@event4u/agent-config 14.18.0 → 14.19.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/.augment-plugin/marketplace.json +3 -3
- package/.augment-plugin/plugin.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +169 -130
- package/README.md +71 -149
- package/dist/agent-src/README.md +1 -1
- package/dist/agent-src/commands/agent-handoff.md +2 -2
- package/dist/agent-src/commands/review/changes.md +19 -19
- package/dist/agent-src/commands/review.md +2 -2
- package/dist/agent-src/contexts/execution/host-capability-manifest.md +30 -3
- package/dist/agent-src/rules/autonomous-execution.md +1 -1
- package/dist/agent-src/rules/git-history-discipline.md +2 -2
- package/dist/agent-src/rules/guidelines.md +1 -1
- package/dist/agent-src/rules/session-canary.md +2 -2
- package/dist/agent-src/rules/token-efficiency.md +1 -1
- package/dist/agent-src/skills/adversarial-review/SKILL.md +0 -8
- package/dist/agent-src/skills/canvas-design/SKILL.md +1 -1
- package/dist/agent-src/skills/design-intelligence/SKILL.md +1 -1
- package/dist/agent-src/skills/design-intelligence/data/app-interface.csv +1 -1
- package/dist/agent-src/skills/design-intelligence/data/motion.csv +17 -17
- package/dist/agent-src/skills/design-intelligence/data/ux-guidelines.csv +2 -2
- package/dist/agent-src/skills/design-intelligence/references/context-and-registers.md +17 -0
- package/dist/agent-src/skills/design-intelligence/references/design-rules-checklist.md +4 -4
- package/dist/agent-src/skills/design-review/SKILL.md +1 -1
- package/dist/agent-src/skills/design-variations/SKILL.md +1 -1
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +1 -1
- package/dist/agent-src/skills/fe-design/SKILL.md +32 -5
- package/dist/agent-src/skills/fe-design/references/craft-floor.md +7 -0
- package/dist/agent-src/skills/fe-design/references/design-patterns.md +47 -2
- package/dist/agent-src/skills/laravel-scheduling/SKILL.md +3 -1
- package/dist/agent-src/skills/project-analyzer/SKILL.md +0 -6
- package/dist/agent-src/skills/react-native-setup/SKILL.md +3 -3
- package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +1 -1
- package/dist/agent-src/skills/sequential-thinking/SKILL.md +18 -8
- package/dist/agent-src/skills/tailwind-engineer/SKILL.md +1 -1
- package/dist/agent-src/skills/ui-apply-generic/SKILL.md +1 -1
- package/dist/agent-src/skills/ui-component-architect/SKILL.md +1 -1
- package/dist/agent-src/skills/using-git-worktrees/SKILL.md +17 -2
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/cli/commands/recordTriggerEval.js +2 -2
- package/dist/cli/main.js +1 -1
- package/dist/cli-delegate/{chunk-AKJGUQNO.js → chunk-GZTMRYCN.js} +405 -341
- package/dist/cli-delegate/{chunk-7RXIKF62.js → chunk-IDHUQIXP.js} +283 -132
- package/dist/cli-delegate/cmd_adr_effective.js +318 -81
- package/dist/cli-delegate/cmd_conformance.js +420 -16
- package/dist/cli-delegate/cmd_doctor.js +1 -1
- package/dist/cli-delegate/cmd_export.js +1 -1
- package/dist/cli-delegate/cmd_handoff.js +1 -1
- package/dist/cli-delegate/cmd_prune.js +1 -1
- package/dist/cli-delegate/cmd_route_audit.js +1 -1
- package/dist/cli-delegate/cmd_settings_migrate.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +1 -1
- package/dist/cli-delegate/cmd_uninstall.js +1 -1
- package/dist/cli-delegate/cmd_validate.js +1 -1
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +28 -27
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +1 -1
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +2 -2
- package/dist/discovery/trust-report.md +1 -1
- package/dist/discovery/workspaces.json +2 -2
- package/dist/hooks/dispatch.js +2132 -1462
- package/dist/install/install.mjs +588 -527
- package/dist/mcp/registry-manifest.json +1 -1
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +1619 -1045
- package/dist/scripts/_lib/model_tier.js +1 -1
- package/docs/guidelines/agent-infra/evaluator-independence-mechanics.md +1 -1
- package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +1 -1
- package/docs/guidelines/design-antipatterns.md +87 -64
- package/package.json +1 -1
- package/src/agent-src/README.md +1 -1
- package/src/config/ci-local-parity.yml +6 -0
- package/src/config/gate-coverage.yml +170 -0
- package/src/config/gate-violation-baselines.json +3 -3
- package/src/config/release-gate-locality.yml +12 -0
- package/src/scripts/_cli/cmd_doctor.ts +2 -2
- package/src/scripts/_cli/cmd_handoff.ts +1 -1
- package/src/scripts/_cli/cmd_update.ts +1 -1
- package/src/scripts/_cli/cmd_versions.ts +1 -1
- package/src/scripts/_lib/adr_frontmatter.ts +44 -0
- package/src/scripts/_lib/consequence_objects.ts +152 -0
- package/src/scripts/_lib/exec_evidence.ts +7 -0
- package/src/scripts/_lib/global_deploy_inventory.ts +2 -2
- package/src/scripts/_lib/host_permission_checks.ts +251 -0
- package/src/scripts/_lib/model_tier.ts +1 -1
- package/src/scripts/_lib/obligation_frequency.ts +2 -2
- package/src/scripts/_lib/release_highlights.ts +93 -0
- package/src/scripts/_lib/release_material.ts +64 -1
- package/src/scripts/_lib/runtime_journal.ts +26 -3
- package/src/scripts/_lib/runtime_wiring_checks.ts +12 -1
- package/src/scripts/_lib/session_register.ts +11 -6
- package/src/scripts/_lib/sqlite_schema.ts +22 -0
- package/src/scripts/_lib/surface.ts +86 -0
- package/src/scripts/_lib/ui_authority.ts +116 -0
- package/src/scripts/adr/regenerate_index.ts +54 -1
- package/src/scripts/adr_cite_check.ts +71 -15
- package/src/scripts/ai_council/clients.ts +1 -1
- package/src/scripts/autonomy_friction_corpus.ts +229 -0
- package/src/scripts/build_proof.ts +15 -2
- package/src/scripts/check_beta_review_markers.ts +141 -17
- package/src/scripts/check_enforcement_coverage.ts +1 -1
- package/src/scripts/check_enforcement_denominator.ts +121 -11
- package/src/scripts/check_finding_dispositions.ts +66 -9
- package/src/scripts/check_gate_coverage.ts +96 -0
- package/src/scripts/check_release_highlights.ts +74 -1
- package/src/scripts/check_skill_activation_claim.ts +179 -0
- package/src/scripts/check_trigger_evals.ts +1 -1
- package/src/scripts/conformance_scan.ts +44 -3
- package/src/scripts/explain_run.ts +1 -1
- package/src/scripts/generate_capability_matrix.ts +1 -1
- package/src/scripts/git_authorization_hook.ts +75 -1
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +14 -11
- package/src/scripts/hooks/augment-dispatcher.sh +1 -1
- package/src/scripts/hooks/category_a.ts +291 -0
- package/src/scripts/hooks/cline-dispatcher.sh +1 -1
- package/src/scripts/hooks/cursor-dispatcher.sh +11 -5
- package/src/scripts/hooks/dispatch_hook.ts +17 -22
- package/src/scripts/hooks/git_command_classifier.ts +156 -1
- package/src/scripts/hooks/host_lowering.ts +215 -0
- package/src/scripts/hooks/host_lowering.yaml +185 -0
- package/src/scripts/hooks/host_semantics.ts +105 -37
- package/src/scripts/hooks/journal_record_hook.ts +10 -0
- package/src/scripts/hooks/permission_gate.ts +117 -0
- package/src/scripts/hooks_status.ts +12 -10
- package/src/scripts/install.ts +53 -82
- package/src/scripts/install_anthropic_key.sh +2 -2
- package/src/scripts/lint_design_antipattern_parity.ts +80 -0
- package/src/scripts/lint_evidence_artifacts.ts +45 -1
- package/src/scripts/lint_hook_manifest.ts +87 -3
- package/src/scripts/lint_motion_authority_drift.ts +731 -0
- package/src/scripts/lint_readme_size.ts +158 -12
- package/src/scripts/lint_reasoning_fixtures.ts +216 -0
- package/src/scripts/lint_skill_trigger_contradiction.ts +161 -0
- package/src/scripts/measure_sibling_naming.ts +150 -0
- package/src/scripts/redact_hook_capture.ts +1 -1
- package/src/scripts/report_skill_activation.ts +319 -7
- package/src/scripts/schemas/review-findings.schema.json +5 -0
- package/src/scripts/schemas/skill.schema.json +2 -2
- package/src/scripts/session_canary_hook.ts +1 -1
- package/src/scripts/session_register_hook.ts +4 -3
- package/src/scripts/trigger_eval_grandfather.json +5 -1
- package/src/scripts/validate_agent_settings.ts +1 -1
|
@@ -272,11 +272,11 @@ function subtract_pointers(doc, entries) {
|
|
|
272
272
|
// src/scripts/install.ts
|
|
273
273
|
import { spawn, spawnSync } from "node:child_process";
|
|
274
274
|
import * as crypto3 from "node:crypto";
|
|
275
|
-
import * as
|
|
275
|
+
import * as fs12 from "node:fs";
|
|
276
276
|
import * as os3 from "node:os";
|
|
277
|
-
import * as
|
|
277
|
+
import * as path10 from "node:path";
|
|
278
278
|
import process2 from "node:process";
|
|
279
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
279
|
+
import { fileURLToPath as fileURLToPath2, pathToFileURL } from "node:url";
|
|
280
280
|
|
|
281
281
|
// src/scripts/_lib/claude_builtin_names.ts
|
|
282
282
|
var _CURRENT = [
|
|
@@ -1151,27 +1151,121 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
|
|
|
1151
1151
|
return written;
|
|
1152
1152
|
}
|
|
1153
1153
|
|
|
1154
|
+
// src/scripts/hooks/host_lowering.ts
|
|
1155
|
+
var import_yaml2 = __toESM(require_dist(), 1);
|
|
1156
|
+
import * as fs6 from "node:fs";
|
|
1157
|
+
import * as path6 from "node:path";
|
|
1158
|
+
import { fileURLToPath } from "node:url";
|
|
1159
|
+
var _IN_BUNDLE = true;
|
|
1160
|
+
var _REPO_ROOT = path6.resolve(
|
|
1161
|
+
path6.dirname(fileURLToPath(import.meta.url)),
|
|
1162
|
+
..._IN_BUNDLE ? ["..", ".."] : ["..", "..", ".."]
|
|
1163
|
+
);
|
|
1164
|
+
var HOST_LOWERING_PATH = path6.join(_REPO_ROOT, "src", "scripts", "hooks", "host_lowering.yaml");
|
|
1165
|
+
var DEFAULT_SURFACE = "any";
|
|
1166
|
+
function _asString(v) {
|
|
1167
|
+
if (v === null || v === void 0) return null;
|
|
1168
|
+
if (v instanceof Date) return v.toISOString().slice(0, 10);
|
|
1169
|
+
return String(v);
|
|
1170
|
+
}
|
|
1171
|
+
function _parse(text) {
|
|
1172
|
+
const raw = (0, import_yaml2.parse)(text);
|
|
1173
|
+
const hostsRaw = raw?.["hosts"];
|
|
1174
|
+
if (typeof hostsRaw !== "object" || hostsRaw === null) {
|
|
1175
|
+
throw new Error("host_lowering.yaml: missing `hosts:` map");
|
|
1176
|
+
}
|
|
1177
|
+
const out = /* @__PURE__ */ new Map();
|
|
1178
|
+
for (const [host, hv] of Object.entries(hostsRaw)) {
|
|
1179
|
+
const surfacesRaw = hv?.["surfaces"];
|
|
1180
|
+
if (typeof surfacesRaw !== "object" || surfacesRaw === null) {
|
|
1181
|
+
throw new Error(`host_lowering.yaml: ${host} has no \`surfaces:\` map`);
|
|
1182
|
+
}
|
|
1183
|
+
const surfaces = /* @__PURE__ */ new Map();
|
|
1184
|
+
for (const [surface, sv] of Object.entries(surfacesRaw)) {
|
|
1185
|
+
const s = sv;
|
|
1186
|
+
const verifiedRaw = s["verified"];
|
|
1187
|
+
let verified = null;
|
|
1188
|
+
if (verifiedRaw) {
|
|
1189
|
+
const expires = _asString(verifiedRaw["expires"]);
|
|
1190
|
+
if (!expires) {
|
|
1191
|
+
throw new Error(`host_lowering.yaml: ${host}/${surface} verified block has no \`expires\``);
|
|
1192
|
+
}
|
|
1193
|
+
verified = {
|
|
1194
|
+
docs_at: _asString(verifiedRaw["docs_at"]),
|
|
1195
|
+
docs_url: _asString(verifiedRaw["docs_url"]),
|
|
1196
|
+
probe_at: _asString(verifiedRaw["probe_at"]),
|
|
1197
|
+
host_version: _asString(verifiedRaw["host_version"]),
|
|
1198
|
+
expires
|
|
1199
|
+
};
|
|
1200
|
+
}
|
|
1201
|
+
const slots = /* @__PURE__ */ new Map();
|
|
1202
|
+
for (const [slot, rvRaw] of Object.entries(s["slots"] ?? {})) {
|
|
1203
|
+
const rv = rvRaw;
|
|
1204
|
+
const nativeRaw = rv["native"];
|
|
1205
|
+
const native = Array.isArray(nativeRaw) ? nativeRaw.map(String) : [String(nativeRaw)];
|
|
1206
|
+
const be = rv["block_exit"];
|
|
1207
|
+
const row = {
|
|
1208
|
+
native,
|
|
1209
|
+
block_exit: typeof be === "number" ? be : null
|
|
1210
|
+
};
|
|
1211
|
+
if (typeof rv["matcher"] === "string") row.matcher = rv["matcher"];
|
|
1212
|
+
slots.set(slot, row);
|
|
1213
|
+
}
|
|
1214
|
+
surfaces.set(surface, {
|
|
1215
|
+
entry_shape: String(s["entry_shape"] ?? "none"),
|
|
1216
|
+
json_shape: String(s["json_shape"] ?? "none"),
|
|
1217
|
+
fail_policy: String(s["fail_policy"] ?? "discard"),
|
|
1218
|
+
timeout_unit: String(s["timeout_unit"] ?? "unknown"),
|
|
1219
|
+
timeout_default: typeof s["timeout_default"] === "number" ? s["timeout_default"] : null,
|
|
1220
|
+
verified,
|
|
1221
|
+
slots
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1224
|
+
out.set(host, surfaces);
|
|
1225
|
+
}
|
|
1226
|
+
return out;
|
|
1227
|
+
}
|
|
1228
|
+
var _cache = null;
|
|
1229
|
+
function loadHostLowering() {
|
|
1230
|
+
if (_cache === null) _cache = _parse(fs6.readFileSync(HOST_LOWERING_PATH, "utf-8"));
|
|
1231
|
+
return _cache;
|
|
1232
|
+
}
|
|
1233
|
+
function surfaceRow(host, surface = DEFAULT_SURFACE, table = loadHostLowering()) {
|
|
1234
|
+
return table.get(host)?.get(surface) ?? table.get(host)?.get(DEFAULT_SURFACE) ?? null;
|
|
1235
|
+
}
|
|
1236
|
+
function hostBindings(host, table = loadHostLowering()) {
|
|
1237
|
+
const row = surfaceRow(host, DEFAULT_SURFACE, table);
|
|
1238
|
+
if (!row) return [];
|
|
1239
|
+
const out = [];
|
|
1240
|
+
for (const [slot, sr] of row.slots) {
|
|
1241
|
+
for (const native of sr.native) {
|
|
1242
|
+
out.push({ slot, native, matcher: sr.matcher ?? "" });
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
return out;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1154
1248
|
// src/install/partitionEligibility.ts
|
|
1155
|
-
import * as
|
|
1249
|
+
import * as fs8 from "node:fs";
|
|
1156
1250
|
import * as os2 from "node:os";
|
|
1157
1251
|
|
|
1158
1252
|
// src/install/hostLayerFingerprint.ts
|
|
1159
1253
|
import { createHash as createHash4 } from "node:crypto";
|
|
1160
|
-
import * as
|
|
1161
|
-
import * as
|
|
1254
|
+
import * as fs7 from "node:fs";
|
|
1255
|
+
import * as path7 from "node:path";
|
|
1162
1256
|
var FINGERPRINT_SCHEMA = 1;
|
|
1163
1257
|
function collectFiles(dir) {
|
|
1164
1258
|
const out = [];
|
|
1165
1259
|
const walk = (d) => {
|
|
1166
1260
|
let entries;
|
|
1167
1261
|
try {
|
|
1168
|
-
entries =
|
|
1262
|
+
entries = fs7.readdirSync(d, { withFileTypes: true });
|
|
1169
1263
|
} catch {
|
|
1170
1264
|
return;
|
|
1171
1265
|
}
|
|
1172
1266
|
const sorted = [...entries].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
1173
1267
|
for (const e of sorted) {
|
|
1174
|
-
const p =
|
|
1268
|
+
const p = path7.join(d, e.name);
|
|
1175
1269
|
if (e.isDirectory()) {
|
|
1176
1270
|
walk(p);
|
|
1177
1271
|
} else if (e.isFile()) {
|
|
@@ -1188,10 +1282,10 @@ function fingerprintLayers(layers) {
|
|
|
1188
1282
|
for (const layer of layers) {
|
|
1189
1283
|
h.update(`layer:${layer.label}\0`);
|
|
1190
1284
|
for (const file of collectFiles(layer.root)) {
|
|
1191
|
-
h.update(
|
|
1285
|
+
h.update(path7.relative(layer.root, file));
|
|
1192
1286
|
h.update("\0");
|
|
1193
1287
|
try {
|
|
1194
|
-
h.update(
|
|
1288
|
+
h.update(fs7.readFileSync(file));
|
|
1195
1289
|
} catch {
|
|
1196
1290
|
h.update("\0unreadable\0");
|
|
1197
1291
|
}
|
|
@@ -1201,11 +1295,11 @@ function fingerprintLayers(layers) {
|
|
|
1201
1295
|
return h.digest("hex");
|
|
1202
1296
|
}
|
|
1203
1297
|
function hostLayerInputs(userHome) {
|
|
1204
|
-
const claude =
|
|
1298
|
+
const claude = path7.join(userHome, ".claude");
|
|
1205
1299
|
return [
|
|
1206
|
-
{ label: "rules", root:
|
|
1207
|
-
{ label: "skills", root:
|
|
1208
|
-
{ label: "commands", root:
|
|
1300
|
+
{ label: "rules", root: path7.join(claude, "rules") },
|
|
1301
|
+
{ label: "skills", root: path7.join(claude, "skills") },
|
|
1302
|
+
{ label: "commands", root: path7.join(claude, "commands") }
|
|
1209
1303
|
];
|
|
1210
1304
|
}
|
|
1211
1305
|
|
|
@@ -1214,7 +1308,7 @@ var MAINTAINER_WORKSPACE = "agent-config-maintainer";
|
|
|
1214
1308
|
function isExclusivelyPackageOnly(source_path) {
|
|
1215
1309
|
let meta;
|
|
1216
1310
|
try {
|
|
1217
|
-
[meta] = parseFrontmatter(
|
|
1311
|
+
[meta] = parseFrontmatter(fs8.readFileSync(source_path, "utf-8"));
|
|
1218
1312
|
} catch {
|
|
1219
1313
|
return false;
|
|
1220
1314
|
}
|
|
@@ -1245,8 +1339,8 @@ function stampHostLayerFingerprint(installedVersion, tools, lockfilePath, skip2,
|
|
|
1245
1339
|
}
|
|
1246
1340
|
|
|
1247
1341
|
// src/install/claudeRuleRewrite.ts
|
|
1248
|
-
import * as
|
|
1249
|
-
import * as
|
|
1342
|
+
import * as fs9 from "node:fs";
|
|
1343
|
+
import * as path8 from "node:path";
|
|
1250
1344
|
|
|
1251
1345
|
// src/install/claudePathsPlan.ts
|
|
1252
1346
|
function derive_trigger_globs(meta) {
|
|
@@ -1402,22 +1496,22 @@ function rewriteClaudeRules(rulesDir) {
|
|
|
1402
1496
|
const result = { rewritten: 0, scoped: [], dropped: [], failed: [] };
|
|
1403
1497
|
let entries;
|
|
1404
1498
|
try {
|
|
1405
|
-
entries =
|
|
1499
|
+
entries = fs9.readdirSync(rulesDir);
|
|
1406
1500
|
} catch {
|
|
1407
1501
|
return result;
|
|
1408
1502
|
}
|
|
1409
1503
|
for (const name of entries.filter((n) => n.endsWith(".md")).sort()) {
|
|
1410
|
-
const full =
|
|
1504
|
+
const full = path8.join(rulesDir, name);
|
|
1411
1505
|
let stat;
|
|
1412
1506
|
try {
|
|
1413
|
-
stat =
|
|
1507
|
+
stat = fs9.lstatSync(full);
|
|
1414
1508
|
} catch {
|
|
1415
1509
|
continue;
|
|
1416
1510
|
}
|
|
1417
1511
|
if (!stat.isFile() || stat.isSymbolicLink()) continue;
|
|
1418
1512
|
let text;
|
|
1419
1513
|
try {
|
|
1420
|
-
text =
|
|
1514
|
+
text = fs9.readFileSync(full, "utf-8");
|
|
1421
1515
|
} catch {
|
|
1422
1516
|
continue;
|
|
1423
1517
|
}
|
|
@@ -1427,7 +1521,7 @@ function rewriteClaudeRules(rulesDir) {
|
|
|
1427
1521
|
const withOwnership = _withPreservedKeys(rendered.text, text);
|
|
1428
1522
|
if (withOwnership !== text) {
|
|
1429
1523
|
try {
|
|
1430
|
-
|
|
1524
|
+
fs9.writeFileSync(full, withOwnership, "utf-8");
|
|
1431
1525
|
} catch (e) {
|
|
1432
1526
|
result.failed.push({
|
|
1433
1527
|
rule: name.slice(0, -3),
|
|
@@ -2801,8 +2895,8 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
2801
2895
|
};
|
|
2802
2896
|
|
|
2803
2897
|
// src/scripts/_lib/module_detection.ts
|
|
2804
|
-
import * as
|
|
2805
|
-
import * as
|
|
2898
|
+
import * as fs10 from "node:fs";
|
|
2899
|
+
import * as path9 from "node:path";
|
|
2806
2900
|
var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
|
|
2807
2901
|
var _RULES = [
|
|
2808
2902
|
["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
|
|
@@ -2816,14 +2910,14 @@ var _RULES = [
|
|
|
2816
2910
|
];
|
|
2817
2911
|
function _isDir(p) {
|
|
2818
2912
|
try {
|
|
2819
|
-
return
|
|
2913
|
+
return fs10.statSync(p).isDirectory();
|
|
2820
2914
|
} catch {
|
|
2821
2915
|
return false;
|
|
2822
2916
|
}
|
|
2823
2917
|
}
|
|
2824
2918
|
function _isFile(p) {
|
|
2825
2919
|
try {
|
|
2826
|
-
return
|
|
2920
|
+
return fs10.statSync(p).isFile();
|
|
2827
2921
|
} catch {
|
|
2828
2922
|
return false;
|
|
2829
2923
|
}
|
|
@@ -2837,13 +2931,13 @@ function _isUpperChar(ch) {
|
|
|
2837
2931
|
function _list_module_subdirs(root) {
|
|
2838
2932
|
let entries;
|
|
2839
2933
|
try {
|
|
2840
|
-
entries =
|
|
2934
|
+
entries = fs10.readdirSync(root).sort();
|
|
2841
2935
|
} catch {
|
|
2842
2936
|
return [];
|
|
2843
2937
|
}
|
|
2844
2938
|
const out = [];
|
|
2845
2939
|
for (const name of entries) {
|
|
2846
|
-
if (!_isDir(
|
|
2940
|
+
if (!_isDir(path9.join(root, name))) {
|
|
2847
2941
|
continue;
|
|
2848
2942
|
}
|
|
2849
2943
|
if (name.startsWith(".")) {
|
|
@@ -2865,11 +2959,11 @@ function _score_confidence(stack, root, subdirs) {
|
|
|
2865
2959
|
return capitalized.length > 0 ? "high" : "medium";
|
|
2866
2960
|
}
|
|
2867
2961
|
if (stack === "node-monorepo") {
|
|
2868
|
-
const withPkgJson = subdirs.filter((name) => _isFile(
|
|
2962
|
+
const withPkgJson = subdirs.filter((name) => _isFile(path9.join(root, name, "package.json")));
|
|
2869
2963
|
return withPkgJson.length > 0 ? "high" : "medium";
|
|
2870
2964
|
}
|
|
2871
2965
|
if (stack === "python-src") {
|
|
2872
|
-
const withInit = subdirs.filter((name) => _isFile(
|
|
2966
|
+
const withInit = subdirs.filter((name) => _isFile(path9.join(root, name, "__init__.py")));
|
|
2873
2967
|
return withInit.length > 0 ? "high" : "medium";
|
|
2874
2968
|
}
|
|
2875
2969
|
if (stack === "go-internal") {
|
|
@@ -2881,7 +2975,7 @@ function detect_module_roots(project_root) {
|
|
|
2881
2975
|
const high = [];
|
|
2882
2976
|
const medium = [];
|
|
2883
2977
|
for (const [rel_path, stack, namespace_template] of _RULES) {
|
|
2884
|
-
const abs_path =
|
|
2978
|
+
const abs_path = path9.join(project_root, rel_path);
|
|
2885
2979
|
if (!_isDir(abs_path)) {
|
|
2886
2980
|
continue;
|
|
2887
2981
|
}
|
|
@@ -2903,7 +2997,7 @@ function detect_module_roots(project_root) {
|
|
|
2903
2997
|
}
|
|
2904
2998
|
|
|
2905
2999
|
// src/scripts/_lib/model_tier.ts
|
|
2906
|
-
import
|
|
3000
|
+
import fs11 from "node:fs";
|
|
2907
3001
|
var TIER_TO_CLAUDE_MODEL = {
|
|
2908
3002
|
frontier: "fable",
|
|
2909
3003
|
high: "opus",
|
|
@@ -2912,8 +3006,8 @@ var TIER_TO_CLAUDE_MODEL = {
|
|
|
2912
3006
|
};
|
|
2913
3007
|
var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
|
|
2914
3008
|
function read_model_tier(skill_md) {
|
|
2915
|
-
if (!
|
|
2916
|
-
const text =
|
|
3009
|
+
if (!fs11.existsSync(skill_md)) return null;
|
|
3010
|
+
const text = fs11.readFileSync(skill_md).toString("utf-8");
|
|
2917
3011
|
if (!text.startsWith("---\n")) return null;
|
|
2918
3012
|
const end = text.indexOf("\n---\n", 4);
|
|
2919
3013
|
if (end === -1) return null;
|
|
@@ -2929,7 +3023,7 @@ function render_native_model_md(text, tier) {
|
|
|
2929
3023
|
}
|
|
2930
3024
|
|
|
2931
3025
|
// src/scripts/install.ts
|
|
2932
|
-
var _HERE =
|
|
3026
|
+
var _HERE = fileURLToPath2(import.meta.url);
|
|
2933
3027
|
var SystemExitError = class extends Error {
|
|
2934
3028
|
constructor(code) {
|
|
2935
3029
|
super(`system-exit-${code}`);
|
|
@@ -2947,34 +3041,34 @@ var ArgparseExit = class extends Error {
|
|
|
2947
3041
|
function expanduser2(p) {
|
|
2948
3042
|
if (p === "~") return os3.homedir();
|
|
2949
3043
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
2950
|
-
return
|
|
3044
|
+
return path10.join(os3.homedir(), p.slice(2));
|
|
2951
3045
|
}
|
|
2952
3046
|
return p;
|
|
2953
3047
|
}
|
|
2954
3048
|
function resolvePath(p) {
|
|
2955
3049
|
try {
|
|
2956
|
-
return
|
|
3050
|
+
return fs12.realpathSync(path10.resolve(p));
|
|
2957
3051
|
} catch {
|
|
2958
|
-
return
|
|
3052
|
+
return path10.resolve(p);
|
|
2959
3053
|
}
|
|
2960
3054
|
}
|
|
2961
3055
|
function isFile(p) {
|
|
2962
3056
|
try {
|
|
2963
|
-
return
|
|
3057
|
+
return fs12.statSync(p).isFile();
|
|
2964
3058
|
} catch {
|
|
2965
3059
|
return false;
|
|
2966
3060
|
}
|
|
2967
3061
|
}
|
|
2968
3062
|
function isDir(p) {
|
|
2969
3063
|
try {
|
|
2970
|
-
return
|
|
3064
|
+
return fs12.statSync(p).isDirectory();
|
|
2971
3065
|
} catch {
|
|
2972
3066
|
return false;
|
|
2973
3067
|
}
|
|
2974
3068
|
}
|
|
2975
3069
|
function pathExists(p) {
|
|
2976
3070
|
try {
|
|
2977
|
-
|
|
3071
|
+
fs12.statSync(p);
|
|
2978
3072
|
return true;
|
|
2979
3073
|
} catch {
|
|
2980
3074
|
return false;
|
|
@@ -2982,24 +3076,24 @@ function pathExists(p) {
|
|
|
2982
3076
|
}
|
|
2983
3077
|
function isSymlink(p) {
|
|
2984
3078
|
try {
|
|
2985
|
-
return
|
|
3079
|
+
return fs12.lstatSync(p).isSymbolicLink();
|
|
2986
3080
|
} catch {
|
|
2987
3081
|
return false;
|
|
2988
3082
|
}
|
|
2989
3083
|
}
|
|
2990
3084
|
function readText(p) {
|
|
2991
|
-
return
|
|
3085
|
+
return fs12.readFileSync(p, "utf-8");
|
|
2992
3086
|
}
|
|
2993
3087
|
function writeText(p, content) {
|
|
2994
|
-
|
|
3088
|
+
fs12.writeFileSync(p, content, "utf-8");
|
|
2995
3089
|
}
|
|
2996
3090
|
function mkdirp(p) {
|
|
2997
|
-
|
|
3091
|
+
fs12.mkdirSync(p, { recursive: true });
|
|
2998
3092
|
}
|
|
2999
3093
|
function sortedGlobStems(directory, suffix) {
|
|
3000
3094
|
let entries;
|
|
3001
3095
|
try {
|
|
3002
|
-
entries =
|
|
3096
|
+
entries = fs12.readdirSync(directory);
|
|
3003
3097
|
} catch {
|
|
3004
3098
|
return [];
|
|
3005
3099
|
}
|
|
@@ -3019,7 +3113,7 @@ function sortedGlobStems(directory, suffix) {
|
|
|
3019
3113
|
function countZips(directory) {
|
|
3020
3114
|
if (!isDir(directory)) return 0;
|
|
3021
3115
|
let n = 0;
|
|
3022
|
-
for (const name of
|
|
3116
|
+
for (const name of fs12.readdirSync(directory)) {
|
|
3023
3117
|
if (name.endsWith(".zip")) n += 1;
|
|
3024
3118
|
}
|
|
3025
3119
|
return n;
|
|
@@ -3027,35 +3121,35 @@ function countZips(directory) {
|
|
|
3027
3121
|
function sha256OfFile(p) {
|
|
3028
3122
|
let data;
|
|
3029
3123
|
try {
|
|
3030
|
-
data =
|
|
3124
|
+
data = fs12.readFileSync(p);
|
|
3031
3125
|
} catch {
|
|
3032
3126
|
return null;
|
|
3033
3127
|
}
|
|
3034
3128
|
return crypto3.createHash("sha256").update(data).digest("hex");
|
|
3035
3129
|
}
|
|
3036
3130
|
function atomicWrite0644(target, body, prefix) {
|
|
3037
|
-
const dir =
|
|
3038
|
-
const tmpName =
|
|
3131
|
+
const dir = path10.dirname(target);
|
|
3132
|
+
const tmpName = path10.join(
|
|
3039
3133
|
dir,
|
|
3040
3134
|
`${prefix}${process2.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
|
|
3041
3135
|
);
|
|
3042
3136
|
let fd = null;
|
|
3043
3137
|
try {
|
|
3044
|
-
fd =
|
|
3045
|
-
|
|
3046
|
-
|
|
3138
|
+
fd = fs12.openSync(tmpName, "wx", 420);
|
|
3139
|
+
fs12.writeFileSync(fd, body, "utf-8");
|
|
3140
|
+
fs12.closeSync(fd);
|
|
3047
3141
|
fd = null;
|
|
3048
|
-
|
|
3049
|
-
|
|
3142
|
+
fs12.chmodSync(tmpName, 420);
|
|
3143
|
+
fs12.renameSync(tmpName, target);
|
|
3050
3144
|
} catch (err) {
|
|
3051
3145
|
if (fd !== null) {
|
|
3052
3146
|
try {
|
|
3053
|
-
|
|
3147
|
+
fs12.closeSync(fd);
|
|
3054
3148
|
} catch {
|
|
3055
3149
|
}
|
|
3056
3150
|
}
|
|
3057
3151
|
try {
|
|
3058
|
-
|
|
3152
|
+
fs12.unlinkSync(tmpName);
|
|
3059
3153
|
} catch {
|
|
3060
3154
|
}
|
|
3061
3155
|
throw err;
|
|
@@ -3179,12 +3273,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
|
|
|
3179
3273
|
var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
|
|
3180
3274
|
var SETTINGS_SUBDIR = ["agents", "settings"];
|
|
3181
3275
|
function _canonical_settings_target(project_root) {
|
|
3182
|
-
return
|
|
3276
|
+
return path10.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
|
|
3183
3277
|
}
|
|
3184
3278
|
function _resolve_settings_read(project_root) {
|
|
3185
3279
|
const canonical = _canonical_settings_target(project_root);
|
|
3186
3280
|
if (pathExists(canonical)) return canonical;
|
|
3187
|
-
const legacy =
|
|
3281
|
+
const legacy = path10.join(project_root, SETTINGS_FILE);
|
|
3188
3282
|
if (pathExists(legacy)) return legacy;
|
|
3189
3283
|
return canonical;
|
|
3190
3284
|
}
|
|
@@ -3248,9 +3342,9 @@ function fail(msg) {
|
|
|
3248
3342
|
throw new SystemExitError(1);
|
|
3249
3343
|
}
|
|
3250
3344
|
function detect_package_root(project_root) {
|
|
3251
|
-
const npm_path =
|
|
3345
|
+
const npm_path = path10.join(project_root, "node_modules", "@event4u", "agent-config");
|
|
3252
3346
|
if (isDir(npm_path)) return resolvePath(npm_path);
|
|
3253
|
-
if (pathExists(
|
|
3347
|
+
if (pathExists(path10.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
3254
3348
|
return project_root;
|
|
3255
3349
|
}
|
|
3256
3350
|
fail(
|
|
@@ -3258,12 +3352,12 @@ function detect_package_root(project_root) {
|
|
|
3258
3352
|
);
|
|
3259
3353
|
}
|
|
3260
3354
|
function detect_package_type(package_root) {
|
|
3261
|
-
if (package_root.split(
|
|
3355
|
+
if (package_root.split(path10.sep).includes("node_modules")) return "npm";
|
|
3262
3356
|
return "local";
|
|
3263
3357
|
}
|
|
3264
3358
|
function detect_package_type_for_project(project_root, package_root) {
|
|
3265
3359
|
const npm_path = resolvePath(
|
|
3266
|
-
|
|
3360
|
+
path10.join(project_root, "node_modules", "@event4u", "agent-config")
|
|
3267
3361
|
);
|
|
3268
3362
|
const package_resolved = resolvePath(package_root);
|
|
3269
3363
|
if (package_resolved === npm_path) return "npm";
|
|
@@ -3283,7 +3377,7 @@ function ensure_directory(p) {
|
|
|
3283
3377
|
mkdirp(p);
|
|
3284
3378
|
}
|
|
3285
3379
|
function write_file(p, content) {
|
|
3286
|
-
ensure_directory(
|
|
3380
|
+
ensure_directory(path10.dirname(p));
|
|
3287
3381
|
writeText(p, content);
|
|
3288
3382
|
}
|
|
3289
3383
|
function read_json_file(p) {
|
|
@@ -3454,7 +3548,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
|
|
|
3454
3548
|
return rendered + "\n" + suffix;
|
|
3455
3549
|
}
|
|
3456
3550
|
function _migrate_legacy_if_present(project_root, template_body) {
|
|
3457
|
-
const legacy_target =
|
|
3551
|
+
const legacy_target = path10.join(project_root, LEGACY_SETTINGS_FILE);
|
|
3458
3552
|
if (!isFile(legacy_target)) return null;
|
|
3459
3553
|
const legacy_text = readText(legacy_target);
|
|
3460
3554
|
const [values, unknown] = _parse_legacy_settings(legacy_text);
|
|
@@ -3469,9 +3563,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
|
|
|
3469
3563
|
}
|
|
3470
3564
|
}
|
|
3471
3565
|
rendered = _append_unknown_legacy(rendered, values, unknown);
|
|
3472
|
-
const backup_target =
|
|
3566
|
+
const backup_target = path10.join(project_root, LEGACY_BACKUP_FILE);
|
|
3473
3567
|
writeText(backup_target, legacy_text);
|
|
3474
|
-
|
|
3568
|
+
fs12.unlinkSync(legacy_target);
|
|
3475
3569
|
info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
|
|
3476
3570
|
info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
|
|
3477
3571
|
if (unknown.length > 0) {
|
|
@@ -3506,7 +3600,7 @@ function _render_template(template, profile_values) {
|
|
|
3506
3600
|
return body;
|
|
3507
3601
|
}
|
|
3508
3602
|
function _load_valid_user_types(package_root) {
|
|
3509
|
-
const directory =
|
|
3603
|
+
const directory = path10.join(package_root, USER_TYPES_DIR);
|
|
3510
3604
|
if (!isDir(directory)) return [];
|
|
3511
3605
|
return sortedGlobStems(directory, ".yml");
|
|
3512
3606
|
}
|
|
@@ -3563,8 +3657,8 @@ function splitlinesKeepends(text) {
|
|
|
3563
3657
|
}
|
|
3564
3658
|
function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
|
|
3565
3659
|
const target = _canonical_settings_target(project_root);
|
|
3566
|
-
const profile_source =
|
|
3567
|
-
const template_source =
|
|
3660
|
+
const profile_source = path10.join(package_root, "src", "config", "profiles", `${profile}.ini`);
|
|
3661
|
+
const template_source = path10.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
3568
3662
|
if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
|
|
3569
3663
|
if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
|
|
3570
3664
|
const template = readText(template_source);
|
|
@@ -3578,21 +3672,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
3578
3672
|
if (profile_values["rule_loading_tier"] !== profile) {
|
|
3579
3673
|
const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
|
|
3580
3674
|
fail(
|
|
3581
|
-
`Profile preset ${
|
|
3675
|
+
`Profile preset ${path10.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
|
|
3582
3676
|
);
|
|
3583
3677
|
}
|
|
3584
3678
|
profile_values["user_type"] = _validate_user_type(package_root, user_type);
|
|
3585
3679
|
let template_body = _render_template(template, profile_values);
|
|
3586
3680
|
template_body = _inject_packs(template_body, packs ?? []);
|
|
3587
|
-
const legacy_root =
|
|
3681
|
+
const legacy_root = path10.join(project_root, SETTINGS_FILE);
|
|
3588
3682
|
if (isFile(legacy_root) && !pathExists(target)) {
|
|
3589
|
-
mkdirp(
|
|
3683
|
+
mkdirp(path10.dirname(target));
|
|
3590
3684
|
writeText(target, readText(legacy_root));
|
|
3591
|
-
|
|
3685
|
+
fs12.unlinkSync(legacy_root);
|
|
3592
3686
|
success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
|
|
3593
3687
|
return;
|
|
3594
3688
|
}
|
|
3595
|
-
const legacy_target =
|
|
3689
|
+
const legacy_target = path10.join(project_root, LEGACY_SETTINGS_FILE);
|
|
3596
3690
|
if (isFile(legacy_target) && pathExists(target)) {
|
|
3597
3691
|
warn(
|
|
3598
3692
|
`Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
|
|
@@ -3609,7 +3703,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
3609
3703
|
skip(`${SETTINGS_FILE} already exists`);
|
|
3610
3704
|
return;
|
|
3611
3705
|
}
|
|
3612
|
-
mkdirp(
|
|
3706
|
+
mkdirp(path10.dirname(target));
|
|
3613
3707
|
write_file(target, template_body);
|
|
3614
3708
|
const user_type_value = profile_values["user_type"] ?? "";
|
|
3615
3709
|
const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
|
|
@@ -3622,7 +3716,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
3622
3716
|
const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
|
|
3623
3717
|
const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
|
|
3624
3718
|
return merge_json_file(
|
|
3625
|
-
|
|
3719
|
+
path10.join(project_root, ".vscode", "settings.json"),
|
|
3626
3720
|
bridge,
|
|
3627
3721
|
force,
|
|
3628
3722
|
".vscode/settings.json"
|
|
@@ -3631,14 +3725,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
3631
3725
|
function ensure_augment_bridge(project_root, force) {
|
|
3632
3726
|
const bridge = { enabledPlugins: { "agent-config@event4u": true } };
|
|
3633
3727
|
return merge_json_file(
|
|
3634
|
-
|
|
3728
|
+
path10.join(project_root, ".augment", "settings.json"),
|
|
3635
3729
|
bridge,
|
|
3636
3730
|
force,
|
|
3637
3731
|
".augment/settings.json"
|
|
3638
3732
|
);
|
|
3639
3733
|
}
|
|
3640
|
-
var AUGMENT_USER_DIR =
|
|
3641
|
-
var AUGMENT_USER_HOOKS_DIR =
|
|
3734
|
+
var AUGMENT_USER_DIR = path10.join(os3.homedir(), ".augment");
|
|
3735
|
+
var AUGMENT_USER_HOOKS_DIR = path10.join(AUGMENT_USER_DIR, "hooks");
|
|
3642
3736
|
var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
|
|
3643
3737
|
var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
3644
3738
|
"augment-chat-history.sh",
|
|
@@ -3646,37 +3740,30 @@ var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
|
3646
3740
|
"augment-onboarding-gate.sh",
|
|
3647
3741
|
"augment-context-hygiene.sh"
|
|
3648
3742
|
];
|
|
3649
|
-
var AUGMENT_DISPATCHER_BINDINGS = [
|
|
3650
|
-
["session_start", "SessionStart"],
|
|
3651
|
-
["session_end", "SessionEnd"],
|
|
3652
|
-
["stop", "Stop"],
|
|
3653
|
-
["pre_tool_use", "PreToolUse"],
|
|
3654
|
-
["post_tool_use", "PostToolUse"]
|
|
3655
|
-
];
|
|
3656
3743
|
function _deploy_augment_trampoline(package_root, name, force) {
|
|
3657
|
-
const src =
|
|
3744
|
+
const src = path10.join(package_root, "scripts", "hooks", name);
|
|
3658
3745
|
if (!pathExists(src)) {
|
|
3659
3746
|
skip(`augment trampoline missing in package: ${src}`);
|
|
3660
3747
|
return null;
|
|
3661
3748
|
}
|
|
3662
3749
|
mkdirp(AUGMENT_USER_HOOKS_DIR);
|
|
3663
|
-
const dst =
|
|
3750
|
+
const dst = path10.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
3664
3751
|
const src_text = readText(src);
|
|
3665
3752
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3666
3753
|
skip(`~/.augment/hooks/${name} already up to date`);
|
|
3667
3754
|
} else {
|
|
3668
3755
|
writeText(dst, src_text);
|
|
3669
|
-
|
|
3756
|
+
fs12.chmodSync(dst, 493);
|
|
3670
3757
|
success(`~/.augment/hooks/${name} installed`);
|
|
3671
3758
|
}
|
|
3672
3759
|
return dst;
|
|
3673
3760
|
}
|
|
3674
3761
|
function _remove_legacy_augment_trampolines() {
|
|
3675
3762
|
for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
|
|
3676
|
-
const legacy =
|
|
3763
|
+
const legacy = path10.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
3677
3764
|
try {
|
|
3678
3765
|
if (isFile(legacy)) {
|
|
3679
|
-
|
|
3766
|
+
fs12.unlinkSync(legacy);
|
|
3680
3767
|
skip(`removed legacy ~/.augment/hooks/${name}`);
|
|
3681
3768
|
}
|
|
3682
3769
|
} catch (err) {
|
|
@@ -3689,14 +3776,14 @@ function ensure_augment_user_hooks(package_root, force) {
|
|
|
3689
3776
|
if (dst === null) return [];
|
|
3690
3777
|
_remove_legacy_augment_trampolines();
|
|
3691
3778
|
const per_event = {};
|
|
3692
|
-
for (const
|
|
3693
|
-
const cmd = `${dst} ${
|
|
3779
|
+
for (const { slot, native } of hostBindings("augment")) {
|
|
3780
|
+
const cmd = `${dst} ${slot} ${native}`;
|
|
3694
3781
|
const entry = { hooks: [{ type: "command", command: cmd }] };
|
|
3695
3782
|
(per_event[native] ??= []).push(entry);
|
|
3696
3783
|
}
|
|
3697
3784
|
const settings_patch = { hooks: per_event };
|
|
3698
3785
|
return merge_json_file(
|
|
3699
|
-
|
|
3786
|
+
path10.join(AUGMENT_USER_DIR, "settings.json"),
|
|
3700
3787
|
settings_patch,
|
|
3701
3788
|
force,
|
|
3702
3789
|
"~/.augment/settings.json"
|
|
@@ -3721,7 +3808,7 @@ function _heal_legacy_claude_plugin_ids(p) {
|
|
|
3721
3808
|
return removed;
|
|
3722
3809
|
}
|
|
3723
3810
|
function ensure_claude_bridge(project_root, force) {
|
|
3724
|
-
const target =
|
|
3811
|
+
const target = path10.join(project_root, ".claude", "settings.json");
|
|
3725
3812
|
const healed = _heal_legacy_claude_plugin_ids(target);
|
|
3726
3813
|
for (const pid of healed) {
|
|
3727
3814
|
success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
|
|
@@ -3731,68 +3818,53 @@ function ensure_claude_bridge(project_root, force) {
|
|
|
3731
3818
|
}
|
|
3732
3819
|
var ensure_mcp_bridge = makeEnsureMcpBridge(merge_json_file);
|
|
3733
3820
|
var _tier_b_advisory = tierBAdvisory;
|
|
3734
|
-
var CURSOR_DISPATCHER_BINDINGS = [
|
|
3735
|
-
["session_start", "sessionStart"],
|
|
3736
|
-
["session_end", "sessionEnd"],
|
|
3737
|
-
["stop", "stop"],
|
|
3738
|
-
["user_prompt_submit", "beforeSubmitPrompt"],
|
|
3739
|
-
["post_tool_use", "postToolUse"]
|
|
3740
|
-
];
|
|
3741
3821
|
function _cursor_dispatch_command(ac_event, native) {
|
|
3742
3822
|
return `[ -x ./agent-config ] || exit 0; ./agent-config dispatch:hook --platform cursor --event ${ac_event} --native-event ${native}`;
|
|
3743
3823
|
}
|
|
3744
3824
|
function ensure_cursor_bridge(project_root, force) {
|
|
3745
3825
|
const hooks = {};
|
|
3746
|
-
for (const
|
|
3747
|
-
(hooks[native] ??= []).push({ command: _cursor_dispatch_command(
|
|
3826
|
+
for (const { slot, native } of hostBindings("cursor")) {
|
|
3827
|
+
(hooks[native] ??= []).push({ command: _cursor_dispatch_command(slot, native) });
|
|
3748
3828
|
}
|
|
3749
3829
|
const bridge = { version: 1, hooks };
|
|
3750
3830
|
return merge_json_file(
|
|
3751
|
-
|
|
3831
|
+
path10.join(project_root, ".cursor", "hooks.json"),
|
|
3752
3832
|
bridge,
|
|
3753
3833
|
force,
|
|
3754
3834
|
".cursor/hooks.json"
|
|
3755
3835
|
);
|
|
3756
3836
|
}
|
|
3757
|
-
var CURSOR_USER_DIR =
|
|
3758
|
-
var CURSOR_USER_HOOKS_DIR =
|
|
3837
|
+
var CURSOR_USER_DIR = path10.join(os3.homedir(), ".cursor");
|
|
3838
|
+
var CURSOR_USER_HOOKS_DIR = path10.join(CURSOR_USER_DIR, "hooks");
|
|
3759
3839
|
var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
|
|
3760
3840
|
function ensure_cursor_user_hooks(package_root, force) {
|
|
3761
|
-
const src =
|
|
3841
|
+
const src = path10.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
|
|
3762
3842
|
if (!pathExists(src)) {
|
|
3763
3843
|
skip(`cursor trampoline missing in package: ${src}`);
|
|
3764
3844
|
return [];
|
|
3765
3845
|
}
|
|
3766
3846
|
mkdirp(CURSOR_USER_HOOKS_DIR);
|
|
3767
|
-
const dst =
|
|
3847
|
+
const dst = path10.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
|
|
3768
3848
|
const src_text = readText(src);
|
|
3769
3849
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3770
3850
|
skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3771
3851
|
} else {
|
|
3772
3852
|
writeText(dst, src_text);
|
|
3773
|
-
|
|
3853
|
+
fs12.chmodSync(dst, 493);
|
|
3774
3854
|
success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
|
|
3775
3855
|
}
|
|
3776
3856
|
const hooks = {};
|
|
3777
|
-
for (const
|
|
3778
|
-
(hooks[native] ??= []).push({ command: `${dst} ${
|
|
3857
|
+
for (const { slot, native } of hostBindings("cursor")) {
|
|
3858
|
+
(hooks[native] ??= []).push({ command: `${dst} ${slot} ${native}` });
|
|
3779
3859
|
}
|
|
3780
3860
|
const settings_patch = { version: 1, hooks };
|
|
3781
3861
|
return merge_json_file(
|
|
3782
|
-
|
|
3862
|
+
path10.join(CURSOR_USER_DIR, "hooks.json"),
|
|
3783
3863
|
settings_patch,
|
|
3784
3864
|
force,
|
|
3785
3865
|
"~/.cursor/hooks.json"
|
|
3786
3866
|
);
|
|
3787
3867
|
}
|
|
3788
|
-
var CLINE_DISPATCHER_BINDINGS = [
|
|
3789
|
-
["session_start", "TaskStart"],
|
|
3790
|
-
["session_start", "TaskResume"],
|
|
3791
|
-
["session_end", "TaskComplete"],
|
|
3792
|
-
["stop", "TaskCancel"],
|
|
3793
|
-
["user_prompt_submit", "UserPromptSubmit"],
|
|
3794
|
-
["post_tool_use", "PostToolUse"]
|
|
3795
|
-
];
|
|
3796
3868
|
function shlexQuote(s) {
|
|
3797
3869
|
if (s === "") return "''";
|
|
3798
3870
|
if (/^[A-Za-z0-9_@%+=:,./-]+$/.test(s)) return s;
|
|
@@ -3800,7 +3872,7 @@ function shlexQuote(s) {
|
|
|
3800
3872
|
}
|
|
3801
3873
|
function clineProjectHookBody(native_event, ac_event, workspace_quoted) {
|
|
3802
3874
|
return `#!/usr/bin/env bash
|
|
3803
|
-
# Generated by event4u/agent-config
|
|
3875
|
+
# Generated by event4u/agent-config \u2014 DO NOT EDIT.
|
|
3804
3876
|
# Project-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
|
|
3805
3877
|
# Phase 7.6 (docs/contracts/hook-architecture-v1.md).
|
|
3806
3878
|
set -u
|
|
@@ -3822,22 +3894,22 @@ exit 0
|
|
|
3822
3894
|
`;
|
|
3823
3895
|
}
|
|
3824
3896
|
function ensure_cline_bridge(project_root, force) {
|
|
3825
|
-
const hooks_dir =
|
|
3897
|
+
const hooks_dir = path10.join(project_root, ".clinerules", "hooks");
|
|
3826
3898
|
mkdirp(hooks_dir);
|
|
3827
3899
|
const workspace_quoted = shlexQuote(resolvePath(project_root));
|
|
3828
3900
|
let written = 0;
|
|
3829
|
-
for (const
|
|
3830
|
-
const target =
|
|
3831
|
-
const body = clineProjectHookBody(
|
|
3901
|
+
for (const { slot, native } of hostBindings("cline")) {
|
|
3902
|
+
const target = path10.join(hooks_dir, native);
|
|
3903
|
+
const body = clineProjectHookBody(native, slot, workspace_quoted);
|
|
3832
3904
|
if (pathExists(target) && readText(target) === body && !force) {
|
|
3833
3905
|
continue;
|
|
3834
3906
|
}
|
|
3835
3907
|
if (pathExists(target) && !force) {
|
|
3836
|
-
skip(`.clinerules/hooks/${
|
|
3908
|
+
skip(`.clinerules/hooks/${native} exists, needs update (use --force)`);
|
|
3837
3909
|
continue;
|
|
3838
3910
|
}
|
|
3839
3911
|
writeText(target, body);
|
|
3840
|
-
|
|
3912
|
+
fs12.chmodSync(target, 493);
|
|
3841
3913
|
written += 1;
|
|
3842
3914
|
}
|
|
3843
3915
|
if (written) {
|
|
@@ -3846,113 +3918,101 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
3846
3918
|
skip(".clinerules/hooks/ already up to date");
|
|
3847
3919
|
}
|
|
3848
3920
|
}
|
|
3849
|
-
var CLINE_USER_DIR =
|
|
3921
|
+
var CLINE_USER_DIR = path10.join(os3.homedir(), "Documents", "Cline", "Hooks");
|
|
3850
3922
|
var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
|
|
3851
3923
|
function ensure_cline_user_hooks(package_root, force) {
|
|
3852
|
-
const src =
|
|
3924
|
+
const src = path10.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
|
|
3853
3925
|
if (!pathExists(src)) {
|
|
3854
3926
|
skip(`cline trampoline missing in package: ${src}`);
|
|
3855
3927
|
return;
|
|
3856
3928
|
}
|
|
3857
3929
|
mkdirp(CLINE_USER_DIR);
|
|
3858
|
-
const trampoline =
|
|
3930
|
+
const trampoline = path10.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
|
|
3859
3931
|
const src_text = readText(src);
|
|
3860
3932
|
if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
|
|
3861
3933
|
skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3862
3934
|
} else {
|
|
3863
3935
|
writeText(trampoline, src_text);
|
|
3864
|
-
|
|
3936
|
+
fs12.chmodSync(trampoline, 493);
|
|
3865
3937
|
success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
|
|
3866
3938
|
}
|
|
3867
3939
|
const trampoline_quoted = shlexQuote(trampoline);
|
|
3868
|
-
for (const
|
|
3869
|
-
const wrapper =
|
|
3940
|
+
for (const { slot, native } of hostBindings("cline")) {
|
|
3941
|
+
const wrapper = path10.join(CLINE_USER_DIR, native);
|
|
3870
3942
|
const body = `#!/usr/bin/env bash
|
|
3871
|
-
# Generated by event4u/agent-config
|
|
3872
|
-
# User-scope Cline hook for ${
|
|
3873
|
-
exec ${trampoline_quoted} ${
|
|
3943
|
+
# Generated by event4u/agent-config \u2014 DO NOT EDIT.
|
|
3944
|
+
# User-scope Cline hook for ${native} \u2192 agent-config ${slot}.
|
|
3945
|
+
exec ${trampoline_quoted} ${slot} ${native}
|
|
3874
3946
|
`;
|
|
3875
3947
|
if (pathExists(wrapper) && readText(wrapper) === body && !force) {
|
|
3876
3948
|
continue;
|
|
3877
3949
|
}
|
|
3878
3950
|
writeText(wrapper, body);
|
|
3879
|
-
|
|
3951
|
+
fs12.chmodSync(wrapper, 493);
|
|
3880
3952
|
}
|
|
3881
3953
|
}
|
|
3882
|
-
var WINDSURF_DISPATCHER_BINDINGS = [
|
|
3883
|
-
["session_start", "post_setup_worktree"],
|
|
3884
|
-
["user_prompt_submit", "pre_user_prompt"],
|
|
3885
|
-
["stop", "post_cascade_response"]
|
|
3886
|
-
];
|
|
3887
3954
|
function _windsurf_dispatch_command(ac_event, native) {
|
|
3888
3955
|
return `[ -x ./agent-config ] || exit 0; ./agent-config dispatch:hook --platform windsurf --event ${ac_event} --native-event ${native}`;
|
|
3889
3956
|
}
|
|
3890
3957
|
function ensure_windsurf_bridge(project_root, force) {
|
|
3891
3958
|
const hooks = {};
|
|
3892
|
-
for (const
|
|
3959
|
+
for (const { slot, native } of hostBindings("windsurf")) {
|
|
3893
3960
|
(hooks[native] ??= []).push({
|
|
3894
|
-
command: _windsurf_dispatch_command(
|
|
3961
|
+
command: _windsurf_dispatch_command(slot, native),
|
|
3895
3962
|
show_output: false
|
|
3896
3963
|
});
|
|
3897
3964
|
}
|
|
3898
3965
|
const bridge = { hooks };
|
|
3899
3966
|
return merge_json_file(
|
|
3900
|
-
|
|
3967
|
+
path10.join(project_root, ".windsurf", "hooks.json"),
|
|
3901
3968
|
bridge,
|
|
3902
3969
|
force,
|
|
3903
3970
|
".windsurf/hooks.json"
|
|
3904
3971
|
);
|
|
3905
3972
|
}
|
|
3906
|
-
var WINDSURF_USER_DIR =
|
|
3907
|
-
var WINDSURF_USER_HOOKS_DIR =
|
|
3973
|
+
var WINDSURF_USER_DIR = path10.join(os3.homedir(), ".codeium", "windsurf");
|
|
3974
|
+
var WINDSURF_USER_HOOKS_DIR = path10.join(WINDSURF_USER_DIR, "hooks");
|
|
3908
3975
|
var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
|
|
3909
3976
|
function ensure_windsurf_user_hooks(package_root, force) {
|
|
3910
|
-
const src =
|
|
3977
|
+
const src = path10.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
3911
3978
|
if (!pathExists(src)) {
|
|
3912
3979
|
skip(`windsurf trampoline missing in package: ${src}`);
|
|
3913
3980
|
return [];
|
|
3914
3981
|
}
|
|
3915
3982
|
mkdirp(WINDSURF_USER_HOOKS_DIR);
|
|
3916
|
-
const dst =
|
|
3983
|
+
const dst = path10.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
3917
3984
|
const src_text = readText(src);
|
|
3918
3985
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3919
3986
|
skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3920
3987
|
} else {
|
|
3921
3988
|
writeText(dst, src_text);
|
|
3922
|
-
|
|
3989
|
+
fs12.chmodSync(dst, 493);
|
|
3923
3990
|
success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
|
|
3924
3991
|
}
|
|
3925
3992
|
const hooks = {};
|
|
3926
|
-
for (const
|
|
3993
|
+
for (const { slot, native } of hostBindings("windsurf")) {
|
|
3927
3994
|
(hooks[native] ??= []).push({
|
|
3928
|
-
command: `${dst} ${
|
|
3995
|
+
command: `${dst} ${slot} ${native}`,
|
|
3929
3996
|
show_output: false
|
|
3930
3997
|
});
|
|
3931
3998
|
}
|
|
3932
3999
|
const settings_patch = { hooks };
|
|
3933
4000
|
return merge_json_file(
|
|
3934
|
-
|
|
4001
|
+
path10.join(WINDSURF_USER_DIR, "hooks.json"),
|
|
3935
4002
|
settings_patch,
|
|
3936
4003
|
force,
|
|
3937
4004
|
"~/.codeium/windsurf/hooks.json"
|
|
3938
4005
|
);
|
|
3939
4006
|
}
|
|
3940
|
-
var GEMINI_DISPATCHER_BINDINGS = [
|
|
3941
|
-
["session_start", "SessionStart", ""],
|
|
3942
|
-
["session_end", "SessionEnd", ""],
|
|
3943
|
-
["stop", "AfterAgent", ""],
|
|
3944
|
-
["user_prompt_submit", "BeforeAgent", ""],
|
|
3945
|
-
["post_tool_use", "AfterTool", ".*"]
|
|
3946
|
-
];
|
|
3947
4007
|
function _gemini_dispatch_command(ac_event, native) {
|
|
3948
4008
|
return `[ -x ./agent-config ] || exit 0; ./agent-config dispatch:hook --platform gemini --event ${ac_event} --native-event ${native}`;
|
|
3949
4009
|
}
|
|
3950
4010
|
function _gemini_hooks_dict(command_factory) {
|
|
3951
4011
|
const out = {};
|
|
3952
|
-
for (const
|
|
4012
|
+
for (const { slot, native, matcher } of hostBindings("gemini")) {
|
|
3953
4013
|
(out[native] ??= []).push({
|
|
3954
4014
|
matcher,
|
|
3955
|
-
hooks: [{ type: "command", command: command_factory(
|
|
4015
|
+
hooks: [{ type: "command", command: command_factory(slot, native) }]
|
|
3956
4016
|
});
|
|
3957
4017
|
}
|
|
3958
4018
|
return out;
|
|
@@ -3960,43 +4020,43 @@ function _gemini_hooks_dict(command_factory) {
|
|
|
3960
4020
|
function ensure_gemini_bridge(project_root, force) {
|
|
3961
4021
|
const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
|
|
3962
4022
|
return merge_json_file(
|
|
3963
|
-
|
|
4023
|
+
path10.join(project_root, ".gemini", "settings.json"),
|
|
3964
4024
|
bridge,
|
|
3965
4025
|
force,
|
|
3966
4026
|
".gemini/settings.json"
|
|
3967
4027
|
);
|
|
3968
4028
|
}
|
|
3969
|
-
var GEMINI_USER_DIR =
|
|
3970
|
-
var GEMINI_USER_HOOKS_DIR =
|
|
4029
|
+
var GEMINI_USER_DIR = path10.join(os3.homedir(), ".gemini");
|
|
4030
|
+
var GEMINI_USER_HOOKS_DIR = path10.join(GEMINI_USER_DIR, "hooks");
|
|
3971
4031
|
var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
|
|
3972
4032
|
function ensure_gemini_user_hooks(package_root, force) {
|
|
3973
|
-
const src =
|
|
4033
|
+
const src = path10.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
|
|
3974
4034
|
if (!pathExists(src)) {
|
|
3975
4035
|
skip(`gemini trampoline missing in package: ${src}`);
|
|
3976
4036
|
return [];
|
|
3977
4037
|
}
|
|
3978
4038
|
mkdirp(GEMINI_USER_HOOKS_DIR);
|
|
3979
|
-
const dst =
|
|
4039
|
+
const dst = path10.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
|
|
3980
4040
|
const src_text = readText(src);
|
|
3981
4041
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3982
4042
|
skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3983
4043
|
} else {
|
|
3984
4044
|
writeText(dst, src_text);
|
|
3985
|
-
|
|
4045
|
+
fs12.chmodSync(dst, 493);
|
|
3986
4046
|
success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
|
|
3987
4047
|
}
|
|
3988
4048
|
const settings_patch = {
|
|
3989
4049
|
hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
|
|
3990
4050
|
};
|
|
3991
4051
|
return merge_json_file(
|
|
3992
|
-
|
|
4052
|
+
path10.join(GEMINI_USER_DIR, "settings.json"),
|
|
3993
4053
|
settings_patch,
|
|
3994
4054
|
force,
|
|
3995
4055
|
"~/.gemini/settings.json"
|
|
3996
4056
|
);
|
|
3997
4057
|
}
|
|
3998
4058
|
function ensure_copilot_bridge(project_root, force) {
|
|
3999
|
-
const target =
|
|
4059
|
+
const target = path10.join(project_root, ".github", "plugin", "marketplace.json");
|
|
4000
4060
|
const bridge = {
|
|
4001
4061
|
marketplace: {
|
|
4002
4062
|
name: "event4u-agent-marketplace",
|
|
@@ -4039,7 +4099,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
|
|
|
4039
4099
|
Run \`./agent-config --help\` for available commands.
|
|
4040
4100
|
`;
|
|
4041
4101
|
function ensure_roocode_bridge(project_root, force) {
|
|
4042
|
-
const target =
|
|
4102
|
+
const target = path10.join(project_root, ".roo", "rules", "agent-config.md");
|
|
4043
4103
|
if (pathExists(target) && !force) {
|
|
4044
4104
|
skip(".roo/rules/agent-config.md already exists");
|
|
4045
4105
|
return;
|
|
@@ -4061,7 +4121,7 @@ To wire Claude Desktop to this project's rules, run:
|
|
|
4061
4121
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
4062
4122
|
`;
|
|
4063
4123
|
function ensure_claude_desktop_bridge(project_root, force) {
|
|
4064
|
-
const target =
|
|
4124
|
+
const target = path10.join(project_root, ".claude-desktop", "agent-config.md");
|
|
4065
4125
|
if (pathExists(target) && !force) {
|
|
4066
4126
|
skip(".claude-desktop/agent-config.md already exists");
|
|
4067
4127
|
return;
|
|
@@ -4086,7 +4146,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
|
|
|
4086
4146
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
4087
4147
|
`;
|
|
4088
4148
|
function ensure_aider_bridge(project_root, force) {
|
|
4089
|
-
const target =
|
|
4149
|
+
const target = path10.join(project_root, ".aider", "agent-config.md");
|
|
4090
4150
|
if (pathExists(target) && !force) {
|
|
4091
4151
|
skip(".aider/agent-config.md already exists");
|
|
4092
4152
|
return;
|
|
@@ -4105,7 +4165,7 @@ developers where the rules and skills live.
|
|
|
4105
4165
|
Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
|
|
4106
4166
|
`;
|
|
4107
4167
|
function ensure_codex_bridge(project_root, force) {
|
|
4108
|
-
const target =
|
|
4168
|
+
const target = path10.join(project_root, ".codex", "agent-config.md");
|
|
4109
4169
|
if (pathExists(target) && !force) {
|
|
4110
4170
|
skip(".codex/agent-config.md already exists");
|
|
4111
4171
|
return;
|
|
@@ -4123,7 +4183,7 @@ rules per session. The canonical rule and skill source lives under
|
|
|
4123
4183
|
orientation).
|
|
4124
4184
|
`;
|
|
4125
4185
|
function ensure_continue_bridge(project_root, force) {
|
|
4126
|
-
const target =
|
|
4186
|
+
const target = path10.join(project_root, ".continue", "rules", "agent-config.md");
|
|
4127
4187
|
if (pathExists(target) && !force) {
|
|
4128
4188
|
skip(".continue/rules/agent-config.md already exists");
|
|
4129
4189
|
return;
|
|
@@ -4154,7 +4214,7 @@ orientation).
|
|
|
4154
4214
|
See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
|
|
4155
4215
|
`;
|
|
4156
4216
|
function ensure_kilocode_bridge(project_root, force) {
|
|
4157
|
-
const target =
|
|
4217
|
+
const target = path10.join(project_root, ".kilocode", "rules", "agent-config.md");
|
|
4158
4218
|
if (pathExists(target) && !force) {
|
|
4159
4219
|
skip(".kilocode/rules/agent-config.md already exists");
|
|
4160
4220
|
return;
|
|
@@ -4181,7 +4241,7 @@ canonical source (or symlink it):
|
|
|
4181
4241
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
4182
4242
|
`;
|
|
4183
4243
|
function ensure_zed_bridge(project_root, force) {
|
|
4184
|
-
const target =
|
|
4244
|
+
const target = path10.join(project_root, ".zed", "agent-config.md");
|
|
4185
4245
|
if (pathExists(target) && !force) {
|
|
4186
4246
|
skip(".zed/agent-config.md already exists");
|
|
4187
4247
|
return;
|
|
@@ -4202,7 +4262,7 @@ rules into your JetBrains profile.
|
|
|
4202
4262
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
4203
4263
|
`;
|
|
4204
4264
|
function ensure_jetbrains_bridge(project_root, force) {
|
|
4205
|
-
const target =
|
|
4265
|
+
const target = path10.join(project_root, ".jetbrains", "agent-config.md");
|
|
4206
4266
|
if (pathExists(target) && !force) {
|
|
4207
4267
|
skip(".jetbrains/agent-config.md already exists");
|
|
4208
4268
|
return;
|
|
@@ -4233,7 +4293,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
|
|
|
4233
4293
|
See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
|
|
4234
4294
|
`;
|
|
4235
4295
|
function ensure_kiro_bridge(project_root, force) {
|
|
4236
|
-
const target =
|
|
4296
|
+
const target = path10.join(project_root, ".kiro", "steering", "agent-config.md");
|
|
4237
4297
|
if (pathExists(target) && !force) {
|
|
4238
4298
|
skip(".kiro/steering/agent-config.md already exists");
|
|
4239
4299
|
return;
|
|
@@ -4241,14 +4301,25 @@ function ensure_kiro_bridge(project_root, force) {
|
|
|
4241
4301
|
write_file(target, KIRO_MARKER);
|
|
4242
4302
|
success(".kiro/steering/agent-config.md created");
|
|
4243
4303
|
}
|
|
4244
|
-
var
|
|
4304
|
+
var SMOKE_PROBE_SLOTS = [
|
|
4245
4305
|
["augment", "session_start"],
|
|
4246
|
-
["claude", "
|
|
4247
|
-
["cursor", "
|
|
4306
|
+
["claude", "session_start"],
|
|
4307
|
+
["cursor", "session_start"],
|
|
4248
4308
|
["cline", "session_start"],
|
|
4249
|
-
["windsurf", "
|
|
4250
|
-
["gemini", "
|
|
4309
|
+
["windsurf", "session_start"],
|
|
4310
|
+
["gemini", "session_start"]
|
|
4251
4311
|
];
|
|
4312
|
+
function smokeProbeEvents() {
|
|
4313
|
+
return SMOKE_PROBE_SLOTS.map(([platform, slot]) => {
|
|
4314
|
+
const binding = hostBindings(platform).find((b) => b.slot === slot);
|
|
4315
|
+
if (binding === void 0) {
|
|
4316
|
+
throw new Error(
|
|
4317
|
+
`install smoke probe: host_lowering.yaml has no \`${slot}\` binding for \`${platform}\``
|
|
4318
|
+
);
|
|
4319
|
+
}
|
|
4320
|
+
return [platform, binding.native];
|
|
4321
|
+
});
|
|
4322
|
+
}
|
|
4252
4323
|
var SMOKE_BRIDGE_PATHS = {
|
|
4253
4324
|
augment: ".augment/settings.json",
|
|
4254
4325
|
claude: ".claude/settings.json",
|
|
@@ -4259,35 +4330,35 @@ var SMOKE_BRIDGE_PATHS = {
|
|
|
4259
4330
|
};
|
|
4260
4331
|
function dirHasEntries(p) {
|
|
4261
4332
|
try {
|
|
4262
|
-
return
|
|
4333
|
+
return fs12.readdirSync(p).length > 0;
|
|
4263
4334
|
} catch {
|
|
4264
4335
|
return false;
|
|
4265
4336
|
}
|
|
4266
4337
|
}
|
|
4267
4338
|
function _resolve_tsx_invocation(scriptPath, scriptArgs) {
|
|
4268
4339
|
const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
4269
|
-
let dir =
|
|
4340
|
+
let dir = path10.dirname(scriptPath);
|
|
4270
4341
|
for (; ; ) {
|
|
4271
|
-
const candidate =
|
|
4342
|
+
const candidate = path10.join(dir, "node_modules", ".bin", binName);
|
|
4272
4343
|
if (isFile(candidate)) {
|
|
4273
4344
|
return { command: candidate, args: [scriptPath, ...scriptArgs] };
|
|
4274
4345
|
}
|
|
4275
|
-
const parent =
|
|
4346
|
+
const parent = path10.dirname(dir);
|
|
4276
4347
|
if (parent === dir) break;
|
|
4277
4348
|
dir = parent;
|
|
4278
4349
|
}
|
|
4279
4350
|
return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
|
|
4280
4351
|
}
|
|
4281
4352
|
function _smoke_test_hooks(project_root, package_root) {
|
|
4282
|
-
const dispatcher =
|
|
4283
|
-
const manifest =
|
|
4353
|
+
const dispatcher = path10.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
|
|
4354
|
+
const manifest = path10.join(package_root, "scripts", "hook_manifest.yaml");
|
|
4284
4355
|
if (!isFile(dispatcher) || !isFile(manifest)) return 0;
|
|
4285
4356
|
const failed = [];
|
|
4286
4357
|
const skipped = [];
|
|
4287
4358
|
const passed = [];
|
|
4288
|
-
for (const [platform, native] of
|
|
4359
|
+
for (const [platform, native] of smokeProbeEvents()) {
|
|
4289
4360
|
const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
|
|
4290
|
-
const bridge_path = rel_bridge ?
|
|
4361
|
+
const bridge_path = rel_bridge ? path10.join(project_root, rel_bridge) : null;
|
|
4291
4362
|
const bridge_present = Boolean(
|
|
4292
4363
|
bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
|
|
4293
4364
|
);
|
|
@@ -4487,9 +4558,9 @@ To remove this marker, delete this file.
|
|
|
4487
4558
|
`;
|
|
4488
4559
|
}
|
|
4489
4560
|
var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
|
|
4490
|
-
var GLOBAL_ROOT =
|
|
4491
|
-
var GLOBAL_USER_SETTINGS_PATH =
|
|
4492
|
-
var GLOBAL_AGENT_SETTINGS_PATH =
|
|
4561
|
+
var GLOBAL_ROOT = path10.join(os3.homedir(), ".event4u", "agent-config");
|
|
4562
|
+
var GLOBAL_USER_SETTINGS_PATH = path10.join(GLOBAL_ROOT, ".agent-user.yml");
|
|
4563
|
+
var GLOBAL_AGENT_SETTINGS_PATH = path10.join(GLOBAL_ROOT, ".agent-settings.yml");
|
|
4493
4564
|
function _bridge_marker(tool_id, scope) {
|
|
4494
4565
|
if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
|
|
4495
4566
|
return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
|
|
@@ -4538,7 +4609,7 @@ function _load_yaml_doc(p) {
|
|
|
4538
4609
|
return _isPlainObject(data) ? data : {};
|
|
4539
4610
|
}
|
|
4540
4611
|
function _load_default_settings(package_root) {
|
|
4541
|
-
const template_source =
|
|
4612
|
+
const template_source = path10.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
4542
4613
|
if (!pathExists(template_source)) return {};
|
|
4543
4614
|
let text;
|
|
4544
4615
|
try {
|
|
@@ -4552,11 +4623,11 @@ function _load_default_settings(package_root) {
|
|
|
4552
4623
|
}
|
|
4553
4624
|
var RULE_LAYER_CHOICES = ["global", "project", "both-acknowledged"];
|
|
4554
4625
|
function _suppress_rule_layer(project_root, suppress_dir) {
|
|
4555
|
-
const target =
|
|
4626
|
+
const target = path10.join(project_root, ".claude", "settings.local.json");
|
|
4556
4627
|
const existing = pathExists(target) ? read_json_file(target) : {};
|
|
4557
4628
|
let real_dir = suppress_dir;
|
|
4558
4629
|
try {
|
|
4559
|
-
real_dir =
|
|
4630
|
+
real_dir = fs12.realpathSync(suppress_dir);
|
|
4560
4631
|
} catch {
|
|
4561
4632
|
real_dir = suppress_dir;
|
|
4562
4633
|
}
|
|
@@ -4567,8 +4638,8 @@ function _suppress_rule_layer(project_root, suppress_dir) {
|
|
|
4567
4638
|
success(`.claude/settings.local.json: claudeMdExcludes += ${entry}`);
|
|
4568
4639
|
}
|
|
4569
4640
|
function _gate_rule_layer_overlap(project_root, layer, dry_run) {
|
|
4570
|
-
const global_dir =
|
|
4571
|
-
const project_dir =
|
|
4641
|
+
const global_dir = path10.join(os3.homedir(), ".claude", "rules");
|
|
4642
|
+
const project_dir = path10.join(project_root, ".claude", "rules");
|
|
4572
4643
|
const g = readRuleLayer(global_dir);
|
|
4573
4644
|
const p = readRuleLayer(project_dir);
|
|
4574
4645
|
if (g === null || p === null) return true;
|
|
@@ -4656,9 +4727,9 @@ function detect_scope(cwd) {
|
|
|
4656
4727
|
if (pathExists(_resolve_settings_read(cwd))) {
|
|
4657
4728
|
return ["project", `existing ${SETTINGS_FILE}`];
|
|
4658
4729
|
}
|
|
4659
|
-
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(
|
|
4660
|
-
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(
|
|
4661
|
-
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(
|
|
4730
|
+
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path10.join(cwd, m))) ?? null;
|
|
4731
|
+
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path10.join(cwd, d))) ?? null;
|
|
4732
|
+
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path10.join(cwd, f))) ?? null;
|
|
4662
4733
|
if (has_manifest && (has_ai_dir || has_ai_file)) {
|
|
4663
4734
|
const marker = has_ai_dir || has_ai_file;
|
|
4664
4735
|
return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
|
|
@@ -4679,7 +4750,7 @@ function readLineSyncRaw(promptText) {
|
|
|
4679
4750
|
for (; ; ) {
|
|
4680
4751
|
let n;
|
|
4681
4752
|
try {
|
|
4682
|
-
n =
|
|
4753
|
+
n = fs12.readSync(0, buf, 0, 1, null);
|
|
4683
4754
|
} catch (err) {
|
|
4684
4755
|
const code = err.code;
|
|
4685
4756
|
if (code === "EAGAIN") {
|
|
@@ -4754,8 +4825,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
|
|
|
4754
4825
|
const marker = _bridge_marker(tool_id, scope);
|
|
4755
4826
|
if (!marker) continue;
|
|
4756
4827
|
let marker_path = marker;
|
|
4757
|
-
if (!
|
|
4758
|
-
marker_path =
|
|
4828
|
+
if (!path10.isAbsolute(marker_path)) {
|
|
4829
|
+
marker_path = path10.join(project_root, marker_path);
|
|
4759
4830
|
}
|
|
4760
4831
|
out[tool_id] = [_file_entry(marker_path, "bridge", false)];
|
|
4761
4832
|
}
|
|
@@ -4794,26 +4865,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
|
|
|
4794
4865
|
}
|
|
4795
4866
|
write_manifest(target, version, entries);
|
|
4796
4867
|
if (!state.QUIET) {
|
|
4797
|
-
const rel = isRelativeTo(target, project_root) ?
|
|
4868
|
+
const rel = isRelativeTo(target, project_root) ? path10.relative(project_root, target) : target;
|
|
4798
4869
|
info(`Manifest updated: ${rel}`);
|
|
4799
4870
|
}
|
|
4800
4871
|
return 0;
|
|
4801
4872
|
}
|
|
4802
4873
|
function isRelativeTo(child, parent) {
|
|
4803
|
-
const rel =
|
|
4804
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
4874
|
+
const rel = path10.relative(parent, child);
|
|
4875
|
+
return rel === "" || !rel.startsWith("..") && !path10.isAbsolute(rel);
|
|
4805
4876
|
}
|
|
4806
4877
|
function _resolve_package_root_for_global() {
|
|
4807
4878
|
const here = resolvePath(_HERE);
|
|
4808
|
-
const candidate =
|
|
4809
|
-
if (!pathExists(
|
|
4879
|
+
const candidate = path10.dirname(path10.dirname(path10.dirname(here)));
|
|
4880
|
+
if (!pathExists(path10.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
|
|
4810
4881
|
fail(
|
|
4811
4882
|
`Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
|
|
4812
4883
|
);
|
|
4813
4884
|
}
|
|
4814
4885
|
return candidate;
|
|
4815
4886
|
}
|
|
4816
|
-
var CONSUMER_BRIDGE_MARKER_RELPATH =
|
|
4887
|
+
var CONSUMER_BRIDGE_MARKER_RELPATH = path10.join("agents", ".event4u-bridge.yml");
|
|
4817
4888
|
var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
4818
4889
|
var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
|
|
4819
4890
|
var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
|
|
@@ -4821,7 +4892,7 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
4821
4892
|
if (process2.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
|
|
4822
4893
|
return [false, "consumer-mode-override"];
|
|
4823
4894
|
}
|
|
4824
|
-
const pkg_json =
|
|
4895
|
+
const pkg_json = path10.join(project_root, "package.json");
|
|
4825
4896
|
if (isFile(pkg_json)) {
|
|
4826
4897
|
let data = {};
|
|
4827
4898
|
try {
|
|
@@ -4833,24 +4904,17 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
4833
4904
|
return [true, "package.json:name"];
|
|
4834
4905
|
}
|
|
4835
4906
|
}
|
|
4836
|
-
if (isDir(
|
|
4907
|
+
if (isDir(path10.join(project_root, ".agent-src.uncondensed"))) {
|
|
4837
4908
|
return [true, ".agent-src.uncondensed/"];
|
|
4838
4909
|
}
|
|
4839
|
-
const packages_dir =
|
|
4910
|
+
const packages_dir = path10.join(project_root, "packages");
|
|
4840
4911
|
if (isDir(packages_dir)) {
|
|
4841
|
-
for (const child of
|
|
4842
|
-
if (isDir(
|
|
4912
|
+
for (const child of fs12.readdirSync(packages_dir)) {
|
|
4913
|
+
if (isDir(path10.join(packages_dir, child, ".agent-src.uncondensed"))) {
|
|
4843
4914
|
return [true, `packages/${child}/.agent-src.uncondensed/`];
|
|
4844
4915
|
}
|
|
4845
4916
|
}
|
|
4846
4917
|
}
|
|
4847
|
-
const installer_self = path9.join(project_root, "scripts", "install.py");
|
|
4848
|
-
try {
|
|
4849
|
-
if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE)) {
|
|
4850
|
-
return [true, "src/scripts/install.py (self)"];
|
|
4851
|
-
}
|
|
4852
|
-
} catch {
|
|
4853
|
-
}
|
|
4854
4918
|
return [false, ""];
|
|
4855
4919
|
}
|
|
4856
4920
|
function _detect_legacy_for_migration(project_root) {
|
|
@@ -4864,17 +4928,17 @@ function _detect_legacy_for_migration(project_root) {
|
|
|
4864
4928
|
}
|
|
4865
4929
|
return [];
|
|
4866
4930
|
}
|
|
4867
|
-
if (isFile(
|
|
4931
|
+
if (isFile(path10.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
|
|
4868
4932
|
const found = [];
|
|
4869
4933
|
for (const name of MIGRATE_LEGACY_YAML_FILES) {
|
|
4870
|
-
if (isFile(
|
|
4934
|
+
if (isFile(path10.join(project_root, name))) {
|
|
4871
4935
|
found.push(name);
|
|
4872
|
-
} else if (isFile(
|
|
4936
|
+
} else if (isFile(path10.join(project_root, "settings", name))) {
|
|
4873
4937
|
found.push(`settings/${name}`);
|
|
4874
4938
|
}
|
|
4875
4939
|
}
|
|
4876
4940
|
for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
|
|
4877
|
-
const p =
|
|
4941
|
+
const p = path10.join(project_root, name);
|
|
4878
4942
|
if (isDir(p) && !isSymlink(p)) {
|
|
4879
4943
|
found.push(`${name}/`);
|
|
4880
4944
|
}
|
|
@@ -4886,7 +4950,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
|
|
|
4886
4950
|
process2.stdout.write("\n");
|
|
4887
4951
|
warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
|
|
4888
4952
|
for (const rel of artefacts) {
|
|
4889
|
-
info(` ${
|
|
4953
|
+
info(` ${path10.join(project_root, rel)}`);
|
|
4890
4954
|
}
|
|
4891
4955
|
info("The unified `agent-config migrate` sweeps these in one pass.");
|
|
4892
4956
|
info("The wizard recreates fresh config afterwards.");
|
|
@@ -4917,20 +4981,20 @@ function _run_migrate_to_global(project_root) {
|
|
|
4917
4981
|
function _format_global_root_for_marker(global_root) {
|
|
4918
4982
|
const home = resolvePath(os3.homedir());
|
|
4919
4983
|
const resolved = resolvePath(global_root);
|
|
4920
|
-
const rel =
|
|
4921
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
4984
|
+
const rel = path10.relative(home, resolved);
|
|
4985
|
+
if (rel === "" || rel.startsWith("..") || path10.isAbsolute(rel)) {
|
|
4922
4986
|
return global_root;
|
|
4923
4987
|
}
|
|
4924
|
-
return `~/${rel.split(
|
|
4988
|
+
return `~/${rel.split(path10.sep).join("/")}`;
|
|
4925
4989
|
}
|
|
4926
4990
|
function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
|
|
4927
4991
|
const env_map = env ?? process2.env;
|
|
4928
4992
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
|
|
4929
|
-
if (isDir(
|
|
4930
|
-
const target =
|
|
4993
|
+
if (isDir(path10.join(project_root, ".agent-src.uncondensed"))) return null;
|
|
4994
|
+
const target = path10.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
|
|
4931
4995
|
if (!isFile(target)) return null;
|
|
4932
4996
|
try {
|
|
4933
|
-
|
|
4997
|
+
fs12.rmSync(target);
|
|
4934
4998
|
} catch {
|
|
4935
4999
|
return null;
|
|
4936
5000
|
}
|
|
@@ -4944,7 +5008,7 @@ var PROJECT_ANCHOR_TOOLS = {
|
|
|
4944
5008
|
function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
|
|
4945
5009
|
const env_map = env ?? process2.env;
|
|
4946
5010
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
|
|
4947
|
-
if (isDir(
|
|
5011
|
+
if (isDir(path10.join(project_root, ".agent-src.uncondensed"))) return [];
|
|
4948
5012
|
const global_root_str = _format_global_root_for_marker(
|
|
4949
5013
|
event4u_root(env_map)
|
|
4950
5014
|
);
|
|
@@ -4953,8 +5017,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
|
|
|
4953
5017
|
for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
|
|
4954
5018
|
const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
|
|
4955
5019
|
if (!tools.has(tool_id)) continue;
|
|
4956
|
-
const target =
|
|
4957
|
-
mkdirp(
|
|
5020
|
+
const target = path10.join(project_root, rel_path);
|
|
5021
|
+
mkdirp(path10.dirname(target));
|
|
4958
5022
|
const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
|
|
4959
5023
|
# Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
|
|
4960
5024
|
# Tool: ${tool_id}. Resolves the global install directly \u2014 no
|
|
@@ -4972,7 +5036,7 @@ installed_at: ${stamp}
|
|
|
4972
5036
|
}
|
|
4973
5037
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
4974
5038
|
function _inject_package_tag(target, source, package_root) {
|
|
4975
|
-
if (
|
|
5039
|
+
if (path10.extname(target) !== ".md") return;
|
|
4976
5040
|
let text;
|
|
4977
5041
|
try {
|
|
4978
5042
|
text = readText(target);
|
|
@@ -5000,8 +5064,8 @@ function _inject_package_tag(target, source, package_root) {
|
|
|
5000
5064
|
resolved_src = source;
|
|
5001
5065
|
}
|
|
5002
5066
|
if (package_root !== null) {
|
|
5003
|
-
const rel =
|
|
5004
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
5067
|
+
const rel = path10.relative(resolvePath(package_root), resolved_src);
|
|
5068
|
+
if (rel !== "" && !rel.startsWith("..") && !path10.isAbsolute(rel)) {
|
|
5005
5069
|
source_value = rel;
|
|
5006
5070
|
} else {
|
|
5007
5071
|
source_value = resolved_src;
|
|
@@ -5036,7 +5100,7 @@ function _escapes_package_root(resolved, package_root) {
|
|
|
5036
5100
|
if (package_root === null) return false;
|
|
5037
5101
|
let root;
|
|
5038
5102
|
try {
|
|
5039
|
-
root =
|
|
5103
|
+
root = fs12.realpathSync(package_root);
|
|
5040
5104
|
} catch {
|
|
5041
5105
|
return false;
|
|
5042
5106
|
}
|
|
@@ -5051,7 +5115,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
5051
5115
|
if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
|
|
5052
5116
|
let resolved_src = src;
|
|
5053
5117
|
try {
|
|
5054
|
-
resolved_src =
|
|
5118
|
+
resolved_src = fs12.realpathSync(src);
|
|
5055
5119
|
} catch {
|
|
5056
5120
|
resolved_src = src;
|
|
5057
5121
|
}
|
|
@@ -5059,10 +5123,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
5059
5123
|
warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
|
|
5060
5124
|
return [0, 0, written_paths];
|
|
5061
5125
|
}
|
|
5062
|
-
mkdirp(
|
|
5126
|
+
mkdirp(path10.dirname(dest));
|
|
5063
5127
|
const decision = _resolve_file_conflict(dest, force);
|
|
5064
5128
|
if (decision === "skip") return [0, 1, written_paths];
|
|
5065
|
-
|
|
5129
|
+
fs12.copyFileSync(src, dest);
|
|
5066
5130
|
_inject_package_tag(dest, src, package_root);
|
|
5067
5131
|
written_paths.push(dest);
|
|
5068
5132
|
return [1, 0, written_paths];
|
|
@@ -5070,11 +5134,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
5070
5134
|
mkdirp(dest);
|
|
5071
5135
|
const walk = (node) => {
|
|
5072
5136
|
const acc = [];
|
|
5073
|
-
const names =
|
|
5137
|
+
const names = fs12.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
5074
5138
|
for (const name of names) {
|
|
5075
|
-
const entry =
|
|
5139
|
+
const entry = path10.join(node, name);
|
|
5076
5140
|
acc.push(entry);
|
|
5077
|
-
const lst =
|
|
5141
|
+
const lst = fs12.lstatSync(entry);
|
|
5078
5142
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
5079
5143
|
acc.push(...walk(entry));
|
|
5080
5144
|
}
|
|
@@ -5082,9 +5146,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
5082
5146
|
return acc;
|
|
5083
5147
|
};
|
|
5084
5148
|
for (const entry of walk(src)) {
|
|
5085
|
-
const rel =
|
|
5086
|
-
const target =
|
|
5087
|
-
const lst =
|
|
5149
|
+
const rel = path10.relative(src, entry);
|
|
5150
|
+
const target = path10.join(dest, rel);
|
|
5151
|
+
const lst = fs12.lstatSync(entry);
|
|
5088
5152
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
5089
5153
|
mkdirp(target);
|
|
5090
5154
|
continue;
|
|
@@ -5092,8 +5156,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
5092
5156
|
let resolvedIsDir = false;
|
|
5093
5157
|
let resolved = entry;
|
|
5094
5158
|
try {
|
|
5095
|
-
resolved =
|
|
5096
|
-
resolvedIsDir =
|
|
5159
|
+
resolved = fs12.realpathSync(entry);
|
|
5160
|
+
resolvedIsDir = fs12.statSync(entry).isDirectory();
|
|
5097
5161
|
} catch {
|
|
5098
5162
|
resolvedIsDir = false;
|
|
5099
5163
|
}
|
|
@@ -5123,8 +5187,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
5123
5187
|
skipped += 1;
|
|
5124
5188
|
continue;
|
|
5125
5189
|
}
|
|
5126
|
-
mkdirp(
|
|
5127
|
-
|
|
5190
|
+
mkdirp(path10.dirname(target));
|
|
5191
|
+
fs12.copyFileSync(resolved, target);
|
|
5128
5192
|
_inject_package_tag(target, resolved, package_root);
|
|
5129
5193
|
written += 1;
|
|
5130
5194
|
written_paths.push(target);
|
|
@@ -5136,7 +5200,7 @@ function _claude_desktop_bundles_dir() {
|
|
|
5136
5200
|
}
|
|
5137
5201
|
function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
|
|
5138
5202
|
const anchor = expanduser2(USER_SCOPE_PATHS["claude-desktop"]);
|
|
5139
|
-
const target =
|
|
5203
|
+
const target = path10.join(anchor, "agent-config.md");
|
|
5140
5204
|
mkdirp(anchor);
|
|
5141
5205
|
const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
|
|
5142
5206
|
writeText(target, body);
|
|
@@ -5160,23 +5224,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
5160
5224
|
const wrapped = [];
|
|
5161
5225
|
const collisions = [];
|
|
5162
5226
|
const reserved = [];
|
|
5163
|
-
const commands_dir =
|
|
5227
|
+
const commands_dir = path10.join(anchor, "commands");
|
|
5164
5228
|
let flat_entries = [];
|
|
5165
5229
|
try {
|
|
5166
|
-
flat_entries =
|
|
5230
|
+
flat_entries = fs12.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
|
|
5167
5231
|
} catch {
|
|
5168
5232
|
}
|
|
5169
5233
|
for (const fname of flat_entries.sort()) {
|
|
5170
5234
|
const slug = fname.slice(0, -".md".length);
|
|
5171
5235
|
if (!is_claude_builtin_name(slug)) continue;
|
|
5172
|
-
|
|
5236
|
+
fs12.rmSync(path10.join(commands_dir, fname), { force: true });
|
|
5173
5237
|
current_files.delete(`commands/${fname}`);
|
|
5174
5238
|
reserved.push(slug);
|
|
5175
5239
|
}
|
|
5176
5240
|
const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
|
|
5177
5241
|
try {
|
|
5178
5242
|
const manifest = JSON.parse(
|
|
5179
|
-
|
|
5243
|
+
fs12.readFileSync(path10.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
|
|
5180
5244
|
);
|
|
5181
5245
|
for (const a of manifest.artefacts ?? []) {
|
|
5182
5246
|
if (a.category !== "command" || typeof a.slug !== "string") continue;
|
|
@@ -5187,22 +5251,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
5187
5251
|
}
|
|
5188
5252
|
for (const slug of [...eligible].sort()) {
|
|
5189
5253
|
const flat_rel = `commands/${slug}.md`;
|
|
5190
|
-
const flat_abs =
|
|
5191
|
-
if (!
|
|
5192
|
-
const skill_dir =
|
|
5193
|
-
if (
|
|
5254
|
+
const flat_abs = path10.join(anchor, "commands", `${slug}.md`);
|
|
5255
|
+
if (!fs12.existsSync(flat_abs)) continue;
|
|
5256
|
+
const skill_dir = path10.join(anchor, "skills", slug);
|
|
5257
|
+
if (fs12.existsSync(skill_dir)) {
|
|
5194
5258
|
collisions.push(slug);
|
|
5195
5259
|
continue;
|
|
5196
5260
|
}
|
|
5197
|
-
let body =
|
|
5261
|
+
let body = fs12.readFileSync(flat_abs, "utf8");
|
|
5198
5262
|
if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
|
|
5199
5263
|
body = body.replace("---\n", `---
|
|
5200
5264
|
name: ${slug}
|
|
5201
5265
|
`);
|
|
5202
5266
|
}
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5267
|
+
fs12.mkdirSync(skill_dir, { recursive: true });
|
|
5268
|
+
fs12.writeFileSync(path10.join(skill_dir, "SKILL.md"), body, "utf8");
|
|
5269
|
+
fs12.rmSync(flat_abs, { force: true });
|
|
5206
5270
|
current_files.delete(flat_rel);
|
|
5207
5271
|
current_files.add(`skills/${slug}/SKILL.md`);
|
|
5208
5272
|
wrapped.push(slug);
|
|
@@ -5234,8 +5298,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
5234
5298
|
const written_paths = [];
|
|
5235
5299
|
let current_files = /* @__PURE__ */ new Set();
|
|
5236
5300
|
for (const [src_rel, dest_sub] of plan) {
|
|
5237
|
-
const src =
|
|
5238
|
-
const dest = dest_sub ?
|
|
5301
|
+
const src = path10.join(package_root, src_rel);
|
|
5302
|
+
const dest = dest_sub ? path10.join(anchor, dest_sub) : anchor;
|
|
5239
5303
|
const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
|
|
5240
5304
|
const [w, s, paths] = _copy_dir_dereferencing_symlinks(
|
|
5241
5305
|
src,
|
|
@@ -5259,7 +5323,7 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
5259
5323
|
if (tool_id === "claude-code") {
|
|
5260
5324
|
const res = _apply_claude_flat_command_wrappers(anchor, package_root, current_files);
|
|
5261
5325
|
rewriteAndReport(
|
|
5262
|
-
|
|
5326
|
+
path10.join(anchor, "rules"),
|
|
5263
5327
|
state.QUIET,
|
|
5264
5328
|
info,
|
|
5265
5329
|
warn,
|
|
@@ -5306,10 +5370,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
5306
5370
|
results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
|
|
5307
5371
|
if (tool_id === "claude-code") {
|
|
5308
5372
|
try {
|
|
5309
|
-
const manifest =
|
|
5373
|
+
const manifest = path10.join(package_root, "src", "scripts", "hook_manifest.yaml");
|
|
5310
5374
|
const matrix = build_claude_hook_matrix(manifest);
|
|
5311
5375
|
const res = ensure_managed_hooks(
|
|
5312
|
-
|
|
5376
|
+
path10.join(anchor, "settings.json"),
|
|
5313
5377
|
matrix
|
|
5314
5378
|
);
|
|
5315
5379
|
if (!state.QUIET) {
|
|
@@ -5346,7 +5410,7 @@ function _preview_global_reap(tools, package_root) {
|
|
|
5346
5410
|
const anchor = expanduser2(anchor_raw);
|
|
5347
5411
|
let current_files = /* @__PURE__ */ new Set();
|
|
5348
5412
|
for (const [src_rel, dest_sub] of plan) {
|
|
5349
|
-
const src =
|
|
5413
|
+
const src = path10.join(package_root, src_rel);
|
|
5350
5414
|
current_files = setUnion(
|
|
5351
5415
|
current_files,
|
|
5352
5416
|
expected_deploy_files(
|
|
@@ -5380,14 +5444,14 @@ function _preview_global_reap(tools, package_root) {
|
|
|
5380
5444
|
function _verify_deploy_targets(anchor, plan) {
|
|
5381
5445
|
const missing = [];
|
|
5382
5446
|
for (const [, dest_sub] of plan) {
|
|
5383
|
-
const target = dest_sub ?
|
|
5447
|
+
const target = dest_sub ? path10.join(anchor, dest_sub) : anchor;
|
|
5384
5448
|
const label = dest_sub || ".";
|
|
5385
5449
|
if (!isDir(target)) {
|
|
5386
5450
|
missing.push(label);
|
|
5387
5451
|
continue;
|
|
5388
5452
|
}
|
|
5389
5453
|
try {
|
|
5390
|
-
const entries =
|
|
5454
|
+
const entries = fs12.readdirSync(target);
|
|
5391
5455
|
if (entries.length === 0) missing.push(label);
|
|
5392
5456
|
} catch {
|
|
5393
5457
|
missing.push(label);
|
|
@@ -5405,9 +5469,9 @@ function _resolve_global_settings_doc() {
|
|
|
5405
5469
|
}
|
|
5406
5470
|
function _resolve_global_settings_path() {
|
|
5407
5471
|
const root = event4u_root();
|
|
5408
|
-
const canonical =
|
|
5472
|
+
const canonical = path10.join(root, "settings", SETTINGS_FILE);
|
|
5409
5473
|
if (pathExists(canonical)) return canonical;
|
|
5410
|
-
const legacy =
|
|
5474
|
+
const legacy = path10.join(root, SETTINGS_FILE);
|
|
5411
5475
|
if (pathExists(legacy)) return legacy;
|
|
5412
5476
|
return null;
|
|
5413
5477
|
}
|
|
@@ -5518,7 +5582,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
5518
5582
|
info(` schema_version=1, agent_config_version=${installed_version}`);
|
|
5519
5583
|
info(` tools=${merged_tools.join(",")}`);
|
|
5520
5584
|
}
|
|
5521
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
5585
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path10.join(project_root, ".agent-src.uncondensed"))) {
|
|
5522
5586
|
const drift = collect_drift(project_root);
|
|
5523
5587
|
if (!state.QUIET) {
|
|
5524
5588
|
process2.stdout.write("\n");
|
|
@@ -5632,19 +5696,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
5632
5696
|
}
|
|
5633
5697
|
}
|
|
5634
5698
|
}
|
|
5635
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
5699
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path10.join(project_root, ".agent-src.uncondensed"))) {
|
|
5636
5700
|
const files_by_tool = _files_by_tool_from_deploy(deploy_results);
|
|
5637
5701
|
const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
|
|
5638
5702
|
if (rc !== 0) return rc;
|
|
5639
5703
|
const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
|
|
5640
5704
|
if (removed_marker !== null && !state.QUIET) {
|
|
5641
|
-
const rel = isRelativeTo(removed_marker, project_root) ?
|
|
5705
|
+
const rel = isRelativeTo(removed_marker, project_root) ? path10.relative(project_root, removed_marker) : removed_marker;
|
|
5642
5706
|
info(`Removed legacy bridge marker: ${rel}`);
|
|
5643
5707
|
}
|
|
5644
5708
|
const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
|
|
5645
5709
|
if (anchor_paths.length > 0 && !state.QUIET) {
|
|
5646
5710
|
for (const p of anchor_paths) {
|
|
5647
|
-
const rel = isRelativeTo(p, project_root) ?
|
|
5711
|
+
const rel = isRelativeTo(p, project_root) ? path10.relative(project_root, p) : p;
|
|
5648
5712
|
info(`Project anchor written: ${rel}`);
|
|
5649
5713
|
}
|
|
5650
5714
|
}
|
|
@@ -5680,8 +5744,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
5680
5744
|
}
|
|
5681
5745
|
function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
5682
5746
|
const log_candidates = [
|
|
5683
|
-
|
|
5684
|
-
...project_root ? [
|
|
5747
|
+
path10.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
5748
|
+
...project_root ? [path10.join(project_root, OBSERVATION_LOG)] : []
|
|
5685
5749
|
];
|
|
5686
5750
|
const records = log_candidates.flatMap((p) => readObservationLog(p));
|
|
5687
5751
|
if (records.length === 0) return [];
|
|
@@ -5704,13 +5768,13 @@ function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
|
5704
5768
|
function _scoped_migration_notice(deploy_results, project_root, package_root, probe) {
|
|
5705
5769
|
if (!isInteractiveSession(probe)) return [];
|
|
5706
5770
|
const log_candidates = [
|
|
5707
|
-
|
|
5708
|
-
...project_root ? [
|
|
5771
|
+
path10.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
5772
|
+
...project_root ? [path10.join(project_root, OBSERVATION_LOG)] : []
|
|
5709
5773
|
];
|
|
5710
5774
|
const limits = knownHostLimits(log_candidates.flatMap((p) => readObservationLog(p)));
|
|
5711
5775
|
if (limits.size === 0) return [];
|
|
5712
5776
|
const resolved = _resolve_scoped_projection(package_root);
|
|
5713
|
-
const settings_path = _resolve_global_settings_path() ??
|
|
5777
|
+
const settings_path = _resolve_global_settings_path() ?? path10.join(event4u_root(), "settings", SETTINGS_FILE);
|
|
5714
5778
|
for (const tool_id of Object.keys(deploy_results).sort()) {
|
|
5715
5779
|
const [, , status] = deploy_results[tool_id];
|
|
5716
5780
|
if (status !== "deployed") continue;
|
|
@@ -5729,8 +5793,8 @@ function _scoped_migration_notice(deploy_results, project_root, package_root, pr
|
|
|
5729
5793
|
}
|
|
5730
5794
|
return [];
|
|
5731
5795
|
}
|
|
5732
|
-
var SETTINGS_SURFACE_REL =
|
|
5733
|
-
var SETTINGS_DELTA_REL =
|
|
5796
|
+
var SETTINGS_SURFACE_REL = path10.join("state", "settings-surface.json");
|
|
5797
|
+
var SETTINGS_DELTA_REL = path10.join("state", "settings-delta.json");
|
|
5734
5798
|
function _current_settings_surface(version) {
|
|
5735
5799
|
const jsonSchema = zodToJsonSchema(settingsSchema, {
|
|
5736
5800
|
name: "AgentSettings",
|
|
@@ -5741,20 +5805,20 @@ function _current_settings_surface(version) {
|
|
|
5741
5805
|
}
|
|
5742
5806
|
function _write_settings_surface_snapshot(installed_version) {
|
|
5743
5807
|
const root = event4u_root();
|
|
5744
|
-
const surface_path =
|
|
5745
|
-
const delta_path =
|
|
5808
|
+
const surface_path = path10.join(root, SETTINGS_SURFACE_REL);
|
|
5809
|
+
const delta_path = path10.join(root, SETTINGS_DELTA_REL);
|
|
5746
5810
|
const next = _current_settings_surface(installed_version);
|
|
5747
5811
|
let previous = null;
|
|
5748
5812
|
try {
|
|
5749
|
-
const parsed = JSON.parse(
|
|
5813
|
+
const parsed = JSON.parse(fs12.readFileSync(surface_path, "utf8"));
|
|
5750
5814
|
if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
|
|
5751
5815
|
} catch {
|
|
5752
5816
|
}
|
|
5753
5817
|
if (previous !== null && previous.version !== next.version) {
|
|
5754
5818
|
const delta = computeSurfaceDelta(previous, next);
|
|
5755
5819
|
if (delta.changes.length > 0) {
|
|
5756
|
-
|
|
5757
|
-
|
|
5820
|
+
fs12.mkdirSync(path10.dirname(delta_path), { recursive: true, mode: 448 });
|
|
5821
|
+
fs12.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
|
|
5758
5822
|
`, { mode: 384 });
|
|
5759
5823
|
if (!state.QUIET) {
|
|
5760
5824
|
const counts = {};
|
|
@@ -5766,8 +5830,8 @@ function _write_settings_surface_snapshot(installed_version) {
|
|
|
5766
5830
|
}
|
|
5767
5831
|
}
|
|
5768
5832
|
}
|
|
5769
|
-
|
|
5770
|
-
|
|
5833
|
+
fs12.mkdirSync(path10.dirname(surface_path), { recursive: true, mode: 448 });
|
|
5834
|
+
fs12.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
|
|
5771
5835
|
`, { mode: 384 });
|
|
5772
5836
|
}
|
|
5773
5837
|
function arrayStrEqual(a, b) {
|
|
@@ -5784,7 +5848,7 @@ function _merge_tools_aliases(tools, ai) {
|
|
|
5784
5848
|
}
|
|
5785
5849
|
return items.length > 0 ? items.join(",") : "all";
|
|
5786
5850
|
}
|
|
5787
|
-
var PROG = "install
|
|
5851
|
+
var PROG = "agent-config install";
|
|
5788
5852
|
var USAGE = `usage: ${PROG} [-h] [--profile PROFILE] [--user-type USER_TYPE] [--force]
|
|
5789
5853
|
[--skip-bridges] [--augment-user-hooks]
|
|
5790
5854
|
[--cursor-user-hooks] [--cline-user-hooks]
|
|
@@ -5987,13 +6051,13 @@ function _minimal_templates_root() {
|
|
|
5987
6051
|
const chain = [start];
|
|
5988
6052
|
let cur = start;
|
|
5989
6053
|
for (; ; ) {
|
|
5990
|
-
const parent =
|
|
6054
|
+
const parent = path10.dirname(cur);
|
|
5991
6055
|
if (parent === cur) break;
|
|
5992
6056
|
chain.push(parent);
|
|
5993
6057
|
cur = parent;
|
|
5994
6058
|
}
|
|
5995
6059
|
for (const ancestor of chain) {
|
|
5996
|
-
const candidate =
|
|
6060
|
+
const candidate = path10.join(ancestor, "src", "templates", "minimal");
|
|
5997
6061
|
if (isDir(candidate)) return candidate;
|
|
5998
6062
|
}
|
|
5999
6063
|
fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
|
|
@@ -6001,9 +6065,9 @@ function _minimal_templates_root() {
|
|
|
6001
6065
|
var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
6002
6066
|
function _write_install_mode_marker(project_root, mode) {
|
|
6003
6067
|
if (mode !== "minimal" && mode !== "full") return;
|
|
6004
|
-
const marker =
|
|
6068
|
+
const marker = path10.join(project_root, INSTALL_MODE_MARKER_REL);
|
|
6005
6069
|
try {
|
|
6006
|
-
mkdirp(
|
|
6070
|
+
mkdirp(path10.dirname(marker));
|
|
6007
6071
|
writeText(marker, `${mode}
|
|
6008
6072
|
`);
|
|
6009
6073
|
} catch {
|
|
@@ -6012,7 +6076,7 @@ function _write_install_mode_marker(project_root, mode) {
|
|
|
6012
6076
|
function install_minimal(target_root_in, force, user_type = "") {
|
|
6013
6077
|
let target_root = resolvePath(target_root_in);
|
|
6014
6078
|
mkdirp(target_root);
|
|
6015
|
-
const parent =
|
|
6079
|
+
const parent = path10.dirname(target_root);
|
|
6016
6080
|
if (parent !== target_root) {
|
|
6017
6081
|
const existing = find_project_root_with_anchor(parent);
|
|
6018
6082
|
if (existing !== null && existing[0] !== target_root) {
|
|
@@ -6023,21 +6087,21 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
6023
6087
|
}
|
|
6024
6088
|
}
|
|
6025
6089
|
const templates = _minimal_templates_root();
|
|
6026
|
-
const settings_src =
|
|
6027
|
-
const overrides_gitkeep_src =
|
|
6028
|
-
const overrides_readme_src =
|
|
6090
|
+
const settings_src = path10.join(templates, SETTINGS_FILE);
|
|
6091
|
+
const overrides_gitkeep_src = path10.join(templates, "overrides-gitkeep");
|
|
6092
|
+
const overrides_readme_src = path10.join(templates, "agents-overrides-readme.md");
|
|
6029
6093
|
if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
|
|
6030
6094
|
if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
|
|
6031
6095
|
fail(`Bundled overrides scaffold templates missing under ${templates}`);
|
|
6032
6096
|
}
|
|
6033
6097
|
info(`Minimal init \u2192 ${target_root}`);
|
|
6034
|
-
const overrides_root =
|
|
6098
|
+
const overrides_root = path10.join(target_root, "agents", "overrides");
|
|
6035
6099
|
mkdirp(overrides_root);
|
|
6036
6100
|
const gitkeep_body = readText(overrides_gitkeep_src);
|
|
6037
6101
|
for (const sub of ["rules", "skills", "commands"]) {
|
|
6038
|
-
const sub_dir =
|
|
6102
|
+
const sub_dir = path10.join(overrides_root, sub);
|
|
6039
6103
|
mkdirp(sub_dir);
|
|
6040
|
-
const gitkeep_dst =
|
|
6104
|
+
const gitkeep_dst = path10.join(sub_dir, ".gitkeep");
|
|
6041
6105
|
if (pathExists(gitkeep_dst) && !force) {
|
|
6042
6106
|
skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
|
|
6043
6107
|
} else {
|
|
@@ -6045,7 +6109,7 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
6045
6109
|
success(`Wrote agents/overrides/${sub}/.gitkeep`);
|
|
6046
6110
|
}
|
|
6047
6111
|
}
|
|
6048
|
-
const readme_dst =
|
|
6112
|
+
const readme_dst = path10.join(overrides_root, "README.md");
|
|
6049
6113
|
if (pathExists(readme_dst) && !force) {
|
|
6050
6114
|
skip("agents/overrides/README.md already exists (use --force to overwrite)");
|
|
6051
6115
|
} else {
|
|
@@ -6063,14 +6127,14 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
6063
6127
|
personal:
|
|
6064
6128
|
user_type: ${user_type}
|
|
6065
6129
|
`;
|
|
6066
|
-
mkdirp(
|
|
6130
|
+
mkdirp(path10.dirname(settings_dst));
|
|
6067
6131
|
writeText(settings_dst, body);
|
|
6068
6132
|
success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
|
|
6069
6133
|
}
|
|
6070
6134
|
}
|
|
6071
6135
|
const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
|
|
6072
6136
|
if (removed_marker !== null) {
|
|
6073
|
-
const rel = isRelativeTo(removed_marker, target_root) ?
|
|
6137
|
+
const rel = isRelativeTo(removed_marker, target_root) ? path10.relative(target_root, removed_marker) : removed_marker;
|
|
6074
6138
|
success(`Removed legacy bridge marker: ${rel}`);
|
|
6075
6139
|
}
|
|
6076
6140
|
_write_install_mode_marker(target_root, "minimal");
|
|
@@ -6144,7 +6208,7 @@ function run_interactive_init(project_root, force) {
|
|
|
6144
6208
|
);
|
|
6145
6209
|
return 0;
|
|
6146
6210
|
}
|
|
6147
|
-
const target =
|
|
6211
|
+
const target = path10.join(project_root, _LOCAL_CONFIG_FILE);
|
|
6148
6212
|
if (pathExists(target) && !force) {
|
|
6149
6213
|
warn(
|
|
6150
6214
|
`${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
|
|
@@ -6171,7 +6235,7 @@ function run_interactive_init(project_root, force) {
|
|
|
6171
6235
|
warn(`Could not write ${target}: ${String(exc)}`);
|
|
6172
6236
|
return 1;
|
|
6173
6237
|
}
|
|
6174
|
-
success(`Wrote ${
|
|
6238
|
+
success(`Wrote ${path10.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
|
|
6175
6239
|
return 0;
|
|
6176
6240
|
}
|
|
6177
6241
|
var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
|
|
@@ -6189,12 +6253,12 @@ function _wizard_should_launch(opts) {
|
|
|
6189
6253
|
return [true, ""];
|
|
6190
6254
|
}
|
|
6191
6255
|
function _wizard_cli_dist(_project_root) {
|
|
6192
|
-
const package_root =
|
|
6193
|
-
const cli =
|
|
6256
|
+
const package_root = path10.dirname(path10.dirname(path10.dirname(resolvePath(_HERE))));
|
|
6257
|
+
const cli = path10.join(package_root, "dist", "cli", "agent-config.js");
|
|
6194
6258
|
return pathExists(cli) ? cli : null;
|
|
6195
6259
|
}
|
|
6196
6260
|
function _server_info_path() {
|
|
6197
|
-
return
|
|
6261
|
+
return path10.join(os3.homedir(), ".event4u", "agent-config", "local-server.json");
|
|
6198
6262
|
}
|
|
6199
6263
|
function _pid_is_agent_config(pid) {
|
|
6200
6264
|
let res;
|
|
@@ -6211,7 +6275,7 @@ function _pid_is_agent_config(pid) {
|
|
|
6211
6275
|
}
|
|
6212
6276
|
function unlinkMissingOk(p) {
|
|
6213
6277
|
try {
|
|
6214
|
-
|
|
6278
|
+
fs12.unlinkSync(p);
|
|
6215
6279
|
} catch {
|
|
6216
6280
|
}
|
|
6217
6281
|
}
|
|
@@ -6289,14 +6353,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
|
|
|
6289
6353
|
}
|
|
6290
6354
|
function _wizard_run_sync(cmd, env, cli) {
|
|
6291
6355
|
const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
|
|
6292
|
-
const log_path =
|
|
6356
|
+
const log_path = path10.join(
|
|
6293
6357
|
os3.tmpdir(),
|
|
6294
6358
|
`agent-config-wizard-${process2.pid}-${Date.now()}.log`
|
|
6295
6359
|
);
|
|
6296
6360
|
let child;
|
|
6297
6361
|
let log_fd = null;
|
|
6298
6362
|
try {
|
|
6299
|
-
log_fd =
|
|
6363
|
+
log_fd = fs12.openSync(log_path, "w");
|
|
6300
6364
|
child = spawn(cmd[0], cmd.slice(1), {
|
|
6301
6365
|
env,
|
|
6302
6366
|
detached: true,
|
|
@@ -6314,7 +6378,7 @@ function _wizard_run_sync(cmd, env, cli) {
|
|
|
6314
6378
|
} finally {
|
|
6315
6379
|
if (log_fd !== null) {
|
|
6316
6380
|
try {
|
|
6317
|
-
|
|
6381
|
+
fs12.closeSync(log_fd);
|
|
6318
6382
|
} catch {
|
|
6319
6383
|
}
|
|
6320
6384
|
}
|
|
@@ -6564,8 +6628,8 @@ function main2(argv) {
|
|
|
6564
6628
|
const target_root = resolvePath(
|
|
6565
6629
|
opts.custom_path || opts.project || process2.env["PROJECT_ROOT"] || process2.cwd()
|
|
6566
6630
|
);
|
|
6567
|
-
const minimal_package_root =
|
|
6568
|
-
|
|
6631
|
+
const minimal_package_root = path10.dirname(
|
|
6632
|
+
path10.dirname(path10.dirname(_minimal_templates_root()))
|
|
6569
6633
|
);
|
|
6570
6634
|
const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
|
|
6571
6635
|
return install_minimal(target_root, opts.force, validated_user_type);
|
|
@@ -6597,7 +6661,7 @@ function main2(argv) {
|
|
|
6597
6661
|
return rc2;
|
|
6598
6662
|
}
|
|
6599
6663
|
const project_root = custom_path || resolvePath(opts.project || process2.env["PROJECT_ROOT"] || process2.cwd());
|
|
6600
|
-
const is_first_run = !pathExists(
|
|
6664
|
+
const is_first_run = !pathExists(path10.join(project_root, SETTINGS_FILE));
|
|
6601
6665
|
const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
|
|
6602
6666
|
if (rc === 0 && opts.interactive) {
|
|
6603
6667
|
run_interactive_init(project_root, opts.force);
|
|
@@ -6661,16 +6725,16 @@ function _team_setup_hint_line(project_root) {
|
|
|
6661
6725
|
return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
|
|
6662
6726
|
}
|
|
6663
6727
|
function finalize_claude_model_tiers(project_root) {
|
|
6664
|
-
const claude_skills =
|
|
6665
|
-
const augment_skills =
|
|
6728
|
+
const claude_skills = path10.join(project_root, ".claude", "skills");
|
|
6729
|
+
const augment_skills = path10.join(project_root, ".augment", "skills");
|
|
6666
6730
|
if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
|
|
6667
6731
|
if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
|
|
6668
6732
|
let rendered = 0;
|
|
6669
|
-
const entries =
|
|
6733
|
+
const entries = fs12.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
6670
6734
|
for (const name of entries) {
|
|
6671
|
-
const entry =
|
|
6672
|
-
const src_dir =
|
|
6673
|
-
const src_md =
|
|
6735
|
+
const entry = path10.join(claude_skills, name);
|
|
6736
|
+
const src_dir = path10.join(augment_skills, name);
|
|
6737
|
+
const src_md = path10.join(src_dir, "SKILL.md");
|
|
6674
6738
|
let tier;
|
|
6675
6739
|
try {
|
|
6676
6740
|
tier = read_model_tier(src_md);
|
|
@@ -6679,22 +6743,22 @@ function finalize_claude_model_tiers(project_root) {
|
|
|
6679
6743
|
}
|
|
6680
6744
|
if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
|
|
6681
6745
|
if (isSymlink(entry) || isFile(entry)) {
|
|
6682
|
-
|
|
6746
|
+
fs12.unlinkSync(entry);
|
|
6683
6747
|
} else if (isDir(entry)) {
|
|
6684
|
-
|
|
6748
|
+
fs12.rmSync(entry, { recursive: true, force: true });
|
|
6685
6749
|
}
|
|
6686
6750
|
mkdirp(entry);
|
|
6687
|
-
const srcFiles =
|
|
6751
|
+
const srcFiles = fs12.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
6688
6752
|
for (const fname of srcFiles) {
|
|
6689
6753
|
if (fname === "SKILL.md") {
|
|
6690
6754
|
writeText(
|
|
6691
|
-
|
|
6755
|
+
path10.join(entry, "SKILL.md"),
|
|
6692
6756
|
render_native_model_md(readText(src_md), tier)
|
|
6693
6757
|
);
|
|
6694
6758
|
} else {
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6759
|
+
fs12.symlinkSync(
|
|
6760
|
+
path10.join("../../../.augment/skills", name, fname),
|
|
6761
|
+
path10.join(entry, fname)
|
|
6698
6762
|
);
|
|
6699
6763
|
}
|
|
6700
6764
|
}
|
|
@@ -6712,7 +6776,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
6712
6776
|
let package_type;
|
|
6713
6777
|
if (opts.package) {
|
|
6714
6778
|
package_root = resolvePath(opts.package);
|
|
6715
|
-
if (!pathExists(
|
|
6779
|
+
if (!pathExists(path10.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
6716
6780
|
fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
|
|
6717
6781
|
}
|
|
6718
6782
|
package_type = detect_package_type_for_project(project_root, package_root);
|
|
@@ -6856,9 +6920,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
6856
6920
|
function _resolvedArgv1() {
|
|
6857
6921
|
if (process2.argv[1] === void 0) return void 0;
|
|
6858
6922
|
try {
|
|
6859
|
-
return
|
|
6923
|
+
return fs12.realpathSync(path10.resolve(process2.argv[1]));
|
|
6860
6924
|
} catch {
|
|
6861
|
-
return
|
|
6925
|
+
return path10.resolve(process2.argv[1]);
|
|
6862
6926
|
}
|
|
6863
6927
|
}
|
|
6864
6928
|
var _argv1 = _resolvedArgv1();
|