@shardflux/cli 0.4.1 → 0.5.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/CHANGELOG.md +226 -0
- package/README.md +517 -34
- package/dist/account-args.d.ts +13 -0
- package/dist/account-args.js +425 -0
- package/dist/account-commands.d.ts +18 -0
- package/dist/account-commands.js +1657 -0
- package/dist/args.d.ts +15 -3
- package/dist/args.js +292 -41
- package/dist/bin.js +5 -16
- package/dist/browser.d.ts +7 -0
- package/dist/browser.js +39 -0
- package/dist/commands.d.ts +69 -5
- package/dist/commands.js +440 -30
- package/dist/credentials.d.ts +77 -0
- package/dist/credentials.js +217 -0
- package/dist/errors.d.ts +63 -11
- package/dist/errors.js +114 -21
- package/dist/format.d.ts +89 -6
- package/dist/format.js +479 -10
- package/dist/handlers.d.ts +2 -0
- package/dist/handlers.js +7 -0
- package/dist/index.d.ts +19 -7
- package/dist/index.js +13 -6
- package/dist/input.d.ts +25 -0
- package/dist/input.js +167 -0
- package/dist/main.d.ts +16 -2
- package/dist/main.js +477 -31
- package/dist/update-check.d.ts +64 -0
- package/dist/update-check.js +128 -0
- package/package.json +3 -3
package/dist/format.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* `--json` output is the API's own objects (see README "JSON output"), so
|
|
4
4
|
* these functions only shape what people read.
|
|
5
5
|
*/
|
|
6
|
-
import type { AgentSession, DraftState, FileList, Operation, Secret, SecretAccessEvent, SecretVersion, TemplateBuild, TemplateDetail, TemplateDiffEntry, TemplateDraft, TemplateFileEntry, TemplateLanguages, TemplatePackagePage, TemplateSettings, TemplateSummary, WorkspaceChange, WorkspaceSecretBindings, WorkspaceView } from '@shardflux/sdk';
|
|
6
|
+
import type { AgentSession, ApiKey, AuditEvent, AuthSessionInfo, BillingCatalog, BillingInvoicePage, BillingSubscription, DataExport, DraftState, ExecutionChange, ExecutionResult, FileInfo, EgressPolicyVersion, Invitation, Member, Organization, Project, ProjectEgressPolicy, Volume, VolumeAttachment, WorkspaceEgressPolicy, FileList, FileSearchResponse, Operation, Secret, SecretAccessEvent, SecretVersion, SpendPolicy, SuspendRequest, TemplateBuild, TemplateDetail, TemplateDiffEntry, TemplateDraft, TemplateFileEntry, TemplateLanguages, TemplatePackagePage, TemplateSettings, TemplateSummary, WorkspaceChange, WorkspaceSecretBindings, WorkspaceView } from '@shardflux/sdk';
|
|
7
7
|
import type { ErrorInfo } from './errors.js';
|
|
8
8
|
export declare function json(value: unknown): string;
|
|
9
9
|
export declare function table(headers: readonly string[], rows: readonly (readonly string[])[]): string;
|
|
@@ -14,7 +14,9 @@ export declare function time(iso: string | null | undefined): string;
|
|
|
14
14
|
export declare function pairs(obj: Record<string, unknown> | null | undefined): string;
|
|
15
15
|
export declare function operationSummary(op: Operation | null | undefined): string;
|
|
16
16
|
export declare const WORKSPACE_HEADERS: readonly ["ID", "KEY", "STATE", "DESIRED", "TEMPLATE", "OPERATION", "CREATED"];
|
|
17
|
-
/**
|
|
17
|
+
/** `file_first` as people write it (`--mode file-first`). */
|
|
18
|
+
export declare function modeText(mode: WorkspaceView['mode'] | undefined): string;
|
|
19
|
+
/** Observed state plus what sets the workspace apart: file-first, session, draft or test instance, and how it ended. */
|
|
18
20
|
export declare function workspaceState(w: WorkspaceView): string;
|
|
19
21
|
export declare function workspaceRow(w: WorkspaceView): string[];
|
|
20
22
|
export declare function workspaceTable(ws: readonly WorkspaceView[]): string;
|
|
@@ -26,11 +28,25 @@ export declare function isReady(w: WorkspaceView): boolean;
|
|
|
26
28
|
export declare function startupText(s: WorkspaceView['startup'] | undefined): string | null;
|
|
27
29
|
/** The failed step's output tail, indented, after the detail block (empty otherwise). */
|
|
28
30
|
export declare function startupTail(s: WorkspaceView['startup'] | undefined): string;
|
|
31
|
+
/** A pending suspend-when-idle request in one line (0.5.1; contracts §20.6). */
|
|
32
|
+
export declare function suspendRequestText(r: SuspendRequest): string;
|
|
33
|
+
/** `shard ws suspend --when-idle`: the recorded request, or the suspend already in progress. */
|
|
34
|
+
export declare function suspendWhenIdleText(w: {
|
|
35
|
+
key: string;
|
|
36
|
+
id: string;
|
|
37
|
+
}, r: {
|
|
38
|
+
suspend_request: SuspendRequest | null;
|
|
39
|
+
operation: Operation | null;
|
|
40
|
+
}): string;
|
|
29
41
|
export declare function workspaceDetail(w: WorkspaceView): string;
|
|
30
42
|
export declare const OPERATION_HEADERS: readonly ["ID", "KIND", "STATE", "REASON", "CREATED", "COMPLETED"];
|
|
31
43
|
export declare function operationTable(ops: readonly Operation[]): string;
|
|
32
44
|
export declare function operationDetail(op: Operation): string;
|
|
33
45
|
export declare function sessionTable(sessions: readonly AgentSession[]): string;
|
|
46
|
+
/** `files stat`: one path's metadata; the revision only when requested and returned. */
|
|
47
|
+
export declare function fileInfoText(f: FileInfo): string;
|
|
48
|
+
/** `files search`: grep-style `path:line:column: text`, context lines as `path-line- text`. */
|
|
49
|
+
export declare function searchText(r: FileSearchResponse): string;
|
|
34
50
|
export declare function fileTable(list: FileList): string;
|
|
35
51
|
export declare function secretTable(rows: readonly Secret[]): string;
|
|
36
52
|
/** Secret metadata; there is no value to show (values are write-only). */
|
|
@@ -38,16 +54,26 @@ export declare function secretDetail(s: Secret): string;
|
|
|
38
54
|
export declare function secretVersionTable(rows: readonly SecretVersion[]): string;
|
|
39
55
|
export declare function secretAccessTable(rows: readonly SecretAccessEvent[]): string;
|
|
40
56
|
export declare function bindingsText(b: WorkspaceSecretBindings): string;
|
|
57
|
+
/** Minor units as money (the overage block): `$3.00` for usd, else `3.00 EUR`. A fractional minor amount (a sub-cent rate) keeps its digits. */
|
|
58
|
+
export declare function capMoney(minor: unknown, currency: string): string;
|
|
41
59
|
/**
|
|
42
60
|
* The usage summary (GET /v1/organizations/{id}/usage/summary): plan, period, measurement
|
|
43
|
-
* freshness, then meters and allowances as tables
|
|
61
|
+
* freshness, then meters and allowances as tables (cap state `overage` past an allowance while opt-in overage is on),
|
|
62
|
+
* then the overage block. Columns absent from the response are omitted.
|
|
44
63
|
*/
|
|
45
64
|
export declare function usageText(summary: unknown): string;
|
|
46
65
|
/**
|
|
47
|
-
*
|
|
48
|
-
* operation
|
|
66
|
+
* The `shard feedback` command a failed command suggests (0.5.0+), with the error's request id and code so the founder
|
|
67
|
+
* can find the logs (a failed operation's or execution's own error code, e.g. capacity_unavailable); the agent fills in
|
|
68
|
+
* the text.
|
|
49
69
|
*/
|
|
50
|
-
export declare function
|
|
70
|
+
export declare function feedbackCommand(e: ErrorInfo): string;
|
|
71
|
+
/**
|
|
72
|
+
* One stderr line: `error: <message> [code=... status=... request_id=...]` plus a hint when there is one, and the
|
|
73
|
+
* `feedback:` line (the command to report it) when given. A failed operation or execution also shows
|
|
74
|
+
* `retryable=true|false`.
|
|
75
|
+
*/
|
|
76
|
+
export declare function errorText(e: ErrorInfo, hint?: string, feedback?: string): string;
|
|
51
77
|
export declare function templateTable(rows: readonly TemplateSummary[]): string;
|
|
52
78
|
/** Permission bits as the four-digit octal `ls -l` users read (e.g. 0755). */
|
|
53
79
|
export declare function octal(mode: number): string;
|
|
@@ -66,3 +92,60 @@ export declare function packageTable(page: TemplatePackagePage): string;
|
|
|
66
92
|
export declare function templateDetailText(t: TemplateDetail): string;
|
|
67
93
|
/** A version's settings (contracts §24.3), one line per part. */
|
|
68
94
|
export declare function settingsText(s: TemplateSettings): string;
|
|
95
|
+
/** How many changed paths the human output lists before "... N more" (--json lists every one the result has). */
|
|
96
|
+
export declare const MAX_CHANGED_SHOWN = 100;
|
|
97
|
+
/**
|
|
98
|
+
* What an execution changed, one `A|M|D path` line each (the letters of a short VCS status; a directory ends in `/`), at
|
|
99
|
+
* most `max`; then how many more the result has, and a note when the cell listed only the first 10,000.
|
|
100
|
+
*/
|
|
101
|
+
export declare function changedText(changed: readonly ExecutionChange[], changedTruncated: boolean, max?: number): string;
|
|
102
|
+
/** The execution's state: `succeeded (exit code 0)`, `failed: <message> (<reason>)`, `running`. */
|
|
103
|
+
export declare function executionStateText(r: ExecutionResult): string;
|
|
104
|
+
/**
|
|
105
|
+
* The summary `shard ws exec -v` prints after a file-first command's output, and `shard executions get` with it (on
|
|
106
|
+
* stderr): execution id, state and exit status, base -> tree revision, `replayed` when true, truncated output, timings
|
|
107
|
+
* (`key=value`: queue_ms, run_ms, publish_ms, total_ms and the host's), then what changed.
|
|
108
|
+
*/
|
|
109
|
+
export declare function executionSummary(r: ExecutionResult, maxChanged?: number, opts?: {
|
|
110
|
+
replayed?: boolean;
|
|
111
|
+
}): string;
|
|
112
|
+
/**
|
|
113
|
+
* The `--json` document of an execution (`shard ws exec` on a file-first workspace, `shard executions get`): the cell's
|
|
114
|
+
* ExecutionResult with stdout/stderr as UTF-8 text (like the processful exec's), plus `stdout_base64` / `stderr_base64`
|
|
115
|
+
* with the exact bytes when a stream is not valid UTF-8 (its text then has U+FFFD for the invalid sequences).
|
|
116
|
+
*/
|
|
117
|
+
export declare function executionJson(r: ExecutionResult): Record<string, unknown>;
|
|
118
|
+
export declare function orgTable(rows: readonly Organization[], defaultId: string | null): string;
|
|
119
|
+
export declare function projectTable(rows: readonly Project[], defaultId: string | null): string;
|
|
120
|
+
/** active, expired or revoked (as the web app shows it). */
|
|
121
|
+
export declare function keyStatus(k: Pick<ApiKey, 'revoked_at' | 'expires_at'>, now?: number): 'active' | 'expired' | 'revoked';
|
|
122
|
+
export declare function toolsText(tools: readonly string[]): string;
|
|
123
|
+
export declare function apiKeyTable(rows: readonly ApiKey[], savedId: string | null): string;
|
|
124
|
+
export declare function memberTable(rows: readonly Member[]): string;
|
|
125
|
+
export declare function invitationTable(rows: readonly Invitation[]): string;
|
|
126
|
+
export declare function authSessionTable(rows: readonly AuthSessionInfo[]): string;
|
|
127
|
+
/** 900 + "usd" -> "9.00 USD" (minor units; zero-decimal currencies shown as whole numbers). */
|
|
128
|
+
/**
|
|
129
|
+
* A usage time series (GET .../usage or /v1/workspaces/{id}/usage): the range and freshness, then one row per bucket
|
|
130
|
+
* and meter. `FINAL` is no while the bucket can still change (the ledger finalizes hours after they end).
|
|
131
|
+
*/
|
|
132
|
+
export declare function usageSeriesText(series: unknown): string;
|
|
133
|
+
/** The period estimate (GET .../usage/estimate): the bill so far and where each allowance is heading. */
|
|
134
|
+
export declare function usageEstimateText(estimate: unknown): string;
|
|
135
|
+
export declare function money(amountMinor: number, currency: string): string;
|
|
136
|
+
export declare function planTable(catalog: BillingCatalog): string;
|
|
137
|
+
export declare function billingStatusText(s: BillingSubscription, org: Pick<Organization, 'name' | 'slug'>): string;
|
|
138
|
+
export declare function invoiceTable(rows: readonly BillingInvoicePage['data'][number][]): string;
|
|
139
|
+
export declare function auditTable(rows: readonly AuditEvent[]): string;
|
|
140
|
+
export declare function dataExportText(e: DataExport, out: string): string;
|
|
141
|
+
export declare function volumeTable(rows: readonly Volume[]): string;
|
|
142
|
+
export declare function volumeDetail(v: Volume): string;
|
|
143
|
+
export declare function attachmentTable(rows: readonly VolumeAttachment[]): string;
|
|
144
|
+
export declare function projectEgressText(p: ProjectEgressPolicy): string;
|
|
145
|
+
export declare function workspaceEgressText(w: WorkspaceEgressPolicy): string;
|
|
146
|
+
export declare function egressVersionTable(rows: readonly EgressPolicyVersion[]): string;
|
|
147
|
+
/**
|
|
148
|
+
* The spend policy's overage settings for people (GET/PUT /v1/organizations/{id}/spend-policy): the state, the spend
|
|
149
|
+
* cap and its bounds, the rates, and the next step. `saved` adds the version the change was saved as.
|
|
150
|
+
*/
|
|
151
|
+
export declare function overagePolicyText(p: SpendPolicy, orgName: string, saved?: boolean): string;
|