@event4u/agent-config 9.27.0 → 9.28.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/AGENTS.md +12 -11
- package/CHANGELOG.md +99 -0
- package/README.md +1 -1
- package/dist/agent-src/commands/analyze/conformance.md +24 -0
- package/dist/agent-src/contexts/execution/orchestration-telemetry.md +10 -3
- package/dist/agent-src/rules/artifact-engagement-recording.md +4 -1
- package/dist/agent-src/rules/autonomous-execution.md +1 -1
- package/dist/agent-src/rules/brand-source-of-truth.md +33 -6
- package/dist/agent-src/rules/context-hygiene.md +3 -1
- package/dist/agent-src/rules/council-availability.md +93 -0
- package/dist/agent-src/rules/cross-source-consistency.md +3 -0
- package/dist/agent-src/rules/delegation-policy.md +29 -5
- package/dist/agent-src/rules/design-fidelity.md +3 -0
- package/dist/agent-src/rules/evaluator-independence.md +2 -1
- package/dist/agent-src/rules/external-code-graph-interop.md +2 -1
- package/dist/agent-src/rules/finance-safety-floor.md +1 -1
- package/dist/agent-src/rules/git-history-discipline.md +1 -1
- package/dist/agent-src/rules/history-discipline.md +3 -1
- package/dist/agent-src/rules/legal-safety-floor.md +1 -1
- package/dist/agent-src/rules/no-pr-progress-comments.md +3 -1
- package/dist/agent-src/rules/onboarding-gate.md +3 -1
- package/dist/agent-src/rules/roadmap-ci-steps-policy.md +4 -1
- package/dist/agent-src/rules/role-mode-adherence.md +1 -1
- package/dist/agent-src/rules/scale-discipline.md +3 -1
- package/dist/agent-src/rules/self-repair-loop.md +103 -0
- package/dist/agent-src/rules/session-canary.md +2 -1
- package/dist/agent-src/rules/strategy-safety-floor.md +1 -1
- package/dist/agent-src/rules/token-budget-discipline.md +3 -1
- package/dist/agent-src/rules/tool-safety.md +5 -1
- package/dist/agent-src/skills/adversarial-review/SKILL.md +1 -1
- package/dist/agent-src/skills/analysis-autonomous-mode/SKILL.md +1 -1
- package/dist/agent-src/skills/performance-analysis/SKILL.md +1 -1
- package/dist/agent-src/skills/persona-improvement/SKILL.md +1 -1
- package/dist/agent-src/skills/project-analyzer/SKILL.md +1 -1
- package/dist/agent-src/skills/security-audit/SKILL.md +1 -1
- package/dist/agent-src/skills/sequential-thinking/SKILL.md +1 -1
- package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +1 -1
- package/dist/agent-src/skills/universal-project-analysis/SKILL.md +1 -1
- package/dist/agent-src/templates/AGENTS.md +6 -10
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/cli/registry.js +7 -0
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/chunk-22GCIJ2O.js +270 -0
- package/dist/cli-delegate/{chunk-BCPIOAGV.js → chunk-2BE5I2MN.js} +8 -8
- package/dist/cli-delegate/{chunk-AIIUU73N.js → chunk-7OMQCH4V.js} +1 -1
- package/dist/cli-delegate/{chunk-HJ6DAJHR.js → chunk-GB2FSUEE.js} +57 -7
- package/dist/cli-delegate/{chunk-WR6GTRHJ.js → chunk-JXARCGVN.js} +3 -3
- package/dist/cli-delegate/{chunk-3KJIMFTB.js → chunk-PQSAQKHW.js} +466 -304
- package/dist/cli-delegate/chunk-REKCMYOU.js +2991 -0
- package/dist/cli-delegate/cmd_analyze_session.js +1 -1
- package/dist/cli-delegate/cmd_brand_status.js +134 -0
- package/dist/cli-delegate/cmd_conformance.js +7 -7
- package/dist/cli-delegate/cmd_converge.js +3 -3
- package/dist/cli-delegate/cmd_doctor.js +4 -4
- package/dist/cli-delegate/cmd_explain.js +80 -330
- package/dist/cli-delegate/cmd_export.js +5 -5
- package/dist/cli-delegate/cmd_fleet.js +3 -3
- package/dist/cli-delegate/cmd_handoff.js +2 -2
- package/dist/cli-delegate/cmd_mcp_available.js +433 -0
- package/dist/cli-delegate/cmd_migrate.js +3 -3
- package/dist/cli-delegate/cmd_packs_active.js +153 -0
- package/dist/cli-delegate/cmd_preflight.js +1 -1
- package/dist/cli-delegate/cmd_prune.js +5 -5
- package/dist/cli-delegate/cmd_route_audit.js +8 -8
- package/dist/cli-delegate/cmd_route_explain.js +4 -4
- package/dist/cli-delegate/cmd_settings_get.js +272 -0
- package/dist/cli-delegate/cmd_settings_migrate.js +5 -5
- package/dist/cli-delegate/cmd_settings_set.js +7 -2967
- package/dist/cli-delegate/cmd_sync.js +5 -5
- package/dist/cli-delegate/cmd_uninstall.js +5 -5
- package/dist/cli-delegate/cmd_update.js +4 -4
- package/dist/cli-delegate/cmd_upgrade.js +4 -4
- package/dist/cli-delegate/cmd_validate.js +5 -5
- package/dist/cli-delegate/cmd_versions.js +4 -4
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +100 -40
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +3 -3
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +7 -5
- package/dist/discovery/trust-report.md +11 -11
- package/dist/discovery/workspaces.json +6 -4
- package/dist/hooks/dispatch.js +9004 -6132
- package/dist/install/install.mjs +697 -507
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +127 -20
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/agent_settings.js +80 -15
- package/dist/scripts/_lib/agent_settings.js.map +1 -1
- package/docs/contracts/settings-classes.md +29 -8
- package/docs/guidelines/agent-infra/memory-access.md +14 -3
- package/package.json +1 -1
- package/src/agent-src/templates/AGENTS.md +6 -10
- package/src/config/budgets.yml +29 -0
- package/src/config/evaluator-budgets.json +4 -4
- package/src/config/gate-coverage.yml +26 -0
- package/src/scripts/_cli/cmd_brand_status.ts +174 -0
- package/src/scripts/_cli/cmd_mcp_available.ts +266 -0
- package/src/scripts/_cli/cmd_packs_active.ts +225 -0
- package/src/scripts/_cli/cmd_settings_get.ts +324 -0
- package/src/scripts/_dispatch.bash +57 -0
- package/src/scripts/_lib/agent_settings.ts +82 -16
- package/src/scripts/_lib/carrier_divergence.ts +135 -0
- package/src/scripts/_lib/host_capability.ts +84 -1
- package/src/scripts/_lib/prompt_shape.ts +88 -0
- package/src/scripts/_lib/review_skipped_record.ts +102 -0
- package/src/scripts/_lib/rule_layer_overlap.ts +254 -0
- package/src/scripts/_lib/self_repair.ts +342 -0
- package/src/scripts/_lib/self_repair_store.ts +100 -0
- package/src/scripts/_lib/transcript_entry.ts +80 -0
- package/src/scripts/check_branch_freshness.ts +255 -0
- package/src/scripts/check_council_config_location.ts +125 -1
- package/src/scripts/check_standing_rule_delivery.ts +314 -0
- package/src/scripts/config/profiles.ts +13 -3
- package/src/scripts/conformance_scan.ts +272 -24
- package/src/scripts/council_availability_hook.ts +188 -0
- package/src/scripts/council_cli.ts +126 -7
- package/src/scripts/hook_manifest.yaml +107 -26
- package/src/scripts/hooks/block_no_verify.ts +39 -2
- package/src/scripts/hooks/block_unauthorized_git.ts +156 -7
- package/src/scripts/hooks/concern_registry.ts +10 -0
- package/src/scripts/hooks/delegation_nudge_hook.ts +450 -0
- package/src/scripts/hooks/end_review_nudge_hook.ts +726 -0
- package/src/scripts/hooks/orchestration_record_hook.ts +342 -0
- package/src/scripts/install.ts +151 -0
- package/src/scripts/language_mirror_hook.ts +30 -37
- package/src/scripts/measure_scope_dedup.ts +19 -13
- package/src/scripts/onboarding_gate_hook.ts +40 -1
- package/src/scripts/orchestration_record.ts +4 -1
- package/src/scripts/preamble_byte_census.ts +9 -20
- package/src/scripts/report_carrier_divergence.ts +364 -0
- package/src/scripts/report_skill_activation.ts +257 -0
- package/src/scripts/report_skill_obligation_violations.ts +579 -0
- package/src/scripts/routing_doctor.ts +77 -6
- package/src/scripts/self_repair_cli.ts +240 -0
- package/src/scripts/self_repair_hook.ts +241 -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, path17) {
|
|
121
|
+
const ctrl = callVisitor(key, node, visitor, path17);
|
|
122
122
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
123
|
-
replaceNode(key,
|
|
124
|
-
return visit_(key, ctrl, visitor,
|
|
123
|
+
replaceNode(key, path17, ctrl);
|
|
124
|
+
return visit_(key, ctrl, visitor, path17);
|
|
125
125
|
}
|
|
126
126
|
if (typeof ctrl !== "symbol") {
|
|
127
127
|
if (identity.isCollection(node)) {
|
|
128
|
-
|
|
128
|
+
path17 = Object.freeze(path17.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, path17);
|
|
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
|
+
path17 = Object.freeze(path17.concat(node));
|
|
142
|
+
const ck = visit_("key", node.key, visitor, path17);
|
|
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, path17);
|
|
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, path17) {
|
|
169
|
+
const ctrl = await callVisitor(key, node, visitor, path17);
|
|
170
170
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
171
|
-
replaceNode(key,
|
|
172
|
-
return visitAsync_(key, ctrl, visitor,
|
|
171
|
+
replaceNode(key, path17, ctrl);
|
|
172
|
+
return visitAsync_(key, ctrl, visitor, path17);
|
|
173
173
|
}
|
|
174
174
|
if (typeof ctrl !== "symbol") {
|
|
175
175
|
if (identity.isCollection(node)) {
|
|
176
|
-
|
|
176
|
+
path17 = Object.freeze(path17.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, path17);
|
|
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
|
+
path17 = Object.freeze(path17.concat(node));
|
|
190
|
+
const ck = await visitAsync_("key", node.key, visitor, path17);
|
|
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, path17);
|
|
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, path17) {
|
|
223
223
|
if (typeof visitor === "function")
|
|
224
|
-
return visitor(key, node,
|
|
224
|
+
return visitor(key, node, path17);
|
|
225
225
|
if (identity.isMap(node))
|
|
226
|
-
return visitor.Map?.(key, node,
|
|
226
|
+
return visitor.Map?.(key, node, path17);
|
|
227
227
|
if (identity.isSeq(node))
|
|
228
|
-
return visitor.Seq?.(key, node,
|
|
228
|
+
return visitor.Seq?.(key, node, path17);
|
|
229
229
|
if (identity.isPair(node))
|
|
230
|
-
return visitor.Pair?.(key, node,
|
|
230
|
+
return visitor.Pair?.(key, node, path17);
|
|
231
231
|
if (identity.isScalar(node))
|
|
232
|
-
return visitor.Scalar?.(key, node,
|
|
232
|
+
return visitor.Scalar?.(key, node, path17);
|
|
233
233
|
if (identity.isAlias(node))
|
|
234
|
-
return visitor.Alias?.(key, node,
|
|
234
|
+
return visitor.Alias?.(key, node, path17);
|
|
235
235
|
return void 0;
|
|
236
236
|
}
|
|
237
|
-
function replaceNode(key,
|
|
238
|
-
const parent =
|
|
237
|
+
function replaceNode(key, path17, node) {
|
|
238
|
+
const parent = path17[path17.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, path17, value) {
|
|
849
849
|
let v = value;
|
|
850
|
-
for (let i =
|
|
851
|
-
const k =
|
|
850
|
+
for (let i = path17.length - 1; i >= 0; --i) {
|
|
851
|
+
const k = path17[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 = (path17) => path17 == null || typeof path17 === "object" && !!path17[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(path17, value) {
|
|
901
|
+
if (isEmptyPath(path17))
|
|
902
902
|
this.add(value);
|
|
903
903
|
else {
|
|
904
|
-
const [key, ...rest] =
|
|
904
|
+
const [key, ...rest] = path17;
|
|
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(path17) {
|
|
919
|
+
const [key, ...rest] = path17;
|
|
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(path17, keepScalar) {
|
|
934
|
+
const [key, ...rest] = path17;
|
|
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(path17) {
|
|
953
|
+
const [key, ...rest] = path17;
|
|
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(path17, value) {
|
|
964
|
+
const [key, ...rest] = path17;
|
|
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(path17, value) {
|
|
3480
3480
|
if (assertCollection(this.contents))
|
|
3481
|
-
this.contents.addIn(
|
|
3481
|
+
this.contents.addIn(path17, 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(path17) {
|
|
3557
|
+
if (Collection.isEmptyPath(path17)) {
|
|
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(path17) : 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(path17, keepScalar) {
|
|
3579
|
+
if (Collection.isEmptyPath(path17))
|
|
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(path17, 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(path17) {
|
|
3593
|
+
if (Collection.isEmptyPath(path17))
|
|
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(path17) : 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(path17, value) {
|
|
3613
|
+
if (Collection.isEmptyPath(path17)) {
|
|
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(path17), value);
|
|
3617
3617
|
} else if (assertCollection(this.contents)) {
|
|
3618
|
-
this.contents.setIn(
|
|
3618
|
+
this.contents.setIn(path17, 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, path17) => {
|
|
5579
5579
|
let item = cst;
|
|
5580
|
-
for (const [field, index] of
|
|
5580
|
+
for (const [field, index] of path17) {
|
|
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, path17) => {
|
|
5590
|
+
const parent = visit.itemAtPath(cst, path17.slice(0, -1));
|
|
5591
|
+
const field = path17[path17.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(path17, item, visitor) {
|
|
5598
|
+
let ctrl = visitor(item, path17);
|
|
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(path17.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, path17);
|
|
5617
5617
|
}
|
|
5618
5618
|
}
|
|
5619
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5619
|
+
return typeof ctrl === "function" ? ctrl(item, path17) : 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 fs19 = this.flowScalar(this.type);
|
|
6922
6922
|
if (atNextItem || it.value) {
|
|
6923
|
-
map.items.push({ start, key:
|
|
6923
|
+
map.items.push({ start, key: fs19, sep: [] });
|
|
6924
6924
|
this.onKeyLine = true;
|
|
6925
6925
|
} else if (it.sep) {
|
|
6926
|
-
this.stack.push(
|
|
6926
|
+
this.stack.push(fs19);
|
|
6927
6927
|
} else {
|
|
6928
|
-
Object.assign(it, { key:
|
|
6928
|
+
Object.assign(it, { key: fs19, 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 fs19 = this.flowScalar(this.type);
|
|
7057
7057
|
if (!it || it.value)
|
|
7058
|
-
fc.items.push({ start: [], key:
|
|
7058
|
+
fc.items.push({ start: [], key: fs19, sep: [] });
|
|
7059
7059
|
else if (it.sep)
|
|
7060
|
-
this.stack.push(
|
|
7060
|
+
this.stack.push(fs19);
|
|
7061
7061
|
else
|
|
7062
|
-
Object.assign(it, { key:
|
|
7062
|
+
Object.assign(it, { key: fs19, 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
|
|
7373
|
+
import * as fs18 from "node:fs";
|
|
7374
7374
|
import * as os7 from "node:os";
|
|
7375
|
-
import * as
|
|
7375
|
+
import * as path16 from "node:path";
|
|
7376
7376
|
import process3 from "node:process";
|
|
7377
7377
|
import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
7378
7378
|
|
|
@@ -7872,8 +7872,8 @@ function lockfile_write_path(env) {
|
|
|
7872
7872
|
}
|
|
7873
7873
|
return write_target("installed.lock", { env: env ?? null });
|
|
7874
7874
|
}
|
|
7875
|
-
function read_lockfile(
|
|
7876
|
-
const target =
|
|
7875
|
+
function read_lockfile(path17) {
|
|
7876
|
+
const target = path17 ?? lockfile_path();
|
|
7877
7877
|
let text;
|
|
7878
7878
|
try {
|
|
7879
7879
|
text = fs2.readFileSync(target, { encoding: "utf-8" });
|
|
@@ -8724,14 +8724,113 @@ function splitlines2(text) {
|
|
|
8724
8724
|
return parts;
|
|
8725
8725
|
}
|
|
8726
8726
|
|
|
8727
|
+
// src/scripts/_lib/rule_layer_overlap.ts
|
|
8728
|
+
import * as fs6 from "node:fs";
|
|
8729
|
+
import * as path6 from "node:path";
|
|
8730
|
+
var INSTALLER_PROVENANCE_KEYS = ["package", "source_path"];
|
|
8731
|
+
function stripProvenance(text) {
|
|
8732
|
+
const lines = text.split("\n");
|
|
8733
|
+
if (lines[0]?.trim() !== "---") return text;
|
|
8734
|
+
let close = -1;
|
|
8735
|
+
for (let i = 1; i < lines.length; i++) {
|
|
8736
|
+
if (lines[i]?.trim() === "---") {
|
|
8737
|
+
close = i;
|
|
8738
|
+
break;
|
|
8739
|
+
}
|
|
8740
|
+
}
|
|
8741
|
+
if (close === -1) return text;
|
|
8742
|
+
const kept = [];
|
|
8743
|
+
for (let i = 0; i < lines.length; i++) {
|
|
8744
|
+
if (i > 0 && i < close) {
|
|
8745
|
+
const key = /^([A-Za-z_][A-Za-z0-9_-]*):/.exec(lines[i] ?? "")?.[1];
|
|
8746
|
+
if (key !== void 0 && INSTALLER_PROVENANCE_KEYS.includes(key)) continue;
|
|
8747
|
+
}
|
|
8748
|
+
kept.push(lines[i] ?? "");
|
|
8749
|
+
}
|
|
8750
|
+
return kept.join("\n");
|
|
8751
|
+
}
|
|
8752
|
+
function only_in(a, b) {
|
|
8753
|
+
return [...a.keys()].filter((k) => !b.has(k)).sort();
|
|
8754
|
+
}
|
|
8755
|
+
function compareLayers(global_layer, project_layer) {
|
|
8756
|
+
const overlap = [...global_layer.keys()].filter((k) => project_layer.has(k)).sort();
|
|
8757
|
+
const duplicate = [];
|
|
8758
|
+
const divergent = [];
|
|
8759
|
+
let redundant_chars = 0;
|
|
8760
|
+
for (const name of overlap) {
|
|
8761
|
+
const g = stripProvenance(global_layer.get(name) ?? "");
|
|
8762
|
+
const p = stripProvenance(project_layer.get(name) ?? "");
|
|
8763
|
+
if (g === p) {
|
|
8764
|
+
duplicate.push(name);
|
|
8765
|
+
redundant_chars += (project_layer.get(name) ?? "").length;
|
|
8766
|
+
} else {
|
|
8767
|
+
divergent.push(name);
|
|
8768
|
+
}
|
|
8769
|
+
}
|
|
8770
|
+
return {
|
|
8771
|
+
schema_version: 1,
|
|
8772
|
+
overlap,
|
|
8773
|
+
duplicate,
|
|
8774
|
+
divergent,
|
|
8775
|
+
global_only: only_in(global_layer, project_layer),
|
|
8776
|
+
project_only: only_in(project_layer, global_layer),
|
|
8777
|
+
redundant_chars
|
|
8778
|
+
};
|
|
8779
|
+
}
|
|
8780
|
+
function readRuleLayer(dir) {
|
|
8781
|
+
let names;
|
|
8782
|
+
try {
|
|
8783
|
+
names = fs6.readdirSync(dir);
|
|
8784
|
+
} catch {
|
|
8785
|
+
return null;
|
|
8786
|
+
}
|
|
8787
|
+
const files = /* @__PURE__ */ new Map();
|
|
8788
|
+
for (const name of names.filter((n) => n.endsWith(".md")).sort()) {
|
|
8789
|
+
try {
|
|
8790
|
+
files.set(name, fs6.readFileSync(path6.join(dir, name), "utf-8"));
|
|
8791
|
+
} catch {
|
|
8792
|
+
continue;
|
|
8793
|
+
}
|
|
8794
|
+
}
|
|
8795
|
+
return { dir, files };
|
|
8796
|
+
}
|
|
8797
|
+
function claudeMdExcludesGlob(dir) {
|
|
8798
|
+
return `${path6.resolve(dir).replace(/\/+$/, "")}/**`;
|
|
8799
|
+
}
|
|
8800
|
+
function mergeClaudeMdExcludes(existing, entry) {
|
|
8801
|
+
if (!Array.isArray(existing)) return [entry];
|
|
8802
|
+
if (existing.includes(entry)) return [...existing];
|
|
8803
|
+
return [...existing, entry];
|
|
8804
|
+
}
|
|
8805
|
+
function decideLayerAction(report, choice, global_dir, project_dir) {
|
|
8806
|
+
const refresh_required = report.divergent.length > 0;
|
|
8807
|
+
const skew = refresh_required ? ` ${report.divergent.length} shared rule(s) differ in body \u2014 refresh before suppressing, or obligations only the suppressed copy carries are lost.` : "";
|
|
8808
|
+
if (choice === "both-acknowledged") {
|
|
8809
|
+
return {
|
|
8810
|
+
write: "both",
|
|
8811
|
+
suppress_dir: null,
|
|
8812
|
+
refresh_required,
|
|
8813
|
+
note: `Keeping both rule layers by request: ${report.overlap.length} shared rule(s), ${report.redundant_chars} chars delivered twice per session. Nothing suppressed, nothing deleted.${skew}`
|
|
8814
|
+
};
|
|
8815
|
+
}
|
|
8816
|
+
const keep = choice === "global" ? global_dir : project_dir;
|
|
8817
|
+
const drop = choice === "global" ? project_dir : global_dir;
|
|
8818
|
+
return {
|
|
8819
|
+
write: choice,
|
|
8820
|
+
suppress_dir: drop,
|
|
8821
|
+
refresh_required,
|
|
8822
|
+
note: `Keeping ${choice} rule layer (${keep}); suppressing ${drop} via claudeMdExcludes \u2014 recovers ${report.redundant_chars} chars per session. No file is deleted or rewritten.${skew}`
|
|
8823
|
+
};
|
|
8824
|
+
}
|
|
8825
|
+
|
|
8727
8826
|
// src/scripts/_lib/installed_tools.ts
|
|
8728
|
-
import * as
|
|
8827
|
+
import * as fs8 from "node:fs";
|
|
8729
8828
|
import * as os4 from "node:os";
|
|
8730
8829
|
import * as fsPath from "node:path";
|
|
8731
8830
|
|
|
8732
8831
|
// src/scripts/_lib/fs_atomic.ts
|
|
8733
|
-
import
|
|
8734
|
-
import
|
|
8832
|
+
import fs7 from "node:fs";
|
|
8833
|
+
import path7 from "node:path";
|
|
8735
8834
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
8736
8835
|
function _normalize_encoding(encoding) {
|
|
8737
8836
|
const compact = encoding.toLowerCase().replace(/[-_\s]/g, "");
|
|
@@ -8747,9 +8846,9 @@ function _normalize_encoding(encoding) {
|
|
|
8747
8846
|
}
|
|
8748
8847
|
function write_atomic(p, data, options = {}) {
|
|
8749
8848
|
const encoding = options.encoding ?? "utf-8";
|
|
8750
|
-
const target =
|
|
8751
|
-
const parent =
|
|
8752
|
-
|
|
8849
|
+
const target = path7.normalize(p);
|
|
8850
|
+
const parent = path7.dirname(target);
|
|
8851
|
+
fs7.mkdirSync(parent, { recursive: true });
|
|
8753
8852
|
let payload;
|
|
8754
8853
|
if (typeof data === "string") {
|
|
8755
8854
|
payload = Buffer.from(data, _normalize_encoding(encoding));
|
|
@@ -8763,12 +8862,12 @@ function write_atomic(p, data, options = {}) {
|
|
|
8763
8862
|
let fd = null;
|
|
8764
8863
|
let tmp_path = "";
|
|
8765
8864
|
for (let attempt = 0; attempt < 32; attempt += 1) {
|
|
8766
|
-
tmp_path =
|
|
8865
|
+
tmp_path = path7.join(
|
|
8767
8866
|
parent,
|
|
8768
|
-
`.${
|
|
8867
|
+
`.${path7.basename(target)}.tmp.${randomBytes3(6).toString("hex")}`
|
|
8769
8868
|
);
|
|
8770
8869
|
try {
|
|
8771
|
-
fd =
|
|
8870
|
+
fd = fs7.openSync(tmp_path, "wx", 384);
|
|
8772
8871
|
break;
|
|
8773
8872
|
} catch (err) {
|
|
8774
8873
|
if (err.code === "EEXIST") continue;
|
|
@@ -8782,24 +8881,24 @@ function write_atomic(p, data, options = {}) {
|
|
|
8782
8881
|
try {
|
|
8783
8882
|
let offset = 0;
|
|
8784
8883
|
while (offset < payload.length) {
|
|
8785
|
-
offset +=
|
|
8884
|
+
offset += fs7.writeSync(fd, payload, offset, payload.length - offset);
|
|
8786
8885
|
}
|
|
8787
8886
|
try {
|
|
8788
|
-
|
|
8887
|
+
fs7.fsyncSync(fd);
|
|
8789
8888
|
} catch {
|
|
8790
8889
|
}
|
|
8791
|
-
|
|
8890
|
+
fs7.closeSync(fd);
|
|
8792
8891
|
closed = true;
|
|
8793
|
-
|
|
8892
|
+
fs7.renameSync(tmp_path, target);
|
|
8794
8893
|
} catch (err) {
|
|
8795
8894
|
if (!closed) {
|
|
8796
8895
|
try {
|
|
8797
|
-
|
|
8896
|
+
fs7.closeSync(fd);
|
|
8798
8897
|
} catch {
|
|
8799
8898
|
}
|
|
8800
8899
|
}
|
|
8801
8900
|
try {
|
|
8802
|
-
|
|
8901
|
+
fs7.unlinkSync(tmp_path);
|
|
8803
8902
|
} catch {
|
|
8804
8903
|
}
|
|
8805
8904
|
throw err;
|
|
@@ -8810,17 +8909,17 @@ function write_atomic(p, data, options = {}) {
|
|
|
8810
8909
|
function _fsync_dir(directory) {
|
|
8811
8910
|
let dir_fd;
|
|
8812
8911
|
try {
|
|
8813
|
-
dir_fd =
|
|
8912
|
+
dir_fd = fs7.openSync(directory, fs7.constants.O_RDONLY);
|
|
8814
8913
|
} catch {
|
|
8815
8914
|
return;
|
|
8816
8915
|
}
|
|
8817
8916
|
try {
|
|
8818
8917
|
try {
|
|
8819
|
-
|
|
8918
|
+
fs7.fsyncSync(dir_fd);
|
|
8820
8919
|
} catch {
|
|
8821
8920
|
}
|
|
8822
8921
|
} finally {
|
|
8823
|
-
|
|
8922
|
+
fs7.closeSync(dir_fd);
|
|
8824
8923
|
}
|
|
8825
8924
|
}
|
|
8826
8925
|
|
|
@@ -8849,18 +8948,18 @@ function manifest_path(project_root, env) {
|
|
|
8849
8948
|
var _TOP_KEY_RE = /^([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
|
|
8850
8949
|
var _LIST_DASH_RE = /^\s*-\s*(.+?)\s*$/;
|
|
8851
8950
|
var _INDENT_KEY_RE = /^\s+([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
|
|
8852
|
-
function read_manifest(
|
|
8951
|
+
function read_manifest(path17) {
|
|
8853
8952
|
let text;
|
|
8854
8953
|
try {
|
|
8855
|
-
text = require_read_text(
|
|
8954
|
+
text = require_read_text(path17);
|
|
8856
8955
|
} catch {
|
|
8857
8956
|
return null;
|
|
8858
8957
|
}
|
|
8859
8958
|
const data = _parse_manual(text);
|
|
8860
8959
|
return _normalise_v2_shape(data);
|
|
8861
8960
|
}
|
|
8862
|
-
function require_read_text(
|
|
8863
|
-
return
|
|
8961
|
+
function require_read_text(path17) {
|
|
8962
|
+
return fs8.readFileSync(path17, { encoding: "utf-8" });
|
|
8864
8963
|
}
|
|
8865
8964
|
function _normalise_v2_shape(data) {
|
|
8866
8965
|
if (data["tools"] === void 0 || data["tools"] === null) {
|
|
@@ -9041,9 +9140,9 @@ function stable_sort(items, key) {
|
|
|
9041
9140
|
return a.index - b.index;
|
|
9042
9141
|
}).map((entry) => entry.item);
|
|
9043
9142
|
}
|
|
9044
|
-
function write_manifest(
|
|
9143
|
+
function write_manifest(path17, version, tools, options = {}) {
|
|
9045
9144
|
const rendered = _render2(version, tools, { deploy_roots: options.deploy_roots ?? null });
|
|
9046
|
-
return write_atomic(
|
|
9145
|
+
return write_atomic(path17, rendered);
|
|
9047
9146
|
}
|
|
9048
9147
|
var ScopeMismatchError = class extends Error {
|
|
9049
9148
|
name_;
|
|
@@ -9134,25 +9233,25 @@ function _today() {
|
|
|
9134
9233
|
// src/scripts/_lib/install_drift.ts
|
|
9135
9234
|
var import_yaml = __toESM(require_dist(), 1);
|
|
9136
9235
|
import * as crypto from "node:crypto";
|
|
9137
|
-
import * as
|
|
9236
|
+
import * as fs9 from "node:fs";
|
|
9138
9237
|
import * as os5 from "node:os";
|
|
9139
|
-
import * as
|
|
9238
|
+
import * as path8 from "node:path";
|
|
9140
9239
|
function expanduser5(p) {
|
|
9141
9240
|
if (p === "~") {
|
|
9142
9241
|
return os5.homedir();
|
|
9143
9242
|
}
|
|
9144
9243
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
9145
|
-
return
|
|
9244
|
+
return path8.join(os5.homedir(), p.slice(2));
|
|
9146
9245
|
}
|
|
9147
9246
|
return p;
|
|
9148
9247
|
}
|
|
9149
9248
|
function resolve_entry_path(project_root, raw) {
|
|
9150
9249
|
const p = expanduser5(raw);
|
|
9151
|
-
return
|
|
9250
|
+
return path8.isAbsolute(p) ? p : path8.join(project_root, p);
|
|
9152
9251
|
}
|
|
9153
9252
|
function sha256_of_file(p) {
|
|
9154
9253
|
try {
|
|
9155
|
-
return crypto.createHash("sha256").update(
|
|
9254
|
+
return crypto.createHash("sha256").update(fs9.readFileSync(p)).digest("hex");
|
|
9156
9255
|
} catch {
|
|
9157
9256
|
return null;
|
|
9158
9257
|
}
|
|
@@ -9161,7 +9260,7 @@ function collect_drift(project_root, env) {
|
|
|
9161
9260
|
const target = manifest_path(project_root, env);
|
|
9162
9261
|
let text;
|
|
9163
9262
|
try {
|
|
9164
|
-
text =
|
|
9263
|
+
text = fs9.readFileSync(target, "utf-8");
|
|
9165
9264
|
} catch {
|
|
9166
9265
|
return null;
|
|
9167
9266
|
}
|
|
@@ -9206,7 +9305,7 @@ function collect_drift(project_root, env) {
|
|
|
9206
9305
|
continue;
|
|
9207
9306
|
}
|
|
9208
9307
|
const resolved = resolve_entry_path(project_root, raw_path);
|
|
9209
|
-
if (!
|
|
9308
|
+
if (!fs9.existsSync(resolved)) {
|
|
9210
9309
|
out.push({
|
|
9211
9310
|
tool_id,
|
|
9212
9311
|
path: resolved,
|
|
@@ -9260,8 +9359,8 @@ function format_drift_report(entries) {
|
|
|
9260
9359
|
|
|
9261
9360
|
// src/scripts/_lib/claude_desktop_bundler.ts
|
|
9262
9361
|
import * as crypto2 from "node:crypto";
|
|
9263
|
-
import * as
|
|
9264
|
-
import * as
|
|
9362
|
+
import * as fs10 from "node:fs";
|
|
9363
|
+
import * as path9 from "node:path";
|
|
9265
9364
|
|
|
9266
9365
|
// src/scripts/_lib/zip_min.ts
|
|
9267
9366
|
import * as zlib from "node:zlib";
|
|
@@ -9368,7 +9467,7 @@ function _is_excluded(rel_parts) {
|
|
|
9368
9467
|
}
|
|
9369
9468
|
function _is_dir(p) {
|
|
9370
9469
|
try {
|
|
9371
|
-
return
|
|
9470
|
+
return fs10.statSync(p).isDirectory();
|
|
9372
9471
|
} catch {
|
|
9373
9472
|
return false;
|
|
9374
9473
|
}
|
|
@@ -9380,12 +9479,12 @@ function _compare_rel_parts(a, b) {
|
|
|
9380
9479
|
}
|
|
9381
9480
|
function _walk_skill_files(skill_dir) {
|
|
9382
9481
|
const out = [];
|
|
9383
|
-
const resolved =
|
|
9482
|
+
const resolved = fs10.realpathSync(skill_dir);
|
|
9384
9483
|
const walk = (root, relRoot) => {
|
|
9385
9484
|
const dirNames = [];
|
|
9386
9485
|
const fileNames = [];
|
|
9387
|
-
for (const dirent of
|
|
9388
|
-
const full =
|
|
9486
|
+
for (const dirent of fs10.readdirSync(root, { withFileTypes: true })) {
|
|
9487
|
+
const full = path9.join(root, dirent.name);
|
|
9389
9488
|
const isDir2 = dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full);
|
|
9390
9489
|
if (isDir2) {
|
|
9391
9490
|
dirNames.push(dirent.name);
|
|
@@ -9398,13 +9497,13 @@ function _walk_skill_files(skill_dir) {
|
|
|
9398
9497
|
if (_is_excluded(rel_parts)) {
|
|
9399
9498
|
continue;
|
|
9400
9499
|
}
|
|
9401
|
-
out.push([
|
|
9500
|
+
out.push([path9.join(root, fname), rel_parts]);
|
|
9402
9501
|
}
|
|
9403
9502
|
for (const dname of dirNames) {
|
|
9404
9503
|
if (_is_excluded([dname])) {
|
|
9405
9504
|
continue;
|
|
9406
9505
|
}
|
|
9407
|
-
walk(
|
|
9506
|
+
walk(path9.join(root, dname), [...relRoot, dname]);
|
|
9408
9507
|
}
|
|
9409
9508
|
};
|
|
9410
9509
|
walk(resolved, []);
|
|
@@ -9417,53 +9516,53 @@ function _manifest_digest(files) {
|
|
|
9417
9516
|
const rel = rel_parts.join("/");
|
|
9418
9517
|
h.update(Buffer.from(rel, "utf-8"));
|
|
9419
9518
|
h.update(Buffer.from([0]));
|
|
9420
|
-
h.update(crypto2.createHash("sha256").update(
|
|
9519
|
+
h.update(crypto2.createHash("sha256").update(fs10.readFileSync(abs_path)).digest());
|
|
9421
9520
|
h.update(Buffer.from([0]));
|
|
9422
9521
|
}
|
|
9423
9522
|
return h.digest("hex");
|
|
9424
9523
|
}
|
|
9425
9524
|
function _atomic_write_zip(zip_path, files) {
|
|
9426
|
-
|
|
9427
|
-
const stem =
|
|
9428
|
-
const tmp_path =
|
|
9429
|
-
|
|
9525
|
+
fs10.mkdirSync(path9.dirname(zip_path), { recursive: true });
|
|
9526
|
+
const stem = path9.basename(zip_path, path9.extname(zip_path));
|
|
9527
|
+
const tmp_path = path9.join(
|
|
9528
|
+
path9.dirname(zip_path),
|
|
9430
9529
|
`.${stem}.${crypto2.randomBytes(6).toString("hex")}.zip.tmp`
|
|
9431
9530
|
);
|
|
9432
9531
|
try {
|
|
9433
9532
|
const entries = files.map(([abs_path, rel_parts]) => ({
|
|
9434
9533
|
name: rel_parts.join("/"),
|
|
9435
|
-
data:
|
|
9534
|
+
data: fs10.readFileSync(abs_path)
|
|
9436
9535
|
}));
|
|
9437
|
-
|
|
9438
|
-
|
|
9536
|
+
fs10.writeFileSync(tmp_path, zip_write_sync(entries));
|
|
9537
|
+
fs10.renameSync(tmp_path, zip_path);
|
|
9439
9538
|
} finally {
|
|
9440
|
-
if (
|
|
9441
|
-
|
|
9539
|
+
if (fs10.existsSync(tmp_path)) {
|
|
9540
|
+
fs10.unlinkSync(tmp_path);
|
|
9442
9541
|
}
|
|
9443
9542
|
}
|
|
9444
9543
|
}
|
|
9445
9544
|
function _write_if_changed(dest_dir, slug, files, force, written) {
|
|
9446
9545
|
const digest = _manifest_digest(files);
|
|
9447
|
-
const zip_path =
|
|
9448
|
-
const digest_path =
|
|
9449
|
-
const recorded =
|
|
9450
|
-
if (!force && recorded === digest &&
|
|
9546
|
+
const zip_path = path9.join(dest_dir, `${slug}.zip`);
|
|
9547
|
+
const digest_path = path9.join(dest_dir, `${slug}.sha256`);
|
|
9548
|
+
const recorded = fs10.existsSync(digest_path) ? fs10.readFileSync(digest_path, "utf-8").trim() : "";
|
|
9549
|
+
if (!force && recorded === digest && fs10.existsSync(zip_path)) {
|
|
9451
9550
|
return;
|
|
9452
9551
|
}
|
|
9453
9552
|
_atomic_write_zip(zip_path, files);
|
|
9454
|
-
|
|
9553
|
+
fs10.writeFileSync(digest_path, digest + "\n", "utf-8");
|
|
9455
9554
|
written.push(zip_path);
|
|
9456
9555
|
}
|
|
9457
9556
|
function build_skill_bundles(package_root, dest_dir, force = false, curation = null) {
|
|
9458
|
-
const skills_root =
|
|
9557
|
+
const skills_root = path9.join(package_root, "dist/agent-src", "skills");
|
|
9459
9558
|
if (!_is_dir(skills_root)) {
|
|
9460
9559
|
return [];
|
|
9461
9560
|
}
|
|
9462
|
-
|
|
9561
|
+
fs10.mkdirSync(dest_dir, { recursive: true });
|
|
9463
9562
|
const written = [];
|
|
9464
|
-
for (const name of
|
|
9465
|
-
const entry =
|
|
9466
|
-
const isSymlink2 =
|
|
9563
|
+
for (const name of fs10.readdirSync(skills_root).sort()) {
|
|
9564
|
+
const entry = path9.join(skills_root, name);
|
|
9565
|
+
const isSymlink2 = fs10.lstatSync(entry).isSymbolicLink();
|
|
9467
9566
|
if (!(_is_dir(entry) || isSymlink2)) {
|
|
9468
9567
|
continue;
|
|
9469
9568
|
}
|
|
@@ -9471,8 +9570,8 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
|
|
|
9471
9570
|
if (curation !== null && !curation.includes(skill_name)) {
|
|
9472
9571
|
continue;
|
|
9473
9572
|
}
|
|
9474
|
-
const skill_md =
|
|
9475
|
-
if (!
|
|
9573
|
+
const skill_md = path9.join(entry, "SKILL.md");
|
|
9574
|
+
if (!fs10.existsSync(skill_md)) {
|
|
9476
9575
|
continue;
|
|
9477
9576
|
}
|
|
9478
9577
|
const files = _walk_skill_files(entry);
|
|
@@ -9484,15 +9583,15 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
|
|
|
9484
9583
|
return written;
|
|
9485
9584
|
}
|
|
9486
9585
|
function _command_slug(source_file, commands_root) {
|
|
9487
|
-
const rel =
|
|
9488
|
-
const noExt = rel.slice(0, rel.length -
|
|
9489
|
-
return noExt.split(
|
|
9586
|
+
const rel = path9.relative(commands_root, source_file);
|
|
9587
|
+
const noExt = rel.slice(0, rel.length - path9.extname(rel).length);
|
|
9588
|
+
return noExt.split(path9.sep).join("-");
|
|
9490
9589
|
}
|
|
9491
9590
|
function _iter_command_files(commands_root) {
|
|
9492
9591
|
const found = [];
|
|
9493
9592
|
const walk = (dir) => {
|
|
9494
|
-
for (const dirent of
|
|
9495
|
-
const full =
|
|
9593
|
+
for (const dirent of fs10.readdirSync(dir, { withFileTypes: true })) {
|
|
9594
|
+
const full = path9.join(dir, dirent.name);
|
|
9496
9595
|
if (dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full)) {
|
|
9497
9596
|
walk(full);
|
|
9498
9597
|
} else if (dirent.name.endsWith(".md")) {
|
|
@@ -9502,21 +9601,21 @@ function _iter_command_files(commands_root) {
|
|
|
9502
9601
|
};
|
|
9503
9602
|
walk(commands_root);
|
|
9504
9603
|
found.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
9505
|
-
return found.filter((source_file) =>
|
|
9604
|
+
return found.filter((source_file) => path9.basename(source_file) !== "AGENTS.md");
|
|
9506
9605
|
}
|
|
9507
9606
|
function build_command_bundles(package_root, dest_dir, force = false, curation = null) {
|
|
9508
|
-
const commands_root =
|
|
9607
|
+
const commands_root = path9.join(package_root, "dist/agent-src", "commands");
|
|
9509
9608
|
if (!_is_dir(commands_root)) {
|
|
9510
9609
|
return [];
|
|
9511
9610
|
}
|
|
9512
|
-
const skills_root =
|
|
9611
|
+
const skills_root = path9.join(package_root, "dist/agent-src", "skills");
|
|
9513
9612
|
let skill_names = /* @__PURE__ */ new Set();
|
|
9514
9613
|
if (_is_dir(skills_root)) {
|
|
9515
9614
|
skill_names = new Set(
|
|
9516
|
-
|
|
9615
|
+
fs10.readdirSync(skills_root).filter((name) => _is_dir(path9.join(skills_root, name)))
|
|
9517
9616
|
);
|
|
9518
9617
|
}
|
|
9519
|
-
|
|
9618
|
+
fs10.mkdirSync(dest_dir, { recursive: true });
|
|
9520
9619
|
const written = [];
|
|
9521
9620
|
for (const source_file of _iter_command_files(commands_root)) {
|
|
9522
9621
|
const slug = _command_slug(source_file, commands_root);
|
|
@@ -9526,7 +9625,7 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
|
|
|
9526
9625
|
if (curation !== null && !curation.includes(slug)) {
|
|
9527
9626
|
continue;
|
|
9528
9627
|
}
|
|
9529
|
-
const files = [[
|
|
9628
|
+
const files = [[fs10.realpathSync(source_file), ["SKILL.md"]]];
|
|
9530
9629
|
_write_if_changed(dest_dir, slug, files, force, written);
|
|
9531
9630
|
}
|
|
9532
9631
|
return written;
|
|
@@ -9534,8 +9633,8 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
|
|
|
9534
9633
|
|
|
9535
9634
|
// src/scripts/_lib/claude_settings_hooks.ts
|
|
9536
9635
|
var YAML = __toESM(require_dist(), 1);
|
|
9537
|
-
import * as
|
|
9538
|
-
import * as
|
|
9636
|
+
import * as fs11 from "node:fs";
|
|
9637
|
+
import * as path10 from "node:path";
|
|
9539
9638
|
|
|
9540
9639
|
// src/install/atomic.ts
|
|
9541
9640
|
import {
|
|
@@ -9543,17 +9642,17 @@ import {
|
|
|
9543
9642
|
fsyncSync,
|
|
9544
9643
|
mkdirSync as mkdirSync5,
|
|
9545
9644
|
openSync as openSync3,
|
|
9546
|
-
readFileSync as
|
|
9645
|
+
readFileSync as readFileSync9,
|
|
9547
9646
|
renameSync as renameSync5,
|
|
9548
9647
|
unlinkSync as unlinkSync4,
|
|
9549
9648
|
writeSync
|
|
9550
9649
|
} from "node:fs";
|
|
9551
|
-
import { dirname as dirname4, join as
|
|
9650
|
+
import { dirname as dirname4, join as join10 } from "node:path";
|
|
9552
9651
|
function atomicWriteFile(target, data, options = {}) {
|
|
9553
9652
|
const mode = options.mode ?? 420;
|
|
9554
9653
|
const parent = dirname4(target);
|
|
9555
9654
|
mkdirSync5(parent, { recursive: true });
|
|
9556
|
-
const tmp =
|
|
9655
|
+
const tmp = join10(parent, `.tmp.${process.pid}.${randSuffix()}`);
|
|
9557
9656
|
let fd = null;
|
|
9558
9657
|
try {
|
|
9559
9658
|
fd = openSync3(tmp, "w", mode);
|
|
@@ -9603,7 +9702,7 @@ var SettingsLockError = class extends Error {
|
|
|
9603
9702
|
}
|
|
9604
9703
|
};
|
|
9605
9704
|
function build_claude_hook_matrix(manifest_path2) {
|
|
9606
|
-
const raw =
|
|
9705
|
+
const raw = fs11.readFileSync(manifest_path2, "utf8");
|
|
9607
9706
|
const manifest = _yaml_parse(raw) ?? {};
|
|
9608
9707
|
const hook_spec = manifest["schema_version"] ?? 1;
|
|
9609
9708
|
const platforms = manifest["platforms"] ?? {};
|
|
@@ -9633,8 +9732,8 @@ function _is_managed_group(group) {
|
|
|
9633
9732
|
);
|
|
9634
9733
|
}
|
|
9635
9734
|
function _read_settings(settings_path) {
|
|
9636
|
-
if (!
|
|
9637
|
-
const raw =
|
|
9735
|
+
if (!fs11.existsSync(settings_path)) return {};
|
|
9736
|
+
const raw = fs11.readFileSync(settings_path, "utf8");
|
|
9638
9737
|
if (raw.trim() === "") return {};
|
|
9639
9738
|
let parsed;
|
|
9640
9739
|
try {
|
|
@@ -9649,18 +9748,18 @@ function _read_settings(settings_path) {
|
|
|
9649
9748
|
}
|
|
9650
9749
|
function _with_lock(settings_path, fn) {
|
|
9651
9750
|
const lockPath = settings_path + ".agent-config.lock";
|
|
9652
|
-
|
|
9751
|
+
fs11.mkdirSync(path10.dirname(lockPath), { recursive: true });
|
|
9653
9752
|
let fd;
|
|
9654
9753
|
try {
|
|
9655
|
-
fd =
|
|
9754
|
+
fd = fs11.openSync(lockPath, "wx");
|
|
9656
9755
|
} catch {
|
|
9657
9756
|
throw new SettingsLockError(lockPath);
|
|
9658
9757
|
}
|
|
9659
9758
|
try {
|
|
9660
9759
|
return fn();
|
|
9661
9760
|
} finally {
|
|
9662
|
-
|
|
9663
|
-
|
|
9761
|
+
fs11.closeSync(fd);
|
|
9762
|
+
fs11.rmSync(lockPath, { force: true });
|
|
9664
9763
|
}
|
|
9665
9764
|
}
|
|
9666
9765
|
function ensure_managed_hooks(settings_path, matrix) {
|
|
@@ -9691,9 +9790,9 @@ function ensure_managed_hooks(settings_path, matrix) {
|
|
|
9691
9790
|
|
|
9692
9791
|
// src/scripts/_lib/agent_settings.ts
|
|
9693
9792
|
import { createRequire as createRequire2 } from "node:module";
|
|
9694
|
-
import * as
|
|
9793
|
+
import * as fs12 from "node:fs";
|
|
9695
9794
|
import * as os6 from "node:os";
|
|
9696
|
-
import * as
|
|
9795
|
+
import * as path11 from "node:path";
|
|
9697
9796
|
var _require2 = createRequire2(import.meta.url);
|
|
9698
9797
|
var Logger = class {
|
|
9699
9798
|
name = "scripts._lib.agent_settings";
|
|
@@ -9733,28 +9832,51 @@ var DEFAULT_PROJECT_FILE = ".agent-settings.yml";
|
|
|
9733
9832
|
var LOCAL_PROJECT_FILE = ".agent-settings.local.yml";
|
|
9734
9833
|
var LOCAL_PROJECT_SUBDIR = ["agents", "settings"];
|
|
9735
9834
|
function _local_settings_path(project_root) {
|
|
9736
|
-
return
|
|
9835
|
+
return path11.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
|
|
9737
9836
|
}
|
|
9738
9837
|
function _canonical_settings_path(project_root) {
|
|
9739
|
-
return
|
|
9838
|
+
return path11.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
|
|
9740
9839
|
}
|
|
9741
9840
|
var USER_GLOBAL_FILENAME = "agent-settings.yml";
|
|
9742
9841
|
function DEFAULT_USER_GLOBAL_FILE() {
|
|
9743
9842
|
return write_target(USER_GLOBAL_FILENAME);
|
|
9744
9843
|
}
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
|
|
9844
|
+
var USER_GLOBAL_CANONICAL_RELATIVE = "settings/.agent-settings.yml";
|
|
9845
|
+
function user_global_settings_paths() {
|
|
9846
|
+
const paths = [];
|
|
9847
|
+
const flat = resolve_with_fallback(USER_GLOBAL_FILENAME);
|
|
9848
|
+
if (flat !== null) {
|
|
9849
|
+
paths.push(flat);
|
|
9850
|
+
}
|
|
9851
|
+
const canonical = resolve_with_fallback(USER_GLOBAL_CANONICAL_RELATIVE);
|
|
9852
|
+
if (canonical !== null) {
|
|
9853
|
+
paths.push(canonical);
|
|
9854
|
+
}
|
|
9855
|
+
if (paths.length === 0) {
|
|
9856
|
+
paths.push(DEFAULT_USER_GLOBAL_FILE());
|
|
9749
9857
|
}
|
|
9750
|
-
return
|
|
9858
|
+
return paths;
|
|
9751
9859
|
}
|
|
9752
9860
|
var MERGEABLE_KEYS = [
|
|
9861
|
+
// `name`, `ide` and `personal.bot_icon` are the PRE-MIGRATION spellings.
|
|
9862
|
+
// `install.ts` migrates `ide` → `personal.ide` and `pr_comment_bot_icon`
|
|
9863
|
+
// into its `personal.` home, and this list was never moved with them — so
|
|
9864
|
+
// the whitelist named keys the template does not have while the keys it
|
|
9865
|
+
// does have were filtered out silently. A user setting either preference
|
|
9866
|
+
// user-globally got no error, no warning, and no effect
|
|
9867
|
+
// (road-to-capability-answerability 4.3, ADR-219).
|
|
9868
|
+
//
|
|
9869
|
+
// Both spellings are listed rather than replaced: a legacy file that still
|
|
9870
|
+
// uses the old name keeps working, and nothing that resolved before
|
|
9871
|
+
// resolves differently. `name` has no reader anywhere and no template key;
|
|
9872
|
+
// it is kept only so this change stays purely additive.
|
|
9753
9873
|
"name",
|
|
9754
9874
|
"ide",
|
|
9875
|
+
"personal.ide",
|
|
9755
9876
|
"rule_loading_tier",
|
|
9756
9877
|
"memory.cadence",
|
|
9757
9878
|
"personal.bot_icon",
|
|
9879
|
+
"personal.pr_comment_bot_icon",
|
|
9758
9880
|
"personal.autonomy",
|
|
9759
9881
|
"telegraph.speak_scope",
|
|
9760
9882
|
// Knowledge-card global cross-project sharing is a USER-GLOBAL setting
|
|
@@ -9784,8 +9906,8 @@ var _AGENTS_DIR_MARKERS = [
|
|
|
9784
9906
|
var _LEGACY_ANCHOR_ENV = "AGENT_CONFIG_LEGACY_ANCHOR";
|
|
9785
9907
|
function _exists(p) {
|
|
9786
9908
|
try {
|
|
9787
|
-
|
|
9788
|
-
|
|
9909
|
+
fs12.lstatSync(p);
|
|
9910
|
+
fs12.statSync(p);
|
|
9789
9911
|
return true;
|
|
9790
9912
|
} catch {
|
|
9791
9913
|
return false;
|
|
@@ -9793,22 +9915,22 @@ function _exists(p) {
|
|
|
9793
9915
|
}
|
|
9794
9916
|
function _is_dir2(p) {
|
|
9795
9917
|
try {
|
|
9796
|
-
return
|
|
9918
|
+
return fs12.statSync(p).isDirectory();
|
|
9797
9919
|
} catch {
|
|
9798
9920
|
return false;
|
|
9799
9921
|
}
|
|
9800
9922
|
}
|
|
9801
9923
|
function _is_file(p) {
|
|
9802
9924
|
try {
|
|
9803
|
-
return
|
|
9925
|
+
return fs12.statSync(p).isFile();
|
|
9804
9926
|
} catch {
|
|
9805
9927
|
return false;
|
|
9806
9928
|
}
|
|
9807
9929
|
}
|
|
9808
9930
|
function _resolve(p) {
|
|
9809
|
-
const absolute =
|
|
9931
|
+
const absolute = path11.resolve(p);
|
|
9810
9932
|
try {
|
|
9811
|
-
return
|
|
9933
|
+
return fs12.realpathSync(absolute);
|
|
9812
9934
|
} catch {
|
|
9813
9935
|
return absolute;
|
|
9814
9936
|
}
|
|
@@ -9818,7 +9940,7 @@ function _ancestor_chain(start) {
|
|
|
9818
9940
|
let cursor = start;
|
|
9819
9941
|
for (; ; ) {
|
|
9820
9942
|
chain.push(cursor);
|
|
9821
|
-
const parent =
|
|
9943
|
+
const parent = path11.dirname(cursor);
|
|
9822
9944
|
if (parent === cursor) {
|
|
9823
9945
|
break;
|
|
9824
9946
|
}
|
|
@@ -9827,15 +9949,15 @@ function _ancestor_chain(start) {
|
|
|
9827
9949
|
return chain;
|
|
9828
9950
|
}
|
|
9829
9951
|
function _boundary_anchor_at(dir) {
|
|
9830
|
-
const agents_dir =
|
|
9952
|
+
const agents_dir = path11.join(dir, "agents");
|
|
9831
9953
|
if (_is_dir2(agents_dir)) {
|
|
9832
9954
|
for (const marker of _AGENTS_DIR_MARKERS) {
|
|
9833
|
-
if (_exists(
|
|
9955
|
+
if (_exists(path11.join(agents_dir, marker))) {
|
|
9834
9956
|
return ANCHOR_AGENTS_DIR;
|
|
9835
9957
|
}
|
|
9836
9958
|
}
|
|
9837
9959
|
}
|
|
9838
|
-
if (_exists(
|
|
9960
|
+
if (_exists(path11.join(dir, ".git"))) {
|
|
9839
9961
|
return ANCHOR_GIT;
|
|
9840
9962
|
}
|
|
9841
9963
|
return null;
|
|
@@ -9846,7 +9968,7 @@ function find_project_root_with_anchor(start) {
|
|
|
9846
9968
|
const chain = _ancestor_chain(current);
|
|
9847
9969
|
if (legacy) {
|
|
9848
9970
|
for (const candidate of chain) {
|
|
9849
|
-
if (_exists(
|
|
9971
|
+
if (_exists(path11.join(candidate, ".git"))) {
|
|
9850
9972
|
return [candidate, ANCHOR_GIT];
|
|
9851
9973
|
}
|
|
9852
9974
|
}
|
|
@@ -9860,7 +9982,7 @@ function find_project_root_with_anchor(start) {
|
|
|
9860
9982
|
}
|
|
9861
9983
|
let outermost = null;
|
|
9862
9984
|
for (const candidate of chain) {
|
|
9863
|
-
if (_exists(
|
|
9985
|
+
if (_exists(path11.join(candidate, DEFAULT_PROJECT_FILE))) {
|
|
9864
9986
|
outermost = candidate;
|
|
9865
9987
|
}
|
|
9866
9988
|
}
|
|
@@ -9904,7 +10026,7 @@ function _expanduser(p) {
|
|
|
9904
10026
|
return os6.homedir();
|
|
9905
10027
|
}
|
|
9906
10028
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
9907
|
-
return
|
|
10029
|
+
return path11.join(os6.homedir(), p.slice(2));
|
|
9908
10030
|
}
|
|
9909
10031
|
return p;
|
|
9910
10032
|
}
|
|
@@ -9933,13 +10055,13 @@ function resolve_project_root(arg, options = {}) {
|
|
|
9933
10055
|
function _resolve_cascade_paths(cwd, project_path) {
|
|
9934
10056
|
if (cwd === null) {
|
|
9935
10057
|
const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
|
|
9936
|
-
const parent =
|
|
10058
|
+
const parent = path11.dirname(legacy);
|
|
9937
10059
|
return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
|
|
9938
10060
|
}
|
|
9939
10061
|
const root = find_project_root(cwd);
|
|
9940
10062
|
if (root === null) {
|
|
9941
10063
|
const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
|
|
9942
|
-
const parent =
|
|
10064
|
+
const parent = path11.dirname(legacy);
|
|
9943
10065
|
return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
|
|
9944
10066
|
}
|
|
9945
10067
|
const cwd_resolved = _resolve(cwd);
|
|
@@ -9950,7 +10072,7 @@ function _resolve_cascade_paths(cwd, project_path) {
|
|
|
9950
10072
|
if (cursor === root) {
|
|
9951
10073
|
break;
|
|
9952
10074
|
}
|
|
9953
|
-
const parent =
|
|
10075
|
+
const parent = path11.dirname(cursor);
|
|
9954
10076
|
if (parent === cursor) {
|
|
9955
10077
|
break;
|
|
9956
10078
|
}
|
|
@@ -9958,7 +10080,7 @@ function _resolve_cascade_paths(cwd, project_path) {
|
|
|
9958
10080
|
}
|
|
9959
10081
|
chain.reverse();
|
|
9960
10082
|
return [
|
|
9961
|
-
...chain.map((d) =>
|
|
10083
|
+
...chain.map((d) => path11.join(d, DEFAULT_PROJECT_FILE)),
|
|
9962
10084
|
_canonical_settings_path(root),
|
|
9963
10085
|
_local_settings_path(root)
|
|
9964
10086
|
];
|
|
@@ -9968,7 +10090,10 @@ function load_agent_settings(options = {}) {
|
|
|
9968
10090
|
const user_global_path = options.user_global_path ?? null;
|
|
9969
10091
|
const verbose = options.verbose ?? false;
|
|
9970
10092
|
const cwd = options.cwd ?? null;
|
|
9971
|
-
const user_global_raw =
|
|
10093
|
+
const user_global_raw = {};
|
|
10094
|
+
for (const p of user_global_path ? [user_global_path] : user_global_settings_paths()) {
|
|
10095
|
+
_deep_merge(user_global_raw, _read_yaml(p) ?? {});
|
|
10096
|
+
}
|
|
9972
10097
|
const [user_global_filtered, ignored] = _filter_whitelist(user_global_raw, MERGEABLE_KEYS);
|
|
9973
10098
|
if (verbose && ignored.length > 0) {
|
|
9974
10099
|
logger.info(
|
|
@@ -9999,7 +10124,7 @@ function _read_yaml(p) {
|
|
|
9999
10124
|
}
|
|
10000
10125
|
let data;
|
|
10001
10126
|
try {
|
|
10002
|
-
const text =
|
|
10127
|
+
const text = fs12.readFileSync(p, "utf-8");
|
|
10003
10128
|
data = YAML3.parse(text, { version: "1.1" });
|
|
10004
10129
|
if (data === null || data === void 0) {
|
|
10005
10130
|
data = {};
|
|
@@ -10091,11 +10216,11 @@ function _is_plain_dict(value) {
|
|
|
10091
10216
|
}
|
|
10092
10217
|
|
|
10093
10218
|
// src/install/rule_scope.ts
|
|
10094
|
-
import * as
|
|
10219
|
+
import * as path12 from "node:path";
|
|
10095
10220
|
|
|
10096
10221
|
// src/install/ruleInScope.ts
|
|
10097
10222
|
var YAML2 = __toESM(require_dist(), 1);
|
|
10098
|
-
import * as
|
|
10223
|
+
import * as fs13 from "node:fs";
|
|
10099
10224
|
function parseYaml2(text) {
|
|
10100
10225
|
try {
|
|
10101
10226
|
const data = YAML2.parse(text, { version: "1.1" });
|
|
@@ -10133,7 +10258,7 @@ function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null)
|
|
|
10133
10258
|
if (scope === null && pack_scope === null && role_scope === null) {
|
|
10134
10259
|
return true;
|
|
10135
10260
|
}
|
|
10136
|
-
const [meta] = parseFrontmatter(
|
|
10261
|
+
const [meta] = parseFrontmatter(fs13.readFileSync(source_path, "utf-8"));
|
|
10137
10262
|
if (meta["type"] === "always" || meta["alwaysApply"] === true) {
|
|
10138
10263
|
return true;
|
|
10139
10264
|
}
|
|
@@ -10184,7 +10309,7 @@ function ruleFileArrives(sourcePath, scope) {
|
|
|
10184
10309
|
if (!sourcePath.endsWith(".md")) {
|
|
10185
10310
|
return true;
|
|
10186
10311
|
}
|
|
10187
|
-
const basename5 =
|
|
10312
|
+
const basename5 = path12.basename(sourcePath);
|
|
10188
10313
|
if (COMPAT_ALWAYS_EXCLUDED.includes(basename5)) {
|
|
10189
10314
|
return false;
|
|
10190
10315
|
}
|
|
@@ -10742,8 +10867,8 @@ function getErrorMap() {
|
|
|
10742
10867
|
|
|
10743
10868
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
10744
10869
|
var makeIssue = (params) => {
|
|
10745
|
-
const { data, path:
|
|
10746
|
-
const fullPath = [...
|
|
10870
|
+
const { data, path: path17, errorMaps, issueData } = params;
|
|
10871
|
+
const fullPath = [...path17, ...issueData.path || []];
|
|
10747
10872
|
const fullIssue = {
|
|
10748
10873
|
...issueData,
|
|
10749
10874
|
path: fullPath
|
|
@@ -10859,11 +10984,11 @@ var errorUtil;
|
|
|
10859
10984
|
|
|
10860
10985
|
// node_modules/zod/v3/types.js
|
|
10861
10986
|
var ParseInputLazyPath = class {
|
|
10862
|
-
constructor(parent, value,
|
|
10987
|
+
constructor(parent, value, path17, key) {
|
|
10863
10988
|
this._cachedPath = [];
|
|
10864
10989
|
this.parent = parent;
|
|
10865
10990
|
this.data = value;
|
|
10866
|
-
this._path =
|
|
10991
|
+
this._path = path17;
|
|
10867
10992
|
this._key = key;
|
|
10868
10993
|
}
|
|
10869
10994
|
get path() {
|
|
@@ -16141,8 +16266,8 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
16141
16266
|
};
|
|
16142
16267
|
|
|
16143
16268
|
// src/scripts/_lib/module_detection.ts
|
|
16144
|
-
import * as
|
|
16145
|
-
import * as
|
|
16269
|
+
import * as fs14 from "node:fs";
|
|
16270
|
+
import * as path13 from "node:path";
|
|
16146
16271
|
var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
|
|
16147
16272
|
var _RULES = [
|
|
16148
16273
|
["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
|
|
@@ -16156,14 +16281,14 @@ var _RULES = [
|
|
|
16156
16281
|
];
|
|
16157
16282
|
function _isDir(p) {
|
|
16158
16283
|
try {
|
|
16159
|
-
return
|
|
16284
|
+
return fs14.statSync(p).isDirectory();
|
|
16160
16285
|
} catch {
|
|
16161
16286
|
return false;
|
|
16162
16287
|
}
|
|
16163
16288
|
}
|
|
16164
16289
|
function _isFile(p) {
|
|
16165
16290
|
try {
|
|
16166
|
-
return
|
|
16291
|
+
return fs14.statSync(p).isFile();
|
|
16167
16292
|
} catch {
|
|
16168
16293
|
return false;
|
|
16169
16294
|
}
|
|
@@ -16177,13 +16302,13 @@ function _isUpperChar(ch) {
|
|
|
16177
16302
|
function _list_module_subdirs(root) {
|
|
16178
16303
|
let entries;
|
|
16179
16304
|
try {
|
|
16180
|
-
entries =
|
|
16305
|
+
entries = fs14.readdirSync(root).sort();
|
|
16181
16306
|
} catch {
|
|
16182
16307
|
return [];
|
|
16183
16308
|
}
|
|
16184
16309
|
const out = [];
|
|
16185
16310
|
for (const name of entries) {
|
|
16186
|
-
if (!_isDir(
|
|
16311
|
+
if (!_isDir(path13.join(root, name))) {
|
|
16187
16312
|
continue;
|
|
16188
16313
|
}
|
|
16189
16314
|
if (name.startsWith(".")) {
|
|
@@ -16205,11 +16330,11 @@ function _score_confidence(stack, root, subdirs) {
|
|
|
16205
16330
|
return capitalized.length > 0 ? "high" : "medium";
|
|
16206
16331
|
}
|
|
16207
16332
|
if (stack === "node-monorepo") {
|
|
16208
|
-
const withPkgJson = subdirs.filter((name) => _isFile(
|
|
16333
|
+
const withPkgJson = subdirs.filter((name) => _isFile(path13.join(root, name, "package.json")));
|
|
16209
16334
|
return withPkgJson.length > 0 ? "high" : "medium";
|
|
16210
16335
|
}
|
|
16211
16336
|
if (stack === "python-src") {
|
|
16212
|
-
const withInit = subdirs.filter((name) => _isFile(
|
|
16337
|
+
const withInit = subdirs.filter((name) => _isFile(path13.join(root, name, "__init__.py")));
|
|
16213
16338
|
return withInit.length > 0 ? "high" : "medium";
|
|
16214
16339
|
}
|
|
16215
16340
|
if (stack === "go-internal") {
|
|
@@ -16221,7 +16346,7 @@ function detect_module_roots(project_root) {
|
|
|
16221
16346
|
const high = [];
|
|
16222
16347
|
const medium = [];
|
|
16223
16348
|
for (const [rel_path, stack, namespace_template] of _RULES) {
|
|
16224
|
-
const abs_path =
|
|
16349
|
+
const abs_path = path13.join(project_root, rel_path);
|
|
16225
16350
|
if (!_isDir(abs_path)) {
|
|
16226
16351
|
continue;
|
|
16227
16352
|
}
|
|
@@ -16243,7 +16368,7 @@ function detect_module_roots(project_root) {
|
|
|
16243
16368
|
}
|
|
16244
16369
|
|
|
16245
16370
|
// src/scripts/_lib/model_tier.ts
|
|
16246
|
-
import
|
|
16371
|
+
import fs15 from "node:fs";
|
|
16247
16372
|
var TIER_TO_CLAUDE_MODEL = {
|
|
16248
16373
|
high: "opus",
|
|
16249
16374
|
medium: "sonnet",
|
|
@@ -16251,8 +16376,8 @@ var TIER_TO_CLAUDE_MODEL = {
|
|
|
16251
16376
|
};
|
|
16252
16377
|
var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
|
|
16253
16378
|
function read_model_tier(skill_md) {
|
|
16254
|
-
if (!
|
|
16255
|
-
const text =
|
|
16379
|
+
if (!fs15.existsSync(skill_md)) return null;
|
|
16380
|
+
const text = fs15.readFileSync(skill_md).toString("utf-8");
|
|
16256
16381
|
if (!text.startsWith("---\n")) return null;
|
|
16257
16382
|
const end = text.indexOf("\n---\n", 4);
|
|
16258
16383
|
if (end === -1) return null;
|
|
@@ -16269,39 +16394,39 @@ function render_native_model_md(text, tier) {
|
|
|
16269
16394
|
|
|
16270
16395
|
// src/scripts/_cli/cmd_migrate.ts
|
|
16271
16396
|
import { spawnSync } from "node:child_process";
|
|
16272
|
-
import * as
|
|
16273
|
-
import * as
|
|
16397
|
+
import * as fs17 from "node:fs";
|
|
16398
|
+
import * as path15 from "node:path";
|
|
16274
16399
|
import process2 from "node:process";
|
|
16275
16400
|
import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
|
|
16276
16401
|
|
|
16277
16402
|
// src/scripts/_lib/package_root.ts
|
|
16278
|
-
import * as
|
|
16279
|
-
import * as
|
|
16403
|
+
import * as fs16 from "node:fs";
|
|
16404
|
+
import * as path14 from "node:path";
|
|
16280
16405
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
16281
16406
|
var PACKAGE_NAME = "@event4u/agent-config";
|
|
16282
16407
|
var MAX_ASCENT = 16;
|
|
16283
16408
|
function resolvePackageRoot(fromUrlOrPath, legacyHops = 3) {
|
|
16284
16409
|
const start = fromUrlOrPath.startsWith("file:") ? fileURLToPath2(fromUrlOrPath) : fromUrlOrPath;
|
|
16285
|
-
const startDir =
|
|
16410
|
+
const startDir = path14.dirname(start);
|
|
16286
16411
|
let dir = startDir;
|
|
16287
16412
|
for (let i = 0; i < MAX_ASCENT; i++) {
|
|
16288
|
-
const manifest =
|
|
16289
|
-
if (
|
|
16413
|
+
const manifest = path14.join(dir, "package.json");
|
|
16414
|
+
if (fs16.existsSync(manifest)) {
|
|
16290
16415
|
try {
|
|
16291
|
-
const parsed = JSON.parse(
|
|
16416
|
+
const parsed = JSON.parse(fs16.readFileSync(manifest, "utf8"));
|
|
16292
16417
|
if (parsed.name === PACKAGE_NAME) {
|
|
16293
16418
|
return dir;
|
|
16294
16419
|
}
|
|
16295
16420
|
} catch {
|
|
16296
16421
|
}
|
|
16297
16422
|
}
|
|
16298
|
-
const parent =
|
|
16423
|
+
const parent = path14.dirname(dir);
|
|
16299
16424
|
if (parent === dir) {
|
|
16300
16425
|
break;
|
|
16301
16426
|
}
|
|
16302
16427
|
dir = parent;
|
|
16303
16428
|
}
|
|
16304
|
-
return
|
|
16429
|
+
return path14.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
|
|
16305
16430
|
}
|
|
16306
16431
|
|
|
16307
16432
|
// src/scripts/_cli/cmd_migrate.ts
|
|
@@ -16322,7 +16447,7 @@ var LEGACY_SETTINGS_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
|
16322
16447
|
var LEGACY_STATE_FILENAME = ".implement-ticket-state.json";
|
|
16323
16448
|
var LEGACY_STATE_V1_FILENAME = ".work-state.json";
|
|
16324
16449
|
var LEGACY_AGENT_CONFIG_SHELL = "agent-config";
|
|
16325
|
-
var _HERE_DIR =
|
|
16450
|
+
var _HERE_DIR = path15.dirname(fileURLToPath3(import.meta.url));
|
|
16326
16451
|
var ArgparseExit = class extends Error {
|
|
16327
16452
|
code;
|
|
16328
16453
|
constructor(code) {
|
|
@@ -16421,38 +16546,38 @@ function _jsonDumpsIndentAscii(value, indent) {
|
|
|
16421
16546
|
}
|
|
16422
16547
|
function _isFile2(p) {
|
|
16423
16548
|
try {
|
|
16424
|
-
return
|
|
16549
|
+
return fs17.statSync(p).isFile();
|
|
16425
16550
|
} catch {
|
|
16426
16551
|
return false;
|
|
16427
16552
|
}
|
|
16428
16553
|
}
|
|
16429
16554
|
function _isDir2(p) {
|
|
16430
16555
|
try {
|
|
16431
|
-
return
|
|
16556
|
+
return fs17.statSync(p).isDirectory();
|
|
16432
16557
|
} catch {
|
|
16433
16558
|
return false;
|
|
16434
16559
|
}
|
|
16435
16560
|
}
|
|
16436
16561
|
function _isSymlink(p) {
|
|
16437
16562
|
try {
|
|
16438
|
-
return
|
|
16563
|
+
return fs17.lstatSync(p).isSymbolicLink();
|
|
16439
16564
|
} catch {
|
|
16440
16565
|
return false;
|
|
16441
16566
|
}
|
|
16442
16567
|
}
|
|
16443
16568
|
function _exists2(p) {
|
|
16444
16569
|
try {
|
|
16445
|
-
|
|
16570
|
+
fs17.lstatSync(p);
|
|
16446
16571
|
return true;
|
|
16447
16572
|
} catch {
|
|
16448
16573
|
return false;
|
|
16449
16574
|
}
|
|
16450
16575
|
}
|
|
16451
16576
|
function _readText(p) {
|
|
16452
|
-
return
|
|
16577
|
+
return fs17.readFileSync(p, { encoding: "utf-8" });
|
|
16453
16578
|
}
|
|
16454
16579
|
function _writeText(p, text) {
|
|
16455
|
-
|
|
16580
|
+
fs17.writeFileSync(p, text, { encoding: "utf-8" });
|
|
16456
16581
|
}
|
|
16457
16582
|
function _jsonLoadFile(p) {
|
|
16458
16583
|
return JSON.parse(_readText(p));
|
|
@@ -16508,7 +16633,7 @@ function _classify_symlink(link) {
|
|
|
16508
16633
|
}
|
|
16509
16634
|
let target;
|
|
16510
16635
|
try {
|
|
16511
|
-
target =
|
|
16636
|
+
target = fs17.readlinkSync(link);
|
|
16512
16637
|
} catch {
|
|
16513
16638
|
return null;
|
|
16514
16639
|
}
|
|
@@ -16519,16 +16644,16 @@ function _classify_symlink(link) {
|
|
|
16519
16644
|
return "user";
|
|
16520
16645
|
}
|
|
16521
16646
|
function _detect_legacy_state(project) {
|
|
16522
|
-
return _isFile2(
|
|
16647
|
+
return _isFile2(path15.join(project, LEGACY_STATE_FILENAME));
|
|
16523
16648
|
}
|
|
16524
16649
|
function _detect_legacy_settings(project) {
|
|
16525
16650
|
const found = [];
|
|
16526
16651
|
for (const name of LEGACY_SETTINGS_FILES) {
|
|
16527
|
-
const flat =
|
|
16652
|
+
const flat = path15.join(project, name);
|
|
16528
16653
|
if (_isFile2(flat)) {
|
|
16529
16654
|
found.push(flat);
|
|
16530
16655
|
}
|
|
16531
|
-
const typed =
|
|
16656
|
+
const typed = path15.join(project, "settings", name);
|
|
16532
16657
|
if (_isFile2(typed)) {
|
|
16533
16658
|
found.push(typed);
|
|
16534
16659
|
}
|
|
@@ -16536,25 +16661,25 @@ function _detect_legacy_settings(project) {
|
|
|
16536
16661
|
return found;
|
|
16537
16662
|
}
|
|
16538
16663
|
function _detect_empty_shell(project) {
|
|
16539
|
-
const shell =
|
|
16664
|
+
const shell = path15.join(project, LEGACY_AGENT_CONFIG_SHELL);
|
|
16540
16665
|
if (!_isDir2(shell) || _isSymlink(shell)) {
|
|
16541
16666
|
return false;
|
|
16542
16667
|
}
|
|
16543
16668
|
try {
|
|
16544
|
-
return
|
|
16669
|
+
return fs17.readdirSync(shell).length === 0;
|
|
16545
16670
|
} catch {
|
|
16546
16671
|
return false;
|
|
16547
16672
|
}
|
|
16548
16673
|
}
|
|
16549
16674
|
function _detect_already_migrated(project) {
|
|
16550
|
-
if (_detect_npm(
|
|
16675
|
+
if (_detect_npm(path15.join(project, "package.json"))) {
|
|
16551
16676
|
return false;
|
|
16552
16677
|
}
|
|
16553
|
-
if (_detect_composer(
|
|
16678
|
+
if (_detect_composer(path15.join(project, "composer.json"))) {
|
|
16554
16679
|
return false;
|
|
16555
16680
|
}
|
|
16556
16681
|
for (const name of MANAGED_SYMLINKS) {
|
|
16557
|
-
if (_classify_symlink(
|
|
16682
|
+
if (_classify_symlink(path15.join(project, name)) === "legacy") {
|
|
16558
16683
|
return false;
|
|
16559
16684
|
}
|
|
16560
16685
|
}
|
|
@@ -16625,11 +16750,11 @@ function _purge_legacy_symlinks(project) {
|
|
|
16625
16750
|
const removed = [];
|
|
16626
16751
|
const preserved = [];
|
|
16627
16752
|
for (const name of MANAGED_SYMLINKS) {
|
|
16628
|
-
const link =
|
|
16753
|
+
const link = path15.join(project, name);
|
|
16629
16754
|
const kind = _classify_symlink(link);
|
|
16630
16755
|
if (kind === "legacy") {
|
|
16631
16756
|
try {
|
|
16632
|
-
|
|
16757
|
+
fs17.unlinkSync(link);
|
|
16633
16758
|
removed.push(name);
|
|
16634
16759
|
} catch {
|
|
16635
16760
|
preserved.push(name);
|
|
@@ -16641,14 +16766,14 @@ function _purge_legacy_symlinks(project) {
|
|
|
16641
16766
|
return [removed, preserved];
|
|
16642
16767
|
}
|
|
16643
16768
|
function _migrate_state_file(project) {
|
|
16644
|
-
const source =
|
|
16769
|
+
const source = path15.join(project, LEGACY_STATE_FILENAME);
|
|
16645
16770
|
if (!_isFile2(source)) {
|
|
16646
16771
|
return null;
|
|
16647
16772
|
}
|
|
16648
|
-
const target =
|
|
16773
|
+
const target = path15.join(project, LEGACY_STATE_V1_FILENAME);
|
|
16649
16774
|
if (_exists2(target)) {
|
|
16650
16775
|
try {
|
|
16651
|
-
|
|
16776
|
+
fs17.unlinkSync(source);
|
|
16652
16777
|
return `removed stale ${LEGACY_STATE_FILENAME} (v1 already present)`;
|
|
16653
16778
|
} catch {
|
|
16654
16779
|
return null;
|
|
@@ -16663,7 +16788,7 @@ function _migrate_state_file(project) {
|
|
|
16663
16788
|
}
|
|
16664
16789
|
function _load_state_migrator() {
|
|
16665
16790
|
const pkg_root = resolvePackageRoot(import.meta.url);
|
|
16666
|
-
const rel =
|
|
16791
|
+
const rel = path15.join(
|
|
16667
16792
|
"agent-src",
|
|
16668
16793
|
"templates",
|
|
16669
16794
|
"scripts",
|
|
@@ -16671,8 +16796,8 @@ function _load_state_migrator() {
|
|
|
16671
16796
|
"migration",
|
|
16672
16797
|
"v0_to_v1.ts"
|
|
16673
16798
|
);
|
|
16674
|
-
const driver = [
|
|
16675
|
-
(p) =>
|
|
16799
|
+
const driver = [path15.join(pkg_root, "dist", rel), path15.join(pkg_root, "src", rel)].find(
|
|
16800
|
+
(p) => fs17.existsSync(p)
|
|
16676
16801
|
) ?? null;
|
|
16677
16802
|
if (driver === null) {
|
|
16678
16803
|
return null;
|
|
@@ -16680,12 +16805,12 @@ function _load_state_migrator() {
|
|
|
16680
16805
|
const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
16681
16806
|
let tsxBin = null;
|
|
16682
16807
|
for (let dir = pkg_root; ; ) {
|
|
16683
|
-
const cand =
|
|
16684
|
-
if (
|
|
16808
|
+
const cand = path15.join(dir, "node_modules", ".bin", binName);
|
|
16809
|
+
if (fs17.existsSync(cand)) {
|
|
16685
16810
|
tsxBin = cand;
|
|
16686
16811
|
break;
|
|
16687
16812
|
}
|
|
16688
|
-
const parent =
|
|
16813
|
+
const parent = path15.dirname(dir);
|
|
16689
16814
|
if (parent === dir) break;
|
|
16690
16815
|
dir = parent;
|
|
16691
16816
|
}
|
|
@@ -16712,17 +16837,17 @@ function _delete_legacy_settings(project) {
|
|
|
16712
16837
|
const removed = [];
|
|
16713
16838
|
for (const p of _detect_legacy_settings(project)) {
|
|
16714
16839
|
try {
|
|
16715
|
-
|
|
16716
|
-
removed.push(
|
|
16840
|
+
fs17.unlinkSync(p);
|
|
16841
|
+
removed.push(path15.relative(project, p));
|
|
16717
16842
|
} catch {
|
|
16718
16843
|
continue;
|
|
16719
16844
|
}
|
|
16720
16845
|
}
|
|
16721
|
-
const settings_dir =
|
|
16846
|
+
const settings_dir = path15.join(project, "settings");
|
|
16722
16847
|
if (_isDir2(settings_dir) && !_isSymlink(settings_dir)) {
|
|
16723
16848
|
try {
|
|
16724
|
-
if (
|
|
16725
|
-
|
|
16849
|
+
if (fs17.readdirSync(settings_dir).length === 0) {
|
|
16850
|
+
fs17.rmdirSync(settings_dir);
|
|
16726
16851
|
removed.push("settings/");
|
|
16727
16852
|
}
|
|
16728
16853
|
} catch {
|
|
@@ -16731,12 +16856,12 @@ function _delete_legacy_settings(project) {
|
|
|
16731
16856
|
return removed;
|
|
16732
16857
|
}
|
|
16733
16858
|
function _remove_empty_shell(project) {
|
|
16734
|
-
const shell =
|
|
16859
|
+
const shell = path15.join(project, LEGACY_AGENT_CONFIG_SHELL);
|
|
16735
16860
|
if (!_detect_empty_shell(project)) {
|
|
16736
16861
|
return false;
|
|
16737
16862
|
}
|
|
16738
16863
|
try {
|
|
16739
|
-
|
|
16864
|
+
fs17.rmdirSync(shell);
|
|
16740
16865
|
} catch {
|
|
16741
16866
|
return false;
|
|
16742
16867
|
}
|
|
@@ -16746,7 +16871,7 @@ function _reEscape(s) {
|
|
|
16746
16871
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
16747
16872
|
}
|
|
16748
16873
|
function _update_gitignore(project) {
|
|
16749
|
-
const gitignore =
|
|
16874
|
+
const gitignore = path15.join(project, ".gitignore");
|
|
16750
16875
|
const block = `${GITIGNORE_BLOCK_START}
|
|
16751
16876
|
${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
|
|
16752
16877
|
`;
|
|
@@ -16777,16 +16902,16 @@ ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
|
|
|
16777
16902
|
}
|
|
16778
16903
|
function _build_plan(project) {
|
|
16779
16904
|
return {
|
|
16780
|
-
npm: _detect_npm(
|
|
16781
|
-
composer: _detect_composer(
|
|
16905
|
+
npm: _detect_npm(path15.join(project, "package.json")),
|
|
16906
|
+
composer: _detect_composer(path15.join(project, "composer.json")),
|
|
16782
16907
|
symlinks_legacy: MANAGED_SYMLINKS.filter(
|
|
16783
|
-
(name) => _classify_symlink(
|
|
16908
|
+
(name) => _classify_symlink(path15.join(project, name)) === "legacy"
|
|
16784
16909
|
),
|
|
16785
16910
|
symlinks_user: MANAGED_SYMLINKS.filter(
|
|
16786
|
-
(name) => _classify_symlink(
|
|
16911
|
+
(name) => _classify_symlink(path15.join(project, name)) === "user"
|
|
16787
16912
|
),
|
|
16788
|
-
state_file: _isFile2(
|
|
16789
|
-
settings_files: _detect_legacy_settings(project).map((p) =>
|
|
16913
|
+
state_file: _isFile2(path15.join(project, LEGACY_STATE_FILENAME)),
|
|
16914
|
+
settings_files: _detect_legacy_settings(project).map((p) => path15.relative(project, p)),
|
|
16790
16915
|
empty_shell: _detect_empty_shell(project)
|
|
16791
16916
|
};
|
|
16792
16917
|
}
|
|
@@ -16850,10 +16975,10 @@ function _warn_on_major_mismatch(from_major, plan, out) {
|
|
|
16850
16975
|
}
|
|
16851
16976
|
function _apply(project, out, err) {
|
|
16852
16977
|
const summary = [];
|
|
16853
|
-
if (_strip_npm_entry(
|
|
16978
|
+
if (_strip_npm_entry(path15.join(project, "package.json"))) {
|
|
16854
16979
|
summary.push(`removed ${PACKAGE_NAME_NPM} from package.json`);
|
|
16855
16980
|
}
|
|
16856
|
-
if (_strip_composer_entry(
|
|
16981
|
+
if (_strip_composer_entry(path15.join(project, "composer.json"))) {
|
|
16857
16982
|
summary.push(`removed ${PACKAGE_NAME_COMPOSER} from composer.json`);
|
|
16858
16983
|
}
|
|
16859
16984
|
const [removed_links, preserved_links] = _purge_legacy_symlinks(project);
|
|
@@ -16979,13 +17104,13 @@ function _isCliEntry() {
|
|
|
16979
17104
|
if (process2.argv[1] === void 0) {
|
|
16980
17105
|
return false;
|
|
16981
17106
|
}
|
|
16982
|
-
const argvUrl = pathToFileURL(
|
|
17107
|
+
const argvUrl = pathToFileURL(path15.resolve(process2.argv[1])).href;
|
|
16983
17108
|
if (import.meta.url === argvUrl) {
|
|
16984
17109
|
return true;
|
|
16985
17110
|
}
|
|
16986
17111
|
try {
|
|
16987
|
-
const here =
|
|
16988
|
-
const argv =
|
|
17112
|
+
const here = fs17.realpathSync(fileURLToPath3(import.meta.url));
|
|
17113
|
+
const argv = fs17.realpathSync(path15.resolve(process2.argv[1]));
|
|
16989
17114
|
return here === argv;
|
|
16990
17115
|
} catch {
|
|
16991
17116
|
return false;
|
|
@@ -17022,34 +17147,34 @@ var ArgparseExit2 = class extends Error {
|
|
|
17022
17147
|
function expanduser6(p) {
|
|
17023
17148
|
if (p === "~") return os7.homedir();
|
|
17024
17149
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
17025
|
-
return
|
|
17150
|
+
return path16.join(os7.homedir(), p.slice(2));
|
|
17026
17151
|
}
|
|
17027
17152
|
return p;
|
|
17028
17153
|
}
|
|
17029
17154
|
function resolvePath(p) {
|
|
17030
17155
|
try {
|
|
17031
|
-
return
|
|
17156
|
+
return fs18.realpathSync(path16.resolve(p));
|
|
17032
17157
|
} catch {
|
|
17033
|
-
return
|
|
17158
|
+
return path16.resolve(p);
|
|
17034
17159
|
}
|
|
17035
17160
|
}
|
|
17036
17161
|
function isFile(p) {
|
|
17037
17162
|
try {
|
|
17038
|
-
return
|
|
17163
|
+
return fs18.statSync(p).isFile();
|
|
17039
17164
|
} catch {
|
|
17040
17165
|
return false;
|
|
17041
17166
|
}
|
|
17042
17167
|
}
|
|
17043
17168
|
function isDir(p) {
|
|
17044
17169
|
try {
|
|
17045
|
-
return
|
|
17170
|
+
return fs18.statSync(p).isDirectory();
|
|
17046
17171
|
} catch {
|
|
17047
17172
|
return false;
|
|
17048
17173
|
}
|
|
17049
17174
|
}
|
|
17050
17175
|
function pathExists(p) {
|
|
17051
17176
|
try {
|
|
17052
|
-
|
|
17177
|
+
fs18.statSync(p);
|
|
17053
17178
|
return true;
|
|
17054
17179
|
} catch {
|
|
17055
17180
|
return false;
|
|
@@ -17057,24 +17182,24 @@ function pathExists(p) {
|
|
|
17057
17182
|
}
|
|
17058
17183
|
function isSymlink(p) {
|
|
17059
17184
|
try {
|
|
17060
|
-
return
|
|
17185
|
+
return fs18.lstatSync(p).isSymbolicLink();
|
|
17061
17186
|
} catch {
|
|
17062
17187
|
return false;
|
|
17063
17188
|
}
|
|
17064
17189
|
}
|
|
17065
17190
|
function readText(p) {
|
|
17066
|
-
return
|
|
17191
|
+
return fs18.readFileSync(p, "utf-8");
|
|
17067
17192
|
}
|
|
17068
17193
|
function writeText(p, content) {
|
|
17069
|
-
|
|
17194
|
+
fs18.writeFileSync(p, content, "utf-8");
|
|
17070
17195
|
}
|
|
17071
17196
|
function mkdirp(p) {
|
|
17072
|
-
|
|
17197
|
+
fs18.mkdirSync(p, { recursive: true });
|
|
17073
17198
|
}
|
|
17074
17199
|
function sortedGlobStems(directory, suffix) {
|
|
17075
17200
|
let entries;
|
|
17076
17201
|
try {
|
|
17077
|
-
entries =
|
|
17202
|
+
entries = fs18.readdirSync(directory);
|
|
17078
17203
|
} catch {
|
|
17079
17204
|
return [];
|
|
17080
17205
|
}
|
|
@@ -17094,7 +17219,7 @@ function sortedGlobStems(directory, suffix) {
|
|
|
17094
17219
|
function countZips(directory) {
|
|
17095
17220
|
if (!isDir(directory)) return 0;
|
|
17096
17221
|
let n = 0;
|
|
17097
|
-
for (const name of
|
|
17222
|
+
for (const name of fs18.readdirSync(directory)) {
|
|
17098
17223
|
if (name.endsWith(".zip")) n += 1;
|
|
17099
17224
|
}
|
|
17100
17225
|
return n;
|
|
@@ -17102,35 +17227,35 @@ function countZips(directory) {
|
|
|
17102
17227
|
function sha256OfFile(p) {
|
|
17103
17228
|
let data;
|
|
17104
17229
|
try {
|
|
17105
|
-
data =
|
|
17230
|
+
data = fs18.readFileSync(p);
|
|
17106
17231
|
} catch {
|
|
17107
17232
|
return null;
|
|
17108
17233
|
}
|
|
17109
17234
|
return crypto3.createHash("sha256").update(data).digest("hex");
|
|
17110
17235
|
}
|
|
17111
17236
|
function atomicWrite0644(target, body, prefix) {
|
|
17112
|
-
const dir =
|
|
17113
|
-
const tmpName =
|
|
17237
|
+
const dir = path16.dirname(target);
|
|
17238
|
+
const tmpName = path16.join(
|
|
17114
17239
|
dir,
|
|
17115
17240
|
`${prefix}${process3.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
|
|
17116
17241
|
);
|
|
17117
17242
|
let fd = null;
|
|
17118
17243
|
try {
|
|
17119
|
-
fd =
|
|
17120
|
-
|
|
17121
|
-
|
|
17244
|
+
fd = fs18.openSync(tmpName, "wx", 420);
|
|
17245
|
+
fs18.writeFileSync(fd, body, "utf-8");
|
|
17246
|
+
fs18.closeSync(fd);
|
|
17122
17247
|
fd = null;
|
|
17123
|
-
|
|
17124
|
-
|
|
17248
|
+
fs18.chmodSync(tmpName, 420);
|
|
17249
|
+
fs18.renameSync(tmpName, target);
|
|
17125
17250
|
} catch (err) {
|
|
17126
17251
|
if (fd !== null) {
|
|
17127
17252
|
try {
|
|
17128
|
-
|
|
17253
|
+
fs18.closeSync(fd);
|
|
17129
17254
|
} catch {
|
|
17130
17255
|
}
|
|
17131
17256
|
}
|
|
17132
17257
|
try {
|
|
17133
|
-
|
|
17258
|
+
fs18.unlinkSync(tmpName);
|
|
17134
17259
|
} catch {
|
|
17135
17260
|
}
|
|
17136
17261
|
throw err;
|
|
@@ -17254,12 +17379,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
|
|
|
17254
17379
|
var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
|
|
17255
17380
|
var SETTINGS_SUBDIR = ["agents", "settings"];
|
|
17256
17381
|
function _canonical_settings_target(project_root) {
|
|
17257
|
-
return
|
|
17382
|
+
return path16.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
|
|
17258
17383
|
}
|
|
17259
17384
|
function _resolve_settings_read(project_root) {
|
|
17260
17385
|
const canonical = _canonical_settings_target(project_root);
|
|
17261
17386
|
if (pathExists(canonical)) return canonical;
|
|
17262
|
-
const legacy =
|
|
17387
|
+
const legacy = path16.join(project_root, SETTINGS_FILE);
|
|
17263
17388
|
if (pathExists(legacy)) return legacy;
|
|
17264
17389
|
return canonical;
|
|
17265
17390
|
}
|
|
@@ -17323,9 +17448,9 @@ function fail(msg) {
|
|
|
17323
17448
|
throw new SystemExitError(1);
|
|
17324
17449
|
}
|
|
17325
17450
|
function detect_package_root(project_root) {
|
|
17326
|
-
const npm_path =
|
|
17451
|
+
const npm_path = path16.join(project_root, "node_modules", "@event4u", "agent-config");
|
|
17327
17452
|
if (isDir(npm_path)) return resolvePath(npm_path);
|
|
17328
|
-
if (pathExists(
|
|
17453
|
+
if (pathExists(path16.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
17329
17454
|
return project_root;
|
|
17330
17455
|
}
|
|
17331
17456
|
fail(
|
|
@@ -17333,12 +17458,12 @@ function detect_package_root(project_root) {
|
|
|
17333
17458
|
);
|
|
17334
17459
|
}
|
|
17335
17460
|
function detect_package_type(package_root) {
|
|
17336
|
-
if (package_root.split(
|
|
17461
|
+
if (package_root.split(path16.sep).includes("node_modules")) return "npm";
|
|
17337
17462
|
return "local";
|
|
17338
17463
|
}
|
|
17339
17464
|
function detect_package_type_for_project(project_root, package_root) {
|
|
17340
17465
|
const npm_path = resolvePath(
|
|
17341
|
-
|
|
17466
|
+
path16.join(project_root, "node_modules", "@event4u", "agent-config")
|
|
17342
17467
|
);
|
|
17343
17468
|
const package_resolved = resolvePath(package_root);
|
|
17344
17469
|
if (package_resolved === npm_path) return "npm";
|
|
@@ -17358,7 +17483,7 @@ function ensure_directory(p) {
|
|
|
17358
17483
|
mkdirp(p);
|
|
17359
17484
|
}
|
|
17360
17485
|
function write_file(p, content) {
|
|
17361
|
-
ensure_directory(
|
|
17486
|
+
ensure_directory(path16.dirname(p));
|
|
17362
17487
|
writeText(p, content);
|
|
17363
17488
|
}
|
|
17364
17489
|
function read_json_file(p) {
|
|
@@ -17529,7 +17654,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
|
|
|
17529
17654
|
return rendered + "\n" + suffix;
|
|
17530
17655
|
}
|
|
17531
17656
|
function _migrate_legacy_if_present(project_root, template_body) {
|
|
17532
|
-
const legacy_target =
|
|
17657
|
+
const legacy_target = path16.join(project_root, LEGACY_SETTINGS_FILE);
|
|
17533
17658
|
if (!isFile(legacy_target)) return null;
|
|
17534
17659
|
const legacy_text = readText(legacy_target);
|
|
17535
17660
|
const [values, unknown] = _parse_legacy_settings(legacy_text);
|
|
@@ -17544,9 +17669,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
|
|
|
17544
17669
|
}
|
|
17545
17670
|
}
|
|
17546
17671
|
rendered = _append_unknown_legacy(rendered, values, unknown);
|
|
17547
|
-
const backup_target =
|
|
17672
|
+
const backup_target = path16.join(project_root, LEGACY_BACKUP_FILE);
|
|
17548
17673
|
writeText(backup_target, legacy_text);
|
|
17549
|
-
|
|
17674
|
+
fs18.unlinkSync(legacy_target);
|
|
17550
17675
|
info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
|
|
17551
17676
|
info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
|
|
17552
17677
|
if (unknown.length > 0) {
|
|
@@ -17581,7 +17706,7 @@ function _render_template(template, profile_values) {
|
|
|
17581
17706
|
return body;
|
|
17582
17707
|
}
|
|
17583
17708
|
function _load_valid_user_types(package_root) {
|
|
17584
|
-
const directory =
|
|
17709
|
+
const directory = path16.join(package_root, USER_TYPES_DIR);
|
|
17585
17710
|
if (!isDir(directory)) return [];
|
|
17586
17711
|
return sortedGlobStems(directory, ".yml");
|
|
17587
17712
|
}
|
|
@@ -17638,8 +17763,8 @@ function splitlinesKeepends(text) {
|
|
|
17638
17763
|
}
|
|
17639
17764
|
function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
|
|
17640
17765
|
const target = _canonical_settings_target(project_root);
|
|
17641
|
-
const profile_source =
|
|
17642
|
-
const template_source =
|
|
17766
|
+
const profile_source = path16.join(package_root, "src", "config", "profiles", `${profile}.ini`);
|
|
17767
|
+
const template_source = path16.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
17643
17768
|
if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
|
|
17644
17769
|
if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
|
|
17645
17770
|
const template = readText(template_source);
|
|
@@ -17653,21 +17778,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
17653
17778
|
if (profile_values["rule_loading_tier"] !== profile) {
|
|
17654
17779
|
const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
|
|
17655
17780
|
fail(
|
|
17656
|
-
`Profile preset ${
|
|
17781
|
+
`Profile preset ${path16.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
|
|
17657
17782
|
);
|
|
17658
17783
|
}
|
|
17659
17784
|
profile_values["user_type"] = _validate_user_type(package_root, user_type);
|
|
17660
17785
|
let template_body = _render_template(template, profile_values);
|
|
17661
17786
|
template_body = _inject_packs(template_body, packs ?? []);
|
|
17662
|
-
const legacy_root =
|
|
17787
|
+
const legacy_root = path16.join(project_root, SETTINGS_FILE);
|
|
17663
17788
|
if (isFile(legacy_root) && !pathExists(target)) {
|
|
17664
|
-
mkdirp(
|
|
17789
|
+
mkdirp(path16.dirname(target));
|
|
17665
17790
|
writeText(target, readText(legacy_root));
|
|
17666
|
-
|
|
17791
|
+
fs18.unlinkSync(legacy_root);
|
|
17667
17792
|
success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
|
|
17668
17793
|
return;
|
|
17669
17794
|
}
|
|
17670
|
-
const legacy_target =
|
|
17795
|
+
const legacy_target = path16.join(project_root, LEGACY_SETTINGS_FILE);
|
|
17671
17796
|
if (isFile(legacy_target) && pathExists(target)) {
|
|
17672
17797
|
warn(
|
|
17673
17798
|
`Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
|
|
@@ -17684,7 +17809,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
17684
17809
|
skip(`${SETTINGS_FILE} already exists`);
|
|
17685
17810
|
return;
|
|
17686
17811
|
}
|
|
17687
|
-
mkdirp(
|
|
17812
|
+
mkdirp(path16.dirname(target));
|
|
17688
17813
|
write_file(target, template_body);
|
|
17689
17814
|
const user_type_value = profile_values["user_type"] ?? "";
|
|
17690
17815
|
const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
|
|
@@ -17697,7 +17822,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
17697
17822
|
const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
|
|
17698
17823
|
const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
|
|
17699
17824
|
merge_json_file(
|
|
17700
|
-
|
|
17825
|
+
path16.join(project_root, ".vscode", "settings.json"),
|
|
17701
17826
|
bridge,
|
|
17702
17827
|
force,
|
|
17703
17828
|
".vscode/settings.json"
|
|
@@ -17706,14 +17831,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
17706
17831
|
function ensure_augment_bridge(project_root, force) {
|
|
17707
17832
|
const bridge = { enabledPlugins: { "agent-config@event4u": true } };
|
|
17708
17833
|
return merge_json_file(
|
|
17709
|
-
|
|
17834
|
+
path16.join(project_root, ".augment", "settings.json"),
|
|
17710
17835
|
bridge,
|
|
17711
17836
|
force,
|
|
17712
17837
|
".augment/settings.json"
|
|
17713
17838
|
);
|
|
17714
17839
|
}
|
|
17715
|
-
var AUGMENT_USER_DIR =
|
|
17716
|
-
var AUGMENT_USER_HOOKS_DIR =
|
|
17840
|
+
var AUGMENT_USER_DIR = path16.join(os7.homedir(), ".augment");
|
|
17841
|
+
var AUGMENT_USER_HOOKS_DIR = path16.join(AUGMENT_USER_DIR, "hooks");
|
|
17717
17842
|
var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
|
|
17718
17843
|
var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
17719
17844
|
"augment-chat-history.sh",
|
|
@@ -17729,29 +17854,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
|
|
|
17729
17854
|
["post_tool_use", "PostToolUse"]
|
|
17730
17855
|
];
|
|
17731
17856
|
function _deploy_augment_trampoline(package_root, name, force) {
|
|
17732
|
-
const src =
|
|
17857
|
+
const src = path16.join(package_root, "scripts", "hooks", name);
|
|
17733
17858
|
if (!pathExists(src)) {
|
|
17734
17859
|
skip(`augment trampoline missing in package: ${src}`);
|
|
17735
17860
|
return null;
|
|
17736
17861
|
}
|
|
17737
17862
|
mkdirp(AUGMENT_USER_HOOKS_DIR);
|
|
17738
|
-
const dst =
|
|
17863
|
+
const dst = path16.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
17739
17864
|
const src_text = readText(src);
|
|
17740
17865
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
17741
17866
|
skip(`~/.augment/hooks/${name} already up to date`);
|
|
17742
17867
|
} else {
|
|
17743
17868
|
writeText(dst, src_text);
|
|
17744
|
-
|
|
17869
|
+
fs18.chmodSync(dst, 493);
|
|
17745
17870
|
success(`~/.augment/hooks/${name} installed`);
|
|
17746
17871
|
}
|
|
17747
17872
|
return dst;
|
|
17748
17873
|
}
|
|
17749
17874
|
function _remove_legacy_augment_trampolines() {
|
|
17750
17875
|
for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
|
|
17751
|
-
const legacy =
|
|
17876
|
+
const legacy = path16.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
17752
17877
|
try {
|
|
17753
17878
|
if (isFile(legacy)) {
|
|
17754
|
-
|
|
17879
|
+
fs18.unlinkSync(legacy);
|
|
17755
17880
|
skip(`removed legacy ~/.augment/hooks/${name}`);
|
|
17756
17881
|
}
|
|
17757
17882
|
} catch {
|
|
@@ -17770,7 +17895,7 @@ function ensure_augment_user_hooks(package_root, force) {
|
|
|
17770
17895
|
}
|
|
17771
17896
|
const settings_patch = { hooks: per_event };
|
|
17772
17897
|
return merge_json_file(
|
|
17773
|
-
|
|
17898
|
+
path16.join(AUGMENT_USER_DIR, "settings.json"),
|
|
17774
17899
|
settings_patch,
|
|
17775
17900
|
force,
|
|
17776
17901
|
"~/.augment/settings.json"
|
|
@@ -17795,7 +17920,7 @@ function _heal_legacy_claude_plugin_ids(p) {
|
|
|
17795
17920
|
return removed;
|
|
17796
17921
|
}
|
|
17797
17922
|
function ensure_claude_bridge(project_root, force) {
|
|
17798
|
-
const target =
|
|
17923
|
+
const target = path16.join(project_root, ".claude", "settings.json");
|
|
17799
17924
|
const healed = _heal_legacy_claude_plugin_ids(target);
|
|
17800
17925
|
for (const pid of healed) {
|
|
17801
17926
|
success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
|
|
@@ -17820,29 +17945,29 @@ function ensure_cursor_bridge(project_root, force) {
|
|
|
17820
17945
|
}
|
|
17821
17946
|
const bridge = { version: 1, hooks };
|
|
17822
17947
|
return merge_json_file(
|
|
17823
|
-
|
|
17948
|
+
path16.join(project_root, ".cursor", "hooks.json"),
|
|
17824
17949
|
bridge,
|
|
17825
17950
|
force,
|
|
17826
17951
|
".cursor/hooks.json"
|
|
17827
17952
|
);
|
|
17828
17953
|
}
|
|
17829
|
-
var CURSOR_USER_DIR =
|
|
17830
|
-
var CURSOR_USER_HOOKS_DIR =
|
|
17954
|
+
var CURSOR_USER_DIR = path16.join(os7.homedir(), ".cursor");
|
|
17955
|
+
var CURSOR_USER_HOOKS_DIR = path16.join(CURSOR_USER_DIR, "hooks");
|
|
17831
17956
|
var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
|
|
17832
17957
|
function ensure_cursor_user_hooks(package_root, force) {
|
|
17833
|
-
const src =
|
|
17958
|
+
const src = path16.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
|
|
17834
17959
|
if (!pathExists(src)) {
|
|
17835
17960
|
skip(`cursor trampoline missing in package: ${src}`);
|
|
17836
17961
|
return [];
|
|
17837
17962
|
}
|
|
17838
17963
|
mkdirp(CURSOR_USER_HOOKS_DIR);
|
|
17839
|
-
const dst =
|
|
17964
|
+
const dst = path16.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
|
|
17840
17965
|
const src_text = readText(src);
|
|
17841
17966
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
17842
17967
|
skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
17843
17968
|
} else {
|
|
17844
17969
|
writeText(dst, src_text);
|
|
17845
|
-
|
|
17970
|
+
fs18.chmodSync(dst, 493);
|
|
17846
17971
|
success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
|
|
17847
17972
|
}
|
|
17848
17973
|
const hooks = {};
|
|
@@ -17851,7 +17976,7 @@ function ensure_cursor_user_hooks(package_root, force) {
|
|
|
17851
17976
|
}
|
|
17852
17977
|
const settings_patch = { version: 1, hooks };
|
|
17853
17978
|
return merge_json_file(
|
|
17854
|
-
|
|
17979
|
+
path16.join(CURSOR_USER_DIR, "hooks.json"),
|
|
17855
17980
|
settings_patch,
|
|
17856
17981
|
force,
|
|
17857
17982
|
"~/.cursor/hooks.json"
|
|
@@ -17894,12 +18019,12 @@ exit 0
|
|
|
17894
18019
|
`;
|
|
17895
18020
|
}
|
|
17896
18021
|
function ensure_cline_bridge(project_root, force) {
|
|
17897
|
-
const hooks_dir =
|
|
18022
|
+
const hooks_dir = path16.join(project_root, ".clinerules", "hooks");
|
|
17898
18023
|
mkdirp(hooks_dir);
|
|
17899
18024
|
const workspace_quoted = shlexQuote(resolvePath(project_root));
|
|
17900
18025
|
let written = 0;
|
|
17901
18026
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
17902
|
-
const target =
|
|
18027
|
+
const target = path16.join(hooks_dir, native_event);
|
|
17903
18028
|
const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
|
|
17904
18029
|
if (pathExists(target) && readText(target) === body && !force) {
|
|
17905
18030
|
continue;
|
|
@@ -17909,7 +18034,7 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
17909
18034
|
continue;
|
|
17910
18035
|
}
|
|
17911
18036
|
writeText(target, body);
|
|
17912
|
-
|
|
18037
|
+
fs18.chmodSync(target, 493);
|
|
17913
18038
|
written += 1;
|
|
17914
18039
|
}
|
|
17915
18040
|
if (written) {
|
|
@@ -17918,27 +18043,27 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
17918
18043
|
skip(".clinerules/hooks/ already up to date");
|
|
17919
18044
|
}
|
|
17920
18045
|
}
|
|
17921
|
-
var CLINE_USER_DIR =
|
|
18046
|
+
var CLINE_USER_DIR = path16.join(os7.homedir(), "Documents", "Cline", "Hooks");
|
|
17922
18047
|
var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
|
|
17923
18048
|
function ensure_cline_user_hooks(package_root, force) {
|
|
17924
|
-
const src =
|
|
18049
|
+
const src = path16.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
|
|
17925
18050
|
if (!pathExists(src)) {
|
|
17926
18051
|
skip(`cline trampoline missing in package: ${src}`);
|
|
17927
18052
|
return;
|
|
17928
18053
|
}
|
|
17929
18054
|
mkdirp(CLINE_USER_DIR);
|
|
17930
|
-
const trampoline =
|
|
18055
|
+
const trampoline = path16.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
|
|
17931
18056
|
const src_text = readText(src);
|
|
17932
18057
|
if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
|
|
17933
18058
|
skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
17934
18059
|
} else {
|
|
17935
18060
|
writeText(trampoline, src_text);
|
|
17936
|
-
|
|
18061
|
+
fs18.chmodSync(trampoline, 493);
|
|
17937
18062
|
success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
|
|
17938
18063
|
}
|
|
17939
18064
|
const trampoline_quoted = shlexQuote(trampoline);
|
|
17940
18065
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
17941
|
-
const wrapper =
|
|
18066
|
+
const wrapper = path16.join(CLINE_USER_DIR, native_event);
|
|
17942
18067
|
const body = `#!/usr/bin/env bash
|
|
17943
18068
|
# Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
|
|
17944
18069
|
# User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
|
|
@@ -17948,7 +18073,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
|
|
|
17948
18073
|
continue;
|
|
17949
18074
|
}
|
|
17950
18075
|
writeText(wrapper, body);
|
|
17951
|
-
|
|
18076
|
+
fs18.chmodSync(wrapper, 493);
|
|
17952
18077
|
}
|
|
17953
18078
|
}
|
|
17954
18079
|
var WINDSURF_DISPATCHER_BINDINGS = [
|
|
@@ -17969,29 +18094,29 @@ function ensure_windsurf_bridge(project_root, force) {
|
|
|
17969
18094
|
}
|
|
17970
18095
|
const bridge = { hooks };
|
|
17971
18096
|
return merge_json_file(
|
|
17972
|
-
|
|
18097
|
+
path16.join(project_root, ".windsurf", "hooks.json"),
|
|
17973
18098
|
bridge,
|
|
17974
18099
|
force,
|
|
17975
18100
|
".windsurf/hooks.json"
|
|
17976
18101
|
);
|
|
17977
18102
|
}
|
|
17978
|
-
var WINDSURF_USER_DIR =
|
|
17979
|
-
var WINDSURF_USER_HOOKS_DIR =
|
|
18103
|
+
var WINDSURF_USER_DIR = path16.join(os7.homedir(), ".codeium", "windsurf");
|
|
18104
|
+
var WINDSURF_USER_HOOKS_DIR = path16.join(WINDSURF_USER_DIR, "hooks");
|
|
17980
18105
|
var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
|
|
17981
18106
|
function ensure_windsurf_user_hooks(package_root, force) {
|
|
17982
|
-
const src =
|
|
18107
|
+
const src = path16.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
17983
18108
|
if (!pathExists(src)) {
|
|
17984
18109
|
skip(`windsurf trampoline missing in package: ${src}`);
|
|
17985
18110
|
return [];
|
|
17986
18111
|
}
|
|
17987
18112
|
mkdirp(WINDSURF_USER_HOOKS_DIR);
|
|
17988
|
-
const dst =
|
|
18113
|
+
const dst = path16.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
17989
18114
|
const src_text = readText(src);
|
|
17990
18115
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
17991
18116
|
skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
17992
18117
|
} else {
|
|
17993
18118
|
writeText(dst, src_text);
|
|
17994
|
-
|
|
18119
|
+
fs18.chmodSync(dst, 493);
|
|
17995
18120
|
success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
|
|
17996
18121
|
}
|
|
17997
18122
|
const hooks = {};
|
|
@@ -18003,7 +18128,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
|
|
|
18003
18128
|
}
|
|
18004
18129
|
const settings_patch = { hooks };
|
|
18005
18130
|
return merge_json_file(
|
|
18006
|
-
|
|
18131
|
+
path16.join(WINDSURF_USER_DIR, "hooks.json"),
|
|
18007
18132
|
settings_patch,
|
|
18008
18133
|
force,
|
|
18009
18134
|
"~/.codeium/windsurf/hooks.json"
|
|
@@ -18032,43 +18157,43 @@ function _gemini_hooks_dict(command_factory) {
|
|
|
18032
18157
|
function ensure_gemini_bridge(project_root, force) {
|
|
18033
18158
|
const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
|
|
18034
18159
|
return merge_json_file(
|
|
18035
|
-
|
|
18160
|
+
path16.join(project_root, ".gemini", "settings.json"),
|
|
18036
18161
|
bridge,
|
|
18037
18162
|
force,
|
|
18038
18163
|
".gemini/settings.json"
|
|
18039
18164
|
);
|
|
18040
18165
|
}
|
|
18041
|
-
var GEMINI_USER_DIR =
|
|
18042
|
-
var GEMINI_USER_HOOKS_DIR =
|
|
18166
|
+
var GEMINI_USER_DIR = path16.join(os7.homedir(), ".gemini");
|
|
18167
|
+
var GEMINI_USER_HOOKS_DIR = path16.join(GEMINI_USER_DIR, "hooks");
|
|
18043
18168
|
var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
|
|
18044
18169
|
function ensure_gemini_user_hooks(package_root, force) {
|
|
18045
|
-
const src =
|
|
18170
|
+
const src = path16.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
|
|
18046
18171
|
if (!pathExists(src)) {
|
|
18047
18172
|
skip(`gemini trampoline missing in package: ${src}`);
|
|
18048
18173
|
return [];
|
|
18049
18174
|
}
|
|
18050
18175
|
mkdirp(GEMINI_USER_HOOKS_DIR);
|
|
18051
|
-
const dst =
|
|
18176
|
+
const dst = path16.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
|
|
18052
18177
|
const src_text = readText(src);
|
|
18053
18178
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
18054
18179
|
skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
18055
18180
|
} else {
|
|
18056
18181
|
writeText(dst, src_text);
|
|
18057
|
-
|
|
18182
|
+
fs18.chmodSync(dst, 493);
|
|
18058
18183
|
success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
|
|
18059
18184
|
}
|
|
18060
18185
|
const settings_patch = {
|
|
18061
18186
|
hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
|
|
18062
18187
|
};
|
|
18063
18188
|
return merge_json_file(
|
|
18064
|
-
|
|
18189
|
+
path16.join(GEMINI_USER_DIR, "settings.json"),
|
|
18065
18190
|
settings_patch,
|
|
18066
18191
|
force,
|
|
18067
18192
|
"~/.gemini/settings.json"
|
|
18068
18193
|
);
|
|
18069
18194
|
}
|
|
18070
18195
|
function ensure_copilot_bridge(project_root, force) {
|
|
18071
|
-
const target =
|
|
18196
|
+
const target = path16.join(project_root, ".github", "plugin", "marketplace.json");
|
|
18072
18197
|
const bridge = {
|
|
18073
18198
|
marketplace: {
|
|
18074
18199
|
name: "event4u-agent-marketplace",
|
|
@@ -18111,7 +18236,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
|
|
|
18111
18236
|
Run \`./agent-config --help\` for available commands.
|
|
18112
18237
|
`;
|
|
18113
18238
|
function ensure_roocode_bridge(project_root, force) {
|
|
18114
|
-
const target =
|
|
18239
|
+
const target = path16.join(project_root, ".roo", "rules", "agent-config.md");
|
|
18115
18240
|
if (pathExists(target) && !force) {
|
|
18116
18241
|
skip(".roo/rules/agent-config.md already exists");
|
|
18117
18242
|
return;
|
|
@@ -18133,7 +18258,7 @@ To wire Claude Desktop to this project's rules, run:
|
|
|
18133
18258
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18134
18259
|
`;
|
|
18135
18260
|
function ensure_claude_desktop_bridge(project_root, force) {
|
|
18136
|
-
const target =
|
|
18261
|
+
const target = path16.join(project_root, ".claude-desktop", "agent-config.md");
|
|
18137
18262
|
if (pathExists(target) && !force) {
|
|
18138
18263
|
skip(".claude-desktop/agent-config.md already exists");
|
|
18139
18264
|
return;
|
|
@@ -18158,7 +18283,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
|
|
|
18158
18283
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18159
18284
|
`;
|
|
18160
18285
|
function ensure_aider_bridge(project_root, force) {
|
|
18161
|
-
const target =
|
|
18286
|
+
const target = path16.join(project_root, ".aider", "agent-config.md");
|
|
18162
18287
|
if (pathExists(target) && !force) {
|
|
18163
18288
|
skip(".aider/agent-config.md already exists");
|
|
18164
18289
|
return;
|
|
@@ -18177,7 +18302,7 @@ developers where the rules and skills live.
|
|
|
18177
18302
|
Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
|
|
18178
18303
|
`;
|
|
18179
18304
|
function ensure_codex_bridge(project_root, force) {
|
|
18180
|
-
const target =
|
|
18305
|
+
const target = path16.join(project_root, ".codex", "agent-config.md");
|
|
18181
18306
|
if (pathExists(target) && !force) {
|
|
18182
18307
|
skip(".codex/agent-config.md already exists");
|
|
18183
18308
|
return;
|
|
@@ -18195,7 +18320,7 @@ rules per session. The canonical rule and skill source lives under
|
|
|
18195
18320
|
orientation).
|
|
18196
18321
|
`;
|
|
18197
18322
|
function ensure_continue_bridge(project_root, force) {
|
|
18198
|
-
const target =
|
|
18323
|
+
const target = path16.join(project_root, ".continue", "rules", "agent-config.md");
|
|
18199
18324
|
if (pathExists(target) && !force) {
|
|
18200
18325
|
skip(".continue/rules/agent-config.md already exists");
|
|
18201
18326
|
return;
|
|
@@ -18226,7 +18351,7 @@ orientation).
|
|
|
18226
18351
|
See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
|
|
18227
18352
|
`;
|
|
18228
18353
|
function ensure_kilocode_bridge(project_root, force) {
|
|
18229
|
-
const target =
|
|
18354
|
+
const target = path16.join(project_root, ".kilocode", "rules", "agent-config.md");
|
|
18230
18355
|
if (pathExists(target) && !force) {
|
|
18231
18356
|
skip(".kilocode/rules/agent-config.md already exists");
|
|
18232
18357
|
return;
|
|
@@ -18253,7 +18378,7 @@ canonical source (or symlink it):
|
|
|
18253
18378
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18254
18379
|
`;
|
|
18255
18380
|
function ensure_zed_bridge(project_root, force) {
|
|
18256
|
-
const target =
|
|
18381
|
+
const target = path16.join(project_root, ".zed", "agent-config.md");
|
|
18257
18382
|
if (pathExists(target) && !force) {
|
|
18258
18383
|
skip(".zed/agent-config.md already exists");
|
|
18259
18384
|
return;
|
|
@@ -18274,7 +18399,7 @@ rules into your JetBrains profile.
|
|
|
18274
18399
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18275
18400
|
`;
|
|
18276
18401
|
function ensure_jetbrains_bridge(project_root, force) {
|
|
18277
|
-
const target =
|
|
18402
|
+
const target = path16.join(project_root, ".jetbrains", "agent-config.md");
|
|
18278
18403
|
if (pathExists(target) && !force) {
|
|
18279
18404
|
skip(".jetbrains/agent-config.md already exists");
|
|
18280
18405
|
return;
|
|
@@ -18305,7 +18430,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
|
|
|
18305
18430
|
See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
|
|
18306
18431
|
`;
|
|
18307
18432
|
function ensure_kiro_bridge(project_root, force) {
|
|
18308
|
-
const target =
|
|
18433
|
+
const target = path16.join(project_root, ".kiro", "steering", "agent-config.md");
|
|
18309
18434
|
if (pathExists(target) && !force) {
|
|
18310
18435
|
skip(".kiro/steering/agent-config.md already exists");
|
|
18311
18436
|
return;
|
|
@@ -18331,35 +18456,35 @@ var SMOKE_BRIDGE_PATHS = {
|
|
|
18331
18456
|
};
|
|
18332
18457
|
function dirHasEntries(p) {
|
|
18333
18458
|
try {
|
|
18334
|
-
return
|
|
18459
|
+
return fs18.readdirSync(p).length > 0;
|
|
18335
18460
|
} catch {
|
|
18336
18461
|
return false;
|
|
18337
18462
|
}
|
|
18338
18463
|
}
|
|
18339
18464
|
function _resolve_tsx_invocation(scriptPath, scriptArgs) {
|
|
18340
18465
|
const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
18341
|
-
let dir =
|
|
18466
|
+
let dir = path16.dirname(scriptPath);
|
|
18342
18467
|
for (; ; ) {
|
|
18343
|
-
const candidate =
|
|
18468
|
+
const candidate = path16.join(dir, "node_modules", ".bin", binName);
|
|
18344
18469
|
if (isFile(candidate)) {
|
|
18345
18470
|
return { command: candidate, args: [scriptPath, ...scriptArgs] };
|
|
18346
18471
|
}
|
|
18347
|
-
const parent =
|
|
18472
|
+
const parent = path16.dirname(dir);
|
|
18348
18473
|
if (parent === dir) break;
|
|
18349
18474
|
dir = parent;
|
|
18350
18475
|
}
|
|
18351
18476
|
return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
|
|
18352
18477
|
}
|
|
18353
18478
|
function _smoke_test_hooks(project_root, package_root) {
|
|
18354
|
-
const dispatcher =
|
|
18355
|
-
const manifest =
|
|
18479
|
+
const dispatcher = path16.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
|
|
18480
|
+
const manifest = path16.join(package_root, "scripts", "hook_manifest.yaml");
|
|
18356
18481
|
if (!isFile(dispatcher) || !isFile(manifest)) return 0;
|
|
18357
18482
|
const failed = [];
|
|
18358
18483
|
const skipped = [];
|
|
18359
18484
|
const passed = [];
|
|
18360
18485
|
for (const [platform, native] of SMOKE_PROBE_EVENTS) {
|
|
18361
18486
|
const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
|
|
18362
|
-
const bridge_path = rel_bridge ?
|
|
18487
|
+
const bridge_path = rel_bridge ? path16.join(project_root, rel_bridge) : null;
|
|
18363
18488
|
const bridge_present = Boolean(
|
|
18364
18489
|
bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
|
|
18365
18490
|
);
|
|
@@ -18559,9 +18684,9 @@ To remove this marker, delete this file.
|
|
|
18559
18684
|
`;
|
|
18560
18685
|
}
|
|
18561
18686
|
var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
|
|
18562
|
-
var GLOBAL_ROOT =
|
|
18563
|
-
var GLOBAL_USER_SETTINGS_PATH =
|
|
18564
|
-
var GLOBAL_AGENT_SETTINGS_PATH =
|
|
18687
|
+
var GLOBAL_ROOT = path16.join(os7.homedir(), ".event4u", "agent-config");
|
|
18688
|
+
var GLOBAL_USER_SETTINGS_PATH = path16.join(GLOBAL_ROOT, ".agent-user.yml");
|
|
18689
|
+
var GLOBAL_AGENT_SETTINGS_PATH = path16.join(GLOBAL_ROOT, ".agent-settings.yml");
|
|
18565
18690
|
function _bridge_marker(tool_id, scope) {
|
|
18566
18691
|
if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
|
|
18567
18692
|
return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
|
|
@@ -18610,7 +18735,7 @@ function _load_yaml_doc(p) {
|
|
|
18610
18735
|
return _isPlainObject2(data) ? data : {};
|
|
18611
18736
|
}
|
|
18612
18737
|
function _load_default_settings(package_root) {
|
|
18613
|
-
const template_source =
|
|
18738
|
+
const template_source = path16.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
18614
18739
|
if (!pathExists(template_source)) return {};
|
|
18615
18740
|
let text;
|
|
18616
18741
|
try {
|
|
@@ -18622,6 +18747,58 @@ function _load_default_settings(package_root) {
|
|
|
18622
18747
|
const data = yamlSafeLoad2(rendered);
|
|
18623
18748
|
return _isPlainObject2(data) ? data : {};
|
|
18624
18749
|
}
|
|
18750
|
+
var RULE_LAYER_CHOICES = ["global", "project", "both-acknowledged"];
|
|
18751
|
+
function _suppress_rule_layer(project_root, suppress_dir) {
|
|
18752
|
+
const target = path16.join(project_root, ".claude", "settings.local.json");
|
|
18753
|
+
const existing = pathExists(target) ? read_json_file(target) : {};
|
|
18754
|
+
let real_dir = suppress_dir;
|
|
18755
|
+
try {
|
|
18756
|
+
real_dir = fs18.realpathSync(suppress_dir);
|
|
18757
|
+
} catch {
|
|
18758
|
+
real_dir = suppress_dir;
|
|
18759
|
+
}
|
|
18760
|
+
const entry = claudeMdExcludesGlob(real_dir);
|
|
18761
|
+
const merged = mergeClaudeMdExcludes(existing["claudeMdExcludes"], entry);
|
|
18762
|
+
if (JSON.stringify(existing["claudeMdExcludes"] ?? null) === JSON.stringify(merged)) return;
|
|
18763
|
+
write_json_file(target, { ...existing, claudeMdExcludes: merged });
|
|
18764
|
+
success(`.claude/settings.local.json: claudeMdExcludes += ${entry}`);
|
|
18765
|
+
}
|
|
18766
|
+
function _gate_rule_layer_overlap(project_root, layer, dry_run) {
|
|
18767
|
+
const global_dir = path16.join(os7.homedir(), ".claude", "rules");
|
|
18768
|
+
const project_dir = path16.join(project_root, ".claude", "rules");
|
|
18769
|
+
const g = readRuleLayer(global_dir);
|
|
18770
|
+
const p = readRuleLayer(project_dir);
|
|
18771
|
+
if (g === null || p === null) return true;
|
|
18772
|
+
const report = compareLayers(g.files, p.files);
|
|
18773
|
+
if (report.overlap.length === 0) return true;
|
|
18774
|
+
if (layer === null) {
|
|
18775
|
+
warn(
|
|
18776
|
+
`rule layers overlap: ${report.overlap.length} rule(s) are in BOTH ${global_dir} and ${project_dir}, so Claude Code loads them twice (${report.redundant_chars} chars of standing context per session).`
|
|
18777
|
+
);
|
|
18778
|
+
info("Pick which layer owns the corpus \u2014 no file is deleted either way:");
|
|
18779
|
+
info(` --layer=global keep ${global_dir}, suppress the project one`);
|
|
18780
|
+
info(` --layer=project keep ${project_dir}, suppress the global one`);
|
|
18781
|
+
info(" --layer=both-acknowledged keep both and pay the doubled context knowingly");
|
|
18782
|
+
return false;
|
|
18783
|
+
}
|
|
18784
|
+
const action = decideLayerAction(
|
|
18785
|
+
report,
|
|
18786
|
+
layer,
|
|
18787
|
+
global_dir,
|
|
18788
|
+
project_dir
|
|
18789
|
+
);
|
|
18790
|
+
if (action.refresh_required && action.suppress_dir !== null) {
|
|
18791
|
+
warn(
|
|
18792
|
+
`${report.divergent.length} shared rule(s) differ in body between the two layers (${report.divergent.slice(0, 5).join(", ")}${report.divergent.length > 5 ? ", \u2026" : ""}). Suppressing a layer now would drop whatever only that copy carries. Re-run the projection first, or pass --layer=both-acknowledged.`
|
|
18793
|
+
);
|
|
18794
|
+
return false;
|
|
18795
|
+
}
|
|
18796
|
+
info(action.note);
|
|
18797
|
+
if (action.suppress_dir !== null && !dry_run) {
|
|
18798
|
+
_suppress_rule_layer(project_root, action.suppress_dir);
|
|
18799
|
+
}
|
|
18800
|
+
return true;
|
|
18801
|
+
}
|
|
18625
18802
|
function _resolve_scope(opts, detected, detect_reason, custom_path) {
|
|
18626
18803
|
if (opts.scope === "project") return "project";
|
|
18627
18804
|
if (opts.scope === "global") return "global";
|
|
@@ -18698,9 +18875,9 @@ function detect_scope(cwd) {
|
|
|
18698
18875
|
if (pathExists(_resolve_settings_read(cwd))) {
|
|
18699
18876
|
return ["project", `existing ${SETTINGS_FILE}`];
|
|
18700
18877
|
}
|
|
18701
|
-
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(
|
|
18702
|
-
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(
|
|
18703
|
-
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(
|
|
18878
|
+
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path16.join(cwd, m))) ?? null;
|
|
18879
|
+
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path16.join(cwd, d))) ?? null;
|
|
18880
|
+
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path16.join(cwd, f))) ?? null;
|
|
18704
18881
|
if (has_manifest && (has_ai_dir || has_ai_file)) {
|
|
18705
18882
|
const marker = has_ai_dir || has_ai_file;
|
|
18706
18883
|
return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
|
|
@@ -18721,7 +18898,7 @@ function readLineSyncRaw(promptText) {
|
|
|
18721
18898
|
for (; ; ) {
|
|
18722
18899
|
let n;
|
|
18723
18900
|
try {
|
|
18724
|
-
n =
|
|
18901
|
+
n = fs18.readSync(0, buf, 0, 1, null);
|
|
18725
18902
|
} catch (err) {
|
|
18726
18903
|
const code = err.code;
|
|
18727
18904
|
if (code === "EAGAIN") {
|
|
@@ -18796,8 +18973,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
|
|
|
18796
18973
|
const marker = _bridge_marker(tool_id, scope);
|
|
18797
18974
|
if (!marker) continue;
|
|
18798
18975
|
let marker_path = marker;
|
|
18799
|
-
if (!
|
|
18800
|
-
marker_path =
|
|
18976
|
+
if (!path16.isAbsolute(marker_path)) {
|
|
18977
|
+
marker_path = path16.join(project_root, marker_path);
|
|
18801
18978
|
}
|
|
18802
18979
|
out[tool_id] = [_file_entry(marker_path, "bridge", false)];
|
|
18803
18980
|
}
|
|
@@ -18836,26 +19013,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
|
|
|
18836
19013
|
}
|
|
18837
19014
|
write_manifest(target, version, entries);
|
|
18838
19015
|
if (!state.QUIET) {
|
|
18839
|
-
const rel = isRelativeTo(target, project_root) ?
|
|
19016
|
+
const rel = isRelativeTo(target, project_root) ? path16.relative(project_root, target) : target;
|
|
18840
19017
|
info(`Manifest updated: ${rel}`);
|
|
18841
19018
|
}
|
|
18842
19019
|
return 0;
|
|
18843
19020
|
}
|
|
18844
19021
|
function isRelativeTo(child, parent) {
|
|
18845
|
-
const rel =
|
|
18846
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
19022
|
+
const rel = path16.relative(parent, child);
|
|
19023
|
+
return rel === "" || !rel.startsWith("..") && !path16.isAbsolute(rel);
|
|
18847
19024
|
}
|
|
18848
19025
|
function _resolve_package_root_for_global() {
|
|
18849
19026
|
const here = resolvePath(_HERE2);
|
|
18850
|
-
const candidate =
|
|
18851
|
-
if (!pathExists(
|
|
19027
|
+
const candidate = path16.dirname(path16.dirname(path16.dirname(here)));
|
|
19028
|
+
if (!pathExists(path16.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
|
|
18852
19029
|
fail(
|
|
18853
19030
|
`Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
|
|
18854
19031
|
);
|
|
18855
19032
|
}
|
|
18856
19033
|
return candidate;
|
|
18857
19034
|
}
|
|
18858
|
-
var CONSUMER_BRIDGE_MARKER_RELPATH =
|
|
19035
|
+
var CONSUMER_BRIDGE_MARKER_RELPATH = path16.join("agents", ".event4u-bridge.yml");
|
|
18859
19036
|
var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
18860
19037
|
var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
|
|
18861
19038
|
var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
|
|
@@ -18863,7 +19040,7 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
18863
19040
|
if (process3.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
|
|
18864
19041
|
return [false, "consumer-mode-override"];
|
|
18865
19042
|
}
|
|
18866
|
-
const pkg_json =
|
|
19043
|
+
const pkg_json = path16.join(project_root, "package.json");
|
|
18867
19044
|
if (isFile(pkg_json)) {
|
|
18868
19045
|
let data = {};
|
|
18869
19046
|
try {
|
|
@@ -18875,18 +19052,18 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
18875
19052
|
return [true, "package.json:name"];
|
|
18876
19053
|
}
|
|
18877
19054
|
}
|
|
18878
|
-
if (isDir(
|
|
19055
|
+
if (isDir(path16.join(project_root, ".agent-src.uncondensed"))) {
|
|
18879
19056
|
return [true, ".agent-src.uncondensed/"];
|
|
18880
19057
|
}
|
|
18881
|
-
const packages_dir =
|
|
19058
|
+
const packages_dir = path16.join(project_root, "packages");
|
|
18882
19059
|
if (isDir(packages_dir)) {
|
|
18883
|
-
for (const child of
|
|
18884
|
-
if (isDir(
|
|
19060
|
+
for (const child of fs18.readdirSync(packages_dir)) {
|
|
19061
|
+
if (isDir(path16.join(packages_dir, child, ".agent-src.uncondensed"))) {
|
|
18885
19062
|
return [true, `packages/${child}/.agent-src.uncondensed/`];
|
|
18886
19063
|
}
|
|
18887
19064
|
}
|
|
18888
19065
|
}
|
|
18889
|
-
const installer_self =
|
|
19066
|
+
const installer_self = path16.join(project_root, "scripts", "install.py");
|
|
18890
19067
|
try {
|
|
18891
19068
|
if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE2)) {
|
|
18892
19069
|
return [true, "src/scripts/install.py (self)"];
|
|
@@ -18906,17 +19083,17 @@ function _detect_legacy_for_migration(project_root) {
|
|
|
18906
19083
|
}
|
|
18907
19084
|
return [];
|
|
18908
19085
|
}
|
|
18909
|
-
if (isFile(
|
|
19086
|
+
if (isFile(path16.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
|
|
18910
19087
|
const found = [];
|
|
18911
19088
|
for (const name of MIGRATE_LEGACY_YAML_FILES) {
|
|
18912
|
-
if (isFile(
|
|
19089
|
+
if (isFile(path16.join(project_root, name))) {
|
|
18913
19090
|
found.push(name);
|
|
18914
|
-
} else if (isFile(
|
|
19091
|
+
} else if (isFile(path16.join(project_root, "settings", name))) {
|
|
18915
19092
|
found.push(`settings/${name}`);
|
|
18916
19093
|
}
|
|
18917
19094
|
}
|
|
18918
19095
|
for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
|
|
18919
|
-
const p =
|
|
19096
|
+
const p = path16.join(project_root, name);
|
|
18920
19097
|
if (isDir(p) && !isSymlink(p)) {
|
|
18921
19098
|
found.push(`${name}/`);
|
|
18922
19099
|
}
|
|
@@ -18928,7 +19105,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
|
|
|
18928
19105
|
process3.stdout.write("\n");
|
|
18929
19106
|
warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
|
|
18930
19107
|
for (const rel of artefacts) {
|
|
18931
|
-
info(` ${
|
|
19108
|
+
info(` ${path16.join(project_root, rel)}`);
|
|
18932
19109
|
}
|
|
18933
19110
|
info("The unified `agent-config migrate` sweeps these in one pass.");
|
|
18934
19111
|
info("The wizard recreates fresh config afterwards.");
|
|
@@ -18959,20 +19136,20 @@ function _run_migrate_to_global(project_root) {
|
|
|
18959
19136
|
function _format_global_root_for_marker(global_root) {
|
|
18960
19137
|
const home = resolvePath(os7.homedir());
|
|
18961
19138
|
const resolved = resolvePath(global_root);
|
|
18962
|
-
const rel =
|
|
18963
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
19139
|
+
const rel = path16.relative(home, resolved);
|
|
19140
|
+
if (rel === "" || rel.startsWith("..") || path16.isAbsolute(rel)) {
|
|
18964
19141
|
return global_root;
|
|
18965
19142
|
}
|
|
18966
|
-
return `~/${rel.split(
|
|
19143
|
+
return `~/${rel.split(path16.sep).join("/")}`;
|
|
18967
19144
|
}
|
|
18968
19145
|
function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
|
|
18969
19146
|
const env_map = env ?? process3.env;
|
|
18970
19147
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
|
|
18971
|
-
if (isDir(
|
|
18972
|
-
const target =
|
|
19148
|
+
if (isDir(path16.join(project_root, ".agent-src.uncondensed"))) return null;
|
|
19149
|
+
const target = path16.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
|
|
18973
19150
|
if (!isFile(target)) return null;
|
|
18974
19151
|
try {
|
|
18975
|
-
|
|
19152
|
+
fs18.rmSync(target);
|
|
18976
19153
|
} catch {
|
|
18977
19154
|
return null;
|
|
18978
19155
|
}
|
|
@@ -18986,7 +19163,7 @@ var PROJECT_ANCHOR_TOOLS = {
|
|
|
18986
19163
|
function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
|
|
18987
19164
|
const env_map = env ?? process3.env;
|
|
18988
19165
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
|
|
18989
|
-
if (isDir(
|
|
19166
|
+
if (isDir(path16.join(project_root, ".agent-src.uncondensed"))) return [];
|
|
18990
19167
|
const global_root_str = _format_global_root_for_marker(
|
|
18991
19168
|
event4u_root(env_map)
|
|
18992
19169
|
);
|
|
@@ -18995,8 +19172,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
|
|
|
18995
19172
|
for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
|
|
18996
19173
|
const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
|
|
18997
19174
|
if (!tools.has(tool_id)) continue;
|
|
18998
|
-
const target =
|
|
18999
|
-
mkdirp(
|
|
19175
|
+
const target = path16.join(project_root, rel_path);
|
|
19176
|
+
mkdirp(path16.dirname(target));
|
|
19000
19177
|
const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
|
|
19001
19178
|
# Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
|
|
19002
19179
|
# Tool: ${tool_id}. Resolves the global install directly \u2014 no
|
|
@@ -19014,7 +19191,7 @@ installed_at: ${stamp}
|
|
|
19014
19191
|
}
|
|
19015
19192
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
19016
19193
|
function _inject_package_tag(target, source, package_root) {
|
|
19017
|
-
if (
|
|
19194
|
+
if (path16.extname(target) !== ".md") return;
|
|
19018
19195
|
let text;
|
|
19019
19196
|
try {
|
|
19020
19197
|
text = readText(target);
|
|
@@ -19042,8 +19219,8 @@ function _inject_package_tag(target, source, package_root) {
|
|
|
19042
19219
|
resolved_src = source;
|
|
19043
19220
|
}
|
|
19044
19221
|
if (package_root !== null) {
|
|
19045
|
-
const rel =
|
|
19046
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
19222
|
+
const rel = path16.relative(resolvePath(package_root), resolved_src);
|
|
19223
|
+
if (rel !== "" && !rel.startsWith("..") && !path16.isAbsolute(rel)) {
|
|
19047
19224
|
source_value = rel;
|
|
19048
19225
|
} else {
|
|
19049
19226
|
source_value = resolved_src;
|
|
@@ -19078,7 +19255,7 @@ function _escapes_package_root(resolved, package_root) {
|
|
|
19078
19255
|
if (package_root === null) return false;
|
|
19079
19256
|
let root;
|
|
19080
19257
|
try {
|
|
19081
|
-
root =
|
|
19258
|
+
root = fs18.realpathSync(package_root);
|
|
19082
19259
|
} catch {
|
|
19083
19260
|
return false;
|
|
19084
19261
|
}
|
|
@@ -19093,7 +19270,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19093
19270
|
if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
|
|
19094
19271
|
let resolved_src = src;
|
|
19095
19272
|
try {
|
|
19096
|
-
resolved_src =
|
|
19273
|
+
resolved_src = fs18.realpathSync(src);
|
|
19097
19274
|
} catch {
|
|
19098
19275
|
resolved_src = src;
|
|
19099
19276
|
}
|
|
@@ -19101,10 +19278,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19101
19278
|
warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
|
|
19102
19279
|
return [0, 0, written_paths];
|
|
19103
19280
|
}
|
|
19104
|
-
mkdirp(
|
|
19281
|
+
mkdirp(path16.dirname(dest));
|
|
19105
19282
|
const decision = _resolve_file_conflict(dest, force);
|
|
19106
19283
|
if (decision === "skip") return [0, 1, written_paths];
|
|
19107
|
-
|
|
19284
|
+
fs18.copyFileSync(src, dest);
|
|
19108
19285
|
_inject_package_tag(dest, src, package_root);
|
|
19109
19286
|
written_paths.push(dest);
|
|
19110
19287
|
return [1, 0, written_paths];
|
|
@@ -19112,11 +19289,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19112
19289
|
mkdirp(dest);
|
|
19113
19290
|
const walk = (node) => {
|
|
19114
19291
|
const acc = [];
|
|
19115
|
-
const names =
|
|
19292
|
+
const names = fs18.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
19116
19293
|
for (const name of names) {
|
|
19117
|
-
const entry =
|
|
19294
|
+
const entry = path16.join(node, name);
|
|
19118
19295
|
acc.push(entry);
|
|
19119
|
-
const lst =
|
|
19296
|
+
const lst = fs18.lstatSync(entry);
|
|
19120
19297
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
19121
19298
|
acc.push(...walk(entry));
|
|
19122
19299
|
}
|
|
@@ -19124,9 +19301,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19124
19301
|
return acc;
|
|
19125
19302
|
};
|
|
19126
19303
|
for (const entry of walk(src)) {
|
|
19127
|
-
const rel =
|
|
19128
|
-
const target =
|
|
19129
|
-
const lst =
|
|
19304
|
+
const rel = path16.relative(src, entry);
|
|
19305
|
+
const target = path16.join(dest, rel);
|
|
19306
|
+
const lst = fs18.lstatSync(entry);
|
|
19130
19307
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
19131
19308
|
mkdirp(target);
|
|
19132
19309
|
continue;
|
|
@@ -19134,8 +19311,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19134
19311
|
let resolvedIsDir = false;
|
|
19135
19312
|
let resolved = entry;
|
|
19136
19313
|
try {
|
|
19137
|
-
resolved =
|
|
19138
|
-
resolvedIsDir =
|
|
19314
|
+
resolved = fs18.realpathSync(entry);
|
|
19315
|
+
resolvedIsDir = fs18.statSync(entry).isDirectory();
|
|
19139
19316
|
} catch {
|
|
19140
19317
|
resolvedIsDir = false;
|
|
19141
19318
|
}
|
|
@@ -19165,8 +19342,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19165
19342
|
skipped += 1;
|
|
19166
19343
|
continue;
|
|
19167
19344
|
}
|
|
19168
|
-
mkdirp(
|
|
19169
|
-
|
|
19345
|
+
mkdirp(path16.dirname(target));
|
|
19346
|
+
fs18.copyFileSync(resolved, target);
|
|
19170
19347
|
_inject_package_tag(target, resolved, package_root);
|
|
19171
19348
|
written += 1;
|
|
19172
19349
|
written_paths.push(target);
|
|
@@ -19178,7 +19355,7 @@ function _claude_desktop_bundles_dir() {
|
|
|
19178
19355
|
}
|
|
19179
19356
|
function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
|
|
19180
19357
|
const anchor = expanduser6(USER_SCOPE_PATHS["claude-desktop"]);
|
|
19181
|
-
const target =
|
|
19358
|
+
const target = path16.join(anchor, "agent-config.md");
|
|
19182
19359
|
mkdirp(anchor);
|
|
19183
19360
|
const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
|
|
19184
19361
|
writeText(target, body);
|
|
@@ -19202,23 +19379,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
19202
19379
|
const wrapped = [];
|
|
19203
19380
|
const collisions = [];
|
|
19204
19381
|
const reserved = [];
|
|
19205
|
-
const commands_dir =
|
|
19382
|
+
const commands_dir = path16.join(anchor, "commands");
|
|
19206
19383
|
let flat_entries = [];
|
|
19207
19384
|
try {
|
|
19208
|
-
flat_entries =
|
|
19385
|
+
flat_entries = fs18.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
|
|
19209
19386
|
} catch {
|
|
19210
19387
|
}
|
|
19211
19388
|
for (const fname of flat_entries.sort()) {
|
|
19212
19389
|
const slug = fname.slice(0, -".md".length);
|
|
19213
19390
|
if (!is_claude_builtin_name(slug)) continue;
|
|
19214
|
-
|
|
19391
|
+
fs18.rmSync(path16.join(commands_dir, fname), { force: true });
|
|
19215
19392
|
current_files.delete(`commands/${fname}`);
|
|
19216
19393
|
reserved.push(slug);
|
|
19217
19394
|
}
|
|
19218
19395
|
const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
|
|
19219
19396
|
try {
|
|
19220
19397
|
const manifest = JSON.parse(
|
|
19221
|
-
|
|
19398
|
+
fs18.readFileSync(path16.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
|
|
19222
19399
|
);
|
|
19223
19400
|
for (const a of manifest.artefacts ?? []) {
|
|
19224
19401
|
if (a.category !== "command" || typeof a.slug !== "string") continue;
|
|
@@ -19229,22 +19406,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
19229
19406
|
}
|
|
19230
19407
|
for (const slug of [...eligible].sort()) {
|
|
19231
19408
|
const flat_rel = `commands/${slug}.md`;
|
|
19232
|
-
const flat_abs =
|
|
19233
|
-
if (!
|
|
19234
|
-
const skill_dir =
|
|
19235
|
-
if (
|
|
19409
|
+
const flat_abs = path16.join(anchor, "commands", `${slug}.md`);
|
|
19410
|
+
if (!fs18.existsSync(flat_abs)) continue;
|
|
19411
|
+
const skill_dir = path16.join(anchor, "skills", slug);
|
|
19412
|
+
if (fs18.existsSync(skill_dir)) {
|
|
19236
19413
|
collisions.push(slug);
|
|
19237
19414
|
continue;
|
|
19238
19415
|
}
|
|
19239
|
-
let body =
|
|
19416
|
+
let body = fs18.readFileSync(flat_abs, "utf8");
|
|
19240
19417
|
if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
|
|
19241
19418
|
body = body.replace("---\n", `---
|
|
19242
19419
|
name: ${slug}
|
|
19243
19420
|
`);
|
|
19244
19421
|
}
|
|
19245
|
-
|
|
19246
|
-
|
|
19247
|
-
|
|
19422
|
+
fs18.mkdirSync(skill_dir, { recursive: true });
|
|
19423
|
+
fs18.writeFileSync(path16.join(skill_dir, "SKILL.md"), body, "utf8");
|
|
19424
|
+
fs18.rmSync(flat_abs, { force: true });
|
|
19248
19425
|
current_files.delete(flat_rel);
|
|
19249
19426
|
current_files.add(`skills/${slug}/SKILL.md`);
|
|
19250
19427
|
wrapped.push(slug);
|
|
@@ -19276,8 +19453,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
19276
19453
|
const written_paths = [];
|
|
19277
19454
|
let current_files = /* @__PURE__ */ new Set();
|
|
19278
19455
|
for (const [src_rel, dest_sub] of plan) {
|
|
19279
|
-
const src =
|
|
19280
|
-
const dest = dest_sub ?
|
|
19456
|
+
const src = path16.join(package_root, src_rel);
|
|
19457
|
+
const dest = dest_sub ? path16.join(anchor, dest_sub) : anchor;
|
|
19281
19458
|
const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
|
|
19282
19459
|
const [w, s, paths] = _copy_dir_dereferencing_symlinks(
|
|
19283
19460
|
src,
|
|
@@ -19351,10 +19528,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
19351
19528
|
results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
|
|
19352
19529
|
if (tool_id === "claude-code") {
|
|
19353
19530
|
try {
|
|
19354
|
-
const manifest =
|
|
19531
|
+
const manifest = path16.join(package_root, "src", "scripts", "hook_manifest.yaml");
|
|
19355
19532
|
const matrix = build_claude_hook_matrix(manifest);
|
|
19356
19533
|
const res = ensure_managed_hooks(
|
|
19357
|
-
|
|
19534
|
+
path16.join(anchor, "settings.json"),
|
|
19358
19535
|
matrix
|
|
19359
19536
|
);
|
|
19360
19537
|
if (!state.QUIET) {
|
|
@@ -19391,7 +19568,7 @@ function _preview_global_reap(tools, package_root) {
|
|
|
19391
19568
|
const anchor = expanduser6(anchor_raw);
|
|
19392
19569
|
let current_files = /* @__PURE__ */ new Set();
|
|
19393
19570
|
for (const [src_rel, dest_sub] of plan) {
|
|
19394
|
-
const src =
|
|
19571
|
+
const src = path16.join(package_root, src_rel);
|
|
19395
19572
|
current_files = setUnion(
|
|
19396
19573
|
current_files,
|
|
19397
19574
|
expected_deploy_files(
|
|
@@ -19425,14 +19602,14 @@ function _preview_global_reap(tools, package_root) {
|
|
|
19425
19602
|
function _verify_deploy_targets(anchor, plan) {
|
|
19426
19603
|
const missing = [];
|
|
19427
19604
|
for (const [, dest_sub] of plan) {
|
|
19428
|
-
const target = dest_sub ?
|
|
19605
|
+
const target = dest_sub ? path16.join(anchor, dest_sub) : anchor;
|
|
19429
19606
|
const label = dest_sub || ".";
|
|
19430
19607
|
if (!isDir(target)) {
|
|
19431
19608
|
missing.push(label);
|
|
19432
19609
|
continue;
|
|
19433
19610
|
}
|
|
19434
19611
|
try {
|
|
19435
|
-
const entries =
|
|
19612
|
+
const entries = fs18.readdirSync(target);
|
|
19436
19613
|
if (entries.length === 0) missing.push(label);
|
|
19437
19614
|
} catch {
|
|
19438
19615
|
missing.push(label);
|
|
@@ -19447,13 +19624,13 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
19447
19624
|
const [written, skipped, status, paths] = deploy_results[tool_id];
|
|
19448
19625
|
const pruned_skill_dirs = /* @__PURE__ */ new Set();
|
|
19449
19626
|
for (const p of paths) {
|
|
19450
|
-
const parts = p.split(
|
|
19627
|
+
const parts = p.split(path16.sep);
|
|
19451
19628
|
if (parts.includes("skills")) {
|
|
19452
19629
|
const i = parts.indexOf("skills");
|
|
19453
19630
|
if (i + 1 < parts.length) {
|
|
19454
|
-
const skill_root = parts.slice(0, i + 2).join(
|
|
19631
|
+
const skill_root = parts.slice(0, i + 2).join(path16.sep);
|
|
19455
19632
|
if (!pruned_skill_dirs.has(skill_root)) {
|
|
19456
|
-
const skillmd =
|
|
19633
|
+
const skillmd = path16.join(skill_root, "SKILL.md");
|
|
19457
19634
|
if (pathExists(skillmd) && is_pruned(skillmd)) {
|
|
19458
19635
|
pruned_skill_dirs.add(skill_root);
|
|
19459
19636
|
}
|
|
@@ -19464,25 +19641,25 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
19464
19641
|
const keep = [];
|
|
19465
19642
|
const delete_files = [];
|
|
19466
19643
|
for (const p of paths) {
|
|
19467
|
-
const parts = p.split(
|
|
19644
|
+
const parts = p.split(path16.sep);
|
|
19468
19645
|
let is_target = false;
|
|
19469
19646
|
if (parts.includes("skills")) {
|
|
19470
19647
|
const i = parts.indexOf("skills");
|
|
19471
|
-
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(
|
|
19648
|
+
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path16.sep))) {
|
|
19472
19649
|
is_target = true;
|
|
19473
19650
|
}
|
|
19474
|
-
} else if (parts.includes("commands") &&
|
|
19651
|
+
} else if (parts.includes("commands") && path16.extname(p) === ".md" && is_pruned(p)) {
|
|
19475
19652
|
is_target = true;
|
|
19476
19653
|
}
|
|
19477
19654
|
(is_target ? delete_files : keep).push(p);
|
|
19478
19655
|
}
|
|
19479
19656
|
for (const d of pruned_skill_dirs) {
|
|
19480
|
-
|
|
19657
|
+
fs18.rmSync(d, { recursive: true, force: true });
|
|
19481
19658
|
}
|
|
19482
19659
|
for (const p of delete_files) {
|
|
19483
|
-
if (p.split(
|
|
19660
|
+
if (p.split(path16.sep).includes("commands") && pathExists(p)) {
|
|
19484
19661
|
try {
|
|
19485
|
-
|
|
19662
|
+
fs18.unlinkSync(p);
|
|
19486
19663
|
} catch {
|
|
19487
19664
|
}
|
|
19488
19665
|
}
|
|
@@ -19503,9 +19680,9 @@ function _resolve_global_settings_doc() {
|
|
|
19503
19680
|
}
|
|
19504
19681
|
function _resolve_global_settings_path() {
|
|
19505
19682
|
const root = event4u_root();
|
|
19506
|
-
const canonical =
|
|
19683
|
+
const canonical = path16.join(root, "settings", SETTINGS_FILE);
|
|
19507
19684
|
if (pathExists(canonical)) return canonical;
|
|
19508
|
-
const legacy =
|
|
19685
|
+
const legacy = path16.join(root, SETTINGS_FILE);
|
|
19509
19686
|
if (pathExists(legacy)) return legacy;
|
|
19510
19687
|
return null;
|
|
19511
19688
|
}
|
|
@@ -19616,7 +19793,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
19616
19793
|
info(` schema_version=1, agent_config_version=${installed_version}`);
|
|
19617
19794
|
info(` tools=${merged_tools.join(",")}`);
|
|
19618
19795
|
}
|
|
19619
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
19796
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path16.join(project_root, ".agent-src.uncondensed"))) {
|
|
19620
19797
|
const drift = collect_drift(project_root);
|
|
19621
19798
|
if (!state.QUIET) {
|
|
19622
19799
|
process3.stdout.write("\n");
|
|
@@ -19716,19 +19893,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
19716
19893
|
}
|
|
19717
19894
|
}
|
|
19718
19895
|
}
|
|
19719
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
19896
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path16.join(project_root, ".agent-src.uncondensed"))) {
|
|
19720
19897
|
const files_by_tool = _files_by_tool_from_deploy(deploy_results);
|
|
19721
19898
|
const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
|
|
19722
19899
|
if (rc !== 0) return rc;
|
|
19723
19900
|
const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
|
|
19724
19901
|
if (removed_marker !== null && !state.QUIET) {
|
|
19725
|
-
const rel = isRelativeTo(removed_marker, project_root) ?
|
|
19902
|
+
const rel = isRelativeTo(removed_marker, project_root) ? path16.relative(project_root, removed_marker) : removed_marker;
|
|
19726
19903
|
info(`Removed legacy bridge marker: ${rel}`);
|
|
19727
19904
|
}
|
|
19728
19905
|
const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
|
|
19729
19906
|
if (anchor_paths.length > 0 && !state.QUIET) {
|
|
19730
19907
|
for (const p of anchor_paths) {
|
|
19731
|
-
const rel = isRelativeTo(p, project_root) ?
|
|
19908
|
+
const rel = isRelativeTo(p, project_root) ? path16.relative(project_root, p) : p;
|
|
19732
19909
|
info(`Project anchor written: ${rel}`);
|
|
19733
19910
|
}
|
|
19734
19911
|
}
|
|
@@ -19745,8 +19922,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
19745
19922
|
}
|
|
19746
19923
|
return 0;
|
|
19747
19924
|
}
|
|
19748
|
-
var SETTINGS_SURFACE_REL =
|
|
19749
|
-
var SETTINGS_DELTA_REL =
|
|
19925
|
+
var SETTINGS_SURFACE_REL = path16.join("state", "settings-surface.json");
|
|
19926
|
+
var SETTINGS_DELTA_REL = path16.join("state", "settings-delta.json");
|
|
19750
19927
|
function _current_settings_surface(version) {
|
|
19751
19928
|
const jsonSchema = zodToJsonSchema(settingsSchema, {
|
|
19752
19929
|
name: "AgentSettings",
|
|
@@ -19757,20 +19934,20 @@ function _current_settings_surface(version) {
|
|
|
19757
19934
|
}
|
|
19758
19935
|
function _write_settings_surface_snapshot(installed_version) {
|
|
19759
19936
|
const root = event4u_root();
|
|
19760
|
-
const surface_path =
|
|
19761
|
-
const delta_path =
|
|
19937
|
+
const surface_path = path16.join(root, SETTINGS_SURFACE_REL);
|
|
19938
|
+
const delta_path = path16.join(root, SETTINGS_DELTA_REL);
|
|
19762
19939
|
const next = _current_settings_surface(installed_version);
|
|
19763
19940
|
let previous = null;
|
|
19764
19941
|
try {
|
|
19765
|
-
const parsed = JSON.parse(
|
|
19942
|
+
const parsed = JSON.parse(fs18.readFileSync(surface_path, "utf8"));
|
|
19766
19943
|
if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
|
|
19767
19944
|
} catch {
|
|
19768
19945
|
}
|
|
19769
19946
|
if (previous !== null && previous.version !== next.version) {
|
|
19770
19947
|
const delta = computeSurfaceDelta(previous, next);
|
|
19771
19948
|
if (delta.changes.length > 0) {
|
|
19772
|
-
|
|
19773
|
-
|
|
19949
|
+
fs18.mkdirSync(path16.dirname(delta_path), { recursive: true, mode: 448 });
|
|
19950
|
+
fs18.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
|
|
19774
19951
|
`, { mode: 384 });
|
|
19775
19952
|
if (!state.QUIET) {
|
|
19776
19953
|
const counts = {};
|
|
@@ -19782,8 +19959,8 @@ function _write_settings_surface_snapshot(installed_version) {
|
|
|
19782
19959
|
}
|
|
19783
19960
|
}
|
|
19784
19961
|
}
|
|
19785
|
-
|
|
19786
|
-
|
|
19962
|
+
fs18.mkdirSync(path16.dirname(surface_path), { recursive: true, mode: 448 });
|
|
19963
|
+
fs18.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
|
|
19787
19964
|
`, { mode: 384 });
|
|
19788
19965
|
}
|
|
19789
19966
|
function arrayStrEqual(a, b) {
|
|
@@ -19809,6 +19986,7 @@ var USAGE = `usage: ${PROG} [-h] [--profile PROFILE] [--user-type USER_TYPE] [--
|
|
|
19809
19986
|
[--tools TOOLS] [--ai AI] [--packs PACKS] [--core-only]
|
|
19810
19987
|
[--no-smoke] [--global]
|
|
19811
19988
|
[--scope {project,global,prompt,auto}]
|
|
19989
|
+
[--layer {global,project,both-acknowledged}]
|
|
19812
19990
|
[--custom-path CUSTOM_PATH] [--offline] [--minimal]
|
|
19813
19991
|
[--interactive] [--no-ui] [--dry-run]
|
|
19814
19992
|
[--apply-payload APPLY_PAYLOAD]
|
|
@@ -19842,7 +20020,8 @@ var _VALUE_FLAGS = {
|
|
|
19842
20020
|
"--packs": "packs",
|
|
19843
20021
|
"--scope": "scope",
|
|
19844
20022
|
"--custom-path": "custom_path",
|
|
19845
|
-
"--apply-payload": "apply_payload"
|
|
20023
|
+
"--apply-payload": "apply_payload",
|
|
20024
|
+
"--layer": "layer"
|
|
19846
20025
|
};
|
|
19847
20026
|
function _argError(msg) {
|
|
19848
20027
|
process3.stderr.write(USAGE);
|
|
@@ -19877,7 +20056,8 @@ function parse_options(argv) {
|
|
|
19877
20056
|
interactive: false,
|
|
19878
20057
|
no_ui: false,
|
|
19879
20058
|
dry_run: false,
|
|
19880
|
-
apply_payload: null
|
|
20059
|
+
apply_payload: null,
|
|
20060
|
+
layer: null
|
|
19881
20061
|
};
|
|
19882
20062
|
const positionals = [];
|
|
19883
20063
|
let i = 0;
|
|
@@ -19914,6 +20094,11 @@ function parse_options(argv) {
|
|
|
19914
20094
|
`argument --scope: invalid choice: '${value}' (choose from 'project', 'global', 'prompt', 'auto')`
|
|
19915
20095
|
);
|
|
19916
20096
|
}
|
|
20097
|
+
if (flag === "--layer" && !RULE_LAYER_CHOICES.includes(value)) {
|
|
20098
|
+
_argError(
|
|
20099
|
+
`argument --layer: invalid choice: '${value}' (choose from ${RULE_LAYER_CHOICES.map((c) => `'${c}'`).join(", ")})`
|
|
20100
|
+
);
|
|
20101
|
+
}
|
|
19917
20102
|
opts[valueDest] = value;
|
|
19918
20103
|
i += 1;
|
|
19919
20104
|
continue;
|
|
@@ -19995,13 +20180,13 @@ function _minimal_templates_root() {
|
|
|
19995
20180
|
const chain = [start];
|
|
19996
20181
|
let cur = start;
|
|
19997
20182
|
for (; ; ) {
|
|
19998
|
-
const parent =
|
|
20183
|
+
const parent = path16.dirname(cur);
|
|
19999
20184
|
if (parent === cur) break;
|
|
20000
20185
|
chain.push(parent);
|
|
20001
20186
|
cur = parent;
|
|
20002
20187
|
}
|
|
20003
20188
|
for (const ancestor of chain) {
|
|
20004
|
-
const candidate =
|
|
20189
|
+
const candidate = path16.join(ancestor, "src", "templates", "minimal");
|
|
20005
20190
|
if (isDir(candidate)) return candidate;
|
|
20006
20191
|
}
|
|
20007
20192
|
fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
|
|
@@ -20009,9 +20194,9 @@ function _minimal_templates_root() {
|
|
|
20009
20194
|
var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
20010
20195
|
function _write_install_mode_marker(project_root, mode) {
|
|
20011
20196
|
if (mode !== "minimal" && mode !== "full") return;
|
|
20012
|
-
const marker =
|
|
20197
|
+
const marker = path16.join(project_root, INSTALL_MODE_MARKER_REL);
|
|
20013
20198
|
try {
|
|
20014
|
-
mkdirp(
|
|
20199
|
+
mkdirp(path16.dirname(marker));
|
|
20015
20200
|
writeText(marker, `${mode}
|
|
20016
20201
|
`);
|
|
20017
20202
|
} catch {
|
|
@@ -20020,7 +20205,7 @@ function _write_install_mode_marker(project_root, mode) {
|
|
|
20020
20205
|
function install_minimal(target_root_in, force, user_type = "") {
|
|
20021
20206
|
let target_root = resolvePath(target_root_in);
|
|
20022
20207
|
mkdirp(target_root);
|
|
20023
|
-
const parent =
|
|
20208
|
+
const parent = path16.dirname(target_root);
|
|
20024
20209
|
if (parent !== target_root) {
|
|
20025
20210
|
const existing = find_project_root_with_anchor(parent);
|
|
20026
20211
|
if (existing !== null && existing[0] !== target_root) {
|
|
@@ -20031,21 +20216,21 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
20031
20216
|
}
|
|
20032
20217
|
}
|
|
20033
20218
|
const templates = _minimal_templates_root();
|
|
20034
|
-
const settings_src =
|
|
20035
|
-
const overrides_gitkeep_src =
|
|
20036
|
-
const overrides_readme_src =
|
|
20219
|
+
const settings_src = path16.join(templates, SETTINGS_FILE);
|
|
20220
|
+
const overrides_gitkeep_src = path16.join(templates, "overrides-gitkeep");
|
|
20221
|
+
const overrides_readme_src = path16.join(templates, "agents-overrides-readme.md");
|
|
20037
20222
|
if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
|
|
20038
20223
|
if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
|
|
20039
20224
|
fail(`Bundled overrides scaffold templates missing under ${templates}`);
|
|
20040
20225
|
}
|
|
20041
20226
|
info(`Minimal init \u2192 ${target_root}`);
|
|
20042
|
-
const overrides_root =
|
|
20227
|
+
const overrides_root = path16.join(target_root, "agents", "overrides");
|
|
20043
20228
|
mkdirp(overrides_root);
|
|
20044
20229
|
const gitkeep_body = readText(overrides_gitkeep_src);
|
|
20045
20230
|
for (const sub of ["rules", "skills", "commands"]) {
|
|
20046
|
-
const sub_dir =
|
|
20231
|
+
const sub_dir = path16.join(overrides_root, sub);
|
|
20047
20232
|
mkdirp(sub_dir);
|
|
20048
|
-
const gitkeep_dst =
|
|
20233
|
+
const gitkeep_dst = path16.join(sub_dir, ".gitkeep");
|
|
20049
20234
|
if (pathExists(gitkeep_dst) && !force) {
|
|
20050
20235
|
skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
|
|
20051
20236
|
} else {
|
|
@@ -20053,7 +20238,7 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
20053
20238
|
success(`Wrote agents/overrides/${sub}/.gitkeep`);
|
|
20054
20239
|
}
|
|
20055
20240
|
}
|
|
20056
|
-
const readme_dst =
|
|
20241
|
+
const readme_dst = path16.join(overrides_root, "README.md");
|
|
20057
20242
|
if (pathExists(readme_dst) && !force) {
|
|
20058
20243
|
skip("agents/overrides/README.md already exists (use --force to overwrite)");
|
|
20059
20244
|
} else {
|
|
@@ -20071,14 +20256,14 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
20071
20256
|
personal:
|
|
20072
20257
|
user_type: ${user_type}
|
|
20073
20258
|
`;
|
|
20074
|
-
mkdirp(
|
|
20259
|
+
mkdirp(path16.dirname(settings_dst));
|
|
20075
20260
|
writeText(settings_dst, body);
|
|
20076
20261
|
success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
|
|
20077
20262
|
}
|
|
20078
20263
|
}
|
|
20079
20264
|
const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
|
|
20080
20265
|
if (removed_marker !== null) {
|
|
20081
|
-
const rel = isRelativeTo(removed_marker, target_root) ?
|
|
20266
|
+
const rel = isRelativeTo(removed_marker, target_root) ? path16.relative(target_root, removed_marker) : removed_marker;
|
|
20082
20267
|
success(`Removed legacy bridge marker: ${rel}`);
|
|
20083
20268
|
}
|
|
20084
20269
|
_write_install_mode_marker(target_root, "minimal");
|
|
@@ -20152,7 +20337,7 @@ function run_interactive_init(project_root, force) {
|
|
|
20152
20337
|
);
|
|
20153
20338
|
return 0;
|
|
20154
20339
|
}
|
|
20155
|
-
const target =
|
|
20340
|
+
const target = path16.join(project_root, _LOCAL_CONFIG_FILE);
|
|
20156
20341
|
if (pathExists(target) && !force) {
|
|
20157
20342
|
warn(
|
|
20158
20343
|
`${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
|
|
@@ -20179,7 +20364,7 @@ function run_interactive_init(project_root, force) {
|
|
|
20179
20364
|
warn(`Could not write ${target}: ${String(exc)}`);
|
|
20180
20365
|
return 1;
|
|
20181
20366
|
}
|
|
20182
|
-
success(`Wrote ${
|
|
20367
|
+
success(`Wrote ${path16.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
|
|
20183
20368
|
return 0;
|
|
20184
20369
|
}
|
|
20185
20370
|
var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
|
|
@@ -20197,12 +20382,12 @@ function _wizard_should_launch(opts) {
|
|
|
20197
20382
|
return [true, ""];
|
|
20198
20383
|
}
|
|
20199
20384
|
function _wizard_cli_dist(_project_root) {
|
|
20200
|
-
const package_root =
|
|
20201
|
-
const cli =
|
|
20385
|
+
const package_root = path16.dirname(path16.dirname(path16.dirname(resolvePath(_HERE2))));
|
|
20386
|
+
const cli = path16.join(package_root, "dist", "cli", "agent-config.js");
|
|
20202
20387
|
return pathExists(cli) ? cli : null;
|
|
20203
20388
|
}
|
|
20204
20389
|
function _server_info_path() {
|
|
20205
|
-
return
|
|
20390
|
+
return path16.join(os7.homedir(), ".event4u", "agent-config", "local-server.json");
|
|
20206
20391
|
}
|
|
20207
20392
|
function _pid_is_agent_config(pid) {
|
|
20208
20393
|
let res;
|
|
@@ -20219,7 +20404,7 @@ function _pid_is_agent_config(pid) {
|
|
|
20219
20404
|
}
|
|
20220
20405
|
function unlinkMissingOk(p) {
|
|
20221
20406
|
try {
|
|
20222
|
-
|
|
20407
|
+
fs18.unlinkSync(p);
|
|
20223
20408
|
} catch {
|
|
20224
20409
|
}
|
|
20225
20410
|
}
|
|
@@ -20297,14 +20482,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
|
|
|
20297
20482
|
}
|
|
20298
20483
|
function _wizard_run_sync(cmd, env, cli) {
|
|
20299
20484
|
const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
|
|
20300
|
-
const log_path =
|
|
20485
|
+
const log_path = path16.join(
|
|
20301
20486
|
os7.tmpdir(),
|
|
20302
20487
|
`agent-config-wizard-${process3.pid}-${Date.now()}.log`
|
|
20303
20488
|
);
|
|
20304
20489
|
let child;
|
|
20305
20490
|
let log_fd = null;
|
|
20306
20491
|
try {
|
|
20307
|
-
log_fd =
|
|
20492
|
+
log_fd = fs18.openSync(log_path, "w");
|
|
20308
20493
|
child = spawn(cmd[0], cmd.slice(1), {
|
|
20309
20494
|
env,
|
|
20310
20495
|
detached: true,
|
|
@@ -20322,7 +20507,7 @@ function _wizard_run_sync(cmd, env, cli) {
|
|
|
20322
20507
|
} finally {
|
|
20323
20508
|
if (log_fd !== null) {
|
|
20324
20509
|
try {
|
|
20325
|
-
|
|
20510
|
+
fs18.closeSync(log_fd);
|
|
20326
20511
|
} catch {
|
|
20327
20512
|
}
|
|
20328
20513
|
}
|
|
@@ -20572,8 +20757,8 @@ function main2(argv) {
|
|
|
20572
20757
|
const target_root = resolvePath(
|
|
20573
20758
|
opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
|
|
20574
20759
|
);
|
|
20575
|
-
const minimal_package_root =
|
|
20576
|
-
|
|
20760
|
+
const minimal_package_root = path16.dirname(
|
|
20761
|
+
path16.dirname(path16.dirname(_minimal_templates_root()))
|
|
20577
20762
|
);
|
|
20578
20763
|
const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
|
|
20579
20764
|
return install_minimal(target_root, opts.force, validated_user_type);
|
|
@@ -20587,6 +20772,9 @@ function main2(argv) {
|
|
|
20587
20772
|
let parsed_tools = _parse_tools(opts.tools);
|
|
20588
20773
|
const tools_was_all = _tools_was_all(opts.tools);
|
|
20589
20774
|
parsed_tools = _validate_scope(parsed_tools, scope, tools_was_all);
|
|
20775
|
+
if (parsed_tools.has("claude-code") && !_gate_rule_layer_overlap(detect_root, opts.layer, opts.dry_run)) {
|
|
20776
|
+
return 2;
|
|
20777
|
+
}
|
|
20590
20778
|
const wizard_handoff = _wizard_should_launch(opts)[0];
|
|
20591
20779
|
if (scope === "global") {
|
|
20592
20780
|
const artefacts = _detect_legacy_for_migration(detect_root);
|
|
@@ -20602,7 +20790,7 @@ function main2(argv) {
|
|
|
20602
20790
|
return rc2;
|
|
20603
20791
|
}
|
|
20604
20792
|
const project_root = custom_path || resolvePath(opts.project || process3.env["PROJECT_ROOT"] || process3.cwd());
|
|
20605
|
-
const is_first_run = !pathExists(
|
|
20793
|
+
const is_first_run = !pathExists(path16.join(project_root, SETTINGS_FILE));
|
|
20606
20794
|
const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
|
|
20607
20795
|
if (rc === 0 && opts.interactive) {
|
|
20608
20796
|
run_interactive_init(project_root, opts.force);
|
|
@@ -20666,16 +20854,16 @@ function _team_setup_hint_line(project_root) {
|
|
|
20666
20854
|
return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
|
|
20667
20855
|
}
|
|
20668
20856
|
function finalize_claude_model_tiers(project_root) {
|
|
20669
|
-
const claude_skills =
|
|
20670
|
-
const augment_skills =
|
|
20857
|
+
const claude_skills = path16.join(project_root, ".claude", "skills");
|
|
20858
|
+
const augment_skills = path16.join(project_root, ".augment", "skills");
|
|
20671
20859
|
if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
|
|
20672
20860
|
if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
|
|
20673
20861
|
let rendered = 0;
|
|
20674
|
-
const entries =
|
|
20862
|
+
const entries = fs18.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
20675
20863
|
for (const name of entries) {
|
|
20676
|
-
const entry =
|
|
20677
|
-
const src_dir =
|
|
20678
|
-
const src_md =
|
|
20864
|
+
const entry = path16.join(claude_skills, name);
|
|
20865
|
+
const src_dir = path16.join(augment_skills, name);
|
|
20866
|
+
const src_md = path16.join(src_dir, "SKILL.md");
|
|
20679
20867
|
let tier;
|
|
20680
20868
|
try {
|
|
20681
20869
|
tier = read_model_tier(src_md);
|
|
@@ -20684,22 +20872,22 @@ function finalize_claude_model_tiers(project_root) {
|
|
|
20684
20872
|
}
|
|
20685
20873
|
if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
|
|
20686
20874
|
if (isSymlink(entry) || isFile(entry)) {
|
|
20687
|
-
|
|
20875
|
+
fs18.unlinkSync(entry);
|
|
20688
20876
|
} else if (isDir(entry)) {
|
|
20689
|
-
|
|
20877
|
+
fs18.rmSync(entry, { recursive: true, force: true });
|
|
20690
20878
|
}
|
|
20691
20879
|
mkdirp(entry);
|
|
20692
|
-
const srcFiles =
|
|
20880
|
+
const srcFiles = fs18.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
20693
20881
|
for (const fname of srcFiles) {
|
|
20694
20882
|
if (fname === "SKILL.md") {
|
|
20695
20883
|
writeText(
|
|
20696
|
-
|
|
20884
|
+
path16.join(entry, "SKILL.md"),
|
|
20697
20885
|
render_native_model_md(readText(src_md), tier)
|
|
20698
20886
|
);
|
|
20699
20887
|
} else {
|
|
20700
|
-
|
|
20701
|
-
|
|
20702
|
-
|
|
20888
|
+
fs18.symlinkSync(
|
|
20889
|
+
path16.join("../../../.augment/skills", name, fname),
|
|
20890
|
+
path16.join(entry, fname)
|
|
20703
20891
|
);
|
|
20704
20892
|
}
|
|
20705
20893
|
}
|
|
@@ -20717,7 +20905,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
20717
20905
|
let package_type;
|
|
20718
20906
|
if (opts.package) {
|
|
20719
20907
|
package_root = resolvePath(opts.package);
|
|
20720
|
-
if (!pathExists(
|
|
20908
|
+
if (!pathExists(path16.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
20721
20909
|
fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
|
|
20722
20910
|
}
|
|
20723
20911
|
package_type = detect_package_type_for_project(project_root, package_root);
|
|
@@ -20852,9 +21040,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
20852
21040
|
function _resolvedArgv1() {
|
|
20853
21041
|
if (process3.argv[1] === void 0) return void 0;
|
|
20854
21042
|
try {
|
|
20855
|
-
return
|
|
21043
|
+
return fs18.realpathSync(path16.resolve(process3.argv[1]));
|
|
20856
21044
|
} catch {
|
|
20857
|
-
return
|
|
21045
|
+
return path16.resolve(process3.argv[1]);
|
|
20858
21046
|
}
|
|
20859
21047
|
}
|
|
20860
21048
|
var _argv1 = _resolvedArgv1();
|
|
@@ -20887,6 +21075,7 @@ export {
|
|
|
20887
21075
|
KIRO_MARKER,
|
|
20888
21076
|
PROJECT_BRIDGE_MARKERS,
|
|
20889
21077
|
ROOCODE_MARKER,
|
|
21078
|
+
RULE_LAYER_CHOICES,
|
|
20890
21079
|
SETTINGS_FILE,
|
|
20891
21080
|
SUPPORTED_PROFILES,
|
|
20892
21081
|
SystemExitError,
|
|
@@ -20908,6 +21097,7 @@ export {
|
|
|
20908
21097
|
_files_by_tool_from_bridges,
|
|
20909
21098
|
_files_by_tool_from_deploy,
|
|
20910
21099
|
_format_global_root_for_marker,
|
|
21100
|
+
_gate_rule_layer_overlap,
|
|
20911
21101
|
_inject_packs,
|
|
20912
21102
|
_is_agent_config_source_repo,
|
|
20913
21103
|
_is_tool_enabled,
|