import { Command } from '@oclif/core'; import { OAuthCommand } from './oauth-command.js'; import type { AccountManagerClient } from '../clients/am-api.js'; /** * Base command for Account Manager operations. * * Extends OAuthCommand with Account Manager client setup for users, roles, and organizations. * Provides enhanced error messages with role-specific guidance when authentication fails. * * @example * export default class UserList extends AmCommand { * async run(): Promise { * const users = await this.accountManagerClient.listUsers({}); * // ... * } * } * * @example * export default class OrgList extends AmCommand { * async run(): Promise { * const orgs = await this.accountManagerClient.listOrgs(); * // ... * } * } */ export declare abstract class AmCommand extends OAuthCommand { protected getDefaultClientId(): string; private _accountManagerClient?; private _authStrategy?; /** * Gets the auth method type that was used, based on the stored strategy. */ protected get authMethodUsed(): 'implicit' | 'client-credentials' | 'jwt' | 'stateful' | undefined; /** * Gets the unified Account Manager client, creating it if necessary. * This provides direct access to all Account Manager API methods (users, roles, orgs). * * @example * const client = this.accountManagerClient; * const users = await client.listUsers({}); * const roles = await client.listRoles({}); * const orgs = await client.listOrgs(); * const user = await client.getUser('user-id'); * const role = await client.getRole('bm-admin'); * const org = await client.getOrg('org-id'); */ protected get accountManagerClient(): AccountManagerClient; /** * Override catch() to detect auth errors and append contextual AM role guidance. */ protected catch(err: Error & { exitCode?: number; }): Promise; /** * Builds a contextual suggestion message based on the auth method and AM subtopic. */ private getAuthErrorSuggestion; /** * Gets the AM subtopic from the command ID (e.g., 'am:users:list' → 'users'). */ private getAmSubtopic; /** * Attempts to extract roles from the cached JWT token synchronously. */ private getJwtRolesInfo; /** * Suggestion for client-credentials auth failures. */ private getClientCredentialsSuggestion; /** * Suggestion for implicit auth failures. */ private getImplicitSuggestion; }