@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.
- package/dist/commands/advisor.d.ts +9 -0
- package/dist/commands/ai.d.ts +2 -0
- package/dist/commands/api.d.ts +14 -0
- package/dist/commands/auth.d.ts +30 -0
- package/dist/commands/browser.d.ts +247 -0
- package/dist/commands/call.d.ts +22 -0
- package/dist/commands/catalog.d.ts +16 -0
- package/dist/commands/check.d.ts +114 -0
- package/dist/commands/claim.d.ts +5 -0
- package/dist/commands/cron.d.ts +14 -0
- package/dist/commands/db-rows.d.ts +2 -0
- package/dist/commands/db.d.ts +2 -0
- package/dist/commands/deploy.d.ts +235 -0
- package/dist/commands/dev.d.ts +171 -0
- package/dist/commands/docs.d.ts +85 -0
- package/dist/commands/email.d.ts +8 -0
- package/dist/commands/env.d.ts +2 -0
- package/dist/commands/errors.d.ts +2 -0
- package/dist/commands/feedback.d.ts +2 -0
- package/dist/commands/fs.d.ts +2 -0
- package/dist/commands/git.d.ts +2 -0
- package/dist/commands/grep.d.ts +2 -0
- package/dist/commands/hooks.d.ts +2 -0
- package/dist/commands/init.d.ts +17 -0
- package/dist/commands/link.d.ts +8 -0
- package/dist/commands/lint.d.ts +2 -0
- package/dist/commands/logs.d.ts +2 -0
- package/dist/commands/mcp.d.ts +4 -0
- package/dist/commands/open.d.ts +2 -0
- package/dist/commands/postgres.d.ts +2 -0
- package/dist/commands/project.d.ts +8 -0
- package/dist/commands/promote.d.ts +28 -0
- package/dist/commands/pull.d.ts +2 -0
- package/dist/commands/restore.d.ts +5 -0
- package/dist/commands/rollback.d.ts +21 -0
- package/dist/commands/run.d.ts +2 -0
- package/dist/commands/skills.d.ts +2 -0
- package/dist/commands/status.d.ts +27 -0
- package/dist/commands/support.d.ts +2 -0
- package/dist/commands/tasks.d.ts +2 -0
- package/dist/commands/test-users.d.ts +4 -0
- package/dist/commands/test.d.ts +2 -0
- package/dist/commands/test.js +74 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/typecheck.d.ts +9 -0
- package/dist/commands/update.d.ts +25 -0
- package/dist/commands/upgrade.d.ts +12 -0
- package/dist/commands/usage.d.ts +2 -0
- package/dist/commands/verify.d.ts +419 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/advisor-context.d.ts +20 -0
- package/dist/lib/advisor-runs.d.ts +26 -0
- package/dist/lib/agent-hooks.d.ts +74 -0
- package/dist/lib/allowed-origins.d.ts +11 -0
- package/dist/lib/auth.d.ts +12 -0
- package/dist/lib/base-files.d.ts +31 -0
- package/dist/lib/browser-actions.d.ts +106 -0
- package/dist/lib/browser-flow-preflight.d.ts +6 -0
- package/dist/lib/browser-refusal.d.ts +17 -0
- package/dist/lib/browser-run.d.ts +102 -0
- package/dist/lib/build-errors.d.ts +24 -0
- package/dist/lib/chrome.d.ts +66 -0
- package/dist/lib/claim-handoff.d.ts +11 -0
- package/dist/lib/client.d.ts +150 -0
- package/dist/lib/config.d.ts +125 -0
- package/dist/lib/declared-data.d.ts +50 -0
- package/dist/lib/deploy-check.d.ts +56 -0
- package/dist/lib/device-login.d.ts +41 -0
- package/dist/lib/device.d.ts +2 -0
- package/dist/lib/envfile-write.d.ts +17 -0
- package/dist/lib/files.d.ts +111 -0
- package/dist/lib/frontend-dev.d.ts +28 -0
- package/dist/lib/generic-lint.d.ts +9 -0
- package/dist/lib/help-summary.d.ts +2 -0
- package/dist/lib/http.d.ts +9 -0
- package/dist/lib/init-agent-guide.d.ts +13 -0
- package/dist/lib/init-feature-template.d.ts +8 -0
- package/dist/lib/init-features.d.ts +50 -0
- package/dist/lib/init-green-template.d.ts +2 -0
- package/dist/lib/init-install.d.ts +14 -0
- package/dist/lib/init-scaffold.d.ts +44 -0
- package/dist/lib/init-template.d.ts +2 -0
- package/dist/lib/init-test-template.d.ts +2 -0
- package/dist/lib/init-ui-kit.d.ts +8 -0
- package/dist/lib/last-run.d.ts +38 -0
- package/dist/lib/link-hint.d.ts +5 -0
- package/dist/lib/next-actions.d.ts +48 -0
- package/dist/lib/notify/index.d.ts +18 -0
- package/dist/lib/notify/providers/update.d.ts +45 -0
- package/dist/lib/notify/types.d.ts +25 -0
- package/dist/lib/open.d.ts +1 -0
- package/dist/lib/output.d.ts +61 -0
- package/dist/lib/platform-command.d.ts +6 -0
- package/dist/lib/platform-contract.d.ts +26 -0
- package/dist/lib/platform-tools.d.ts +77 -0
- package/dist/lib/playwright-fixtures.d.ts +19 -0
- package/dist/lib/playwright-fixtures.js +140 -0
- package/dist/lib/playwright-fixtures.js.map +1 -0
- package/dist/lib/post-live-render.d.ts +48 -0
- package/dist/lib/project-notices.d.ts +18 -0
- package/dist/lib/project-pin.d.ts +57 -0
- package/dist/lib/project-ref.d.ts +32 -0
- package/dist/lib/project-urls.d.ts +18 -0
- package/dist/lib/promote-handoff.d.ts +65 -0
- package/dist/lib/promote-outcome.d.ts +98 -0
- package/dist/lib/publish-surface.d.ts +8 -0
- package/dist/lib/repro-packet.d.ts +35 -0
- package/dist/lib/scaffold.d.ts +46 -0
- package/dist/lib/skills-pack.d.ts +81 -0
- package/dist/lib/skills-pack.generated.d.ts +2 -0
- package/dist/lib/source-lint.d.ts +42 -0
- package/dist/lib/spinner.d.ts +14 -0
- package/dist/lib/startup-notice.d.ts +23 -0
- package/dist/lib/surface-counts.d.ts +88 -0
- package/dist/lib/temp-auth.d.ts +53 -0
- package/dist/lib/terminal-text.d.ts +10 -0
- package/dist/lib/test-identities.d.ts +122 -0
- package/dist/lib/test-identities.js +1 -1
- package/dist/lib/test-identities.js.map +1 -1
- package/dist/lib/test-reporter.d.ts +13 -0
- package/dist/lib/test-reporter.js +28 -0
- package/dist/lib/test-reporter.js.map +1 -0
- package/dist/lib/typecheck-version.d.ts +1 -0
- package/dist/lib/typecheck.d.ts +136 -0
- package/dist/lib/update-security.d.ts +25 -0
- package/dist/lib/vendor/deploy-paths.d.ts +21 -0
- package/dist/lib/vendor/repro-guidance.d.ts +111 -0
- package/dist/lib/verify-keep.d.ts +92 -0
- package/dist/lib/verify-progress.d.ts +2 -0
- package/dist/lib/verify-report.d.ts +4 -0
- package/dist/lib/version.d.ts +1 -0
- package/dist/testing.d.ts +37 -0
- package/dist/testing.js +2 -0
- package/dist/testing.js.map +1 -1
- package/dist/types.d.ts +104 -0
- package/npm-shrinkwrap.json +48 -2
- package/package.json +14 -3
- package/runtime/PLATFORM-SOURCE.json +1 -1
- package/runtime/SOURCE-LINT-VENDOR.json +1 -1
- package/src/testing.ts +3 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { type ContractVerdict } from './platform-contract.js';
|
|
2
|
+
export interface TypeError {
|
|
3
|
+
file: string;
|
|
4
|
+
line: number;
|
|
5
|
+
column: number;
|
|
6
|
+
code: string;
|
|
7
|
+
message: string;
|
|
8
|
+
}
|
|
9
|
+
export interface TypecheckResult {
|
|
10
|
+
/** true = no type errors. */
|
|
11
|
+
ok: boolean;
|
|
12
|
+
errors: TypeError[];
|
|
13
|
+
/** How tsc was located, for a one-line "ran via …" note. */
|
|
14
|
+
via: 'project' | 'bundled' | 'npx';
|
|
15
|
+
/** Raw combined stdout+stderr — shown when we couldn't parse structured errors. */
|
|
16
|
+
raw: string;
|
|
17
|
+
/** Set when tsc itself couldn't be run at all. */
|
|
18
|
+
spawnError?: string;
|
|
19
|
+
/** This CLI's consumer contract against the platform's last announced one (tsk_0f3d05b9). */
|
|
20
|
+
contract?: ContractVerdict;
|
|
21
|
+
}
|
|
22
|
+
interface TscInvocation {
|
|
23
|
+
command: string;
|
|
24
|
+
args: string[];
|
|
25
|
+
via: TypecheckResult['via'];
|
|
26
|
+
}
|
|
27
|
+
export declare function npxTscInvocation(platform?: NodeJS.Platform): TscInvocation;
|
|
28
|
+
/**
|
|
29
|
+
* Load the pulled tree's project config explicitly. TypeScript 7 reports
|
|
30
|
+
* TS5112 when source files are passed because that would ignore tsconfig.json;
|
|
31
|
+
* this project-wide invocation needs neither source-file args nor
|
|
32
|
+
* --ignoreConfig.
|
|
33
|
+
*/
|
|
34
|
+
export declare function typecheckArgs(prefixArgs?: readonly string[]): string[];
|
|
35
|
+
/**
|
|
36
|
+
* A type package declared in package.json but absent from node_modules is not a
|
|
37
|
+
* mistake in the code — it is a tree that has not been installed yet. tsc has no
|
|
38
|
+
* way to tell those apart, so the first check on a fresh pull failed with
|
|
39
|
+
* TS2503 ("Cannot find namespace 'JSX'") and every agent lost a couple of
|
|
40
|
+
* minutes installing by hand before re-running. Resolving the DECLARED packages
|
|
41
|
+
* first makes the first check mean what it says.
|
|
42
|
+
*
|
|
43
|
+
* Deliberately narrow, so this can never mask a real bug:
|
|
44
|
+
* - only `@types/*` entries, only ones the project itself declares, only ones
|
|
45
|
+
* actually missing from node_modules. An UNDECLARED import still fails with
|
|
46
|
+
* its real diagnostic — that is the bug the gate exists to catch.
|
|
47
|
+
* - a warm tree plans nothing and spawns nothing.
|
|
48
|
+
* Mirrors the prerequisite the platform's deploy-check container already
|
|
49
|
+
* provides for the same tree.
|
|
50
|
+
*/
|
|
51
|
+
export interface DeclaredTypesPlan {
|
|
52
|
+
/** Install specs (`@types/react@^18.3.0`) for declared-but-missing packages. */
|
|
53
|
+
specs: string[];
|
|
54
|
+
/** Bare package names, for messaging. */
|
|
55
|
+
missing: string[];
|
|
56
|
+
}
|
|
57
|
+
export type TypePackageInstaller = (specs: string[], projectDir: string) => void;
|
|
58
|
+
export declare function planDeclaredTypePackages(projectDir: string): DeclaredTypesPlan;
|
|
59
|
+
/**
|
|
60
|
+
* Resolve declared-but-missing type packages with a caller-supplied installer.
|
|
61
|
+
* The CLI's own commands never install into a project (tsk_97979518,
|
|
62
|
+
* pfb_8f0f7cdd04a1): they refuse with missingTypePackagesMessage instead.
|
|
63
|
+
* Fail-open: an installer that throws never blocks the check.
|
|
64
|
+
*/
|
|
65
|
+
export declare function ensureDeclaredTypePackages(projectDir: string, install: TypePackageInstaller): DeclaredTypesPlan & {
|
|
66
|
+
installed: boolean;
|
|
67
|
+
};
|
|
68
|
+
/** Why a check did not run: declared type packages are not installed. The
|
|
69
|
+
* typecheck never installs them itself (it would change the project tree and
|
|
70
|
+
* run package scripts). */
|
|
71
|
+
export declare function missingTypePackagesMessage(missing: string[], projectDir: string): string;
|
|
72
|
+
/** Longest a typecheck child may run before it and its children are stopped.
|
|
73
|
+
* SOMEWHERE_TYPECHECK_TIMEOUT_MS overrides it. */
|
|
74
|
+
export declare function typecheckTimeoutMs(): number;
|
|
75
|
+
export interface BoundedResult {
|
|
76
|
+
code: number | null;
|
|
77
|
+
out: string;
|
|
78
|
+
stdout: string;
|
|
79
|
+
error?: Error;
|
|
80
|
+
timedOut: boolean;
|
|
81
|
+
/** Set when a stopped run's process group still had members after the
|
|
82
|
+
* final wait: some of its processes may still be running. */
|
|
83
|
+
stopIncomplete?: {
|
|
84
|
+
pid: number;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Run a typecheck child (tsc, or npx fetching it) with a deadline.
|
|
89
|
+
*
|
|
90
|
+
* POSIX: the child leads its own process group. A timeout, Ctrl-C or TERM
|
|
91
|
+
* sends TERM to that group, waits (bounded) for it to empty, sends KILL to
|
|
92
|
+
* what remains, and waits (bounded) again. This reaches descendants that stay
|
|
93
|
+
* in the group; one that moved to another group or session is not reached.
|
|
94
|
+
* If the group still has members after the final wait, the run reports that
|
|
95
|
+
* some processes may still be running instead of claiming they stopped.
|
|
96
|
+
* The group is signalled only after a membership check and no timer outlives
|
|
97
|
+
* the run, which narrows (does not eliminate) the chance of signalling a
|
|
98
|
+
* recycled group id. Windows: `taskkill /T /F` (not exercised by this CLI's
|
|
99
|
+
* tests). `onAbort` runs before the CLI exits on Ctrl-C/TERM, for the
|
|
100
|
+
* caller's temporary files.
|
|
101
|
+
*/
|
|
102
|
+
export declare function runBounded(command: string, args: string[], cwd: string, options?: {
|
|
103
|
+
timeoutMs?: number;
|
|
104
|
+
onAbort?: () => void;
|
|
105
|
+
}): Promise<BoundedResult>;
|
|
106
|
+
/** Said instead of "stopped" when processes may have survived the stop. */
|
|
107
|
+
export declare function stopIncompleteMessage(pid: number): string;
|
|
108
|
+
export declare function timedOutMessage(via: TscInvocation['via'], run?: Pick<BoundedResult, 'stopIncomplete'>): string;
|
|
109
|
+
/**
|
|
110
|
+
* Parse tsc's default (non-pretty) diagnostic lines:
|
|
111
|
+
* path/to/file.ts(12,5): error TS2304: Cannot find name 'sanitizeForSpeech'.
|
|
112
|
+
*/
|
|
113
|
+
export declare function parseTscOutput(output: string): TypeError[];
|
|
114
|
+
/** The typed data client allows `limit` 1 to 100. Outside that range tsc only
|
|
115
|
+
* says the call has no matching overload (TS2769) and shows `limit?: undefined`
|
|
116
|
+
* in the detail lines, which never names the rule, so the rule is appended. */
|
|
117
|
+
export declare const PAGE_LIMIT_EXPLANATION = "A data list call reads at most 100 rows: limit must be a number from 1 to 100. Read further pages with { after: page.next } while page.has_more is true.";
|
|
118
|
+
export declare function explainPageLimit(message: string, detailLine: string): string;
|
|
119
|
+
/**
|
|
120
|
+
* Run a typecheck against `projectDir`. Assumes a tsconfig.json is present
|
|
121
|
+
* (pull scaffolds one); without it, tsc errors loudly and we surface that.
|
|
122
|
+
*/
|
|
123
|
+
export declare function runTypecheck(projectDir: string, options?: {
|
|
124
|
+
installTypePackages?: TypePackageInstaller | false;
|
|
125
|
+
apiBase?: string;
|
|
126
|
+
}): Promise<TypecheckResult>;
|
|
127
|
+
/** Announce, on stderr so JSON on stdout is untouched, that TypeScript is
|
|
128
|
+
* about to be fetched with npx: a network step that also writes npm's cache.
|
|
129
|
+
* The project's own dependencies are never installed. */
|
|
130
|
+
export declare function announceNpxTypeScriptFetch(version: string): void;
|
|
131
|
+
/** How this project's typecheck will get its compiler: 'npx' means a
|
|
132
|
+
* network fetch of TypeScript, which commands announce before running. */
|
|
133
|
+
export declare function typecheckCompilerSource(projectDir: string): TscInvocation['via'];
|
|
134
|
+
/** Where this module lives — used by tests that need the CLI package root. */
|
|
135
|
+
export declare function cliPackageRoot(): string;
|
|
136
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const CLI_PACKAGE = "@somewhere-cloud/cli";
|
|
2
|
+
export declare const OFFICIAL_NPM_REGISTRY = "https://registry.npmjs.org";
|
|
3
|
+
export declare const OFFICIAL_REPOSITORY = "https://github.com/Somewhere-Cloud/somewhere-cli";
|
|
4
|
+
export interface OfficialRelease {
|
|
5
|
+
version: string;
|
|
6
|
+
integrity: string;
|
|
7
|
+
tarballUrl: string;
|
|
8
|
+
attestationUrl: string;
|
|
9
|
+
}
|
|
10
|
+
/** Validate the exact release coordinates from npm's pinned official
|
|
11
|
+
* packument before any artifact or attestation URL is followed. */
|
|
12
|
+
export declare function parseOfficialRelease(body: unknown): OfficialRelease;
|
|
13
|
+
/** Cryptographically verify the SLSA bundle against Sigstore's TUF trust root.
|
|
14
|
+
* This checks the Fulcio certificate chain and SCT, Rekor inclusion proof, DSSE
|
|
15
|
+
* signature, GitHub OIDC issuer, exact workflow identity, immutable repository
|
|
16
|
+
* and owner IDs, and public-repository claim. Any verifier/network/policy error
|
|
17
|
+
* is a hard refusal. */
|
|
18
|
+
export declare function assertUpdateVerificationRuntime(nodeVersion?: string): void;
|
|
19
|
+
export declare function verifyPublishedProvenance(body: unknown, release: OfficialRelease): Promise<void>;
|
|
20
|
+
export declare function verifyTarballIntegrity(bytes: Uint8Array, integrity: string): void;
|
|
21
|
+
/** Validate the publishable lock carried inside the authenticated tarball.
|
|
22
|
+
* Every reachable production package must be integrity-pinned and marked as
|
|
23
|
+
* bundled, so the final install never needs registry resolution. */
|
|
24
|
+
export declare function validateLockedClosure(manifestValue: unknown, lockValue: unknown, release: OfficialRelease): void;
|
|
25
|
+
export declare function verifyLockedArtifact(artifact: Buffer, extractionDir: string, release: OfficialRelease): Promise<void>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deploy-relative path policy.
|
|
3
|
+
*
|
|
4
|
+
* Deploy maps become object-store keys and are later returned by source export
|
|
5
|
+
* for local writes. Accept only already-normalized, project-relative paths so
|
|
6
|
+
* neither side has to guess whether `..`, a backslash, or a control character
|
|
7
|
+
* is data or navigation. Sensitive paths are rejected separately so secrets
|
|
8
|
+
* never enter the public deploy namespace in the first place.
|
|
9
|
+
*/
|
|
10
|
+
export type DeployPathIssueKind = 'unsafe' | 'sensitive';
|
|
11
|
+
export interface DeployPathIssue {
|
|
12
|
+
kind: DeployPathIssueKind;
|
|
13
|
+
reason: string;
|
|
14
|
+
}
|
|
15
|
+
/** High-confidence secret/dotfile detection after path safety is established. */
|
|
16
|
+
export declare function isSensitiveDeployPath(path: string): boolean;
|
|
17
|
+
export declare function inspectDeployPath(path: string, options?: {
|
|
18
|
+
allowSensitive?: boolean;
|
|
19
|
+
}): DeployPathIssue | null;
|
|
20
|
+
/** True only for a path safe to return from source export / local pull. */
|
|
21
|
+
export declare function isSafeDeployExportPath(path: string): boolean;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical repro-packet schema, validators and guidance map (`somewhere.repro/1`, tsk_da2dba3d).
|
|
3
|
+
*
|
|
4
|
+
* ONE source for both clients. The MCP server imports it directly; the CLI vendors it with a
|
|
5
|
+
* sha256 manifest and a `--check` (the same pattern as runtime/source-lint.cjs). Ported from the
|
|
6
|
+
* CLI's local module (somewhere-cli PR #67 @ 516b0fd1, Files e0e3e20d) without behaviour changes,
|
|
7
|
+
* except buildRecordFromFields, which takes already-typed fields so each client keeps its own
|
|
8
|
+
* capture while sharing every validator.
|
|
9
|
+
*
|
|
10
|
+
* A packet is built ONLY from typed, validated fields of a failure: never its message, hint, data,
|
|
11
|
+
* arguments, request or response. A field that fails its validator is omitted, not cleaned.
|
|
12
|
+
* OMITTED names the parts of a failure the builder never reads. It is NOT a claim about what the
|
|
13
|
+
* collected fields can contain: an id field keeps any value that passes its shape validator, and the
|
|
14
|
+
* secret-shape scrub below refuses only the shapes it lists. So a packet is reviewed before it is
|
|
15
|
+
* submitted, and nothing here promises that tokens, passwords or emails cannot appear (tsk_da2dba3d).
|
|
16
|
+
* Investigation steps are fixed argv arrays keyed by the validated code/operation; untrusted text
|
|
17
|
+
* is never interpolated into a command. Nothing here uploads anything.
|
|
18
|
+
*
|
|
19
|
+
* Dependency-free and platform-neutral: no imports, no runtime APIs.
|
|
20
|
+
*/
|
|
21
|
+
export declare const REPRO_SCHEMA = "somewhere.repro/1";
|
|
22
|
+
export declare const LAST_ERROR_FILE = "last-error.json";
|
|
23
|
+
export declare const OMITTED: readonly ["message", "hint_text", "stack", "console", "request_body", "response_body", "arguments", "route_data", "sql", "url_query", "headers", "cookies", "source", "env"];
|
|
24
|
+
export type Outcome = 'refused' | 'unknown' | 'failed';
|
|
25
|
+
/** The one structured detail a refusal may carry (agreed with Deploy f74, tsk_da2dba3d): where in the
|
|
26
|
+
* caller's own input the problem is, and the numeric limit. `path` is built by the platform from an
|
|
27
|
+
* index and a fixed key, never from flow text; anything that fails these shapes is dropped. */
|
|
28
|
+
export interface InvalidDetail {
|
|
29
|
+
path: string;
|
|
30
|
+
limit_ms?: number;
|
|
31
|
+
}
|
|
32
|
+
export declare function safeInvalid(value: unknown): InvalidDetail | undefined;
|
|
33
|
+
export declare function safeCode(value: unknown): string | undefined;
|
|
34
|
+
export declare function safeStatus(value: unknown): number | undefined;
|
|
35
|
+
export interface ReproRecord {
|
|
36
|
+
schema: typeof REPRO_SCHEMA;
|
|
37
|
+
/** Shared with the MCP builder (f74): `kind` names the client, `version` is its semver or 'unknown'. */
|
|
38
|
+
client: {
|
|
39
|
+
kind: 'cli' | 'mcp';
|
|
40
|
+
version: string;
|
|
41
|
+
};
|
|
42
|
+
captured_at: string;
|
|
43
|
+
command?: string;
|
|
44
|
+
code: string;
|
|
45
|
+
http_status?: number;
|
|
46
|
+
operation?: string;
|
|
47
|
+
request_id?: string;
|
|
48
|
+
trace_id?: string;
|
|
49
|
+
project_id?: string;
|
|
50
|
+
retry?: boolean;
|
|
51
|
+
retry_after_ms?: number;
|
|
52
|
+
outcome: Outcome;
|
|
53
|
+
duration_ms?: number;
|
|
54
|
+
invalid?: InvalidDetail;
|
|
55
|
+
}
|
|
56
|
+
/** `/projects/<uuid>/deploys/rel_x?q=secret` → `/projects/:id/deploys/:id`. */
|
|
57
|
+
export declare function routeTemplate(path: string): string | undefined;
|
|
58
|
+
export declare function operationLabel(method: string, path: string): string | undefined;
|
|
59
|
+
/** An operation is kept only if it is already a template: `METHOD <routeTemplate fixed point>` or `tool:<name>`. */
|
|
60
|
+
export declare function safeOperation(value: unknown): string | undefined;
|
|
61
|
+
export declare function toolOperation(name: unknown): string | undefined;
|
|
62
|
+
/** Command names only, e.g. ['browser', 'test'] → 'browser test'; anything else is dropped. */
|
|
63
|
+
export declare function commandPath(names: string[]): string | undefined;
|
|
64
|
+
/** The typed fields a client has for one failure. Every one is re-validated here. */
|
|
65
|
+
export interface FailureFields {
|
|
66
|
+
/** True only for a platform-originated failure (an API or tool error); false is a client-side error. */
|
|
67
|
+
platform: boolean;
|
|
68
|
+
code?: unknown;
|
|
69
|
+
status?: unknown;
|
|
70
|
+
operation?: unknown;
|
|
71
|
+
tool?: unknown;
|
|
72
|
+
requestId?: unknown;
|
|
73
|
+
traceId?: unknown;
|
|
74
|
+
projectId?: unknown;
|
|
75
|
+
retry?: unknown;
|
|
76
|
+
retryAfterMs?: unknown;
|
|
77
|
+
responseIncomplete?: unknown;
|
|
78
|
+
invalid?: unknown;
|
|
79
|
+
}
|
|
80
|
+
export interface RecordContext {
|
|
81
|
+
client: {
|
|
82
|
+
kind: 'cli' | 'mcp';
|
|
83
|
+
version: string;
|
|
84
|
+
};
|
|
85
|
+
command?: string;
|
|
86
|
+
startedAt?: number;
|
|
87
|
+
now?: number;
|
|
88
|
+
}
|
|
89
|
+
/** Shared record builder. The CLI maps a CliApiError/PlatformToolError into FailureFields; the MCP
|
|
90
|
+
* server maps an upstream tool-error envelope. Same validators, same outcome rule. */
|
|
91
|
+
export declare function buildRecordFromFields(fields: FailureFields, context: RecordContext): ReproRecord;
|
|
92
|
+
type Step = string[];
|
|
93
|
+
export interface ReproPacket {
|
|
94
|
+
schema: typeof REPRO_SCHEMA;
|
|
95
|
+
collected: ReproRecord;
|
|
96
|
+
omitted: readonly string[];
|
|
97
|
+
surface: string;
|
|
98
|
+
recipe: {
|
|
99
|
+
kind: 'synthetic';
|
|
100
|
+
rerun_original: boolean;
|
|
101
|
+
steps: string[];
|
|
102
|
+
investigate: Step[];
|
|
103
|
+
};
|
|
104
|
+
submit: {
|
|
105
|
+
destination: 'support_ticket';
|
|
106
|
+
automatic: false;
|
|
107
|
+
how: string;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export declare function buildPacket(record: ReproRecord): ReproPacket;
|
|
111
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { ApiClient } from './client.js';
|
|
2
|
+
/** `somewhere verify --keep-actors`: what THIS project folder remembers between runs
|
|
3
|
+
* of one multi-user flow. Ids, emails and session names only; never a token, cookie
|
|
4
|
+
* or password (the browsers' sessions live on the platform, owned by this developer). */
|
|
5
|
+
export declare const KEEP_FILE = "verify-actors.json";
|
|
6
|
+
/** Test identities live 24 h; reuse them only well inside that. */
|
|
7
|
+
export declare const KEEP_IDENTITY_REUSE_MS: number;
|
|
8
|
+
/** A run's lock older than this is stale even if its process id was reused. */
|
|
9
|
+
export declare const KEEP_LOCK_STALE_MS: number;
|
|
10
|
+
export interface KeepEntry {
|
|
11
|
+
project_id: string;
|
|
12
|
+
created_at: string;
|
|
13
|
+
actors: string[];
|
|
14
|
+
sessions: Record<string, string>;
|
|
15
|
+
identities?: Record<string, {
|
|
16
|
+
user_id: string;
|
|
17
|
+
email: string;
|
|
18
|
+
}>;
|
|
19
|
+
/** The page path (pathname only, never a query) each kept actor was left on. */
|
|
20
|
+
pages?: Record<string, string>;
|
|
21
|
+
}
|
|
22
|
+
/** A random per-folder salt, so two folders linked to one project never share kept browsers. */
|
|
23
|
+
export declare function folderSalt(root: string): string;
|
|
24
|
+
/** Stable per folder, project, flow file and full cast (names, sign-in and seed values,
|
|
25
|
+
* hashed only), so a different flow, user or seed never reconnects to these browsers. */
|
|
26
|
+
export declare function keepKey(salt: string, projectId: string, flowPath: string, actors: Record<string, unknown>): string;
|
|
27
|
+
export declare function readKeep(root: string, key: string): KeepEntry | null;
|
|
28
|
+
export declare function listKeep(root: string, projectId: string): Array<[string, KeepEntry]>;
|
|
29
|
+
export declare function writeKeep(root: string, key: string, entry: KeepEntry): void;
|
|
30
|
+
export declare function dropKeep(root: string, key: string): void;
|
|
31
|
+
/** Identities a previous keeping run left, if still well inside their lifetime. */
|
|
32
|
+
export declare function reusableIdentities(entry: KeepEntry | null, now: number): KeepEntry['identities'] | undefined;
|
|
33
|
+
/** One run per kept flow at a time: an exclusive lock file for the whole run. A
|
|
34
|
+
* lock whose process is gone, or older than KEEP_LOCK_STALE_MS, is taken over. */
|
|
35
|
+
export declare function lockKeep(root: string, key: string, now?: number): () => void;
|
|
36
|
+
/** What the record should say after a run: keep (what this run kept), keep the old
|
|
37
|
+
* record (cleanup unconfirmed, so --close-actors can still find it), or drop it. */
|
|
38
|
+
export declare function recordAfterRun(previous: KeepEntry | null, report: {
|
|
39
|
+
keep_actors?: {
|
|
40
|
+
kept: string[];
|
|
41
|
+
reused_identities: boolean;
|
|
42
|
+
};
|
|
43
|
+
kept_sessions: Array<{
|
|
44
|
+
actor: string;
|
|
45
|
+
session_id: string;
|
|
46
|
+
}>;
|
|
47
|
+
cleanup: Array<{
|
|
48
|
+
status: string;
|
|
49
|
+
}>;
|
|
50
|
+
test_users?: {
|
|
51
|
+
identities: Array<{
|
|
52
|
+
actor: string;
|
|
53
|
+
user_id: string;
|
|
54
|
+
email: string;
|
|
55
|
+
}>;
|
|
56
|
+
cleanup: {
|
|
57
|
+
status: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
segments?: Array<{
|
|
61
|
+
as: string;
|
|
62
|
+
final_url?: string;
|
|
63
|
+
}>;
|
|
64
|
+
}, projectId: string, now: number): {
|
|
65
|
+
action: 'write';
|
|
66
|
+
entry: KeepEntry;
|
|
67
|
+
} | {
|
|
68
|
+
action: 'keep';
|
|
69
|
+
} | {
|
|
70
|
+
action: 'drop';
|
|
71
|
+
};
|
|
72
|
+
/** --close-actors: close each kept browser and delete the kept test identities. */
|
|
73
|
+
export declare function closeKept(client: Pick<ApiClient, 'call'>, entry: KeepEntry): Promise<{
|
|
74
|
+
browsers: Array<{
|
|
75
|
+
actor: string;
|
|
76
|
+
status: string;
|
|
77
|
+
}>;
|
|
78
|
+
identities: {
|
|
79
|
+
status: string;
|
|
80
|
+
deleted?: number;
|
|
81
|
+
};
|
|
82
|
+
}>;
|
|
83
|
+
/** The one line --keep-actors prints on stderr when this run cannot reconnect:
|
|
84
|
+
* nothing is kept for THIS flow file and cast in this folder (a new or renamed
|
|
85
|
+
* flow file, or a changed cast, starts fresh). Null when there is a record. */
|
|
86
|
+
export declare function keepStartNote(entry: KeepEntry | null, otherFlowsKept: number): string | null;
|
|
87
|
+
/** Each kept actor's last page path, from the run's segment reports (pathname
|
|
88
|
+
* only: a query or fragment is never stored). */
|
|
89
|
+
export declare function lastPages(segments: Array<{
|
|
90
|
+
as: string;
|
|
91
|
+
final_url?: string;
|
|
92
|
+
}>, actors: string[]): Record<string, string>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Bearer screenshot URLs belong in private CLI state, never deployable source. */
|
|
2
|
+
export declare function saveVerifyReport(report: unknown): string;
|
|
3
|
+
/** An explicit report destination never replaces an existing file. */
|
|
4
|
+
export declare function writeVerifyReportTo(path: string, report: unknown): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CLI_VERSION: string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare class UserSession {
|
|
2
|
+
readonly origin: string;
|
|
3
|
+
private cookies;
|
|
4
|
+
constructor(baseUrl: string);
|
|
5
|
+
request(path: string, init?: RequestInit): Promise<Response>;
|
|
6
|
+
post(path: string, body: unknown): Promise<Response>;
|
|
7
|
+
data(table: string, contract: string, request: DataRequest): Promise<Response>;
|
|
8
|
+
}
|
|
9
|
+
export type DataRequest = {
|
|
10
|
+
operation: 'list';
|
|
11
|
+
limit?: number;
|
|
12
|
+
after?: string | number;
|
|
13
|
+
where?: Record<string, unknown>;
|
|
14
|
+
} | {
|
|
15
|
+
operation: 'get' | 'delete';
|
|
16
|
+
id: string | number;
|
|
17
|
+
} | {
|
|
18
|
+
operation: 'create';
|
|
19
|
+
values: Record<string, unknown>;
|
|
20
|
+
} | {
|
|
21
|
+
operation: 'update';
|
|
22
|
+
id: string | number;
|
|
23
|
+
values: Record<string, unknown>;
|
|
24
|
+
};
|
|
25
|
+
export declare function expectStatus(response: Response, expected: number): Promise<void>;
|
|
26
|
+
export declare function expectRefusal(response: Response, status: 401 | 403, code: string): Promise<void>;
|
|
27
|
+
export declare function signIn(baseUrl: string, email: string, password: string): Promise<UserSession>;
|
|
28
|
+
export declare function createUser(baseUrl: string): Promise<UserSession>;
|
|
29
|
+
interface BrowserPage {
|
|
30
|
+
locator(selector: string): {
|
|
31
|
+
waitFor(options: {
|
|
32
|
+
state: 'visible';
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export declare function waitForApp(page: BrowserPage, state?: 'ready' | 'signed-in' | 'signed-out'): Promise<void>;
|
|
37
|
+
export { test, expect, expectRefused, data, ready, type TestUser } from './lib/playwright-fixtures.js';
|
package/dist/testing.js
CHANGED
|
@@ -62,4 +62,6 @@ export function waitForApp(page, state = 'ready') {
|
|
|
62
62
|
const selector = state === 'ready' ? '[data-app-state="signed-in"], [data-app-state="signed-out"]' : '[data-app-state="' + state + '"]';
|
|
63
63
|
return page.locator(selector).waitFor({ state: 'visible' });
|
|
64
64
|
}
|
|
65
|
+
// Lazy project-local Playwright resolution keeps UserSession dependency-free.
|
|
66
|
+
export { test, expect, expectRefused, data, ready } from './lib/playwright-fixtures.js';
|
|
65
67
|
//# sourceMappingURL=testing.js.map
|
package/dist/testing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,OAAO,WAAW;IACb,MAAM,CAAS;IAChB,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC5C,YAAY,OAAe,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IACvE,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,OAAoB,EAAE;QAChD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAChG,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACnC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACjF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QAC3E,KAAK,MAAM,MAAM,IAAI,QAAQ,CAAC,OAAO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,CAAC,UAAU,EAAE,CAAC;IACpD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC7E,MAAM,YAAY,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAkC,CAAC;IACnE,IAAI,CAAC,IAAI,CAAC,cAAc;QAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IACvF,OAAO,OAAO,CAAC;AACjB,CAAC;AAGD,MAAM,UAAU,UAAU,CAAC,IAAiB,EAAE,QAA8C,OAAO;IACjG,MAAM,QAAQ,GAAG,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,6DAA6D,CAAC,CAAC,CAAC,mBAAmB,GAAG,KAAK,GAAG,IAAI,CAAC;IACxI,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,8EAA8E;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,EAAiB,MAAM,8BAA8B,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
export interface CliConfig {
|
|
2
|
+
token: string;
|
|
3
|
+
/** Long-lived (30-day) cli-pair refresh token (smtr_…). When present, the
|
|
4
|
+
* API client swaps the access key on a 401 API_KEY_EXPIRED via
|
|
5
|
+
* POST /v1/keys/cli-pair/refresh instead of forcing a manual re-login
|
|
6
|
+
* (tsk_3642f3c4). Absent for login flows that don't yet return one. */
|
|
7
|
+
refresh_token?: string;
|
|
8
|
+
/** ISO expiry of a refreshable cli-pair access key. MCP uses this to renew
|
|
9
|
+
* shortly before expiry, avoiding replay of a request that reached the
|
|
10
|
+
* auth boundary at the same moment the 24-hour access key expired. */
|
|
11
|
+
access_expires_at?: string;
|
|
12
|
+
user: {
|
|
13
|
+
email: string;
|
|
14
|
+
username: string;
|
|
15
|
+
};
|
|
16
|
+
/** True when `token` is a temporary no-login credential (tsk_35674c33)
|
|
17
|
+
* rather than a real account login. Distinguishes the two so getToken()
|
|
18
|
+
* can give temp-aware expiry messaging and deploy can reuse/re-mint
|
|
19
|
+
* instead of ever prompting `somewhere login`. */
|
|
20
|
+
temporary?: boolean;
|
|
21
|
+
/** ISO expiry for a temporary credential (3h TTL from the server). Unused
|
|
22
|
+
* when `temporary` is not set. */
|
|
23
|
+
temp_expires_at?: string;
|
|
24
|
+
/** Where claiming a temporary workspace happens — printed on every temp
|
|
25
|
+
* deploy so the dev can convert it into a real account. */
|
|
26
|
+
claim_url?: string;
|
|
27
|
+
/** Proof held only by the originating CLI. The claim URL cannot exchange it. */
|
|
28
|
+
claim_handoff?: ClaimCliHandoff;
|
|
29
|
+
/** Kept until the server confirms it cleared the encrypted delivery. */
|
|
30
|
+
claim_handoff_ack?: ClaimCliHandoffAck;
|
|
31
|
+
}
|
|
32
|
+
export interface ClaimCliHandoff {
|
|
33
|
+
project_id: string;
|
|
34
|
+
verifier: string;
|
|
35
|
+
handoff_id?: string;
|
|
36
|
+
expires_at?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface ClaimCliHandoffAck {
|
|
39
|
+
handoff_id: string;
|
|
40
|
+
verifier: string;
|
|
41
|
+
}
|
|
42
|
+
export interface ProjectConfig {
|
|
43
|
+
project_id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
subdomain: string;
|
|
46
|
+
/** The app's URL exactly as the platform reported it (deploy response or
|
|
47
|
+
* GET /projects/:id/urls), for createClient(appUrl, key). Never built from
|
|
48
|
+
* a slug. Absent when the platform has not reported one. */
|
|
49
|
+
app_url?: string;
|
|
50
|
+
last_deploy?: ProjectDeployState;
|
|
51
|
+
/** The published version this folder's source came from: null for a project
|
|
52
|
+
* created empty here (genesis), else the release that was pulled or last
|
|
53
|
+
* deployed. Deploy sends it as base_release_id; the CLI never fetches one. */
|
|
54
|
+
source_base?: SourceBaseState;
|
|
55
|
+
/** Set once the deploy output has explained the publish surface (tsk_c166924f). */
|
|
56
|
+
publish_notice_seen?: boolean;
|
|
57
|
+
/** The CLI version this folder is pinned to when its package.json does not
|
|
58
|
+
* declare @somewhere-cloud/cli (lib/project-pin.ts, tsk_a4641877). */
|
|
59
|
+
cli_version?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface SourceBaseState {
|
|
62
|
+
project_id: string;
|
|
63
|
+
release_id: string | null;
|
|
64
|
+
at: string;
|
|
65
|
+
}
|
|
66
|
+
export interface ProjectDeployState {
|
|
67
|
+
project_id: string;
|
|
68
|
+
last_deployed_version: number;
|
|
69
|
+
at: string;
|
|
70
|
+
release_id?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface ApiError {
|
|
73
|
+
ok: false;
|
|
74
|
+
error: string;
|
|
75
|
+
message: string;
|
|
76
|
+
retry?: boolean;
|
|
77
|
+
retry_after_ms?: number;
|
|
78
|
+
}
|
|
79
|
+
export interface ApiSuccess<T = unknown> {
|
|
80
|
+
ok: true;
|
|
81
|
+
data: T;
|
|
82
|
+
}
|
|
83
|
+
export type ApiResponse<T = unknown> = ApiSuccess<T> | ApiError;
|
|
84
|
+
export type EnvScope = 'all' | 'dev' | 'prod';
|
|
85
|
+
export type EnvVisibility = 'server' | 'public';
|
|
86
|
+
export interface EnvKey {
|
|
87
|
+
key: string;
|
|
88
|
+
scope: EnvScope;
|
|
89
|
+
visibility: EnvVisibility;
|
|
90
|
+
provider: string | null;
|
|
91
|
+
purpose: string | null;
|
|
92
|
+
server_reference: string;
|
|
93
|
+
browser_reference: string | null;
|
|
94
|
+
browser_guidance: string | null;
|
|
95
|
+
exposure_eligible: boolean;
|
|
96
|
+
browser_exposed: boolean;
|
|
97
|
+
created_at: string;
|
|
98
|
+
}
|
|
99
|
+
export interface EnvSetResult extends Omit<EnvKey, 'created_at'> {
|
|
100
|
+
project_id: string;
|
|
101
|
+
set: true;
|
|
102
|
+
requires_deploy: boolean;
|
|
103
|
+
warnings?: string[];
|
|
104
|
+
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@somewhere-cloud/cli",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.51",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@somewhere-cloud/cli",
|
|
9
|
-
"version": "0.38.
|
|
9
|
+
"version": "0.38.51",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"@modelcontextprotocol/sdk",
|
|
12
12
|
"chokidar",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"sw": "bin/somewhere.js"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
+
"@playwright/test": "^1.65.0",
|
|
37
38
|
"@types/node": "^22.19.21",
|
|
38
39
|
"@types/prompts": "^2.4.0",
|
|
39
40
|
"@types/semver": "^7.5.8",
|
|
@@ -160,6 +161,22 @@
|
|
|
160
161
|
"node": "^20.17.0 || >=22.9.0"
|
|
161
162
|
}
|
|
162
163
|
},
|
|
164
|
+
"node_modules/@playwright/test": {
|
|
165
|
+
"version": "1.65.0",
|
|
166
|
+
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.65.0.tgz",
|
|
167
|
+
"integrity": "sha512-iGURLGuKDLakSEl7Pgfv8h7f+XLT+V861Wfhz0zlEl5nyFuKUopdkFBPKqTllTUp06aOwPuH8iuUEb3yp3MpbQ==",
|
|
168
|
+
"dev": true,
|
|
169
|
+
"license": "Apache-2.0",
|
|
170
|
+
"dependencies": {
|
|
171
|
+
"playwright": "1.65.0"
|
|
172
|
+
},
|
|
173
|
+
"bin": {
|
|
174
|
+
"playwright": "cli.js"
|
|
175
|
+
},
|
|
176
|
+
"engines": {
|
|
177
|
+
"node": ">=20"
|
|
178
|
+
}
|
|
179
|
+
},
|
|
163
180
|
"node_modules/@sigstore/bundle": {
|
|
164
181
|
"version": "4.0.0",
|
|
165
182
|
"resolved": "https://registry.npmjs.org/@sigstore/bundle/-/bundle-4.0.0.tgz",
|
|
@@ -1491,6 +1508,35 @@
|
|
|
1491
1508
|
"node": ">=16.20.0"
|
|
1492
1509
|
}
|
|
1493
1510
|
},
|
|
1511
|
+
"node_modules/playwright": {
|
|
1512
|
+
"version": "1.65.0",
|
|
1513
|
+
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.65.0.tgz",
|
|
1514
|
+
"integrity": "sha512-F3AMWcR44qMBt4kq+6Kb6mX7bjGXshktKFOPULd7reED6ZJWevjbNRqysP7q+AATE9kdPEZBibex1BYsvpVoeA==",
|
|
1515
|
+
"dev": true,
|
|
1516
|
+
"license": "Apache-2.0",
|
|
1517
|
+
"dependencies": {
|
|
1518
|
+
"playwright-core": "1.65.0"
|
|
1519
|
+
},
|
|
1520
|
+
"bin": {
|
|
1521
|
+
"playwright": "cli.js"
|
|
1522
|
+
},
|
|
1523
|
+
"engines": {
|
|
1524
|
+
"node": ">=20"
|
|
1525
|
+
}
|
|
1526
|
+
},
|
|
1527
|
+
"node_modules/playwright-core": {
|
|
1528
|
+
"version": "1.65.0",
|
|
1529
|
+
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.65.0.tgz",
|
|
1530
|
+
"integrity": "sha512-vNSKgH6YqtN7cdT/L334zo0a+YwkrpicyrHJlWWPIm/Q+Nn2SWInil01oT0mbu96U4GgoRtCYQD9CzJQgju+lA==",
|
|
1531
|
+
"dev": true,
|
|
1532
|
+
"license": "Apache-2.0",
|
|
1533
|
+
"bin": {
|
|
1534
|
+
"playwright-core": "cli.js"
|
|
1535
|
+
},
|
|
1536
|
+
"engines": {
|
|
1537
|
+
"node": ">=20"
|
|
1538
|
+
}
|
|
1539
|
+
},
|
|
1494
1540
|
"node_modules/proc-log": {
|
|
1495
1541
|
"version": "6.1.0",
|
|
1496
1542
|
"resolved": "https://registry.npmjs.org/proc-log/-/proc-log-6.1.0.tgz",
|