@mycompbox/compbox-cli 1.21.9 → 1.21.11
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/.tsbuildinfo +1 -1
- package/commands/list.js +1 -1
- package/commands/list.js.map +1 -1
- package/commands/machines.d.ts +4 -0
- package/commands/machines.d.ts.map +1 -1
- package/commands/machines.js +61 -2
- package/commands/machines.js.map +1 -1
- package/commands/run.d.ts +27 -1
- package/commands/run.d.ts.map +1 -1
- package/commands/run.js +182 -36
- package/commands/run.js.map +1 -1
- package/commands/update.d.ts +19 -0
- package/commands/update.d.ts.map +1 -1
- package/commands/update.js +124 -7
- package/commands/update.js.map +1 -1
- package/commands/workspace.d.ts.map +1 -1
- package/commands/workspace.js +13 -1
- package/commands/workspace.js.map +1 -1
- package/index.js +4983 -1505
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/utils/agent-invoker.d.ts +264 -31
- package/utils/agent-invoker.d.ts.map +1 -1
- package/utils/agent-invoker.js +1013 -372
- package/utils/agent-invoker.js.map +1 -1
- package/utils/brew.d.ts +10 -0
- package/utils/brew.d.ts.map +1 -1
- package/utils/brew.js +14 -0
- package/utils/brew.js.map +1 -1
- package/utils/cli-version.d.ts +3 -0
- package/utils/cli-version.d.ts.map +1 -0
- package/utils/cli-version.js +18 -0
- package/utils/cli-version.js.map +1 -0
- package/utils/cloud-preflight.d.ts +68 -0
- package/utils/cloud-preflight.d.ts.map +1 -0
- package/utils/cloud-preflight.js +287 -0
- package/utils/cloud-preflight.js.map +1 -0
- package/utils/config-store.d.ts +29 -0
- package/utils/config-store.d.ts.map +1 -1
- package/utils/config-store.js +30 -0
- package/utils/config-store.js.map +1 -1
- package/utils/install-cache.d.ts +105 -0
- package/utils/install-cache.d.ts.map +1 -0
- package/utils/install-cache.js +184 -0
- package/utils/install-cache.js.map +1 -0
- package/utils/mailbox-client.d.ts +130 -3
- package/utils/mailbox-client.d.ts.map +1 -1
- package/utils/mailbox-client.js +140 -6
- package/utils/mailbox-client.js.map +1 -1
- package/utils/merge-guard.d.ts +66 -0
- package/utils/merge-guard.d.ts.map +1 -0
- package/utils/merge-guard.js +271 -0
- package/utils/merge-guard.js.map +1 -0
- package/utils/merge-policy.d.ts +68 -0
- package/utils/merge-policy.d.ts.map +1 -0
- package/utils/merge-policy.js +129 -0
- package/utils/merge-policy.js.map +1 -0
- package/utils/progress-watcher.d.ts +53 -0
- package/utils/progress-watcher.d.ts.map +1 -0
- package/utils/progress-watcher.js +109 -0
- package/utils/progress-watcher.js.map +1 -0
- package/utils/project-checks.d.ts +72 -0
- package/utils/project-checks.d.ts.map +1 -0
- package/utils/project-checks.js +276 -0
- package/utils/project-checks.js.map +1 -0
- package/utils/run-timings.d.ts +59 -0
- package/utils/run-timings.d.ts.map +1 -0
- package/utils/run-timings.js +130 -0
- package/utils/run-timings.js.map +1 -0
- package/utils/run-workspace.d.ts +200 -2
- package/utils/run-workspace.d.ts.map +1 -1
- package/utils/run-workspace.js +898 -136
- package/utils/run-workspace.js.map +1 -1
- package/utils/self-update.d.ts +104 -0
- package/utils/self-update.d.ts.map +1 -0
- package/utils/self-update.js +391 -0
- package/utils/self-update.js.map +1 -0
- package/utils/usage-limit.d.ts +30 -0
- package/utils/usage-limit.d.ts.map +1 -0
- package/utils/usage-limit.js +186 -0
- package/utils/usage-limit.js.map +1 -0
- package/utils/wrap-up.d.ts +109 -0
- package/utils/wrap-up.d.ts.map +1 -0
- package/utils/wrap-up.js +260 -0
- package/utils/wrap-up.js.map +1 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progress-based build timeout (ENG-331).
|
|
3
|
+
*
|
|
4
|
+
* A long build is only stopped when it has stopped making progress (a stall)
|
|
5
|
+
* or when it hits a high absolute ceiling, instead of after a fixed wall-clock
|
|
6
|
+
* budget. Progress is any change in a probe: the run branch's HEAD (a new
|
|
7
|
+
* commit), the epic's completed-feature count, or the agent's stdout byte count.
|
|
8
|
+
*
|
|
9
|
+
* The probes and clock are injected so the watcher is unit-testable with fake
|
|
10
|
+
* timers and never touches git, the network or a real process.
|
|
11
|
+
*/
|
|
12
|
+
/** Why a build run stopped. `completed` means the agent exited on its own. */
|
|
13
|
+
export type BuildStopReason = 'completed' | 'stalled' | 'ceiling';
|
|
14
|
+
/** A probe value; `undefined`/`null` is a valid (comparable) value. */
|
|
15
|
+
type ProbeValue = string | number | null | undefined;
|
|
16
|
+
/** A probe may be sync or async. One that throws counts as "no change". */
|
|
17
|
+
export type Probe = () => ProbeValue | Promise<ProbeValue>;
|
|
18
|
+
export interface ProgressWatcherOptions {
|
|
19
|
+
/** Current commit of the run's branch (e.g. `git rev-parse HEAD` in the worktree). */
|
|
20
|
+
getHead?: Probe;
|
|
21
|
+
/** The epic's completed-feature count. */
|
|
22
|
+
getCompletedCount?: Probe;
|
|
23
|
+
/** Bytes the agent has written to stdout so far. */
|
|
24
|
+
getStdoutBytes?: Probe;
|
|
25
|
+
/** Stop as `stalled` after this long with no probe change. */
|
|
26
|
+
stallMs: number;
|
|
27
|
+
/** Stop as `ceiling` after this long in total, progress or not. */
|
|
28
|
+
maxMs: number;
|
|
29
|
+
/** How often the probes are checked (default 60s). */
|
|
30
|
+
tickMs?: number;
|
|
31
|
+
/** Clock (default `Date.now`). */
|
|
32
|
+
now?: () => number;
|
|
33
|
+
/** Called at most once, when the watcher decides the run must stop. */
|
|
34
|
+
onStop: (reason: Exclude<BuildStopReason, 'completed'>) => void;
|
|
35
|
+
}
|
|
36
|
+
export interface ProgressWatcher {
|
|
37
|
+
/** Stop watching (idempotent). Call when the child exits. */
|
|
38
|
+
stop: () => void;
|
|
39
|
+
/** Whether any probe changed since the watcher started. */
|
|
40
|
+
readonly madeProgress: boolean;
|
|
41
|
+
/** When progress was last seen (or the start time). */
|
|
42
|
+
readonly lastProgressAt: number;
|
|
43
|
+
}
|
|
44
|
+
/** Default cadence for checking progress probes. */
|
|
45
|
+
export declare const PROGRESS_WATCHER_TICK_MS = 60000;
|
|
46
|
+
/**
|
|
47
|
+
* Start watching a build for progress. The first successful reading of each
|
|
48
|
+
* probe is its baseline (not progress); every later change resets the stall
|
|
49
|
+
* clock and marks the run as having made progress.
|
|
50
|
+
*/
|
|
51
|
+
export declare function startProgressWatcher(options: ProgressWatcherOptions): ProgressWatcher;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=progress-watcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-watcher.d.ts","sourceRoot":"","sources":["../../src/utils/progress-watcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,8EAA8E;AAC9E,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;AAElE,uEAAuE;AACvE,KAAK,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAErD,2EAA2E;AAC3E,MAAM,MAAM,KAAK,GAAG,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3D,MAAM,WAAW,sBAAsB;IACrC,sFAAsF;IACtF,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,0CAA0C;IAC1C,iBAAiB,CAAC,EAAE,KAAK,CAAC;IAC1B,oDAAoD;IACpD,cAAc,CAAC,EAAE,KAAK,CAAC;IACvB,8DAA8D;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,uEAAuE;IACvE,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,EAAE,WAAW,CAAC,KAAK,IAAI,CAAC;CACjE;AAED,MAAM,WAAW,eAAe;IAC9B,6DAA6D;IAC7D,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,2DAA2D;IAC3D,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,uDAAuD;IACvD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED,oDAAoD;AACpD,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAW/C;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,sBAAsB,GAAG,eAAe,CA8ErF"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progress-based build timeout (ENG-331).
|
|
3
|
+
*
|
|
4
|
+
* A long build is only stopped when it has stopped making progress (a stall)
|
|
5
|
+
* or when it hits a high absolute ceiling, instead of after a fixed wall-clock
|
|
6
|
+
* budget. Progress is any change in a probe: the run branch's HEAD (a new
|
|
7
|
+
* commit), the epic's completed-feature count, or the agent's stdout byte count.
|
|
8
|
+
*
|
|
9
|
+
* The probes and clock are injected so the watcher is unit-testable with fake
|
|
10
|
+
* timers and never touches git, the network or a real process.
|
|
11
|
+
*/
|
|
12
|
+
/** Default cadence for checking progress probes. */
|
|
13
|
+
export const PROGRESS_WATCHER_TICK_MS = 60_000;
|
|
14
|
+
async function readProbe(probe) {
|
|
15
|
+
if (!probe)
|
|
16
|
+
return { ok: false, value: undefined };
|
|
17
|
+
try {
|
|
18
|
+
return { ok: true, value: await probe() };
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return { ok: false, value: undefined };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Start watching a build for progress. The first successful reading of each
|
|
26
|
+
* probe is its baseline (not progress); every later change resets the stall
|
|
27
|
+
* clock and marks the run as having made progress.
|
|
28
|
+
*/
|
|
29
|
+
export function startProgressWatcher(options) {
|
|
30
|
+
const now = options.now ?? Date.now;
|
|
31
|
+
const tickMs = options.tickMs ?? PROGRESS_WATCHER_TICK_MS;
|
|
32
|
+
const probes = [options.getHead, options.getCompletedCount, options.getStdoutBytes];
|
|
33
|
+
const startedAt = now();
|
|
34
|
+
const baselines = probes.map(() => ({ set: false, value: undefined }));
|
|
35
|
+
let lastProgressAt = startedAt;
|
|
36
|
+
let madeProgress = false;
|
|
37
|
+
let stopped = false;
|
|
38
|
+
let ticking = false;
|
|
39
|
+
const fire = (reason) => {
|
|
40
|
+
if (stopped)
|
|
41
|
+
return;
|
|
42
|
+
stop();
|
|
43
|
+
options.onStop(reason);
|
|
44
|
+
};
|
|
45
|
+
const check = () => {
|
|
46
|
+
const t = now();
|
|
47
|
+
if (t - startedAt >= options.maxMs) {
|
|
48
|
+
fire('ceiling');
|
|
49
|
+
}
|
|
50
|
+
else if (t - lastProgressAt >= options.stallMs) {
|
|
51
|
+
fire('stalled');
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const tick = async () => {
|
|
55
|
+
if (stopped || ticking)
|
|
56
|
+
return;
|
|
57
|
+
ticking = true;
|
|
58
|
+
try {
|
|
59
|
+
const readings = await Promise.all(probes.map((p) => readProbe(p)));
|
|
60
|
+
// stop() may have run while the probes were awaited.
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
62
|
+
if (stopped)
|
|
63
|
+
return;
|
|
64
|
+
readings.forEach((reading, i) => {
|
|
65
|
+
if (!reading.ok)
|
|
66
|
+
return; // a failed probe counts as unchanged
|
|
67
|
+
const base = baselines[i];
|
|
68
|
+
if (!base)
|
|
69
|
+
return;
|
|
70
|
+
if (!base.set) {
|
|
71
|
+
base.set = true;
|
|
72
|
+
base.value = reading.value;
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (reading.value !== base.value) {
|
|
76
|
+
base.value = reading.value;
|
|
77
|
+
madeProgress = true;
|
|
78
|
+
lastProgressAt = now();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
check();
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
ticking = false;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const timer = setInterval(() => {
|
|
88
|
+
void tick();
|
|
89
|
+
}, tickMs);
|
|
90
|
+
timer.unref();
|
|
91
|
+
// Take baselines right away so the first tick can already see a change.
|
|
92
|
+
void tick();
|
|
93
|
+
function stop() {
|
|
94
|
+
if (stopped)
|
|
95
|
+
return;
|
|
96
|
+
stopped = true;
|
|
97
|
+
clearInterval(timer);
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
stop,
|
|
101
|
+
get madeProgress() {
|
|
102
|
+
return madeProgress;
|
|
103
|
+
},
|
|
104
|
+
get lastProgressAt() {
|
|
105
|
+
return lastProgressAt;
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=progress-watcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-watcher.js","sourceRoot":"","sources":["../../src/utils/progress-watcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAuCH,oDAAoD;AACpD,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAE/C,KAAK,UAAU,SAAS,CAAC,KAAwB;IAC/C,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IACnD,IAAI,CAAC;QACH,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,EAAE,EAAE,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IACzC,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAA+B;IAClE,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC;IACpC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,wBAAwB,CAAC;IAC1D,MAAM,MAAM,GAAG,CAAC,OAA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-0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project checks for a build's wrap-up (ENG-327).
|
|
3
|
+
*
|
|
4
|
+
* Before a build's pull request can be marked ready, the runner runs the
|
|
5
|
+
* project's own checks in the run worktree. By default those are the
|
|
6
|
+
* `typecheck`, `lint` and `test` scripts each package defines (the root
|
|
7
|
+
* package, or every workspace package of a monorepo). A project can replace
|
|
8
|
+
* the defaults with a `.compbox/checks.json` file:
|
|
9
|
+
*
|
|
10
|
+
* { "checks": [{ "name": "api tests", "command": "pnpm --filter api test", "cwd": "packages/api", "timeoutSeconds": 900 }] }
|
|
11
|
+
*
|
|
12
|
+
* Every check runs with a timeout and records pass/fail, how long it took and
|
|
13
|
+
* the tail of its output, so a failure can be explained without the full log.
|
|
14
|
+
*/
|
|
15
|
+
/** The scripts run by default, in this order, when a package defines them. */
|
|
16
|
+
export declare const DEFAULT_CHECK_SCRIPTS: readonly ["typecheck", "lint", "test"];
|
|
17
|
+
/** Where a project overrides the default checks, relative to the project root. */
|
|
18
|
+
export declare const CHECKS_CONFIG_FILE: string;
|
|
19
|
+
/** Default per-check timeout. */
|
|
20
|
+
export declare const DEFAULT_CHECK_TIMEOUT_MS: number;
|
|
21
|
+
/** How much output is kept from each check. */
|
|
22
|
+
export declare const OUTPUT_TAIL_LINES = 40;
|
|
23
|
+
export interface ProjectCheck {
|
|
24
|
+
/** Display name, e.g. "packages/api: test". */
|
|
25
|
+
name: string;
|
|
26
|
+
/** Directory the check runs in, relative to the project root ("." for the root). */
|
|
27
|
+
cwd: string;
|
|
28
|
+
command: string;
|
|
29
|
+
args: string[];
|
|
30
|
+
timeoutMs: number;
|
|
31
|
+
}
|
|
32
|
+
export interface CheckResult {
|
|
33
|
+
name: string;
|
|
34
|
+
cwd: string;
|
|
35
|
+
passed: boolean;
|
|
36
|
+
timedOut: boolean;
|
|
37
|
+
durationMs: number;
|
|
38
|
+
/** The last lines of combined stdout/stderr. */
|
|
39
|
+
outputTail: string;
|
|
40
|
+
}
|
|
41
|
+
export interface CheckRunOutput {
|
|
42
|
+
exitCode: number;
|
|
43
|
+
output: string;
|
|
44
|
+
timedOut: boolean;
|
|
45
|
+
}
|
|
46
|
+
/** Runs one check command. Injectable in tests. */
|
|
47
|
+
export type CheckRunner = (command: string, args: string[], cwd: string, timeoutMs: number) => Promise<CheckRunOutput>;
|
|
48
|
+
export interface ResolveChecksResult {
|
|
49
|
+
checks: ProjectCheck[];
|
|
50
|
+
/** "config" when `.compbox/checks.json` decided the checks. */
|
|
51
|
+
source: "config" | "defaults";
|
|
52
|
+
/** Problems with the config file; the defaults are used instead. */
|
|
53
|
+
warnings: string[];
|
|
54
|
+
}
|
|
55
|
+
/** The package manager the project uses, from its lockfile. */
|
|
56
|
+
export declare function packageManagerFor(rootDir: string): "pnpm" | "yarn" | "npm";
|
|
57
|
+
/** Splits a command line into words, honouring simple quotes. */
|
|
58
|
+
export declare function splitCommand(command: string): string[];
|
|
59
|
+
/**
|
|
60
|
+
* The checks to run for the project at `rootDir`: the config file's when it
|
|
61
|
+
* is present and valid, otherwise each package's typecheck/lint/test scripts.
|
|
62
|
+
*/
|
|
63
|
+
export declare function resolveProjectChecks(rootDir: string): ResolveChecksResult;
|
|
64
|
+
/** The last lines of a check's output, bounded in size. */
|
|
65
|
+
export declare function outputTail(output: string, lines?: number): string;
|
|
66
|
+
export declare const defaultCheckRunner: CheckRunner;
|
|
67
|
+
/** Runs every check in order (all of them, even after a failure) and records each result. */
|
|
68
|
+
export declare function runProjectChecks(rootDir: string, checks: ProjectCheck[], deps?: {
|
|
69
|
+
runner?: CheckRunner;
|
|
70
|
+
now?: () => number;
|
|
71
|
+
}): Promise<CheckResult[]>;
|
|
72
|
+
//# sourceMappingURL=project-checks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-checks.d.ts","sourceRoot":"","sources":["../../src/utils/project-checks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,8EAA8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1E;AAyDD,iEAAiE;AACjE,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAMtD;AAuCD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,CAiDzE;AAED,2DAA2D;AAC3D,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,SAAoB,GAAG,MAAM,CAG5E;AAED,eAAO,MAAM,kBAAkB,EAAE,WA6C7B,CAAC;AAEL,6FAA6F;AAC7F,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,YAAY,EAAE,EACtB,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CAAO,GACtD,OAAO,CAAC,WAAW,EAAE,CAAC,CAqBxB"}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project checks for a build's wrap-up (ENG-327).
|
|
3
|
+
*
|
|
4
|
+
* Before a build's pull request can be marked ready, the runner runs the
|
|
5
|
+
* project's own checks in the run worktree. By default those are the
|
|
6
|
+
* `typecheck`, `lint` and `test` scripts each package defines (the root
|
|
7
|
+
* package, or every workspace package of a monorepo). A project can replace
|
|
8
|
+
* the defaults with a `.compbox/checks.json` file:
|
|
9
|
+
*
|
|
10
|
+
* { "checks": [{ "name": "api tests", "command": "pnpm --filter api test", "cwd": "packages/api", "timeoutSeconds": 900 }] }
|
|
11
|
+
*
|
|
12
|
+
* Every check runs with a timeout and records pass/fail, how long it took and
|
|
13
|
+
* the tail of its output, so a failure can be explained without the full log.
|
|
14
|
+
*/
|
|
15
|
+
import { spawn } from "node:child_process";
|
|
16
|
+
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
17
|
+
import { join, relative } from "node:path";
|
|
18
|
+
import { claudeChildEnvPath } from "./claude-runtime.js";
|
|
19
|
+
/** The scripts run by default, in this order, when a package defines them. */
|
|
20
|
+
export const DEFAULT_CHECK_SCRIPTS = ["typecheck", "lint", "test"];
|
|
21
|
+
/** Where a project overrides the default checks, relative to the project root. */
|
|
22
|
+
export const CHECKS_CONFIG_FILE = join(".compbox", "checks.json");
|
|
23
|
+
/** Default per-check timeout. */
|
|
24
|
+
export const DEFAULT_CHECK_TIMEOUT_MS = 15 * 60 * 1_000;
|
|
25
|
+
/** How much output is kept from each check. */
|
|
26
|
+
export const OUTPUT_TAIL_LINES = 40;
|
|
27
|
+
const OUTPUT_TAIL_CHARS = 4_000;
|
|
28
|
+
function readJson(path) {
|
|
29
|
+
return JSON.parse(readFileSync(path, "utf-8"));
|
|
30
|
+
}
|
|
31
|
+
function isRecord(value) {
|
|
32
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
33
|
+
}
|
|
34
|
+
/** The package manager the project uses, from its lockfile. */
|
|
35
|
+
export function packageManagerFor(rootDir) {
|
|
36
|
+
if (existsSync(join(rootDir, "pnpm-lock.yaml")))
|
|
37
|
+
return "pnpm";
|
|
38
|
+
if (existsSync(join(rootDir, "yarn.lock")))
|
|
39
|
+
return "yarn";
|
|
40
|
+
return "npm";
|
|
41
|
+
}
|
|
42
|
+
/** Workspace package patterns from package.json `workspaces` or pnpm-workspace.yaml. */
|
|
43
|
+
function workspacePatterns(rootDir, rootPkg) {
|
|
44
|
+
const patterns = [];
|
|
45
|
+
const ws = rootPkg?.workspaces;
|
|
46
|
+
if (Array.isArray(ws))
|
|
47
|
+
patterns.push(...ws.filter((p) => typeof p === "string"));
|
|
48
|
+
else if (isRecord(ws) && Array.isArray(ws.packages)) {
|
|
49
|
+
patterns.push(...ws.packages.filter((p) => typeof p === "string"));
|
|
50
|
+
}
|
|
51
|
+
const pnpmFile = join(rootDir, "pnpm-workspace.yaml");
|
|
52
|
+
if (existsSync(pnpmFile)) {
|
|
53
|
+
// Only the `packages:` list matters; a minimal reader avoids a YAML dependency.
|
|
54
|
+
let inPackages = false;
|
|
55
|
+
for (const raw of readFileSync(pnpmFile, "utf-8").split("\n")) {
|
|
56
|
+
const line = raw.replace(/#.*$/, "").trimEnd();
|
|
57
|
+
if (/^packages\s*:/.test(line)) {
|
|
58
|
+
inPackages = true;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (inPackages) {
|
|
62
|
+
const item = /^\s+-\s*['"]?([^'"]+)['"]?\s*$/.exec(line);
|
|
63
|
+
if (item?.[1])
|
|
64
|
+
patterns.push(item[1]);
|
|
65
|
+
else if (/^\S/.test(line))
|
|
66
|
+
inPackages = false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return patterns;
|
|
71
|
+
}
|
|
72
|
+
/** Package directories matching simple workspace patterns ("packages/*", "apps/web"). */
|
|
73
|
+
function expandPatterns(rootDir, patterns) {
|
|
74
|
+
const dirs = new Set();
|
|
75
|
+
for (const pattern of patterns) {
|
|
76
|
+
if (pattern.startsWith("!"))
|
|
77
|
+
continue;
|
|
78
|
+
const clean = pattern.replace(/\/+$/, "");
|
|
79
|
+
if (clean.endsWith("/*") || clean.endsWith("/**")) {
|
|
80
|
+
const parent = join(rootDir, clean.replace(/\/\*\*?$/, ""));
|
|
81
|
+
if (!existsSync(parent))
|
|
82
|
+
continue;
|
|
83
|
+
for (const entry of readdirSync(parent).sort()) {
|
|
84
|
+
const dir = join(parent, entry);
|
|
85
|
+
if (entry !== "node_modules" &&
|
|
86
|
+
statSync(dir).isDirectory() &&
|
|
87
|
+
existsSync(join(dir, "package.json"))) {
|
|
88
|
+
dirs.add(dir);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else if (!clean.includes("*")) {
|
|
93
|
+
const dir = join(rootDir, clean);
|
|
94
|
+
if (existsSync(join(dir, "package.json")))
|
|
95
|
+
dirs.add(dir);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return [...dirs];
|
|
99
|
+
}
|
|
100
|
+
/** Splits a command line into words, honouring simple quotes. */
|
|
101
|
+
export function splitCommand(command) {
|
|
102
|
+
const words = [];
|
|
103
|
+
const re = /"([^"]*)"|'([^']*)'|(\S+)/g;
|
|
104
|
+
let match;
|
|
105
|
+
while ((match = re.exec(command)) !== null)
|
|
106
|
+
words.push(match[1] ?? match[2] ?? match[3] ?? "");
|
|
107
|
+
return words;
|
|
108
|
+
}
|
|
109
|
+
function checksFromConfig(config, warnings) {
|
|
110
|
+
if (!isRecord(config) || !Array.isArray(config.checks)) {
|
|
111
|
+
warnings.push(`${CHECKS_CONFIG_FILE} must contain a "checks" list; using the default checks.`);
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
const checks = [];
|
|
115
|
+
for (const [index, item] of config.checks.entries()) {
|
|
116
|
+
const words = isRecord(item) && typeof item.command === "string" ? splitCommand(item.command) : [];
|
|
117
|
+
const [command, ...args] = words;
|
|
118
|
+
if (!isRecord(item) || !command) {
|
|
119
|
+
warnings.push(`Check ${String(index + 1)} in ${CHECKS_CONFIG_FILE} has no command; skipped.`);
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
const cwd = typeof item.cwd === "string" && item.cwd.trim() ? item.cwd.trim() : ".";
|
|
123
|
+
if (cwd.split(/[\\/]/).includes("..")) {
|
|
124
|
+
warnings.push(`Check ${String(index + 1)} in ${CHECKS_CONFIG_FILE} runs outside the project; skipped.`);
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
const seconds = typeof item.timeoutSeconds === "number" && item.timeoutSeconds > 0
|
|
128
|
+
? item.timeoutSeconds
|
|
129
|
+
: null;
|
|
130
|
+
checks.push({
|
|
131
|
+
name: typeof item.name === "string" && item.name.trim() ? item.name.trim() : String(item.command),
|
|
132
|
+
cwd,
|
|
133
|
+
command,
|
|
134
|
+
args,
|
|
135
|
+
timeoutMs: seconds ? seconds * 1_000 : DEFAULT_CHECK_TIMEOUT_MS,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return checks;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The checks to run for the project at `rootDir`: the config file's when it
|
|
142
|
+
* is present and valid, otherwise each package's typecheck/lint/test scripts.
|
|
143
|
+
*/
|
|
144
|
+
export function resolveProjectChecks(rootDir) {
|
|
145
|
+
const warnings = [];
|
|
146
|
+
const configPath = join(rootDir, CHECKS_CONFIG_FILE);
|
|
147
|
+
if (existsSync(configPath)) {
|
|
148
|
+
let config;
|
|
149
|
+
try {
|
|
150
|
+
config = readJson(configPath);
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
warnings.push(`${CHECKS_CONFIG_FILE} isn't valid JSON; using the default checks.`);
|
|
154
|
+
}
|
|
155
|
+
const checks = config === undefined ? null : checksFromConfig(config, warnings);
|
|
156
|
+
if (checks)
|
|
157
|
+
return { checks, source: "config", warnings };
|
|
158
|
+
}
|
|
159
|
+
let rootPkg = null;
|
|
160
|
+
try {
|
|
161
|
+
const value = existsSync(join(rootDir, "package.json"))
|
|
162
|
+
? readJson(join(rootDir, "package.json"))
|
|
163
|
+
: null;
|
|
164
|
+
rootPkg = isRecord(value) ? value : null;
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
rootPkg = null;
|
|
168
|
+
}
|
|
169
|
+
const packageDirs = expandPatterns(rootDir, workspacePatterns(rootDir, rootPkg));
|
|
170
|
+
// A monorepo's root scripts usually fan out to the packages; run each package once instead.
|
|
171
|
+
const dirs = packageDirs.length > 0 ? packageDirs : rootPkg ? [rootDir] : [];
|
|
172
|
+
const pm = packageManagerFor(rootDir);
|
|
173
|
+
const checks = [];
|
|
174
|
+
for (const dir of dirs) {
|
|
175
|
+
let pkg;
|
|
176
|
+
try {
|
|
177
|
+
pkg = readJson(join(dir, "package.json"));
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
const scripts = isRecord(pkg) && isRecord(pkg.scripts) ? pkg.scripts : {};
|
|
183
|
+
const rel = relative(rootDir, dir) || ".";
|
|
184
|
+
for (const script of DEFAULT_CHECK_SCRIPTS) {
|
|
185
|
+
if (typeof scripts[script] !== "string")
|
|
186
|
+
continue;
|
|
187
|
+
checks.push({
|
|
188
|
+
name: rel === "." ? script : `${rel}: ${script}`,
|
|
189
|
+
cwd: rel,
|
|
190
|
+
command: pm,
|
|
191
|
+
args: ["run", script],
|
|
192
|
+
timeoutMs: DEFAULT_CHECK_TIMEOUT_MS,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return { checks, source: "defaults", warnings };
|
|
197
|
+
}
|
|
198
|
+
/** The last lines of a check's output, bounded in size. */
|
|
199
|
+
export function outputTail(output, lines = OUTPUT_TAIL_LINES) {
|
|
200
|
+
const tail = output.trimEnd().split("\n").slice(-lines).join("\n");
|
|
201
|
+
return tail.length > OUTPUT_TAIL_CHARS ? tail.slice(-OUTPUT_TAIL_CHARS) : tail;
|
|
202
|
+
}
|
|
203
|
+
export const defaultCheckRunner = (command, args, cwd, timeoutMs) => new Promise((resolve) => {
|
|
204
|
+
let output = "";
|
|
205
|
+
let settled = false;
|
|
206
|
+
const done = (result) => {
|
|
207
|
+
if (settled)
|
|
208
|
+
return;
|
|
209
|
+
settled = true;
|
|
210
|
+
clearTimeout(timer);
|
|
211
|
+
resolve(result);
|
|
212
|
+
};
|
|
213
|
+
const child = spawn(command, args, {
|
|
214
|
+
cwd,
|
|
215
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
216
|
+
// CI=1 keeps test runners out of watch mode and interactive prompts.
|
|
217
|
+
env: {
|
|
218
|
+
...process.env,
|
|
219
|
+
PATH: claudeChildEnvPath(process.env.PATH),
|
|
220
|
+
CI: "1",
|
|
221
|
+
GIT_TERMINAL_PROMPT: "0",
|
|
222
|
+
},
|
|
223
|
+
detached: process.platform !== "win32",
|
|
224
|
+
});
|
|
225
|
+
const append = (chunk) => {
|
|
226
|
+
output += chunk.toString("utf-8");
|
|
227
|
+
// Keep memory bounded on chatty checks; only the tail is reported.
|
|
228
|
+
if (output.length > 200_000)
|
|
229
|
+
output = output.slice(-100_000);
|
|
230
|
+
};
|
|
231
|
+
const timer = setTimeout(() => {
|
|
232
|
+
try {
|
|
233
|
+
// Kill the whole process group so the script's children stop too.
|
|
234
|
+
if (child.pid && process.platform !== "win32")
|
|
235
|
+
process.kill(-child.pid, "SIGKILL");
|
|
236
|
+
else
|
|
237
|
+
child.kill("SIGKILL");
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
child.kill("SIGKILL");
|
|
241
|
+
}
|
|
242
|
+
done({ exitCode: 1, output, timedOut: true });
|
|
243
|
+
}, timeoutMs);
|
|
244
|
+
child.stdout.on("data", append);
|
|
245
|
+
child.stderr.on("data", append);
|
|
246
|
+
child.on("error", (error) => {
|
|
247
|
+
done({ exitCode: 1, output: `${output}\n${error.message}`, timedOut: false });
|
|
248
|
+
});
|
|
249
|
+
child.on("close", (code) => {
|
|
250
|
+
done({ exitCode: code ?? 1, output, timedOut: false });
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
/** Runs every check in order (all of them, even after a failure) and records each result. */
|
|
254
|
+
export async function runProjectChecks(rootDir, checks, deps = {}) {
|
|
255
|
+
const runner = deps.runner ?? defaultCheckRunner;
|
|
256
|
+
const now = deps.now ?? Date.now;
|
|
257
|
+
const results = [];
|
|
258
|
+
for (const check of checks) {
|
|
259
|
+
const started = now();
|
|
260
|
+
const run = await runner(check.command, check.args, join(rootDir, check.cwd), check.timeoutMs);
|
|
261
|
+
const durationMs = Math.max(0, now() - started);
|
|
262
|
+
const tail = outputTail(run.output);
|
|
263
|
+
results.push({
|
|
264
|
+
name: check.name,
|
|
265
|
+
cwd: check.cwd,
|
|
266
|
+
passed: run.exitCode === 0 && !run.timedOut,
|
|
267
|
+
timedOut: run.timedOut,
|
|
268
|
+
durationMs,
|
|
269
|
+
outputTail: run.timedOut
|
|
270
|
+
? `${tail}\nTimed out after ${String(Math.round(check.timeoutMs / 1_000))}s.`.trim()
|
|
271
|
+
: tail,
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
return results;
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=project-checks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-checks.js","sourceRoot":"","sources":["../../src/utils/project-checks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAE5E,kFAAkF;AAClF,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAElE,iCAAiC;AACjC,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;AAExD,+CAA+C;AAC/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AACpC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AA4ChC,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAY,CAAC;AAC5D,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,+DAA+D;AAC/D,MA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,UAAU,EAAE,GAAG,CAAC,QAAQ;gBACtB,CAAC,CAAC,GAAG,IAAI,qBAAqB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE;gBACpF,CAAC,CAAC,IAAI;SACT,CAAC,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ENG-352: where a build's time went — install, model, tools, CI waits — for
|
|
3
|
+
* the run page's time breakdown. Pure helpers; agent-invoker feeds them.
|
|
4
|
+
*/
|
|
5
|
+
import type { JobTimings } from "@mycompbox/shared";
|
|
6
|
+
/** The model/agent durations one Claude run reported in its JSON result. */
|
|
7
|
+
export interface ClaudeRunDurations {
|
|
8
|
+
/** Time spent in model API calls. */
|
|
9
|
+
apiMs: number;
|
|
10
|
+
/** The run's own wall-clock time (model + tools). */
|
|
11
|
+
totalMs: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Reads `duration_api_ms` / `duration_ms` from a Claude run's JSON output
|
|
15
|
+
* (`--output-format json`, or the last `result` line of stream-json). Plain
|
|
16
|
+
* text output has no durations → null (the caller records "not measured").
|
|
17
|
+
*/
|
|
18
|
+
export declare function parseClaudeDurations(stdout: string): ClaudeRunDurations | null;
|
|
19
|
+
/**
|
|
20
|
+
* Sums model and tool time across every Claude run of a job (the first run and
|
|
21
|
+
* each continue/resume). If any run reported no durations, both are null —
|
|
22
|
+
* a partial sum would understate the real time.
|
|
23
|
+
*/
|
|
24
|
+
export declare function aggregateRunDurations(runs: (ClaudeRunDurations | null)[]): {
|
|
25
|
+
modelMs: number | null;
|
|
26
|
+
toolMs: number | null;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Tracks `[compbox:ci-wait start]` / `[compbox:ci-wait end] ... elapsed=Ns`
|
|
30
|
+
* markers in a run's output (printed by the compbox-pullrequest skill's CI
|
|
31
|
+
* wait helper). Durations come from, in order: the end marker's `elapsed=`,
|
|
32
|
+
* the markers' `ts=<epoch seconds>`, or the time each line arrived.
|
|
33
|
+
*/
|
|
34
|
+
export declare class CiWaitTracker {
|
|
35
|
+
private partial;
|
|
36
|
+
private openAtMs;
|
|
37
|
+
private totalMs;
|
|
38
|
+
private waits;
|
|
39
|
+
/** Feeds a stdout chunk that arrived at `nowMs` (epoch ms). */
|
|
40
|
+
feed(chunk: string, nowMs: number): void;
|
|
41
|
+
/** Processes a trailing line without a newline (call once the run ends). */
|
|
42
|
+
flush(nowMs: number): void;
|
|
43
|
+
private line;
|
|
44
|
+
/** Total CI wait so far, or null when no wait was seen. */
|
|
45
|
+
get ms(): number | null;
|
|
46
|
+
}
|
|
47
|
+
/** Builds the job result's `timings` block (ENG-352). */
|
|
48
|
+
export declare function buildJobTimings(input: {
|
|
49
|
+
install?: {
|
|
50
|
+
ms: number;
|
|
51
|
+
cacheHit: boolean;
|
|
52
|
+
} | undefined;
|
|
53
|
+
runs: (ClaudeRunDurations | null)[];
|
|
54
|
+
ciWaitMs: number | null;
|
|
55
|
+
startedAtMs: number;
|
|
56
|
+
endedAtMs: number;
|
|
57
|
+
fastMode: JobTimings["fastMode"];
|
|
58
|
+
}): JobTimings;
|
|
59
|
+
//# sourceMappingURL=run-timings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-timings.d.ts","sourceRoot":"","sources":["../../src/utils/run-timings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,4EAA4E;AAC5E,MAAM,WAAW,kBAAkB;IACjC,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;CACjB;AAYD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,k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