@gravity-rail/cli 0.18.1 → 0.21.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, a as CLICredentials } from './cli-client-context-D81-ym1X.js';
3
- export { b as ConciergeAppContextPayload, c as buildCliConciergeAppContext } from './cli-client-context-D81-ym1X.js';
2
+ import { E as EnvironmentConfig, C as CredentialsManager, a as CLICredentials } from './cli-client-context-dl4gw0Fb.js';
3
+ export { b as ConciergeAppContextPayload, c as buildCliConciergeAppContext } from './cli-client-context-dl4gw0Fb.js';
4
4
 
5
5
  /** Metadata extracted from a paginated API response */
6
6
  interface PaginationMeta {
@@ -141,6 +141,27 @@ declare const COL: {
141
141
  };
142
142
  /** Write a status/progress message to stderr (never pollutes stdout) */
143
143
  declare function stderr(msg: string): void;
144
+ /**
145
+ * Wait until everything written to stdout has actually reached the OS.
146
+ *
147
+ * Call this before `process.exit()`. `process.exit` does not flush a pending
148
+ * asynchronous write, and stdout **is** asynchronous whenever it is a pipe
149
+ * (Node only makes it synchronous for files and TTYs), so a large piped payload
150
+ * is silently cut at the pipe buffer — 8KB on Linux, 64KB elsewhere.
151
+ *
152
+ * `writableNeedDrain` is the wrong probe and was the bug: it only goes true
153
+ * once the buffered amount exceeds `highWaterMark` (16KB by default). A 10KB
154
+ * JSON document sits fully buffered with `needDrain === false`, so the guard
155
+ * passed and `process.exit` discarded the tail. Observed as
156
+ * `json.decoder.JSONDecodeError: Expecting ':' delimiter` at exactly char 8192
157
+ * in a script reading `gr admin workspaces list -o json` through a pipe, while
158
+ * the same command redirected to a file was complete and valid.
159
+ *
160
+ * The reliable signal is the write callback, which fires only after the data is
161
+ * handed off. An empty write queues behind whatever is already pending, so its
162
+ * callback is a barrier for all of it.
163
+ */
164
+ declare function flushStdout(): Promise<void>;
144
165
 
145
166
  interface GlobalOptions {
146
167
  env: string;
@@ -330,6 +351,14 @@ declare class AuthRequiredError extends CLIError {
330
351
  }
331
352
  declare function handleError(err: unknown): never;
332
353
 
354
+ /** Tagged payload when ``--file`` points at a workspace export ZIP. */
355
+ declare const WORKSPACE_EXPORT_ZIP = "__grWorkspaceExportZip";
356
+ type WorkspaceExportZipInput = {
357
+ [WORKSPACE_EXPORT_ZIP]: true;
358
+ bytes: Buffer;
359
+ path: string;
360
+ };
361
+ declare function isWorkspaceExportZip(data: unknown): data is WorkspaceExportZipInput;
333
362
  /**
334
363
  * Whether the CLI should read --data / --file / stdin for this command.
335
364
  *
@@ -648,4 +677,4 @@ declare function organizationsListCommand(ctx: AuthenticatedContext): Promise<vo
648
677
 
649
678
  declare function whoamiCommand(ctx: AuthenticatedContext): Promise<void>;
650
679
 
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 };
680
+ 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, WORKSPACE_EXPORT_ZIP, type WorkspaceExportZipInput, authBrowserCommand, authImportDevCommand, authListCommand, authSwitchCommand, chatCommand, commandNeedsJsonBody, conciergeCommand, conciergeOutboundCommand, confirmAccountPhoneVerify, createAuthenticatedContext, createConciergeChat, createContext, createPublicAuthenticatedContext, createPublicContext, crudCommands, detectOutputFormat, devImportLocalCommand, extractPaginationMeta, fetchAllCursorPages, fetchAllPages, flushStdout, formatPaginationWarning, getConciergeChat, getConciergeChatMessages, getStartedCommand, handleError, importDevProfiles, isCursorPaginatedResponse, isDirectoryTrusted, isLikelySeedPhoneNumber, isListResult, isPagePaginatedResponse, isPaginatedResponse, isWorkspaceExportZip, 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 };