@testsprite/testsprite-cli 0.10.0 → 0.12.0
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/README.md +65 -41
- package/dist/commands/auth.d.ts +5 -1
- package/dist/commands/auth.js +17 -5
- package/dist/commands/ci.js +34 -4
- package/dist/commands/init.d.ts +6 -1
- package/dist/commands/init.js +13 -5
- package/dist/commands/project-env.d.ts +90 -0
- package/dist/commands/project-env.js +486 -0
- package/dist/commands/project.d.ts +19 -0
- package/dist/commands/project.js +92 -25
- package/dist/commands/test.d.ts +42 -4
- package/dist/commands/test.js +344 -49
- package/dist/commands/testlist.js +29 -3
- package/dist/commands/tunnel.d.ts +2 -2
- package/dist/commands/tunnel.js +139 -31
- package/dist/index.js +42 -14
- package/dist/lib/client-factory.d.ts +4 -1
- package/dist/lib/client-factory.js +14 -4
- package/dist/lib/client-tag.d.ts +13 -0
- package/dist/lib/client-tag.js +44 -0
- package/dist/lib/conflict-reason.d.ts +43 -2
- package/dist/lib/conflict-reason.js +100 -14
- package/dist/lib/credentials.d.ts +4 -0
- package/dist/lib/credentials.js +43 -4
- package/dist/lib/cron.js +8 -1
- package/dist/lib/errors.d.ts +44 -1
- package/dist/lib/errors.js +69 -12
- package/dist/lib/gh-output.d.ts +25 -11
- package/dist/lib/gh-output.js +36 -13
- package/dist/lib/http.d.ts +21 -2
- package/dist/lib/http.js +45 -8
- package/dist/lib/local-target.d.ts +32 -0
- package/dist/lib/local-target.js +77 -0
- package/dist/lib/output.d.ts +27 -1
- package/dist/lib/output.js +22 -3
- package/dist/lib/response-schemas.d.ts +5 -2
- package/dist/lib/response-schemas.js +39 -1
- package/dist/lib/runs.types.d.ts +50 -2
- package/dist/lib/target-url.d.ts +1 -1
- package/dist/lib/target-url.js +35 -12
- package/dist/lib/telemetry.d.ts +174 -4
- package/dist/lib/telemetry.js +286 -13
- package/dist/lib/tunnel-session.d.ts +13 -2
- package/dist/lib/tunnel-session.js +92 -23
- package/dist/lib/tunnel.types.d.ts +3 -1
- package/dist/lib/version-notice.d.ts +20 -1
- package/dist/lib/version-notice.js +59 -12
- package/dist/vendor/tunnel-client/client.d.ts +11 -0
- package/dist/vendor/tunnel-client/client.js +383 -56
- package/dist/vendor/tunnel-client/config.d.ts +11 -3
- package/dist/vendor/tunnel-client/config.js +11 -3
- package/dist/vendor/tunnel-client/types.d.ts +26 -1
- package/dist/vendor/tunnel-client/types.js +1 -0
- package/dist/vendor/tunnel-client/ws-compat.d.ts +3 -2
- package/dist/vendor/tunnel-client/ws-compat.js +3 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -1
- package/skills/testsprite-onboard.skill.md +74 -59
- package/skills/testsprite-verify.codex.md +82 -97
- package/skills/testsprite-verify.skill.md +64 -15
|
@@ -21,17 +21,36 @@ export interface VersionNoticeDeps {
|
|
|
21
21
|
* dry-run, and non-TTY all suppress. Pure — no side effects, no process state.
|
|
22
22
|
*/
|
|
23
23
|
export declare function shouldWarnBelowFloor(info: ServerVersionInfo, deps?: VersionNoticeDeps): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* True when the below-floor state should be surfaced as a GitHub Actions
|
|
26
|
+
* `::warning::` annotation: running under Actions (`GITHUB_ACTIONS=true`), not
|
|
27
|
+
* opted out, not dry-run, and strictly below the floor. Deliberately NOT gated
|
|
28
|
+
* on TTY or `--output json` — an Actions job is never a TTY, and a workflow
|
|
29
|
+
* command is parsed by the runner from either stream, so it can ride stderr
|
|
30
|
+
* without touching a JSON envelope on stdout.
|
|
31
|
+
*/
|
|
32
|
+
export declare function shouldWarnPinnedInActions(info: ServerVersionInfo, deps?: VersionNoticeDeps): boolean;
|
|
24
33
|
/**
|
|
25
34
|
* The single advisory line. Names the floor (the backend's authority) and the
|
|
26
35
|
* upgrade command — it deliberately does NOT name a target release; the npm
|
|
27
36
|
* update-notice is the single source of truth for the newest version.
|
|
28
37
|
*/
|
|
29
38
|
export declare function formatBelowFloorNotice(currentVersion: string, minVersion: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* The GitHub Actions workflow-command form of the advisory. Names the pinned
|
|
41
|
+
* (running) version, the floor it has fallen below, and the one command that
|
|
42
|
+
* re-pins the workflow to a current release. Both versions come from semver
|
|
43
|
+
* strings that already parsed (see `isBelowFloor`), so no command-data escaping
|
|
44
|
+
* is needed — neither can carry `%`, CR or LF.
|
|
45
|
+
*/
|
|
46
|
+
export declare function formatPinnedVersionWarning(currentVersion: string, minVersion: string): string;
|
|
30
47
|
/** Test-only: reset the once-per-process guard between cases. */
|
|
31
48
|
export declare function resetBelowFloorNoticeState(): void;
|
|
32
49
|
/**
|
|
33
50
|
* Emit the below-floor advisory at most once per process. Wired to the HTTP
|
|
34
51
|
* client's `onServerVersion` hook. Never throws — an advisory must not break or
|
|
35
|
-
* delay the command it rides along with.
|
|
52
|
+
* delay the command it rides along with. Under GitHub Actions the advisory is
|
|
53
|
+
* the `::warning::` workflow command (annotates the job) instead of the plain
|
|
54
|
+
* TTY line; exactly one of the two is ever emitted.
|
|
36
55
|
*/
|
|
37
56
|
export declare function noteServerVersion(info: ServerVersionInfo, deps?: VersionNoticeDeps): void;
|
|
@@ -15,29 +15,32 @@
|
|
|
15
15
|
* notice names the npm LATEST and fires whenever a newer release exists. Each
|
|
16
16
|
* owns its own number — the backend never advertises "latest".
|
|
17
17
|
*
|
|
18
|
+
* Under GitHub Actions the same below-floor observation is surfaced as a
|
|
19
|
+
* `::warning::` workflow command instead (see {@link formatPinnedVersionWarning}):
|
|
20
|
+
* a `ci init`-generated workflow pins `cli-version` to the version that
|
|
21
|
+
* generated it, so the job keeps running that version forever and the plain
|
|
22
|
+
* stderr line (TTY-gated) would never be seen. The floor header is the only
|
|
23
|
+
* version signal a CI run has in-process — the npm update check is skipped
|
|
24
|
+
* under `CI` by design — so this fires only when the pin has fallen BELOW the
|
|
25
|
+
* floor, not merely behind the newest release.
|
|
26
|
+
*
|
|
18
27
|
* Reuses `compareSemver` and the `TESTSPRITE_NO_UPDATE_NOTIFIER` opt-out from
|
|
19
28
|
* `update-check.ts` so the gating and semver semantics stay consistent.
|
|
20
29
|
*/
|
|
21
30
|
import { compareSemver, UPDATE_CHECK_OPT_OUT_ENV } from './update-check.js';
|
|
22
31
|
import { VERSION } from '../version.js';
|
|
23
32
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* dry-run, and non-TTY all suppress. Pure — no side effects, no process state.
|
|
33
|
+
* The gates every advisory shares: opt-out env, dry-run, a present + parseable
|
|
34
|
+
* floor, and the running version strictly below it. Pure.
|
|
27
35
|
*/
|
|
28
|
-
|
|
36
|
+
function isBelowFloor(info, deps) {
|
|
29
37
|
const env = deps.env ?? process.env;
|
|
30
38
|
const currentVersion = deps.currentVersion ?? VERSION;
|
|
31
|
-
const isTTY = deps.isTTY ?? process.stderr.isTTY === true;
|
|
32
39
|
const optOut = env[UPDATE_CHECK_OPT_OUT_ENV];
|
|
33
40
|
if (optOut !== undefined && optOut !== '')
|
|
34
41
|
return false;
|
|
35
|
-
if (deps.outputMode === 'json')
|
|
36
|
-
return false;
|
|
37
42
|
if (deps.dryRun === true)
|
|
38
43
|
return false;
|
|
39
|
-
if (!isTTY)
|
|
40
|
-
return false;
|
|
41
44
|
const minVersion = info.minVersion;
|
|
42
45
|
if (!minVersion)
|
|
43
46
|
return false;
|
|
@@ -45,6 +48,33 @@ export function shouldWarnBelowFloor(info, deps = {}) {
|
|
|
45
48
|
// Unparseable input on either side compares as 0, so garbage never warns.
|
|
46
49
|
return compareSemver(currentVersion, minVersion) === -1;
|
|
47
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* True when every gate passes and the running version is strictly below the
|
|
53
|
+
* advertised floor. Gates mirror the update notice: opt-out env, JSON output,
|
|
54
|
+
* dry-run, and non-TTY all suppress. Pure — no side effects, no process state.
|
|
55
|
+
*/
|
|
56
|
+
export function shouldWarnBelowFloor(info, deps = {}) {
|
|
57
|
+
const isTTY = deps.isTTY ?? process.stderr.isTTY === true;
|
|
58
|
+
if (deps.outputMode === 'json')
|
|
59
|
+
return false;
|
|
60
|
+
if (!isTTY)
|
|
61
|
+
return false;
|
|
62
|
+
return isBelowFloor(info, deps);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* True when the below-floor state should be surfaced as a GitHub Actions
|
|
66
|
+
* `::warning::` annotation: running under Actions (`GITHUB_ACTIONS=true`), not
|
|
67
|
+
* opted out, not dry-run, and strictly below the floor. Deliberately NOT gated
|
|
68
|
+
* on TTY or `--output json` — an Actions job is never a TTY, and a workflow
|
|
69
|
+
* command is parsed by the runner from either stream, so it can ride stderr
|
|
70
|
+
* without touching a JSON envelope on stdout.
|
|
71
|
+
*/
|
|
72
|
+
export function shouldWarnPinnedInActions(info, deps = {}) {
|
|
73
|
+
const env = deps.env ?? process.env;
|
|
74
|
+
if (env.GITHUB_ACTIONS !== 'true')
|
|
75
|
+
return false;
|
|
76
|
+
return isBelowFloor(info, deps);
|
|
77
|
+
}
|
|
48
78
|
/**
|
|
49
79
|
* The single advisory line. Names the floor (the backend's authority) and the
|
|
50
80
|
* upgrade command — it deliberately does NOT name a target release; the npm
|
|
@@ -55,6 +85,18 @@ export function formatBelowFloorNotice(currentVersion, minVersion) {
|
|
|
55
85
|
`Upgrade: npm install -g @testsprite/testsprite-cli ` +
|
|
56
86
|
`(disable this notice with ${UPDATE_CHECK_OPT_OUT_ENV}=1).`);
|
|
57
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* The GitHub Actions workflow-command form of the advisory. Names the pinned
|
|
90
|
+
* (running) version, the floor it has fallen below, and the one command that
|
|
91
|
+
* re-pins the workflow to a current release. Both versions come from semver
|
|
92
|
+
* strings that already parsed (see `isBelowFloor`), so no command-data escaping
|
|
93
|
+
* is needed — neither can carry `%`, CR or LF.
|
|
94
|
+
*/
|
|
95
|
+
export function formatPinnedVersionWarning(currentVersion, minVersion) {
|
|
96
|
+
return (`::warning title=TestSprite::testsprite-cli ${currentVersion} is pinned in this workflow ` +
|
|
97
|
+
`and is below the minimum supported version ${minVersion}. ` +
|
|
98
|
+
`Regenerate with testsprite ci init github --force.`);
|
|
99
|
+
}
|
|
58
100
|
/** Module-level guard: at most one below-floor advisory per process. */
|
|
59
101
|
let warnedThisProcess = false;
|
|
60
102
|
/** Test-only: reset the once-per-process guard between cases. */
|
|
@@ -64,20 +106,25 @@ export function resetBelowFloorNoticeState() {
|
|
|
64
106
|
/**
|
|
65
107
|
* Emit the below-floor advisory at most once per process. Wired to the HTTP
|
|
66
108
|
* client's `onServerVersion` hook. Never throws — an advisory must not break or
|
|
67
|
-
* delay the command it rides along with.
|
|
109
|
+
* delay the command it rides along with. Under GitHub Actions the advisory is
|
|
110
|
+
* the `::warning::` workflow command (annotates the job) instead of the plain
|
|
111
|
+
* TTY line; exactly one of the two is ever emitted.
|
|
68
112
|
*/
|
|
69
113
|
export function noteServerVersion(info, deps = {}) {
|
|
70
114
|
try {
|
|
71
115
|
if (warnedThisProcess)
|
|
72
116
|
return;
|
|
73
|
-
|
|
117
|
+
const inActions = shouldWarnPinnedInActions(info, deps);
|
|
118
|
+
if (!inActions && !shouldWarnBelowFloor(info, deps))
|
|
74
119
|
return;
|
|
75
120
|
const minVersion = info.minVersion;
|
|
76
121
|
if (!minVersion)
|
|
77
122
|
return;
|
|
78
123
|
const currentVersion = deps.currentVersion ?? VERSION;
|
|
79
124
|
const stderr = deps.stderr ?? ((line) => process.stderr.write(`${line}\n`));
|
|
80
|
-
stderr(
|
|
125
|
+
stderr(inActions
|
|
126
|
+
? formatPinnedVersionWarning(currentVersion, minVersion)
|
|
127
|
+
: formatBelowFloorNotice(currentVersion, minVersion));
|
|
81
128
|
warnedThisProcess = true;
|
|
82
129
|
}
|
|
83
130
|
catch {
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { EventEmitter } from "node:events";
|
|
2
2
|
import { TunnelClientOptions } from "./types.js";
|
|
3
3
|
export declare class TunnelClient extends EventEmitter {
|
|
4
|
+
#private;
|
|
4
5
|
private readonly options;
|
|
6
|
+
private readonly tunnelAddress;
|
|
5
7
|
private running;
|
|
6
8
|
private controlConnected;
|
|
7
9
|
private controlWs?;
|
|
8
10
|
private controlLoopTask?;
|
|
9
11
|
private controlConnectionGeneration;
|
|
10
12
|
private allowTunnelReconnect;
|
|
13
|
+
private dataPlaneTerminalErrorReported;
|
|
11
14
|
private readonly tunnelRuntimes;
|
|
12
15
|
private reconnectDelayController;
|
|
13
16
|
private readonly activeTargetSockets;
|
|
14
17
|
constructor(options: TunnelClientOptions);
|
|
18
|
+
get transport(): "tls" | "plaintext";
|
|
15
19
|
start(): Promise<void>;
|
|
16
20
|
stop(): Promise<void>;
|
|
17
21
|
private runControlLoop;
|
|
@@ -21,7 +25,14 @@ export declare class TunnelClient extends EventEmitter {
|
|
|
21
25
|
private parseControlMessage;
|
|
22
26
|
private ensureTunnelRuntime;
|
|
23
27
|
private connectTunnel;
|
|
28
|
+
private recordDataPlaneFailure;
|
|
29
|
+
private armDataPlaneFailureDeadline;
|
|
30
|
+
private expireDataPlaneFailureEpisode;
|
|
31
|
+
private markDataPlaneEstablished;
|
|
32
|
+
private clearDataPlaneAttemptTimers;
|
|
33
|
+
private clearDataPlaneFailureEpisode;
|
|
24
34
|
private stopAllTunnelRuntimes;
|
|
35
|
+
private beginStop;
|
|
25
36
|
private handleIncomingStream;
|
|
26
37
|
private proxyStreams;
|
|
27
38
|
private copyOneWay;
|