@mmerterden/multi-agent-pipeline 24.2.0 → 24.3.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/CHANGELOG.md +24 -0
- package/docs/facts.json +1 -1
- package/install/_common.mjs +65 -0
- package/install/_plugin-skills.mjs +76 -18
- package/install/claude.mjs +7 -0
- package/install/codex.mjs +15 -1
- package/install/copilot.mjs +7 -0
- package/manifest.json +26 -26
- package/package.json +1 -1
- package/pipeline/contract/CHANGELOG.md +10 -0
- package/pipeline/contract/fixtures/error-invalid-request.json +1 -1
- package/pipeline/contract/fixtures/error-unauthorized.json +1 -1
- package/pipeline/contract/manifest.json +4 -3
- package/pipeline/contract/types/index.d.ts +7 -5
- package/pipeline/schemas/disk-clean-request.schema.json +8 -2
- package/pipeline/schemas/disk-clean.schema.json +3 -2
- package/pipeline/schemas/hosts.json +7 -0
- package/pipeline/schemas/hosts.schema.json +17 -0
- package/pipeline/scripts/_contract-core.mjs +1 -1
- package/pipeline/scripts/disk-cleaner.mjs +232 -5
- package/pipeline/skills/.skill-manifest.json +2 -2
- package/pipeline/skills/shared/README.md +1 -1
- package/pipeline/skills/shared/external/disk-cleaner/SKILL.md +2 -1
- package/pipeline/skills/shared/external/disk-cleaner/scripts/disk-cleaner.mjs +232 -5
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://github.com/multi-agent-ecosystem/multi-agent-pipeline/pipeline/schemas/disk-clean-request.schema.json",
|
|
4
4
|
"title": "Disk clean request",
|
|
5
|
-
"description": "The body of POST /v1/disk-clean. With no other field it measures (the disk cleaner's dry run, no token). With categories it previews exactly those, each one from the cleaner's allow-list, and returns a confirm token;
|
|
5
|
+
"description": "The body of POST /v1/disk-clean. With no other field it measures (the disk cleaner's dry run, no token). With categories it previews exactly those, each one from the cleaner's allow-list, and returns a confirm token; an opt-in category must also send its own flag as true. Step 2 sends only the confirmToken.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"additionalProperties": false,
|
|
8
8
|
"required": ["contractVersion"],
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
"pipeline-logs",
|
|
43
43
|
"ds-store",
|
|
44
44
|
"trash",
|
|
45
|
-
"transcripts"
|
|
45
|
+
"transcripts",
|
|
46
|
+
"test-artifacts"
|
|
46
47
|
]
|
|
47
48
|
},
|
|
48
49
|
"x-sensitivity": "none",
|
|
@@ -58,6 +59,11 @@
|
|
|
58
59
|
"x-sensitivity": "none",
|
|
59
60
|
"description": "Required with the transcripts category: resume and past-session search read them."
|
|
60
61
|
},
|
|
62
|
+
"test-artifacts": {
|
|
63
|
+
"const": true,
|
|
64
|
+
"x-sensitivity": "none",
|
|
65
|
+
"description": "Required with the test-artifacts category: a recording or a result bundle can be the only evidence of a failure anybody still has."
|
|
66
|
+
},
|
|
61
67
|
"confirmToken": {
|
|
62
68
|
"type": "string",
|
|
63
69
|
"pattern": "^[A-Za-z0-9_-]{16,128}$",
|
|
@@ -107,7 +107,8 @@
|
|
|
107
107
|
"pipeline-logs",
|
|
108
108
|
"ds-store",
|
|
109
109
|
"trash",
|
|
110
|
-
"transcripts"
|
|
110
|
+
"transcripts",
|
|
111
|
+
"test-artifacts"
|
|
111
112
|
]
|
|
112
113
|
},
|
|
113
114
|
"label": {
|
|
@@ -164,7 +165,7 @@
|
|
|
164
165
|
"description": "The cleaner's unattended-safe set."
|
|
165
166
|
},
|
|
166
167
|
"optIn": {
|
|
167
|
-
"enum": ["trash", "transcripts", null],
|
|
168
|
+
"enum": ["trash", "transcripts", "test-artifacts", null],
|
|
168
169
|
"description": "The request flag this category needs as well as its id."
|
|
169
170
|
}
|
|
170
171
|
}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"root": ".claude",
|
|
12
12
|
"seedsPreferences": true,
|
|
13
13
|
"subtrees": ["commands", "multi-agent-refs", "scripts", "lib", "schemas"],
|
|
14
|
+
"knowledgeSkills": "plugin",
|
|
14
15
|
"commandSpecs": "commands/multi-agent",
|
|
15
16
|
"commandSpecPrefix": "",
|
|
16
17
|
"pathRewrites": []
|
|
@@ -91,6 +92,8 @@
|
|
|
91
92
|
"root": ".copilot",
|
|
92
93
|
"seedsPreferences": true,
|
|
93
94
|
"subtrees": ["skills", "multi-agent-refs", "scripts", "lib", "schemas"],
|
|
95
|
+
"knowledgeSkills": "install",
|
|
96
|
+
"knowledgeSkillsRoot": "skills",
|
|
94
97
|
"commandSpecs": "skills",
|
|
95
98
|
"commandSpecPrefix": "multi-agent-",
|
|
96
99
|
"pathRewrites": [
|
|
@@ -220,6 +223,8 @@
|
|
|
220
223
|
"root": ".codex",
|
|
221
224
|
"seedsPreferences": true,
|
|
222
225
|
"subtrees": ["skills", "multi-agent-refs", "scripts", "lib", "schemas"],
|
|
226
|
+
"knowledgeSkills": "install",
|
|
227
|
+
"knowledgeSkillsRoot": "multi-agent-refs/skills",
|
|
223
228
|
"commandSpecs": "multi-agent-refs/commands",
|
|
224
229
|
"commandSpecPrefix": "",
|
|
225
230
|
"pathRewrites": [
|
|
@@ -373,6 +378,8 @@
|
|
|
373
378
|
"root": ".codex-local",
|
|
374
379
|
"seedsPreferences": true,
|
|
375
380
|
"subtrees": ["skills", "multi-agent-refs", "scripts", "lib", "schemas"],
|
|
381
|
+
"knowledgeSkills": "install",
|
|
382
|
+
"knowledgeSkillsRoot": "multi-agent-refs/skills",
|
|
376
383
|
"commandSpecs": "multi-agent-refs/commands",
|
|
377
384
|
"commandSpecPrefix": "",
|
|
378
385
|
"pathRewrites": [
|
|
@@ -65,9 +65,17 @@
|
|
|
65
65
|
"root",
|
|
66
66
|
"seedsPreferences",
|
|
67
67
|
"subtrees",
|
|
68
|
+
"knowledgeSkills",
|
|
68
69
|
"commandSpecs",
|
|
69
70
|
"commandSpecPrefix"
|
|
70
71
|
],
|
|
72
|
+
"allOf": [
|
|
73
|
+
{
|
|
74
|
+
"if": { "properties": { "knowledgeSkills": { "const": "install" } } },
|
|
75
|
+
"then": { "required": ["knowledgeSkillsRoot"] },
|
|
76
|
+
"else": { "not": { "required": ["knowledgeSkillsRoot"] } }
|
|
77
|
+
}
|
|
78
|
+
],
|
|
71
79
|
"properties": {
|
|
72
80
|
"flag": { "type": "string", "pattern": "^--[a-z][a-z0-9-]*$" },
|
|
73
81
|
"root": { "type": "string", "pattern": "^\\.[a-z][a-z0-9-]*$" },
|
|
@@ -81,6 +89,15 @@
|
|
|
81
89
|
"minItems": 1,
|
|
82
90
|
"items": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" }
|
|
83
91
|
},
|
|
92
|
+
"knowledgeSkills": {
|
|
93
|
+
"description": "How this host receives the knowledge skills. \"install\" means the installer writes them into the root and every one of them must land there; \"plugin\" means the host loads them from the marketplace plugin, and the installer writing them too would be a duplicate copy. The parity gate reads this to decide which trees it compares, so a host whose delivery changes states it here rather than having the gate discover it.",
|
|
94
|
+
"enum": ["install", "plugin"]
|
|
95
|
+
},
|
|
96
|
+
"knowledgeSkillsRoot": {
|
|
97
|
+
"description": "Path, relative to the install root, of the tree the knowledge skills land in. Required when knowledgeSkills is \"install\"; the three layouts do not agree on it.",
|
|
98
|
+
"type": "string",
|
|
99
|
+
"minLength": 1
|
|
100
|
+
},
|
|
84
101
|
"commandSpecs": {
|
|
85
102
|
"description": "Path, relative to the install root, of the tree holding one directory per sub-command, each with its own SKILL.md. The three layouts differ: specs are commands on one host, reference files on another, and one skill per sub-command on a third.",
|
|
86
103
|
"type": "string",
|
|
@@ -21,7 +21,7 @@ import { launchRepoAllowed, launchRepos } from "./launch-request.mjs";
|
|
|
21
21
|
import { selectRuns } from "./runs-index.mjs";
|
|
22
22
|
|
|
23
23
|
/** The contract as a whole; pipeline/contract/manifest.json carries the same. */
|
|
24
|
-
export const CONTRACT_VERSION = "2.
|
|
24
|
+
export const CONTRACT_VERSION = "2.5.0";
|
|
25
25
|
/** Confirm tokens held at once; the oldest is dropped past this. */
|
|
26
26
|
export const MAX_CONFIRMS = 256;
|
|
27
27
|
/** How long a kill or gc confirm token stays valid. */
|
|
@@ -42,11 +42,14 @@
|
|
|
42
42
|
*
|
|
43
43
|
* Usage:
|
|
44
44
|
* disk-cleaner.mjs [--dry-run] [--apply] [--only=a,b] [--skip=a,b]
|
|
45
|
-
* [--trash] [--transcripts] [--
|
|
45
|
+
* [--trash] [--transcripts] [--test-artifacts] [--unattended]
|
|
46
|
+
* [--include-recent]
|
|
46
47
|
* [--log-days=N] [--archive-days=N] [--transcript-days=N]
|
|
48
|
+
* [--artifact-days=N]
|
|
47
49
|
* [--scratch-hours=N] [--build-hours=N] [--orphan-minutes=N]
|
|
48
50
|
* [--runtime-days=N] [--depth=N] [--exclude=PATH]...
|
|
49
|
-
* [--root=DIR]... [--tmp-root=DIR]... [--
|
|
51
|
+
* [--root=DIR]... [--tmp-root=DIR]... [--artifact-root=DIR]...
|
|
52
|
+
* [--home=DIR]
|
|
50
53
|
* [--report=FILE] [--json] [--list] [--top=N]
|
|
51
54
|
*
|
|
52
55
|
* --root and --depth (defaults: the git repos under the usual dev folders,
|
|
@@ -54,6 +57,11 @@
|
|
|
54
57
|
* DISK_CLEANER_DEPTH; --exclude from DISK_CLEANER_EXCLUDE (colon-separated).
|
|
55
58
|
* An excluded path, and any candidate that holds it, is kept.
|
|
56
59
|
*
|
|
60
|
+
* --artifact-root, also DISK_CLEANER_ARTIFACT_ROOTS (colon-separated), adds a
|
|
61
|
+
* tree to search for test run output beside the dev roots. It is where a
|
|
62
|
+
* harness that keeps its results outside a repository is named, so no product's
|
|
63
|
+
* paths live in this file.
|
|
64
|
+
*
|
|
57
65
|
* Every category in the JSON report carries `top` (its largest items, real
|
|
58
66
|
* paths and sizes, 5 unless --top says otherwise), `more` (how many items
|
|
59
67
|
* `top` leaves out) and `kept` (how many items were kept, per reason). The
|
|
@@ -70,12 +78,15 @@
|
|
|
70
78
|
|
|
71
79
|
import { spawnSync } from "node:child_process";
|
|
72
80
|
import {
|
|
81
|
+
closeSync,
|
|
73
82
|
existsSync,
|
|
74
83
|
lstatSync,
|
|
75
84
|
mkdirSync,
|
|
85
|
+
openSync,
|
|
76
86
|
readdirSync,
|
|
77
87
|
realpathSync,
|
|
78
88
|
readFileSync,
|
|
89
|
+
readSync,
|
|
79
90
|
rmSync,
|
|
80
91
|
statfsSync,
|
|
81
92
|
writeFileSync,
|
|
@@ -312,12 +323,14 @@ export function makeContext(o = {}) {
|
|
|
312
323
|
now: o.now ?? Date.now(),
|
|
313
324
|
tmpRoots,
|
|
314
325
|
devRoots: o.devRoots || defaultDevRoots(home),
|
|
326
|
+
artifactRoots: (o.artifactRoots || []).filter(Boolean).map((r) => nativeReal(r) || r),
|
|
315
327
|
scriptsDir: o.scriptsDir || defaultScriptsDir(home),
|
|
316
328
|
sessionId: o.sessionId ?? process.env.CLAUDE_CODE_SESSION_ID ?? "",
|
|
317
329
|
days: {
|
|
318
330
|
logs: o.logDays ?? 30,
|
|
319
331
|
archives: o.archiveDays ?? 90,
|
|
320
332
|
transcripts: o.transcriptDays ?? 90,
|
|
333
|
+
artifacts: o.artifactDays ?? 7,
|
|
321
334
|
},
|
|
322
335
|
includeRecent: Boolean(o.includeRecent),
|
|
323
336
|
scratchHours: o.scratchHours ?? 48,
|
|
@@ -328,6 +341,7 @@ export function makeContext(o = {}) {
|
|
|
328
341
|
maxDepth: o.maxDepth ?? MAX_WALK_DEPTH,
|
|
329
342
|
excludes: (o.excludes || []).filter(Boolean).map((p) => nativeReal(p) || p),
|
|
330
343
|
denied: new Set(),
|
|
344
|
+
trackedCache: new Map(),
|
|
331
345
|
run: o.run || realRun,
|
|
332
346
|
du: o.du || duBytes,
|
|
333
347
|
ps: () => (psCache ??= (o.ps || realPs)()),
|
|
@@ -669,6 +683,54 @@ const BUILD_SHAPE = {
|
|
|
669
683
|
};
|
|
670
684
|
BUILD_SHAPE[".DerivedData"] = BUILD_SHAPE.DerivedData;
|
|
671
685
|
|
|
686
|
+
// Build output under a name nobody can enumerate.
|
|
687
|
+
//
|
|
688
|
+
// Matching on the folder's NAME finds the default layouts and nothing else. A
|
|
689
|
+
// tool that points `-derivedDataPath` somewhere of its own choosing - a test
|
|
690
|
+
// harness giving each lane its own copy, a CI script, a wrapper that keeps one
|
|
691
|
+
// per scheme - writes the same tree under a name this file has never heard of.
|
|
692
|
+
// Measured on one machine: four such copies beside a repository's worktrees
|
|
693
|
+
// held 104 GB, the walk descended through all of it looking for a folder called
|
|
694
|
+
// DerivedData, and the report came back with 11 GB.
|
|
695
|
+
//
|
|
696
|
+
// So the shape decides, not the name. Both tools write a signature no source
|
|
697
|
+
// tree carries: Xcode writes `Build` beside its `.noindex` caches, SwiftPM a
|
|
698
|
+
// `build.db` beside its manifest and checkouts. `Build` or `build.db` is tested
|
|
699
|
+
// first, one stat, and the rest only when that hits - so an ordinary directory
|
|
700
|
+
// costs a single extra stat.
|
|
701
|
+
const SHAPE_SIGNATURES = Object.freeze([
|
|
702
|
+
{
|
|
703
|
+
kind: "DerivedData",
|
|
704
|
+
lead: "Build",
|
|
705
|
+
others: ["Index.noindex", "ModuleCache.noindex", "SourcePackages", "Logs", "info.plist"],
|
|
706
|
+
least: 2,
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
kind: ".build",
|
|
710
|
+
lead: "build.db",
|
|
711
|
+
others: ["manifest.db", "checkouts", "artifacts", "repositories", "index-build"],
|
|
712
|
+
least: 1,
|
|
713
|
+
},
|
|
714
|
+
]);
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* What a directory is, read from what it holds rather than what it is called.
|
|
718
|
+
*
|
|
719
|
+
* @param {string} dir
|
|
720
|
+
* @returns {"DerivedData"|".build"|null}
|
|
721
|
+
*/
|
|
722
|
+
function shapeOf(dir) {
|
|
723
|
+
for (const sig of SHAPE_SIGNATURES) {
|
|
724
|
+
if (!existsSync(join(dir, sig.lead))) continue;
|
|
725
|
+
let found = 0;
|
|
726
|
+
for (const n of sig.others) {
|
|
727
|
+
if (existsSync(join(dir, n))) found++;
|
|
728
|
+
if (found >= sig.least) return sig.kind;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
return null;
|
|
732
|
+
}
|
|
733
|
+
|
|
672
734
|
function repoBuildCandidates(ctx, out) {
|
|
673
735
|
const maxAge = ctx.repoBuildHours * HOUR_MS;
|
|
674
736
|
const visit = (root, dir, depth) => {
|
|
@@ -684,9 +746,14 @@ function repoBuildCandidates(ctx, out) {
|
|
|
684
746
|
if (!e.isDirectory() || e.isSymbolicLink()) continue;
|
|
685
747
|
const p = join(dir, e.name);
|
|
686
748
|
if (devPruned(ctx, p, e.name)) continue;
|
|
687
|
-
|
|
749
|
+
// A folder with a build tool's NAME is a candidate when it also holds what
|
|
750
|
+
// that tool writes; one that does not is somebody's own directory, and the
|
|
751
|
+
// report says it was kept. A folder with any OTHER name is a candidate only
|
|
752
|
+
// when its shape says so, and then there is nothing to report about it.
|
|
753
|
+
const named = Boolean(BUILD_SHAPE[e.name]);
|
|
754
|
+
const shape = named ? BUILD_SHAPE[e.name] : BUILD_SHAPE[shapeOf(p) ?? ""];
|
|
688
755
|
if (shape) {
|
|
689
|
-
if (!shape.some((n) => existsSync(join(p, n)))) {
|
|
756
|
+
if (named && !shape.some((n) => existsSync(join(p, n)))) {
|
|
690
757
|
out.skipped.push({ path: p, reason: "does not look like build output" });
|
|
691
758
|
} else if (inUse(ctx, realOrNull(p) || p)) {
|
|
692
759
|
hold(out, p, "in use by a running process", "live");
|
|
@@ -784,6 +851,146 @@ function claudeScratchCandidates(ctx, out) {
|
|
|
784
851
|
}
|
|
785
852
|
}
|
|
786
853
|
|
|
854
|
+
// What a test run leaves behind, found by shape.
|
|
855
|
+
//
|
|
856
|
+
// A run writes three kinds of output and all three are regenerable by running
|
|
857
|
+
// it again: the result bundle, the recordings and screenshots taken while it
|
|
858
|
+
// ran, and the report files. They are also the biggest thing on a machine that
|
|
859
|
+
// runs a suite every night, and nothing deleted them.
|
|
860
|
+
//
|
|
861
|
+
// The shape is the only safe way to find them. Naming the directories one
|
|
862
|
+
// harness happens to use would tie this file to that harness, and this
|
|
863
|
+
// repository carries no product's paths - an extra root belongs in preferences
|
|
864
|
+
// (DISK_CLEANER_ARTIFACT_ROOTS, --artifact-root), not here. So a run is
|
|
865
|
+
// recognised by what every harness writes: a result bundle, or a report file
|
|
866
|
+
// shaped like a test report. Media and report files count only inside such a
|
|
867
|
+
// directory, so a recording somebody saved among their own files is never a
|
|
868
|
+
// candidate.
|
|
869
|
+
//
|
|
870
|
+
// Opt-in, never unattended: a recording can be the only evidence of a failure
|
|
871
|
+
// anybody still has.
|
|
872
|
+
const RESULT_BUNDLE = /\.xcresult$/i;
|
|
873
|
+
const RUN_MEDIA = /\.(?:mp4|mov|m4v|png|jpe?g|heic)$/i;
|
|
874
|
+
const RUN_REPORT = /\.(?:html?|json|xml|junit|txt|log)$/i;
|
|
875
|
+
const JUNIT_HEAD = /<testsuites?[\s>]/i;
|
|
876
|
+
|
|
877
|
+
/**
|
|
878
|
+
* The names git tracks in one directory, cached per directory.
|
|
879
|
+
*
|
|
880
|
+
* A run's output is not in version control; a test fixture is. Without this the
|
|
881
|
+
* shape rules read a committed `TEST-*.xml` as a run's report and offer to
|
|
882
|
+
* delete the repository's own fixtures - found on the first real run, against
|
|
883
|
+
* this repository's test tree.
|
|
884
|
+
*
|
|
885
|
+
* `ls-files` is asked once per directory and only for that directory, so a
|
|
886
|
+
* directory of run output, which is normally ignored, costs one call that
|
|
887
|
+
* returns nothing.
|
|
888
|
+
*
|
|
889
|
+
* @returns {Set<string>} basenames; empty when the directory is not in a repository
|
|
890
|
+
*/
|
|
891
|
+
function trackedNames(dir, ctx) {
|
|
892
|
+
const cached = ctx.trackedCache.get(dir);
|
|
893
|
+
if (cached) return cached;
|
|
894
|
+
const names = new Set();
|
|
895
|
+
const r = ctx.run("git", ["-C", dir, "ls-files", "-z", "--", "."], { timeout: 20_000 });
|
|
896
|
+
if (r.status === 0 && r.stdout) {
|
|
897
|
+
for (const rel of r.stdout.split("\0")) {
|
|
898
|
+
if (!rel) continue;
|
|
899
|
+
// `.` is this directory, so a path with a separator names something below
|
|
900
|
+
// it - and the first segment is what sits here.
|
|
901
|
+
names.add(rel.split("/")[0]);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
ctx.trackedCache.set(dir, names);
|
|
905
|
+
return names;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
/** Does this directory hold a test run's output? */
|
|
909
|
+
function holdsRunOutput(dir, ctx) {
|
|
910
|
+
let names;
|
|
911
|
+
try {
|
|
912
|
+
names = listDir(dir, ctx).map((p) => basename(p));
|
|
913
|
+
} catch {
|
|
914
|
+
return false;
|
|
915
|
+
}
|
|
916
|
+
if (names.some((n) => RESULT_BUNDLE.test(n))) return true;
|
|
917
|
+
for (const n of names) {
|
|
918
|
+
if (!/\.xml$/i.test(n)) continue;
|
|
919
|
+
try {
|
|
920
|
+
// The head of the file, not the whole of it: a junit file can be large and
|
|
921
|
+
// the element that identifies it is the first one.
|
|
922
|
+
const fd = openSync(join(dir, n), "r");
|
|
923
|
+
try {
|
|
924
|
+
const buf = Buffer.alloc(512);
|
|
925
|
+
const read = readSync(fd, buf, 0, 512, 0);
|
|
926
|
+
if (JUNIT_HEAD.test(buf.subarray(0, read).toString("utf8"))) return true;
|
|
927
|
+
} finally {
|
|
928
|
+
closeSync(fd);
|
|
929
|
+
}
|
|
930
|
+
} catch {
|
|
931
|
+
/* unreadable; it decides nothing */
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
return false;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
function testArtifactCandidates(ctx, out) {
|
|
938
|
+
const maxAge = ctx.days.artifacts * DAY_MS;
|
|
939
|
+
const roots = [...ctx.devRoots, ...ctx.artifactRoots];
|
|
940
|
+
const seen = new Set();
|
|
941
|
+
for (const root of roots) {
|
|
942
|
+
if (seen.has(root) || !rootUsable(root, ctx, out)) continue;
|
|
943
|
+
seen.add(root);
|
|
944
|
+
const visit = (dir, depth) => {
|
|
945
|
+
if (depth > ctx.maxDepth) return;
|
|
946
|
+
let entries;
|
|
947
|
+
try {
|
|
948
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
949
|
+
} catch (e) {
|
|
950
|
+
noteDenied(ctx, dir, e);
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
953
|
+
// A result bundle is a directory. Take it whole and do not walk into it.
|
|
954
|
+
for (const e of entries) {
|
|
955
|
+
if (e.isSymbolicLink()) continue;
|
|
956
|
+
const path = join(dir, e.name);
|
|
957
|
+
if (e.isDirectory() && RESULT_BUNDLE.test(e.name)) {
|
|
958
|
+
take(path);
|
|
959
|
+
continue;
|
|
960
|
+
}
|
|
961
|
+
if (e.isDirectory()) {
|
|
962
|
+
if (WALK_SKIP.has(e.name) || devPruned(ctx, path, e.name)) continue;
|
|
963
|
+
if (e.name === ".git" || e.name === "node_modules" || e.name === "Pods") continue;
|
|
964
|
+
visit(path, depth + 1);
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
// Media and reports, only where a run's output is.
|
|
968
|
+
if (!holdsRunOutput(dir, ctx)) return;
|
|
969
|
+
for (const e of entries) {
|
|
970
|
+
if (!e.isFile() || e.isSymbolicLink()) continue;
|
|
971
|
+
if (!RUN_MEDIA.test(e.name) && !RUN_REPORT.test(e.name)) continue;
|
|
972
|
+
take(join(dir, e.name));
|
|
973
|
+
}
|
|
974
|
+
};
|
|
975
|
+
const take = (path) => {
|
|
976
|
+
if (trackedNames(dirname(path), ctx).has(basename(path))) {
|
|
977
|
+
out.skipped.push({ path, reason: "tracked by git" });
|
|
978
|
+
return;
|
|
979
|
+
}
|
|
980
|
+
if (!olderThan(path, maxAge, ctx)) {
|
|
981
|
+
hold(out, path, "touched recently", "age");
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
if (inUse(ctx, realOrNull(path) || path)) {
|
|
985
|
+
hold(out, path, "in use by a running process", "live");
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
addPath(out, ctx, path, [root]);
|
|
989
|
+
};
|
|
990
|
+
visit(root, 0);
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
|
|
787
994
|
function transcriptCandidates(ctx, out) {
|
|
788
995
|
const maxAge = ctx.days.transcripts * DAY_MS;
|
|
789
996
|
const roots = [H(ctx, ".claude", "projects"), H(ctx, ".codex", "sessions")];
|
|
@@ -1240,6 +1447,14 @@ export const CATEGORIES = [
|
|
|
1240
1447
|
optIn: "trash",
|
|
1241
1448
|
discover: (ctx, out) => childrenOf(ctx, out, [H(ctx, ".Trash")]),
|
|
1242
1449
|
},
|
|
1450
|
+
{
|
|
1451
|
+
id: "test-artifacts",
|
|
1452
|
+
label:
|
|
1453
|
+
"test run output under the dev and artifact roots, older than the artifact age: result bundles, recordings, screenshots and report files",
|
|
1454
|
+
unattended: false,
|
|
1455
|
+
optIn: "test-artifacts",
|
|
1456
|
+
discover: testArtifactCandidates,
|
|
1457
|
+
},
|
|
1243
1458
|
{
|
|
1244
1459
|
id: "transcripts",
|
|
1245
1460
|
label: "Claude Code and Codex session transcripts older than the transcript age",
|
|
@@ -1427,7 +1642,7 @@ export function applyPlan(ctx, planned) {
|
|
|
1427
1642
|
// ---------------------------------------------------------------- CLI
|
|
1428
1643
|
|
|
1429
1644
|
function parseCli(argv) {
|
|
1430
|
-
const o = { only: [], skip: [], tmpRoots: [], devRoots: [], excludes: [] };
|
|
1645
|
+
const o = { only: [], skip: [], tmpRoots: [], devRoots: [], artifactRoots: [], excludes: [] };
|
|
1431
1646
|
const num = (k, v) => {
|
|
1432
1647
|
if (!/^\d+$/.test(v)) throw new Error(`${k} needs a whole number, got "${v}"`);
|
|
1433
1648
|
return Number(v);
|
|
@@ -1445,6 +1660,7 @@ function parseCli(argv) {
|
|
|
1445
1660
|
break;
|
|
1446
1661
|
case "--trash":
|
|
1447
1662
|
case "--transcripts":
|
|
1663
|
+
case "--test-artifacts":
|
|
1448
1664
|
case "--unattended":
|
|
1449
1665
|
case "--json":
|
|
1450
1666
|
case "--list":
|
|
@@ -1457,6 +1673,13 @@ function parseCli(argv) {
|
|
|
1457
1673
|
if (!v) throw new Error("--exclude needs a path");
|
|
1458
1674
|
o.excludes.push(v);
|
|
1459
1675
|
break;
|
|
1676
|
+
case "--artifact-root":
|
|
1677
|
+
if (!v) throw new Error("--artifact-root needs a path");
|
|
1678
|
+
o.artifactRoots.push(v);
|
|
1679
|
+
break;
|
|
1680
|
+
case "--artifact-days":
|
|
1681
|
+
o.artifactDays = num(k, v);
|
|
1682
|
+
break;
|
|
1460
1683
|
case "--depth":
|
|
1461
1684
|
o.depth = num(k, v);
|
|
1462
1685
|
break;
|
|
@@ -1670,6 +1893,9 @@ export function main(argv, env = process.env) {
|
|
|
1670
1893
|
home: o.home,
|
|
1671
1894
|
tmpRoots: o.tmpRoots.length ? o.tmpRoots : undefined,
|
|
1672
1895
|
devRoots: o.devRoots.length ? o.devRoots : env.DISK_CLEANER_ROOTS?.split(":").filter(Boolean),
|
|
1896
|
+
artifactRoots: o.artifactRoots.length
|
|
1897
|
+
? o.artifactRoots
|
|
1898
|
+
: (env.DISK_CLEANER_ARTIFACT_ROOTS?.split(":").filter(Boolean) ?? []),
|
|
1673
1899
|
logDays: o.logDays,
|
|
1674
1900
|
archiveDays: o.archiveDays,
|
|
1675
1901
|
transcriptDays: o.transcriptDays,
|
|
@@ -1690,6 +1916,7 @@ export function main(argv, env = process.env) {
|
|
|
1690
1916
|
unattended,
|
|
1691
1917
|
trash: unattended ? false : o.trash,
|
|
1692
1918
|
transcripts: unattended ? false : o.transcripts,
|
|
1919
|
+
"test-artifacts": unattended ? false : o["test-artifacts"],
|
|
1693
1920
|
};
|
|
1694
1921
|
const before = diskStatus(ctx.home);
|
|
1695
1922
|
const planned = plan(ctx, sel);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "1.0.0",
|
|
3
|
-
"generatedAt": "2026-11-
|
|
3
|
+
"generatedAt": "2026-11-18T15:59:36Z",
|
|
4
4
|
"skillCount": 259,
|
|
5
5
|
"entries": [
|
|
6
6
|
{
|
|
@@ -541,7 +541,7 @@
|
|
|
541
541
|
},
|
|
542
542
|
{
|
|
543
543
|
"path": "shared/external/disk-cleaner/SKILL.md",
|
|
544
|
-
"sha256": "
|
|
544
|
+
"sha256": "12648e6ababa644ab65fcbea5d4163e86e9eb7fba593e4e365e09304ad30e13d"
|
|
545
545
|
},
|
|
546
546
|
{
|
|
547
547
|
"path": "shared/external/docker-expert/SKILL.md",
|
|
@@ -109,7 +109,7 @@ Source layout is logical grouping only - skill discovery at runtime is unchang
|
|
|
109
109
|
| [`multi-agent-testflight-validation`](./core/multi-agent-testflight-validation/) | `core` | iOS-pinned alias of store-ready: same three gates on an iOS build, one implementation. Validates a TestFlight / App Store package, never upl |
|
|
110
110
|
| [`multi-agent-uninstall`](./core/multi-agent-uninstall/) | `core` | Uninstall the pipeline from Claude Code + Copilot CLI. Keychain access tokens are always left untouched; --all-data also clears pipeline set |
|
|
111
111
|
| [`multi-agent-update`](./core/multi-agent-update/) | `core` | Update the pipeline to the latest published npm release: registry check, npm pack, install, migrate. Use when the installed pipeline is behi |
|
|
112
|
-
| [`multi-agent-version`](./core/multi-agent-version/) | `core` | Which version of the pipeline, the MCP toolkit and the plugins this machine runs,
|
|
112
|
+
| [`multi-agent-version`](./core/multi-agent-version/) | `core` | Which version of the pipeline, the MCP toolkit and the plugins this machine runs, with each one's dates. Use when asked what is installed or |
|
|
113
113
|
|
|
114
114
|
## iOS / Apple Ecosystem
|
|
115
115
|
|
|
@@ -65,10 +65,11 @@ non-zero count means the report is incomplete, not that the disk is clean.
|
|
|
65
65
|
| `held.aged` is above 0 and the user wants that space too | Add `--include-recent` after asking. Items in use and session scratch touched within `--scratch-hours`, which may belong to another open session, stay held at any age. |
|
|
66
66
|
| The user asked to empty the Trash | Add `--trash`. Only on that explicit request. |
|
|
67
67
|
| The user asked to delete old transcripts | Add `--transcripts` (older than `--transcript-days`, default 90). Past transcripts are searched for history, so this is opt-in and never the current session. |
|
|
68
|
+
| The user asked to delete test run output | Add `--test-artifacts` (older than `--artifact-days`, default 7), and name what will go before applying it: the result bundles, the recordings and screenshots, and the report files, counted and sized per root. A recording can be the only evidence of a failure anybody still has, so the confirmation is per run and never carried over from a previous one. A harness that keeps its results outside a repository is added with `--artifact-root` or `DISK_CLEANER_ARTIFACT_ROOTS`. |
|
|
68
69
|
| The user asked to stop hanging sessions | Show the report's `orphans` list as information. The script never stops a process; stopping one is the user's own step. Live sessions are never listed. |
|
|
69
70
|
|
|
70
71
|
Narrow a run with `--only=a,b` or `--skip=a,b`. Ages: `--log-days`
|
|
71
|
-
(default 30), `--archive-days` (90), `--scratch-hours` (48),
|
|
72
|
+
(default 30), `--archive-days` (90), `--artifact-days` (7), `--scratch-hours` (48),
|
|
72
73
|
`--build-hours` (12, for in-repo `.build` and DerivedData and XCTest
|
|
73
74
|
clones), `--orphan-minutes` (30), `--runtime-days` (30, for simulator
|
|
74
75
|
runtimes; the newest runtime per platform and one backing a booted device
|