@yasaswy.nagavolu/agents 0.25.0 → 0.26.1
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 +15 -0
- package/bin/cli.js +114 -2
- package/content/global/hooks/cloudshell_guard.py +712 -0
- package/content/global/hooks/project_hook.sh +7 -4
- package/content/manifest.json +61 -1
- package/content/mods/handoff/.claude-plugin/plugin.json +1 -1
- package/content/mods/handoff/README.md +1 -1
- package/content/mods/handoff/hooks/register.js +2 -0
- package/content/mods/handoff/tests/register.test.mjs +41 -1
- package/content/skills/README.md +4 -0
- package/content/skills/ci-runner/SKILL.md +35 -0
- package/content/skills/disk-cleanup/SKILL.md +3 -2
- package/content/skills/disk-cleanup/classify.ps1 +2 -1
- package/content/skills/disk-cleanup/purge_walker.ps1 +98 -0
- package/content/skills/disk-cleanup/safe_clean.ps1 +7 -4
- package/content/skills/disk-cleanup/scan.ps1 +3 -2
- package/content/skills/disk-cleanup/worktree_audit.ps1 +1 -1
- package/content/skills/make-space/SKILL.md +61 -0
- package/content/skills/make-space/allowlist.json +39 -0
- package/content/skills/make-space/make_space.ps1 +219 -0
- package/content/skills/make-space/space_guard.ps1 +84 -0
- package/content/skills/make-space/tests/conftest.py +103 -0
- package/content/skills/make-space/tests/test_make_space.py +195 -0
- package/lib/claudeVersion.js +82 -0
- package/lib/doctor.js +19 -2
- package/lib/projectHooks.js +284 -0
- package/lib/runner/args.js +154 -0
- package/lib/runner/detect.js +84 -0
- package/lib/runner/exec.js +72 -0
- package/lib/runner/gitlab.js +126 -0
- package/lib/runner/index.js +290 -0
- package/lib/runner/profiles/linuxDocker.js +353 -0
- package/lib/runner/profiles/macosShell.js +416 -0
- package/lib/runner/project.js +172 -0
- package/lib/runner/result.js +12 -0
- package/lib/runner/secrets.js +68 -0
- package/lib/semver.js +12 -1
- package/lib/wiring.js +4 -2
- package/package.json +1 -1
- package/templates/ci/README.md +25 -0
- package/templates/ci/base.yml +34 -0
- package/templates/ci/docker.yml +7 -0
- package/templates/ci/image/Dockerfile +33 -0
- package/templates/ci/macos.yml +16 -0
- package/templates/ci/node.yml +34 -0
- package/templates/ci/python.yml +34 -0
package/README.md
CHANGED
|
@@ -73,6 +73,21 @@ agents-cli install
|
|
|
73
73
|
secrets --list` — see [Secrets](#secrets) below.
|
|
74
74
|
- `agents-cli update --yes` / `agents-cli update --bundle <key> --yes` — see
|
|
75
75
|
[Updating](#updating) below.
|
|
76
|
+
- `agents-cli runner install --group-id <id> | --project-id <id>` — install a
|
|
77
|
+
ready GitLab CI runner on this machine (`linux-docker`, or `macos-shell` on
|
|
78
|
+
a Mac). `runner status` / `runner doctor` / `runner uninstall` check,
|
|
79
|
+
diagnose or remove it; `runner attach|detach --project-id <id>` enable the
|
|
80
|
+
saved runners on a project (`--no-cloud` also turns off cloud runners);
|
|
81
|
+
`runner init-project [--write] [--attach --project-id <id>]` writes a
|
|
82
|
+
`.gitlab-ci.yml`. Needs `GITLAB_RUNNER_PAT` (set it with `agents-cli
|
|
83
|
+
secrets`). Add `--json` for a machine-readable result that never contains a
|
|
84
|
+
token. Exit codes: 0 ok, 1 a step failed, 2 usage error.
|
|
85
|
+
- `agents-cli doctor [--fix] [--scan-root <dir>] [--json]` — report orphaned, missing and drifted
|
|
86
|
+
files under the install target, plus project hooks in the repo's `.claude/settings.json` and
|
|
87
|
+
`settings.local.json` whose script file is missing or that are bare `python <repo>/.claude/hooks/x.py`
|
|
88
|
+
commands (they exit 2 and block a PreToolUse call when the file goes missing). `--fix` rewrites the
|
|
89
|
+
bare ones to `sh ~/.claude/hooks/project_hook.sh .claude/hooks/x.py [args]` (fail-open launcher);
|
|
90
|
+
`--scan-root <dir>` checks every git repo directly under `<dir>` instead of the cwd repo.
|
|
76
91
|
- `agents-cli --help` — show usage
|
|
77
92
|
|
|
78
93
|
### The interactive menu
|
package/bin/cli.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
const path = require('node:path');
|
|
5
|
+
const fs = require('node:fs');
|
|
5
6
|
const { readFileSync } = require('node:fs');
|
|
6
7
|
|
|
7
8
|
const pkg = JSON.parse(
|
|
@@ -32,6 +33,8 @@ const { collectBundleSecrets, collectComponentSecrets, isResolved, promptForMiss
|
|
|
32
33
|
const { envPath, readSecrets, removeSecret } = require('../lib/secretsStore');
|
|
33
34
|
const { runSelfProfilePostInstall } = require('../lib/selfProfile');
|
|
34
35
|
const { checkHealth, DoctorError } = require('../lib/doctor');
|
|
36
|
+
const projectHooks = require('../lib/projectHooks');
|
|
37
|
+
const { checkModVersions } = require('../lib/claudeVersion');
|
|
35
38
|
|
|
36
39
|
const PACKAGE_ROOT = path.join(__dirname, '..');
|
|
37
40
|
// One styler for the whole process: colors on only for a real TTY stdout
|
|
@@ -62,7 +65,9 @@ Usage:
|
|
|
62
65
|
agents-cli secrets Prompt for any missing secrets across all installed bundles
|
|
63
66
|
agents-cli secrets --bundle <key> Prompt for missing secrets for one bundle
|
|
64
67
|
agents-cli secrets --list Show which secrets are set/missing (names only — never values)
|
|
65
|
-
agents-cli doctor
|
|
68
|
+
agents-cli doctor [--fix] [--scan-root <dir>] Report orphaned/missing/drifted files under the install target
|
|
69
|
+
and project hooks that would brick a session if their file went missing
|
|
70
|
+
agents-cli runner <sub> [flags] Install and manage a self-hosted GitLab CI runner (see "Flags for runner")
|
|
66
71
|
agents-cli --help Show this help
|
|
67
72
|
|
|
68
73
|
Flags for install:
|
|
@@ -133,9 +138,31 @@ Python is installed to wire it. Duplicate hook registrations that predate this C
|
|
|
133
138
|
(or otherwise accumulate outside its per-block dedupe) are collapsed automatically on
|
|
134
139
|
every install/update — see "doctor" below to inspect settings.json wiring separately.
|
|
135
140
|
|
|
141
|
+
Flags for runner:
|
|
142
|
+
runner install --group-id <id> | --project-id <id> Install a ready runner on this machine (idempotent)
|
|
143
|
+
runner status | doctor | uninstall Check, diagnose (docker, PAT scopes, online) or remove it
|
|
144
|
+
runner attach | detach --project-id <id> Enable/disable the saved runners on a project (--no-cloud on
|
|
145
|
+
attach also turns off cloud runners for it)
|
|
146
|
+
runner init-project [--profile node|python|docker|macos|blank] [--write] [--attach --project-id <id>]
|
|
147
|
+
Write a .gitlab-ci.yml that uses the shared templates (dry run unless --write)
|
|
148
|
+
--profile <auto|linux|macos> Install profile (default auto); --name, --tags, --concurrent, --url, --image,
|
|
149
|
+
--cache-volume, --protected, --run-untagged/--no-run-untagged, --dry-run
|
|
150
|
+
--json Print a machine-readable result (never contains a token or PAT)
|
|
151
|
+
Needs a GitLab PAT in GITLAB_RUNNER_PAT (or GITLAB_TOKEN): set it with "agents-cli secrets".
|
|
152
|
+
Exit codes: 0 ok, 1 a step failed, 2 usage error.
|
|
153
|
+
|
|
136
154
|
Flags for doctor:
|
|
137
155
|
--target-dir <path> Install target base, default ~/.claude (use for testing)
|
|
138
156
|
--json Print a machine-readable report instead of prose
|
|
157
|
+
--scan-root <dir> Check the project hooks of every git repo directly under <dir> (default: the repo of the cwd)
|
|
158
|
+
--fix Rewrite bare "python <repo>/.claude/hooks/x.py" project hook commands into the fail-open
|
|
159
|
+
launcher form "sh ~/.claude/hooks/project_hook.sh .claude/hooks/x.py" (needs the launcher
|
|
160
|
+
installed under the target; edits only settings.json / settings.local.json hook commands)
|
|
161
|
+
|
|
162
|
+
doctor also checks the project hooks in .claude/settings.json and settings.local.json of the repo: a hook command
|
|
163
|
+
whose script file is missing, and a bare (non-launcher) project hook command, which exits 2 if its file goes missing
|
|
164
|
+
and so blocks every tool call when it is a PreToolUse hook. A launcher-form hook with a missing file fails open but is still
|
|
165
|
+
reported. Without --fix nothing is modified.
|
|
139
166
|
|
|
140
167
|
doctor reports, without changing anything: orphans (files/directories sitting inside
|
|
141
168
|
a path this CLI manages that the ledger does not claim — e.g. a stale file left behind
|
|
@@ -143,6 +170,8 @@ by a renamed/retired item), missing (a ledger-tracked file no longer on disk), a
|
|
|
143
170
|
drifted (a ledger-tracked file whose on-disk hash no longer matches what was installed).
|
|
144
171
|
It never scans anywhere the manifest doesn't declare a file/directory item into, so the
|
|
145
172
|
rest of <target> (Claude Code's own state, caches, logs, your own files) is left alone.
|
|
173
|
+
It also compares the local "claude --version" with each installed mod's minClaudeCodeVersion:
|
|
174
|
+
a too-old Claude Code is a finding (exit 1); a missing claude binary only warns.
|
|
146
175
|
Exit code is 0 when clean, 1 otherwise — safe to use as a CI/scripted gate. It never
|
|
147
176
|
deletes or modifies anything; deciding what to do about a finding is a separate step.
|
|
148
177
|
`);
|
|
@@ -378,12 +407,28 @@ function printFinalSummary({ installed, skipped, targetBase }) {
|
|
|
378
407
|
console.log(` ${mark('skip')} ${label}`);
|
|
379
408
|
}
|
|
380
409
|
printPythonSyncIssues(installed.map(({ result }) => result));
|
|
410
|
+
printModVersionWarnings(installed.map(({ bundle }) => bundle.key), targetBase);
|
|
381
411
|
console.log(
|
|
382
412
|
`\nInstalled to ${ansi.bold(targetBase)}. Next: ${ansi.dim('agents-cli secrets')} to fill in any skipped ` +
|
|
383
413
|
`secrets, ${ansi.dim('agents-cli update --yes')} to refresh later.`
|
|
384
414
|
);
|
|
385
415
|
}
|
|
386
416
|
|
|
417
|
+
/** Print one warning line per just-installed mod whose minClaudeCodeVersion the local Claude Code does not meet; never fails the run. */
|
|
418
|
+
function printModVersionWarnings(bundleKeys, targetBase) {
|
|
419
|
+
try {
|
|
420
|
+
const { manifest } = loadManifest(PACKAGE_ROOT);
|
|
421
|
+
const items = [...new Set(bundleKeys)].flatMap((key) => {
|
|
422
|
+
const bundle = findBundle(manifest, key);
|
|
423
|
+
return bundle ? bundle.items.filter((item) => item.kind === 'mod') : [];
|
|
424
|
+
});
|
|
425
|
+
const checks = checkModVersions({ items, targetBase: targetBase || defaultTargetBase() });
|
|
426
|
+
for (const c of checks) {
|
|
427
|
+
if (c.status === 'too-old') console.log(` ${mark('skip')} ${c.line}`);
|
|
428
|
+
}
|
|
429
|
+
} catch { /* advisory only — never fail an install or update */ }
|
|
430
|
+
}
|
|
431
|
+
|
|
387
432
|
/**
|
|
388
433
|
* A python item's missing-uv/failed status is easy to miss among per-bundle
|
|
389
434
|
* component/hook bullets — surface it again as the last thing printed before
|
|
@@ -588,6 +633,7 @@ async function runInstall(argv) {
|
|
|
588
633
|
});
|
|
589
634
|
runSelfProfileStepsIfNeeded({ profile: args.profile, targetDir: args.targetDir });
|
|
590
635
|
printPythonSyncIssues([result]);
|
|
636
|
+
printModVersionWarnings([args.bundle], result.targetBase);
|
|
591
637
|
return 0;
|
|
592
638
|
} catch (err) {
|
|
593
639
|
if (err instanceof InstallError || err instanceof ManifestError || err instanceof LedgerError || err instanceof WiringError) {
|
|
@@ -1001,6 +1047,7 @@ async function runUpdate(argv) {
|
|
|
1001
1047
|
}
|
|
1002
1048
|
|
|
1003
1049
|
printPythonSyncIssues(result.bundles);
|
|
1050
|
+
printModVersionWarnings(result.bundles.map((b) => b.bundle), result.targetBase);
|
|
1004
1051
|
|
|
1005
1052
|
if (result.exitCode !== 0) {
|
|
1006
1053
|
console.error(
|
|
@@ -1021,7 +1068,7 @@ async function runUpdate(argv) {
|
|
|
1021
1068
|
}
|
|
1022
1069
|
|
|
1023
1070
|
function parseDoctorArgs(argv) {
|
|
1024
|
-
const args = { targetDir: null, json: false };
|
|
1071
|
+
const args = { targetDir: null, json: false, fix: false, scanRoot: null };
|
|
1025
1072
|
for (let i = 0; i < argv.length; i += 1) {
|
|
1026
1073
|
const arg = argv[i];
|
|
1027
1074
|
if (arg === '--target-dir') {
|
|
@@ -1029,6 +1076,12 @@ function parseDoctorArgs(argv) {
|
|
|
1029
1076
|
i += 1;
|
|
1030
1077
|
} else if (arg === '--json') {
|
|
1031
1078
|
args.json = true;
|
|
1079
|
+
} else if (arg === '--fix') {
|
|
1080
|
+
args.fix = true;
|
|
1081
|
+
} else if (arg === '--scan-root') {
|
|
1082
|
+
args.scanRoot = argv[i + 1];
|
|
1083
|
+
if (!args.scanRoot) throw new DoctorError('--scan-root needs a directory');
|
|
1084
|
+
i += 1;
|
|
1032
1085
|
} else {
|
|
1033
1086
|
throw new DoctorError(`Unknown doctor flag: ${arg}`);
|
|
1034
1087
|
}
|
|
@@ -1040,6 +1093,16 @@ function describeOrphan(o) {
|
|
|
1040
1093
|
return o.type === 'dir' ? `${o.relTarget}/ (directory)` : o.relTarget;
|
|
1041
1094
|
}
|
|
1042
1095
|
|
|
1096
|
+
function describeHookFinding(f) {
|
|
1097
|
+
const where = `${f.file} [${f.event || '-'}]`;
|
|
1098
|
+
if (f.kind === 'unparseable') return `${f.file}: not valid JSON, hooks not checked`;
|
|
1099
|
+
if (f.kind === 'bare-project-hook') {
|
|
1100
|
+
return `${where} bare project hook, exits 2 (blocks a PreToolUse call) if its file goes missing${f.fixable ? ' (fixable)' : ' (not auto-fixable)'}: ${f.command}`;
|
|
1101
|
+
}
|
|
1102
|
+
if (f.kind === 'missing-launcher') return `${where} launcher not found: ${f.script}`;
|
|
1103
|
+
return `${where} script missing${f.failsOpen ? ' (launcher: fails open, hook does not run)' : ' (FAILS CLOSED: blocks tool calls)'}: ${f.script}`;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1043
1106
|
function runDoctor(argv) {
|
|
1044
1107
|
let args;
|
|
1045
1108
|
try {
|
|
@@ -1055,13 +1118,56 @@ function runDoctor(argv) {
|
|
|
1055
1118
|
targetBase: args.targetDir,
|
|
1056
1119
|
});
|
|
1057
1120
|
|
|
1121
|
+
const targetBase = args.targetDir || defaultTargetBase();
|
|
1122
|
+
const hookScope = { cwd: process.cwd(), scanRoot: args.scanRoot ? path.resolve(args.scanRoot) : null };
|
|
1123
|
+
let hooks = projectHooks.checkProjectHooks(hookScope);
|
|
1124
|
+
const fixed = [];
|
|
1125
|
+
if (args.fix && hooks.findings.some((f) => f.kind === 'bare-project-hook' && f.fixable)) {
|
|
1126
|
+
if (!fs.existsSync(path.join(targetBase, 'hooks', projectHooks.LAUNCHER_NAME))) {
|
|
1127
|
+
console.error(
|
|
1128
|
+
`Cannot fix: ${path.join(targetBase, 'hooks', projectHooks.LAUNCHER_NAME)} is not installed. ` +
|
|
1129
|
+
'Run "agents-cli update" (or install the harness-hygiene bundle) first.'
|
|
1130
|
+
);
|
|
1131
|
+
return 1;
|
|
1132
|
+
}
|
|
1133
|
+
const launcherCommand = projectHooks.launcherCommandFor(targetBase);
|
|
1134
|
+
for (const repo of hooks.repos) fixed.push(...projectHooks.fixRepo(repo, { launcherCommand }));
|
|
1135
|
+
hooks = projectHooks.checkProjectHooks(hookScope);
|
|
1136
|
+
}
|
|
1137
|
+
result.projectHooks = { repos: hooks.repos, findings: hooks.findings, fixed };
|
|
1138
|
+
result.healthy = result.healthy && hooks.findings.length === 0;
|
|
1139
|
+
|
|
1058
1140
|
if (args.json) {
|
|
1059
1141
|
console.log(JSON.stringify(result, null, 2));
|
|
1060
1142
|
return result.healthy ? 0 : 1;
|
|
1061
1143
|
}
|
|
1062
1144
|
|
|
1145
|
+
const printProjectHooks = () => {
|
|
1146
|
+
if (fixed.length > 0) {
|
|
1147
|
+
console.log(`
|
|
1148
|
+
Rewrote ${fixed.length} bare project hook command(s) to the fail-open launcher:`);
|
|
1149
|
+
for (const c of fixed) console.log(` ${c.file}
|
|
1150
|
+
- ${c.from}
|
|
1151
|
+
+ ${c.to}`);
|
|
1152
|
+
}
|
|
1153
|
+
if (hooks.findings.length === 0) return;
|
|
1154
|
+
console.log(`
|
|
1155
|
+
Project hooks (${hooks.findings.length} finding(s), ${hooks.repos.length} repo(s) checked):`);
|
|
1156
|
+
for (const f of hooks.findings) console.log(` ${describeHookFinding(f)}`);
|
|
1157
|
+
if (hooks.findings.some((f) => f.kind === 'bare-project-hook' && f.fixable) && !args.fix) {
|
|
1158
|
+
console.log(' Run "agents-cli doctor --fix" to rewrite the fixable ones.');
|
|
1159
|
+
}
|
|
1160
|
+
};
|
|
1161
|
+
|
|
1162
|
+
const printModVersions = () => {
|
|
1163
|
+
if (result.modVersions.length === 0) return;
|
|
1164
|
+
console.log('\nClaude Code version vs. installed mods:');
|
|
1165
|
+
for (const c of result.modVersions) console.log(` ${c.line}`);
|
|
1166
|
+
};
|
|
1167
|
+
|
|
1063
1168
|
if (result.healthy) {
|
|
1064
1169
|
console.log(`${result.targetBase}: healthy — no orphans, no missing files, no drift.`);
|
|
1170
|
+
printModVersions();
|
|
1065
1171
|
return 0;
|
|
1066
1172
|
}
|
|
1067
1173
|
|
|
@@ -1078,6 +1184,8 @@ function runDoctor(argv) {
|
|
|
1078
1184
|
console.log(`\nDrifted (on-disk hash no longer matches the ledger, ${result.drifted.length}):`);
|
|
1079
1185
|
for (const d of result.drifted) console.log(` ${d.relTarget} (bundle: ${d.bundle})`);
|
|
1080
1186
|
}
|
|
1187
|
+
printModVersions();
|
|
1188
|
+
printProjectHooks();
|
|
1081
1189
|
return 1;
|
|
1082
1190
|
} catch (err) {
|
|
1083
1191
|
if (err instanceof DoctorError || err instanceof ManifestError || err instanceof LedgerError) {
|
|
@@ -1121,6 +1229,10 @@ async function main(argv) {
|
|
|
1121
1229
|
return runDoctor(rest);
|
|
1122
1230
|
}
|
|
1123
1231
|
|
|
1232
|
+
if (command === 'runner') {
|
|
1233
|
+
return require('../lib/runner').runRunnerCommand(rest);
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1124
1236
|
console.error(`Unknown command: ${command}`);
|
|
1125
1237
|
printHelp();
|
|
1126
1238
|
return 1;
|