@gravity-rail/cli 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { GravityRailClient, PhoneCall } from '@gravity-rail/sdk';
2
- import { E as EnvironmentConfig, C as CredentialsManager } from './cli-client-context-BbyBEGcg.js';
3
- export { a as ConciergeAppContextPayload, b as buildCliConciergeAppContext } from './cli-client-context-BbyBEGcg.js';
2
+ import { E as EnvironmentConfig, C as CredentialsManager, a as CLICredentials } from './cli-client-context-C5l8lg7h.js';
3
+ export { b as ConciergeAppContextPayload, c as buildCliConciergeAppContext } from './cli-client-context-C5l8lg7h.js';
4
4
 
5
5
  /** Metadata extracted from a paginated API response */
6
6
  interface PaginationMeta {
@@ -114,7 +114,12 @@ declare function detectOutputFormat(explicit?: string): OutputFormat;
114
114
  declare function outputData(data: unknown, opts: OutputOptions, columns?: TableColumn<any>[], paginationMeta?: PaginationMeta, supportsAll?: boolean): void;
115
115
  /** Write a single object to stdout in the requested format */
116
116
  declare function outputSingle<T>(data: T, opts: OutputOptions, columns?: TableColumn<T>[]): void;
117
- /** Common column factory helpers for domain files */
117
+ /** Common column factory helpers for domain files.
118
+ *
119
+ * GR app-facing API wire is camelCase. First-party consumers (CLI, lambdas we
120
+ * own) read that shape only — no snake_case dual-read "bandaid". When the API
121
+ * flips a key, convert the consumer; do not carry both. (#19305)
122
+ */
118
123
  declare const COL: {
119
124
  id: () => TableColumn<any>;
120
125
  uuid: () => TableColumn<any>;
@@ -130,12 +135,13 @@ declare function stderr(msg: string): void;
130
135
 
131
136
  interface GlobalOptions {
132
137
  env: string;
133
- realm?: string;
134
138
  /** Override API base URL (also: GRAVITY_RAIL_API_URL env var). */
135
139
  apiUrl?: string;
136
140
  outputFormat?: string;
137
141
  verbose?: boolean;
138
142
  allowWrite?: boolean;
143
+ /** Named credential profile (`--profile` / GRAVITY_RAIL_PROFILE). */
144
+ profile?: string;
139
145
  }
140
146
  interface PublicGlobalOptions {
141
147
  env?: string;
@@ -144,6 +150,8 @@ interface PublicGlobalOptions {
144
150
  outputFormat?: string;
145
151
  verbose?: boolean;
146
152
  allowWrite?: boolean;
153
+ /** Named credential profile (`--profile` / GRAVITY_RAIL_PROFILE). */
154
+ profile?: string;
147
155
  }
148
156
  interface CommandContext {
149
157
  env: string;
@@ -152,15 +160,24 @@ interface CommandContext {
152
160
  verbose: boolean;
153
161
  allowWrite: boolean;
154
162
  credentialsManager: CredentialsManager;
163
+ /** Resolved credential profile for this invocation. */
164
+ profile: string;
155
165
  }
156
166
  interface AuthenticatedContext extends CommandContext {
157
167
  accessToken: string;
158
168
  apiClient: GravityRailClient;
159
- realmWorkspace?: string;
169
+ /** Default workspace UUID from the profile (dev workspace/member profiles). */
170
+ profileWorkspace?: string;
160
171
  }
161
172
  /** Create a base command context (no auth required) */
162
173
  declare function createContext(opts: GlobalOptions): CommandContext;
163
- /** Create an authenticated command context. Tries realm, env var, then cached token. Never auto-triggers OAuth. */
174
+ /**
175
+ * Create an authenticated command context.
176
+ * Order: GRAVITY_RAIL_API_KEY → named/current profile store. Never auto-triggers OAuth.
177
+ *
178
+ * Dev accounts that used to be selected with `--realm` are now named profiles
179
+ * (import with `gr auth import-dev` after provisioning).
180
+ */
164
181
  declare function createAuthenticatedContext(opts: GlobalOptions): Promise<AuthenticatedContext>;
165
182
  /**
166
183
  * Narrow a handler context to `AuthenticatedContext`.
@@ -512,8 +529,47 @@ declare function requireDirectoryTrust(opts: DirectoryTrustOptions): Promise<voi
512
529
 
513
530
  declare function devImportLocalCommand(ctx: AuthenticatedContext, workspace: string): Promise<void>;
514
531
 
515
- declare function loginCommand(ctx: CommandContext): Promise<void>;
516
- declare function logoutCommand(ctx: CommandContext): Promise<void>;
532
+ declare function loginCommand(ctx: CommandContext, args?: ParsedArgs): Promise<void>;
533
+ declare function logoutCommand(ctx: CommandContext, args?: ParsedArgs): Promise<void>;
534
+ /** List stored credential profiles for the current environment. */
535
+ declare function authListCommand(ctx: CommandContext): Promise<void>;
536
+ /** Switch the default profile for subsequent commands. */
537
+ declare function authSwitchCommand(ctx: CommandContext, args: ParsedArgs): Promise<void>;
538
+ /**
539
+ * Import account + workspace/member tokens from dev-realms.json into named profiles.
540
+ * Replaces the old per-invocation `--realm` flag.
541
+ */
542
+ declare function authImportDevCommand(ctx: CommandContext, args?: ParsedArgs): Promise<void>;
543
+
544
+ /**
545
+ * Import local/dev-cloud auth tokens from dev-realms.json into gr CLI profiles.
546
+ *
547
+ * Replaces the old `--realm` flag: after import, use
548
+ * yarn gr whoami --profile superadmin
549
+ * yarn gr tasks list --profile acme-demo/acme-admin
550
+ *
551
+ * dev-realms.json remains the provisioner output (and is still used by e2e /
552
+ * site-template tooling). The gr CLI no longer reads it at command time.
553
+ */
554
+
555
+ interface ImportDevProfilesResult {
556
+ path: string;
557
+ imported: number;
558
+ accountProfiles: number;
559
+ memberProfiles: number;
560
+ storePath: string;
561
+ }
562
+ /** Parse dev-realms.json into profile name → credentials (token + optional workspace). */
563
+ declare function profilesFromDevRealms(data: Record<string, unknown>): Record<string, CLICredentials>;
564
+ /**
565
+ * Import all accounts + workspace/member entries from dev-realms into the
566
+ * credential store for `env`. Overwrites matching profile names; leaves
567
+ * unrelated OAuth profiles intact.
568
+ */
569
+ declare function importDevProfiles(credentialsManager: CredentialsManager, env: string, options?: {
570
+ file?: string;
571
+ preferCurrent?: string;
572
+ }): ImportDevProfilesResult;
517
573
 
518
574
  declare function manageCommand(hctx: CommandHandlerContext): Promise<void>;
519
575
  declare function chatCommand(hctx: CommandHandlerContext): Promise<void>;
@@ -522,4 +578,4 @@ declare function organizationsListCommand(ctx: AuthenticatedContext): Promise<vo
522
578
 
523
579
  declare function whoamiCommand(ctx: AuthenticatedContext): Promise<void>;
524
580
 
525
- export { type ArgDef, AuthRequiredError, type AuthenticatedContext, CLIError, COL, type CommandContext, type CommandDef, type CommandHandlerContext, CommandRegistry, type ConciergeChat, type ConciergeMessage, type DomainDef, type GlobalOptions, LIST_PAGINATION_ARGS, type OutputFormat, type OutputOptions, PAGINATION_ARGS, type PaginationMeta, type ParsedArgs, type PublicGlobalOptions, type TableColumn, authBrowserCommand, chatCommand, commandNeedsJsonBody, conciergeCommand, conciergeOutboundCommand, confirmAccountPhoneVerify, createAuthenticatedContext, createConciergeChat, createContext, createPublicAuthenticatedContext, createPublicContext, crudCommands, detectOutputFormat, devImportLocalCommand, extractPaginationMeta, fetchAllCursorPages, fetchAllPages, formatPaginationWarning, getConciergeChat, getConciergeChatMessages, getStartedCommand, handleError, isCursorPaginatedResponse, isDirectoryTrusted, isLikelySeedPhoneNumber, isListResult, isPagePaginatedResponse, isPaginatedResponse, listConciergeChats, listResult, loginCommand, logoutCommand, manageCommand, organizationsListCommand, originateConciergeCall, originateConciergeSms, outputData, outputSingle, parseArgs, parsePaginationArgs, readJsonInput, registerPublicDomains, requireAuth, requireDirectoryTrust, requireNumber, requireString, resolveVoicePhoneNumberId, simpleCrudCommands, startAccountPhoneVerify, stderr, topLevelCommands, unwrapItems, waitForOutboundPhoneCallOutcome, whoamiCommand };
581
+ export { type ArgDef, AuthRequiredError, type AuthenticatedContext, CLIError, COL, type CommandContext, type CommandDef, type CommandHandlerContext, CommandRegistry, type ConciergeChat, type ConciergeMessage, type DomainDef, type GlobalOptions, LIST_PAGINATION_ARGS, type OutputFormat, type OutputOptions, PAGINATION_ARGS, type PaginationMeta, type ParsedArgs, type PublicGlobalOptions, type TableColumn, authBrowserCommand, authImportDevCommand, authListCommand, authSwitchCommand, chatCommand, commandNeedsJsonBody, conciergeCommand, conciergeOutboundCommand, confirmAccountPhoneVerify, createAuthenticatedContext, createConciergeChat, createContext, createPublicAuthenticatedContext, createPublicContext, crudCommands, detectOutputFormat, devImportLocalCommand, extractPaginationMeta, fetchAllCursorPages, fetchAllPages, formatPaginationWarning, getConciergeChat, getConciergeChatMessages, getStartedCommand, handleError, importDevProfiles, isCursorPaginatedResponse, isDirectoryTrusted, isLikelySeedPhoneNumber, isListResult, isPagePaginatedResponse, isPaginatedResponse, listConciergeChats, listResult, loginCommand, logoutCommand, manageCommand, organizationsListCommand, originateConciergeCall, originateConciergeSms, outputData, outputSingle, parseArgs, parsePaginationArgs, profilesFromDevRealms, readJsonInput, registerPublicDomains, requireAuth, requireDirectoryTrust, requireNumber, requireString, resolveVoicePhoneNumberId, simpleCrudCommands, startAccountPhoneVerify, stderr, topLevelCommands, unwrapItems, waitForOutboundPhoneCallOutcome, whoamiCommand };