@event4u/agent-config 14.6.0 → 14.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +260 -7
- package/README.md +1 -1
- package/dist/agent-src/commands/analyze/inbox.md +264 -10
- package/dist/agent-src/commands/analyze.md +1 -1
- package/dist/agent-src/commands/roadmap/process-full.md +116 -30
- package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +31 -0
- package/dist/agent-src/contexts/execution/roadmap-process-loop.md +135 -104
- package/dist/agent-src/rules/context-hygiene.md +2 -0
- package/dist/agent-src/rules/decision-revisit-gate.md +3 -0
- package/dist/agent-src/rules/fix-what-you-see.md +108 -0
- package/dist/agent-src/rules/no-roadmap-references.md +0 -5
- package/dist/agent-src/rules/recurring-criticism.md +110 -0
- package/dist/agent-src/rules/roadmap-progress-sync.md +1 -1
- package/dist/agent-src/rules/rule-type-governance.md +0 -2
- package/dist/agent-src/rules/self-repair-loop.md +17 -0
- package/dist/agent-src/rules/skill-quality.md +0 -2
- package/dist/agent-src/rules/source-confidentiality.md +37 -7
- package/dist/agent-src/scripts/archival_sweep.ts +117 -0
- package/dist/agent-src/scripts/archive_completed_roadmaps.ts +19 -3
- package/dist/agent-src/scripts/gate_budget.ts +282 -0
- package/dist/agent-src/scripts/gate_execute.ts +72 -31
- package/dist/agent-src/scripts/roadmap_gates.ts +74 -3
- package/dist/agent-src/scripts/update_roadmap_progress.ts +251 -7
- package/dist/agent-src/skills/ai-council/SKILL.md +48 -807
- package/dist/agent-src/skills/ai-council/references/advanced-modes.md +320 -0
- package/dist/agent-src/skills/ai-council/references/cost-and-redaction.md +99 -0
- package/dist/agent-src/skills/ai-council/references/execution-modes.md +162 -0
- package/dist/agent-src/skills/ai-council/references/output-and-synthesis.md +125 -0
- package/dist/agent-src/skills/ai-council/references/procedure.md +143 -0
- package/dist/agent-src/skills/quality-tools/SKILL.md +34 -326
- package/dist/agent-src/skills/quality-tools/references/js-ts-tools.md +113 -0
- package/dist/agent-src/skills/quality-tools/references/php-tools.md +222 -0
- package/dist/agent-src/skills/roadmap-management/SKILL.md +15 -409
- package/dist/agent-src/skills/roadmap-management/references/archival.md +226 -0
- package/dist/agent-src/skills/roadmap-management/references/authoring.md +107 -0
- package/dist/agent-src/skills/roadmap-management/references/dashboard.md +47 -0
- package/dist/agent-src/skills/roadmap-management/references/lifecycle.md +58 -0
- package/dist/agent-src/skills/skill-writing/SKILL.md +34 -570
- package/dist/agent-src/skills/skill-writing/references/procedure.md +275 -0
- package/dist/agent-src/skills/skill-writing/references/read-only-scripts.md +18 -0
- package/dist/agent-src/skills/skill-writing/references/section-patterns.md +298 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +45 -2
- package/dist/agent-src/templates/scripts/telemetry/flush_sender.mjs +163 -0
- package/dist/agent-src/templates/scripts/telemetry/remote.ts +160 -7
- package/dist/agent-src/templates/scripts/telemetry/transport.ts +169 -0
- package/dist/cli/registry.js +1 -1
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/chunk-2GNWGMAL.js +172 -0
- package/dist/cli-delegate/{chunk-RLN73PR5.js → chunk-4VR4ORQ6.js} +10 -7
- package/dist/cli-delegate/chunk-6EOCNQAM.js +402 -0
- package/dist/cli-delegate/{chunk-XURJ4AQC.js → chunk-74E3TKWV.js} +381 -280
- package/dist/cli-delegate/{chunk-3UCJWMMP.js → chunk-7F3VYSM2.js} +4 -4
- package/dist/cli-delegate/{chunk-BKO2AZ7Z.js → chunk-B2ERU2VA.js} +1 -1
- package/dist/cli-delegate/{chunk-NXFWFAYV.js → chunk-G23AT6GD.js} +1 -0
- package/dist/cli-delegate/{chunk-63WSP6YZ.js → chunk-GJ5BVHXM.js} +72 -165
- package/dist/cli-delegate/{chunk-P6LQDIWK.js → chunk-JZ4NR2TW.js} +338 -0
- package/dist/cli-delegate/chunk-MWRD5YOH.js +100 -0
- package/dist/cli-delegate/{chunk-GRRPEPRN.js → chunk-T7L2QK3K.js} +24 -5
- package/dist/cli-delegate/{chunk-EVTY7ISR.js → chunk-YM4GZDJG.js} +9 -1
- package/dist/cli-delegate/cmd_conformance.js +459 -709
- package/dist/cli-delegate/cmd_doctor.js +6 -6
- package/dist/cli-delegate/cmd_explain.js +1 -1
- package/dist/cli-delegate/cmd_export.js +7 -6
- package/dist/cli-delegate/cmd_handoff.js +6 -6
- package/dist/cli-delegate/cmd_packs_active.js +1 -1
- package/dist/cli-delegate/cmd_preflight.js +2 -2
- package/dist/cli-delegate/cmd_prune.js +7 -6
- package/dist/cli-delegate/cmd_session_recycle.js +840 -30
- package/dist/cli-delegate/cmd_settings_migrate.js +7 -6
- package/dist/cli-delegate/cmd_settings_set.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +7 -6
- package/dist/cli-delegate/cmd_uninstall.js +9 -7
- package/dist/cli-delegate/cmd_update.js +1 -1
- package/dist/cli-delegate/cmd_upgrade.js +1 -1
- package/dist/cli-delegate/cmd_validate.js +7 -6
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +68 -25
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +4 -4
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +10 -8
- package/dist/discovery/trust-report.md +3 -3
- package/dist/discovery/workspaces.json +8 -6
- package/dist/hooks/dispatch.js +2901 -2053
- package/dist/install/claudePathsPlan.js +187 -0
- package/dist/install/claudePathsPlan.js.map +1 -0
- package/dist/install/hostLayerFingerprint.js +136 -0
- package/dist/install/hostLayerFingerprint.js.map +1 -0
- package/dist/install/install.mjs +553 -425
- package/dist/install/partitionEligibility.js +276 -0
- package/dist/install/partitionEligibility.js.map +1 -0
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +1744 -1191
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/agent_src.js +41 -0
- package/dist/scripts/_lib/agent_src.js.map +1 -1
- package/dist/scripts/_lib/install_layout.js +83 -0
- package/dist/scripts/_lib/install_layout.js.map +1 -0
- package/dist/scripts/_lib/installed_lock.js +444 -0
- package/dist/scripts/_lib/installed_lock.js.map +1 -0
- package/dist/scripts/condense.js +13 -164
- package/dist/scripts/condense.js.map +1 -1
- package/dist/server/schemas/settings.js +4 -0
- package/dist/server/schemas/settings.js.map +1 -1
- package/docs/contracts/settings-classes.md +12 -6
- package/docs/guidelines/agent-infra/agent-interaction-and-decision-quality.md +8 -3
- package/docs/guidelines/agent-infra/context-hygiene-mechanics.md +26 -0
- package/docs/guidelines/agent-infra/memory-access.md +17 -0
- package/docs/guidelines/agent-infra/recurring-criticism-mechanics.md +96 -0
- package/package.json +1 -1
- package/src/agent-src/scripts/archival_sweep.ts +117 -0
- package/src/agent-src/scripts/archive_completed_roadmaps.ts +19 -3
- package/src/agent-src/scripts/gate_budget.ts +282 -0
- package/src/agent-src/scripts/gate_execute.ts +72 -31
- package/src/agent-src/scripts/roadmap_gates.ts +74 -3
- package/src/agent-src/scripts/update_roadmap_progress.ts +251 -7
- package/src/agent-src/templates/scripts/telemetry/flush_sender.mjs +163 -0
- package/src/agent-src/templates/scripts/telemetry/remote.ts +160 -7
- package/src/agent-src/templates/scripts/telemetry/transport.ts +169 -0
- package/src/config/agent-settings.template.yml +27 -2
- package/src/config/ci-local-parity.yml +18 -0
- package/src/config/estate-count-budget.json +339 -3
- package/src/config/gate-violation-baselines.json +41 -41
- package/src/config/rule-activation-census.json +14 -6
- package/src/config/rule-stub-ceilings.json +19 -6
- package/src/install/claudePathsPlan.ts +196 -0
- package/src/install/hostLayerFingerprint.ts +145 -0
- package/src/install/partitionEligibility.ts +325 -0
- package/src/scripts/_cli/cmd_session_recycle.ts +9 -1
- package/src/scripts/_dispatch.bash +6 -1
- package/src/scripts/_lib/ac_heading.ts +30 -0
- package/src/scripts/_lib/agent_src.ts +42 -0
- package/src/scripts/_lib/bench_ab_pinned_repo.ts +162 -0
- package/src/scripts/_lib/bench_ab_workspace.ts +10 -1
- package/src/scripts/_lib/envelope_grounding.ts +38 -8
- package/src/scripts/_lib/installed_lock.ts +50 -5
- package/src/scripts/_lib/md_section.ts +129 -0
- package/src/scripts/_lib/scope_guard.sh +26 -3
- package/src/scripts/_lib/self_repair.ts +19 -0
- package/src/scripts/_lib/self_repair_class_b.ts +171 -0
- package/src/scripts/ai_council/cli_help.ts +55 -0
- package/src/scripts/before_complete_hook.ts +153 -28
- package/src/scripts/bench_ab_v2_complexity.ts +27 -7
- package/src/scripts/check_references.ts +60 -0
- package/src/scripts/check_release_published.ts +32 -11
- package/src/scripts/check_single_delivery.ts +59 -15
- package/src/scripts/ci_settle.ts +170 -0
- package/src/scripts/condense.ts +20 -170
- package/src/scripts/council_cli.ts +3 -3
- package/src/scripts/dispatch_r2_reviewer.ts +6 -14
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +77 -14
- package/src/scripts/hooks/block_no_verify.ts +61 -10
- package/src/scripts/hooks/block_unauthorized_git.ts +1 -1
- package/src/scripts/hooks/concern_registry.ts +4 -0
- package/src/scripts/hooks/rtk_wrap_hook.ts +8 -3
- package/src/scripts/hooks/run_continuation_hook.ts +8 -5
- package/src/scripts/hooks/ship_diff_volume_hook.ts +81 -15
- package/src/scripts/hooks/source_first_gate_hook.ts +464 -0
- package/src/scripts/hooks/state_io.ts +782 -20
- package/src/scripts/hooks/subagent_ledger_hook.ts +44 -15
- package/src/scripts/hooks/telemetry_flush_hook.ts +139 -0
- package/src/scripts/hooks/telemetry_self_repair.ts +128 -0
- package/src/scripts/hooks/telemetry_usage_hook.ts +22 -4
- package/src/scripts/hooks/turn_end_gate_hook.ts +81 -15
- package/src/scripts/install.ts +16 -11
- package/src/scripts/language_mirror_hook.ts +561 -25
- package/src/scripts/lint_framework_leakage_allowlist.json +2 -2
- package/src/scripts/lint_plan_risk_register.ts +4 -3
- package/src/scripts/lint_skill_router_head.ts +4 -4
- package/src/scripts/mcp_server/tools.ts +2 -2
- package/src/scripts/new_roadmap.ts +136 -0
- package/src/scripts/pack_mcp_content.ts +20 -5
- package/src/scripts/release.ts +37 -38
- package/src/scripts/report_layer_overlap.ts +6 -0
- package/src/scripts/self_repair_hook.ts +37 -5
- package/src/scripts/session_register_hook.ts +11 -0
- package/src/scripts/skill_usage_collect.ts +11 -1
- package/src/scripts/skill_usage_report.ts +278 -8
- package/src/scripts/sync_pr_branch.ts +7 -0
- package/src/server/schemas/settings.ts +8 -0
- package/dist/cli-delegate/chunk-EJITJBJX.js +0 -172
- package/dist/cli-delegate/chunk-PZWRPRWP.js +0 -38
- /package/dist/cli-delegate/{chunk-RYNADUFG.js → chunk-LWTYTX6F.js} +0 -0
package/dist/install/install.mjs
CHANGED
|
@@ -117,17 +117,17 @@ var require_visit = __commonJS({
|
|
|
117
117
|
visit.BREAK = BREAK;
|
|
118
118
|
visit.SKIP = SKIP;
|
|
119
119
|
visit.REMOVE = REMOVE;
|
|
120
|
-
function visit_(key, node, visitor,
|
|
121
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
120
|
+
function visit_(key, node, visitor, path19) {
|
|
121
|
+
const ctrl = callVisitor(key, node, visitor, path19);
|
|
122
122
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
123
|
-
replaceNode(key,
|
|
124
|
-
return visit_(key, ctrl, visitor,
|
|
123
|
+
replaceNode(key, path19, ctrl);
|
|
124
|
+
return visit_(key, ctrl, visitor, path19);
|
|
125
125
|
}
|
|
126
126
|
if (typeof ctrl !== "symbol") {
|
|
127
127
|
if (identity.isCollection(node)) {
|
|
128
|
-
|
|
128
|
+
path19 = Object.freeze(path19.concat(node));
|
|
129
129
|
for (let i = 0; i < node.items.length; ++i) {
|
|
130
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
130
|
+
const ci = visit_(i, node.items[i], visitor, path19);
|
|
131
131
|
if (typeof ci === "number")
|
|
132
132
|
i = ci - 1;
|
|
133
133
|
else if (ci === BREAK)
|
|
@@ -138,13 +138,13 @@ var require_visit = __commonJS({
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
} else if (identity.isPair(node)) {
|
|
141
|
-
|
|
142
|
-
const ck = visit_("key", node.key, visitor,
|
|
141
|
+
path19 = Object.freeze(path19.concat(node));
|
|
142
|
+
const ck = visit_("key", node.key, visitor, path19);
|
|
143
143
|
if (ck === BREAK)
|
|
144
144
|
return BREAK;
|
|
145
145
|
else if (ck === REMOVE)
|
|
146
146
|
node.key = null;
|
|
147
|
-
const cv = visit_("value", node.value, visitor,
|
|
147
|
+
const cv = visit_("value", node.value, visitor, path19);
|
|
148
148
|
if (cv === BREAK)
|
|
149
149
|
return BREAK;
|
|
150
150
|
else if (cv === REMOVE)
|
|
@@ -165,17 +165,17 @@ var require_visit = __commonJS({
|
|
|
165
165
|
visitAsync.BREAK = BREAK;
|
|
166
166
|
visitAsync.SKIP = SKIP;
|
|
167
167
|
visitAsync.REMOVE = REMOVE;
|
|
168
|
-
async function visitAsync_(key, node, visitor,
|
|
169
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
168
|
+
async function visitAsync_(key, node, visitor, path19) {
|
|
169
|
+
const ctrl = await callVisitor(key, node, visitor, path19);
|
|
170
170
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
171
|
-
replaceNode(key,
|
|
172
|
-
return visitAsync_(key, ctrl, visitor,
|
|
171
|
+
replaceNode(key, path19, ctrl);
|
|
172
|
+
return visitAsync_(key, ctrl, visitor, path19);
|
|
173
173
|
}
|
|
174
174
|
if (typeof ctrl !== "symbol") {
|
|
175
175
|
if (identity.isCollection(node)) {
|
|
176
|
-
|
|
176
|
+
path19 = Object.freeze(path19.concat(node));
|
|
177
177
|
for (let i = 0; i < node.items.length; ++i) {
|
|
178
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
178
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path19);
|
|
179
179
|
if (typeof ci === "number")
|
|
180
180
|
i = ci - 1;
|
|
181
181
|
else if (ci === BREAK)
|
|
@@ -186,13 +186,13 @@ var require_visit = __commonJS({
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
} else if (identity.isPair(node)) {
|
|
189
|
-
|
|
190
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
189
|
+
path19 = Object.freeze(path19.concat(node));
|
|
190
|
+
const ck = await visitAsync_("key", node.key, visitor, path19);
|
|
191
191
|
if (ck === BREAK)
|
|
192
192
|
return BREAK;
|
|
193
193
|
else if (ck === REMOVE)
|
|
194
194
|
node.key = null;
|
|
195
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
195
|
+
const cv = await visitAsync_("value", node.value, visitor, path19);
|
|
196
196
|
if (cv === BREAK)
|
|
197
197
|
return BREAK;
|
|
198
198
|
else if (cv === REMOVE)
|
|
@@ -219,23 +219,23 @@ var require_visit = __commonJS({
|
|
|
219
219
|
}
|
|
220
220
|
return visitor;
|
|
221
221
|
}
|
|
222
|
-
function callVisitor(key, node, visitor,
|
|
222
|
+
function callVisitor(key, node, visitor, path19) {
|
|
223
223
|
if (typeof visitor === "function")
|
|
224
|
-
return visitor(key, node,
|
|
224
|
+
return visitor(key, node, path19);
|
|
225
225
|
if (identity.isMap(node))
|
|
226
|
-
return visitor.Map?.(key, node,
|
|
226
|
+
return visitor.Map?.(key, node, path19);
|
|
227
227
|
if (identity.isSeq(node))
|
|
228
|
-
return visitor.Seq?.(key, node,
|
|
228
|
+
return visitor.Seq?.(key, node, path19);
|
|
229
229
|
if (identity.isPair(node))
|
|
230
|
-
return visitor.Pair?.(key, node,
|
|
230
|
+
return visitor.Pair?.(key, node, path19);
|
|
231
231
|
if (identity.isScalar(node))
|
|
232
|
-
return visitor.Scalar?.(key, node,
|
|
232
|
+
return visitor.Scalar?.(key, node, path19);
|
|
233
233
|
if (identity.isAlias(node))
|
|
234
|
-
return visitor.Alias?.(key, node,
|
|
234
|
+
return visitor.Alias?.(key, node, path19);
|
|
235
235
|
return void 0;
|
|
236
236
|
}
|
|
237
|
-
function replaceNode(key,
|
|
238
|
-
const parent =
|
|
237
|
+
function replaceNode(key, path19, node) {
|
|
238
|
+
const parent = path19[path19.length - 1];
|
|
239
239
|
if (identity.isCollection(parent)) {
|
|
240
240
|
parent.items[key] = node;
|
|
241
241
|
} else if (identity.isPair(parent)) {
|
|
@@ -845,10 +845,10 @@ var require_Collection = __commonJS({
|
|
|
845
845
|
var createNode = require_createNode();
|
|
846
846
|
var identity = require_identity();
|
|
847
847
|
var Node = require_Node();
|
|
848
|
-
function collectionFromPath(schema,
|
|
848
|
+
function collectionFromPath(schema, path19, value) {
|
|
849
849
|
let v = value;
|
|
850
|
-
for (let i =
|
|
851
|
-
const k =
|
|
850
|
+
for (let i = path19.length - 1; i >= 0; --i) {
|
|
851
|
+
const k = path19[i];
|
|
852
852
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
853
853
|
const a = [];
|
|
854
854
|
a[k] = v;
|
|
@@ -867,7 +867,7 @@ var require_Collection = __commonJS({
|
|
|
867
867
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
868
868
|
});
|
|
869
869
|
}
|
|
870
|
-
var isEmptyPath = (
|
|
870
|
+
var isEmptyPath = (path19) => path19 == null || typeof path19 === "object" && !!path19[Symbol.iterator]().next().done;
|
|
871
871
|
var Collection = class extends Node.NodeBase {
|
|
872
872
|
constructor(type, schema) {
|
|
873
873
|
super(type);
|
|
@@ -897,11 +897,11 @@ var require_Collection = __commonJS({
|
|
|
897
897
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
898
898
|
* that already exists in the map.
|
|
899
899
|
*/
|
|
900
|
-
addIn(
|
|
901
|
-
if (isEmptyPath(
|
|
900
|
+
addIn(path19, value) {
|
|
901
|
+
if (isEmptyPath(path19))
|
|
902
902
|
this.add(value);
|
|
903
903
|
else {
|
|
904
|
-
const [key, ...rest] =
|
|
904
|
+
const [key, ...rest] = path19;
|
|
905
905
|
const node = this.get(key, true);
|
|
906
906
|
if (identity.isCollection(node))
|
|
907
907
|
node.addIn(rest, value);
|
|
@@ -915,8 +915,8 @@ var require_Collection = __commonJS({
|
|
|
915
915
|
* Removes a value from the collection.
|
|
916
916
|
* @returns `true` if the item was found and removed.
|
|
917
917
|
*/
|
|
918
|
-
deleteIn(
|
|
919
|
-
const [key, ...rest] =
|
|
918
|
+
deleteIn(path19) {
|
|
919
|
+
const [key, ...rest] = path19;
|
|
920
920
|
if (rest.length === 0)
|
|
921
921
|
return this.delete(key);
|
|
922
922
|
const node = this.get(key, true);
|
|
@@ -930,8 +930,8 @@ var require_Collection = __commonJS({
|
|
|
930
930
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
931
931
|
* `true` (collections are always returned intact).
|
|
932
932
|
*/
|
|
933
|
-
getIn(
|
|
934
|
-
const [key, ...rest] =
|
|
933
|
+
getIn(path19, keepScalar) {
|
|
934
|
+
const [key, ...rest] = path19;
|
|
935
935
|
const node = this.get(key, true);
|
|
936
936
|
if (rest.length === 0)
|
|
937
937
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -949,8 +949,8 @@ var require_Collection = __commonJS({
|
|
|
949
949
|
/**
|
|
950
950
|
* Checks if the collection includes a value with the key `key`.
|
|
951
951
|
*/
|
|
952
|
-
hasIn(
|
|
953
|
-
const [key, ...rest] =
|
|
952
|
+
hasIn(path19) {
|
|
953
|
+
const [key, ...rest] = path19;
|
|
954
954
|
if (rest.length === 0)
|
|
955
955
|
return this.has(key);
|
|
956
956
|
const node = this.get(key, true);
|
|
@@ -960,8 +960,8 @@ var require_Collection = __commonJS({
|
|
|
960
960
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
961
961
|
* boolean to add/remove the item from the set.
|
|
962
962
|
*/
|
|
963
|
-
setIn(
|
|
964
|
-
const [key, ...rest] =
|
|
963
|
+
setIn(path19, value) {
|
|
964
|
+
const [key, ...rest] = path19;
|
|
965
965
|
if (rest.length === 0) {
|
|
966
966
|
this.set(key, value);
|
|
967
967
|
} else {
|
|
@@ -3476,9 +3476,9 @@ var require_Document = __commonJS({
|
|
|
3476
3476
|
this.contents.add(value);
|
|
3477
3477
|
}
|
|
3478
3478
|
/** Adds a value to the document. */
|
|
3479
|
-
addIn(
|
|
3479
|
+
addIn(path19, value) {
|
|
3480
3480
|
if (assertCollection(this.contents))
|
|
3481
|
-
this.contents.addIn(
|
|
3481
|
+
this.contents.addIn(path19, value);
|
|
3482
3482
|
}
|
|
3483
3483
|
/**
|
|
3484
3484
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3553,14 +3553,14 @@ var require_Document = __commonJS({
|
|
|
3553
3553
|
* Removes a value from the document.
|
|
3554
3554
|
* @returns `true` if the item was found and removed.
|
|
3555
3555
|
*/
|
|
3556
|
-
deleteIn(
|
|
3557
|
-
if (Collection.isEmptyPath(
|
|
3556
|
+
deleteIn(path19) {
|
|
3557
|
+
if (Collection.isEmptyPath(path19)) {
|
|
3558
3558
|
if (this.contents == null)
|
|
3559
3559
|
return false;
|
|
3560
3560
|
this.contents = null;
|
|
3561
3561
|
return true;
|
|
3562
3562
|
}
|
|
3563
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3563
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path19) : false;
|
|
3564
3564
|
}
|
|
3565
3565
|
/**
|
|
3566
3566
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3575,10 +3575,10 @@ var require_Document = __commonJS({
|
|
|
3575
3575
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3576
3576
|
* `true` (collections are always returned intact).
|
|
3577
3577
|
*/
|
|
3578
|
-
getIn(
|
|
3579
|
-
if (Collection.isEmptyPath(
|
|
3578
|
+
getIn(path19, keepScalar) {
|
|
3579
|
+
if (Collection.isEmptyPath(path19))
|
|
3580
3580
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3581
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
3581
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path19, keepScalar) : void 0;
|
|
3582
3582
|
}
|
|
3583
3583
|
/**
|
|
3584
3584
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3589,10 +3589,10 @@ var require_Document = __commonJS({
|
|
|
3589
3589
|
/**
|
|
3590
3590
|
* Checks if the document includes a value at `path`.
|
|
3591
3591
|
*/
|
|
3592
|
-
hasIn(
|
|
3593
|
-
if (Collection.isEmptyPath(
|
|
3592
|
+
hasIn(path19) {
|
|
3593
|
+
if (Collection.isEmptyPath(path19))
|
|
3594
3594
|
return this.contents !== void 0;
|
|
3595
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
3595
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path19) : false;
|
|
3596
3596
|
}
|
|
3597
3597
|
/**
|
|
3598
3598
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3609,13 +3609,13 @@ var require_Document = __commonJS({
|
|
|
3609
3609
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3610
3610
|
* boolean to add/remove the item from the set.
|
|
3611
3611
|
*/
|
|
3612
|
-
setIn(
|
|
3613
|
-
if (Collection.isEmptyPath(
|
|
3612
|
+
setIn(path19, value) {
|
|
3613
|
+
if (Collection.isEmptyPath(path19)) {
|
|
3614
3614
|
this.contents = value;
|
|
3615
3615
|
} else if (this.contents == null) {
|
|
3616
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
3616
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path19), value);
|
|
3617
3617
|
} else if (assertCollection(this.contents)) {
|
|
3618
|
-
this.contents.setIn(
|
|
3618
|
+
this.contents.setIn(path19, value);
|
|
3619
3619
|
}
|
|
3620
3620
|
}
|
|
3621
3621
|
/**
|
|
@@ -5575,9 +5575,9 @@ var require_cst_visit = __commonJS({
|
|
|
5575
5575
|
visit.BREAK = BREAK;
|
|
5576
5576
|
visit.SKIP = SKIP;
|
|
5577
5577
|
visit.REMOVE = REMOVE;
|
|
5578
|
-
visit.itemAtPath = (cst,
|
|
5578
|
+
visit.itemAtPath = (cst, path19) => {
|
|
5579
5579
|
let item = cst;
|
|
5580
|
-
for (const [field, index] of
|
|
5580
|
+
for (const [field, index] of path19) {
|
|
5581
5581
|
const tok = item?.[field];
|
|
5582
5582
|
if (tok && "items" in tok) {
|
|
5583
5583
|
item = tok.items[index];
|
|
@@ -5586,23 +5586,23 @@ var require_cst_visit = __commonJS({
|
|
|
5586
5586
|
}
|
|
5587
5587
|
return item;
|
|
5588
5588
|
};
|
|
5589
|
-
visit.parentCollection = (cst,
|
|
5590
|
-
const parent = visit.itemAtPath(cst,
|
|
5591
|
-
const field =
|
|
5589
|
+
visit.parentCollection = (cst, path19) => {
|
|
5590
|
+
const parent = visit.itemAtPath(cst, path19.slice(0, -1));
|
|
5591
|
+
const field = path19[path19.length - 1][0];
|
|
5592
5592
|
const coll = parent?.[field];
|
|
5593
5593
|
if (coll && "items" in coll)
|
|
5594
5594
|
return coll;
|
|
5595
5595
|
throw new Error("Parent collection not found");
|
|
5596
5596
|
};
|
|
5597
|
-
function _visit(
|
|
5598
|
-
let ctrl = visitor(item,
|
|
5597
|
+
function _visit(path19, item, visitor) {
|
|
5598
|
+
let ctrl = visitor(item, path19);
|
|
5599
5599
|
if (typeof ctrl === "symbol")
|
|
5600
5600
|
return ctrl;
|
|
5601
5601
|
for (const field of ["key", "value"]) {
|
|
5602
5602
|
const token = item[field];
|
|
5603
5603
|
if (token && "items" in token) {
|
|
5604
5604
|
for (let i = 0; i < token.items.length; ++i) {
|
|
5605
|
-
const ci = _visit(Object.freeze(
|
|
5605
|
+
const ci = _visit(Object.freeze(path19.concat([[field, i]])), token.items[i], visitor);
|
|
5606
5606
|
if (typeof ci === "number")
|
|
5607
5607
|
i = ci - 1;
|
|
5608
5608
|
else if (ci === BREAK)
|
|
@@ -5613,10 +5613,10 @@ var require_cst_visit = __commonJS({
|
|
|
5613
5613
|
}
|
|
5614
5614
|
}
|
|
5615
5615
|
if (typeof ctrl === "function" && field === "key")
|
|
5616
|
-
ctrl = ctrl(item,
|
|
5616
|
+
ctrl = ctrl(item, path19);
|
|
5617
5617
|
}
|
|
5618
5618
|
}
|
|
5619
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5619
|
+
return typeof ctrl === "function" ? ctrl(item, path19) : ctrl;
|
|
5620
5620
|
}
|
|
5621
5621
|
exports.visit = visit;
|
|
5622
5622
|
}
|
|
@@ -6918,14 +6918,14 @@ var require_parser = __commonJS({
|
|
|
6918
6918
|
case "scalar":
|
|
6919
6919
|
case "single-quoted-scalar":
|
|
6920
6920
|
case "double-quoted-scalar": {
|
|
6921
|
-
const
|
|
6921
|
+
const fs22 = this.flowScalar(this.type);
|
|
6922
6922
|
if (atNextItem || it.value) {
|
|
6923
|
-
map.items.push({ start, key:
|
|
6923
|
+
map.items.push({ start, key: fs22, sep: [] });
|
|
6924
6924
|
this.onKeyLine = true;
|
|
6925
6925
|
} else if (it.sep) {
|
|
6926
|
-
this.stack.push(
|
|
6926
|
+
this.stack.push(fs22);
|
|
6927
6927
|
} else {
|
|
6928
|
-
Object.assign(it, { key:
|
|
6928
|
+
Object.assign(it, { key: fs22, sep: [] });
|
|
6929
6929
|
this.onKeyLine = true;
|
|
6930
6930
|
}
|
|
6931
6931
|
return;
|
|
@@ -7053,13 +7053,13 @@ var require_parser = __commonJS({
|
|
|
7053
7053
|
case "scalar":
|
|
7054
7054
|
case "single-quoted-scalar":
|
|
7055
7055
|
case "double-quoted-scalar": {
|
|
7056
|
-
const
|
|
7056
|
+
const fs22 = this.flowScalar(this.type);
|
|
7057
7057
|
if (!it || it.value)
|
|
7058
|
-
fc.items.push({ start: [], key:
|
|
7058
|
+
fc.items.push({ start: [], key: fs22, sep: [] });
|
|
7059
7059
|
else if (it.sep)
|
|
7060
|
-
this.stack.push(
|
|
7060
|
+
this.stack.push(fs22);
|
|
7061
7061
|
else
|
|
7062
|
-
Object.assign(it, { key:
|
|
7062
|
+
Object.assign(it, { key: fs22, sep: [] });
|
|
7063
7063
|
return;
|
|
7064
7064
|
}
|
|
7065
7065
|
case "flow-map-end":
|
|
@@ -7370,9 +7370,9 @@ var require_dist = __commonJS({
|
|
|
7370
7370
|
// src/scripts/install.ts
|
|
7371
7371
|
import { spawn, spawnSync as spawnSync2 } from "node:child_process";
|
|
7372
7372
|
import * as crypto3 from "node:crypto";
|
|
7373
|
-
import * as
|
|
7374
|
-
import * as
|
|
7375
|
-
import * as
|
|
7373
|
+
import * as fs21 from "node:fs";
|
|
7374
|
+
import * as os8 from "node:os";
|
|
7375
|
+
import * as path18 from "node:path";
|
|
7376
7376
|
import process3 from "node:process";
|
|
7377
7377
|
import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
7378
7378
|
|
|
@@ -7842,6 +7842,7 @@ var _VERSION_RE = /^\s*agent_config_version\s*:\s*"?([^"\s]+)"?\s*$/;
|
|
|
7842
7842
|
var _SCHEMA_RE = /^\s*schema_version\s*:\s*(\d+)\s*$/;
|
|
7843
7843
|
var _LAYOUT_RE = /^\s*install_layout_version\s*:\s*(\d+)\s*$/;
|
|
7844
7844
|
var _INSTALLED_AT_RE = /^\s*installed_at\s*:\s*"?([^"\s]+)"?\s*$/;
|
|
7845
|
+
var _FINGERPRINT_RE = /^\s*host_layer_fingerprint\s*:\s*"?([0-9a-f]{64})"?\s*$/;
|
|
7845
7846
|
var _TOOL_RE = /^\s*-\s*([A-Za-z0-9_\-.]+)\s*$/;
|
|
7846
7847
|
function expanduser2(p) {
|
|
7847
7848
|
if (p === "~") {
|
|
@@ -7872,8 +7873,8 @@ function lockfile_write_path(env) {
|
|
|
7872
7873
|
}
|
|
7873
7874
|
return write_target("installed.lock", { env: env ?? null });
|
|
7874
7875
|
}
|
|
7875
|
-
function read_lockfile(
|
|
7876
|
-
const target =
|
|
7876
|
+
function read_lockfile(path19) {
|
|
7877
|
+
const target = path19 ?? lockfile_path();
|
|
7877
7878
|
let text;
|
|
7878
7879
|
try {
|
|
7879
7880
|
text = fs2.readFileSync(target, { encoding: "utf-8" });
|
|
@@ -7907,6 +7908,12 @@ function read_lockfile(path18) {
|
|
|
7907
7908
|
in_tools = false;
|
|
7908
7909
|
continue;
|
|
7909
7910
|
}
|
|
7911
|
+
const fp_m = _FINGERPRINT_RE.exec(raw_line);
|
|
7912
|
+
if (fp_m) {
|
|
7913
|
+
data.host_layer_fingerprint = fp_m[1];
|
|
7914
|
+
in_tools = false;
|
|
7915
|
+
continue;
|
|
7916
|
+
}
|
|
7910
7917
|
if (raw_line.trim().startsWith("tools:")) {
|
|
7911
7918
|
in_tools = true;
|
|
7912
7919
|
continue;
|
|
@@ -7929,14 +7936,17 @@ function splitlines(text) {
|
|
|
7929
7936
|
}
|
|
7930
7937
|
return parts;
|
|
7931
7938
|
}
|
|
7932
|
-
function _render(version, tools, installed_at) {
|
|
7939
|
+
function _render(version, tools, installed_at, fingerprint) {
|
|
7933
7940
|
const lines = [
|
|
7934
7941
|
`schema_version: ${SCHEMA_VERSION}`,
|
|
7935
7942
|
`install_layout_version: ${INSTALL_LAYOUT_VERSION}`,
|
|
7936
7943
|
`agent_config_version: "${version}"`,
|
|
7937
|
-
`installed_at: "${installed_at}"
|
|
7938
|
-
"tools:"
|
|
7944
|
+
`installed_at: "${installed_at}"`
|
|
7939
7945
|
];
|
|
7946
|
+
if (fingerprint) {
|
|
7947
|
+
lines.push(`host_layer_fingerprint: "${fingerprint}"`);
|
|
7948
|
+
}
|
|
7949
|
+
lines.push("tools:");
|
|
7940
7950
|
for (const tool of tools) {
|
|
7941
7951
|
lines.push(` - ${tool}`);
|
|
7942
7952
|
}
|
|
@@ -7946,7 +7956,12 @@ function write_lockfile(version, tools, options = {}) {
|
|
|
7946
7956
|
const target = options.path ?? lockfile_path();
|
|
7947
7957
|
fs2.mkdirSync(path2.dirname(target), { recursive: true });
|
|
7948
7958
|
const stamp = strftime_iso_z(options.now ?? /* @__PURE__ */ new Date());
|
|
7949
|
-
const rendered = _render(
|
|
7959
|
+
const rendered = _render(
|
|
7960
|
+
version,
|
|
7961
|
+
sorted_unique(tools),
|
|
7962
|
+
stamp,
|
|
7963
|
+
options.host_layer_fingerprint ?? null
|
|
7964
|
+
);
|
|
7950
7965
|
const parent = path2.dirname(target);
|
|
7951
7966
|
const { fd, tmp_name } = mkstemp(parent, ".installed.lock.");
|
|
7952
7967
|
try {
|
|
@@ -8002,7 +8017,11 @@ function migrate_layout(options = {}) {
|
|
|
8002
8017
|
const version = existing.agent_config_version || current_package_version();
|
|
8003
8018
|
const tools = [...existing.tools ?? []];
|
|
8004
8019
|
const when = options.now ?? _parse_installed_at(existing.installed_at);
|
|
8005
|
-
write_lockfile(version, tools, {
|
|
8020
|
+
write_lockfile(version, tools, {
|
|
8021
|
+
path: target,
|
|
8022
|
+
now: when,
|
|
8023
|
+
host_layer_fingerprint: existing.host_layer_fingerprint ?? null
|
|
8024
|
+
});
|
|
8006
8025
|
return {
|
|
8007
8026
|
from: from_v,
|
|
8008
8027
|
to: INSTALL_LAYOUT_VERSION,
|
|
@@ -8948,18 +8967,18 @@ function manifest_path(project_root, env) {
|
|
|
8948
8967
|
var _TOP_KEY_RE = /^([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
|
|
8949
8968
|
var _LIST_DASH_RE = /^\s*-\s*(.+?)\s*$/;
|
|
8950
8969
|
var _INDENT_KEY_RE = /^\s+([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
|
|
8951
|
-
function read_manifest(
|
|
8970
|
+
function read_manifest(path19) {
|
|
8952
8971
|
let text;
|
|
8953
8972
|
try {
|
|
8954
|
-
text = require_read_text(
|
|
8973
|
+
text = require_read_text(path19);
|
|
8955
8974
|
} catch {
|
|
8956
8975
|
return null;
|
|
8957
8976
|
}
|
|
8958
8977
|
const data = _parse_manual(text);
|
|
8959
8978
|
return _normalise_v2_shape(data);
|
|
8960
8979
|
}
|
|
8961
|
-
function require_read_text(
|
|
8962
|
-
return fs8.readFileSync(
|
|
8980
|
+
function require_read_text(path19) {
|
|
8981
|
+
return fs8.readFileSync(path19, { encoding: "utf-8" });
|
|
8963
8982
|
}
|
|
8964
8983
|
function _normalise_v2_shape(data) {
|
|
8965
8984
|
if (data["tools"] === void 0 || data["tools"] === null) {
|
|
@@ -9140,9 +9159,9 @@ function stable_sort(items, key) {
|
|
|
9140
9159
|
return a.index - b.index;
|
|
9141
9160
|
}).map((entry) => entry.item);
|
|
9142
9161
|
}
|
|
9143
|
-
function write_manifest(
|
|
9162
|
+
function write_manifest(path19, version, tools, options = {}) {
|
|
9144
9163
|
const rendered = _render2(version, tools, { deploy_roots: options.deploy_roots ?? null });
|
|
9145
|
-
return write_atomic(
|
|
9164
|
+
return write_atomic(path19, rendered);
|
|
9146
9165
|
}
|
|
9147
9166
|
var ScopeMismatchError = class extends Error {
|
|
9148
9167
|
name_;
|
|
@@ -10661,6 +10680,99 @@ function ruleFileArrives(sourcePath, scope) {
|
|
|
10661
10680
|
return rule_in_scope(sourcePath, scope.workspaces, scope.packs, scope.roles ?? null);
|
|
10662
10681
|
}
|
|
10663
10682
|
|
|
10683
|
+
// src/install/partitionEligibility.ts
|
|
10684
|
+
import * as fs16 from "node:fs";
|
|
10685
|
+
import * as os7 from "node:os";
|
|
10686
|
+
|
|
10687
|
+
// src/install/hostLayerFingerprint.ts
|
|
10688
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
10689
|
+
import * as fs15 from "node:fs";
|
|
10690
|
+
import * as path14 from "node:path";
|
|
10691
|
+
var FINGERPRINT_SCHEMA = 1;
|
|
10692
|
+
function collectFiles(dir) {
|
|
10693
|
+
const out = [];
|
|
10694
|
+
const walk = (d) => {
|
|
10695
|
+
let entries;
|
|
10696
|
+
try {
|
|
10697
|
+
entries = fs15.readdirSync(d, { withFileTypes: true });
|
|
10698
|
+
} catch {
|
|
10699
|
+
return;
|
|
10700
|
+
}
|
|
10701
|
+
const sorted = [...entries].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
10702
|
+
for (const e of sorted) {
|
|
10703
|
+
const p = path14.join(d, e.name);
|
|
10704
|
+
if (e.isDirectory()) {
|
|
10705
|
+
walk(p);
|
|
10706
|
+
} else if (e.isFile()) {
|
|
10707
|
+
out.push(p);
|
|
10708
|
+
}
|
|
10709
|
+
}
|
|
10710
|
+
};
|
|
10711
|
+
walk(dir);
|
|
10712
|
+
return out.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
10713
|
+
}
|
|
10714
|
+
function fingerprintLayers(layers) {
|
|
10715
|
+
const h = createHash4("sha256");
|
|
10716
|
+
h.update(`v${FINGERPRINT_SCHEMA}\0`);
|
|
10717
|
+
for (const layer of layers) {
|
|
10718
|
+
h.update(`layer:${layer.label}\0`);
|
|
10719
|
+
for (const file of collectFiles(layer.root)) {
|
|
10720
|
+
h.update(path14.relative(layer.root, file));
|
|
10721
|
+
h.update("\0");
|
|
10722
|
+
try {
|
|
10723
|
+
h.update(fs15.readFileSync(file));
|
|
10724
|
+
} catch {
|
|
10725
|
+
h.update("\0unreadable\0");
|
|
10726
|
+
}
|
|
10727
|
+
h.update("\0");
|
|
10728
|
+
}
|
|
10729
|
+
}
|
|
10730
|
+
return h.digest("hex");
|
|
10731
|
+
}
|
|
10732
|
+
function hostLayerInputs(userHome) {
|
|
10733
|
+
const claude = path14.join(userHome, ".claude");
|
|
10734
|
+
return [
|
|
10735
|
+
{ label: "rules", root: path14.join(claude, "rules") },
|
|
10736
|
+
{ label: "skills", root: path14.join(claude, "skills") },
|
|
10737
|
+
{ label: "commands", root: path14.join(claude, "commands") }
|
|
10738
|
+
];
|
|
10739
|
+
}
|
|
10740
|
+
|
|
10741
|
+
// src/install/partitionEligibility.ts
|
|
10742
|
+
var MAINTAINER_WORKSPACE = "agent-config-maintainer";
|
|
10743
|
+
function isExclusivelyPackageOnly(source_path) {
|
|
10744
|
+
let meta;
|
|
10745
|
+
try {
|
|
10746
|
+
[meta] = parseFrontmatter(fs16.readFileSync(source_path, "utf-8"));
|
|
10747
|
+
} catch {
|
|
10748
|
+
return false;
|
|
10749
|
+
}
|
|
10750
|
+
const raw = meta["workspaces"];
|
|
10751
|
+
if (!Array.isArray(raw) || raw.length === 0) {
|
|
10752
|
+
return false;
|
|
10753
|
+
}
|
|
10754
|
+
return raw.every((w) => String(w) === MAINTAINER_WORKSPACE);
|
|
10755
|
+
}
|
|
10756
|
+
function stampHostLayerFingerprint(installedVersion, tools, lockfilePath, skip2, report) {
|
|
10757
|
+
if (skip2) {
|
|
10758
|
+
return null;
|
|
10759
|
+
}
|
|
10760
|
+
try {
|
|
10761
|
+
const fingerprint = fingerprintLayers(hostLayerInputs(os7.homedir()));
|
|
10762
|
+
write_lockfile(installedVersion, [...tools], {
|
|
10763
|
+
path: lockfilePath,
|
|
10764
|
+
host_layer_fingerprint: fingerprint
|
|
10765
|
+
});
|
|
10766
|
+
report(`Host-layer fingerprint recorded: ${fingerprint.slice(0, 12)} (enables single delivery)`);
|
|
10767
|
+
return fingerprint;
|
|
10768
|
+
} catch (e) {
|
|
10769
|
+
report(
|
|
10770
|
+
`Host-layer fingerprint NOT recorded (${String(e)}) \u2014 the project layer keeps the full projection.`
|
|
10771
|
+
);
|
|
10772
|
+
return null;
|
|
10773
|
+
}
|
|
10774
|
+
}
|
|
10775
|
+
|
|
10664
10776
|
// src/install/wizard-plan.ts
|
|
10665
10777
|
var RULE_SOURCE_REL = "dist/agent-src/rules";
|
|
10666
10778
|
|
|
@@ -11212,8 +11324,8 @@ function getErrorMap() {
|
|
|
11212
11324
|
|
|
11213
11325
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
11214
11326
|
var makeIssue = (params) => {
|
|
11215
|
-
const { data, path:
|
|
11216
|
-
const fullPath = [...
|
|
11327
|
+
const { data, path: path19, errorMaps, issueData } = params;
|
|
11328
|
+
const fullPath = [...path19, ...issueData.path || []];
|
|
11217
11329
|
const fullIssue = {
|
|
11218
11330
|
...issueData,
|
|
11219
11331
|
path: fullPath
|
|
@@ -11329,11 +11441,11 @@ var errorUtil;
|
|
|
11329
11441
|
|
|
11330
11442
|
// node_modules/zod/v3/types.js
|
|
11331
11443
|
var ParseInputLazyPath = class {
|
|
11332
|
-
constructor(parent, value,
|
|
11444
|
+
constructor(parent, value, path19, key) {
|
|
11333
11445
|
this._cachedPath = [];
|
|
11334
11446
|
this.parent = parent;
|
|
11335
11447
|
this.data = value;
|
|
11336
|
-
this._path =
|
|
11448
|
+
this._path = path19;
|
|
11337
11449
|
this._key = key;
|
|
11338
11450
|
}
|
|
11339
11451
|
get path() {
|
|
@@ -14961,7 +15073,15 @@ var settingsSchema = external_exports.object({
|
|
|
14961
15073
|
),
|
|
14962
15074
|
horizon_weeks: external_exports.number().int().min(0).default(0).describe(
|
|
14963
15075
|
'Optional planning horizon (weeks) the agent shows in roadmap framing ("next 4 weeks"). Set 0 to omit the horizon \u2014 most teams prefer to ship without a hardcoded window.'
|
|
14964
|
-
)
|
|
15076
|
+
),
|
|
15077
|
+
gate_budget: external_exports.object({
|
|
15078
|
+
max_cost_per_run_usd: external_exports.number().min(0).default(5).describe(
|
|
15079
|
+
"Per-run USD ceiling for a CLASS-1 roadmap blocker executed via `agent-config gates --execute`. A class-1 entry whose **Budget:** field states a larger figure renders its consent line instead of running. Bounds the size of an authorised spend; never supplies the authorisation \u2014 `--confirm` is still required on every class-1 run."
|
|
15080
|
+
),
|
|
15081
|
+
max_cost_per_rolling_7d_usd: external_exports.number().min(0).default(25).describe(
|
|
15082
|
+
"Rolling 7-day USD ceiling for class-1 gate execution, summed from the append-only receipt ledger at agents/runtime/state/gate-budget-ledger.jsonl. A run whose estimate would cross it renders instead of running. A per-run cap alone bounds one mistake, not a week of them, which is why option (a) of b-gate-budget-preauth carries two numbers."
|
|
15083
|
+
)
|
|
15084
|
+
}).default({ max_cost_per_run_usd: 5, max_cost_per_rolling_7d_usd: 25 })
|
|
14965
15085
|
}),
|
|
14966
15086
|
planning: external_exports.object({
|
|
14967
15087
|
challenge_on_create: external_exports.boolean().default(true).describe(
|
|
@@ -16603,8 +16723,8 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
16603
16723
|
};
|
|
16604
16724
|
|
|
16605
16725
|
// src/scripts/_lib/module_detection.ts
|
|
16606
|
-
import * as
|
|
16607
|
-
import * as
|
|
16726
|
+
import * as fs17 from "node:fs";
|
|
16727
|
+
import * as path15 from "node:path";
|
|
16608
16728
|
var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
|
|
16609
16729
|
var _RULES = [
|
|
16610
16730
|
["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
|
|
@@ -16618,14 +16738,14 @@ var _RULES = [
|
|
|
16618
16738
|
];
|
|
16619
16739
|
function _isDir(p) {
|
|
16620
16740
|
try {
|
|
16621
|
-
return
|
|
16741
|
+
return fs17.statSync(p).isDirectory();
|
|
16622
16742
|
} catch {
|
|
16623
16743
|
return false;
|
|
16624
16744
|
}
|
|
16625
16745
|
}
|
|
16626
16746
|
function _isFile(p) {
|
|
16627
16747
|
try {
|
|
16628
|
-
return
|
|
16748
|
+
return fs17.statSync(p).isFile();
|
|
16629
16749
|
} catch {
|
|
16630
16750
|
return false;
|
|
16631
16751
|
}
|
|
@@ -16639,13 +16759,13 @@ function _isUpperChar(ch) {
|
|
|
16639
16759
|
function _list_module_subdirs(root) {
|
|
16640
16760
|
let entries;
|
|
16641
16761
|
try {
|
|
16642
|
-
entries =
|
|
16762
|
+
entries = fs17.readdirSync(root).sort();
|
|
16643
16763
|
} catch {
|
|
16644
16764
|
return [];
|
|
16645
16765
|
}
|
|
16646
16766
|
const out = [];
|
|
16647
16767
|
for (const name of entries) {
|
|
16648
|
-
if (!_isDir(
|
|
16768
|
+
if (!_isDir(path15.join(root, name))) {
|
|
16649
16769
|
continue;
|
|
16650
16770
|
}
|
|
16651
16771
|
if (name.startsWith(".")) {
|
|
@@ -16667,11 +16787,11 @@ function _score_confidence(stack, root, subdirs) {
|
|
|
16667
16787
|
return capitalized.length > 0 ? "high" : "medium";
|
|
16668
16788
|
}
|
|
16669
16789
|
if (stack === "node-monorepo") {
|
|
16670
|
-
const withPkgJson = subdirs.filter((name) => _isFile(
|
|
16790
|
+
const withPkgJson = subdirs.filter((name) => _isFile(path15.join(root, name, "package.json")));
|
|
16671
16791
|
return withPkgJson.length > 0 ? "high" : "medium";
|
|
16672
16792
|
}
|
|
16673
16793
|
if (stack === "python-src") {
|
|
16674
|
-
const withInit = subdirs.filter((name) => _isFile(
|
|
16794
|
+
const withInit = subdirs.filter((name) => _isFile(path15.join(root, name, "__init__.py")));
|
|
16675
16795
|
return withInit.length > 0 ? "high" : "medium";
|
|
16676
16796
|
}
|
|
16677
16797
|
if (stack === "go-internal") {
|
|
@@ -16683,7 +16803,7 @@ function detect_module_roots(project_root) {
|
|
|
16683
16803
|
const high = [];
|
|
16684
16804
|
const medium = [];
|
|
16685
16805
|
for (const [rel_path, stack, namespace_template] of _RULES) {
|
|
16686
|
-
const abs_path =
|
|
16806
|
+
const abs_path = path15.join(project_root, rel_path);
|
|
16687
16807
|
if (!_isDir(abs_path)) {
|
|
16688
16808
|
continue;
|
|
16689
16809
|
}
|
|
@@ -16705,7 +16825,7 @@ function detect_module_roots(project_root) {
|
|
|
16705
16825
|
}
|
|
16706
16826
|
|
|
16707
16827
|
// src/scripts/_lib/model_tier.ts
|
|
16708
|
-
import
|
|
16828
|
+
import fs18 from "node:fs";
|
|
16709
16829
|
var TIER_TO_CLAUDE_MODEL = {
|
|
16710
16830
|
frontier: "fable",
|
|
16711
16831
|
high: "opus",
|
|
@@ -16714,8 +16834,8 @@ var TIER_TO_CLAUDE_MODEL = {
|
|
|
16714
16834
|
};
|
|
16715
16835
|
var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
|
|
16716
16836
|
function read_model_tier(skill_md) {
|
|
16717
|
-
if (!
|
|
16718
|
-
const text =
|
|
16837
|
+
if (!fs18.existsSync(skill_md)) return null;
|
|
16838
|
+
const text = fs18.readFileSync(skill_md).toString("utf-8");
|
|
16719
16839
|
if (!text.startsWith("---\n")) return null;
|
|
16720
16840
|
const end = text.indexOf("\n---\n", 4);
|
|
16721
16841
|
if (end === -1) return null;
|
|
@@ -16732,39 +16852,39 @@ function render_native_model_md(text, tier) {
|
|
|
16732
16852
|
|
|
16733
16853
|
// src/scripts/_cli/cmd_migrate.ts
|
|
16734
16854
|
import { spawnSync } from "node:child_process";
|
|
16735
|
-
import * as
|
|
16736
|
-
import * as
|
|
16855
|
+
import * as fs20 from "node:fs";
|
|
16856
|
+
import * as path17 from "node:path";
|
|
16737
16857
|
import process2 from "node:process";
|
|
16738
16858
|
import { fileURLToPath as fileURLToPath4, pathToFileURL } from "node:url";
|
|
16739
16859
|
|
|
16740
16860
|
// src/scripts/_lib/package_root.ts
|
|
16741
|
-
import * as
|
|
16742
|
-
import * as
|
|
16861
|
+
import * as fs19 from "node:fs";
|
|
16862
|
+
import * as path16 from "node:path";
|
|
16743
16863
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
16744
16864
|
var PACKAGE_NAME = "@event4u/agent-config";
|
|
16745
16865
|
var MAX_ASCENT = 16;
|
|
16746
16866
|
function resolvePackageRoot(fromUrlOrPath, legacyHops = 3) {
|
|
16747
16867
|
const start = fromUrlOrPath.startsWith("file:") ? fileURLToPath3(fromUrlOrPath) : fromUrlOrPath;
|
|
16748
|
-
const startDir =
|
|
16868
|
+
const startDir = path16.dirname(start);
|
|
16749
16869
|
let dir = startDir;
|
|
16750
16870
|
for (let i = 0; i < MAX_ASCENT; i++) {
|
|
16751
|
-
const manifest =
|
|
16752
|
-
if (
|
|
16871
|
+
const manifest = path16.join(dir, "package.json");
|
|
16872
|
+
if (fs19.existsSync(manifest)) {
|
|
16753
16873
|
try {
|
|
16754
|
-
const parsed = JSON.parse(
|
|
16874
|
+
const parsed = JSON.parse(fs19.readFileSync(manifest, "utf8"));
|
|
16755
16875
|
if (parsed.name === PACKAGE_NAME) {
|
|
16756
16876
|
return dir;
|
|
16757
16877
|
}
|
|
16758
16878
|
} catch {
|
|
16759
16879
|
}
|
|
16760
16880
|
}
|
|
16761
|
-
const parent =
|
|
16881
|
+
const parent = path16.dirname(dir);
|
|
16762
16882
|
if (parent === dir) {
|
|
16763
16883
|
break;
|
|
16764
16884
|
}
|
|
16765
16885
|
dir = parent;
|
|
16766
16886
|
}
|
|
16767
|
-
return
|
|
16887
|
+
return path16.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
|
|
16768
16888
|
}
|
|
16769
16889
|
|
|
16770
16890
|
// src/scripts/_cli/cmd_migrate.ts
|
|
@@ -16785,7 +16905,7 @@ var LEGACY_SETTINGS_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
|
16785
16905
|
var LEGACY_STATE_FILENAME = ".implement-ticket-state.json";
|
|
16786
16906
|
var LEGACY_STATE_V1_FILENAME = ".work-state.json";
|
|
16787
16907
|
var LEGACY_AGENT_CONFIG_SHELL = "agent-config";
|
|
16788
|
-
var _HERE_DIR =
|
|
16908
|
+
var _HERE_DIR = path17.dirname(fileURLToPath4(import.meta.url));
|
|
16789
16909
|
var ArgparseExit = class extends Error {
|
|
16790
16910
|
code;
|
|
16791
16911
|
constructor(code) {
|
|
@@ -16884,38 +17004,38 @@ function _jsonDumpsIndentAscii(value, indent) {
|
|
|
16884
17004
|
}
|
|
16885
17005
|
function _isFile2(p) {
|
|
16886
17006
|
try {
|
|
16887
|
-
return
|
|
17007
|
+
return fs20.statSync(p).isFile();
|
|
16888
17008
|
} catch {
|
|
16889
17009
|
return false;
|
|
16890
17010
|
}
|
|
16891
17011
|
}
|
|
16892
17012
|
function _isDir2(p) {
|
|
16893
17013
|
try {
|
|
16894
|
-
return
|
|
17014
|
+
return fs20.statSync(p).isDirectory();
|
|
16895
17015
|
} catch {
|
|
16896
17016
|
return false;
|
|
16897
17017
|
}
|
|
16898
17018
|
}
|
|
16899
17019
|
function _isSymlink(p) {
|
|
16900
17020
|
try {
|
|
16901
|
-
return
|
|
17021
|
+
return fs20.lstatSync(p).isSymbolicLink();
|
|
16902
17022
|
} catch {
|
|
16903
17023
|
return false;
|
|
16904
17024
|
}
|
|
16905
17025
|
}
|
|
16906
17026
|
function _exists2(p) {
|
|
16907
17027
|
try {
|
|
16908
|
-
|
|
17028
|
+
fs20.lstatSync(p);
|
|
16909
17029
|
return true;
|
|
16910
17030
|
} catch {
|
|
16911
17031
|
return false;
|
|
16912
17032
|
}
|
|
16913
17033
|
}
|
|
16914
17034
|
function _readText(p) {
|
|
16915
|
-
return
|
|
17035
|
+
return fs20.readFileSync(p, { encoding: "utf-8" });
|
|
16916
17036
|
}
|
|
16917
17037
|
function _writeText(p, text) {
|
|
16918
|
-
|
|
17038
|
+
fs20.writeFileSync(p, text, { encoding: "utf-8" });
|
|
16919
17039
|
}
|
|
16920
17040
|
function _jsonLoadFile(p) {
|
|
16921
17041
|
return JSON.parse(_readText(p));
|
|
@@ -16971,7 +17091,7 @@ function _classify_symlink(link) {
|
|
|
16971
17091
|
}
|
|
16972
17092
|
let target;
|
|
16973
17093
|
try {
|
|
16974
|
-
target =
|
|
17094
|
+
target = fs20.readlinkSync(link);
|
|
16975
17095
|
} catch {
|
|
16976
17096
|
return null;
|
|
16977
17097
|
}
|
|
@@ -16982,16 +17102,16 @@ function _classify_symlink(link) {
|
|
|
16982
17102
|
return "user";
|
|
16983
17103
|
}
|
|
16984
17104
|
function _detect_legacy_state(project) {
|
|
16985
|
-
return _isFile2(
|
|
17105
|
+
return _isFile2(path17.join(project, LEGACY_STATE_FILENAME));
|
|
16986
17106
|
}
|
|
16987
17107
|
function _detect_legacy_settings(project) {
|
|
16988
17108
|
const found = [];
|
|
16989
17109
|
for (const name of LEGACY_SETTINGS_FILES) {
|
|
16990
|
-
const flat =
|
|
17110
|
+
const flat = path17.join(project, name);
|
|
16991
17111
|
if (_isFile2(flat)) {
|
|
16992
17112
|
found.push(flat);
|
|
16993
17113
|
}
|
|
16994
|
-
const typed =
|
|
17114
|
+
const typed = path17.join(project, "settings", name);
|
|
16995
17115
|
if (_isFile2(typed)) {
|
|
16996
17116
|
found.push(typed);
|
|
16997
17117
|
}
|
|
@@ -16999,25 +17119,25 @@ function _detect_legacy_settings(project) {
|
|
|
16999
17119
|
return found;
|
|
17000
17120
|
}
|
|
17001
17121
|
function _detect_empty_shell(project) {
|
|
17002
|
-
const shell =
|
|
17122
|
+
const shell = path17.join(project, LEGACY_AGENT_CONFIG_SHELL);
|
|
17003
17123
|
if (!_isDir2(shell) || _isSymlink(shell)) {
|
|
17004
17124
|
return false;
|
|
17005
17125
|
}
|
|
17006
17126
|
try {
|
|
17007
|
-
return
|
|
17127
|
+
return fs20.readdirSync(shell).length === 0;
|
|
17008
17128
|
} catch {
|
|
17009
17129
|
return false;
|
|
17010
17130
|
}
|
|
17011
17131
|
}
|
|
17012
17132
|
function _detect_already_migrated(project) {
|
|
17013
|
-
if (_detect_npm(
|
|
17133
|
+
if (_detect_npm(path17.join(project, "package.json"))) {
|
|
17014
17134
|
return false;
|
|
17015
17135
|
}
|
|
17016
|
-
if (_detect_composer(
|
|
17136
|
+
if (_detect_composer(path17.join(project, "composer.json"))) {
|
|
17017
17137
|
return false;
|
|
17018
17138
|
}
|
|
17019
17139
|
for (const name of MANAGED_SYMLINKS) {
|
|
17020
|
-
if (_classify_symlink(
|
|
17140
|
+
if (_classify_symlink(path17.join(project, name)) === "legacy") {
|
|
17021
17141
|
return false;
|
|
17022
17142
|
}
|
|
17023
17143
|
}
|
|
@@ -17088,11 +17208,11 @@ function _purge_legacy_symlinks(project) {
|
|
|
17088
17208
|
const removed = [];
|
|
17089
17209
|
const preserved = [];
|
|
17090
17210
|
for (const name of MANAGED_SYMLINKS) {
|
|
17091
|
-
const link =
|
|
17211
|
+
const link = path17.join(project, name);
|
|
17092
17212
|
const kind = _classify_symlink(link);
|
|
17093
17213
|
if (kind === "legacy") {
|
|
17094
17214
|
try {
|
|
17095
|
-
|
|
17215
|
+
fs20.unlinkSync(link);
|
|
17096
17216
|
removed.push(name);
|
|
17097
17217
|
} catch {
|
|
17098
17218
|
preserved.push(name);
|
|
@@ -17104,14 +17224,14 @@ function _purge_legacy_symlinks(project) {
|
|
|
17104
17224
|
return [removed, preserved];
|
|
17105
17225
|
}
|
|
17106
17226
|
function _migrate_state_file(project) {
|
|
17107
|
-
const source =
|
|
17227
|
+
const source = path17.join(project, LEGACY_STATE_FILENAME);
|
|
17108
17228
|
if (!_isFile2(source)) {
|
|
17109
17229
|
return null;
|
|
17110
17230
|
}
|
|
17111
|
-
const target =
|
|
17231
|
+
const target = path17.join(project, LEGACY_STATE_V1_FILENAME);
|
|
17112
17232
|
if (_exists2(target)) {
|
|
17113
17233
|
try {
|
|
17114
|
-
|
|
17234
|
+
fs20.unlinkSync(source);
|
|
17115
17235
|
return `removed stale ${LEGACY_STATE_FILENAME} (v1 already present)`;
|
|
17116
17236
|
} catch {
|
|
17117
17237
|
return null;
|
|
@@ -17126,7 +17246,7 @@ function _migrate_state_file(project) {
|
|
|
17126
17246
|
}
|
|
17127
17247
|
function _load_state_migrator() {
|
|
17128
17248
|
const pkg_root = resolvePackageRoot(import.meta.url);
|
|
17129
|
-
const rel =
|
|
17249
|
+
const rel = path17.join(
|
|
17130
17250
|
"agent-src",
|
|
17131
17251
|
"templates",
|
|
17132
17252
|
"scripts",
|
|
@@ -17134,8 +17254,8 @@ function _load_state_migrator() {
|
|
|
17134
17254
|
"migration",
|
|
17135
17255
|
"v0_to_v1.ts"
|
|
17136
17256
|
);
|
|
17137
|
-
const driver = [
|
|
17138
|
-
(p) =>
|
|
17257
|
+
const driver = [path17.join(pkg_root, "dist", rel), path17.join(pkg_root, "src", rel)].find(
|
|
17258
|
+
(p) => fs20.existsSync(p)
|
|
17139
17259
|
) ?? null;
|
|
17140
17260
|
if (driver === null) {
|
|
17141
17261
|
return null;
|
|
@@ -17143,12 +17263,12 @@ function _load_state_migrator() {
|
|
|
17143
17263
|
const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
17144
17264
|
let tsxBin = null;
|
|
17145
17265
|
for (let dir = pkg_root; ; ) {
|
|
17146
|
-
const cand =
|
|
17147
|
-
if (
|
|
17266
|
+
const cand = path17.join(dir, "node_modules", ".bin", binName);
|
|
17267
|
+
if (fs20.existsSync(cand)) {
|
|
17148
17268
|
tsxBin = cand;
|
|
17149
17269
|
break;
|
|
17150
17270
|
}
|
|
17151
|
-
const parent =
|
|
17271
|
+
const parent = path17.dirname(dir);
|
|
17152
17272
|
if (parent === dir) break;
|
|
17153
17273
|
dir = parent;
|
|
17154
17274
|
}
|
|
@@ -17175,17 +17295,17 @@ function _delete_legacy_settings(project) {
|
|
|
17175
17295
|
const removed = [];
|
|
17176
17296
|
for (const p of _detect_legacy_settings(project)) {
|
|
17177
17297
|
try {
|
|
17178
|
-
|
|
17179
|
-
removed.push(
|
|
17298
|
+
fs20.unlinkSync(p);
|
|
17299
|
+
removed.push(path17.relative(project, p));
|
|
17180
17300
|
} catch {
|
|
17181
17301
|
continue;
|
|
17182
17302
|
}
|
|
17183
17303
|
}
|
|
17184
|
-
const settings_dir =
|
|
17304
|
+
const settings_dir = path17.join(project, "settings");
|
|
17185
17305
|
if (_isDir2(settings_dir) && !_isSymlink(settings_dir)) {
|
|
17186
17306
|
try {
|
|
17187
|
-
if (
|
|
17188
|
-
|
|
17307
|
+
if (fs20.readdirSync(settings_dir).length === 0) {
|
|
17308
|
+
fs20.rmdirSync(settings_dir);
|
|
17189
17309
|
removed.push("settings/");
|
|
17190
17310
|
}
|
|
17191
17311
|
} catch {
|
|
@@ -17194,12 +17314,12 @@ function _delete_legacy_settings(project) {
|
|
|
17194
17314
|
return removed;
|
|
17195
17315
|
}
|
|
17196
17316
|
function _remove_empty_shell(project) {
|
|
17197
|
-
const shell =
|
|
17317
|
+
const shell = path17.join(project, LEGACY_AGENT_CONFIG_SHELL);
|
|
17198
17318
|
if (!_detect_empty_shell(project)) {
|
|
17199
17319
|
return false;
|
|
17200
17320
|
}
|
|
17201
17321
|
try {
|
|
17202
|
-
|
|
17322
|
+
fs20.rmdirSync(shell);
|
|
17203
17323
|
} catch {
|
|
17204
17324
|
return false;
|
|
17205
17325
|
}
|
|
@@ -17209,7 +17329,7 @@ function _reEscape(s) {
|
|
|
17209
17329
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
17210
17330
|
}
|
|
17211
17331
|
function _update_gitignore(project) {
|
|
17212
|
-
const gitignore =
|
|
17332
|
+
const gitignore = path17.join(project, ".gitignore");
|
|
17213
17333
|
const block = `${GITIGNORE_BLOCK_START}
|
|
17214
17334
|
${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
|
|
17215
17335
|
`;
|
|
@@ -17240,16 +17360,16 @@ ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
|
|
|
17240
17360
|
}
|
|
17241
17361
|
function _build_plan(project) {
|
|
17242
17362
|
return {
|
|
17243
|
-
npm: _detect_npm(
|
|
17244
|
-
composer: _detect_composer(
|
|
17363
|
+
npm: _detect_npm(path17.join(project, "package.json")),
|
|
17364
|
+
composer: _detect_composer(path17.join(project, "composer.json")),
|
|
17245
17365
|
symlinks_legacy: MANAGED_SYMLINKS.filter(
|
|
17246
|
-
(name) => _classify_symlink(
|
|
17366
|
+
(name) => _classify_symlink(path17.join(project, name)) === "legacy"
|
|
17247
17367
|
),
|
|
17248
17368
|
symlinks_user: MANAGED_SYMLINKS.filter(
|
|
17249
|
-
(name) => _classify_symlink(
|
|
17369
|
+
(name) => _classify_symlink(path17.join(project, name)) === "user"
|
|
17250
17370
|
),
|
|
17251
|
-
state_file: _isFile2(
|
|
17252
|
-
settings_files: _detect_legacy_settings(project).map((p) =>
|
|
17371
|
+
state_file: _isFile2(path17.join(project, LEGACY_STATE_FILENAME)),
|
|
17372
|
+
settings_files: _detect_legacy_settings(project).map((p) => path17.relative(project, p)),
|
|
17253
17373
|
empty_shell: _detect_empty_shell(project)
|
|
17254
17374
|
};
|
|
17255
17375
|
}
|
|
@@ -17313,10 +17433,10 @@ function _warn_on_major_mismatch(from_major, plan, out) {
|
|
|
17313
17433
|
}
|
|
17314
17434
|
function _apply(project, out, err) {
|
|
17315
17435
|
const summary = [];
|
|
17316
|
-
if (_strip_npm_entry(
|
|
17436
|
+
if (_strip_npm_entry(path17.join(project, "package.json"))) {
|
|
17317
17437
|
summary.push(`removed ${PACKAGE_NAME_NPM} from package.json`);
|
|
17318
17438
|
}
|
|
17319
|
-
if (_strip_composer_entry(
|
|
17439
|
+
if (_strip_composer_entry(path17.join(project, "composer.json"))) {
|
|
17320
17440
|
summary.push(`removed ${PACKAGE_NAME_COMPOSER} from composer.json`);
|
|
17321
17441
|
}
|
|
17322
17442
|
const [removed_links, preserved_links] = _purge_legacy_symlinks(project);
|
|
@@ -17443,17 +17563,17 @@ function _isCliEntry() {
|
|
|
17443
17563
|
return false;
|
|
17444
17564
|
}
|
|
17445
17565
|
if (typeof __AGENT_CONFIG_CLI_DELEGATE__ !== "undefined" && __AGENT_CONFIG_CLI_DELEGATE__) {
|
|
17446
|
-
if (
|
|
17566
|
+
if (path17.basename(process2.argv[1], ".js") === "cmd_migrate") {
|
|
17447
17567
|
return true;
|
|
17448
17568
|
}
|
|
17449
17569
|
}
|
|
17450
|
-
const argvUrl = pathToFileURL(
|
|
17570
|
+
const argvUrl = pathToFileURL(path17.resolve(process2.argv[1])).href;
|
|
17451
17571
|
if (import.meta.url === argvUrl) {
|
|
17452
17572
|
return true;
|
|
17453
17573
|
}
|
|
17454
17574
|
try {
|
|
17455
|
-
const here =
|
|
17456
|
-
const argv =
|
|
17575
|
+
const here = fs20.realpathSync(fileURLToPath4(import.meta.url));
|
|
17576
|
+
const argv = fs20.realpathSync(path17.resolve(process2.argv[1]));
|
|
17457
17577
|
return here === argv;
|
|
17458
17578
|
} catch {
|
|
17459
17579
|
return false;
|
|
@@ -17488,36 +17608,36 @@ var ArgparseExit2 = class extends Error {
|
|
|
17488
17608
|
code;
|
|
17489
17609
|
};
|
|
17490
17610
|
function expanduser6(p) {
|
|
17491
|
-
if (p === "~") return
|
|
17611
|
+
if (p === "~") return os8.homedir();
|
|
17492
17612
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
17493
|
-
return
|
|
17613
|
+
return path18.join(os8.homedir(), p.slice(2));
|
|
17494
17614
|
}
|
|
17495
17615
|
return p;
|
|
17496
17616
|
}
|
|
17497
17617
|
function resolvePath(p) {
|
|
17498
17618
|
try {
|
|
17499
|
-
return
|
|
17619
|
+
return fs21.realpathSync(path18.resolve(p));
|
|
17500
17620
|
} catch {
|
|
17501
|
-
return
|
|
17621
|
+
return path18.resolve(p);
|
|
17502
17622
|
}
|
|
17503
17623
|
}
|
|
17504
17624
|
function isFile(p) {
|
|
17505
17625
|
try {
|
|
17506
|
-
return
|
|
17626
|
+
return fs21.statSync(p).isFile();
|
|
17507
17627
|
} catch {
|
|
17508
17628
|
return false;
|
|
17509
17629
|
}
|
|
17510
17630
|
}
|
|
17511
17631
|
function isDir(p) {
|
|
17512
17632
|
try {
|
|
17513
|
-
return
|
|
17633
|
+
return fs21.statSync(p).isDirectory();
|
|
17514
17634
|
} catch {
|
|
17515
17635
|
return false;
|
|
17516
17636
|
}
|
|
17517
17637
|
}
|
|
17518
17638
|
function pathExists(p) {
|
|
17519
17639
|
try {
|
|
17520
|
-
|
|
17640
|
+
fs21.statSync(p);
|
|
17521
17641
|
return true;
|
|
17522
17642
|
} catch {
|
|
17523
17643
|
return false;
|
|
@@ -17525,24 +17645,24 @@ function pathExists(p) {
|
|
|
17525
17645
|
}
|
|
17526
17646
|
function isSymlink(p) {
|
|
17527
17647
|
try {
|
|
17528
|
-
return
|
|
17648
|
+
return fs21.lstatSync(p).isSymbolicLink();
|
|
17529
17649
|
} catch {
|
|
17530
17650
|
return false;
|
|
17531
17651
|
}
|
|
17532
17652
|
}
|
|
17533
17653
|
function readText(p) {
|
|
17534
|
-
return
|
|
17654
|
+
return fs21.readFileSync(p, "utf-8");
|
|
17535
17655
|
}
|
|
17536
17656
|
function writeText(p, content) {
|
|
17537
|
-
|
|
17657
|
+
fs21.writeFileSync(p, content, "utf-8");
|
|
17538
17658
|
}
|
|
17539
17659
|
function mkdirp(p) {
|
|
17540
|
-
|
|
17660
|
+
fs21.mkdirSync(p, { recursive: true });
|
|
17541
17661
|
}
|
|
17542
17662
|
function sortedGlobStems(directory, suffix) {
|
|
17543
17663
|
let entries;
|
|
17544
17664
|
try {
|
|
17545
|
-
entries =
|
|
17665
|
+
entries = fs21.readdirSync(directory);
|
|
17546
17666
|
} catch {
|
|
17547
17667
|
return [];
|
|
17548
17668
|
}
|
|
@@ -17562,7 +17682,7 @@ function sortedGlobStems(directory, suffix) {
|
|
|
17562
17682
|
function countZips(directory) {
|
|
17563
17683
|
if (!isDir(directory)) return 0;
|
|
17564
17684
|
let n = 0;
|
|
17565
|
-
for (const name of
|
|
17685
|
+
for (const name of fs21.readdirSync(directory)) {
|
|
17566
17686
|
if (name.endsWith(".zip")) n += 1;
|
|
17567
17687
|
}
|
|
17568
17688
|
return n;
|
|
@@ -17570,35 +17690,35 @@ function countZips(directory) {
|
|
|
17570
17690
|
function sha256OfFile(p) {
|
|
17571
17691
|
let data;
|
|
17572
17692
|
try {
|
|
17573
|
-
data =
|
|
17693
|
+
data = fs21.readFileSync(p);
|
|
17574
17694
|
} catch {
|
|
17575
17695
|
return null;
|
|
17576
17696
|
}
|
|
17577
17697
|
return crypto3.createHash("sha256").update(data).digest("hex");
|
|
17578
17698
|
}
|
|
17579
17699
|
function atomicWrite0644(target, body, prefix) {
|
|
17580
|
-
const dir =
|
|
17581
|
-
const tmpName =
|
|
17700
|
+
const dir = path18.dirname(target);
|
|
17701
|
+
const tmpName = path18.join(
|
|
17582
17702
|
dir,
|
|
17583
17703
|
`${prefix}${process3.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
|
|
17584
17704
|
);
|
|
17585
17705
|
let fd = null;
|
|
17586
17706
|
try {
|
|
17587
|
-
fd =
|
|
17588
|
-
|
|
17589
|
-
|
|
17707
|
+
fd = fs21.openSync(tmpName, "wx", 420);
|
|
17708
|
+
fs21.writeFileSync(fd, body, "utf-8");
|
|
17709
|
+
fs21.closeSync(fd);
|
|
17590
17710
|
fd = null;
|
|
17591
|
-
|
|
17592
|
-
|
|
17711
|
+
fs21.chmodSync(tmpName, 420);
|
|
17712
|
+
fs21.renameSync(tmpName, target);
|
|
17593
17713
|
} catch (err) {
|
|
17594
17714
|
if (fd !== null) {
|
|
17595
17715
|
try {
|
|
17596
|
-
|
|
17716
|
+
fs21.closeSync(fd);
|
|
17597
17717
|
} catch {
|
|
17598
17718
|
}
|
|
17599
17719
|
}
|
|
17600
17720
|
try {
|
|
17601
|
-
|
|
17721
|
+
fs21.unlinkSync(tmpName);
|
|
17602
17722
|
} catch {
|
|
17603
17723
|
}
|
|
17604
17724
|
throw err;
|
|
@@ -17722,12 +17842,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
|
|
|
17722
17842
|
var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
|
|
17723
17843
|
var SETTINGS_SUBDIR = ["agents", "settings"];
|
|
17724
17844
|
function _canonical_settings_target(project_root) {
|
|
17725
|
-
return
|
|
17845
|
+
return path18.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
|
|
17726
17846
|
}
|
|
17727
17847
|
function _resolve_settings_read(project_root) {
|
|
17728
17848
|
const canonical = _canonical_settings_target(project_root);
|
|
17729
17849
|
if (pathExists(canonical)) return canonical;
|
|
17730
|
-
const legacy =
|
|
17850
|
+
const legacy = path18.join(project_root, SETTINGS_FILE);
|
|
17731
17851
|
if (pathExists(legacy)) return legacy;
|
|
17732
17852
|
return canonical;
|
|
17733
17853
|
}
|
|
@@ -17791,9 +17911,9 @@ function fail(msg) {
|
|
|
17791
17911
|
throw new SystemExitError(1);
|
|
17792
17912
|
}
|
|
17793
17913
|
function detect_package_root(project_root) {
|
|
17794
|
-
const npm_path =
|
|
17914
|
+
const npm_path = path18.join(project_root, "node_modules", "@event4u", "agent-config");
|
|
17795
17915
|
if (isDir(npm_path)) return resolvePath(npm_path);
|
|
17796
|
-
if (pathExists(
|
|
17916
|
+
if (pathExists(path18.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
17797
17917
|
return project_root;
|
|
17798
17918
|
}
|
|
17799
17919
|
fail(
|
|
@@ -17801,12 +17921,12 @@ function detect_package_root(project_root) {
|
|
|
17801
17921
|
);
|
|
17802
17922
|
}
|
|
17803
17923
|
function detect_package_type(package_root) {
|
|
17804
|
-
if (package_root.split(
|
|
17924
|
+
if (package_root.split(path18.sep).includes("node_modules")) return "npm";
|
|
17805
17925
|
return "local";
|
|
17806
17926
|
}
|
|
17807
17927
|
function detect_package_type_for_project(project_root, package_root) {
|
|
17808
17928
|
const npm_path = resolvePath(
|
|
17809
|
-
|
|
17929
|
+
path18.join(project_root, "node_modules", "@event4u", "agent-config")
|
|
17810
17930
|
);
|
|
17811
17931
|
const package_resolved = resolvePath(package_root);
|
|
17812
17932
|
if (package_resolved === npm_path) return "npm";
|
|
@@ -17826,7 +17946,7 @@ function ensure_directory(p) {
|
|
|
17826
17946
|
mkdirp(p);
|
|
17827
17947
|
}
|
|
17828
17948
|
function write_file(p, content) {
|
|
17829
|
-
ensure_directory(
|
|
17949
|
+
ensure_directory(path18.dirname(p));
|
|
17830
17950
|
writeText(p, content);
|
|
17831
17951
|
}
|
|
17832
17952
|
function read_json_file(p) {
|
|
@@ -17997,7 +18117,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
|
|
|
17997
18117
|
return rendered + "\n" + suffix;
|
|
17998
18118
|
}
|
|
17999
18119
|
function _migrate_legacy_if_present(project_root, template_body) {
|
|
18000
|
-
const legacy_target =
|
|
18120
|
+
const legacy_target = path18.join(project_root, LEGACY_SETTINGS_FILE);
|
|
18001
18121
|
if (!isFile(legacy_target)) return null;
|
|
18002
18122
|
const legacy_text = readText(legacy_target);
|
|
18003
18123
|
const [values, unknown] = _parse_legacy_settings(legacy_text);
|
|
@@ -18012,9 +18132,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
|
|
|
18012
18132
|
}
|
|
18013
18133
|
}
|
|
18014
18134
|
rendered = _append_unknown_legacy(rendered, values, unknown);
|
|
18015
|
-
const backup_target =
|
|
18135
|
+
const backup_target = path18.join(project_root, LEGACY_BACKUP_FILE);
|
|
18016
18136
|
writeText(backup_target, legacy_text);
|
|
18017
|
-
|
|
18137
|
+
fs21.unlinkSync(legacy_target);
|
|
18018
18138
|
info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
|
|
18019
18139
|
info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
|
|
18020
18140
|
if (unknown.length > 0) {
|
|
@@ -18049,7 +18169,7 @@ function _render_template(template, profile_values) {
|
|
|
18049
18169
|
return body;
|
|
18050
18170
|
}
|
|
18051
18171
|
function _load_valid_user_types(package_root) {
|
|
18052
|
-
const directory =
|
|
18172
|
+
const directory = path18.join(package_root, USER_TYPES_DIR);
|
|
18053
18173
|
if (!isDir(directory)) return [];
|
|
18054
18174
|
return sortedGlobStems(directory, ".yml");
|
|
18055
18175
|
}
|
|
@@ -18106,8 +18226,8 @@ function splitlinesKeepends(text) {
|
|
|
18106
18226
|
}
|
|
18107
18227
|
function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
|
|
18108
18228
|
const target = _canonical_settings_target(project_root);
|
|
18109
|
-
const profile_source =
|
|
18110
|
-
const template_source =
|
|
18229
|
+
const profile_source = path18.join(package_root, "src", "config", "profiles", `${profile}.ini`);
|
|
18230
|
+
const template_source = path18.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
18111
18231
|
if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
|
|
18112
18232
|
if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
|
|
18113
18233
|
const template = readText(template_source);
|
|
@@ -18121,21 +18241,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
18121
18241
|
if (profile_values["rule_loading_tier"] !== profile) {
|
|
18122
18242
|
const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
|
|
18123
18243
|
fail(
|
|
18124
|
-
`Profile preset ${
|
|
18244
|
+
`Profile preset ${path18.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
|
|
18125
18245
|
);
|
|
18126
18246
|
}
|
|
18127
18247
|
profile_values["user_type"] = _validate_user_type(package_root, user_type);
|
|
18128
18248
|
let template_body = _render_template(template, profile_values);
|
|
18129
18249
|
template_body = _inject_packs(template_body, packs ?? []);
|
|
18130
|
-
const legacy_root =
|
|
18250
|
+
const legacy_root = path18.join(project_root, SETTINGS_FILE);
|
|
18131
18251
|
if (isFile(legacy_root) && !pathExists(target)) {
|
|
18132
|
-
mkdirp(
|
|
18252
|
+
mkdirp(path18.dirname(target));
|
|
18133
18253
|
writeText(target, readText(legacy_root));
|
|
18134
|
-
|
|
18254
|
+
fs21.unlinkSync(legacy_root);
|
|
18135
18255
|
success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
|
|
18136
18256
|
return;
|
|
18137
18257
|
}
|
|
18138
|
-
const legacy_target =
|
|
18258
|
+
const legacy_target = path18.join(project_root, LEGACY_SETTINGS_FILE);
|
|
18139
18259
|
if (isFile(legacy_target) && pathExists(target)) {
|
|
18140
18260
|
warn(
|
|
18141
18261
|
`Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
|
|
@@ -18152,7 +18272,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
18152
18272
|
skip(`${SETTINGS_FILE} already exists`);
|
|
18153
18273
|
return;
|
|
18154
18274
|
}
|
|
18155
|
-
mkdirp(
|
|
18275
|
+
mkdirp(path18.dirname(target));
|
|
18156
18276
|
write_file(target, template_body);
|
|
18157
18277
|
const user_type_value = profile_values["user_type"] ?? "";
|
|
18158
18278
|
const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
|
|
@@ -18165,7 +18285,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
18165
18285
|
const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
|
|
18166
18286
|
const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
|
|
18167
18287
|
return merge_json_file(
|
|
18168
|
-
|
|
18288
|
+
path18.join(project_root, ".vscode", "settings.json"),
|
|
18169
18289
|
bridge,
|
|
18170
18290
|
force,
|
|
18171
18291
|
".vscode/settings.json"
|
|
@@ -18174,14 +18294,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
18174
18294
|
function ensure_augment_bridge(project_root, force) {
|
|
18175
18295
|
const bridge = { enabledPlugins: { "agent-config@event4u": true } };
|
|
18176
18296
|
return merge_json_file(
|
|
18177
|
-
|
|
18297
|
+
path18.join(project_root, ".augment", "settings.json"),
|
|
18178
18298
|
bridge,
|
|
18179
18299
|
force,
|
|
18180
18300
|
".augment/settings.json"
|
|
18181
18301
|
);
|
|
18182
18302
|
}
|
|
18183
|
-
var AUGMENT_USER_DIR =
|
|
18184
|
-
var AUGMENT_USER_HOOKS_DIR =
|
|
18303
|
+
var AUGMENT_USER_DIR = path18.join(os8.homedir(), ".augment");
|
|
18304
|
+
var AUGMENT_USER_HOOKS_DIR = path18.join(AUGMENT_USER_DIR, "hooks");
|
|
18185
18305
|
var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
|
|
18186
18306
|
var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
18187
18307
|
"augment-chat-history.sh",
|
|
@@ -18197,29 +18317,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
|
|
|
18197
18317
|
["post_tool_use", "PostToolUse"]
|
|
18198
18318
|
];
|
|
18199
18319
|
function _deploy_augment_trampoline(package_root, name, force) {
|
|
18200
|
-
const src =
|
|
18320
|
+
const src = path18.join(package_root, "scripts", "hooks", name);
|
|
18201
18321
|
if (!pathExists(src)) {
|
|
18202
18322
|
skip(`augment trampoline missing in package: ${src}`);
|
|
18203
18323
|
return null;
|
|
18204
18324
|
}
|
|
18205
18325
|
mkdirp(AUGMENT_USER_HOOKS_DIR);
|
|
18206
|
-
const dst =
|
|
18326
|
+
const dst = path18.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
18207
18327
|
const src_text = readText(src);
|
|
18208
18328
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
18209
18329
|
skip(`~/.augment/hooks/${name} already up to date`);
|
|
18210
18330
|
} else {
|
|
18211
18331
|
writeText(dst, src_text);
|
|
18212
|
-
|
|
18332
|
+
fs21.chmodSync(dst, 493);
|
|
18213
18333
|
success(`~/.augment/hooks/${name} installed`);
|
|
18214
18334
|
}
|
|
18215
18335
|
return dst;
|
|
18216
18336
|
}
|
|
18217
18337
|
function _remove_legacy_augment_trampolines() {
|
|
18218
18338
|
for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
|
|
18219
|
-
const legacy =
|
|
18339
|
+
const legacy = path18.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
18220
18340
|
try {
|
|
18221
18341
|
if (isFile(legacy)) {
|
|
18222
|
-
|
|
18342
|
+
fs21.unlinkSync(legacy);
|
|
18223
18343
|
skip(`removed legacy ~/.augment/hooks/${name}`);
|
|
18224
18344
|
}
|
|
18225
18345
|
} catch (err) {
|
|
@@ -18239,7 +18359,7 @@ function ensure_augment_user_hooks(package_root, force) {
|
|
|
18239
18359
|
}
|
|
18240
18360
|
const settings_patch = { hooks: per_event };
|
|
18241
18361
|
return merge_json_file(
|
|
18242
|
-
|
|
18362
|
+
path18.join(AUGMENT_USER_DIR, "settings.json"),
|
|
18243
18363
|
settings_patch,
|
|
18244
18364
|
force,
|
|
18245
18365
|
"~/.augment/settings.json"
|
|
@@ -18264,7 +18384,7 @@ function _heal_legacy_claude_plugin_ids(p) {
|
|
|
18264
18384
|
return removed;
|
|
18265
18385
|
}
|
|
18266
18386
|
function ensure_claude_bridge(project_root, force) {
|
|
18267
|
-
const target =
|
|
18387
|
+
const target = path18.join(project_root, ".claude", "settings.json");
|
|
18268
18388
|
const healed = _heal_legacy_claude_plugin_ids(target);
|
|
18269
18389
|
for (const pid of healed) {
|
|
18270
18390
|
success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
|
|
@@ -18289,29 +18409,29 @@ function ensure_cursor_bridge(project_root, force) {
|
|
|
18289
18409
|
}
|
|
18290
18410
|
const bridge = { version: 1, hooks };
|
|
18291
18411
|
return merge_json_file(
|
|
18292
|
-
|
|
18412
|
+
path18.join(project_root, ".cursor", "hooks.json"),
|
|
18293
18413
|
bridge,
|
|
18294
18414
|
force,
|
|
18295
18415
|
".cursor/hooks.json"
|
|
18296
18416
|
);
|
|
18297
18417
|
}
|
|
18298
|
-
var CURSOR_USER_DIR =
|
|
18299
|
-
var CURSOR_USER_HOOKS_DIR =
|
|
18418
|
+
var CURSOR_USER_DIR = path18.join(os8.homedir(), ".cursor");
|
|
18419
|
+
var CURSOR_USER_HOOKS_DIR = path18.join(CURSOR_USER_DIR, "hooks");
|
|
18300
18420
|
var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
|
|
18301
18421
|
function ensure_cursor_user_hooks(package_root, force) {
|
|
18302
|
-
const src =
|
|
18422
|
+
const src = path18.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
|
|
18303
18423
|
if (!pathExists(src)) {
|
|
18304
18424
|
skip(`cursor trampoline missing in package: ${src}`);
|
|
18305
18425
|
return [];
|
|
18306
18426
|
}
|
|
18307
18427
|
mkdirp(CURSOR_USER_HOOKS_DIR);
|
|
18308
|
-
const dst =
|
|
18428
|
+
const dst = path18.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
|
|
18309
18429
|
const src_text = readText(src);
|
|
18310
18430
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
18311
18431
|
skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
18312
18432
|
} else {
|
|
18313
18433
|
writeText(dst, src_text);
|
|
18314
|
-
|
|
18434
|
+
fs21.chmodSync(dst, 493);
|
|
18315
18435
|
success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
|
|
18316
18436
|
}
|
|
18317
18437
|
const hooks = {};
|
|
@@ -18320,7 +18440,7 @@ function ensure_cursor_user_hooks(package_root, force) {
|
|
|
18320
18440
|
}
|
|
18321
18441
|
const settings_patch = { version: 1, hooks };
|
|
18322
18442
|
return merge_json_file(
|
|
18323
|
-
|
|
18443
|
+
path18.join(CURSOR_USER_DIR, "hooks.json"),
|
|
18324
18444
|
settings_patch,
|
|
18325
18445
|
force,
|
|
18326
18446
|
"~/.cursor/hooks.json"
|
|
@@ -18363,12 +18483,12 @@ exit 0
|
|
|
18363
18483
|
`;
|
|
18364
18484
|
}
|
|
18365
18485
|
function ensure_cline_bridge(project_root, force) {
|
|
18366
|
-
const hooks_dir =
|
|
18486
|
+
const hooks_dir = path18.join(project_root, ".clinerules", "hooks");
|
|
18367
18487
|
mkdirp(hooks_dir);
|
|
18368
18488
|
const workspace_quoted = shlexQuote(resolvePath(project_root));
|
|
18369
18489
|
let written = 0;
|
|
18370
18490
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
18371
|
-
const target =
|
|
18491
|
+
const target = path18.join(hooks_dir, native_event);
|
|
18372
18492
|
const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
|
|
18373
18493
|
if (pathExists(target) && readText(target) === body && !force) {
|
|
18374
18494
|
continue;
|
|
@@ -18378,7 +18498,7 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
18378
18498
|
continue;
|
|
18379
18499
|
}
|
|
18380
18500
|
writeText(target, body);
|
|
18381
|
-
|
|
18501
|
+
fs21.chmodSync(target, 493);
|
|
18382
18502
|
written += 1;
|
|
18383
18503
|
}
|
|
18384
18504
|
if (written) {
|
|
@@ -18387,27 +18507,27 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
18387
18507
|
skip(".clinerules/hooks/ already up to date");
|
|
18388
18508
|
}
|
|
18389
18509
|
}
|
|
18390
|
-
var CLINE_USER_DIR =
|
|
18510
|
+
var CLINE_USER_DIR = path18.join(os8.homedir(), "Documents", "Cline", "Hooks");
|
|
18391
18511
|
var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
|
|
18392
18512
|
function ensure_cline_user_hooks(package_root, force) {
|
|
18393
|
-
const src =
|
|
18513
|
+
const src = path18.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
|
|
18394
18514
|
if (!pathExists(src)) {
|
|
18395
18515
|
skip(`cline trampoline missing in package: ${src}`);
|
|
18396
18516
|
return;
|
|
18397
18517
|
}
|
|
18398
18518
|
mkdirp(CLINE_USER_DIR);
|
|
18399
|
-
const trampoline =
|
|
18519
|
+
const trampoline = path18.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
|
|
18400
18520
|
const src_text = readText(src);
|
|
18401
18521
|
if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
|
|
18402
18522
|
skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
18403
18523
|
} else {
|
|
18404
18524
|
writeText(trampoline, src_text);
|
|
18405
|
-
|
|
18525
|
+
fs21.chmodSync(trampoline, 493);
|
|
18406
18526
|
success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
|
|
18407
18527
|
}
|
|
18408
18528
|
const trampoline_quoted = shlexQuote(trampoline);
|
|
18409
18529
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
18410
|
-
const wrapper =
|
|
18530
|
+
const wrapper = path18.join(CLINE_USER_DIR, native_event);
|
|
18411
18531
|
const body = `#!/usr/bin/env bash
|
|
18412
18532
|
# Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
|
|
18413
18533
|
# User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
|
|
@@ -18417,7 +18537,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
|
|
|
18417
18537
|
continue;
|
|
18418
18538
|
}
|
|
18419
18539
|
writeText(wrapper, body);
|
|
18420
|
-
|
|
18540
|
+
fs21.chmodSync(wrapper, 493);
|
|
18421
18541
|
}
|
|
18422
18542
|
}
|
|
18423
18543
|
var WINDSURF_DISPATCHER_BINDINGS = [
|
|
@@ -18438,29 +18558,29 @@ function ensure_windsurf_bridge(project_root, force) {
|
|
|
18438
18558
|
}
|
|
18439
18559
|
const bridge = { hooks };
|
|
18440
18560
|
return merge_json_file(
|
|
18441
|
-
|
|
18561
|
+
path18.join(project_root, ".windsurf", "hooks.json"),
|
|
18442
18562
|
bridge,
|
|
18443
18563
|
force,
|
|
18444
18564
|
".windsurf/hooks.json"
|
|
18445
18565
|
);
|
|
18446
18566
|
}
|
|
18447
|
-
var WINDSURF_USER_DIR =
|
|
18448
|
-
var WINDSURF_USER_HOOKS_DIR =
|
|
18567
|
+
var WINDSURF_USER_DIR = path18.join(os8.homedir(), ".codeium", "windsurf");
|
|
18568
|
+
var WINDSURF_USER_HOOKS_DIR = path18.join(WINDSURF_USER_DIR, "hooks");
|
|
18449
18569
|
var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
|
|
18450
18570
|
function ensure_windsurf_user_hooks(package_root, force) {
|
|
18451
|
-
const src =
|
|
18571
|
+
const src = path18.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
18452
18572
|
if (!pathExists(src)) {
|
|
18453
18573
|
skip(`windsurf trampoline missing in package: ${src}`);
|
|
18454
18574
|
return [];
|
|
18455
18575
|
}
|
|
18456
18576
|
mkdirp(WINDSURF_USER_HOOKS_DIR);
|
|
18457
|
-
const dst =
|
|
18577
|
+
const dst = path18.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
18458
18578
|
const src_text = readText(src);
|
|
18459
18579
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
18460
18580
|
skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
18461
18581
|
} else {
|
|
18462
18582
|
writeText(dst, src_text);
|
|
18463
|
-
|
|
18583
|
+
fs21.chmodSync(dst, 493);
|
|
18464
18584
|
success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
|
|
18465
18585
|
}
|
|
18466
18586
|
const hooks = {};
|
|
@@ -18472,7 +18592,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
|
|
|
18472
18592
|
}
|
|
18473
18593
|
const settings_patch = { hooks };
|
|
18474
18594
|
return merge_json_file(
|
|
18475
|
-
|
|
18595
|
+
path18.join(WINDSURF_USER_DIR, "hooks.json"),
|
|
18476
18596
|
settings_patch,
|
|
18477
18597
|
force,
|
|
18478
18598
|
"~/.codeium/windsurf/hooks.json"
|
|
@@ -18501,43 +18621,43 @@ function _gemini_hooks_dict(command_factory) {
|
|
|
18501
18621
|
function ensure_gemini_bridge(project_root, force) {
|
|
18502
18622
|
const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
|
|
18503
18623
|
return merge_json_file(
|
|
18504
|
-
|
|
18624
|
+
path18.join(project_root, ".gemini", "settings.json"),
|
|
18505
18625
|
bridge,
|
|
18506
18626
|
force,
|
|
18507
18627
|
".gemini/settings.json"
|
|
18508
18628
|
);
|
|
18509
18629
|
}
|
|
18510
|
-
var GEMINI_USER_DIR =
|
|
18511
|
-
var GEMINI_USER_HOOKS_DIR =
|
|
18630
|
+
var GEMINI_USER_DIR = path18.join(os8.homedir(), ".gemini");
|
|
18631
|
+
var GEMINI_USER_HOOKS_DIR = path18.join(GEMINI_USER_DIR, "hooks");
|
|
18512
18632
|
var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
|
|
18513
18633
|
function ensure_gemini_user_hooks(package_root, force) {
|
|
18514
|
-
const src =
|
|
18634
|
+
const src = path18.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
|
|
18515
18635
|
if (!pathExists(src)) {
|
|
18516
18636
|
skip(`gemini trampoline missing in package: ${src}`);
|
|
18517
18637
|
return [];
|
|
18518
18638
|
}
|
|
18519
18639
|
mkdirp(GEMINI_USER_HOOKS_DIR);
|
|
18520
|
-
const dst =
|
|
18640
|
+
const dst = path18.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
|
|
18521
18641
|
const src_text = readText(src);
|
|
18522
18642
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
18523
18643
|
skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
18524
18644
|
} else {
|
|
18525
18645
|
writeText(dst, src_text);
|
|
18526
|
-
|
|
18646
|
+
fs21.chmodSync(dst, 493);
|
|
18527
18647
|
success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
|
|
18528
18648
|
}
|
|
18529
18649
|
const settings_patch = {
|
|
18530
18650
|
hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
|
|
18531
18651
|
};
|
|
18532
18652
|
return merge_json_file(
|
|
18533
|
-
|
|
18653
|
+
path18.join(GEMINI_USER_DIR, "settings.json"),
|
|
18534
18654
|
settings_patch,
|
|
18535
18655
|
force,
|
|
18536
18656
|
"~/.gemini/settings.json"
|
|
18537
18657
|
);
|
|
18538
18658
|
}
|
|
18539
18659
|
function ensure_copilot_bridge(project_root, force) {
|
|
18540
|
-
const target =
|
|
18660
|
+
const target = path18.join(project_root, ".github", "plugin", "marketplace.json");
|
|
18541
18661
|
const bridge = {
|
|
18542
18662
|
marketplace: {
|
|
18543
18663
|
name: "event4u-agent-marketplace",
|
|
@@ -18580,7 +18700,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
|
|
|
18580
18700
|
Run \`./agent-config --help\` for available commands.
|
|
18581
18701
|
`;
|
|
18582
18702
|
function ensure_roocode_bridge(project_root, force) {
|
|
18583
|
-
const target =
|
|
18703
|
+
const target = path18.join(project_root, ".roo", "rules", "agent-config.md");
|
|
18584
18704
|
if (pathExists(target) && !force) {
|
|
18585
18705
|
skip(".roo/rules/agent-config.md already exists");
|
|
18586
18706
|
return;
|
|
@@ -18602,7 +18722,7 @@ To wire Claude Desktop to this project's rules, run:
|
|
|
18602
18722
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18603
18723
|
`;
|
|
18604
18724
|
function ensure_claude_desktop_bridge(project_root, force) {
|
|
18605
|
-
const target =
|
|
18725
|
+
const target = path18.join(project_root, ".claude-desktop", "agent-config.md");
|
|
18606
18726
|
if (pathExists(target) && !force) {
|
|
18607
18727
|
skip(".claude-desktop/agent-config.md already exists");
|
|
18608
18728
|
return;
|
|
@@ -18627,7 +18747,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
|
|
|
18627
18747
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18628
18748
|
`;
|
|
18629
18749
|
function ensure_aider_bridge(project_root, force) {
|
|
18630
|
-
const target =
|
|
18750
|
+
const target = path18.join(project_root, ".aider", "agent-config.md");
|
|
18631
18751
|
if (pathExists(target) && !force) {
|
|
18632
18752
|
skip(".aider/agent-config.md already exists");
|
|
18633
18753
|
return;
|
|
@@ -18646,7 +18766,7 @@ developers where the rules and skills live.
|
|
|
18646
18766
|
Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
|
|
18647
18767
|
`;
|
|
18648
18768
|
function ensure_codex_bridge(project_root, force) {
|
|
18649
|
-
const target =
|
|
18769
|
+
const target = path18.join(project_root, ".codex", "agent-config.md");
|
|
18650
18770
|
if (pathExists(target) && !force) {
|
|
18651
18771
|
skip(".codex/agent-config.md already exists");
|
|
18652
18772
|
return;
|
|
@@ -18664,7 +18784,7 @@ rules per session. The canonical rule and skill source lives under
|
|
|
18664
18784
|
orientation).
|
|
18665
18785
|
`;
|
|
18666
18786
|
function ensure_continue_bridge(project_root, force) {
|
|
18667
|
-
const target =
|
|
18787
|
+
const target = path18.join(project_root, ".continue", "rules", "agent-config.md");
|
|
18668
18788
|
if (pathExists(target) && !force) {
|
|
18669
18789
|
skip(".continue/rules/agent-config.md already exists");
|
|
18670
18790
|
return;
|
|
@@ -18695,7 +18815,7 @@ orientation).
|
|
|
18695
18815
|
See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
|
|
18696
18816
|
`;
|
|
18697
18817
|
function ensure_kilocode_bridge(project_root, force) {
|
|
18698
|
-
const target =
|
|
18818
|
+
const target = path18.join(project_root, ".kilocode", "rules", "agent-config.md");
|
|
18699
18819
|
if (pathExists(target) && !force) {
|
|
18700
18820
|
skip(".kilocode/rules/agent-config.md already exists");
|
|
18701
18821
|
return;
|
|
@@ -18722,7 +18842,7 @@ canonical source (or symlink it):
|
|
|
18722
18842
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18723
18843
|
`;
|
|
18724
18844
|
function ensure_zed_bridge(project_root, force) {
|
|
18725
|
-
const target =
|
|
18845
|
+
const target = path18.join(project_root, ".zed", "agent-config.md");
|
|
18726
18846
|
if (pathExists(target) && !force) {
|
|
18727
18847
|
skip(".zed/agent-config.md already exists");
|
|
18728
18848
|
return;
|
|
@@ -18743,7 +18863,7 @@ rules into your JetBrains profile.
|
|
|
18743
18863
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18744
18864
|
`;
|
|
18745
18865
|
function ensure_jetbrains_bridge(project_root, force) {
|
|
18746
|
-
const target =
|
|
18866
|
+
const target = path18.join(project_root, ".jetbrains", "agent-config.md");
|
|
18747
18867
|
if (pathExists(target) && !force) {
|
|
18748
18868
|
skip(".jetbrains/agent-config.md already exists");
|
|
18749
18869
|
return;
|
|
@@ -18774,7 +18894,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
|
|
|
18774
18894
|
See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
|
|
18775
18895
|
`;
|
|
18776
18896
|
function ensure_kiro_bridge(project_root, force) {
|
|
18777
|
-
const target =
|
|
18897
|
+
const target = path18.join(project_root, ".kiro", "steering", "agent-config.md");
|
|
18778
18898
|
if (pathExists(target) && !force) {
|
|
18779
18899
|
skip(".kiro/steering/agent-config.md already exists");
|
|
18780
18900
|
return;
|
|
@@ -18800,35 +18920,35 @@ var SMOKE_BRIDGE_PATHS = {
|
|
|
18800
18920
|
};
|
|
18801
18921
|
function dirHasEntries(p) {
|
|
18802
18922
|
try {
|
|
18803
|
-
return
|
|
18923
|
+
return fs21.readdirSync(p).length > 0;
|
|
18804
18924
|
} catch {
|
|
18805
18925
|
return false;
|
|
18806
18926
|
}
|
|
18807
18927
|
}
|
|
18808
18928
|
function _resolve_tsx_invocation(scriptPath, scriptArgs) {
|
|
18809
18929
|
const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
18810
|
-
let dir =
|
|
18930
|
+
let dir = path18.dirname(scriptPath);
|
|
18811
18931
|
for (; ; ) {
|
|
18812
|
-
const candidate =
|
|
18932
|
+
const candidate = path18.join(dir, "node_modules", ".bin", binName);
|
|
18813
18933
|
if (isFile(candidate)) {
|
|
18814
18934
|
return { command: candidate, args: [scriptPath, ...scriptArgs] };
|
|
18815
18935
|
}
|
|
18816
|
-
const parent =
|
|
18936
|
+
const parent = path18.dirname(dir);
|
|
18817
18937
|
if (parent === dir) break;
|
|
18818
18938
|
dir = parent;
|
|
18819
18939
|
}
|
|
18820
18940
|
return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
|
|
18821
18941
|
}
|
|
18822
18942
|
function _smoke_test_hooks(project_root, package_root) {
|
|
18823
|
-
const dispatcher =
|
|
18824
|
-
const manifest =
|
|
18943
|
+
const dispatcher = path18.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
|
|
18944
|
+
const manifest = path18.join(package_root, "scripts", "hook_manifest.yaml");
|
|
18825
18945
|
if (!isFile(dispatcher) || !isFile(manifest)) return 0;
|
|
18826
18946
|
const failed = [];
|
|
18827
18947
|
const skipped = [];
|
|
18828
18948
|
const passed = [];
|
|
18829
18949
|
for (const [platform, native] of SMOKE_PROBE_EVENTS) {
|
|
18830
18950
|
const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
|
|
18831
|
-
const bridge_path = rel_bridge ?
|
|
18951
|
+
const bridge_path = rel_bridge ? path18.join(project_root, rel_bridge) : null;
|
|
18832
18952
|
const bridge_present = Boolean(
|
|
18833
18953
|
bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
|
|
18834
18954
|
);
|
|
@@ -19028,9 +19148,9 @@ To remove this marker, delete this file.
|
|
|
19028
19148
|
`;
|
|
19029
19149
|
}
|
|
19030
19150
|
var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
|
|
19031
|
-
var GLOBAL_ROOT =
|
|
19032
|
-
var GLOBAL_USER_SETTINGS_PATH =
|
|
19033
|
-
var GLOBAL_AGENT_SETTINGS_PATH =
|
|
19151
|
+
var GLOBAL_ROOT = path18.join(os8.homedir(), ".event4u", "agent-config");
|
|
19152
|
+
var GLOBAL_USER_SETTINGS_PATH = path18.join(GLOBAL_ROOT, ".agent-user.yml");
|
|
19153
|
+
var GLOBAL_AGENT_SETTINGS_PATH = path18.join(GLOBAL_ROOT, ".agent-settings.yml");
|
|
19034
19154
|
function _bridge_marker(tool_id, scope) {
|
|
19035
19155
|
if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
|
|
19036
19156
|
return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
|
|
@@ -19079,7 +19199,7 @@ function _load_yaml_doc(p) {
|
|
|
19079
19199
|
return _isPlainObject2(data) ? data : {};
|
|
19080
19200
|
}
|
|
19081
19201
|
function _load_default_settings(package_root) {
|
|
19082
|
-
const template_source =
|
|
19202
|
+
const template_source = path18.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
19083
19203
|
if (!pathExists(template_source)) return {};
|
|
19084
19204
|
let text;
|
|
19085
19205
|
try {
|
|
@@ -19093,11 +19213,11 @@ function _load_default_settings(package_root) {
|
|
|
19093
19213
|
}
|
|
19094
19214
|
var RULE_LAYER_CHOICES = ["global", "project", "both-acknowledged"];
|
|
19095
19215
|
function _suppress_rule_layer(project_root, suppress_dir) {
|
|
19096
|
-
const target =
|
|
19216
|
+
const target = path18.join(project_root, ".claude", "settings.local.json");
|
|
19097
19217
|
const existing = pathExists(target) ? read_json_file(target) : {};
|
|
19098
19218
|
let real_dir = suppress_dir;
|
|
19099
19219
|
try {
|
|
19100
|
-
real_dir =
|
|
19220
|
+
real_dir = fs21.realpathSync(suppress_dir);
|
|
19101
19221
|
} catch {
|
|
19102
19222
|
real_dir = suppress_dir;
|
|
19103
19223
|
}
|
|
@@ -19108,8 +19228,8 @@ function _suppress_rule_layer(project_root, suppress_dir) {
|
|
|
19108
19228
|
success(`.claude/settings.local.json: claudeMdExcludes += ${entry}`);
|
|
19109
19229
|
}
|
|
19110
19230
|
function _gate_rule_layer_overlap(project_root, layer, dry_run) {
|
|
19111
|
-
const global_dir =
|
|
19112
|
-
const project_dir =
|
|
19231
|
+
const global_dir = path18.join(os8.homedir(), ".claude", "rules");
|
|
19232
|
+
const project_dir = path18.join(project_root, ".claude", "rules");
|
|
19113
19233
|
const g = readRuleLayer(global_dir);
|
|
19114
19234
|
const p = readRuleLayer(project_dir);
|
|
19115
19235
|
if (g === null || p === null) return true;
|
|
@@ -19219,9 +19339,9 @@ function detect_scope(cwd) {
|
|
|
19219
19339
|
if (pathExists(_resolve_settings_read(cwd))) {
|
|
19220
19340
|
return ["project", `existing ${SETTINGS_FILE}`];
|
|
19221
19341
|
}
|
|
19222
|
-
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(
|
|
19223
|
-
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(
|
|
19224
|
-
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(
|
|
19342
|
+
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path18.join(cwd, m))) ?? null;
|
|
19343
|
+
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path18.join(cwd, d))) ?? null;
|
|
19344
|
+
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path18.join(cwd, f))) ?? null;
|
|
19225
19345
|
if (has_manifest && (has_ai_dir || has_ai_file)) {
|
|
19226
19346
|
const marker = has_ai_dir || has_ai_file;
|
|
19227
19347
|
return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
|
|
@@ -19242,7 +19362,7 @@ function readLineSyncRaw(promptText) {
|
|
|
19242
19362
|
for (; ; ) {
|
|
19243
19363
|
let n;
|
|
19244
19364
|
try {
|
|
19245
|
-
n =
|
|
19365
|
+
n = fs21.readSync(0, buf, 0, 1, null);
|
|
19246
19366
|
} catch (err) {
|
|
19247
19367
|
const code = err.code;
|
|
19248
19368
|
if (code === "EAGAIN") {
|
|
@@ -19317,8 +19437,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
|
|
|
19317
19437
|
const marker = _bridge_marker(tool_id, scope);
|
|
19318
19438
|
if (!marker) continue;
|
|
19319
19439
|
let marker_path = marker;
|
|
19320
|
-
if (!
|
|
19321
|
-
marker_path =
|
|
19440
|
+
if (!path18.isAbsolute(marker_path)) {
|
|
19441
|
+
marker_path = path18.join(project_root, marker_path);
|
|
19322
19442
|
}
|
|
19323
19443
|
out[tool_id] = [_file_entry(marker_path, "bridge", false)];
|
|
19324
19444
|
}
|
|
@@ -19357,26 +19477,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
|
|
|
19357
19477
|
}
|
|
19358
19478
|
write_manifest(target, version, entries);
|
|
19359
19479
|
if (!state.QUIET) {
|
|
19360
|
-
const rel = isRelativeTo(target, project_root) ?
|
|
19480
|
+
const rel = isRelativeTo(target, project_root) ? path18.relative(project_root, target) : target;
|
|
19361
19481
|
info(`Manifest updated: ${rel}`);
|
|
19362
19482
|
}
|
|
19363
19483
|
return 0;
|
|
19364
19484
|
}
|
|
19365
19485
|
function isRelativeTo(child, parent) {
|
|
19366
|
-
const rel =
|
|
19367
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
19486
|
+
const rel = path18.relative(parent, child);
|
|
19487
|
+
return rel === "" || !rel.startsWith("..") && !path18.isAbsolute(rel);
|
|
19368
19488
|
}
|
|
19369
19489
|
function _resolve_package_root_for_global() {
|
|
19370
19490
|
const here = resolvePath(_HERE2);
|
|
19371
|
-
const candidate =
|
|
19372
|
-
if (!pathExists(
|
|
19491
|
+
const candidate = path18.dirname(path18.dirname(path18.dirname(here)));
|
|
19492
|
+
if (!pathExists(path18.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
|
|
19373
19493
|
fail(
|
|
19374
19494
|
`Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
|
|
19375
19495
|
);
|
|
19376
19496
|
}
|
|
19377
19497
|
return candidate;
|
|
19378
19498
|
}
|
|
19379
|
-
var CONSUMER_BRIDGE_MARKER_RELPATH =
|
|
19499
|
+
var CONSUMER_BRIDGE_MARKER_RELPATH = path18.join("agents", ".event4u-bridge.yml");
|
|
19380
19500
|
var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
19381
19501
|
var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
|
|
19382
19502
|
var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
|
|
@@ -19384,7 +19504,7 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
19384
19504
|
if (process3.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
|
|
19385
19505
|
return [false, "consumer-mode-override"];
|
|
19386
19506
|
}
|
|
19387
|
-
const pkg_json =
|
|
19507
|
+
const pkg_json = path18.join(project_root, "package.json");
|
|
19388
19508
|
if (isFile(pkg_json)) {
|
|
19389
19509
|
let data = {};
|
|
19390
19510
|
try {
|
|
@@ -19396,18 +19516,18 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
19396
19516
|
return [true, "package.json:name"];
|
|
19397
19517
|
}
|
|
19398
19518
|
}
|
|
19399
|
-
if (isDir(
|
|
19519
|
+
if (isDir(path18.join(project_root, ".agent-src.uncondensed"))) {
|
|
19400
19520
|
return [true, ".agent-src.uncondensed/"];
|
|
19401
19521
|
}
|
|
19402
|
-
const packages_dir =
|
|
19522
|
+
const packages_dir = path18.join(project_root, "packages");
|
|
19403
19523
|
if (isDir(packages_dir)) {
|
|
19404
|
-
for (const child of
|
|
19405
|
-
if (isDir(
|
|
19524
|
+
for (const child of fs21.readdirSync(packages_dir)) {
|
|
19525
|
+
if (isDir(path18.join(packages_dir, child, ".agent-src.uncondensed"))) {
|
|
19406
19526
|
return [true, `packages/${child}/.agent-src.uncondensed/`];
|
|
19407
19527
|
}
|
|
19408
19528
|
}
|
|
19409
19529
|
}
|
|
19410
|
-
const installer_self =
|
|
19530
|
+
const installer_self = path18.join(project_root, "scripts", "install.py");
|
|
19411
19531
|
try {
|
|
19412
19532
|
if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE2)) {
|
|
19413
19533
|
return [true, "src/scripts/install.py (self)"];
|
|
@@ -19427,17 +19547,17 @@ function _detect_legacy_for_migration(project_root) {
|
|
|
19427
19547
|
}
|
|
19428
19548
|
return [];
|
|
19429
19549
|
}
|
|
19430
|
-
if (isFile(
|
|
19550
|
+
if (isFile(path18.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
|
|
19431
19551
|
const found = [];
|
|
19432
19552
|
for (const name of MIGRATE_LEGACY_YAML_FILES) {
|
|
19433
|
-
if (isFile(
|
|
19553
|
+
if (isFile(path18.join(project_root, name))) {
|
|
19434
19554
|
found.push(name);
|
|
19435
|
-
} else if (isFile(
|
|
19555
|
+
} else if (isFile(path18.join(project_root, "settings", name))) {
|
|
19436
19556
|
found.push(`settings/${name}`);
|
|
19437
19557
|
}
|
|
19438
19558
|
}
|
|
19439
19559
|
for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
|
|
19440
|
-
const p =
|
|
19560
|
+
const p = path18.join(project_root, name);
|
|
19441
19561
|
if (isDir(p) && !isSymlink(p)) {
|
|
19442
19562
|
found.push(`${name}/`);
|
|
19443
19563
|
}
|
|
@@ -19449,7 +19569,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
|
|
|
19449
19569
|
process3.stdout.write("\n");
|
|
19450
19570
|
warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
|
|
19451
19571
|
for (const rel of artefacts) {
|
|
19452
|
-
info(` ${
|
|
19572
|
+
info(` ${path18.join(project_root, rel)}`);
|
|
19453
19573
|
}
|
|
19454
19574
|
info("The unified `agent-config migrate` sweeps these in one pass.");
|
|
19455
19575
|
info("The wizard recreates fresh config afterwards.");
|
|
@@ -19478,22 +19598,22 @@ function _run_migrate_to_global(project_root) {
|
|
|
19478
19598
|
}
|
|
19479
19599
|
}
|
|
19480
19600
|
function _format_global_root_for_marker(global_root) {
|
|
19481
|
-
const home = resolvePath(
|
|
19601
|
+
const home = resolvePath(os8.homedir());
|
|
19482
19602
|
const resolved = resolvePath(global_root);
|
|
19483
|
-
const rel =
|
|
19484
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
19603
|
+
const rel = path18.relative(home, resolved);
|
|
19604
|
+
if (rel === "" || rel.startsWith("..") || path18.isAbsolute(rel)) {
|
|
19485
19605
|
return global_root;
|
|
19486
19606
|
}
|
|
19487
|
-
return `~/${rel.split(
|
|
19607
|
+
return `~/${rel.split(path18.sep).join("/")}`;
|
|
19488
19608
|
}
|
|
19489
19609
|
function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
|
|
19490
19610
|
const env_map = env ?? process3.env;
|
|
19491
19611
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
|
|
19492
|
-
if (isDir(
|
|
19493
|
-
const target =
|
|
19612
|
+
if (isDir(path18.join(project_root, ".agent-src.uncondensed"))) return null;
|
|
19613
|
+
const target = path18.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
|
|
19494
19614
|
if (!isFile(target)) return null;
|
|
19495
19615
|
try {
|
|
19496
|
-
|
|
19616
|
+
fs21.rmSync(target);
|
|
19497
19617
|
} catch {
|
|
19498
19618
|
return null;
|
|
19499
19619
|
}
|
|
@@ -19507,7 +19627,7 @@ var PROJECT_ANCHOR_TOOLS = {
|
|
|
19507
19627
|
function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
|
|
19508
19628
|
const env_map = env ?? process3.env;
|
|
19509
19629
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
|
|
19510
|
-
if (isDir(
|
|
19630
|
+
if (isDir(path18.join(project_root, ".agent-src.uncondensed"))) return [];
|
|
19511
19631
|
const global_root_str = _format_global_root_for_marker(
|
|
19512
19632
|
event4u_root(env_map)
|
|
19513
19633
|
);
|
|
@@ -19516,8 +19636,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
|
|
|
19516
19636
|
for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
|
|
19517
19637
|
const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
|
|
19518
19638
|
if (!tools.has(tool_id)) continue;
|
|
19519
|
-
const target =
|
|
19520
|
-
mkdirp(
|
|
19639
|
+
const target = path18.join(project_root, rel_path);
|
|
19640
|
+
mkdirp(path18.dirname(target));
|
|
19521
19641
|
const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
|
|
19522
19642
|
# Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
|
|
19523
19643
|
# Tool: ${tool_id}. Resolves the global install directly \u2014 no
|
|
@@ -19535,7 +19655,7 @@ installed_at: ${stamp}
|
|
|
19535
19655
|
}
|
|
19536
19656
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
19537
19657
|
function _inject_package_tag(target, source, package_root) {
|
|
19538
|
-
if (
|
|
19658
|
+
if (path18.extname(target) !== ".md") return;
|
|
19539
19659
|
let text;
|
|
19540
19660
|
try {
|
|
19541
19661
|
text = readText(target);
|
|
@@ -19563,8 +19683,8 @@ function _inject_package_tag(target, source, package_root) {
|
|
|
19563
19683
|
resolved_src = source;
|
|
19564
19684
|
}
|
|
19565
19685
|
if (package_root !== null) {
|
|
19566
|
-
const rel =
|
|
19567
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
19686
|
+
const rel = path18.relative(resolvePath(package_root), resolved_src);
|
|
19687
|
+
if (rel !== "" && !rel.startsWith("..") && !path18.isAbsolute(rel)) {
|
|
19568
19688
|
source_value = rel;
|
|
19569
19689
|
} else {
|
|
19570
19690
|
source_value = resolved_src;
|
|
@@ -19599,7 +19719,7 @@ function _escapes_package_root(resolved, package_root) {
|
|
|
19599
19719
|
if (package_root === null) return false;
|
|
19600
19720
|
let root;
|
|
19601
19721
|
try {
|
|
19602
|
-
root =
|
|
19722
|
+
root = fs21.realpathSync(package_root);
|
|
19603
19723
|
} catch {
|
|
19604
19724
|
return false;
|
|
19605
19725
|
}
|
|
@@ -19614,7 +19734,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19614
19734
|
if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
|
|
19615
19735
|
let resolved_src = src;
|
|
19616
19736
|
try {
|
|
19617
|
-
resolved_src =
|
|
19737
|
+
resolved_src = fs21.realpathSync(src);
|
|
19618
19738
|
} catch {
|
|
19619
19739
|
resolved_src = src;
|
|
19620
19740
|
}
|
|
@@ -19622,10 +19742,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19622
19742
|
warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
|
|
19623
19743
|
return [0, 0, written_paths];
|
|
19624
19744
|
}
|
|
19625
|
-
mkdirp(
|
|
19745
|
+
mkdirp(path18.dirname(dest));
|
|
19626
19746
|
const decision = _resolve_file_conflict(dest, force);
|
|
19627
19747
|
if (decision === "skip") return [0, 1, written_paths];
|
|
19628
|
-
|
|
19748
|
+
fs21.copyFileSync(src, dest);
|
|
19629
19749
|
_inject_package_tag(dest, src, package_root);
|
|
19630
19750
|
written_paths.push(dest);
|
|
19631
19751
|
return [1, 0, written_paths];
|
|
@@ -19633,11 +19753,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19633
19753
|
mkdirp(dest);
|
|
19634
19754
|
const walk = (node) => {
|
|
19635
19755
|
const acc = [];
|
|
19636
|
-
const names =
|
|
19756
|
+
const names = fs21.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
19637
19757
|
for (const name of names) {
|
|
19638
|
-
const entry =
|
|
19758
|
+
const entry = path18.join(node, name);
|
|
19639
19759
|
acc.push(entry);
|
|
19640
|
-
const lst =
|
|
19760
|
+
const lst = fs21.lstatSync(entry);
|
|
19641
19761
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
19642
19762
|
acc.push(...walk(entry));
|
|
19643
19763
|
}
|
|
@@ -19645,9 +19765,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19645
19765
|
return acc;
|
|
19646
19766
|
};
|
|
19647
19767
|
for (const entry of walk(src)) {
|
|
19648
|
-
const rel =
|
|
19649
|
-
const target =
|
|
19650
|
-
const lst =
|
|
19768
|
+
const rel = path18.relative(src, entry);
|
|
19769
|
+
const target = path18.join(dest, rel);
|
|
19770
|
+
const lst = fs21.lstatSync(entry);
|
|
19651
19771
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
19652
19772
|
mkdirp(target);
|
|
19653
19773
|
continue;
|
|
@@ -19655,8 +19775,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19655
19775
|
let resolvedIsDir = false;
|
|
19656
19776
|
let resolved = entry;
|
|
19657
19777
|
try {
|
|
19658
|
-
resolved =
|
|
19659
|
-
resolvedIsDir =
|
|
19778
|
+
resolved = fs21.realpathSync(entry);
|
|
19779
|
+
resolvedIsDir = fs21.statSync(entry).isDirectory();
|
|
19660
19780
|
} catch {
|
|
19661
19781
|
resolvedIsDir = false;
|
|
19662
19782
|
}
|
|
@@ -19686,8 +19806,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19686
19806
|
skipped += 1;
|
|
19687
19807
|
continue;
|
|
19688
19808
|
}
|
|
19689
|
-
mkdirp(
|
|
19690
|
-
|
|
19809
|
+
mkdirp(path18.dirname(target));
|
|
19810
|
+
fs21.copyFileSync(resolved, target);
|
|
19691
19811
|
_inject_package_tag(target, resolved, package_root);
|
|
19692
19812
|
written += 1;
|
|
19693
19813
|
written_paths.push(target);
|
|
@@ -19699,7 +19819,7 @@ function _claude_desktop_bundles_dir() {
|
|
|
19699
19819
|
}
|
|
19700
19820
|
function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
|
|
19701
19821
|
const anchor = expanduser6(USER_SCOPE_PATHS["claude-desktop"]);
|
|
19702
|
-
const target =
|
|
19822
|
+
const target = path18.join(anchor, "agent-config.md");
|
|
19703
19823
|
mkdirp(anchor);
|
|
19704
19824
|
const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
|
|
19705
19825
|
writeText(target, body);
|
|
@@ -19723,23 +19843,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
19723
19843
|
const wrapped = [];
|
|
19724
19844
|
const collisions = [];
|
|
19725
19845
|
const reserved = [];
|
|
19726
|
-
const commands_dir =
|
|
19846
|
+
const commands_dir = path18.join(anchor, "commands");
|
|
19727
19847
|
let flat_entries = [];
|
|
19728
19848
|
try {
|
|
19729
|
-
flat_entries =
|
|
19849
|
+
flat_entries = fs21.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
|
|
19730
19850
|
} catch {
|
|
19731
19851
|
}
|
|
19732
19852
|
for (const fname of flat_entries.sort()) {
|
|
19733
19853
|
const slug = fname.slice(0, -".md".length);
|
|
19734
19854
|
if (!is_claude_builtin_name(slug)) continue;
|
|
19735
|
-
|
|
19855
|
+
fs21.rmSync(path18.join(commands_dir, fname), { force: true });
|
|
19736
19856
|
current_files.delete(`commands/${fname}`);
|
|
19737
19857
|
reserved.push(slug);
|
|
19738
19858
|
}
|
|
19739
19859
|
const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
|
|
19740
19860
|
try {
|
|
19741
19861
|
const manifest = JSON.parse(
|
|
19742
|
-
|
|
19862
|
+
fs21.readFileSync(path18.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
|
|
19743
19863
|
);
|
|
19744
19864
|
for (const a of manifest.artefacts ?? []) {
|
|
19745
19865
|
if (a.category !== "command" || typeof a.slug !== "string") continue;
|
|
@@ -19750,22 +19870,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
19750
19870
|
}
|
|
19751
19871
|
for (const slug of [...eligible].sort()) {
|
|
19752
19872
|
const flat_rel = `commands/${slug}.md`;
|
|
19753
|
-
const flat_abs =
|
|
19754
|
-
if (!
|
|
19755
|
-
const skill_dir =
|
|
19756
|
-
if (
|
|
19873
|
+
const flat_abs = path18.join(anchor, "commands", `${slug}.md`);
|
|
19874
|
+
if (!fs21.existsSync(flat_abs)) continue;
|
|
19875
|
+
const skill_dir = path18.join(anchor, "skills", slug);
|
|
19876
|
+
if (fs21.existsSync(skill_dir)) {
|
|
19757
19877
|
collisions.push(slug);
|
|
19758
19878
|
continue;
|
|
19759
19879
|
}
|
|
19760
|
-
let body =
|
|
19880
|
+
let body = fs21.readFileSync(flat_abs, "utf8");
|
|
19761
19881
|
if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
|
|
19762
19882
|
body = body.replace("---\n", `---
|
|
19763
19883
|
name: ${slug}
|
|
19764
19884
|
`);
|
|
19765
19885
|
}
|
|
19766
|
-
|
|
19767
|
-
|
|
19768
|
-
|
|
19886
|
+
fs21.mkdirSync(skill_dir, { recursive: true });
|
|
19887
|
+
fs21.writeFileSync(path18.join(skill_dir, "SKILL.md"), body, "utf8");
|
|
19888
|
+
fs21.rmSync(flat_abs, { force: true });
|
|
19769
19889
|
current_files.delete(flat_rel);
|
|
19770
19890
|
current_files.add(`skills/${slug}/SKILL.md`);
|
|
19771
19891
|
wrapped.push(slug);
|
|
@@ -19797,8 +19917,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
19797
19917
|
const written_paths = [];
|
|
19798
19918
|
let current_files = /* @__PURE__ */ new Set();
|
|
19799
19919
|
for (const [src_rel, dest_sub] of plan) {
|
|
19800
|
-
const src =
|
|
19801
|
-
const dest = dest_sub ?
|
|
19920
|
+
const src = path18.join(package_root, src_rel);
|
|
19921
|
+
const dest = dest_sub ? path18.join(anchor, dest_sub) : anchor;
|
|
19802
19922
|
const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
|
|
19803
19923
|
const [w, s, paths] = _copy_dir_dereferencing_symlinks(
|
|
19804
19924
|
src,
|
|
@@ -19872,10 +19992,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
19872
19992
|
results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
|
|
19873
19993
|
if (tool_id === "claude-code") {
|
|
19874
19994
|
try {
|
|
19875
|
-
const manifest =
|
|
19995
|
+
const manifest = path18.join(package_root, "src", "scripts", "hook_manifest.yaml");
|
|
19876
19996
|
const matrix = build_claude_hook_matrix(manifest);
|
|
19877
19997
|
const res = ensure_managed_hooks(
|
|
19878
|
-
|
|
19998
|
+
path18.join(anchor, "settings.json"),
|
|
19879
19999
|
matrix
|
|
19880
20000
|
);
|
|
19881
20001
|
if (!state.QUIET) {
|
|
@@ -19912,7 +20032,7 @@ function _preview_global_reap(tools, package_root) {
|
|
|
19912
20032
|
const anchor = expanduser6(anchor_raw);
|
|
19913
20033
|
let current_files = /* @__PURE__ */ new Set();
|
|
19914
20034
|
for (const [src_rel, dest_sub] of plan) {
|
|
19915
|
-
const src =
|
|
20035
|
+
const src = path18.join(package_root, src_rel);
|
|
19916
20036
|
current_files = setUnion(
|
|
19917
20037
|
current_files,
|
|
19918
20038
|
expected_deploy_files(
|
|
@@ -19946,14 +20066,14 @@ function _preview_global_reap(tools, package_root) {
|
|
|
19946
20066
|
function _verify_deploy_targets(anchor, plan) {
|
|
19947
20067
|
const missing = [];
|
|
19948
20068
|
for (const [, dest_sub] of plan) {
|
|
19949
|
-
const target = dest_sub ?
|
|
20069
|
+
const target = dest_sub ? path18.join(anchor, dest_sub) : anchor;
|
|
19950
20070
|
const label = dest_sub || ".";
|
|
19951
20071
|
if (!isDir(target)) {
|
|
19952
20072
|
missing.push(label);
|
|
19953
20073
|
continue;
|
|
19954
20074
|
}
|
|
19955
20075
|
try {
|
|
19956
|
-
const entries =
|
|
20076
|
+
const entries = fs21.readdirSync(target);
|
|
19957
20077
|
if (entries.length === 0) missing.push(label);
|
|
19958
20078
|
} catch {
|
|
19959
20079
|
missing.push(label);
|
|
@@ -19968,13 +20088,13 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
19968
20088
|
const [written, skipped, status, paths] = deploy_results[tool_id];
|
|
19969
20089
|
const pruned_skill_dirs = /* @__PURE__ */ new Set();
|
|
19970
20090
|
for (const p of paths) {
|
|
19971
|
-
const parts = p.split(
|
|
20091
|
+
const parts = p.split(path18.sep);
|
|
19972
20092
|
if (parts.includes("skills")) {
|
|
19973
20093
|
const i = parts.indexOf("skills");
|
|
19974
20094
|
if (i + 1 < parts.length) {
|
|
19975
|
-
const skill_root = parts.slice(0, i + 2).join(
|
|
20095
|
+
const skill_root = parts.slice(0, i + 2).join(path18.sep);
|
|
19976
20096
|
if (!pruned_skill_dirs.has(skill_root)) {
|
|
19977
|
-
const skillmd =
|
|
20097
|
+
const skillmd = path18.join(skill_root, "SKILL.md");
|
|
19978
20098
|
if (pathExists(skillmd) && is_pruned(skillmd)) {
|
|
19979
20099
|
pruned_skill_dirs.add(skill_root);
|
|
19980
20100
|
}
|
|
@@ -19985,25 +20105,25 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
19985
20105
|
const keep = [];
|
|
19986
20106
|
const delete_files = [];
|
|
19987
20107
|
for (const p of paths) {
|
|
19988
|
-
const parts = p.split(
|
|
20108
|
+
const parts = p.split(path18.sep);
|
|
19989
20109
|
let is_target = false;
|
|
19990
20110
|
if (parts.includes("skills")) {
|
|
19991
20111
|
const i = parts.indexOf("skills");
|
|
19992
|
-
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(
|
|
20112
|
+
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path18.sep))) {
|
|
19993
20113
|
is_target = true;
|
|
19994
20114
|
}
|
|
19995
|
-
} else if (parts.includes("commands") &&
|
|
20115
|
+
} else if (parts.includes("commands") && path18.extname(p) === ".md" && is_pruned(p)) {
|
|
19996
20116
|
is_target = true;
|
|
19997
20117
|
}
|
|
19998
20118
|
(is_target ? delete_files : keep).push(p);
|
|
19999
20119
|
}
|
|
20000
20120
|
for (const d of pruned_skill_dirs) {
|
|
20001
|
-
|
|
20121
|
+
fs21.rmSync(d, { recursive: true, force: true });
|
|
20002
20122
|
}
|
|
20003
20123
|
for (const p of delete_files) {
|
|
20004
|
-
if (p.split(
|
|
20124
|
+
if (p.split(path18.sep).includes("commands") && pathExists(p)) {
|
|
20005
20125
|
try {
|
|
20006
|
-
|
|
20126
|
+
fs21.unlinkSync(p);
|
|
20007
20127
|
} catch {
|
|
20008
20128
|
}
|
|
20009
20129
|
}
|
|
@@ -20024,9 +20144,9 @@ function _resolve_global_settings_doc() {
|
|
|
20024
20144
|
}
|
|
20025
20145
|
function _resolve_global_settings_path() {
|
|
20026
20146
|
const root = event4u_root();
|
|
20027
|
-
const canonical =
|
|
20147
|
+
const canonical = path18.join(root, "settings", SETTINGS_FILE);
|
|
20028
20148
|
if (pathExists(canonical)) return canonical;
|
|
20029
|
-
const legacy =
|
|
20149
|
+
const legacy = path18.join(root, SETTINGS_FILE);
|
|
20030
20150
|
if (pathExists(legacy)) return legacy;
|
|
20031
20151
|
return null;
|
|
20032
20152
|
}
|
|
@@ -20075,7 +20195,7 @@ function _resolve_global_rule_scope(package_root) {
|
|
|
20075
20195
|
}
|
|
20076
20196
|
function _rule_filter_for_source(src_rel, scope) {
|
|
20077
20197
|
if (src_rel !== RULE_SOURCE_REL) return null;
|
|
20078
|
-
return (srcFile) => ruleFileArrives(srcFile, scope);
|
|
20198
|
+
return (srcFile) => ruleFileArrives(srcFile, scope) && !isExclusivelyPackageOnly(srcFile);
|
|
20079
20199
|
}
|
|
20080
20200
|
function _prune_scoped_modules(deploy_results, active_ids) {
|
|
20081
20201
|
return _prune_modules_by(
|
|
@@ -20137,7 +20257,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
20137
20257
|
info(` schema_version=1, agent_config_version=${installed_version}`);
|
|
20138
20258
|
info(` tools=${merged_tools.join(",")}`);
|
|
20139
20259
|
}
|
|
20140
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
20260
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path18.join(project_root, ".agent-src.uncondensed"))) {
|
|
20141
20261
|
const drift = collect_drift(project_root);
|
|
20142
20262
|
if (!state.QUIET) {
|
|
20143
20263
|
process3.stdout.write("\n");
|
|
@@ -20181,17 +20301,24 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
20181
20301
|
(tool_id) => deploy_results[tool_id][2] === "deploy_failed"
|
|
20182
20302
|
)
|
|
20183
20303
|
);
|
|
20184
|
-
|
|
20185
|
-
|
|
20186
|
-
|
|
20187
|
-
|
|
20188
|
-
|
|
20189
|
-
|
|
20190
|
-
|
|
20191
|
-
);
|
|
20192
|
-
}
|
|
20304
|
+
const corrected_tools = failed_tools.size > 0 ? merged_tools.filter((t) => !failed_tools.has(t)) : merged_tools;
|
|
20305
|
+
if (failed_tools.size > 0 && !arrayStrEqual(corrected_tools, merged_tools)) {
|
|
20306
|
+
write_lockfile(installed_version, corrected_tools, { path: write_path });
|
|
20307
|
+
if (!state.QUIET) {
|
|
20308
|
+
warn(
|
|
20309
|
+
`Lockfile corrected after deploy postcheck \u2014 dropped ${[...failed_tools].sort().join(", ")} (verification failed).`
|
|
20310
|
+
);
|
|
20193
20311
|
}
|
|
20194
20312
|
}
|
|
20313
|
+
stampHostLayerFingerprint(
|
|
20314
|
+
installed_version,
|
|
20315
|
+
corrected_tools,
|
|
20316
|
+
write_path,
|
|
20317
|
+
failed_tools.has("claude-code"),
|
|
20318
|
+
(m) => {
|
|
20319
|
+
if (!state.QUIET) info(m);
|
|
20320
|
+
}
|
|
20321
|
+
);
|
|
20195
20322
|
if (state.PROGRESS_NDJSON) {
|
|
20196
20323
|
const ordered = Object.keys(deploy_results).sort();
|
|
20197
20324
|
const total = ordered.length;
|
|
@@ -20237,19 +20364,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
20237
20364
|
}
|
|
20238
20365
|
}
|
|
20239
20366
|
}
|
|
20240
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
20367
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path18.join(project_root, ".agent-src.uncondensed"))) {
|
|
20241
20368
|
const files_by_tool = _files_by_tool_from_deploy(deploy_results);
|
|
20242
20369
|
const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
|
|
20243
20370
|
if (rc !== 0) return rc;
|
|
20244
20371
|
const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
|
|
20245
20372
|
if (removed_marker !== null && !state.QUIET) {
|
|
20246
|
-
const rel = isRelativeTo(removed_marker, project_root) ?
|
|
20373
|
+
const rel = isRelativeTo(removed_marker, project_root) ? path18.relative(project_root, removed_marker) : removed_marker;
|
|
20247
20374
|
info(`Removed legacy bridge marker: ${rel}`);
|
|
20248
20375
|
}
|
|
20249
20376
|
const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
|
|
20250
20377
|
if (anchor_paths.length > 0 && !state.QUIET) {
|
|
20251
20378
|
for (const p of anchor_paths) {
|
|
20252
|
-
const rel = isRelativeTo(p, project_root) ?
|
|
20379
|
+
const rel = isRelativeTo(p, project_root) ? path18.relative(project_root, p) : p;
|
|
20253
20380
|
info(`Project anchor written: ${rel}`);
|
|
20254
20381
|
}
|
|
20255
20382
|
}
|
|
@@ -20285,8 +20412,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
20285
20412
|
}
|
|
20286
20413
|
function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
20287
20414
|
const log_candidates = [
|
|
20288
|
-
|
|
20289
|
-
...project_root ? [
|
|
20415
|
+
path18.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
20416
|
+
...project_root ? [path18.join(project_root, OBSERVATION_LOG)] : []
|
|
20290
20417
|
];
|
|
20291
20418
|
const records = log_candidates.flatMap((p) => readObservationLog(p));
|
|
20292
20419
|
if (records.length === 0) return [];
|
|
@@ -20309,13 +20436,13 @@ function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
|
20309
20436
|
function _scoped_migration_notice(deploy_results, project_root, package_root, probe) {
|
|
20310
20437
|
if (!isInteractiveSession(probe)) return [];
|
|
20311
20438
|
const log_candidates = [
|
|
20312
|
-
|
|
20313
|
-
...project_root ? [
|
|
20439
|
+
path18.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
20440
|
+
...project_root ? [path18.join(project_root, OBSERVATION_LOG)] : []
|
|
20314
20441
|
];
|
|
20315
20442
|
const limits = knownHostLimits(log_candidates.flatMap((p) => readObservationLog(p)));
|
|
20316
20443
|
if (limits.size === 0) return [];
|
|
20317
20444
|
const resolved = _resolve_scoped_projection(package_root);
|
|
20318
|
-
const settings_path = _resolve_global_settings_path() ??
|
|
20445
|
+
const settings_path = _resolve_global_settings_path() ?? path18.join(event4u_root(), "settings", SETTINGS_FILE);
|
|
20319
20446
|
for (const tool_id of Object.keys(deploy_results).sort()) {
|
|
20320
20447
|
const [, , status] = deploy_results[tool_id];
|
|
20321
20448
|
if (status !== "deployed") continue;
|
|
@@ -20334,8 +20461,8 @@ function _scoped_migration_notice(deploy_results, project_root, package_root, pr
|
|
|
20334
20461
|
}
|
|
20335
20462
|
return [];
|
|
20336
20463
|
}
|
|
20337
|
-
var SETTINGS_SURFACE_REL =
|
|
20338
|
-
var SETTINGS_DELTA_REL =
|
|
20464
|
+
var SETTINGS_SURFACE_REL = path18.join("state", "settings-surface.json");
|
|
20465
|
+
var SETTINGS_DELTA_REL = path18.join("state", "settings-delta.json");
|
|
20339
20466
|
function _current_settings_surface(version) {
|
|
20340
20467
|
const jsonSchema = zodToJsonSchema(settingsSchema, {
|
|
20341
20468
|
name: "AgentSettings",
|
|
@@ -20346,20 +20473,20 @@ function _current_settings_surface(version) {
|
|
|
20346
20473
|
}
|
|
20347
20474
|
function _write_settings_surface_snapshot(installed_version) {
|
|
20348
20475
|
const root = event4u_root();
|
|
20349
|
-
const surface_path =
|
|
20350
|
-
const delta_path =
|
|
20476
|
+
const surface_path = path18.join(root, SETTINGS_SURFACE_REL);
|
|
20477
|
+
const delta_path = path18.join(root, SETTINGS_DELTA_REL);
|
|
20351
20478
|
const next = _current_settings_surface(installed_version);
|
|
20352
20479
|
let previous = null;
|
|
20353
20480
|
try {
|
|
20354
|
-
const parsed = JSON.parse(
|
|
20481
|
+
const parsed = JSON.parse(fs21.readFileSync(surface_path, "utf8"));
|
|
20355
20482
|
if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
|
|
20356
20483
|
} catch {
|
|
20357
20484
|
}
|
|
20358
20485
|
if (previous !== null && previous.version !== next.version) {
|
|
20359
20486
|
const delta = computeSurfaceDelta(previous, next);
|
|
20360
20487
|
if (delta.changes.length > 0) {
|
|
20361
|
-
|
|
20362
|
-
|
|
20488
|
+
fs21.mkdirSync(path18.dirname(delta_path), { recursive: true, mode: 448 });
|
|
20489
|
+
fs21.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
|
|
20363
20490
|
`, { mode: 384 });
|
|
20364
20491
|
if (!state.QUIET) {
|
|
20365
20492
|
const counts = {};
|
|
@@ -20371,8 +20498,8 @@ function _write_settings_surface_snapshot(installed_version) {
|
|
|
20371
20498
|
}
|
|
20372
20499
|
}
|
|
20373
20500
|
}
|
|
20374
|
-
|
|
20375
|
-
|
|
20501
|
+
fs21.mkdirSync(path18.dirname(surface_path), { recursive: true, mode: 448 });
|
|
20502
|
+
fs21.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
|
|
20376
20503
|
`, { mode: 384 });
|
|
20377
20504
|
}
|
|
20378
20505
|
function arrayStrEqual(a, b) {
|
|
@@ -20592,13 +20719,13 @@ function _minimal_templates_root() {
|
|
|
20592
20719
|
const chain = [start];
|
|
20593
20720
|
let cur = start;
|
|
20594
20721
|
for (; ; ) {
|
|
20595
|
-
const parent =
|
|
20722
|
+
const parent = path18.dirname(cur);
|
|
20596
20723
|
if (parent === cur) break;
|
|
20597
20724
|
chain.push(parent);
|
|
20598
20725
|
cur = parent;
|
|
20599
20726
|
}
|
|
20600
20727
|
for (const ancestor of chain) {
|
|
20601
|
-
const candidate =
|
|
20728
|
+
const candidate = path18.join(ancestor, "src", "templates", "minimal");
|
|
20602
20729
|
if (isDir(candidate)) return candidate;
|
|
20603
20730
|
}
|
|
20604
20731
|
fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
|
|
@@ -20606,9 +20733,9 @@ function _minimal_templates_root() {
|
|
|
20606
20733
|
var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
20607
20734
|
function _write_install_mode_marker(project_root, mode) {
|
|
20608
20735
|
if (mode !== "minimal" && mode !== "full") return;
|
|
20609
|
-
const marker =
|
|
20736
|
+
const marker = path18.join(project_root, INSTALL_MODE_MARKER_REL);
|
|
20610
20737
|
try {
|
|
20611
|
-
mkdirp(
|
|
20738
|
+
mkdirp(path18.dirname(marker));
|
|
20612
20739
|
writeText(marker, `${mode}
|
|
20613
20740
|
`);
|
|
20614
20741
|
} catch {
|
|
@@ -20617,7 +20744,7 @@ function _write_install_mode_marker(project_root, mode) {
|
|
|
20617
20744
|
function install_minimal(target_root_in, force, user_type = "") {
|
|
20618
20745
|
let target_root = resolvePath(target_root_in);
|
|
20619
20746
|
mkdirp(target_root);
|
|
20620
|
-
const parent =
|
|
20747
|
+
const parent = path18.dirname(target_root);
|
|
20621
20748
|
if (parent !== target_root) {
|
|
20622
20749
|
const existing = find_project_root_with_anchor(parent);
|
|
20623
20750
|
if (existing !== null && existing[0] !== target_root) {
|
|
@@ -20628,21 +20755,21 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
20628
20755
|
}
|
|
20629
20756
|
}
|
|
20630
20757
|
const templates = _minimal_templates_root();
|
|
20631
|
-
const settings_src =
|
|
20632
|
-
const overrides_gitkeep_src =
|
|
20633
|
-
const overrides_readme_src =
|
|
20758
|
+
const settings_src = path18.join(templates, SETTINGS_FILE);
|
|
20759
|
+
const overrides_gitkeep_src = path18.join(templates, "overrides-gitkeep");
|
|
20760
|
+
const overrides_readme_src = path18.join(templates, "agents-overrides-readme.md");
|
|
20634
20761
|
if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
|
|
20635
20762
|
if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
|
|
20636
20763
|
fail(`Bundled overrides scaffold templates missing under ${templates}`);
|
|
20637
20764
|
}
|
|
20638
20765
|
info(`Minimal init \u2192 ${target_root}`);
|
|
20639
|
-
const overrides_root =
|
|
20766
|
+
const overrides_root = path18.join(target_root, "agents", "overrides");
|
|
20640
20767
|
mkdirp(overrides_root);
|
|
20641
20768
|
const gitkeep_body = readText(overrides_gitkeep_src);
|
|
20642
20769
|
for (const sub of ["rules", "skills", "commands"]) {
|
|
20643
|
-
const sub_dir =
|
|
20770
|
+
const sub_dir = path18.join(overrides_root, sub);
|
|
20644
20771
|
mkdirp(sub_dir);
|
|
20645
|
-
const gitkeep_dst =
|
|
20772
|
+
const gitkeep_dst = path18.join(sub_dir, ".gitkeep");
|
|
20646
20773
|
if (pathExists(gitkeep_dst) && !force) {
|
|
20647
20774
|
skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
|
|
20648
20775
|
} else {
|
|
@@ -20650,7 +20777,7 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
20650
20777
|
success(`Wrote agents/overrides/${sub}/.gitkeep`);
|
|
20651
20778
|
}
|
|
20652
20779
|
}
|
|
20653
|
-
const readme_dst =
|
|
20780
|
+
const readme_dst = path18.join(overrides_root, "README.md");
|
|
20654
20781
|
if (pathExists(readme_dst) && !force) {
|
|
20655
20782
|
skip("agents/overrides/README.md already exists (use --force to overwrite)");
|
|
20656
20783
|
} else {
|
|
@@ -20668,14 +20795,14 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
20668
20795
|
personal:
|
|
20669
20796
|
user_type: ${user_type}
|
|
20670
20797
|
`;
|
|
20671
|
-
mkdirp(
|
|
20798
|
+
mkdirp(path18.dirname(settings_dst));
|
|
20672
20799
|
writeText(settings_dst, body);
|
|
20673
20800
|
success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
|
|
20674
20801
|
}
|
|
20675
20802
|
}
|
|
20676
20803
|
const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
|
|
20677
20804
|
if (removed_marker !== null) {
|
|
20678
|
-
const rel = isRelativeTo(removed_marker, target_root) ?
|
|
20805
|
+
const rel = isRelativeTo(removed_marker, target_root) ? path18.relative(target_root, removed_marker) : removed_marker;
|
|
20679
20806
|
success(`Removed legacy bridge marker: ${rel}`);
|
|
20680
20807
|
}
|
|
20681
20808
|
_write_install_mode_marker(target_root, "minimal");
|
|
@@ -20749,7 +20876,7 @@ function run_interactive_init(project_root, force) {
|
|
|
20749
20876
|
);
|
|
20750
20877
|
return 0;
|
|
20751
20878
|
}
|
|
20752
|
-
const target =
|
|
20879
|
+
const target = path18.join(project_root, _LOCAL_CONFIG_FILE);
|
|
20753
20880
|
if (pathExists(target) && !force) {
|
|
20754
20881
|
warn(
|
|
20755
20882
|
`${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
|
|
@@ -20776,7 +20903,7 @@ function run_interactive_init(project_root, force) {
|
|
|
20776
20903
|
warn(`Could not write ${target}: ${String(exc)}`);
|
|
20777
20904
|
return 1;
|
|
20778
20905
|
}
|
|
20779
|
-
success(`Wrote ${
|
|
20906
|
+
success(`Wrote ${path18.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
|
|
20780
20907
|
return 0;
|
|
20781
20908
|
}
|
|
20782
20909
|
var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
|
|
@@ -20794,12 +20921,12 @@ function _wizard_should_launch(opts) {
|
|
|
20794
20921
|
return [true, ""];
|
|
20795
20922
|
}
|
|
20796
20923
|
function _wizard_cli_dist(_project_root) {
|
|
20797
|
-
const package_root =
|
|
20798
|
-
const cli =
|
|
20924
|
+
const package_root = path18.dirname(path18.dirname(path18.dirname(resolvePath(_HERE2))));
|
|
20925
|
+
const cli = path18.join(package_root, "dist", "cli", "agent-config.js");
|
|
20799
20926
|
return pathExists(cli) ? cli : null;
|
|
20800
20927
|
}
|
|
20801
20928
|
function _server_info_path() {
|
|
20802
|
-
return
|
|
20929
|
+
return path18.join(os8.homedir(), ".event4u", "agent-config", "local-server.json");
|
|
20803
20930
|
}
|
|
20804
20931
|
function _pid_is_agent_config(pid) {
|
|
20805
20932
|
let res;
|
|
@@ -20816,7 +20943,7 @@ function _pid_is_agent_config(pid) {
|
|
|
20816
20943
|
}
|
|
20817
20944
|
function unlinkMissingOk(p) {
|
|
20818
20945
|
try {
|
|
20819
|
-
|
|
20946
|
+
fs21.unlinkSync(p);
|
|
20820
20947
|
} catch {
|
|
20821
20948
|
}
|
|
20822
20949
|
}
|
|
@@ -20894,14 +21021,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
|
|
|
20894
21021
|
}
|
|
20895
21022
|
function _wizard_run_sync(cmd, env, cli) {
|
|
20896
21023
|
const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
|
|
20897
|
-
const log_path =
|
|
20898
|
-
|
|
21024
|
+
const log_path = path18.join(
|
|
21025
|
+
os8.tmpdir(),
|
|
20899
21026
|
`agent-config-wizard-${process3.pid}-${Date.now()}.log`
|
|
20900
21027
|
);
|
|
20901
21028
|
let child;
|
|
20902
21029
|
let log_fd = null;
|
|
20903
21030
|
try {
|
|
20904
|
-
log_fd =
|
|
21031
|
+
log_fd = fs21.openSync(log_path, "w");
|
|
20905
21032
|
child = spawn(cmd[0], cmd.slice(1), {
|
|
20906
21033
|
env,
|
|
20907
21034
|
detached: true,
|
|
@@ -20919,7 +21046,7 @@ function _wizard_run_sync(cmd, env, cli) {
|
|
|
20919
21046
|
} finally {
|
|
20920
21047
|
if (log_fd !== null) {
|
|
20921
21048
|
try {
|
|
20922
|
-
|
|
21049
|
+
fs21.closeSync(log_fd);
|
|
20923
21050
|
} catch {
|
|
20924
21051
|
}
|
|
20925
21052
|
}
|
|
@@ -21169,8 +21296,8 @@ function main2(argv) {
|
|
|
21169
21296
|
const target_root = resolvePath(
|
|
21170
21297
|
opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
|
|
21171
21298
|
);
|
|
21172
|
-
const minimal_package_root =
|
|
21173
|
-
|
|
21299
|
+
const minimal_package_root = path18.dirname(
|
|
21300
|
+
path18.dirname(path18.dirname(_minimal_templates_root()))
|
|
21174
21301
|
);
|
|
21175
21302
|
const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
|
|
21176
21303
|
return install_minimal(target_root, opts.force, validated_user_type);
|
|
@@ -21202,7 +21329,7 @@ function main2(argv) {
|
|
|
21202
21329
|
return rc2;
|
|
21203
21330
|
}
|
|
21204
21331
|
const project_root = custom_path || resolvePath(opts.project || process3.env["PROJECT_ROOT"] || process3.cwd());
|
|
21205
|
-
const is_first_run = !pathExists(
|
|
21332
|
+
const is_first_run = !pathExists(path18.join(project_root, SETTINGS_FILE));
|
|
21206
21333
|
const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
|
|
21207
21334
|
if (rc === 0 && opts.interactive) {
|
|
21208
21335
|
run_interactive_init(project_root, opts.force);
|
|
@@ -21266,16 +21393,16 @@ function _team_setup_hint_line(project_root) {
|
|
|
21266
21393
|
return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
|
|
21267
21394
|
}
|
|
21268
21395
|
function finalize_claude_model_tiers(project_root) {
|
|
21269
|
-
const claude_skills =
|
|
21270
|
-
const augment_skills =
|
|
21396
|
+
const claude_skills = path18.join(project_root, ".claude", "skills");
|
|
21397
|
+
const augment_skills = path18.join(project_root, ".augment", "skills");
|
|
21271
21398
|
if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
|
|
21272
21399
|
if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
|
|
21273
21400
|
let rendered = 0;
|
|
21274
|
-
const entries =
|
|
21401
|
+
const entries = fs21.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
21275
21402
|
for (const name of entries) {
|
|
21276
|
-
const entry =
|
|
21277
|
-
const src_dir =
|
|
21278
|
-
const src_md =
|
|
21403
|
+
const entry = path18.join(claude_skills, name);
|
|
21404
|
+
const src_dir = path18.join(augment_skills, name);
|
|
21405
|
+
const src_md = path18.join(src_dir, "SKILL.md");
|
|
21279
21406
|
let tier;
|
|
21280
21407
|
try {
|
|
21281
21408
|
tier = read_model_tier(src_md);
|
|
@@ -21284,22 +21411,22 @@ function finalize_claude_model_tiers(project_root) {
|
|
|
21284
21411
|
}
|
|
21285
21412
|
if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
|
|
21286
21413
|
if (isSymlink(entry) || isFile(entry)) {
|
|
21287
|
-
|
|
21414
|
+
fs21.unlinkSync(entry);
|
|
21288
21415
|
} else if (isDir(entry)) {
|
|
21289
|
-
|
|
21416
|
+
fs21.rmSync(entry, { recursive: true, force: true });
|
|
21290
21417
|
}
|
|
21291
21418
|
mkdirp(entry);
|
|
21292
|
-
const srcFiles =
|
|
21419
|
+
const srcFiles = fs21.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
21293
21420
|
for (const fname of srcFiles) {
|
|
21294
21421
|
if (fname === "SKILL.md") {
|
|
21295
21422
|
writeText(
|
|
21296
|
-
|
|
21423
|
+
path18.join(entry, "SKILL.md"),
|
|
21297
21424
|
render_native_model_md(readText(src_md), tier)
|
|
21298
21425
|
);
|
|
21299
21426
|
} else {
|
|
21300
|
-
|
|
21301
|
-
|
|
21302
|
-
|
|
21427
|
+
fs21.symlinkSync(
|
|
21428
|
+
path18.join("../../../.augment/skills", name, fname),
|
|
21429
|
+
path18.join(entry, fname)
|
|
21303
21430
|
);
|
|
21304
21431
|
}
|
|
21305
21432
|
}
|
|
@@ -21317,7 +21444,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
21317
21444
|
let package_type;
|
|
21318
21445
|
if (opts.package) {
|
|
21319
21446
|
package_root = resolvePath(opts.package);
|
|
21320
|
-
if (!pathExists(
|
|
21447
|
+
if (!pathExists(path18.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
21321
21448
|
fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
|
|
21322
21449
|
}
|
|
21323
21450
|
package_type = detect_package_type_for_project(project_root, package_root);
|
|
@@ -21454,9 +21581,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
21454
21581
|
function _resolvedArgv1() {
|
|
21455
21582
|
if (process3.argv[1] === void 0) return void 0;
|
|
21456
21583
|
try {
|
|
21457
|
-
return
|
|
21584
|
+
return fs21.realpathSync(path18.resolve(process3.argv[1]));
|
|
21458
21585
|
} catch {
|
|
21459
|
-
return
|
|
21586
|
+
return path18.resolve(process3.argv[1]);
|
|
21460
21587
|
}
|
|
21461
21588
|
}
|
|
21462
21589
|
var _argv1 = _resolvedArgv1();
|
|
@@ -21533,6 +21660,7 @@ export {
|
|
|
21533
21660
|
_resolve_scope,
|
|
21534
21661
|
_resolve_scoped_projection,
|
|
21535
21662
|
_resolve_settings_read,
|
|
21663
|
+
_rule_filter_for_source,
|
|
21536
21664
|
_scoped_migration_notice,
|
|
21537
21665
|
_team_setup_hint_line,
|
|
21538
21666
|
_tools_was_all,
|