@somewhere-cloud/cli 0.38.48 → 0.38.51

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.
Files changed (142) hide show
  1. package/dist/commands/advisor.d.ts +9 -0
  2. package/dist/commands/ai.d.ts +2 -0
  3. package/dist/commands/api.d.ts +14 -0
  4. package/dist/commands/auth.d.ts +30 -0
  5. package/dist/commands/browser.d.ts +247 -0
  6. package/dist/commands/call.d.ts +22 -0
  7. package/dist/commands/catalog.d.ts +16 -0
  8. package/dist/commands/check.d.ts +114 -0
  9. package/dist/commands/claim.d.ts +5 -0
  10. package/dist/commands/cron.d.ts +14 -0
  11. package/dist/commands/db-rows.d.ts +2 -0
  12. package/dist/commands/db.d.ts +2 -0
  13. package/dist/commands/deploy.d.ts +235 -0
  14. package/dist/commands/dev.d.ts +171 -0
  15. package/dist/commands/docs.d.ts +85 -0
  16. package/dist/commands/email.d.ts +8 -0
  17. package/dist/commands/env.d.ts +2 -0
  18. package/dist/commands/errors.d.ts +2 -0
  19. package/dist/commands/feedback.d.ts +2 -0
  20. package/dist/commands/fs.d.ts +2 -0
  21. package/dist/commands/git.d.ts +2 -0
  22. package/dist/commands/grep.d.ts +2 -0
  23. package/dist/commands/hooks.d.ts +2 -0
  24. package/dist/commands/init.d.ts +17 -0
  25. package/dist/commands/link.d.ts +8 -0
  26. package/dist/commands/lint.d.ts +2 -0
  27. package/dist/commands/logs.d.ts +2 -0
  28. package/dist/commands/mcp.d.ts +4 -0
  29. package/dist/commands/open.d.ts +2 -0
  30. package/dist/commands/postgres.d.ts +2 -0
  31. package/dist/commands/project.d.ts +8 -0
  32. package/dist/commands/promote.d.ts +28 -0
  33. package/dist/commands/pull.d.ts +2 -0
  34. package/dist/commands/restore.d.ts +5 -0
  35. package/dist/commands/rollback.d.ts +21 -0
  36. package/dist/commands/run.d.ts +2 -0
  37. package/dist/commands/skills.d.ts +2 -0
  38. package/dist/commands/status.d.ts +27 -0
  39. package/dist/commands/support.d.ts +2 -0
  40. package/dist/commands/tasks.d.ts +2 -0
  41. package/dist/commands/test-users.d.ts +4 -0
  42. package/dist/commands/test.d.ts +2 -0
  43. package/dist/commands/test.js +74 -0
  44. package/dist/commands/test.js.map +1 -0
  45. package/dist/commands/typecheck.d.ts +9 -0
  46. package/dist/commands/update.d.ts +25 -0
  47. package/dist/commands/upgrade.d.ts +12 -0
  48. package/dist/commands/usage.d.ts +2 -0
  49. package/dist/commands/verify.d.ts +419 -0
  50. package/dist/index.d.ts +1 -0
  51. package/dist/index.js +2 -0
  52. package/dist/index.js.map +1 -1
  53. package/dist/lib/advisor-context.d.ts +20 -0
  54. package/dist/lib/advisor-runs.d.ts +26 -0
  55. package/dist/lib/agent-hooks.d.ts +74 -0
  56. package/dist/lib/allowed-origins.d.ts +11 -0
  57. package/dist/lib/auth.d.ts +12 -0
  58. package/dist/lib/base-files.d.ts +31 -0
  59. package/dist/lib/browser-actions.d.ts +106 -0
  60. package/dist/lib/browser-flow-preflight.d.ts +6 -0
  61. package/dist/lib/browser-refusal.d.ts +17 -0
  62. package/dist/lib/browser-run.d.ts +102 -0
  63. package/dist/lib/build-errors.d.ts +24 -0
  64. package/dist/lib/chrome.d.ts +66 -0
  65. package/dist/lib/claim-handoff.d.ts +11 -0
  66. package/dist/lib/client.d.ts +150 -0
  67. package/dist/lib/config.d.ts +125 -0
  68. package/dist/lib/declared-data.d.ts +50 -0
  69. package/dist/lib/deploy-check.d.ts +56 -0
  70. package/dist/lib/device-login.d.ts +41 -0
  71. package/dist/lib/device.d.ts +2 -0
  72. package/dist/lib/envfile-write.d.ts +17 -0
  73. package/dist/lib/files.d.ts +111 -0
  74. package/dist/lib/frontend-dev.d.ts +28 -0
  75. package/dist/lib/generic-lint.d.ts +9 -0
  76. package/dist/lib/help-summary.d.ts +2 -0
  77. package/dist/lib/http.d.ts +9 -0
  78. package/dist/lib/init-agent-guide.d.ts +13 -0
  79. package/dist/lib/init-feature-template.d.ts +8 -0
  80. package/dist/lib/init-features.d.ts +50 -0
  81. package/dist/lib/init-green-template.d.ts +2 -0
  82. package/dist/lib/init-install.d.ts +14 -0
  83. package/dist/lib/init-scaffold.d.ts +44 -0
  84. package/dist/lib/init-template.d.ts +2 -0
  85. package/dist/lib/init-test-template.d.ts +2 -0
  86. package/dist/lib/init-ui-kit.d.ts +8 -0
  87. package/dist/lib/last-run.d.ts +38 -0
  88. package/dist/lib/link-hint.d.ts +5 -0
  89. package/dist/lib/next-actions.d.ts +48 -0
  90. package/dist/lib/notify/index.d.ts +18 -0
  91. package/dist/lib/notify/providers/update.d.ts +45 -0
  92. package/dist/lib/notify/types.d.ts +25 -0
  93. package/dist/lib/open.d.ts +1 -0
  94. package/dist/lib/output.d.ts +61 -0
  95. package/dist/lib/platform-command.d.ts +6 -0
  96. package/dist/lib/platform-contract.d.ts +26 -0
  97. package/dist/lib/platform-tools.d.ts +77 -0
  98. package/dist/lib/playwright-fixtures.d.ts +19 -0
  99. package/dist/lib/playwright-fixtures.js +140 -0
  100. package/dist/lib/playwright-fixtures.js.map +1 -0
  101. package/dist/lib/post-live-render.d.ts +48 -0
  102. package/dist/lib/project-notices.d.ts +18 -0
  103. package/dist/lib/project-pin.d.ts +57 -0
  104. package/dist/lib/project-ref.d.ts +32 -0
  105. package/dist/lib/project-urls.d.ts +18 -0
  106. package/dist/lib/promote-handoff.d.ts +65 -0
  107. package/dist/lib/promote-outcome.d.ts +98 -0
  108. package/dist/lib/publish-surface.d.ts +8 -0
  109. package/dist/lib/repro-packet.d.ts +35 -0
  110. package/dist/lib/scaffold.d.ts +46 -0
  111. package/dist/lib/skills-pack.d.ts +81 -0
  112. package/dist/lib/skills-pack.generated.d.ts +2 -0
  113. package/dist/lib/source-lint.d.ts +42 -0
  114. package/dist/lib/spinner.d.ts +14 -0
  115. package/dist/lib/startup-notice.d.ts +23 -0
  116. package/dist/lib/surface-counts.d.ts +88 -0
  117. package/dist/lib/temp-auth.d.ts +53 -0
  118. package/dist/lib/terminal-text.d.ts +10 -0
  119. package/dist/lib/test-identities.d.ts +122 -0
  120. package/dist/lib/test-identities.js +1 -1
  121. package/dist/lib/test-identities.js.map +1 -1
  122. package/dist/lib/test-reporter.d.ts +13 -0
  123. package/dist/lib/test-reporter.js +28 -0
  124. package/dist/lib/test-reporter.js.map +1 -0
  125. package/dist/lib/typecheck-version.d.ts +1 -0
  126. package/dist/lib/typecheck.d.ts +136 -0
  127. package/dist/lib/update-security.d.ts +25 -0
  128. package/dist/lib/vendor/deploy-paths.d.ts +21 -0
  129. package/dist/lib/vendor/repro-guidance.d.ts +111 -0
  130. package/dist/lib/verify-keep.d.ts +92 -0
  131. package/dist/lib/verify-progress.d.ts +2 -0
  132. package/dist/lib/verify-report.d.ts +4 -0
  133. package/dist/lib/version.d.ts +1 -0
  134. package/dist/testing.d.ts +37 -0
  135. package/dist/testing.js +2 -0
  136. package/dist/testing.js.map +1 -1
  137. package/dist/types.d.ts +104 -0
  138. package/npm-shrinkwrap.json +48 -2
  139. package/package.json +14 -3
  140. package/runtime/PLATFORM-SOURCE.json +1 -1
  141. package/runtime/SOURCE-LINT-VENDOR.json +1 -1
  142. package/src/testing.ts +4 -1
@@ -0,0 +1,9 @@
1
+ import { Command } from 'commander';
2
+ import { callPlatformHelpTool } from '../lib/platform-tools.js';
3
+ import { type AdvisorContext } from '../lib/advisor-context.js';
4
+ export { callPlatformHelpTool };
5
+ /** Anonymous callers cannot authorize a linked project. Keep explicitly
6
+ * attached, redacted local context while removing that private identity. */
7
+ export declare function anonymousAdvisorContext(context: AdvisorContext | undefined): AdvisorContext | undefined;
8
+ export declare function callAnonymousAdvisor(question: string, context?: AdvisorContext): Promise<string>;
9
+ export declare function registerAdvisor(program: Command): void;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerAi(program: Command): void;
@@ -0,0 +1,14 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerApi(program: Command): void;
3
+ /**
4
+ * Keep a raw API call inside the configured API origin and its /v1 prefix
5
+ * (pfb_8cef4606e9a3). A full URL, a protocol-relative or backslash path, a
6
+ * fragment, or any `.`/`..` segment (percent-encoded too) is refused before a
7
+ * request carries the token anywhere. A leading /v1 is accepted and dropped,
8
+ * a missing leading slash is added, and the query string is kept.
9
+ */
10
+ export declare function normalizeApiPath(input: string, apiBase?: string): {
11
+ path: string;
12
+ } | {
13
+ error: string;
14
+ };
@@ -0,0 +1,30 @@
1
+ import { Command } from 'commander';
2
+ import { type DeviceSessionScope } from '../lib/device-login.js';
3
+ import { ApiClient } from '../lib/client.js';
4
+ /** The account-creation page. `login` sends an existing user through the OAuth
5
+ * device flow, which offers no way to create an account — a stranger with no
6
+ * Google or GitHub account had no front door from the CLI at all
7
+ * (tsk_0e9e13b8). This URL is the one that does. */
8
+ export declare const SIGNUP_URL = "https://somewhere.cloud/auth?intent=signup";
9
+ /** The one line `login` prints so a new user is never stranded, and the line
10
+ * `signup` is built around. Kept as data so it can be pinned by a test
11
+ * without driving a browser. */
12
+ export declare const SIGNUP_HINT = "New here? Create an account: https://somewhere.cloud/auth?intent=signup";
13
+ /** One line for what a session may touch, as the approval page decided it. */
14
+ export declare function describeScope(scope: DeviceSessionScope | null | undefined): string;
15
+ /** Everything `somewhere login` prints before it contacts the platform. */
16
+ export declare function loginIntroLines(): string[];
17
+ /**
18
+ * The plan's display name from the public plan table, keyed by the tier id, so
19
+ * a new or renamed plan never shows up as the wrong one (pfb_b69363269589).
20
+ * An unreadable table or an id it does not list prints the id itself.
21
+ */
22
+ export declare function readPlanName(client: Pick<ApiClient, 'call'>, tierId: string): Promise<string>;
23
+ /**
24
+ * whoami's count is every project the account owns, in any status; `somewhere projects` lists owned
25
+ * and shared/group projects but leaves out archived ones and ones being deleted. Say which is which,
26
+ * so the two numbers reconcile instead of looking like a lost project (tsk_8a68dfa2). A failed
27
+ * breakdown read never fails whoami: the count is still labelled.
28
+ */
29
+ export declare function describeProjectCount(client: ApiClient, owned: number): Promise<string>;
30
+ export declare function registerAuth(program: Command): void;
@@ -0,0 +1,247 @@
1
+ import { Command } from 'commander';
2
+ import { ApiClient } from '../lib/client.js';
3
+ import { type BrowserRequestExpectationResult, type BrowserSequenceAction, type ExpectedBrowserRequest } from '../lib/browser-actions.js';
4
+ interface BrowserStepResult {
5
+ step?: number;
6
+ action?: string;
7
+ ok?: boolean;
8
+ passed?: boolean;
9
+ selector?: string;
10
+ script?: string;
11
+ path?: string;
12
+ /** The hosted browser returns an evaluated value here (`steps[].value`) —
13
+ * an `eval` expression's result, a `snapshot`'s page outline. */
14
+ value?: unknown;
15
+ /** The local loopback browser (`src/lib/browser-run.ts`) returns the same
16
+ * thing under this name. Both are read; neither may be dropped. */
17
+ result?: unknown;
18
+ error?: string;
19
+ duration_ms?: number;
20
+ /** The platform's own navigation before the caller's first action. */
21
+ phase?: 'start_navigation' | 'session_restore';
22
+ /** false: this submitted action was never started (the run stopped at its
23
+ * execution cap first). It has no verdict; it is not a failure. */
24
+ ran?: boolean;
25
+ }
26
+ /** The run stopped at its own execution cap before starting `next_step`.
27
+ * Counts and indexes refer to the actions submitted in this call (0-based),
28
+ * never to the platform's own start navigation. `passed` stays false. */
29
+ export interface BrowserIncomplete {
30
+ reason: 'execution_cap';
31
+ completed: number;
32
+ next_step: number;
33
+ budget_ms: number;
34
+ elapsed_ms: number;
35
+ }
36
+ /** The incomplete block when it is well formed; anything else is ignored and
37
+ * the report is judged on its own verdict. */
38
+ export declare function readBrowserIncomplete(r: BrowserResult): BrowserIncomplete | null;
39
+ /** Unknown outcome is distinct from a known unstarted execution-cap boundary. */
40
+ export interface BrowserLifecycle {
41
+ status: 'execution_timeout' | 'evidence_timeout' | 'cleanup_unknown' | 'transport_timeout' | 'transport_error';
42
+ outcome_unknown: true;
43
+ }
44
+ export declare function readBrowserLifecycle(r: BrowserResult): BrowserLifecycle | null;
45
+ /** Only measured executed steps get a timing; absence is not zero. */
46
+ export declare function formatStepDuration(durationMs: unknown, ran?: boolean): string;
47
+ /** The combined health response from POST /v1/browser (confirmed shape: the
48
+ * agent-native browser returns these signals whether or not `steps` ran). */
49
+ export interface BrowserResult {
50
+ passed?: boolean;
51
+ dialogs?: Array<{
52
+ step?: number;
53
+ type: string;
54
+ message: string;
55
+ answer: 'accept' | 'dismiss';
56
+ handled: 'accepted' | 'dismissed' | 'failed' | 'unconfirmed';
57
+ by: 'default' | 'dialog_action';
58
+ note?: string;
59
+ }>;
60
+ dialogs_truncated?: true;
61
+ dialog_actions_unused?: Array<{
62
+ step: number;
63
+ answer: 'accept' | 'dismiss';
64
+ }>;
65
+ lifecycle?: BrowserLifecycle;
66
+ transport_error?: {
67
+ code: string;
68
+ message: string;
69
+ status: number;
70
+ };
71
+ final_url?: string;
72
+ console_errors?: unknown[];
73
+ page_errors?: unknown[];
74
+ failed_requests?: unknown[];
75
+ request_expectations?: BrowserRequestExpectationResult[];
76
+ steps?: BrowserStepResult[];
77
+ /** A screenshot is a bare path string (legacy) OR an object. In VERIFY mode
78
+ * it carries `fs_path` (where the file lives) plus `url` (a short-lived link
79
+ * that opens it); in EYES mode it carries either `inline_base64` (the image
80
+ * bytes — not renderable in a terminal) or, with --store, a short-TTL
81
+ * `scratch_url` (+ `scratch_expires_at`). */
82
+ screenshots?: Array<string | {
83
+ label?: string;
84
+ path?: string;
85
+ /** A link that OPENS the stored image. `fs_path` is where the file
86
+ * lives; this is what you fetch to see it. Short-lived. */
87
+ url?: string;
88
+ url_expires_at?: string;
89
+ fs_path?: string;
90
+ inline_base64?: string;
91
+ scratch_url?: string;
92
+ scratch_expires_at?: string;
93
+ error?: string;
94
+ }>;
95
+ dom_outline?: Array<{
96
+ tag?: string;
97
+ id?: string;
98
+ testid?: string;
99
+ name?: string;
100
+ aria?: string;
101
+ text?: string;
102
+ selector?: string;
103
+ visible?: boolean;
104
+ disabled?: boolean;
105
+ }>;
106
+ /** Why the interactive-element map is missing, when the run knows. Absent
107
+ * `dom_outline` with no reason is reported as "not read", never as zero. */
108
+ dom_error?: string;
109
+ testid_map?: Record<string, unknown>;
110
+ /** Structured extraction (--extract / --include markdown): the page as clean markdown. */
111
+ markdown?: string;
112
+ /** Persistent session (--session): the handle to reconnect on the next call. */
113
+ session_id?: string;
114
+ /** When the kept session ends: the earlier of its idle and absolute bounds,
115
+ * read by the platform when it released the browser. Absent once closed. */
116
+ session_expires_at?: string;
117
+ /** The kept session's idle bound (release + the idle keep-alive). */
118
+ idle_expires_at?: string;
119
+ /** The kept session's absolute bound (opened + its lifetime cap). */
120
+ absolute_expires_at?: string;
121
+ /** The platform closed this session at the end of the run. */
122
+ session_closed?: true;
123
+ /** Fail-soft note, e.g. "session expired, started fresh". */
124
+ session_note?: string;
125
+ /** Present when the run reached its execution cap (budget_ms) before
126
+ * starting its next action. */
127
+ incomplete?: BrowserIncomplete;
128
+ /** One non-blocking line: contrast, horizontal overflow, tap-target sizing. */
129
+ accessibility_layout?: string;
130
+ /** The page when the start navigation gave up (document status, ready state, what was loading). */
131
+ navigation_snapshot?: Record<string, unknown>;
132
+ /** The initial navigation, repeated once after it timed out with no document
133
+ * response observed while the page was still blank. No action was replayed. */
134
+ navigation_retries?: Array<{
135
+ phase: string;
136
+ error: string;
137
+ elapsed_ms?: number;
138
+ snapshot?: Record<string, unknown>;
139
+ }>;
140
+ }
141
+ export interface BrowserOptions {
142
+ project?: string;
143
+ url?: string;
144
+ path?: string;
145
+ wait?: string;
146
+ eval?: string;
147
+ screenshot?: boolean | string;
148
+ snapshot?: boolean;
149
+ viewport?: string;
150
+ store?: boolean;
151
+ include?: string;
152
+ extract?: boolean;
153
+ session?: string;
154
+ close?: string;
155
+ authUser?: string;
156
+ actionSequence?: BrowserSequenceAction[];
157
+ expectedRequests?: ExpectedBrowserRequest[];
158
+ visibleOnly?: boolean;
159
+ json?: boolean;
160
+ }
161
+ /**
162
+ * The request body for `--close`. Hosted sessions belong to the project they
163
+ * were opened for, so the close names the same project a run would use:
164
+ * --project, else the linked project. With neither, it closes the session
165
+ * opened without a project (session_id alone).
166
+ */
167
+ export declare function buildBrowserCloseBody(session: string, project?: string, linkedProject?: string): {
168
+ session_id: string;
169
+ project_id?: string;
170
+ close?: true;
171
+ };
172
+ /**
173
+ * Build the POST /v1/browser request body from the positional `target` + flags.
174
+ *
175
+ * Target precedence: an explicit --url (or a positional that looks like a URL)
176
+ * becomes `url`; otherwise --project (or a non-URL positional, then the linked
177
+ * project) becomes `project_id`. The action flags compile to an ordered `steps`
178
+ * array (goto → wait_for → eval → screenshot). `--snapshot` is not a step — it
179
+ * prints the DOM map — but the map is an opt-in section, so it adds `dom` to
180
+ * `include`. `--store` (EYES mode: get a scratch signed URL instead of an
181
+ * inline shot) and `--include` forward the matching request params.
182
+ */
183
+ export declare function buildBrowserBody(target: string | undefined, opts: BrowserOptions, linkedProject?: string): Record<string, unknown>;
184
+ export declare function resolveAuthUser(client: Pick<ApiClient, 'call'>, projectId: string | undefined, value: string): Promise<string>;
185
+ /**
186
+ * Exit non-zero when the page is UNHEALTHY: a step failed (`passed === false`),
187
+ * a request failed, or JS threw. Console errors alone are advisory (favicon
188
+ * 404s etc.) and don't fail the gate — they're still printed.
189
+ */
190
+ export declare function browserExitCode(r: BrowserResult): number;
191
+ /** Make the response verdict agree with the command's health/exit contract. */
192
+ export declare function normalizeBrowserVerdict(r: BrowserResult): BrowserResult;
193
+ /**
194
+ * The evaluated value a step handed back, rendered for a terminal.
195
+ *
196
+ * A string prints as itself; everything else prints as the JSON `--json` would
197
+ * have shown, pretty-printed so an object is readable rather than one long
198
+ * line. `null` prints as `null` — the hosted browser maps an expression that
199
+ * returned `undefined` to null, and that IS the answer.
200
+ */
201
+ export declare function stringifyResult(v: unknown): string;
202
+ /**
203
+ * ` result:` lines for one step, or [] when the step carries no value and
204
+ * was never going to.
205
+ *
206
+ * The hosted browser puts the value in `value`; the local loopback browser
207
+ * puts it in `result`. Reading only one of them is how `--eval` came back
208
+ * blank in text mode while `--json` showed the answer (pfb_4a4d8dd84186).
209
+ * A multi-line object is indented under the label so every line still belongs
210
+ * to a visible owner.
211
+ */
212
+ export declare function stepResultLines(s: BrowserStepResult): string[];
213
+ interface FramesValue {
214
+ complete?: boolean;
215
+ requested?: number;
216
+ captured?: number;
217
+ summary?: string;
218
+ motion?: Array<{
219
+ from_ms: number;
220
+ to_ms: number;
221
+ changed_ratio: number;
222
+ }>;
223
+ element_box?: {
224
+ moved?: boolean;
225
+ max_shift_px?: number;
226
+ };
227
+ incomplete?: {
228
+ reason?: string;
229
+ detail?: string;
230
+ };
231
+ sheet?: string;
232
+ }
233
+ /** A frames step: the verdict line, the measured change between frames, and
234
+ * (with a selector) how far the element itself moved. The sheet is listed
235
+ * with the screenshots under its label. */
236
+ export declare function framesResultLines(v: FramesValue): string[];
237
+ /**
238
+ * Render the combined health signal as grep-able lines (one signal per line,
239
+ * stable `label:` prefixes) — never the screenshot image itself, just its
240
+ * stored path. Returns the lines so the formatting is unit-testable.
241
+ */
242
+ export declare function formatBrowserReport(r: BrowserResult, opts?: {
243
+ snapshot?: boolean;
244
+ }): string[];
245
+ export declare function localBrowserUnsupportedMessage(opts: BrowserOptions): string | undefined;
246
+ export declare function registerBrowser(program: Command): void;
247
+ export {};
@@ -0,0 +1,22 @@
1
+ import { Command } from 'commander';
2
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
3
+ import type { ProjectConfig } from '../types.js';
4
+ /** Arguments from the inline JSON or from `--file <path>` (tsk_81dd50f0), never both. */
5
+ export declare function readCallArguments(jsonArgs: string | undefined, file: string | undefined): Record<string, unknown>;
6
+ export type CallScope = {
7
+ kind: 'explicit';
8
+ } | {
9
+ kind: 'linked';
10
+ args: Record<string, unknown>;
11
+ note: string;
12
+ } | {
13
+ kind: 'account';
14
+ reason: 'all-projects' | 'not-linked' | 'no-project-arg';
15
+ };
16
+ /** Decide which project a generic tool call runs against (tsk_0a027a93).
17
+ * An explicit `project_id` always wins. In a linked directory, a tool that
18
+ * takes `project_id` runs against the linked project, as the first-class
19
+ * commands do; `--all-projects` omits that default, leaving scope to the tool.
20
+ * `tool` is the catalog entry, looked up only when injection is possible. */
21
+ export declare function chooseCallScope(args: Record<string, unknown>, linked: ProjectConfig | null, allProjects: boolean, tool: Tool | undefined): CallScope;
22
+ export declare function registerCall(program: Command): void;
@@ -0,0 +1,16 @@
1
+ import { Command } from 'commander';
2
+ interface CatalogCategory {
3
+ summary: string;
4
+ aliases: string[];
5
+ tools: string[];
6
+ }
7
+ interface CatalogResponse {
8
+ categories: Record<string, CatalogCategory>;
9
+ total_tools: number;
10
+ next_step?: string;
11
+ }
12
+ /** `catalog email` names a category, not a tool. Resolve category names first,
13
+ * then the aliases the catalog already publishes; an alias can span groups. */
14
+ export declare function matchCatalogCategories(catalog: CatalogResponse, query: string): Array<[string, CatalogCategory]>;
15
+ export declare function registerCatalog(program: Command): void;
16
+ export {};
@@ -0,0 +1,114 @@
1
+ import { Command } from 'commander';
2
+ import { CliApiError } from '../lib/client.js';
3
+ import { type BuildErrorDetail } from '../lib/build-errors.js';
4
+ import { type CollectedFiles } from '../lib/files.js';
5
+ import { type TypecheckResult } from '../lib/typecheck.js';
6
+ /** A single diagnostic from the server-side dry compile. Same file:line shape
7
+ * the /deploy BUILD_ERROR payload uses (so it renders through the same code
8
+ * frame), plus an optional `code` (e.g. TS2304 / esbuild). */
9
+ export type CheckErrorDetail = BuildErrorDetail & {
10
+ code?: string;
11
+ stack?: string | null;
12
+ };
13
+ /** POST /v1/deploy/check — the dry-compile verdict. A checker reports problems
14
+ * as DATA (ok:false + errors), so finding errors is a successful call, not an
15
+ * HTTP error. We also tolerate the server answering with a thrown BUILD_ERROR
16
+ * (same as /deploy) — see the action's catch. */
17
+ export interface CheckResult {
18
+ ok?: boolean;
19
+ errors?: CheckErrorDetail[];
20
+ warnings?: string[];
21
+ build_log?: string[];
22
+ }
23
+ /** POST <runner>/check-handler — compile-then-invoke. Carries `errors` when the
24
+ * compile failed before the handler could run; otherwise the handler's
25
+ * response and logs. */
26
+ export interface CheckRunResult extends CheckResult {
27
+ response?: {
28
+ status: number;
29
+ headers: Record<string, string>;
30
+ body: string;
31
+ body_truncated?: boolean;
32
+ } | null;
33
+ logs?: Array<{
34
+ level?: string;
35
+ message?: string;
36
+ } | string>;
37
+ served?: 'function' | 'static';
38
+ isolated_db?: boolean;
39
+ duration_ms?: number;
40
+ logs_truncated?: boolean;
41
+ }
42
+ export interface CheckRunRequest {
43
+ path: string;
44
+ method: string;
45
+ body?: string;
46
+ }
47
+ /** The dry-compile body: the same collected source tree `somewhere deploy`
48
+ * uploads, so the server compiles exactly what would deploy. */
49
+ export declare function buildCheckBody(collected: CollectedFiles, projectId: string): Record<string, unknown>;
50
+ /** The handler-check body accepted by the runner's POST /check-handler. That
51
+ * endpoint accepts inline function source and a top-level request spec; static
52
+ * client files are outside this mode's contract. */
53
+ export declare function buildCheckRunBody(collected: CollectedFiles, projectId: string, request: CheckRunRequest): Record<string, unknown>;
54
+ /** validateInvokeInput treats `path` as the complete URL path. Preserve the
55
+ * caller's query string byte-for-byte by appending it there, rather than
56
+ * sending an unsupported sibling `query` property. */
57
+ export declare function checkRunPath(path: string, query?: string): string;
58
+ /**
59
+ * Map an errors-as-data check response to a synthetic BUILD_ERROR so it renders
60
+ * through the exact same code-frame path as a /deploy failure (we have the
61
+ * local source on disk → real frames). Returns null when the response is clean.
62
+ */
63
+ export declare function checkErrorsToCliError(r: CheckResult | undefined): CliApiError | null;
64
+ /** Format the --run handler response as lines (mirrors `somewhere run`). */
65
+ export declare function formatCheckRunResult(r: CheckRunResult): string[];
66
+ /** One verdict for both terminal and --json modes. An explicit handler check
67
+ * passes only when handler preparation and invocation completed with an HTTP response
68
+ * below 400 and no captured handler error. */
69
+ export declare function checkRunExitCode(r: CheckRunResult): number;
70
+ /** Human success copy for the compile-only path. Keep the scope explicit: a
71
+ * clean compile says nothing about requests or user journeys. */
72
+ export declare function formatCompileOnlySuccess(totalFiles: number, totalBytes: number, projectId: string): string[];
73
+ /** One step of the projectless preflight. `skipped` is never a pass. */
74
+ export interface LocalCheckStep {
75
+ name: 'source' | 'typecheck' | 'platform_compile';
76
+ status: 'passed' | 'failed' | 'skipped';
77
+ reason?: string;
78
+ errors?: Array<{
79
+ file: string;
80
+ line: number;
81
+ column: number;
82
+ code: string;
83
+ message: string;
84
+ }>;
85
+ files?: number;
86
+ bytes?: number;
87
+ not_uploaded?: Array<{
88
+ path: string;
89
+ reason: string;
90
+ }>;
91
+ not_published?: Array<{
92
+ path: string;
93
+ reason: string;
94
+ }>;
95
+ }
96
+ /** The projectless verdict. `complete` is false whenever any step was
97
+ * skipped, so a green local run can never read as a full deploy check. */
98
+ export interface LocalPreflightResult {
99
+ ok: boolean;
100
+ complete: boolean;
101
+ verdict: 'failed' | 'partial' | 'passed';
102
+ mode: 'local';
103
+ checks: LocalCheckStep[];
104
+ next: string;
105
+ }
106
+ export declare const PLATFORM_COMPILE_SKIPPED_REASON: string;
107
+ export declare const RUN_NEEDS_PROJECT_MESSAGE: string;
108
+ /** Combine projectless steps into one verdict. A skipped step makes the
109
+ * result partial, never passed. */
110
+ export declare function localPreflightVerdict(checks: LocalCheckStep[]): LocalPreflightResult;
111
+ /** Projectless preflight: only checks that need no project, account, or
112
+ * network. The platform compile is reported as skipped, not passed. */
113
+ export declare function runLocalPreflight(targetDir: string, collected: CollectedFiles, typecheck?: (dir: string) => Promise<TypecheckResult>): Promise<LocalPreflightResult>;
114
+ export declare function registerCheck(program: Command): void;
@@ -0,0 +1,5 @@
1
+ import { Command } from 'commander';
2
+ /** `somewhere claim`: the claim URL of this computer's temporary workspace,
3
+ * for a signed-out person who deployed and wants to keep the app
4
+ * (tsk_b9900dbb). Reads the local credential only; nothing is sent. */
5
+ export declare function registerClaim(program: Command): void;
@@ -0,0 +1,14 @@
1
+ import { Command } from 'commander';
2
+ /** The plan's schedule policy, which the platform returns for a one-project
3
+ * listing. Printed even when the list is empty, so an agent learns whether a
4
+ * schedule will be accepted before trying (tsk_a86f8a12). */
5
+ export declare function cronPolicyLine(value: unknown): string | null;
6
+ /** next_run_at as shown in `cron list` / `cron runs`. A past next run on an
7
+ * enabled trigger is overdue: the schedule has not advanced it yet. Whether a
8
+ * run was recorded for it is only known from the run history (`cron runs`). */
9
+ export declare function nextRunLabel(row: Record<string, unknown>, now?: number): string;
10
+ /** For an overdue trigger, the run for that exact occurrence if it appears in
11
+ * the recent history. job_get returns only the latest N runs, so absence there
12
+ * does not prove no run exists. */
13
+ export declare function overdueOccurrenceLine(cron: Record<string, unknown>, jobs: Record<string, unknown>[], now?: number): string | null;
14
+ export declare function registerCron(program: Command): void;
@@ -0,0 +1,2 @@
1
+ import type { Command } from 'commander';
2
+ export declare function registerDbRows(db: Command): void;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerDb(program: Command): void;