@event4u/agent-config 12.0.0 → 12.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +122 -0
- package/agents/templates/.ai-council.yml.example +46 -3
- package/dist/agent-src/contexts/model-recommendations.md +6 -4
- package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +1 -0
- package/dist/agent-src/scripts/roadmap_gates.ts +30 -2
- package/dist/agent-src/scripts/update_roadmap_progress.ts +32 -1
- package/dist/agent-src/skills/roadmap-writing/SKILL.md +7 -7
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +41 -3
- package/dist/cli/registry.js +1 -0
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/chunk-K34QTSD5.js +3895 -0
- package/dist/cli-delegate/{chunk-L565YFXH.js → chunk-LKZ5DOYW.js} +557 -297
- package/dist/cli-delegate/{chunk-NN4KW4HZ.js → chunk-O52B4F5S.js} +123 -2338
- package/dist/cli-delegate/cmd_conformance.js +4 -4
- package/dist/cli-delegate/cmd_doctor.js +2 -2
- package/dist/cli-delegate/cmd_export.js +1 -1
- package/dist/cli-delegate/cmd_handoff.js +1 -1
- package/dist/cli-delegate/cmd_prune.js +1 -1
- package/dist/cli-delegate/cmd_settings_migrate.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +1 -1
- package/dist/cli-delegate/cmd_uninstall.js +1 -1
- package/dist/cli-delegate/cmd_validate.js +1 -1
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +4 -4
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +1 -1
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +2 -2
- package/dist/discovery/trust-report.md +1 -1
- package/dist/discovery/workspaces.json +2 -2
- package/dist/hooks/dispatch.js +2574 -1080
- package/dist/install/install.mjs +744 -482
- package/dist/mcp/registry-manifest.json +2 -2
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +113 -10
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/model_tier.js +9 -0
- package/dist/scripts/_lib/model_tier.js.map +1 -1
- package/dist/scripts/condense.js +50 -0
- package/dist/scripts/condense.js.map +1 -1
- package/docs/MIGRATION.md +20 -1
- package/package.json +1 -1
- package/src/agent-src/scripts/roadmap_gates.ts +30 -2
- package/src/agent-src/scripts/update_roadmap_progress.ts +32 -1
- package/src/config/evaluator-budgets.json +4 -4
- package/src/config/gate-coverage.yml +39 -9
- package/src/config/gate-violation-baselines.json +6 -0
- package/src/config/hook-token-budget.json +7 -1
- package/src/config/preamble-payload-budget.json +28 -0
- package/src/scripts/_dispatch.bash +10 -0
- package/src/scripts/_lib/git_common_dir.ts +173 -0
- package/src/scripts/_lib/model_tier.ts +9 -0
- package/src/scripts/_lib/release_highlights.ts +108 -7
- package/src/scripts/_lib/skill_catalogue.ts +862 -0
- package/src/scripts/ai_council/clients.ts +182 -3
- package/src/scripts/ai_council/config.ts +16 -1
- package/src/scripts/ai_council/low_impact.ts +14 -1
- package/src/scripts/ai_council/orchestrator.ts +14 -1
- package/src/scripts/ai_council/transport_resolver.ts +32 -2
- package/src/scripts/capture_skill_catalogue.ts +185 -328
- package/src/scripts/check_branch_freshness.ts +7 -1
- package/src/scripts/check_release_published.ts +6 -2
- package/src/scripts/check_release_trunk_sync.ts +18 -2
- package/src/scripts/condense.ts +50 -1
- package/src/scripts/dispatch_r2_reviewer.ts +15 -5
- package/src/scripts/evidence_report.ts +15 -4
- package/src/scripts/hook_manifest.yaml +47 -13
- package/src/scripts/hooks/concern_registry.ts +2 -0
- package/src/scripts/hooks/orchestration_record_hook.ts +21 -0
- package/src/scripts/hooks/tool_result_bytes_hook.ts +219 -0
- package/src/scripts/hot_context_hook.ts +13 -1
- package/src/scripts/install.ts +129 -0
- package/src/scripts/janitor.ts +77 -2
- package/src/scripts/lint_plan_risk_register.ts +22 -9
- package/src/scripts/lint_roadmap_blockers.ts +109 -6
- package/src/scripts/lint_scheduled_deprecations.ts +738 -0
- package/src/scripts/migration_status.ts +17 -1
- package/src/scripts/probe_review_binding_drift.ts +731 -0
- package/src/scripts/release.ts +95 -1
- package/src/scripts/schemas/command.schema.json +2 -2
- package/src/scripts/schemas/skill.schema.json +2 -1
- package/src/scripts/schemas/subagent.schema.json +2 -2
- package/src/scripts/session_eol_report.ts +81 -0
- package/src/scripts/workspace_doctor.ts +464 -0
- package/src/scripts/worktree_cleanup_check.ts +2 -1
- package/dist/cli-delegate/chunk-AYKQGIBG.js +0 -1594
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, path18) {
|
|
121
|
+
const ctrl = callVisitor(key, node, visitor, path18);
|
|
122
122
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
123
|
-
replaceNode(key,
|
|
124
|
-
return visit_(key, ctrl, visitor,
|
|
123
|
+
replaceNode(key, path18, ctrl);
|
|
124
|
+
return visit_(key, ctrl, visitor, path18);
|
|
125
125
|
}
|
|
126
126
|
if (typeof ctrl !== "symbol") {
|
|
127
127
|
if (identity.isCollection(node)) {
|
|
128
|
-
|
|
128
|
+
path18 = Object.freeze(path18.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, path18);
|
|
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
|
+
path18 = Object.freeze(path18.concat(node));
|
|
142
|
+
const ck = visit_("key", node.key, visitor, path18);
|
|
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, path18);
|
|
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, path18) {
|
|
169
|
+
const ctrl = await callVisitor(key, node, visitor, path18);
|
|
170
170
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
171
|
-
replaceNode(key,
|
|
172
|
-
return visitAsync_(key, ctrl, visitor,
|
|
171
|
+
replaceNode(key, path18, ctrl);
|
|
172
|
+
return visitAsync_(key, ctrl, visitor, path18);
|
|
173
173
|
}
|
|
174
174
|
if (typeof ctrl !== "symbol") {
|
|
175
175
|
if (identity.isCollection(node)) {
|
|
176
|
-
|
|
176
|
+
path18 = Object.freeze(path18.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, path18);
|
|
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
|
+
path18 = Object.freeze(path18.concat(node));
|
|
190
|
+
const ck = await visitAsync_("key", node.key, visitor, path18);
|
|
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, path18);
|
|
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, path18) {
|
|
223
223
|
if (typeof visitor === "function")
|
|
224
|
-
return visitor(key, node,
|
|
224
|
+
return visitor(key, node, path18);
|
|
225
225
|
if (identity.isMap(node))
|
|
226
|
-
return visitor.Map?.(key, node,
|
|
226
|
+
return visitor.Map?.(key, node, path18);
|
|
227
227
|
if (identity.isSeq(node))
|
|
228
|
-
return visitor.Seq?.(key, node,
|
|
228
|
+
return visitor.Seq?.(key, node, path18);
|
|
229
229
|
if (identity.isPair(node))
|
|
230
|
-
return visitor.Pair?.(key, node,
|
|
230
|
+
return visitor.Pair?.(key, node, path18);
|
|
231
231
|
if (identity.isScalar(node))
|
|
232
|
-
return visitor.Scalar?.(key, node,
|
|
232
|
+
return visitor.Scalar?.(key, node, path18);
|
|
233
233
|
if (identity.isAlias(node))
|
|
234
|
-
return visitor.Alias?.(key, node,
|
|
234
|
+
return visitor.Alias?.(key, node, path18);
|
|
235
235
|
return void 0;
|
|
236
236
|
}
|
|
237
|
-
function replaceNode(key,
|
|
238
|
-
const parent =
|
|
237
|
+
function replaceNode(key, path18, node) {
|
|
238
|
+
const parent = path18[path18.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, path18, value) {
|
|
849
849
|
let v = value;
|
|
850
|
-
for (let i =
|
|
851
|
-
const k =
|
|
850
|
+
for (let i = path18.length - 1; i >= 0; --i) {
|
|
851
|
+
const k = path18[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 = (path18) => path18 == null || typeof path18 === "object" && !!path18[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(path18, value) {
|
|
901
|
+
if (isEmptyPath(path18))
|
|
902
902
|
this.add(value);
|
|
903
903
|
else {
|
|
904
|
-
const [key, ...rest] =
|
|
904
|
+
const [key, ...rest] = path18;
|
|
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(path18) {
|
|
919
|
+
const [key, ...rest] = path18;
|
|
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(path18, keepScalar) {
|
|
934
|
+
const [key, ...rest] = path18;
|
|
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(path18) {
|
|
953
|
+
const [key, ...rest] = path18;
|
|
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(path18, value) {
|
|
964
|
+
const [key, ...rest] = path18;
|
|
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(path18, value) {
|
|
3480
3480
|
if (assertCollection(this.contents))
|
|
3481
|
-
this.contents.addIn(
|
|
3481
|
+
this.contents.addIn(path18, 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(path18) {
|
|
3557
|
+
if (Collection.isEmptyPath(path18)) {
|
|
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(path18) : 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(path18, keepScalar) {
|
|
3579
|
+
if (Collection.isEmptyPath(path18))
|
|
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(path18, 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(path18) {
|
|
3593
|
+
if (Collection.isEmptyPath(path18))
|
|
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(path18) : 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(path18, value) {
|
|
3613
|
+
if (Collection.isEmptyPath(path18)) {
|
|
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(path18), value);
|
|
3617
3617
|
} else if (assertCollection(this.contents)) {
|
|
3618
|
-
this.contents.setIn(
|
|
3618
|
+
this.contents.setIn(path18, 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, path18) => {
|
|
5579
5579
|
let item = cst;
|
|
5580
|
-
for (const [field, index] of
|
|
5580
|
+
for (const [field, index] of path18) {
|
|
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, path18) => {
|
|
5590
|
+
const parent = visit.itemAtPath(cst, path18.slice(0, -1));
|
|
5591
|
+
const field = path18[path18.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(path18, item, visitor) {
|
|
5598
|
+
let ctrl = visitor(item, path18);
|
|
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(path18.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, path18);
|
|
5617
5617
|
}
|
|
5618
5618
|
}
|
|
5619
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5619
|
+
return typeof ctrl === "function" ? ctrl(item, path18) : 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 fs20 = this.flowScalar(this.type);
|
|
6922
6922
|
if (atNextItem || it.value) {
|
|
6923
|
-
map.items.push({ start, key:
|
|
6923
|
+
map.items.push({ start, key: fs20, sep: [] });
|
|
6924
6924
|
this.onKeyLine = true;
|
|
6925
6925
|
} else if (it.sep) {
|
|
6926
|
-
this.stack.push(
|
|
6926
|
+
this.stack.push(fs20);
|
|
6927
6927
|
} else {
|
|
6928
|
-
Object.assign(it, { key:
|
|
6928
|
+
Object.assign(it, { key: fs20, 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 fs20 = this.flowScalar(this.type);
|
|
7057
7057
|
if (!it || it.value)
|
|
7058
|
-
fc.items.push({ start: [], key:
|
|
7058
|
+
fc.items.push({ start: [], key: fs20, sep: [] });
|
|
7059
7059
|
else if (it.sep)
|
|
7060
|
-
this.stack.push(
|
|
7060
|
+
this.stack.push(fs20);
|
|
7061
7061
|
else
|
|
7062
|
-
Object.assign(it, { key:
|
|
7062
|
+
Object.assign(it, { key: fs20, 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 fs19 from "node:fs";
|
|
7374
7374
|
import * as os7 from "node:os";
|
|
7375
|
-
import * as
|
|
7375
|
+
import * as path17 from "node:path";
|
|
7376
7376
|
import process3 from "node:process";
|
|
7377
7377
|
import { fileURLToPath as fileURLToPath5, 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(path18) {
|
|
7876
|
+
const target = path18 ?? lockfile_path();
|
|
7877
7877
|
let text;
|
|
7878
7878
|
try {
|
|
7879
7879
|
text = fs2.readFileSync(target, { encoding: "utf-8" });
|
|
@@ -8948,18 +8948,18 @@ function manifest_path(project_root, env) {
|
|
|
8948
8948
|
var _TOP_KEY_RE = /^([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
|
|
8949
8949
|
var _LIST_DASH_RE = /^\s*-\s*(.+?)\s*$/;
|
|
8950
8950
|
var _INDENT_KEY_RE = /^\s+([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
|
|
8951
|
-
function read_manifest(
|
|
8951
|
+
function read_manifest(path18) {
|
|
8952
8952
|
let text;
|
|
8953
8953
|
try {
|
|
8954
|
-
text = require_read_text(
|
|
8954
|
+
text = require_read_text(path18);
|
|
8955
8955
|
} catch {
|
|
8956
8956
|
return null;
|
|
8957
8957
|
}
|
|
8958
8958
|
const data = _parse_manual(text);
|
|
8959
8959
|
return _normalise_v2_shape(data);
|
|
8960
8960
|
}
|
|
8961
|
-
function require_read_text(
|
|
8962
|
-
return fs8.readFileSync(
|
|
8961
|
+
function require_read_text(path18) {
|
|
8962
|
+
return fs8.readFileSync(path18, { encoding: "utf-8" });
|
|
8963
8963
|
}
|
|
8964
8964
|
function _normalise_v2_shape(data) {
|
|
8965
8965
|
if (data["tools"] === void 0 || data["tools"] === null) {
|
|
@@ -9140,9 +9140,9 @@ function stable_sort(items, key) {
|
|
|
9140
9140
|
return a.index - b.index;
|
|
9141
9141
|
}).map((entry) => entry.item);
|
|
9142
9142
|
}
|
|
9143
|
-
function write_manifest(
|
|
9143
|
+
function write_manifest(path18, version, tools, options = {}) {
|
|
9144
9144
|
const rendered = _render2(version, tools, { deploy_roots: options.deploy_roots ?? null });
|
|
9145
|
-
return write_atomic(
|
|
9145
|
+
return write_atomic(path18, rendered);
|
|
9146
9146
|
}
|
|
9147
9147
|
var ScopeMismatchError = class extends Error {
|
|
9148
9148
|
name_;
|
|
@@ -9357,10 +9357,201 @@ function format_drift_report(entries) {
|
|
|
9357
9357
|
return lines.join("\n") + "\n";
|
|
9358
9358
|
}
|
|
9359
9359
|
|
|
9360
|
-
// src/scripts/_lib/
|
|
9361
|
-
import * as crypto2 from "node:crypto";
|
|
9360
|
+
// src/scripts/_lib/skill_catalogue.ts
|
|
9362
9361
|
import * as fs10 from "node:fs";
|
|
9363
9362
|
import * as path9 from "node:path";
|
|
9363
|
+
var OBSERVATION_LOG = path9.join(
|
|
9364
|
+
"agents",
|
|
9365
|
+
"evidence",
|
|
9366
|
+
"metrics",
|
|
9367
|
+
"skill-catalogue.jsonl"
|
|
9368
|
+
);
|
|
9369
|
+
function frontmatterOf(content) {
|
|
9370
|
+
if (!content.startsWith("---")) return "";
|
|
9371
|
+
const end = content.indexOf("\n---", 3);
|
|
9372
|
+
if (end === -1) return "";
|
|
9373
|
+
return content.slice(3, end);
|
|
9374
|
+
}
|
|
9375
|
+
function topLevelKeys(frontmatter) {
|
|
9376
|
+
const keys = [];
|
|
9377
|
+
for (const line of frontmatter.split("\n")) {
|
|
9378
|
+
const match = /^([A-Za-z_][A-Za-z0-9_-]*):/.exec(line);
|
|
9379
|
+
if (match) keys.push(match[1]);
|
|
9380
|
+
}
|
|
9381
|
+
return keys;
|
|
9382
|
+
}
|
|
9383
|
+
function descriptionOf(frontmatter) {
|
|
9384
|
+
const lines = frontmatter.split("\n");
|
|
9385
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
9386
|
+
const match = /^description:\s*(.*)$/.exec(lines[i]);
|
|
9387
|
+
if (!match) continue;
|
|
9388
|
+
const rest = match[1].trim();
|
|
9389
|
+
if (/^[|>][-+]?\d*$/.test(rest)) {
|
|
9390
|
+
const body = [];
|
|
9391
|
+
for (let j = i + 1; j < lines.length; j += 1) {
|
|
9392
|
+
const line = lines[j];
|
|
9393
|
+
if (line.trim() === "") {
|
|
9394
|
+
body.push("");
|
|
9395
|
+
continue;
|
|
9396
|
+
}
|
|
9397
|
+
if (!/^\s/.test(line)) break;
|
|
9398
|
+
body.push(line.trim());
|
|
9399
|
+
}
|
|
9400
|
+
return body.join(" ").trim();
|
|
9401
|
+
}
|
|
9402
|
+
return rest.replace(/^["']|["']$/g, "");
|
|
9403
|
+
}
|
|
9404
|
+
return "";
|
|
9405
|
+
}
|
|
9406
|
+
function readProjectedCatalogue(root) {
|
|
9407
|
+
const names = fs10.readdirSync(root).filter((n) => fs10.existsSync(path9.join(root, n, "SKILL.md"))).sort();
|
|
9408
|
+
return names.map((name, index) => {
|
|
9409
|
+
const content = fs10.readFileSync(path9.join(root, name, "SKILL.md"), "utf-8");
|
|
9410
|
+
const frontmatter = frontmatterOf(content);
|
|
9411
|
+
const description = descriptionOf(frontmatter);
|
|
9412
|
+
return {
|
|
9413
|
+
name,
|
|
9414
|
+
position: index + 1,
|
|
9415
|
+
hasDescription: description.length > 0,
|
|
9416
|
+
descriptionLength: description.length,
|
|
9417
|
+
description,
|
|
9418
|
+
frontmatterKeys: topLevelKeys(frontmatter)
|
|
9419
|
+
};
|
|
9420
|
+
});
|
|
9421
|
+
}
|
|
9422
|
+
function truncationModeOf(record) {
|
|
9423
|
+
return record.truncation_mode ?? "per-entry";
|
|
9424
|
+
}
|
|
9425
|
+
function markdownFilesUnder(root) {
|
|
9426
|
+
if (!fs10.existsSync(root)) return [];
|
|
9427
|
+
const out = [];
|
|
9428
|
+
const walk = (dir) => {
|
|
9429
|
+
for (const entry of fs10.readdirSync(dir, { withFileTypes: true })) {
|
|
9430
|
+
const full = path9.join(dir, entry.name);
|
|
9431
|
+
if (fs10.statSync(full).isDirectory()) walk(full);
|
|
9432
|
+
else if (entry.name.endsWith(".md")) out.push(full);
|
|
9433
|
+
}
|
|
9434
|
+
};
|
|
9435
|
+
walk(root);
|
|
9436
|
+
return out;
|
|
9437
|
+
}
|
|
9438
|
+
function measureCatalogueVolume(host, root) {
|
|
9439
|
+
const skillsRoot = path9.join(root, "skills");
|
|
9440
|
+
const skills = fs10.existsSync(skillsRoot) ? readProjectedCatalogue(skillsRoot) : [];
|
|
9441
|
+
const commandEntries = markdownFilesUnder(path9.join(root, "commands")).length;
|
|
9442
|
+
return {
|
|
9443
|
+
host,
|
|
9444
|
+
root,
|
|
9445
|
+
skillEntries: skills.length,
|
|
9446
|
+
commandEntries,
|
|
9447
|
+
artefacts: skills.length + commandEntries,
|
|
9448
|
+
descriptionBytes: skills.reduce((sum, e) => sum + Buffer.byteLength(e.description), 0)
|
|
9449
|
+
};
|
|
9450
|
+
}
|
|
9451
|
+
function knownHostLimits(records) {
|
|
9452
|
+
const out = /* @__PURE__ */ new Map();
|
|
9453
|
+
for (const record of records) {
|
|
9454
|
+
if (truncationModeOf(record) !== "budget-strip-and-drop") continue;
|
|
9455
|
+
if (typeof record.dropped_count !== "number") continue;
|
|
9456
|
+
if (record.dropped_count <= 0) continue;
|
|
9457
|
+
const previous = out.get(record.host);
|
|
9458
|
+
if (previous !== void 0 && previous.observedAt > record.observed_at) continue;
|
|
9459
|
+
out.set(record.host, {
|
|
9460
|
+
host: record.host,
|
|
9461
|
+
droppedEntries: record.dropped_count,
|
|
9462
|
+
projectedVolume: record.entries_total,
|
|
9463
|
+
projectedSkills: record.projected_skill_count ?? null,
|
|
9464
|
+
observedAt: record.observed_at
|
|
9465
|
+
});
|
|
9466
|
+
}
|
|
9467
|
+
return out;
|
|
9468
|
+
}
|
|
9469
|
+
function catalogueLimitWarning(volume, limit) {
|
|
9470
|
+
if (limit === void 0) return null;
|
|
9471
|
+
if (limit.projectedSkills === null) return null;
|
|
9472
|
+
if (volume.skillEntries < limit.projectedSkills) return null;
|
|
9473
|
+
return `${volume.host}: deploying ${volume.skillEntries} skills. This host reported dropping ${limit.droppedEntries} entries from the model-visible list when last measured (${limit.observedAt}, at ${limit.projectedSkills} skills) \u2014 that much never reaches the model. Explain: \`agent-config exec capture_skill_catalogue --limits\``;
|
|
9474
|
+
}
|
|
9475
|
+
function migrationEligibility(host, resolvedMode, currentSkillCount, limits) {
|
|
9476
|
+
if (resolvedMode === "scoped") return { eligible: false, reason: "already-scoped" };
|
|
9477
|
+
const limit = limits.get(host);
|
|
9478
|
+
if (limit === void 0) return { eligible: false, reason: "no-observation-for-host" };
|
|
9479
|
+
if (limit.projectedSkills === null) return { eligible: false, reason: "observation-not-comparable" };
|
|
9480
|
+
if (limit.droppedEntries <= 0) return { eligible: false, reason: "no-truncation-observed" };
|
|
9481
|
+
if (currentSkillCount < limit.projectedSkills) {
|
|
9482
|
+
return { eligible: false, reason: "below-observed-skill-volume" };
|
|
9483
|
+
}
|
|
9484
|
+
return {
|
|
9485
|
+
eligible: true,
|
|
9486
|
+
reason: "eligible",
|
|
9487
|
+
droppedEntries: limit.droppedEntries,
|
|
9488
|
+
observedAt: limit.observedAt
|
|
9489
|
+
};
|
|
9490
|
+
}
|
|
9491
|
+
function migrationPromptLines(host, eligibility, settingsPath) {
|
|
9492
|
+
return [
|
|
9493
|
+
`${host}: ${eligibility.droppedEntries} catalogue entries never reach the model.`,
|
|
9494
|
+
`Measured on this machine (${eligibility.observedAt}). This install is on \`legacy-all\`,`,
|
|
9495
|
+
"which ships everything and lets the host drop what does not fit \u2014 silently.",
|
|
9496
|
+
"",
|
|
9497
|
+
"Scoping the projection to your active packs is the alternative. Nothing here",
|
|
9498
|
+
"changes it for you: `projection.mode` is yours to set, by hand or in the GUI.",
|
|
9499
|
+
"",
|
|
9500
|
+
` edit ${settingsPath}`,
|
|
9501
|
+
" projection:",
|
|
9502
|
+
" mode: scoped",
|
|
9503
|
+
"",
|
|
9504
|
+
" or agent-config config (Settings \u2192 projection)",
|
|
9505
|
+
"",
|
|
9506
|
+
"Keeping `legacy-all` is a legitimate choice \u2014 this is a notification, not a gate."
|
|
9507
|
+
];
|
|
9508
|
+
}
|
|
9509
|
+
function readObservationLog(logPath) {
|
|
9510
|
+
if (!fs10.existsSync(logPath)) return [];
|
|
9511
|
+
const out = [];
|
|
9512
|
+
for (const line of fs10.readFileSync(logPath, "utf-8").split("\n")) {
|
|
9513
|
+
const trimmed = line.trim();
|
|
9514
|
+
if (trimmed.length === 0) continue;
|
|
9515
|
+
try {
|
|
9516
|
+
out.push(JSON.parse(trimmed));
|
|
9517
|
+
} catch {
|
|
9518
|
+
continue;
|
|
9519
|
+
}
|
|
9520
|
+
}
|
|
9521
|
+
return out;
|
|
9522
|
+
}
|
|
9523
|
+
|
|
9524
|
+
// src/shared/interactiveContext.ts
|
|
9525
|
+
var CI_ENV_KEYS = ["CI", "GITHUB_ACTIONS", "AGENT_CONFIG_CI"];
|
|
9526
|
+
function _flagSet(env, key) {
|
|
9527
|
+
const raw = (env[key] ?? "").trim();
|
|
9528
|
+
return raw !== "" && raw !== "0";
|
|
9529
|
+
}
|
|
9530
|
+
function nonInteractiveReason(probe) {
|
|
9531
|
+
for (const key of CI_ENV_KEYS) {
|
|
9532
|
+
if (_flagSet(probe.env, key)) {
|
|
9533
|
+
return "ci";
|
|
9534
|
+
}
|
|
9535
|
+
}
|
|
9536
|
+
if (_flagSet(probe.env, "AGENT_CONFIG_NO_UI")) {
|
|
9537
|
+
return "no-ui-requested";
|
|
9538
|
+
}
|
|
9539
|
+
if (!probe.stdinTty || !probe.stdoutTty) {
|
|
9540
|
+
return "not-a-tty";
|
|
9541
|
+
}
|
|
9542
|
+
if (probe.headless === true) {
|
|
9543
|
+
return "headless";
|
|
9544
|
+
}
|
|
9545
|
+
return null;
|
|
9546
|
+
}
|
|
9547
|
+
function isInteractiveSession(probe) {
|
|
9548
|
+
return nonInteractiveReason(probe) === null;
|
|
9549
|
+
}
|
|
9550
|
+
|
|
9551
|
+
// src/scripts/_lib/claude_desktop_bundler.ts
|
|
9552
|
+
import * as crypto2 from "node:crypto";
|
|
9553
|
+
import * as fs11 from "node:fs";
|
|
9554
|
+
import * as path10 from "node:path";
|
|
9364
9555
|
|
|
9365
9556
|
// src/scripts/_lib/zip_min.ts
|
|
9366
9557
|
import * as zlib from "node:zlib";
|
|
@@ -9467,7 +9658,7 @@ function _is_excluded(rel_parts) {
|
|
|
9467
9658
|
}
|
|
9468
9659
|
function _is_dir(p) {
|
|
9469
9660
|
try {
|
|
9470
|
-
return
|
|
9661
|
+
return fs11.statSync(p).isDirectory();
|
|
9471
9662
|
} catch {
|
|
9472
9663
|
return false;
|
|
9473
9664
|
}
|
|
@@ -9479,12 +9670,12 @@ function _compare_rel_parts(a, b) {
|
|
|
9479
9670
|
}
|
|
9480
9671
|
function _walk_skill_files(skill_dir) {
|
|
9481
9672
|
const out = [];
|
|
9482
|
-
const resolved =
|
|
9673
|
+
const resolved = fs11.realpathSync(skill_dir);
|
|
9483
9674
|
const walk = (root, relRoot) => {
|
|
9484
9675
|
const dirNames = [];
|
|
9485
9676
|
const fileNames = [];
|
|
9486
|
-
for (const dirent of
|
|
9487
|
-
const full =
|
|
9677
|
+
for (const dirent of fs11.readdirSync(root, { withFileTypes: true })) {
|
|
9678
|
+
const full = path10.join(root, dirent.name);
|
|
9488
9679
|
const isDir2 = dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full);
|
|
9489
9680
|
if (isDir2) {
|
|
9490
9681
|
dirNames.push(dirent.name);
|
|
@@ -9497,13 +9688,13 @@ function _walk_skill_files(skill_dir) {
|
|
|
9497
9688
|
if (_is_excluded(rel_parts)) {
|
|
9498
9689
|
continue;
|
|
9499
9690
|
}
|
|
9500
|
-
out.push([
|
|
9691
|
+
out.push([path10.join(root, fname), rel_parts]);
|
|
9501
9692
|
}
|
|
9502
9693
|
for (const dname of dirNames) {
|
|
9503
9694
|
if (_is_excluded([dname])) {
|
|
9504
9695
|
continue;
|
|
9505
9696
|
}
|
|
9506
|
-
walk(
|
|
9697
|
+
walk(path10.join(root, dname), [...relRoot, dname]);
|
|
9507
9698
|
}
|
|
9508
9699
|
};
|
|
9509
9700
|
walk(resolved, []);
|
|
@@ -9516,53 +9707,53 @@ function _manifest_digest(files) {
|
|
|
9516
9707
|
const rel = rel_parts.join("/");
|
|
9517
9708
|
h.update(Buffer.from(rel, "utf-8"));
|
|
9518
9709
|
h.update(Buffer.from([0]));
|
|
9519
|
-
h.update(crypto2.createHash("sha256").update(
|
|
9710
|
+
h.update(crypto2.createHash("sha256").update(fs11.readFileSync(abs_path)).digest());
|
|
9520
9711
|
h.update(Buffer.from([0]));
|
|
9521
9712
|
}
|
|
9522
9713
|
return h.digest("hex");
|
|
9523
9714
|
}
|
|
9524
9715
|
function _atomic_write_zip(zip_path, files) {
|
|
9525
|
-
|
|
9526
|
-
const stem =
|
|
9527
|
-
const tmp_path =
|
|
9528
|
-
|
|
9716
|
+
fs11.mkdirSync(path10.dirname(zip_path), { recursive: true });
|
|
9717
|
+
const stem = path10.basename(zip_path, path10.extname(zip_path));
|
|
9718
|
+
const tmp_path = path10.join(
|
|
9719
|
+
path10.dirname(zip_path),
|
|
9529
9720
|
`.${stem}.${crypto2.randomBytes(6).toString("hex")}.zip.tmp`
|
|
9530
9721
|
);
|
|
9531
9722
|
try {
|
|
9532
9723
|
const entries = files.map(([abs_path, rel_parts]) => ({
|
|
9533
9724
|
name: rel_parts.join("/"),
|
|
9534
|
-
data:
|
|
9725
|
+
data: fs11.readFileSync(abs_path)
|
|
9535
9726
|
}));
|
|
9536
|
-
|
|
9537
|
-
|
|
9727
|
+
fs11.writeFileSync(tmp_path, zip_write_sync(entries));
|
|
9728
|
+
fs11.renameSync(tmp_path, zip_path);
|
|
9538
9729
|
} finally {
|
|
9539
|
-
if (
|
|
9540
|
-
|
|
9730
|
+
if (fs11.existsSync(tmp_path)) {
|
|
9731
|
+
fs11.unlinkSync(tmp_path);
|
|
9541
9732
|
}
|
|
9542
9733
|
}
|
|
9543
9734
|
}
|
|
9544
9735
|
function _write_if_changed(dest_dir, slug, files, force, written) {
|
|
9545
9736
|
const digest = _manifest_digest(files);
|
|
9546
|
-
const zip_path =
|
|
9547
|
-
const digest_path =
|
|
9548
|
-
const recorded =
|
|
9549
|
-
if (!force && recorded === digest &&
|
|
9737
|
+
const zip_path = path10.join(dest_dir, `${slug}.zip`);
|
|
9738
|
+
const digest_path = path10.join(dest_dir, `${slug}.sha256`);
|
|
9739
|
+
const recorded = fs11.existsSync(digest_path) ? fs11.readFileSync(digest_path, "utf-8").trim() : "";
|
|
9740
|
+
if (!force && recorded === digest && fs11.existsSync(zip_path)) {
|
|
9550
9741
|
return;
|
|
9551
9742
|
}
|
|
9552
9743
|
_atomic_write_zip(zip_path, files);
|
|
9553
|
-
|
|
9744
|
+
fs11.writeFileSync(digest_path, digest + "\n", "utf-8");
|
|
9554
9745
|
written.push(zip_path);
|
|
9555
9746
|
}
|
|
9556
9747
|
function build_skill_bundles(package_root, dest_dir, force = false, curation = null) {
|
|
9557
|
-
const skills_root =
|
|
9748
|
+
const skills_root = path10.join(package_root, "dist/agent-src", "skills");
|
|
9558
9749
|
if (!_is_dir(skills_root)) {
|
|
9559
9750
|
return [];
|
|
9560
9751
|
}
|
|
9561
|
-
|
|
9752
|
+
fs11.mkdirSync(dest_dir, { recursive: true });
|
|
9562
9753
|
const written = [];
|
|
9563
|
-
for (const name of
|
|
9564
|
-
const entry =
|
|
9565
|
-
const isSymlink2 =
|
|
9754
|
+
for (const name of fs11.readdirSync(skills_root).sort()) {
|
|
9755
|
+
const entry = path10.join(skills_root, name);
|
|
9756
|
+
const isSymlink2 = fs11.lstatSync(entry).isSymbolicLink();
|
|
9566
9757
|
if (!(_is_dir(entry) || isSymlink2)) {
|
|
9567
9758
|
continue;
|
|
9568
9759
|
}
|
|
@@ -9570,8 +9761,8 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
|
|
|
9570
9761
|
if (curation !== null && !curation.includes(skill_name)) {
|
|
9571
9762
|
continue;
|
|
9572
9763
|
}
|
|
9573
|
-
const skill_md =
|
|
9574
|
-
if (!
|
|
9764
|
+
const skill_md = path10.join(entry, "SKILL.md");
|
|
9765
|
+
if (!fs11.existsSync(skill_md)) {
|
|
9575
9766
|
continue;
|
|
9576
9767
|
}
|
|
9577
9768
|
const files = _walk_skill_files(entry);
|
|
@@ -9583,15 +9774,15 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
|
|
|
9583
9774
|
return written;
|
|
9584
9775
|
}
|
|
9585
9776
|
function _command_slug(source_file, commands_root) {
|
|
9586
|
-
const rel =
|
|
9587
|
-
const noExt = rel.slice(0, rel.length -
|
|
9588
|
-
return noExt.split(
|
|
9777
|
+
const rel = path10.relative(commands_root, source_file);
|
|
9778
|
+
const noExt = rel.slice(0, rel.length - path10.extname(rel).length);
|
|
9779
|
+
return noExt.split(path10.sep).join("-");
|
|
9589
9780
|
}
|
|
9590
9781
|
function _iter_command_files(commands_root) {
|
|
9591
9782
|
const found = [];
|
|
9592
9783
|
const walk = (dir) => {
|
|
9593
|
-
for (const dirent of
|
|
9594
|
-
const full =
|
|
9784
|
+
for (const dirent of fs11.readdirSync(dir, { withFileTypes: true })) {
|
|
9785
|
+
const full = path10.join(dir, dirent.name);
|
|
9595
9786
|
if (dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full)) {
|
|
9596
9787
|
walk(full);
|
|
9597
9788
|
} else if (dirent.name.endsWith(".md")) {
|
|
@@ -9601,21 +9792,21 @@ function _iter_command_files(commands_root) {
|
|
|
9601
9792
|
};
|
|
9602
9793
|
walk(commands_root);
|
|
9603
9794
|
found.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
9604
|
-
return found.filter((source_file) =>
|
|
9795
|
+
return found.filter((source_file) => path10.basename(source_file) !== "AGENTS.md");
|
|
9605
9796
|
}
|
|
9606
9797
|
function build_command_bundles(package_root, dest_dir, force = false, curation = null) {
|
|
9607
|
-
const commands_root =
|
|
9798
|
+
const commands_root = path10.join(package_root, "dist/agent-src", "commands");
|
|
9608
9799
|
if (!_is_dir(commands_root)) {
|
|
9609
9800
|
return [];
|
|
9610
9801
|
}
|
|
9611
|
-
const skills_root =
|
|
9802
|
+
const skills_root = path10.join(package_root, "dist/agent-src", "skills");
|
|
9612
9803
|
let skill_names = /* @__PURE__ */ new Set();
|
|
9613
9804
|
if (_is_dir(skills_root)) {
|
|
9614
9805
|
skill_names = new Set(
|
|
9615
|
-
|
|
9806
|
+
fs11.readdirSync(skills_root).filter((name) => _is_dir(path10.join(skills_root, name)))
|
|
9616
9807
|
);
|
|
9617
9808
|
}
|
|
9618
|
-
|
|
9809
|
+
fs11.mkdirSync(dest_dir, { recursive: true });
|
|
9619
9810
|
const written = [];
|
|
9620
9811
|
for (const source_file of _iter_command_files(commands_root)) {
|
|
9621
9812
|
const slug = _command_slug(source_file, commands_root);
|
|
@@ -9625,7 +9816,7 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
|
|
|
9625
9816
|
if (curation !== null && !curation.includes(slug)) {
|
|
9626
9817
|
continue;
|
|
9627
9818
|
}
|
|
9628
|
-
const files = [[
|
|
9819
|
+
const files = [[fs11.realpathSync(source_file), ["SKILL.md"]]];
|
|
9629
9820
|
_write_if_changed(dest_dir, slug, files, force, written);
|
|
9630
9821
|
}
|
|
9631
9822
|
return written;
|
|
@@ -9633,8 +9824,8 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
|
|
|
9633
9824
|
|
|
9634
9825
|
// src/scripts/_lib/claude_settings_hooks.ts
|
|
9635
9826
|
var YAML = __toESM(require_dist(), 1);
|
|
9636
|
-
import * as
|
|
9637
|
-
import * as
|
|
9827
|
+
import * as fs12 from "node:fs";
|
|
9828
|
+
import * as path11 from "node:path";
|
|
9638
9829
|
|
|
9639
9830
|
// src/install/atomic.ts
|
|
9640
9831
|
import {
|
|
@@ -9642,17 +9833,17 @@ import {
|
|
|
9642
9833
|
fsyncSync,
|
|
9643
9834
|
mkdirSync as mkdirSync5,
|
|
9644
9835
|
openSync as openSync3,
|
|
9645
|
-
readFileSync as
|
|
9836
|
+
readFileSync as readFileSync10,
|
|
9646
9837
|
renameSync as renameSync5,
|
|
9647
9838
|
unlinkSync as unlinkSync4,
|
|
9648
9839
|
writeSync
|
|
9649
9840
|
} from "node:fs";
|
|
9650
|
-
import { dirname as dirname4, join as
|
|
9841
|
+
import { dirname as dirname4, join as join11 } from "node:path";
|
|
9651
9842
|
function atomicWriteFile(target, data, options = {}) {
|
|
9652
9843
|
const mode = options.mode ?? 420;
|
|
9653
9844
|
const parent = dirname4(target);
|
|
9654
9845
|
mkdirSync5(parent, { recursive: true });
|
|
9655
|
-
const tmp =
|
|
9846
|
+
const tmp = join11(parent, `.tmp.${process.pid}.${randSuffix()}`);
|
|
9656
9847
|
let fd = null;
|
|
9657
9848
|
try {
|
|
9658
9849
|
fd = openSync3(tmp, "w", mode);
|
|
@@ -9702,7 +9893,7 @@ var SettingsLockError = class extends Error {
|
|
|
9702
9893
|
}
|
|
9703
9894
|
};
|
|
9704
9895
|
function build_claude_hook_matrix(manifest_path2) {
|
|
9705
|
-
const raw =
|
|
9896
|
+
const raw = fs12.readFileSync(manifest_path2, "utf8");
|
|
9706
9897
|
const manifest = _yaml_parse(raw) ?? {};
|
|
9707
9898
|
const hook_spec = manifest["schema_version"] ?? 1;
|
|
9708
9899
|
const platforms = manifest["platforms"] ?? {};
|
|
@@ -9732,8 +9923,8 @@ function _is_managed_group(group) {
|
|
|
9732
9923
|
);
|
|
9733
9924
|
}
|
|
9734
9925
|
function _read_settings(settings_path) {
|
|
9735
|
-
if (!
|
|
9736
|
-
const raw =
|
|
9926
|
+
if (!fs12.existsSync(settings_path)) return {};
|
|
9927
|
+
const raw = fs12.readFileSync(settings_path, "utf8");
|
|
9737
9928
|
if (raw.trim() === "") return {};
|
|
9738
9929
|
let parsed;
|
|
9739
9930
|
try {
|
|
@@ -9748,18 +9939,18 @@ function _read_settings(settings_path) {
|
|
|
9748
9939
|
}
|
|
9749
9940
|
function _with_lock(settings_path, fn) {
|
|
9750
9941
|
const lockPath = settings_path + ".agent-config.lock";
|
|
9751
|
-
|
|
9942
|
+
fs12.mkdirSync(path11.dirname(lockPath), { recursive: true });
|
|
9752
9943
|
let fd;
|
|
9753
9944
|
try {
|
|
9754
|
-
fd =
|
|
9945
|
+
fd = fs12.openSync(lockPath, "wx");
|
|
9755
9946
|
} catch {
|
|
9756
9947
|
throw new SettingsLockError(lockPath);
|
|
9757
9948
|
}
|
|
9758
9949
|
try {
|
|
9759
9950
|
return fn();
|
|
9760
9951
|
} finally {
|
|
9761
|
-
|
|
9762
|
-
|
|
9952
|
+
fs12.closeSync(fd);
|
|
9953
|
+
fs12.rmSync(lockPath, { force: true });
|
|
9763
9954
|
}
|
|
9764
9955
|
}
|
|
9765
9956
|
function ensure_managed_hooks(settings_path, matrix) {
|
|
@@ -9790,9 +9981,9 @@ function ensure_managed_hooks(settings_path, matrix) {
|
|
|
9790
9981
|
|
|
9791
9982
|
// src/scripts/_lib/agent_settings.ts
|
|
9792
9983
|
import { createRequire as createRequire2 } from "node:module";
|
|
9793
|
-
import * as
|
|
9984
|
+
import * as fs13 from "node:fs";
|
|
9794
9985
|
import * as os6 from "node:os";
|
|
9795
|
-
import * as
|
|
9986
|
+
import * as path12 from "node:path";
|
|
9796
9987
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
9797
9988
|
|
|
9798
9989
|
// src/shared/settingsCarveOut.ts
|
|
@@ -9890,10 +10081,10 @@ var DEFAULT_PROJECT_FILE = ".agent-settings.yml";
|
|
|
9890
10081
|
var LOCAL_PROJECT_FILE = ".agent-settings.local.yml";
|
|
9891
10082
|
var LOCAL_PROJECT_SUBDIR = ["agents", "settings"];
|
|
9892
10083
|
function _local_settings_path(project_root) {
|
|
9893
|
-
return
|
|
10084
|
+
return path12.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
|
|
9894
10085
|
}
|
|
9895
10086
|
function _canonical_settings_path(project_root) {
|
|
9896
|
-
return
|
|
10087
|
+
return path12.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
|
|
9897
10088
|
}
|
|
9898
10089
|
var USER_GLOBAL_FILENAME = "agent-settings.yml";
|
|
9899
10090
|
function DEFAULT_USER_GLOBAL_FILE() {
|
|
@@ -9947,10 +10138,10 @@ var MERGEABLE_KEYS = [
|
|
|
9947
10138
|
"knowledge.global_sharing.freshness.hypothesis_after_days",
|
|
9948
10139
|
"knowledge.global_sharing.freshness.stale_after_days"
|
|
9949
10140
|
];
|
|
9950
|
-
var TEMPLATE_RELATIVE =
|
|
9951
|
-
var _PACKAGE_ROOT =
|
|
10141
|
+
var TEMPLATE_RELATIVE = path12.join("src", "config", "agent-settings.template.yml");
|
|
10142
|
+
var _PACKAGE_ROOT = path12.resolve(path12.dirname(fileURLToPath2(import.meta.url)), "..", "..", "..");
|
|
9952
10143
|
function default_template_path() {
|
|
9953
|
-
return
|
|
10144
|
+
return path12.join(_PACKAGE_ROOT, TEMPLATE_RELATIVE);
|
|
9954
10145
|
}
|
|
9955
10146
|
function _is_placeholder(value) {
|
|
9956
10147
|
return typeof value === "string" && /^__[A-Z0-9_]+__$/.test(value);
|
|
@@ -10001,8 +10192,8 @@ var _AGENTS_DIR_MARKERS = [
|
|
|
10001
10192
|
var _LEGACY_ANCHOR_ENV = "AGENT_CONFIG_LEGACY_ANCHOR";
|
|
10002
10193
|
function _exists(p) {
|
|
10003
10194
|
try {
|
|
10004
|
-
|
|
10005
|
-
|
|
10195
|
+
fs13.lstatSync(p);
|
|
10196
|
+
fs13.statSync(p);
|
|
10006
10197
|
return true;
|
|
10007
10198
|
} catch {
|
|
10008
10199
|
return false;
|
|
@@ -10010,22 +10201,22 @@ function _exists(p) {
|
|
|
10010
10201
|
}
|
|
10011
10202
|
function _is_dir2(p) {
|
|
10012
10203
|
try {
|
|
10013
|
-
return
|
|
10204
|
+
return fs13.statSync(p).isDirectory();
|
|
10014
10205
|
} catch {
|
|
10015
10206
|
return false;
|
|
10016
10207
|
}
|
|
10017
10208
|
}
|
|
10018
10209
|
function _is_file(p) {
|
|
10019
10210
|
try {
|
|
10020
|
-
return
|
|
10211
|
+
return fs13.statSync(p).isFile();
|
|
10021
10212
|
} catch {
|
|
10022
10213
|
return false;
|
|
10023
10214
|
}
|
|
10024
10215
|
}
|
|
10025
10216
|
function _resolve(p) {
|
|
10026
|
-
const absolute =
|
|
10217
|
+
const absolute = path12.resolve(p);
|
|
10027
10218
|
try {
|
|
10028
|
-
return
|
|
10219
|
+
return fs13.realpathSync(absolute);
|
|
10029
10220
|
} catch {
|
|
10030
10221
|
return absolute;
|
|
10031
10222
|
}
|
|
@@ -10035,7 +10226,7 @@ function _ancestor_chain(start) {
|
|
|
10035
10226
|
let cursor = start;
|
|
10036
10227
|
for (; ; ) {
|
|
10037
10228
|
chain.push(cursor);
|
|
10038
|
-
const parent =
|
|
10229
|
+
const parent = path12.dirname(cursor);
|
|
10039
10230
|
if (parent === cursor) {
|
|
10040
10231
|
break;
|
|
10041
10232
|
}
|
|
@@ -10044,15 +10235,15 @@ function _ancestor_chain(start) {
|
|
|
10044
10235
|
return chain;
|
|
10045
10236
|
}
|
|
10046
10237
|
function _boundary_anchor_at(dir) {
|
|
10047
|
-
const agents_dir =
|
|
10238
|
+
const agents_dir = path12.join(dir, "agents");
|
|
10048
10239
|
if (_is_dir2(agents_dir)) {
|
|
10049
10240
|
for (const marker of _AGENTS_DIR_MARKERS) {
|
|
10050
|
-
if (_exists(
|
|
10241
|
+
if (_exists(path12.join(agents_dir, marker))) {
|
|
10051
10242
|
return ANCHOR_AGENTS_DIR;
|
|
10052
10243
|
}
|
|
10053
10244
|
}
|
|
10054
10245
|
}
|
|
10055
|
-
if (_exists(
|
|
10246
|
+
if (_exists(path12.join(dir, ".git"))) {
|
|
10056
10247
|
return ANCHOR_GIT;
|
|
10057
10248
|
}
|
|
10058
10249
|
return null;
|
|
@@ -10063,7 +10254,7 @@ function find_project_root_with_anchor(start) {
|
|
|
10063
10254
|
const chain = _ancestor_chain(current);
|
|
10064
10255
|
if (legacy) {
|
|
10065
10256
|
for (const candidate of chain) {
|
|
10066
|
-
if (_exists(
|
|
10257
|
+
if (_exists(path12.join(candidate, ".git"))) {
|
|
10067
10258
|
return [candidate, ANCHOR_GIT];
|
|
10068
10259
|
}
|
|
10069
10260
|
}
|
|
@@ -10077,7 +10268,7 @@ function find_project_root_with_anchor(start) {
|
|
|
10077
10268
|
}
|
|
10078
10269
|
let outermost = null;
|
|
10079
10270
|
for (const candidate of chain) {
|
|
10080
|
-
if (_exists(
|
|
10271
|
+
if (_exists(path12.join(candidate, DEFAULT_PROJECT_FILE))) {
|
|
10081
10272
|
outermost = candidate;
|
|
10082
10273
|
}
|
|
10083
10274
|
}
|
|
@@ -10121,7 +10312,7 @@ function _expanduser(p) {
|
|
|
10121
10312
|
return os6.homedir();
|
|
10122
10313
|
}
|
|
10123
10314
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
10124
|
-
return
|
|
10315
|
+
return path12.join(os6.homedir(), p.slice(2));
|
|
10125
10316
|
}
|
|
10126
10317
|
return p;
|
|
10127
10318
|
}
|
|
@@ -10150,13 +10341,13 @@ function resolve_project_root(arg, options = {}) {
|
|
|
10150
10341
|
function _resolve_cascade_paths(cwd, project_path) {
|
|
10151
10342
|
if (cwd === null) {
|
|
10152
10343
|
const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
|
|
10153
|
-
const parent =
|
|
10344
|
+
const parent = path12.dirname(legacy);
|
|
10154
10345
|
return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
|
|
10155
10346
|
}
|
|
10156
10347
|
const root = find_project_root(cwd);
|
|
10157
10348
|
if (root === null) {
|
|
10158
10349
|
const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
|
|
10159
|
-
const parent =
|
|
10350
|
+
const parent = path12.dirname(legacy);
|
|
10160
10351
|
return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
|
|
10161
10352
|
}
|
|
10162
10353
|
const cwd_resolved = _resolve(cwd);
|
|
@@ -10167,7 +10358,7 @@ function _resolve_cascade_paths(cwd, project_path) {
|
|
|
10167
10358
|
if (cursor === root) {
|
|
10168
10359
|
break;
|
|
10169
10360
|
}
|
|
10170
|
-
const parent =
|
|
10361
|
+
const parent = path12.dirname(cursor);
|
|
10171
10362
|
if (parent === cursor) {
|
|
10172
10363
|
break;
|
|
10173
10364
|
}
|
|
@@ -10175,7 +10366,7 @@ function _resolve_cascade_paths(cwd, project_path) {
|
|
|
10175
10366
|
}
|
|
10176
10367
|
chain.reverse();
|
|
10177
10368
|
return [
|
|
10178
|
-
...chain.map((d) =>
|
|
10369
|
+
...chain.map((d) => path12.join(d, DEFAULT_PROJECT_FILE)),
|
|
10179
10370
|
_canonical_settings_path(root),
|
|
10180
10371
|
_local_settings_path(root)
|
|
10181
10372
|
];
|
|
@@ -10262,7 +10453,7 @@ function _read_yaml(p) {
|
|
|
10262
10453
|
}
|
|
10263
10454
|
let data;
|
|
10264
10455
|
try {
|
|
10265
|
-
const text =
|
|
10456
|
+
const text = fs13.readFileSync(p, "utf-8");
|
|
10266
10457
|
data = YAML3.parse(text, { version: "1.1" });
|
|
10267
10458
|
if (data === null || data === void 0) {
|
|
10268
10459
|
data = {};
|
|
@@ -10362,11 +10553,11 @@ function _is_plain_dict(value) {
|
|
|
10362
10553
|
}
|
|
10363
10554
|
|
|
10364
10555
|
// src/install/rule_scope.ts
|
|
10365
|
-
import * as
|
|
10556
|
+
import * as path13 from "node:path";
|
|
10366
10557
|
|
|
10367
10558
|
// src/install/ruleInScope.ts
|
|
10368
10559
|
var YAML2 = __toESM(require_dist(), 1);
|
|
10369
|
-
import * as
|
|
10560
|
+
import * as fs14 from "node:fs";
|
|
10370
10561
|
function parseYaml2(text) {
|
|
10371
10562
|
try {
|
|
10372
10563
|
const data = YAML2.parse(text, { version: "1.1" });
|
|
@@ -10404,7 +10595,7 @@ function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null)
|
|
|
10404
10595
|
if (scope === null && pack_scope === null && role_scope === null) {
|
|
10405
10596
|
return true;
|
|
10406
10597
|
}
|
|
10407
|
-
const [meta] = parseFrontmatter(
|
|
10598
|
+
const [meta] = parseFrontmatter(fs14.readFileSync(source_path, "utf-8"));
|
|
10408
10599
|
if (meta["type"] === "always" || meta["alwaysApply"] === true) {
|
|
10409
10600
|
return true;
|
|
10410
10601
|
}
|
|
@@ -10455,7 +10646,7 @@ function ruleFileArrives(sourcePath, scope) {
|
|
|
10455
10646
|
if (!sourcePath.endsWith(".md")) {
|
|
10456
10647
|
return true;
|
|
10457
10648
|
}
|
|
10458
|
-
const basename6 =
|
|
10649
|
+
const basename6 = path13.basename(sourcePath);
|
|
10459
10650
|
if (COMPAT_ALWAYS_EXCLUDED.includes(basename6)) {
|
|
10460
10651
|
return false;
|
|
10461
10652
|
}
|
|
@@ -11013,8 +11204,8 @@ function getErrorMap() {
|
|
|
11013
11204
|
|
|
11014
11205
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
11015
11206
|
var makeIssue = (params) => {
|
|
11016
|
-
const { data, path:
|
|
11017
|
-
const fullPath = [...
|
|
11207
|
+
const { data, path: path18, errorMaps, issueData } = params;
|
|
11208
|
+
const fullPath = [...path18, ...issueData.path || []];
|
|
11018
11209
|
const fullIssue = {
|
|
11019
11210
|
...issueData,
|
|
11020
11211
|
path: fullPath
|
|
@@ -11130,11 +11321,11 @@ var errorUtil;
|
|
|
11130
11321
|
|
|
11131
11322
|
// node_modules/zod/v3/types.js
|
|
11132
11323
|
var ParseInputLazyPath = class {
|
|
11133
|
-
constructor(parent, value,
|
|
11324
|
+
constructor(parent, value, path18, key) {
|
|
11134
11325
|
this._cachedPath = [];
|
|
11135
11326
|
this.parent = parent;
|
|
11136
11327
|
this.data = value;
|
|
11137
|
-
this._path =
|
|
11328
|
+
this._path = path18;
|
|
11138
11329
|
this._key = key;
|
|
11139
11330
|
}
|
|
11140
11331
|
get path() {
|
|
@@ -16404,8 +16595,8 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
16404
16595
|
};
|
|
16405
16596
|
|
|
16406
16597
|
// src/scripts/_lib/module_detection.ts
|
|
16407
|
-
import * as
|
|
16408
|
-
import * as
|
|
16598
|
+
import * as fs15 from "node:fs";
|
|
16599
|
+
import * as path14 from "node:path";
|
|
16409
16600
|
var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
|
|
16410
16601
|
var _RULES = [
|
|
16411
16602
|
["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
|
|
@@ -16419,14 +16610,14 @@ var _RULES = [
|
|
|
16419
16610
|
];
|
|
16420
16611
|
function _isDir(p) {
|
|
16421
16612
|
try {
|
|
16422
|
-
return
|
|
16613
|
+
return fs15.statSync(p).isDirectory();
|
|
16423
16614
|
} catch {
|
|
16424
16615
|
return false;
|
|
16425
16616
|
}
|
|
16426
16617
|
}
|
|
16427
16618
|
function _isFile(p) {
|
|
16428
16619
|
try {
|
|
16429
|
-
return
|
|
16620
|
+
return fs15.statSync(p).isFile();
|
|
16430
16621
|
} catch {
|
|
16431
16622
|
return false;
|
|
16432
16623
|
}
|
|
@@ -16440,13 +16631,13 @@ function _isUpperChar(ch) {
|
|
|
16440
16631
|
function _list_module_subdirs(root) {
|
|
16441
16632
|
let entries;
|
|
16442
16633
|
try {
|
|
16443
|
-
entries =
|
|
16634
|
+
entries = fs15.readdirSync(root).sort();
|
|
16444
16635
|
} catch {
|
|
16445
16636
|
return [];
|
|
16446
16637
|
}
|
|
16447
16638
|
const out = [];
|
|
16448
16639
|
for (const name of entries) {
|
|
16449
|
-
if (!_isDir(
|
|
16640
|
+
if (!_isDir(path14.join(root, name))) {
|
|
16450
16641
|
continue;
|
|
16451
16642
|
}
|
|
16452
16643
|
if (name.startsWith(".")) {
|
|
@@ -16468,11 +16659,11 @@ function _score_confidence(stack, root, subdirs) {
|
|
|
16468
16659
|
return capitalized.length > 0 ? "high" : "medium";
|
|
16469
16660
|
}
|
|
16470
16661
|
if (stack === "node-monorepo") {
|
|
16471
|
-
const withPkgJson = subdirs.filter((name) => _isFile(
|
|
16662
|
+
const withPkgJson = subdirs.filter((name) => _isFile(path14.join(root, name, "package.json")));
|
|
16472
16663
|
return withPkgJson.length > 0 ? "high" : "medium";
|
|
16473
16664
|
}
|
|
16474
16665
|
if (stack === "python-src") {
|
|
16475
|
-
const withInit = subdirs.filter((name) => _isFile(
|
|
16666
|
+
const withInit = subdirs.filter((name) => _isFile(path14.join(root, name, "__init__.py")));
|
|
16476
16667
|
return withInit.length > 0 ? "high" : "medium";
|
|
16477
16668
|
}
|
|
16478
16669
|
if (stack === "go-internal") {
|
|
@@ -16484,7 +16675,7 @@ function detect_module_roots(project_root) {
|
|
|
16484
16675
|
const high = [];
|
|
16485
16676
|
const medium = [];
|
|
16486
16677
|
for (const [rel_path, stack, namespace_template] of _RULES) {
|
|
16487
|
-
const abs_path =
|
|
16678
|
+
const abs_path = path14.join(project_root, rel_path);
|
|
16488
16679
|
if (!_isDir(abs_path)) {
|
|
16489
16680
|
continue;
|
|
16490
16681
|
}
|
|
@@ -16506,16 +16697,17 @@ function detect_module_roots(project_root) {
|
|
|
16506
16697
|
}
|
|
16507
16698
|
|
|
16508
16699
|
// src/scripts/_lib/model_tier.ts
|
|
16509
|
-
import
|
|
16700
|
+
import fs16 from "node:fs";
|
|
16510
16701
|
var TIER_TO_CLAUDE_MODEL = {
|
|
16702
|
+
frontier: "fable",
|
|
16511
16703
|
high: "opus",
|
|
16512
16704
|
medium: "sonnet",
|
|
16513
16705
|
lite: "haiku"
|
|
16514
16706
|
};
|
|
16515
16707
|
var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
|
|
16516
16708
|
function read_model_tier(skill_md) {
|
|
16517
|
-
if (!
|
|
16518
|
-
const text =
|
|
16709
|
+
if (!fs16.existsSync(skill_md)) return null;
|
|
16710
|
+
const text = fs16.readFileSync(skill_md).toString("utf-8");
|
|
16519
16711
|
if (!text.startsWith("---\n")) return null;
|
|
16520
16712
|
const end = text.indexOf("\n---\n", 4);
|
|
16521
16713
|
if (end === -1) return null;
|
|
@@ -16532,39 +16724,39 @@ function render_native_model_md(text, tier) {
|
|
|
16532
16724
|
|
|
16533
16725
|
// src/scripts/_cli/cmd_migrate.ts
|
|
16534
16726
|
import { spawnSync } from "node:child_process";
|
|
16535
|
-
import * as
|
|
16536
|
-
import * as
|
|
16727
|
+
import * as fs18 from "node:fs";
|
|
16728
|
+
import * as path16 from "node:path";
|
|
16537
16729
|
import process2 from "node:process";
|
|
16538
16730
|
import { fileURLToPath as fileURLToPath4, pathToFileURL } from "node:url";
|
|
16539
16731
|
|
|
16540
16732
|
// src/scripts/_lib/package_root.ts
|
|
16541
|
-
import * as
|
|
16542
|
-
import * as
|
|
16733
|
+
import * as fs17 from "node:fs";
|
|
16734
|
+
import * as path15 from "node:path";
|
|
16543
16735
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
16544
16736
|
var PACKAGE_NAME = "@event4u/agent-config";
|
|
16545
16737
|
var MAX_ASCENT = 16;
|
|
16546
16738
|
function resolvePackageRoot(fromUrlOrPath, legacyHops = 3) {
|
|
16547
16739
|
const start = fromUrlOrPath.startsWith("file:") ? fileURLToPath3(fromUrlOrPath) : fromUrlOrPath;
|
|
16548
|
-
const startDir =
|
|
16740
|
+
const startDir = path15.dirname(start);
|
|
16549
16741
|
let dir = startDir;
|
|
16550
16742
|
for (let i = 0; i < MAX_ASCENT; i++) {
|
|
16551
|
-
const manifest =
|
|
16552
|
-
if (
|
|
16743
|
+
const manifest = path15.join(dir, "package.json");
|
|
16744
|
+
if (fs17.existsSync(manifest)) {
|
|
16553
16745
|
try {
|
|
16554
|
-
const parsed = JSON.parse(
|
|
16746
|
+
const parsed = JSON.parse(fs17.readFileSync(manifest, "utf8"));
|
|
16555
16747
|
if (parsed.name === PACKAGE_NAME) {
|
|
16556
16748
|
return dir;
|
|
16557
16749
|
}
|
|
16558
16750
|
} catch {
|
|
16559
16751
|
}
|
|
16560
16752
|
}
|
|
16561
|
-
const parent =
|
|
16753
|
+
const parent = path15.dirname(dir);
|
|
16562
16754
|
if (parent === dir) {
|
|
16563
16755
|
break;
|
|
16564
16756
|
}
|
|
16565
16757
|
dir = parent;
|
|
16566
16758
|
}
|
|
16567
|
-
return
|
|
16759
|
+
return path15.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
|
|
16568
16760
|
}
|
|
16569
16761
|
|
|
16570
16762
|
// src/scripts/_cli/cmd_migrate.ts
|
|
@@ -16585,7 +16777,7 @@ var LEGACY_SETTINGS_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
|
16585
16777
|
var LEGACY_STATE_FILENAME = ".implement-ticket-state.json";
|
|
16586
16778
|
var LEGACY_STATE_V1_FILENAME = ".work-state.json";
|
|
16587
16779
|
var LEGACY_AGENT_CONFIG_SHELL = "agent-config";
|
|
16588
|
-
var _HERE_DIR =
|
|
16780
|
+
var _HERE_DIR = path16.dirname(fileURLToPath4(import.meta.url));
|
|
16589
16781
|
var ArgparseExit = class extends Error {
|
|
16590
16782
|
code;
|
|
16591
16783
|
constructor(code) {
|
|
@@ -16684,38 +16876,38 @@ function _jsonDumpsIndentAscii(value, indent) {
|
|
|
16684
16876
|
}
|
|
16685
16877
|
function _isFile2(p) {
|
|
16686
16878
|
try {
|
|
16687
|
-
return
|
|
16879
|
+
return fs18.statSync(p).isFile();
|
|
16688
16880
|
} catch {
|
|
16689
16881
|
return false;
|
|
16690
16882
|
}
|
|
16691
16883
|
}
|
|
16692
16884
|
function _isDir2(p) {
|
|
16693
16885
|
try {
|
|
16694
|
-
return
|
|
16886
|
+
return fs18.statSync(p).isDirectory();
|
|
16695
16887
|
} catch {
|
|
16696
16888
|
return false;
|
|
16697
16889
|
}
|
|
16698
16890
|
}
|
|
16699
16891
|
function _isSymlink(p) {
|
|
16700
16892
|
try {
|
|
16701
|
-
return
|
|
16893
|
+
return fs18.lstatSync(p).isSymbolicLink();
|
|
16702
16894
|
} catch {
|
|
16703
16895
|
return false;
|
|
16704
16896
|
}
|
|
16705
16897
|
}
|
|
16706
16898
|
function _exists2(p) {
|
|
16707
16899
|
try {
|
|
16708
|
-
|
|
16900
|
+
fs18.lstatSync(p);
|
|
16709
16901
|
return true;
|
|
16710
16902
|
} catch {
|
|
16711
16903
|
return false;
|
|
16712
16904
|
}
|
|
16713
16905
|
}
|
|
16714
16906
|
function _readText(p) {
|
|
16715
|
-
return
|
|
16907
|
+
return fs18.readFileSync(p, { encoding: "utf-8" });
|
|
16716
16908
|
}
|
|
16717
16909
|
function _writeText(p, text) {
|
|
16718
|
-
|
|
16910
|
+
fs18.writeFileSync(p, text, { encoding: "utf-8" });
|
|
16719
16911
|
}
|
|
16720
16912
|
function _jsonLoadFile(p) {
|
|
16721
16913
|
return JSON.parse(_readText(p));
|
|
@@ -16771,7 +16963,7 @@ function _classify_symlink(link) {
|
|
|
16771
16963
|
}
|
|
16772
16964
|
let target;
|
|
16773
16965
|
try {
|
|
16774
|
-
target =
|
|
16966
|
+
target = fs18.readlinkSync(link);
|
|
16775
16967
|
} catch {
|
|
16776
16968
|
return null;
|
|
16777
16969
|
}
|
|
@@ -16782,16 +16974,16 @@ function _classify_symlink(link) {
|
|
|
16782
16974
|
return "user";
|
|
16783
16975
|
}
|
|
16784
16976
|
function _detect_legacy_state(project) {
|
|
16785
|
-
return _isFile2(
|
|
16977
|
+
return _isFile2(path16.join(project, LEGACY_STATE_FILENAME));
|
|
16786
16978
|
}
|
|
16787
16979
|
function _detect_legacy_settings(project) {
|
|
16788
16980
|
const found = [];
|
|
16789
16981
|
for (const name of LEGACY_SETTINGS_FILES) {
|
|
16790
|
-
const flat =
|
|
16982
|
+
const flat = path16.join(project, name);
|
|
16791
16983
|
if (_isFile2(flat)) {
|
|
16792
16984
|
found.push(flat);
|
|
16793
16985
|
}
|
|
16794
|
-
const typed =
|
|
16986
|
+
const typed = path16.join(project, "settings", name);
|
|
16795
16987
|
if (_isFile2(typed)) {
|
|
16796
16988
|
found.push(typed);
|
|
16797
16989
|
}
|
|
@@ -16799,25 +16991,25 @@ function _detect_legacy_settings(project) {
|
|
|
16799
16991
|
return found;
|
|
16800
16992
|
}
|
|
16801
16993
|
function _detect_empty_shell(project) {
|
|
16802
|
-
const shell =
|
|
16994
|
+
const shell = path16.join(project, LEGACY_AGENT_CONFIG_SHELL);
|
|
16803
16995
|
if (!_isDir2(shell) || _isSymlink(shell)) {
|
|
16804
16996
|
return false;
|
|
16805
16997
|
}
|
|
16806
16998
|
try {
|
|
16807
|
-
return
|
|
16999
|
+
return fs18.readdirSync(shell).length === 0;
|
|
16808
17000
|
} catch {
|
|
16809
17001
|
return false;
|
|
16810
17002
|
}
|
|
16811
17003
|
}
|
|
16812
17004
|
function _detect_already_migrated(project) {
|
|
16813
|
-
if (_detect_npm(
|
|
17005
|
+
if (_detect_npm(path16.join(project, "package.json"))) {
|
|
16814
17006
|
return false;
|
|
16815
17007
|
}
|
|
16816
|
-
if (_detect_composer(
|
|
17008
|
+
if (_detect_composer(path16.join(project, "composer.json"))) {
|
|
16817
17009
|
return false;
|
|
16818
17010
|
}
|
|
16819
17011
|
for (const name of MANAGED_SYMLINKS) {
|
|
16820
|
-
if (_classify_symlink(
|
|
17012
|
+
if (_classify_symlink(path16.join(project, name)) === "legacy") {
|
|
16821
17013
|
return false;
|
|
16822
17014
|
}
|
|
16823
17015
|
}
|
|
@@ -16888,11 +17080,11 @@ function _purge_legacy_symlinks(project) {
|
|
|
16888
17080
|
const removed = [];
|
|
16889
17081
|
const preserved = [];
|
|
16890
17082
|
for (const name of MANAGED_SYMLINKS) {
|
|
16891
|
-
const link =
|
|
17083
|
+
const link = path16.join(project, name);
|
|
16892
17084
|
const kind = _classify_symlink(link);
|
|
16893
17085
|
if (kind === "legacy") {
|
|
16894
17086
|
try {
|
|
16895
|
-
|
|
17087
|
+
fs18.unlinkSync(link);
|
|
16896
17088
|
removed.push(name);
|
|
16897
17089
|
} catch {
|
|
16898
17090
|
preserved.push(name);
|
|
@@ -16904,14 +17096,14 @@ function _purge_legacy_symlinks(project) {
|
|
|
16904
17096
|
return [removed, preserved];
|
|
16905
17097
|
}
|
|
16906
17098
|
function _migrate_state_file(project) {
|
|
16907
|
-
const source =
|
|
17099
|
+
const source = path16.join(project, LEGACY_STATE_FILENAME);
|
|
16908
17100
|
if (!_isFile2(source)) {
|
|
16909
17101
|
return null;
|
|
16910
17102
|
}
|
|
16911
|
-
const target =
|
|
17103
|
+
const target = path16.join(project, LEGACY_STATE_V1_FILENAME);
|
|
16912
17104
|
if (_exists2(target)) {
|
|
16913
17105
|
try {
|
|
16914
|
-
|
|
17106
|
+
fs18.unlinkSync(source);
|
|
16915
17107
|
return `removed stale ${LEGACY_STATE_FILENAME} (v1 already present)`;
|
|
16916
17108
|
} catch {
|
|
16917
17109
|
return null;
|
|
@@ -16926,7 +17118,7 @@ function _migrate_state_file(project) {
|
|
|
16926
17118
|
}
|
|
16927
17119
|
function _load_state_migrator() {
|
|
16928
17120
|
const pkg_root = resolvePackageRoot(import.meta.url);
|
|
16929
|
-
const rel =
|
|
17121
|
+
const rel = path16.join(
|
|
16930
17122
|
"agent-src",
|
|
16931
17123
|
"templates",
|
|
16932
17124
|
"scripts",
|
|
@@ -16934,8 +17126,8 @@ function _load_state_migrator() {
|
|
|
16934
17126
|
"migration",
|
|
16935
17127
|
"v0_to_v1.ts"
|
|
16936
17128
|
);
|
|
16937
|
-
const driver = [
|
|
16938
|
-
(p) =>
|
|
17129
|
+
const driver = [path16.join(pkg_root, "dist", rel), path16.join(pkg_root, "src", rel)].find(
|
|
17130
|
+
(p) => fs18.existsSync(p)
|
|
16939
17131
|
) ?? null;
|
|
16940
17132
|
if (driver === null) {
|
|
16941
17133
|
return null;
|
|
@@ -16943,12 +17135,12 @@ function _load_state_migrator() {
|
|
|
16943
17135
|
const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
16944
17136
|
let tsxBin = null;
|
|
16945
17137
|
for (let dir = pkg_root; ; ) {
|
|
16946
|
-
const cand =
|
|
16947
|
-
if (
|
|
17138
|
+
const cand = path16.join(dir, "node_modules", ".bin", binName);
|
|
17139
|
+
if (fs18.existsSync(cand)) {
|
|
16948
17140
|
tsxBin = cand;
|
|
16949
17141
|
break;
|
|
16950
17142
|
}
|
|
16951
|
-
const parent =
|
|
17143
|
+
const parent = path16.dirname(dir);
|
|
16952
17144
|
if (parent === dir) break;
|
|
16953
17145
|
dir = parent;
|
|
16954
17146
|
}
|
|
@@ -16975,17 +17167,17 @@ function _delete_legacy_settings(project) {
|
|
|
16975
17167
|
const removed = [];
|
|
16976
17168
|
for (const p of _detect_legacy_settings(project)) {
|
|
16977
17169
|
try {
|
|
16978
|
-
|
|
16979
|
-
removed.push(
|
|
17170
|
+
fs18.unlinkSync(p);
|
|
17171
|
+
removed.push(path16.relative(project, p));
|
|
16980
17172
|
} catch {
|
|
16981
17173
|
continue;
|
|
16982
17174
|
}
|
|
16983
17175
|
}
|
|
16984
|
-
const settings_dir =
|
|
17176
|
+
const settings_dir = path16.join(project, "settings");
|
|
16985
17177
|
if (_isDir2(settings_dir) && !_isSymlink(settings_dir)) {
|
|
16986
17178
|
try {
|
|
16987
|
-
if (
|
|
16988
|
-
|
|
17179
|
+
if (fs18.readdirSync(settings_dir).length === 0) {
|
|
17180
|
+
fs18.rmdirSync(settings_dir);
|
|
16989
17181
|
removed.push("settings/");
|
|
16990
17182
|
}
|
|
16991
17183
|
} catch {
|
|
@@ -16994,12 +17186,12 @@ function _delete_legacy_settings(project) {
|
|
|
16994
17186
|
return removed;
|
|
16995
17187
|
}
|
|
16996
17188
|
function _remove_empty_shell(project) {
|
|
16997
|
-
const shell =
|
|
17189
|
+
const shell = path16.join(project, LEGACY_AGENT_CONFIG_SHELL);
|
|
16998
17190
|
if (!_detect_empty_shell(project)) {
|
|
16999
17191
|
return false;
|
|
17000
17192
|
}
|
|
17001
17193
|
try {
|
|
17002
|
-
|
|
17194
|
+
fs18.rmdirSync(shell);
|
|
17003
17195
|
} catch {
|
|
17004
17196
|
return false;
|
|
17005
17197
|
}
|
|
@@ -17009,7 +17201,7 @@ function _reEscape(s) {
|
|
|
17009
17201
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
17010
17202
|
}
|
|
17011
17203
|
function _update_gitignore(project) {
|
|
17012
|
-
const gitignore =
|
|
17204
|
+
const gitignore = path16.join(project, ".gitignore");
|
|
17013
17205
|
const block = `${GITIGNORE_BLOCK_START}
|
|
17014
17206
|
${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
|
|
17015
17207
|
`;
|
|
@@ -17040,16 +17232,16 @@ ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
|
|
|
17040
17232
|
}
|
|
17041
17233
|
function _build_plan(project) {
|
|
17042
17234
|
return {
|
|
17043
|
-
npm: _detect_npm(
|
|
17044
|
-
composer: _detect_composer(
|
|
17235
|
+
npm: _detect_npm(path16.join(project, "package.json")),
|
|
17236
|
+
composer: _detect_composer(path16.join(project, "composer.json")),
|
|
17045
17237
|
symlinks_legacy: MANAGED_SYMLINKS.filter(
|
|
17046
|
-
(name) => _classify_symlink(
|
|
17238
|
+
(name) => _classify_symlink(path16.join(project, name)) === "legacy"
|
|
17047
17239
|
),
|
|
17048
17240
|
symlinks_user: MANAGED_SYMLINKS.filter(
|
|
17049
|
-
(name) => _classify_symlink(
|
|
17241
|
+
(name) => _classify_symlink(path16.join(project, name)) === "user"
|
|
17050
17242
|
),
|
|
17051
|
-
state_file: _isFile2(
|
|
17052
|
-
settings_files: _detect_legacy_settings(project).map((p) =>
|
|
17243
|
+
state_file: _isFile2(path16.join(project, LEGACY_STATE_FILENAME)),
|
|
17244
|
+
settings_files: _detect_legacy_settings(project).map((p) => path16.relative(project, p)),
|
|
17053
17245
|
empty_shell: _detect_empty_shell(project)
|
|
17054
17246
|
};
|
|
17055
17247
|
}
|
|
@@ -17113,10 +17305,10 @@ function _warn_on_major_mismatch(from_major, plan, out) {
|
|
|
17113
17305
|
}
|
|
17114
17306
|
function _apply(project, out, err) {
|
|
17115
17307
|
const summary = [];
|
|
17116
|
-
if (_strip_npm_entry(
|
|
17308
|
+
if (_strip_npm_entry(path16.join(project, "package.json"))) {
|
|
17117
17309
|
summary.push(`removed ${PACKAGE_NAME_NPM} from package.json`);
|
|
17118
17310
|
}
|
|
17119
|
-
if (_strip_composer_entry(
|
|
17311
|
+
if (_strip_composer_entry(path16.join(project, "composer.json"))) {
|
|
17120
17312
|
summary.push(`removed ${PACKAGE_NAME_COMPOSER} from composer.json`);
|
|
17121
17313
|
}
|
|
17122
17314
|
const [removed_links, preserved_links] = _purge_legacy_symlinks(project);
|
|
@@ -17243,17 +17435,17 @@ function _isCliEntry() {
|
|
|
17243
17435
|
return false;
|
|
17244
17436
|
}
|
|
17245
17437
|
if (typeof __AGENT_CONFIG_CLI_DELEGATE__ !== "undefined" && __AGENT_CONFIG_CLI_DELEGATE__) {
|
|
17246
|
-
if (
|
|
17438
|
+
if (path16.basename(process2.argv[1], ".js") === "cmd_migrate") {
|
|
17247
17439
|
return true;
|
|
17248
17440
|
}
|
|
17249
17441
|
}
|
|
17250
|
-
const argvUrl = pathToFileURL(
|
|
17442
|
+
const argvUrl = pathToFileURL(path16.resolve(process2.argv[1])).href;
|
|
17251
17443
|
if (import.meta.url === argvUrl) {
|
|
17252
17444
|
return true;
|
|
17253
17445
|
}
|
|
17254
17446
|
try {
|
|
17255
|
-
const here =
|
|
17256
|
-
const argv =
|
|
17447
|
+
const here = fs18.realpathSync(fileURLToPath4(import.meta.url));
|
|
17448
|
+
const argv = fs18.realpathSync(path16.resolve(process2.argv[1]));
|
|
17257
17449
|
return here === argv;
|
|
17258
17450
|
} catch {
|
|
17259
17451
|
return false;
|
|
@@ -17290,34 +17482,34 @@ var ArgparseExit2 = class extends Error {
|
|
|
17290
17482
|
function expanduser6(p) {
|
|
17291
17483
|
if (p === "~") return os7.homedir();
|
|
17292
17484
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
17293
|
-
return
|
|
17485
|
+
return path17.join(os7.homedir(), p.slice(2));
|
|
17294
17486
|
}
|
|
17295
17487
|
return p;
|
|
17296
17488
|
}
|
|
17297
17489
|
function resolvePath(p) {
|
|
17298
17490
|
try {
|
|
17299
|
-
return
|
|
17491
|
+
return fs19.realpathSync(path17.resolve(p));
|
|
17300
17492
|
} catch {
|
|
17301
|
-
return
|
|
17493
|
+
return path17.resolve(p);
|
|
17302
17494
|
}
|
|
17303
17495
|
}
|
|
17304
17496
|
function isFile(p) {
|
|
17305
17497
|
try {
|
|
17306
|
-
return
|
|
17498
|
+
return fs19.statSync(p).isFile();
|
|
17307
17499
|
} catch {
|
|
17308
17500
|
return false;
|
|
17309
17501
|
}
|
|
17310
17502
|
}
|
|
17311
17503
|
function isDir(p) {
|
|
17312
17504
|
try {
|
|
17313
|
-
return
|
|
17505
|
+
return fs19.statSync(p).isDirectory();
|
|
17314
17506
|
} catch {
|
|
17315
17507
|
return false;
|
|
17316
17508
|
}
|
|
17317
17509
|
}
|
|
17318
17510
|
function pathExists(p) {
|
|
17319
17511
|
try {
|
|
17320
|
-
|
|
17512
|
+
fs19.statSync(p);
|
|
17321
17513
|
return true;
|
|
17322
17514
|
} catch {
|
|
17323
17515
|
return false;
|
|
@@ -17325,24 +17517,24 @@ function pathExists(p) {
|
|
|
17325
17517
|
}
|
|
17326
17518
|
function isSymlink(p) {
|
|
17327
17519
|
try {
|
|
17328
|
-
return
|
|
17520
|
+
return fs19.lstatSync(p).isSymbolicLink();
|
|
17329
17521
|
} catch {
|
|
17330
17522
|
return false;
|
|
17331
17523
|
}
|
|
17332
17524
|
}
|
|
17333
17525
|
function readText(p) {
|
|
17334
|
-
return
|
|
17526
|
+
return fs19.readFileSync(p, "utf-8");
|
|
17335
17527
|
}
|
|
17336
17528
|
function writeText(p, content) {
|
|
17337
|
-
|
|
17529
|
+
fs19.writeFileSync(p, content, "utf-8");
|
|
17338
17530
|
}
|
|
17339
17531
|
function mkdirp(p) {
|
|
17340
|
-
|
|
17532
|
+
fs19.mkdirSync(p, { recursive: true });
|
|
17341
17533
|
}
|
|
17342
17534
|
function sortedGlobStems(directory, suffix) {
|
|
17343
17535
|
let entries;
|
|
17344
17536
|
try {
|
|
17345
|
-
entries =
|
|
17537
|
+
entries = fs19.readdirSync(directory);
|
|
17346
17538
|
} catch {
|
|
17347
17539
|
return [];
|
|
17348
17540
|
}
|
|
@@ -17362,7 +17554,7 @@ function sortedGlobStems(directory, suffix) {
|
|
|
17362
17554
|
function countZips(directory) {
|
|
17363
17555
|
if (!isDir(directory)) return 0;
|
|
17364
17556
|
let n = 0;
|
|
17365
|
-
for (const name of
|
|
17557
|
+
for (const name of fs19.readdirSync(directory)) {
|
|
17366
17558
|
if (name.endsWith(".zip")) n += 1;
|
|
17367
17559
|
}
|
|
17368
17560
|
return n;
|
|
@@ -17370,35 +17562,35 @@ function countZips(directory) {
|
|
|
17370
17562
|
function sha256OfFile(p) {
|
|
17371
17563
|
let data;
|
|
17372
17564
|
try {
|
|
17373
|
-
data =
|
|
17565
|
+
data = fs19.readFileSync(p);
|
|
17374
17566
|
} catch {
|
|
17375
17567
|
return null;
|
|
17376
17568
|
}
|
|
17377
17569
|
return crypto3.createHash("sha256").update(data).digest("hex");
|
|
17378
17570
|
}
|
|
17379
17571
|
function atomicWrite0644(target, body, prefix) {
|
|
17380
|
-
const dir =
|
|
17381
|
-
const tmpName =
|
|
17572
|
+
const dir = path17.dirname(target);
|
|
17573
|
+
const tmpName = path17.join(
|
|
17382
17574
|
dir,
|
|
17383
17575
|
`${prefix}${process3.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
|
|
17384
17576
|
);
|
|
17385
17577
|
let fd = null;
|
|
17386
17578
|
try {
|
|
17387
|
-
fd =
|
|
17388
|
-
|
|
17389
|
-
|
|
17579
|
+
fd = fs19.openSync(tmpName, "wx", 420);
|
|
17580
|
+
fs19.writeFileSync(fd, body, "utf-8");
|
|
17581
|
+
fs19.closeSync(fd);
|
|
17390
17582
|
fd = null;
|
|
17391
|
-
|
|
17392
|
-
|
|
17583
|
+
fs19.chmodSync(tmpName, 420);
|
|
17584
|
+
fs19.renameSync(tmpName, target);
|
|
17393
17585
|
} catch (err) {
|
|
17394
17586
|
if (fd !== null) {
|
|
17395
17587
|
try {
|
|
17396
|
-
|
|
17588
|
+
fs19.closeSync(fd);
|
|
17397
17589
|
} catch {
|
|
17398
17590
|
}
|
|
17399
17591
|
}
|
|
17400
17592
|
try {
|
|
17401
|
-
|
|
17593
|
+
fs19.unlinkSync(tmpName);
|
|
17402
17594
|
} catch {
|
|
17403
17595
|
}
|
|
17404
17596
|
throw err;
|
|
@@ -17522,12 +17714,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
|
|
|
17522
17714
|
var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
|
|
17523
17715
|
var SETTINGS_SUBDIR = ["agents", "settings"];
|
|
17524
17716
|
function _canonical_settings_target(project_root) {
|
|
17525
|
-
return
|
|
17717
|
+
return path17.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
|
|
17526
17718
|
}
|
|
17527
17719
|
function _resolve_settings_read(project_root) {
|
|
17528
17720
|
const canonical = _canonical_settings_target(project_root);
|
|
17529
17721
|
if (pathExists(canonical)) return canonical;
|
|
17530
|
-
const legacy =
|
|
17722
|
+
const legacy = path17.join(project_root, SETTINGS_FILE);
|
|
17531
17723
|
if (pathExists(legacy)) return legacy;
|
|
17532
17724
|
return canonical;
|
|
17533
17725
|
}
|
|
@@ -17591,9 +17783,9 @@ function fail(msg) {
|
|
|
17591
17783
|
throw new SystemExitError(1);
|
|
17592
17784
|
}
|
|
17593
17785
|
function detect_package_root(project_root) {
|
|
17594
|
-
const npm_path =
|
|
17786
|
+
const npm_path = path17.join(project_root, "node_modules", "@event4u", "agent-config");
|
|
17595
17787
|
if (isDir(npm_path)) return resolvePath(npm_path);
|
|
17596
|
-
if (pathExists(
|
|
17788
|
+
if (pathExists(path17.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
17597
17789
|
return project_root;
|
|
17598
17790
|
}
|
|
17599
17791
|
fail(
|
|
@@ -17601,12 +17793,12 @@ function detect_package_root(project_root) {
|
|
|
17601
17793
|
);
|
|
17602
17794
|
}
|
|
17603
17795
|
function detect_package_type(package_root) {
|
|
17604
|
-
if (package_root.split(
|
|
17796
|
+
if (package_root.split(path17.sep).includes("node_modules")) return "npm";
|
|
17605
17797
|
return "local";
|
|
17606
17798
|
}
|
|
17607
17799
|
function detect_package_type_for_project(project_root, package_root) {
|
|
17608
17800
|
const npm_path = resolvePath(
|
|
17609
|
-
|
|
17801
|
+
path17.join(project_root, "node_modules", "@event4u", "agent-config")
|
|
17610
17802
|
);
|
|
17611
17803
|
const package_resolved = resolvePath(package_root);
|
|
17612
17804
|
if (package_resolved === npm_path) return "npm";
|
|
@@ -17626,7 +17818,7 @@ function ensure_directory(p) {
|
|
|
17626
17818
|
mkdirp(p);
|
|
17627
17819
|
}
|
|
17628
17820
|
function write_file(p, content) {
|
|
17629
|
-
ensure_directory(
|
|
17821
|
+
ensure_directory(path17.dirname(p));
|
|
17630
17822
|
writeText(p, content);
|
|
17631
17823
|
}
|
|
17632
17824
|
function read_json_file(p) {
|
|
@@ -17797,7 +17989,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
|
|
|
17797
17989
|
return rendered + "\n" + suffix;
|
|
17798
17990
|
}
|
|
17799
17991
|
function _migrate_legacy_if_present(project_root, template_body) {
|
|
17800
|
-
const legacy_target =
|
|
17992
|
+
const legacy_target = path17.join(project_root, LEGACY_SETTINGS_FILE);
|
|
17801
17993
|
if (!isFile(legacy_target)) return null;
|
|
17802
17994
|
const legacy_text = readText(legacy_target);
|
|
17803
17995
|
const [values, unknown] = _parse_legacy_settings(legacy_text);
|
|
@@ -17812,9 +18004,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
|
|
|
17812
18004
|
}
|
|
17813
18005
|
}
|
|
17814
18006
|
rendered = _append_unknown_legacy(rendered, values, unknown);
|
|
17815
|
-
const backup_target =
|
|
18007
|
+
const backup_target = path17.join(project_root, LEGACY_BACKUP_FILE);
|
|
17816
18008
|
writeText(backup_target, legacy_text);
|
|
17817
|
-
|
|
18009
|
+
fs19.unlinkSync(legacy_target);
|
|
17818
18010
|
info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
|
|
17819
18011
|
info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
|
|
17820
18012
|
if (unknown.length > 0) {
|
|
@@ -17849,7 +18041,7 @@ function _render_template(template, profile_values) {
|
|
|
17849
18041
|
return body;
|
|
17850
18042
|
}
|
|
17851
18043
|
function _load_valid_user_types(package_root) {
|
|
17852
|
-
const directory =
|
|
18044
|
+
const directory = path17.join(package_root, USER_TYPES_DIR);
|
|
17853
18045
|
if (!isDir(directory)) return [];
|
|
17854
18046
|
return sortedGlobStems(directory, ".yml");
|
|
17855
18047
|
}
|
|
@@ -17906,8 +18098,8 @@ function splitlinesKeepends(text) {
|
|
|
17906
18098
|
}
|
|
17907
18099
|
function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
|
|
17908
18100
|
const target = _canonical_settings_target(project_root);
|
|
17909
|
-
const profile_source =
|
|
17910
|
-
const template_source =
|
|
18101
|
+
const profile_source = path17.join(package_root, "src", "config", "profiles", `${profile}.ini`);
|
|
18102
|
+
const template_source = path17.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
17911
18103
|
if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
|
|
17912
18104
|
if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
|
|
17913
18105
|
const template = readText(template_source);
|
|
@@ -17921,21 +18113,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
17921
18113
|
if (profile_values["rule_loading_tier"] !== profile) {
|
|
17922
18114
|
const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
|
|
17923
18115
|
fail(
|
|
17924
|
-
`Profile preset ${
|
|
18116
|
+
`Profile preset ${path17.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
|
|
17925
18117
|
);
|
|
17926
18118
|
}
|
|
17927
18119
|
profile_values["user_type"] = _validate_user_type(package_root, user_type);
|
|
17928
18120
|
let template_body = _render_template(template, profile_values);
|
|
17929
18121
|
template_body = _inject_packs(template_body, packs ?? []);
|
|
17930
|
-
const legacy_root =
|
|
18122
|
+
const legacy_root = path17.join(project_root, SETTINGS_FILE);
|
|
17931
18123
|
if (isFile(legacy_root) && !pathExists(target)) {
|
|
17932
|
-
mkdirp(
|
|
18124
|
+
mkdirp(path17.dirname(target));
|
|
17933
18125
|
writeText(target, readText(legacy_root));
|
|
17934
|
-
|
|
18126
|
+
fs19.unlinkSync(legacy_root);
|
|
17935
18127
|
success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
|
|
17936
18128
|
return;
|
|
17937
18129
|
}
|
|
17938
|
-
const legacy_target =
|
|
18130
|
+
const legacy_target = path17.join(project_root, LEGACY_SETTINGS_FILE);
|
|
17939
18131
|
if (isFile(legacy_target) && pathExists(target)) {
|
|
17940
18132
|
warn(
|
|
17941
18133
|
`Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
|
|
@@ -17952,7 +18144,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
17952
18144
|
skip(`${SETTINGS_FILE} already exists`);
|
|
17953
18145
|
return;
|
|
17954
18146
|
}
|
|
17955
|
-
mkdirp(
|
|
18147
|
+
mkdirp(path17.dirname(target));
|
|
17956
18148
|
write_file(target, template_body);
|
|
17957
18149
|
const user_type_value = profile_values["user_type"] ?? "";
|
|
17958
18150
|
const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
|
|
@@ -17965,7 +18157,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
17965
18157
|
const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
|
|
17966
18158
|
const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
|
|
17967
18159
|
return merge_json_file(
|
|
17968
|
-
|
|
18160
|
+
path17.join(project_root, ".vscode", "settings.json"),
|
|
17969
18161
|
bridge,
|
|
17970
18162
|
force,
|
|
17971
18163
|
".vscode/settings.json"
|
|
@@ -17974,14 +18166,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
17974
18166
|
function ensure_augment_bridge(project_root, force) {
|
|
17975
18167
|
const bridge = { enabledPlugins: { "agent-config@event4u": true } };
|
|
17976
18168
|
return merge_json_file(
|
|
17977
|
-
|
|
18169
|
+
path17.join(project_root, ".augment", "settings.json"),
|
|
17978
18170
|
bridge,
|
|
17979
18171
|
force,
|
|
17980
18172
|
".augment/settings.json"
|
|
17981
18173
|
);
|
|
17982
18174
|
}
|
|
17983
|
-
var AUGMENT_USER_DIR =
|
|
17984
|
-
var AUGMENT_USER_HOOKS_DIR =
|
|
18175
|
+
var AUGMENT_USER_DIR = path17.join(os7.homedir(), ".augment");
|
|
18176
|
+
var AUGMENT_USER_HOOKS_DIR = path17.join(AUGMENT_USER_DIR, "hooks");
|
|
17985
18177
|
var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
|
|
17986
18178
|
var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
17987
18179
|
"augment-chat-history.sh",
|
|
@@ -17997,29 +18189,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
|
|
|
17997
18189
|
["post_tool_use", "PostToolUse"]
|
|
17998
18190
|
];
|
|
17999
18191
|
function _deploy_augment_trampoline(package_root, name, force) {
|
|
18000
|
-
const src =
|
|
18192
|
+
const src = path17.join(package_root, "scripts", "hooks", name);
|
|
18001
18193
|
if (!pathExists(src)) {
|
|
18002
18194
|
skip(`augment trampoline missing in package: ${src}`);
|
|
18003
18195
|
return null;
|
|
18004
18196
|
}
|
|
18005
18197
|
mkdirp(AUGMENT_USER_HOOKS_DIR);
|
|
18006
|
-
const dst =
|
|
18198
|
+
const dst = path17.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
18007
18199
|
const src_text = readText(src);
|
|
18008
18200
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
18009
18201
|
skip(`~/.augment/hooks/${name} already up to date`);
|
|
18010
18202
|
} else {
|
|
18011
18203
|
writeText(dst, src_text);
|
|
18012
|
-
|
|
18204
|
+
fs19.chmodSync(dst, 493);
|
|
18013
18205
|
success(`~/.augment/hooks/${name} installed`);
|
|
18014
18206
|
}
|
|
18015
18207
|
return dst;
|
|
18016
18208
|
}
|
|
18017
18209
|
function _remove_legacy_augment_trampolines() {
|
|
18018
18210
|
for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
|
|
18019
|
-
const legacy =
|
|
18211
|
+
const legacy = path17.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
18020
18212
|
try {
|
|
18021
18213
|
if (isFile(legacy)) {
|
|
18022
|
-
|
|
18214
|
+
fs19.unlinkSync(legacy);
|
|
18023
18215
|
skip(`removed legacy ~/.augment/hooks/${name}`);
|
|
18024
18216
|
}
|
|
18025
18217
|
} catch (err) {
|
|
@@ -18039,7 +18231,7 @@ function ensure_augment_user_hooks(package_root, force) {
|
|
|
18039
18231
|
}
|
|
18040
18232
|
const settings_patch = { hooks: per_event };
|
|
18041
18233
|
return merge_json_file(
|
|
18042
|
-
|
|
18234
|
+
path17.join(AUGMENT_USER_DIR, "settings.json"),
|
|
18043
18235
|
settings_patch,
|
|
18044
18236
|
force,
|
|
18045
18237
|
"~/.augment/settings.json"
|
|
@@ -18064,7 +18256,7 @@ function _heal_legacy_claude_plugin_ids(p) {
|
|
|
18064
18256
|
return removed;
|
|
18065
18257
|
}
|
|
18066
18258
|
function ensure_claude_bridge(project_root, force) {
|
|
18067
|
-
const target =
|
|
18259
|
+
const target = path17.join(project_root, ".claude", "settings.json");
|
|
18068
18260
|
const healed = _heal_legacy_claude_plugin_ids(target);
|
|
18069
18261
|
for (const pid of healed) {
|
|
18070
18262
|
success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
|
|
@@ -18089,29 +18281,29 @@ function ensure_cursor_bridge(project_root, force) {
|
|
|
18089
18281
|
}
|
|
18090
18282
|
const bridge = { version: 1, hooks };
|
|
18091
18283
|
return merge_json_file(
|
|
18092
|
-
|
|
18284
|
+
path17.join(project_root, ".cursor", "hooks.json"),
|
|
18093
18285
|
bridge,
|
|
18094
18286
|
force,
|
|
18095
18287
|
".cursor/hooks.json"
|
|
18096
18288
|
);
|
|
18097
18289
|
}
|
|
18098
|
-
var CURSOR_USER_DIR =
|
|
18099
|
-
var CURSOR_USER_HOOKS_DIR =
|
|
18290
|
+
var CURSOR_USER_DIR = path17.join(os7.homedir(), ".cursor");
|
|
18291
|
+
var CURSOR_USER_HOOKS_DIR = path17.join(CURSOR_USER_DIR, "hooks");
|
|
18100
18292
|
var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
|
|
18101
18293
|
function ensure_cursor_user_hooks(package_root, force) {
|
|
18102
|
-
const src =
|
|
18294
|
+
const src = path17.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
|
|
18103
18295
|
if (!pathExists(src)) {
|
|
18104
18296
|
skip(`cursor trampoline missing in package: ${src}`);
|
|
18105
18297
|
return [];
|
|
18106
18298
|
}
|
|
18107
18299
|
mkdirp(CURSOR_USER_HOOKS_DIR);
|
|
18108
|
-
const dst =
|
|
18300
|
+
const dst = path17.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
|
|
18109
18301
|
const src_text = readText(src);
|
|
18110
18302
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
18111
18303
|
skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
18112
18304
|
} else {
|
|
18113
18305
|
writeText(dst, src_text);
|
|
18114
|
-
|
|
18306
|
+
fs19.chmodSync(dst, 493);
|
|
18115
18307
|
success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
|
|
18116
18308
|
}
|
|
18117
18309
|
const hooks = {};
|
|
@@ -18120,7 +18312,7 @@ function ensure_cursor_user_hooks(package_root, force) {
|
|
|
18120
18312
|
}
|
|
18121
18313
|
const settings_patch = { version: 1, hooks };
|
|
18122
18314
|
return merge_json_file(
|
|
18123
|
-
|
|
18315
|
+
path17.join(CURSOR_USER_DIR, "hooks.json"),
|
|
18124
18316
|
settings_patch,
|
|
18125
18317
|
force,
|
|
18126
18318
|
"~/.cursor/hooks.json"
|
|
@@ -18163,12 +18355,12 @@ exit 0
|
|
|
18163
18355
|
`;
|
|
18164
18356
|
}
|
|
18165
18357
|
function ensure_cline_bridge(project_root, force) {
|
|
18166
|
-
const hooks_dir =
|
|
18358
|
+
const hooks_dir = path17.join(project_root, ".clinerules", "hooks");
|
|
18167
18359
|
mkdirp(hooks_dir);
|
|
18168
18360
|
const workspace_quoted = shlexQuote(resolvePath(project_root));
|
|
18169
18361
|
let written = 0;
|
|
18170
18362
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
18171
|
-
const target =
|
|
18363
|
+
const target = path17.join(hooks_dir, native_event);
|
|
18172
18364
|
const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
|
|
18173
18365
|
if (pathExists(target) && readText(target) === body && !force) {
|
|
18174
18366
|
continue;
|
|
@@ -18178,7 +18370,7 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
18178
18370
|
continue;
|
|
18179
18371
|
}
|
|
18180
18372
|
writeText(target, body);
|
|
18181
|
-
|
|
18373
|
+
fs19.chmodSync(target, 493);
|
|
18182
18374
|
written += 1;
|
|
18183
18375
|
}
|
|
18184
18376
|
if (written) {
|
|
@@ -18187,27 +18379,27 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
18187
18379
|
skip(".clinerules/hooks/ already up to date");
|
|
18188
18380
|
}
|
|
18189
18381
|
}
|
|
18190
|
-
var CLINE_USER_DIR =
|
|
18382
|
+
var CLINE_USER_DIR = path17.join(os7.homedir(), "Documents", "Cline", "Hooks");
|
|
18191
18383
|
var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
|
|
18192
18384
|
function ensure_cline_user_hooks(package_root, force) {
|
|
18193
|
-
const src =
|
|
18385
|
+
const src = path17.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
|
|
18194
18386
|
if (!pathExists(src)) {
|
|
18195
18387
|
skip(`cline trampoline missing in package: ${src}`);
|
|
18196
18388
|
return;
|
|
18197
18389
|
}
|
|
18198
18390
|
mkdirp(CLINE_USER_DIR);
|
|
18199
|
-
const trampoline =
|
|
18391
|
+
const trampoline = path17.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
|
|
18200
18392
|
const src_text = readText(src);
|
|
18201
18393
|
if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
|
|
18202
18394
|
skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
18203
18395
|
} else {
|
|
18204
18396
|
writeText(trampoline, src_text);
|
|
18205
|
-
|
|
18397
|
+
fs19.chmodSync(trampoline, 493);
|
|
18206
18398
|
success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
|
|
18207
18399
|
}
|
|
18208
18400
|
const trampoline_quoted = shlexQuote(trampoline);
|
|
18209
18401
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
18210
|
-
const wrapper =
|
|
18402
|
+
const wrapper = path17.join(CLINE_USER_DIR, native_event);
|
|
18211
18403
|
const body = `#!/usr/bin/env bash
|
|
18212
18404
|
# Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
|
|
18213
18405
|
# User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
|
|
@@ -18217,7 +18409,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
|
|
|
18217
18409
|
continue;
|
|
18218
18410
|
}
|
|
18219
18411
|
writeText(wrapper, body);
|
|
18220
|
-
|
|
18412
|
+
fs19.chmodSync(wrapper, 493);
|
|
18221
18413
|
}
|
|
18222
18414
|
}
|
|
18223
18415
|
var WINDSURF_DISPATCHER_BINDINGS = [
|
|
@@ -18238,29 +18430,29 @@ function ensure_windsurf_bridge(project_root, force) {
|
|
|
18238
18430
|
}
|
|
18239
18431
|
const bridge = { hooks };
|
|
18240
18432
|
return merge_json_file(
|
|
18241
|
-
|
|
18433
|
+
path17.join(project_root, ".windsurf", "hooks.json"),
|
|
18242
18434
|
bridge,
|
|
18243
18435
|
force,
|
|
18244
18436
|
".windsurf/hooks.json"
|
|
18245
18437
|
);
|
|
18246
18438
|
}
|
|
18247
|
-
var WINDSURF_USER_DIR =
|
|
18248
|
-
var WINDSURF_USER_HOOKS_DIR =
|
|
18439
|
+
var WINDSURF_USER_DIR = path17.join(os7.homedir(), ".codeium", "windsurf");
|
|
18440
|
+
var WINDSURF_USER_HOOKS_DIR = path17.join(WINDSURF_USER_DIR, "hooks");
|
|
18249
18441
|
var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
|
|
18250
18442
|
function ensure_windsurf_user_hooks(package_root, force) {
|
|
18251
|
-
const src =
|
|
18443
|
+
const src = path17.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
18252
18444
|
if (!pathExists(src)) {
|
|
18253
18445
|
skip(`windsurf trampoline missing in package: ${src}`);
|
|
18254
18446
|
return [];
|
|
18255
18447
|
}
|
|
18256
18448
|
mkdirp(WINDSURF_USER_HOOKS_DIR);
|
|
18257
|
-
const dst =
|
|
18449
|
+
const dst = path17.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
18258
18450
|
const src_text = readText(src);
|
|
18259
18451
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
18260
18452
|
skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
18261
18453
|
} else {
|
|
18262
18454
|
writeText(dst, src_text);
|
|
18263
|
-
|
|
18455
|
+
fs19.chmodSync(dst, 493);
|
|
18264
18456
|
success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
|
|
18265
18457
|
}
|
|
18266
18458
|
const hooks = {};
|
|
@@ -18272,7 +18464,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
|
|
|
18272
18464
|
}
|
|
18273
18465
|
const settings_patch = { hooks };
|
|
18274
18466
|
return merge_json_file(
|
|
18275
|
-
|
|
18467
|
+
path17.join(WINDSURF_USER_DIR, "hooks.json"),
|
|
18276
18468
|
settings_patch,
|
|
18277
18469
|
force,
|
|
18278
18470
|
"~/.codeium/windsurf/hooks.json"
|
|
@@ -18301,43 +18493,43 @@ function _gemini_hooks_dict(command_factory) {
|
|
|
18301
18493
|
function ensure_gemini_bridge(project_root, force) {
|
|
18302
18494
|
const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
|
|
18303
18495
|
return merge_json_file(
|
|
18304
|
-
|
|
18496
|
+
path17.join(project_root, ".gemini", "settings.json"),
|
|
18305
18497
|
bridge,
|
|
18306
18498
|
force,
|
|
18307
18499
|
".gemini/settings.json"
|
|
18308
18500
|
);
|
|
18309
18501
|
}
|
|
18310
|
-
var GEMINI_USER_DIR =
|
|
18311
|
-
var GEMINI_USER_HOOKS_DIR =
|
|
18502
|
+
var GEMINI_USER_DIR = path17.join(os7.homedir(), ".gemini");
|
|
18503
|
+
var GEMINI_USER_HOOKS_DIR = path17.join(GEMINI_USER_DIR, "hooks");
|
|
18312
18504
|
var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
|
|
18313
18505
|
function ensure_gemini_user_hooks(package_root, force) {
|
|
18314
|
-
const src =
|
|
18506
|
+
const src = path17.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
|
|
18315
18507
|
if (!pathExists(src)) {
|
|
18316
18508
|
skip(`gemini trampoline missing in package: ${src}`);
|
|
18317
18509
|
return [];
|
|
18318
18510
|
}
|
|
18319
18511
|
mkdirp(GEMINI_USER_HOOKS_DIR);
|
|
18320
|
-
const dst =
|
|
18512
|
+
const dst = path17.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
|
|
18321
18513
|
const src_text = readText(src);
|
|
18322
18514
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
18323
18515
|
skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
18324
18516
|
} else {
|
|
18325
18517
|
writeText(dst, src_text);
|
|
18326
|
-
|
|
18518
|
+
fs19.chmodSync(dst, 493);
|
|
18327
18519
|
success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
|
|
18328
18520
|
}
|
|
18329
18521
|
const settings_patch = {
|
|
18330
18522
|
hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
|
|
18331
18523
|
};
|
|
18332
18524
|
return merge_json_file(
|
|
18333
|
-
|
|
18525
|
+
path17.join(GEMINI_USER_DIR, "settings.json"),
|
|
18334
18526
|
settings_patch,
|
|
18335
18527
|
force,
|
|
18336
18528
|
"~/.gemini/settings.json"
|
|
18337
18529
|
);
|
|
18338
18530
|
}
|
|
18339
18531
|
function ensure_copilot_bridge(project_root, force) {
|
|
18340
|
-
const target =
|
|
18532
|
+
const target = path17.join(project_root, ".github", "plugin", "marketplace.json");
|
|
18341
18533
|
const bridge = {
|
|
18342
18534
|
marketplace: {
|
|
18343
18535
|
name: "event4u-agent-marketplace",
|
|
@@ -18380,7 +18572,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
|
|
|
18380
18572
|
Run \`./agent-config --help\` for available commands.
|
|
18381
18573
|
`;
|
|
18382
18574
|
function ensure_roocode_bridge(project_root, force) {
|
|
18383
|
-
const target =
|
|
18575
|
+
const target = path17.join(project_root, ".roo", "rules", "agent-config.md");
|
|
18384
18576
|
if (pathExists(target) && !force) {
|
|
18385
18577
|
skip(".roo/rules/agent-config.md already exists");
|
|
18386
18578
|
return;
|
|
@@ -18402,7 +18594,7 @@ To wire Claude Desktop to this project's rules, run:
|
|
|
18402
18594
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18403
18595
|
`;
|
|
18404
18596
|
function ensure_claude_desktop_bridge(project_root, force) {
|
|
18405
|
-
const target =
|
|
18597
|
+
const target = path17.join(project_root, ".claude-desktop", "agent-config.md");
|
|
18406
18598
|
if (pathExists(target) && !force) {
|
|
18407
18599
|
skip(".claude-desktop/agent-config.md already exists");
|
|
18408
18600
|
return;
|
|
@@ -18427,7 +18619,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
|
|
|
18427
18619
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18428
18620
|
`;
|
|
18429
18621
|
function ensure_aider_bridge(project_root, force) {
|
|
18430
|
-
const target =
|
|
18622
|
+
const target = path17.join(project_root, ".aider", "agent-config.md");
|
|
18431
18623
|
if (pathExists(target) && !force) {
|
|
18432
18624
|
skip(".aider/agent-config.md already exists");
|
|
18433
18625
|
return;
|
|
@@ -18446,7 +18638,7 @@ developers where the rules and skills live.
|
|
|
18446
18638
|
Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
|
|
18447
18639
|
`;
|
|
18448
18640
|
function ensure_codex_bridge(project_root, force) {
|
|
18449
|
-
const target =
|
|
18641
|
+
const target = path17.join(project_root, ".codex", "agent-config.md");
|
|
18450
18642
|
if (pathExists(target) && !force) {
|
|
18451
18643
|
skip(".codex/agent-config.md already exists");
|
|
18452
18644
|
return;
|
|
@@ -18464,7 +18656,7 @@ rules per session. The canonical rule and skill source lives under
|
|
|
18464
18656
|
orientation).
|
|
18465
18657
|
`;
|
|
18466
18658
|
function ensure_continue_bridge(project_root, force) {
|
|
18467
|
-
const target =
|
|
18659
|
+
const target = path17.join(project_root, ".continue", "rules", "agent-config.md");
|
|
18468
18660
|
if (pathExists(target) && !force) {
|
|
18469
18661
|
skip(".continue/rules/agent-config.md already exists");
|
|
18470
18662
|
return;
|
|
@@ -18495,7 +18687,7 @@ orientation).
|
|
|
18495
18687
|
See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
|
|
18496
18688
|
`;
|
|
18497
18689
|
function ensure_kilocode_bridge(project_root, force) {
|
|
18498
|
-
const target =
|
|
18690
|
+
const target = path17.join(project_root, ".kilocode", "rules", "agent-config.md");
|
|
18499
18691
|
if (pathExists(target) && !force) {
|
|
18500
18692
|
skip(".kilocode/rules/agent-config.md already exists");
|
|
18501
18693
|
return;
|
|
@@ -18522,7 +18714,7 @@ canonical source (or symlink it):
|
|
|
18522
18714
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18523
18715
|
`;
|
|
18524
18716
|
function ensure_zed_bridge(project_root, force) {
|
|
18525
|
-
const target =
|
|
18717
|
+
const target = path17.join(project_root, ".zed", "agent-config.md");
|
|
18526
18718
|
if (pathExists(target) && !force) {
|
|
18527
18719
|
skip(".zed/agent-config.md already exists");
|
|
18528
18720
|
return;
|
|
@@ -18543,7 +18735,7 @@ rules into your JetBrains profile.
|
|
|
18543
18735
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18544
18736
|
`;
|
|
18545
18737
|
function ensure_jetbrains_bridge(project_root, force) {
|
|
18546
|
-
const target =
|
|
18738
|
+
const target = path17.join(project_root, ".jetbrains", "agent-config.md");
|
|
18547
18739
|
if (pathExists(target) && !force) {
|
|
18548
18740
|
skip(".jetbrains/agent-config.md already exists");
|
|
18549
18741
|
return;
|
|
@@ -18574,7 +18766,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
|
|
|
18574
18766
|
See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
|
|
18575
18767
|
`;
|
|
18576
18768
|
function ensure_kiro_bridge(project_root, force) {
|
|
18577
|
-
const target =
|
|
18769
|
+
const target = path17.join(project_root, ".kiro", "steering", "agent-config.md");
|
|
18578
18770
|
if (pathExists(target) && !force) {
|
|
18579
18771
|
skip(".kiro/steering/agent-config.md already exists");
|
|
18580
18772
|
return;
|
|
@@ -18600,35 +18792,35 @@ var SMOKE_BRIDGE_PATHS = {
|
|
|
18600
18792
|
};
|
|
18601
18793
|
function dirHasEntries(p) {
|
|
18602
18794
|
try {
|
|
18603
|
-
return
|
|
18795
|
+
return fs19.readdirSync(p).length > 0;
|
|
18604
18796
|
} catch {
|
|
18605
18797
|
return false;
|
|
18606
18798
|
}
|
|
18607
18799
|
}
|
|
18608
18800
|
function _resolve_tsx_invocation(scriptPath, scriptArgs) {
|
|
18609
18801
|
const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
18610
|
-
let dir =
|
|
18802
|
+
let dir = path17.dirname(scriptPath);
|
|
18611
18803
|
for (; ; ) {
|
|
18612
|
-
const candidate =
|
|
18804
|
+
const candidate = path17.join(dir, "node_modules", ".bin", binName);
|
|
18613
18805
|
if (isFile(candidate)) {
|
|
18614
18806
|
return { command: candidate, args: [scriptPath, ...scriptArgs] };
|
|
18615
18807
|
}
|
|
18616
|
-
const parent =
|
|
18808
|
+
const parent = path17.dirname(dir);
|
|
18617
18809
|
if (parent === dir) break;
|
|
18618
18810
|
dir = parent;
|
|
18619
18811
|
}
|
|
18620
18812
|
return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
|
|
18621
18813
|
}
|
|
18622
18814
|
function _smoke_test_hooks(project_root, package_root) {
|
|
18623
|
-
const dispatcher =
|
|
18624
|
-
const manifest =
|
|
18815
|
+
const dispatcher = path17.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
|
|
18816
|
+
const manifest = path17.join(package_root, "scripts", "hook_manifest.yaml");
|
|
18625
18817
|
if (!isFile(dispatcher) || !isFile(manifest)) return 0;
|
|
18626
18818
|
const failed = [];
|
|
18627
18819
|
const skipped = [];
|
|
18628
18820
|
const passed = [];
|
|
18629
18821
|
for (const [platform, native] of SMOKE_PROBE_EVENTS) {
|
|
18630
18822
|
const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
|
|
18631
|
-
const bridge_path = rel_bridge ?
|
|
18823
|
+
const bridge_path = rel_bridge ? path17.join(project_root, rel_bridge) : null;
|
|
18632
18824
|
const bridge_present = Boolean(
|
|
18633
18825
|
bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
|
|
18634
18826
|
);
|
|
@@ -18828,9 +19020,9 @@ To remove this marker, delete this file.
|
|
|
18828
19020
|
`;
|
|
18829
19021
|
}
|
|
18830
19022
|
var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
|
|
18831
|
-
var GLOBAL_ROOT =
|
|
18832
|
-
var GLOBAL_USER_SETTINGS_PATH =
|
|
18833
|
-
var GLOBAL_AGENT_SETTINGS_PATH =
|
|
19023
|
+
var GLOBAL_ROOT = path17.join(os7.homedir(), ".event4u", "agent-config");
|
|
19024
|
+
var GLOBAL_USER_SETTINGS_PATH = path17.join(GLOBAL_ROOT, ".agent-user.yml");
|
|
19025
|
+
var GLOBAL_AGENT_SETTINGS_PATH = path17.join(GLOBAL_ROOT, ".agent-settings.yml");
|
|
18834
19026
|
function _bridge_marker(tool_id, scope) {
|
|
18835
19027
|
if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
|
|
18836
19028
|
return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
|
|
@@ -18879,7 +19071,7 @@ function _load_yaml_doc(p) {
|
|
|
18879
19071
|
return _isPlainObject2(data) ? data : {};
|
|
18880
19072
|
}
|
|
18881
19073
|
function _load_default_settings(package_root) {
|
|
18882
|
-
const template_source =
|
|
19074
|
+
const template_source = path17.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
18883
19075
|
if (!pathExists(template_source)) return {};
|
|
18884
19076
|
let text;
|
|
18885
19077
|
try {
|
|
@@ -18893,11 +19085,11 @@ function _load_default_settings(package_root) {
|
|
|
18893
19085
|
}
|
|
18894
19086
|
var RULE_LAYER_CHOICES = ["global", "project", "both-acknowledged"];
|
|
18895
19087
|
function _suppress_rule_layer(project_root, suppress_dir) {
|
|
18896
|
-
const target =
|
|
19088
|
+
const target = path17.join(project_root, ".claude", "settings.local.json");
|
|
18897
19089
|
const existing = pathExists(target) ? read_json_file(target) : {};
|
|
18898
19090
|
let real_dir = suppress_dir;
|
|
18899
19091
|
try {
|
|
18900
|
-
real_dir =
|
|
19092
|
+
real_dir = fs19.realpathSync(suppress_dir);
|
|
18901
19093
|
} catch {
|
|
18902
19094
|
real_dir = suppress_dir;
|
|
18903
19095
|
}
|
|
@@ -18908,8 +19100,8 @@ function _suppress_rule_layer(project_root, suppress_dir) {
|
|
|
18908
19100
|
success(`.claude/settings.local.json: claudeMdExcludes += ${entry}`);
|
|
18909
19101
|
}
|
|
18910
19102
|
function _gate_rule_layer_overlap(project_root, layer, dry_run) {
|
|
18911
|
-
const global_dir =
|
|
18912
|
-
const project_dir =
|
|
19103
|
+
const global_dir = path17.join(os7.homedir(), ".claude", "rules");
|
|
19104
|
+
const project_dir = path17.join(project_root, ".claude", "rules");
|
|
18913
19105
|
const g = readRuleLayer(global_dir);
|
|
18914
19106
|
const p = readRuleLayer(project_dir);
|
|
18915
19107
|
if (g === null || p === null) return true;
|
|
@@ -19019,9 +19211,9 @@ function detect_scope(cwd) {
|
|
|
19019
19211
|
if (pathExists(_resolve_settings_read(cwd))) {
|
|
19020
19212
|
return ["project", `existing ${SETTINGS_FILE}`];
|
|
19021
19213
|
}
|
|
19022
|
-
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(
|
|
19023
|
-
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(
|
|
19024
|
-
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(
|
|
19214
|
+
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path17.join(cwd, m))) ?? null;
|
|
19215
|
+
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path17.join(cwd, d))) ?? null;
|
|
19216
|
+
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path17.join(cwd, f))) ?? null;
|
|
19025
19217
|
if (has_manifest && (has_ai_dir || has_ai_file)) {
|
|
19026
19218
|
const marker = has_ai_dir || has_ai_file;
|
|
19027
19219
|
return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
|
|
@@ -19042,7 +19234,7 @@ function readLineSyncRaw(promptText) {
|
|
|
19042
19234
|
for (; ; ) {
|
|
19043
19235
|
let n;
|
|
19044
19236
|
try {
|
|
19045
|
-
n =
|
|
19237
|
+
n = fs19.readSync(0, buf, 0, 1, null);
|
|
19046
19238
|
} catch (err) {
|
|
19047
19239
|
const code = err.code;
|
|
19048
19240
|
if (code === "EAGAIN") {
|
|
@@ -19117,8 +19309,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
|
|
|
19117
19309
|
const marker = _bridge_marker(tool_id, scope);
|
|
19118
19310
|
if (!marker) continue;
|
|
19119
19311
|
let marker_path = marker;
|
|
19120
|
-
if (!
|
|
19121
|
-
marker_path =
|
|
19312
|
+
if (!path17.isAbsolute(marker_path)) {
|
|
19313
|
+
marker_path = path17.join(project_root, marker_path);
|
|
19122
19314
|
}
|
|
19123
19315
|
out[tool_id] = [_file_entry(marker_path, "bridge", false)];
|
|
19124
19316
|
}
|
|
@@ -19157,26 +19349,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
|
|
|
19157
19349
|
}
|
|
19158
19350
|
write_manifest(target, version, entries);
|
|
19159
19351
|
if (!state.QUIET) {
|
|
19160
|
-
const rel = isRelativeTo(target, project_root) ?
|
|
19352
|
+
const rel = isRelativeTo(target, project_root) ? path17.relative(project_root, target) : target;
|
|
19161
19353
|
info(`Manifest updated: ${rel}`);
|
|
19162
19354
|
}
|
|
19163
19355
|
return 0;
|
|
19164
19356
|
}
|
|
19165
19357
|
function isRelativeTo(child, parent) {
|
|
19166
|
-
const rel =
|
|
19167
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
19358
|
+
const rel = path17.relative(parent, child);
|
|
19359
|
+
return rel === "" || !rel.startsWith("..") && !path17.isAbsolute(rel);
|
|
19168
19360
|
}
|
|
19169
19361
|
function _resolve_package_root_for_global() {
|
|
19170
19362
|
const here = resolvePath(_HERE2);
|
|
19171
|
-
const candidate =
|
|
19172
|
-
if (!pathExists(
|
|
19363
|
+
const candidate = path17.dirname(path17.dirname(path17.dirname(here)));
|
|
19364
|
+
if (!pathExists(path17.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
|
|
19173
19365
|
fail(
|
|
19174
19366
|
`Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
|
|
19175
19367
|
);
|
|
19176
19368
|
}
|
|
19177
19369
|
return candidate;
|
|
19178
19370
|
}
|
|
19179
|
-
var CONSUMER_BRIDGE_MARKER_RELPATH =
|
|
19371
|
+
var CONSUMER_BRIDGE_MARKER_RELPATH = path17.join("agents", ".event4u-bridge.yml");
|
|
19180
19372
|
var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
19181
19373
|
var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
|
|
19182
19374
|
var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
|
|
@@ -19184,7 +19376,7 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
19184
19376
|
if (process3.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
|
|
19185
19377
|
return [false, "consumer-mode-override"];
|
|
19186
19378
|
}
|
|
19187
|
-
const pkg_json =
|
|
19379
|
+
const pkg_json = path17.join(project_root, "package.json");
|
|
19188
19380
|
if (isFile(pkg_json)) {
|
|
19189
19381
|
let data = {};
|
|
19190
19382
|
try {
|
|
@@ -19196,18 +19388,18 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
19196
19388
|
return [true, "package.json:name"];
|
|
19197
19389
|
}
|
|
19198
19390
|
}
|
|
19199
|
-
if (isDir(
|
|
19391
|
+
if (isDir(path17.join(project_root, ".agent-src.uncondensed"))) {
|
|
19200
19392
|
return [true, ".agent-src.uncondensed/"];
|
|
19201
19393
|
}
|
|
19202
|
-
const packages_dir =
|
|
19394
|
+
const packages_dir = path17.join(project_root, "packages");
|
|
19203
19395
|
if (isDir(packages_dir)) {
|
|
19204
|
-
for (const child of
|
|
19205
|
-
if (isDir(
|
|
19396
|
+
for (const child of fs19.readdirSync(packages_dir)) {
|
|
19397
|
+
if (isDir(path17.join(packages_dir, child, ".agent-src.uncondensed"))) {
|
|
19206
19398
|
return [true, `packages/${child}/.agent-src.uncondensed/`];
|
|
19207
19399
|
}
|
|
19208
19400
|
}
|
|
19209
19401
|
}
|
|
19210
|
-
const installer_self =
|
|
19402
|
+
const installer_self = path17.join(project_root, "scripts", "install.py");
|
|
19211
19403
|
try {
|
|
19212
19404
|
if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE2)) {
|
|
19213
19405
|
return [true, "src/scripts/install.py (self)"];
|
|
@@ -19227,17 +19419,17 @@ function _detect_legacy_for_migration(project_root) {
|
|
|
19227
19419
|
}
|
|
19228
19420
|
return [];
|
|
19229
19421
|
}
|
|
19230
|
-
if (isFile(
|
|
19422
|
+
if (isFile(path17.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
|
|
19231
19423
|
const found = [];
|
|
19232
19424
|
for (const name of MIGRATE_LEGACY_YAML_FILES) {
|
|
19233
|
-
if (isFile(
|
|
19425
|
+
if (isFile(path17.join(project_root, name))) {
|
|
19234
19426
|
found.push(name);
|
|
19235
|
-
} else if (isFile(
|
|
19427
|
+
} else if (isFile(path17.join(project_root, "settings", name))) {
|
|
19236
19428
|
found.push(`settings/${name}`);
|
|
19237
19429
|
}
|
|
19238
19430
|
}
|
|
19239
19431
|
for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
|
|
19240
|
-
const p =
|
|
19432
|
+
const p = path17.join(project_root, name);
|
|
19241
19433
|
if (isDir(p) && !isSymlink(p)) {
|
|
19242
19434
|
found.push(`${name}/`);
|
|
19243
19435
|
}
|
|
@@ -19249,7 +19441,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
|
|
|
19249
19441
|
process3.stdout.write("\n");
|
|
19250
19442
|
warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
|
|
19251
19443
|
for (const rel of artefacts) {
|
|
19252
|
-
info(` ${
|
|
19444
|
+
info(` ${path17.join(project_root, rel)}`);
|
|
19253
19445
|
}
|
|
19254
19446
|
info("The unified `agent-config migrate` sweeps these in one pass.");
|
|
19255
19447
|
info("The wizard recreates fresh config afterwards.");
|
|
@@ -19280,20 +19472,20 @@ function _run_migrate_to_global(project_root) {
|
|
|
19280
19472
|
function _format_global_root_for_marker(global_root) {
|
|
19281
19473
|
const home = resolvePath(os7.homedir());
|
|
19282
19474
|
const resolved = resolvePath(global_root);
|
|
19283
|
-
const rel =
|
|
19284
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
19475
|
+
const rel = path17.relative(home, resolved);
|
|
19476
|
+
if (rel === "" || rel.startsWith("..") || path17.isAbsolute(rel)) {
|
|
19285
19477
|
return global_root;
|
|
19286
19478
|
}
|
|
19287
|
-
return `~/${rel.split(
|
|
19479
|
+
return `~/${rel.split(path17.sep).join("/")}`;
|
|
19288
19480
|
}
|
|
19289
19481
|
function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
|
|
19290
19482
|
const env_map = env ?? process3.env;
|
|
19291
19483
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
|
|
19292
|
-
if (isDir(
|
|
19293
|
-
const target =
|
|
19484
|
+
if (isDir(path17.join(project_root, ".agent-src.uncondensed"))) return null;
|
|
19485
|
+
const target = path17.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
|
|
19294
19486
|
if (!isFile(target)) return null;
|
|
19295
19487
|
try {
|
|
19296
|
-
|
|
19488
|
+
fs19.rmSync(target);
|
|
19297
19489
|
} catch {
|
|
19298
19490
|
return null;
|
|
19299
19491
|
}
|
|
@@ -19307,7 +19499,7 @@ var PROJECT_ANCHOR_TOOLS = {
|
|
|
19307
19499
|
function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
|
|
19308
19500
|
const env_map = env ?? process3.env;
|
|
19309
19501
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
|
|
19310
|
-
if (isDir(
|
|
19502
|
+
if (isDir(path17.join(project_root, ".agent-src.uncondensed"))) return [];
|
|
19311
19503
|
const global_root_str = _format_global_root_for_marker(
|
|
19312
19504
|
event4u_root(env_map)
|
|
19313
19505
|
);
|
|
@@ -19316,8 +19508,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
|
|
|
19316
19508
|
for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
|
|
19317
19509
|
const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
|
|
19318
19510
|
if (!tools.has(tool_id)) continue;
|
|
19319
|
-
const target =
|
|
19320
|
-
mkdirp(
|
|
19511
|
+
const target = path17.join(project_root, rel_path);
|
|
19512
|
+
mkdirp(path17.dirname(target));
|
|
19321
19513
|
const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
|
|
19322
19514
|
# Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
|
|
19323
19515
|
# Tool: ${tool_id}. Resolves the global install directly \u2014 no
|
|
@@ -19335,7 +19527,7 @@ installed_at: ${stamp}
|
|
|
19335
19527
|
}
|
|
19336
19528
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
19337
19529
|
function _inject_package_tag(target, source, package_root) {
|
|
19338
|
-
if (
|
|
19530
|
+
if (path17.extname(target) !== ".md") return;
|
|
19339
19531
|
let text;
|
|
19340
19532
|
try {
|
|
19341
19533
|
text = readText(target);
|
|
@@ -19363,8 +19555,8 @@ function _inject_package_tag(target, source, package_root) {
|
|
|
19363
19555
|
resolved_src = source;
|
|
19364
19556
|
}
|
|
19365
19557
|
if (package_root !== null) {
|
|
19366
|
-
const rel =
|
|
19367
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
19558
|
+
const rel = path17.relative(resolvePath(package_root), resolved_src);
|
|
19559
|
+
if (rel !== "" && !rel.startsWith("..") && !path17.isAbsolute(rel)) {
|
|
19368
19560
|
source_value = rel;
|
|
19369
19561
|
} else {
|
|
19370
19562
|
source_value = resolved_src;
|
|
@@ -19399,7 +19591,7 @@ function _escapes_package_root(resolved, package_root) {
|
|
|
19399
19591
|
if (package_root === null) return false;
|
|
19400
19592
|
let root;
|
|
19401
19593
|
try {
|
|
19402
|
-
root =
|
|
19594
|
+
root = fs19.realpathSync(package_root);
|
|
19403
19595
|
} catch {
|
|
19404
19596
|
return false;
|
|
19405
19597
|
}
|
|
@@ -19414,7 +19606,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19414
19606
|
if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
|
|
19415
19607
|
let resolved_src = src;
|
|
19416
19608
|
try {
|
|
19417
|
-
resolved_src =
|
|
19609
|
+
resolved_src = fs19.realpathSync(src);
|
|
19418
19610
|
} catch {
|
|
19419
19611
|
resolved_src = src;
|
|
19420
19612
|
}
|
|
@@ -19422,10 +19614,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19422
19614
|
warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
|
|
19423
19615
|
return [0, 0, written_paths];
|
|
19424
19616
|
}
|
|
19425
|
-
mkdirp(
|
|
19617
|
+
mkdirp(path17.dirname(dest));
|
|
19426
19618
|
const decision = _resolve_file_conflict(dest, force);
|
|
19427
19619
|
if (decision === "skip") return [0, 1, written_paths];
|
|
19428
|
-
|
|
19620
|
+
fs19.copyFileSync(src, dest);
|
|
19429
19621
|
_inject_package_tag(dest, src, package_root);
|
|
19430
19622
|
written_paths.push(dest);
|
|
19431
19623
|
return [1, 0, written_paths];
|
|
@@ -19433,11 +19625,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19433
19625
|
mkdirp(dest);
|
|
19434
19626
|
const walk = (node) => {
|
|
19435
19627
|
const acc = [];
|
|
19436
|
-
const names =
|
|
19628
|
+
const names = fs19.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
19437
19629
|
for (const name of names) {
|
|
19438
|
-
const entry =
|
|
19630
|
+
const entry = path17.join(node, name);
|
|
19439
19631
|
acc.push(entry);
|
|
19440
|
-
const lst =
|
|
19632
|
+
const lst = fs19.lstatSync(entry);
|
|
19441
19633
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
19442
19634
|
acc.push(...walk(entry));
|
|
19443
19635
|
}
|
|
@@ -19445,9 +19637,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19445
19637
|
return acc;
|
|
19446
19638
|
};
|
|
19447
19639
|
for (const entry of walk(src)) {
|
|
19448
|
-
const rel =
|
|
19449
|
-
const target =
|
|
19450
|
-
const lst =
|
|
19640
|
+
const rel = path17.relative(src, entry);
|
|
19641
|
+
const target = path17.join(dest, rel);
|
|
19642
|
+
const lst = fs19.lstatSync(entry);
|
|
19451
19643
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
19452
19644
|
mkdirp(target);
|
|
19453
19645
|
continue;
|
|
@@ -19455,8 +19647,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19455
19647
|
let resolvedIsDir = false;
|
|
19456
19648
|
let resolved = entry;
|
|
19457
19649
|
try {
|
|
19458
|
-
resolved =
|
|
19459
|
-
resolvedIsDir =
|
|
19650
|
+
resolved = fs19.realpathSync(entry);
|
|
19651
|
+
resolvedIsDir = fs19.statSync(entry).isDirectory();
|
|
19460
19652
|
} catch {
|
|
19461
19653
|
resolvedIsDir = false;
|
|
19462
19654
|
}
|
|
@@ -19486,8 +19678,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19486
19678
|
skipped += 1;
|
|
19487
19679
|
continue;
|
|
19488
19680
|
}
|
|
19489
|
-
mkdirp(
|
|
19490
|
-
|
|
19681
|
+
mkdirp(path17.dirname(target));
|
|
19682
|
+
fs19.copyFileSync(resolved, target);
|
|
19491
19683
|
_inject_package_tag(target, resolved, package_root);
|
|
19492
19684
|
written += 1;
|
|
19493
19685
|
written_paths.push(target);
|
|
@@ -19499,7 +19691,7 @@ function _claude_desktop_bundles_dir() {
|
|
|
19499
19691
|
}
|
|
19500
19692
|
function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
|
|
19501
19693
|
const anchor = expanduser6(USER_SCOPE_PATHS["claude-desktop"]);
|
|
19502
|
-
const target =
|
|
19694
|
+
const target = path17.join(anchor, "agent-config.md");
|
|
19503
19695
|
mkdirp(anchor);
|
|
19504
19696
|
const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
|
|
19505
19697
|
writeText(target, body);
|
|
@@ -19523,23 +19715,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
19523
19715
|
const wrapped = [];
|
|
19524
19716
|
const collisions = [];
|
|
19525
19717
|
const reserved = [];
|
|
19526
|
-
const commands_dir =
|
|
19718
|
+
const commands_dir = path17.join(anchor, "commands");
|
|
19527
19719
|
let flat_entries = [];
|
|
19528
19720
|
try {
|
|
19529
|
-
flat_entries =
|
|
19721
|
+
flat_entries = fs19.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
|
|
19530
19722
|
} catch {
|
|
19531
19723
|
}
|
|
19532
19724
|
for (const fname of flat_entries.sort()) {
|
|
19533
19725
|
const slug = fname.slice(0, -".md".length);
|
|
19534
19726
|
if (!is_claude_builtin_name(slug)) continue;
|
|
19535
|
-
|
|
19727
|
+
fs19.rmSync(path17.join(commands_dir, fname), { force: true });
|
|
19536
19728
|
current_files.delete(`commands/${fname}`);
|
|
19537
19729
|
reserved.push(slug);
|
|
19538
19730
|
}
|
|
19539
19731
|
const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
|
|
19540
19732
|
try {
|
|
19541
19733
|
const manifest = JSON.parse(
|
|
19542
|
-
|
|
19734
|
+
fs19.readFileSync(path17.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
|
|
19543
19735
|
);
|
|
19544
19736
|
for (const a of manifest.artefacts ?? []) {
|
|
19545
19737
|
if (a.category !== "command" || typeof a.slug !== "string") continue;
|
|
@@ -19550,22 +19742,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
19550
19742
|
}
|
|
19551
19743
|
for (const slug of [...eligible].sort()) {
|
|
19552
19744
|
const flat_rel = `commands/${slug}.md`;
|
|
19553
|
-
const flat_abs =
|
|
19554
|
-
if (!
|
|
19555
|
-
const skill_dir =
|
|
19556
|
-
if (
|
|
19745
|
+
const flat_abs = path17.join(anchor, "commands", `${slug}.md`);
|
|
19746
|
+
if (!fs19.existsSync(flat_abs)) continue;
|
|
19747
|
+
const skill_dir = path17.join(anchor, "skills", slug);
|
|
19748
|
+
if (fs19.existsSync(skill_dir)) {
|
|
19557
19749
|
collisions.push(slug);
|
|
19558
19750
|
continue;
|
|
19559
19751
|
}
|
|
19560
|
-
let body =
|
|
19752
|
+
let body = fs19.readFileSync(flat_abs, "utf8");
|
|
19561
19753
|
if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
|
|
19562
19754
|
body = body.replace("---\n", `---
|
|
19563
19755
|
name: ${slug}
|
|
19564
19756
|
`);
|
|
19565
19757
|
}
|
|
19566
|
-
|
|
19567
|
-
|
|
19568
|
-
|
|
19758
|
+
fs19.mkdirSync(skill_dir, { recursive: true });
|
|
19759
|
+
fs19.writeFileSync(path17.join(skill_dir, "SKILL.md"), body, "utf8");
|
|
19760
|
+
fs19.rmSync(flat_abs, { force: true });
|
|
19569
19761
|
current_files.delete(flat_rel);
|
|
19570
19762
|
current_files.add(`skills/${slug}/SKILL.md`);
|
|
19571
19763
|
wrapped.push(slug);
|
|
@@ -19597,8 +19789,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
19597
19789
|
const written_paths = [];
|
|
19598
19790
|
let current_files = /* @__PURE__ */ new Set();
|
|
19599
19791
|
for (const [src_rel, dest_sub] of plan) {
|
|
19600
|
-
const src =
|
|
19601
|
-
const dest = dest_sub ?
|
|
19792
|
+
const src = path17.join(package_root, src_rel);
|
|
19793
|
+
const dest = dest_sub ? path17.join(anchor, dest_sub) : anchor;
|
|
19602
19794
|
const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
|
|
19603
19795
|
const [w, s, paths] = _copy_dir_dereferencing_symlinks(
|
|
19604
19796
|
src,
|
|
@@ -19672,10 +19864,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
19672
19864
|
results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
|
|
19673
19865
|
if (tool_id === "claude-code") {
|
|
19674
19866
|
try {
|
|
19675
|
-
const manifest =
|
|
19867
|
+
const manifest = path17.join(package_root, "src", "scripts", "hook_manifest.yaml");
|
|
19676
19868
|
const matrix = build_claude_hook_matrix(manifest);
|
|
19677
19869
|
const res = ensure_managed_hooks(
|
|
19678
|
-
|
|
19870
|
+
path17.join(anchor, "settings.json"),
|
|
19679
19871
|
matrix
|
|
19680
19872
|
);
|
|
19681
19873
|
if (!state.QUIET) {
|
|
@@ -19712,7 +19904,7 @@ function _preview_global_reap(tools, package_root) {
|
|
|
19712
19904
|
const anchor = expanduser6(anchor_raw);
|
|
19713
19905
|
let current_files = /* @__PURE__ */ new Set();
|
|
19714
19906
|
for (const [src_rel, dest_sub] of plan) {
|
|
19715
|
-
const src =
|
|
19907
|
+
const src = path17.join(package_root, src_rel);
|
|
19716
19908
|
current_files = setUnion(
|
|
19717
19909
|
current_files,
|
|
19718
19910
|
expected_deploy_files(
|
|
@@ -19746,14 +19938,14 @@ function _preview_global_reap(tools, package_root) {
|
|
|
19746
19938
|
function _verify_deploy_targets(anchor, plan) {
|
|
19747
19939
|
const missing = [];
|
|
19748
19940
|
for (const [, dest_sub] of plan) {
|
|
19749
|
-
const target = dest_sub ?
|
|
19941
|
+
const target = dest_sub ? path17.join(anchor, dest_sub) : anchor;
|
|
19750
19942
|
const label = dest_sub || ".";
|
|
19751
19943
|
if (!isDir(target)) {
|
|
19752
19944
|
missing.push(label);
|
|
19753
19945
|
continue;
|
|
19754
19946
|
}
|
|
19755
19947
|
try {
|
|
19756
|
-
const entries =
|
|
19948
|
+
const entries = fs19.readdirSync(target);
|
|
19757
19949
|
if (entries.length === 0) missing.push(label);
|
|
19758
19950
|
} catch {
|
|
19759
19951
|
missing.push(label);
|
|
@@ -19768,13 +19960,13 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
19768
19960
|
const [written, skipped, status, paths] = deploy_results[tool_id];
|
|
19769
19961
|
const pruned_skill_dirs = /* @__PURE__ */ new Set();
|
|
19770
19962
|
for (const p of paths) {
|
|
19771
|
-
const parts = p.split(
|
|
19963
|
+
const parts = p.split(path17.sep);
|
|
19772
19964
|
if (parts.includes("skills")) {
|
|
19773
19965
|
const i = parts.indexOf("skills");
|
|
19774
19966
|
if (i + 1 < parts.length) {
|
|
19775
|
-
const skill_root = parts.slice(0, i + 2).join(
|
|
19967
|
+
const skill_root = parts.slice(0, i + 2).join(path17.sep);
|
|
19776
19968
|
if (!pruned_skill_dirs.has(skill_root)) {
|
|
19777
|
-
const skillmd =
|
|
19969
|
+
const skillmd = path17.join(skill_root, "SKILL.md");
|
|
19778
19970
|
if (pathExists(skillmd) && is_pruned(skillmd)) {
|
|
19779
19971
|
pruned_skill_dirs.add(skill_root);
|
|
19780
19972
|
}
|
|
@@ -19785,25 +19977,25 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
19785
19977
|
const keep = [];
|
|
19786
19978
|
const delete_files = [];
|
|
19787
19979
|
for (const p of paths) {
|
|
19788
|
-
const parts = p.split(
|
|
19980
|
+
const parts = p.split(path17.sep);
|
|
19789
19981
|
let is_target = false;
|
|
19790
19982
|
if (parts.includes("skills")) {
|
|
19791
19983
|
const i = parts.indexOf("skills");
|
|
19792
|
-
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(
|
|
19984
|
+
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path17.sep))) {
|
|
19793
19985
|
is_target = true;
|
|
19794
19986
|
}
|
|
19795
|
-
} else if (parts.includes("commands") &&
|
|
19987
|
+
} else if (parts.includes("commands") && path17.extname(p) === ".md" && is_pruned(p)) {
|
|
19796
19988
|
is_target = true;
|
|
19797
19989
|
}
|
|
19798
19990
|
(is_target ? delete_files : keep).push(p);
|
|
19799
19991
|
}
|
|
19800
19992
|
for (const d of pruned_skill_dirs) {
|
|
19801
|
-
|
|
19993
|
+
fs19.rmSync(d, { recursive: true, force: true });
|
|
19802
19994
|
}
|
|
19803
19995
|
for (const p of delete_files) {
|
|
19804
|
-
if (p.split(
|
|
19996
|
+
if (p.split(path17.sep).includes("commands") && pathExists(p)) {
|
|
19805
19997
|
try {
|
|
19806
|
-
|
|
19998
|
+
fs19.unlinkSync(p);
|
|
19807
19999
|
} catch {
|
|
19808
20000
|
}
|
|
19809
20001
|
}
|
|
@@ -19824,9 +20016,9 @@ function _resolve_global_settings_doc() {
|
|
|
19824
20016
|
}
|
|
19825
20017
|
function _resolve_global_settings_path() {
|
|
19826
20018
|
const root = event4u_root();
|
|
19827
|
-
const canonical =
|
|
20019
|
+
const canonical = path17.join(root, "settings", SETTINGS_FILE);
|
|
19828
20020
|
if (pathExists(canonical)) return canonical;
|
|
19829
|
-
const legacy =
|
|
20021
|
+
const legacy = path17.join(root, SETTINGS_FILE);
|
|
19830
20022
|
if (pathExists(legacy)) return legacy;
|
|
19831
20023
|
return null;
|
|
19832
20024
|
}
|
|
@@ -19937,7 +20129,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
19937
20129
|
info(` schema_version=1, agent_config_version=${installed_version}`);
|
|
19938
20130
|
info(` tools=${merged_tools.join(",")}`);
|
|
19939
20131
|
}
|
|
19940
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
20132
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path17.join(project_root, ".agent-src.uncondensed"))) {
|
|
19941
20133
|
const drift = collect_drift(project_root);
|
|
19942
20134
|
if (!state.QUIET) {
|
|
19943
20135
|
process3.stdout.write("\n");
|
|
@@ -20037,19 +20229,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
20037
20229
|
}
|
|
20038
20230
|
}
|
|
20039
20231
|
}
|
|
20040
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
20232
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path17.join(project_root, ".agent-src.uncondensed"))) {
|
|
20041
20233
|
const files_by_tool = _files_by_tool_from_deploy(deploy_results);
|
|
20042
20234
|
const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
|
|
20043
20235
|
if (rc !== 0) return rc;
|
|
20044
20236
|
const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
|
|
20045
20237
|
if (removed_marker !== null && !state.QUIET) {
|
|
20046
|
-
const rel = isRelativeTo(removed_marker, project_root) ?
|
|
20238
|
+
const rel = isRelativeTo(removed_marker, project_root) ? path17.relative(project_root, removed_marker) : removed_marker;
|
|
20047
20239
|
info(`Removed legacy bridge marker: ${rel}`);
|
|
20048
20240
|
}
|
|
20049
20241
|
const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
|
|
20050
20242
|
if (anchor_paths.length > 0 && !state.QUIET) {
|
|
20051
20243
|
for (const p of anchor_paths) {
|
|
20052
|
-
const rel = isRelativeTo(p, project_root) ?
|
|
20244
|
+
const rel = isRelativeTo(p, project_root) ? path17.relative(project_root, p) : p;
|
|
20053
20245
|
info(`Project anchor written: ${rel}`);
|
|
20054
20246
|
}
|
|
20055
20247
|
}
|
|
@@ -20059,6 +20251,23 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
20059
20251
|
} catch (e) {
|
|
20060
20252
|
if (!state.QUIET) warn(`settings-surface snapshot failed \u2014 ${String(e)}`);
|
|
20061
20253
|
}
|
|
20254
|
+
if (!state.QUIET) {
|
|
20255
|
+
try {
|
|
20256
|
+
for (const line of _catalogue_truncation_warnings(deploy_results, project_root)) {
|
|
20257
|
+
warn(line);
|
|
20258
|
+
}
|
|
20259
|
+
const notice = _scoped_migration_notice(deploy_results, project_root, package_root, {
|
|
20260
|
+
env: process3.env,
|
|
20261
|
+
stdinTty: process3.stdin.isTTY === true,
|
|
20262
|
+
stdoutTty: process3.stdout.isTTY === true
|
|
20263
|
+
});
|
|
20264
|
+
if (notice.length > 0) {
|
|
20265
|
+
process3.stdout.write("\n");
|
|
20266
|
+
for (const line of notice) info(line);
|
|
20267
|
+
}
|
|
20268
|
+
} catch {
|
|
20269
|
+
}
|
|
20270
|
+
}
|
|
20062
20271
|
if (!state.QUIET) {
|
|
20063
20272
|
process3.stdout.write("\n");
|
|
20064
20273
|
success(`Global install completed (v${installed_version}).`);
|
|
@@ -20066,8 +20275,59 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
20066
20275
|
}
|
|
20067
20276
|
return 0;
|
|
20068
20277
|
}
|
|
20069
|
-
|
|
20070
|
-
|
|
20278
|
+
function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
20279
|
+
const log_candidates = [
|
|
20280
|
+
path17.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
20281
|
+
...project_root ? [path17.join(project_root, OBSERVATION_LOG)] : []
|
|
20282
|
+
];
|
|
20283
|
+
const records = log_candidates.flatMap((p) => readObservationLog(p));
|
|
20284
|
+
if (records.length === 0) return [];
|
|
20285
|
+
const limits = knownHostLimits(records);
|
|
20286
|
+
if (limits.size === 0) return [];
|
|
20287
|
+
const lines = [];
|
|
20288
|
+
for (const tool_id of Object.keys(deploy_results).sort()) {
|
|
20289
|
+
const [, , status] = deploy_results[tool_id];
|
|
20290
|
+
if (status !== "deployed") continue;
|
|
20291
|
+
const limit = limits.get(tool_id);
|
|
20292
|
+
if (limit === void 0) continue;
|
|
20293
|
+
const anchor_raw = USER_SCOPE_PATHS[tool_id];
|
|
20294
|
+
if (!anchor_raw) continue;
|
|
20295
|
+
const volume = measureCatalogueVolume(tool_id, expanduser6(anchor_raw));
|
|
20296
|
+
const warning = catalogueLimitWarning(volume, limit);
|
|
20297
|
+
if (warning !== null) lines.push(warning);
|
|
20298
|
+
}
|
|
20299
|
+
return lines;
|
|
20300
|
+
}
|
|
20301
|
+
function _scoped_migration_notice(deploy_results, project_root, package_root, probe) {
|
|
20302
|
+
if (!isInteractiveSession(probe)) return [];
|
|
20303
|
+
const log_candidates = [
|
|
20304
|
+
path17.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
20305
|
+
...project_root ? [path17.join(project_root, OBSERVATION_LOG)] : []
|
|
20306
|
+
];
|
|
20307
|
+
const limits = knownHostLimits(log_candidates.flatMap((p) => readObservationLog(p)));
|
|
20308
|
+
if (limits.size === 0) return [];
|
|
20309
|
+
const resolved = _resolve_scoped_projection(package_root);
|
|
20310
|
+
const settings_path = _resolve_global_settings_path() ?? path17.join(event4u_root(), "settings", SETTINGS_FILE);
|
|
20311
|
+
for (const tool_id of Object.keys(deploy_results).sort()) {
|
|
20312
|
+
const [, , status] = deploy_results[tool_id];
|
|
20313
|
+
if (status !== "deployed") continue;
|
|
20314
|
+
const anchor_raw = USER_SCOPE_PATHS[tool_id];
|
|
20315
|
+
if (!anchor_raw) continue;
|
|
20316
|
+
const volume = measureCatalogueVolume(tool_id, expanduser6(anchor_raw));
|
|
20317
|
+
const eligibility = migrationEligibility(
|
|
20318
|
+
tool_id,
|
|
20319
|
+
resolved.mode,
|
|
20320
|
+
volume.skillEntries,
|
|
20321
|
+
limits
|
|
20322
|
+
);
|
|
20323
|
+
if (eligibility.eligible) {
|
|
20324
|
+
return migrationPromptLines(tool_id, eligibility, settings_path);
|
|
20325
|
+
}
|
|
20326
|
+
}
|
|
20327
|
+
return [];
|
|
20328
|
+
}
|
|
20329
|
+
var SETTINGS_SURFACE_REL = path17.join("state", "settings-surface.json");
|
|
20330
|
+
var SETTINGS_DELTA_REL = path17.join("state", "settings-delta.json");
|
|
20071
20331
|
function _current_settings_surface(version) {
|
|
20072
20332
|
const jsonSchema = zodToJsonSchema(settingsSchema, {
|
|
20073
20333
|
name: "AgentSettings",
|
|
@@ -20078,20 +20338,20 @@ function _current_settings_surface(version) {
|
|
|
20078
20338
|
}
|
|
20079
20339
|
function _write_settings_surface_snapshot(installed_version) {
|
|
20080
20340
|
const root = event4u_root();
|
|
20081
|
-
const surface_path =
|
|
20082
|
-
const delta_path =
|
|
20341
|
+
const surface_path = path17.join(root, SETTINGS_SURFACE_REL);
|
|
20342
|
+
const delta_path = path17.join(root, SETTINGS_DELTA_REL);
|
|
20083
20343
|
const next = _current_settings_surface(installed_version);
|
|
20084
20344
|
let previous = null;
|
|
20085
20345
|
try {
|
|
20086
|
-
const parsed = JSON.parse(
|
|
20346
|
+
const parsed = JSON.parse(fs19.readFileSync(surface_path, "utf8"));
|
|
20087
20347
|
if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
|
|
20088
20348
|
} catch {
|
|
20089
20349
|
}
|
|
20090
20350
|
if (previous !== null && previous.version !== next.version) {
|
|
20091
20351
|
const delta = computeSurfaceDelta(previous, next);
|
|
20092
20352
|
if (delta.changes.length > 0) {
|
|
20093
|
-
|
|
20094
|
-
|
|
20353
|
+
fs19.mkdirSync(path17.dirname(delta_path), { recursive: true, mode: 448 });
|
|
20354
|
+
fs19.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
|
|
20095
20355
|
`, { mode: 384 });
|
|
20096
20356
|
if (!state.QUIET) {
|
|
20097
20357
|
const counts = {};
|
|
@@ -20103,8 +20363,8 @@ function _write_settings_surface_snapshot(installed_version) {
|
|
|
20103
20363
|
}
|
|
20104
20364
|
}
|
|
20105
20365
|
}
|
|
20106
|
-
|
|
20107
|
-
|
|
20366
|
+
fs19.mkdirSync(path17.dirname(surface_path), { recursive: true, mode: 448 });
|
|
20367
|
+
fs19.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
|
|
20108
20368
|
`, { mode: 384 });
|
|
20109
20369
|
}
|
|
20110
20370
|
function arrayStrEqual(a, b) {
|
|
@@ -20324,13 +20584,13 @@ function _minimal_templates_root() {
|
|
|
20324
20584
|
const chain = [start];
|
|
20325
20585
|
let cur = start;
|
|
20326
20586
|
for (; ; ) {
|
|
20327
|
-
const parent =
|
|
20587
|
+
const parent = path17.dirname(cur);
|
|
20328
20588
|
if (parent === cur) break;
|
|
20329
20589
|
chain.push(parent);
|
|
20330
20590
|
cur = parent;
|
|
20331
20591
|
}
|
|
20332
20592
|
for (const ancestor of chain) {
|
|
20333
|
-
const candidate =
|
|
20593
|
+
const candidate = path17.join(ancestor, "src", "templates", "minimal");
|
|
20334
20594
|
if (isDir(candidate)) return candidate;
|
|
20335
20595
|
}
|
|
20336
20596
|
fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
|
|
@@ -20338,9 +20598,9 @@ function _minimal_templates_root() {
|
|
|
20338
20598
|
var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
20339
20599
|
function _write_install_mode_marker(project_root, mode) {
|
|
20340
20600
|
if (mode !== "minimal" && mode !== "full") return;
|
|
20341
|
-
const marker =
|
|
20601
|
+
const marker = path17.join(project_root, INSTALL_MODE_MARKER_REL);
|
|
20342
20602
|
try {
|
|
20343
|
-
mkdirp(
|
|
20603
|
+
mkdirp(path17.dirname(marker));
|
|
20344
20604
|
writeText(marker, `${mode}
|
|
20345
20605
|
`);
|
|
20346
20606
|
} catch {
|
|
@@ -20349,7 +20609,7 @@ function _write_install_mode_marker(project_root, mode) {
|
|
|
20349
20609
|
function install_minimal(target_root_in, force, user_type = "") {
|
|
20350
20610
|
let target_root = resolvePath(target_root_in);
|
|
20351
20611
|
mkdirp(target_root);
|
|
20352
|
-
const parent =
|
|
20612
|
+
const parent = path17.dirname(target_root);
|
|
20353
20613
|
if (parent !== target_root) {
|
|
20354
20614
|
const existing = find_project_root_with_anchor(parent);
|
|
20355
20615
|
if (existing !== null && existing[0] !== target_root) {
|
|
@@ -20360,21 +20620,21 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
20360
20620
|
}
|
|
20361
20621
|
}
|
|
20362
20622
|
const templates = _minimal_templates_root();
|
|
20363
|
-
const settings_src =
|
|
20364
|
-
const overrides_gitkeep_src =
|
|
20365
|
-
const overrides_readme_src =
|
|
20623
|
+
const settings_src = path17.join(templates, SETTINGS_FILE);
|
|
20624
|
+
const overrides_gitkeep_src = path17.join(templates, "overrides-gitkeep");
|
|
20625
|
+
const overrides_readme_src = path17.join(templates, "agents-overrides-readme.md");
|
|
20366
20626
|
if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
|
|
20367
20627
|
if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
|
|
20368
20628
|
fail(`Bundled overrides scaffold templates missing under ${templates}`);
|
|
20369
20629
|
}
|
|
20370
20630
|
info(`Minimal init \u2192 ${target_root}`);
|
|
20371
|
-
const overrides_root =
|
|
20631
|
+
const overrides_root = path17.join(target_root, "agents", "overrides");
|
|
20372
20632
|
mkdirp(overrides_root);
|
|
20373
20633
|
const gitkeep_body = readText(overrides_gitkeep_src);
|
|
20374
20634
|
for (const sub of ["rules", "skills", "commands"]) {
|
|
20375
|
-
const sub_dir =
|
|
20635
|
+
const sub_dir = path17.join(overrides_root, sub);
|
|
20376
20636
|
mkdirp(sub_dir);
|
|
20377
|
-
const gitkeep_dst =
|
|
20637
|
+
const gitkeep_dst = path17.join(sub_dir, ".gitkeep");
|
|
20378
20638
|
if (pathExists(gitkeep_dst) && !force) {
|
|
20379
20639
|
skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
|
|
20380
20640
|
} else {
|
|
@@ -20382,7 +20642,7 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
20382
20642
|
success(`Wrote agents/overrides/${sub}/.gitkeep`);
|
|
20383
20643
|
}
|
|
20384
20644
|
}
|
|
20385
|
-
const readme_dst =
|
|
20645
|
+
const readme_dst = path17.join(overrides_root, "README.md");
|
|
20386
20646
|
if (pathExists(readme_dst) && !force) {
|
|
20387
20647
|
skip("agents/overrides/README.md already exists (use --force to overwrite)");
|
|
20388
20648
|
} else {
|
|
@@ -20400,14 +20660,14 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
20400
20660
|
personal:
|
|
20401
20661
|
user_type: ${user_type}
|
|
20402
20662
|
`;
|
|
20403
|
-
mkdirp(
|
|
20663
|
+
mkdirp(path17.dirname(settings_dst));
|
|
20404
20664
|
writeText(settings_dst, body);
|
|
20405
20665
|
success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
|
|
20406
20666
|
}
|
|
20407
20667
|
}
|
|
20408
20668
|
const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
|
|
20409
20669
|
if (removed_marker !== null) {
|
|
20410
|
-
const rel = isRelativeTo(removed_marker, target_root) ?
|
|
20670
|
+
const rel = isRelativeTo(removed_marker, target_root) ? path17.relative(target_root, removed_marker) : removed_marker;
|
|
20411
20671
|
success(`Removed legacy bridge marker: ${rel}`);
|
|
20412
20672
|
}
|
|
20413
20673
|
_write_install_mode_marker(target_root, "minimal");
|
|
@@ -20481,7 +20741,7 @@ function run_interactive_init(project_root, force) {
|
|
|
20481
20741
|
);
|
|
20482
20742
|
return 0;
|
|
20483
20743
|
}
|
|
20484
|
-
const target =
|
|
20744
|
+
const target = path17.join(project_root, _LOCAL_CONFIG_FILE);
|
|
20485
20745
|
if (pathExists(target) && !force) {
|
|
20486
20746
|
warn(
|
|
20487
20747
|
`${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
|
|
@@ -20508,7 +20768,7 @@ function run_interactive_init(project_root, force) {
|
|
|
20508
20768
|
warn(`Could not write ${target}: ${String(exc)}`);
|
|
20509
20769
|
return 1;
|
|
20510
20770
|
}
|
|
20511
|
-
success(`Wrote ${
|
|
20771
|
+
success(`Wrote ${path17.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
|
|
20512
20772
|
return 0;
|
|
20513
20773
|
}
|
|
20514
20774
|
var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
|
|
@@ -20526,12 +20786,12 @@ function _wizard_should_launch(opts) {
|
|
|
20526
20786
|
return [true, ""];
|
|
20527
20787
|
}
|
|
20528
20788
|
function _wizard_cli_dist(_project_root) {
|
|
20529
|
-
const package_root =
|
|
20530
|
-
const cli =
|
|
20789
|
+
const package_root = path17.dirname(path17.dirname(path17.dirname(resolvePath(_HERE2))));
|
|
20790
|
+
const cli = path17.join(package_root, "dist", "cli", "agent-config.js");
|
|
20531
20791
|
return pathExists(cli) ? cli : null;
|
|
20532
20792
|
}
|
|
20533
20793
|
function _server_info_path() {
|
|
20534
|
-
return
|
|
20794
|
+
return path17.join(os7.homedir(), ".event4u", "agent-config", "local-server.json");
|
|
20535
20795
|
}
|
|
20536
20796
|
function _pid_is_agent_config(pid) {
|
|
20537
20797
|
let res;
|
|
@@ -20548,7 +20808,7 @@ function _pid_is_agent_config(pid) {
|
|
|
20548
20808
|
}
|
|
20549
20809
|
function unlinkMissingOk(p) {
|
|
20550
20810
|
try {
|
|
20551
|
-
|
|
20811
|
+
fs19.unlinkSync(p);
|
|
20552
20812
|
} catch {
|
|
20553
20813
|
}
|
|
20554
20814
|
}
|
|
@@ -20626,14 +20886,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
|
|
|
20626
20886
|
}
|
|
20627
20887
|
function _wizard_run_sync(cmd, env, cli) {
|
|
20628
20888
|
const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
|
|
20629
|
-
const log_path =
|
|
20889
|
+
const log_path = path17.join(
|
|
20630
20890
|
os7.tmpdir(),
|
|
20631
20891
|
`agent-config-wizard-${process3.pid}-${Date.now()}.log`
|
|
20632
20892
|
);
|
|
20633
20893
|
let child;
|
|
20634
20894
|
let log_fd = null;
|
|
20635
20895
|
try {
|
|
20636
|
-
log_fd =
|
|
20896
|
+
log_fd = fs19.openSync(log_path, "w");
|
|
20637
20897
|
child = spawn(cmd[0], cmd.slice(1), {
|
|
20638
20898
|
env,
|
|
20639
20899
|
detached: true,
|
|
@@ -20651,7 +20911,7 @@ function _wizard_run_sync(cmd, env, cli) {
|
|
|
20651
20911
|
} finally {
|
|
20652
20912
|
if (log_fd !== null) {
|
|
20653
20913
|
try {
|
|
20654
|
-
|
|
20914
|
+
fs19.closeSync(log_fd);
|
|
20655
20915
|
} catch {
|
|
20656
20916
|
}
|
|
20657
20917
|
}
|
|
@@ -20901,8 +21161,8 @@ function main2(argv) {
|
|
|
20901
21161
|
const target_root = resolvePath(
|
|
20902
21162
|
opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
|
|
20903
21163
|
);
|
|
20904
|
-
const minimal_package_root =
|
|
20905
|
-
|
|
21164
|
+
const minimal_package_root = path17.dirname(
|
|
21165
|
+
path17.dirname(path17.dirname(_minimal_templates_root()))
|
|
20906
21166
|
);
|
|
20907
21167
|
const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
|
|
20908
21168
|
return install_minimal(target_root, opts.force, validated_user_type);
|
|
@@ -20934,7 +21194,7 @@ function main2(argv) {
|
|
|
20934
21194
|
return rc2;
|
|
20935
21195
|
}
|
|
20936
21196
|
const project_root = custom_path || resolvePath(opts.project || process3.env["PROJECT_ROOT"] || process3.cwd());
|
|
20937
|
-
const is_first_run = !pathExists(
|
|
21197
|
+
const is_first_run = !pathExists(path17.join(project_root, SETTINGS_FILE));
|
|
20938
21198
|
const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
|
|
20939
21199
|
if (rc === 0 && opts.interactive) {
|
|
20940
21200
|
run_interactive_init(project_root, opts.force);
|
|
@@ -20998,16 +21258,16 @@ function _team_setup_hint_line(project_root) {
|
|
|
20998
21258
|
return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
|
|
20999
21259
|
}
|
|
21000
21260
|
function finalize_claude_model_tiers(project_root) {
|
|
21001
|
-
const claude_skills =
|
|
21002
|
-
const augment_skills =
|
|
21261
|
+
const claude_skills = path17.join(project_root, ".claude", "skills");
|
|
21262
|
+
const augment_skills = path17.join(project_root, ".augment", "skills");
|
|
21003
21263
|
if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
|
|
21004
21264
|
if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
|
|
21005
21265
|
let rendered = 0;
|
|
21006
|
-
const entries =
|
|
21266
|
+
const entries = fs19.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
21007
21267
|
for (const name of entries) {
|
|
21008
|
-
const entry =
|
|
21009
|
-
const src_dir =
|
|
21010
|
-
const src_md =
|
|
21268
|
+
const entry = path17.join(claude_skills, name);
|
|
21269
|
+
const src_dir = path17.join(augment_skills, name);
|
|
21270
|
+
const src_md = path17.join(src_dir, "SKILL.md");
|
|
21011
21271
|
let tier;
|
|
21012
21272
|
try {
|
|
21013
21273
|
tier = read_model_tier(src_md);
|
|
@@ -21016,22 +21276,22 @@ function finalize_claude_model_tiers(project_root) {
|
|
|
21016
21276
|
}
|
|
21017
21277
|
if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
|
|
21018
21278
|
if (isSymlink(entry) || isFile(entry)) {
|
|
21019
|
-
|
|
21279
|
+
fs19.unlinkSync(entry);
|
|
21020
21280
|
} else if (isDir(entry)) {
|
|
21021
|
-
|
|
21281
|
+
fs19.rmSync(entry, { recursive: true, force: true });
|
|
21022
21282
|
}
|
|
21023
21283
|
mkdirp(entry);
|
|
21024
|
-
const srcFiles =
|
|
21284
|
+
const srcFiles = fs19.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
21025
21285
|
for (const fname of srcFiles) {
|
|
21026
21286
|
if (fname === "SKILL.md") {
|
|
21027
21287
|
writeText(
|
|
21028
|
-
|
|
21288
|
+
path17.join(entry, "SKILL.md"),
|
|
21029
21289
|
render_native_model_md(readText(src_md), tier)
|
|
21030
21290
|
);
|
|
21031
21291
|
} else {
|
|
21032
|
-
|
|
21033
|
-
|
|
21034
|
-
|
|
21292
|
+
fs19.symlinkSync(
|
|
21293
|
+
path17.join("../../../.augment/skills", name, fname),
|
|
21294
|
+
path17.join(entry, fname)
|
|
21035
21295
|
);
|
|
21036
21296
|
}
|
|
21037
21297
|
}
|
|
@@ -21049,7 +21309,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
21049
21309
|
let package_type;
|
|
21050
21310
|
if (opts.package) {
|
|
21051
21311
|
package_root = resolvePath(opts.package);
|
|
21052
|
-
if (!pathExists(
|
|
21312
|
+
if (!pathExists(path17.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
21053
21313
|
fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
|
|
21054
21314
|
}
|
|
21055
21315
|
package_type = detect_package_type_for_project(project_root, package_root);
|
|
@@ -21186,9 +21446,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
21186
21446
|
function _resolvedArgv1() {
|
|
21187
21447
|
if (process3.argv[1] === void 0) return void 0;
|
|
21188
21448
|
try {
|
|
21189
|
-
return
|
|
21449
|
+
return fs19.realpathSync(path17.resolve(process3.argv[1]));
|
|
21190
21450
|
} catch {
|
|
21191
|
-
return
|
|
21451
|
+
return path17.resolve(process3.argv[1]);
|
|
21192
21452
|
}
|
|
21193
21453
|
}
|
|
21194
21454
|
var _argv1 = _resolvedArgv1();
|
|
@@ -21234,6 +21494,7 @@ export {
|
|
|
21234
21494
|
_apply_payload_preview,
|
|
21235
21495
|
_bridge_marker,
|
|
21236
21496
|
_canonical_settings_target,
|
|
21497
|
+
_catalogue_truncation_warnings,
|
|
21237
21498
|
_compute_active_pack_ids,
|
|
21238
21499
|
_copy_dir_dereferencing_symlinks,
|
|
21239
21500
|
_current_settings_surface,
|
|
@@ -21264,6 +21525,7 @@ export {
|
|
|
21264
21525
|
_resolve_scope,
|
|
21265
21526
|
_resolve_scoped_projection,
|
|
21266
21527
|
_resolve_settings_read,
|
|
21528
|
+
_scoped_migration_notice,
|
|
21267
21529
|
_team_setup_hint_line,
|
|
21268
21530
|
_tools_was_all,
|
|
21269
21531
|
_validate_scope,
|