@somewhere-cloud/cli 0.38.49 → 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 +3 -0
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerRun(program: Command): void;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerSkills(program: Command): void;
@@ -0,0 +1,27 @@
1
+ import { Command } from 'commander';
2
+ export interface PreviewCandidateStatus {
3
+ draft_id: string;
4
+ candidate_release_id: string;
5
+ preview_origin?: string;
6
+ expires_at?: string;
7
+ }
8
+ export interface DeploymentProvenance {
9
+ promotedFromCandidate: string | null;
10
+ shortContentHash: string | null;
11
+ }
12
+ /** Additive deploy-status fields are untrusted at this boundary: older
13
+ * platforms omit them and malformed values must never break `status`. */
14
+ export declare function deploymentProvenanceFromStatus(deployment: Record<string, unknown>): DeploymentProvenance;
15
+ export declare function previewCandidatesFromDeployment(deployment: Record<string, unknown>): PreviewCandidateStatus[];
16
+ export interface PlanEntitlementNote {
17
+ code: string;
18
+ message: string;
19
+ }
20
+ /** Read a platform tool error as a plan-entitlement fact, or null when it is a
21
+ * real problem (deploy failed, project missing, auth broken). Tool errors
22
+ * arrive as `CODE: message`, the shape platform-tools.ts renders. */
23
+ export declare function planEntitlementFromError(err: unknown): PlanEntitlementNote | null;
24
+ /** Build the production-only status from the plan-neutral deploy history API.
25
+ * Preview candidates intentionally do not exist on this surface. */
26
+ export declare function productionDeploymentFromHistory(value: unknown): Record<string, unknown>;
27
+ export declare function registerStatus(program: Command): void;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerSupport(program: Command): void;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerTasks(program: Command): void;
@@ -0,0 +1,4 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerTestUsers(program: Command): void;
3
+ /** Exported for tests: a manifest on disk never contains a token. */
4
+ export declare function manifestHasNoSecrets(root: string): boolean;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerTest(program: Command): void;
@@ -0,0 +1,74 @@
1
+ import { createRequire } from 'node:module';
2
+ import { join, dirname } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { spawnSync } from 'node:child_process';
5
+ import { appendFileSync } from 'node:fs';
6
+ import { ApiClient } from '../lib/client.js';
7
+ import { getToken, loadProjectConfig } from '../lib/config.js';
8
+ import { productionOrigin, ensurePrivateDir, writePrivateFile } from '../lib/test-identities.js';
9
+ export function registerTest(program) {
10
+ program.command('test [file]')
11
+ .description('Run project Playwright tests against its canonical production origin')
12
+ .option('--workers <count>', 'Parallel workers', '5')
13
+ .option('--failed', 'Run last failures only (subset; a full green is still required)')
14
+ .option('--grep <name>', 'Filter test names (subset)')
15
+ .option('--url <url>', 'Unsupported in phase 1')
16
+ .option('--json', 'Print structured results')
17
+ .action(async (file, opts) => {
18
+ if (opts.url)
19
+ throw new Error('--url is unsupported: tests use the linked project canonical production origin only.');
20
+ if (!/^[1-9]\d*$/.test(opts.workers))
21
+ throw new Error('--workers must be a positive integer');
22
+ const root = process.cwd();
23
+ const require = createRequire(join(root, 'package.json'));
24
+ let cli;
25
+ let pw;
26
+ try {
27
+ cli = require.resolve('@playwright/test/cli');
28
+ pw = require('@playwright/test');
29
+ }
30
+ catch {
31
+ throw new Error('Install project test dependencies: npm install -D @playwright/test @somewhere-cloud/cli');
32
+ }
33
+ const id = loadProjectConfig()?.project_id;
34
+ if (!id)
35
+ throw new Error('Run somewhere test from a linked project folder');
36
+ const client = new ApiClient(getToken());
37
+ const urls = await client.call('GET', `/projects/${encodeURIComponent(id)}/urls`);
38
+ const { origin } = productionOrigin(urls.prod_fallback);
39
+ const dir = join(root, '.somewhere', 'tests');
40
+ ensurePrivateDir(dir);
41
+ appendFileSync(join(root, '.gitignore'), '\n.somewhere/\nplaywright-report/\ntest-results/\n');
42
+ let channel = 'chrome';
43
+ let browser;
44
+ try {
45
+ browser = await pw.chromium.launch({ channel: 'chrome' });
46
+ }
47
+ catch (error) {
48
+ if (!(error instanceof Error) || !/not found|doesn't exist|not installed/i.test(error.message))
49
+ throw error;
50
+ channel = undefined;
51
+ process.stderr.write('Chrome is not installed; installing Playwright Chromium in the CLI cache.\n');
52
+ process.env.PLAYWRIGHT_BROWSERS_PATH ??= join(dir, 'browsers');
53
+ const install = spawnSync(process.execPath, [cli, 'install', 'chromium'], { stdio: 'inherit', env: process.env });
54
+ if (install.status !== 0)
55
+ throw new Error('Playwright Chromium installation failed');
56
+ browser = await pw.chromium.launch();
57
+ }
58
+ const version = browser.version();
59
+ await browser.close();
60
+ const subset = Boolean(file || opts.grep || opts.failed);
61
+ const config = join(dir, 'runner.config.cjs');
62
+ writePrivateFile(config, `module.exports = ${JSON.stringify({ testDir: join(root, 'tests'), fullyParallel: true, forbidOnly: !subset, retries: 0, workers: Number(opts.workers), outputDir: join(dir, 'artifacts'), reporter: [[join(dirname(fileURLToPath(import.meta.url)), '../lib/test-reporter.js')]], use: { baseURL: origin, channel, trace: 'off', video: 'off', screenshot: 'off' } })};\n`);
63
+ const args = [cli, 'test', '--config', config];
64
+ if (file)
65
+ args.push(file);
66
+ if (opts.grep)
67
+ args.push('--grep', opts.grep);
68
+ if (opts.failed)
69
+ args.push('--last-failed');
70
+ const result = spawnSync(process.execPath, args, { stdio: 'inherit', env: { ...process.env, SW_TEST_ORIGIN: origin, SW_TEST_BROWSER: `${channel ?? 'chromium'} ${version}`, SW_TEST_SUBSET: String(subset), SW_TEST_JSON: String(Boolean(opts.json)), SW_TEST_RESULTS: join(dir, 'results.json') } });
71
+ process.exitCode = result.status ?? 1;
72
+ });
73
+ }
74
+ //# sourceMappingURL=test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/commands/test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAEjG,MAAM,UAAU,YAAY,CAAC,OAAgB;IAC3C,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC;SAC3B,WAAW,CAAC,sEAAsE,CAAC;SACnF,MAAM,CAAC,mBAAmB,EAAE,kBAAkB,EAAE,GAAG,CAAC;SACpD,MAAM,CAAC,UAAU,EAAE,iEAAiE,CAAC;SACrF,MAAM,CAAC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AAe,EAAE,GAAG,OAAO,IAAI,UAAU,IAAI,OAAO,EAAE,EAAE,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,eAAe,EAAE,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,EAAE,EAAE,CAAC,CAAC;QACtS,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { Command } from 'commander';
2
+ import { type DeployCheckResult } from '../lib/deploy-check.js';
3
+ import { type TypecheckResult } from '../lib/typecheck.js';
4
+ export declare const MISSING_TSCONFIG_GUIDANCE = "No tsconfig.json here to typecheck against. Add a local tsconfig.json for a new app, or run `somewhere pull` for an existing deployed app.";
5
+ export declare function registerTypecheck(program: Command): void;
6
+ /** Print the local TypeScript check verdict. */
7
+ export declare function reportTypecheck(result: TypecheckResult): void;
8
+ /** Print the deploy reference check's verdict. */
9
+ export declare function reportDeployCheck(result: DeployCheckResult): void;
@@ -0,0 +1,25 @@
1
+ import { Command } from 'commander';
2
+ import { type OfficialRelease } from '../lib/update-security.js';
3
+ interface FetchResponse {
4
+ ok: boolean;
5
+ status: number;
6
+ json(): Promise<unknown>;
7
+ arrayBuffer(): Promise<ArrayBuffer>;
8
+ }
9
+ type FetchUpdate = (url: string, init?: RequestInit) => Promise<FetchResponse>;
10
+ interface UpdateDependencies {
11
+ fetch?: FetchUpdate;
12
+ currentVersion?: () => string;
13
+ verifyProvenance?: (body: unknown, release: OfficialRelease) => Promise<void>;
14
+ install?: (tarballPath: string, tempDir: string, release: OfficialRelease) => Promise<void>;
15
+ }
16
+ /** Real installer used by production and the isolated positive test. It reads
17
+ * and unlinks the downloaded tarball once, then uses only that immutable Buffer
18
+ * snapshot for integrity, closure inspection, and the loopback response npm
19
+ * consumes. Registry/proxy traffic is denied and treated as a failed update. */
20
+ export declare function installVerifiedTarball(tarballPath: string, tempDir: string, release: OfficialRelease): Promise<void>;
21
+ export declare function runUpdate(opts: {
22
+ check?: boolean;
23
+ }, dependencies?: UpdateDependencies): Promise<number>;
24
+ export declare function registerUpdate(program: Command): void;
25
+ export {};
@@ -0,0 +1,12 @@
1
+ import { Command } from 'commander';
2
+ import { type ChangelogEntry } from '../lib/project-pin.js';
3
+ export interface UpgradeResult {
4
+ from: string | null;
5
+ to: string;
6
+ updated: string[];
7
+ changes: ChangelogEntry[];
8
+ next: string[];
9
+ }
10
+ /** Move this folder's CLI pin to the running CLI and list what changed. */
11
+ export declare function upgradeProject(dir: string, running: string, changelog?: () => string): UpgradeResult;
12
+ export declare function registerUpgrade(program: Command): void;
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerUsage(program: Command): void;
@@ -0,0 +1,419 @@
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
+ import { type BrowserLifecycle, type BrowserResult } from './browser.js';
5
+ export type VerifyViewportInput = 'desktop' | 'mobile' | {
6
+ label: string;
7
+ width: number;
8
+ height: number;
9
+ };
10
+ export interface VerifyFlow {
11
+ actions: BrowserSequenceAction[];
12
+ auth?: {
13
+ user_id: string;
14
+ };
15
+ local_storage?: Record<string, string>;
16
+ cookies?: Array<{
17
+ name: string;
18
+ value: string;
19
+ }>;
20
+ headers?: Record<string, string>;
21
+ expect_requests: ExpectedBrowserRequest[];
22
+ visible_only: boolean;
23
+ viewports: VerifyViewportInput[];
24
+ }
25
+ export interface VerifyStepReport {
26
+ viewport: string;
27
+ step: number;
28
+ name: string;
29
+ passed: boolean;
30
+ error?: string;
31
+ duration_ms?: number;
32
+ value?: unknown;
33
+ /** false: never started (the run stopped at its execution cap first). No
34
+ * verdict either way. */
35
+ ran?: false;
36
+ }
37
+ /** A run that reached its execution cap before starting its next action, in
38
+ * the caller's own action numbering. */
39
+ export interface VerifyIncomplete {
40
+ reason: 'execution_cap';
41
+ /** The caller's actions that ran (an inserted goto is not counted). */
42
+ completed: number;
43
+ /** 1-based number of the first action that did not run, in the caller's own
44
+ * actions for this run; 0 = the goto a continued segment's path inserted. */
45
+ next_step: number;
46
+ next_action: string;
47
+ /** The caller's actions that did not run, including next_step. */
48
+ not_run: number;
49
+ budget_ms: number;
50
+ elapsed_ms: number;
51
+ }
52
+ export interface VerifyScreenshotReport {
53
+ viewport: string;
54
+ label: string;
55
+ path?: string;
56
+ url?: string;
57
+ url_expires_at?: string;
58
+ fs_path?: string;
59
+ scratch_url?: string;
60
+ scratch_expires_at?: string;
61
+ error?: string;
62
+ }
63
+ export interface VerifySignal<T> {
64
+ viewport: string;
65
+ detail: T;
66
+ }
67
+ export interface VerifyReport {
68
+ passed: boolean;
69
+ verdict: string;
70
+ target: string;
71
+ viewports: Array<{
72
+ label: string;
73
+ width: number;
74
+ height: number;
75
+ passed: boolean;
76
+ final_url: string;
77
+ refusal?: string;
78
+ }>;
79
+ refusals?: Array<VerifySignal<{
80
+ code: string;
81
+ status: number;
82
+ message: string;
83
+ request_id?: string;
84
+ retry?: boolean;
85
+ retry_after_ms?: number;
86
+ data?: Record<string, unknown>;
87
+ }>>;
88
+ dialogs?: Array<VerifySignal<NonNullable<BrowserResult['dialogs']>[number]>>;
89
+ dialogs_truncated?: true;
90
+ dialog_actions_unused?: Array<VerifySignal<NonNullable<BrowserResult['dialog_actions_unused']>[number]>>;
91
+ steps: VerifyStepReport[];
92
+ health: {
93
+ page: {
94
+ passed: boolean;
95
+ errors: Array<VerifySignal<unknown>>;
96
+ };
97
+ console: {
98
+ passed: boolean;
99
+ errors: Array<VerifySignal<unknown>>;
100
+ };
101
+ network: {
102
+ passed: boolean;
103
+ failed_requests: Array<VerifySignal<unknown>>;
104
+ expectations: Array<VerifySignal<BrowserRequestExpectationResult>>;
105
+ };
106
+ };
107
+ screenshots: VerifyScreenshotReport[];
108
+ /** The platform's non-blocking layout line per run: contrast, horizontal
109
+ * overflow, and tap-target sizing at that viewport. */
110
+ layout: Array<VerifySignal<string>>;
111
+ /** Responses of 4xx/5xx the flow did not declare, with who made the request
112
+ * and the exact expect_requests entry that would declare it. Never applied
113
+ * automatically: an undeclared status fails the run. */
114
+ undeclared_statuses: VerifyUndeclaredStatus[];
115
+ /** Initial navigations the platform repeated once (a timeout with no document
116
+ * response observed while the page was still blank, before any action).
117
+ * Reported, never hidden; says nothing about the cause. */
118
+ navigation_retries: Array<VerifySignal<{
119
+ phase: string;
120
+ error: string;
121
+ elapsed_ms?: number;
122
+ }>>;
123
+ /** Runs that stopped at their execution cap with nothing failed before it.
124
+ * Never a pass: the actions not run have no verdict. */
125
+ incomplete: Array<VerifySignal<VerifyIncomplete>>;
126
+ lifecycle?: Array<VerifySignal<BrowserLifecycle>>;
127
+ transport_errors?: Array<VerifySignal<NonNullable<BrowserResult['transport_error']>>>;
128
+ }
129
+ export interface VerifyUndeclaredStatus {
130
+ viewport: string;
131
+ method: string;
132
+ path: string;
133
+ status: number;
134
+ /** 'eval' = your flow's eval step made it (a probe); 'page' = the app's own code. */
135
+ initiator: 'eval' | 'page' | 'unknown';
136
+ declare: {
137
+ path: string;
138
+ status: number;
139
+ };
140
+ /** Other viewports whose steps all ran and passed without reporting this
141
+ * refusal. Set only for an undeclared 409 on a writing method, where one
142
+ * possible cause is the same unique record created in each viewport. verify
143
+ * records failed requests only, so this does not prove the request ran or
144
+ * succeeded there. */
145
+ not_failed_at?: string[];
146
+ }
147
+ interface ResolvedViewport {
148
+ label: string;
149
+ width: number;
150
+ height: number;
151
+ wire: 'desktop' | 'mobile' | {
152
+ width: number;
153
+ height: number;
154
+ };
155
+ }
156
+ export interface VerificationTarget {
157
+ project_id?: string;
158
+ url?: string;
159
+ }
160
+ /** A directory link is a hint, never proof that the current login owns a URL. */
161
+ export declare function linkedVerifyTarget(url: string, client: ApiClient, linkedProjectId?: string): Promise<string | undefined>;
162
+ export declare function normalizeVerifyFlow(raw: unknown, baseDir?: string): VerifyFlow;
163
+ export declare function loadVerifyFlow(path?: string, cwd?: string): VerifyFlow;
164
+ /** ` WARNING — …` for every viewport whose layout line reports horizontal
165
+ * overflow, naming the element the platform found; '' when none did. */
166
+ export declare function overflowWarning(layout: Array<VerifySignal<string>>): string;
167
+ /**
168
+ * The run's execution-cap stop in the caller's numbering, or null when there
169
+ * is none or when anything failed before it (then it is judged as a failure:
170
+ * an incomplete never hides an earlier genuine failure). `offset` is 1 when the
171
+ * CLI inserted a leading goto the caller did not write.
172
+ */
173
+ export declare function mapIncomplete(report: BrowserResult, sent: BrowserSequenceAction[], offset: 0 | 1): VerifyIncomplete | null;
174
+ export declare function settleViewportRuns(viewports: ResolvedViewport[], run: (viewport: ResolvedViewport) => Promise<BrowserResult>): Promise<{
175
+ runs: Array<{
176
+ viewport: ResolvedViewport;
177
+ report: BrowserResult;
178
+ }>;
179
+ refusals: NonNullable<VerifyReport['refusals']>;
180
+ }>;
181
+ export declare function runVerification(target: VerificationTarget, flow: VerifyFlow, client?: ApiClient): Promise<VerifyReport>;
182
+ export declare const VERIFY_JOURNEY_LIMITS: {
183
+ readonly actors: 3;
184
+ readonly segments: 12;
185
+ /** Segments in one { "parallel": [...] } item, each by a different actor. */
186
+ readonly parallel_segments: 3;
187
+ readonly actions_per_segment: 30;
188
+ readonly total_actions: 120;
189
+ readonly deadline_ms: number;
190
+ /** The execution cap each segment asks for (budget_ms): one connected run. */
191
+ readonly segment_budget_ms: 180000;
192
+ /** A segment is not started with a smaller cap than this. */
193
+ readonly min_segment_budget_ms: 10000;
194
+ /** Added to the cap for the client's wait: admission, launch, capture, release. */
195
+ readonly transport_headroom_ms: 45000;
196
+ readonly segment_timeout_ms: number;
197
+ /** Separate from the journey budget: how long closing the actors' browsers
198
+ * may take once the run stops, including waiting for a call in flight. */
199
+ readonly cleanup_budget_ms: 20000;
200
+ };
201
+ export interface VerifyActor {
202
+ auth?: {
203
+ user_id: string;
204
+ };
205
+ /** Sign in as a platform-managed test identity created for this run: a
206
+ * verified, password-less user on the project's own test-mail domain,
207
+ * deleted when the run ends. Never a real user. */
208
+ test_user?: true;
209
+ local_storage?: Record<string, string>;
210
+ cookies?: Array<{
211
+ name: string;
212
+ value: string;
213
+ }>;
214
+ headers?: Record<string, string>;
215
+ }
216
+ export interface VerifyJourneySegment {
217
+ as: string;
218
+ path?: string;
219
+ actions: BrowserSequenceAction[];
220
+ expect_requests: ExpectedBrowserRequest[];
221
+ visible_only: boolean;
222
+ viewport: VerifyViewportInput;
223
+ /** Set on the consecutive segments of one { "parallel": [...] } item: they
224
+ * run at the same time, each by a different actor. */
225
+ group?: number;
226
+ }
227
+ export interface VerifyJourney {
228
+ actors: Record<string, VerifyActor>;
229
+ journey: VerifyJourneySegment[];
230
+ }
231
+ export interface VerifyJourneySegmentReport {
232
+ segment: number;
233
+ as: string;
234
+ viewport: string;
235
+ path?: string;
236
+ /** Segments sharing this number ran at the same time. */
237
+ parallel_group?: number;
238
+ ran: boolean;
239
+ /** Request sent, but browser execution is unconfirmed. */
240
+ outcome_unknown?: true;
241
+ session_closed?: true;
242
+ lifecycle?: BrowserLifecycle;
243
+ passed: boolean;
244
+ final_url?: string;
245
+ error?: {
246
+ code: string;
247
+ message: string;
248
+ };
249
+ /** The segment reached its execution cap with nothing failed before it. */
250
+ incomplete?: VerifyIncomplete;
251
+ /** Where this segment's time went: the platform's own browser timing plus
252
+ * this CLI's request wall. Numbers only, never a URL, id or credential. */
253
+ timing?: VerifySegmentTiming;
254
+ }
255
+ /** A segment's measured time, in ms. `request_wall_ms` is this CLI's request
256
+ * (send to answer); every other field is a flat numeric field of the
257
+ * platform's report.timing, whose phases may contain one another (e.g.
258
+ * evidence_ms is part of actions_ms). */
259
+ export type VerifySegmentTiming = {
260
+ request_wall_ms: number;
261
+ browser_reused?: boolean;
262
+ } & Record<string, number | boolean>;
263
+ /** Whole-journey phases, in ms, around the segments. */
264
+ export interface VerifyJourneyTiming {
265
+ test_users_create_ms?: number;
266
+ segments_ms: number;
267
+ cleanup_ms: number;
268
+ test_users_delete_ms?: number;
269
+ }
270
+ /** An actor's browser deliberately left open after an execution-cap stop, so
271
+ * its page can still be inspected. It is the caller's to close; otherwise the
272
+ * platform closes it at its idle or absolute bound, whichever comes first.
273
+ * Every time here is the platform's, read when it released the browser; the
274
+ * CLI never estimates one. */
275
+ export interface VerifyKeptSession {
276
+ actor: string;
277
+ session_id: string;
278
+ /** When the platform will close it: the earlier of the two bounds below. */
279
+ session_expires_at?: string;
280
+ idle_expires_at?: string;
281
+ absolute_expires_at?: string;
282
+ close: string;
283
+ }
284
+ /**
285
+ * What closing one actor's browser achieved:
286
+ * - closed: the platform closed it, after every call for that actor settled.
287
+ * - already_closed: the platform had nothing open for it (a failed call closes
288
+ * its own browser).
289
+ * - unconfirmed: a close failed, or a call for that actor may still be running
290
+ * on the platform, so a browser can exist that this run could not close. The
291
+ * platform closes an idle browser within 5 minutes.
292
+ */
293
+ export interface VerifyJourneyCleanup {
294
+ actor: string;
295
+ status: 'closed' | 'already_closed' | 'unconfirmed' | 'kept_open';
296
+ reason?: string;
297
+ }
298
+ /** Managed test identities this run created: who played which actor, and
299
+ * whether they were removed afterwards. No credential is ever included. */
300
+ export interface VerifyTestUsers {
301
+ identities: Array<{
302
+ actor: string;
303
+ user_id: string;
304
+ email: string;
305
+ }>;
306
+ cleanup: {
307
+ status: 'deleted' | 'kept' | 'unconfirmed';
308
+ deleted?: number;
309
+ reason?: string;
310
+ };
311
+ }
312
+ /** --keep-actors: the flow's stable key (owner-local; derived from project and
313
+ * actors) and the test identities a previous keeping run left for reuse. */
314
+ export interface VerifyKeepActors {
315
+ key: string;
316
+ identities?: Record<string, {
317
+ user_id: string;
318
+ email: string;
319
+ }>;
320
+ /** --resume-page: the page path each kept actor was left on by the last passed
321
+ * run. An actor whose first segment starts at exactly this path continues on
322
+ * its kept page instead of reloading it (a stateful warm continuation). */
323
+ resumePages?: Record<string, string>;
324
+ }
325
+ export interface VerifyJourneyReport extends VerifyReport {
326
+ mode: 'journey';
327
+ /** --keep-actors: browsers kept for the next run, those reconnected this run, and whether identities were reused. */
328
+ keep_actors?: {
329
+ kept: string[];
330
+ reconnected: string[];
331
+ reused_identities: boolean;
332
+ resumed_pages?: string[];
333
+ note?: string;
334
+ };
335
+ test_users?: VerifyTestUsers;
336
+ actors: string[];
337
+ segments: VerifyJourneySegmentReport[];
338
+ browser_runs: number;
339
+ limits: typeof VERIFY_JOURNEY_LIMITS;
340
+ cleanup: VerifyJourneyCleanup[];
341
+ cleanup_ms: number;
342
+ cleanup_confirmed: boolean;
343
+ /** Browsers left open on purpose after an execution-cap stop. */
344
+ kept_sessions: VerifyKeptSession[];
345
+ timing: VerifyJourneyTiming;
346
+ }
347
+ export declare function isVerifyJourneyInput(raw: unknown): boolean;
348
+ export declare function normalizeVerifyJourney(raw: unknown, baseDir?: string): VerifyJourney;
349
+ export declare function loadVerifyInput(path?: string, cwd?: string): {
350
+ kind: 'single';
351
+ flow: VerifyFlow;
352
+ } | {
353
+ kind: 'journey';
354
+ journey: VerifyJourney;
355
+ };
356
+ export interface VerifyJourneyRun {
357
+ /** The session id each actor uses in this run. */
358
+ readonly sessions: Readonly<Record<string, string>>;
359
+ run(): Promise<VerifyJourneyReport>;
360
+ /** Stop starting segments, now. Synchronous; the first reason wins. */
361
+ stop(code: string, message: string): void;
362
+ /** Stop, then close every browser this run opened, within the cleanup
363
+ * budget. Idempotent; never throws; reports what it could not confirm. */
364
+ closeAll(): Promise<{
365
+ cleanup: VerifyJourneyCleanup[];
366
+ cleanup_ms: number;
367
+ }>;
368
+ }
369
+ export declare function createVerifyJourneyRun(target: VerificationTarget, journey: VerifyJourney, client: Pick<ApiClient, 'call'>, opts?: {
370
+ runId?: string;
371
+ now?: () => number;
372
+ cleanupBudgetMs?: number;
373
+ recloseAfterAbandonedMs?: number;
374
+ keepTestUsers?: boolean;
375
+ keep?: VerifyKeepActors;
376
+ }): VerifyJourneyRun;
377
+ /** The flow file contract, for agents: `somewhere verify --schema`. */
378
+ export declare function verifyFlowSchema(): Record<string, unknown>;
379
+ export declare function formatVerifyReport(report: VerifyReport, evidencePath?: string): string[];
380
+ export declare function formatVerifyJourneyReport(report: VerifyJourneyReport, evidencePath?: string): string[];
381
+ /** Persist before shortening human output; JSON callers keep their original contract. */
382
+ export declare function formatVerifyOutput(report: VerifyReport | VerifyJourneyReport, save?: (value: unknown) => string): string[];
383
+ /** A report is never overwritten (it is private evidence of a past run), so a
384
+ * rerun needs a new --out path. Name the first free sibling so a rerun is one
385
+ * copy-paste: run-report.json → run-report-2.json, -3, … (Haiku workers
386
+ * w2-invites, w3-invites and w3-data each invented names by hand). */
387
+ export declare function nextFreeOutPath(path: string, exists?: (candidate: string) => boolean): string | null;
388
+ export declare function outExistsMessage(path: string, exists?: (candidate: string) => boolean): string;
389
+ /** Only local booleans, counts and durations belong in opt-in stdout. The
390
+ * full evidence, including eval values and screenshot links, stays in --out. */
391
+ export declare function summarizeVerifyReport(report: VerifyReport | VerifyJourneyReport): {
392
+ segments?: number | undefined;
393
+ browser_runs?: number | undefined;
394
+ cleanup_confirmed?: boolean | undefined;
395
+ incomplete: number;
396
+ outcome_unknown: boolean;
397
+ start_error_details?: {
398
+ refusal_index: number;
399
+ limit_ms?: number | undefined;
400
+ path: string;
401
+ status?: number | undefined;
402
+ code: string;
403
+ }[] | undefined;
404
+ start_errors?: string[] | undefined;
405
+ segments_not_started?: number | undefined;
406
+ passed: boolean;
407
+ mode: string;
408
+ steps: number;
409
+ failed_steps: number;
410
+ not_run_steps: number;
411
+ step_duration_ms: number;
412
+ refusals: number;
413
+ };
414
+ /** The one-line --out summary. A run in which no browser ran says so first:
415
+ * "0 failed steps" under FAIL reads as a clean app, and it is not one. */
416
+ export declare function formatVerifySummaryLine(summary: ReturnType<typeof summarizeVerifyReport>): string;
417
+ export declare function formatJourneyCleanup(cleanup: VerifyJourneyCleanup[], cleanupMs: number): string[];
418
+ export declare function registerVerify(program: Command): void;
419
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.js CHANGED
@@ -44,6 +44,7 @@ import { registerUsage } from './commands/usage.js';
44
44
  import { registerGit } from './commands/git.js';
45
45
  import { registerCron } from './commands/cron.js';
46
46
  import { registerEmail } from './commands/email.js';
47
+ import { registerTest } from './commands/test.js';
47
48
  import { registerTestUsers } from './commands/test-users.js';
48
49
  import { registerSupport } from './commands/support.js';
49
50
  import { buildRecord, commandPath, writeLastError } from './lib/repro-packet.js';
@@ -143,6 +144,7 @@ registerPreview(program);
143
144
  registerBrowser(program);
144
145
  registerVerify(program);
145
146
  registerTestUsers(program);
147
+ registerTest(program);
146
148
  registerSupport(program);
147
149
  registerCheck(program);
148
150
  registerApi(program);