@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,235 @@
1
+ import { Command } from 'commander';
2
+ import { ApiClient, CliApiError } from '../lib/client.js';
3
+ import { awaitPostLiveRender, type PostLiveRenderRecord } from '../lib/post-live-render.js';
4
+ import { type CollectedFiles } from '../lib/files.js';
5
+ import type { ProjectConfig } from '../types.js';
6
+ export declare function resolveTargetDir(dir?: string, cwd?: string): string;
7
+ export declare function prebuiltOptIn(opts: {
8
+ prebuilt?: boolean;
9
+ allowBundled?: boolean;
10
+ }): boolean;
11
+ export declare const POST_DEPLOY_HINT: string;
12
+ export declare function isNextAppShapeSignal(signal: string): boolean;
13
+ export declare function detectNodeServerShape(files: Record<string, string>, functions: Record<string, string>): string | null;
14
+ export declare function slugify(name: string): string;
15
+ export declare function randomSuffix(): string;
16
+ export declare function deriveTempProjectName(dirPath: string): string;
17
+ export declare function formatTtlHours(ttlSeconds?: number): number;
18
+ export declare function formatRemainingTempTime(expiresAt: string, nowMs?: number): string | null;
19
+ export declare function formatTempExpiry(expiresAt: string, ttlSeconds?: number, nowMs?: number): string;
20
+ export interface StaleBaseDetails {
21
+ current_version?: number;
22
+ base_version?: number;
23
+ changed_files: string[];
24
+ last_change_source?: string;
25
+ last_change_at?: string;
26
+ }
27
+ export declare function readStaleBaseDetails(data?: Record<string, unknown>): StaleBaseDetails;
28
+ export declare function formatStaleBaseExplanation(details: StaleBaseDetails, nowMs?: number): string;
29
+ /** What the platform reports about the live release in a STALE_RELEASE_BASE answer. */
30
+ export interface StaleReleaseDetails {
31
+ changed_files?: string[];
32
+ history_unavailable?: boolean;
33
+ active_release_id?: string | null;
34
+ active_version?: number;
35
+ base_version?: number;
36
+ active_release_source?: string;
37
+ active_release_activation?: 'publish' | 'rollback';
38
+ active_release_activated_at?: string;
39
+ }
40
+ export declare function readStaleReleaseDetails(data: Record<string, unknown> | undefined): StaleReleaseDetails;
41
+ /**
42
+ * A deploy refused because live is newer than this folder: which version is
43
+ * live, what put it there (naming this folder's own rollback or restore when
44
+ * that is the cause, tsk_0dcd7530), which files changed, and the one next step.
45
+ */
46
+ export declare function formatStaleReleaseBaseExplanation(details?: StaleReleaseDetails | string[], historyUnavailable?: boolean, ownActivation?: {
47
+ kind: 'rollback' | 'restore';
48
+ release_id: string;
49
+ } | null): string;
50
+ /**
51
+ * STALE_RELEASE_BASE on a retry the CLI sent after its own timeout or lost
52
+ * connection: the refusal itself changed nothing, but the FIRST attempt may
53
+ * have gone live (its answer never arrived), so "NOT applied" would be false.
54
+ */
55
+ export declare function formatAmbiguousRetryStaleExplanation(transportFailure: string): string;
56
+ /** Signed in, nothing linked: deploy never creates or links a project in the
57
+ * account on its own; say exactly how to (tsk_8a68dfa2 item 15). */
58
+ export declare function formatSignedInUnlinkedExplanation(): string;
59
+ /** The folder's link names a project this sign-in cannot open (tsk_8a68dfa2
60
+ * item 14: typically a temporary project that expired unclaimed, after the
61
+ * developer signed in). The platform answers not-found and no-access alike,
62
+ * so this names possibilities only, never which one. Reached only when the
63
+ * platform refused the deploy before applying anything. */
64
+ export declare function linkedProjectNotFoundSteps(signedIn: boolean): string[];
65
+ export declare function formatLinkedProjectNotFoundExplanation(linkedProjectId: string, signedIn: boolean): string;
66
+ /** Signed out, no stored credential, and the deploy names an existing project. */
67
+ export declare function formatSignedOutExistingTargetExplanation(projectId: string, fromLink: boolean): string;
68
+ /** The stored temporary session expired before this deploy (tsk_8a68dfa2
69
+ * item 14). Built only from this machine's own record, so it says nothing
70
+ * about whether any project exists. */
71
+ export declare function formatExpiredTemporaryProjectExplanation(expiredAt: string): string;
72
+ export declare function formatBaseRequiredExplanation(): string;
73
+ /** `--project <ref>` named a project that is not the one this folder is linked
74
+ * to. Deploying would publish this folder over a project it never came from,
75
+ * so the CLI refuses instead of silently switching targets (founder 2026-10-23). */
76
+ export declare function formatLinkedProjectMismatchExplanation(linkedProjectId: string, ref: string, resolvedProjectId: string): string;
77
+ /** BASE_REQUIRED for an explicit --project target whose live release could not
78
+ * be read first (or a legacy project with no release). `somewhere pull` alone
79
+ * cannot record a base in an unlinked folder, so the steps must terminate. */
80
+ export declare function formatExplicitProjectBaseRequiredExplanation(ref: string): string;
81
+ /** Bound on the prestart request; it answers at once, so this only caps a stalled connection. */
82
+ export declare const DEPLOY_PRESTART_TIMEOUT_MS = 5000;
83
+ /**
84
+ * Prestart (tsk_a92c59b9, root decision 2026-11-04): ask the platform to start this project's compile container
85
+ * now, so a cold one boots while the files are packed and uploaded instead of after the upload arrives. The
86
+ * platform holds an instance it starts only until the deploy's compile (at most a minute) and only renews a warm
87
+ * one. Sent once and never awaited or retried. Every outcome is ignored, including an older platform's 404 and a
88
+ * refusal, which the deploy itself then reports. It never refreshes the login: the deploy's own calls do that.
89
+ */
90
+ export declare function startDeployPrestart(client: ApiClient, projectId: string): () => void;
91
+ /** Resolve an explicit `--project <ref>` (uuid, slug or subdomain) to its
92
+ * canonical project id, or null when the ref cannot be resolved (the deploy
93
+ * itself then names the real error). Read-only. */
94
+ export declare function resolveExplicitProjectId(client: ApiClient, ref: string): Promise<string | null>;
95
+ /** The live release an explicit `--project` deploy is prepared against, read
96
+ * moments before the upload (founder architecture 2026-10-23): a release id,
97
+ * null for a project with no published source (the genesis claim), or
98
+ * undefined when unknown (the server's own BASE_REQUIRED then stands). The id is
99
+ * declared as base_release_id, so the server's existing stale-overwrite fence
100
+ * still refuses a release that lands between this read and the publish. Never
101
+ * used for a folder that did not name its target, never with --force. */
102
+ export declare function readExplicitProjectLiveBase(client: ApiClient, projectId: string): Promise<string | null | undefined>;
103
+ /** The folder's link was written when a project was created for it, and no
104
+ * deploy from this folder has gone live since (a first deploy that failed
105
+ * writes exactly this: source_base.release_id null). Nothing of the folder's
106
+ * is on that project, so a credential that cannot open it loses nothing by
107
+ * starting a new temporary project and replacing the link (tsk_b9900dbb). */
108
+ export declare function linkNeverDeployed(config: ProjectConfig | null | undefined): boolean;
109
+ export declare function formatReplacedNeverDeployedLink(oldProjectId: string): string;
110
+ /** A temporary credential is reusable until its window closes; no recorded
111
+ * expiry means the server never gave one, which is not a reason to re-mint. */
112
+ /** The stored temporary session's own expiry time has passed. A session that
113
+ * is merely missing its token is not reported as expired. */
114
+ export declare function temporarySessionExpired(session: {
115
+ temp_expires_at?: string;
116
+ } | null, nowMs?: number): boolean;
117
+ export declare function isTempSessionLive(session: {
118
+ token?: string;
119
+ temp_expires_at?: string;
120
+ } | null, nowMs?: number): boolean;
121
+ export declare function registerDeploy(program: Command): void;
122
+ export interface DeployResult {
123
+ project_id?: string;
124
+ version?: number;
125
+ release_id?: string;
126
+ active_release_id?: string;
127
+ base_release_id?: string | null;
128
+ files_deployed?: number;
129
+ files?: string[] | number;
130
+ url?: string;
131
+ has_functions: boolean;
132
+ build_log?: string[];
133
+ warnings?: string[];
134
+ preserved_functions?: string[];
135
+ removed_functions?: string[];
136
+ function_errors?: Array<{
137
+ route?: string;
138
+ error?: string;
139
+ } | string>;
140
+ runtime_fixes?: Array<{
141
+ notice_id: string;
142
+ title: string;
143
+ message: string;
144
+ }>;
145
+ status?: string;
146
+ release_publish?: boolean;
147
+ compiled_artifact_digest?: string | null;
148
+ stage_timing_ms?: Record<string, number> | null;
149
+ reference_check?: {
150
+ status?: string;
151
+ } | null;
152
+ /** Present when the blank-page check runs after the answer (tsk_b9507144). */
153
+ post_live_render?: (PostLiveRenderRecord & {
154
+ note?: string;
155
+ }) | null;
156
+ blank_page_check?: unknown;
157
+ }
158
+ /** The line a deploy prints about a blank-page check that ran after it
159
+ * answered: still running at the deadline, passed with a warning, or could
160
+ * not finish. A clean pass prints nothing. */
161
+ export declare function formatPostLiveRenderLine(wait: Awaited<ReturnType<typeof awaitPostLiveRender>>): string | null;
162
+ /**
163
+ * The after-live reference check runs in the background, so the deploy
164
+ * answer can only say `pending`. Name the existing read that carries its
165
+ * result (the deploy log) for this exact version (tsk_8a68dfa2 item 4). The
166
+ * project is named unless this directory's link already selects it, because
167
+ * `call` defaults to the linked project.
168
+ */
169
+ export declare function formatReferenceCheckHint(result: DeployResult, linkedHere: boolean): string | null;
170
+ export declare function formatDeployTiming(input: {
171
+ startupMs: number;
172
+ collectionMs: number;
173
+ preparationMs: number;
174
+ requestMs: number;
175
+ stageTimingMs?: Record<string, number> | null;
176
+ }): string[];
177
+ interface DeploySuccessFormatOptions {
178
+ scope?: 'functions' | 'static';
179
+ functionCount: number;
180
+ /**
181
+ * How many static files this command actually uploaded, counted from the
182
+ * tree it read. Preferred over the platform's own tally because it is the
183
+ * same count the project reports back and the same count `somewhere preview`
184
+ * prints — one project, one number (parity finding #12). The response fields
185
+ * remain the fallback for callers that have no local tree.
186
+ */
187
+ staticFileCount?: number;
188
+ totalBytes: number;
189
+ linkedProject?: Pick<ProjectConfig, 'project_id' | 'subdomain'>;
190
+ }
191
+ export interface FormattedDeploySuccess {
192
+ staticFileCount: number | null;
193
+ headline: string;
194
+ projectRef: string | null;
195
+ liveUrl: string | null;
196
+ liveMessage: string;
197
+ }
198
+ /**
199
+ * The deploy response names the project but not its address. When the link
200
+ * file has no subdomain (a hand-written `{"project_id": ...}`), read it from
201
+ * the project record so the success line can still print the live URL. A
202
+ * failed lookup only loses the URL; the deploy already succeeded.
203
+ */
204
+ export declare function linkedProjectWithSubdomain(client: Pick<ApiClient, 'call'>, result: DeployResult, linked: Pick<ProjectConfig, 'project_id' | 'subdomain'> | undefined): Promise<Pick<ProjectConfig, 'project_id' | 'subdomain'> | undefined>;
205
+ export declare function formatDeploySuccess(result: DeployResult, options: DeploySuccessFormatOptions): FormattedDeploySuccess;
206
+ /** The client-detected failure the deploy was retried after, if any. */
207
+ export declare function deployRetriedAfterTransportFailure(err: unknown): string | null;
208
+ /** The request may have reached the server and no authoritative answer was
209
+ * read: a timeout or dropped connection after the connection opened, or a
210
+ * response whose body was cut off or never finished. */
211
+ export declare function outcomeUnknown(err: unknown): boolean;
212
+ /** The deploy request may have been applied and no answer was read. Nothing
213
+ * the CLI can read ties a deploy-history entry to this exact request (history
214
+ * entries carry no request or trace id), so the outcome stays unconfirmed: a
215
+ * later entry may be another actor's deploy, and client and server clocks
216
+ * differ. History is offered for investigation only, never as a signal to
217
+ * deploy again. */
218
+ export declare function formatUnknownDeployOutcomeExplanation(err: CliApiError, projectId: string, startedAt: string): string;
219
+ export declare function printExcludedFiles(excluded: Array<{
220
+ path: string;
221
+ reason: string;
222
+ }>, targetDir: string, { remember }?: {
223
+ remember?: boolean;
224
+ }): void;
225
+ /** The --json form of the omission notices: one stderr line per file, stdout
226
+ * untouched, paths and reasons only (never contents), in a fixed order. */
227
+ export declare function printLocalOmissionsToStderr(omitted: Pick<CollectedFiles, 'excluded' | 'sensitive' | 'skipped'> & {
228
+ notes?: CollectedFiles['notes'];
229
+ }): void;
230
+ /** Files held back by the sensitive-path policy (vendored deploy path policy).
231
+ * Neither --include nor a "!" line publishes them. */
232
+ export declare function printSensitiveFiles(sensitive: CollectedFiles['sensitive']): void;
233
+ /** Why a dry run stops before reaching the platform (pfb_a0af8bb647dc). */
234
+ export declare function formatDryRunNeedsProjectExplanation(): string;
235
+ export {};
@@ -0,0 +1,171 @@
1
+ import { Command } from 'commander';
2
+ import { ApiClient, CliApiError } from '../lib/client.js';
3
+ import { callPlatformTool } from '../lib/platform-tools.js';
4
+ export interface PreviewCandidateHandoff {
5
+ draftId: string;
6
+ candidateReleaseId: string;
7
+ capabilityUrl: string;
8
+ projectRef: string;
9
+ /** Runnable in THIS shell — carries `--yes` when nobody can answer a prompt. */
10
+ promoteCommand: string;
11
+ }
12
+ export declare function mintPreviewHandoff(client: ApiClient, projectId: string, draftId: string, candidateReleaseId: string): Promise<PreviewCandidateHandoff>;
13
+ export declare function callDraftCandidate<T>(client: ApiClient, path: '/deploy' | '/deploy/patch', body: Record<string, unknown>, onRetry?: (error: CliApiError) => void): Promise<T>;
14
+ /** Preserve the platform's typed state without replacing it with a generic
15
+ * "failed". This is deliberately compact enough for a progress line. */
16
+ export declare function previewPlatformState(value: unknown): string | null;
17
+ /** A long preview bootstrap phase must never look frozen. */
18
+ export declare function runPreviewPhase<T>(label: string, operation: () => Promise<T>): Promise<T>;
19
+ export type PreviewSessionState = 'active' | 'promoted' | 'closed' | 'missing' | 'unknown';
20
+ /** Read the preview lifecycle fields returned by deploy_status. A missing row
21
+ * is kept distinct so the monitor only treats it as terminal after it has
22
+ * observed this exact session active. */
23
+ export declare function previewSessionStateFromDeployment(value: unknown, previewSessionId: string, previewId: string): PreviewSessionState;
24
+ export declare function registerPreview(program: Command): void;
25
+ /** The open preview a fresh link should point at (tsk_35c1bb78): the one the
26
+ * caller named, or the only open one. Several open previews and no choice is
27
+ * an error that lists them, never a guess. */
28
+ export declare function choosePreviewCandidate(status: unknown, previewSessionId?: string): {
29
+ draftId: string;
30
+ candidateReleaseId: string;
31
+ };
32
+ export declare function registerDev(program: Command): void;
33
+ export declare const CLOUD_DEV_UNAVAILABLE_MESSAGE: string;
34
+ /**
35
+ * Does this account have private previews?
36
+ *
37
+ * Returns `true`/`false` when the platform states it, and `null` when it does
38
+ * not — a read that fails, or a platform that stopped reporting the field.
39
+ * `null` must NEVER refuse: an unknown answer is not a denial, and telling
40
+ * someone whose account works today to upgrade would be a worse bug than the
41
+ * one this check exists to fix. Only an explicit `false` stops the command.
42
+ *
43
+ * That is safe HERE, and only here, because of where the answer is used: an
44
+ * unknown entitlement is read on the path that already requires explicit
45
+ * consent to publish (see resolveBaseRelease), so it can no longer wave through
46
+ * a production release nobody asked for. It is the RELEASE read, not this one,
47
+ * that must refuse when it cannot answer.
48
+ *
49
+ * On a never-published project the platform answers this with the plain plan
50
+ * entitlement (there is no release to bind a preview to yet), which is exactly
51
+ * the case the caller needs.
52
+ */
53
+ export declare function readCloudDevAllowed(projectId: string, call?: typeof callPlatformTool): Promise<boolean | null>;
54
+ /**
55
+ * The plans that include previews, read from the public plan table rather than
56
+ * typed here, so a plan change never leaves this refusal naming the wrong ones.
57
+ * Null when the table cannot be read; the refusal then stays plan-neutral.
58
+ */
59
+ export declare function readPreviewPlanNames(client: Pick<ApiClient, 'call'>): Promise<string[] | null>;
60
+ /** The customer-facing refusal, naming the plans when the table was readable. */
61
+ export declare function cloudDevUnavailableMessage(planNames: string[] | null): string;
62
+ export declare class CloudDevUnavailableError extends Error {
63
+ readonly code = "CLOUD_DEV_NOT_ENABLED";
64
+ constructor();
65
+ }
66
+ /**
67
+ * What the platform says about this project's live version.
68
+ *
69
+ * `known: false` is the entire point of this type. The previous shape was
70
+ * `string | null`, and `null` carried two opposite meanings at once: "there is
71
+ * positively nothing live" and "I could not find out". The caller acts on that
72
+ * answer by PUBLISHING THE WORKING DIRECTORY TO PRODUCTION, so collapsing the
73
+ * two costs a customer a production release on a project that was already live
74
+ * — which is exactly what happened, because a Free account's own production
75
+ * deploy status answers 403 today (tsk_f4236589) and the 403 became `null`.
76
+ *
77
+ * A read that cannot answer is `unknown`, and unknown never publishes.
78
+ */
79
+ export type BaseReleaseState = {
80
+ known: true;
81
+ activeReleaseId: string | null;
82
+ } | {
83
+ known: false;
84
+ reason: string;
85
+ code?: string;
86
+ };
87
+ /**
88
+ * Read the project's live version, distinguishing "nothing is live" from
89
+ * "could not tell". Every failure mode — a refusal, a server error, a dropped
90
+ * connection, a 200 whose shape this CLI does not recognise — is `unknown`.
91
+ *
92
+ * `call` is injected so a fixture can drive each of those answers.
93
+ */
94
+ export declare function readBaseReleaseState(projectId: string, call?: typeof callPlatformTool): Promise<BaseReleaseState>;
95
+ /** The live version could not be read, so nothing may be published over it. */
96
+ export declare class BaseReleaseUnknownError extends Error {
97
+ readonly reason: string;
98
+ readonly code: string;
99
+ constructor(reason: string, platformCode?: string);
100
+ }
101
+ /**
102
+ * Publishing this directory to production was never agreed to.
103
+ *
104
+ * `declined` — asked, and the answer was no.
105
+ * `not-asked` — nothing here could ask (a script, an agent, a piped shell), so
106
+ * the answer is no by default. Consent that cannot be given is not consent.
107
+ */
108
+ export declare class PublishConsentRequiredError extends Error {
109
+ readonly why: 'declined' | 'not-asked';
110
+ readonly code = "PUBLISH_CONSENT_REQUIRED";
111
+ constructor(why: 'declined' | 'not-asked');
112
+ }
113
+ export type PublishConsent = 'granted' | 'declined' | 'not-asked';
114
+ /** Missing folder provenance cannot be repaired by observing the live release. */
115
+ export declare class SourceBaseRequiredError extends Error {
116
+ readonly code = "BASE_RELEASE_REQUIRED";
117
+ constructor();
118
+ }
119
+ export declare class FirstPublishReleaseUnknownError extends Error {
120
+ readonly code = "PUBLISHED_RELEASE_UNKNOWN";
121
+ constructor();
122
+ }
123
+ /** Keep the folder's observed base. Live status only establishes availability;
124
+ * an empty project can be published once after explicit consent. */
125
+ export declare function resolveBaseRelease(args: {
126
+ sourceBase: {
127
+ releaseId: string | null;
128
+ } | null;
129
+ cloudDevAllowed: () => Promise<boolean | null>;
130
+ readBaseReleaseState: () => Promise<BaseReleaseState>;
131
+ confirmPublish: () => Promise<PublishConsent>;
132
+ publish: () => Promise<string | undefined>;
133
+ announce?: (message: string) => void;
134
+ }): Promise<{
135
+ baseReleaseId: string;
136
+ published: boolean;
137
+ }>;
138
+ /**
139
+ * Ask, once, before the one thing `somewhere preview` can do to a live site.
140
+ *
141
+ * A prompt is the primary mechanism rather than a bare flag because the publish
142
+ * happens on a FIRST run, when nobody knows a flag is needed — a flag-only
143
+ * design would either block every interactive first run or, worse, be added
144
+ * blindly and re-open the hole. A prompt nobody can answer is not consent
145
+ * either, so a non-interactive shell (a script, an agent, a piped terminal)
146
+ * gets `not-asked` and the refusal names `--publish-first`, which is the same
147
+ * consent given up front.
148
+ */
149
+ export declare function readPublishConsent(publishFirst: boolean): Promise<PublishConsent>;
150
+ export interface PreviewSaveQueue {
151
+ pendingChanged: Set<string>;
152
+ pendingDeleted: Set<string>;
153
+ heldChanged: Set<string>;
154
+ heldDeleted: Set<string>;
155
+ }
156
+ /**
157
+ * Decide one preview save. The pending saves (and any save held back earlier)
158
+ * are taken from the queue. Ignored files are dropped; a file over the
159
+ * per-file limit refuses the whole save, which is held unchanged until the
160
+ * next save so nothing is lost and nothing is retried in a loop.
161
+ */
162
+ export declare function planPreviewSave(cwd: string, queue: PreviewSaveQueue): {
163
+ action: 'none';
164
+ } | {
165
+ action: 'refuse';
166
+ message: string;
167
+ } | {
168
+ action: 'send';
169
+ upload: string[];
170
+ deleted: string[];
171
+ };
@@ -0,0 +1,85 @@
1
+ import { Command } from 'commander';
2
+ import { hasUsableCredential } from '../lib/config.js';
3
+ export interface PublicDocsSection {
4
+ id: string;
5
+ alias_of?: string;
6
+ heading: string;
7
+ start: number;
8
+ end: number;
9
+ }
10
+ export interface PublicDocsPage {
11
+ id: string;
12
+ title: string;
13
+ section: string | null;
14
+ body: string;
15
+ /** Compact default view, when the platform publishes one. */
16
+ summary?: string;
17
+ summary_complete?: boolean;
18
+ /** Offsets into `body`; each section includes its nested subsections. */
19
+ sections?: PublicDocsSection[];
20
+ }
21
+ export type DocsView = {
22
+ kind: 'default';
23
+ } | {
24
+ kind: 'full';
25
+ } | {
26
+ kind: 'section';
27
+ id: string;
28
+ };
29
+ interface RenderedDocs {
30
+ content: string;
31
+ view?: string;
32
+ complete?: boolean;
33
+ failure?: DocsFailure;
34
+ }
35
+ interface DocsFailure {
36
+ error: 'DOCS_SECTION_INDEX_UNAVAILABLE' | 'DOCS_SECTION_NOT_FOUND' | 'DOCS_TOPIC_NOT_FOUND';
37
+ message: string;
38
+ hint: string;
39
+ matches?: string[];
40
+ }
41
+ /** Render indexed public views without expanding a failed section request. */
42
+ export declare function renderPublicDocsView(page: PublicDocsPage, view: DocsView): RenderedDocs;
43
+ /** The platform prefixes docs tool responses with
44
+ * `[docs] topic=<t> view=<v> complete=<bool> ...`; older platforms do not. */
45
+ export declare function parseDocsStatusLine(content: string): {
46
+ view?: string;
47
+ complete?: boolean;
48
+ };
49
+ export declare function parsePublicDocsManifest(value: unknown): PublicDocsPage[];
50
+ /** A docs read must never exit through `getToken()`: the corpus is public. */
51
+ export { hasUsableCredential };
52
+ export interface PublicDocsGroup {
53
+ id: string;
54
+ title: string;
55
+ pages: string[];
56
+ }
57
+ /** The manifest's reading-order groups. Older manifests have none; the index
58
+ * then groups by each page's own `section`. */
59
+ export declare function parsePublicDocsGroups(value: unknown): PublicDocsGroup[];
60
+ /** The manifest's topic aliases (`{ alias: canonicalId }`), the same names the
61
+ * signed-in docs tool resolves (tsk_51155c7d). Absent on older manifests. */
62
+ export declare function parsePublicDocsAliases(value: unknown): Record<string, string>;
63
+ /** The page a requested topic names: its own id, else a manifest alias matched
64
+ * the way the docs tool matches (lowercase, then non-alphanumeric runs as `-`). */
65
+ export declare function findPublicDocsPage(pages: PublicDocsPage[], aliases: Record<string, string>, requested: string): PublicDocsPage | undefined;
66
+ /** The topic index: every public topic with its one-line title, in the
67
+ * manifest's reading order, plus how to open a topic, a section, or search.
68
+ * This is what bare `somewhere docs` prints — the full manual is ~18k lines
69
+ * and only appears behind an explicit `--full` (tsk_a86f8a12). */
70
+ export declare function renderDocsIndex(pages: PublicDocsPage[], groups: PublicDocsGroup[]): string;
71
+ export interface DocsSearchResult {
72
+ topic: string;
73
+ title: string;
74
+ section: string | null;
75
+ heading: string | null;
76
+ snippet: string;
77
+ open: string;
78
+ }
79
+ /** Case-insensitive search over the public manifest. Every word must appear
80
+ * in the same section; each hit is reported against the innermost section
81
+ * that contains its first match, with the command that opens it. Title and
82
+ * heading hits rank first, then the number of occurrences. */
83
+ export declare function searchPublicDocs(pages: PublicDocsPage[], query: string): DocsSearchResult[];
84
+ export declare function writeResponseBodyToStdout(res: Pick<Response, 'body'>): Promise<void>;
85
+ export declare function registerDocs(program: Command): void;
@@ -0,0 +1,8 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * The platform names the only valid domain (`<subdomain>.test.somewhere.site`)
4
+ * when it rejects an address. Turn that into a runnable command with a fixed
5
+ * example mailbox: never echo the rejected, possibly private, address.
6
+ */
7
+ export declare function testInboxNextCommand(message: string, project: string | undefined): string | null;
8
+ export declare function registerEmail(program: Command): void;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerEnv(program: Command): void;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerErrors(program: Command): void;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerFeedback(program: Command): void;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerFs(program: Command): void;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerGit(program: Command): void;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerGrep(program: Command): void;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerHooks(program: Command): void;
@@ -0,0 +1,17 @@
1
+ import { Command } from 'commander';
2
+ import { ApiClient } from '../lib/client.js';
3
+ interface LinkProject {
4
+ id: string;
5
+ name: string;
6
+ subdomain: string;
7
+ slug?: string;
8
+ }
9
+ export declare function registerInit(program: Command): void;
10
+ export declare function linkExisting(client: ApiClient, dir: string, projectRef?: string, json?: boolean, configureMcp?: boolean, scaffold?: (project: LinkProject) => Promise<void>): Promise<void>;
11
+ /** Existing installations and same-name project skills remain unchanged during init. */
12
+ export declare function writeInitSkills(dir: string): {
13
+ version: string;
14
+ } | {
15
+ kept: string;
16
+ };
17
+ export {};
@@ -0,0 +1,8 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * `somewhere link` — a discoverable top-level alias for `somewhere init --link`.
4
+ * Agents look for `link`; this registers it without forking any logic — it
5
+ * reuses linkExisting (which fetches projects, prompts a pick, and writes
6
+ * .somewhere.json via saveProjectConfig).
7
+ */
8
+ export declare function registerLink(program: Command): void;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerLint(program: Command): void;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerLogs(program: Command): void;
@@ -0,0 +1,4 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerMcp(program: Command): void;
3
+ /** The one tool the bridge serves itself while it cannot reach Somewhere. */
4
+ export declare const BRIDGE_STATUS_TOOL = "somewhere_status";
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerOpen(program: Command): void;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerPostgres(program: Command): void;
@@ -0,0 +1,8 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerProject(program: Command): void;
3
+ /** The allowlist as the platform reports it. */
4
+ export interface AllowedOriginsResult {
5
+ project_id?: string;
6
+ allowed_origins?: string[];
7
+ cors_mode?: string;
8
+ }
@@ -0,0 +1,28 @@
1
+ import { Command } from 'commander';
2
+ import { type PublishSurfaceCounts } from '../lib/surface-counts.js';
3
+ interface PromoteResult {
4
+ version: number;
5
+ files_promoted: number;
6
+ /** Sent by newer platform versions; absent ones only carry has_functions. */
7
+ functions_promoted?: unknown;
8
+ has_functions: boolean;
9
+ /** The platform's own sentence about what promotion did to the data, when it
10
+ * sends one. It wins over the CLI's wording so the line can be corrected
11
+ * without a CLI release. */
12
+ data_notice?: unknown;
13
+ /** Compatibility with the field understood by 0.31.3. */
14
+ data_note?: unknown;
15
+ promoted_draft_id?: string;
16
+ preview_session_id?: string;
17
+ preview_id?: string;
18
+ active_release_id?: string;
19
+ release_id?: string;
20
+ /** Production functions the preview lacked that stayed live (the default). */
21
+ preserved_functions?: string[];
22
+ /** Production functions removed because --prune was passed. */
23
+ removed_functions?: string[];
24
+ }
25
+ export declare function promoteSurfaceFromResponse(result: Pick<PromoteResult, 'files_promoted' | 'functions_promoted' | 'has_functions'>): PublishSurfaceCounts;
26
+ export declare function promoteDataNotesFromResponse(result: Pick<PromoteResult, 'data_notice' | 'data_note'>): string[];
27
+ export declare function registerPromote(program: Command): void;
28
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerPull(program: Command): void;
@@ -0,0 +1,5 @@
1
+ import { Command } from 'commander';
2
+ /** `somewhere restore <version>`: make an earlier version live again through the
3
+ * platform's restore route (the one MCP project_restore_version calls). The
4
+ * version list is `somewhere status` / MCP project_deploys. */
5
+ export declare function registerRestore(program: Command): void;
@@ -0,0 +1,21 @@
1
+ import { Command } from 'commander';
2
+ /** Remember in the linked folder that it put this release live itself, so a
3
+ * later refused deploy names this folder's own rollback/restore (tsk_0dcd7530). */
4
+ export declare function rememberActivation(kind: 'rollback' | 'restore', projectId: string, result: Pick<RollbackResult, 'active_release_id' | 'version'>): void;
5
+ export interface RollbackResult {
6
+ restored_at: string;
7
+ version: number;
8
+ /** The release now live, and the one it replaced (platform 2026-11-11+). */
9
+ active_release_id?: string;
10
+ from_release_id?: string | null;
11
+ files_restored?: number | null;
12
+ message?: string | null;
13
+ /** Tables and columns added since the target stay, with their data (null when none). */
14
+ database_notice?: string | null;
15
+ }
16
+ /** The "Version notes" lines: the platform's message, then its database
17
+ * notice unless the message already says it word for word. */
18
+ export declare function formatRollbackNotes(result: Pick<RollbackResult, 'message' | 'database_notice'>): string[];
19
+ export declare function formatRollbackSuccess(result: Pick<RollbackResult, 'version' | 'files_restored'>): string;
20
+ export declare function registerRollback(program: Command): void;
21
+ export declare function rollbackErrorMessage(err: unknown): string;