@event4u/agent-config 9.10.0 → 9.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/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +111 -0
- package/README.md +20 -16
- package/agents/templates/.ai-council.yml.example +481 -0
- package/agents/templates/.ai-video.xml.example +247 -0
- package/dist/agent-src/commands/fix/ci.md +29 -0
- package/dist/agent-src/commands/pr/create.md +60 -0
- package/dist/agent-src/contexts/authority/kernel-rule-edits.md +18 -2
- package/dist/agent-src/rules/design-fidelity.md +2 -2
- package/dist/agent-src/skills/ai-code-blindspots/SKILL.md +1 -0
- package/dist/agent-src/skills/design-intelligence/SKILL.md +27 -1
- package/dist/agent-src/skills/design-intelligence/data/font-pairings-reference.csv +74 -74
- package/dist/agent-src/skills/design-intelligence/data/manifest.json +2 -0
- package/dist/agent-src/skills/design-tokens/scripts/tokens.ts +0 -7
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +15 -2
- package/dist/agent-src/skills/fe-design/SKILL.md +10 -0
- package/dist/agent-src/skills/typography-system/SKILL.md +55 -11
- package/dist/agent-src/skills/ui-apply-generic/SKILL.md +180 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +34 -30
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/design.ts +88 -33
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +23 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/review.ts +24 -1
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +332 -0
- package/dist/agent-src/templates/scripts/work_engine/stack/detect.ts +449 -11
- package/dist/agent-src/templates/scripts/work_engine/state.ts +21 -4
- package/dist/cli/initRouting.js +74 -11
- package/dist/cli/initRouting.js.map +1 -1
- package/dist/cli/main.js +14 -3
- package/dist/cli/main.js.map +1 -1
- package/dist/cli-delegate/chunk-523HCFYO.js +90 -0
- package/dist/cli-delegate/chunk-736JCWLM.js +1104 -0
- package/dist/cli-delegate/chunk-7HQ52DHU.js +74 -0
- package/dist/cli-delegate/chunk-A3HJ6NTI.js +1084 -0
- package/dist/cli-delegate/chunk-EJYIGZ3T.js +125 -0
- package/dist/cli-delegate/chunk-FTAISGDQ.js +117 -0
- package/dist/cli-delegate/chunk-GME3Q44L.js +82 -0
- package/dist/cli-delegate/chunk-GRRPEPRN.js +336 -0
- package/dist/cli-delegate/chunk-HJ6DAJHR.js +502 -0
- package/dist/cli-delegate/chunk-HYWSRNUX.js +179 -0
- package/dist/cli-delegate/chunk-J55WI3RR.js +47 -0
- package/dist/cli-delegate/chunk-MCJYCQPF.js +35 -0
- package/dist/cli-delegate/chunk-NDJLNC6Q.js +169 -0
- package/dist/cli-delegate/chunk-OMIVVCG2.js +26 -0
- package/dist/cli-delegate/chunk-OY53J6II.js +7336 -0
- package/dist/cli-delegate/chunk-QFKQLQ7X.js +10835 -0
- package/dist/cli-delegate/chunk-TEGJU2JX.js +6908 -0
- package/dist/cli-delegate/chunk-TJIAM5FW.js +133 -0
- package/dist/cli-delegate/chunk-XX6TOPD7.js +715 -0
- package/dist/cli-delegate/cmd_analyze_session.js +294 -0
- package/dist/cli-delegate/cmd_conformance.js +643 -0
- package/dist/cli-delegate/cmd_converge.js +326 -0
- package/dist/cli-delegate/cmd_doctor.js +142 -0
- package/dist/cli-delegate/cmd_explain.js +2576 -0
- package/dist/cli-delegate/cmd_export.js +298 -0
- package/dist/cli-delegate/cmd_fleet.js +333 -0
- package/dist/cli-delegate/cmd_memory_get.js +3878 -0
- package/dist/cli-delegate/cmd_migrate.js +11 -0
- package/dist/cli-delegate/cmd_preflight.js +153 -0
- package/dist/cli-delegate/cmd_prune.js +446 -0
- package/dist/cli-delegate/cmd_refresh.js +28 -0
- package/dist/cli-delegate/cmd_settings_check.js +574 -0
- package/dist/cli-delegate/cmd_settings_migrate.js +225 -0
- package/dist/cli-delegate/cmd_sync.js +266 -0
- package/dist/cli-delegate/cmd_uninstall.js +657 -0
- package/dist/cli-delegate/cmd_update.js +425 -0
- package/dist/cli-delegate/cmd_upgrade.js +444 -0
- package/dist/cli-delegate/cmd_validate.js +307 -0
- package/dist/cli-delegate/cmd_versions.js +370 -0
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +45 -16
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +3 -3
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +13 -7
- package/dist/discovery/trust-report.md +2 -2
- package/dist/discovery/workspaces.json +6 -4
- package/dist/install/emit_host_rules_cli.js +2 -1
- package/dist/install/emit_host_rules_cli.js.map +1 -1
- package/dist/install/install.mjs +634 -409
- package/dist/install/ruleInScope.js +123 -0
- package/dist/install/ruleInScope.js.map +1 -0
- package/dist/install/rule_scope.js +7 -3
- package/dist/install/rule_scope.js.map +1 -1
- package/dist/install/toolDetection.js +40 -12
- package/dist/install/toolDetection.js.map +1 -1
- package/dist/install/wizard-plan.js +12 -3
- package/dist/install/wizard-plan.js.map +1 -1
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +1553 -2728
- package/dist/router.json +1 -1
- package/dist/scripts/condense.js +6 -22
- package/dist/scripts/condense.js.map +1 -1
- package/docs/guidelines/design-fidelity-mechanics.md +14 -0
- package/package.json +4 -2
- package/src/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +34 -30
- package/src/agent-src/templates/scripts/work_engine/directives/ui/design.ts +88 -33
- package/src/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +23 -0
- package/src/agent-src/templates/scripts/work_engine/directives/ui/review.ts +24 -1
- package/src/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +332 -0
- package/src/agent-src/templates/scripts/work_engine/stack/detect.ts +449 -11
- package/src/agent-src/templates/scripts/work_engine/state.ts +21 -4
- package/src/config/discovery/packs.yml +7 -0
- package/src/config/evaluator-budgets.json +1 -1
- package/src/config/pack-size-budget.json +27 -0
- package/src/install/emit_host_rules_cli.ts +2 -1
- package/src/install/ruleInScope.ts +133 -0
- package/src/install/rule_scope.ts +7 -3
- package/src/install/toolDetection.ts +39 -8
- package/src/install/wizard-plan.ts +13 -3
- package/src/scripts/_cli/cmd_conformance.ts +2 -1
- package/src/scripts/_cli/cmd_converge.ts +2 -1
- package/src/scripts/_cli/cmd_doctor.ts +214 -13
- package/src/scripts/_cli/cmd_export.ts +2 -1
- package/src/scripts/_cli/cmd_fleet.ts +2 -1
- package/src/scripts/_cli/cmd_migrate.ts +2 -1
- package/src/scripts/_cli/cmd_preflight.ts +2 -1
- package/src/scripts/_cli/cmd_refresh.ts +2 -1
- package/src/scripts/_cli/cmd_update.ts +2 -1
- package/src/scripts/_cli/cmd_upgrade.ts +2 -1
- package/src/scripts/_cli/cmd_versions.ts +2 -1
- package/src/scripts/_cli/detection_report.ts +480 -0
- package/src/scripts/_dispatch.bash +52 -14
- package/src/scripts/_lib/changelog_eras.ts +103 -9
- package/src/scripts/_lib/environment_detector.ts +441 -0
- package/src/scripts/_lib/global_deploy_inventory.ts +38 -2
- package/src/scripts/_lib/package_root.ts +72 -0
- package/src/scripts/ai_council/config.ts +15 -7
- package/src/scripts/ai_council/modes.ts +68 -2
- package/src/scripts/ai_council/transport_resolver.ts +331 -0
- package/src/scripts/check_bundle_path_leakage.ts +10 -4
- package/src/scripts/check_dependency_floors.ts +153 -0
- package/src/scripts/check_installer_import_purity.ts +295 -0
- package/src/scripts/check_pack_size.ts +188 -0
- package/src/scripts/condense.ts +7 -28
- package/src/scripts/council_cli.ts +6 -2
- package/src/scripts/evaluator_umbrella.sh +34 -1
- package/src/scripts/install-hooks.sh +36 -4
- package/src/scripts/install.ts +210 -5
- package/src/scripts/lint_eval_fixture_citations.ts +113 -0
- package/src/scripts/lint_ui_stack_bundles.ts +201 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
main
|
|
4
|
+
} from "./chunk-XX6TOPD7.js";
|
|
5
|
+
import "./chunk-HJ6DAJHR.js";
|
|
6
|
+
import "./chunk-NDJLNC6Q.js";
|
|
7
|
+
import "./chunk-MCJYCQPF.js";
|
|
8
|
+
import "./chunk-J55WI3RR.js";
|
|
9
|
+
export {
|
|
10
|
+
main
|
|
11
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
GLOBAL_DEPLOY_SOURCES,
|
|
4
|
+
expandWizardSources
|
|
5
|
+
} from "./chunk-EJYIGZ3T.js";
|
|
6
|
+
import "./chunk-TJIAM5FW.js";
|
|
7
|
+
import {
|
|
8
|
+
hasBlockingFinding,
|
|
9
|
+
runPreflight
|
|
10
|
+
} from "./chunk-HYWSRNUX.js";
|
|
11
|
+
import "./chunk-OMIVVCG2.js";
|
|
12
|
+
import "./chunk-523HCFYO.js";
|
|
13
|
+
import {
|
|
14
|
+
resolvePackageRoot
|
|
15
|
+
} from "./chunk-MCJYCQPF.js";
|
|
16
|
+
import "./chunk-OY53J6II.js";
|
|
17
|
+
import "./chunk-J55WI3RR.js";
|
|
18
|
+
|
|
19
|
+
// src/scripts/_cli/cmd_preflight.ts
|
|
20
|
+
import * as os from "node:os";
|
|
21
|
+
import * as path from "node:path";
|
|
22
|
+
import process from "node:process";
|
|
23
|
+
import * as fs from "node:fs";
|
|
24
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
25
|
+
var _HERE = fileURLToPath(import.meta.url);
|
|
26
|
+
var PACKAGE_ROOT = resolvePackageRoot(import.meta.url);
|
|
27
|
+
var USAGE = "usage: cmd_preflight [-h] [--tools a,b,...] [--target DIR] [--json]\n";
|
|
28
|
+
var SEVERITY_SYMBOL = {
|
|
29
|
+
blocking: "\u274C",
|
|
30
|
+
warning: "\u26A0\uFE0F ",
|
|
31
|
+
info: "\u2139\uFE0F "
|
|
32
|
+
};
|
|
33
|
+
var ArgError = class extends Error {
|
|
34
|
+
};
|
|
35
|
+
function parse(argv) {
|
|
36
|
+
const opts = {
|
|
37
|
+
tools: Object.keys(GLOBAL_DEPLOY_SOURCES),
|
|
38
|
+
target: os.homedir(),
|
|
39
|
+
json: false
|
|
40
|
+
};
|
|
41
|
+
let i = 0;
|
|
42
|
+
while (i < argv.length) {
|
|
43
|
+
const a = argv[i];
|
|
44
|
+
if (a === "-h" || a === "--help") {
|
|
45
|
+
process.stdout.write(USAGE);
|
|
46
|
+
process.exit(0);
|
|
47
|
+
}
|
|
48
|
+
if (a === "--json") {
|
|
49
|
+
opts.json = true;
|
|
50
|
+
} else if (a === "--tools" || a.startsWith("--tools=")) {
|
|
51
|
+
let raw;
|
|
52
|
+
if (a.includes("=")) {
|
|
53
|
+
raw = a.slice(a.indexOf("=") + 1);
|
|
54
|
+
} else {
|
|
55
|
+
raw = String(argv[i + 1] ?? "");
|
|
56
|
+
i += 1;
|
|
57
|
+
}
|
|
58
|
+
const list = raw.split(",").map((t) => t.trim()).filter((t) => t.length > 0 && t !== "all");
|
|
59
|
+
if (list.length > 0) {
|
|
60
|
+
opts.tools = list;
|
|
61
|
+
}
|
|
62
|
+
} else if (a === "--target" || a.startsWith("--target=")) {
|
|
63
|
+
if (a.includes("=")) {
|
|
64
|
+
opts.target = a.slice(a.indexOf("=") + 1);
|
|
65
|
+
} else {
|
|
66
|
+
opts.target = String(argv[i + 1] ?? "");
|
|
67
|
+
i += 1;
|
|
68
|
+
}
|
|
69
|
+
if (!opts.target) {
|
|
70
|
+
throw new ArgError("--target expects a value");
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
throw new ArgError(`unrecognized argument ${a}`);
|
|
74
|
+
}
|
|
75
|
+
i += 1;
|
|
76
|
+
}
|
|
77
|
+
return opts;
|
|
78
|
+
}
|
|
79
|
+
function main(argv = null) {
|
|
80
|
+
let opts;
|
|
81
|
+
try {
|
|
82
|
+
opts = parse(argv !== null ? Array.from(argv) : process.argv.slice(2));
|
|
83
|
+
} catch (exc) {
|
|
84
|
+
if (exc instanceof ArgError) {
|
|
85
|
+
process.stderr.write(USAGE);
|
|
86
|
+
process.stderr.write(`cmd_preflight: error: ${exc.message}
|
|
87
|
+
`);
|
|
88
|
+
return 2;
|
|
89
|
+
}
|
|
90
|
+
throw exc;
|
|
91
|
+
}
|
|
92
|
+
const policy = {
|
|
93
|
+
force: false,
|
|
94
|
+
interactive: false,
|
|
95
|
+
knownPaths: /* @__PURE__ */ new Set(),
|
|
96
|
+
knownPointers: /* @__PURE__ */ new Set(),
|
|
97
|
+
defaultStrategy: "skip"
|
|
98
|
+
};
|
|
99
|
+
const sources = expandWizardSources({
|
|
100
|
+
toolIds: opts.tools,
|
|
101
|
+
packageRoot: PACKAGE_ROOT
|
|
102
|
+
});
|
|
103
|
+
const findings = runPreflight({
|
|
104
|
+
target: "global",
|
|
105
|
+
root: opts.target,
|
|
106
|
+
sources,
|
|
107
|
+
policy
|
|
108
|
+
});
|
|
109
|
+
if (opts.json) {
|
|
110
|
+
process.stdout.write(
|
|
111
|
+
`${JSON.stringify({ target: opts.target, tools: opts.tools, findings }, null, 2)}
|
|
112
|
+
`
|
|
113
|
+
);
|
|
114
|
+
} else {
|
|
115
|
+
process.stdout.write(` \u{1F50E} pre-flight: ${opts.tools.length} tool(s) against ${opts.target}
|
|
116
|
+
`);
|
|
117
|
+
if (findings.length === 0) {
|
|
118
|
+
process.stdout.write(" \u2705 no findings\n");
|
|
119
|
+
}
|
|
120
|
+
for (const f of findings) {
|
|
121
|
+
const sym = SEVERITY_SYMBOL[f.severity];
|
|
122
|
+
process.stdout.write(` ${sym} ${f.id}: ${f.message}
|
|
123
|
+
`);
|
|
124
|
+
if (f.severity !== "info" && f.remedy) {
|
|
125
|
+
process.stdout.write(` fix: ${f.remedy}
|
|
126
|
+
`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return hasBlockingFinding(findings) ? 1 : 0;
|
|
131
|
+
}
|
|
132
|
+
function _isCliEntry() {
|
|
133
|
+
if (process.argv[1] === void 0) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
const argvUrl = pathToFileURL(path.resolve(process.argv[1])).href;
|
|
137
|
+
if (import.meta.url === argvUrl) {
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
const here = fs.realpathSync(fileURLToPath(import.meta.url));
|
|
142
|
+
const argv = fs.realpathSync(path.resolve(process.argv[1]));
|
|
143
|
+
return here === argv;
|
|
144
|
+
} catch {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (_isCliEntry() || process.argv[1] === _HERE) {
|
|
149
|
+
process.exitCode = main(process.argv.slice(2));
|
|
150
|
+
}
|
|
151
|
+
export {
|
|
152
|
+
main
|
|
153
|
+
};
|
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
PROJECT_BRIDGE_MARKERS
|
|
4
|
+
} from "./chunk-QFKQLQ7X.js";
|
|
5
|
+
import "./chunk-XX6TOPD7.js";
|
|
6
|
+
import "./chunk-EJYIGZ3T.js";
|
|
7
|
+
import {
|
|
8
|
+
manifest_path,
|
|
9
|
+
read_manifest
|
|
10
|
+
} from "./chunk-A3HJ6NTI.js";
|
|
11
|
+
import "./chunk-GRRPEPRN.js";
|
|
12
|
+
import "./chunk-TJIAM5FW.js";
|
|
13
|
+
import {
|
|
14
|
+
resolve_project_root
|
|
15
|
+
} from "./chunk-HJ6DAJHR.js";
|
|
16
|
+
import "./chunk-NDJLNC6Q.js";
|
|
17
|
+
import "./chunk-523HCFYO.js";
|
|
18
|
+
import "./chunk-MCJYCQPF.js";
|
|
19
|
+
import "./chunk-OY53J6II.js";
|
|
20
|
+
import "./chunk-J55WI3RR.js";
|
|
21
|
+
|
|
22
|
+
// src/scripts/_cli/cmd_prune.ts
|
|
23
|
+
import * as crypto from "node:crypto";
|
|
24
|
+
import * as fs from "node:fs";
|
|
25
|
+
import * as path from "node:path";
|
|
26
|
+
import process from "node:process";
|
|
27
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
28
|
+
var ArgparseExit = class extends Error {
|
|
29
|
+
code;
|
|
30
|
+
constructor(code) {
|
|
31
|
+
super(`ArgparseExit(${code})`);
|
|
32
|
+
this.name = "ArgparseExit";
|
|
33
|
+
this.code = code;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var _stdout = { write: (t) => process.stdout.write(t) };
|
|
37
|
+
var _stderr = { write: (t) => process.stderr.write(t) };
|
|
38
|
+
function _print(out, line = "") {
|
|
39
|
+
out.write(line + "\n");
|
|
40
|
+
}
|
|
41
|
+
function expanduser(p) {
|
|
42
|
+
if (p === "~" || p.startsWith("~/")) {
|
|
43
|
+
const home = process.env["HOME"] ?? process.env["USERPROFILE"] ?? "";
|
|
44
|
+
return home + p.slice(1);
|
|
45
|
+
}
|
|
46
|
+
return p;
|
|
47
|
+
}
|
|
48
|
+
function _exists(p) {
|
|
49
|
+
try {
|
|
50
|
+
fs.lstatSync(p);
|
|
51
|
+
return true;
|
|
52
|
+
} catch {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function _listOf(value) {
|
|
57
|
+
return Array.isArray(value) ? value : [];
|
|
58
|
+
}
|
|
59
|
+
function _jsonStrAscii(s) {
|
|
60
|
+
let out = '"';
|
|
61
|
+
for (let i = 0; i < s.length; i++) {
|
|
62
|
+
const code = s.charCodeAt(i);
|
|
63
|
+
const ch = s[i];
|
|
64
|
+
switch (ch) {
|
|
65
|
+
case '"':
|
|
66
|
+
out += '\\"';
|
|
67
|
+
break;
|
|
68
|
+
case "\\":
|
|
69
|
+
out += "\\\\";
|
|
70
|
+
break;
|
|
71
|
+
case "\n":
|
|
72
|
+
out += "\\n";
|
|
73
|
+
break;
|
|
74
|
+
case "\r":
|
|
75
|
+
out += "\\r";
|
|
76
|
+
break;
|
|
77
|
+
case " ":
|
|
78
|
+
out += "\\t";
|
|
79
|
+
break;
|
|
80
|
+
case "\b":
|
|
81
|
+
out += "\\b";
|
|
82
|
+
break;
|
|
83
|
+
case "\f":
|
|
84
|
+
out += "\\f";
|
|
85
|
+
break;
|
|
86
|
+
default:
|
|
87
|
+
if (code < 32 || code > 126) {
|
|
88
|
+
out += "\\u" + code.toString(16).padStart(4, "0");
|
|
89
|
+
} else {
|
|
90
|
+
out += ch;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return out + '"';
|
|
95
|
+
}
|
|
96
|
+
function _jsonScalarAscii(value) {
|
|
97
|
+
if (value === null || value === void 0) return "null";
|
|
98
|
+
if (typeof value === "boolean") return value ? "true" : "false";
|
|
99
|
+
if (typeof value === "number") {
|
|
100
|
+
if (!Number.isFinite(value)) {
|
|
101
|
+
if (Number.isNaN(value)) return "NaN";
|
|
102
|
+
return value > 0 ? "Infinity" : "-Infinity";
|
|
103
|
+
}
|
|
104
|
+
return String(value);
|
|
105
|
+
}
|
|
106
|
+
if (typeof value === "string") return _jsonStrAscii(value);
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
function _dumpIndentAscii(value, indent, depth) {
|
|
110
|
+
const scalar = _jsonScalarAscii(value);
|
|
111
|
+
if (scalar !== null) return scalar;
|
|
112
|
+
const pad = " ".repeat(indent * (depth + 1));
|
|
113
|
+
const closePad = " ".repeat(indent * depth);
|
|
114
|
+
if (Array.isArray(value)) {
|
|
115
|
+
if (value.length === 0) return "[]";
|
|
116
|
+
const items = value.map((v) => pad + _dumpIndentAscii(v, indent, depth + 1));
|
|
117
|
+
return `[
|
|
118
|
+
${items.join(",\n")}
|
|
119
|
+
${closePad}]`;
|
|
120
|
+
}
|
|
121
|
+
if (typeof value === "object" && value !== null) {
|
|
122
|
+
const obj = value;
|
|
123
|
+
const keys = Object.keys(obj);
|
|
124
|
+
if (keys.length === 0) return "{}";
|
|
125
|
+
const items = keys.map(
|
|
126
|
+
(k) => `${pad}${_jsonStrAscii(k)}: ${_dumpIndentAscii(obj[k], indent, depth + 1)}`
|
|
127
|
+
);
|
|
128
|
+
return `{
|
|
129
|
+
${items.join(",\n")}
|
|
130
|
+
${closePad}}`;
|
|
131
|
+
}
|
|
132
|
+
return _jsonStrAscii(String(value));
|
|
133
|
+
}
|
|
134
|
+
function _jsonDumpsIndentAscii(value, indent) {
|
|
135
|
+
return _dumpIndentAscii(value, indent, 0);
|
|
136
|
+
}
|
|
137
|
+
function _resolve_project_root(arg) {
|
|
138
|
+
const [root] = resolve_project_root(arg);
|
|
139
|
+
return root;
|
|
140
|
+
}
|
|
141
|
+
function _load_manifest(project_root, opts) {
|
|
142
|
+
const manifest_path2 = manifest_path(project_root);
|
|
143
|
+
const manifest = read_manifest(manifest_path2);
|
|
144
|
+
if (manifest === null) {
|
|
145
|
+
if (opts.force_empty) {
|
|
146
|
+
return [null, /* @__PURE__ */ new Set()];
|
|
147
|
+
}
|
|
148
|
+
return [null, null];
|
|
149
|
+
}
|
|
150
|
+
const tools = _listOf(manifest["tools"]) ?? [];
|
|
151
|
+
const declared = /* @__PURE__ */ new Set();
|
|
152
|
+
for (const e of tools) {
|
|
153
|
+
const name = e["name"];
|
|
154
|
+
if (name && e["scope"] === "project" && (e["status"] ?? "installed") === "installed") {
|
|
155
|
+
declared.add(String(name));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return [manifest, declared];
|
|
159
|
+
}
|
|
160
|
+
function _resolve_path(project_root, raw) {
|
|
161
|
+
const p = expanduser(raw);
|
|
162
|
+
if (!path.isAbsolute(p)) {
|
|
163
|
+
return path.join(project_root, p);
|
|
164
|
+
}
|
|
165
|
+
return p;
|
|
166
|
+
}
|
|
167
|
+
function _sha256(p) {
|
|
168
|
+
try {
|
|
169
|
+
return crypto.createHash("sha256").update(fs.readFileSync(p)).digest("hex");
|
|
170
|
+
} catch {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function _orphaned(project_root, manifest, declared, opts = {}) {
|
|
175
|
+
const resume_uninstall = opts.resume_uninstall ?? false;
|
|
176
|
+
const out = [];
|
|
177
|
+
const seen = /* @__PURE__ */ new Set();
|
|
178
|
+
if (!resume_uninstall) {
|
|
179
|
+
for (const tool_id of Object.keys(PROJECT_BRIDGE_MARKERS)) {
|
|
180
|
+
const rel = PROJECT_BRIDGE_MARKERS[tool_id];
|
|
181
|
+
if (declared.has(tool_id)) {
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
const target = path.join(project_root, rel);
|
|
185
|
+
if (!_exists(target)) {
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
out.push([tool_id, target, null, null]);
|
|
189
|
+
seen.add(_realpath(target));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (manifest === null) {
|
|
193
|
+
return out;
|
|
194
|
+
}
|
|
195
|
+
for (const tool of _listOf(manifest["tools"])) {
|
|
196
|
+
if (tool["scope"] !== "project") {
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
const files = _listOf(tool["files"]);
|
|
200
|
+
if (!files.length) {
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
const tool_id = String(tool["name"] ?? "");
|
|
204
|
+
const status = tool["status"] ?? "installed";
|
|
205
|
+
if (resume_uninstall) {
|
|
206
|
+
if (status !== "uninstalling") {
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
} else if (status === "installed" && declared.has(tool_id)) {
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
for (const entry of files) {
|
|
213
|
+
const kind = entry["kind"];
|
|
214
|
+
if (kind !== "bridge" && kind !== "marker" && kind !== "deployed") {
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
const raw = entry["path"] ?? "";
|
|
218
|
+
if (!raw) {
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
const target = _resolve_path(project_root, raw);
|
|
222
|
+
const resolved = _realpath(target);
|
|
223
|
+
if (seen.has(resolved) || !_exists(target)) {
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
out.push([tool_id, target, kind, entry["sha256"] ?? null]);
|
|
227
|
+
seen.add(resolved);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return out;
|
|
231
|
+
}
|
|
232
|
+
function _realpath(p) {
|
|
233
|
+
try {
|
|
234
|
+
return fs.realpathSync(p);
|
|
235
|
+
} catch {
|
|
236
|
+
return path.resolve(p);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function _classify(target, expected_sha) {
|
|
240
|
+
if (expected_sha === null) {
|
|
241
|
+
return ["orphan", null];
|
|
242
|
+
}
|
|
243
|
+
const actual = _sha256(target);
|
|
244
|
+
if (actual === null || actual !== expected_sha) {
|
|
245
|
+
return ["modified", actual];
|
|
246
|
+
}
|
|
247
|
+
return ["orphan", actual];
|
|
248
|
+
}
|
|
249
|
+
function _remove(target, opts) {
|
|
250
|
+
if (opts.dry_run) {
|
|
251
|
+
return [true, "would remove"];
|
|
252
|
+
}
|
|
253
|
+
try {
|
|
254
|
+
fs.unlinkSync(target);
|
|
255
|
+
return [true, "removed"];
|
|
256
|
+
} catch (exc) {
|
|
257
|
+
const e = exc;
|
|
258
|
+
if (e && e.code === "EISDIR") {
|
|
259
|
+
return [false, "\u274C is a directory (refusing \u2014 use uninstall --purge)"];
|
|
260
|
+
}
|
|
261
|
+
return [false, `\u274C failed (${_pyOSErrorStr(e, target)})`];
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
function _pyOSErrorStr(e, filename) {
|
|
265
|
+
const errno = typeof e.errno === "number" ? Math.abs(e.errno) : null;
|
|
266
|
+
const STRERROR = {
|
|
267
|
+
EPERM: "Operation not permitted",
|
|
268
|
+
EISDIR: "Is a directory",
|
|
269
|
+
EACCES: "Permission denied",
|
|
270
|
+
ENOENT: "No such file or directory",
|
|
271
|
+
EBUSY: "Device or resource busy",
|
|
272
|
+
ENOTEMPTY: "Directory not empty"
|
|
273
|
+
};
|
|
274
|
+
const strerror = e.code && STRERROR[e.code] || (e.message ?? String(e));
|
|
275
|
+
if (errno !== null) {
|
|
276
|
+
return `[Errno ${errno}] ${strerror}: '${filename}'`;
|
|
277
|
+
}
|
|
278
|
+
return strerror;
|
|
279
|
+
}
|
|
280
|
+
function _parse(argv) {
|
|
281
|
+
const prog = "agent-config prune";
|
|
282
|
+
const usage = "usage: agent-config prune [-h] [--project PROJECT] [--dry-run] [--json]\n [--all-missing-lock] [--resume-uninstall]\n";
|
|
283
|
+
const emitError = (msg) => {
|
|
284
|
+
_stderr.write(usage);
|
|
285
|
+
_stderr.write(`${prog}: error: ${msg}
|
|
286
|
+
`);
|
|
287
|
+
throw new ArgparseExit(2);
|
|
288
|
+
};
|
|
289
|
+
const opts = {
|
|
290
|
+
project: null,
|
|
291
|
+
dry_run: false,
|
|
292
|
+
json: false,
|
|
293
|
+
all_missing_lock: false,
|
|
294
|
+
resume_uninstall: false
|
|
295
|
+
};
|
|
296
|
+
let i = 0;
|
|
297
|
+
while (i < argv.length) {
|
|
298
|
+
const tok = argv[i];
|
|
299
|
+
const flag = tok.includes("=") ? tok.slice(0, tok.indexOf("=")) : tok;
|
|
300
|
+
if (flag === "-h" || flag === "--help") {
|
|
301
|
+
_stdout.write(usage);
|
|
302
|
+
throw new ArgparseExit(0);
|
|
303
|
+
} else if (flag === "--project") {
|
|
304
|
+
const eq = tok.indexOf("=");
|
|
305
|
+
if (eq >= 0) {
|
|
306
|
+
opts.project = tok.slice(eq + 1);
|
|
307
|
+
i += 1;
|
|
308
|
+
} else {
|
|
309
|
+
const val = argv[i + 1];
|
|
310
|
+
if (val === void 0) {
|
|
311
|
+
emitError("argument --project: expected one argument");
|
|
312
|
+
}
|
|
313
|
+
opts.project = val;
|
|
314
|
+
i += 2;
|
|
315
|
+
}
|
|
316
|
+
} else if (flag === "--dry-run") {
|
|
317
|
+
opts.dry_run = true;
|
|
318
|
+
i += 1;
|
|
319
|
+
} else if (flag === "--json") {
|
|
320
|
+
opts.json = true;
|
|
321
|
+
i += 1;
|
|
322
|
+
} else if (flag === "--all-missing-lock") {
|
|
323
|
+
opts.all_missing_lock = true;
|
|
324
|
+
i += 1;
|
|
325
|
+
} else if (flag === "--resume-uninstall") {
|
|
326
|
+
opts.resume_uninstall = true;
|
|
327
|
+
i += 1;
|
|
328
|
+
} else {
|
|
329
|
+
emitError(`unrecognized arguments: ${tok}`);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return opts;
|
|
333
|
+
}
|
|
334
|
+
function _relativeToOr(target, base) {
|
|
335
|
+
if (!path.isAbsolute(target)) {
|
|
336
|
+
return target;
|
|
337
|
+
}
|
|
338
|
+
const rel = path.relative(base, target);
|
|
339
|
+
if (rel.startsWith("..") || path.isAbsolute(rel)) {
|
|
340
|
+
return target;
|
|
341
|
+
}
|
|
342
|
+
return rel;
|
|
343
|
+
}
|
|
344
|
+
function _emit_text(project_root, candidates, results, opts, out) {
|
|
345
|
+
const prefix = opts.dry_run ? "[dry-run] " : "";
|
|
346
|
+
if (!candidates.length) {
|
|
347
|
+
_print(out, `\u2705 ${prefix}no orphaned bridges in ${project_root}`);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
const modified = results.filter((r) => r[2] === "modified");
|
|
351
|
+
const orphans = results.filter((r) => r[2] === "orphan");
|
|
352
|
+
_print(
|
|
353
|
+
out,
|
|
354
|
+
`${prefix}${orphans.length} orphaned, ${modified.length} modified bridge(s) under ${project_root}:`
|
|
355
|
+
);
|
|
356
|
+
for (const [tool_id, target, state, ok, msg] of results) {
|
|
357
|
+
const rel = _relativeToOr(target, project_root);
|
|
358
|
+
if (state === "modified") {
|
|
359
|
+
_print(out, ` \u26A0 ${tool_id}: modified \u2014 skipped ${rel}`);
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
const mark = ok ? "\xB7" : "!";
|
|
363
|
+
_print(out, ` ${mark} ${tool_id}: ${msg} ${rel}`);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
function _emit_json(project_root, results, opts, out) {
|
|
367
|
+
const payload = {
|
|
368
|
+
project_root,
|
|
369
|
+
dry_run: opts.dry_run,
|
|
370
|
+
orphans: results.map(([tool_id, target, state, ok, msg]) => ({
|
|
371
|
+
tool: tool_id,
|
|
372
|
+
path: _relativeToOr(target, project_root),
|
|
373
|
+
state,
|
|
374
|
+
ok,
|
|
375
|
+
status: msg
|
|
376
|
+
}))
|
|
377
|
+
};
|
|
378
|
+
_print(out, _jsonDumpsIndentAscii(payload, 2));
|
|
379
|
+
}
|
|
380
|
+
function main(argv = null) {
|
|
381
|
+
const opts = _parse(argv !== null ? [...argv] : process.argv.slice(2));
|
|
382
|
+
const project_root = _resolve_project_root(opts.project);
|
|
383
|
+
const [manifest, declared] = _load_manifest(project_root, {
|
|
384
|
+
force_empty: opts.all_missing_lock
|
|
385
|
+
});
|
|
386
|
+
if (declared === null) {
|
|
387
|
+
const manifest_path2 = manifest_path(project_root);
|
|
388
|
+
_print(_stderr, `\u274C no project lockfile at ${manifest_path2}`);
|
|
389
|
+
_print(
|
|
390
|
+
_stderr,
|
|
391
|
+
" pass --all-missing-lock to prune every known marker (destructive)"
|
|
392
|
+
);
|
|
393
|
+
return 1;
|
|
394
|
+
}
|
|
395
|
+
const candidates = _orphaned(project_root, manifest, declared, {
|
|
396
|
+
resume_uninstall: opts.resume_uninstall
|
|
397
|
+
});
|
|
398
|
+
const results = [];
|
|
399
|
+
for (const [tool_id, target, _kind, expected_sha] of candidates) {
|
|
400
|
+
const [state] = _classify(target, expected_sha);
|
|
401
|
+
if (state === "modified") {
|
|
402
|
+
results.push([tool_id, target, state, true, "skipped (modified)"]);
|
|
403
|
+
continue;
|
|
404
|
+
}
|
|
405
|
+
const [ok, msg] = _remove(target, { dry_run: opts.dry_run });
|
|
406
|
+
results.push([tool_id, target, state, ok, msg]);
|
|
407
|
+
}
|
|
408
|
+
if (opts.json) {
|
|
409
|
+
_emit_json(project_root, results, { dry_run: opts.dry_run }, _stdout);
|
|
410
|
+
} else {
|
|
411
|
+
_emit_text(project_root, candidates, results, { dry_run: opts.dry_run }, _stdout);
|
|
412
|
+
}
|
|
413
|
+
const failed = results.filter((r) => !r[2]);
|
|
414
|
+
return failed.length ? 1 : 0;
|
|
415
|
+
}
|
|
416
|
+
var _HERE = fileURLToPath(import.meta.url);
|
|
417
|
+
function _isCliEntry() {
|
|
418
|
+
if (process.argv[1] === void 0) {
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
const argvUrl = pathToFileURL(path.resolve(process.argv[1])).href;
|
|
422
|
+
if (import.meta.url === argvUrl) {
|
|
423
|
+
return true;
|
|
424
|
+
}
|
|
425
|
+
try {
|
|
426
|
+
const here = fs.realpathSync(fileURLToPath(import.meta.url));
|
|
427
|
+
const argv = fs.realpathSync(path.resolve(process.argv[1]));
|
|
428
|
+
return here === argv;
|
|
429
|
+
} catch {
|
|
430
|
+
return false;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
if (_isCliEntry() || process.argv[1] === _HERE) {
|
|
434
|
+
try {
|
|
435
|
+
process.exitCode = main(process.argv.slice(2));
|
|
436
|
+
} catch (exc) {
|
|
437
|
+
if (exc instanceof ArgparseExit) {
|
|
438
|
+
process.exitCode = exc.code;
|
|
439
|
+
} else {
|
|
440
|
+
throw exc;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
export {
|
|
445
|
+
main
|
|
446
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
ArgparseExit,
|
|
5
|
+
_default_runner,
|
|
6
|
+
_is_source_repo,
|
|
7
|
+
_parse,
|
|
8
|
+
_refresh_global,
|
|
9
|
+
_refresh_project,
|
|
10
|
+
_remove_legacy_consumer_bridge_marker,
|
|
11
|
+
_sync_gitattributes,
|
|
12
|
+
_sync_gitignore,
|
|
13
|
+
main
|
|
14
|
+
} from "./chunk-736JCWLM.js";
|
|
15
|
+
import "./chunk-MCJYCQPF.js";
|
|
16
|
+
import "./chunk-J55WI3RR.js";
|
|
17
|
+
export {
|
|
18
|
+
ArgparseExit,
|
|
19
|
+
_default_runner,
|
|
20
|
+
_is_source_repo,
|
|
21
|
+
_parse,
|
|
22
|
+
_refresh_global,
|
|
23
|
+
_refresh_project,
|
|
24
|
+
_remove_legacy_consumer_bridge_marker,
|
|
25
|
+
_sync_gitattributes,
|
|
26
|
+
_sync_gitignore,
|
|
27
|
+
main
|
|
28
|
+
};
|