@somewhere-cloud/cli 0.38.109 → 0.38.111
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 +12 -0
- package/README.md +6 -8
- package/dist/commands/ai.js +3 -2
- package/dist/commands/ai.js.map +1 -1
- package/dist/commands/api.js +2 -1
- package/dist/commands/api.js.map +1 -1
- package/dist/commands/auth.js +16 -15
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/browser.js +4 -3
- package/dist/commands/browser.js.map +1 -1
- package/dist/commands/call.js +6 -5
- package/dist/commands/call.js.map +1 -1
- package/dist/commands/catalog.js +2 -1
- package/dist/commands/catalog.js.map +1 -1
- package/dist/commands/check.js +14 -13
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/claim.js +5 -4
- package/dist/commands/claim.js.map +1 -1
- package/dist/commands/cron.js +10 -9
- package/dist/commands/cron.js.map +1 -1
- package/dist/commands/db.js +5 -4
- package/dist/commands/db.js.map +1 -1
- package/dist/commands/deploy.d.ts +1 -2
- package/dist/commands/deploy.js +140 -139
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.js +38 -37
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/docs.js +28 -27
- package/dist/commands/docs.js.map +1 -1
- package/dist/commands/email.js +3 -2
- package/dist/commands/email.js.map +1 -1
- package/dist/commands/env.js +3 -2
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/errors.js +2 -1
- package/dist/commands/errors.js.map +1 -1
- package/dist/commands/feedback.js +2 -1
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/fs.js +2 -1
- package/dist/commands/fs.js.map +1 -1
- package/dist/commands/git.js +3 -2
- package/dist/commands/git.js.map +1 -1
- package/dist/commands/hooks.js +2 -1
- package/dist/commands/hooks.js.map +1 -1
- package/dist/commands/init.js +27 -23
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/mcp.js +15 -14
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/postgres.js +13 -12
- package/dist/commands/postgres.js.map +1 -1
- package/dist/commands/project.js +5 -4
- package/dist/commands/project.js.map +1 -1
- package/dist/commands/promote.js +10 -9
- package/dist/commands/promote.js.map +1 -1
- package/dist/commands/pull.js +5 -4
- package/dist/commands/pull.js.map +1 -1
- package/dist/commands/restore.js +5 -4
- package/dist/commands/restore.js.map +1 -1
- package/dist/commands/rollback.js +7 -3
- package/dist/commands/rollback.js.map +1 -1
- package/dist/commands/run.js +3 -2
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/skills.js +3 -2
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/support.js +2 -1
- package/dist/commands/support.js.map +1 -1
- package/dist/commands/tasks.js +4 -3
- package/dist/commands/tasks.js.map +1 -1
- package/dist/commands/typecheck.d.ts +1 -1
- package/dist/commands/typecheck.js +11 -10
- package/dist/commands/typecheck.js.map +1 -1
- package/dist/commands/update.js +3 -2
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/upgrade.js +4 -3
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/commands/verify.js +13 -12
- package/dist/commands/verify.js.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/lib/advisor-runs.js +3 -2
- package/dist/lib/advisor-runs.js.map +1 -1
- package/dist/lib/agent-hooks.js +4 -3
- package/dist/lib/agent-hooks.js.map +1 -1
- package/dist/lib/app-test.d.ts +3 -2
- package/dist/lib/app-test.js +7 -3
- package/dist/lib/app-test.js.map +1 -1
- package/dist/lib/browser-run.js +3 -2
- package/dist/lib/browser-run.js.map +1 -1
- package/dist/lib/claim-handoff.js +3 -2
- package/dist/lib/claim-handoff.js.map +1 -1
- package/dist/lib/cli-invocation.d.ts +2 -0
- package/dist/lib/cli-invocation.js +5 -0
- package/dist/lib/cli-invocation.js.map +1 -0
- package/dist/lib/client.js +6 -5
- package/dist/lib/client.js.map +1 -1
- package/dist/lib/config.js +4 -3
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/device-login.js +4 -3
- package/dist/lib/device-login.js.map +1 -1
- package/dist/lib/files.js +4 -3
- package/dist/lib/files.js.map +1 -1
- package/dist/lib/form-auth.d.ts +1 -1
- package/dist/lib/form-auth.js +2 -1
- package/dist/lib/form-auth.js.map +1 -1
- package/dist/lib/frontend-dev.js +6 -2
- package/dist/lib/frontend-dev.js.map +1 -1
- package/dist/lib/init-agent-guide.d.ts +2 -2
- package/dist/lib/init-agent-guide.js +1 -0
- package/dist/lib/init-agent-guide.js.map +1 -1
- package/dist/lib/init-feature-template.js +1 -0
- package/dist/lib/init-feature-template.js.map +1 -1
- package/dist/lib/init-features.js +9 -8
- package/dist/lib/init-features.js.map +1 -1
- package/dist/lib/init-test-template.js +55 -37
- package/dist/lib/init-test-template.js.map +1 -1
- package/dist/lib/link-hint.js +3 -2
- package/dist/lib/link-hint.js.map +1 -1
- package/dist/lib/next-actions.js +10 -20
- package/dist/lib/next-actions.js.map +1 -1
- package/dist/lib/notify/index.d.ts +3 -0
- package/dist/lib/notify/index.js +9 -0
- package/dist/lib/notify/index.js.map +1 -1
- package/dist/lib/notify/providers/update.d.ts +1 -1
- package/dist/lib/notify/providers/update.js +4 -3
- package/dist/lib/notify/providers/update.js.map +1 -1
- package/dist/lib/operational-files.js +2 -1
- package/dist/lib/operational-files.js.map +1 -1
- package/dist/lib/output.js +2 -1
- package/dist/lib/output.js.map +1 -1
- package/dist/lib/playwright-fixtures.js +14 -4
- package/dist/lib/playwright-fixtures.js.map +1 -1
- package/dist/lib/post-live-render.d.ts +1 -1
- package/dist/lib/post-live-render.js +2 -1
- package/dist/lib/post-live-render.js.map +1 -1
- package/dist/lib/preview-jobs.js +3 -2
- package/dist/lib/preview-jobs.js.map +1 -1
- package/dist/lib/project-pin.js +2 -1
- package/dist/lib/project-pin.js.map +1 -1
- package/dist/lib/promote-handoff.js +2 -1
- package/dist/lib/promote-handoff.js.map +1 -1
- package/dist/lib/publish-surface.js +2 -1
- package/dist/lib/publish-surface.js.map +1 -1
- package/dist/lib/skills-pack.generated.js +4 -4
- package/dist/lib/skills-pack.generated.js.map +1 -1
- package/dist/lib/skills-pack.js +4 -3
- package/dist/lib/skills-pack.js.map +1 -1
- package/dist/lib/surface-counts.js +2 -24
- package/dist/lib/surface-counts.js.map +1 -1
- package/dist/lib/test-control.d.ts +3 -0
- package/dist/lib/test-control.js +7 -1
- package/dist/lib/test-control.js.map +1 -1
- package/dist/lib/test-report.d.ts +3 -1
- package/dist/lib/test-report.js +10 -1
- package/dist/lib/test-report.js.map +1 -1
- package/dist/lib/test-reporter.js +9 -4
- package/dist/lib/test-reporter.js.map +1 -1
- package/dist/lib/test-run.d.ts +1 -0
- package/dist/lib/test-run.js +7 -1
- package/dist/lib/test-run.js.map +1 -1
- package/dist/lib/test-scripts.d.ts +1 -1
- package/dist/lib/test-scripts.js +7 -4
- package/dist/lib/test-scripts.js.map +1 -1
- package/dist/lib/typecheck.d.ts +3 -4
- package/dist/lib/typecheck.js +34 -15
- package/dist/lib/typecheck.js.map +1 -1
- package/dist/lib/update-security.js +2 -1
- package/dist/lib/update-security.js.map +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +5 -4
package/dist/commands/deploy.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { roleMethodHints } from '../lib/role-method-hints.js';
|
|
2
|
-
import {
|
|
2
|
+
import { cliInvocation } from '../lib/cli-invocation.js';
|
|
3
|
+
import { suppressExitNotices } from '../lib/notify/index.js';
|
|
3
4
|
import { existsSync } from 'node:fs';
|
|
4
5
|
import { join } from 'node:path';
|
|
5
|
-
import { runTypecheck } from '../lib/typecheck.js';
|
|
6
|
+
import { missingProjectDependencies, runTypecheck } from '../lib/typecheck.js';
|
|
6
7
|
import { reportTypecheck } from './typecheck.js';
|
|
7
8
|
import { clearBaseFiles, hashFiles, loadLastActivation, saveBaseFiles } from '../lib/base-files.js';
|
|
8
9
|
import { withVerifyProgress } from '../lib/verify-progress.js';
|
|
@@ -26,7 +27,7 @@ import { showProjectNotices } from '../lib/project-notices.js';
|
|
|
26
27
|
import { prepareRunner } from '../lib/test-run.js';
|
|
27
28
|
import { formatDeployTestsLine, prepareDeployTests, runDeployTests } from '../lib/deploy-tests.js';
|
|
28
29
|
import { mark as timelineMark, markProcessStart } from '../lib/test-timeline.js';
|
|
29
|
-
import { formatNextActions, nextActions } from '../lib/next-actions.js';
|
|
30
|
+
import { formatNextActions, nextActions, shellQuote } from '../lib/next-actions.js';
|
|
30
31
|
import { countFromResponse, countFunctionRoutes, formatPublishSurface, formatUploadInventory, uploadInventory } from '../lib/surface-counts.js';
|
|
31
32
|
import { formatVerifyOutput, loadVerifyFlow, runVerification, } from './verify.js';
|
|
32
33
|
// Resolve the deploy target directory. `resolve` (not `join`) so an absolute
|
|
@@ -74,7 +75,7 @@ const NEXT_DEPENDENCY_SECTIONS = [
|
|
|
74
75
|
'optionalDependencies',
|
|
75
76
|
];
|
|
76
77
|
const NEXT_APP_WARNING = "Next.js apps do not run here. Somewhere supports HTML responses from ordinary server functions. " +
|
|
77
|
-
|
|
78
|
+
`Port API routes to api/ handlers and HTML pages to root routes such as [...path].ts, or start from a Vite React app. Read ${cliInvocation()} docs functions; deploy raw JSX/TSX.`;
|
|
78
79
|
const DEPLOY_HEARTBEAT_MS = 30_000;
|
|
79
80
|
const DEPLOY_MAX_ATTEMPTS = 2;
|
|
80
81
|
// The CLI's OWN verdicts — transport failures it detected itself, where no
|
|
@@ -85,8 +86,8 @@ const RETRYABLE_DEPLOY_CODES = new Set(['TIMEOUT', 'SERVER_SLOW', 'NETWORK_ERROR
|
|
|
85
86
|
// one retry. A wait the platform asks for is worth honouring; an unbounded one
|
|
86
87
|
// is a hang, and `somewhere deploy` must stay a command that finishes.
|
|
87
88
|
const DEPLOY_RETRY_MAX_WAIT_MS = 10_000;
|
|
88
|
-
export const POST_DEPLOY_HINT =
|
|
89
|
-
|
|
89
|
+
export const POST_DEPLOY_HINT = `Next: keep building with \`${cliInvocation()} dev\`; run \`${cliInvocation()} deploy\` to update this live app. ` +
|
|
90
|
+
`Once it has real users or data, use \`${cliInvocation()} preview\` before changing what they see.`;
|
|
90
91
|
export function isNextAppShapeSignal(signal) {
|
|
91
92
|
return signal.startsWith(`${NEXT_APP_SIGNAL_PREFIX} (`);
|
|
92
93
|
}
|
|
@@ -168,23 +169,21 @@ export function formatTtlHours(ttlSeconds) {
|
|
|
168
169
|
return 3;
|
|
169
170
|
return Math.round(ttlSeconds / 3600) || 3;
|
|
170
171
|
}
|
|
171
|
-
export function formatRemainingTempTime(expiresAt, nowMs = Date.now()) {
|
|
172
|
-
const expiresMs = new Date(expiresAt).getTime();
|
|
173
|
-
if (!Number.isFinite(expiresMs))
|
|
174
|
-
return null;
|
|
175
|
-
const totalMinutes = Math.max(0, Math.ceil((expiresMs - nowMs) / 60_000));
|
|
176
|
-
const hours = Math.floor(totalMinutes / 60);
|
|
177
|
-
const minutes = totalMinutes % 60;
|
|
178
|
-
return hours > 0 ? `${hours}h ${minutes}m` : `${minutes}m`;
|
|
179
|
-
}
|
|
180
172
|
export function formatTempExpiry(expiresAt, ttlSeconds, nowMs = Date.now()) {
|
|
181
|
-
const
|
|
182
|
-
//
|
|
183
|
-
//
|
|
184
|
-
|
|
185
|
-
&& (
|
|
186
|
-
|
|
187
|
-
|
|
173
|
+
const remainingMs = expiresAt ? Date.parse(expiresAt) - nowMs : NaN;
|
|
174
|
+
// If this terminal's clock disagrees with the server, describe the lifetime
|
|
175
|
+
// from creation rather than making a promise about how much is left.
|
|
176
|
+
if (!Number.isFinite(remainingMs) || (ttlSeconds !== undefined && Number.isFinite(ttlSeconds)
|
|
177
|
+
&& (remainingMs > ttlSeconds * 1000 + 60_000 || remainingMs < -60_000))) {
|
|
178
|
+
return `Temporary app. Expires about ${plural(formatTtlHours(ttlSeconds), 'hour')} after it was created.`;
|
|
179
|
+
}
|
|
180
|
+
if (remainingMs <= 0)
|
|
181
|
+
return 'Temporary app. It has expired.';
|
|
182
|
+
const minutes = Math.ceil(remainingMs / 60_000);
|
|
183
|
+
const remaining = minutes >= 60
|
|
184
|
+
? plural(Math.round(minutes / 60), 'hour')
|
|
185
|
+
: plural(minutes < 5 ? minutes : Math.min(55, Math.round(minutes / 5) * 5), 'minute');
|
|
186
|
+
return `Temporary app. Expires in about ${remaining}.`;
|
|
188
187
|
}
|
|
189
188
|
function plural(count, singular, pluralWord = `${singular}s`) {
|
|
190
189
|
return `${count} ${count === 1 ? singular : pluralWord}`;
|
|
@@ -261,8 +260,8 @@ export function formatStaleBaseExplanation(details, nowMs = Date.now()) {
|
|
|
261
260
|
versionSummary,
|
|
262
261
|
'',
|
|
263
262
|
'Next steps:',
|
|
264
|
-
|
|
265
|
-
|
|
263
|
+
` Run \`${cliInvocation()} pull\` to bring the latest deployed source into this directory, review it, then deploy again.`,
|
|
264
|
+
` Run \`${cliInvocation()} deploy --force\` to overwrite those remote changes intentionally.`,
|
|
266
265
|
].filter((line) => line !== null).join('\n');
|
|
267
266
|
}
|
|
268
267
|
// The release-native staleness guard: another production update landed after
|
|
@@ -323,8 +322,8 @@ export function formatStaleReleaseBaseExplanation(details = {}, historyUnavailab
|
|
|
323
322
|
: d.history_unavailable ? 'The earlier version is no longer available to compare, so the differing files cannot be listed.' : null,
|
|
324
323
|
'',
|
|
325
324
|
own
|
|
326
|
-
? `Next step: run
|
|
327
|
-
:
|
|
325
|
+
? `Next step: run \`${cliInvocation()} pull\` to bring this folder to live (local-only files are kept), or \`${cliInvocation()} restore ${d.base_version ?? '<version>'}\` to make ${folder} live again.`
|
|
326
|
+
: `Next step: run \`${cliInvocation()} pull\`. It brings the published files up to live, keeps local-only files and your local edits, and stops on a file changed both here and live. Then deploy again.`,
|
|
328
327
|
].filter((line) => line !== null).join('\n');
|
|
329
328
|
}
|
|
330
329
|
/**
|
|
@@ -340,8 +339,8 @@ export function formatAmbiguousRetryStaleExplanation(transportFailure) {
|
|
|
340
339
|
`The first deploy attempt ${what} before the platform answered, so it may already have gone live. The automatic retry was refused because the live release is now newer than the version this folder came from; that refusal changed nothing.`,
|
|
341
340
|
'',
|
|
342
341
|
'Next steps:',
|
|
343
|
-
|
|
344
|
-
|
|
342
|
+
` Check the live release before deploying again: run \`${cliInvocation()} pull\` into a separate folder (or open the dashboard) and compare it with your changes.`,
|
|
343
|
+
` If your changes are live, you are done. If they are not, deploy again from the pulled source, or run \`${cliInvocation()} deploy --force\` to replace the live release intentionally.`,
|
|
345
344
|
].join('\n');
|
|
346
345
|
}
|
|
347
346
|
/** Signed in, nothing linked: deploy never creates or links a project in the
|
|
@@ -351,8 +350,8 @@ export function formatSignedInUnlinkedExplanation() {
|
|
|
351
350
|
'No project is linked to this folder. You are signed in, so deploy will not create or pick a project in your account on its own.',
|
|
352
351
|
'',
|
|
353
352
|
'Next steps:',
|
|
354
|
-
|
|
355
|
-
|
|
353
|
+
` New project: run \`${cliInvocation()} init --bare --name <name>\` (creates it in your account and links this folder; adds .somewhere.json, AGENTS.md/CLAUDE.md and agent skills, no app source), then \`${cliInvocation()} deploy\`.`,
|
|
354
|
+
` Existing project: run \`${cliInvocation()} init --link --project <name-or-id>\` (list yours with \`${cliInvocation()} projects\`), or deploy once with \`${cliInvocation()} deploy --project <name-or-id>\`.`,
|
|
356
355
|
].join('\n');
|
|
357
356
|
}
|
|
358
357
|
/** The folder's link names a project this sign-in cannot open (
|
|
@@ -363,14 +362,14 @@ export function formatSignedInUnlinkedExplanation() {
|
|
|
363
362
|
export function linkedProjectNotFoundSteps(signedIn) {
|
|
364
363
|
return signedIn
|
|
365
364
|
? [
|
|
366
|
-
|
|
367
|
-
|
|
365
|
+
`See your projects: \`${cliInvocation()} projects\`.`,
|
|
366
|
+
`Deploy this folder to one of them: \`${cliInvocation()} init --link --project <name-or-id>\`, then \`${cliInvocation()} deploy\`.`,
|
|
368
367
|
// init refuses a linked folder without a terminal, so the stale link goes first.
|
|
369
|
-
|
|
368
|
+
`Or create a new project for it: delete this folder\'s .somewhere.json (your other files are kept), run \`${cliInvocation()} init --bare --name <name>\`, then \`${cliInvocation()} deploy\`.`,
|
|
370
369
|
]
|
|
371
370
|
: [
|
|
372
|
-
|
|
373
|
-
|
|
371
|
+
`If the project is in your account, sign in with \`${cliInvocation()} login\` and deploy again.`,
|
|
372
|
+
`Start a new temporary project: delete this folder\'s .somewhere.json, then run \`${cliInvocation()} deploy\` again.`,
|
|
374
373
|
];
|
|
375
374
|
}
|
|
376
375
|
export function formatLinkedProjectNotFoundExplanation(linkedProjectId, signedIn) {
|
|
@@ -388,12 +387,12 @@ export function formatSignedOutExistingTargetExplanation(projectId, fromLink) {
|
|
|
388
387
|
'',
|
|
389
388
|
'Next steps:',
|
|
390
389
|
...(fromLink
|
|
391
|
-
? [
|
|
390
|
+
? [` If you deployed this folder signed out earlier, its temporary credential is in ~/.somewhere/config.json of the terminal you used then: run \`${cliInvocation()} deploy\` there. An agent\'s sandboxed shell or another user account does not see it.`]
|
|
392
391
|
: []),
|
|
393
|
-
|
|
392
|
+
` If the project is in your account, run \`${cliInvocation()} login\` (it prints a code; approve it in any browser), then deploy again. Without a person to approve: \`printf %s "$SOMEWHERE_TOKEN" | ${cliInvocation()} auth set\` saves an smt_ key; the SOMEWHERE_TOKEN variable on its own does not sign commands in.`,
|
|
394
393
|
fromLink
|
|
395
|
-
?
|
|
396
|
-
:
|
|
394
|
+
? ` Start a new temporary project instead: delete this folder\'s .somewhere.json, then run \`${cliInvocation()} deploy\` again.`
|
|
395
|
+
: ` Start a new temporary project instead: run \`${cliInvocation()} deploy\` without --project in a folder that is not linked.`,
|
|
397
396
|
].join('\n');
|
|
398
397
|
}
|
|
399
398
|
/** The stored temporary session expired before this deploy (
|
|
@@ -404,9 +403,9 @@ export function formatExpiredTemporaryProjectExplanation(expiredAt) {
|
|
|
404
403
|
`The temporary workspace on this machine expired at ${expiredAt}, and this machine has no record of a claim. Its projects can no longer be deployed to, and a new temporary workspace cannot deploy to this folder's linked project. Nothing was deployed.`,
|
|
405
404
|
'',
|
|
406
405
|
'Next steps:',
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
406
|
+
` If you claimed this workspace in the browser, sign in with \`${cliInvocation()} login\` and deploy again; your projects are in your account.`,
|
|
407
|
+
` Start a new temporary project: delete this folder\'s .somewhere.json, then run \`${cliInvocation()} deploy\` again.`,
|
|
408
|
+
` Keep your work in an account: sign in (\`${cliInvocation()} login\`, or \`${cliInvocation()} signup\`), then run \`${cliInvocation()} init --bare --name <name>\` and \`${cliInvocation()} deploy\`.`,
|
|
410
409
|
].join('\n');
|
|
411
410
|
}
|
|
412
411
|
// No record of which published version this folder's source came from (a
|
|
@@ -422,8 +421,8 @@ export function formatBaseRequiredExplanation() {
|
|
|
422
421
|
'This folder has no record of which published version its files came from, so the deploy was NOT applied.',
|
|
423
422
|
'',
|
|
424
423
|
'Next steps:',
|
|
425
|
-
|
|
426
|
-
|
|
424
|
+
` Run \`${cliInvocation()} pull\` to start from the current version, re-apply your changes, then deploy again.`,
|
|
425
|
+
` Run \`${cliInvocation()} deploy --force\` to replace the current version with this folder intentionally.`,
|
|
427
426
|
].join('\n');
|
|
428
427
|
}
|
|
429
428
|
/** `--project <ref>` named a project that is not the one this folder is linked
|
|
@@ -434,9 +433,9 @@ export function formatLinkedProjectMismatchExplanation(linkedProjectId, ref, res
|
|
|
434
433
|
`This folder is linked to project ${linkedProjectId} (in .somewhere.json), but --project ${ref} names a different project (${resolvedProjectId}). Your deploy was NOT applied.`,
|
|
435
434
|
'',
|
|
436
435
|
'Next steps:',
|
|
437
|
-
|
|
438
|
-
` Move this folder to ${ref} deliberately: delete this folder's .somewhere.json, then run
|
|
439
|
-
` Deploy a copy elsewhere: copy the files into an unlinked folder and run
|
|
436
|
+
` Deploy this folder to its linked project: run \`${cliInvocation()} deploy\` (no --project).`,
|
|
437
|
+
` Move this folder to ${ref} deliberately: delete this folder's .somewhere.json, then run \`${cliInvocation()} init --link --project ${ref}\`, \`${cliInvocation()} pull\`, re-apply your changes, and \`${cliInvocation()} deploy\`.`,
|
|
438
|
+
` Deploy a copy elsewhere: copy the files into an unlinked folder and run \`${cliInvocation()} deploy --project ${ref}\` there.`,
|
|
440
439
|
].join('\n');
|
|
441
440
|
}
|
|
442
441
|
/** BASE_REQUIRED for an explicit --project target whose live release could not
|
|
@@ -447,8 +446,8 @@ export function formatExplicitProjectBaseRequiredExplanation(ref) {
|
|
|
447
446
|
`The live version of project ${ref} could not be read before deploying, and this folder has no record of which published version its files came from, so the deploy was NOT applied.`,
|
|
448
447
|
'',
|
|
449
448
|
'Next steps:',
|
|
450
|
-
` Link and pull first:
|
|
451
|
-
` Or replace the live release deliberately:
|
|
449
|
+
` Link and pull first: \`${cliInvocation()} init --link --project ${ref}\`, then \`${cliInvocation()} pull\`, re-apply your changes, then \`${cliInvocation()} deploy\`.`,
|
|
450
|
+
` Or replace the live release deliberately: \`${cliInvocation()} deploy --project ${ref} --force --yes\`.`,
|
|
452
451
|
].join('\n');
|
|
453
452
|
}
|
|
454
453
|
/** Bound on the prestart request; it answers at once, so this only caps a stalled connection. */
|
|
@@ -552,14 +551,14 @@ export function registerDeploy(program) {
|
|
|
552
551
|
program
|
|
553
552
|
.command('deploy [dir]')
|
|
554
553
|
.description('Deploy the current directory (anonymous automatically when logged out)')
|
|
555
|
-
.addHelpText('after',
|
|
554
|
+
.addHelpText('after', `\nFunctions missing from the directory: a full \`${cliInvocation()} deploy\` REMOVES deployed functions that\n`
|
|
556
555
|
+ 'are not in this directory (each one is named in the output). `--scope functions` keeps them unless\n'
|
|
557
|
-
+
|
|
556
|
+
+ `--replace-functions. \`${cliInvocation()} promote\` is the opposite: it keeps them unless --prune.\n`
|
|
558
557
|
+ '\nNo project yet? Signed in, deploy never creates one on its own:\n'
|
|
559
|
-
+
|
|
560
|
-
+
|
|
561
|
-
+
|
|
562
|
-
.option('--project <ref>',
|
|
558
|
+
+ ` ${cliInvocation()} init --bare --name <name> create a project in your account and link this folder\n`
|
|
559
|
+
+ ` ${cliInvocation()} deploy then deploy it\n`
|
|
560
|
+
+ `Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cliInvocation()} projects\`), or \`--project <ref>\` here.\n`)
|
|
561
|
+
.option('--project <ref>', `Existing project to deploy to — accepts the project UUID, slug, or subdomain (all three resolve server-side). To create one, run \`${cliInvocation()} init --bare --name <name>\``)
|
|
563
562
|
.option('--scope <scope>', "Partial deploy: 'functions' (backend only, leaves the site untouched) or 'static' (site only, leaves functions untouched). Default deploys both.")
|
|
564
563
|
.option('--dry-run', 'Show what would change (added / modified / removed files) in an already deployed project, without deploying. The files a deploy would publish are sent to Somewhere to compute the change; nothing is published. Never creates a project or a temporary workspace.')
|
|
565
564
|
.option('--replace-functions', 'Delete deployed functions that are not in this directory. A full deploy already does; use it with --scope functions, which otherwise keeps them.')
|
|
@@ -582,7 +581,7 @@ export function registerDeploy(program) {
|
|
|
582
581
|
.option('--json', 'Print the raw deploy response as JSON on stdout; files left out locally are listed on stderr by path and reason')
|
|
583
582
|
.option('--list-unpublished', 'List the local files this deploy keeps on your machine, and how to publish one on purpose')
|
|
584
583
|
.option('--allow-type-errors', 'Upload even when the local TypeScript check fails')
|
|
585
|
-
.option('--timing', 'Print
|
|
584
|
+
.option('--timing', 'Print deploy details and timings')
|
|
586
585
|
.action(async (dir, opts) => {
|
|
587
586
|
// performance.now() counts from process start, so this is the real
|
|
588
587
|
// start-up cost (runtime boot + module load) before the command ran.
|
|
@@ -597,7 +596,9 @@ export function registerDeploy(program) {
|
|
|
597
596
|
const typecheckStartedAt = performance.now();
|
|
598
597
|
// Collection, authentication and packaging can proceed while tsc runs.
|
|
599
598
|
// Observe rejection immediately, then enforce the result before upload.
|
|
600
|
-
const
|
|
599
|
+
const hasTsconfig = existsSync(join(targetDir, 'tsconfig.json'));
|
|
600
|
+
const missingDependencies = hasTsconfig && missingProjectDependencies(targetDir).length > 0;
|
|
601
|
+
const typecheck = hasTsconfig && !missingDependencies
|
|
601
602
|
? runTypecheck(targetDir).then(value => ({ value }), (error) => ({ error }))
|
|
602
603
|
.finally(() => { typecheckMs = performance.now() - typecheckStartedAt; })
|
|
603
604
|
: Promise.resolve(null);
|
|
@@ -642,7 +643,7 @@ export function registerDeploy(program) {
|
|
|
642
643
|
&& Object.keys(binaryFiles).length === 0
|
|
643
644
|
&& Object.keys(functions).length === 0) {
|
|
644
645
|
const message = 'No deployable source found. Create an index.html or add raw app source files, ' +
|
|
645
|
-
|
|
646
|
+
`or add serverless handlers under functions/, then run \`${cliInvocation()} deploy\` again.`;
|
|
646
647
|
if (opts.json)
|
|
647
648
|
printJsonError('NO_DEPLOYABLE_SOURCE', message);
|
|
648
649
|
else
|
|
@@ -999,7 +1000,7 @@ export function registerDeploy(program) {
|
|
|
999
1000
|
if (opts.force && !opts.yes) {
|
|
1000
1001
|
await settleNotices();
|
|
1001
1002
|
if (!process.stdin.isTTY) {
|
|
1002
|
-
const message =
|
|
1003
|
+
const message = `Refusing to force deploy without confirmation in a non-interactive shell. Run \`${cliInvocation()} deploy --force --yes\` to overwrite remote changes intentionally.`;
|
|
1003
1004
|
if (opts.json) {
|
|
1004
1005
|
printJsonError('CONFIRMATION_REQUIRED', message);
|
|
1005
1006
|
}
|
|
@@ -1029,7 +1030,7 @@ export function registerDeploy(program) {
|
|
|
1029
1030
|
// folder it was built in. Name every held-back file — a silent exclusion
|
|
1030
1031
|
// is how a private note gets published, and how a needed file goes
|
|
1031
1032
|
// missing without anyone noticing.
|
|
1032
|
-
if (excluded.length && !opts.json) {
|
|
1033
|
+
if (excluded.length && !opts.json && (!tempSession || tempSession.reused || opts.listUnpublished || opts.timing)) {
|
|
1033
1034
|
spinner?.stop();
|
|
1034
1035
|
// A dry run leaves .somewhere.json as it found it.
|
|
1035
1036
|
printExcludedFiles(excluded, targetDir, { list: Boolean(opts.listUnpublished) });
|
|
@@ -1077,7 +1078,7 @@ export function registerDeploy(program) {
|
|
|
1077
1078
|
warn('server source will be publicly readable at its file path.');
|
|
1078
1079
|
warn('The platform shape: static files at the root + API handlers under functions/');
|
|
1079
1080
|
warn('(each default-exports async (req, sw) and becomes a route).');
|
|
1080
|
-
warn(
|
|
1081
|
+
warn(`Full quickstart: ${cliInvocation()} docs start`);
|
|
1081
1082
|
}
|
|
1082
1083
|
if (process.stderr.isTTY)
|
|
1083
1084
|
spinner?.start();
|
|
@@ -1203,6 +1204,8 @@ export function registerDeploy(program) {
|
|
|
1203
1204
|
body.source = 'cli';
|
|
1204
1205
|
if (opts.force)
|
|
1205
1206
|
body.force = true;
|
|
1207
|
+
if (missingDependencies)
|
|
1208
|
+
process.stderr.write('Types were not checked locally because project dependencies are not installed.\n');
|
|
1206
1209
|
const checked = await typecheck;
|
|
1207
1210
|
if (checked && 'error' in checked)
|
|
1208
1211
|
throw checked.error;
|
|
@@ -1214,7 +1217,7 @@ export function registerDeploy(program) {
|
|
|
1214
1217
|
if (!opts.allowTypeErrors) {
|
|
1215
1218
|
stopPrestart();
|
|
1216
1219
|
spinner?.stop();
|
|
1217
|
-
error(
|
|
1220
|
+
error(`Deploy stopped before upload. To proceed anyway: ${cliInvocation()} deploy --allow-type-errors`);
|
|
1218
1221
|
process.exitCode = 1;
|
|
1219
1222
|
return;
|
|
1220
1223
|
}
|
|
@@ -1280,7 +1283,7 @@ export function registerDeploy(program) {
|
|
|
1280
1283
|
// one that deployed it (never a throwaway beside a real login: the
|
|
1281
1284
|
// folder's .somewhere.json is the developer's own link).
|
|
1282
1285
|
if (!besideRealLogin && recordPinIfMissing(deployStateEntry?.dir ?? targetDir, CLI_VERSION) && !opts.json) {
|
|
1283
|
-
info(`Recorded somewhere CLI ${CLI_VERSION} in .somewhere.json (cli_version).
|
|
1286
|
+
info(`Recorded somewhere CLI ${CLI_VERSION} in .somewhere.json (cli_version). \`${cliInvocation()} upgrade\` moves it.`);
|
|
1284
1287
|
}
|
|
1285
1288
|
if (!tempSession && deployStateEntry && result.project_id === deployStateEntry.config.project_id) {
|
|
1286
1289
|
saveProjectAppUrl(deployStateEntry.dir, deployStateEntry.config.project_id, httpsOrigin(result.url));
|
|
@@ -1328,10 +1331,10 @@ export function registerDeploy(program) {
|
|
|
1328
1331
|
};
|
|
1329
1332
|
const verificationNextSteps = besideRealLogin ? [
|
|
1330
1333
|
'Inspect the live URL; keep this project and its claim URL.',
|
|
1331
|
-
|
|
1334
|
+
`After claiming and connecting this project, run: ${cliInvocation()} verify --project <PROJECT>`,
|
|
1332
1335
|
] : [
|
|
1333
|
-
|
|
1334
|
-
|
|
1336
|
+
`Read the live release: ${cliInvocation()} status --project <PROJECT>`,
|
|
1337
|
+
`Run verification without deploying: ${cliInvocation()} verify --project <PROJECT>`,
|
|
1335
1338
|
];
|
|
1336
1339
|
if (opts.json) {
|
|
1337
1340
|
// A temporary session adds the claim fields to the server's result;
|
|
@@ -1370,10 +1373,14 @@ export function registerDeploy(program) {
|
|
|
1370
1373
|
// static-only deploy or counts static files on a backend-only deploy
|
|
1371
1374
|
// (audit #3: the old output printed "Functions deployed" + a static
|
|
1372
1375
|
// count + "the other layer was left untouched" all at once).
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
if (
|
|
1376
|
-
|
|
1376
|
+
const firstTemporaryRelease = Boolean(tempSession && result.version === 1);
|
|
1377
|
+
const cwdDeploysToProject = loadProjectConfig()?.project_id === (result.project_id ?? projectId);
|
|
1378
|
+
if (!firstTemporaryRelease || opts.timing) {
|
|
1379
|
+
success(formatted.headline);
|
|
1380
|
+
info(dim(formatUploadInventory(inventory)));
|
|
1381
|
+
if (formatted.projectRef)
|
|
1382
|
+
info(`Project: ${teal(formatted.projectRef)}`);
|
|
1383
|
+
}
|
|
1377
1384
|
// Build log: entry chunk, chunks + sizes, functions + sizes (returned
|
|
1378
1385
|
// by the worker since ). Surface it instead of a bare
|
|
1379
1386
|
// "deployed." so the dev can see what the compiler actually produced.
|
|
@@ -1392,7 +1399,7 @@ export function registerDeploy(program) {
|
|
|
1392
1399
|
// directory — named, so a rename never leaves a silent leftover.
|
|
1393
1400
|
if (result.removed_functions && result.removed_functions.length > 0) {
|
|
1394
1401
|
warn(`Removed ${result.removed_functions.length} function(s) no longer in this directory: ${result.removed_functions.join(', ')}. `
|
|
1395
|
-
+
|
|
1402
|
+
+ `A full deploy publishes exactly this directory (unlike \`${cliInvocation()} promote\`, which keeps them unless --prune).`);
|
|
1396
1403
|
}
|
|
1397
1404
|
// Warnings + function errors must be loud — never let a "success"
|
|
1398
1405
|
// line hide a partial failure (fail-loudly principle).
|
|
@@ -1406,14 +1413,27 @@ export function registerDeploy(program) {
|
|
|
1406
1413
|
if (result.warnings && result.warnings.length > 0) {
|
|
1407
1414
|
const buildWarnings = warningsInBuildLog(result.build_log);
|
|
1408
1415
|
for (const w of result.warnings) {
|
|
1416
|
+
// The first release normally creates tables and indexes. Keep the
|
|
1417
|
+
// receipt in --json and --timing, and still print actual warnings.
|
|
1418
|
+
const schemaCreated = /^Database schema: (?:table |index on ).+ is created(?:[ .(]|$)/.test(w);
|
|
1419
|
+
if (firstTemporaryRelease && !opts.timing && schemaCreated)
|
|
1420
|
+
continue;
|
|
1409
1421
|
if (!buildWarnings.has(normalizeWarning(w)))
|
|
1410
1422
|
warn(w);
|
|
1411
1423
|
}
|
|
1412
1424
|
}
|
|
1413
|
-
if (result.previous)
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
console.log(result.
|
|
1425
|
+
if (result.previous) {
|
|
1426
|
+
const target = cwdDeploysToProject ? '' : ` --project ${shellQuote(result.project_id ?? projectId ?? '<project>')}`;
|
|
1427
|
+
const confirmation = process.stdin.isTTY ? '' : ' --yes';
|
|
1428
|
+
console.log(result.previous.rollback_available
|
|
1429
|
+
? `Version ${result.previous.version} is kept; ${cliInvocation()} rollback${target}${confirmation} returns to it.`
|
|
1430
|
+
: result.previous.message);
|
|
1431
|
+
}
|
|
1432
|
+
if (Array.isArray(result.privacy_lines) && (!firstTemporaryRelease || opts.timing)) {
|
|
1433
|
+
const lines = result.privacy_lines.filter(line => typeof line === 'string' && (opts.timing || !/^warning:/i.test(line)));
|
|
1434
|
+
if (lines.length)
|
|
1435
|
+
console.log(lines.join('\n'));
|
|
1436
|
+
}
|
|
1417
1437
|
if (result.runtime_fixes && result.runtime_fixes.length > 0) {
|
|
1418
1438
|
for (const fix of result.runtime_fixes)
|
|
1419
1439
|
success(fix.message);
|
|
@@ -1423,55 +1443,19 @@ export function registerDeploy(program) {
|
|
|
1423
1443
|
const unpromotable = Array.isArray(listed) ? listed.filter((id) => typeof id === 'string') : [];
|
|
1424
1444
|
if (unpromotable.length > 0) {
|
|
1425
1445
|
warn(`${unpromotable.length} open preview${unpromotable.length === 1 ? ' was' : 's were'} opened from the previous production version and can no longer be promoted: ${unpromotable.join(', ')}.`);
|
|
1426
|
-
info(
|
|
1446
|
+
info(`To ship a change from one: run \`${cliInvocation()} preview\` here (it opens a fresh preview from this release), and close the old ones with \`${cliInvocation()} preview close <preview_session_id>\` (\`${cliInvocation()} preview list\` shows them).`);
|
|
1427
1447
|
}
|
|
1428
|
-
if (tempSession) {
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
success(`Live URL: ${teal(formatted.liveUrl)}`);
|
|
1448
|
+
if (tempSession && !firstTemporaryRelease && !hasFunctionErrors && !verificationFailed) {
|
|
1449
|
+
if (!besideRealLogin) {
|
|
1450
|
+
const hint = formatReferenceCheckHint(result, cwdDeploysToProject);
|
|
1451
|
+
if (hint)
|
|
1452
|
+
info(hint);
|
|
1434
1453
|
}
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
}
|
|
1438
|
-
if (renderLine)
|
|
1439
|
-
warn(renderLine);
|
|
1440
|
-
info(`Claim URL: ${teal(tempSession.claimUrl)}`);
|
|
1441
|
-
if (tempSession.expiresAt) {
|
|
1442
|
-
info(formatTempExpiry(tempSession.expiresAt, tempSession.ttlSeconds));
|
|
1443
|
-
}
|
|
1444
|
-
else {
|
|
1445
|
-
const hours = formatTtlHours(tempSession.ttlSeconds);
|
|
1446
|
-
info(`Expires: about ${hours} hour${hours === 1 ? '' : 's'} after the temporary session was created`);
|
|
1447
|
-
}
|
|
1448
|
-
// Same discoverability the account path gets — this is a main
|
|
1449
|
-
// fresh-agent route, not a side door. Addressed by URL on purpose:
|
|
1450
|
-
// beside a real login the throwaway project is deliberately NOT in
|
|
1451
|
-
// `.somewhere.json`, so a bare `somewhere browser` would open the
|
|
1452
|
-
// developer's own app. Temporary credentials carry the `browser`
|
|
1453
|
-
// scope, so the URL form works on both temporary paths.
|
|
1454
|
-
if (!hasFunctionErrors && !verificationFailed) {
|
|
1455
|
-
for (const line of formatNextActions(nextActions({
|
|
1456
|
-
stage: 'deploy',
|
|
1457
|
-
projectLinked: false,
|
|
1458
|
-
liveUrl: formatted.liveUrl ?? null,
|
|
1459
|
-
temporary: true,
|
|
1460
|
-
}), { command: teal, why: dim })) {
|
|
1461
|
-
console.log(line);
|
|
1462
|
-
}
|
|
1454
|
+
for (const line of formatNextActions(nextActions({ stage: 'deploy', projectLinked: false, liveUrl: formatted.liveUrl, temporary: true }), { command: teal, why: dim })) {
|
|
1455
|
+
console.log(line);
|
|
1463
1456
|
}
|
|
1464
|
-
// Beside a real login the CLI's own credentials cannot read the throwaway project.
|
|
1465
|
-
const tempCheckHint = besideRealLogin ? null : formatReferenceCheckHint(result, loadProjectConfig()?.project_id === projectId);
|
|
1466
|
-
if (tempCheckHint)
|
|
1467
|
-
info(tempCheckHint);
|
|
1468
|
-
info(besideRealLogin
|
|
1469
|
-
? `Your permanent login is untouched. After claiming, keep this project and run ${teal(`somewhere init --link --project ${projectId}`)} only if this directory has no link. Do not unlink, create a replacement, or redeploy to recover it.`
|
|
1470
|
-
: tempSession.handoffReady
|
|
1471
|
-
? 'Tell the owner to choose "Save project and connect agent" on the claim page. This CLI then signs in on its next command, to this project only unless they choose all projects. If they save without connecting, they can connect it later from the same link, or run `somewhere login` here.'
|
|
1472
|
-
: `After claiming, run ${teal('somewhere login')} in this directory, then deploy as usual. Keep the existing project link, so deploys keep going to the claimed project.`);
|
|
1473
1457
|
}
|
|
1474
|
-
|
|
1458
|
+
if (!tempSession) {
|
|
1475
1459
|
if (formatted.liveUrl) {
|
|
1476
1460
|
success(`Live at ${teal(formatted.liveUrl)}`);
|
|
1477
1461
|
}
|
|
@@ -1519,19 +1503,40 @@ export function registerDeploy(program) {
|
|
|
1519
1503
|
else
|
|
1520
1504
|
error(formatDeployTestsLine(tests));
|
|
1521
1505
|
}
|
|
1522
|
-
// Exit non-zero if any function failed to deploy — a CI step that
|
|
1523
|
-
// shells out to `somewhere deploy` should fail, not pass green.
|
|
1524
|
-
if (hasFunctionErrors) {
|
|
1525
|
-
process.exit(1);
|
|
1526
|
-
}
|
|
1527
1506
|
if (verificationFailed) {
|
|
1528
1507
|
warn(verificationError
|
|
1529
1508
|
? `The deploy is live, but verification could not finish: ${verificationError.message} [${verificationError.code}]`
|
|
1530
1509
|
: 'The deploy is live, but verification did not pass.');
|
|
1531
1510
|
for (const step of verificationNextSteps)
|
|
1532
1511
|
info(step);
|
|
1512
|
+
}
|
|
1513
|
+
if (tempSession) {
|
|
1514
|
+
suppressExitNotices();
|
|
1515
|
+
if (renderLine)
|
|
1516
|
+
warn(renderLine);
|
|
1517
|
+
if (formatted.liveUrl)
|
|
1518
|
+
success(`Live URL: ${teal(formatted.liveUrl)}`);
|
|
1519
|
+
else
|
|
1520
|
+
info(`Live URL not reported by the platform; \`${cliInvocation()} project view ${formatted.projectRef ?? '<project>'}\` shows it.`);
|
|
1521
|
+
info(formatTempExpiry(tempSession.expiresAt, tempSession.ttlSeconds));
|
|
1522
|
+
const link = teal(tempSession.claimUrl);
|
|
1523
|
+
if (tempSession.handoffReady) {
|
|
1524
|
+
info(`Open ${link} and select "Save project and connect agent" to save the project to your account and connect this terminal automatically.`);
|
|
1525
|
+
}
|
|
1526
|
+
else if (besideRealLogin) {
|
|
1527
|
+
info(`Open ${link} to save the project to your account, then run \`${cliInvocation()} init --link --project ${projectId}\` in an unlinked folder to work on it.`);
|
|
1528
|
+
}
|
|
1529
|
+
else {
|
|
1530
|
+
info(`Open ${link} to save the project to your account, then run \`${cliInvocation()} login\` to connect this terminal.`);
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
// Exit non-zero if any function failed to deploy — a CI step that
|
|
1534
|
+
// shells out to `somewhere deploy` should fail, not pass green.
|
|
1535
|
+
if (hasFunctionErrors) {
|
|
1533
1536
|
process.exit(1);
|
|
1534
1537
|
}
|
|
1538
|
+
if (verificationFailed)
|
|
1539
|
+
process.exit(1);
|
|
1535
1540
|
if (tests && tests.status !== 'passed')
|
|
1536
1541
|
process.exit(1);
|
|
1537
1542
|
}
|
|
@@ -1606,7 +1611,7 @@ export function registerDeploy(program) {
|
|
|
1606
1611
|
if (liveUrl)
|
|
1607
1612
|
info(`Live at ${teal(liveUrl)}`);
|
|
1608
1613
|
if (projectId)
|
|
1609
|
-
info(`This folder now starts from ${version !== null ? `v${version}` : 'this version'}, so the next
|
|
1614
|
+
info(`This folder now starts from ${version !== null ? `v${version}` : 'this version'}, so the next \`${cliInvocation()} deploy\` here replaces it without --force.`);
|
|
1610
1615
|
const reference = formatErrorReference(err.meta);
|
|
1611
1616
|
if (reference)
|
|
1612
1617
|
info(dim(reference));
|
|
@@ -1684,7 +1689,7 @@ export function formatReferenceCheckHint(result, linkedHere) {
|
|
|
1684
1689
|
const args = linkedHere
|
|
1685
1690
|
? { version: result.version }
|
|
1686
1691
|
: { project_id: result.project_id, version: result.version };
|
|
1687
|
-
return `A reference check is running in the background; read its result with:
|
|
1692
|
+
return `A reference check is running in the background; read its result with: ${cliInvocation()} call project_deploy_log '${JSON.stringify(args)}'`;
|
|
1688
1693
|
}
|
|
1689
1694
|
export function formatDeployTiming(input) {
|
|
1690
1695
|
const stage = input.stageTimingMs ?? {};
|
|
@@ -1785,7 +1790,7 @@ export function formatDeploySuccess(result, options) {
|
|
|
1785
1790
|
// Only an older platform omits the URL; name the command that shows it.
|
|
1786
1791
|
liveMessage: liveUrl
|
|
1787
1792
|
? `Live at ${liveUrl}`
|
|
1788
|
-
: `Deployed. The platform did not report the live URL;
|
|
1793
|
+
: `Deployed. The platform did not report the live URL; \`${cliInvocation()} project view ${typeof result.project_id === 'string' && result.project_id.trim() ? result.project_id.trim() : '<project>'}\` shows it.`,
|
|
1789
1794
|
};
|
|
1790
1795
|
}
|
|
1791
1796
|
function normalizeWarning(value) {
|
|
@@ -1877,7 +1882,7 @@ export function formatUnknownDeployOutcomeExplanation(err, projectId, startedAt)
|
|
|
1877
1882
|
`The deploy request ${what} after it may have reached the platform. Its outcome is unknown: it may have gone live, may have been refused, or may still be running. It was not sent again, and this CLI cannot confirm what happened to it.`,
|
|
1878
1883
|
'',
|
|
1879
1884
|
'What you can do:',
|
|
1880
|
-
` Look, for investigation only:
|
|
1885
|
+
` Look, for investigation only: ${cliInvocation()} call project_deploys '${JSON.stringify({ project_id: projectId })}' lists the project's recent deploys. No entry there is tied to this request, and deploys by anyone else can appear in it, so a later entry does not show what happened to this one.`,
|
|
1881
1886
|
` Ask for help with this reference so the platform can find this exact request: project ${projectId}, sent at ${startedAt} (this machine's clock)${ids.length ? `, ${ids.join(', ')}` : ''}.`,
|
|
1882
1887
|
' Deploying again is your call; nothing here says this request has finished, and a deploy sent while it may still be running can race it.',
|
|
1883
1888
|
].join('\n');
|
|
@@ -1971,20 +1976,16 @@ function formatDeployElapsed(ms) {
|
|
|
1971
1976
|
const INTERNAL_PREFIXES = ['_compiled/', '_internal/', '_source/'];
|
|
1972
1977
|
const isInternalPath = (p) => INTERNAL_PREFIXES.some((prefix) => p.startsWith(prefix));
|
|
1973
1978
|
// ── Publish-surface notice ────────────────────────────────
|
|
1974
|
-
//
|
|
1975
|
-
// about how the rule is implemented, no ticket ids. The "how" line prints once
|
|
1976
|
-
// per linked project — stored in the project's own .somewhere.json, never as a
|
|
1977
|
-
// new stray file in the customer's repo. An unlinked (anonymous) deploy has
|
|
1978
|
-
// nowhere to remember it, so it prints every time, which is the safe direction.
|
|
1979
|
+
// Routine exclusions are summarized on deploy and listed by --list-unpublished or --json.
|
|
1979
1980
|
export function printExcludedFiles(excluded, _targetDir, { list = false } = {}) {
|
|
1980
1981
|
// One plain sentence and the count; the list, and how to publish one on purpose, behind --list-unpublished.
|
|
1981
1982
|
if (!list) {
|
|
1982
|
-
info(`Not published: ${excluded.length} local file${excluded.length === 1 ? '' : 's'} (notes, tests, tooling) stay on your machine. See them: ${
|
|
1983
|
+
info(`Not published: ${excluded.length} local file${excluded.length === 1 ? '' : 's'} (notes, tests, tooling) stay on your machine. See them: ${cliInvocation()} deploy --list-unpublished`);
|
|
1983
1984
|
return;
|
|
1984
1985
|
}
|
|
1985
1986
|
info(`Not published (${excluded.length}): ${excluded.map((e) => e.path).join(', ')}`);
|
|
1986
1987
|
info(dim('Notes and scratch files nothing in your app uses, tests, and tooling folders stay local; everything else is uploaded. '
|
|
1987
|
-
+ `To publish one of these on purpose: ${
|
|
1988
|
+
+ `To publish one of these on purpose: ${cliInvocation()} deploy --include <file>, or add a "!<file>" line to .somewhereignore.`));
|
|
1988
1989
|
}
|
|
1989
1990
|
/** The --json form of the omission notices: one stderr line per file, stdout
|
|
1990
1991
|
* untouched, paths and reasons only (never contents), in a fixed order. */
|
|
@@ -2006,7 +2007,7 @@ export function printLocalOmissionsToStderr(omitted) {
|
|
|
2006
2007
|
* Neither --include nor a "!" line publishes them. */
|
|
2007
2008
|
export function printSensitiveFiles(sensitive) {
|
|
2008
2009
|
info(`Never uploaded (${sensitive.length}): ${sensitive.map((e) => e.path).join(', ')}`);
|
|
2009
|
-
info(dim(
|
|
2010
|
+
info(dim(`Files blocked by the sensitive-path policy stay on your machine; --include and "!" lines do not publish them. The policy matches file names only: a secret under any other name uploads like any other file. Store a secret your code needs with \`${cliInvocation()} env set\` and read it with sw.env in a function.`));
|
|
2010
2011
|
}
|
|
2011
2012
|
/** Why a dry run stops before reaching the platform. */
|
|
2012
2013
|
export function formatDryRunNeedsProjectExplanation() {
|
|
@@ -2015,8 +2016,8 @@ export function formatDryRunNeedsProjectExplanation() {
|
|
|
2015
2016
|
'this folder is not linked to a project, or you are not signed in.',
|
|
2016
2017
|
'Nothing was created, no temporary workspace was started, and no project or login files were changed.',
|
|
2017
2018
|
'',
|
|
2018
|
-
|
|
2019
|
-
|
|
2019
|
+
`To check your code without contacting Somewhere: \`${cliInvocation()} typecheck\` and \`${cliInvocation()} lint\`.`,
|
|
2020
|
+
`To deploy for real (signed out, this starts a temporary workspace): \`${cliInvocation()} deploy\`.`,
|
|
2020
2021
|
].join('\n');
|
|
2021
2022
|
}
|
|
2022
2023
|
function printDryRun(plan, scope) {
|