@gravity-rail/cli 0.17.0 → 0.18.1
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/README.md +32 -0
- package/dist/{account-verify-phone-Q2NIRSX4.js → account-verify-phone-LKTAJQD7.js} +2 -2
- package/dist/{chunk-EITDLX75.js → chunk-RO6EEXTM.js} +47 -5
- package/dist/chunk-RO6EEXTM.js.map +1 -0
- package/dist/gr.js +2917 -3812
- package/dist/gr.js.map +1 -1
- package/dist/lib.d.ts +71 -1
- package/dist/lib.js +1340 -138
- package/dist/lib.js.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-EITDLX75.js.map +0 -1
- /package/dist/{account-verify-phone-Q2NIRSX4.js.map → account-verify-phone-LKTAJQD7.js.map} +0 -0
package/dist/lib.d.ts
CHANGED
|
@@ -89,6 +89,15 @@ declare function listResult(data: unknown, supportsAll?: boolean): ListResult;
|
|
|
89
89
|
type OutputFormat = 'json' | 'jsonl' | 'table';
|
|
90
90
|
interface OutputOptions {
|
|
91
91
|
outputFormat: OutputFormat;
|
|
92
|
+
/**
|
|
93
|
+
* jq filter applied to the serialised JSON before it reaches stdout.
|
|
94
|
+
*
|
|
95
|
+
* Setting this implies JSON output regardless of `outputFormat`: a filter
|
|
96
|
+
* over a rendered table is meaningless, and silently filtering nothing is
|
|
97
|
+
* worse than ignoring the flag. See `lib/jq.ts` for why the filter lives
|
|
98
|
+
* here rather than in a shell pipe.
|
|
99
|
+
*/
|
|
100
|
+
jq?: string;
|
|
92
101
|
}
|
|
93
102
|
interface TableColumn<T> {
|
|
94
103
|
header: string;
|
|
@@ -138,6 +147,7 @@ interface GlobalOptions {
|
|
|
138
147
|
/** Override API base URL (also: GRAVITY_RAIL_API_URL env var). */
|
|
139
148
|
apiUrl?: string;
|
|
140
149
|
outputFormat?: string;
|
|
150
|
+
jq?: string;
|
|
141
151
|
verbose?: boolean;
|
|
142
152
|
allowWrite?: boolean;
|
|
143
153
|
/** Named credential profile (`--profile` / GRAVITY_RAIL_PROFILE). */
|
|
@@ -148,6 +158,7 @@ interface PublicGlobalOptions {
|
|
|
148
158
|
apiUrl?: string;
|
|
149
159
|
frontendUrl?: string;
|
|
150
160
|
outputFormat?: string;
|
|
161
|
+
jq?: string;
|
|
151
162
|
verbose?: boolean;
|
|
152
163
|
allowWrite?: boolean;
|
|
153
164
|
/** Named credential profile (`--profile` / GRAVITY_RAIL_PROFILE). */
|
|
@@ -157,6 +168,8 @@ interface CommandContext {
|
|
|
157
168
|
env: string;
|
|
158
169
|
envConfig: EnvironmentConfig;
|
|
159
170
|
outputFormat: OutputFormat;
|
|
171
|
+
/** `--jq` filter, applied to JSON output. See `lib/jq.ts`. */
|
|
172
|
+
jq?: string;
|
|
160
173
|
verbose: boolean;
|
|
161
174
|
allowWrite: boolean;
|
|
162
175
|
credentialsManager: CredentialsManager;
|
|
@@ -251,6 +264,63 @@ declare function requireNumber(args: ParsedArgs, key: string): number;
|
|
|
251
264
|
declare const PAGINATION_ARGS: ArgDef[];
|
|
252
265
|
declare function parseArgs(defs: ArgDef[], argv: string[]): ParsedArgs;
|
|
253
266
|
|
|
267
|
+
/**
|
|
268
|
+
* The global-option parser both `gr` binaries share.
|
|
269
|
+
*
|
|
270
|
+
* `packages/cli` is canonical. `packages/gr-cli` is a developer-only build that
|
|
271
|
+
* layers extra domains and a few dev conveniences on top and is meant to change
|
|
272
|
+
* *nothing* about behaviour. That contract was not expressible while each entry
|
|
273
|
+
* point carried its own copy of this parser, and the copies had already drifted:
|
|
274
|
+
*
|
|
275
|
+
* - `--api-url=x` and `-o=json` (inline `=` form) worked in the developer build
|
|
276
|
+
* and threw "Unknown flag" in the canonical one.
|
|
277
|
+
* - `--jq` had to be implemented twice (PR #23017), which is what surfaced the
|
|
278
|
+
* duplication in the first place.
|
|
279
|
+
*
|
|
280
|
+
* Anything genuinely build-specific is passed in via {@link GlobalOptionsSpec}
|
|
281
|
+
* rather than forked here. If a future difference cannot be expressed as one of
|
|
282
|
+
* those knobs, that is the signal it does not belong in only one binary.
|
|
283
|
+
*/
|
|
284
|
+
interface ParsedGlobalOptions {
|
|
285
|
+
env: string;
|
|
286
|
+
profile?: string;
|
|
287
|
+
apiUrl?: string;
|
|
288
|
+
outputFormat?: string;
|
|
289
|
+
jq?: string;
|
|
290
|
+
verbose: boolean;
|
|
291
|
+
allowWrite: boolean;
|
|
292
|
+
}
|
|
293
|
+
interface GlobalOptionsSpec {
|
|
294
|
+
/**
|
|
295
|
+
* Default when `--env` is absent.
|
|
296
|
+
*
|
|
297
|
+
* The public CLI defaults to `prod` because public consumers cannot reach
|
|
298
|
+
* dev or staging (#15819); the developer build defaults to `dev`. This is a
|
|
299
|
+
* legitimate difference, which is exactly why it is a parameter.
|
|
300
|
+
*/
|
|
301
|
+
defaultEnv: string;
|
|
302
|
+
/**
|
|
303
|
+
* Flags the build recognises and consumes itself, beyond the shared set.
|
|
304
|
+
*
|
|
305
|
+
* Return `true` to mean "handled, keep scanning"; the handler owns any side
|
|
306
|
+
* effect, including exiting. Return `false` for a flag you do not claim, and
|
|
307
|
+
* the shared parser continues as though the hook were absent.
|
|
308
|
+
*
|
|
309
|
+
* `readValue()` ADVANCES the scan when it consumes the following token, so
|
|
310
|
+
* calling it and then returning `false` would swallow an argument this hook
|
|
311
|
+
* never claimed. Decide on `flag` first; only read a value once you are
|
|
312
|
+
* committed to returning `true`. The parser cannot enforce that for you —
|
|
313
|
+
* it is why the rule is stated here rather than left to be discovered.
|
|
314
|
+
*/
|
|
315
|
+
extraFlag?: (flag: string, readValue: () => string | undefined) => boolean;
|
|
316
|
+
}
|
|
317
|
+
interface GlobalOptionsResult {
|
|
318
|
+
opts: ParsedGlobalOptions;
|
|
319
|
+
commandWords: string[];
|
|
320
|
+
rest: string[];
|
|
321
|
+
}
|
|
322
|
+
declare function parseGlobalOptions(argv: string[], spec: GlobalOptionsSpec): GlobalOptionsResult;
|
|
323
|
+
|
|
254
324
|
declare class CLIError extends Error {
|
|
255
325
|
exitCode: number;
|
|
256
326
|
constructor(message: string, exitCode?: number);
|
|
@@ -578,4 +648,4 @@ declare function organizationsListCommand(ctx: AuthenticatedContext): Promise<vo
|
|
|
578
648
|
|
|
579
649
|
declare function whoamiCommand(ctx: AuthenticatedContext): Promise<void>;
|
|
580
650
|
|
|
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 };
|
|
651
|
+
export { type ArgDef, AuthRequiredError, type AuthenticatedContext, CLIError, COL, type CommandContext, type CommandDef, type CommandHandlerContext, CommandRegistry, type ConciergeChat, type ConciergeMessage, type DomainDef, type GlobalOptions, type GlobalOptionsResult, type GlobalOptionsSpec, LIST_PAGINATION_ARGS, type OutputFormat, type OutputOptions, PAGINATION_ARGS, type PaginationMeta, type ParsedArgs, type ParsedGlobalOptions, 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, parseGlobalOptions, parsePaginationArgs, profilesFromDevRealms, readJsonInput, registerPublicDomains, requireAuth, requireDirectoryTrust, requireNumber, requireString, resolveVoicePhoneNumberId, simpleCrudCommands, startAccountPhoneVerify, stderr, topLevelCommands, unwrapItems, waitForOutboundPhoneCallOutcome, whoamiCommand };
|