@event4u/agent-config 9.27.0 → 9.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/AGENTS.md +13 -12
- package/CHANGELOG.md +165 -0
- package/README.md +1 -1
- package/agents/templates/.ai-council.yml.example +55 -24
- package/dist/agent-src/commands/analyze/conformance.md +24 -0
- package/dist/agent-src/commands/cost/report.md +2 -2
- package/dist/agent-src/commands/team/adversarial.md +8 -7
- package/dist/agent-src/commands/team/delegate.md +13 -12
- package/dist/agent-src/commands/team/review.md +9 -8
- package/dist/agent-src/commands/team/status.md +9 -8
- package/dist/agent-src/commands/team.md +29 -19
- package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +88 -2
- package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +29 -21
- package/dist/agent-src/contexts/execution/host-capability-manifest.md +26 -15
- package/dist/agent-src/contexts/execution/orchestration-telemetry.md +28 -3
- package/dist/agent-src/contexts/execution/subagent-response-contract.md +54 -0
- package/dist/agent-src/contexts/execution/subagent-routing.md +13 -11
- package/dist/agent-src/contexts/execution/subagent-spawn-contract.md +25 -0
- package/dist/agent-src/contexts/execution/subagent-steering.md +6 -3
- package/dist/agent-src/rules/artifact-engagement-recording.md +4 -1
- package/dist/agent-src/rules/autonomous-execution.md +1 -1
- package/dist/agent-src/rules/brand-source-of-truth.md +33 -6
- package/dist/agent-src/rules/context-hygiene.md +3 -1
- package/dist/agent-src/rules/council-availability.md +93 -0
- package/dist/agent-src/rules/cross-source-consistency.md +3 -0
- package/dist/agent-src/rules/delegation-policy.md +38 -10
- package/dist/agent-src/rules/design-fidelity.md +3 -0
- package/dist/agent-src/rules/evaluator-independence.md +2 -1
- package/dist/agent-src/rules/external-code-graph-interop.md +2 -1
- package/dist/agent-src/rules/finance-safety-floor.md +1 -1
- package/dist/agent-src/rules/git-history-discipline.md +1 -1
- package/dist/agent-src/rules/history-discipline.md +3 -1
- package/dist/agent-src/rules/legal-safety-floor.md +1 -1
- package/dist/agent-src/rules/no-pr-progress-comments.md +3 -1
- package/dist/agent-src/rules/onboarding-gate.md +3 -1
- package/dist/agent-src/rules/roadmap-ci-steps-policy.md +4 -1
- package/dist/agent-src/rules/role-mode-adherence.md +1 -1
- package/dist/agent-src/rules/scale-discipline.md +3 -1
- package/dist/agent-src/rules/self-repair-loop.md +103 -0
- package/dist/agent-src/rules/session-canary.md +2 -1
- package/dist/agent-src/rules/settings-ask-protocol.md +8 -7
- package/dist/agent-src/rules/strategy-safety-floor.md +1 -1
- package/dist/agent-src/rules/token-budget-discipline.md +4 -2
- package/dist/agent-src/rules/tool-safety.md +5 -1
- package/dist/agent-src/skills/adversarial-review/SKILL.md +1 -1
- package/dist/agent-src/skills/analysis-autonomous-mode/SKILL.md +1 -1
- package/dist/agent-src/skills/forensics-report/SKILL.md +114 -0
- package/dist/agent-src/skills/forensics-report/evals/triggers.json +17 -0
- package/dist/agent-src/skills/performance-analysis/SKILL.md +1 -1
- package/dist/agent-src/skills/persona-improvement/SKILL.md +1 -1
- package/dist/agent-src/skills/premortem/SKILL.md +30 -1
- package/dist/agent-src/skills/project-analyzer/SKILL.md +1 -1
- package/dist/agent-src/skills/reasoning-orchestrator/SKILL.md +2 -1
- package/dist/agent-src/skills/security-audit/SKILL.md +1 -1
- package/dist/agent-src/skills/sequential-thinking/SKILL.md +1 -1
- package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +1 -1
- package/dist/agent-src/skills/subagent-orchestration/SKILL.md +7 -5
- package/dist/agent-src/skills/subagent-orchestration/schemas/subagent-status.json +61 -3
- package/dist/agent-src/skills/test-case-discovery/SKILL.md +1 -1
- package/dist/agent-src/skills/universal-project-analysis/SKILL.md +1 -1
- package/dist/agent-src/templates/AGENTS.md +8 -12
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +23 -0
- package/dist/cli/registry.js +7 -0
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/chunk-66OVWGB5.js +270 -0
- package/dist/cli-delegate/{chunk-HJ6DAJHR.js → chunk-LCFJIQ4J.js} +89 -7
- package/dist/cli-delegate/{chunk-VSYT7OHO.js → chunk-LVRYBKTI.js} +31 -2
- package/dist/cli-delegate/{chunk-DVRS2KVR.js → chunk-MMXA5GY7.js} +10 -17
- package/dist/cli-delegate/{chunk-WR6GTRHJ.js → chunk-MP3JT3IU.js} +3 -3
- package/dist/cli-delegate/{chunk-3KJIMFTB.js → chunk-NZ5N2XQL.js} +467 -305
- package/dist/cli-delegate/{chunk-AIIUU73N.js → chunk-OJM3MBJM.js} +1 -1
- package/dist/cli-delegate/{chunk-BCPIOAGV.js → chunk-RCIA67XN.js} +117 -96
- package/dist/cli-delegate/chunk-REKCMYOU.js +2991 -0
- package/dist/cli-delegate/cmd_analyze_session.js +1 -1
- package/dist/cli-delegate/cmd_brand_status.js +134 -0
- package/dist/cli-delegate/cmd_conformance.js +10 -47
- package/dist/cli-delegate/cmd_converge.js +3 -3
- package/dist/cli-delegate/cmd_doctor.js +10 -6
- package/dist/cli-delegate/cmd_explain.js +80 -330
- package/dist/cli-delegate/cmd_export.js +6 -6
- package/dist/cli-delegate/cmd_fleet.js +3 -3
- package/dist/cli-delegate/cmd_handoff.js +3 -3
- package/dist/cli-delegate/cmd_mcp_available.js +433 -0
- package/dist/cli-delegate/cmd_migrate.js +3 -3
- package/dist/cli-delegate/cmd_packs_active.js +153 -0
- package/dist/cli-delegate/cmd_preflight.js +1 -1
- package/dist/cli-delegate/cmd_prune.js +6 -6
- package/dist/cli-delegate/cmd_route_audit.js +8 -8
- package/dist/cli-delegate/cmd_route_explain.js +4 -4
- package/dist/cli-delegate/cmd_settings_get.js +266 -0
- package/dist/cli-delegate/cmd_settings_migrate.js +6 -6
- package/dist/cli-delegate/cmd_settings_set.js +8 -2968
- package/dist/cli-delegate/cmd_sync.js +6 -6
- package/dist/cli-delegate/cmd_uninstall.js +6 -6
- package/dist/cli-delegate/cmd_update.js +4 -4
- package/dist/cli-delegate/cmd_upgrade.js +4 -4
- package/dist/cli-delegate/cmd_validate.js +6 -6
- package/dist/cli-delegate/cmd_versions.js +4 -4
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +164 -55
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +4 -3
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +44 -5
- package/dist/discovery/trust-report.md +11 -11
- package/dist/discovery/workspaces.json +16 -6
- package/dist/hooks/dispatch.js +9341 -6131
- package/dist/install/install.mjs +739 -524
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +777 -281
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/agent_settings.js +134 -15
- package/dist/scripts/_lib/agent_settings.js.map +1 -1
- package/dist/scripts/condense.js +147 -2
- package/dist/scripts/condense.js.map +1 -1
- package/dist/server/schemas/settings.js +6 -7
- package/dist/server/schemas/settings.js.map +1 -1
- package/dist/shared/settingsCarveOut.js +0 -9
- package/dist/shared/settingsCarveOut.js.map +1 -1
- package/dist/shared/settingsClasses.js +11 -9
- package/dist/shared/settingsClasses.js.map +1 -1
- package/dist/ui/assets/{index-DmR0mbk4.js → index-JDAF00bC.js} +2 -2
- package/dist/ui/assets/{index-DmR0mbk4.js.map → index-JDAF00bC.js.map} +1 -1
- package/dist/ui/index.html +1 -1
- package/docs/contracts/settings-classes.md +68 -17
- package/docs/guidelines/agent-infra/memory-access.md +14 -3
- package/package.json +1 -1
- package/src/agent-src/templates/AGENTS.md +8 -12
- package/src/config/agent-settings.template.yml +52 -66
- package/src/config/budgets.yml +29 -0
- package/src/config/discovery/packs.yml +11 -0
- package/src/config/discovery/workspaces.yml +1 -1
- package/src/config/evaluator-budgets.json +4 -4
- package/src/config/gate-coverage.yml +26 -0
- package/src/config/gate-violation-baselines.json +3 -3
- package/src/scripts/_cli/cmd_brand_status.ts +174 -0
- package/src/scripts/_cli/cmd_conformance.ts +14 -42
- package/src/scripts/_cli/cmd_doctor.ts +65 -48
- package/src/scripts/_cli/cmd_mcp_available.ts +266 -0
- package/src/scripts/_cli/cmd_packs_active.ts +225 -0
- package/src/scripts/_cli/cmd_settings_get.ts +324 -0
- package/src/scripts/_dispatch.bash +57 -0
- package/src/scripts/_lib/agent_settings.ts +140 -16
- package/src/scripts/_lib/auto_dispatch.corpus.test.ts +1 -1
- package/src/scripts/_lib/auto_dispatch.ts +23 -18
- package/src/scripts/_lib/capsule_trigger.ts +124 -0
- package/src/scripts/_lib/carrier_divergence.ts +135 -0
- package/src/scripts/_lib/host_capability.ts +144 -4
- package/src/scripts/_lib/judgment_ladder.ts +382 -0
- package/src/scripts/_lib/orchestration_gate.ts +8 -0
- package/src/scripts/_lib/orchestration_record.ts +37 -0
- package/src/scripts/_lib/orchestration_savings.ts +1 -1
- package/src/scripts/_lib/prompt_shape.ts +88 -0
- package/src/scripts/_lib/review_skipped_record.ts +102 -0
- package/src/scripts/_lib/rule_layer_overlap.ts +254 -0
- package/src/scripts/_lib/self_repair.ts +489 -0
- package/src/scripts/_lib/self_repair_store.ts +128 -0
- package/src/scripts/_lib/subagent_capsule.ts +182 -0
- package/src/scripts/_lib/subagent_response.ts +19 -0
- package/src/scripts/_lib/subagent_spawn.ts +13 -0
- package/src/scripts/_lib/subagent_steering.ts +9 -4
- package/src/scripts/_lib/tier_budget_routing.ts +6 -1
- package/src/scripts/_lib/transcript_entry.ts +80 -0
- package/src/scripts/_lib/worker_budget.ts +37 -2
- package/src/scripts/ai_council/clients.ts +76 -54
- package/src/scripts/ai_council/config.ts +94 -6
- package/src/scripts/ai_council/handoff.ts +113 -0
- package/src/scripts/ai_council/modes.ts +19 -4
- package/src/scripts/ai_council/orchestrator.ts +105 -0
- package/src/scripts/ai_council/quorum.ts +84 -0
- package/src/scripts/ai_council/session.ts +44 -0
- package/src/scripts/ai_council/transport_resolver.ts +127 -1
- package/src/scripts/ai_team/availability.ts +110 -0
- package/src/scripts/ai_team/config.ts +34 -14
- package/src/scripts/ai_team/team_dispatch.ts +71 -29
- package/src/scripts/bench_critic_protocol.ts +396 -0
- package/src/scripts/check_branch_freshness.ts +255 -0
- package/src/scripts/check_council_config_location.ts +125 -1
- package/src/scripts/check_detector_corpus.ts +202 -0
- package/src/scripts/check_hook_bundle_freshness.ts +4 -1
- package/src/scripts/check_standing_rule_delivery.ts +314 -0
- package/src/scripts/condense.ts +162 -2
- package/src/scripts/config/profiles.ts +13 -3
- package/src/scripts/conformance_scan.ts +272 -24
- package/src/scripts/council_availability_hook.ts +188 -0
- package/src/scripts/council_cli.ts +527 -32
- package/src/scripts/forensics_report.ts +333 -0
- package/src/scripts/hook_manifest.yaml +107 -26
- package/src/scripts/hooks/block_no_verify.ts +39 -2
- package/src/scripts/hooks/block_unauthorized_git.ts +156 -7
- package/src/scripts/hooks/concern_registry.ts +10 -0
- package/src/scripts/hooks/delegation_nudge_hook.ts +484 -0
- package/src/scripts/hooks/end_review_nudge_hook.ts +726 -0
- package/src/scripts/hooks/orchestration_record_hook.ts +342 -0
- package/src/scripts/install.ts +151 -0
- package/src/scripts/language_mirror_hook.ts +30 -37
- package/src/scripts/lint_discovery_vocabulary.ts +2 -0
- package/src/scripts/lint_never_silent.ts +276 -0
- package/src/scripts/lint_no_activation_gates.ts +271 -0
- package/src/scripts/measure_scope_dedup.ts +19 -13
- package/src/scripts/onboarding_gate_hook.ts +40 -1
- package/src/scripts/orchestration_record.ts +12 -1
- package/src/scripts/preamble_byte_census.ts +9 -20
- package/src/scripts/rebuild_hook_bundle.ts +177 -0
- package/src/scripts/release.ts +74 -2
- package/src/scripts/report_carrier_divergence.ts +364 -0
- package/src/scripts/report_skill_activation.ts +257 -0
- package/src/scripts/report_skill_obligation_violations.ts +579 -0
- package/src/scripts/routing_doctor.ts +95 -39
- package/src/scripts/score_skill_selection.ts +19 -5
- package/src/scripts/self_repair_cli.ts +470 -0
- package/src/scripts/self_repair_hook.ts +241 -0
- package/src/scripts/team_events_spike.ts +271 -0
- package/src/scripts/team_review_gate_hook.ts +31 -9
- package/src/server/schemas/settings.ts +10 -17
- package/src/shared/settingsCarveOut.ts +0 -10
- package/src/shared/settingsClasses.ts +11 -9
package/dist/install/install.mjs
CHANGED
|
@@ -117,17 +117,17 @@ var require_visit = __commonJS({
|
|
|
117
117
|
visit.BREAK = BREAK;
|
|
118
118
|
visit.SKIP = SKIP;
|
|
119
119
|
visit.REMOVE = REMOVE;
|
|
120
|
-
function visit_(key, node, visitor,
|
|
121
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
120
|
+
function visit_(key, node, visitor, path17) {
|
|
121
|
+
const ctrl = callVisitor(key, node, visitor, path17);
|
|
122
122
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
123
|
-
replaceNode(key,
|
|
124
|
-
return visit_(key, ctrl, visitor,
|
|
123
|
+
replaceNode(key, path17, ctrl);
|
|
124
|
+
return visit_(key, ctrl, visitor, path17);
|
|
125
125
|
}
|
|
126
126
|
if (typeof ctrl !== "symbol") {
|
|
127
127
|
if (identity.isCollection(node)) {
|
|
128
|
-
|
|
128
|
+
path17 = Object.freeze(path17.concat(node));
|
|
129
129
|
for (let i = 0; i < node.items.length; ++i) {
|
|
130
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
130
|
+
const ci = visit_(i, node.items[i], visitor, path17);
|
|
131
131
|
if (typeof ci === "number")
|
|
132
132
|
i = ci - 1;
|
|
133
133
|
else if (ci === BREAK)
|
|
@@ -138,13 +138,13 @@ var require_visit = __commonJS({
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
} else if (identity.isPair(node)) {
|
|
141
|
-
|
|
142
|
-
const ck = visit_("key", node.key, visitor,
|
|
141
|
+
path17 = Object.freeze(path17.concat(node));
|
|
142
|
+
const ck = visit_("key", node.key, visitor, path17);
|
|
143
143
|
if (ck === BREAK)
|
|
144
144
|
return BREAK;
|
|
145
145
|
else if (ck === REMOVE)
|
|
146
146
|
node.key = null;
|
|
147
|
-
const cv = visit_("value", node.value, visitor,
|
|
147
|
+
const cv = visit_("value", node.value, visitor, path17);
|
|
148
148
|
if (cv === BREAK)
|
|
149
149
|
return BREAK;
|
|
150
150
|
else if (cv === REMOVE)
|
|
@@ -165,17 +165,17 @@ var require_visit = __commonJS({
|
|
|
165
165
|
visitAsync.BREAK = BREAK;
|
|
166
166
|
visitAsync.SKIP = SKIP;
|
|
167
167
|
visitAsync.REMOVE = REMOVE;
|
|
168
|
-
async function visitAsync_(key, node, visitor,
|
|
169
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
168
|
+
async function visitAsync_(key, node, visitor, path17) {
|
|
169
|
+
const ctrl = await callVisitor(key, node, visitor, path17);
|
|
170
170
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
171
|
-
replaceNode(key,
|
|
172
|
-
return visitAsync_(key, ctrl, visitor,
|
|
171
|
+
replaceNode(key, path17, ctrl);
|
|
172
|
+
return visitAsync_(key, ctrl, visitor, path17);
|
|
173
173
|
}
|
|
174
174
|
if (typeof ctrl !== "symbol") {
|
|
175
175
|
if (identity.isCollection(node)) {
|
|
176
|
-
|
|
176
|
+
path17 = Object.freeze(path17.concat(node));
|
|
177
177
|
for (let i = 0; i < node.items.length; ++i) {
|
|
178
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
178
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path17);
|
|
179
179
|
if (typeof ci === "number")
|
|
180
180
|
i = ci - 1;
|
|
181
181
|
else if (ci === BREAK)
|
|
@@ -186,13 +186,13 @@ var require_visit = __commonJS({
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
} else if (identity.isPair(node)) {
|
|
189
|
-
|
|
190
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
189
|
+
path17 = Object.freeze(path17.concat(node));
|
|
190
|
+
const ck = await visitAsync_("key", node.key, visitor, path17);
|
|
191
191
|
if (ck === BREAK)
|
|
192
192
|
return BREAK;
|
|
193
193
|
else if (ck === REMOVE)
|
|
194
194
|
node.key = null;
|
|
195
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
195
|
+
const cv = await visitAsync_("value", node.value, visitor, path17);
|
|
196
196
|
if (cv === BREAK)
|
|
197
197
|
return BREAK;
|
|
198
198
|
else if (cv === REMOVE)
|
|
@@ -219,23 +219,23 @@ var require_visit = __commonJS({
|
|
|
219
219
|
}
|
|
220
220
|
return visitor;
|
|
221
221
|
}
|
|
222
|
-
function callVisitor(key, node, visitor,
|
|
222
|
+
function callVisitor(key, node, visitor, path17) {
|
|
223
223
|
if (typeof visitor === "function")
|
|
224
|
-
return visitor(key, node,
|
|
224
|
+
return visitor(key, node, path17);
|
|
225
225
|
if (identity.isMap(node))
|
|
226
|
-
return visitor.Map?.(key, node,
|
|
226
|
+
return visitor.Map?.(key, node, path17);
|
|
227
227
|
if (identity.isSeq(node))
|
|
228
|
-
return visitor.Seq?.(key, node,
|
|
228
|
+
return visitor.Seq?.(key, node, path17);
|
|
229
229
|
if (identity.isPair(node))
|
|
230
|
-
return visitor.Pair?.(key, node,
|
|
230
|
+
return visitor.Pair?.(key, node, path17);
|
|
231
231
|
if (identity.isScalar(node))
|
|
232
|
-
return visitor.Scalar?.(key, node,
|
|
232
|
+
return visitor.Scalar?.(key, node, path17);
|
|
233
233
|
if (identity.isAlias(node))
|
|
234
|
-
return visitor.Alias?.(key, node,
|
|
234
|
+
return visitor.Alias?.(key, node, path17);
|
|
235
235
|
return void 0;
|
|
236
236
|
}
|
|
237
|
-
function replaceNode(key,
|
|
238
|
-
const parent =
|
|
237
|
+
function replaceNode(key, path17, node) {
|
|
238
|
+
const parent = path17[path17.length - 1];
|
|
239
239
|
if (identity.isCollection(parent)) {
|
|
240
240
|
parent.items[key] = node;
|
|
241
241
|
} else if (identity.isPair(parent)) {
|
|
@@ -845,10 +845,10 @@ var require_Collection = __commonJS({
|
|
|
845
845
|
var createNode = require_createNode();
|
|
846
846
|
var identity = require_identity();
|
|
847
847
|
var Node = require_Node();
|
|
848
|
-
function collectionFromPath(schema,
|
|
848
|
+
function collectionFromPath(schema, path17, value) {
|
|
849
849
|
let v = value;
|
|
850
|
-
for (let i =
|
|
851
|
-
const k =
|
|
850
|
+
for (let i = path17.length - 1; i >= 0; --i) {
|
|
851
|
+
const k = path17[i];
|
|
852
852
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
853
853
|
const a = [];
|
|
854
854
|
a[k] = v;
|
|
@@ -867,7 +867,7 @@ var require_Collection = __commonJS({
|
|
|
867
867
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
868
868
|
});
|
|
869
869
|
}
|
|
870
|
-
var isEmptyPath = (
|
|
870
|
+
var isEmptyPath = (path17) => path17 == null || typeof path17 === "object" && !!path17[Symbol.iterator]().next().done;
|
|
871
871
|
var Collection = class extends Node.NodeBase {
|
|
872
872
|
constructor(type, schema) {
|
|
873
873
|
super(type);
|
|
@@ -897,11 +897,11 @@ var require_Collection = __commonJS({
|
|
|
897
897
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
898
898
|
* that already exists in the map.
|
|
899
899
|
*/
|
|
900
|
-
addIn(
|
|
901
|
-
if (isEmptyPath(
|
|
900
|
+
addIn(path17, value) {
|
|
901
|
+
if (isEmptyPath(path17))
|
|
902
902
|
this.add(value);
|
|
903
903
|
else {
|
|
904
|
-
const [key, ...rest] =
|
|
904
|
+
const [key, ...rest] = path17;
|
|
905
905
|
const node = this.get(key, true);
|
|
906
906
|
if (identity.isCollection(node))
|
|
907
907
|
node.addIn(rest, value);
|
|
@@ -915,8 +915,8 @@ var require_Collection = __commonJS({
|
|
|
915
915
|
* Removes a value from the collection.
|
|
916
916
|
* @returns `true` if the item was found and removed.
|
|
917
917
|
*/
|
|
918
|
-
deleteIn(
|
|
919
|
-
const [key, ...rest] =
|
|
918
|
+
deleteIn(path17) {
|
|
919
|
+
const [key, ...rest] = path17;
|
|
920
920
|
if (rest.length === 0)
|
|
921
921
|
return this.delete(key);
|
|
922
922
|
const node = this.get(key, true);
|
|
@@ -930,8 +930,8 @@ var require_Collection = __commonJS({
|
|
|
930
930
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
931
931
|
* `true` (collections are always returned intact).
|
|
932
932
|
*/
|
|
933
|
-
getIn(
|
|
934
|
-
const [key, ...rest] =
|
|
933
|
+
getIn(path17, keepScalar) {
|
|
934
|
+
const [key, ...rest] = path17;
|
|
935
935
|
const node = this.get(key, true);
|
|
936
936
|
if (rest.length === 0)
|
|
937
937
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -949,8 +949,8 @@ var require_Collection = __commonJS({
|
|
|
949
949
|
/**
|
|
950
950
|
* Checks if the collection includes a value with the key `key`.
|
|
951
951
|
*/
|
|
952
|
-
hasIn(
|
|
953
|
-
const [key, ...rest] =
|
|
952
|
+
hasIn(path17) {
|
|
953
|
+
const [key, ...rest] = path17;
|
|
954
954
|
if (rest.length === 0)
|
|
955
955
|
return this.has(key);
|
|
956
956
|
const node = this.get(key, true);
|
|
@@ -960,8 +960,8 @@ var require_Collection = __commonJS({
|
|
|
960
960
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
961
961
|
* boolean to add/remove the item from the set.
|
|
962
962
|
*/
|
|
963
|
-
setIn(
|
|
964
|
-
const [key, ...rest] =
|
|
963
|
+
setIn(path17, value) {
|
|
964
|
+
const [key, ...rest] = path17;
|
|
965
965
|
if (rest.length === 0) {
|
|
966
966
|
this.set(key, value);
|
|
967
967
|
} else {
|
|
@@ -3476,9 +3476,9 @@ var require_Document = __commonJS({
|
|
|
3476
3476
|
this.contents.add(value);
|
|
3477
3477
|
}
|
|
3478
3478
|
/** Adds a value to the document. */
|
|
3479
|
-
addIn(
|
|
3479
|
+
addIn(path17, value) {
|
|
3480
3480
|
if (assertCollection(this.contents))
|
|
3481
|
-
this.contents.addIn(
|
|
3481
|
+
this.contents.addIn(path17, value);
|
|
3482
3482
|
}
|
|
3483
3483
|
/**
|
|
3484
3484
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3553,14 +3553,14 @@ var require_Document = __commonJS({
|
|
|
3553
3553
|
* Removes a value from the document.
|
|
3554
3554
|
* @returns `true` if the item was found and removed.
|
|
3555
3555
|
*/
|
|
3556
|
-
deleteIn(
|
|
3557
|
-
if (Collection.isEmptyPath(
|
|
3556
|
+
deleteIn(path17) {
|
|
3557
|
+
if (Collection.isEmptyPath(path17)) {
|
|
3558
3558
|
if (this.contents == null)
|
|
3559
3559
|
return false;
|
|
3560
3560
|
this.contents = null;
|
|
3561
3561
|
return true;
|
|
3562
3562
|
}
|
|
3563
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3563
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path17) : false;
|
|
3564
3564
|
}
|
|
3565
3565
|
/**
|
|
3566
3566
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3575,10 +3575,10 @@ var require_Document = __commonJS({
|
|
|
3575
3575
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3576
3576
|
* `true` (collections are always returned intact).
|
|
3577
3577
|
*/
|
|
3578
|
-
getIn(
|
|
3579
|
-
if (Collection.isEmptyPath(
|
|
3578
|
+
getIn(path17, keepScalar) {
|
|
3579
|
+
if (Collection.isEmptyPath(path17))
|
|
3580
3580
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3581
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
3581
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path17, keepScalar) : void 0;
|
|
3582
3582
|
}
|
|
3583
3583
|
/**
|
|
3584
3584
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3589,10 +3589,10 @@ var require_Document = __commonJS({
|
|
|
3589
3589
|
/**
|
|
3590
3590
|
* Checks if the document includes a value at `path`.
|
|
3591
3591
|
*/
|
|
3592
|
-
hasIn(
|
|
3593
|
-
if (Collection.isEmptyPath(
|
|
3592
|
+
hasIn(path17) {
|
|
3593
|
+
if (Collection.isEmptyPath(path17))
|
|
3594
3594
|
return this.contents !== void 0;
|
|
3595
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
3595
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path17) : false;
|
|
3596
3596
|
}
|
|
3597
3597
|
/**
|
|
3598
3598
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3609,13 +3609,13 @@ var require_Document = __commonJS({
|
|
|
3609
3609
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3610
3610
|
* boolean to add/remove the item from the set.
|
|
3611
3611
|
*/
|
|
3612
|
-
setIn(
|
|
3613
|
-
if (Collection.isEmptyPath(
|
|
3612
|
+
setIn(path17, value) {
|
|
3613
|
+
if (Collection.isEmptyPath(path17)) {
|
|
3614
3614
|
this.contents = value;
|
|
3615
3615
|
} else if (this.contents == null) {
|
|
3616
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
3616
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path17), value);
|
|
3617
3617
|
} else if (assertCollection(this.contents)) {
|
|
3618
|
-
this.contents.setIn(
|
|
3618
|
+
this.contents.setIn(path17, value);
|
|
3619
3619
|
}
|
|
3620
3620
|
}
|
|
3621
3621
|
/**
|
|
@@ -5575,9 +5575,9 @@ var require_cst_visit = __commonJS({
|
|
|
5575
5575
|
visit.BREAK = BREAK;
|
|
5576
5576
|
visit.SKIP = SKIP;
|
|
5577
5577
|
visit.REMOVE = REMOVE;
|
|
5578
|
-
visit.itemAtPath = (cst,
|
|
5578
|
+
visit.itemAtPath = (cst, path17) => {
|
|
5579
5579
|
let item = cst;
|
|
5580
|
-
for (const [field, index] of
|
|
5580
|
+
for (const [field, index] of path17) {
|
|
5581
5581
|
const tok = item?.[field];
|
|
5582
5582
|
if (tok && "items" in tok) {
|
|
5583
5583
|
item = tok.items[index];
|
|
@@ -5586,23 +5586,23 @@ var require_cst_visit = __commonJS({
|
|
|
5586
5586
|
}
|
|
5587
5587
|
return item;
|
|
5588
5588
|
};
|
|
5589
|
-
visit.parentCollection = (cst,
|
|
5590
|
-
const parent = visit.itemAtPath(cst,
|
|
5591
|
-
const field =
|
|
5589
|
+
visit.parentCollection = (cst, path17) => {
|
|
5590
|
+
const parent = visit.itemAtPath(cst, path17.slice(0, -1));
|
|
5591
|
+
const field = path17[path17.length - 1][0];
|
|
5592
5592
|
const coll = parent?.[field];
|
|
5593
5593
|
if (coll && "items" in coll)
|
|
5594
5594
|
return coll;
|
|
5595
5595
|
throw new Error("Parent collection not found");
|
|
5596
5596
|
};
|
|
5597
|
-
function _visit(
|
|
5598
|
-
let ctrl = visitor(item,
|
|
5597
|
+
function _visit(path17, item, visitor) {
|
|
5598
|
+
let ctrl = visitor(item, path17);
|
|
5599
5599
|
if (typeof ctrl === "symbol")
|
|
5600
5600
|
return ctrl;
|
|
5601
5601
|
for (const field of ["key", "value"]) {
|
|
5602
5602
|
const token = item[field];
|
|
5603
5603
|
if (token && "items" in token) {
|
|
5604
5604
|
for (let i = 0; i < token.items.length; ++i) {
|
|
5605
|
-
const ci = _visit(Object.freeze(
|
|
5605
|
+
const ci = _visit(Object.freeze(path17.concat([[field, i]])), token.items[i], visitor);
|
|
5606
5606
|
if (typeof ci === "number")
|
|
5607
5607
|
i = ci - 1;
|
|
5608
5608
|
else if (ci === BREAK)
|
|
@@ -5613,10 +5613,10 @@ var require_cst_visit = __commonJS({
|
|
|
5613
5613
|
}
|
|
5614
5614
|
}
|
|
5615
5615
|
if (typeof ctrl === "function" && field === "key")
|
|
5616
|
-
ctrl = ctrl(item,
|
|
5616
|
+
ctrl = ctrl(item, path17);
|
|
5617
5617
|
}
|
|
5618
5618
|
}
|
|
5619
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5619
|
+
return typeof ctrl === "function" ? ctrl(item, path17) : ctrl;
|
|
5620
5620
|
}
|
|
5621
5621
|
exports.visit = visit;
|
|
5622
5622
|
}
|
|
@@ -6918,14 +6918,14 @@ var require_parser = __commonJS({
|
|
|
6918
6918
|
case "scalar":
|
|
6919
6919
|
case "single-quoted-scalar":
|
|
6920
6920
|
case "double-quoted-scalar": {
|
|
6921
|
-
const
|
|
6921
|
+
const fs19 = this.flowScalar(this.type);
|
|
6922
6922
|
if (atNextItem || it.value) {
|
|
6923
|
-
map.items.push({ start, key:
|
|
6923
|
+
map.items.push({ start, key: fs19, sep: [] });
|
|
6924
6924
|
this.onKeyLine = true;
|
|
6925
6925
|
} else if (it.sep) {
|
|
6926
|
-
this.stack.push(
|
|
6926
|
+
this.stack.push(fs19);
|
|
6927
6927
|
} else {
|
|
6928
|
-
Object.assign(it, { key:
|
|
6928
|
+
Object.assign(it, { key: fs19, sep: [] });
|
|
6929
6929
|
this.onKeyLine = true;
|
|
6930
6930
|
}
|
|
6931
6931
|
return;
|
|
@@ -7053,13 +7053,13 @@ var require_parser = __commonJS({
|
|
|
7053
7053
|
case "scalar":
|
|
7054
7054
|
case "single-quoted-scalar":
|
|
7055
7055
|
case "double-quoted-scalar": {
|
|
7056
|
-
const
|
|
7056
|
+
const fs19 = this.flowScalar(this.type);
|
|
7057
7057
|
if (!it || it.value)
|
|
7058
|
-
fc.items.push({ start: [], key:
|
|
7058
|
+
fc.items.push({ start: [], key: fs19, sep: [] });
|
|
7059
7059
|
else if (it.sep)
|
|
7060
|
-
this.stack.push(
|
|
7060
|
+
this.stack.push(fs19);
|
|
7061
7061
|
else
|
|
7062
|
-
Object.assign(it, { key:
|
|
7062
|
+
Object.assign(it, { key: fs19, sep: [] });
|
|
7063
7063
|
return;
|
|
7064
7064
|
}
|
|
7065
7065
|
case "flow-map-end":
|
|
@@ -7370,9 +7370,9 @@ var require_dist = __commonJS({
|
|
|
7370
7370
|
// src/scripts/install.ts
|
|
7371
7371
|
import { spawn, spawnSync as spawnSync2 } from "node:child_process";
|
|
7372
7372
|
import * as crypto3 from "node:crypto";
|
|
7373
|
-
import * as
|
|
7373
|
+
import * as fs18 from "node:fs";
|
|
7374
7374
|
import * as os7 from "node:os";
|
|
7375
|
-
import * as
|
|
7375
|
+
import * as path16 from "node:path";
|
|
7376
7376
|
import process3 from "node:process";
|
|
7377
7377
|
import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
7378
7378
|
|
|
@@ -7872,8 +7872,8 @@ function lockfile_write_path(env) {
|
|
|
7872
7872
|
}
|
|
7873
7873
|
return write_target("installed.lock", { env: env ?? null });
|
|
7874
7874
|
}
|
|
7875
|
-
function read_lockfile(
|
|
7876
|
-
const target =
|
|
7875
|
+
function read_lockfile(path17) {
|
|
7876
|
+
const target = path17 ?? lockfile_path();
|
|
7877
7877
|
let text;
|
|
7878
7878
|
try {
|
|
7879
7879
|
text = fs2.readFileSync(target, { encoding: "utf-8" });
|
|
@@ -8724,14 +8724,113 @@ function splitlines2(text) {
|
|
|
8724
8724
|
return parts;
|
|
8725
8725
|
}
|
|
8726
8726
|
|
|
8727
|
+
// src/scripts/_lib/rule_layer_overlap.ts
|
|
8728
|
+
import * as fs6 from "node:fs";
|
|
8729
|
+
import * as path6 from "node:path";
|
|
8730
|
+
var INSTALLER_PROVENANCE_KEYS = ["package", "source_path"];
|
|
8731
|
+
function stripProvenance(text) {
|
|
8732
|
+
const lines = text.split("\n");
|
|
8733
|
+
if (lines[0]?.trim() !== "---") return text;
|
|
8734
|
+
let close = -1;
|
|
8735
|
+
for (let i = 1; i < lines.length; i++) {
|
|
8736
|
+
if (lines[i]?.trim() === "---") {
|
|
8737
|
+
close = i;
|
|
8738
|
+
break;
|
|
8739
|
+
}
|
|
8740
|
+
}
|
|
8741
|
+
if (close === -1) return text;
|
|
8742
|
+
const kept = [];
|
|
8743
|
+
for (let i = 0; i < lines.length; i++) {
|
|
8744
|
+
if (i > 0 && i < close) {
|
|
8745
|
+
const key = /^([A-Za-z_][A-Za-z0-9_-]*):/.exec(lines[i] ?? "")?.[1];
|
|
8746
|
+
if (key !== void 0 && INSTALLER_PROVENANCE_KEYS.includes(key)) continue;
|
|
8747
|
+
}
|
|
8748
|
+
kept.push(lines[i] ?? "");
|
|
8749
|
+
}
|
|
8750
|
+
return kept.join("\n");
|
|
8751
|
+
}
|
|
8752
|
+
function only_in(a, b) {
|
|
8753
|
+
return [...a.keys()].filter((k) => !b.has(k)).sort();
|
|
8754
|
+
}
|
|
8755
|
+
function compareLayers(global_layer, project_layer) {
|
|
8756
|
+
const overlap = [...global_layer.keys()].filter((k) => project_layer.has(k)).sort();
|
|
8757
|
+
const duplicate = [];
|
|
8758
|
+
const divergent = [];
|
|
8759
|
+
let redundant_chars = 0;
|
|
8760
|
+
for (const name of overlap) {
|
|
8761
|
+
const g = stripProvenance(global_layer.get(name) ?? "");
|
|
8762
|
+
const p = stripProvenance(project_layer.get(name) ?? "");
|
|
8763
|
+
if (g === p) {
|
|
8764
|
+
duplicate.push(name);
|
|
8765
|
+
redundant_chars += (project_layer.get(name) ?? "").length;
|
|
8766
|
+
} else {
|
|
8767
|
+
divergent.push(name);
|
|
8768
|
+
}
|
|
8769
|
+
}
|
|
8770
|
+
return {
|
|
8771
|
+
schema_version: 1,
|
|
8772
|
+
overlap,
|
|
8773
|
+
duplicate,
|
|
8774
|
+
divergent,
|
|
8775
|
+
global_only: only_in(global_layer, project_layer),
|
|
8776
|
+
project_only: only_in(project_layer, global_layer),
|
|
8777
|
+
redundant_chars
|
|
8778
|
+
};
|
|
8779
|
+
}
|
|
8780
|
+
function readRuleLayer(dir) {
|
|
8781
|
+
let names;
|
|
8782
|
+
try {
|
|
8783
|
+
names = fs6.readdirSync(dir);
|
|
8784
|
+
} catch {
|
|
8785
|
+
return null;
|
|
8786
|
+
}
|
|
8787
|
+
const files = /* @__PURE__ */ new Map();
|
|
8788
|
+
for (const name of names.filter((n) => n.endsWith(".md")).sort()) {
|
|
8789
|
+
try {
|
|
8790
|
+
files.set(name, fs6.readFileSync(path6.join(dir, name), "utf-8"));
|
|
8791
|
+
} catch {
|
|
8792
|
+
continue;
|
|
8793
|
+
}
|
|
8794
|
+
}
|
|
8795
|
+
return { dir, files };
|
|
8796
|
+
}
|
|
8797
|
+
function claudeMdExcludesGlob(dir) {
|
|
8798
|
+
return `${path6.resolve(dir).replace(/\/+$/, "")}/**`;
|
|
8799
|
+
}
|
|
8800
|
+
function mergeClaudeMdExcludes(existing, entry) {
|
|
8801
|
+
if (!Array.isArray(existing)) return [entry];
|
|
8802
|
+
if (existing.includes(entry)) return [...existing];
|
|
8803
|
+
return [...existing, entry];
|
|
8804
|
+
}
|
|
8805
|
+
function decideLayerAction(report, choice, global_dir, project_dir) {
|
|
8806
|
+
const refresh_required = report.divergent.length > 0;
|
|
8807
|
+
const skew = refresh_required ? ` ${report.divergent.length} shared rule(s) differ in body \u2014 refresh before suppressing, or obligations only the suppressed copy carries are lost.` : "";
|
|
8808
|
+
if (choice === "both-acknowledged") {
|
|
8809
|
+
return {
|
|
8810
|
+
write: "both",
|
|
8811
|
+
suppress_dir: null,
|
|
8812
|
+
refresh_required,
|
|
8813
|
+
note: `Keeping both rule layers by request: ${report.overlap.length} shared rule(s), ${report.redundant_chars} chars delivered twice per session. Nothing suppressed, nothing deleted.${skew}`
|
|
8814
|
+
};
|
|
8815
|
+
}
|
|
8816
|
+
const keep = choice === "global" ? global_dir : project_dir;
|
|
8817
|
+
const drop = choice === "global" ? project_dir : global_dir;
|
|
8818
|
+
return {
|
|
8819
|
+
write: choice,
|
|
8820
|
+
suppress_dir: drop,
|
|
8821
|
+
refresh_required,
|
|
8822
|
+
note: `Keeping ${choice} rule layer (${keep}); suppressing ${drop} via claudeMdExcludes \u2014 recovers ${report.redundant_chars} chars per session. No file is deleted or rewritten.${skew}`
|
|
8823
|
+
};
|
|
8824
|
+
}
|
|
8825
|
+
|
|
8727
8826
|
// src/scripts/_lib/installed_tools.ts
|
|
8728
|
-
import * as
|
|
8827
|
+
import * as fs8 from "node:fs";
|
|
8729
8828
|
import * as os4 from "node:os";
|
|
8730
8829
|
import * as fsPath from "node:path";
|
|
8731
8830
|
|
|
8732
8831
|
// src/scripts/_lib/fs_atomic.ts
|
|
8733
|
-
import
|
|
8734
|
-
import
|
|
8832
|
+
import fs7 from "node:fs";
|
|
8833
|
+
import path7 from "node:path";
|
|
8735
8834
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
8736
8835
|
function _normalize_encoding(encoding) {
|
|
8737
8836
|
const compact = encoding.toLowerCase().replace(/[-_\s]/g, "");
|
|
@@ -8747,9 +8846,9 @@ function _normalize_encoding(encoding) {
|
|
|
8747
8846
|
}
|
|
8748
8847
|
function write_atomic(p, data, options = {}) {
|
|
8749
8848
|
const encoding = options.encoding ?? "utf-8";
|
|
8750
|
-
const target =
|
|
8751
|
-
const parent =
|
|
8752
|
-
|
|
8849
|
+
const target = path7.normalize(p);
|
|
8850
|
+
const parent = path7.dirname(target);
|
|
8851
|
+
fs7.mkdirSync(parent, { recursive: true });
|
|
8753
8852
|
let payload;
|
|
8754
8853
|
if (typeof data === "string") {
|
|
8755
8854
|
payload = Buffer.from(data, _normalize_encoding(encoding));
|
|
@@ -8763,12 +8862,12 @@ function write_atomic(p, data, options = {}) {
|
|
|
8763
8862
|
let fd = null;
|
|
8764
8863
|
let tmp_path = "";
|
|
8765
8864
|
for (let attempt = 0; attempt < 32; attempt += 1) {
|
|
8766
|
-
tmp_path =
|
|
8865
|
+
tmp_path = path7.join(
|
|
8767
8866
|
parent,
|
|
8768
|
-
`.${
|
|
8867
|
+
`.${path7.basename(target)}.tmp.${randomBytes3(6).toString("hex")}`
|
|
8769
8868
|
);
|
|
8770
8869
|
try {
|
|
8771
|
-
fd =
|
|
8870
|
+
fd = fs7.openSync(tmp_path, "wx", 384);
|
|
8772
8871
|
break;
|
|
8773
8872
|
} catch (err) {
|
|
8774
8873
|
if (err.code === "EEXIST") continue;
|
|
@@ -8782,24 +8881,24 @@ function write_atomic(p, data, options = {}) {
|
|
|
8782
8881
|
try {
|
|
8783
8882
|
let offset = 0;
|
|
8784
8883
|
while (offset < payload.length) {
|
|
8785
|
-
offset +=
|
|
8884
|
+
offset += fs7.writeSync(fd, payload, offset, payload.length - offset);
|
|
8786
8885
|
}
|
|
8787
8886
|
try {
|
|
8788
|
-
|
|
8887
|
+
fs7.fsyncSync(fd);
|
|
8789
8888
|
} catch {
|
|
8790
8889
|
}
|
|
8791
|
-
|
|
8890
|
+
fs7.closeSync(fd);
|
|
8792
8891
|
closed = true;
|
|
8793
|
-
|
|
8892
|
+
fs7.renameSync(tmp_path, target);
|
|
8794
8893
|
} catch (err) {
|
|
8795
8894
|
if (!closed) {
|
|
8796
8895
|
try {
|
|
8797
|
-
|
|
8896
|
+
fs7.closeSync(fd);
|
|
8798
8897
|
} catch {
|
|
8799
8898
|
}
|
|
8800
8899
|
}
|
|
8801
8900
|
try {
|
|
8802
|
-
|
|
8901
|
+
fs7.unlinkSync(tmp_path);
|
|
8803
8902
|
} catch {
|
|
8804
8903
|
}
|
|
8805
8904
|
throw err;
|
|
@@ -8810,17 +8909,17 @@ function write_atomic(p, data, options = {}) {
|
|
|
8810
8909
|
function _fsync_dir(directory) {
|
|
8811
8910
|
let dir_fd;
|
|
8812
8911
|
try {
|
|
8813
|
-
dir_fd =
|
|
8912
|
+
dir_fd = fs7.openSync(directory, fs7.constants.O_RDONLY);
|
|
8814
8913
|
} catch {
|
|
8815
8914
|
return;
|
|
8816
8915
|
}
|
|
8817
8916
|
try {
|
|
8818
8917
|
try {
|
|
8819
|
-
|
|
8918
|
+
fs7.fsyncSync(dir_fd);
|
|
8820
8919
|
} catch {
|
|
8821
8920
|
}
|
|
8822
8921
|
} finally {
|
|
8823
|
-
|
|
8922
|
+
fs7.closeSync(dir_fd);
|
|
8824
8923
|
}
|
|
8825
8924
|
}
|
|
8826
8925
|
|
|
@@ -8849,18 +8948,18 @@ function manifest_path(project_root, env) {
|
|
|
8849
8948
|
var _TOP_KEY_RE = /^([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
|
|
8850
8949
|
var _LIST_DASH_RE = /^\s*-\s*(.+?)\s*$/;
|
|
8851
8950
|
var _INDENT_KEY_RE = /^\s+([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
|
|
8852
|
-
function read_manifest(
|
|
8951
|
+
function read_manifest(path17) {
|
|
8853
8952
|
let text;
|
|
8854
8953
|
try {
|
|
8855
|
-
text = require_read_text(
|
|
8954
|
+
text = require_read_text(path17);
|
|
8856
8955
|
} catch {
|
|
8857
8956
|
return null;
|
|
8858
8957
|
}
|
|
8859
8958
|
const data = _parse_manual(text);
|
|
8860
8959
|
return _normalise_v2_shape(data);
|
|
8861
8960
|
}
|
|
8862
|
-
function require_read_text(
|
|
8863
|
-
return
|
|
8961
|
+
function require_read_text(path17) {
|
|
8962
|
+
return fs8.readFileSync(path17, { encoding: "utf-8" });
|
|
8864
8963
|
}
|
|
8865
8964
|
function _normalise_v2_shape(data) {
|
|
8866
8965
|
if (data["tools"] === void 0 || data["tools"] === null) {
|
|
@@ -9041,9 +9140,9 @@ function stable_sort(items, key) {
|
|
|
9041
9140
|
return a.index - b.index;
|
|
9042
9141
|
}).map((entry) => entry.item);
|
|
9043
9142
|
}
|
|
9044
|
-
function write_manifest(
|
|
9143
|
+
function write_manifest(path17, version, tools, options = {}) {
|
|
9045
9144
|
const rendered = _render2(version, tools, { deploy_roots: options.deploy_roots ?? null });
|
|
9046
|
-
return write_atomic(
|
|
9145
|
+
return write_atomic(path17, rendered);
|
|
9047
9146
|
}
|
|
9048
9147
|
var ScopeMismatchError = class extends Error {
|
|
9049
9148
|
name_;
|
|
@@ -9134,25 +9233,25 @@ function _today() {
|
|
|
9134
9233
|
// src/scripts/_lib/install_drift.ts
|
|
9135
9234
|
var import_yaml = __toESM(require_dist(), 1);
|
|
9136
9235
|
import * as crypto from "node:crypto";
|
|
9137
|
-
import * as
|
|
9236
|
+
import * as fs9 from "node:fs";
|
|
9138
9237
|
import * as os5 from "node:os";
|
|
9139
|
-
import * as
|
|
9238
|
+
import * as path8 from "node:path";
|
|
9140
9239
|
function expanduser5(p) {
|
|
9141
9240
|
if (p === "~") {
|
|
9142
9241
|
return os5.homedir();
|
|
9143
9242
|
}
|
|
9144
9243
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
9145
|
-
return
|
|
9244
|
+
return path8.join(os5.homedir(), p.slice(2));
|
|
9146
9245
|
}
|
|
9147
9246
|
return p;
|
|
9148
9247
|
}
|
|
9149
9248
|
function resolve_entry_path(project_root, raw) {
|
|
9150
9249
|
const p = expanduser5(raw);
|
|
9151
|
-
return
|
|
9250
|
+
return path8.isAbsolute(p) ? p : path8.join(project_root, p);
|
|
9152
9251
|
}
|
|
9153
9252
|
function sha256_of_file(p) {
|
|
9154
9253
|
try {
|
|
9155
|
-
return crypto.createHash("sha256").update(
|
|
9254
|
+
return crypto.createHash("sha256").update(fs9.readFileSync(p)).digest("hex");
|
|
9156
9255
|
} catch {
|
|
9157
9256
|
return null;
|
|
9158
9257
|
}
|
|
@@ -9161,7 +9260,7 @@ function collect_drift(project_root, env) {
|
|
|
9161
9260
|
const target = manifest_path(project_root, env);
|
|
9162
9261
|
let text;
|
|
9163
9262
|
try {
|
|
9164
|
-
text =
|
|
9263
|
+
text = fs9.readFileSync(target, "utf-8");
|
|
9165
9264
|
} catch {
|
|
9166
9265
|
return null;
|
|
9167
9266
|
}
|
|
@@ -9206,7 +9305,7 @@ function collect_drift(project_root, env) {
|
|
|
9206
9305
|
continue;
|
|
9207
9306
|
}
|
|
9208
9307
|
const resolved = resolve_entry_path(project_root, raw_path);
|
|
9209
|
-
if (!
|
|
9308
|
+
if (!fs9.existsSync(resolved)) {
|
|
9210
9309
|
out.push({
|
|
9211
9310
|
tool_id,
|
|
9212
9311
|
path: resolved,
|
|
@@ -9260,8 +9359,8 @@ function format_drift_report(entries) {
|
|
|
9260
9359
|
|
|
9261
9360
|
// src/scripts/_lib/claude_desktop_bundler.ts
|
|
9262
9361
|
import * as crypto2 from "node:crypto";
|
|
9263
|
-
import * as
|
|
9264
|
-
import * as
|
|
9362
|
+
import * as fs10 from "node:fs";
|
|
9363
|
+
import * as path9 from "node:path";
|
|
9265
9364
|
|
|
9266
9365
|
// src/scripts/_lib/zip_min.ts
|
|
9267
9366
|
import * as zlib from "node:zlib";
|
|
@@ -9368,7 +9467,7 @@ function _is_excluded(rel_parts) {
|
|
|
9368
9467
|
}
|
|
9369
9468
|
function _is_dir(p) {
|
|
9370
9469
|
try {
|
|
9371
|
-
return
|
|
9470
|
+
return fs10.statSync(p).isDirectory();
|
|
9372
9471
|
} catch {
|
|
9373
9472
|
return false;
|
|
9374
9473
|
}
|
|
@@ -9380,12 +9479,12 @@ function _compare_rel_parts(a, b) {
|
|
|
9380
9479
|
}
|
|
9381
9480
|
function _walk_skill_files(skill_dir) {
|
|
9382
9481
|
const out = [];
|
|
9383
|
-
const resolved =
|
|
9482
|
+
const resolved = fs10.realpathSync(skill_dir);
|
|
9384
9483
|
const walk = (root, relRoot) => {
|
|
9385
9484
|
const dirNames = [];
|
|
9386
9485
|
const fileNames = [];
|
|
9387
|
-
for (const dirent of
|
|
9388
|
-
const full =
|
|
9486
|
+
for (const dirent of fs10.readdirSync(root, { withFileTypes: true })) {
|
|
9487
|
+
const full = path9.join(root, dirent.name);
|
|
9389
9488
|
const isDir2 = dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full);
|
|
9390
9489
|
if (isDir2) {
|
|
9391
9490
|
dirNames.push(dirent.name);
|
|
@@ -9398,13 +9497,13 @@ function _walk_skill_files(skill_dir) {
|
|
|
9398
9497
|
if (_is_excluded(rel_parts)) {
|
|
9399
9498
|
continue;
|
|
9400
9499
|
}
|
|
9401
|
-
out.push([
|
|
9500
|
+
out.push([path9.join(root, fname), rel_parts]);
|
|
9402
9501
|
}
|
|
9403
9502
|
for (const dname of dirNames) {
|
|
9404
9503
|
if (_is_excluded([dname])) {
|
|
9405
9504
|
continue;
|
|
9406
9505
|
}
|
|
9407
|
-
walk(
|
|
9506
|
+
walk(path9.join(root, dname), [...relRoot, dname]);
|
|
9408
9507
|
}
|
|
9409
9508
|
};
|
|
9410
9509
|
walk(resolved, []);
|
|
@@ -9417,53 +9516,53 @@ function _manifest_digest(files) {
|
|
|
9417
9516
|
const rel = rel_parts.join("/");
|
|
9418
9517
|
h.update(Buffer.from(rel, "utf-8"));
|
|
9419
9518
|
h.update(Buffer.from([0]));
|
|
9420
|
-
h.update(crypto2.createHash("sha256").update(
|
|
9519
|
+
h.update(crypto2.createHash("sha256").update(fs10.readFileSync(abs_path)).digest());
|
|
9421
9520
|
h.update(Buffer.from([0]));
|
|
9422
9521
|
}
|
|
9423
9522
|
return h.digest("hex");
|
|
9424
9523
|
}
|
|
9425
9524
|
function _atomic_write_zip(zip_path, files) {
|
|
9426
|
-
|
|
9427
|
-
const stem =
|
|
9428
|
-
const tmp_path =
|
|
9429
|
-
|
|
9525
|
+
fs10.mkdirSync(path9.dirname(zip_path), { recursive: true });
|
|
9526
|
+
const stem = path9.basename(zip_path, path9.extname(zip_path));
|
|
9527
|
+
const tmp_path = path9.join(
|
|
9528
|
+
path9.dirname(zip_path),
|
|
9430
9529
|
`.${stem}.${crypto2.randomBytes(6).toString("hex")}.zip.tmp`
|
|
9431
9530
|
);
|
|
9432
9531
|
try {
|
|
9433
9532
|
const entries = files.map(([abs_path, rel_parts]) => ({
|
|
9434
9533
|
name: rel_parts.join("/"),
|
|
9435
|
-
data:
|
|
9534
|
+
data: fs10.readFileSync(abs_path)
|
|
9436
9535
|
}));
|
|
9437
|
-
|
|
9438
|
-
|
|
9536
|
+
fs10.writeFileSync(tmp_path, zip_write_sync(entries));
|
|
9537
|
+
fs10.renameSync(tmp_path, zip_path);
|
|
9439
9538
|
} finally {
|
|
9440
|
-
if (
|
|
9441
|
-
|
|
9539
|
+
if (fs10.existsSync(tmp_path)) {
|
|
9540
|
+
fs10.unlinkSync(tmp_path);
|
|
9442
9541
|
}
|
|
9443
9542
|
}
|
|
9444
9543
|
}
|
|
9445
9544
|
function _write_if_changed(dest_dir, slug, files, force, written) {
|
|
9446
9545
|
const digest = _manifest_digest(files);
|
|
9447
|
-
const zip_path =
|
|
9448
|
-
const digest_path =
|
|
9449
|
-
const recorded =
|
|
9450
|
-
if (!force && recorded === digest &&
|
|
9546
|
+
const zip_path = path9.join(dest_dir, `${slug}.zip`);
|
|
9547
|
+
const digest_path = path9.join(dest_dir, `${slug}.sha256`);
|
|
9548
|
+
const recorded = fs10.existsSync(digest_path) ? fs10.readFileSync(digest_path, "utf-8").trim() : "";
|
|
9549
|
+
if (!force && recorded === digest && fs10.existsSync(zip_path)) {
|
|
9451
9550
|
return;
|
|
9452
9551
|
}
|
|
9453
9552
|
_atomic_write_zip(zip_path, files);
|
|
9454
|
-
|
|
9553
|
+
fs10.writeFileSync(digest_path, digest + "\n", "utf-8");
|
|
9455
9554
|
written.push(zip_path);
|
|
9456
9555
|
}
|
|
9457
9556
|
function build_skill_bundles(package_root, dest_dir, force = false, curation = null) {
|
|
9458
|
-
const skills_root =
|
|
9557
|
+
const skills_root = path9.join(package_root, "dist/agent-src", "skills");
|
|
9459
9558
|
if (!_is_dir(skills_root)) {
|
|
9460
9559
|
return [];
|
|
9461
9560
|
}
|
|
9462
|
-
|
|
9561
|
+
fs10.mkdirSync(dest_dir, { recursive: true });
|
|
9463
9562
|
const written = [];
|
|
9464
|
-
for (const name of
|
|
9465
|
-
const entry =
|
|
9466
|
-
const isSymlink2 =
|
|
9563
|
+
for (const name of fs10.readdirSync(skills_root).sort()) {
|
|
9564
|
+
const entry = path9.join(skills_root, name);
|
|
9565
|
+
const isSymlink2 = fs10.lstatSync(entry).isSymbolicLink();
|
|
9467
9566
|
if (!(_is_dir(entry) || isSymlink2)) {
|
|
9468
9567
|
continue;
|
|
9469
9568
|
}
|
|
@@ -9471,8 +9570,8 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
|
|
|
9471
9570
|
if (curation !== null && !curation.includes(skill_name)) {
|
|
9472
9571
|
continue;
|
|
9473
9572
|
}
|
|
9474
|
-
const skill_md =
|
|
9475
|
-
if (!
|
|
9573
|
+
const skill_md = path9.join(entry, "SKILL.md");
|
|
9574
|
+
if (!fs10.existsSync(skill_md)) {
|
|
9476
9575
|
continue;
|
|
9477
9576
|
}
|
|
9478
9577
|
const files = _walk_skill_files(entry);
|
|
@@ -9484,15 +9583,15 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
|
|
|
9484
9583
|
return written;
|
|
9485
9584
|
}
|
|
9486
9585
|
function _command_slug(source_file, commands_root) {
|
|
9487
|
-
const rel =
|
|
9488
|
-
const noExt = rel.slice(0, rel.length -
|
|
9489
|
-
return noExt.split(
|
|
9586
|
+
const rel = path9.relative(commands_root, source_file);
|
|
9587
|
+
const noExt = rel.slice(0, rel.length - path9.extname(rel).length);
|
|
9588
|
+
return noExt.split(path9.sep).join("-");
|
|
9490
9589
|
}
|
|
9491
9590
|
function _iter_command_files(commands_root) {
|
|
9492
9591
|
const found = [];
|
|
9493
9592
|
const walk = (dir) => {
|
|
9494
|
-
for (const dirent of
|
|
9495
|
-
const full =
|
|
9593
|
+
for (const dirent of fs10.readdirSync(dir, { withFileTypes: true })) {
|
|
9594
|
+
const full = path9.join(dir, dirent.name);
|
|
9496
9595
|
if (dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full)) {
|
|
9497
9596
|
walk(full);
|
|
9498
9597
|
} else if (dirent.name.endsWith(".md")) {
|
|
@@ -9502,21 +9601,21 @@ function _iter_command_files(commands_root) {
|
|
|
9502
9601
|
};
|
|
9503
9602
|
walk(commands_root);
|
|
9504
9603
|
found.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
9505
|
-
return found.filter((source_file) =>
|
|
9604
|
+
return found.filter((source_file) => path9.basename(source_file) !== "AGENTS.md");
|
|
9506
9605
|
}
|
|
9507
9606
|
function build_command_bundles(package_root, dest_dir, force = false, curation = null) {
|
|
9508
|
-
const commands_root =
|
|
9607
|
+
const commands_root = path9.join(package_root, "dist/agent-src", "commands");
|
|
9509
9608
|
if (!_is_dir(commands_root)) {
|
|
9510
9609
|
return [];
|
|
9511
9610
|
}
|
|
9512
|
-
const skills_root =
|
|
9611
|
+
const skills_root = path9.join(package_root, "dist/agent-src", "skills");
|
|
9513
9612
|
let skill_names = /* @__PURE__ */ new Set();
|
|
9514
9613
|
if (_is_dir(skills_root)) {
|
|
9515
9614
|
skill_names = new Set(
|
|
9516
|
-
|
|
9615
|
+
fs10.readdirSync(skills_root).filter((name) => _is_dir(path9.join(skills_root, name)))
|
|
9517
9616
|
);
|
|
9518
9617
|
}
|
|
9519
|
-
|
|
9618
|
+
fs10.mkdirSync(dest_dir, { recursive: true });
|
|
9520
9619
|
const written = [];
|
|
9521
9620
|
for (const source_file of _iter_command_files(commands_root)) {
|
|
9522
9621
|
const slug = _command_slug(source_file, commands_root);
|
|
@@ -9526,7 +9625,7 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
|
|
|
9526
9625
|
if (curation !== null && !curation.includes(slug)) {
|
|
9527
9626
|
continue;
|
|
9528
9627
|
}
|
|
9529
|
-
const files = [[
|
|
9628
|
+
const files = [[fs10.realpathSync(source_file), ["SKILL.md"]]];
|
|
9530
9629
|
_write_if_changed(dest_dir, slug, files, force, written);
|
|
9531
9630
|
}
|
|
9532
9631
|
return written;
|
|
@@ -9534,8 +9633,8 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
|
|
|
9534
9633
|
|
|
9535
9634
|
// src/scripts/_lib/claude_settings_hooks.ts
|
|
9536
9635
|
var YAML = __toESM(require_dist(), 1);
|
|
9537
|
-
import * as
|
|
9538
|
-
import * as
|
|
9636
|
+
import * as fs11 from "node:fs";
|
|
9637
|
+
import * as path10 from "node:path";
|
|
9539
9638
|
|
|
9540
9639
|
// src/install/atomic.ts
|
|
9541
9640
|
import {
|
|
@@ -9543,17 +9642,17 @@ import {
|
|
|
9543
9642
|
fsyncSync,
|
|
9544
9643
|
mkdirSync as mkdirSync5,
|
|
9545
9644
|
openSync as openSync3,
|
|
9546
|
-
readFileSync as
|
|
9645
|
+
readFileSync as readFileSync9,
|
|
9547
9646
|
renameSync as renameSync5,
|
|
9548
9647
|
unlinkSync as unlinkSync4,
|
|
9549
9648
|
writeSync
|
|
9550
9649
|
} from "node:fs";
|
|
9551
|
-
import { dirname as dirname4, join as
|
|
9650
|
+
import { dirname as dirname4, join as join10 } from "node:path";
|
|
9552
9651
|
function atomicWriteFile(target, data, options = {}) {
|
|
9553
9652
|
const mode = options.mode ?? 420;
|
|
9554
9653
|
const parent = dirname4(target);
|
|
9555
9654
|
mkdirSync5(parent, { recursive: true });
|
|
9556
|
-
const tmp =
|
|
9655
|
+
const tmp = join10(parent, `.tmp.${process.pid}.${randSuffix()}`);
|
|
9557
9656
|
let fd = null;
|
|
9558
9657
|
try {
|
|
9559
9658
|
fd = openSync3(tmp, "w", mode);
|
|
@@ -9603,7 +9702,7 @@ var SettingsLockError = class extends Error {
|
|
|
9603
9702
|
}
|
|
9604
9703
|
};
|
|
9605
9704
|
function build_claude_hook_matrix(manifest_path2) {
|
|
9606
|
-
const raw =
|
|
9705
|
+
const raw = fs11.readFileSync(manifest_path2, "utf8");
|
|
9607
9706
|
const manifest = _yaml_parse(raw) ?? {};
|
|
9608
9707
|
const hook_spec = manifest["schema_version"] ?? 1;
|
|
9609
9708
|
const platforms = manifest["platforms"] ?? {};
|
|
@@ -9633,8 +9732,8 @@ function _is_managed_group(group) {
|
|
|
9633
9732
|
);
|
|
9634
9733
|
}
|
|
9635
9734
|
function _read_settings(settings_path) {
|
|
9636
|
-
if (!
|
|
9637
|
-
const raw =
|
|
9735
|
+
if (!fs11.existsSync(settings_path)) return {};
|
|
9736
|
+
const raw = fs11.readFileSync(settings_path, "utf8");
|
|
9638
9737
|
if (raw.trim() === "") return {};
|
|
9639
9738
|
let parsed;
|
|
9640
9739
|
try {
|
|
@@ -9649,18 +9748,18 @@ function _read_settings(settings_path) {
|
|
|
9649
9748
|
}
|
|
9650
9749
|
function _with_lock(settings_path, fn) {
|
|
9651
9750
|
const lockPath = settings_path + ".agent-config.lock";
|
|
9652
|
-
|
|
9751
|
+
fs11.mkdirSync(path10.dirname(lockPath), { recursive: true });
|
|
9653
9752
|
let fd;
|
|
9654
9753
|
try {
|
|
9655
|
-
fd =
|
|
9754
|
+
fd = fs11.openSync(lockPath, "wx");
|
|
9656
9755
|
} catch {
|
|
9657
9756
|
throw new SettingsLockError(lockPath);
|
|
9658
9757
|
}
|
|
9659
9758
|
try {
|
|
9660
9759
|
return fn();
|
|
9661
9760
|
} finally {
|
|
9662
|
-
|
|
9663
|
-
|
|
9761
|
+
fs11.closeSync(fd);
|
|
9762
|
+
fs11.rmSync(lockPath, { force: true });
|
|
9664
9763
|
}
|
|
9665
9764
|
}
|
|
9666
9765
|
function ensure_managed_hooks(settings_path, matrix) {
|
|
@@ -9691,9 +9790,9 @@ function ensure_managed_hooks(settings_path, matrix) {
|
|
|
9691
9790
|
|
|
9692
9791
|
// src/scripts/_lib/agent_settings.ts
|
|
9693
9792
|
import { createRequire as createRequire2 } from "node:module";
|
|
9694
|
-
import * as
|
|
9793
|
+
import * as fs12 from "node:fs";
|
|
9695
9794
|
import * as os6 from "node:os";
|
|
9696
|
-
import * as
|
|
9795
|
+
import * as path11 from "node:path";
|
|
9697
9796
|
var _require2 = createRequire2(import.meta.url);
|
|
9698
9797
|
var Logger = class {
|
|
9699
9798
|
name = "scripts._lib.agent_settings";
|
|
@@ -9733,28 +9832,51 @@ var DEFAULT_PROJECT_FILE = ".agent-settings.yml";
|
|
|
9733
9832
|
var LOCAL_PROJECT_FILE = ".agent-settings.local.yml";
|
|
9734
9833
|
var LOCAL_PROJECT_SUBDIR = ["agents", "settings"];
|
|
9735
9834
|
function _local_settings_path(project_root) {
|
|
9736
|
-
return
|
|
9835
|
+
return path11.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
|
|
9737
9836
|
}
|
|
9738
9837
|
function _canonical_settings_path(project_root) {
|
|
9739
|
-
return
|
|
9838
|
+
return path11.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
|
|
9740
9839
|
}
|
|
9741
9840
|
var USER_GLOBAL_FILENAME = "agent-settings.yml";
|
|
9742
9841
|
function DEFAULT_USER_GLOBAL_FILE() {
|
|
9743
9842
|
return write_target(USER_GLOBAL_FILENAME);
|
|
9744
9843
|
}
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
|
|
9844
|
+
var USER_GLOBAL_CANONICAL_RELATIVE = "settings/.agent-settings.yml";
|
|
9845
|
+
function user_global_settings_paths() {
|
|
9846
|
+
const paths = [];
|
|
9847
|
+
const flat = resolve_with_fallback(USER_GLOBAL_FILENAME);
|
|
9848
|
+
if (flat !== null) {
|
|
9849
|
+
paths.push(flat);
|
|
9850
|
+
}
|
|
9851
|
+
const canonical = resolve_with_fallback(USER_GLOBAL_CANONICAL_RELATIVE);
|
|
9852
|
+
if (canonical !== null) {
|
|
9853
|
+
paths.push(canonical);
|
|
9854
|
+
}
|
|
9855
|
+
if (paths.length === 0) {
|
|
9856
|
+
paths.push(DEFAULT_USER_GLOBAL_FILE());
|
|
9749
9857
|
}
|
|
9750
|
-
return
|
|
9858
|
+
return paths;
|
|
9751
9859
|
}
|
|
9752
9860
|
var MERGEABLE_KEYS = [
|
|
9861
|
+
// `name`, `ide` and `personal.bot_icon` are the PRE-MIGRATION spellings.
|
|
9862
|
+
// `install.ts` migrates `ide` → `personal.ide` and `pr_comment_bot_icon`
|
|
9863
|
+
// into its `personal.` home, and this list was never moved with them — so
|
|
9864
|
+
// the whitelist named keys the template does not have while the keys it
|
|
9865
|
+
// does have were filtered out silently. A user setting either preference
|
|
9866
|
+
// user-globally got no error, no warning, and no effect
|
|
9867
|
+
// (road-to-capability-answerability 4.3, ADR-219).
|
|
9868
|
+
//
|
|
9869
|
+
// Both spellings are listed rather than replaced: a legacy file that still
|
|
9870
|
+
// uses the old name keeps working, and nothing that resolved before
|
|
9871
|
+
// resolves differently. `name` has no reader anywhere and no template key;
|
|
9872
|
+
// it is kept only so this change stays purely additive.
|
|
9753
9873
|
"name",
|
|
9754
9874
|
"ide",
|
|
9875
|
+
"personal.ide",
|
|
9755
9876
|
"rule_loading_tier",
|
|
9756
9877
|
"memory.cadence",
|
|
9757
9878
|
"personal.bot_icon",
|
|
9879
|
+
"personal.pr_comment_bot_icon",
|
|
9758
9880
|
"personal.autonomy",
|
|
9759
9881
|
"telegraph.speak_scope",
|
|
9760
9882
|
// Knowledge-card global cross-project sharing is a USER-GLOBAL setting
|
|
@@ -9784,8 +9906,8 @@ var _AGENTS_DIR_MARKERS = [
|
|
|
9784
9906
|
var _LEGACY_ANCHOR_ENV = "AGENT_CONFIG_LEGACY_ANCHOR";
|
|
9785
9907
|
function _exists(p) {
|
|
9786
9908
|
try {
|
|
9787
|
-
|
|
9788
|
-
|
|
9909
|
+
fs12.lstatSync(p);
|
|
9910
|
+
fs12.statSync(p);
|
|
9789
9911
|
return true;
|
|
9790
9912
|
} catch {
|
|
9791
9913
|
return false;
|
|
@@ -9793,22 +9915,22 @@ function _exists(p) {
|
|
|
9793
9915
|
}
|
|
9794
9916
|
function _is_dir2(p) {
|
|
9795
9917
|
try {
|
|
9796
|
-
return
|
|
9918
|
+
return fs12.statSync(p).isDirectory();
|
|
9797
9919
|
} catch {
|
|
9798
9920
|
return false;
|
|
9799
9921
|
}
|
|
9800
9922
|
}
|
|
9801
9923
|
function _is_file(p) {
|
|
9802
9924
|
try {
|
|
9803
|
-
return
|
|
9925
|
+
return fs12.statSync(p).isFile();
|
|
9804
9926
|
} catch {
|
|
9805
9927
|
return false;
|
|
9806
9928
|
}
|
|
9807
9929
|
}
|
|
9808
9930
|
function _resolve(p) {
|
|
9809
|
-
const absolute =
|
|
9931
|
+
const absolute = path11.resolve(p);
|
|
9810
9932
|
try {
|
|
9811
|
-
return
|
|
9933
|
+
return fs12.realpathSync(absolute);
|
|
9812
9934
|
} catch {
|
|
9813
9935
|
return absolute;
|
|
9814
9936
|
}
|
|
@@ -9818,7 +9940,7 @@ function _ancestor_chain(start) {
|
|
|
9818
9940
|
let cursor = start;
|
|
9819
9941
|
for (; ; ) {
|
|
9820
9942
|
chain.push(cursor);
|
|
9821
|
-
const parent =
|
|
9943
|
+
const parent = path11.dirname(cursor);
|
|
9822
9944
|
if (parent === cursor) {
|
|
9823
9945
|
break;
|
|
9824
9946
|
}
|
|
@@ -9827,15 +9949,15 @@ function _ancestor_chain(start) {
|
|
|
9827
9949
|
return chain;
|
|
9828
9950
|
}
|
|
9829
9951
|
function _boundary_anchor_at(dir) {
|
|
9830
|
-
const agents_dir =
|
|
9952
|
+
const agents_dir = path11.join(dir, "agents");
|
|
9831
9953
|
if (_is_dir2(agents_dir)) {
|
|
9832
9954
|
for (const marker of _AGENTS_DIR_MARKERS) {
|
|
9833
|
-
if (_exists(
|
|
9955
|
+
if (_exists(path11.join(agents_dir, marker))) {
|
|
9834
9956
|
return ANCHOR_AGENTS_DIR;
|
|
9835
9957
|
}
|
|
9836
9958
|
}
|
|
9837
9959
|
}
|
|
9838
|
-
if (_exists(
|
|
9960
|
+
if (_exists(path11.join(dir, ".git"))) {
|
|
9839
9961
|
return ANCHOR_GIT;
|
|
9840
9962
|
}
|
|
9841
9963
|
return null;
|
|
@@ -9846,7 +9968,7 @@ function find_project_root_with_anchor(start) {
|
|
|
9846
9968
|
const chain = _ancestor_chain(current);
|
|
9847
9969
|
if (legacy) {
|
|
9848
9970
|
for (const candidate of chain) {
|
|
9849
|
-
if (_exists(
|
|
9971
|
+
if (_exists(path11.join(candidate, ".git"))) {
|
|
9850
9972
|
return [candidate, ANCHOR_GIT];
|
|
9851
9973
|
}
|
|
9852
9974
|
}
|
|
@@ -9860,7 +9982,7 @@ function find_project_root_with_anchor(start) {
|
|
|
9860
9982
|
}
|
|
9861
9983
|
let outermost = null;
|
|
9862
9984
|
for (const candidate of chain) {
|
|
9863
|
-
if (_exists(
|
|
9985
|
+
if (_exists(path11.join(candidate, DEFAULT_PROJECT_FILE))) {
|
|
9864
9986
|
outermost = candidate;
|
|
9865
9987
|
}
|
|
9866
9988
|
}
|
|
@@ -9904,7 +10026,7 @@ function _expanduser(p) {
|
|
|
9904
10026
|
return os6.homedir();
|
|
9905
10027
|
}
|
|
9906
10028
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
9907
|
-
return
|
|
10029
|
+
return path11.join(os6.homedir(), p.slice(2));
|
|
9908
10030
|
}
|
|
9909
10031
|
return p;
|
|
9910
10032
|
}
|
|
@@ -9933,13 +10055,13 @@ function resolve_project_root(arg, options = {}) {
|
|
|
9933
10055
|
function _resolve_cascade_paths(cwd, project_path) {
|
|
9934
10056
|
if (cwd === null) {
|
|
9935
10057
|
const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
|
|
9936
|
-
const parent =
|
|
10058
|
+
const parent = path11.dirname(legacy);
|
|
9937
10059
|
return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
|
|
9938
10060
|
}
|
|
9939
10061
|
const root = find_project_root(cwd);
|
|
9940
10062
|
if (root === null) {
|
|
9941
10063
|
const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
|
|
9942
|
-
const parent =
|
|
10064
|
+
const parent = path11.dirname(legacy);
|
|
9943
10065
|
return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
|
|
9944
10066
|
}
|
|
9945
10067
|
const cwd_resolved = _resolve(cwd);
|
|
@@ -9950,7 +10072,7 @@ function _resolve_cascade_paths(cwd, project_path) {
|
|
|
9950
10072
|
if (cursor === root) {
|
|
9951
10073
|
break;
|
|
9952
10074
|
}
|
|
9953
|
-
const parent =
|
|
10075
|
+
const parent = path11.dirname(cursor);
|
|
9954
10076
|
if (parent === cursor) {
|
|
9955
10077
|
break;
|
|
9956
10078
|
}
|
|
@@ -9958,7 +10080,7 @@ function _resolve_cascade_paths(cwd, project_path) {
|
|
|
9958
10080
|
}
|
|
9959
10081
|
chain.reverse();
|
|
9960
10082
|
return [
|
|
9961
|
-
...chain.map((d) =>
|
|
10083
|
+
...chain.map((d) => path11.join(d, DEFAULT_PROJECT_FILE)),
|
|
9962
10084
|
_canonical_settings_path(root),
|
|
9963
10085
|
_local_settings_path(root)
|
|
9964
10086
|
];
|
|
@@ -9968,7 +10090,10 @@ function load_agent_settings(options = {}) {
|
|
|
9968
10090
|
const user_global_path = options.user_global_path ?? null;
|
|
9969
10091
|
const verbose = options.verbose ?? false;
|
|
9970
10092
|
const cwd = options.cwd ?? null;
|
|
9971
|
-
const user_global_raw =
|
|
10093
|
+
const user_global_raw = {};
|
|
10094
|
+
for (const p of user_global_path ? [user_global_path] : user_global_settings_paths()) {
|
|
10095
|
+
_deep_merge(user_global_raw, _read_yaml(p) ?? {});
|
|
10096
|
+
}
|
|
9972
10097
|
const [user_global_filtered, ignored] = _filter_whitelist(user_global_raw, MERGEABLE_KEYS);
|
|
9973
10098
|
if (verbose && ignored.length > 0) {
|
|
9974
10099
|
logger.info(
|
|
@@ -9985,8 +10110,40 @@ function load_agent_settings(options = {}) {
|
|
|
9985
10110
|
_deep_merge(merged, layer);
|
|
9986
10111
|
}
|
|
9987
10112
|
}
|
|
10113
|
+
_warn_removed_always_on_keys(merged);
|
|
9988
10114
|
return merged;
|
|
9989
10115
|
}
|
|
10116
|
+
var REMOVED_ALWAYS_ON_KEYS = [
|
|
10117
|
+
"subagents.enabled",
|
|
10118
|
+
"subagents.auto",
|
|
10119
|
+
"subagents.host_capabilities",
|
|
10120
|
+
"subagents.budget_routing",
|
|
10121
|
+
"ai_team.enabled"
|
|
10122
|
+
];
|
|
10123
|
+
var _warnedRemovedAlwaysOnKeys = /* @__PURE__ */ new Set();
|
|
10124
|
+
function _readDottedSettingsPath(root, dotted) {
|
|
10125
|
+
let node = root;
|
|
10126
|
+
for (const part of dotted.split(".")) {
|
|
10127
|
+
if (typeof node !== "object" || node === null || Array.isArray(node)) {
|
|
10128
|
+
return void 0;
|
|
10129
|
+
}
|
|
10130
|
+
node = node[part];
|
|
10131
|
+
}
|
|
10132
|
+
return node;
|
|
10133
|
+
}
|
|
10134
|
+
function _warn_removed_always_on_keys(merged) {
|
|
10135
|
+
for (const key of REMOVED_ALWAYS_ON_KEYS) {
|
|
10136
|
+
if (_warnedRemovedAlwaysOnKeys.has(key)) {
|
|
10137
|
+
continue;
|
|
10138
|
+
}
|
|
10139
|
+
if (_readDottedSettingsPath(merged, key) === void 0) {
|
|
10140
|
+
continue;
|
|
10141
|
+
}
|
|
10142
|
+
_warnedRemovedAlwaysOnKeys.add(key);
|
|
10143
|
+
process.stderr.write(`${key} was removed (always-on orchestration); ignored.
|
|
10144
|
+
`);
|
|
10145
|
+
}
|
|
10146
|
+
}
|
|
9990
10147
|
function _read_yaml(p) {
|
|
9991
10148
|
if (!_is_file(p)) {
|
|
9992
10149
|
return null;
|
|
@@ -9999,7 +10156,7 @@ function _read_yaml(p) {
|
|
|
9999
10156
|
}
|
|
10000
10157
|
let data;
|
|
10001
10158
|
try {
|
|
10002
|
-
const text =
|
|
10159
|
+
const text = fs12.readFileSync(p, "utf-8");
|
|
10003
10160
|
data = YAML3.parse(text, { version: "1.1" });
|
|
10004
10161
|
if (data === null || data === void 0) {
|
|
10005
10162
|
data = {};
|
|
@@ -10091,11 +10248,11 @@ function _is_plain_dict(value) {
|
|
|
10091
10248
|
}
|
|
10092
10249
|
|
|
10093
10250
|
// src/install/rule_scope.ts
|
|
10094
|
-
import * as
|
|
10251
|
+
import * as path12 from "node:path";
|
|
10095
10252
|
|
|
10096
10253
|
// src/install/ruleInScope.ts
|
|
10097
10254
|
var YAML2 = __toESM(require_dist(), 1);
|
|
10098
|
-
import * as
|
|
10255
|
+
import * as fs13 from "node:fs";
|
|
10099
10256
|
function parseYaml2(text) {
|
|
10100
10257
|
try {
|
|
10101
10258
|
const data = YAML2.parse(text, { version: "1.1" });
|
|
@@ -10133,7 +10290,7 @@ function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null)
|
|
|
10133
10290
|
if (scope === null && pack_scope === null && role_scope === null) {
|
|
10134
10291
|
return true;
|
|
10135
10292
|
}
|
|
10136
|
-
const [meta] = parseFrontmatter(
|
|
10293
|
+
const [meta] = parseFrontmatter(fs13.readFileSync(source_path, "utf-8"));
|
|
10137
10294
|
if (meta["type"] === "always" || meta["alwaysApply"] === true) {
|
|
10138
10295
|
return true;
|
|
10139
10296
|
}
|
|
@@ -10184,7 +10341,7 @@ function ruleFileArrives(sourcePath, scope) {
|
|
|
10184
10341
|
if (!sourcePath.endsWith(".md")) {
|
|
10185
10342
|
return true;
|
|
10186
10343
|
}
|
|
10187
|
-
const basename5 =
|
|
10344
|
+
const basename5 = path12.basename(sourcePath);
|
|
10188
10345
|
if (COMPAT_ALWAYS_EXCLUDED.includes(basename5)) {
|
|
10189
10346
|
return false;
|
|
10190
10347
|
}
|
|
@@ -10742,8 +10899,8 @@ function getErrorMap() {
|
|
|
10742
10899
|
|
|
10743
10900
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
10744
10901
|
var makeIssue = (params) => {
|
|
10745
|
-
const { data, path:
|
|
10746
|
-
const fullPath = [...
|
|
10902
|
+
const { data, path: path17, errorMaps, issueData } = params;
|
|
10903
|
+
const fullPath = [...path17, ...issueData.path || []];
|
|
10747
10904
|
const fullIssue = {
|
|
10748
10905
|
...issueData,
|
|
10749
10906
|
path: fullPath
|
|
@@ -10859,11 +11016,11 @@ var errorUtil;
|
|
|
10859
11016
|
|
|
10860
11017
|
// node_modules/zod/v3/types.js
|
|
10861
11018
|
var ParseInputLazyPath = class {
|
|
10862
|
-
constructor(parent, value,
|
|
11019
|
+
constructor(parent, value, path17, key) {
|
|
10863
11020
|
this._cachedPath = [];
|
|
10864
11021
|
this.parent = parent;
|
|
10865
11022
|
this.data = value;
|
|
10866
|
-
this._path =
|
|
11023
|
+
this._path = path17;
|
|
10867
11024
|
this._key = key;
|
|
10868
11025
|
}
|
|
10869
11026
|
get path() {
|
|
@@ -14616,18 +14773,9 @@ var settingsSchema = external_exports.object({
|
|
|
14616
14773
|
}).default({})
|
|
14617
14774
|
}).default({}),
|
|
14618
14775
|
subagents: external_exports.object({
|
|
14619
|
-
enabled: external_exports.boolean().default(true).describe(
|
|
14620
|
-
"Global master switch for the subagent layer. true (default) = available; false = fully disabled (the canonical kill-switch \u2014 no auto-dispatch, no routing, everything runs in-session)."
|
|
14621
|
-
),
|
|
14622
|
-
auto: external_exports.enum(["off", "ask", "on"]).default("on").describe(
|
|
14623
|
-
"Automatic-dispatch mode. off = subagents only via explicit command. ask = classify the task and ask once before dispatching. on = auto-dispatch delegable tasks (surface the choice in one line). Shipped default is on on subagent-capable hosts (flipped from ask 2026-07-09, ADR-117), off elsewhere; no-op where the host has no subagent primitive."
|
|
14624
|
-
),
|
|
14625
14776
|
downshift: external_exports.boolean().default(true).describe(
|
|
14626
14777
|
"Route delegable sub-tasks to the lowest-capable model tier (cost + speed via model downshift). false = every subagent runs on the session tier."
|
|
14627
14778
|
),
|
|
14628
|
-
budget_routing: external_exports.enum(["ask", "auto", "off"]).default("ask").describe(
|
|
14629
|
-
"Budget-aware cheap-request delegation (docs/contracts/budget-routing.md): pick the cheapest classifier-adequate tier WITH available budget (cost.budgets.per_tier); cheap exhausted but strong funded \u2192 strong tier; all exhausted \u2192 session model + notice. Work is never blocked to save money; the session model is never switched (delegation with a model override). ask = confirm the first budget-motivated downshift per session (default). auto = apply silently with telemetry. off = today's behavior (single-flip rollback). Distinct from downshift: that is the quality/cost knob, this is the resource-availability gate."
|
|
14630
|
-
),
|
|
14631
14779
|
quota_arbitrage: external_exports.boolean().default(true).describe(
|
|
14632
14780
|
"Prefer a separate quota-pool model for delegable sub-tasks where the host manifest reports one. Optional bonus only \u2014 identical behaviour (minus the quota win) where unsupported. Never load-bearing."
|
|
14633
14781
|
),
|
|
@@ -14638,9 +14786,6 @@ var settingsSchema = external_exports.object({
|
|
|
14638
14786
|
}).default({}).describe(
|
|
14639
14787
|
"Per-tier model map for downshift routing. Each empty value uses the tier runtime default (no vendor model baked in)."
|
|
14640
14788
|
),
|
|
14641
|
-
host_capabilities: external_exports.object({}).passthrough().default({}).describe(
|
|
14642
|
-
"Optional override of the host-capability manifest (subagent_spawn / parallel_spawn / status_polling / separate_quota_pool). Any field set wins; omitted fields fall back to the all-false safe default. Empty = the agent resolves the manifest from host knowledge."
|
|
14643
|
-
),
|
|
14644
14789
|
implementer_model: external_exports.string().default("").describe(
|
|
14645
14790
|
"Override the model the orchestrator dispatches to subagents that write code (e.g. claude-sonnet-4, gpt-5). Empty (default) = inherit the session's primary model \u2014 cheapest and usually right."
|
|
14646
14791
|
),
|
|
@@ -14660,14 +14805,11 @@ var settingsSchema = external_exports.object({
|
|
|
14660
14805
|
)
|
|
14661
14806
|
}),
|
|
14662
14807
|
ai_team: external_exports.object({
|
|
14663
|
-
enabled: external_exports.boolean().default(false).describe(
|
|
14664
|
-
"Master switch for the /team cross-model review family (docs/contracts/ai-team-config.md). false (default) = commands are never suggested and every invocation refuses with an enable pointer. true = the family is live; individual gates (allow_delegate) still apply."
|
|
14665
|
-
),
|
|
14666
14808
|
model: external_exports.string().default("auto").describe(
|
|
14667
14809
|
"Model handed to the codex CLI. 'auto' (default) = pass no --model flag so the CLI's own default applies \u2014 tracks the subscription's current strongest model instead of pinning a stale ID. Any other value passes through verbatim as `--model <value>`."
|
|
14668
14810
|
),
|
|
14669
14811
|
allow_delegate: external_exports.boolean().default(false).describe(
|
|
14670
|
-
"Second opt-in for the only wrapper that delegates write access (/team:delegate). false (default) = delegate refuses even when
|
|
14812
|
+
"Second opt-in for the only wrapper that delegates write access (/team:delegate). false (default) = delegate refuses even when /team itself is available. Availability (codex CLI installed + authenticated) is necessary but not sufficient \u2014 this key must ALSO be true before delegation is reachable."
|
|
14671
14813
|
),
|
|
14672
14814
|
max_calls_per_day: external_exports.number().int().min(0).default(50).describe(
|
|
14673
14815
|
"Per-day cap on team calls, read against the EXISTING cli_call_budget openai bucket (~/.event4u/agent-config/cli-calls.json, daily UTC reset) \u2014 one subscription, one counter, never a parallel count. 0 = block all team calls."
|
|
@@ -14683,7 +14825,15 @@ var settingsSchema = external_exports.object({
|
|
|
14683
14825
|
"Circuit-breaker bound: after this many CONSECUTIVE BLOCK verdicts in one session, a visible notice is injected exactly once and the managed layer stops re-blocking \u2014 the user decides, never an infinite Claude\u2194Codex loop. An ALLOW verdict resets the counter. Positive integer."
|
|
14684
14826
|
)
|
|
14685
14827
|
}).default({ managed: false, max_consecutive_blocks: 3 })
|
|
14686
|
-
}).default({
|
|
14828
|
+
}).default({ model: "auto", allow_delegate: false, max_calls_per_day: 50, suppress_setup_hint: false, review_gate: { managed: false, max_consecutive_blocks: 3 } }),
|
|
14829
|
+
emergency: external_exports.object({
|
|
14830
|
+
orchestration_halt: external_exports.boolean().default(false).describe(
|
|
14831
|
+
"The one audited incident switch over the always-on orchestration stack (subagents, council, team). NOT an activation gate: false (default) = the stack runs normally. true = halted; arming requires no ceremony. Disarming (returning to false) requires orchestration_halt_justification to be a non-empty string. Both transitions emit one telemetry line."
|
|
14832
|
+
),
|
|
14833
|
+
orchestration_halt_justification: external_exports.string().default("").describe(
|
|
14834
|
+
"Required non-empty before orchestration_halt may return to false. Ignored while arming the halt."
|
|
14835
|
+
)
|
|
14836
|
+
}).default({ orchestration_halt: false, orchestration_halt_justification: "" }),
|
|
14687
14837
|
onboarding: external_exports.object({
|
|
14688
14838
|
onboarded: external_exports.boolean().default(false).describe(
|
|
14689
14839
|
"Set to true once the developer has completed `agent-config setup`. The onboarding-gate rule blocks the first turn of every chat until this is true. Toggle back to false to re-trigger the wizard."
|
|
@@ -16141,8 +16291,8 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
16141
16291
|
};
|
|
16142
16292
|
|
|
16143
16293
|
// src/scripts/_lib/module_detection.ts
|
|
16144
|
-
import * as
|
|
16145
|
-
import * as
|
|
16294
|
+
import * as fs14 from "node:fs";
|
|
16295
|
+
import * as path13 from "node:path";
|
|
16146
16296
|
var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
|
|
16147
16297
|
var _RULES = [
|
|
16148
16298
|
["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
|
|
@@ -16156,14 +16306,14 @@ var _RULES = [
|
|
|
16156
16306
|
];
|
|
16157
16307
|
function _isDir(p) {
|
|
16158
16308
|
try {
|
|
16159
|
-
return
|
|
16309
|
+
return fs14.statSync(p).isDirectory();
|
|
16160
16310
|
} catch {
|
|
16161
16311
|
return false;
|
|
16162
16312
|
}
|
|
16163
16313
|
}
|
|
16164
16314
|
function _isFile(p) {
|
|
16165
16315
|
try {
|
|
16166
|
-
return
|
|
16316
|
+
return fs14.statSync(p).isFile();
|
|
16167
16317
|
} catch {
|
|
16168
16318
|
return false;
|
|
16169
16319
|
}
|
|
@@ -16177,13 +16327,13 @@ function _isUpperChar(ch) {
|
|
|
16177
16327
|
function _list_module_subdirs(root) {
|
|
16178
16328
|
let entries;
|
|
16179
16329
|
try {
|
|
16180
|
-
entries =
|
|
16330
|
+
entries = fs14.readdirSync(root).sort();
|
|
16181
16331
|
} catch {
|
|
16182
16332
|
return [];
|
|
16183
16333
|
}
|
|
16184
16334
|
const out = [];
|
|
16185
16335
|
for (const name of entries) {
|
|
16186
|
-
if (!_isDir(
|
|
16336
|
+
if (!_isDir(path13.join(root, name))) {
|
|
16187
16337
|
continue;
|
|
16188
16338
|
}
|
|
16189
16339
|
if (name.startsWith(".")) {
|
|
@@ -16205,11 +16355,11 @@ function _score_confidence(stack, root, subdirs) {
|
|
|
16205
16355
|
return capitalized.length > 0 ? "high" : "medium";
|
|
16206
16356
|
}
|
|
16207
16357
|
if (stack === "node-monorepo") {
|
|
16208
|
-
const withPkgJson = subdirs.filter((name) => _isFile(
|
|
16358
|
+
const withPkgJson = subdirs.filter((name) => _isFile(path13.join(root, name, "package.json")));
|
|
16209
16359
|
return withPkgJson.length > 0 ? "high" : "medium";
|
|
16210
16360
|
}
|
|
16211
16361
|
if (stack === "python-src") {
|
|
16212
|
-
const withInit = subdirs.filter((name) => _isFile(
|
|
16362
|
+
const withInit = subdirs.filter((name) => _isFile(path13.join(root, name, "__init__.py")));
|
|
16213
16363
|
return withInit.length > 0 ? "high" : "medium";
|
|
16214
16364
|
}
|
|
16215
16365
|
if (stack === "go-internal") {
|
|
@@ -16221,7 +16371,7 @@ function detect_module_roots(project_root) {
|
|
|
16221
16371
|
const high = [];
|
|
16222
16372
|
const medium = [];
|
|
16223
16373
|
for (const [rel_path, stack, namespace_template] of _RULES) {
|
|
16224
|
-
const abs_path =
|
|
16374
|
+
const abs_path = path13.join(project_root, rel_path);
|
|
16225
16375
|
if (!_isDir(abs_path)) {
|
|
16226
16376
|
continue;
|
|
16227
16377
|
}
|
|
@@ -16243,7 +16393,7 @@ function detect_module_roots(project_root) {
|
|
|
16243
16393
|
}
|
|
16244
16394
|
|
|
16245
16395
|
// src/scripts/_lib/model_tier.ts
|
|
16246
|
-
import
|
|
16396
|
+
import fs15 from "node:fs";
|
|
16247
16397
|
var TIER_TO_CLAUDE_MODEL = {
|
|
16248
16398
|
high: "opus",
|
|
16249
16399
|
medium: "sonnet",
|
|
@@ -16251,8 +16401,8 @@ var TIER_TO_CLAUDE_MODEL = {
|
|
|
16251
16401
|
};
|
|
16252
16402
|
var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
|
|
16253
16403
|
function read_model_tier(skill_md) {
|
|
16254
|
-
if (!
|
|
16255
|
-
const text =
|
|
16404
|
+
if (!fs15.existsSync(skill_md)) return null;
|
|
16405
|
+
const text = fs15.readFileSync(skill_md).toString("utf-8");
|
|
16256
16406
|
if (!text.startsWith("---\n")) return null;
|
|
16257
16407
|
const end = text.indexOf("\n---\n", 4);
|
|
16258
16408
|
if (end === -1) return null;
|
|
@@ -16269,39 +16419,39 @@ function render_native_model_md(text, tier) {
|
|
|
16269
16419
|
|
|
16270
16420
|
// src/scripts/_cli/cmd_migrate.ts
|
|
16271
16421
|
import { spawnSync } from "node:child_process";
|
|
16272
|
-
import * as
|
|
16273
|
-
import * as
|
|
16422
|
+
import * as fs17 from "node:fs";
|
|
16423
|
+
import * as path15 from "node:path";
|
|
16274
16424
|
import process2 from "node:process";
|
|
16275
16425
|
import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
|
|
16276
16426
|
|
|
16277
16427
|
// src/scripts/_lib/package_root.ts
|
|
16278
|
-
import * as
|
|
16279
|
-
import * as
|
|
16428
|
+
import * as fs16 from "node:fs";
|
|
16429
|
+
import * as path14 from "node:path";
|
|
16280
16430
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
16281
16431
|
var PACKAGE_NAME = "@event4u/agent-config";
|
|
16282
16432
|
var MAX_ASCENT = 16;
|
|
16283
16433
|
function resolvePackageRoot(fromUrlOrPath, legacyHops = 3) {
|
|
16284
16434
|
const start = fromUrlOrPath.startsWith("file:") ? fileURLToPath2(fromUrlOrPath) : fromUrlOrPath;
|
|
16285
|
-
const startDir =
|
|
16435
|
+
const startDir = path14.dirname(start);
|
|
16286
16436
|
let dir = startDir;
|
|
16287
16437
|
for (let i = 0; i < MAX_ASCENT; i++) {
|
|
16288
|
-
const manifest =
|
|
16289
|
-
if (
|
|
16438
|
+
const manifest = path14.join(dir, "package.json");
|
|
16439
|
+
if (fs16.existsSync(manifest)) {
|
|
16290
16440
|
try {
|
|
16291
|
-
const parsed = JSON.parse(
|
|
16441
|
+
const parsed = JSON.parse(fs16.readFileSync(manifest, "utf8"));
|
|
16292
16442
|
if (parsed.name === PACKAGE_NAME) {
|
|
16293
16443
|
return dir;
|
|
16294
16444
|
}
|
|
16295
16445
|
} catch {
|
|
16296
16446
|
}
|
|
16297
16447
|
}
|
|
16298
|
-
const parent =
|
|
16448
|
+
const parent = path14.dirname(dir);
|
|
16299
16449
|
if (parent === dir) {
|
|
16300
16450
|
break;
|
|
16301
16451
|
}
|
|
16302
16452
|
dir = parent;
|
|
16303
16453
|
}
|
|
16304
|
-
return
|
|
16454
|
+
return path14.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
|
|
16305
16455
|
}
|
|
16306
16456
|
|
|
16307
16457
|
// src/scripts/_cli/cmd_migrate.ts
|
|
@@ -16322,7 +16472,7 @@ var LEGACY_SETTINGS_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
|
16322
16472
|
var LEGACY_STATE_FILENAME = ".implement-ticket-state.json";
|
|
16323
16473
|
var LEGACY_STATE_V1_FILENAME = ".work-state.json";
|
|
16324
16474
|
var LEGACY_AGENT_CONFIG_SHELL = "agent-config";
|
|
16325
|
-
var _HERE_DIR =
|
|
16475
|
+
var _HERE_DIR = path15.dirname(fileURLToPath3(import.meta.url));
|
|
16326
16476
|
var ArgparseExit = class extends Error {
|
|
16327
16477
|
code;
|
|
16328
16478
|
constructor(code) {
|
|
@@ -16421,38 +16571,38 @@ function _jsonDumpsIndentAscii(value, indent) {
|
|
|
16421
16571
|
}
|
|
16422
16572
|
function _isFile2(p) {
|
|
16423
16573
|
try {
|
|
16424
|
-
return
|
|
16574
|
+
return fs17.statSync(p).isFile();
|
|
16425
16575
|
} catch {
|
|
16426
16576
|
return false;
|
|
16427
16577
|
}
|
|
16428
16578
|
}
|
|
16429
16579
|
function _isDir2(p) {
|
|
16430
16580
|
try {
|
|
16431
|
-
return
|
|
16581
|
+
return fs17.statSync(p).isDirectory();
|
|
16432
16582
|
} catch {
|
|
16433
16583
|
return false;
|
|
16434
16584
|
}
|
|
16435
16585
|
}
|
|
16436
16586
|
function _isSymlink(p) {
|
|
16437
16587
|
try {
|
|
16438
|
-
return
|
|
16588
|
+
return fs17.lstatSync(p).isSymbolicLink();
|
|
16439
16589
|
} catch {
|
|
16440
16590
|
return false;
|
|
16441
16591
|
}
|
|
16442
16592
|
}
|
|
16443
16593
|
function _exists2(p) {
|
|
16444
16594
|
try {
|
|
16445
|
-
|
|
16595
|
+
fs17.lstatSync(p);
|
|
16446
16596
|
return true;
|
|
16447
16597
|
} catch {
|
|
16448
16598
|
return false;
|
|
16449
16599
|
}
|
|
16450
16600
|
}
|
|
16451
16601
|
function _readText(p) {
|
|
16452
|
-
return
|
|
16602
|
+
return fs17.readFileSync(p, { encoding: "utf-8" });
|
|
16453
16603
|
}
|
|
16454
16604
|
function _writeText(p, text) {
|
|
16455
|
-
|
|
16605
|
+
fs17.writeFileSync(p, text, { encoding: "utf-8" });
|
|
16456
16606
|
}
|
|
16457
16607
|
function _jsonLoadFile(p) {
|
|
16458
16608
|
return JSON.parse(_readText(p));
|
|
@@ -16508,7 +16658,7 @@ function _classify_symlink(link) {
|
|
|
16508
16658
|
}
|
|
16509
16659
|
let target;
|
|
16510
16660
|
try {
|
|
16511
|
-
target =
|
|
16661
|
+
target = fs17.readlinkSync(link);
|
|
16512
16662
|
} catch {
|
|
16513
16663
|
return null;
|
|
16514
16664
|
}
|
|
@@ -16519,16 +16669,16 @@ function _classify_symlink(link) {
|
|
|
16519
16669
|
return "user";
|
|
16520
16670
|
}
|
|
16521
16671
|
function _detect_legacy_state(project) {
|
|
16522
|
-
return _isFile2(
|
|
16672
|
+
return _isFile2(path15.join(project, LEGACY_STATE_FILENAME));
|
|
16523
16673
|
}
|
|
16524
16674
|
function _detect_legacy_settings(project) {
|
|
16525
16675
|
const found = [];
|
|
16526
16676
|
for (const name of LEGACY_SETTINGS_FILES) {
|
|
16527
|
-
const flat =
|
|
16677
|
+
const flat = path15.join(project, name);
|
|
16528
16678
|
if (_isFile2(flat)) {
|
|
16529
16679
|
found.push(flat);
|
|
16530
16680
|
}
|
|
16531
|
-
const typed =
|
|
16681
|
+
const typed = path15.join(project, "settings", name);
|
|
16532
16682
|
if (_isFile2(typed)) {
|
|
16533
16683
|
found.push(typed);
|
|
16534
16684
|
}
|
|
@@ -16536,25 +16686,25 @@ function _detect_legacy_settings(project) {
|
|
|
16536
16686
|
return found;
|
|
16537
16687
|
}
|
|
16538
16688
|
function _detect_empty_shell(project) {
|
|
16539
|
-
const shell =
|
|
16689
|
+
const shell = path15.join(project, LEGACY_AGENT_CONFIG_SHELL);
|
|
16540
16690
|
if (!_isDir2(shell) || _isSymlink(shell)) {
|
|
16541
16691
|
return false;
|
|
16542
16692
|
}
|
|
16543
16693
|
try {
|
|
16544
|
-
return
|
|
16694
|
+
return fs17.readdirSync(shell).length === 0;
|
|
16545
16695
|
} catch {
|
|
16546
16696
|
return false;
|
|
16547
16697
|
}
|
|
16548
16698
|
}
|
|
16549
16699
|
function _detect_already_migrated(project) {
|
|
16550
|
-
if (_detect_npm(
|
|
16700
|
+
if (_detect_npm(path15.join(project, "package.json"))) {
|
|
16551
16701
|
return false;
|
|
16552
16702
|
}
|
|
16553
|
-
if (_detect_composer(
|
|
16703
|
+
if (_detect_composer(path15.join(project, "composer.json"))) {
|
|
16554
16704
|
return false;
|
|
16555
16705
|
}
|
|
16556
16706
|
for (const name of MANAGED_SYMLINKS) {
|
|
16557
|
-
if (_classify_symlink(
|
|
16707
|
+
if (_classify_symlink(path15.join(project, name)) === "legacy") {
|
|
16558
16708
|
return false;
|
|
16559
16709
|
}
|
|
16560
16710
|
}
|
|
@@ -16625,11 +16775,11 @@ function _purge_legacy_symlinks(project) {
|
|
|
16625
16775
|
const removed = [];
|
|
16626
16776
|
const preserved = [];
|
|
16627
16777
|
for (const name of MANAGED_SYMLINKS) {
|
|
16628
|
-
const link =
|
|
16778
|
+
const link = path15.join(project, name);
|
|
16629
16779
|
const kind = _classify_symlink(link);
|
|
16630
16780
|
if (kind === "legacy") {
|
|
16631
16781
|
try {
|
|
16632
|
-
|
|
16782
|
+
fs17.unlinkSync(link);
|
|
16633
16783
|
removed.push(name);
|
|
16634
16784
|
} catch {
|
|
16635
16785
|
preserved.push(name);
|
|
@@ -16641,14 +16791,14 @@ function _purge_legacy_symlinks(project) {
|
|
|
16641
16791
|
return [removed, preserved];
|
|
16642
16792
|
}
|
|
16643
16793
|
function _migrate_state_file(project) {
|
|
16644
|
-
const source =
|
|
16794
|
+
const source = path15.join(project, LEGACY_STATE_FILENAME);
|
|
16645
16795
|
if (!_isFile2(source)) {
|
|
16646
16796
|
return null;
|
|
16647
16797
|
}
|
|
16648
|
-
const target =
|
|
16798
|
+
const target = path15.join(project, LEGACY_STATE_V1_FILENAME);
|
|
16649
16799
|
if (_exists2(target)) {
|
|
16650
16800
|
try {
|
|
16651
|
-
|
|
16801
|
+
fs17.unlinkSync(source);
|
|
16652
16802
|
return `removed stale ${LEGACY_STATE_FILENAME} (v1 already present)`;
|
|
16653
16803
|
} catch {
|
|
16654
16804
|
return null;
|
|
@@ -16663,7 +16813,7 @@ function _migrate_state_file(project) {
|
|
|
16663
16813
|
}
|
|
16664
16814
|
function _load_state_migrator() {
|
|
16665
16815
|
const pkg_root = resolvePackageRoot(import.meta.url);
|
|
16666
|
-
const rel =
|
|
16816
|
+
const rel = path15.join(
|
|
16667
16817
|
"agent-src",
|
|
16668
16818
|
"templates",
|
|
16669
16819
|
"scripts",
|
|
@@ -16671,8 +16821,8 @@ function _load_state_migrator() {
|
|
|
16671
16821
|
"migration",
|
|
16672
16822
|
"v0_to_v1.ts"
|
|
16673
16823
|
);
|
|
16674
|
-
const driver = [
|
|
16675
|
-
(p) =>
|
|
16824
|
+
const driver = [path15.join(pkg_root, "dist", rel), path15.join(pkg_root, "src", rel)].find(
|
|
16825
|
+
(p) => fs17.existsSync(p)
|
|
16676
16826
|
) ?? null;
|
|
16677
16827
|
if (driver === null) {
|
|
16678
16828
|
return null;
|
|
@@ -16680,12 +16830,12 @@ function _load_state_migrator() {
|
|
|
16680
16830
|
const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
16681
16831
|
let tsxBin = null;
|
|
16682
16832
|
for (let dir = pkg_root; ; ) {
|
|
16683
|
-
const cand =
|
|
16684
|
-
if (
|
|
16833
|
+
const cand = path15.join(dir, "node_modules", ".bin", binName);
|
|
16834
|
+
if (fs17.existsSync(cand)) {
|
|
16685
16835
|
tsxBin = cand;
|
|
16686
16836
|
break;
|
|
16687
16837
|
}
|
|
16688
|
-
const parent =
|
|
16838
|
+
const parent = path15.dirname(dir);
|
|
16689
16839
|
if (parent === dir) break;
|
|
16690
16840
|
dir = parent;
|
|
16691
16841
|
}
|
|
@@ -16712,17 +16862,17 @@ function _delete_legacy_settings(project) {
|
|
|
16712
16862
|
const removed = [];
|
|
16713
16863
|
for (const p of _detect_legacy_settings(project)) {
|
|
16714
16864
|
try {
|
|
16715
|
-
|
|
16716
|
-
removed.push(
|
|
16865
|
+
fs17.unlinkSync(p);
|
|
16866
|
+
removed.push(path15.relative(project, p));
|
|
16717
16867
|
} catch {
|
|
16718
16868
|
continue;
|
|
16719
16869
|
}
|
|
16720
16870
|
}
|
|
16721
|
-
const settings_dir =
|
|
16871
|
+
const settings_dir = path15.join(project, "settings");
|
|
16722
16872
|
if (_isDir2(settings_dir) && !_isSymlink(settings_dir)) {
|
|
16723
16873
|
try {
|
|
16724
|
-
if (
|
|
16725
|
-
|
|
16874
|
+
if (fs17.readdirSync(settings_dir).length === 0) {
|
|
16875
|
+
fs17.rmdirSync(settings_dir);
|
|
16726
16876
|
removed.push("settings/");
|
|
16727
16877
|
}
|
|
16728
16878
|
} catch {
|
|
@@ -16731,12 +16881,12 @@ function _delete_legacy_settings(project) {
|
|
|
16731
16881
|
return removed;
|
|
16732
16882
|
}
|
|
16733
16883
|
function _remove_empty_shell(project) {
|
|
16734
|
-
const shell =
|
|
16884
|
+
const shell = path15.join(project, LEGACY_AGENT_CONFIG_SHELL);
|
|
16735
16885
|
if (!_detect_empty_shell(project)) {
|
|
16736
16886
|
return false;
|
|
16737
16887
|
}
|
|
16738
16888
|
try {
|
|
16739
|
-
|
|
16889
|
+
fs17.rmdirSync(shell);
|
|
16740
16890
|
} catch {
|
|
16741
16891
|
return false;
|
|
16742
16892
|
}
|
|
@@ -16746,7 +16896,7 @@ function _reEscape(s) {
|
|
|
16746
16896
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
16747
16897
|
}
|
|
16748
16898
|
function _update_gitignore(project) {
|
|
16749
|
-
const gitignore =
|
|
16899
|
+
const gitignore = path15.join(project, ".gitignore");
|
|
16750
16900
|
const block = `${GITIGNORE_BLOCK_START}
|
|
16751
16901
|
${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
|
|
16752
16902
|
`;
|
|
@@ -16777,16 +16927,16 @@ ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
|
|
|
16777
16927
|
}
|
|
16778
16928
|
function _build_plan(project) {
|
|
16779
16929
|
return {
|
|
16780
|
-
npm: _detect_npm(
|
|
16781
|
-
composer: _detect_composer(
|
|
16930
|
+
npm: _detect_npm(path15.join(project, "package.json")),
|
|
16931
|
+
composer: _detect_composer(path15.join(project, "composer.json")),
|
|
16782
16932
|
symlinks_legacy: MANAGED_SYMLINKS.filter(
|
|
16783
|
-
(name) => _classify_symlink(
|
|
16933
|
+
(name) => _classify_symlink(path15.join(project, name)) === "legacy"
|
|
16784
16934
|
),
|
|
16785
16935
|
symlinks_user: MANAGED_SYMLINKS.filter(
|
|
16786
|
-
(name) => _classify_symlink(
|
|
16936
|
+
(name) => _classify_symlink(path15.join(project, name)) === "user"
|
|
16787
16937
|
),
|
|
16788
|
-
state_file: _isFile2(
|
|
16789
|
-
settings_files: _detect_legacy_settings(project).map((p) =>
|
|
16938
|
+
state_file: _isFile2(path15.join(project, LEGACY_STATE_FILENAME)),
|
|
16939
|
+
settings_files: _detect_legacy_settings(project).map((p) => path15.relative(project, p)),
|
|
16790
16940
|
empty_shell: _detect_empty_shell(project)
|
|
16791
16941
|
};
|
|
16792
16942
|
}
|
|
@@ -16850,10 +17000,10 @@ function _warn_on_major_mismatch(from_major, plan, out) {
|
|
|
16850
17000
|
}
|
|
16851
17001
|
function _apply(project, out, err) {
|
|
16852
17002
|
const summary = [];
|
|
16853
|
-
if (_strip_npm_entry(
|
|
17003
|
+
if (_strip_npm_entry(path15.join(project, "package.json"))) {
|
|
16854
17004
|
summary.push(`removed ${PACKAGE_NAME_NPM} from package.json`);
|
|
16855
17005
|
}
|
|
16856
|
-
if (_strip_composer_entry(
|
|
17006
|
+
if (_strip_composer_entry(path15.join(project, "composer.json"))) {
|
|
16857
17007
|
summary.push(`removed ${PACKAGE_NAME_COMPOSER} from composer.json`);
|
|
16858
17008
|
}
|
|
16859
17009
|
const [removed_links, preserved_links] = _purge_legacy_symlinks(project);
|
|
@@ -16979,13 +17129,13 @@ function _isCliEntry() {
|
|
|
16979
17129
|
if (process2.argv[1] === void 0) {
|
|
16980
17130
|
return false;
|
|
16981
17131
|
}
|
|
16982
|
-
const argvUrl = pathToFileURL(
|
|
17132
|
+
const argvUrl = pathToFileURL(path15.resolve(process2.argv[1])).href;
|
|
16983
17133
|
if (import.meta.url === argvUrl) {
|
|
16984
17134
|
return true;
|
|
16985
17135
|
}
|
|
16986
17136
|
try {
|
|
16987
|
-
const here =
|
|
16988
|
-
const argv =
|
|
17137
|
+
const here = fs17.realpathSync(fileURLToPath3(import.meta.url));
|
|
17138
|
+
const argv = fs17.realpathSync(path15.resolve(process2.argv[1]));
|
|
16989
17139
|
return here === argv;
|
|
16990
17140
|
} catch {
|
|
16991
17141
|
return false;
|
|
@@ -17022,34 +17172,34 @@ var ArgparseExit2 = class extends Error {
|
|
|
17022
17172
|
function expanduser6(p) {
|
|
17023
17173
|
if (p === "~") return os7.homedir();
|
|
17024
17174
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
17025
|
-
return
|
|
17175
|
+
return path16.join(os7.homedir(), p.slice(2));
|
|
17026
17176
|
}
|
|
17027
17177
|
return p;
|
|
17028
17178
|
}
|
|
17029
17179
|
function resolvePath(p) {
|
|
17030
17180
|
try {
|
|
17031
|
-
return
|
|
17181
|
+
return fs18.realpathSync(path16.resolve(p));
|
|
17032
17182
|
} catch {
|
|
17033
|
-
return
|
|
17183
|
+
return path16.resolve(p);
|
|
17034
17184
|
}
|
|
17035
17185
|
}
|
|
17036
17186
|
function isFile(p) {
|
|
17037
17187
|
try {
|
|
17038
|
-
return
|
|
17188
|
+
return fs18.statSync(p).isFile();
|
|
17039
17189
|
} catch {
|
|
17040
17190
|
return false;
|
|
17041
17191
|
}
|
|
17042
17192
|
}
|
|
17043
17193
|
function isDir(p) {
|
|
17044
17194
|
try {
|
|
17045
|
-
return
|
|
17195
|
+
return fs18.statSync(p).isDirectory();
|
|
17046
17196
|
} catch {
|
|
17047
17197
|
return false;
|
|
17048
17198
|
}
|
|
17049
17199
|
}
|
|
17050
17200
|
function pathExists(p) {
|
|
17051
17201
|
try {
|
|
17052
|
-
|
|
17202
|
+
fs18.statSync(p);
|
|
17053
17203
|
return true;
|
|
17054
17204
|
} catch {
|
|
17055
17205
|
return false;
|
|
@@ -17057,24 +17207,24 @@ function pathExists(p) {
|
|
|
17057
17207
|
}
|
|
17058
17208
|
function isSymlink(p) {
|
|
17059
17209
|
try {
|
|
17060
|
-
return
|
|
17210
|
+
return fs18.lstatSync(p).isSymbolicLink();
|
|
17061
17211
|
} catch {
|
|
17062
17212
|
return false;
|
|
17063
17213
|
}
|
|
17064
17214
|
}
|
|
17065
17215
|
function readText(p) {
|
|
17066
|
-
return
|
|
17216
|
+
return fs18.readFileSync(p, "utf-8");
|
|
17067
17217
|
}
|
|
17068
17218
|
function writeText(p, content) {
|
|
17069
|
-
|
|
17219
|
+
fs18.writeFileSync(p, content, "utf-8");
|
|
17070
17220
|
}
|
|
17071
17221
|
function mkdirp(p) {
|
|
17072
|
-
|
|
17222
|
+
fs18.mkdirSync(p, { recursive: true });
|
|
17073
17223
|
}
|
|
17074
17224
|
function sortedGlobStems(directory, suffix) {
|
|
17075
17225
|
let entries;
|
|
17076
17226
|
try {
|
|
17077
|
-
entries =
|
|
17227
|
+
entries = fs18.readdirSync(directory);
|
|
17078
17228
|
} catch {
|
|
17079
17229
|
return [];
|
|
17080
17230
|
}
|
|
@@ -17094,7 +17244,7 @@ function sortedGlobStems(directory, suffix) {
|
|
|
17094
17244
|
function countZips(directory) {
|
|
17095
17245
|
if (!isDir(directory)) return 0;
|
|
17096
17246
|
let n = 0;
|
|
17097
|
-
for (const name of
|
|
17247
|
+
for (const name of fs18.readdirSync(directory)) {
|
|
17098
17248
|
if (name.endsWith(".zip")) n += 1;
|
|
17099
17249
|
}
|
|
17100
17250
|
return n;
|
|
@@ -17102,35 +17252,35 @@ function countZips(directory) {
|
|
|
17102
17252
|
function sha256OfFile(p) {
|
|
17103
17253
|
let data;
|
|
17104
17254
|
try {
|
|
17105
|
-
data =
|
|
17255
|
+
data = fs18.readFileSync(p);
|
|
17106
17256
|
} catch {
|
|
17107
17257
|
return null;
|
|
17108
17258
|
}
|
|
17109
17259
|
return crypto3.createHash("sha256").update(data).digest("hex");
|
|
17110
17260
|
}
|
|
17111
17261
|
function atomicWrite0644(target, body, prefix) {
|
|
17112
|
-
const dir =
|
|
17113
|
-
const tmpName =
|
|
17262
|
+
const dir = path16.dirname(target);
|
|
17263
|
+
const tmpName = path16.join(
|
|
17114
17264
|
dir,
|
|
17115
17265
|
`${prefix}${process3.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
|
|
17116
17266
|
);
|
|
17117
17267
|
let fd = null;
|
|
17118
17268
|
try {
|
|
17119
|
-
fd =
|
|
17120
|
-
|
|
17121
|
-
|
|
17269
|
+
fd = fs18.openSync(tmpName, "wx", 420);
|
|
17270
|
+
fs18.writeFileSync(fd, body, "utf-8");
|
|
17271
|
+
fs18.closeSync(fd);
|
|
17122
17272
|
fd = null;
|
|
17123
|
-
|
|
17124
|
-
|
|
17273
|
+
fs18.chmodSync(tmpName, 420);
|
|
17274
|
+
fs18.renameSync(tmpName, target);
|
|
17125
17275
|
} catch (err) {
|
|
17126
17276
|
if (fd !== null) {
|
|
17127
17277
|
try {
|
|
17128
|
-
|
|
17278
|
+
fs18.closeSync(fd);
|
|
17129
17279
|
} catch {
|
|
17130
17280
|
}
|
|
17131
17281
|
}
|
|
17132
17282
|
try {
|
|
17133
|
-
|
|
17283
|
+
fs18.unlinkSync(tmpName);
|
|
17134
17284
|
} catch {
|
|
17135
17285
|
}
|
|
17136
17286
|
throw err;
|
|
@@ -17254,12 +17404,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
|
|
|
17254
17404
|
var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
|
|
17255
17405
|
var SETTINGS_SUBDIR = ["agents", "settings"];
|
|
17256
17406
|
function _canonical_settings_target(project_root) {
|
|
17257
|
-
return
|
|
17407
|
+
return path16.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
|
|
17258
17408
|
}
|
|
17259
17409
|
function _resolve_settings_read(project_root) {
|
|
17260
17410
|
const canonical = _canonical_settings_target(project_root);
|
|
17261
17411
|
if (pathExists(canonical)) return canonical;
|
|
17262
|
-
const legacy =
|
|
17412
|
+
const legacy = path16.join(project_root, SETTINGS_FILE);
|
|
17263
17413
|
if (pathExists(legacy)) return legacy;
|
|
17264
17414
|
return canonical;
|
|
17265
17415
|
}
|
|
@@ -17323,9 +17473,9 @@ function fail(msg) {
|
|
|
17323
17473
|
throw new SystemExitError(1);
|
|
17324
17474
|
}
|
|
17325
17475
|
function detect_package_root(project_root) {
|
|
17326
|
-
const npm_path =
|
|
17476
|
+
const npm_path = path16.join(project_root, "node_modules", "@event4u", "agent-config");
|
|
17327
17477
|
if (isDir(npm_path)) return resolvePath(npm_path);
|
|
17328
|
-
if (pathExists(
|
|
17478
|
+
if (pathExists(path16.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
17329
17479
|
return project_root;
|
|
17330
17480
|
}
|
|
17331
17481
|
fail(
|
|
@@ -17333,12 +17483,12 @@ function detect_package_root(project_root) {
|
|
|
17333
17483
|
);
|
|
17334
17484
|
}
|
|
17335
17485
|
function detect_package_type(package_root) {
|
|
17336
|
-
if (package_root.split(
|
|
17486
|
+
if (package_root.split(path16.sep).includes("node_modules")) return "npm";
|
|
17337
17487
|
return "local";
|
|
17338
17488
|
}
|
|
17339
17489
|
function detect_package_type_for_project(project_root, package_root) {
|
|
17340
17490
|
const npm_path = resolvePath(
|
|
17341
|
-
|
|
17491
|
+
path16.join(project_root, "node_modules", "@event4u", "agent-config")
|
|
17342
17492
|
);
|
|
17343
17493
|
const package_resolved = resolvePath(package_root);
|
|
17344
17494
|
if (package_resolved === npm_path) return "npm";
|
|
@@ -17358,7 +17508,7 @@ function ensure_directory(p) {
|
|
|
17358
17508
|
mkdirp(p);
|
|
17359
17509
|
}
|
|
17360
17510
|
function write_file(p, content) {
|
|
17361
|
-
ensure_directory(
|
|
17511
|
+
ensure_directory(path16.dirname(p));
|
|
17362
17512
|
writeText(p, content);
|
|
17363
17513
|
}
|
|
17364
17514
|
function read_json_file(p) {
|
|
@@ -17529,7 +17679,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
|
|
|
17529
17679
|
return rendered + "\n" + suffix;
|
|
17530
17680
|
}
|
|
17531
17681
|
function _migrate_legacy_if_present(project_root, template_body) {
|
|
17532
|
-
const legacy_target =
|
|
17682
|
+
const legacy_target = path16.join(project_root, LEGACY_SETTINGS_FILE);
|
|
17533
17683
|
if (!isFile(legacy_target)) return null;
|
|
17534
17684
|
const legacy_text = readText(legacy_target);
|
|
17535
17685
|
const [values, unknown] = _parse_legacy_settings(legacy_text);
|
|
@@ -17544,9 +17694,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
|
|
|
17544
17694
|
}
|
|
17545
17695
|
}
|
|
17546
17696
|
rendered = _append_unknown_legacy(rendered, values, unknown);
|
|
17547
|
-
const backup_target =
|
|
17697
|
+
const backup_target = path16.join(project_root, LEGACY_BACKUP_FILE);
|
|
17548
17698
|
writeText(backup_target, legacy_text);
|
|
17549
|
-
|
|
17699
|
+
fs18.unlinkSync(legacy_target);
|
|
17550
17700
|
info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
|
|
17551
17701
|
info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
|
|
17552
17702
|
if (unknown.length > 0) {
|
|
@@ -17581,7 +17731,7 @@ function _render_template(template, profile_values) {
|
|
|
17581
17731
|
return body;
|
|
17582
17732
|
}
|
|
17583
17733
|
function _load_valid_user_types(package_root) {
|
|
17584
|
-
const directory =
|
|
17734
|
+
const directory = path16.join(package_root, USER_TYPES_DIR);
|
|
17585
17735
|
if (!isDir(directory)) return [];
|
|
17586
17736
|
return sortedGlobStems(directory, ".yml");
|
|
17587
17737
|
}
|
|
@@ -17638,8 +17788,8 @@ function splitlinesKeepends(text) {
|
|
|
17638
17788
|
}
|
|
17639
17789
|
function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
|
|
17640
17790
|
const target = _canonical_settings_target(project_root);
|
|
17641
|
-
const profile_source =
|
|
17642
|
-
const template_source =
|
|
17791
|
+
const profile_source = path16.join(package_root, "src", "config", "profiles", `${profile}.ini`);
|
|
17792
|
+
const template_source = path16.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
17643
17793
|
if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
|
|
17644
17794
|
if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
|
|
17645
17795
|
const template = readText(template_source);
|
|
@@ -17653,21 +17803,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
17653
17803
|
if (profile_values["rule_loading_tier"] !== profile) {
|
|
17654
17804
|
const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
|
|
17655
17805
|
fail(
|
|
17656
|
-
`Profile preset ${
|
|
17806
|
+
`Profile preset ${path16.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
|
|
17657
17807
|
);
|
|
17658
17808
|
}
|
|
17659
17809
|
profile_values["user_type"] = _validate_user_type(package_root, user_type);
|
|
17660
17810
|
let template_body = _render_template(template, profile_values);
|
|
17661
17811
|
template_body = _inject_packs(template_body, packs ?? []);
|
|
17662
|
-
const legacy_root =
|
|
17812
|
+
const legacy_root = path16.join(project_root, SETTINGS_FILE);
|
|
17663
17813
|
if (isFile(legacy_root) && !pathExists(target)) {
|
|
17664
|
-
mkdirp(
|
|
17814
|
+
mkdirp(path16.dirname(target));
|
|
17665
17815
|
writeText(target, readText(legacy_root));
|
|
17666
|
-
|
|
17816
|
+
fs18.unlinkSync(legacy_root);
|
|
17667
17817
|
success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
|
|
17668
17818
|
return;
|
|
17669
17819
|
}
|
|
17670
|
-
const legacy_target =
|
|
17820
|
+
const legacy_target = path16.join(project_root, LEGACY_SETTINGS_FILE);
|
|
17671
17821
|
if (isFile(legacy_target) && pathExists(target)) {
|
|
17672
17822
|
warn(
|
|
17673
17823
|
`Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
|
|
@@ -17684,7 +17834,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
17684
17834
|
skip(`${SETTINGS_FILE} already exists`);
|
|
17685
17835
|
return;
|
|
17686
17836
|
}
|
|
17687
|
-
mkdirp(
|
|
17837
|
+
mkdirp(path16.dirname(target));
|
|
17688
17838
|
write_file(target, template_body);
|
|
17689
17839
|
const user_type_value = profile_values["user_type"] ?? "";
|
|
17690
17840
|
const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
|
|
@@ -17697,7 +17847,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
17697
17847
|
const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
|
|
17698
17848
|
const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
|
|
17699
17849
|
merge_json_file(
|
|
17700
|
-
|
|
17850
|
+
path16.join(project_root, ".vscode", "settings.json"),
|
|
17701
17851
|
bridge,
|
|
17702
17852
|
force,
|
|
17703
17853
|
".vscode/settings.json"
|
|
@@ -17706,14 +17856,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
17706
17856
|
function ensure_augment_bridge(project_root, force) {
|
|
17707
17857
|
const bridge = { enabledPlugins: { "agent-config@event4u": true } };
|
|
17708
17858
|
return merge_json_file(
|
|
17709
|
-
|
|
17859
|
+
path16.join(project_root, ".augment", "settings.json"),
|
|
17710
17860
|
bridge,
|
|
17711
17861
|
force,
|
|
17712
17862
|
".augment/settings.json"
|
|
17713
17863
|
);
|
|
17714
17864
|
}
|
|
17715
|
-
var AUGMENT_USER_DIR =
|
|
17716
|
-
var AUGMENT_USER_HOOKS_DIR =
|
|
17865
|
+
var AUGMENT_USER_DIR = path16.join(os7.homedir(), ".augment");
|
|
17866
|
+
var AUGMENT_USER_HOOKS_DIR = path16.join(AUGMENT_USER_DIR, "hooks");
|
|
17717
17867
|
var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
|
|
17718
17868
|
var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
17719
17869
|
"augment-chat-history.sh",
|
|
@@ -17729,29 +17879,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
|
|
|
17729
17879
|
["post_tool_use", "PostToolUse"]
|
|
17730
17880
|
];
|
|
17731
17881
|
function _deploy_augment_trampoline(package_root, name, force) {
|
|
17732
|
-
const src =
|
|
17882
|
+
const src = path16.join(package_root, "scripts", "hooks", name);
|
|
17733
17883
|
if (!pathExists(src)) {
|
|
17734
17884
|
skip(`augment trampoline missing in package: ${src}`);
|
|
17735
17885
|
return null;
|
|
17736
17886
|
}
|
|
17737
17887
|
mkdirp(AUGMENT_USER_HOOKS_DIR);
|
|
17738
|
-
const dst =
|
|
17888
|
+
const dst = path16.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
17739
17889
|
const src_text = readText(src);
|
|
17740
17890
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
17741
17891
|
skip(`~/.augment/hooks/${name} already up to date`);
|
|
17742
17892
|
} else {
|
|
17743
17893
|
writeText(dst, src_text);
|
|
17744
|
-
|
|
17894
|
+
fs18.chmodSync(dst, 493);
|
|
17745
17895
|
success(`~/.augment/hooks/${name} installed`);
|
|
17746
17896
|
}
|
|
17747
17897
|
return dst;
|
|
17748
17898
|
}
|
|
17749
17899
|
function _remove_legacy_augment_trampolines() {
|
|
17750
17900
|
for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
|
|
17751
|
-
const legacy =
|
|
17901
|
+
const legacy = path16.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
17752
17902
|
try {
|
|
17753
17903
|
if (isFile(legacy)) {
|
|
17754
|
-
|
|
17904
|
+
fs18.unlinkSync(legacy);
|
|
17755
17905
|
skip(`removed legacy ~/.augment/hooks/${name}`);
|
|
17756
17906
|
}
|
|
17757
17907
|
} catch {
|
|
@@ -17770,7 +17920,7 @@ function ensure_augment_user_hooks(package_root, force) {
|
|
|
17770
17920
|
}
|
|
17771
17921
|
const settings_patch = { hooks: per_event };
|
|
17772
17922
|
return merge_json_file(
|
|
17773
|
-
|
|
17923
|
+
path16.join(AUGMENT_USER_DIR, "settings.json"),
|
|
17774
17924
|
settings_patch,
|
|
17775
17925
|
force,
|
|
17776
17926
|
"~/.augment/settings.json"
|
|
@@ -17795,7 +17945,7 @@ function _heal_legacy_claude_plugin_ids(p) {
|
|
|
17795
17945
|
return removed;
|
|
17796
17946
|
}
|
|
17797
17947
|
function ensure_claude_bridge(project_root, force) {
|
|
17798
|
-
const target =
|
|
17948
|
+
const target = path16.join(project_root, ".claude", "settings.json");
|
|
17799
17949
|
const healed = _heal_legacy_claude_plugin_ids(target);
|
|
17800
17950
|
for (const pid of healed) {
|
|
17801
17951
|
success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
|
|
@@ -17820,29 +17970,29 @@ function ensure_cursor_bridge(project_root, force) {
|
|
|
17820
17970
|
}
|
|
17821
17971
|
const bridge = { version: 1, hooks };
|
|
17822
17972
|
return merge_json_file(
|
|
17823
|
-
|
|
17973
|
+
path16.join(project_root, ".cursor", "hooks.json"),
|
|
17824
17974
|
bridge,
|
|
17825
17975
|
force,
|
|
17826
17976
|
".cursor/hooks.json"
|
|
17827
17977
|
);
|
|
17828
17978
|
}
|
|
17829
|
-
var CURSOR_USER_DIR =
|
|
17830
|
-
var CURSOR_USER_HOOKS_DIR =
|
|
17979
|
+
var CURSOR_USER_DIR = path16.join(os7.homedir(), ".cursor");
|
|
17980
|
+
var CURSOR_USER_HOOKS_DIR = path16.join(CURSOR_USER_DIR, "hooks");
|
|
17831
17981
|
var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
|
|
17832
17982
|
function ensure_cursor_user_hooks(package_root, force) {
|
|
17833
|
-
const src =
|
|
17983
|
+
const src = path16.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
|
|
17834
17984
|
if (!pathExists(src)) {
|
|
17835
17985
|
skip(`cursor trampoline missing in package: ${src}`);
|
|
17836
17986
|
return [];
|
|
17837
17987
|
}
|
|
17838
17988
|
mkdirp(CURSOR_USER_HOOKS_DIR);
|
|
17839
|
-
const dst =
|
|
17989
|
+
const dst = path16.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
|
|
17840
17990
|
const src_text = readText(src);
|
|
17841
17991
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
17842
17992
|
skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
17843
17993
|
} else {
|
|
17844
17994
|
writeText(dst, src_text);
|
|
17845
|
-
|
|
17995
|
+
fs18.chmodSync(dst, 493);
|
|
17846
17996
|
success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
|
|
17847
17997
|
}
|
|
17848
17998
|
const hooks = {};
|
|
@@ -17851,7 +18001,7 @@ function ensure_cursor_user_hooks(package_root, force) {
|
|
|
17851
18001
|
}
|
|
17852
18002
|
const settings_patch = { version: 1, hooks };
|
|
17853
18003
|
return merge_json_file(
|
|
17854
|
-
|
|
18004
|
+
path16.join(CURSOR_USER_DIR, "hooks.json"),
|
|
17855
18005
|
settings_patch,
|
|
17856
18006
|
force,
|
|
17857
18007
|
"~/.cursor/hooks.json"
|
|
@@ -17894,12 +18044,12 @@ exit 0
|
|
|
17894
18044
|
`;
|
|
17895
18045
|
}
|
|
17896
18046
|
function ensure_cline_bridge(project_root, force) {
|
|
17897
|
-
const hooks_dir =
|
|
18047
|
+
const hooks_dir = path16.join(project_root, ".clinerules", "hooks");
|
|
17898
18048
|
mkdirp(hooks_dir);
|
|
17899
18049
|
const workspace_quoted = shlexQuote(resolvePath(project_root));
|
|
17900
18050
|
let written = 0;
|
|
17901
18051
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
17902
|
-
const target =
|
|
18052
|
+
const target = path16.join(hooks_dir, native_event);
|
|
17903
18053
|
const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
|
|
17904
18054
|
if (pathExists(target) && readText(target) === body && !force) {
|
|
17905
18055
|
continue;
|
|
@@ -17909,7 +18059,7 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
17909
18059
|
continue;
|
|
17910
18060
|
}
|
|
17911
18061
|
writeText(target, body);
|
|
17912
|
-
|
|
18062
|
+
fs18.chmodSync(target, 493);
|
|
17913
18063
|
written += 1;
|
|
17914
18064
|
}
|
|
17915
18065
|
if (written) {
|
|
@@ -17918,27 +18068,27 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
17918
18068
|
skip(".clinerules/hooks/ already up to date");
|
|
17919
18069
|
}
|
|
17920
18070
|
}
|
|
17921
|
-
var CLINE_USER_DIR =
|
|
18071
|
+
var CLINE_USER_DIR = path16.join(os7.homedir(), "Documents", "Cline", "Hooks");
|
|
17922
18072
|
var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
|
|
17923
18073
|
function ensure_cline_user_hooks(package_root, force) {
|
|
17924
|
-
const src =
|
|
18074
|
+
const src = path16.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
|
|
17925
18075
|
if (!pathExists(src)) {
|
|
17926
18076
|
skip(`cline trampoline missing in package: ${src}`);
|
|
17927
18077
|
return;
|
|
17928
18078
|
}
|
|
17929
18079
|
mkdirp(CLINE_USER_DIR);
|
|
17930
|
-
const trampoline =
|
|
18080
|
+
const trampoline = path16.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
|
|
17931
18081
|
const src_text = readText(src);
|
|
17932
18082
|
if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
|
|
17933
18083
|
skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
17934
18084
|
} else {
|
|
17935
18085
|
writeText(trampoline, src_text);
|
|
17936
|
-
|
|
18086
|
+
fs18.chmodSync(trampoline, 493);
|
|
17937
18087
|
success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
|
|
17938
18088
|
}
|
|
17939
18089
|
const trampoline_quoted = shlexQuote(trampoline);
|
|
17940
18090
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
17941
|
-
const wrapper =
|
|
18091
|
+
const wrapper = path16.join(CLINE_USER_DIR, native_event);
|
|
17942
18092
|
const body = `#!/usr/bin/env bash
|
|
17943
18093
|
# Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
|
|
17944
18094
|
# User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
|
|
@@ -17948,7 +18098,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
|
|
|
17948
18098
|
continue;
|
|
17949
18099
|
}
|
|
17950
18100
|
writeText(wrapper, body);
|
|
17951
|
-
|
|
18101
|
+
fs18.chmodSync(wrapper, 493);
|
|
17952
18102
|
}
|
|
17953
18103
|
}
|
|
17954
18104
|
var WINDSURF_DISPATCHER_BINDINGS = [
|
|
@@ -17969,29 +18119,29 @@ function ensure_windsurf_bridge(project_root, force) {
|
|
|
17969
18119
|
}
|
|
17970
18120
|
const bridge = { hooks };
|
|
17971
18121
|
return merge_json_file(
|
|
17972
|
-
|
|
18122
|
+
path16.join(project_root, ".windsurf", "hooks.json"),
|
|
17973
18123
|
bridge,
|
|
17974
18124
|
force,
|
|
17975
18125
|
".windsurf/hooks.json"
|
|
17976
18126
|
);
|
|
17977
18127
|
}
|
|
17978
|
-
var WINDSURF_USER_DIR =
|
|
17979
|
-
var WINDSURF_USER_HOOKS_DIR =
|
|
18128
|
+
var WINDSURF_USER_DIR = path16.join(os7.homedir(), ".codeium", "windsurf");
|
|
18129
|
+
var WINDSURF_USER_HOOKS_DIR = path16.join(WINDSURF_USER_DIR, "hooks");
|
|
17980
18130
|
var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
|
|
17981
18131
|
function ensure_windsurf_user_hooks(package_root, force) {
|
|
17982
|
-
const src =
|
|
18132
|
+
const src = path16.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
17983
18133
|
if (!pathExists(src)) {
|
|
17984
18134
|
skip(`windsurf trampoline missing in package: ${src}`);
|
|
17985
18135
|
return [];
|
|
17986
18136
|
}
|
|
17987
18137
|
mkdirp(WINDSURF_USER_HOOKS_DIR);
|
|
17988
|
-
const dst =
|
|
18138
|
+
const dst = path16.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
17989
18139
|
const src_text = readText(src);
|
|
17990
18140
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
17991
18141
|
skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
17992
18142
|
} else {
|
|
17993
18143
|
writeText(dst, src_text);
|
|
17994
|
-
|
|
18144
|
+
fs18.chmodSync(dst, 493);
|
|
17995
18145
|
success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
|
|
17996
18146
|
}
|
|
17997
18147
|
const hooks = {};
|
|
@@ -18003,7 +18153,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
|
|
|
18003
18153
|
}
|
|
18004
18154
|
const settings_patch = { hooks };
|
|
18005
18155
|
return merge_json_file(
|
|
18006
|
-
|
|
18156
|
+
path16.join(WINDSURF_USER_DIR, "hooks.json"),
|
|
18007
18157
|
settings_patch,
|
|
18008
18158
|
force,
|
|
18009
18159
|
"~/.codeium/windsurf/hooks.json"
|
|
@@ -18032,43 +18182,43 @@ function _gemini_hooks_dict(command_factory) {
|
|
|
18032
18182
|
function ensure_gemini_bridge(project_root, force) {
|
|
18033
18183
|
const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
|
|
18034
18184
|
return merge_json_file(
|
|
18035
|
-
|
|
18185
|
+
path16.join(project_root, ".gemini", "settings.json"),
|
|
18036
18186
|
bridge,
|
|
18037
18187
|
force,
|
|
18038
18188
|
".gemini/settings.json"
|
|
18039
18189
|
);
|
|
18040
18190
|
}
|
|
18041
|
-
var GEMINI_USER_DIR =
|
|
18042
|
-
var GEMINI_USER_HOOKS_DIR =
|
|
18191
|
+
var GEMINI_USER_DIR = path16.join(os7.homedir(), ".gemini");
|
|
18192
|
+
var GEMINI_USER_HOOKS_DIR = path16.join(GEMINI_USER_DIR, "hooks");
|
|
18043
18193
|
var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
|
|
18044
18194
|
function ensure_gemini_user_hooks(package_root, force) {
|
|
18045
|
-
const src =
|
|
18195
|
+
const src = path16.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
|
|
18046
18196
|
if (!pathExists(src)) {
|
|
18047
18197
|
skip(`gemini trampoline missing in package: ${src}`);
|
|
18048
18198
|
return [];
|
|
18049
18199
|
}
|
|
18050
18200
|
mkdirp(GEMINI_USER_HOOKS_DIR);
|
|
18051
|
-
const dst =
|
|
18201
|
+
const dst = path16.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
|
|
18052
18202
|
const src_text = readText(src);
|
|
18053
18203
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
18054
18204
|
skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
18055
18205
|
} else {
|
|
18056
18206
|
writeText(dst, src_text);
|
|
18057
|
-
|
|
18207
|
+
fs18.chmodSync(dst, 493);
|
|
18058
18208
|
success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
|
|
18059
18209
|
}
|
|
18060
18210
|
const settings_patch = {
|
|
18061
18211
|
hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
|
|
18062
18212
|
};
|
|
18063
18213
|
return merge_json_file(
|
|
18064
|
-
|
|
18214
|
+
path16.join(GEMINI_USER_DIR, "settings.json"),
|
|
18065
18215
|
settings_patch,
|
|
18066
18216
|
force,
|
|
18067
18217
|
"~/.gemini/settings.json"
|
|
18068
18218
|
);
|
|
18069
18219
|
}
|
|
18070
18220
|
function ensure_copilot_bridge(project_root, force) {
|
|
18071
|
-
const target =
|
|
18221
|
+
const target = path16.join(project_root, ".github", "plugin", "marketplace.json");
|
|
18072
18222
|
const bridge = {
|
|
18073
18223
|
marketplace: {
|
|
18074
18224
|
name: "event4u-agent-marketplace",
|
|
@@ -18111,7 +18261,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
|
|
|
18111
18261
|
Run \`./agent-config --help\` for available commands.
|
|
18112
18262
|
`;
|
|
18113
18263
|
function ensure_roocode_bridge(project_root, force) {
|
|
18114
|
-
const target =
|
|
18264
|
+
const target = path16.join(project_root, ".roo", "rules", "agent-config.md");
|
|
18115
18265
|
if (pathExists(target) && !force) {
|
|
18116
18266
|
skip(".roo/rules/agent-config.md already exists");
|
|
18117
18267
|
return;
|
|
@@ -18133,7 +18283,7 @@ To wire Claude Desktop to this project's rules, run:
|
|
|
18133
18283
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18134
18284
|
`;
|
|
18135
18285
|
function ensure_claude_desktop_bridge(project_root, force) {
|
|
18136
|
-
const target =
|
|
18286
|
+
const target = path16.join(project_root, ".claude-desktop", "agent-config.md");
|
|
18137
18287
|
if (pathExists(target) && !force) {
|
|
18138
18288
|
skip(".claude-desktop/agent-config.md already exists");
|
|
18139
18289
|
return;
|
|
@@ -18158,7 +18308,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
|
|
|
18158
18308
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18159
18309
|
`;
|
|
18160
18310
|
function ensure_aider_bridge(project_root, force) {
|
|
18161
|
-
const target =
|
|
18311
|
+
const target = path16.join(project_root, ".aider", "agent-config.md");
|
|
18162
18312
|
if (pathExists(target) && !force) {
|
|
18163
18313
|
skip(".aider/agent-config.md already exists");
|
|
18164
18314
|
return;
|
|
@@ -18177,7 +18327,7 @@ developers where the rules and skills live.
|
|
|
18177
18327
|
Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
|
|
18178
18328
|
`;
|
|
18179
18329
|
function ensure_codex_bridge(project_root, force) {
|
|
18180
|
-
const target =
|
|
18330
|
+
const target = path16.join(project_root, ".codex", "agent-config.md");
|
|
18181
18331
|
if (pathExists(target) && !force) {
|
|
18182
18332
|
skip(".codex/agent-config.md already exists");
|
|
18183
18333
|
return;
|
|
@@ -18195,7 +18345,7 @@ rules per session. The canonical rule and skill source lives under
|
|
|
18195
18345
|
orientation).
|
|
18196
18346
|
`;
|
|
18197
18347
|
function ensure_continue_bridge(project_root, force) {
|
|
18198
|
-
const target =
|
|
18348
|
+
const target = path16.join(project_root, ".continue", "rules", "agent-config.md");
|
|
18199
18349
|
if (pathExists(target) && !force) {
|
|
18200
18350
|
skip(".continue/rules/agent-config.md already exists");
|
|
18201
18351
|
return;
|
|
@@ -18226,7 +18376,7 @@ orientation).
|
|
|
18226
18376
|
See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
|
|
18227
18377
|
`;
|
|
18228
18378
|
function ensure_kilocode_bridge(project_root, force) {
|
|
18229
|
-
const target =
|
|
18379
|
+
const target = path16.join(project_root, ".kilocode", "rules", "agent-config.md");
|
|
18230
18380
|
if (pathExists(target) && !force) {
|
|
18231
18381
|
skip(".kilocode/rules/agent-config.md already exists");
|
|
18232
18382
|
return;
|
|
@@ -18253,7 +18403,7 @@ canonical source (or symlink it):
|
|
|
18253
18403
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18254
18404
|
`;
|
|
18255
18405
|
function ensure_zed_bridge(project_root, force) {
|
|
18256
|
-
const target =
|
|
18406
|
+
const target = path16.join(project_root, ".zed", "agent-config.md");
|
|
18257
18407
|
if (pathExists(target) && !force) {
|
|
18258
18408
|
skip(".zed/agent-config.md already exists");
|
|
18259
18409
|
return;
|
|
@@ -18274,7 +18424,7 @@ rules into your JetBrains profile.
|
|
|
18274
18424
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18275
18425
|
`;
|
|
18276
18426
|
function ensure_jetbrains_bridge(project_root, force) {
|
|
18277
|
-
const target =
|
|
18427
|
+
const target = path16.join(project_root, ".jetbrains", "agent-config.md");
|
|
18278
18428
|
if (pathExists(target) && !force) {
|
|
18279
18429
|
skip(".jetbrains/agent-config.md already exists");
|
|
18280
18430
|
return;
|
|
@@ -18305,7 +18455,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
|
|
|
18305
18455
|
See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
|
|
18306
18456
|
`;
|
|
18307
18457
|
function ensure_kiro_bridge(project_root, force) {
|
|
18308
|
-
const target =
|
|
18458
|
+
const target = path16.join(project_root, ".kiro", "steering", "agent-config.md");
|
|
18309
18459
|
if (pathExists(target) && !force) {
|
|
18310
18460
|
skip(".kiro/steering/agent-config.md already exists");
|
|
18311
18461
|
return;
|
|
@@ -18331,35 +18481,35 @@ var SMOKE_BRIDGE_PATHS = {
|
|
|
18331
18481
|
};
|
|
18332
18482
|
function dirHasEntries(p) {
|
|
18333
18483
|
try {
|
|
18334
|
-
return
|
|
18484
|
+
return fs18.readdirSync(p).length > 0;
|
|
18335
18485
|
} catch {
|
|
18336
18486
|
return false;
|
|
18337
18487
|
}
|
|
18338
18488
|
}
|
|
18339
18489
|
function _resolve_tsx_invocation(scriptPath, scriptArgs) {
|
|
18340
18490
|
const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
18341
|
-
let dir =
|
|
18491
|
+
let dir = path16.dirname(scriptPath);
|
|
18342
18492
|
for (; ; ) {
|
|
18343
|
-
const candidate =
|
|
18493
|
+
const candidate = path16.join(dir, "node_modules", ".bin", binName);
|
|
18344
18494
|
if (isFile(candidate)) {
|
|
18345
18495
|
return { command: candidate, args: [scriptPath, ...scriptArgs] };
|
|
18346
18496
|
}
|
|
18347
|
-
const parent =
|
|
18497
|
+
const parent = path16.dirname(dir);
|
|
18348
18498
|
if (parent === dir) break;
|
|
18349
18499
|
dir = parent;
|
|
18350
18500
|
}
|
|
18351
18501
|
return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
|
|
18352
18502
|
}
|
|
18353
18503
|
function _smoke_test_hooks(project_root, package_root) {
|
|
18354
|
-
const dispatcher =
|
|
18355
|
-
const manifest =
|
|
18504
|
+
const dispatcher = path16.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
|
|
18505
|
+
const manifest = path16.join(package_root, "scripts", "hook_manifest.yaml");
|
|
18356
18506
|
if (!isFile(dispatcher) || !isFile(manifest)) return 0;
|
|
18357
18507
|
const failed = [];
|
|
18358
18508
|
const skipped = [];
|
|
18359
18509
|
const passed = [];
|
|
18360
18510
|
for (const [platform, native] of SMOKE_PROBE_EVENTS) {
|
|
18361
18511
|
const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
|
|
18362
|
-
const bridge_path = rel_bridge ?
|
|
18512
|
+
const bridge_path = rel_bridge ? path16.join(project_root, rel_bridge) : null;
|
|
18363
18513
|
const bridge_present = Boolean(
|
|
18364
18514
|
bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
|
|
18365
18515
|
);
|
|
@@ -18559,9 +18709,9 @@ To remove this marker, delete this file.
|
|
|
18559
18709
|
`;
|
|
18560
18710
|
}
|
|
18561
18711
|
var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
|
|
18562
|
-
var GLOBAL_ROOT =
|
|
18563
|
-
var GLOBAL_USER_SETTINGS_PATH =
|
|
18564
|
-
var GLOBAL_AGENT_SETTINGS_PATH =
|
|
18712
|
+
var GLOBAL_ROOT = path16.join(os7.homedir(), ".event4u", "agent-config");
|
|
18713
|
+
var GLOBAL_USER_SETTINGS_PATH = path16.join(GLOBAL_ROOT, ".agent-user.yml");
|
|
18714
|
+
var GLOBAL_AGENT_SETTINGS_PATH = path16.join(GLOBAL_ROOT, ".agent-settings.yml");
|
|
18565
18715
|
function _bridge_marker(tool_id, scope) {
|
|
18566
18716
|
if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
|
|
18567
18717
|
return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
|
|
@@ -18610,7 +18760,7 @@ function _load_yaml_doc(p) {
|
|
|
18610
18760
|
return _isPlainObject2(data) ? data : {};
|
|
18611
18761
|
}
|
|
18612
18762
|
function _load_default_settings(package_root) {
|
|
18613
|
-
const template_source =
|
|
18763
|
+
const template_source = path16.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
18614
18764
|
if (!pathExists(template_source)) return {};
|
|
18615
18765
|
let text;
|
|
18616
18766
|
try {
|
|
@@ -18622,6 +18772,58 @@ function _load_default_settings(package_root) {
|
|
|
18622
18772
|
const data = yamlSafeLoad2(rendered);
|
|
18623
18773
|
return _isPlainObject2(data) ? data : {};
|
|
18624
18774
|
}
|
|
18775
|
+
var RULE_LAYER_CHOICES = ["global", "project", "both-acknowledged"];
|
|
18776
|
+
function _suppress_rule_layer(project_root, suppress_dir) {
|
|
18777
|
+
const target = path16.join(project_root, ".claude", "settings.local.json");
|
|
18778
|
+
const existing = pathExists(target) ? read_json_file(target) : {};
|
|
18779
|
+
let real_dir = suppress_dir;
|
|
18780
|
+
try {
|
|
18781
|
+
real_dir = fs18.realpathSync(suppress_dir);
|
|
18782
|
+
} catch {
|
|
18783
|
+
real_dir = suppress_dir;
|
|
18784
|
+
}
|
|
18785
|
+
const entry = claudeMdExcludesGlob(real_dir);
|
|
18786
|
+
const merged = mergeClaudeMdExcludes(existing["claudeMdExcludes"], entry);
|
|
18787
|
+
if (JSON.stringify(existing["claudeMdExcludes"] ?? null) === JSON.stringify(merged)) return;
|
|
18788
|
+
write_json_file(target, { ...existing, claudeMdExcludes: merged });
|
|
18789
|
+
success(`.claude/settings.local.json: claudeMdExcludes += ${entry}`);
|
|
18790
|
+
}
|
|
18791
|
+
function _gate_rule_layer_overlap(project_root, layer, dry_run) {
|
|
18792
|
+
const global_dir = path16.join(os7.homedir(), ".claude", "rules");
|
|
18793
|
+
const project_dir = path16.join(project_root, ".claude", "rules");
|
|
18794
|
+
const g = readRuleLayer(global_dir);
|
|
18795
|
+
const p = readRuleLayer(project_dir);
|
|
18796
|
+
if (g === null || p === null) return true;
|
|
18797
|
+
const report = compareLayers(g.files, p.files);
|
|
18798
|
+
if (report.overlap.length === 0) return true;
|
|
18799
|
+
if (layer === null) {
|
|
18800
|
+
warn(
|
|
18801
|
+
`rule layers overlap: ${report.overlap.length} rule(s) are in BOTH ${global_dir} and ${project_dir}, so Claude Code loads them twice (${report.redundant_chars} chars of standing context per session).`
|
|
18802
|
+
);
|
|
18803
|
+
info("Pick which layer owns the corpus \u2014 no file is deleted either way:");
|
|
18804
|
+
info(` --layer=global keep ${global_dir}, suppress the project one`);
|
|
18805
|
+
info(` --layer=project keep ${project_dir}, suppress the global one`);
|
|
18806
|
+
info(" --layer=both-acknowledged keep both and pay the doubled context knowingly");
|
|
18807
|
+
return false;
|
|
18808
|
+
}
|
|
18809
|
+
const action = decideLayerAction(
|
|
18810
|
+
report,
|
|
18811
|
+
layer,
|
|
18812
|
+
global_dir,
|
|
18813
|
+
project_dir
|
|
18814
|
+
);
|
|
18815
|
+
if (action.refresh_required && action.suppress_dir !== null) {
|
|
18816
|
+
warn(
|
|
18817
|
+
`${report.divergent.length} shared rule(s) differ in body between the two layers (${report.divergent.slice(0, 5).join(", ")}${report.divergent.length > 5 ? ", \u2026" : ""}). Suppressing a layer now would drop whatever only that copy carries. Re-run the projection first, or pass --layer=both-acknowledged.`
|
|
18818
|
+
);
|
|
18819
|
+
return false;
|
|
18820
|
+
}
|
|
18821
|
+
info(action.note);
|
|
18822
|
+
if (action.suppress_dir !== null && !dry_run) {
|
|
18823
|
+
_suppress_rule_layer(project_root, action.suppress_dir);
|
|
18824
|
+
}
|
|
18825
|
+
return true;
|
|
18826
|
+
}
|
|
18625
18827
|
function _resolve_scope(opts, detected, detect_reason, custom_path) {
|
|
18626
18828
|
if (opts.scope === "project") return "project";
|
|
18627
18829
|
if (opts.scope === "global") return "global";
|
|
@@ -18698,9 +18900,9 @@ function detect_scope(cwd) {
|
|
|
18698
18900
|
if (pathExists(_resolve_settings_read(cwd))) {
|
|
18699
18901
|
return ["project", `existing ${SETTINGS_FILE}`];
|
|
18700
18902
|
}
|
|
18701
|
-
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(
|
|
18702
|
-
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(
|
|
18703
|
-
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(
|
|
18903
|
+
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path16.join(cwd, m))) ?? null;
|
|
18904
|
+
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path16.join(cwd, d))) ?? null;
|
|
18905
|
+
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path16.join(cwd, f))) ?? null;
|
|
18704
18906
|
if (has_manifest && (has_ai_dir || has_ai_file)) {
|
|
18705
18907
|
const marker = has_ai_dir || has_ai_file;
|
|
18706
18908
|
return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
|
|
@@ -18721,7 +18923,7 @@ function readLineSyncRaw(promptText) {
|
|
|
18721
18923
|
for (; ; ) {
|
|
18722
18924
|
let n;
|
|
18723
18925
|
try {
|
|
18724
|
-
n =
|
|
18926
|
+
n = fs18.readSync(0, buf, 0, 1, null);
|
|
18725
18927
|
} catch (err) {
|
|
18726
18928
|
const code = err.code;
|
|
18727
18929
|
if (code === "EAGAIN") {
|
|
@@ -18796,8 +18998,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
|
|
|
18796
18998
|
const marker = _bridge_marker(tool_id, scope);
|
|
18797
18999
|
if (!marker) continue;
|
|
18798
19000
|
let marker_path = marker;
|
|
18799
|
-
if (!
|
|
18800
|
-
marker_path =
|
|
19001
|
+
if (!path16.isAbsolute(marker_path)) {
|
|
19002
|
+
marker_path = path16.join(project_root, marker_path);
|
|
18801
19003
|
}
|
|
18802
19004
|
out[tool_id] = [_file_entry(marker_path, "bridge", false)];
|
|
18803
19005
|
}
|
|
@@ -18836,26 +19038,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
|
|
|
18836
19038
|
}
|
|
18837
19039
|
write_manifest(target, version, entries);
|
|
18838
19040
|
if (!state.QUIET) {
|
|
18839
|
-
const rel = isRelativeTo(target, project_root) ?
|
|
19041
|
+
const rel = isRelativeTo(target, project_root) ? path16.relative(project_root, target) : target;
|
|
18840
19042
|
info(`Manifest updated: ${rel}`);
|
|
18841
19043
|
}
|
|
18842
19044
|
return 0;
|
|
18843
19045
|
}
|
|
18844
19046
|
function isRelativeTo(child, parent) {
|
|
18845
|
-
const rel =
|
|
18846
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
19047
|
+
const rel = path16.relative(parent, child);
|
|
19048
|
+
return rel === "" || !rel.startsWith("..") && !path16.isAbsolute(rel);
|
|
18847
19049
|
}
|
|
18848
19050
|
function _resolve_package_root_for_global() {
|
|
18849
19051
|
const here = resolvePath(_HERE2);
|
|
18850
|
-
const candidate =
|
|
18851
|
-
if (!pathExists(
|
|
19052
|
+
const candidate = path16.dirname(path16.dirname(path16.dirname(here)));
|
|
19053
|
+
if (!pathExists(path16.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
|
|
18852
19054
|
fail(
|
|
18853
19055
|
`Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
|
|
18854
19056
|
);
|
|
18855
19057
|
}
|
|
18856
19058
|
return candidate;
|
|
18857
19059
|
}
|
|
18858
|
-
var CONSUMER_BRIDGE_MARKER_RELPATH =
|
|
19060
|
+
var CONSUMER_BRIDGE_MARKER_RELPATH = path16.join("agents", ".event4u-bridge.yml");
|
|
18859
19061
|
var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
18860
19062
|
var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
|
|
18861
19063
|
var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
|
|
@@ -18863,7 +19065,7 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
18863
19065
|
if (process3.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
|
|
18864
19066
|
return [false, "consumer-mode-override"];
|
|
18865
19067
|
}
|
|
18866
|
-
const pkg_json =
|
|
19068
|
+
const pkg_json = path16.join(project_root, "package.json");
|
|
18867
19069
|
if (isFile(pkg_json)) {
|
|
18868
19070
|
let data = {};
|
|
18869
19071
|
try {
|
|
@@ -18875,18 +19077,18 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
18875
19077
|
return [true, "package.json:name"];
|
|
18876
19078
|
}
|
|
18877
19079
|
}
|
|
18878
|
-
if (isDir(
|
|
19080
|
+
if (isDir(path16.join(project_root, ".agent-src.uncondensed"))) {
|
|
18879
19081
|
return [true, ".agent-src.uncondensed/"];
|
|
18880
19082
|
}
|
|
18881
|
-
const packages_dir =
|
|
19083
|
+
const packages_dir = path16.join(project_root, "packages");
|
|
18882
19084
|
if (isDir(packages_dir)) {
|
|
18883
|
-
for (const child of
|
|
18884
|
-
if (isDir(
|
|
19085
|
+
for (const child of fs18.readdirSync(packages_dir)) {
|
|
19086
|
+
if (isDir(path16.join(packages_dir, child, ".agent-src.uncondensed"))) {
|
|
18885
19087
|
return [true, `packages/${child}/.agent-src.uncondensed/`];
|
|
18886
19088
|
}
|
|
18887
19089
|
}
|
|
18888
19090
|
}
|
|
18889
|
-
const installer_self =
|
|
19091
|
+
const installer_self = path16.join(project_root, "scripts", "install.py");
|
|
18890
19092
|
try {
|
|
18891
19093
|
if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE2)) {
|
|
18892
19094
|
return [true, "src/scripts/install.py (self)"];
|
|
@@ -18906,17 +19108,17 @@ function _detect_legacy_for_migration(project_root) {
|
|
|
18906
19108
|
}
|
|
18907
19109
|
return [];
|
|
18908
19110
|
}
|
|
18909
|
-
if (isFile(
|
|
19111
|
+
if (isFile(path16.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
|
|
18910
19112
|
const found = [];
|
|
18911
19113
|
for (const name of MIGRATE_LEGACY_YAML_FILES) {
|
|
18912
|
-
if (isFile(
|
|
19114
|
+
if (isFile(path16.join(project_root, name))) {
|
|
18913
19115
|
found.push(name);
|
|
18914
|
-
} else if (isFile(
|
|
19116
|
+
} else if (isFile(path16.join(project_root, "settings", name))) {
|
|
18915
19117
|
found.push(`settings/${name}`);
|
|
18916
19118
|
}
|
|
18917
19119
|
}
|
|
18918
19120
|
for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
|
|
18919
|
-
const p =
|
|
19121
|
+
const p = path16.join(project_root, name);
|
|
18920
19122
|
if (isDir(p) && !isSymlink(p)) {
|
|
18921
19123
|
found.push(`${name}/`);
|
|
18922
19124
|
}
|
|
@@ -18928,7 +19130,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
|
|
|
18928
19130
|
process3.stdout.write("\n");
|
|
18929
19131
|
warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
|
|
18930
19132
|
for (const rel of artefacts) {
|
|
18931
|
-
info(` ${
|
|
19133
|
+
info(` ${path16.join(project_root, rel)}`);
|
|
18932
19134
|
}
|
|
18933
19135
|
info("The unified `agent-config migrate` sweeps these in one pass.");
|
|
18934
19136
|
info("The wizard recreates fresh config afterwards.");
|
|
@@ -18959,20 +19161,20 @@ function _run_migrate_to_global(project_root) {
|
|
|
18959
19161
|
function _format_global_root_for_marker(global_root) {
|
|
18960
19162
|
const home = resolvePath(os7.homedir());
|
|
18961
19163
|
const resolved = resolvePath(global_root);
|
|
18962
|
-
const rel =
|
|
18963
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
19164
|
+
const rel = path16.relative(home, resolved);
|
|
19165
|
+
if (rel === "" || rel.startsWith("..") || path16.isAbsolute(rel)) {
|
|
18964
19166
|
return global_root;
|
|
18965
19167
|
}
|
|
18966
|
-
return `~/${rel.split(
|
|
19168
|
+
return `~/${rel.split(path16.sep).join("/")}`;
|
|
18967
19169
|
}
|
|
18968
19170
|
function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
|
|
18969
19171
|
const env_map = env ?? process3.env;
|
|
18970
19172
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
|
|
18971
|
-
if (isDir(
|
|
18972
|
-
const target =
|
|
19173
|
+
if (isDir(path16.join(project_root, ".agent-src.uncondensed"))) return null;
|
|
19174
|
+
const target = path16.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
|
|
18973
19175
|
if (!isFile(target)) return null;
|
|
18974
19176
|
try {
|
|
18975
|
-
|
|
19177
|
+
fs18.rmSync(target);
|
|
18976
19178
|
} catch {
|
|
18977
19179
|
return null;
|
|
18978
19180
|
}
|
|
@@ -18986,7 +19188,7 @@ var PROJECT_ANCHOR_TOOLS = {
|
|
|
18986
19188
|
function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
|
|
18987
19189
|
const env_map = env ?? process3.env;
|
|
18988
19190
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
|
|
18989
|
-
if (isDir(
|
|
19191
|
+
if (isDir(path16.join(project_root, ".agent-src.uncondensed"))) return [];
|
|
18990
19192
|
const global_root_str = _format_global_root_for_marker(
|
|
18991
19193
|
event4u_root(env_map)
|
|
18992
19194
|
);
|
|
@@ -18995,8 +19197,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
|
|
|
18995
19197
|
for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
|
|
18996
19198
|
const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
|
|
18997
19199
|
if (!tools.has(tool_id)) continue;
|
|
18998
|
-
const target =
|
|
18999
|
-
mkdirp(
|
|
19200
|
+
const target = path16.join(project_root, rel_path);
|
|
19201
|
+
mkdirp(path16.dirname(target));
|
|
19000
19202
|
const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
|
|
19001
19203
|
# Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
|
|
19002
19204
|
# Tool: ${tool_id}. Resolves the global install directly \u2014 no
|
|
@@ -19014,7 +19216,7 @@ installed_at: ${stamp}
|
|
|
19014
19216
|
}
|
|
19015
19217
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
19016
19218
|
function _inject_package_tag(target, source, package_root) {
|
|
19017
|
-
if (
|
|
19219
|
+
if (path16.extname(target) !== ".md") return;
|
|
19018
19220
|
let text;
|
|
19019
19221
|
try {
|
|
19020
19222
|
text = readText(target);
|
|
@@ -19042,8 +19244,8 @@ function _inject_package_tag(target, source, package_root) {
|
|
|
19042
19244
|
resolved_src = source;
|
|
19043
19245
|
}
|
|
19044
19246
|
if (package_root !== null) {
|
|
19045
|
-
const rel =
|
|
19046
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
19247
|
+
const rel = path16.relative(resolvePath(package_root), resolved_src);
|
|
19248
|
+
if (rel !== "" && !rel.startsWith("..") && !path16.isAbsolute(rel)) {
|
|
19047
19249
|
source_value = rel;
|
|
19048
19250
|
} else {
|
|
19049
19251
|
source_value = resolved_src;
|
|
@@ -19078,7 +19280,7 @@ function _escapes_package_root(resolved, package_root) {
|
|
|
19078
19280
|
if (package_root === null) return false;
|
|
19079
19281
|
let root;
|
|
19080
19282
|
try {
|
|
19081
|
-
root =
|
|
19283
|
+
root = fs18.realpathSync(package_root);
|
|
19082
19284
|
} catch {
|
|
19083
19285
|
return false;
|
|
19084
19286
|
}
|
|
@@ -19093,7 +19295,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19093
19295
|
if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
|
|
19094
19296
|
let resolved_src = src;
|
|
19095
19297
|
try {
|
|
19096
|
-
resolved_src =
|
|
19298
|
+
resolved_src = fs18.realpathSync(src);
|
|
19097
19299
|
} catch {
|
|
19098
19300
|
resolved_src = src;
|
|
19099
19301
|
}
|
|
@@ -19101,10 +19303,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19101
19303
|
warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
|
|
19102
19304
|
return [0, 0, written_paths];
|
|
19103
19305
|
}
|
|
19104
|
-
mkdirp(
|
|
19306
|
+
mkdirp(path16.dirname(dest));
|
|
19105
19307
|
const decision = _resolve_file_conflict(dest, force);
|
|
19106
19308
|
if (decision === "skip") return [0, 1, written_paths];
|
|
19107
|
-
|
|
19309
|
+
fs18.copyFileSync(src, dest);
|
|
19108
19310
|
_inject_package_tag(dest, src, package_root);
|
|
19109
19311
|
written_paths.push(dest);
|
|
19110
19312
|
return [1, 0, written_paths];
|
|
@@ -19112,11 +19314,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19112
19314
|
mkdirp(dest);
|
|
19113
19315
|
const walk = (node) => {
|
|
19114
19316
|
const acc = [];
|
|
19115
|
-
const names =
|
|
19317
|
+
const names = fs18.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
19116
19318
|
for (const name of names) {
|
|
19117
|
-
const entry =
|
|
19319
|
+
const entry = path16.join(node, name);
|
|
19118
19320
|
acc.push(entry);
|
|
19119
|
-
const lst =
|
|
19321
|
+
const lst = fs18.lstatSync(entry);
|
|
19120
19322
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
19121
19323
|
acc.push(...walk(entry));
|
|
19122
19324
|
}
|
|
@@ -19124,9 +19326,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19124
19326
|
return acc;
|
|
19125
19327
|
};
|
|
19126
19328
|
for (const entry of walk(src)) {
|
|
19127
|
-
const rel =
|
|
19128
|
-
const target =
|
|
19129
|
-
const lst =
|
|
19329
|
+
const rel = path16.relative(src, entry);
|
|
19330
|
+
const target = path16.join(dest, rel);
|
|
19331
|
+
const lst = fs18.lstatSync(entry);
|
|
19130
19332
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
19131
19333
|
mkdirp(target);
|
|
19132
19334
|
continue;
|
|
@@ -19134,8 +19336,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19134
19336
|
let resolvedIsDir = false;
|
|
19135
19337
|
let resolved = entry;
|
|
19136
19338
|
try {
|
|
19137
|
-
resolved =
|
|
19138
|
-
resolvedIsDir =
|
|
19339
|
+
resolved = fs18.realpathSync(entry);
|
|
19340
|
+
resolvedIsDir = fs18.statSync(entry).isDirectory();
|
|
19139
19341
|
} catch {
|
|
19140
19342
|
resolvedIsDir = false;
|
|
19141
19343
|
}
|
|
@@ -19165,8 +19367,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19165
19367
|
skipped += 1;
|
|
19166
19368
|
continue;
|
|
19167
19369
|
}
|
|
19168
|
-
mkdirp(
|
|
19169
|
-
|
|
19370
|
+
mkdirp(path16.dirname(target));
|
|
19371
|
+
fs18.copyFileSync(resolved, target);
|
|
19170
19372
|
_inject_package_tag(target, resolved, package_root);
|
|
19171
19373
|
written += 1;
|
|
19172
19374
|
written_paths.push(target);
|
|
@@ -19178,7 +19380,7 @@ function _claude_desktop_bundles_dir() {
|
|
|
19178
19380
|
}
|
|
19179
19381
|
function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
|
|
19180
19382
|
const anchor = expanduser6(USER_SCOPE_PATHS["claude-desktop"]);
|
|
19181
|
-
const target =
|
|
19383
|
+
const target = path16.join(anchor, "agent-config.md");
|
|
19182
19384
|
mkdirp(anchor);
|
|
19183
19385
|
const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
|
|
19184
19386
|
writeText(target, body);
|
|
@@ -19202,23 +19404,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
19202
19404
|
const wrapped = [];
|
|
19203
19405
|
const collisions = [];
|
|
19204
19406
|
const reserved = [];
|
|
19205
|
-
const commands_dir =
|
|
19407
|
+
const commands_dir = path16.join(anchor, "commands");
|
|
19206
19408
|
let flat_entries = [];
|
|
19207
19409
|
try {
|
|
19208
|
-
flat_entries =
|
|
19410
|
+
flat_entries = fs18.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
|
|
19209
19411
|
} catch {
|
|
19210
19412
|
}
|
|
19211
19413
|
for (const fname of flat_entries.sort()) {
|
|
19212
19414
|
const slug = fname.slice(0, -".md".length);
|
|
19213
19415
|
if (!is_claude_builtin_name(slug)) continue;
|
|
19214
|
-
|
|
19416
|
+
fs18.rmSync(path16.join(commands_dir, fname), { force: true });
|
|
19215
19417
|
current_files.delete(`commands/${fname}`);
|
|
19216
19418
|
reserved.push(slug);
|
|
19217
19419
|
}
|
|
19218
19420
|
const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
|
|
19219
19421
|
try {
|
|
19220
19422
|
const manifest = JSON.parse(
|
|
19221
|
-
|
|
19423
|
+
fs18.readFileSync(path16.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
|
|
19222
19424
|
);
|
|
19223
19425
|
for (const a of manifest.artefacts ?? []) {
|
|
19224
19426
|
if (a.category !== "command" || typeof a.slug !== "string") continue;
|
|
@@ -19229,22 +19431,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
19229
19431
|
}
|
|
19230
19432
|
for (const slug of [...eligible].sort()) {
|
|
19231
19433
|
const flat_rel = `commands/${slug}.md`;
|
|
19232
|
-
const flat_abs =
|
|
19233
|
-
if (!
|
|
19234
|
-
const skill_dir =
|
|
19235
|
-
if (
|
|
19434
|
+
const flat_abs = path16.join(anchor, "commands", `${slug}.md`);
|
|
19435
|
+
if (!fs18.existsSync(flat_abs)) continue;
|
|
19436
|
+
const skill_dir = path16.join(anchor, "skills", slug);
|
|
19437
|
+
if (fs18.existsSync(skill_dir)) {
|
|
19236
19438
|
collisions.push(slug);
|
|
19237
19439
|
continue;
|
|
19238
19440
|
}
|
|
19239
|
-
let body =
|
|
19441
|
+
let body = fs18.readFileSync(flat_abs, "utf8");
|
|
19240
19442
|
if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
|
|
19241
19443
|
body = body.replace("---\n", `---
|
|
19242
19444
|
name: ${slug}
|
|
19243
19445
|
`);
|
|
19244
19446
|
}
|
|
19245
|
-
|
|
19246
|
-
|
|
19247
|
-
|
|
19447
|
+
fs18.mkdirSync(skill_dir, { recursive: true });
|
|
19448
|
+
fs18.writeFileSync(path16.join(skill_dir, "SKILL.md"), body, "utf8");
|
|
19449
|
+
fs18.rmSync(flat_abs, { force: true });
|
|
19248
19450
|
current_files.delete(flat_rel);
|
|
19249
19451
|
current_files.add(`skills/${slug}/SKILL.md`);
|
|
19250
19452
|
wrapped.push(slug);
|
|
@@ -19276,8 +19478,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
19276
19478
|
const written_paths = [];
|
|
19277
19479
|
let current_files = /* @__PURE__ */ new Set();
|
|
19278
19480
|
for (const [src_rel, dest_sub] of plan) {
|
|
19279
|
-
const src =
|
|
19280
|
-
const dest = dest_sub ?
|
|
19481
|
+
const src = path16.join(package_root, src_rel);
|
|
19482
|
+
const dest = dest_sub ? path16.join(anchor, dest_sub) : anchor;
|
|
19281
19483
|
const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
|
|
19282
19484
|
const [w, s, paths] = _copy_dir_dereferencing_symlinks(
|
|
19283
19485
|
src,
|
|
@@ -19351,10 +19553,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
19351
19553
|
results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
|
|
19352
19554
|
if (tool_id === "claude-code") {
|
|
19353
19555
|
try {
|
|
19354
|
-
const manifest =
|
|
19556
|
+
const manifest = path16.join(package_root, "src", "scripts", "hook_manifest.yaml");
|
|
19355
19557
|
const matrix = build_claude_hook_matrix(manifest);
|
|
19356
19558
|
const res = ensure_managed_hooks(
|
|
19357
|
-
|
|
19559
|
+
path16.join(anchor, "settings.json"),
|
|
19358
19560
|
matrix
|
|
19359
19561
|
);
|
|
19360
19562
|
if (!state.QUIET) {
|
|
@@ -19391,7 +19593,7 @@ function _preview_global_reap(tools, package_root) {
|
|
|
19391
19593
|
const anchor = expanduser6(anchor_raw);
|
|
19392
19594
|
let current_files = /* @__PURE__ */ new Set();
|
|
19393
19595
|
for (const [src_rel, dest_sub] of plan) {
|
|
19394
|
-
const src =
|
|
19596
|
+
const src = path16.join(package_root, src_rel);
|
|
19395
19597
|
current_files = setUnion(
|
|
19396
19598
|
current_files,
|
|
19397
19599
|
expected_deploy_files(
|
|
@@ -19425,14 +19627,14 @@ function _preview_global_reap(tools, package_root) {
|
|
|
19425
19627
|
function _verify_deploy_targets(anchor, plan) {
|
|
19426
19628
|
const missing = [];
|
|
19427
19629
|
for (const [, dest_sub] of plan) {
|
|
19428
|
-
const target = dest_sub ?
|
|
19630
|
+
const target = dest_sub ? path16.join(anchor, dest_sub) : anchor;
|
|
19429
19631
|
const label = dest_sub || ".";
|
|
19430
19632
|
if (!isDir(target)) {
|
|
19431
19633
|
missing.push(label);
|
|
19432
19634
|
continue;
|
|
19433
19635
|
}
|
|
19434
19636
|
try {
|
|
19435
|
-
const entries =
|
|
19637
|
+
const entries = fs18.readdirSync(target);
|
|
19436
19638
|
if (entries.length === 0) missing.push(label);
|
|
19437
19639
|
} catch {
|
|
19438
19640
|
missing.push(label);
|
|
@@ -19447,13 +19649,13 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
19447
19649
|
const [written, skipped, status, paths] = deploy_results[tool_id];
|
|
19448
19650
|
const pruned_skill_dirs = /* @__PURE__ */ new Set();
|
|
19449
19651
|
for (const p of paths) {
|
|
19450
|
-
const parts = p.split(
|
|
19652
|
+
const parts = p.split(path16.sep);
|
|
19451
19653
|
if (parts.includes("skills")) {
|
|
19452
19654
|
const i = parts.indexOf("skills");
|
|
19453
19655
|
if (i + 1 < parts.length) {
|
|
19454
|
-
const skill_root = parts.slice(0, i + 2).join(
|
|
19656
|
+
const skill_root = parts.slice(0, i + 2).join(path16.sep);
|
|
19455
19657
|
if (!pruned_skill_dirs.has(skill_root)) {
|
|
19456
|
-
const skillmd =
|
|
19658
|
+
const skillmd = path16.join(skill_root, "SKILL.md");
|
|
19457
19659
|
if (pathExists(skillmd) && is_pruned(skillmd)) {
|
|
19458
19660
|
pruned_skill_dirs.add(skill_root);
|
|
19459
19661
|
}
|
|
@@ -19464,25 +19666,25 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
19464
19666
|
const keep = [];
|
|
19465
19667
|
const delete_files = [];
|
|
19466
19668
|
for (const p of paths) {
|
|
19467
|
-
const parts = p.split(
|
|
19669
|
+
const parts = p.split(path16.sep);
|
|
19468
19670
|
let is_target = false;
|
|
19469
19671
|
if (parts.includes("skills")) {
|
|
19470
19672
|
const i = parts.indexOf("skills");
|
|
19471
|
-
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(
|
|
19673
|
+
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path16.sep))) {
|
|
19472
19674
|
is_target = true;
|
|
19473
19675
|
}
|
|
19474
|
-
} else if (parts.includes("commands") &&
|
|
19676
|
+
} else if (parts.includes("commands") && path16.extname(p) === ".md" && is_pruned(p)) {
|
|
19475
19677
|
is_target = true;
|
|
19476
19678
|
}
|
|
19477
19679
|
(is_target ? delete_files : keep).push(p);
|
|
19478
19680
|
}
|
|
19479
19681
|
for (const d of pruned_skill_dirs) {
|
|
19480
|
-
|
|
19682
|
+
fs18.rmSync(d, { recursive: true, force: true });
|
|
19481
19683
|
}
|
|
19482
19684
|
for (const p of delete_files) {
|
|
19483
|
-
if (p.split(
|
|
19685
|
+
if (p.split(path16.sep).includes("commands") && pathExists(p)) {
|
|
19484
19686
|
try {
|
|
19485
|
-
|
|
19687
|
+
fs18.unlinkSync(p);
|
|
19486
19688
|
} catch {
|
|
19487
19689
|
}
|
|
19488
19690
|
}
|
|
@@ -19503,9 +19705,9 @@ function _resolve_global_settings_doc() {
|
|
|
19503
19705
|
}
|
|
19504
19706
|
function _resolve_global_settings_path() {
|
|
19505
19707
|
const root = event4u_root();
|
|
19506
|
-
const canonical =
|
|
19708
|
+
const canonical = path16.join(root, "settings", SETTINGS_FILE);
|
|
19507
19709
|
if (pathExists(canonical)) return canonical;
|
|
19508
|
-
const legacy =
|
|
19710
|
+
const legacy = path16.join(root, SETTINGS_FILE);
|
|
19509
19711
|
if (pathExists(legacy)) return legacy;
|
|
19510
19712
|
return null;
|
|
19511
19713
|
}
|
|
@@ -19616,7 +19818,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
19616
19818
|
info(` schema_version=1, agent_config_version=${installed_version}`);
|
|
19617
19819
|
info(` tools=${merged_tools.join(",")}`);
|
|
19618
19820
|
}
|
|
19619
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
19821
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path16.join(project_root, ".agent-src.uncondensed"))) {
|
|
19620
19822
|
const drift = collect_drift(project_root);
|
|
19621
19823
|
if (!state.QUIET) {
|
|
19622
19824
|
process3.stdout.write("\n");
|
|
@@ -19716,19 +19918,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
19716
19918
|
}
|
|
19717
19919
|
}
|
|
19718
19920
|
}
|
|
19719
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
19921
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path16.join(project_root, ".agent-src.uncondensed"))) {
|
|
19720
19922
|
const files_by_tool = _files_by_tool_from_deploy(deploy_results);
|
|
19721
19923
|
const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
|
|
19722
19924
|
if (rc !== 0) return rc;
|
|
19723
19925
|
const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
|
|
19724
19926
|
if (removed_marker !== null && !state.QUIET) {
|
|
19725
|
-
const rel = isRelativeTo(removed_marker, project_root) ?
|
|
19927
|
+
const rel = isRelativeTo(removed_marker, project_root) ? path16.relative(project_root, removed_marker) : removed_marker;
|
|
19726
19928
|
info(`Removed legacy bridge marker: ${rel}`);
|
|
19727
19929
|
}
|
|
19728
19930
|
const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
|
|
19729
19931
|
if (anchor_paths.length > 0 && !state.QUIET) {
|
|
19730
19932
|
for (const p of anchor_paths) {
|
|
19731
|
-
const rel = isRelativeTo(p, project_root) ?
|
|
19933
|
+
const rel = isRelativeTo(p, project_root) ? path16.relative(project_root, p) : p;
|
|
19732
19934
|
info(`Project anchor written: ${rel}`);
|
|
19733
19935
|
}
|
|
19734
19936
|
}
|
|
@@ -19745,8 +19947,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
19745
19947
|
}
|
|
19746
19948
|
return 0;
|
|
19747
19949
|
}
|
|
19748
|
-
var SETTINGS_SURFACE_REL =
|
|
19749
|
-
var SETTINGS_DELTA_REL =
|
|
19950
|
+
var SETTINGS_SURFACE_REL = path16.join("state", "settings-surface.json");
|
|
19951
|
+
var SETTINGS_DELTA_REL = path16.join("state", "settings-delta.json");
|
|
19750
19952
|
function _current_settings_surface(version) {
|
|
19751
19953
|
const jsonSchema = zodToJsonSchema(settingsSchema, {
|
|
19752
19954
|
name: "AgentSettings",
|
|
@@ -19757,20 +19959,20 @@ function _current_settings_surface(version) {
|
|
|
19757
19959
|
}
|
|
19758
19960
|
function _write_settings_surface_snapshot(installed_version) {
|
|
19759
19961
|
const root = event4u_root();
|
|
19760
|
-
const surface_path =
|
|
19761
|
-
const delta_path =
|
|
19962
|
+
const surface_path = path16.join(root, SETTINGS_SURFACE_REL);
|
|
19963
|
+
const delta_path = path16.join(root, SETTINGS_DELTA_REL);
|
|
19762
19964
|
const next = _current_settings_surface(installed_version);
|
|
19763
19965
|
let previous = null;
|
|
19764
19966
|
try {
|
|
19765
|
-
const parsed = JSON.parse(
|
|
19967
|
+
const parsed = JSON.parse(fs18.readFileSync(surface_path, "utf8"));
|
|
19766
19968
|
if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
|
|
19767
19969
|
} catch {
|
|
19768
19970
|
}
|
|
19769
19971
|
if (previous !== null && previous.version !== next.version) {
|
|
19770
19972
|
const delta = computeSurfaceDelta(previous, next);
|
|
19771
19973
|
if (delta.changes.length > 0) {
|
|
19772
|
-
|
|
19773
|
-
|
|
19974
|
+
fs18.mkdirSync(path16.dirname(delta_path), { recursive: true, mode: 448 });
|
|
19975
|
+
fs18.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
|
|
19774
19976
|
`, { mode: 384 });
|
|
19775
19977
|
if (!state.QUIET) {
|
|
19776
19978
|
const counts = {};
|
|
@@ -19782,8 +19984,8 @@ function _write_settings_surface_snapshot(installed_version) {
|
|
|
19782
19984
|
}
|
|
19783
19985
|
}
|
|
19784
19986
|
}
|
|
19785
|
-
|
|
19786
|
-
|
|
19987
|
+
fs18.mkdirSync(path16.dirname(surface_path), { recursive: true, mode: 448 });
|
|
19988
|
+
fs18.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
|
|
19787
19989
|
`, { mode: 384 });
|
|
19788
19990
|
}
|
|
19789
19991
|
function arrayStrEqual(a, b) {
|
|
@@ -19809,6 +20011,7 @@ var USAGE = `usage: ${PROG} [-h] [--profile PROFILE] [--user-type USER_TYPE] [--
|
|
|
19809
20011
|
[--tools TOOLS] [--ai AI] [--packs PACKS] [--core-only]
|
|
19810
20012
|
[--no-smoke] [--global]
|
|
19811
20013
|
[--scope {project,global,prompt,auto}]
|
|
20014
|
+
[--layer {global,project,both-acknowledged}]
|
|
19812
20015
|
[--custom-path CUSTOM_PATH] [--offline] [--minimal]
|
|
19813
20016
|
[--interactive] [--no-ui] [--dry-run]
|
|
19814
20017
|
[--apply-payload APPLY_PAYLOAD]
|
|
@@ -19842,7 +20045,8 @@ var _VALUE_FLAGS = {
|
|
|
19842
20045
|
"--packs": "packs",
|
|
19843
20046
|
"--scope": "scope",
|
|
19844
20047
|
"--custom-path": "custom_path",
|
|
19845
|
-
"--apply-payload": "apply_payload"
|
|
20048
|
+
"--apply-payload": "apply_payload",
|
|
20049
|
+
"--layer": "layer"
|
|
19846
20050
|
};
|
|
19847
20051
|
function _argError(msg) {
|
|
19848
20052
|
process3.stderr.write(USAGE);
|
|
@@ -19877,7 +20081,8 @@ function parse_options(argv) {
|
|
|
19877
20081
|
interactive: false,
|
|
19878
20082
|
no_ui: false,
|
|
19879
20083
|
dry_run: false,
|
|
19880
|
-
apply_payload: null
|
|
20084
|
+
apply_payload: null,
|
|
20085
|
+
layer: null
|
|
19881
20086
|
};
|
|
19882
20087
|
const positionals = [];
|
|
19883
20088
|
let i = 0;
|
|
@@ -19914,6 +20119,11 @@ function parse_options(argv) {
|
|
|
19914
20119
|
`argument --scope: invalid choice: '${value}' (choose from 'project', 'global', 'prompt', 'auto')`
|
|
19915
20120
|
);
|
|
19916
20121
|
}
|
|
20122
|
+
if (flag === "--layer" && !RULE_LAYER_CHOICES.includes(value)) {
|
|
20123
|
+
_argError(
|
|
20124
|
+
`argument --layer: invalid choice: '${value}' (choose from ${RULE_LAYER_CHOICES.map((c) => `'${c}'`).join(", ")})`
|
|
20125
|
+
);
|
|
20126
|
+
}
|
|
19917
20127
|
opts[valueDest] = value;
|
|
19918
20128
|
i += 1;
|
|
19919
20129
|
continue;
|
|
@@ -19995,13 +20205,13 @@ function _minimal_templates_root() {
|
|
|
19995
20205
|
const chain = [start];
|
|
19996
20206
|
let cur = start;
|
|
19997
20207
|
for (; ; ) {
|
|
19998
|
-
const parent =
|
|
20208
|
+
const parent = path16.dirname(cur);
|
|
19999
20209
|
if (parent === cur) break;
|
|
20000
20210
|
chain.push(parent);
|
|
20001
20211
|
cur = parent;
|
|
20002
20212
|
}
|
|
20003
20213
|
for (const ancestor of chain) {
|
|
20004
|
-
const candidate =
|
|
20214
|
+
const candidate = path16.join(ancestor, "src", "templates", "minimal");
|
|
20005
20215
|
if (isDir(candidate)) return candidate;
|
|
20006
20216
|
}
|
|
20007
20217
|
fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
|
|
@@ -20009,9 +20219,9 @@ function _minimal_templates_root() {
|
|
|
20009
20219
|
var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
20010
20220
|
function _write_install_mode_marker(project_root, mode) {
|
|
20011
20221
|
if (mode !== "minimal" && mode !== "full") return;
|
|
20012
|
-
const marker =
|
|
20222
|
+
const marker = path16.join(project_root, INSTALL_MODE_MARKER_REL);
|
|
20013
20223
|
try {
|
|
20014
|
-
mkdirp(
|
|
20224
|
+
mkdirp(path16.dirname(marker));
|
|
20015
20225
|
writeText(marker, `${mode}
|
|
20016
20226
|
`);
|
|
20017
20227
|
} catch {
|
|
@@ -20020,7 +20230,7 @@ function _write_install_mode_marker(project_root, mode) {
|
|
|
20020
20230
|
function install_minimal(target_root_in, force, user_type = "") {
|
|
20021
20231
|
let target_root = resolvePath(target_root_in);
|
|
20022
20232
|
mkdirp(target_root);
|
|
20023
|
-
const parent =
|
|
20233
|
+
const parent = path16.dirname(target_root);
|
|
20024
20234
|
if (parent !== target_root) {
|
|
20025
20235
|
const existing = find_project_root_with_anchor(parent);
|
|
20026
20236
|
if (existing !== null && existing[0] !== target_root) {
|
|
@@ -20031,21 +20241,21 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
20031
20241
|
}
|
|
20032
20242
|
}
|
|
20033
20243
|
const templates = _minimal_templates_root();
|
|
20034
|
-
const settings_src =
|
|
20035
|
-
const overrides_gitkeep_src =
|
|
20036
|
-
const overrides_readme_src =
|
|
20244
|
+
const settings_src = path16.join(templates, SETTINGS_FILE);
|
|
20245
|
+
const overrides_gitkeep_src = path16.join(templates, "overrides-gitkeep");
|
|
20246
|
+
const overrides_readme_src = path16.join(templates, "agents-overrides-readme.md");
|
|
20037
20247
|
if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
|
|
20038
20248
|
if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
|
|
20039
20249
|
fail(`Bundled overrides scaffold templates missing under ${templates}`);
|
|
20040
20250
|
}
|
|
20041
20251
|
info(`Minimal init \u2192 ${target_root}`);
|
|
20042
|
-
const overrides_root =
|
|
20252
|
+
const overrides_root = path16.join(target_root, "agents", "overrides");
|
|
20043
20253
|
mkdirp(overrides_root);
|
|
20044
20254
|
const gitkeep_body = readText(overrides_gitkeep_src);
|
|
20045
20255
|
for (const sub of ["rules", "skills", "commands"]) {
|
|
20046
|
-
const sub_dir =
|
|
20256
|
+
const sub_dir = path16.join(overrides_root, sub);
|
|
20047
20257
|
mkdirp(sub_dir);
|
|
20048
|
-
const gitkeep_dst =
|
|
20258
|
+
const gitkeep_dst = path16.join(sub_dir, ".gitkeep");
|
|
20049
20259
|
if (pathExists(gitkeep_dst) && !force) {
|
|
20050
20260
|
skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
|
|
20051
20261
|
} else {
|
|
@@ -20053,7 +20263,7 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
20053
20263
|
success(`Wrote agents/overrides/${sub}/.gitkeep`);
|
|
20054
20264
|
}
|
|
20055
20265
|
}
|
|
20056
|
-
const readme_dst =
|
|
20266
|
+
const readme_dst = path16.join(overrides_root, "README.md");
|
|
20057
20267
|
if (pathExists(readme_dst) && !force) {
|
|
20058
20268
|
skip("agents/overrides/README.md already exists (use --force to overwrite)");
|
|
20059
20269
|
} else {
|
|
@@ -20071,14 +20281,14 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
20071
20281
|
personal:
|
|
20072
20282
|
user_type: ${user_type}
|
|
20073
20283
|
`;
|
|
20074
|
-
mkdirp(
|
|
20284
|
+
mkdirp(path16.dirname(settings_dst));
|
|
20075
20285
|
writeText(settings_dst, body);
|
|
20076
20286
|
success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
|
|
20077
20287
|
}
|
|
20078
20288
|
}
|
|
20079
20289
|
const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
|
|
20080
20290
|
if (removed_marker !== null) {
|
|
20081
|
-
const rel = isRelativeTo(removed_marker, target_root) ?
|
|
20291
|
+
const rel = isRelativeTo(removed_marker, target_root) ? path16.relative(target_root, removed_marker) : removed_marker;
|
|
20082
20292
|
success(`Removed legacy bridge marker: ${rel}`);
|
|
20083
20293
|
}
|
|
20084
20294
|
_write_install_mode_marker(target_root, "minimal");
|
|
@@ -20152,7 +20362,7 @@ function run_interactive_init(project_root, force) {
|
|
|
20152
20362
|
);
|
|
20153
20363
|
return 0;
|
|
20154
20364
|
}
|
|
20155
|
-
const target =
|
|
20365
|
+
const target = path16.join(project_root, _LOCAL_CONFIG_FILE);
|
|
20156
20366
|
if (pathExists(target) && !force) {
|
|
20157
20367
|
warn(
|
|
20158
20368
|
`${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
|
|
@@ -20179,7 +20389,7 @@ function run_interactive_init(project_root, force) {
|
|
|
20179
20389
|
warn(`Could not write ${target}: ${String(exc)}`);
|
|
20180
20390
|
return 1;
|
|
20181
20391
|
}
|
|
20182
|
-
success(`Wrote ${
|
|
20392
|
+
success(`Wrote ${path16.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
|
|
20183
20393
|
return 0;
|
|
20184
20394
|
}
|
|
20185
20395
|
var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
|
|
@@ -20197,12 +20407,12 @@ function _wizard_should_launch(opts) {
|
|
|
20197
20407
|
return [true, ""];
|
|
20198
20408
|
}
|
|
20199
20409
|
function _wizard_cli_dist(_project_root) {
|
|
20200
|
-
const package_root =
|
|
20201
|
-
const cli =
|
|
20410
|
+
const package_root = path16.dirname(path16.dirname(path16.dirname(resolvePath(_HERE2))));
|
|
20411
|
+
const cli = path16.join(package_root, "dist", "cli", "agent-config.js");
|
|
20202
20412
|
return pathExists(cli) ? cli : null;
|
|
20203
20413
|
}
|
|
20204
20414
|
function _server_info_path() {
|
|
20205
|
-
return
|
|
20415
|
+
return path16.join(os7.homedir(), ".event4u", "agent-config", "local-server.json");
|
|
20206
20416
|
}
|
|
20207
20417
|
function _pid_is_agent_config(pid) {
|
|
20208
20418
|
let res;
|
|
@@ -20219,7 +20429,7 @@ function _pid_is_agent_config(pid) {
|
|
|
20219
20429
|
}
|
|
20220
20430
|
function unlinkMissingOk(p) {
|
|
20221
20431
|
try {
|
|
20222
|
-
|
|
20432
|
+
fs18.unlinkSync(p);
|
|
20223
20433
|
} catch {
|
|
20224
20434
|
}
|
|
20225
20435
|
}
|
|
@@ -20297,14 +20507,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
|
|
|
20297
20507
|
}
|
|
20298
20508
|
function _wizard_run_sync(cmd, env, cli) {
|
|
20299
20509
|
const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
|
|
20300
|
-
const log_path =
|
|
20510
|
+
const log_path = path16.join(
|
|
20301
20511
|
os7.tmpdir(),
|
|
20302
20512
|
`agent-config-wizard-${process3.pid}-${Date.now()}.log`
|
|
20303
20513
|
);
|
|
20304
20514
|
let child;
|
|
20305
20515
|
let log_fd = null;
|
|
20306
20516
|
try {
|
|
20307
|
-
log_fd =
|
|
20517
|
+
log_fd = fs18.openSync(log_path, "w");
|
|
20308
20518
|
child = spawn(cmd[0], cmd.slice(1), {
|
|
20309
20519
|
env,
|
|
20310
20520
|
detached: true,
|
|
@@ -20322,7 +20532,7 @@ function _wizard_run_sync(cmd, env, cli) {
|
|
|
20322
20532
|
} finally {
|
|
20323
20533
|
if (log_fd !== null) {
|
|
20324
20534
|
try {
|
|
20325
|
-
|
|
20535
|
+
fs18.closeSync(log_fd);
|
|
20326
20536
|
} catch {
|
|
20327
20537
|
}
|
|
20328
20538
|
}
|
|
@@ -20572,8 +20782,8 @@ function main2(argv) {
|
|
|
20572
20782
|
const target_root = resolvePath(
|
|
20573
20783
|
opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
|
|
20574
20784
|
);
|
|
20575
|
-
const minimal_package_root =
|
|
20576
|
-
|
|
20785
|
+
const minimal_package_root = path16.dirname(
|
|
20786
|
+
path16.dirname(path16.dirname(_minimal_templates_root()))
|
|
20577
20787
|
);
|
|
20578
20788
|
const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
|
|
20579
20789
|
return install_minimal(target_root, opts.force, validated_user_type);
|
|
@@ -20587,6 +20797,9 @@ function main2(argv) {
|
|
|
20587
20797
|
let parsed_tools = _parse_tools(opts.tools);
|
|
20588
20798
|
const tools_was_all = _tools_was_all(opts.tools);
|
|
20589
20799
|
parsed_tools = _validate_scope(parsed_tools, scope, tools_was_all);
|
|
20800
|
+
if (parsed_tools.has("claude-code") && !_gate_rule_layer_overlap(detect_root, opts.layer, opts.dry_run)) {
|
|
20801
|
+
return 2;
|
|
20802
|
+
}
|
|
20590
20803
|
const wizard_handoff = _wizard_should_launch(opts)[0];
|
|
20591
20804
|
if (scope === "global") {
|
|
20592
20805
|
const artefacts = _detect_legacy_for_migration(detect_root);
|
|
@@ -20602,7 +20815,7 @@ function main2(argv) {
|
|
|
20602
20815
|
return rc2;
|
|
20603
20816
|
}
|
|
20604
20817
|
const project_root = custom_path || resolvePath(opts.project || process3.env["PROJECT_ROOT"] || process3.cwd());
|
|
20605
|
-
const is_first_run = !pathExists(
|
|
20818
|
+
const is_first_run = !pathExists(path16.join(project_root, SETTINGS_FILE));
|
|
20606
20819
|
const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
|
|
20607
20820
|
if (rc === 0 && opts.interactive) {
|
|
20608
20821
|
run_interactive_init(project_root, opts.force);
|
|
@@ -20666,16 +20879,16 @@ function _team_setup_hint_line(project_root) {
|
|
|
20666
20879
|
return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
|
|
20667
20880
|
}
|
|
20668
20881
|
function finalize_claude_model_tiers(project_root) {
|
|
20669
|
-
const claude_skills =
|
|
20670
|
-
const augment_skills =
|
|
20882
|
+
const claude_skills = path16.join(project_root, ".claude", "skills");
|
|
20883
|
+
const augment_skills = path16.join(project_root, ".augment", "skills");
|
|
20671
20884
|
if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
|
|
20672
20885
|
if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
|
|
20673
20886
|
let rendered = 0;
|
|
20674
|
-
const entries =
|
|
20887
|
+
const entries = fs18.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
20675
20888
|
for (const name of entries) {
|
|
20676
|
-
const entry =
|
|
20677
|
-
const src_dir =
|
|
20678
|
-
const src_md =
|
|
20889
|
+
const entry = path16.join(claude_skills, name);
|
|
20890
|
+
const src_dir = path16.join(augment_skills, name);
|
|
20891
|
+
const src_md = path16.join(src_dir, "SKILL.md");
|
|
20679
20892
|
let tier;
|
|
20680
20893
|
try {
|
|
20681
20894
|
tier = read_model_tier(src_md);
|
|
@@ -20684,22 +20897,22 @@ function finalize_claude_model_tiers(project_root) {
|
|
|
20684
20897
|
}
|
|
20685
20898
|
if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
|
|
20686
20899
|
if (isSymlink(entry) || isFile(entry)) {
|
|
20687
|
-
|
|
20900
|
+
fs18.unlinkSync(entry);
|
|
20688
20901
|
} else if (isDir(entry)) {
|
|
20689
|
-
|
|
20902
|
+
fs18.rmSync(entry, { recursive: true, force: true });
|
|
20690
20903
|
}
|
|
20691
20904
|
mkdirp(entry);
|
|
20692
|
-
const srcFiles =
|
|
20905
|
+
const srcFiles = fs18.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
20693
20906
|
for (const fname of srcFiles) {
|
|
20694
20907
|
if (fname === "SKILL.md") {
|
|
20695
20908
|
writeText(
|
|
20696
|
-
|
|
20909
|
+
path16.join(entry, "SKILL.md"),
|
|
20697
20910
|
render_native_model_md(readText(src_md), tier)
|
|
20698
20911
|
);
|
|
20699
20912
|
} else {
|
|
20700
|
-
|
|
20701
|
-
|
|
20702
|
-
|
|
20913
|
+
fs18.symlinkSync(
|
|
20914
|
+
path16.join("../../../.augment/skills", name, fname),
|
|
20915
|
+
path16.join(entry, fname)
|
|
20703
20916
|
);
|
|
20704
20917
|
}
|
|
20705
20918
|
}
|
|
@@ -20717,7 +20930,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
20717
20930
|
let package_type;
|
|
20718
20931
|
if (opts.package) {
|
|
20719
20932
|
package_root = resolvePath(opts.package);
|
|
20720
|
-
if (!pathExists(
|
|
20933
|
+
if (!pathExists(path16.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
20721
20934
|
fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
|
|
20722
20935
|
}
|
|
20723
20936
|
package_type = detect_package_type_for_project(project_root, package_root);
|
|
@@ -20852,9 +21065,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
20852
21065
|
function _resolvedArgv1() {
|
|
20853
21066
|
if (process3.argv[1] === void 0) return void 0;
|
|
20854
21067
|
try {
|
|
20855
|
-
return
|
|
21068
|
+
return fs18.realpathSync(path16.resolve(process3.argv[1]));
|
|
20856
21069
|
} catch {
|
|
20857
|
-
return
|
|
21070
|
+
return path16.resolve(process3.argv[1]);
|
|
20858
21071
|
}
|
|
20859
21072
|
}
|
|
20860
21073
|
var _argv1 = _resolvedArgv1();
|
|
@@ -20887,6 +21100,7 @@ export {
|
|
|
20887
21100
|
KIRO_MARKER,
|
|
20888
21101
|
PROJECT_BRIDGE_MARKERS,
|
|
20889
21102
|
ROOCODE_MARKER,
|
|
21103
|
+
RULE_LAYER_CHOICES,
|
|
20890
21104
|
SETTINGS_FILE,
|
|
20891
21105
|
SUPPORTED_PROFILES,
|
|
20892
21106
|
SystemExitError,
|
|
@@ -20908,6 +21122,7 @@ export {
|
|
|
20908
21122
|
_files_by_tool_from_bridges,
|
|
20909
21123
|
_files_by_tool_from_deploy,
|
|
20910
21124
|
_format_global_root_for_marker,
|
|
21125
|
+
_gate_rule_layer_overlap,
|
|
20911
21126
|
_inject_packs,
|
|
20912
21127
|
_is_agent_config_source_repo,
|
|
20913
21128
|
_is_tool_enabled,
|