@event4u/agent-config 16.1.0 → 16.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.augment-plugin/marketplace.json +3 -3
- package/.augment-plugin/plugin.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +237 -248
- package/dist/agent-src/commands/roadmap/process-full.md +1 -1
- package/dist/agent-src/commands/work.md +4 -0
- package/dist/agent-src/contexts/execution/autonomy-mechanics.md +4 -8
- package/dist/agent-src/rules/ui-audit-gate.md +1 -2
- package/dist/agent-src/skills/accessibility-auditor/data/aria-patterns.csv +1 -1
- package/dist/agent-src/skills/accessibility-auditor/data/manifest.json +2 -2
- package/dist/agent-src/skills/design-review/SKILL.md +30 -4
- package/dist/agent-src/skills/design-review/references/verification-automation.md +32 -0
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +16 -1
- package/dist/agent-src/skills/existing-ui-audit/references/component-taxonomy-detection.md +56 -0
- package/dist/agent-src/skills/markitdown/SKILL.md +4 -0
- package/dist/agent-src/skills/playwright-testing/SKILL.md +30 -6
- package/dist/agent-src/skills/ui-component-architect/SKILL.md +23 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +30 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/app_spec.ts +10 -4
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +260 -21
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/audit.ts +22 -3
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/scaffold.ts +6 -1
- package/dist/agent-src/templates/scripts/work_engine/state.ts +57 -7
- package/dist/agent-src/templates/scripts/work_engine/taxonomy/detect.ts +500 -0
- package/dist/agent-src/templates/scripts/work_engine/taxonomy/place.ts +183 -0
- package/dist/cli/python/knowledge_ingest.js +1 -1
- package/dist/cli/python/workspace_drive.js +1 -1
- package/dist/cli-delegate/{chunk-S3VFXMTM.js → chunk-4XFP2Y3E.js} +1 -1
- package/dist/cli-delegate/{chunk-HDVVGPQW.js → chunk-7XGBX6ZH.js} +471 -387
- package/dist/cli-delegate/{chunk-GJCBB2UG.js → chunk-FP36SWJD.js} +432 -144
- package/dist/cli-delegate/{chunk-UNCRJBT3.js → chunk-IGD6ERX6.js} +31 -0
- package/dist/cli-delegate/{chunk-FXYUYU4N.js → chunk-JNMVLWLR.js} +42 -1
- package/dist/cli-delegate/{chunk-QJWAUMJW.js → chunk-YJ72UIAK.js} +730 -15
- package/dist/cli-delegate/cmd_conformance.js +902 -782
- package/dist/cli-delegate/cmd_doctor.js +2 -2
- package/dist/cli-delegate/cmd_export.js +2 -2
- package/dist/cli-delegate/cmd_handoff.js +4 -4
- package/dist/cli-delegate/cmd_memory_get.js +1 -1
- package/dist/cli-delegate/cmd_prune.js +2 -2
- package/dist/cli-delegate/cmd_route_audit.js +1 -1
- package/dist/cli-delegate/cmd_session_recycle.js +2 -2
- package/dist/cli-delegate/cmd_settings_migrate.js +2 -2
- package/dist/cli-delegate/cmd_settings_set.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +2 -2
- package/dist/cli-delegate/cmd_uninstall.js +2 -2
- package/dist/cli-delegate/cmd_validate.js +2 -2
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +10 -10
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +1 -1
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +2 -2
- package/dist/discovery/trust-report.md +1 -1
- package/dist/discovery/workspaces.json +2 -2
- package/dist/hooks/dispatch.js +6666 -2581
- package/dist/hooks/dispatch.sha256 +1 -0
- package/dist/install/install.mjs +848 -733
- package/dist/mcp/registry-manifest.json +2 -2
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +2747 -1510
- package/dist/server/schemas/settings.js +23 -0
- package/dist/ui/assets/index-Cwq4d0hX.js +23 -0
- package/dist/ui/assets/index-Cyjy8bWO.css +1 -0
- package/dist/ui/index.html +2 -2
- package/docs/contracts/settings-classes.md +6 -4
- package/package.json +4 -4
- package/src/agent-src/templates/scripts/work_engine/directives/ui/app_spec.ts +10 -4
- package/src/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +260 -21
- package/src/agent-src/templates/scripts/work_engine/directives/ui/audit.ts +22 -3
- package/src/agent-src/templates/scripts/work_engine/directives/ui/scaffold.ts +6 -1
- package/src/agent-src/templates/scripts/work_engine/state.ts +57 -7
- package/src/agent-src/templates/scripts/work_engine/taxonomy/detect.ts +500 -0
- package/src/agent-src/templates/scripts/work_engine/taxonomy/place.ts +183 -0
- package/src/config/agent-settings.template.yml +29 -0
- package/src/config/ci-local-parity.yml +18 -0
- package/src/config/continuity-surface.json +2 -2
- package/src/config/gate-coverage.yml +234 -3
- package/src/config/gate-violation-baselines.json +7 -3
- package/src/config/hook-latency-budget.json +21 -0
- package/src/config/hook-token-budget.json +2 -2
- package/src/config/metric-registry.yml +114 -0
- package/src/config/placeholder-drift-budget.json +10 -0
- package/src/config/routing-coverage-seed.json +18 -4
- package/src/scripts/_cli/cmd_doctor.ts +5 -19
- package/src/scripts/_cli/doctor_execution.ts +100 -17
- package/src/scripts/_cli/doctor_network_posture.ts +226 -0
- package/src/scripts/_lib/body_portable.ts +102 -0
- package/src/scripts/_lib/cc_transcript.ts +132 -1
- package/src/scripts/_lib/concern_sla_window.ts +200 -0
- package/src/scripts/_lib/forge_protection.ts +114 -0
- package/src/scripts/_lib/forge_reader.ts +558 -0
- package/src/scripts/_lib/host_env_write.ts +111 -0
- package/src/scripts/_lib/llm_proposer_transport.ts +14 -4
- package/src/scripts/_lib/obligations.ts +119 -8
- package/src/scripts/_lib/probe_inputs.ts +271 -0
- package/src/scripts/_lib/read_surface_scan.ts +322 -0
- package/src/scripts/_lib/release_highlights.ts +2 -1
- package/src/scripts/_lib/retrieval_sanitize.ts +77 -16
- package/src/scripts/_lib/shell_write_shapes.ts +108 -0
- package/src/scripts/_lib/structural_hiding.ts +622 -0
- package/src/scripts/_lib/turn_end_refusals.ts +525 -4
- package/src/scripts/_lib/turn_end_transcript.ts +216 -0
- package/src/scripts/_lib/verification_command.ts +324 -0
- package/src/scripts/_lib/verification_evidence.ts +647 -0
- package/src/scripts/_lib/verify_clause.ts +280 -0
- package/src/scripts/ai_team/team_dispatch.ts +4 -0
- package/src/scripts/before_complete_hook.ts +340 -23
- package/src/scripts/bench_hook_latency.ts +412 -5
- package/src/scripts/cache_realization_report.ts +61 -1
- package/src/scripts/check_argument_hint.ts +287 -0
- package/src/scripts/check_claims.ts +125 -1
- package/src/scripts/check_enforcement_coverage.ts +38 -9
- package/src/scripts/check_enforcement_matrix.ts +245 -3
- package/src/scripts/check_finding_dispositions.ts +22 -3
- package/src/scripts/check_generator_sync.ts +71 -0
- package/src/scripts/check_host_docs_digest.ts +786 -0
- package/src/scripts/check_host_format_column.ts +559 -0
- package/src/scripts/check_input_references.ts +228 -0
- package/src/scripts/check_inputs_parity.ts +235 -0
- package/src/scripts/check_kernel_edit_ratified.ts +47 -5
- package/src/scripts/check_kill_switch_table.ts +294 -0
- package/src/scripts/check_placeholder_drift.ts +221 -0
- package/src/scripts/check_read_surface_coverage.ts +515 -0
- package/src/scripts/check_release_holds.ts +2 -1
- package/src/scripts/check_routing_coverage.ts +378 -11
- package/src/scripts/check_static_parity.ts +17 -0
- package/src/scripts/ci_settle.ts +145 -19
- package/src/scripts/closure_scan.ts +115 -1
- package/src/scripts/compile_hook_manifest.ts +60 -16
- package/src/scripts/external_sources_denylist.json +29 -4
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +42 -5
- package/src/scripts/hooks/block_config_weakening.ts +229 -4
- package/src/scripts/hooks/block_kernel_rule_writes.ts +9 -78
- package/src/scripts/hooks/block_plumbing_writes.ts +314 -0
- package/src/scripts/hooks/bundle_integrity.ts +291 -0
- package/src/scripts/hooks/chain_nudge_hook.ts +1 -2
- package/src/scripts/hooks/code_graph_context_hook.ts +1 -2
- package/src/scripts/hooks/comment_discipline_hook.ts +1 -3
- package/src/scripts/hooks/concern_registry.ts +2 -0
- package/src/scripts/hooks/concern_timings.ts +94 -0
- package/src/scripts/hooks/delegation_nudge_hook.ts +1 -2
- package/src/scripts/hooks/design_pass_hook.ts +100 -9
- package/src/scripts/hooks/design_slop_hook.ts +1 -2
- package/src/scripts/hooks/dispatch_hook.ts +25 -19
- package/src/scripts/hooks/edit_shape_hook.ts +1 -2
- package/src/scripts/hooks/end_review_nudge_hook.ts +1 -1
- package/src/scripts/hooks/evidence_independence.ts +1 -2
- package/src/scripts/hooks/exit_codes.ts +128 -0
- package/src/scripts/hooks/host_lowering.json +1 -0
- package/src/scripts/hooks/host_lowering.ts +128 -3
- package/src/scripts/hooks/host_lowering.yaml +262 -46
- package/src/scripts/hooks/host_semantics.ts +30 -2
- package/src/scripts/hooks/injection_budget.ts +9 -2
- package/src/scripts/hooks/interruption_ledger_hook.ts +1 -2
- package/src/scripts/hooks/journal_record_hook.ts +1 -2
- package/src/scripts/hooks/memory_recall_hook.ts +1 -2
- package/src/scripts/hooks/obligation_settle_hook.ts +151 -5
- package/src/scripts/hooks/one_question_per_ask_hook.ts +25 -4
- package/src/scripts/hooks/orchestration_record_hook.ts +1 -2
- package/src/scripts/hooks/permission_gate.ts +1 -2
- package/src/scripts/hooks/push_settle_hook.ts +1 -3
- package/src/scripts/hooks/replay_hook.ts +2 -1
- package/src/scripts/hooks/reread_guard_hook.ts +1 -2
- package/src/scripts/hooks/review_baseline_hook.ts +1 -2
- package/src/scripts/hooks/rtk_wrap_hook.ts +1 -2
- package/src/scripts/hooks/rule_inject_hook.ts +8 -5
- package/src/scripts/hooks/run_continuation_hook.ts +13 -15
- package/src/scripts/hooks/skill_route_hook.ts +1 -2
- package/src/scripts/hooks/source_first_gate_hook.ts +1 -2
- package/src/scripts/hooks/spawn_guard_shadow_hook.ts +1 -2
- package/src/scripts/hooks/subagent_ledger_hook.ts +1 -2
- package/src/scripts/hooks/suggestion_capture_hook.ts +1 -1
- package/src/scripts/hooks/table_fingerprint.ts +49 -0
- package/src/scripts/hooks/telemetry_flush_hook.ts +1 -2
- package/src/scripts/hooks/telemetry_usage_hook.ts +1 -2
- package/src/scripts/hooks/tool_result_bytes_hook.ts +93 -9
- package/src/scripts/hooks/turn_end_gate_hook.ts +337 -324
- package/src/scripts/hooks/ui_route_nudge_hook.ts +1 -2
- package/src/scripts/install.ts +3 -4
- package/src/scripts/lint_deny_text.ts +419 -0
- package/src/scripts/lint_exit_codes.ts +262 -0
- package/src/scripts/lint_hook_manifest.ts +55 -0
- package/src/scripts/lint_roadmap_blockers.ts +78 -12
- package/src/scripts/lint_skill_descriptions.ts +1 -1
- package/src/scripts/lint_skill_scripts_readonly.ts +1 -1
- package/src/scripts/mcp_server/prompts.ts +142 -1
- package/src/scripts/measure_skill_ranker_baseline.ts +305 -51
- package/src/scripts/measure_turn_end_gate.ts +193 -0
- package/src/scripts/memory_lookup.ts +1 -1
- package/src/scripts/prepack-check.mjs +53 -0
- package/src/scripts/release_publication.ts +13 -1
- package/src/scripts/report_invocation_surface.ts +383 -0
- package/src/scripts/report_obligation_carriers.ts +699 -0
- package/src/scripts/report_obligation_writer_split.ts +236 -0
- package/src/scripts/report_skill_menu_census.ts +208 -0
- package/src/scripts/report_standing_payload_by_host.ts +1 -1
- package/src/scripts/roadmap_verify_share.ts +213 -0
- package/src/scripts/schemas/command.schema.json +44 -0
- package/src/scripts/schemas/review-findings.schema.json +4 -0
- package/src/scripts/schemas/skill.schema.json +44 -0
- package/src/scripts/self_review_gate.ts +359 -10
- package/src/scripts/semantic_parity_census.ts +314 -0
- package/src/scripts/session_eol_report.ts +54 -1
- package/src/scripts/sweep_dead_scan_roots.ts +1 -1
- package/src/scripts/trigger_eval_grandfather.json +0 -2
- package/src/scripts/trigger_eval_rotation.ts +122 -27
- package/src/scripts/ui_conformance_probe.ts +156 -4
- package/src/scripts/update_prices.ts +85 -3
- package/src/scripts/write_bundle_digest.mjs +74 -0
- package/src/server/schemas/settings.ts +31 -0
- package/src/templates/consumer-settings/ONBOARDING.md +1 -0
- package/dist/ui/assets/index-DH1xc62v.js +0 -29
- package/dist/ui/assets/index-jSfMW8_t.css +0 -1
- /package/dist/cli-delegate/{chunk-YUM5KURG.js → chunk-7RQP4UDH.js} +0 -0
package/dist/install/install.mjs
CHANGED
|
@@ -117,17 +117,17 @@ var require_visit = __commonJS({
|
|
|
117
117
|
visit.BREAK = BREAK;
|
|
118
118
|
visit.SKIP = SKIP;
|
|
119
119
|
visit.REMOVE = REMOVE;
|
|
120
|
-
function visit_(key, node, visitor,
|
|
121
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
120
|
+
function visit_(key, node, visitor, path25) {
|
|
121
|
+
const ctrl = callVisitor(key, node, visitor, path25);
|
|
122
122
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
123
|
-
replaceNode(key,
|
|
124
|
-
return visit_(key, ctrl, visitor,
|
|
123
|
+
replaceNode(key, path25, ctrl);
|
|
124
|
+
return visit_(key, ctrl, visitor, path25);
|
|
125
125
|
}
|
|
126
126
|
if (typeof ctrl !== "symbol") {
|
|
127
127
|
if (identity.isCollection(node)) {
|
|
128
|
-
|
|
128
|
+
path25 = Object.freeze(path25.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, path25);
|
|
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
|
+
path25 = Object.freeze(path25.concat(node));
|
|
142
|
+
const ck = visit_("key", node.key, visitor, path25);
|
|
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, path25);
|
|
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, path25) {
|
|
169
|
+
const ctrl = await callVisitor(key, node, visitor, path25);
|
|
170
170
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
171
|
-
replaceNode(key,
|
|
172
|
-
return visitAsync_(key, ctrl, visitor,
|
|
171
|
+
replaceNode(key, path25, ctrl);
|
|
172
|
+
return visitAsync_(key, ctrl, visitor, path25);
|
|
173
173
|
}
|
|
174
174
|
if (typeof ctrl !== "symbol") {
|
|
175
175
|
if (identity.isCollection(node)) {
|
|
176
|
-
|
|
176
|
+
path25 = Object.freeze(path25.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, path25);
|
|
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
|
+
path25 = Object.freeze(path25.concat(node));
|
|
190
|
+
const ck = await visitAsync_("key", node.key, visitor, path25);
|
|
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, path25);
|
|
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, path25) {
|
|
223
223
|
if (typeof visitor === "function")
|
|
224
|
-
return visitor(key, node,
|
|
224
|
+
return visitor(key, node, path25);
|
|
225
225
|
if (identity.isMap(node))
|
|
226
|
-
return visitor.Map?.(key, node,
|
|
226
|
+
return visitor.Map?.(key, node, path25);
|
|
227
227
|
if (identity.isSeq(node))
|
|
228
|
-
return visitor.Seq?.(key, node,
|
|
228
|
+
return visitor.Seq?.(key, node, path25);
|
|
229
229
|
if (identity.isPair(node))
|
|
230
|
-
return visitor.Pair?.(key, node,
|
|
230
|
+
return visitor.Pair?.(key, node, path25);
|
|
231
231
|
if (identity.isScalar(node))
|
|
232
|
-
return visitor.Scalar?.(key, node,
|
|
232
|
+
return visitor.Scalar?.(key, node, path25);
|
|
233
233
|
if (identity.isAlias(node))
|
|
234
|
-
return visitor.Alias?.(key, node,
|
|
234
|
+
return visitor.Alias?.(key, node, path25);
|
|
235
235
|
return void 0;
|
|
236
236
|
}
|
|
237
|
-
function replaceNode(key,
|
|
238
|
-
const parent =
|
|
237
|
+
function replaceNode(key, path25, node) {
|
|
238
|
+
const parent = path25[path25.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, path25, value) {
|
|
849
849
|
let v = value;
|
|
850
|
-
for (let i =
|
|
851
|
-
const k =
|
|
850
|
+
for (let i = path25.length - 1; i >= 0; --i) {
|
|
851
|
+
const k = path25[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 = (path25) => path25 == null || typeof path25 === "object" && !!path25[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(path25, value) {
|
|
901
|
+
if (isEmptyPath(path25))
|
|
902
902
|
this.add(value);
|
|
903
903
|
else {
|
|
904
|
-
const [key, ...rest] =
|
|
904
|
+
const [key, ...rest] = path25;
|
|
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(path25) {
|
|
919
|
+
const [key, ...rest] = path25;
|
|
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(path25, keepScalar) {
|
|
934
|
+
const [key, ...rest] = path25;
|
|
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(path25) {
|
|
953
|
+
const [key, ...rest] = path25;
|
|
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(path25, value) {
|
|
964
|
+
const [key, ...rest] = path25;
|
|
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(path25, value) {
|
|
3480
3480
|
if (assertCollection(this.contents))
|
|
3481
|
-
this.contents.addIn(
|
|
3481
|
+
this.contents.addIn(path25, 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(path25) {
|
|
3557
|
+
if (Collection.isEmptyPath(path25)) {
|
|
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(path25) : 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(path25, keepScalar) {
|
|
3579
|
+
if (Collection.isEmptyPath(path25))
|
|
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(path25, 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(path25) {
|
|
3593
|
+
if (Collection.isEmptyPath(path25))
|
|
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(path25) : 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(path25, value) {
|
|
3613
|
+
if (Collection.isEmptyPath(path25)) {
|
|
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(path25), value);
|
|
3617
3617
|
} else if (assertCollection(this.contents)) {
|
|
3618
|
-
this.contents.setIn(
|
|
3618
|
+
this.contents.setIn(path25, 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, path25) => {
|
|
5579
5579
|
let item = cst;
|
|
5580
|
-
for (const [field, index] of
|
|
5580
|
+
for (const [field, index] of path25) {
|
|
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, path25) => {
|
|
5590
|
+
const parent = visit.itemAtPath(cst, path25.slice(0, -1));
|
|
5591
|
+
const field = path25[path25.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(path25, item, visitor) {
|
|
5598
|
+
let ctrl = visitor(item, path25);
|
|
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(path25.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, path25);
|
|
5617
5617
|
}
|
|
5618
5618
|
}
|
|
5619
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5619
|
+
return typeof ctrl === "function" ? ctrl(item, path25) : 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 fs28 = this.flowScalar(this.type);
|
|
6922
6922
|
if (atNextItem || it.value) {
|
|
6923
|
-
map.items.push({ start, key:
|
|
6923
|
+
map.items.push({ start, key: fs28, sep: [] });
|
|
6924
6924
|
this.onKeyLine = true;
|
|
6925
6925
|
} else if (it.sep) {
|
|
6926
|
-
this.stack.push(
|
|
6926
|
+
this.stack.push(fs28);
|
|
6927
6927
|
} else {
|
|
6928
|
-
Object.assign(it, { key:
|
|
6928
|
+
Object.assign(it, { key: fs28, 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 fs28 = this.flowScalar(this.type);
|
|
7057
7057
|
if (!it || it.value)
|
|
7058
|
-
fc.items.push({ start: [], key:
|
|
7058
|
+
fc.items.push({ start: [], key: fs28, sep: [] });
|
|
7059
7059
|
else if (it.sep)
|
|
7060
|
-
this.stack.push(
|
|
7060
|
+
this.stack.push(fs28);
|
|
7061
7061
|
else
|
|
7062
|
-
Object.assign(it, { key:
|
|
7062
|
+
Object.assign(it, { key: fs28, sep: [] });
|
|
7063
7063
|
return;
|
|
7064
7064
|
}
|
|
7065
7065
|
case "flow-map-end":
|
|
@@ -7267,7 +7267,7 @@ var require_public_api = __commonJS({
|
|
|
7267
7267
|
}
|
|
7268
7268
|
return doc;
|
|
7269
7269
|
}
|
|
7270
|
-
function
|
|
7270
|
+
function parse6(src, reviver, options) {
|
|
7271
7271
|
let _reviver = void 0;
|
|
7272
7272
|
if (typeof reviver === "function") {
|
|
7273
7273
|
_reviver = reviver;
|
|
@@ -7308,7 +7308,7 @@ var require_public_api = __commonJS({
|
|
|
7308
7308
|
return value.toString(options);
|
|
7309
7309
|
return new Document.Document(value, _replacer, options).toString(options);
|
|
7310
7310
|
}
|
|
7311
|
-
exports.parse =
|
|
7311
|
+
exports.parse = parse6;
|
|
7312
7312
|
exports.parseAllDocuments = parseAllDocuments;
|
|
7313
7313
|
exports.parseDocument = parseDocument;
|
|
7314
7314
|
exports.stringify = stringify;
|
|
@@ -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 crypto5 from "node:crypto";
|
|
7373
|
-
import * as
|
|
7373
|
+
import * as fs27 from "node:fs";
|
|
7374
7374
|
import * as os8 from "node:os";
|
|
7375
|
-
import * as
|
|
7375
|
+
import * as path24 from "node:path";
|
|
7376
7376
|
import process4 from "node:process";
|
|
7377
7377
|
import { fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
7378
7378
|
|
|
@@ -7512,6 +7512,56 @@ function build_merge_entries(file_label, overlay) {
|
|
|
7512
7512
|
}));
|
|
7513
7513
|
}
|
|
7514
7514
|
|
|
7515
|
+
// src/scripts/_lib/host_env_write.ts
|
|
7516
|
+
var YAML = __toESM(require_dist(), 1);
|
|
7517
|
+
import * as fs from "node:fs";
|
|
7518
|
+
import * as path from "node:path";
|
|
7519
|
+
var WRITABLE_HOST_ENV = [
|
|
7520
|
+
{ variable: "BASH_MAX_OUTPUT_LENGTH", settingsKey: "bash_max_output_length" },
|
|
7521
|
+
{ variable: "MAX_MCP_OUTPUT_TOKENS", settingsKey: "max_mcp_output_tokens" }
|
|
7522
|
+
];
|
|
7523
|
+
var SETTINGS_CANDIDATES = [
|
|
7524
|
+
["agents", "settings", ".agent-settings.yml"],
|
|
7525
|
+
[".agent-settings.yml"]
|
|
7526
|
+
];
|
|
7527
|
+
function readSettingsDoc(projectRoot) {
|
|
7528
|
+
for (const parts of SETTINGS_CANDIDATES) {
|
|
7529
|
+
const p = path.join(projectRoot, ...parts);
|
|
7530
|
+
let text;
|
|
7531
|
+
try {
|
|
7532
|
+
text = fs.readFileSync(p, "utf-8");
|
|
7533
|
+
} catch {
|
|
7534
|
+
continue;
|
|
7535
|
+
}
|
|
7536
|
+
let doc;
|
|
7537
|
+
try {
|
|
7538
|
+
doc = YAML.parse(text, { version: "1.1" });
|
|
7539
|
+
} catch {
|
|
7540
|
+
return null;
|
|
7541
|
+
}
|
|
7542
|
+
return doc === null || doc === void 0 || typeof doc !== "object" ? null : doc;
|
|
7543
|
+
}
|
|
7544
|
+
return null;
|
|
7545
|
+
}
|
|
7546
|
+
function hostEnvBlock(settings) {
|
|
7547
|
+
const root = settings;
|
|
7548
|
+
const he = root?.["host_environment"];
|
|
7549
|
+
const caps = he?.["request_size_caps"];
|
|
7550
|
+
if (caps === void 0) return null;
|
|
7551
|
+
const out = {};
|
|
7552
|
+
for (const { variable, settingsKey } of WRITABLE_HOST_ENV) {
|
|
7553
|
+
const v = caps[settingsKey];
|
|
7554
|
+
if (typeof v === "number" && Number.isInteger(v) && v > 0) out[variable] = String(v);
|
|
7555
|
+
}
|
|
7556
|
+
return Object.keys(out).length === 0 ? null : out;
|
|
7557
|
+
}
|
|
7558
|
+
function withHostEnv(bridge, projectRoot, announce) {
|
|
7559
|
+
const env = hostEnvBlock(readSettingsDoc(projectRoot));
|
|
7560
|
+
if (env === null) return bridge;
|
|
7561
|
+
announce(`.claude/settings.json: wrote ${Object.keys(env).join(", ")} (request-size caps)`);
|
|
7562
|
+
return { ...bridge, env };
|
|
7563
|
+
}
|
|
7564
|
+
|
|
7515
7565
|
// src/scripts/_lib/json_python_parity.ts
|
|
7516
7566
|
function jsonStrNoAscii(s) {
|
|
7517
7567
|
let out = '"';
|
|
@@ -7721,25 +7771,25 @@ function is_claude_builtin_name(slug) {
|
|
|
7721
7771
|
|
|
7722
7772
|
// src/scripts/_lib/installed_lock.ts
|
|
7723
7773
|
import { randomBytes } from "node:crypto";
|
|
7724
|
-
import * as
|
|
7774
|
+
import * as fs3 from "node:fs";
|
|
7725
7775
|
import * as os2 from "node:os";
|
|
7726
|
-
import * as
|
|
7776
|
+
import * as path3 from "node:path";
|
|
7727
7777
|
import { fileURLToPath } from "node:url";
|
|
7728
7778
|
|
|
7729
7779
|
// src/scripts/_lib/user_global_paths.ts
|
|
7730
|
-
import * as
|
|
7780
|
+
import * as fs2 from "node:fs";
|
|
7731
7781
|
import * as os from "node:os";
|
|
7732
|
-
import * as
|
|
7782
|
+
import * as path2 from "node:path";
|
|
7733
7783
|
var _PARTIAL_SUFFIX = ".event4u-partial-";
|
|
7734
7784
|
var EVENT4U_HOME_ENV = "EVENT4U_CONFIG_HOME";
|
|
7735
|
-
var DEFAULT_EVENT4U_ROOT_RELATIVE =
|
|
7736
|
-
var LEGACY_XDG_ROOT_RELATIVE =
|
|
7785
|
+
var DEFAULT_EVENT4U_ROOT_RELATIVE = path2.join(".event4u", "agent-config");
|
|
7786
|
+
var LEGACY_XDG_ROOT_RELATIVE = path2.join(".config", "agent-config");
|
|
7737
7787
|
function expanduser(p) {
|
|
7738
7788
|
if (p === "~") {
|
|
7739
7789
|
return os.homedir();
|
|
7740
7790
|
}
|
|
7741
7791
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
7742
|
-
return
|
|
7792
|
+
return path2.join(os.homedir(), p.slice(2));
|
|
7743
7793
|
}
|
|
7744
7794
|
return p;
|
|
7745
7795
|
}
|
|
@@ -7755,10 +7805,10 @@ function event4u_root(env) {
|
|
|
7755
7805
|
if (override) {
|
|
7756
7806
|
return expanduser(override);
|
|
7757
7807
|
}
|
|
7758
|
-
return
|
|
7808
|
+
return path2.join(os.homedir(), DEFAULT_EVENT4U_ROOT_RELATIVE);
|
|
7759
7809
|
}
|
|
7760
7810
|
function legacy_xdg_root() {
|
|
7761
|
-
return
|
|
7811
|
+
return path2.join(os.homedir(), LEGACY_XDG_ROOT_RELATIVE);
|
|
7762
7812
|
}
|
|
7763
7813
|
function resolve_with_fallback(relative_name, options = {}) {
|
|
7764
7814
|
if (is_absolute_like_python(relative_name)) {
|
|
@@ -7766,12 +7816,12 @@ function resolve_with_fallback(relative_name, options = {}) {
|
|
|
7766
7816
|
`resolve_with_fallback expects a relative path, got '${relative_name}'`
|
|
7767
7817
|
);
|
|
7768
7818
|
}
|
|
7769
|
-
const new_path =
|
|
7770
|
-
if (
|
|
7819
|
+
const new_path = path2.join(event4u_root(options.env ?? null), relative_name);
|
|
7820
|
+
if (fs2.existsSync(new_path)) {
|
|
7771
7821
|
return new_path;
|
|
7772
7822
|
}
|
|
7773
|
-
const legacy_path =
|
|
7774
|
-
if (
|
|
7823
|
+
const legacy_path = path2.join(legacy_xdg_root(), relative_name);
|
|
7824
|
+
if (fs2.existsSync(legacy_path)) {
|
|
7775
7825
|
return legacy_path;
|
|
7776
7826
|
}
|
|
7777
7827
|
return null;
|
|
@@ -7780,7 +7830,7 @@ function write_target(relative_name, options = {}) {
|
|
|
7780
7830
|
if (is_absolute_like_python(relative_name)) {
|
|
7781
7831
|
throw new Error(`write_target expects a relative path, got '${relative_name}'`);
|
|
7782
7832
|
}
|
|
7783
|
-
return
|
|
7833
|
+
return path2.join(event4u_root(options.env ?? null), relative_name);
|
|
7784
7834
|
}
|
|
7785
7835
|
var MIGRATION_BREADCRUMB_NAME = "MIGRATED.md";
|
|
7786
7836
|
var _BREADCRUMB_TEMPLATE = `# Migrated to \`~/.event4u/agent-config/\`
|
|
@@ -7814,43 +7864,43 @@ function migrate_legacy_namespace(options = {}) {
|
|
|
7814
7864
|
const new_root = event4u_root(options.env ?? null);
|
|
7815
7865
|
let legacy_stat;
|
|
7816
7866
|
try {
|
|
7817
|
-
legacy_stat =
|
|
7867
|
+
legacy_stat = fs2.statSync(legacy_root);
|
|
7818
7868
|
} catch {
|
|
7819
7869
|
return false;
|
|
7820
7870
|
}
|
|
7821
7871
|
if (!legacy_stat.isDirectory()) {
|
|
7822
7872
|
return false;
|
|
7823
7873
|
}
|
|
7824
|
-
const legacy_entries =
|
|
7874
|
+
const legacy_entries = fs2.readdirSync(legacy_root).filter((name) => name !== MIGRATION_BREADCRUMB_NAME);
|
|
7825
7875
|
if (legacy_entries.length === 0) {
|
|
7826
7876
|
return false;
|
|
7827
7877
|
}
|
|
7828
|
-
const new_has_content =
|
|
7878
|
+
const new_has_content = fs2.existsSync(new_root) && fs2.readdirSync(new_root).some((name) => !_is_partial_name(name));
|
|
7829
7879
|
if (new_has_content) {
|
|
7830
7880
|
_ensure_breadcrumb(legacy_root);
|
|
7831
7881
|
return false;
|
|
7832
7882
|
}
|
|
7833
|
-
|
|
7883
|
+
fs2.mkdirSync(new_root, { recursive: true });
|
|
7834
7884
|
_purge_partial_entries(new_root);
|
|
7835
7885
|
for (const name of legacy_entries) {
|
|
7836
|
-
const entry =
|
|
7837
|
-
const target =
|
|
7838
|
-
if (
|
|
7886
|
+
const entry = path2.join(legacy_root, name);
|
|
7887
|
+
const target = path2.join(new_root, name);
|
|
7888
|
+
if (fs2.existsSync(target)) {
|
|
7839
7889
|
continue;
|
|
7840
7890
|
}
|
|
7841
|
-
const staging =
|
|
7842
|
-
if (
|
|
7891
|
+
const staging = path2.join(new_root, `${name}${_PARTIAL_SUFFIX}${process.pid}`);
|
|
7892
|
+
if (fs2.existsSync(staging)) {
|
|
7843
7893
|
_remove_path(staging);
|
|
7844
7894
|
}
|
|
7845
|
-
if (
|
|
7846
|
-
|
|
7895
|
+
if (fs2.statSync(entry).isDirectory()) {
|
|
7896
|
+
fs2.cpSync(entry, staging, { recursive: true, preserveTimestamps: true });
|
|
7847
7897
|
} else {
|
|
7848
|
-
|
|
7849
|
-
const src_stat =
|
|
7850
|
-
|
|
7851
|
-
|
|
7898
|
+
fs2.copyFileSync(entry, staging);
|
|
7899
|
+
const src_stat = fs2.statSync(entry);
|
|
7900
|
+
fs2.chmodSync(staging, src_stat.mode & 4095);
|
|
7901
|
+
fs2.utimesSync(staging, src_stat.atime, src_stat.mtime);
|
|
7852
7902
|
}
|
|
7853
|
-
|
|
7903
|
+
fs2.renameSync(staging, target);
|
|
7854
7904
|
}
|
|
7855
7905
|
_ensure_breadcrumb(legacy_root);
|
|
7856
7906
|
return true;
|
|
@@ -7859,31 +7909,31 @@ function _is_partial_name(name) {
|
|
|
7859
7909
|
return name.includes(_PARTIAL_SUFFIX);
|
|
7860
7910
|
}
|
|
7861
7911
|
function _purge_partial_entries(new_root) {
|
|
7862
|
-
for (const name of
|
|
7912
|
+
for (const name of fs2.readdirSync(new_root)) {
|
|
7863
7913
|
if (_is_partial_name(name)) {
|
|
7864
|
-
_remove_path(
|
|
7914
|
+
_remove_path(path2.join(new_root, name));
|
|
7865
7915
|
}
|
|
7866
7916
|
}
|
|
7867
7917
|
}
|
|
7868
7918
|
function _remove_path(p) {
|
|
7869
7919
|
let st = null;
|
|
7870
7920
|
try {
|
|
7871
|
-
st =
|
|
7921
|
+
st = fs2.lstatSync(p);
|
|
7872
7922
|
} catch {
|
|
7873
7923
|
return;
|
|
7874
7924
|
}
|
|
7875
7925
|
if (st.isDirectory() && !st.isSymbolicLink()) {
|
|
7876
|
-
|
|
7926
|
+
fs2.rmSync(p, { recursive: true });
|
|
7877
7927
|
} else {
|
|
7878
|
-
|
|
7928
|
+
fs2.rmSync(p, { force: true });
|
|
7879
7929
|
}
|
|
7880
7930
|
}
|
|
7881
7931
|
function _ensure_breadcrumb(legacy_root) {
|
|
7882
|
-
const breadcrumb =
|
|
7883
|
-
if (
|
|
7932
|
+
const breadcrumb = path2.join(legacy_root, MIGRATION_BREADCRUMB_NAME);
|
|
7933
|
+
if (fs2.existsSync(breadcrumb)) {
|
|
7884
7934
|
return;
|
|
7885
7935
|
}
|
|
7886
|
-
|
|
7936
|
+
fs2.writeFileSync(breadcrumb, _BREADCRUMB_TEMPLATE, "utf-8");
|
|
7887
7937
|
}
|
|
7888
7938
|
|
|
7889
7939
|
// src/scripts/_lib/install_layout.ts
|
|
@@ -7940,7 +7990,7 @@ function expanduser2(p) {
|
|
|
7940
7990
|
return os2.homedir();
|
|
7941
7991
|
}
|
|
7942
7992
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
7943
|
-
return
|
|
7993
|
+
return path3.join(os2.homedir(), p.slice(2));
|
|
7944
7994
|
}
|
|
7945
7995
|
return p;
|
|
7946
7996
|
}
|
|
@@ -7964,11 +8014,11 @@ function lockfile_write_path(env) {
|
|
|
7964
8014
|
}
|
|
7965
8015
|
return write_target("installed.lock", { env: env ?? null });
|
|
7966
8016
|
}
|
|
7967
|
-
function read_lockfile(
|
|
7968
|
-
const target =
|
|
8017
|
+
function read_lockfile(path25) {
|
|
8018
|
+
const target = path25 ?? lockfile_path();
|
|
7969
8019
|
let text;
|
|
7970
8020
|
try {
|
|
7971
|
-
text =
|
|
8021
|
+
text = fs3.readFileSync(target, { encoding: "utf-8" });
|
|
7972
8022
|
} catch {
|
|
7973
8023
|
return null;
|
|
7974
8024
|
}
|
|
@@ -8045,7 +8095,7 @@ function _render(version, tools, installed_at, fingerprint) {
|
|
|
8045
8095
|
}
|
|
8046
8096
|
function write_lockfile(version, tools, options = {}) {
|
|
8047
8097
|
const target = options.path ?? lockfile_path();
|
|
8048
|
-
|
|
8098
|
+
fs3.mkdirSync(path3.dirname(target), { recursive: true });
|
|
8049
8099
|
const stamp = strftime_iso_z(options.now ?? /* @__PURE__ */ new Date());
|
|
8050
8100
|
const rendered = _render(
|
|
8051
8101
|
version,
|
|
@@ -8053,19 +8103,19 @@ function write_lockfile(version, tools, options = {}) {
|
|
|
8053
8103
|
stamp,
|
|
8054
8104
|
options.host_layer_fingerprint ?? null
|
|
8055
8105
|
);
|
|
8056
|
-
const parent =
|
|
8106
|
+
const parent = path3.dirname(target);
|
|
8057
8107
|
const { fd, tmp_name } = mkstemp(parent, ".installed.lock.");
|
|
8058
8108
|
try {
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8109
|
+
fs3.writeFileSync(fd, rendered, { encoding: "utf-8" });
|
|
8110
|
+
fs3.closeSync(fd);
|
|
8111
|
+
fs3.renameSync(tmp_name, target);
|
|
8062
8112
|
} catch (err) {
|
|
8063
8113
|
try {
|
|
8064
|
-
|
|
8114
|
+
fs3.closeSync(fd);
|
|
8065
8115
|
} catch {
|
|
8066
8116
|
}
|
|
8067
8117
|
try {
|
|
8068
|
-
|
|
8118
|
+
fs3.unlinkSync(tmp_name);
|
|
8069
8119
|
} catch {
|
|
8070
8120
|
}
|
|
8071
8121
|
throw err;
|
|
@@ -8127,9 +8177,9 @@ function strftime_iso_z(now) {
|
|
|
8127
8177
|
}
|
|
8128
8178
|
function mkstemp(dir, prefix) {
|
|
8129
8179
|
for (let attempt = 0; attempt < 32; attempt += 1) {
|
|
8130
|
-
const tmp_name =
|
|
8180
|
+
const tmp_name = path3.join(dir, `${prefix}${randomBytes(6).toString("hex")}`);
|
|
8131
8181
|
try {
|
|
8132
|
-
const fd =
|
|
8182
|
+
const fd = fs3.openSync(tmp_name, "wx", 384);
|
|
8133
8183
|
return { fd, tmp_name };
|
|
8134
8184
|
} catch (err) {
|
|
8135
8185
|
if (err.code === "EEXIST") {
|
|
@@ -8187,7 +8237,7 @@ function tuple_lt(a, b) {
|
|
|
8187
8237
|
}
|
|
8188
8238
|
function _read_package_version(dir) {
|
|
8189
8239
|
try {
|
|
8190
|
-
const data = JSON.parse(
|
|
8240
|
+
const data = JSON.parse(fs3.readFileSync(path3.join(dir, "package.json"), { encoding: "utf-8" }));
|
|
8191
8241
|
const version = data.version;
|
|
8192
8242
|
if (typeof version === "string" && version.trim()) {
|
|
8193
8243
|
return version.trim();
|
|
@@ -8203,7 +8253,7 @@ function _find_package_version_upward(start_dir) {
|
|
|
8203
8253
|
if (found !== null) {
|
|
8204
8254
|
return found;
|
|
8205
8255
|
}
|
|
8206
|
-
const parent =
|
|
8256
|
+
const parent = path3.dirname(dir);
|
|
8207
8257
|
if (parent === dir) {
|
|
8208
8258
|
return null;
|
|
8209
8259
|
}
|
|
@@ -8214,13 +8264,13 @@ function current_package_version(repo_root) {
|
|
|
8214
8264
|
if (repo_root != null) {
|
|
8215
8265
|
return _read_package_version(repo_root) ?? "0.0.0";
|
|
8216
8266
|
}
|
|
8217
|
-
const here =
|
|
8267
|
+
const here = path3.dirname(fileURLToPath(import.meta.url));
|
|
8218
8268
|
return _find_package_version_upward(here) ?? "0.0.0";
|
|
8219
8269
|
}
|
|
8220
8270
|
|
|
8221
8271
|
// src/scripts/_lib/mcp_bridge.ts
|
|
8222
|
-
import * as
|
|
8223
|
-
import * as
|
|
8272
|
+
import * as fs4 from "node:fs";
|
|
8273
|
+
import * as path4 from "node:path";
|
|
8224
8274
|
|
|
8225
8275
|
// src/scripts/_lib/host_capability.ts
|
|
8226
8276
|
import process2 from "node:process";
|
|
@@ -8327,7 +8377,7 @@ function mcpBridgeEntry(packageRoot) {
|
|
|
8327
8377
|
}
|
|
8328
8378
|
function readPackageVersion(packageRoot) {
|
|
8329
8379
|
try {
|
|
8330
|
-
const raw =
|
|
8380
|
+
const raw = fs4.readFileSync(path4.join(packageRoot, "package.json"), "utf-8");
|
|
8331
8381
|
const v = JSON.parse(raw).version;
|
|
8332
8382
|
return typeof v === "string" && v.trim() !== "" ? v : null;
|
|
8333
8383
|
} catch {
|
|
@@ -8336,7 +8386,7 @@ function readPackageVersion(packageRoot) {
|
|
|
8336
8386
|
}
|
|
8337
8387
|
function makeEnsureMcpBridge(mergeJsonFile) {
|
|
8338
8388
|
return (projectRoot, force, packageRoot = projectRoot) => mergeJsonFile(
|
|
8339
|
-
|
|
8389
|
+
path4.join(projectRoot, ".mcp.json"),
|
|
8340
8390
|
mcpBridgeEntry(packageRoot),
|
|
8341
8391
|
force,
|
|
8342
8392
|
".mcp.json"
|
|
@@ -8362,7 +8412,7 @@ function makeEnsureMcpRegistrations(mergeJsonFile) {
|
|
|
8362
8412
|
const merged = {};
|
|
8363
8413
|
for (const t of targets) {
|
|
8364
8414
|
merged[t.toolId] = mergeJsonFile(
|
|
8365
|
-
|
|
8415
|
+
path4.join(projectRoot, ...t.relPath.split("/")),
|
|
8366
8416
|
mcpBridgeEntry(packageRoot),
|
|
8367
8417
|
force,
|
|
8368
8418
|
t.relPath
|
|
@@ -8393,10 +8443,10 @@ function projectionModeOf(raw) {
|
|
|
8393
8443
|
return raw === "scoped" ? "scoped" : raw === "tiered" ? "tiered" : "legacy-all";
|
|
8394
8444
|
}
|
|
8395
8445
|
function resolveTierB(packageRoot) {
|
|
8396
|
-
const p =
|
|
8397
|
-
if (!
|
|
8446
|
+
const p = path4.join(packageRoot, "agents", "runtime", "state", "skill-tiers.json");
|
|
8447
|
+
if (!fs4.existsSync(p)) return null;
|
|
8398
8448
|
try {
|
|
8399
|
-
const parsed = JSON.parse(
|
|
8449
|
+
const parsed = JSON.parse(fs4.readFileSync(p, "utf-8"));
|
|
8400
8450
|
if (!Array.isArray(parsed.tier_b)) return null;
|
|
8401
8451
|
return new Set(parsed.tier_b.filter((n) => typeof n === "string"));
|
|
8402
8452
|
} catch {
|
|
@@ -8404,7 +8454,7 @@ function resolveTierB(packageRoot) {
|
|
|
8404
8454
|
}
|
|
8405
8455
|
}
|
|
8406
8456
|
function tierBPrunePredicate(tierB) {
|
|
8407
|
-
return (mdPath) => tierB.has(
|
|
8457
|
+
return (mdPath) => tierB.has(path4.basename(path4.dirname(mdPath)));
|
|
8408
8458
|
}
|
|
8409
8459
|
function tierBAdvisory(packageRoot) {
|
|
8410
8460
|
const tierB = resolveTierB(packageRoot);
|
|
@@ -8505,20 +8555,20 @@ function printResiduals(toolIds, quiet, write = (s) => process.stdout.write(s))
|
|
|
8505
8555
|
}
|
|
8506
8556
|
|
|
8507
8557
|
// src/scripts/_lib/scoped_projection.ts
|
|
8508
|
-
import * as
|
|
8558
|
+
import * as fs6 from "node:fs";
|
|
8509
8559
|
import { createRequire } from "node:module";
|
|
8510
|
-
import * as
|
|
8560
|
+
import * as path6 from "node:path";
|
|
8511
8561
|
|
|
8512
8562
|
// src/scripts/_lib/surface_tiers.ts
|
|
8513
|
-
import * as
|
|
8514
|
-
import * as
|
|
8563
|
+
import * as fs5 from "node:fs";
|
|
8564
|
+
import * as path5 from "node:path";
|
|
8515
8565
|
var _LAB_FALLBACK = /* @__PURE__ */ new Set(["ai-video", "ai-image", "fun"]);
|
|
8516
8566
|
function load_lab_pack_ids(repo_root) {
|
|
8517
|
-
const vocab =
|
|
8567
|
+
const vocab = path5.join(repo_root, "src", "config", "discovery", "packs.yml");
|
|
8518
8568
|
const ids = /* @__PURE__ */ new Set();
|
|
8519
8569
|
try {
|
|
8520
|
-
const
|
|
8521
|
-
const data =
|
|
8570
|
+
const YAML6 = require_dist();
|
|
8571
|
+
const data = YAML6.parse(fs5.readFileSync(vocab, "utf-8"), { version: "1.1" });
|
|
8522
8572
|
for (const entry of data ?? []) {
|
|
8523
8573
|
if (entry && typeof entry === "object" && !Array.isArray(entry)) {
|
|
8524
8574
|
const rec = entry;
|
|
@@ -8538,7 +8588,7 @@ function load_lab_pack_ids(repo_root) {
|
|
|
8538
8588
|
function frontmatter_packs(md_path) {
|
|
8539
8589
|
let text;
|
|
8540
8590
|
try {
|
|
8541
|
-
text =
|
|
8591
|
+
text = fs5.readFileSync(md_path, "utf-8");
|
|
8542
8592
|
} catch {
|
|
8543
8593
|
return /* @__PURE__ */ new Set();
|
|
8544
8594
|
}
|
|
@@ -8609,22 +8659,22 @@ function isPlainObject(v) {
|
|
|
8609
8659
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
8610
8660
|
}
|
|
8611
8661
|
function yamlSafeLoad(text) {
|
|
8612
|
-
let
|
|
8662
|
+
let YAML6;
|
|
8613
8663
|
try {
|
|
8614
|
-
|
|
8664
|
+
YAML6 = _require("yaml");
|
|
8615
8665
|
} catch {
|
|
8616
8666
|
return null;
|
|
8617
8667
|
}
|
|
8618
8668
|
try {
|
|
8619
|
-
return
|
|
8669
|
+
return YAML6.parse(text, { version: "1.1" }) ?? null;
|
|
8620
8670
|
} catch {
|
|
8621
8671
|
return null;
|
|
8622
8672
|
}
|
|
8623
8673
|
}
|
|
8624
|
-
var PACKS_YML_REL =
|
|
8674
|
+
var PACKS_YML_REL = path6.join("src", "config", "discovery", "packs.yml");
|
|
8625
8675
|
function load_packs_registry(package_root) {
|
|
8626
|
-
const vocab_path =
|
|
8627
|
-
const data = yamlSafeLoad(
|
|
8676
|
+
const vocab_path = path6.join(package_root, PACKS_YML_REL);
|
|
8677
|
+
const data = yamlSafeLoad(fs6.readFileSync(vocab_path, "utf-8"));
|
|
8628
8678
|
if (!Array.isArray(data)) {
|
|
8629
8679
|
throw new Error(`packs.yml did not parse to a list: ${vocab_path}`);
|
|
8630
8680
|
}
|
|
@@ -8702,14 +8752,14 @@ function prune_modules_by(deploy_results, is_pruned) {
|
|
|
8702
8752
|
const [written, skipped, status, paths] = deploy_results[tool_id];
|
|
8703
8753
|
const pruned_skill_dirs = /* @__PURE__ */ new Set();
|
|
8704
8754
|
for (const p of paths) {
|
|
8705
|
-
const parts = p.split(
|
|
8755
|
+
const parts = p.split(path6.sep);
|
|
8706
8756
|
if (parts.includes("skills")) {
|
|
8707
8757
|
const i = parts.indexOf("skills");
|
|
8708
8758
|
if (i + 1 < parts.length) {
|
|
8709
|
-
const skill_root = parts.slice(0, i + 2).join(
|
|
8759
|
+
const skill_root = parts.slice(0, i + 2).join(path6.sep);
|
|
8710
8760
|
if (!pruned_skill_dirs.has(skill_root)) {
|
|
8711
|
-
const skillmd =
|
|
8712
|
-
if (
|
|
8761
|
+
const skillmd = path6.join(skill_root, "SKILL.md");
|
|
8762
|
+
if (fs6.existsSync(skillmd) && is_pruned(skillmd)) {
|
|
8713
8763
|
pruned_skill_dirs.add(skill_root);
|
|
8714
8764
|
}
|
|
8715
8765
|
}
|
|
@@ -8719,25 +8769,25 @@ function prune_modules_by(deploy_results, is_pruned) {
|
|
|
8719
8769
|
const keep = [];
|
|
8720
8770
|
const delete_files = [];
|
|
8721
8771
|
for (const p of paths) {
|
|
8722
|
-
const parts = p.split(
|
|
8772
|
+
const parts = p.split(path6.sep);
|
|
8723
8773
|
let is_target = false;
|
|
8724
8774
|
if (parts.includes("skills")) {
|
|
8725
8775
|
const i = parts.indexOf("skills");
|
|
8726
|
-
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(
|
|
8776
|
+
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path6.sep))) {
|
|
8727
8777
|
is_target = true;
|
|
8728
8778
|
}
|
|
8729
|
-
} else if (parts.includes("commands") &&
|
|
8779
|
+
} else if (parts.includes("commands") && path6.extname(p) === ".md" && is_pruned(p)) {
|
|
8730
8780
|
is_target = true;
|
|
8731
8781
|
}
|
|
8732
8782
|
(is_target ? delete_files : keep).push(p);
|
|
8733
8783
|
}
|
|
8734
8784
|
for (const d of pruned_skill_dirs) {
|
|
8735
|
-
|
|
8785
|
+
fs6.rmSync(d, { recursive: true, force: true });
|
|
8736
8786
|
}
|
|
8737
8787
|
for (const p of delete_files) {
|
|
8738
|
-
if (p.split(
|
|
8788
|
+
if (p.split(path6.sep).includes("commands") && fs6.existsSync(p)) {
|
|
8739
8789
|
try {
|
|
8740
|
-
|
|
8790
|
+
fs6.unlinkSync(p);
|
|
8741
8791
|
} catch {
|
|
8742
8792
|
}
|
|
8743
8793
|
}
|
|
@@ -8753,35 +8803,35 @@ function prune_lab_modules(deploy_results, lab_ids) {
|
|
|
8753
8803
|
|
|
8754
8804
|
// src/install/conflictTracker.ts
|
|
8755
8805
|
import * as crypto2 from "node:crypto";
|
|
8756
|
-
import * as
|
|
8757
|
-
import * as
|
|
8806
|
+
import * as fs10 from "node:fs";
|
|
8807
|
+
import * as path9 from "node:path";
|
|
8758
8808
|
|
|
8759
8809
|
// src/install/fsPrimitives.ts
|
|
8760
8810
|
import * as crypto from "node:crypto";
|
|
8761
|
-
import * as
|
|
8762
|
-
import * as
|
|
8811
|
+
import * as fs7 from "node:fs";
|
|
8812
|
+
import * as path7 from "node:path";
|
|
8763
8813
|
function resolvePath(p) {
|
|
8764
8814
|
try {
|
|
8765
|
-
return
|
|
8815
|
+
return fs7.realpathSync(path7.resolve(p));
|
|
8766
8816
|
} catch {
|
|
8767
|
-
return
|
|
8817
|
+
return path7.resolve(p);
|
|
8768
8818
|
}
|
|
8769
8819
|
}
|
|
8770
8820
|
function pathExists(p) {
|
|
8771
8821
|
try {
|
|
8772
|
-
|
|
8822
|
+
fs7.statSync(p);
|
|
8773
8823
|
return true;
|
|
8774
8824
|
} catch {
|
|
8775
8825
|
return false;
|
|
8776
8826
|
}
|
|
8777
8827
|
}
|
|
8778
8828
|
function mkdirp(p) {
|
|
8779
|
-
|
|
8829
|
+
fs7.mkdirSync(p, { recursive: true });
|
|
8780
8830
|
}
|
|
8781
8831
|
function sha256OfFile(p) {
|
|
8782
8832
|
let data;
|
|
8783
8833
|
try {
|
|
8784
|
-
data =
|
|
8834
|
+
data = fs7.readFileSync(p);
|
|
8785
8835
|
} catch {
|
|
8786
8836
|
return null;
|
|
8787
8837
|
}
|
|
@@ -8789,19 +8839,19 @@ function sha256OfFile(p) {
|
|
|
8789
8839
|
}
|
|
8790
8840
|
|
|
8791
8841
|
// src/install/recordedOwnership.ts
|
|
8792
|
-
var
|
|
8793
|
-
import { existsSync as existsSync4, readFileSync as
|
|
8842
|
+
var YAML2 = __toESM(require_dist(), 1);
|
|
8843
|
+
import { existsSync as existsSync4, readFileSync as readFileSync8 } from "node:fs";
|
|
8794
8844
|
import { homedir as homedir4 } from "node:os";
|
|
8795
|
-
import { isAbsolute, join as
|
|
8845
|
+
import { isAbsolute, join as join8, resolve as resolve2 } from "node:path";
|
|
8796
8846
|
|
|
8797
8847
|
// src/scripts/_lib/installed_tools.ts
|
|
8798
|
-
import * as
|
|
8848
|
+
import * as fs9 from "node:fs";
|
|
8799
8849
|
import * as os3 from "node:os";
|
|
8800
8850
|
import * as fsPath from "node:path";
|
|
8801
8851
|
|
|
8802
8852
|
// src/scripts/_lib/fs_atomic.ts
|
|
8803
|
-
import
|
|
8804
|
-
import
|
|
8853
|
+
import fs8 from "node:fs";
|
|
8854
|
+
import path8 from "node:path";
|
|
8805
8855
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
8806
8856
|
function _normalize_encoding(encoding) {
|
|
8807
8857
|
const compact = encoding.toLowerCase().replace(/[-_\s]/g, "");
|
|
@@ -8817,9 +8867,9 @@ function _normalize_encoding(encoding) {
|
|
|
8817
8867
|
}
|
|
8818
8868
|
function write_atomic(p, data, options = {}) {
|
|
8819
8869
|
const encoding = options.encoding ?? "utf-8";
|
|
8820
|
-
const target =
|
|
8821
|
-
const parent =
|
|
8822
|
-
|
|
8870
|
+
const target = path8.normalize(p);
|
|
8871
|
+
const parent = path8.dirname(target);
|
|
8872
|
+
fs8.mkdirSync(parent, { recursive: true });
|
|
8823
8873
|
let payload;
|
|
8824
8874
|
if (typeof data === "string") {
|
|
8825
8875
|
payload = Buffer.from(data, _normalize_encoding(encoding));
|
|
@@ -8833,12 +8883,12 @@ function write_atomic(p, data, options = {}) {
|
|
|
8833
8883
|
let fd = null;
|
|
8834
8884
|
let tmp_path = "";
|
|
8835
8885
|
for (let attempt = 0; attempt < 32; attempt += 1) {
|
|
8836
|
-
tmp_path =
|
|
8886
|
+
tmp_path = path8.join(
|
|
8837
8887
|
parent,
|
|
8838
|
-
`.${
|
|
8888
|
+
`.${path8.basename(target)}.tmp.${randomBytes2(6).toString("hex")}`
|
|
8839
8889
|
);
|
|
8840
8890
|
try {
|
|
8841
|
-
fd =
|
|
8891
|
+
fd = fs8.openSync(tmp_path, "wx", 384);
|
|
8842
8892
|
break;
|
|
8843
8893
|
} catch (err) {
|
|
8844
8894
|
if (err.code === "EEXIST") continue;
|
|
@@ -8852,24 +8902,24 @@ function write_atomic(p, data, options = {}) {
|
|
|
8852
8902
|
try {
|
|
8853
8903
|
let offset = 0;
|
|
8854
8904
|
while (offset < payload.length) {
|
|
8855
|
-
offset +=
|
|
8905
|
+
offset += fs8.writeSync(fd, payload, offset, payload.length - offset);
|
|
8856
8906
|
}
|
|
8857
8907
|
try {
|
|
8858
|
-
|
|
8908
|
+
fs8.fsyncSync(fd);
|
|
8859
8909
|
} catch {
|
|
8860
8910
|
}
|
|
8861
|
-
|
|
8911
|
+
fs8.closeSync(fd);
|
|
8862
8912
|
closed = true;
|
|
8863
|
-
|
|
8913
|
+
fs8.renameSync(tmp_path, target);
|
|
8864
8914
|
} catch (err) {
|
|
8865
8915
|
if (!closed) {
|
|
8866
8916
|
try {
|
|
8867
|
-
|
|
8917
|
+
fs8.closeSync(fd);
|
|
8868
8918
|
} catch {
|
|
8869
8919
|
}
|
|
8870
8920
|
}
|
|
8871
8921
|
try {
|
|
8872
|
-
|
|
8922
|
+
fs8.unlinkSync(tmp_path);
|
|
8873
8923
|
} catch {
|
|
8874
8924
|
}
|
|
8875
8925
|
throw err;
|
|
@@ -8880,17 +8930,17 @@ function write_atomic(p, data, options = {}) {
|
|
|
8880
8930
|
function _fsync_dir(directory) {
|
|
8881
8931
|
let dir_fd;
|
|
8882
8932
|
try {
|
|
8883
|
-
dir_fd =
|
|
8933
|
+
dir_fd = fs8.openSync(directory, fs8.constants.O_RDONLY);
|
|
8884
8934
|
} catch {
|
|
8885
8935
|
return;
|
|
8886
8936
|
}
|
|
8887
8937
|
try {
|
|
8888
8938
|
try {
|
|
8889
|
-
|
|
8939
|
+
fs8.fsyncSync(dir_fd);
|
|
8890
8940
|
} catch {
|
|
8891
8941
|
}
|
|
8892
8942
|
} finally {
|
|
8893
|
-
|
|
8943
|
+
fs8.closeSync(dir_fd);
|
|
8894
8944
|
}
|
|
8895
8945
|
}
|
|
8896
8946
|
|
|
@@ -8919,18 +8969,18 @@ function manifest_path(project_root, env) {
|
|
|
8919
8969
|
var _TOP_KEY_RE = /^([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
|
|
8920
8970
|
var _LIST_DASH_RE = /^\s*-\s*(.+?)\s*$/;
|
|
8921
8971
|
var _INDENT_KEY_RE = /^\s+([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
|
|
8922
|
-
function read_manifest(
|
|
8972
|
+
function read_manifest(path25) {
|
|
8923
8973
|
let text;
|
|
8924
8974
|
try {
|
|
8925
|
-
text = require_read_text(
|
|
8975
|
+
text = require_read_text(path25);
|
|
8926
8976
|
} catch {
|
|
8927
8977
|
return null;
|
|
8928
8978
|
}
|
|
8929
8979
|
const data = _parse_manual(text);
|
|
8930
8980
|
return _normalise_v2_shape(data);
|
|
8931
8981
|
}
|
|
8932
|
-
function require_read_text(
|
|
8933
|
-
return
|
|
8982
|
+
function require_read_text(path25) {
|
|
8983
|
+
return fs9.readFileSync(path25, { encoding: "utf-8" });
|
|
8934
8984
|
}
|
|
8935
8985
|
function _normalise_v2_shape(data) {
|
|
8936
8986
|
if (data["tools"] === void 0 || data["tools"] === null) {
|
|
@@ -9111,9 +9161,9 @@ function stable_sort(items, key) {
|
|
|
9111
9161
|
return a.index - b.index;
|
|
9112
9162
|
}).map((entry) => entry.item);
|
|
9113
9163
|
}
|
|
9114
|
-
function write_manifest(
|
|
9164
|
+
function write_manifest(path25, version, tools, options = {}) {
|
|
9115
9165
|
const rendered = _render2(version, tools, { deploy_roots: options.deploy_roots ?? null });
|
|
9116
|
-
return write_atomic(
|
|
9166
|
+
return write_atomic(path25, rendered);
|
|
9117
9167
|
}
|
|
9118
9168
|
var ScopeMismatchError = class extends Error {
|
|
9119
9169
|
name_;
|
|
@@ -9212,7 +9262,7 @@ function readRecordedHashes(manifestPath, projectRoot) {
|
|
|
9212
9262
|
if (!existsSync4(manifestPath)) return NO_RECORDED_HASHES;
|
|
9213
9263
|
let doc;
|
|
9214
9264
|
try {
|
|
9215
|
-
doc =
|
|
9265
|
+
doc = YAML2.parse(readFileSync8(manifestPath, "utf8"));
|
|
9216
9266
|
} catch {
|
|
9217
9267
|
return NO_RECORDED_HASHES;
|
|
9218
9268
|
}
|
|
@@ -9240,7 +9290,7 @@ function readRecordedHashes(manifestPath, projectRoot) {
|
|
|
9240
9290
|
function expanduser4(p) {
|
|
9241
9291
|
if (p === "~") return homedir4();
|
|
9242
9292
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
9243
|
-
return
|
|
9293
|
+
return join8(homedir4(), p.slice(2));
|
|
9244
9294
|
}
|
|
9245
9295
|
return p;
|
|
9246
9296
|
}
|
|
@@ -9282,20 +9332,20 @@ function createConflictTracker(host) {
|
|
|
9282
9332
|
function recordedHashFor(target) {
|
|
9283
9333
|
if (conflictState.root === null) return void 0;
|
|
9284
9334
|
conflictState.recorded ??= recordedHashesForRoot(conflictState.root);
|
|
9285
|
-
const plain =
|
|
9335
|
+
const plain = path9.resolve(target);
|
|
9286
9336
|
if (conflictState.recorded.has(plain)) return conflictState.recorded.get(plain);
|
|
9287
9337
|
const real = resolvePath(target);
|
|
9288
9338
|
return real === plain ? void 0 : conflictState.recorded.get(real);
|
|
9289
9339
|
}
|
|
9290
9340
|
function stageInto(target, sidecar, produce) {
|
|
9291
|
-
mkdirp(
|
|
9292
|
-
const tmp =
|
|
9293
|
-
|
|
9294
|
-
`.${
|
|
9341
|
+
mkdirp(path9.dirname(sidecar));
|
|
9342
|
+
const tmp = path9.join(
|
|
9343
|
+
path9.dirname(sidecar),
|
|
9344
|
+
`.${path9.basename(sidecar)}.${process.pid}.${crypto2.randomBytes(6).toString("hex")}${path9.extname(target)}`
|
|
9295
9345
|
);
|
|
9296
9346
|
const discard = () => {
|
|
9297
9347
|
try {
|
|
9298
|
-
|
|
9348
|
+
fs10.unlinkSync(tmp);
|
|
9299
9349
|
} catch {
|
|
9300
9350
|
}
|
|
9301
9351
|
};
|
|
@@ -9322,7 +9372,7 @@ function createConflictTracker(host) {
|
|
|
9322
9372
|
}
|
|
9323
9373
|
}
|
|
9324
9374
|
try {
|
|
9325
|
-
|
|
9375
|
+
fs10.renameSync(tmp, sidecar);
|
|
9326
9376
|
} catch (exc) {
|
|
9327
9377
|
discard();
|
|
9328
9378
|
host.fail(
|
|
@@ -9371,7 +9421,7 @@ function createConflictTracker(host) {
|
|
|
9371
9421
|
preserve(target, source, packageRoot) {
|
|
9372
9422
|
const sidecar = sidecarPathFor(target);
|
|
9373
9423
|
stageInto(target, sidecar, (tmp) => {
|
|
9374
|
-
|
|
9424
|
+
fs10.copyFileSync(source, tmp);
|
|
9375
9425
|
host.tagDeployed(tmp, source, packageRoot);
|
|
9376
9426
|
});
|
|
9377
9427
|
record(target, sidecar);
|
|
@@ -9387,7 +9437,7 @@ function createConflictTracker(host) {
|
|
|
9387
9437
|
*/
|
|
9388
9438
|
preserveContent(target, content) {
|
|
9389
9439
|
const sidecar = sidecarPathFor(target);
|
|
9390
|
-
stageInto(target, sidecar, (tmp) =>
|
|
9440
|
+
stageInto(target, sidecar, (tmp) => fs10.writeFileSync(tmp, content, "utf-8"));
|
|
9391
9441
|
record(target, sidecar);
|
|
9392
9442
|
},
|
|
9393
9443
|
/**
|
|
@@ -9406,10 +9456,10 @@ function createConflictTracker(host) {
|
|
|
9406
9456
|
}
|
|
9407
9457
|
|
|
9408
9458
|
// src/install/manifestFiles.ts
|
|
9409
|
-
var
|
|
9410
|
-
import { existsSync as existsSync5, readFileSync as
|
|
9459
|
+
var YAML3 = __toESM(require_dist(), 1);
|
|
9460
|
+
import { existsSync as existsSync5, readFileSync as readFileSync9 } from "node:fs";
|
|
9411
9461
|
import { homedir as homedir5 } from "node:os";
|
|
9412
|
-
import { isAbsolute as isAbsolute2, join as
|
|
9462
|
+
import { isAbsolute as isAbsolute2, join as join10, resolve as resolve4 } from "node:path";
|
|
9413
9463
|
function fileEntry(p, kind, hashContent) {
|
|
9414
9464
|
return { path: p, kind, sha256: hashContent ? sha256OfFile(p) : null };
|
|
9415
9465
|
}
|
|
@@ -9432,7 +9482,7 @@ function filesByToolFromBridges(tools, projectRoot, scope, bridgeMarker) {
|
|
|
9432
9482
|
for (const toolId of [...tools].sort()) {
|
|
9433
9483
|
const marker = bridgeMarker(toolId, scope);
|
|
9434
9484
|
if (!marker) continue;
|
|
9435
|
-
const markerPath = isAbsolute2(marker) ? marker :
|
|
9485
|
+
const markerPath = isAbsolute2(marker) ? marker : join10(projectRoot, marker);
|
|
9436
9486
|
out[toolId] = [fileEntry(markerPath, "bridge", false)];
|
|
9437
9487
|
}
|
|
9438
9488
|
return out;
|
|
@@ -9440,7 +9490,7 @@ function filesByToolFromBridges(tools, projectRoot, scope, bridgeMarker) {
|
|
|
9440
9490
|
function expanduser5(p) {
|
|
9441
9491
|
if (p === "~") return homedir5();
|
|
9442
9492
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
9443
|
-
return
|
|
9493
|
+
return join10(homedir5(), p.slice(2));
|
|
9444
9494
|
}
|
|
9445
9495
|
return p;
|
|
9446
9496
|
}
|
|
@@ -9453,7 +9503,7 @@ function readRecordedByTool(manifestPath, projectRoot) {
|
|
|
9453
9503
|
if (!existsSync5(manifestPath)) return out;
|
|
9454
9504
|
let doc;
|
|
9455
9505
|
try {
|
|
9456
|
-
doc =
|
|
9506
|
+
doc = YAML3.parse(readFileSync9(manifestPath, "utf8"));
|
|
9457
9507
|
} catch {
|
|
9458
9508
|
return out;
|
|
9459
9509
|
}
|
|
@@ -9533,9 +9583,9 @@ function preservedIndex(preservedTargets, staged) {
|
|
|
9533
9583
|
|
|
9534
9584
|
// src/scripts/_lib/global_deploy_inventory.ts
|
|
9535
9585
|
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
9536
|
-
import * as
|
|
9586
|
+
import * as fs11 from "node:fs";
|
|
9537
9587
|
import * as os4 from "node:os";
|
|
9538
|
-
import * as
|
|
9588
|
+
import * as path10 from "node:path";
|
|
9539
9589
|
var SCHEMA_VERSION3 = 1;
|
|
9540
9590
|
var INVENTORY_BASENAME = "deployed-files.json";
|
|
9541
9591
|
var INVENTORY_ENV = "AGENT_CONFIG_DEPLOY_INVENTORY";
|
|
@@ -9544,22 +9594,22 @@ function expanduser6(p) {
|
|
|
9544
9594
|
return os4.homedir();
|
|
9545
9595
|
}
|
|
9546
9596
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
9547
|
-
return
|
|
9597
|
+
return path10.join(os4.homedir(), p.slice(2));
|
|
9548
9598
|
}
|
|
9549
9599
|
return p;
|
|
9550
9600
|
}
|
|
9551
9601
|
function resolve_path(p) {
|
|
9552
9602
|
try {
|
|
9553
|
-
return
|
|
9603
|
+
return fs11.realpathSync(p);
|
|
9554
9604
|
} catch {
|
|
9555
|
-
const abs =
|
|
9556
|
-
const parts = abs.split(
|
|
9605
|
+
const abs = path10.resolve(p);
|
|
9606
|
+
const parts = abs.split(path10.sep);
|
|
9557
9607
|
for (let i = parts.length; i > 0; i -= 1) {
|
|
9558
|
-
const prefix = parts.slice(0, i).join(
|
|
9608
|
+
const prefix = parts.slice(0, i).join(path10.sep) || path10.sep;
|
|
9559
9609
|
try {
|
|
9560
|
-
const real =
|
|
9610
|
+
const real = fs11.realpathSync(prefix);
|
|
9561
9611
|
const rest = parts.slice(i);
|
|
9562
|
-
return rest.length > 0 ?
|
|
9612
|
+
return rest.length > 0 ? path10.join(real, ...rest) : real;
|
|
9563
9613
|
} catch {
|
|
9564
9614
|
continue;
|
|
9565
9615
|
}
|
|
@@ -9569,7 +9619,7 @@ function resolve_path(p) {
|
|
|
9569
9619
|
}
|
|
9570
9620
|
function path_exists(p) {
|
|
9571
9621
|
try {
|
|
9572
|
-
|
|
9622
|
+
fs11.statSync(p);
|
|
9573
9623
|
return true;
|
|
9574
9624
|
} catch {
|
|
9575
9625
|
return false;
|
|
@@ -9587,7 +9637,7 @@ function load_inventory(p) {
|
|
|
9587
9637
|
const target = p ?? inventory_path();
|
|
9588
9638
|
let data;
|
|
9589
9639
|
try {
|
|
9590
|
-
data = JSON.parse(
|
|
9640
|
+
data = JSON.parse(fs11.readFileSync(target, { encoding: "utf-8" }));
|
|
9591
9641
|
} catch {
|
|
9592
9642
|
return { schema_version: SCHEMA_VERSION3, tools: {} };
|
|
9593
9643
|
}
|
|
@@ -9598,15 +9648,15 @@ function load_inventory(p) {
|
|
|
9598
9648
|
}
|
|
9599
9649
|
function save_inventory(data, p) {
|
|
9600
9650
|
const target = p ?? inventory_path();
|
|
9601
|
-
|
|
9651
|
+
fs11.mkdirSync(path10.dirname(target), { recursive: true });
|
|
9602
9652
|
const payload = json_dumps_sorted(data, 2) + "\n";
|
|
9603
|
-
const parent =
|
|
9653
|
+
const parent = path10.dirname(target);
|
|
9604
9654
|
let fd = null;
|
|
9605
9655
|
let tmp_name = "";
|
|
9606
9656
|
for (let attempt = 0; attempt < 32; attempt += 1) {
|
|
9607
|
-
tmp_name =
|
|
9657
|
+
tmp_name = path10.join(parent, `${path10.basename(target)}.${randomBytes4(6).toString("hex")}`);
|
|
9608
9658
|
try {
|
|
9609
|
-
fd =
|
|
9659
|
+
fd = fs11.openSync(tmp_name, "wx", 384);
|
|
9610
9660
|
break;
|
|
9611
9661
|
} catch (err) {
|
|
9612
9662
|
if (err.code === "EEXIST") {
|
|
@@ -9619,16 +9669,16 @@ function save_inventory(data, p) {
|
|
|
9619
9669
|
throw new Error("save_inventory: could not create a unique temp file");
|
|
9620
9670
|
}
|
|
9621
9671
|
try {
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
9672
|
+
fs11.writeFileSync(fd, payload, { encoding: "utf-8" });
|
|
9673
|
+
fs11.closeSync(fd);
|
|
9674
|
+
fs11.renameSync(tmp_name, target);
|
|
9625
9675
|
} catch (err) {
|
|
9626
9676
|
try {
|
|
9627
|
-
|
|
9677
|
+
fs11.closeSync(fd);
|
|
9628
9678
|
} catch {
|
|
9629
9679
|
}
|
|
9630
9680
|
try {
|
|
9631
|
-
|
|
9681
|
+
fs11.unlinkSync(tmp_name);
|
|
9632
9682
|
} catch {
|
|
9633
9683
|
}
|
|
9634
9684
|
throw err;
|
|
@@ -9687,7 +9737,7 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
|
|
|
9687
9737
|
const out = /* @__PURE__ */ new Set();
|
|
9688
9738
|
let src_stat;
|
|
9689
9739
|
try {
|
|
9690
|
-
src_stat =
|
|
9740
|
+
src_stat = fs11.statSync(src);
|
|
9691
9741
|
} catch {
|
|
9692
9742
|
return out;
|
|
9693
9743
|
}
|
|
@@ -9699,23 +9749,23 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
|
|
|
9699
9749
|
return out;
|
|
9700
9750
|
}
|
|
9701
9751
|
const _walk = (node, prefix) => {
|
|
9702
|
-
const entries =
|
|
9752
|
+
const entries = fs11.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
9703
9753
|
for (const name of entries) {
|
|
9704
|
-
const entry =
|
|
9754
|
+
const entry = path10.join(node, name);
|
|
9705
9755
|
const rel = join_rel(prefix, name);
|
|
9706
|
-
const lst =
|
|
9756
|
+
const lst = fs11.lstatSync(entry);
|
|
9707
9757
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
9708
9758
|
_walk(entry, rel);
|
|
9709
9759
|
continue;
|
|
9710
9760
|
}
|
|
9711
9761
|
let resolved_is_dir = false;
|
|
9712
9762
|
try {
|
|
9713
|
-
resolved_is_dir =
|
|
9763
|
+
resolved_is_dir = fs11.statSync(entry).isDirectory();
|
|
9714
9764
|
} catch {
|
|
9715
9765
|
resolved_is_dir = false;
|
|
9716
9766
|
}
|
|
9717
9767
|
if (resolved_is_dir) {
|
|
9718
|
-
_walk(
|
|
9768
|
+
_walk(fs11.realpathSync(entry), rel);
|
|
9719
9769
|
continue;
|
|
9720
9770
|
}
|
|
9721
9771
|
if (file_filter !== null && !file_filter(entry)) {
|
|
@@ -9728,13 +9778,13 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
|
|
|
9728
9778
|
return out;
|
|
9729
9779
|
}
|
|
9730
9780
|
function join_rel(prefix, name) {
|
|
9731
|
-
return prefix ?
|
|
9781
|
+
return prefix ? path10.join(prefix, name) : name;
|
|
9732
9782
|
}
|
|
9733
9783
|
function as_posix(p) {
|
|
9734
9784
|
if (p === "") {
|
|
9735
9785
|
return ".";
|
|
9736
9786
|
}
|
|
9737
|
-
return p.split(
|
|
9787
|
+
return p.split(path10.sep).join("/");
|
|
9738
9788
|
}
|
|
9739
9789
|
function reap_stale(tool_id, anchor, current_files, inventory, dry_run = false) {
|
|
9740
9790
|
const tools = inventory["tools"] ?? {};
|
|
@@ -9759,15 +9809,15 @@ function reap_stale(tool_id, anchor, current_files, inventory, dry_run = false)
|
|
|
9759
9809
|
if (typeof rel !== "string" || !rel || rel.startsWith("/") || rel.startsWith("..")) {
|
|
9760
9810
|
continue;
|
|
9761
9811
|
}
|
|
9762
|
-
const target =
|
|
9812
|
+
const target = path10.join(anchor_resolved, rel);
|
|
9763
9813
|
try {
|
|
9764
|
-
relative_to(resolve_path(
|
|
9814
|
+
relative_to(resolve_path(path10.dirname(target)), anchor_resolved);
|
|
9765
9815
|
} catch {
|
|
9766
9816
|
continue;
|
|
9767
9817
|
}
|
|
9768
9818
|
let lst = null;
|
|
9769
9819
|
try {
|
|
9770
|
-
lst =
|
|
9820
|
+
lst = fs11.lstatSync(target);
|
|
9771
9821
|
} catch {
|
|
9772
9822
|
lst = null;
|
|
9773
9823
|
}
|
|
@@ -9781,12 +9831,12 @@ function reap_stale(tool_id, anchor, current_files, inventory, dry_run = false)
|
|
|
9781
9831
|
continue;
|
|
9782
9832
|
}
|
|
9783
9833
|
try {
|
|
9784
|
-
|
|
9834
|
+
fs11.unlinkSync(target);
|
|
9785
9835
|
} catch {
|
|
9786
9836
|
continue;
|
|
9787
9837
|
}
|
|
9788
9838
|
deleted.push(target);
|
|
9789
|
-
prune_candidates.add(
|
|
9839
|
+
prune_candidates.add(path10.dirname(target));
|
|
9790
9840
|
}
|
|
9791
9841
|
prune_empty_dirs(prune_candidates, anchor_resolved);
|
|
9792
9842
|
return deleted;
|
|
@@ -9797,10 +9847,10 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
|
|
|
9797
9847
|
const prune_candidates = /* @__PURE__ */ new Set();
|
|
9798
9848
|
const needle = `package: ${package_tag}`;
|
|
9799
9849
|
for (const dest_sub of dest_subs) {
|
|
9800
|
-
const root = dest_sub ?
|
|
9850
|
+
const root = dest_sub ? path10.join(anchor_resolved, dest_sub) : anchor_resolved;
|
|
9801
9851
|
let root_stat;
|
|
9802
9852
|
try {
|
|
9803
|
-
root_stat =
|
|
9853
|
+
root_stat = fs11.statSync(root);
|
|
9804
9854
|
} catch {
|
|
9805
9855
|
continue;
|
|
9806
9856
|
}
|
|
@@ -9810,7 +9860,7 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
|
|
|
9810
9860
|
for (const md of rglob_md(root)) {
|
|
9811
9861
|
let md_lst;
|
|
9812
9862
|
try {
|
|
9813
|
-
md_lst =
|
|
9863
|
+
md_lst = fs11.lstatSync(md);
|
|
9814
9864
|
} catch {
|
|
9815
9865
|
continue;
|
|
9816
9866
|
}
|
|
@@ -9822,13 +9872,13 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
|
|
|
9822
9872
|
continue;
|
|
9823
9873
|
}
|
|
9824
9874
|
try {
|
|
9825
|
-
relative_to(resolve_path(
|
|
9875
|
+
relative_to(resolve_path(path10.dirname(md)), anchor_resolved);
|
|
9826
9876
|
} catch {
|
|
9827
9877
|
continue;
|
|
9828
9878
|
}
|
|
9829
9879
|
let head;
|
|
9830
9880
|
try {
|
|
9831
|
-
head =
|
|
9881
|
+
head = fs11.readFileSync(md, { encoding: "utf-8" });
|
|
9832
9882
|
} catch {
|
|
9833
9883
|
continue;
|
|
9834
9884
|
}
|
|
@@ -9846,12 +9896,12 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
|
|
|
9846
9896
|
continue;
|
|
9847
9897
|
}
|
|
9848
9898
|
try {
|
|
9849
|
-
|
|
9899
|
+
fs11.unlinkSync(md);
|
|
9850
9900
|
} catch {
|
|
9851
9901
|
continue;
|
|
9852
9902
|
}
|
|
9853
9903
|
deleted.push(md);
|
|
9854
|
-
prune_candidates.add(
|
|
9904
|
+
prune_candidates.add(path10.dirname(md));
|
|
9855
9905
|
}
|
|
9856
9906
|
}
|
|
9857
9907
|
prune_empty_dirs(prune_candidates, anchor_resolved);
|
|
@@ -9871,51 +9921,51 @@ function record_deploy(tool_id, anchor, current_files, inventory) {
|
|
|
9871
9921
|
}
|
|
9872
9922
|
function prune_empty_dirs(prune_candidates, anchor_resolved) {
|
|
9873
9923
|
const ordered = [...prune_candidates].sort(
|
|
9874
|
-
(a, b) => b.split(
|
|
9924
|
+
(a, b) => b.split(path10.sep).length - a.split(path10.sep).length
|
|
9875
9925
|
);
|
|
9876
9926
|
for (const start of ordered) {
|
|
9877
9927
|
let node = start;
|
|
9878
9928
|
while (node !== anchor_resolved && is_ancestor(anchor_resolved, node)) {
|
|
9879
9929
|
try {
|
|
9880
|
-
|
|
9930
|
+
fs11.rmdirSync(node);
|
|
9881
9931
|
} catch {
|
|
9882
9932
|
break;
|
|
9883
9933
|
}
|
|
9884
|
-
node =
|
|
9934
|
+
node = path10.dirname(node);
|
|
9885
9935
|
}
|
|
9886
9936
|
}
|
|
9887
9937
|
}
|
|
9888
9938
|
function is_ancestor(anchor, node) {
|
|
9889
|
-
const rel =
|
|
9890
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
9939
|
+
const rel = path10.relative(anchor, node);
|
|
9940
|
+
return rel !== "" && !rel.startsWith("..") && !path10.isAbsolute(rel);
|
|
9891
9941
|
}
|
|
9892
9942
|
function relative_to(child, parent) {
|
|
9893
9943
|
if (child === parent) {
|
|
9894
9944
|
return "";
|
|
9895
9945
|
}
|
|
9896
|
-
const rel =
|
|
9897
|
-
if (rel.startsWith("..") ||
|
|
9946
|
+
const rel = path10.relative(parent, child);
|
|
9947
|
+
if (rel.startsWith("..") || path10.isAbsolute(rel)) {
|
|
9898
9948
|
throw new Error(`'${child}' is not in the subpath of '${parent}'`);
|
|
9899
9949
|
}
|
|
9900
9950
|
return rel;
|
|
9901
9951
|
}
|
|
9902
9952
|
function relative_to_posix(child, parent) {
|
|
9903
|
-
return
|
|
9953
|
+
return path10.relative(parent, child).split(path10.sep).join("/");
|
|
9904
9954
|
}
|
|
9905
9955
|
function rglob_md(root) {
|
|
9906
9956
|
const out = [];
|
|
9907
9957
|
const walk = (dir) => {
|
|
9908
9958
|
let names;
|
|
9909
9959
|
try {
|
|
9910
|
-
names =
|
|
9960
|
+
names = fs11.readdirSync(dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
9911
9961
|
} catch {
|
|
9912
9962
|
return;
|
|
9913
9963
|
}
|
|
9914
9964
|
for (const name of names) {
|
|
9915
|
-
const full =
|
|
9965
|
+
const full = path10.join(dir, name);
|
|
9916
9966
|
let lst;
|
|
9917
9967
|
try {
|
|
9918
|
-
lst =
|
|
9968
|
+
lst = fs11.lstatSync(full);
|
|
9919
9969
|
} catch {
|
|
9920
9970
|
continue;
|
|
9921
9971
|
}
|
|
@@ -9956,8 +10006,8 @@ function splitlines3(text) {
|
|
|
9956
10006
|
}
|
|
9957
10007
|
|
|
9958
10008
|
// src/scripts/_lib/rule_layer_overlap.ts
|
|
9959
|
-
import * as
|
|
9960
|
-
import * as
|
|
10009
|
+
import * as fs12 from "node:fs";
|
|
10010
|
+
import * as path11 from "node:path";
|
|
9961
10011
|
var INSTALLER_PROVENANCE_KEYS = ["package", "source_path"];
|
|
9962
10012
|
function stripProvenance(text) {
|
|
9963
10013
|
const lines = text.split("\n");
|
|
@@ -10011,14 +10061,14 @@ function compareLayers(global_layer, project_layer) {
|
|
|
10011
10061
|
function readRuleLayer(dir) {
|
|
10012
10062
|
let names;
|
|
10013
10063
|
try {
|
|
10014
|
-
names =
|
|
10064
|
+
names = fs12.readdirSync(dir);
|
|
10015
10065
|
} catch {
|
|
10016
10066
|
return null;
|
|
10017
10067
|
}
|
|
10018
10068
|
const files = /* @__PURE__ */ new Map();
|
|
10019
10069
|
for (const name of names.filter((n) => n.endsWith(".md")).sort()) {
|
|
10020
10070
|
try {
|
|
10021
|
-
files.set(name,
|
|
10071
|
+
files.set(name, fs12.readFileSync(path11.join(dir, name), "utf-8"));
|
|
10022
10072
|
} catch {
|
|
10023
10073
|
continue;
|
|
10024
10074
|
}
|
|
@@ -10026,7 +10076,7 @@ function readRuleLayer(dir) {
|
|
|
10026
10076
|
return { dir, files };
|
|
10027
10077
|
}
|
|
10028
10078
|
function claudeMdExcludesGlob(dir) {
|
|
10029
|
-
return `${
|
|
10079
|
+
return `${path11.resolve(dir).replace(/\/+$/, "")}/**`;
|
|
10030
10080
|
}
|
|
10031
10081
|
function mergeClaudeMdExcludes(existing, entry) {
|
|
10032
10082
|
if (!Array.isArray(existing)) return [entry];
|
|
@@ -10057,25 +10107,25 @@ function decideLayerAction(report, choice, global_dir, project_dir) {
|
|
|
10057
10107
|
// src/scripts/_lib/install_drift.ts
|
|
10058
10108
|
var import_yaml = __toESM(require_dist(), 1);
|
|
10059
10109
|
import * as crypto3 from "node:crypto";
|
|
10060
|
-
import * as
|
|
10110
|
+
import * as fs13 from "node:fs";
|
|
10061
10111
|
import * as os5 from "node:os";
|
|
10062
|
-
import * as
|
|
10112
|
+
import * as path12 from "node:path";
|
|
10063
10113
|
function expanduser7(p) {
|
|
10064
10114
|
if (p === "~") {
|
|
10065
10115
|
return os5.homedir();
|
|
10066
10116
|
}
|
|
10067
10117
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
10068
|
-
return
|
|
10118
|
+
return path12.join(os5.homedir(), p.slice(2));
|
|
10069
10119
|
}
|
|
10070
10120
|
return p;
|
|
10071
10121
|
}
|
|
10072
10122
|
function resolve_entry_path(project_root, raw) {
|
|
10073
10123
|
const p = expanduser7(raw);
|
|
10074
|
-
return
|
|
10124
|
+
return path12.isAbsolute(p) ? p : path12.join(project_root, p);
|
|
10075
10125
|
}
|
|
10076
10126
|
function sha256_of_file(p) {
|
|
10077
10127
|
try {
|
|
10078
|
-
return crypto3.createHash("sha256").update(
|
|
10128
|
+
return crypto3.createHash("sha256").update(fs13.readFileSync(p)).digest("hex");
|
|
10079
10129
|
} catch {
|
|
10080
10130
|
return null;
|
|
10081
10131
|
}
|
|
@@ -10084,7 +10134,7 @@ function collect_drift(project_root, env) {
|
|
|
10084
10134
|
const target = manifest_path(project_root, env);
|
|
10085
10135
|
let text;
|
|
10086
10136
|
try {
|
|
10087
|
-
text =
|
|
10137
|
+
text = fs13.readFileSync(target, "utf-8");
|
|
10088
10138
|
} catch {
|
|
10089
10139
|
return null;
|
|
10090
10140
|
}
|
|
@@ -10129,7 +10179,7 @@ function collect_drift(project_root, env) {
|
|
|
10129
10179
|
continue;
|
|
10130
10180
|
}
|
|
10131
10181
|
const resolved = resolve_entry_path(project_root, raw_path);
|
|
10132
|
-
if (!
|
|
10182
|
+
if (!fs13.existsSync(resolved)) {
|
|
10133
10183
|
out.push({
|
|
10134
10184
|
tool_id,
|
|
10135
10185
|
path: resolved,
|
|
@@ -10182,15 +10232,15 @@ function format_drift_report(entries) {
|
|
|
10182
10232
|
}
|
|
10183
10233
|
|
|
10184
10234
|
// src/scripts/_lib/skill_catalogue.ts
|
|
10185
|
-
import * as
|
|
10186
|
-
import * as
|
|
10235
|
+
import * as fs14 from "node:fs";
|
|
10236
|
+
import * as path13 from "node:path";
|
|
10187
10237
|
var PROJECT_CATALOGUE_ROOTS = ["src/skills", ".claude/skills"];
|
|
10188
10238
|
var HOST_CATALOGUE_ROOT = ".claude/skills";
|
|
10189
10239
|
var DEFAULT_CATALOGUE_ROOTS = [
|
|
10190
10240
|
...PROJECT_CATALOGUE_ROOTS,
|
|
10191
10241
|
`~/${HOST_CATALOGUE_ROOT}`
|
|
10192
10242
|
];
|
|
10193
|
-
var OBSERVATION_LOG =
|
|
10243
|
+
var OBSERVATION_LOG = path13.join(
|
|
10194
10244
|
"agents",
|
|
10195
10245
|
"evidence",
|
|
10196
10246
|
"metrics",
|
|
@@ -10234,9 +10284,9 @@ function descriptionOf(frontmatter) {
|
|
|
10234
10284
|
return "";
|
|
10235
10285
|
}
|
|
10236
10286
|
function readProjectedCatalogue(root) {
|
|
10237
|
-
const names =
|
|
10287
|
+
const names = fs14.readdirSync(root).filter((n) => fs14.existsSync(path13.join(root, n, "SKILL.md"))).sort();
|
|
10238
10288
|
return names.map((name, index) => {
|
|
10239
|
-
const content =
|
|
10289
|
+
const content = fs14.readFileSync(path13.join(root, name, "SKILL.md"), "utf-8");
|
|
10240
10290
|
const frontmatter = frontmatterOf(content);
|
|
10241
10291
|
const description = descriptionOf(frontmatter);
|
|
10242
10292
|
return {
|
|
@@ -10253,12 +10303,12 @@ function truncationModeOf(record) {
|
|
|
10253
10303
|
return record.truncation_mode ?? "per-entry";
|
|
10254
10304
|
}
|
|
10255
10305
|
function markdownFilesUnder(root) {
|
|
10256
|
-
if (!
|
|
10306
|
+
if (!fs14.existsSync(root)) return [];
|
|
10257
10307
|
const out = [];
|
|
10258
10308
|
const walk = (dir) => {
|
|
10259
|
-
for (const entry of
|
|
10260
|
-
const full =
|
|
10261
|
-
if (
|
|
10309
|
+
for (const entry of fs14.readdirSync(dir, { withFileTypes: true })) {
|
|
10310
|
+
const full = path13.join(dir, entry.name);
|
|
10311
|
+
if (fs14.statSync(full).isDirectory()) walk(full);
|
|
10262
10312
|
else if (entry.name.endsWith(".md")) out.push(full);
|
|
10263
10313
|
}
|
|
10264
10314
|
};
|
|
@@ -10266,9 +10316,9 @@ function markdownFilesUnder(root) {
|
|
|
10266
10316
|
return out;
|
|
10267
10317
|
}
|
|
10268
10318
|
function measureCatalogueVolume(host, root) {
|
|
10269
|
-
const skillsRoot =
|
|
10270
|
-
const skills =
|
|
10271
|
-
const commandEntries = markdownFilesUnder(
|
|
10319
|
+
const skillsRoot = path13.join(root, "skills");
|
|
10320
|
+
const skills = fs14.existsSync(skillsRoot) ? readProjectedCatalogue(skillsRoot) : [];
|
|
10321
|
+
const commandEntries = markdownFilesUnder(path13.join(root, "commands")).length;
|
|
10272
10322
|
return {
|
|
10273
10323
|
host,
|
|
10274
10324
|
root,
|
|
@@ -10346,9 +10396,9 @@ function migrationPromptLines(host, eligibility, settingsPath) {
|
|
|
10346
10396
|
];
|
|
10347
10397
|
}
|
|
10348
10398
|
function readObservationLog(logPath) {
|
|
10349
|
-
if (!
|
|
10399
|
+
if (!fs14.existsSync(logPath)) return [];
|
|
10350
10400
|
const out = [];
|
|
10351
|
-
for (const line of
|
|
10401
|
+
for (const line of fs14.readFileSync(logPath, "utf-8").split("\n")) {
|
|
10352
10402
|
const trimmed = line.trim();
|
|
10353
10403
|
if (trimmed.length === 0) continue;
|
|
10354
10404
|
try {
|
|
@@ -10389,8 +10439,8 @@ function isInteractiveSession(probe) {
|
|
|
10389
10439
|
|
|
10390
10440
|
// src/scripts/_lib/claude_desktop_bundler.ts
|
|
10391
10441
|
import * as crypto4 from "node:crypto";
|
|
10392
|
-
import * as
|
|
10393
|
-
import * as
|
|
10442
|
+
import * as fs15 from "node:fs";
|
|
10443
|
+
import * as path14 from "node:path";
|
|
10394
10444
|
|
|
10395
10445
|
// src/scripts/_lib/zip_min.ts
|
|
10396
10446
|
import * as zlib from "node:zlib";
|
|
@@ -10497,7 +10547,7 @@ function _is_excluded(rel_parts) {
|
|
|
10497
10547
|
}
|
|
10498
10548
|
function _is_dir(p) {
|
|
10499
10549
|
try {
|
|
10500
|
-
return
|
|
10550
|
+
return fs15.statSync(p).isDirectory();
|
|
10501
10551
|
} catch {
|
|
10502
10552
|
return false;
|
|
10503
10553
|
}
|
|
@@ -10509,12 +10559,12 @@ function _compare_rel_parts(a, b) {
|
|
|
10509
10559
|
}
|
|
10510
10560
|
function _walk_skill_files(skill_dir) {
|
|
10511
10561
|
const out = [];
|
|
10512
|
-
const resolved =
|
|
10562
|
+
const resolved = fs15.realpathSync(skill_dir);
|
|
10513
10563
|
const walk = (root, relRoot) => {
|
|
10514
10564
|
const dirNames = [];
|
|
10515
10565
|
const fileNames = [];
|
|
10516
|
-
for (const dirent of
|
|
10517
|
-
const full =
|
|
10566
|
+
for (const dirent of fs15.readdirSync(root, { withFileTypes: true })) {
|
|
10567
|
+
const full = path14.join(root, dirent.name);
|
|
10518
10568
|
const isDir2 = dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full);
|
|
10519
10569
|
if (isDir2) {
|
|
10520
10570
|
dirNames.push(dirent.name);
|
|
@@ -10527,13 +10577,13 @@ function _walk_skill_files(skill_dir) {
|
|
|
10527
10577
|
if (_is_excluded(rel_parts)) {
|
|
10528
10578
|
continue;
|
|
10529
10579
|
}
|
|
10530
|
-
out.push([
|
|
10580
|
+
out.push([path14.join(root, fname), rel_parts]);
|
|
10531
10581
|
}
|
|
10532
10582
|
for (const dname of dirNames) {
|
|
10533
10583
|
if (_is_excluded([dname])) {
|
|
10534
10584
|
continue;
|
|
10535
10585
|
}
|
|
10536
|
-
walk(
|
|
10586
|
+
walk(path14.join(root, dname), [...relRoot, dname]);
|
|
10537
10587
|
}
|
|
10538
10588
|
};
|
|
10539
10589
|
walk(resolved, []);
|
|
@@ -10546,53 +10596,53 @@ function _manifest_digest(files) {
|
|
|
10546
10596
|
const rel = rel_parts.join("/");
|
|
10547
10597
|
h.update(Buffer.from(rel, "utf-8"));
|
|
10548
10598
|
h.update(Buffer.from([0]));
|
|
10549
|
-
h.update(crypto4.createHash("sha256").update(
|
|
10599
|
+
h.update(crypto4.createHash("sha256").update(fs15.readFileSync(abs_path)).digest());
|
|
10550
10600
|
h.update(Buffer.from([0]));
|
|
10551
10601
|
}
|
|
10552
10602
|
return h.digest("hex");
|
|
10553
10603
|
}
|
|
10554
10604
|
function _atomic_write_zip(zip_path, files) {
|
|
10555
|
-
|
|
10556
|
-
const stem =
|
|
10557
|
-
const tmp_path =
|
|
10558
|
-
|
|
10605
|
+
fs15.mkdirSync(path14.dirname(zip_path), { recursive: true });
|
|
10606
|
+
const stem = path14.basename(zip_path, path14.extname(zip_path));
|
|
10607
|
+
const tmp_path = path14.join(
|
|
10608
|
+
path14.dirname(zip_path),
|
|
10559
10609
|
`.${stem}.${crypto4.randomBytes(6).toString("hex")}.zip.tmp`
|
|
10560
10610
|
);
|
|
10561
10611
|
try {
|
|
10562
10612
|
const entries = files.map(([abs_path, rel_parts]) => ({
|
|
10563
10613
|
name: rel_parts.join("/"),
|
|
10564
|
-
data:
|
|
10614
|
+
data: fs15.readFileSync(abs_path)
|
|
10565
10615
|
}));
|
|
10566
|
-
|
|
10567
|
-
|
|
10616
|
+
fs15.writeFileSync(tmp_path, zip_write_sync(entries));
|
|
10617
|
+
fs15.renameSync(tmp_path, zip_path);
|
|
10568
10618
|
} finally {
|
|
10569
|
-
if (
|
|
10570
|
-
|
|
10619
|
+
if (fs15.existsSync(tmp_path)) {
|
|
10620
|
+
fs15.unlinkSync(tmp_path);
|
|
10571
10621
|
}
|
|
10572
10622
|
}
|
|
10573
10623
|
}
|
|
10574
10624
|
function _write_if_changed(dest_dir, slug, files, force, written) {
|
|
10575
10625
|
const digest = _manifest_digest(files);
|
|
10576
|
-
const zip_path =
|
|
10577
|
-
const digest_path =
|
|
10578
|
-
const recorded =
|
|
10579
|
-
if (!force && recorded === digest &&
|
|
10626
|
+
const zip_path = path14.join(dest_dir, `${slug}.zip`);
|
|
10627
|
+
const digest_path = path14.join(dest_dir, `${slug}.sha256`);
|
|
10628
|
+
const recorded = fs15.existsSync(digest_path) ? fs15.readFileSync(digest_path, "utf-8").trim() : "";
|
|
10629
|
+
if (!force && recorded === digest && fs15.existsSync(zip_path)) {
|
|
10580
10630
|
return;
|
|
10581
10631
|
}
|
|
10582
10632
|
_atomic_write_zip(zip_path, files);
|
|
10583
|
-
|
|
10633
|
+
fs15.writeFileSync(digest_path, digest + "\n", "utf-8");
|
|
10584
10634
|
written.push(zip_path);
|
|
10585
10635
|
}
|
|
10586
10636
|
function build_skill_bundles(package_root, dest_dir, force = false, curation = null) {
|
|
10587
|
-
const skills_root =
|
|
10637
|
+
const skills_root = path14.join(package_root, "dist/agent-src", "skills");
|
|
10588
10638
|
if (!_is_dir(skills_root)) {
|
|
10589
10639
|
return [];
|
|
10590
10640
|
}
|
|
10591
|
-
|
|
10641
|
+
fs15.mkdirSync(dest_dir, { recursive: true });
|
|
10592
10642
|
const written = [];
|
|
10593
|
-
for (const name of
|
|
10594
|
-
const entry =
|
|
10595
|
-
const isSymlink2 =
|
|
10643
|
+
for (const name of fs15.readdirSync(skills_root).sort()) {
|
|
10644
|
+
const entry = path14.join(skills_root, name);
|
|
10645
|
+
const isSymlink2 = fs15.lstatSync(entry).isSymbolicLink();
|
|
10596
10646
|
if (!(_is_dir(entry) || isSymlink2)) {
|
|
10597
10647
|
continue;
|
|
10598
10648
|
}
|
|
@@ -10600,8 +10650,8 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
|
|
|
10600
10650
|
if (curation !== null && !curation.includes(skill_name)) {
|
|
10601
10651
|
continue;
|
|
10602
10652
|
}
|
|
10603
|
-
const skill_md =
|
|
10604
|
-
if (!
|
|
10653
|
+
const skill_md = path14.join(entry, "SKILL.md");
|
|
10654
|
+
if (!fs15.existsSync(skill_md)) {
|
|
10605
10655
|
continue;
|
|
10606
10656
|
}
|
|
10607
10657
|
const files = _walk_skill_files(entry);
|
|
@@ -10613,15 +10663,15 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
|
|
|
10613
10663
|
return written;
|
|
10614
10664
|
}
|
|
10615
10665
|
function _command_slug(source_file, commands_root) {
|
|
10616
|
-
const rel =
|
|
10617
|
-
const noExt = rel.slice(0, rel.length -
|
|
10618
|
-
return noExt.split(
|
|
10666
|
+
const rel = path14.relative(commands_root, source_file);
|
|
10667
|
+
const noExt = rel.slice(0, rel.length - path14.extname(rel).length);
|
|
10668
|
+
return noExt.split(path14.sep).join("-");
|
|
10619
10669
|
}
|
|
10620
10670
|
function _iter_command_files(commands_root) {
|
|
10621
10671
|
const found = [];
|
|
10622
10672
|
const walk = (dir) => {
|
|
10623
|
-
for (const dirent of
|
|
10624
|
-
const full =
|
|
10673
|
+
for (const dirent of fs15.readdirSync(dir, { withFileTypes: true })) {
|
|
10674
|
+
const full = path14.join(dir, dirent.name);
|
|
10625
10675
|
if (dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full)) {
|
|
10626
10676
|
walk(full);
|
|
10627
10677
|
} else if (dirent.name.endsWith(".md")) {
|
|
@@ -10631,21 +10681,21 @@ function _iter_command_files(commands_root) {
|
|
|
10631
10681
|
};
|
|
10632
10682
|
walk(commands_root);
|
|
10633
10683
|
found.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
10634
|
-
return found.filter((source_file) =>
|
|
10684
|
+
return found.filter((source_file) => path14.basename(source_file) !== "AGENTS.md");
|
|
10635
10685
|
}
|
|
10636
10686
|
function build_command_bundles(package_root, dest_dir, force = false, curation = null) {
|
|
10637
|
-
const commands_root =
|
|
10687
|
+
const commands_root = path14.join(package_root, "dist/agent-src", "commands");
|
|
10638
10688
|
if (!_is_dir(commands_root)) {
|
|
10639
10689
|
return [];
|
|
10640
10690
|
}
|
|
10641
|
-
const skills_root =
|
|
10691
|
+
const skills_root = path14.join(package_root, "dist/agent-src", "skills");
|
|
10642
10692
|
let skill_names = /* @__PURE__ */ new Set();
|
|
10643
10693
|
if (_is_dir(skills_root)) {
|
|
10644
10694
|
skill_names = new Set(
|
|
10645
|
-
|
|
10695
|
+
fs15.readdirSync(skills_root).filter((name) => _is_dir(path14.join(skills_root, name)))
|
|
10646
10696
|
);
|
|
10647
10697
|
}
|
|
10648
|
-
|
|
10698
|
+
fs15.mkdirSync(dest_dir, { recursive: true });
|
|
10649
10699
|
const written = [];
|
|
10650
10700
|
for (const source_file of _iter_command_files(commands_root)) {
|
|
10651
10701
|
const slug = _command_slug(source_file, commands_root);
|
|
@@ -10655,16 +10705,16 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
|
|
|
10655
10705
|
if (curation !== null && !curation.includes(slug)) {
|
|
10656
10706
|
continue;
|
|
10657
10707
|
}
|
|
10658
|
-
const files = [[
|
|
10708
|
+
const files = [[fs15.realpathSync(source_file), ["SKILL.md"]]];
|
|
10659
10709
|
_write_if_changed(dest_dir, slug, files, force, written);
|
|
10660
10710
|
}
|
|
10661
10711
|
return written;
|
|
10662
10712
|
}
|
|
10663
10713
|
|
|
10664
10714
|
// src/scripts/_lib/claude_settings_hooks.ts
|
|
10665
|
-
var
|
|
10666
|
-
import * as
|
|
10667
|
-
import * as
|
|
10715
|
+
var YAML4 = __toESM(require_dist(), 1);
|
|
10716
|
+
import * as fs16 from "node:fs";
|
|
10717
|
+
import * as path15 from "node:path";
|
|
10668
10718
|
|
|
10669
10719
|
// src/install/atomic.ts
|
|
10670
10720
|
import {
|
|
@@ -10672,17 +10722,17 @@ import {
|
|
|
10672
10722
|
fsyncSync,
|
|
10673
10723
|
mkdirSync as mkdirSync6,
|
|
10674
10724
|
openSync as openSync3,
|
|
10675
|
-
readFileSync as
|
|
10725
|
+
readFileSync as readFileSync15,
|
|
10676
10726
|
renameSync as renameSync6,
|
|
10677
10727
|
unlinkSync as unlinkSync6,
|
|
10678
10728
|
writeSync
|
|
10679
10729
|
} from "node:fs";
|
|
10680
|
-
import { dirname as dirname6, join as
|
|
10730
|
+
import { dirname as dirname6, join as join16 } from "node:path";
|
|
10681
10731
|
function atomicWriteFile(target, data, options = {}) {
|
|
10682
10732
|
const mode = options.mode ?? 420;
|
|
10683
10733
|
const parent = dirname6(target);
|
|
10684
10734
|
mkdirSync6(parent, { recursive: true });
|
|
10685
|
-
const tmp =
|
|
10735
|
+
const tmp = join16(parent, `.tmp.${process.pid}.${randSuffix()}`);
|
|
10686
10736
|
let fd = null;
|
|
10687
10737
|
try {
|
|
10688
10738
|
fd = openSync3(tmp, "w", mode);
|
|
@@ -10709,7 +10759,7 @@ function atomicWriteFile(target, data, options = {}) {
|
|
|
10709
10759
|
function atomicAppendLine(target, line) {
|
|
10710
10760
|
let existing = "";
|
|
10711
10761
|
try {
|
|
10712
|
-
existing =
|
|
10762
|
+
existing = readFileSync15(target, "utf8");
|
|
10713
10763
|
} catch {
|
|
10714
10764
|
existing = "";
|
|
10715
10765
|
}
|
|
@@ -10723,7 +10773,7 @@ function randSuffix() {
|
|
|
10723
10773
|
|
|
10724
10774
|
// src/scripts/_lib/claude_settings_hooks.ts
|
|
10725
10775
|
function _yaml_parse(text) {
|
|
10726
|
-
return
|
|
10776
|
+
return YAML4.parse(text);
|
|
10727
10777
|
}
|
|
10728
10778
|
var MANAGED_SIGNATURE = "dispatch:hook --platform claude";
|
|
10729
10779
|
var CorruptSettingsError = class extends Error {
|
|
@@ -10743,7 +10793,7 @@ var SettingsLockError = class extends Error {
|
|
|
10743
10793
|
}
|
|
10744
10794
|
};
|
|
10745
10795
|
function build_claude_hook_matrix(manifest_path2) {
|
|
10746
|
-
const raw =
|
|
10796
|
+
const raw = fs16.readFileSync(manifest_path2, "utf8");
|
|
10747
10797
|
const manifest = _yaml_parse(raw) ?? {};
|
|
10748
10798
|
const hook_spec = manifest["schema_version"] ?? 1;
|
|
10749
10799
|
const platforms = manifest["platforms"] ?? {};
|
|
@@ -10773,8 +10823,8 @@ function _is_managed_group(group) {
|
|
|
10773
10823
|
);
|
|
10774
10824
|
}
|
|
10775
10825
|
function _read_settings(settings_path) {
|
|
10776
|
-
if (!
|
|
10777
|
-
const raw =
|
|
10826
|
+
if (!fs16.existsSync(settings_path)) return {};
|
|
10827
|
+
const raw = fs16.readFileSync(settings_path, "utf8");
|
|
10778
10828
|
if (raw.trim() === "") return {};
|
|
10779
10829
|
let parsed;
|
|
10780
10830
|
try {
|
|
@@ -10789,18 +10839,18 @@ function _read_settings(settings_path) {
|
|
|
10789
10839
|
}
|
|
10790
10840
|
function _with_lock(settings_path, fn) {
|
|
10791
10841
|
const lockPath = settings_path + ".agent-config.lock";
|
|
10792
|
-
|
|
10842
|
+
fs16.mkdirSync(path15.dirname(lockPath), { recursive: true });
|
|
10793
10843
|
let fd;
|
|
10794
10844
|
try {
|
|
10795
|
-
fd =
|
|
10845
|
+
fd = fs16.openSync(lockPath, "wx");
|
|
10796
10846
|
} catch {
|
|
10797
10847
|
throw new SettingsLockError(lockPath);
|
|
10798
10848
|
}
|
|
10799
10849
|
try {
|
|
10800
10850
|
return fn();
|
|
10801
10851
|
} finally {
|
|
10802
|
-
|
|
10803
|
-
|
|
10852
|
+
fs16.closeSync(fd);
|
|
10853
|
+
fs16.rmSync(lockPath, { force: true });
|
|
10804
10854
|
}
|
|
10805
10855
|
}
|
|
10806
10856
|
function ensure_managed_hooks(settings_path, matrix) {
|
|
@@ -10831,15 +10881,25 @@ function ensure_managed_hooks(settings_path, matrix) {
|
|
|
10831
10881
|
|
|
10832
10882
|
// src/scripts/hooks/host_lowering.ts
|
|
10833
10883
|
var import_yaml2 = __toESM(require_dist(), 1);
|
|
10834
|
-
import * as
|
|
10835
|
-
import * as
|
|
10884
|
+
import * as fs17 from "node:fs";
|
|
10885
|
+
import * as path16 from "node:path";
|
|
10836
10886
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
10887
|
+
|
|
10888
|
+
// src/scripts/hooks/table_fingerprint.ts
|
|
10889
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
10890
|
+
function tableFingerprint(text) {
|
|
10891
|
+
const digest = createHash5("sha256").update(text, "utf-8").digest("hex");
|
|
10892
|
+
return `${digest}:${String(text.length)}`;
|
|
10893
|
+
}
|
|
10894
|
+
|
|
10895
|
+
// src/scripts/hooks/host_lowering.ts
|
|
10837
10896
|
var _IN_BUNDLE = true;
|
|
10838
|
-
var _REPO_ROOT =
|
|
10839
|
-
|
|
10897
|
+
var _REPO_ROOT = path16.resolve(
|
|
10898
|
+
path16.dirname(fileURLToPath2(import.meta.url)),
|
|
10840
10899
|
..._IN_BUNDLE ? ["..", ".."] : ["..", "..", ".."]
|
|
10841
10900
|
);
|
|
10842
|
-
var HOST_LOWERING_PATH =
|
|
10901
|
+
var HOST_LOWERING_PATH = path16.join(_REPO_ROOT, "src", "scripts", "hooks", "host_lowering.yaml");
|
|
10902
|
+
var HOST_LOWERING_JSON_PATH = path16.join(_REPO_ROOT, "src", "scripts", "hooks", "host_lowering.json");
|
|
10843
10903
|
var DEFAULT_SURFACE = "any";
|
|
10844
10904
|
function _asString(v) {
|
|
10845
10905
|
if (v === null || v === void 0) return null;
|
|
@@ -10847,7 +10907,9 @@ function _asString(v) {
|
|
|
10847
10907
|
return String(v);
|
|
10848
10908
|
}
|
|
10849
10909
|
function _parse(text) {
|
|
10850
|
-
|
|
10910
|
+
return _structure((0, import_yaml2.parse)(text));
|
|
10911
|
+
}
|
|
10912
|
+
function _structure(raw) {
|
|
10851
10913
|
const hostsRaw = raw?.["hosts"];
|
|
10852
10914
|
if (typeof hostsRaw !== "object" || hostsRaw === null) {
|
|
10853
10915
|
throw new Error("host_lowering.yaml: missing `hosts:` map");
|
|
@@ -10871,6 +10933,7 @@ function _parse(text) {
|
|
|
10871
10933
|
verified = {
|
|
10872
10934
|
docs_at: _asString(verifiedRaw["docs_at"]),
|
|
10873
10935
|
docs_url: _asString(verifiedRaw["docs_url"]),
|
|
10936
|
+
docs_digest: _asString(verifiedRaw["docs_digest"]),
|
|
10874
10937
|
probe_at: _asString(verifiedRaw["probe_at"]),
|
|
10875
10938
|
host_version: _asString(verifiedRaw["host_version"]),
|
|
10876
10939
|
expires
|
|
@@ -10884,7 +10947,9 @@ function _parse(text) {
|
|
|
10884
10947
|
const be = rv["block_exit"];
|
|
10885
10948
|
const row = {
|
|
10886
10949
|
native,
|
|
10887
|
-
block_exit: typeof be === "number" ? be : null
|
|
10950
|
+
block_exit: typeof be === "number" ? be : null,
|
|
10951
|
+
answered_at: _asString(rv["answered_at"]),
|
|
10952
|
+
docs_url: _asString(rv["docs_url"])
|
|
10888
10953
|
};
|
|
10889
10954
|
if (typeof rv["matcher"] === "string") row.matcher = rv["matcher"];
|
|
10890
10955
|
slots.set(slot, row);
|
|
@@ -10905,9 +10970,30 @@ function _parse(text) {
|
|
|
10905
10970
|
}
|
|
10906
10971
|
var _cache = null;
|
|
10907
10972
|
function loadHostLowering() {
|
|
10908
|
-
if (_cache
|
|
10973
|
+
if (_cache !== null) return _cache;
|
|
10974
|
+
const text = fs17.readFileSync(HOST_LOWERING_PATH, "utf-8");
|
|
10975
|
+
let compiled;
|
|
10976
|
+
try {
|
|
10977
|
+
compiled = fs17.readFileSync(HOST_LOWERING_JSON_PATH, "utf-8");
|
|
10978
|
+
} catch {
|
|
10979
|
+
compiled = null;
|
|
10980
|
+
}
|
|
10981
|
+
_cache = resolveTable(text, compiled);
|
|
10909
10982
|
return _cache;
|
|
10910
10983
|
}
|
|
10984
|
+
function resolveTable(yamlText, compiledText) {
|
|
10985
|
+
if (compiledText !== null) {
|
|
10986
|
+
try {
|
|
10987
|
+
const raw = JSON.parse(compiledText);
|
|
10988
|
+
const table = raw["table"];
|
|
10989
|
+
if (raw["fingerprint"] === tableFingerprint(yamlText) && typeof table === "object" && table !== null) {
|
|
10990
|
+
return _structure(table);
|
|
10991
|
+
}
|
|
10992
|
+
} catch {
|
|
10993
|
+
}
|
|
10994
|
+
}
|
|
10995
|
+
return _parse(yamlText);
|
|
10996
|
+
}
|
|
10911
10997
|
function surfaceRow(host, surface = DEFAULT_SURFACE, table = loadHostLowering()) {
|
|
10912
10998
|
return table.get(host)?.get(surface) ?? table.get(host)?.get(DEFAULT_SURFACE) ?? null;
|
|
10913
10999
|
}
|
|
@@ -10925,9 +11011,9 @@ function hostBindings(host, table = loadHostLowering()) {
|
|
|
10925
11011
|
|
|
10926
11012
|
// src/scripts/_lib/agent_settings.ts
|
|
10927
11013
|
import { createRequire as createRequire2 } from "node:module";
|
|
10928
|
-
import * as
|
|
11014
|
+
import * as fs18 from "node:fs";
|
|
10929
11015
|
import * as os6 from "node:os";
|
|
10930
|
-
import * as
|
|
11016
|
+
import * as path17 from "node:path";
|
|
10931
11017
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
10932
11018
|
|
|
10933
11019
|
// src/shared/settingsCarveOut.ts
|
|
@@ -11063,10 +11149,10 @@ var DEFAULT_PROJECT_FILE = ".agent-settings.yml";
|
|
|
11063
11149
|
var LOCAL_PROJECT_FILE = ".agent-settings.local.yml";
|
|
11064
11150
|
var LOCAL_PROJECT_SUBDIR = ["agents", "settings"];
|
|
11065
11151
|
function _local_settings_path(project_root) {
|
|
11066
|
-
return
|
|
11152
|
+
return path17.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
|
|
11067
11153
|
}
|
|
11068
11154
|
function _canonical_settings_path(project_root) {
|
|
11069
|
-
return
|
|
11155
|
+
return path17.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
|
|
11070
11156
|
}
|
|
11071
11157
|
var USER_GLOBAL_FILENAME = "agent-settings.yml";
|
|
11072
11158
|
function DEFAULT_USER_GLOBAL_FILE() {
|
|
@@ -11131,10 +11217,10 @@ var MERGEABLE_KEYS = [
|
|
|
11131
11217
|
// (ADR-271, road-to-design-intent-conformance 2.3).
|
|
11132
11218
|
"design.fidelity_mode"
|
|
11133
11219
|
];
|
|
11134
|
-
var TEMPLATE_RELATIVE =
|
|
11135
|
-
var _PACKAGE_ROOT =
|
|
11220
|
+
var TEMPLATE_RELATIVE = path17.join("src", "config", "agent-settings.template.yml");
|
|
11221
|
+
var _PACKAGE_ROOT = path17.resolve(path17.dirname(fileURLToPath3(import.meta.url)), "..", "..", "..");
|
|
11136
11222
|
function default_template_path() {
|
|
11137
|
-
return
|
|
11223
|
+
return path17.join(_PACKAGE_ROOT, TEMPLATE_RELATIVE);
|
|
11138
11224
|
}
|
|
11139
11225
|
function _is_placeholder(value) {
|
|
11140
11226
|
return typeof value === "string" && /^__[A-Z0-9_]+__$/.test(value);
|
|
@@ -11185,8 +11271,8 @@ var _AGENTS_DIR_MARKERS = [
|
|
|
11185
11271
|
var _LEGACY_ANCHOR_ENV = "AGENT_CONFIG_LEGACY_ANCHOR";
|
|
11186
11272
|
function _exists(p) {
|
|
11187
11273
|
try {
|
|
11188
|
-
|
|
11189
|
-
|
|
11274
|
+
fs18.lstatSync(p);
|
|
11275
|
+
fs18.statSync(p);
|
|
11190
11276
|
return true;
|
|
11191
11277
|
} catch {
|
|
11192
11278
|
return false;
|
|
@@ -11194,22 +11280,22 @@ function _exists(p) {
|
|
|
11194
11280
|
}
|
|
11195
11281
|
function _is_dir2(p) {
|
|
11196
11282
|
try {
|
|
11197
|
-
return
|
|
11283
|
+
return fs18.statSync(p).isDirectory();
|
|
11198
11284
|
} catch {
|
|
11199
11285
|
return false;
|
|
11200
11286
|
}
|
|
11201
11287
|
}
|
|
11202
11288
|
function _is_file(p) {
|
|
11203
11289
|
try {
|
|
11204
|
-
return
|
|
11290
|
+
return fs18.statSync(p).isFile();
|
|
11205
11291
|
} catch {
|
|
11206
11292
|
return false;
|
|
11207
11293
|
}
|
|
11208
11294
|
}
|
|
11209
11295
|
function _resolve(p) {
|
|
11210
|
-
const absolute =
|
|
11296
|
+
const absolute = path17.resolve(p);
|
|
11211
11297
|
try {
|
|
11212
|
-
return
|
|
11298
|
+
return fs18.realpathSync(absolute);
|
|
11213
11299
|
} catch {
|
|
11214
11300
|
return absolute;
|
|
11215
11301
|
}
|
|
@@ -11219,7 +11305,7 @@ function _ancestor_chain(start) {
|
|
|
11219
11305
|
let cursor = start;
|
|
11220
11306
|
for (; ; ) {
|
|
11221
11307
|
chain.push(cursor);
|
|
11222
|
-
const parent =
|
|
11308
|
+
const parent = path17.dirname(cursor);
|
|
11223
11309
|
if (parent === cursor) {
|
|
11224
11310
|
break;
|
|
11225
11311
|
}
|
|
@@ -11228,15 +11314,15 @@ function _ancestor_chain(start) {
|
|
|
11228
11314
|
return chain;
|
|
11229
11315
|
}
|
|
11230
11316
|
function _boundary_anchor_at(dir) {
|
|
11231
|
-
const agents_dir =
|
|
11317
|
+
const agents_dir = path17.join(dir, "agents");
|
|
11232
11318
|
if (_is_dir2(agents_dir)) {
|
|
11233
11319
|
for (const marker of _AGENTS_DIR_MARKERS) {
|
|
11234
|
-
if (_exists(
|
|
11320
|
+
if (_exists(path17.join(agents_dir, marker))) {
|
|
11235
11321
|
return ANCHOR_AGENTS_DIR;
|
|
11236
11322
|
}
|
|
11237
11323
|
}
|
|
11238
11324
|
}
|
|
11239
|
-
if (_exists(
|
|
11325
|
+
if (_exists(path17.join(dir, ".git"))) {
|
|
11240
11326
|
return ANCHOR_GIT;
|
|
11241
11327
|
}
|
|
11242
11328
|
return null;
|
|
@@ -11247,7 +11333,7 @@ function find_project_root_with_anchor(start) {
|
|
|
11247
11333
|
const chain = _ancestor_chain(current);
|
|
11248
11334
|
if (legacy) {
|
|
11249
11335
|
for (const candidate of chain) {
|
|
11250
|
-
if (_exists(
|
|
11336
|
+
if (_exists(path17.join(candidate, ".git"))) {
|
|
11251
11337
|
return [candidate, ANCHOR_GIT];
|
|
11252
11338
|
}
|
|
11253
11339
|
}
|
|
@@ -11261,7 +11347,7 @@ function find_project_root_with_anchor(start) {
|
|
|
11261
11347
|
}
|
|
11262
11348
|
let outermost = null;
|
|
11263
11349
|
for (const candidate of chain) {
|
|
11264
|
-
if (_exists(
|
|
11350
|
+
if (_exists(path17.join(candidate, DEFAULT_PROJECT_FILE))) {
|
|
11265
11351
|
outermost = candidate;
|
|
11266
11352
|
}
|
|
11267
11353
|
}
|
|
@@ -11305,7 +11391,7 @@ function _expanduser(p) {
|
|
|
11305
11391
|
return os6.homedir();
|
|
11306
11392
|
}
|
|
11307
11393
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
11308
|
-
return
|
|
11394
|
+
return path17.join(os6.homedir(), p.slice(2));
|
|
11309
11395
|
}
|
|
11310
11396
|
return p;
|
|
11311
11397
|
}
|
|
@@ -11334,13 +11420,13 @@ function resolve_project_root(arg, options = {}) {
|
|
|
11334
11420
|
function _resolve_cascade_paths(cwd, project_path) {
|
|
11335
11421
|
if (cwd === null) {
|
|
11336
11422
|
const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
|
|
11337
|
-
const parent =
|
|
11423
|
+
const parent = path17.dirname(legacy);
|
|
11338
11424
|
return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
|
|
11339
11425
|
}
|
|
11340
11426
|
const root = find_project_root(cwd);
|
|
11341
11427
|
if (root === null) {
|
|
11342
11428
|
const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
|
|
11343
|
-
const parent =
|
|
11429
|
+
const parent = path17.dirname(legacy);
|
|
11344
11430
|
return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
|
|
11345
11431
|
}
|
|
11346
11432
|
const cwd_resolved = _resolve(cwd);
|
|
@@ -11351,7 +11437,7 @@ function _resolve_cascade_paths(cwd, project_path) {
|
|
|
11351
11437
|
if (cursor === root) {
|
|
11352
11438
|
break;
|
|
11353
11439
|
}
|
|
11354
|
-
const parent =
|
|
11440
|
+
const parent = path17.dirname(cursor);
|
|
11355
11441
|
if (parent === cursor) {
|
|
11356
11442
|
break;
|
|
11357
11443
|
}
|
|
@@ -11359,7 +11445,7 @@ function _resolve_cascade_paths(cwd, project_path) {
|
|
|
11359
11445
|
}
|
|
11360
11446
|
chain.reverse();
|
|
11361
11447
|
return [
|
|
11362
|
-
...chain.map((d) =>
|
|
11448
|
+
...chain.map((d) => path17.join(d, DEFAULT_PROJECT_FILE)),
|
|
11363
11449
|
_canonical_settings_path(root),
|
|
11364
11450
|
_local_settings_path(root)
|
|
11365
11451
|
];
|
|
@@ -11438,16 +11524,16 @@ function _read_yaml(p) {
|
|
|
11438
11524
|
if (!_is_file(p)) {
|
|
11439
11525
|
return null;
|
|
11440
11526
|
}
|
|
11441
|
-
let
|
|
11527
|
+
let YAML6;
|
|
11442
11528
|
try {
|
|
11443
|
-
|
|
11529
|
+
YAML6 = _require2("yaml");
|
|
11444
11530
|
} catch {
|
|
11445
11531
|
return null;
|
|
11446
11532
|
}
|
|
11447
11533
|
let data;
|
|
11448
11534
|
try {
|
|
11449
|
-
const text =
|
|
11450
|
-
data =
|
|
11535
|
+
const text = fs18.readFileSync(p, "utf-8");
|
|
11536
|
+
data = YAML6.parse(text, { version: "1.1" });
|
|
11451
11537
|
if (data === null || data === void 0) {
|
|
11452
11538
|
data = {};
|
|
11453
11539
|
}
|
|
@@ -11546,14 +11632,14 @@ function _is_plain_dict(value) {
|
|
|
11546
11632
|
}
|
|
11547
11633
|
|
|
11548
11634
|
// src/install/rule_scope.ts
|
|
11549
|
-
import * as
|
|
11635
|
+
import * as path18 from "node:path";
|
|
11550
11636
|
|
|
11551
11637
|
// src/install/ruleInScope.ts
|
|
11552
|
-
var
|
|
11553
|
-
import * as
|
|
11638
|
+
var YAML5 = __toESM(require_dist(), 1);
|
|
11639
|
+
import * as fs19 from "node:fs";
|
|
11554
11640
|
function parseYaml3(text) {
|
|
11555
11641
|
try {
|
|
11556
|
-
const data =
|
|
11642
|
+
const data = YAML5.parse(text, { version: "1.1" });
|
|
11557
11643
|
return data === void 0 ? null : data;
|
|
11558
11644
|
} catch {
|
|
11559
11645
|
return null;
|
|
@@ -11588,7 +11674,7 @@ function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null)
|
|
|
11588
11674
|
if (scope === null && pack_scope === null && role_scope === null) {
|
|
11589
11675
|
return true;
|
|
11590
11676
|
}
|
|
11591
|
-
const [meta] = parseFrontmatter(
|
|
11677
|
+
const [meta] = parseFrontmatter(fs19.readFileSync(source_path, "utf-8"));
|
|
11592
11678
|
if (meta["type"] === "always" || meta["alwaysApply"] === true) {
|
|
11593
11679
|
return true;
|
|
11594
11680
|
}
|
|
@@ -11639,7 +11725,7 @@ function ruleFileArrives(sourcePath, scope) {
|
|
|
11639
11725
|
if (!sourcePath.endsWith(".md")) {
|
|
11640
11726
|
return true;
|
|
11641
11727
|
}
|
|
11642
|
-
const basename8 =
|
|
11728
|
+
const basename8 = path18.basename(sourcePath);
|
|
11643
11729
|
if (COMPAT_ALWAYS_EXCLUDED.includes(basename8)) {
|
|
11644
11730
|
return false;
|
|
11645
11731
|
}
|
|
@@ -11647,26 +11733,26 @@ function ruleFileArrives(sourcePath, scope) {
|
|
|
11647
11733
|
}
|
|
11648
11734
|
|
|
11649
11735
|
// src/install/partitionEligibility.ts
|
|
11650
|
-
import * as
|
|
11736
|
+
import * as fs21 from "node:fs";
|
|
11651
11737
|
import * as os7 from "node:os";
|
|
11652
11738
|
|
|
11653
11739
|
// src/install/hostLayerFingerprint.ts
|
|
11654
|
-
import { createHash as
|
|
11655
|
-
import * as
|
|
11656
|
-
import * as
|
|
11740
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
11741
|
+
import * as fs20 from "node:fs";
|
|
11742
|
+
import * as path19 from "node:path";
|
|
11657
11743
|
var FINGERPRINT_SCHEMA = 1;
|
|
11658
11744
|
function collectFiles(dir) {
|
|
11659
11745
|
const out = [];
|
|
11660
11746
|
const walk = (d) => {
|
|
11661
11747
|
let entries;
|
|
11662
11748
|
try {
|
|
11663
|
-
entries =
|
|
11749
|
+
entries = fs20.readdirSync(d, { withFileTypes: true });
|
|
11664
11750
|
} catch {
|
|
11665
11751
|
return;
|
|
11666
11752
|
}
|
|
11667
11753
|
const sorted = [...entries].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
11668
11754
|
for (const e of sorted) {
|
|
11669
|
-
const p =
|
|
11755
|
+
const p = path19.join(d, e.name);
|
|
11670
11756
|
if (e.isDirectory()) {
|
|
11671
11757
|
walk(p);
|
|
11672
11758
|
} else if (e.isFile()) {
|
|
@@ -11678,15 +11764,15 @@ function collectFiles(dir) {
|
|
|
11678
11764
|
return out.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
11679
11765
|
}
|
|
11680
11766
|
function fingerprintLayers(layers) {
|
|
11681
|
-
const h =
|
|
11767
|
+
const h = createHash6("sha256");
|
|
11682
11768
|
h.update(`v${FINGERPRINT_SCHEMA}\0`);
|
|
11683
11769
|
for (const layer of layers) {
|
|
11684
11770
|
h.update(`layer:${layer.label}\0`);
|
|
11685
11771
|
for (const file of collectFiles(layer.root)) {
|
|
11686
|
-
h.update(
|
|
11772
|
+
h.update(path19.relative(layer.root, file));
|
|
11687
11773
|
h.update("\0");
|
|
11688
11774
|
try {
|
|
11689
|
-
h.update(
|
|
11775
|
+
h.update(fs20.readFileSync(file));
|
|
11690
11776
|
} catch {
|
|
11691
11777
|
h.update("\0unreadable\0");
|
|
11692
11778
|
}
|
|
@@ -11696,11 +11782,11 @@ function fingerprintLayers(layers) {
|
|
|
11696
11782
|
return h.digest("hex");
|
|
11697
11783
|
}
|
|
11698
11784
|
function hostLayerInputs(userHome) {
|
|
11699
|
-
const claude =
|
|
11785
|
+
const claude = path19.join(userHome, ".claude");
|
|
11700
11786
|
return [
|
|
11701
|
-
{ label: "rules", root:
|
|
11702
|
-
{ label: "skills", root:
|
|
11703
|
-
{ label: "commands", root:
|
|
11787
|
+
{ label: "rules", root: path19.join(claude, "rules") },
|
|
11788
|
+
{ label: "skills", root: path19.join(claude, "skills") },
|
|
11789
|
+
{ label: "commands", root: path19.join(claude, "commands") }
|
|
11704
11790
|
];
|
|
11705
11791
|
}
|
|
11706
11792
|
|
|
@@ -11709,7 +11795,7 @@ var MAINTAINER_WORKSPACE = "agent-config-maintainer";
|
|
|
11709
11795
|
function isExclusivelyPackageOnly(source_path) {
|
|
11710
11796
|
let meta;
|
|
11711
11797
|
try {
|
|
11712
|
-
[meta] = parseFrontmatter(
|
|
11798
|
+
[meta] = parseFrontmatter(fs21.readFileSync(source_path, "utf-8"));
|
|
11713
11799
|
} catch {
|
|
11714
11800
|
return false;
|
|
11715
11801
|
}
|
|
@@ -11740,8 +11826,8 @@ function stampHostLayerFingerprint(installedVersion, tools, lockfilePath, skip2,
|
|
|
11740
11826
|
}
|
|
11741
11827
|
|
|
11742
11828
|
// src/install/claudeRuleRewrite.ts
|
|
11743
|
-
import * as
|
|
11744
|
-
import * as
|
|
11829
|
+
import * as fs22 from "node:fs";
|
|
11830
|
+
import * as path20 from "node:path";
|
|
11745
11831
|
|
|
11746
11832
|
// src/install/claudePathsPlan.ts
|
|
11747
11833
|
function derive_trigger_globs(meta) {
|
|
@@ -11897,23 +11983,23 @@ function rewriteClaudeRules(rulesDir, preserved = /* @__PURE__ */ new Set()) {
|
|
|
11897
11983
|
const result = { rewritten: 0, scoped: [], dropped: [], failed: [] };
|
|
11898
11984
|
let entries;
|
|
11899
11985
|
try {
|
|
11900
|
-
entries =
|
|
11986
|
+
entries = fs22.readdirSync(rulesDir);
|
|
11901
11987
|
} catch {
|
|
11902
11988
|
return result;
|
|
11903
11989
|
}
|
|
11904
11990
|
for (const name of entries.filter((n) => n.endsWith(".md")).sort()) {
|
|
11905
|
-
const full =
|
|
11906
|
-
if (preserved.has(
|
|
11991
|
+
const full = path20.join(rulesDir, name);
|
|
11992
|
+
if (preserved.has(path20.resolve(full))) continue;
|
|
11907
11993
|
let stat;
|
|
11908
11994
|
try {
|
|
11909
|
-
stat =
|
|
11995
|
+
stat = fs22.lstatSync(full);
|
|
11910
11996
|
} catch {
|
|
11911
11997
|
continue;
|
|
11912
11998
|
}
|
|
11913
11999
|
if (!stat.isFile() || stat.isSymbolicLink()) continue;
|
|
11914
12000
|
let text;
|
|
11915
12001
|
try {
|
|
11916
|
-
text =
|
|
12002
|
+
text = fs22.readFileSync(full, "utf-8");
|
|
11917
12003
|
} catch {
|
|
11918
12004
|
continue;
|
|
11919
12005
|
}
|
|
@@ -11923,7 +12009,7 @@ function rewriteClaudeRules(rulesDir, preserved = /* @__PURE__ */ new Set()) {
|
|
|
11923
12009
|
const withOwnership = _withPreservedKeys(rendered.text, text);
|
|
11924
12010
|
if (withOwnership !== text) {
|
|
11925
12011
|
try {
|
|
11926
|
-
|
|
12012
|
+
fs22.writeFileSync(full, withOwnership, "utf-8");
|
|
11927
12013
|
} catch (e) {
|
|
11928
12014
|
result.failed.push({
|
|
11929
12015
|
rule: name.slice(0, -3),
|
|
@@ -12493,8 +12579,8 @@ function getErrorMap() {
|
|
|
12493
12579
|
|
|
12494
12580
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
12495
12581
|
var makeIssue = (params) => {
|
|
12496
|
-
const { data, path:
|
|
12497
|
-
const fullPath = [...
|
|
12582
|
+
const { data, path: path25, errorMaps, issueData } = params;
|
|
12583
|
+
const fullPath = [...path25, ...issueData.path || []];
|
|
12498
12584
|
const fullIssue = {
|
|
12499
12585
|
...issueData,
|
|
12500
12586
|
path: fullPath
|
|
@@ -12610,11 +12696,11 @@ var errorUtil;
|
|
|
12610
12696
|
|
|
12611
12697
|
// node_modules/zod/v3/types.js
|
|
12612
12698
|
var ParseInputLazyPath = class {
|
|
12613
|
-
constructor(parent, value,
|
|
12699
|
+
constructor(parent, value, path25, key) {
|
|
12614
12700
|
this._cachedPath = [];
|
|
12615
12701
|
this.parent = parent;
|
|
12616
12702
|
this.data = value;
|
|
12617
|
-
this._path =
|
|
12703
|
+
this._path = path25;
|
|
12618
12704
|
this._key = key;
|
|
12619
12705
|
}
|
|
12620
12706
|
get path() {
|
|
@@ -16210,6 +16296,37 @@ var settingsSchema = external_exports.object({
|
|
|
16210
16296
|
"How a mission's work is shaped into pull requests. single (default) = one branch, one pull request. stacked = a dependent series. stacked is never chosen by the agent and never asked about at roadmap creation \u2014 the owner plans it or it does not happen."
|
|
16211
16297
|
)
|
|
16212
16298
|
}),
|
|
16299
|
+
/**
|
|
16300
|
+
* What this package may write into the HOST's own environment.
|
|
16301
|
+
*
|
|
16302
|
+
* THE GUARANTEE IS THE SHAPE, not a check. Only two keys exist here, and
|
|
16303
|
+
* both are request-SIZE caps. Neither traffic variable is expressible —
|
|
16304
|
+
* `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` and `DISABLE_AUTOUPDATER` both
|
|
16305
|
+
* reach the host's update-disabled resolver (the blanket one as its third
|
|
16306
|
+
* rung, measured on Claude Code 2.1.284), so a profile able to write either
|
|
16307
|
+
* could disable a consumer's security updates. Owner-decided 2026-09-30:
|
|
16308
|
+
* they are not writable through this package at all, and the strongest way
|
|
16309
|
+
* to hold that is a schema that cannot say them rather than an exclusion
|
|
16310
|
+
* list somebody has to maintain.
|
|
16311
|
+
*
|
|
16312
|
+
* `null` is the default on both, and it is the off switch: nothing is
|
|
16313
|
+
* written. There is no separate enable flag, because a flag plus a value is
|
|
16314
|
+
* two ways to say off and one of them would drift.
|
|
16315
|
+
*/
|
|
16316
|
+
host_environment: external_exports.object({
|
|
16317
|
+
request_size_caps: external_exports.object({
|
|
16318
|
+
bash_max_output_length: external_exports.number().int().positive().max(15e4).nullable().default(null).describe(
|
|
16319
|
+
"Character cap on Bash tool output the host places inline into a model request. null (default) = this package writes nothing and the host default of 30000 applies. A number is written into the host env block. Values above 150000 are capped by the host itself, so the schema refuses them here rather than writing a value the host silently changes. Bounds request SIZE, never request COUNT: lowering it suppresses no telemetry, no update check and no download."
|
|
16320
|
+
),
|
|
16321
|
+
max_mcp_output_tokens: external_exports.number().int().positive().nullable().default(null).describe(
|
|
16322
|
+
"Token cap on a single MCP tool result the host places into a model request. null (default) = nothing written, host default 25000 applies. Same size-not-count caveat: it does not govern MCP connections, timeouts, or whether a tool runs."
|
|
16323
|
+
)
|
|
16324
|
+
}).default({}).describe(
|
|
16325
|
+
"Request-size caps this package may write into the host env block. Both null by default. No traffic or auto-updater variable is expressible here, by construction \u2014 see the block comment."
|
|
16326
|
+
)
|
|
16327
|
+
}).default({}).describe(
|
|
16328
|
+
'What this package may write into the host environment. ABSENT resolves to the all-null shape, which is the same thing as off \u2014 a settings file predating this section must not fail to parse, and "no section" and "both caps null" both mean write nothing.'
|
|
16329
|
+
),
|
|
16213
16330
|
augment: external_exports.object({
|
|
16214
16331
|
rules_use_symlinks: external_exports.boolean().default(false).describe(
|
|
16215
16332
|
"When true, .augment/rules/*.md are symlinks into dist/agent-src/rules/ \u2014 edits flow back to source on save. When false (default), they are copies \u2014 safer on Windows and shared volumes, but rule edits in .augment/ are lost on the next `task sync`."
|
|
@@ -17959,8 +18076,8 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
17959
18076
|
};
|
|
17960
18077
|
|
|
17961
18078
|
// src/scripts/_lib/module_detection.ts
|
|
17962
|
-
import * as
|
|
17963
|
-
import * as
|
|
18079
|
+
import * as fs23 from "node:fs";
|
|
18080
|
+
import * as path21 from "node:path";
|
|
17964
18081
|
var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
|
|
17965
18082
|
var _RULES = [
|
|
17966
18083
|
["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
|
|
@@ -17974,14 +18091,14 @@ var _RULES = [
|
|
|
17974
18091
|
];
|
|
17975
18092
|
function _isDir(p) {
|
|
17976
18093
|
try {
|
|
17977
|
-
return
|
|
18094
|
+
return fs23.statSync(p).isDirectory();
|
|
17978
18095
|
} catch {
|
|
17979
18096
|
return false;
|
|
17980
18097
|
}
|
|
17981
18098
|
}
|
|
17982
18099
|
function _isFile(p) {
|
|
17983
18100
|
try {
|
|
17984
|
-
return
|
|
18101
|
+
return fs23.statSync(p).isFile();
|
|
17985
18102
|
} catch {
|
|
17986
18103
|
return false;
|
|
17987
18104
|
}
|
|
@@ -17995,13 +18112,13 @@ function _isUpperChar(ch) {
|
|
|
17995
18112
|
function _list_module_subdirs(root) {
|
|
17996
18113
|
let entries;
|
|
17997
18114
|
try {
|
|
17998
|
-
entries =
|
|
18115
|
+
entries = fs23.readdirSync(root).sort();
|
|
17999
18116
|
} catch {
|
|
18000
18117
|
return [];
|
|
18001
18118
|
}
|
|
18002
18119
|
const out = [];
|
|
18003
18120
|
for (const name of entries) {
|
|
18004
|
-
if (!_isDir(
|
|
18121
|
+
if (!_isDir(path21.join(root, name))) {
|
|
18005
18122
|
continue;
|
|
18006
18123
|
}
|
|
18007
18124
|
if (name.startsWith(".")) {
|
|
@@ -18023,11 +18140,11 @@ function _score_confidence(stack, root, subdirs) {
|
|
|
18023
18140
|
return capitalized.length > 0 ? "high" : "medium";
|
|
18024
18141
|
}
|
|
18025
18142
|
if (stack === "node-monorepo") {
|
|
18026
|
-
const withPkgJson = subdirs.filter((name) => _isFile(
|
|
18143
|
+
const withPkgJson = subdirs.filter((name) => _isFile(path21.join(root, name, "package.json")));
|
|
18027
18144
|
return withPkgJson.length > 0 ? "high" : "medium";
|
|
18028
18145
|
}
|
|
18029
18146
|
if (stack === "python-src") {
|
|
18030
|
-
const withInit = subdirs.filter((name) => _isFile(
|
|
18147
|
+
const withInit = subdirs.filter((name) => _isFile(path21.join(root, name, "__init__.py")));
|
|
18031
18148
|
return withInit.length > 0 ? "high" : "medium";
|
|
18032
18149
|
}
|
|
18033
18150
|
if (stack === "go-internal") {
|
|
@@ -18039,7 +18156,7 @@ function detect_module_roots(project_root) {
|
|
|
18039
18156
|
const high = [];
|
|
18040
18157
|
const medium = [];
|
|
18041
18158
|
for (const [rel_path, stack, namespace_template] of _RULES) {
|
|
18042
|
-
const abs_path =
|
|
18159
|
+
const abs_path = path21.join(project_root, rel_path);
|
|
18043
18160
|
if (!_isDir(abs_path)) {
|
|
18044
18161
|
continue;
|
|
18045
18162
|
}
|
|
@@ -18061,7 +18178,7 @@ function detect_module_roots(project_root) {
|
|
|
18061
18178
|
}
|
|
18062
18179
|
|
|
18063
18180
|
// src/scripts/_lib/model_tier.ts
|
|
18064
|
-
import
|
|
18181
|
+
import fs24 from "node:fs";
|
|
18065
18182
|
var TIER_TO_CLAUDE_MODEL = {
|
|
18066
18183
|
frontier: "fable",
|
|
18067
18184
|
high: "opus",
|
|
@@ -18070,8 +18187,8 @@ var TIER_TO_CLAUDE_MODEL = {
|
|
|
18070
18187
|
};
|
|
18071
18188
|
var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
|
|
18072
18189
|
function read_model_tier(skill_md) {
|
|
18073
|
-
if (!
|
|
18074
|
-
const text =
|
|
18190
|
+
if (!fs24.existsSync(skill_md)) return null;
|
|
18191
|
+
const text = fs24.readFileSync(skill_md).toString("utf-8");
|
|
18075
18192
|
if (!text.startsWith("---\n")) return null;
|
|
18076
18193
|
const end = text.indexOf("\n---\n", 4);
|
|
18077
18194
|
if (end === -1) return null;
|
|
@@ -18088,39 +18205,39 @@ function render_native_model_md(text, tier) {
|
|
|
18088
18205
|
|
|
18089
18206
|
// src/scripts/_cli/cmd_migrate.ts
|
|
18090
18207
|
import { spawnSync } from "node:child_process";
|
|
18091
|
-
import * as
|
|
18092
|
-
import * as
|
|
18208
|
+
import * as fs26 from "node:fs";
|
|
18209
|
+
import * as path23 from "node:path";
|
|
18093
18210
|
import process3 from "node:process";
|
|
18094
18211
|
import { fileURLToPath as fileURLToPath5, pathToFileURL } from "node:url";
|
|
18095
18212
|
|
|
18096
18213
|
// src/scripts/_lib/package_root.ts
|
|
18097
|
-
import * as
|
|
18098
|
-
import * as
|
|
18214
|
+
import * as fs25 from "node:fs";
|
|
18215
|
+
import * as path22 from "node:path";
|
|
18099
18216
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
18100
18217
|
var PACKAGE_NAME = "@event4u/agent-config";
|
|
18101
18218
|
var MAX_ASCENT = 16;
|
|
18102
18219
|
function resolvePackageRoot(fromUrlOrPath, legacyHops = 3) {
|
|
18103
18220
|
const start = fromUrlOrPath.startsWith("file:") ? fileURLToPath4(fromUrlOrPath) : fromUrlOrPath;
|
|
18104
|
-
const startDir =
|
|
18221
|
+
const startDir = path22.dirname(start);
|
|
18105
18222
|
let dir = startDir;
|
|
18106
18223
|
for (let i = 0; i < MAX_ASCENT; i++) {
|
|
18107
|
-
const manifest =
|
|
18108
|
-
if (
|
|
18224
|
+
const manifest = path22.join(dir, "package.json");
|
|
18225
|
+
if (fs25.existsSync(manifest)) {
|
|
18109
18226
|
try {
|
|
18110
|
-
const parsed = JSON.parse(
|
|
18227
|
+
const parsed = JSON.parse(fs25.readFileSync(manifest, "utf8"));
|
|
18111
18228
|
if (parsed.name === PACKAGE_NAME) {
|
|
18112
18229
|
return dir;
|
|
18113
18230
|
}
|
|
18114
18231
|
} catch {
|
|
18115
18232
|
}
|
|
18116
18233
|
}
|
|
18117
|
-
const parent =
|
|
18234
|
+
const parent = path22.dirname(dir);
|
|
18118
18235
|
if (parent === dir) {
|
|
18119
18236
|
break;
|
|
18120
18237
|
}
|
|
18121
18238
|
dir = parent;
|
|
18122
18239
|
}
|
|
18123
|
-
return
|
|
18240
|
+
return path22.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
|
|
18124
18241
|
}
|
|
18125
18242
|
|
|
18126
18243
|
// src/scripts/_cli/cmd_migrate.ts
|
|
@@ -18141,7 +18258,7 @@ var LEGACY_SETTINGS_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
|
18141
18258
|
var LEGACY_STATE_FILENAME = ".implement-ticket-state.json";
|
|
18142
18259
|
var LEGACY_STATE_V1_FILENAME = ".work-state.json";
|
|
18143
18260
|
var LEGACY_AGENT_CONFIG_SHELL = "agent-config";
|
|
18144
|
-
var _HERE_DIR =
|
|
18261
|
+
var _HERE_DIR = path23.dirname(fileURLToPath5(import.meta.url));
|
|
18145
18262
|
var ArgparseExit = class extends Error {
|
|
18146
18263
|
code;
|
|
18147
18264
|
constructor(code) {
|
|
@@ -18240,38 +18357,38 @@ function _jsonDumpsIndentAscii(value, indent) {
|
|
|
18240
18357
|
}
|
|
18241
18358
|
function _isFile2(p) {
|
|
18242
18359
|
try {
|
|
18243
|
-
return
|
|
18360
|
+
return fs26.statSync(p).isFile();
|
|
18244
18361
|
} catch {
|
|
18245
18362
|
return false;
|
|
18246
18363
|
}
|
|
18247
18364
|
}
|
|
18248
18365
|
function _isDir2(p) {
|
|
18249
18366
|
try {
|
|
18250
|
-
return
|
|
18367
|
+
return fs26.statSync(p).isDirectory();
|
|
18251
18368
|
} catch {
|
|
18252
18369
|
return false;
|
|
18253
18370
|
}
|
|
18254
18371
|
}
|
|
18255
18372
|
function _isSymlink(p) {
|
|
18256
18373
|
try {
|
|
18257
|
-
return
|
|
18374
|
+
return fs26.lstatSync(p).isSymbolicLink();
|
|
18258
18375
|
} catch {
|
|
18259
18376
|
return false;
|
|
18260
18377
|
}
|
|
18261
18378
|
}
|
|
18262
18379
|
function _exists2(p) {
|
|
18263
18380
|
try {
|
|
18264
|
-
|
|
18381
|
+
fs26.lstatSync(p);
|
|
18265
18382
|
return true;
|
|
18266
18383
|
} catch {
|
|
18267
18384
|
return false;
|
|
18268
18385
|
}
|
|
18269
18386
|
}
|
|
18270
18387
|
function _readText(p) {
|
|
18271
|
-
return
|
|
18388
|
+
return fs26.readFileSync(p, { encoding: "utf-8" });
|
|
18272
18389
|
}
|
|
18273
18390
|
function _writeText(p, text) {
|
|
18274
|
-
|
|
18391
|
+
fs26.writeFileSync(p, text, { encoding: "utf-8" });
|
|
18275
18392
|
}
|
|
18276
18393
|
function _jsonLoadFile(p) {
|
|
18277
18394
|
return JSON.parse(_readText(p));
|
|
@@ -18327,7 +18444,7 @@ function _classify_symlink(link) {
|
|
|
18327
18444
|
}
|
|
18328
18445
|
let target;
|
|
18329
18446
|
try {
|
|
18330
|
-
target =
|
|
18447
|
+
target = fs26.readlinkSync(link);
|
|
18331
18448
|
} catch {
|
|
18332
18449
|
return null;
|
|
18333
18450
|
}
|
|
@@ -18338,16 +18455,16 @@ function _classify_symlink(link) {
|
|
|
18338
18455
|
return "user";
|
|
18339
18456
|
}
|
|
18340
18457
|
function _detect_legacy_state(project) {
|
|
18341
|
-
return _isFile2(
|
|
18458
|
+
return _isFile2(path23.join(project, LEGACY_STATE_FILENAME));
|
|
18342
18459
|
}
|
|
18343
18460
|
function _detect_legacy_settings(project) {
|
|
18344
18461
|
const found = [];
|
|
18345
18462
|
for (const name of LEGACY_SETTINGS_FILES) {
|
|
18346
|
-
const flat =
|
|
18463
|
+
const flat = path23.join(project, name);
|
|
18347
18464
|
if (_isFile2(flat)) {
|
|
18348
18465
|
found.push(flat);
|
|
18349
18466
|
}
|
|
18350
|
-
const typed =
|
|
18467
|
+
const typed = path23.join(project, "settings", name);
|
|
18351
18468
|
if (_isFile2(typed)) {
|
|
18352
18469
|
found.push(typed);
|
|
18353
18470
|
}
|
|
@@ -18355,25 +18472,25 @@ function _detect_legacy_settings(project) {
|
|
|
18355
18472
|
return found;
|
|
18356
18473
|
}
|
|
18357
18474
|
function _detect_empty_shell(project) {
|
|
18358
|
-
const shell =
|
|
18475
|
+
const shell = path23.join(project, LEGACY_AGENT_CONFIG_SHELL);
|
|
18359
18476
|
if (!_isDir2(shell) || _isSymlink(shell)) {
|
|
18360
18477
|
return false;
|
|
18361
18478
|
}
|
|
18362
18479
|
try {
|
|
18363
|
-
return
|
|
18480
|
+
return fs26.readdirSync(shell).length === 0;
|
|
18364
18481
|
} catch {
|
|
18365
18482
|
return false;
|
|
18366
18483
|
}
|
|
18367
18484
|
}
|
|
18368
18485
|
function _detect_already_migrated(project) {
|
|
18369
|
-
if (_detect_npm(
|
|
18486
|
+
if (_detect_npm(path23.join(project, "package.json"))) {
|
|
18370
18487
|
return false;
|
|
18371
18488
|
}
|
|
18372
|
-
if (_detect_composer(
|
|
18489
|
+
if (_detect_composer(path23.join(project, "composer.json"))) {
|
|
18373
18490
|
return false;
|
|
18374
18491
|
}
|
|
18375
18492
|
for (const name of MANAGED_SYMLINKS) {
|
|
18376
|
-
if (_classify_symlink(
|
|
18493
|
+
if (_classify_symlink(path23.join(project, name)) === "legacy") {
|
|
18377
18494
|
return false;
|
|
18378
18495
|
}
|
|
18379
18496
|
}
|
|
@@ -18444,11 +18561,11 @@ function _purge_legacy_symlinks(project) {
|
|
|
18444
18561
|
const removed = [];
|
|
18445
18562
|
const preserved = [];
|
|
18446
18563
|
for (const name of MANAGED_SYMLINKS) {
|
|
18447
|
-
const link =
|
|
18564
|
+
const link = path23.join(project, name);
|
|
18448
18565
|
const kind = _classify_symlink(link);
|
|
18449
18566
|
if (kind === "legacy") {
|
|
18450
18567
|
try {
|
|
18451
|
-
|
|
18568
|
+
fs26.unlinkSync(link);
|
|
18452
18569
|
removed.push(name);
|
|
18453
18570
|
} catch {
|
|
18454
18571
|
preserved.push(name);
|
|
@@ -18460,14 +18577,14 @@ function _purge_legacy_symlinks(project) {
|
|
|
18460
18577
|
return [removed, preserved];
|
|
18461
18578
|
}
|
|
18462
18579
|
function _migrate_state_file(project) {
|
|
18463
|
-
const source =
|
|
18580
|
+
const source = path23.join(project, LEGACY_STATE_FILENAME);
|
|
18464
18581
|
if (!_isFile2(source)) {
|
|
18465
18582
|
return null;
|
|
18466
18583
|
}
|
|
18467
|
-
const target =
|
|
18584
|
+
const target = path23.join(project, LEGACY_STATE_V1_FILENAME);
|
|
18468
18585
|
if (_exists2(target)) {
|
|
18469
18586
|
try {
|
|
18470
|
-
|
|
18587
|
+
fs26.unlinkSync(source);
|
|
18471
18588
|
return `removed stale ${LEGACY_STATE_FILENAME} (v1 already present)`;
|
|
18472
18589
|
} catch {
|
|
18473
18590
|
return null;
|
|
@@ -18482,7 +18599,7 @@ function _migrate_state_file(project) {
|
|
|
18482
18599
|
}
|
|
18483
18600
|
function _load_state_migrator() {
|
|
18484
18601
|
const pkg_root = resolvePackageRoot(import.meta.url);
|
|
18485
|
-
const rel =
|
|
18602
|
+
const rel = path23.join(
|
|
18486
18603
|
"agent-src",
|
|
18487
18604
|
"templates",
|
|
18488
18605
|
"scripts",
|
|
@@ -18490,8 +18607,8 @@ function _load_state_migrator() {
|
|
|
18490
18607
|
"migration",
|
|
18491
18608
|
"v0_to_v1.ts"
|
|
18492
18609
|
);
|
|
18493
|
-
const driver = [
|
|
18494
|
-
(p) =>
|
|
18610
|
+
const driver = [path23.join(pkg_root, "dist", rel), path23.join(pkg_root, "src", rel)].find(
|
|
18611
|
+
(p) => fs26.existsSync(p)
|
|
18495
18612
|
) ?? null;
|
|
18496
18613
|
if (driver === null) {
|
|
18497
18614
|
return null;
|
|
@@ -18499,12 +18616,12 @@ function _load_state_migrator() {
|
|
|
18499
18616
|
const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
18500
18617
|
let tsxBin = null;
|
|
18501
18618
|
for (let dir = pkg_root; ; ) {
|
|
18502
|
-
const cand =
|
|
18503
|
-
if (
|
|
18619
|
+
const cand = path23.join(dir, "node_modules", ".bin", binName);
|
|
18620
|
+
if (fs26.existsSync(cand)) {
|
|
18504
18621
|
tsxBin = cand;
|
|
18505
18622
|
break;
|
|
18506
18623
|
}
|
|
18507
|
-
const parent =
|
|
18624
|
+
const parent = path23.dirname(dir);
|
|
18508
18625
|
if (parent === dir) break;
|
|
18509
18626
|
dir = parent;
|
|
18510
18627
|
}
|
|
@@ -18531,17 +18648,17 @@ function _delete_legacy_settings(project) {
|
|
|
18531
18648
|
const removed = [];
|
|
18532
18649
|
for (const p of _detect_legacy_settings(project)) {
|
|
18533
18650
|
try {
|
|
18534
|
-
|
|
18535
|
-
removed.push(
|
|
18651
|
+
fs26.unlinkSync(p);
|
|
18652
|
+
removed.push(path23.relative(project, p));
|
|
18536
18653
|
} catch {
|
|
18537
18654
|
continue;
|
|
18538
18655
|
}
|
|
18539
18656
|
}
|
|
18540
|
-
const settings_dir =
|
|
18657
|
+
const settings_dir = path23.join(project, "settings");
|
|
18541
18658
|
if (_isDir2(settings_dir) && !_isSymlink(settings_dir)) {
|
|
18542
18659
|
try {
|
|
18543
|
-
if (
|
|
18544
|
-
|
|
18660
|
+
if (fs26.readdirSync(settings_dir).length === 0) {
|
|
18661
|
+
fs26.rmdirSync(settings_dir);
|
|
18545
18662
|
removed.push("settings/");
|
|
18546
18663
|
}
|
|
18547
18664
|
} catch {
|
|
@@ -18550,12 +18667,12 @@ function _delete_legacy_settings(project) {
|
|
|
18550
18667
|
return removed;
|
|
18551
18668
|
}
|
|
18552
18669
|
function _remove_empty_shell(project) {
|
|
18553
|
-
const shell =
|
|
18670
|
+
const shell = path23.join(project, LEGACY_AGENT_CONFIG_SHELL);
|
|
18554
18671
|
if (!_detect_empty_shell(project)) {
|
|
18555
18672
|
return false;
|
|
18556
18673
|
}
|
|
18557
18674
|
try {
|
|
18558
|
-
|
|
18675
|
+
fs26.rmdirSync(shell);
|
|
18559
18676
|
} catch {
|
|
18560
18677
|
return false;
|
|
18561
18678
|
}
|
|
@@ -18565,7 +18682,7 @@ function _reEscape(s) {
|
|
|
18565
18682
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
18566
18683
|
}
|
|
18567
18684
|
function _update_gitignore(project) {
|
|
18568
|
-
const gitignore =
|
|
18685
|
+
const gitignore = path23.join(project, ".gitignore");
|
|
18569
18686
|
const block = `${GITIGNORE_BLOCK_START}
|
|
18570
18687
|
${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
|
|
18571
18688
|
`;
|
|
@@ -18596,16 +18713,16 @@ ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
|
|
|
18596
18713
|
}
|
|
18597
18714
|
function _build_plan(project) {
|
|
18598
18715
|
return {
|
|
18599
|
-
npm: _detect_npm(
|
|
18600
|
-
composer: _detect_composer(
|
|
18716
|
+
npm: _detect_npm(path23.join(project, "package.json")),
|
|
18717
|
+
composer: _detect_composer(path23.join(project, "composer.json")),
|
|
18601
18718
|
symlinks_legacy: MANAGED_SYMLINKS.filter(
|
|
18602
|
-
(name) => _classify_symlink(
|
|
18719
|
+
(name) => _classify_symlink(path23.join(project, name)) === "legacy"
|
|
18603
18720
|
),
|
|
18604
18721
|
symlinks_user: MANAGED_SYMLINKS.filter(
|
|
18605
|
-
(name) => _classify_symlink(
|
|
18722
|
+
(name) => _classify_symlink(path23.join(project, name)) === "user"
|
|
18606
18723
|
),
|
|
18607
|
-
state_file: _isFile2(
|
|
18608
|
-
settings_files: _detect_legacy_settings(project).map((p) =>
|
|
18724
|
+
state_file: _isFile2(path23.join(project, LEGACY_STATE_FILENAME)),
|
|
18725
|
+
settings_files: _detect_legacy_settings(project).map((p) => path23.relative(project, p)),
|
|
18609
18726
|
empty_shell: _detect_empty_shell(project)
|
|
18610
18727
|
};
|
|
18611
18728
|
}
|
|
@@ -18669,10 +18786,10 @@ function _warn_on_major_mismatch(from_major, plan, out) {
|
|
|
18669
18786
|
}
|
|
18670
18787
|
function _apply(project, out, err) {
|
|
18671
18788
|
const summary = [];
|
|
18672
|
-
if (_strip_npm_entry(
|
|
18789
|
+
if (_strip_npm_entry(path23.join(project, "package.json"))) {
|
|
18673
18790
|
summary.push(`removed ${PACKAGE_NAME_NPM} from package.json`);
|
|
18674
18791
|
}
|
|
18675
|
-
if (_strip_composer_entry(
|
|
18792
|
+
if (_strip_composer_entry(path23.join(project, "composer.json"))) {
|
|
18676
18793
|
summary.push(`removed ${PACKAGE_NAME_COMPOSER} from composer.json`);
|
|
18677
18794
|
}
|
|
18678
18795
|
const [removed_links, preserved_links] = _purge_legacy_symlinks(project);
|
|
@@ -18799,17 +18916,17 @@ function _isCliEntry() {
|
|
|
18799
18916
|
return false;
|
|
18800
18917
|
}
|
|
18801
18918
|
if (typeof __AGENT_CONFIG_CLI_DELEGATE__ !== "undefined" && __AGENT_CONFIG_CLI_DELEGATE__) {
|
|
18802
|
-
if (
|
|
18919
|
+
if (path23.basename(process3.argv[1], ".js") === "cmd_migrate") {
|
|
18803
18920
|
return true;
|
|
18804
18921
|
}
|
|
18805
18922
|
}
|
|
18806
|
-
const argvUrl = pathToFileURL(
|
|
18923
|
+
const argvUrl = pathToFileURL(path23.resolve(process3.argv[1])).href;
|
|
18807
18924
|
if (import.meta.url === argvUrl) {
|
|
18808
18925
|
return true;
|
|
18809
18926
|
}
|
|
18810
18927
|
try {
|
|
18811
|
-
const here =
|
|
18812
|
-
const argv =
|
|
18928
|
+
const here = fs26.realpathSync(fileURLToPath5(import.meta.url));
|
|
18929
|
+
const argv = fs26.realpathSync(path23.resolve(process3.argv[1]));
|
|
18813
18930
|
return here === argv;
|
|
18814
18931
|
} catch {
|
|
18815
18932
|
return false;
|
|
@@ -18853,7 +18970,7 @@ var SCOPE_DETECT_AI_DIRS = [
|
|
|
18853
18970
|
|
|
18854
18971
|
// src/install/paths.ts
|
|
18855
18972
|
import { homedir as homedir10, tmpdir } from "node:os";
|
|
18856
|
-
import { join as
|
|
18973
|
+
import { join as join25 } from "node:path";
|
|
18857
18974
|
var INSTALL_ROOT_SUBPATH = ".event4u/agent-config";
|
|
18858
18975
|
var INSTALL_LOG_FILENAME = "install-log.jsonl";
|
|
18859
18976
|
function resolveHome(home) {
|
|
@@ -18869,15 +18986,15 @@ function resolveHome(home) {
|
|
|
18869
18986
|
return fromOs;
|
|
18870
18987
|
}
|
|
18871
18988
|
function getInstallRoot(home) {
|
|
18872
|
-
return
|
|
18989
|
+
return join25(resolveHome(home), INSTALL_ROOT_SUBPATH);
|
|
18873
18990
|
}
|
|
18874
18991
|
function getLogPath(home) {
|
|
18875
|
-
return
|
|
18992
|
+
return join25(getInstallRoot(home), INSTALL_LOG_FILENAME);
|
|
18876
18993
|
}
|
|
18877
18994
|
|
|
18878
18995
|
// src/install/txlog.ts
|
|
18879
18996
|
import { createGzip } from "node:zlib";
|
|
18880
|
-
import { createReadStream, createWriteStream, existsSync as existsSync12, readFileSync as
|
|
18997
|
+
import { createReadStream, createWriteStream, existsSync as existsSync12, readFileSync as readFileSync25, renameSync as renameSync7, statSync as statSync10, unlinkSync as unlinkSync8 } from "node:fs";
|
|
18881
18998
|
import { pipeline } from "node:stream/promises";
|
|
18882
18999
|
var ROTATION_MAX_BYTES = 10 * 1024 * 1024;
|
|
18883
19000
|
var ROTATION_MAX_AGE_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
@@ -18926,7 +19043,7 @@ async function gzipInPlace(source) {
|
|
|
18926
19043
|
}
|
|
18927
19044
|
function readFirstTimestamp(logPath) {
|
|
18928
19045
|
try {
|
|
18929
|
-
const raw =
|
|
19046
|
+
const raw = readFileSync25(logPath, "utf8");
|
|
18930
19047
|
const firstLine = raw.split("\n", 1)[0] ?? "";
|
|
18931
19048
|
const parsed = tryParseEntry(firstLine);
|
|
18932
19049
|
if (parsed === null) return null;
|
|
@@ -18967,41 +19084,41 @@ var ArgparseExit2 = class extends Error {
|
|
|
18967
19084
|
function expanduser8(p) {
|
|
18968
19085
|
if (p === "~") return os8.homedir();
|
|
18969
19086
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
18970
|
-
return
|
|
19087
|
+
return path24.join(os8.homedir(), p.slice(2));
|
|
18971
19088
|
}
|
|
18972
19089
|
return p;
|
|
18973
19090
|
}
|
|
18974
19091
|
function isFile(p) {
|
|
18975
19092
|
try {
|
|
18976
|
-
return
|
|
19093
|
+
return fs27.statSync(p).isFile();
|
|
18977
19094
|
} catch {
|
|
18978
19095
|
return false;
|
|
18979
19096
|
}
|
|
18980
19097
|
}
|
|
18981
19098
|
function isDir(p) {
|
|
18982
19099
|
try {
|
|
18983
|
-
return
|
|
19100
|
+
return fs27.statSync(p).isDirectory();
|
|
18984
19101
|
} catch {
|
|
18985
19102
|
return false;
|
|
18986
19103
|
}
|
|
18987
19104
|
}
|
|
18988
19105
|
function isSymlink(p) {
|
|
18989
19106
|
try {
|
|
18990
|
-
return
|
|
19107
|
+
return fs27.lstatSync(p).isSymbolicLink();
|
|
18991
19108
|
} catch {
|
|
18992
19109
|
return false;
|
|
18993
19110
|
}
|
|
18994
19111
|
}
|
|
18995
19112
|
function readText(p) {
|
|
18996
|
-
return
|
|
19113
|
+
return fs27.readFileSync(p, "utf-8");
|
|
18997
19114
|
}
|
|
18998
19115
|
function writeText(p, content) {
|
|
18999
|
-
|
|
19116
|
+
fs27.writeFileSync(p, content, "utf-8");
|
|
19000
19117
|
}
|
|
19001
19118
|
function sortedGlobStems(directory, suffix) {
|
|
19002
19119
|
let entries;
|
|
19003
19120
|
try {
|
|
19004
|
-
entries =
|
|
19121
|
+
entries = fs27.readdirSync(directory);
|
|
19005
19122
|
} catch {
|
|
19006
19123
|
return [];
|
|
19007
19124
|
}
|
|
@@ -19021,34 +19138,34 @@ function sortedGlobStems(directory, suffix) {
|
|
|
19021
19138
|
function countZips(directory) {
|
|
19022
19139
|
if (!isDir(directory)) return 0;
|
|
19023
19140
|
let n = 0;
|
|
19024
|
-
for (const name of
|
|
19141
|
+
for (const name of fs27.readdirSync(directory)) {
|
|
19025
19142
|
if (name.endsWith(".zip")) n += 1;
|
|
19026
19143
|
}
|
|
19027
19144
|
return n;
|
|
19028
19145
|
}
|
|
19029
19146
|
function atomicWrite0644(target, body, prefix) {
|
|
19030
|
-
const dir =
|
|
19031
|
-
const tmpName =
|
|
19147
|
+
const dir = path24.dirname(target);
|
|
19148
|
+
const tmpName = path24.join(
|
|
19032
19149
|
dir,
|
|
19033
19150
|
`${prefix}${process4.pid}.${crypto5.randomBytes(6).toString("hex")}.yml.tmp`
|
|
19034
19151
|
);
|
|
19035
19152
|
let fd = null;
|
|
19036
19153
|
try {
|
|
19037
|
-
fd =
|
|
19038
|
-
|
|
19039
|
-
|
|
19154
|
+
fd = fs27.openSync(tmpName, "wx", 420);
|
|
19155
|
+
fs27.writeFileSync(fd, body, "utf-8");
|
|
19156
|
+
fs27.closeSync(fd);
|
|
19040
19157
|
fd = null;
|
|
19041
|
-
|
|
19042
|
-
|
|
19158
|
+
fs27.chmodSync(tmpName, 420);
|
|
19159
|
+
fs27.renameSync(tmpName, target);
|
|
19043
19160
|
} catch (err) {
|
|
19044
19161
|
if (fd !== null) {
|
|
19045
19162
|
try {
|
|
19046
|
-
|
|
19163
|
+
fs27.closeSync(fd);
|
|
19047
19164
|
} catch {
|
|
19048
19165
|
}
|
|
19049
19166
|
}
|
|
19050
19167
|
try {
|
|
19051
|
-
|
|
19168
|
+
fs27.unlinkSync(tmpName);
|
|
19052
19169
|
} catch {
|
|
19053
19170
|
}
|
|
19054
19171
|
throw err;
|
|
@@ -19060,14 +19177,14 @@ function utcStamp(now) {
|
|
|
19060
19177
|
return `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}Z`;
|
|
19061
19178
|
}
|
|
19062
19179
|
function yamlSafeLoad2(text) {
|
|
19063
|
-
let
|
|
19180
|
+
let YAML6;
|
|
19064
19181
|
try {
|
|
19065
|
-
|
|
19182
|
+
YAML6 = require_dist();
|
|
19066
19183
|
} catch {
|
|
19067
19184
|
return null;
|
|
19068
19185
|
}
|
|
19069
19186
|
try {
|
|
19070
|
-
const data =
|
|
19187
|
+
const data = YAML6.parse(text, { version: "1.1" });
|
|
19071
19188
|
return data;
|
|
19072
19189
|
} catch {
|
|
19073
19190
|
return void 0;
|
|
@@ -19083,12 +19200,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
|
|
|
19083
19200
|
var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
|
|
19084
19201
|
var SETTINGS_SUBDIR = ["agents", "settings"];
|
|
19085
19202
|
function _canonical_settings_target(project_root) {
|
|
19086
|
-
return
|
|
19203
|
+
return path24.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
|
|
19087
19204
|
}
|
|
19088
19205
|
function _resolve_settings_read(project_root) {
|
|
19089
19206
|
const canonical = _canonical_settings_target(project_root);
|
|
19090
19207
|
if (pathExists(canonical)) return canonical;
|
|
19091
|
-
const legacy =
|
|
19208
|
+
const legacy = path24.join(project_root, SETTINGS_FILE);
|
|
19092
19209
|
if (pathExists(legacy)) return legacy;
|
|
19093
19210
|
return canonical;
|
|
19094
19211
|
}
|
|
@@ -19154,9 +19271,9 @@ function fail(msg) {
|
|
|
19154
19271
|
throw new SystemExitError(1);
|
|
19155
19272
|
}
|
|
19156
19273
|
function detect_package_root(project_root) {
|
|
19157
|
-
const npm_path =
|
|
19274
|
+
const npm_path = path24.join(project_root, "node_modules", "@event4u", "agent-config");
|
|
19158
19275
|
if (isDir(npm_path)) return resolvePath(npm_path);
|
|
19159
|
-
if (pathExists(
|
|
19276
|
+
if (pathExists(path24.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
19160
19277
|
return project_root;
|
|
19161
19278
|
}
|
|
19162
19279
|
fail(
|
|
@@ -19164,12 +19281,12 @@ function detect_package_root(project_root) {
|
|
|
19164
19281
|
);
|
|
19165
19282
|
}
|
|
19166
19283
|
function detect_package_type(package_root) {
|
|
19167
|
-
if (package_root.split(
|
|
19284
|
+
if (package_root.split(path24.sep).includes("node_modules")) return "npm";
|
|
19168
19285
|
return "local";
|
|
19169
19286
|
}
|
|
19170
19287
|
function detect_package_type_for_project(project_root, package_root) {
|
|
19171
19288
|
const npm_path = resolvePath(
|
|
19172
|
-
|
|
19289
|
+
path24.join(project_root, "node_modules", "@event4u", "agent-config")
|
|
19173
19290
|
);
|
|
19174
19291
|
const package_resolved = resolvePath(package_root);
|
|
19175
19292
|
if (package_resolved === npm_path) return "npm";
|
|
@@ -19193,7 +19310,7 @@ function ensure_directory(p) {
|
|
|
19193
19310
|
mkdirp(p);
|
|
19194
19311
|
}
|
|
19195
19312
|
function write_file(p, content) {
|
|
19196
|
-
ensure_directory(
|
|
19313
|
+
ensure_directory(path24.dirname(p));
|
|
19197
19314
|
writeText(p, content);
|
|
19198
19315
|
}
|
|
19199
19316
|
function read_json_file(p) {
|
|
@@ -19364,7 +19481,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
|
|
|
19364
19481
|
return rendered + "\n" + suffix;
|
|
19365
19482
|
}
|
|
19366
19483
|
function _migrate_legacy_if_present(project_root, template_body) {
|
|
19367
|
-
const legacy_target =
|
|
19484
|
+
const legacy_target = path24.join(project_root, LEGACY_SETTINGS_FILE);
|
|
19368
19485
|
if (!isFile(legacy_target)) return null;
|
|
19369
19486
|
const legacy_text = readText(legacy_target);
|
|
19370
19487
|
const [values, unknown] = _parse_legacy_settings(legacy_text);
|
|
@@ -19379,9 +19496,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
|
|
|
19379
19496
|
}
|
|
19380
19497
|
}
|
|
19381
19498
|
rendered = _append_unknown_legacy(rendered, values, unknown);
|
|
19382
|
-
const backup_target =
|
|
19499
|
+
const backup_target = path24.join(project_root, LEGACY_BACKUP_FILE);
|
|
19383
19500
|
writeText(backup_target, legacy_text);
|
|
19384
|
-
|
|
19501
|
+
fs27.unlinkSync(legacy_target);
|
|
19385
19502
|
info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
|
|
19386
19503
|
info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
|
|
19387
19504
|
if (unknown.length > 0) {
|
|
@@ -19416,7 +19533,7 @@ function _render_template(template, profile_values) {
|
|
|
19416
19533
|
return body;
|
|
19417
19534
|
}
|
|
19418
19535
|
function _load_valid_user_types(package_root) {
|
|
19419
|
-
const directory =
|
|
19536
|
+
const directory = path24.join(package_root, USER_TYPES_DIR);
|
|
19420
19537
|
if (!isDir(directory)) return [];
|
|
19421
19538
|
return sortedGlobStems(directory, ".yml");
|
|
19422
19539
|
}
|
|
@@ -19473,8 +19590,8 @@ function splitlinesKeepends(text) {
|
|
|
19473
19590
|
}
|
|
19474
19591
|
function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
|
|
19475
19592
|
const target = _canonical_settings_target(project_root);
|
|
19476
|
-
const profile_source =
|
|
19477
|
-
const template_source =
|
|
19593
|
+
const profile_source = path24.join(package_root, "src", "config", "profiles", `${profile}.ini`);
|
|
19594
|
+
const template_source = path24.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
19478
19595
|
if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
|
|
19479
19596
|
if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
|
|
19480
19597
|
const template = readText(template_source);
|
|
@@ -19488,21 +19605,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
19488
19605
|
if (profile_values["rule_loading_tier"] !== profile) {
|
|
19489
19606
|
const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
|
|
19490
19607
|
fail(
|
|
19491
|
-
`Profile preset ${
|
|
19608
|
+
`Profile preset ${path24.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
|
|
19492
19609
|
);
|
|
19493
19610
|
}
|
|
19494
19611
|
profile_values["user_type"] = _validate_user_type(package_root, user_type);
|
|
19495
19612
|
let template_body = _render_template(template, profile_values);
|
|
19496
19613
|
template_body = _inject_packs(template_body, packs ?? []);
|
|
19497
|
-
const legacy_root =
|
|
19614
|
+
const legacy_root = path24.join(project_root, SETTINGS_FILE);
|
|
19498
19615
|
if (isFile(legacy_root) && !pathExists(target)) {
|
|
19499
|
-
mkdirp(
|
|
19616
|
+
mkdirp(path24.dirname(target));
|
|
19500
19617
|
writeText(target, readText(legacy_root));
|
|
19501
|
-
|
|
19618
|
+
fs27.unlinkSync(legacy_root);
|
|
19502
19619
|
success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
|
|
19503
19620
|
return;
|
|
19504
19621
|
}
|
|
19505
|
-
const legacy_target =
|
|
19622
|
+
const legacy_target = path24.join(project_root, LEGACY_SETTINGS_FILE);
|
|
19506
19623
|
if (isFile(legacy_target) && pathExists(target)) {
|
|
19507
19624
|
warn(
|
|
19508
19625
|
`Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
|
|
@@ -19519,7 +19636,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
19519
19636
|
skip(`${SETTINGS_FILE} already exists`);
|
|
19520
19637
|
return;
|
|
19521
19638
|
}
|
|
19522
|
-
mkdirp(
|
|
19639
|
+
mkdirp(path24.dirname(target));
|
|
19523
19640
|
write_file(target, template_body);
|
|
19524
19641
|
const user_type_value = profile_values["user_type"] ?? "";
|
|
19525
19642
|
const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
|
|
@@ -19532,7 +19649,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
19532
19649
|
const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
|
|
19533
19650
|
const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
|
|
19534
19651
|
return merge_json_file(
|
|
19535
|
-
|
|
19652
|
+
path24.join(project_root, ".vscode", "settings.json"),
|
|
19536
19653
|
bridge,
|
|
19537
19654
|
force,
|
|
19538
19655
|
".vscode/settings.json"
|
|
@@ -19541,14 +19658,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
19541
19658
|
function ensure_augment_bridge(project_root, force) {
|
|
19542
19659
|
const bridge = { enabledPlugins: { "agent-config@event4u": true } };
|
|
19543
19660
|
return merge_json_file(
|
|
19544
|
-
|
|
19661
|
+
path24.join(project_root, ".augment", "settings.json"),
|
|
19545
19662
|
bridge,
|
|
19546
19663
|
force,
|
|
19547
19664
|
".augment/settings.json"
|
|
19548
19665
|
);
|
|
19549
19666
|
}
|
|
19550
|
-
var AUGMENT_USER_DIR =
|
|
19551
|
-
var AUGMENT_USER_HOOKS_DIR =
|
|
19667
|
+
var AUGMENT_USER_DIR = path24.join(os8.homedir(), ".augment");
|
|
19668
|
+
var AUGMENT_USER_HOOKS_DIR = path24.join(AUGMENT_USER_DIR, "hooks");
|
|
19552
19669
|
var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
|
|
19553
19670
|
var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
19554
19671
|
"augment-chat-history.sh",
|
|
@@ -19557,29 +19674,29 @@ var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
|
19557
19674
|
"augment-context-hygiene.sh"
|
|
19558
19675
|
];
|
|
19559
19676
|
function _deploy_augment_trampoline(package_root, name, force) {
|
|
19560
|
-
const src =
|
|
19677
|
+
const src = path24.join(package_root, "scripts", "hooks", name);
|
|
19561
19678
|
if (!pathExists(src)) {
|
|
19562
19679
|
skip(`augment trampoline missing in package: ${src}`);
|
|
19563
19680
|
return null;
|
|
19564
19681
|
}
|
|
19565
19682
|
mkdirp(AUGMENT_USER_HOOKS_DIR);
|
|
19566
|
-
const dst =
|
|
19683
|
+
const dst = path24.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
19567
19684
|
const src_text = readText(src);
|
|
19568
19685
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
19569
19686
|
skip(`~/.augment/hooks/${name} already up to date`);
|
|
19570
19687
|
} else {
|
|
19571
19688
|
writeText(dst, src_text);
|
|
19572
|
-
|
|
19689
|
+
fs27.chmodSync(dst, 493);
|
|
19573
19690
|
success(`~/.augment/hooks/${name} installed`);
|
|
19574
19691
|
}
|
|
19575
19692
|
return dst;
|
|
19576
19693
|
}
|
|
19577
19694
|
function _remove_legacy_augment_trampolines() {
|
|
19578
19695
|
for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
|
|
19579
|
-
const legacy =
|
|
19696
|
+
const legacy = path24.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
19580
19697
|
try {
|
|
19581
19698
|
if (isFile(legacy)) {
|
|
19582
|
-
|
|
19699
|
+
fs27.unlinkSync(legacy);
|
|
19583
19700
|
skip(`removed legacy ~/.augment/hooks/${name}`);
|
|
19584
19701
|
}
|
|
19585
19702
|
} catch (err) {
|
|
@@ -19599,7 +19716,7 @@ function ensure_augment_user_hooks(package_root, force) {
|
|
|
19599
19716
|
}
|
|
19600
19717
|
const settings_patch = { hooks: per_event };
|
|
19601
19718
|
return merge_json_file(
|
|
19602
|
-
|
|
19719
|
+
path24.join(AUGMENT_USER_DIR, "settings.json"),
|
|
19603
19720
|
settings_patch,
|
|
19604
19721
|
force,
|
|
19605
19722
|
"~/.augment/settings.json"
|
|
@@ -19624,12 +19741,10 @@ function _heal_legacy_claude_plugin_ids(p) {
|
|
|
19624
19741
|
return removed;
|
|
19625
19742
|
}
|
|
19626
19743
|
function ensure_claude_bridge(project_root, force) {
|
|
19627
|
-
const target =
|
|
19744
|
+
const target = path24.join(project_root, ".claude", "settings.json");
|
|
19628
19745
|
const healed = _heal_legacy_claude_plugin_ids(target);
|
|
19629
|
-
for (const pid of healed) {
|
|
19630
|
-
|
|
19631
|
-
}
|
|
19632
|
-
const bridge = { enabledPlugins: { [CLAUDE_PLUGIN_ID]: true } };
|
|
19746
|
+
for (const pid of healed) success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
|
|
19747
|
+
const bridge = withHostEnv({ enabledPlugins: { [CLAUDE_PLUGIN_ID]: true } }, project_root, success);
|
|
19633
19748
|
return merge_json_file(target, bridge, force || healed.length > 0, ".claude/settings.json");
|
|
19634
19749
|
}
|
|
19635
19750
|
var ensure_mcp_bridge = makeEnsureMcpBridge(merge_json_file);
|
|
@@ -19646,29 +19761,29 @@ function ensure_cursor_bridge(project_root, force) {
|
|
|
19646
19761
|
}
|
|
19647
19762
|
const bridge = { version: 1, hooks };
|
|
19648
19763
|
return merge_json_file(
|
|
19649
|
-
|
|
19764
|
+
path24.join(project_root, ".cursor", "hooks.json"),
|
|
19650
19765
|
bridge,
|
|
19651
19766
|
force,
|
|
19652
19767
|
".cursor/hooks.json"
|
|
19653
19768
|
);
|
|
19654
19769
|
}
|
|
19655
|
-
var CURSOR_USER_DIR =
|
|
19656
|
-
var CURSOR_USER_HOOKS_DIR =
|
|
19770
|
+
var CURSOR_USER_DIR = path24.join(os8.homedir(), ".cursor");
|
|
19771
|
+
var CURSOR_USER_HOOKS_DIR = path24.join(CURSOR_USER_DIR, "hooks");
|
|
19657
19772
|
var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
|
|
19658
19773
|
function ensure_cursor_user_hooks(package_root, force) {
|
|
19659
|
-
const src =
|
|
19774
|
+
const src = path24.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
|
|
19660
19775
|
if (!pathExists(src)) {
|
|
19661
19776
|
skip(`cursor trampoline missing in package: ${src}`);
|
|
19662
19777
|
return [];
|
|
19663
19778
|
}
|
|
19664
19779
|
mkdirp(CURSOR_USER_HOOKS_DIR);
|
|
19665
|
-
const dst =
|
|
19780
|
+
const dst = path24.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
|
|
19666
19781
|
const src_text = readText(src);
|
|
19667
19782
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
19668
19783
|
skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
19669
19784
|
} else {
|
|
19670
19785
|
writeText(dst, src_text);
|
|
19671
|
-
|
|
19786
|
+
fs27.chmodSync(dst, 493);
|
|
19672
19787
|
success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
|
|
19673
19788
|
}
|
|
19674
19789
|
const hooks = {};
|
|
@@ -19677,7 +19792,7 @@ function ensure_cursor_user_hooks(package_root, force) {
|
|
|
19677
19792
|
}
|
|
19678
19793
|
const settings_patch = { version: 1, hooks };
|
|
19679
19794
|
return merge_json_file(
|
|
19680
|
-
|
|
19795
|
+
path24.join(CURSOR_USER_DIR, "hooks.json"),
|
|
19681
19796
|
settings_patch,
|
|
19682
19797
|
force,
|
|
19683
19798
|
"~/.cursor/hooks.json"
|
|
@@ -19712,12 +19827,12 @@ exit 0
|
|
|
19712
19827
|
`;
|
|
19713
19828
|
}
|
|
19714
19829
|
function ensure_cline_bridge(project_root, force) {
|
|
19715
|
-
const hooks_dir =
|
|
19830
|
+
const hooks_dir = path24.join(project_root, ".clinerules", "hooks");
|
|
19716
19831
|
mkdirp(hooks_dir);
|
|
19717
19832
|
const workspace_quoted = shlexQuote(resolvePath(project_root));
|
|
19718
19833
|
let written = 0;
|
|
19719
19834
|
for (const { slot, native } of hostBindings("cline")) {
|
|
19720
|
-
const target =
|
|
19835
|
+
const target = path24.join(hooks_dir, native);
|
|
19721
19836
|
const body = clineProjectHookBody(native, slot, workspace_quoted);
|
|
19722
19837
|
if (pathExists(target) && readText(target) === body && !force) {
|
|
19723
19838
|
continue;
|
|
@@ -19727,7 +19842,7 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
19727
19842
|
continue;
|
|
19728
19843
|
}
|
|
19729
19844
|
writeText(target, body);
|
|
19730
|
-
|
|
19845
|
+
fs27.chmodSync(target, 493);
|
|
19731
19846
|
written += 1;
|
|
19732
19847
|
}
|
|
19733
19848
|
if (written) {
|
|
@@ -19736,27 +19851,27 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
19736
19851
|
skip(".clinerules/hooks/ already up to date");
|
|
19737
19852
|
}
|
|
19738
19853
|
}
|
|
19739
|
-
var CLINE_USER_DIR =
|
|
19854
|
+
var CLINE_USER_DIR = path24.join(os8.homedir(), "Documents", "Cline", "Hooks");
|
|
19740
19855
|
var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
|
|
19741
19856
|
function ensure_cline_user_hooks(package_root, force) {
|
|
19742
|
-
const src =
|
|
19857
|
+
const src = path24.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
|
|
19743
19858
|
if (!pathExists(src)) {
|
|
19744
19859
|
skip(`cline trampoline missing in package: ${src}`);
|
|
19745
19860
|
return;
|
|
19746
19861
|
}
|
|
19747
19862
|
mkdirp(CLINE_USER_DIR);
|
|
19748
|
-
const trampoline =
|
|
19863
|
+
const trampoline = path24.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
|
|
19749
19864
|
const src_text = readText(src);
|
|
19750
19865
|
if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
|
|
19751
19866
|
skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
19752
19867
|
} else {
|
|
19753
19868
|
writeText(trampoline, src_text);
|
|
19754
|
-
|
|
19869
|
+
fs27.chmodSync(trampoline, 493);
|
|
19755
19870
|
success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
|
|
19756
19871
|
}
|
|
19757
19872
|
const trampoline_quoted = shlexQuote(trampoline);
|
|
19758
19873
|
for (const { slot, native } of hostBindings("cline")) {
|
|
19759
|
-
const wrapper =
|
|
19874
|
+
const wrapper = path24.join(CLINE_USER_DIR, native);
|
|
19760
19875
|
const body = `#!/usr/bin/env bash
|
|
19761
19876
|
# Generated by event4u/agent-config \u2014 DO NOT EDIT.
|
|
19762
19877
|
# User-scope Cline hook for ${native} \u2192 agent-config ${slot}.
|
|
@@ -19766,7 +19881,7 @@ exec ${trampoline_quoted} ${slot} ${native}
|
|
|
19766
19881
|
continue;
|
|
19767
19882
|
}
|
|
19768
19883
|
writeText(wrapper, body);
|
|
19769
|
-
|
|
19884
|
+
fs27.chmodSync(wrapper, 493);
|
|
19770
19885
|
}
|
|
19771
19886
|
}
|
|
19772
19887
|
function _windsurf_dispatch_command(ac_event, native) {
|
|
@@ -19782,29 +19897,29 @@ function ensure_windsurf_bridge(project_root, force) {
|
|
|
19782
19897
|
}
|
|
19783
19898
|
const bridge = { hooks };
|
|
19784
19899
|
return merge_json_file(
|
|
19785
|
-
|
|
19900
|
+
path24.join(project_root, ".windsurf", "hooks.json"),
|
|
19786
19901
|
bridge,
|
|
19787
19902
|
force,
|
|
19788
19903
|
".windsurf/hooks.json"
|
|
19789
19904
|
);
|
|
19790
19905
|
}
|
|
19791
|
-
var WINDSURF_USER_DIR =
|
|
19792
|
-
var WINDSURF_USER_HOOKS_DIR =
|
|
19906
|
+
var WINDSURF_USER_DIR = path24.join(os8.homedir(), ".codeium", "windsurf");
|
|
19907
|
+
var WINDSURF_USER_HOOKS_DIR = path24.join(WINDSURF_USER_DIR, "hooks");
|
|
19793
19908
|
var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
|
|
19794
19909
|
function ensure_windsurf_user_hooks(package_root, force) {
|
|
19795
|
-
const src =
|
|
19910
|
+
const src = path24.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
19796
19911
|
if (!pathExists(src)) {
|
|
19797
19912
|
skip(`windsurf trampoline missing in package: ${src}`);
|
|
19798
19913
|
return [];
|
|
19799
19914
|
}
|
|
19800
19915
|
mkdirp(WINDSURF_USER_HOOKS_DIR);
|
|
19801
|
-
const dst =
|
|
19916
|
+
const dst = path24.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
19802
19917
|
const src_text = readText(src);
|
|
19803
19918
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
19804
19919
|
skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
19805
19920
|
} else {
|
|
19806
19921
|
writeText(dst, src_text);
|
|
19807
|
-
|
|
19922
|
+
fs27.chmodSync(dst, 493);
|
|
19808
19923
|
success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
|
|
19809
19924
|
}
|
|
19810
19925
|
const hooks = {};
|
|
@@ -19816,7 +19931,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
|
|
|
19816
19931
|
}
|
|
19817
19932
|
const settings_patch = { hooks };
|
|
19818
19933
|
return merge_json_file(
|
|
19819
|
-
|
|
19934
|
+
path24.join(WINDSURF_USER_DIR, "hooks.json"),
|
|
19820
19935
|
settings_patch,
|
|
19821
19936
|
force,
|
|
19822
19937
|
"~/.codeium/windsurf/hooks.json"
|
|
@@ -19838,43 +19953,43 @@ function _gemini_hooks_dict(command_factory) {
|
|
|
19838
19953
|
function ensure_gemini_bridge(project_root, force) {
|
|
19839
19954
|
const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
|
|
19840
19955
|
return merge_json_file(
|
|
19841
|
-
|
|
19956
|
+
path24.join(project_root, ".gemini", "settings.json"),
|
|
19842
19957
|
bridge,
|
|
19843
19958
|
force,
|
|
19844
19959
|
".gemini/settings.json"
|
|
19845
19960
|
);
|
|
19846
19961
|
}
|
|
19847
|
-
var GEMINI_USER_DIR =
|
|
19848
|
-
var GEMINI_USER_HOOKS_DIR =
|
|
19962
|
+
var GEMINI_USER_DIR = path24.join(os8.homedir(), ".gemini");
|
|
19963
|
+
var GEMINI_USER_HOOKS_DIR = path24.join(GEMINI_USER_DIR, "hooks");
|
|
19849
19964
|
var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
|
|
19850
19965
|
function ensure_gemini_user_hooks(package_root, force) {
|
|
19851
|
-
const src =
|
|
19966
|
+
const src = path24.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
|
|
19852
19967
|
if (!pathExists(src)) {
|
|
19853
19968
|
skip(`gemini trampoline missing in package: ${src}`);
|
|
19854
19969
|
return [];
|
|
19855
19970
|
}
|
|
19856
19971
|
mkdirp(GEMINI_USER_HOOKS_DIR);
|
|
19857
|
-
const dst =
|
|
19972
|
+
const dst = path24.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
|
|
19858
19973
|
const src_text = readText(src);
|
|
19859
19974
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
19860
19975
|
skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
19861
19976
|
} else {
|
|
19862
19977
|
writeText(dst, src_text);
|
|
19863
|
-
|
|
19978
|
+
fs27.chmodSync(dst, 493);
|
|
19864
19979
|
success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
|
|
19865
19980
|
}
|
|
19866
19981
|
const settings_patch = {
|
|
19867
19982
|
hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
|
|
19868
19983
|
};
|
|
19869
19984
|
return merge_json_file(
|
|
19870
|
-
|
|
19985
|
+
path24.join(GEMINI_USER_DIR, "settings.json"),
|
|
19871
19986
|
settings_patch,
|
|
19872
19987
|
force,
|
|
19873
19988
|
"~/.gemini/settings.json"
|
|
19874
19989
|
);
|
|
19875
19990
|
}
|
|
19876
19991
|
function ensure_copilot_bridge(project_root, force) {
|
|
19877
|
-
const target =
|
|
19992
|
+
const target = path24.join(project_root, ".github", "plugin", "marketplace.json");
|
|
19878
19993
|
const bridge = {
|
|
19879
19994
|
marketplace: {
|
|
19880
19995
|
name: "event4u-agent-marketplace",
|
|
@@ -19917,7 +20032,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
|
|
|
19917
20032
|
Run \`./agent-config --help\` for available commands.
|
|
19918
20033
|
`;
|
|
19919
20034
|
function ensure_roocode_bridge(project_root, force) {
|
|
19920
|
-
const target =
|
|
20035
|
+
const target = path24.join(project_root, ".roo", "rules", "agent-config.md");
|
|
19921
20036
|
if (pathExists(target) && !force) {
|
|
19922
20037
|
skip(".roo/rules/agent-config.md already exists");
|
|
19923
20038
|
return;
|
|
@@ -19939,7 +20054,7 @@ To wire Claude Desktop to this project's rules, run:
|
|
|
19939
20054
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
19940
20055
|
`;
|
|
19941
20056
|
function ensure_claude_desktop_bridge(project_root, force) {
|
|
19942
|
-
const target =
|
|
20057
|
+
const target = path24.join(project_root, ".claude-desktop", "agent-config.md");
|
|
19943
20058
|
if (pathExists(target) && !force) {
|
|
19944
20059
|
skip(".claude-desktop/agent-config.md already exists");
|
|
19945
20060
|
return;
|
|
@@ -19964,7 +20079,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
|
|
|
19964
20079
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
19965
20080
|
`;
|
|
19966
20081
|
function ensure_aider_bridge(project_root, force) {
|
|
19967
|
-
const target =
|
|
20082
|
+
const target = path24.join(project_root, ".aider", "agent-config.md");
|
|
19968
20083
|
if (pathExists(target) && !force) {
|
|
19969
20084
|
skip(".aider/agent-config.md already exists");
|
|
19970
20085
|
return;
|
|
@@ -19983,7 +20098,7 @@ developers where the rules and skills live.
|
|
|
19983
20098
|
Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
|
|
19984
20099
|
`;
|
|
19985
20100
|
function ensure_codex_bridge(project_root, force) {
|
|
19986
|
-
const target =
|
|
20101
|
+
const target = path24.join(project_root, ".codex", "agent-config.md");
|
|
19987
20102
|
if (pathExists(target) && !force) {
|
|
19988
20103
|
skip(".codex/agent-config.md already exists");
|
|
19989
20104
|
return;
|
|
@@ -20001,7 +20116,7 @@ rules per session. The canonical rule and skill source lives under
|
|
|
20001
20116
|
orientation).
|
|
20002
20117
|
`;
|
|
20003
20118
|
function ensure_continue_bridge(project_root, force) {
|
|
20004
|
-
const target =
|
|
20119
|
+
const target = path24.join(project_root, ".continue", "rules", "agent-config.md");
|
|
20005
20120
|
if (pathExists(target) && !force) {
|
|
20006
20121
|
skip(".continue/rules/agent-config.md already exists");
|
|
20007
20122
|
return;
|
|
@@ -20032,7 +20147,7 @@ orientation).
|
|
|
20032
20147
|
See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
|
|
20033
20148
|
`;
|
|
20034
20149
|
function ensure_kilocode_bridge(project_root, force) {
|
|
20035
|
-
const target =
|
|
20150
|
+
const target = path24.join(project_root, ".kilocode", "rules", "agent-config.md");
|
|
20036
20151
|
if (pathExists(target) && !force) {
|
|
20037
20152
|
skip(".kilocode/rules/agent-config.md already exists");
|
|
20038
20153
|
return;
|
|
@@ -20059,7 +20174,7 @@ canonical source (or symlink it):
|
|
|
20059
20174
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
20060
20175
|
`;
|
|
20061
20176
|
function ensure_zed_bridge(project_root, force) {
|
|
20062
|
-
const target =
|
|
20177
|
+
const target = path24.join(project_root, ".zed", "agent-config.md");
|
|
20063
20178
|
if (pathExists(target) && !force) {
|
|
20064
20179
|
skip(".zed/agent-config.md already exists");
|
|
20065
20180
|
return;
|
|
@@ -20080,7 +20195,7 @@ rules into your JetBrains profile.
|
|
|
20080
20195
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
20081
20196
|
`;
|
|
20082
20197
|
function ensure_jetbrains_bridge(project_root, force) {
|
|
20083
|
-
const target =
|
|
20198
|
+
const target = path24.join(project_root, ".jetbrains", "agent-config.md");
|
|
20084
20199
|
if (pathExists(target) && !force) {
|
|
20085
20200
|
skip(".jetbrains/agent-config.md already exists");
|
|
20086
20201
|
return;
|
|
@@ -20111,7 +20226,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
|
|
|
20111
20226
|
See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
|
|
20112
20227
|
`;
|
|
20113
20228
|
function ensure_kiro_bridge(project_root, force) {
|
|
20114
|
-
const target =
|
|
20229
|
+
const target = path24.join(project_root, ".kiro", "steering", "agent-config.md");
|
|
20115
20230
|
if (pathExists(target) && !force) {
|
|
20116
20231
|
skip(".kiro/steering/agent-config.md already exists");
|
|
20117
20232
|
return;
|
|
@@ -20148,35 +20263,35 @@ var SMOKE_BRIDGE_PATHS = {
|
|
|
20148
20263
|
};
|
|
20149
20264
|
function dirHasEntries(p) {
|
|
20150
20265
|
try {
|
|
20151
|
-
return
|
|
20266
|
+
return fs27.readdirSync(p).length > 0;
|
|
20152
20267
|
} catch {
|
|
20153
20268
|
return false;
|
|
20154
20269
|
}
|
|
20155
20270
|
}
|
|
20156
20271
|
function _resolve_tsx_invocation(scriptPath, scriptArgs) {
|
|
20157
20272
|
const binName = process4.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
20158
|
-
let dir =
|
|
20273
|
+
let dir = path24.dirname(scriptPath);
|
|
20159
20274
|
for (; ; ) {
|
|
20160
|
-
const candidate =
|
|
20275
|
+
const candidate = path24.join(dir, "node_modules", ".bin", binName);
|
|
20161
20276
|
if (isFile(candidate)) {
|
|
20162
20277
|
return { command: candidate, args: [scriptPath, ...scriptArgs] };
|
|
20163
20278
|
}
|
|
20164
|
-
const parent =
|
|
20279
|
+
const parent = path24.dirname(dir);
|
|
20165
20280
|
if (parent === dir) break;
|
|
20166
20281
|
dir = parent;
|
|
20167
20282
|
}
|
|
20168
20283
|
return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
|
|
20169
20284
|
}
|
|
20170
20285
|
function _smoke_test_hooks(project_root, package_root) {
|
|
20171
|
-
const dispatcher =
|
|
20172
|
-
const manifest =
|
|
20286
|
+
const dispatcher = path24.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
|
|
20287
|
+
const manifest = path24.join(package_root, "scripts", "hook_manifest.yaml");
|
|
20173
20288
|
if (!isFile(dispatcher) || !isFile(manifest)) return 0;
|
|
20174
20289
|
const failed = [];
|
|
20175
20290
|
const skipped = [];
|
|
20176
20291
|
const passed = [];
|
|
20177
20292
|
for (const [platform, native] of smokeProbeEvents()) {
|
|
20178
20293
|
const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
|
|
20179
|
-
const bridge_path = rel_bridge ?
|
|
20294
|
+
const bridge_path = rel_bridge ? path24.join(project_root, rel_bridge) : null;
|
|
20180
20295
|
const bridge_present = Boolean(
|
|
20181
20296
|
bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
|
|
20182
20297
|
);
|
|
@@ -20376,9 +20491,9 @@ To remove this marker, delete this file.
|
|
|
20376
20491
|
`;
|
|
20377
20492
|
}
|
|
20378
20493
|
var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
|
|
20379
|
-
var GLOBAL_ROOT =
|
|
20380
|
-
var GLOBAL_USER_SETTINGS_PATH =
|
|
20381
|
-
var GLOBAL_AGENT_SETTINGS_PATH =
|
|
20494
|
+
var GLOBAL_ROOT = path24.join(os8.homedir(), ".event4u", "agent-config");
|
|
20495
|
+
var GLOBAL_USER_SETTINGS_PATH = path24.join(GLOBAL_ROOT, ".agent-user.yml");
|
|
20496
|
+
var GLOBAL_AGENT_SETTINGS_PATH = path24.join(GLOBAL_ROOT, ".agent-settings.yml");
|
|
20382
20497
|
function _bridge_marker(tool_id, scope) {
|
|
20383
20498
|
if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
|
|
20384
20499
|
return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
|
|
@@ -20427,7 +20542,7 @@ function _load_yaml_doc(p) {
|
|
|
20427
20542
|
return _isPlainObject2(data) ? data : {};
|
|
20428
20543
|
}
|
|
20429
20544
|
function _load_default_settings(package_root) {
|
|
20430
|
-
const template_source =
|
|
20545
|
+
const template_source = path24.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
20431
20546
|
if (!pathExists(template_source)) return {};
|
|
20432
20547
|
let text;
|
|
20433
20548
|
try {
|
|
@@ -20441,11 +20556,11 @@ function _load_default_settings(package_root) {
|
|
|
20441
20556
|
}
|
|
20442
20557
|
var RULE_LAYER_CHOICES = ["global", "project", "both-acknowledged"];
|
|
20443
20558
|
function _suppress_rule_layer(project_root, suppress_dir) {
|
|
20444
|
-
const target =
|
|
20559
|
+
const target = path24.join(project_root, ".claude", "settings.local.json");
|
|
20445
20560
|
const existing = pathExists(target) ? read_json_file(target) : {};
|
|
20446
20561
|
let real_dir = suppress_dir;
|
|
20447
20562
|
try {
|
|
20448
|
-
real_dir =
|
|
20563
|
+
real_dir = fs27.realpathSync(suppress_dir);
|
|
20449
20564
|
} catch {
|
|
20450
20565
|
real_dir = suppress_dir;
|
|
20451
20566
|
}
|
|
@@ -20456,8 +20571,8 @@ function _suppress_rule_layer(project_root, suppress_dir) {
|
|
|
20456
20571
|
success(`.claude/settings.local.json: claudeMdExcludes += ${entry}`);
|
|
20457
20572
|
}
|
|
20458
20573
|
function _gate_rule_layer_overlap(project_root, layer, dry_run) {
|
|
20459
|
-
const global_dir =
|
|
20460
|
-
const project_dir =
|
|
20574
|
+
const global_dir = path24.join(os8.homedir(), ".claude", "rules");
|
|
20575
|
+
const project_dir = path24.join(project_root, ".claude", "rules");
|
|
20461
20576
|
const g = readRuleLayer(global_dir);
|
|
20462
20577
|
const p = readRuleLayer(project_dir);
|
|
20463
20578
|
if (g === null || p === null) return true;
|
|
@@ -20545,9 +20660,9 @@ function detect_scope(cwd) {
|
|
|
20545
20660
|
if (pathExists(_resolve_settings_read(cwd))) {
|
|
20546
20661
|
return ["project", `existing ${SETTINGS_FILE}`];
|
|
20547
20662
|
}
|
|
20548
|
-
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(
|
|
20549
|
-
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(
|
|
20550
|
-
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(
|
|
20663
|
+
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path24.join(cwd, m))) ?? null;
|
|
20664
|
+
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path24.join(cwd, d))) ?? null;
|
|
20665
|
+
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path24.join(cwd, f))) ?? null;
|
|
20551
20666
|
if (has_manifest && (has_ai_dir || has_ai_file)) {
|
|
20552
20667
|
const marker = has_ai_dir || has_ai_file;
|
|
20553
20668
|
return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
|
|
@@ -20568,7 +20683,7 @@ function readLineSyncRaw(promptText) {
|
|
|
20568
20683
|
for (; ; ) {
|
|
20569
20684
|
let n;
|
|
20570
20685
|
try {
|
|
20571
|
-
n =
|
|
20686
|
+
n = fs27.readSync(0, buf, 0, 1, null);
|
|
20572
20687
|
} catch (err) {
|
|
20573
20688
|
const code = err.code;
|
|
20574
20689
|
if (code === "EAGAIN") {
|
|
@@ -20651,26 +20766,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
|
|
|
20651
20766
|
}
|
|
20652
20767
|
write_manifest(target, version, entries);
|
|
20653
20768
|
if (!state.QUIET) {
|
|
20654
|
-
const rel = isRelativeTo(target, project_root) ?
|
|
20769
|
+
const rel = isRelativeTo(target, project_root) ? path24.relative(project_root, target) : target;
|
|
20655
20770
|
info(`Manifest updated: ${rel}`);
|
|
20656
20771
|
}
|
|
20657
20772
|
return 0;
|
|
20658
20773
|
}
|
|
20659
20774
|
function isRelativeTo(child, parent) {
|
|
20660
|
-
const rel =
|
|
20661
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
20775
|
+
const rel = path24.relative(parent, child);
|
|
20776
|
+
return rel === "" || !rel.startsWith("..") && !path24.isAbsolute(rel);
|
|
20662
20777
|
}
|
|
20663
20778
|
function _resolve_package_root_for_global() {
|
|
20664
20779
|
const here = resolvePath(_HERE2);
|
|
20665
|
-
const candidate =
|
|
20666
|
-
if (!pathExists(
|
|
20780
|
+
const candidate = path24.dirname(path24.dirname(path24.dirname(here)));
|
|
20781
|
+
if (!pathExists(path24.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
|
|
20667
20782
|
fail(
|
|
20668
20783
|
`Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
|
|
20669
20784
|
);
|
|
20670
20785
|
}
|
|
20671
20786
|
return candidate;
|
|
20672
20787
|
}
|
|
20673
|
-
var CONSUMER_BRIDGE_MARKER_RELPATH =
|
|
20788
|
+
var CONSUMER_BRIDGE_MARKER_RELPATH = path24.join("agents", ".event4u-bridge.yml");
|
|
20674
20789
|
var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
20675
20790
|
var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
|
|
20676
20791
|
var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
|
|
@@ -20678,7 +20793,7 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
20678
20793
|
if (process4.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
|
|
20679
20794
|
return [false, "consumer-mode-override"];
|
|
20680
20795
|
}
|
|
20681
|
-
const pkg_json =
|
|
20796
|
+
const pkg_json = path24.join(project_root, "package.json");
|
|
20682
20797
|
if (isFile(pkg_json)) {
|
|
20683
20798
|
let data = {};
|
|
20684
20799
|
try {
|
|
@@ -20690,13 +20805,13 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
20690
20805
|
return [true, "package.json:name"];
|
|
20691
20806
|
}
|
|
20692
20807
|
}
|
|
20693
|
-
if (isDir(
|
|
20808
|
+
if (isDir(path24.join(project_root, ".agent-src.uncondensed"))) {
|
|
20694
20809
|
return [true, ".agent-src.uncondensed/"];
|
|
20695
20810
|
}
|
|
20696
|
-
const packages_dir =
|
|
20811
|
+
const packages_dir = path24.join(project_root, "packages");
|
|
20697
20812
|
if (isDir(packages_dir)) {
|
|
20698
|
-
for (const child of
|
|
20699
|
-
if (isDir(
|
|
20813
|
+
for (const child of fs27.readdirSync(packages_dir)) {
|
|
20814
|
+
if (isDir(path24.join(packages_dir, child, ".agent-src.uncondensed"))) {
|
|
20700
20815
|
return [true, `packages/${child}/.agent-src.uncondensed/`];
|
|
20701
20816
|
}
|
|
20702
20817
|
}
|
|
@@ -20714,17 +20829,17 @@ function _detect_legacy_for_migration(project_root) {
|
|
|
20714
20829
|
}
|
|
20715
20830
|
return [];
|
|
20716
20831
|
}
|
|
20717
|
-
if (isFile(
|
|
20832
|
+
if (isFile(path24.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
|
|
20718
20833
|
const found = [];
|
|
20719
20834
|
for (const name of MIGRATE_LEGACY_YAML_FILES) {
|
|
20720
|
-
if (isFile(
|
|
20835
|
+
if (isFile(path24.join(project_root, name))) {
|
|
20721
20836
|
found.push(name);
|
|
20722
|
-
} else if (isFile(
|
|
20837
|
+
} else if (isFile(path24.join(project_root, "settings", name))) {
|
|
20723
20838
|
found.push(`settings/${name}`);
|
|
20724
20839
|
}
|
|
20725
20840
|
}
|
|
20726
20841
|
for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
|
|
20727
|
-
const p =
|
|
20842
|
+
const p = path24.join(project_root, name);
|
|
20728
20843
|
if (isDir(p) && !isSymlink(p)) {
|
|
20729
20844
|
found.push(`${name}/`);
|
|
20730
20845
|
}
|
|
@@ -20736,7 +20851,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
|
|
|
20736
20851
|
process4.stdout.write("\n");
|
|
20737
20852
|
warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
|
|
20738
20853
|
for (const rel of artefacts) {
|
|
20739
|
-
info(` ${
|
|
20854
|
+
info(` ${path24.join(project_root, rel)}`);
|
|
20740
20855
|
}
|
|
20741
20856
|
info("The unified `agent-config migrate` sweeps these in one pass.");
|
|
20742
20857
|
info("The wizard recreates fresh config afterwards.");
|
|
@@ -20767,20 +20882,20 @@ function _run_migrate_to_global(project_root) {
|
|
|
20767
20882
|
function _format_global_root_for_marker(global_root) {
|
|
20768
20883
|
const home = resolvePath(os8.homedir());
|
|
20769
20884
|
const resolved = resolvePath(global_root);
|
|
20770
|
-
const rel =
|
|
20771
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
20885
|
+
const rel = path24.relative(home, resolved);
|
|
20886
|
+
if (rel === "" || rel.startsWith("..") || path24.isAbsolute(rel)) {
|
|
20772
20887
|
return global_root;
|
|
20773
20888
|
}
|
|
20774
|
-
return `~/${rel.split(
|
|
20889
|
+
return `~/${rel.split(path24.sep).join("/")}`;
|
|
20775
20890
|
}
|
|
20776
20891
|
function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
|
|
20777
20892
|
const env_map = env ?? process4.env;
|
|
20778
20893
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
|
|
20779
|
-
if (isDir(
|
|
20780
|
-
const target =
|
|
20894
|
+
if (isDir(path24.join(project_root, ".agent-src.uncondensed"))) return null;
|
|
20895
|
+
const target = path24.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
|
|
20781
20896
|
if (!isFile(target)) return null;
|
|
20782
20897
|
try {
|
|
20783
|
-
|
|
20898
|
+
fs27.rmSync(target);
|
|
20784
20899
|
} catch {
|
|
20785
20900
|
return null;
|
|
20786
20901
|
}
|
|
@@ -20794,7 +20909,7 @@ var PROJECT_ANCHOR_TOOLS = {
|
|
|
20794
20909
|
function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
|
|
20795
20910
|
const env_map = env ?? process4.env;
|
|
20796
20911
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
|
|
20797
|
-
if (isDir(
|
|
20912
|
+
if (isDir(path24.join(project_root, ".agent-src.uncondensed"))) return [];
|
|
20798
20913
|
const global_root_str = _format_global_root_for_marker(
|
|
20799
20914
|
event4u_root(env_map)
|
|
20800
20915
|
);
|
|
@@ -20803,8 +20918,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
|
|
|
20803
20918
|
for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
|
|
20804
20919
|
const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
|
|
20805
20920
|
if (!tools.has(tool_id)) continue;
|
|
20806
|
-
const target =
|
|
20807
|
-
mkdirp(
|
|
20921
|
+
const target = path24.join(project_root, rel_path);
|
|
20922
|
+
mkdirp(path24.dirname(target));
|
|
20808
20923
|
const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
|
|
20809
20924
|
# Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
|
|
20810
20925
|
# Tool: ${tool_id}. Resolves the global install directly \u2014 no
|
|
@@ -20822,7 +20937,7 @@ installed_at: ${stamp}
|
|
|
20822
20937
|
}
|
|
20823
20938
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
20824
20939
|
function _inject_package_tag(target, source, package_root) {
|
|
20825
|
-
if (
|
|
20940
|
+
if (path24.extname(target) !== ".md") return;
|
|
20826
20941
|
let text;
|
|
20827
20942
|
try {
|
|
20828
20943
|
text = readText(target);
|
|
@@ -20850,8 +20965,8 @@ function _inject_package_tag(target, source, package_root) {
|
|
|
20850
20965
|
resolved_src = source;
|
|
20851
20966
|
}
|
|
20852
20967
|
if (package_root !== null) {
|
|
20853
|
-
const rel =
|
|
20854
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
20968
|
+
const rel = path24.relative(resolvePath(package_root), resolved_src);
|
|
20969
|
+
if (rel !== "" && !rel.startsWith("..") && !path24.isAbsolute(rel)) {
|
|
20855
20970
|
source_value = rel;
|
|
20856
20971
|
} else {
|
|
20857
20972
|
source_value = resolved_src;
|
|
@@ -20886,7 +21001,7 @@ function _escapes_package_root(resolved, package_root) {
|
|
|
20886
21001
|
if (package_root === null) return false;
|
|
20887
21002
|
let root;
|
|
20888
21003
|
try {
|
|
20889
|
-
root =
|
|
21004
|
+
root = fs27.realpathSync(package_root);
|
|
20890
21005
|
} catch {
|
|
20891
21006
|
return false;
|
|
20892
21007
|
}
|
|
@@ -20912,7 +21027,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
20912
21027
|
if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
|
|
20913
21028
|
let resolved_src = src;
|
|
20914
21029
|
try {
|
|
20915
|
-
resolved_src =
|
|
21030
|
+
resolved_src = fs27.realpathSync(src);
|
|
20916
21031
|
} catch {
|
|
20917
21032
|
resolved_src = src;
|
|
20918
21033
|
}
|
|
@@ -20920,14 +21035,14 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
20920
21035
|
warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
|
|
20921
21036
|
return [0, 0, written_paths];
|
|
20922
21037
|
}
|
|
20923
|
-
mkdirp(
|
|
21038
|
+
mkdirp(path24.dirname(dest));
|
|
20924
21039
|
const decision = tracker.resolve(dest, force);
|
|
20925
21040
|
if (decision === "preserve") {
|
|
20926
21041
|
tracker.preserve(dest, resolved_src, package_root);
|
|
20927
21042
|
_log_tx_entry("skip", dest);
|
|
20928
21043
|
return [0, 1, written_paths];
|
|
20929
21044
|
}
|
|
20930
|
-
|
|
21045
|
+
fs27.copyFileSync(src, dest);
|
|
20931
21046
|
_inject_package_tag(dest, src, package_root);
|
|
20932
21047
|
_log_tx_entry("write", dest);
|
|
20933
21048
|
written_paths.push(dest);
|
|
@@ -20936,11 +21051,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
20936
21051
|
mkdirp(dest);
|
|
20937
21052
|
const walk = (node) => {
|
|
20938
21053
|
const acc = [];
|
|
20939
|
-
const names =
|
|
21054
|
+
const names = fs27.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
20940
21055
|
for (const name of names) {
|
|
20941
|
-
const entry =
|
|
21056
|
+
const entry = path24.join(node, name);
|
|
20942
21057
|
acc.push(entry);
|
|
20943
|
-
const lst =
|
|
21058
|
+
const lst = fs27.lstatSync(entry);
|
|
20944
21059
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
20945
21060
|
acc.push(...walk(entry));
|
|
20946
21061
|
}
|
|
@@ -20948,9 +21063,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
20948
21063
|
return acc;
|
|
20949
21064
|
};
|
|
20950
21065
|
for (const entry of walk(src)) {
|
|
20951
|
-
const rel =
|
|
20952
|
-
const target =
|
|
20953
|
-
const lst =
|
|
21066
|
+
const rel = path24.relative(src, entry);
|
|
21067
|
+
const target = path24.join(dest, rel);
|
|
21068
|
+
const lst = fs27.lstatSync(entry);
|
|
20954
21069
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
20955
21070
|
mkdirp(target);
|
|
20956
21071
|
continue;
|
|
@@ -20958,8 +21073,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
20958
21073
|
let resolvedIsDir = false;
|
|
20959
21074
|
let resolved = entry;
|
|
20960
21075
|
try {
|
|
20961
|
-
resolved =
|
|
20962
|
-
resolvedIsDir =
|
|
21076
|
+
resolved = fs27.realpathSync(entry);
|
|
21077
|
+
resolvedIsDir = fs27.statSync(entry).isDirectory();
|
|
20963
21078
|
} catch {
|
|
20964
21079
|
resolvedIsDir = false;
|
|
20965
21080
|
}
|
|
@@ -20991,8 +21106,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
20991
21106
|
_log_tx_entry("skip", target);
|
|
20992
21107
|
continue;
|
|
20993
21108
|
}
|
|
20994
|
-
mkdirp(
|
|
20995
|
-
|
|
21109
|
+
mkdirp(path24.dirname(target));
|
|
21110
|
+
fs27.copyFileSync(resolved, target);
|
|
20996
21111
|
_inject_package_tag(target, resolved, package_root);
|
|
20997
21112
|
_log_tx_entry("write", target);
|
|
20998
21113
|
written += 1;
|
|
@@ -21005,7 +21120,7 @@ function _claude_desktop_bundles_dir() {
|
|
|
21005
21120
|
}
|
|
21006
21121
|
function _write_claude_desktop_marker(force, lockfile_path2, bundles_dir, bundle_count) {
|
|
21007
21122
|
const anchor = expanduser8(USER_SCOPE_PATHS["claude-desktop"]);
|
|
21008
|
-
const target =
|
|
21123
|
+
const target = path24.join(anchor, "agent-config.md");
|
|
21009
21124
|
mkdirp(anchor);
|
|
21010
21125
|
const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
|
|
21011
21126
|
if (tracker.resolve(target, force) === "preserve") {
|
|
@@ -21034,23 +21149,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
21034
21149
|
const wrapped = [];
|
|
21035
21150
|
const collisions = [];
|
|
21036
21151
|
const reserved = [];
|
|
21037
|
-
const commands_dir =
|
|
21152
|
+
const commands_dir = path24.join(anchor, "commands");
|
|
21038
21153
|
let flat_entries = [];
|
|
21039
21154
|
try {
|
|
21040
|
-
flat_entries =
|
|
21155
|
+
flat_entries = fs27.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
|
|
21041
21156
|
} catch {
|
|
21042
21157
|
}
|
|
21043
21158
|
for (const fname of flat_entries.sort()) {
|
|
21044
21159
|
const slug = fname.slice(0, -".md".length);
|
|
21045
21160
|
if (!is_claude_builtin_name(slug)) continue;
|
|
21046
|
-
|
|
21161
|
+
fs27.rmSync(path24.join(commands_dir, fname), { force: true });
|
|
21047
21162
|
current_files.delete(`commands/${fname}`);
|
|
21048
21163
|
reserved.push(slug);
|
|
21049
21164
|
}
|
|
21050
21165
|
const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
|
|
21051
21166
|
try {
|
|
21052
21167
|
const manifest = JSON.parse(
|
|
21053
|
-
|
|
21168
|
+
fs27.readFileSync(path24.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
|
|
21054
21169
|
);
|
|
21055
21170
|
for (const a of manifest.artefacts ?? []) {
|
|
21056
21171
|
if (a.category !== "command" || typeof a.slug !== "string") continue;
|
|
@@ -21061,22 +21176,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
21061
21176
|
}
|
|
21062
21177
|
for (const slug of [...eligible].sort()) {
|
|
21063
21178
|
const flat_rel = `commands/${slug}.md`;
|
|
21064
|
-
const flat_abs =
|
|
21065
|
-
if (!
|
|
21066
|
-
const skill_dir =
|
|
21067
|
-
if (
|
|
21179
|
+
const flat_abs = path24.join(anchor, "commands", `${slug}.md`);
|
|
21180
|
+
if (!fs27.existsSync(flat_abs)) continue;
|
|
21181
|
+
const skill_dir = path24.join(anchor, "skills", slug);
|
|
21182
|
+
if (fs27.existsSync(skill_dir)) {
|
|
21068
21183
|
collisions.push(slug);
|
|
21069
21184
|
continue;
|
|
21070
21185
|
}
|
|
21071
|
-
let body =
|
|
21186
|
+
let body = fs27.readFileSync(flat_abs, "utf8");
|
|
21072
21187
|
if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
|
|
21073
21188
|
body = body.replace("---\n", `---
|
|
21074
21189
|
name: ${slug}
|
|
21075
21190
|
`);
|
|
21076
21191
|
}
|
|
21077
|
-
|
|
21078
|
-
|
|
21079
|
-
|
|
21192
|
+
fs27.mkdirSync(skill_dir, { recursive: true });
|
|
21193
|
+
fs27.writeFileSync(path24.join(skill_dir, "SKILL.md"), body, "utf8");
|
|
21194
|
+
fs27.rmSync(flat_abs, { force: true });
|
|
21080
21195
|
current_files.delete(flat_rel);
|
|
21081
21196
|
current_files.add(`skills/${slug}/SKILL.md`);
|
|
21082
21197
|
wrapped.push(slug);
|
|
@@ -21108,8 +21223,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
21108
21223
|
const written_paths = [];
|
|
21109
21224
|
let current_files = /* @__PURE__ */ new Set();
|
|
21110
21225
|
for (const [src_rel, dest_sub] of plan) {
|
|
21111
|
-
const src =
|
|
21112
|
-
const dest = dest_sub ?
|
|
21226
|
+
const src = path24.join(package_root, src_rel);
|
|
21227
|
+
const dest = dest_sub ? path24.join(anchor, dest_sub) : anchor;
|
|
21113
21228
|
const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
|
|
21114
21229
|
const [w, s, paths] = _copy_dir_dereferencing_symlinks(
|
|
21115
21230
|
src,
|
|
@@ -21133,12 +21248,12 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
21133
21248
|
if (tool_id === "claude-code") {
|
|
21134
21249
|
const res = _apply_claude_flat_command_wrappers(anchor, package_root, current_files);
|
|
21135
21250
|
rewriteAndReport(
|
|
21136
|
-
|
|
21251
|
+
path24.join(anchor, "rules"),
|
|
21137
21252
|
state.QUIET,
|
|
21138
21253
|
info,
|
|
21139
21254
|
warn,
|
|
21140
21255
|
res,
|
|
21141
|
-
new Set(tracker.conflictState.preserved.map((p) =>
|
|
21256
|
+
new Set(tracker.conflictState.preserved.map((p) => path24.resolve(p)))
|
|
21142
21257
|
);
|
|
21143
21258
|
}
|
|
21144
21259
|
const missing_targets = _verify_deploy_targets(anchor, plan);
|
|
@@ -21181,10 +21296,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
21181
21296
|
results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
|
|
21182
21297
|
if (tool_id === "claude-code") {
|
|
21183
21298
|
try {
|
|
21184
|
-
const manifest =
|
|
21299
|
+
const manifest = path24.join(package_root, "src", "scripts", "hook_manifest.yaml");
|
|
21185
21300
|
const matrix = build_claude_hook_matrix(manifest);
|
|
21186
21301
|
const res = ensure_managed_hooks(
|
|
21187
|
-
|
|
21302
|
+
path24.join(anchor, "settings.json"),
|
|
21188
21303
|
matrix
|
|
21189
21304
|
);
|
|
21190
21305
|
if (!state.QUIET) {
|
|
@@ -21221,7 +21336,7 @@ function _preview_global_reap(tools, package_root) {
|
|
|
21221
21336
|
const anchor = expanduser8(anchor_raw);
|
|
21222
21337
|
let current_files = /* @__PURE__ */ new Set();
|
|
21223
21338
|
for (const [src_rel, dest_sub] of plan) {
|
|
21224
|
-
const src =
|
|
21339
|
+
const src = path24.join(package_root, src_rel);
|
|
21225
21340
|
current_files = setUnion(
|
|
21226
21341
|
current_files,
|
|
21227
21342
|
expected_deploy_files(
|
|
@@ -21255,14 +21370,14 @@ function _preview_global_reap(tools, package_root) {
|
|
|
21255
21370
|
function _verify_deploy_targets(anchor, plan) {
|
|
21256
21371
|
const missing = [];
|
|
21257
21372
|
for (const [, dest_sub] of plan) {
|
|
21258
|
-
const target = dest_sub ?
|
|
21373
|
+
const target = dest_sub ? path24.join(anchor, dest_sub) : anchor;
|
|
21259
21374
|
const label = dest_sub || ".";
|
|
21260
21375
|
if (!isDir(target)) {
|
|
21261
21376
|
missing.push(label);
|
|
21262
21377
|
continue;
|
|
21263
21378
|
}
|
|
21264
21379
|
try {
|
|
21265
|
-
const entries =
|
|
21380
|
+
const entries = fs27.readdirSync(target);
|
|
21266
21381
|
if (entries.length === 0) missing.push(label);
|
|
21267
21382
|
} catch {
|
|
21268
21383
|
missing.push(label);
|
|
@@ -21280,9 +21395,9 @@ function _resolve_global_settings_doc() {
|
|
|
21280
21395
|
}
|
|
21281
21396
|
function _resolve_global_settings_path() {
|
|
21282
21397
|
const root = event4u_root();
|
|
21283
|
-
const canonical =
|
|
21398
|
+
const canonical = path24.join(root, "settings", SETTINGS_FILE);
|
|
21284
21399
|
if (pathExists(canonical)) return canonical;
|
|
21285
|
-
const legacy =
|
|
21400
|
+
const legacy = path24.join(root, SETTINGS_FILE);
|
|
21286
21401
|
if (pathExists(legacy)) return legacy;
|
|
21287
21402
|
return null;
|
|
21288
21403
|
}
|
|
@@ -21393,7 +21508,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
21393
21508
|
info(` schema_version=1, agent_config_version=${installed_version}`);
|
|
21394
21509
|
info(` tools=${merged_tools.join(",")}`);
|
|
21395
21510
|
}
|
|
21396
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
21511
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path24.join(project_root, ".agent-src.uncondensed"))) {
|
|
21397
21512
|
const drift = collect_drift(project_root);
|
|
21398
21513
|
if (!state.QUIET) {
|
|
21399
21514
|
process4.stdout.write("\n");
|
|
@@ -21507,19 +21622,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
21507
21622
|
}
|
|
21508
21623
|
}
|
|
21509
21624
|
}
|
|
21510
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
21625
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path24.join(project_root, ".agent-src.uncondensed"))) {
|
|
21511
21626
|
const files_by_tool = filesByToolFromDeploy(deploy_results);
|
|
21512
21627
|
const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
|
|
21513
21628
|
if (rc !== 0) return rc;
|
|
21514
21629
|
const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
|
|
21515
21630
|
if (removed_marker !== null && !state.QUIET) {
|
|
21516
|
-
const rel = isRelativeTo(removed_marker, project_root) ?
|
|
21631
|
+
const rel = isRelativeTo(removed_marker, project_root) ? path24.relative(project_root, removed_marker) : removed_marker;
|
|
21517
21632
|
info(`Removed legacy bridge marker: ${rel}`);
|
|
21518
21633
|
}
|
|
21519
21634
|
const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
|
|
21520
21635
|
if (anchor_paths.length > 0 && !state.QUIET) {
|
|
21521
21636
|
for (const p of anchor_paths) {
|
|
21522
|
-
const rel = isRelativeTo(p, project_root) ?
|
|
21637
|
+
const rel = isRelativeTo(p, project_root) ? path24.relative(project_root, p) : p;
|
|
21523
21638
|
info(`Project anchor written: ${rel}`);
|
|
21524
21639
|
}
|
|
21525
21640
|
}
|
|
@@ -21555,8 +21670,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
21555
21670
|
}
|
|
21556
21671
|
function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
21557
21672
|
const log_candidates = [
|
|
21558
|
-
|
|
21559
|
-
...project_root ? [
|
|
21673
|
+
path24.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
21674
|
+
...project_root ? [path24.join(project_root, OBSERVATION_LOG)] : []
|
|
21560
21675
|
];
|
|
21561
21676
|
const records = log_candidates.flatMap((p) => readObservationLog(p));
|
|
21562
21677
|
if (records.length === 0) return [];
|
|
@@ -21579,13 +21694,13 @@ function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
|
21579
21694
|
function _scoped_migration_notice(deploy_results, project_root, package_root, probe) {
|
|
21580
21695
|
if (!isInteractiveSession(probe)) return [];
|
|
21581
21696
|
const log_candidates = [
|
|
21582
|
-
|
|
21583
|
-
...project_root ? [
|
|
21697
|
+
path24.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
21698
|
+
...project_root ? [path24.join(project_root, OBSERVATION_LOG)] : []
|
|
21584
21699
|
];
|
|
21585
21700
|
const limits = knownHostLimits(log_candidates.flatMap((p) => readObservationLog(p)));
|
|
21586
21701
|
if (limits.size === 0) return [];
|
|
21587
21702
|
const resolved = _resolve_scoped_projection(package_root);
|
|
21588
|
-
const settings_path = _resolve_global_settings_path() ??
|
|
21703
|
+
const settings_path = _resolve_global_settings_path() ?? path24.join(event4u_root(), "settings", SETTINGS_FILE);
|
|
21589
21704
|
for (const tool_id of Object.keys(deploy_results).sort()) {
|
|
21590
21705
|
const [, , status] = deploy_results[tool_id];
|
|
21591
21706
|
if (status !== "deployed") continue;
|
|
@@ -21604,8 +21719,8 @@ function _scoped_migration_notice(deploy_results, project_root, package_root, pr
|
|
|
21604
21719
|
}
|
|
21605
21720
|
return [];
|
|
21606
21721
|
}
|
|
21607
|
-
var SETTINGS_SURFACE_REL =
|
|
21608
|
-
var SETTINGS_DELTA_REL =
|
|
21722
|
+
var SETTINGS_SURFACE_REL = path24.join("state", "settings-surface.json");
|
|
21723
|
+
var SETTINGS_DELTA_REL = path24.join("state", "settings-delta.json");
|
|
21609
21724
|
function _current_settings_surface(version) {
|
|
21610
21725
|
const jsonSchema = zodToJsonSchema(settingsSchema, {
|
|
21611
21726
|
name: "AgentSettings",
|
|
@@ -21616,20 +21731,20 @@ function _current_settings_surface(version) {
|
|
|
21616
21731
|
}
|
|
21617
21732
|
function _write_settings_surface_snapshot(installed_version) {
|
|
21618
21733
|
const root = event4u_root();
|
|
21619
|
-
const surface_path =
|
|
21620
|
-
const delta_path =
|
|
21734
|
+
const surface_path = path24.join(root, SETTINGS_SURFACE_REL);
|
|
21735
|
+
const delta_path = path24.join(root, SETTINGS_DELTA_REL);
|
|
21621
21736
|
const next = _current_settings_surface(installed_version);
|
|
21622
21737
|
let previous = null;
|
|
21623
21738
|
try {
|
|
21624
|
-
const parsed = JSON.parse(
|
|
21739
|
+
const parsed = JSON.parse(fs27.readFileSync(surface_path, "utf8"));
|
|
21625
21740
|
if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
|
|
21626
21741
|
} catch {
|
|
21627
21742
|
}
|
|
21628
21743
|
if (previous !== null && previous.version !== next.version) {
|
|
21629
21744
|
const delta = computeSurfaceDelta(previous, next);
|
|
21630
21745
|
if (delta.changes.length > 0) {
|
|
21631
|
-
|
|
21632
|
-
|
|
21746
|
+
fs27.mkdirSync(path24.dirname(delta_path), { recursive: true, mode: 448 });
|
|
21747
|
+
fs27.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
|
|
21633
21748
|
`, { mode: 384 });
|
|
21634
21749
|
if (!state.QUIET) {
|
|
21635
21750
|
const counts = {};
|
|
@@ -21641,8 +21756,8 @@ function _write_settings_surface_snapshot(installed_version) {
|
|
|
21641
21756
|
}
|
|
21642
21757
|
}
|
|
21643
21758
|
}
|
|
21644
|
-
|
|
21645
|
-
|
|
21759
|
+
fs27.mkdirSync(path24.dirname(surface_path), { recursive: true, mode: 448 });
|
|
21760
|
+
fs27.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
|
|
21646
21761
|
`, { mode: 384 });
|
|
21647
21762
|
}
|
|
21648
21763
|
function arrayStrEqual(a, b) {
|
|
@@ -21862,13 +21977,13 @@ function _minimal_templates_root() {
|
|
|
21862
21977
|
const chain = [start];
|
|
21863
21978
|
let cur = start;
|
|
21864
21979
|
for (; ; ) {
|
|
21865
|
-
const parent =
|
|
21980
|
+
const parent = path24.dirname(cur);
|
|
21866
21981
|
if (parent === cur) break;
|
|
21867
21982
|
chain.push(parent);
|
|
21868
21983
|
cur = parent;
|
|
21869
21984
|
}
|
|
21870
21985
|
for (const ancestor of chain) {
|
|
21871
|
-
const candidate =
|
|
21986
|
+
const candidate = path24.join(ancestor, "src", "templates", "minimal");
|
|
21872
21987
|
if (isDir(candidate)) return candidate;
|
|
21873
21988
|
}
|
|
21874
21989
|
fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
|
|
@@ -21876,9 +21991,9 @@ function _minimal_templates_root() {
|
|
|
21876
21991
|
var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
21877
21992
|
function _write_install_mode_marker(project_root, mode) {
|
|
21878
21993
|
if (mode !== "minimal" && mode !== "full") return;
|
|
21879
|
-
const marker =
|
|
21994
|
+
const marker = path24.join(project_root, INSTALL_MODE_MARKER_REL);
|
|
21880
21995
|
try {
|
|
21881
|
-
mkdirp(
|
|
21996
|
+
mkdirp(path24.dirname(marker));
|
|
21882
21997
|
writeText(marker, `${mode}
|
|
21883
21998
|
`);
|
|
21884
21999
|
} catch {
|
|
@@ -21887,7 +22002,7 @@ function _write_install_mode_marker(project_root, mode) {
|
|
|
21887
22002
|
function install_minimal(target_root_in, force, user_type = "") {
|
|
21888
22003
|
let target_root = resolvePath(target_root_in);
|
|
21889
22004
|
mkdirp(target_root);
|
|
21890
|
-
const parent =
|
|
22005
|
+
const parent = path24.dirname(target_root);
|
|
21891
22006
|
if (parent !== target_root) {
|
|
21892
22007
|
const existing = find_project_root_with_anchor(parent);
|
|
21893
22008
|
if (existing !== null && existing[0] !== target_root) {
|
|
@@ -21898,21 +22013,21 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
21898
22013
|
}
|
|
21899
22014
|
}
|
|
21900
22015
|
const templates = _minimal_templates_root();
|
|
21901
|
-
const settings_src =
|
|
21902
|
-
const overrides_gitkeep_src =
|
|
21903
|
-
const overrides_readme_src =
|
|
22016
|
+
const settings_src = path24.join(templates, SETTINGS_FILE);
|
|
22017
|
+
const overrides_gitkeep_src = path24.join(templates, "overrides-gitkeep");
|
|
22018
|
+
const overrides_readme_src = path24.join(templates, "agents-overrides-readme.md");
|
|
21904
22019
|
if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
|
|
21905
22020
|
if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
|
|
21906
22021
|
fail(`Bundled overrides scaffold templates missing under ${templates}`);
|
|
21907
22022
|
}
|
|
21908
22023
|
info(`Minimal init \u2192 ${target_root}`);
|
|
21909
|
-
const overrides_root =
|
|
22024
|
+
const overrides_root = path24.join(target_root, "agents", "overrides");
|
|
21910
22025
|
mkdirp(overrides_root);
|
|
21911
22026
|
const gitkeep_body = readText(overrides_gitkeep_src);
|
|
21912
22027
|
for (const sub of ["rules", "skills", "commands"]) {
|
|
21913
|
-
const sub_dir =
|
|
22028
|
+
const sub_dir = path24.join(overrides_root, sub);
|
|
21914
22029
|
mkdirp(sub_dir);
|
|
21915
|
-
const gitkeep_dst =
|
|
22030
|
+
const gitkeep_dst = path24.join(sub_dir, ".gitkeep");
|
|
21916
22031
|
if (pathExists(gitkeep_dst) && !force) {
|
|
21917
22032
|
skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
|
|
21918
22033
|
} else {
|
|
@@ -21920,7 +22035,7 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
21920
22035
|
success(`Wrote agents/overrides/${sub}/.gitkeep`);
|
|
21921
22036
|
}
|
|
21922
22037
|
}
|
|
21923
|
-
const readme_dst =
|
|
22038
|
+
const readme_dst = path24.join(overrides_root, "README.md");
|
|
21924
22039
|
if (pathExists(readme_dst) && !force) {
|
|
21925
22040
|
skip("agents/overrides/README.md already exists (use --force to overwrite)");
|
|
21926
22041
|
} else {
|
|
@@ -21938,14 +22053,14 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
21938
22053
|
personal:
|
|
21939
22054
|
user_type: ${user_type}
|
|
21940
22055
|
`;
|
|
21941
|
-
mkdirp(
|
|
22056
|
+
mkdirp(path24.dirname(settings_dst));
|
|
21942
22057
|
writeText(settings_dst, body);
|
|
21943
22058
|
success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
|
|
21944
22059
|
}
|
|
21945
22060
|
}
|
|
21946
22061
|
const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
|
|
21947
22062
|
if (removed_marker !== null) {
|
|
21948
|
-
const rel = isRelativeTo(removed_marker, target_root) ?
|
|
22063
|
+
const rel = isRelativeTo(removed_marker, target_root) ? path24.relative(target_root, removed_marker) : removed_marker;
|
|
21949
22064
|
success(`Removed legacy bridge marker: ${rel}`);
|
|
21950
22065
|
}
|
|
21951
22066
|
_write_install_mode_marker(target_root, "minimal");
|
|
@@ -22019,7 +22134,7 @@ function run_interactive_init(project_root, force) {
|
|
|
22019
22134
|
);
|
|
22020
22135
|
return 0;
|
|
22021
22136
|
}
|
|
22022
|
-
const target =
|
|
22137
|
+
const target = path24.join(project_root, _LOCAL_CONFIG_FILE);
|
|
22023
22138
|
if (pathExists(target) && !force) {
|
|
22024
22139
|
warn(
|
|
22025
22140
|
`${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
|
|
@@ -22046,7 +22161,7 @@ function run_interactive_init(project_root, force) {
|
|
|
22046
22161
|
warn(`Could not write ${target}: ${String(exc)}`);
|
|
22047
22162
|
return 1;
|
|
22048
22163
|
}
|
|
22049
|
-
success(`Wrote ${
|
|
22164
|
+
success(`Wrote ${path24.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
|
|
22050
22165
|
return 0;
|
|
22051
22166
|
}
|
|
22052
22167
|
var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
|
|
@@ -22064,12 +22179,12 @@ function _wizard_should_launch(opts) {
|
|
|
22064
22179
|
return [true, ""];
|
|
22065
22180
|
}
|
|
22066
22181
|
function _wizard_cli_dist(_project_root) {
|
|
22067
|
-
const package_root =
|
|
22068
|
-
const cli =
|
|
22182
|
+
const package_root = path24.dirname(path24.dirname(path24.dirname(resolvePath(_HERE2))));
|
|
22183
|
+
const cli = path24.join(package_root, "dist", "cli", "agent-config.js");
|
|
22069
22184
|
return pathExists(cli) ? cli : null;
|
|
22070
22185
|
}
|
|
22071
22186
|
function _server_info_path() {
|
|
22072
|
-
return
|
|
22187
|
+
return path24.join(os8.homedir(), ".event4u", "agent-config", "local-server.json");
|
|
22073
22188
|
}
|
|
22074
22189
|
function _pid_is_agent_config(pid) {
|
|
22075
22190
|
let res;
|
|
@@ -22086,7 +22201,7 @@ function _pid_is_agent_config(pid) {
|
|
|
22086
22201
|
}
|
|
22087
22202
|
function unlinkMissingOk(p) {
|
|
22088
22203
|
try {
|
|
22089
|
-
|
|
22204
|
+
fs27.unlinkSync(p);
|
|
22090
22205
|
} catch {
|
|
22091
22206
|
}
|
|
22092
22207
|
}
|
|
@@ -22164,14 +22279,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
|
|
|
22164
22279
|
}
|
|
22165
22280
|
function _wizard_run_sync(cmd, env, cli) {
|
|
22166
22281
|
const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
|
|
22167
|
-
const log_path =
|
|
22282
|
+
const log_path = path24.join(
|
|
22168
22283
|
os8.tmpdir(),
|
|
22169
22284
|
`agent-config-wizard-${process4.pid}-${Date.now()}.log`
|
|
22170
22285
|
);
|
|
22171
22286
|
let child;
|
|
22172
22287
|
let log_fd = null;
|
|
22173
22288
|
try {
|
|
22174
|
-
log_fd =
|
|
22289
|
+
log_fd = fs27.openSync(log_path, "w");
|
|
22175
22290
|
child = spawn(cmd[0], cmd.slice(1), {
|
|
22176
22291
|
env,
|
|
22177
22292
|
detached: true,
|
|
@@ -22189,7 +22304,7 @@ function _wizard_run_sync(cmd, env, cli) {
|
|
|
22189
22304
|
} finally {
|
|
22190
22305
|
if (log_fd !== null) {
|
|
22191
22306
|
try {
|
|
22192
|
-
|
|
22307
|
+
fs27.closeSync(log_fd);
|
|
22193
22308
|
} catch {
|
|
22194
22309
|
}
|
|
22195
22310
|
}
|
|
@@ -22439,8 +22554,8 @@ function main2(argv) {
|
|
|
22439
22554
|
const target_root = resolvePath(
|
|
22440
22555
|
opts.custom_path || opts.project || process4.env["PROJECT_ROOT"] || process4.cwd()
|
|
22441
22556
|
);
|
|
22442
|
-
const minimal_package_root =
|
|
22443
|
-
|
|
22557
|
+
const minimal_package_root = path24.dirname(
|
|
22558
|
+
path24.dirname(path24.dirname(_minimal_templates_root()))
|
|
22444
22559
|
);
|
|
22445
22560
|
const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
|
|
22446
22561
|
return install_minimal(target_root, opts.force, validated_user_type);
|
|
@@ -22476,7 +22591,7 @@ function main2(argv) {
|
|
|
22476
22591
|
return rc2;
|
|
22477
22592
|
}
|
|
22478
22593
|
const project_root = custom_path || resolvePath(opts.project || process4.env["PROJECT_ROOT"] || process4.cwd());
|
|
22479
|
-
const is_first_run = !pathExists(
|
|
22594
|
+
const is_first_run = !pathExists(path24.join(project_root, SETTINGS_FILE));
|
|
22480
22595
|
tracker.begin(project_root);
|
|
22481
22596
|
let rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
|
|
22482
22597
|
if (rc === 0 && opts.interactive) {
|
|
@@ -22542,16 +22657,16 @@ function _team_setup_hint_line(project_root) {
|
|
|
22542
22657
|
return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
|
|
22543
22658
|
}
|
|
22544
22659
|
function finalize_claude_model_tiers(project_root) {
|
|
22545
|
-
const claude_skills =
|
|
22546
|
-
const augment_skills =
|
|
22660
|
+
const claude_skills = path24.join(project_root, ".claude", "skills");
|
|
22661
|
+
const augment_skills = path24.join(project_root, ".augment", "skills");
|
|
22547
22662
|
if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
|
|
22548
22663
|
if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
|
|
22549
22664
|
let rendered = 0;
|
|
22550
|
-
const entries =
|
|
22665
|
+
const entries = fs27.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
22551
22666
|
for (const name of entries) {
|
|
22552
|
-
const entry =
|
|
22553
|
-
const src_dir =
|
|
22554
|
-
const src_md =
|
|
22667
|
+
const entry = path24.join(claude_skills, name);
|
|
22668
|
+
const src_dir = path24.join(augment_skills, name);
|
|
22669
|
+
const src_md = path24.join(src_dir, "SKILL.md");
|
|
22555
22670
|
let tier;
|
|
22556
22671
|
try {
|
|
22557
22672
|
tier = read_model_tier(src_md);
|
|
@@ -22560,22 +22675,22 @@ function finalize_claude_model_tiers(project_root) {
|
|
|
22560
22675
|
}
|
|
22561
22676
|
if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
|
|
22562
22677
|
if (isSymlink(entry) || isFile(entry)) {
|
|
22563
|
-
|
|
22678
|
+
fs27.unlinkSync(entry);
|
|
22564
22679
|
} else if (isDir(entry)) {
|
|
22565
|
-
|
|
22680
|
+
fs27.rmSync(entry, { recursive: true, force: true });
|
|
22566
22681
|
}
|
|
22567
22682
|
mkdirp(entry);
|
|
22568
|
-
const srcFiles =
|
|
22683
|
+
const srcFiles = fs27.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
22569
22684
|
for (const fname of srcFiles) {
|
|
22570
22685
|
if (fname === "SKILL.md") {
|
|
22571
22686
|
writeText(
|
|
22572
|
-
|
|
22687
|
+
path24.join(entry, "SKILL.md"),
|
|
22573
22688
|
render_native_model_md(readText(src_md), tier)
|
|
22574
22689
|
);
|
|
22575
22690
|
} else {
|
|
22576
|
-
|
|
22577
|
-
|
|
22578
|
-
|
|
22691
|
+
fs27.symlinkSync(
|
|
22692
|
+
path24.join("../../../.augment/skills", name, fname),
|
|
22693
|
+
path24.join(entry, fname)
|
|
22579
22694
|
);
|
|
22580
22695
|
}
|
|
22581
22696
|
}
|
|
@@ -22593,7 +22708,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
22593
22708
|
let package_type;
|
|
22594
22709
|
if (opts.package) {
|
|
22595
22710
|
package_root = resolvePath(opts.package);
|
|
22596
|
-
if (!pathExists(
|
|
22711
|
+
if (!pathExists(path24.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
22597
22712
|
fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
|
|
22598
22713
|
}
|
|
22599
22714
|
package_type = detect_package_type_for_project(project_root, package_root);
|
|
@@ -22736,9 +22851,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
22736
22851
|
function _resolvedArgv1() {
|
|
22737
22852
|
if (process4.argv[1] === void 0) return void 0;
|
|
22738
22853
|
try {
|
|
22739
|
-
return
|
|
22854
|
+
return fs27.realpathSync(path24.resolve(process4.argv[1]));
|
|
22740
22855
|
} catch {
|
|
22741
|
-
return
|
|
22856
|
+
return path24.resolve(process4.argv[1]);
|
|
22742
22857
|
}
|
|
22743
22858
|
}
|
|
22744
22859
|
var _argv1 = _resolvedArgv1();
|