@event4u/agent-config 14.17.0 → 14.19.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 +207 -77
- package/README.md +72 -150
- package/dist/agent-src/README.md +1 -1
- package/dist/agent-src/commands/agent-handoff.md +2 -2
- package/dist/agent-src/commands/pr/merge.md +35 -44
- package/dist/agent-src/commands/review/changes.md +19 -19
- package/dist/agent-src/commands/review.md +2 -2
- package/dist/agent-src/contexts/execution/host-capability-manifest.md +30 -3
- package/dist/agent-src/rules/autonomous-execution.md +1 -1
- package/dist/agent-src/rules/git-history-discipline.md +2 -2
- package/dist/agent-src/rules/guidelines.md +1 -1
- package/dist/agent-src/rules/session-canary.md +2 -2
- package/dist/agent-src/rules/token-efficiency.md +1 -1
- package/dist/agent-src/skills/accessibility-auditor/SKILL.md +2 -0
- package/dist/agent-src/skills/adversarial-review/SKILL.md +0 -8
- package/dist/agent-src/skills/ai-code-blindspots/SKILL.md +27 -1
- package/dist/agent-src/skills/canvas-design/SKILL.md +1 -1
- package/dist/agent-src/skills/code-intelligence/SKILL.md +60 -12
- package/dist/agent-src/skills/complexity-first-planning/SKILL.md +27 -0
- package/dist/agent-src/skills/design-intelligence/SKILL.md +1 -1
- package/dist/agent-src/skills/design-intelligence/data/app-interface.csv +1 -1
- package/dist/agent-src/skills/design-intelligence/data/motion.csv +17 -17
- package/dist/agent-src/skills/design-intelligence/data/ux-guidelines.csv +2 -2
- package/dist/agent-src/skills/design-intelligence/references/context-and-registers.md +17 -0
- package/dist/agent-src/skills/design-intelligence/references/design-rules-checklist.md +4 -4
- package/dist/agent-src/skills/design-review/SKILL.md +3 -1
- package/dist/agent-src/skills/design-variations/SKILL.md +1 -1
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +1 -1
- package/dist/agent-src/skills/fe-design/SKILL.md +32 -5
- package/dist/agent-src/skills/fe-design/references/craft-floor.md +7 -0
- package/dist/agent-src/skills/fe-design/references/design-patterns.md +47 -2
- package/dist/agent-src/skills/feature-planning/SKILL.md +34 -0
- package/dist/agent-src/skills/git-workflow/SKILL.md +37 -12
- package/dist/agent-src/skills/git-workflow/references/push-closes-its-loop.md +176 -0
- package/dist/agent-src/skills/laravel-mail/SKILL.md +44 -0
- package/dist/agent-src/skills/laravel-scheduling/SKILL.md +3 -1
- package/dist/agent-src/skills/project-analyzer/SKILL.md +0 -6
- package/dist/agent-src/skills/react-native-setup/SKILL.md +3 -3
- package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +1 -1
- package/dist/agent-src/skills/sequential-thinking/SKILL.md +18 -8
- package/dist/agent-src/skills/tailwind-engineer/SKILL.md +1 -1
- package/dist/agent-src/skills/testing-anti-patterns/SKILL.md +40 -0
- package/dist/agent-src/skills/ui-apply-generic/SKILL.md +1 -1
- package/dist/agent-src/skills/ui-component-architect/SKILL.md +1 -1
- package/dist/agent-src/skills/using-git-worktrees/SKILL.md +29 -2
- package/dist/agent-src/skills/verify-repair-loop/SKILL.md +53 -8
- package/dist/agent-src/skills/worktree-lifecycle/SKILL.md +3 -1
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/cli/commands/recordTriggerEval.js +2 -2
- package/dist/cli/main.js +1 -1
- package/dist/cli-delegate/{chunk-AKJGUQNO.js → chunk-GZTMRYCN.js} +405 -341
- package/dist/cli-delegate/{chunk-7RXIKF62.js → chunk-IDHUQIXP.js} +283 -132
- package/dist/cli-delegate/cmd_adr_effective.js +318 -81
- package/dist/cli-delegate/cmd_conformance.js +749 -669
- package/dist/cli-delegate/cmd_doctor.js +1 -1
- package/dist/cli-delegate/cmd_export.js +1 -1
- package/dist/cli-delegate/cmd_handoff.js +1 -1
- package/dist/cli-delegate/cmd_prune.js +1 -1
- package/dist/cli-delegate/cmd_route_audit.js +1 -1
- package/dist/cli-delegate/cmd_settings_migrate.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +1 -1
- package/dist/cli-delegate/cmd_uninstall.js +1 -1
- package/dist/cli-delegate/cmd_validate.js +1 -1
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +39 -38
- 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 +2764 -2439
- package/dist/install/install.mjs +588 -527
- package/dist/mcp/registry-manifest.json +2 -2
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +1381 -1138
- package/dist/scripts/_lib/model_tier.js +1 -1
- package/dist/shared/settingsConsent.js +1 -1
- package/docs/guidelines/agent-infra/evaluator-independence-mechanics.md +1 -1
- package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +1 -1
- package/docs/guidelines/design-antipatterns.md +87 -64
- package/package.json +1 -1
- package/src/agent-src/README.md +1 -1
- package/src/config/ci-local-parity.yml +6 -0
- package/src/config/conformance-claim-baseline.json +9 -0
- package/src/config/gate-coverage.yml +170 -0
- package/src/config/gate-violation-baselines.json +4 -4
- package/src/config/release-gate-locality.yml +141 -0
- package/src/scripts/_cli/cmd_doctor.ts +2 -2
- package/src/scripts/_cli/cmd_handoff.ts +1 -1
- package/src/scripts/_cli/cmd_update.ts +1 -1
- package/src/scripts/_cli/cmd_versions.ts +1 -1
- package/src/scripts/_lib/adr_frontmatter.ts +44 -0
- package/src/scripts/_lib/consequence_objects.ts +152 -0
- package/src/scripts/_lib/exec_evidence.ts +7 -0
- package/src/scripts/_lib/global_deploy_inventory.ts +2 -2
- package/src/scripts/_lib/host_permission_checks.ts +251 -0
- package/src/scripts/_lib/model_tier.ts +1 -1
- package/src/scripts/_lib/obligation_frequency.ts +2 -2
- package/src/scripts/_lib/release_highlights.ts +265 -1
- package/src/scripts/_lib/release_material.ts +129 -0
- package/src/scripts/_lib/repeated_run.ts +77 -0
- package/src/scripts/_lib/runtime_journal.ts +26 -3
- package/src/scripts/_lib/runtime_wiring_checks.ts +12 -1
- package/src/scripts/_lib/session_register.ts +11 -6
- package/src/scripts/_lib/sqlite_schema.ts +22 -0
- package/src/scripts/_lib/surface.ts +86 -0
- package/src/scripts/_lib/tamper_vocabulary.ts +242 -0
- package/src/scripts/_lib/ui_authority.ts +116 -0
- package/src/scripts/_lib/unified_diff.ts +121 -0
- package/src/scripts/adr/regenerate_index.ts +54 -1
- package/src/scripts/adr_cite_check.ts +71 -15
- package/src/scripts/ai_council/clients.ts +1 -1
- package/src/scripts/autonomy_friction_corpus.ts +229 -0
- package/src/scripts/build_proof.ts +15 -2
- package/src/scripts/check_beta_review_markers.ts +141 -17
- package/src/scripts/check_enforcement_coverage.ts +1 -1
- package/src/scripts/check_enforcement_denominator.ts +121 -11
- package/src/scripts/check_finding_dispositions.ts +239 -6
- package/src/scripts/check_gate_coverage.ts +96 -0
- package/src/scripts/check_installed_hooks_fresh.ts +381 -0
- package/src/scripts/check_release_highlights.ts +99 -14
- package/src/scripts/check_skill_activation_claim.ts +179 -0
- package/src/scripts/check_suppression_hygiene.ts +11 -0
- package/src/scripts/check_trigger_evals.ts +1 -1
- package/src/scripts/code_graph/build.ts +230 -33
- package/src/scripts/code_graph/extract.ts +168 -33
- package/src/scripts/code_graph/types.ts +37 -2
- package/src/scripts/code_graph/validate.ts +12 -1
- package/src/scripts/conformance_scan.ts +45 -4
- package/src/scripts/detect_silent_catch.ts +403 -0
- package/src/scripts/detect_verification_tampering.ts +538 -0
- package/src/scripts/explain_run.ts +1 -1
- package/src/scripts/generate_capability_matrix.ts +1 -1
- package/src/scripts/git_authorization_hook.ts +228 -18
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +47 -30
- package/src/scripts/hooks/augment-dispatcher.sh +1 -1
- package/src/scripts/hooks/block_no_verify.ts +3 -3
- package/src/scripts/hooks/category_a.ts +291 -0
- package/src/scripts/hooks/cline-dispatcher.sh +1 -1
- package/src/scripts/hooks/concern_registry.ts +2 -2
- package/src/scripts/hooks/cursor-dispatcher.sh +11 -5
- package/src/scripts/hooks/dispatch_hook.ts +17 -22
- package/src/scripts/hooks/evidence_independence.ts +21 -2
- package/src/scripts/hooks/{block_unauthorized_git.ts → git_command_classifier.ts} +175 -364
- package/src/scripts/hooks/host_lowering.ts +215 -0
- package/src/scripts/hooks/host_lowering.yaml +185 -0
- package/src/scripts/hooks/host_semantics.ts +105 -37
- package/src/scripts/hooks/journal_record_hook.ts +10 -0
- package/src/scripts/hooks/permission_gate.ts +117 -0
- package/src/scripts/hooks/push_settle_hook.ts +250 -0
- package/src/scripts/hooks/ship_diff_volume_hook.ts +1 -1
- package/src/scripts/hooks_status.ts +12 -10
- package/src/scripts/install-hooks.sh +134 -1
- package/src/scripts/install.ts +53 -82
- package/src/scripts/install_anthropic_key.sh +2 -2
- package/src/scripts/language_mirror_hook.ts +27 -5
- package/src/scripts/lint_design_antipattern_parity.ts +80 -0
- package/src/scripts/lint_evidence_artifacts.ts +45 -1
- package/src/scripts/lint_hook_manifest.ts +87 -3
- package/src/scripts/lint_motion_authority_drift.ts +731 -0
- package/src/scripts/lint_readme_size.ts +158 -12
- package/src/scripts/lint_reasoning_fixtures.ts +216 -0
- package/src/scripts/lint_skill_trigger_contradiction.ts +161 -0
- package/src/scripts/measure_sibling_naming.ts +150 -0
- package/src/scripts/redact_hook_capture.ts +1 -1
- package/src/scripts/release.ts +31 -143
- package/src/scripts/release_drill.ts +71 -1
- package/src/scripts/release_publication.ts +243 -3
- package/src/scripts/release_verify.ts +220 -0
- package/src/scripts/report_skill_activation.ts +319 -7
- package/src/scripts/schemas/review-findings.schema.json +6 -1
- package/src/scripts/schemas/skill.schema.json +12 -2
- package/src/scripts/self_review_gate.ts +10 -1
- package/src/scripts/session_canary_hook.ts +1 -1
- package/src/scripts/session_register_hook.ts +4 -3
- package/src/scripts/trigger_eval_grandfather.json +5 -1
- package/src/scripts/validate_agent_settings.ts +1 -1
- package/src/shared/settingsConsent.ts +1 -1
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, path22) {
|
|
121
|
+
const ctrl = callVisitor(key, node, visitor, path22);
|
|
122
122
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
123
|
-
replaceNode(key,
|
|
124
|
-
return visit_(key, ctrl, visitor,
|
|
123
|
+
replaceNode(key, path22, ctrl);
|
|
124
|
+
return visit_(key, ctrl, visitor, path22);
|
|
125
125
|
}
|
|
126
126
|
if (typeof ctrl !== "symbol") {
|
|
127
127
|
if (identity.isCollection(node)) {
|
|
128
|
-
|
|
128
|
+
path22 = Object.freeze(path22.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, path22);
|
|
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
|
+
path22 = Object.freeze(path22.concat(node));
|
|
142
|
+
const ck = visit_("key", node.key, visitor, path22);
|
|
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, path22);
|
|
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, path22) {
|
|
169
|
+
const ctrl = await callVisitor(key, node, visitor, path22);
|
|
170
170
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
171
|
-
replaceNode(key,
|
|
172
|
-
return visitAsync_(key, ctrl, visitor,
|
|
171
|
+
replaceNode(key, path22, ctrl);
|
|
172
|
+
return visitAsync_(key, ctrl, visitor, path22);
|
|
173
173
|
}
|
|
174
174
|
if (typeof ctrl !== "symbol") {
|
|
175
175
|
if (identity.isCollection(node)) {
|
|
176
|
-
|
|
176
|
+
path22 = Object.freeze(path22.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, path22);
|
|
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
|
+
path22 = Object.freeze(path22.concat(node));
|
|
190
|
+
const ck = await visitAsync_("key", node.key, visitor, path22);
|
|
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, path22);
|
|
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, path22) {
|
|
223
223
|
if (typeof visitor === "function")
|
|
224
|
-
return visitor(key, node,
|
|
224
|
+
return visitor(key, node, path22);
|
|
225
225
|
if (identity.isMap(node))
|
|
226
|
-
return visitor.Map?.(key, node,
|
|
226
|
+
return visitor.Map?.(key, node, path22);
|
|
227
227
|
if (identity.isSeq(node))
|
|
228
|
-
return visitor.Seq?.(key, node,
|
|
228
|
+
return visitor.Seq?.(key, node, path22);
|
|
229
229
|
if (identity.isPair(node))
|
|
230
|
-
return visitor.Pair?.(key, node,
|
|
230
|
+
return visitor.Pair?.(key, node, path22);
|
|
231
231
|
if (identity.isScalar(node))
|
|
232
|
-
return visitor.Scalar?.(key, node,
|
|
232
|
+
return visitor.Scalar?.(key, node, path22);
|
|
233
233
|
if (identity.isAlias(node))
|
|
234
|
-
return visitor.Alias?.(key, node,
|
|
234
|
+
return visitor.Alias?.(key, node, path22);
|
|
235
235
|
return void 0;
|
|
236
236
|
}
|
|
237
|
-
function replaceNode(key,
|
|
238
|
-
const parent =
|
|
237
|
+
function replaceNode(key, path22, node) {
|
|
238
|
+
const parent = path22[path22.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, path22, value) {
|
|
849
849
|
let v = value;
|
|
850
|
-
for (let i =
|
|
851
|
-
const k =
|
|
850
|
+
for (let i = path22.length - 1; i >= 0; --i) {
|
|
851
|
+
const k = path22[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 = (path22) => path22 == null || typeof path22 === "object" && !!path22[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(path22, value) {
|
|
901
|
+
if (isEmptyPath(path22))
|
|
902
902
|
this.add(value);
|
|
903
903
|
else {
|
|
904
|
-
const [key, ...rest] =
|
|
904
|
+
const [key, ...rest] = path22;
|
|
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(path22) {
|
|
919
|
+
const [key, ...rest] = path22;
|
|
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(path22, keepScalar) {
|
|
934
|
+
const [key, ...rest] = path22;
|
|
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(path22) {
|
|
953
|
+
const [key, ...rest] = path22;
|
|
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(path22, value) {
|
|
964
|
+
const [key, ...rest] = path22;
|
|
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(path22, value) {
|
|
3480
3480
|
if (assertCollection(this.contents))
|
|
3481
|
-
this.contents.addIn(
|
|
3481
|
+
this.contents.addIn(path22, 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(path22) {
|
|
3557
|
+
if (Collection.isEmptyPath(path22)) {
|
|
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(path22) : 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(path22, keepScalar) {
|
|
3579
|
+
if (Collection.isEmptyPath(path22))
|
|
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(path22, 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(path22) {
|
|
3593
|
+
if (Collection.isEmptyPath(path22))
|
|
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(path22) : 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(path22, value) {
|
|
3613
|
+
if (Collection.isEmptyPath(path22)) {
|
|
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(path22), value);
|
|
3617
3617
|
} else if (assertCollection(this.contents)) {
|
|
3618
|
-
this.contents.setIn(
|
|
3618
|
+
this.contents.setIn(path22, 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, path22) => {
|
|
5579
5579
|
let item = cst;
|
|
5580
|
-
for (const [field, index] of
|
|
5580
|
+
for (const [field, index] of path22) {
|
|
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, path22) => {
|
|
5590
|
+
const parent = visit.itemAtPath(cst, path22.slice(0, -1));
|
|
5591
|
+
const field = path22[path22.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(path22, item, visitor) {
|
|
5598
|
+
let ctrl = visitor(item, path22);
|
|
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(path22.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, path22);
|
|
5617
5617
|
}
|
|
5618
5618
|
}
|
|
5619
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5619
|
+
return typeof ctrl === "function" ? ctrl(item, path22) : 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 fs25 = this.flowScalar(this.type);
|
|
6922
6922
|
if (atNextItem || it.value) {
|
|
6923
|
-
map.items.push({ start, key:
|
|
6923
|
+
map.items.push({ start, key: fs25, sep: [] });
|
|
6924
6924
|
this.onKeyLine = true;
|
|
6925
6925
|
} else if (it.sep) {
|
|
6926
|
-
this.stack.push(
|
|
6926
|
+
this.stack.push(fs25);
|
|
6927
6927
|
} else {
|
|
6928
|
-
Object.assign(it, { key:
|
|
6928
|
+
Object.assign(it, { key: fs25, 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 fs25 = this.flowScalar(this.type);
|
|
7057
7057
|
if (!it || it.value)
|
|
7058
|
-
fc.items.push({ start: [], key:
|
|
7058
|
+
fc.items.push({ start: [], key: fs25, sep: [] });
|
|
7059
7059
|
else if (it.sep)
|
|
7060
|
-
this.stack.push(
|
|
7060
|
+
this.stack.push(fs25);
|
|
7061
7061
|
else
|
|
7062
|
-
Object.assign(it, { key:
|
|
7062
|
+
Object.assign(it, { key: fs25, sep: [] });
|
|
7063
7063
|
return;
|
|
7064
7064
|
}
|
|
7065
7065
|
case "flow-map-end":
|
|
@@ -7370,11 +7370,11 @@ var require_dist = __commonJS({
|
|
|
7370
7370
|
// src/scripts/install.ts
|
|
7371
7371
|
import { spawn, spawnSync as spawnSync2 } from "node:child_process";
|
|
7372
7372
|
import * as crypto3 from "node:crypto";
|
|
7373
|
-
import * as
|
|
7373
|
+
import * as fs24 from "node:fs";
|
|
7374
7374
|
import * as os8 from "node:os";
|
|
7375
|
-
import * as
|
|
7375
|
+
import * as path21 from "node:path";
|
|
7376
7376
|
import process3 from "node:process";
|
|
7377
|
-
import { fileURLToPath as
|
|
7377
|
+
import { fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
7378
7378
|
|
|
7379
7379
|
// src/scripts/_lib/json_pointers.ts
|
|
7380
7380
|
import { createHash } from "node:crypto";
|
|
@@ -7873,8 +7873,8 @@ function lockfile_write_path(env) {
|
|
|
7873
7873
|
}
|
|
7874
7874
|
return write_target("installed.lock", { env: env ?? null });
|
|
7875
7875
|
}
|
|
7876
|
-
function read_lockfile(
|
|
7877
|
-
const target =
|
|
7876
|
+
function read_lockfile(path22) {
|
|
7877
|
+
const target = path22 ?? lockfile_path();
|
|
7878
7878
|
let text;
|
|
7879
7879
|
try {
|
|
7880
7880
|
text = fs2.readFileSync(target, { encoding: "utf-8" });
|
|
@@ -9079,18 +9079,18 @@ function manifest_path(project_root, env) {
|
|
|
9079
9079
|
var _TOP_KEY_RE = /^([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
|
|
9080
9080
|
var _LIST_DASH_RE = /^\s*-\s*(.+?)\s*$/;
|
|
9081
9081
|
var _INDENT_KEY_RE = /^\s+([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
|
|
9082
|
-
function read_manifest(
|
|
9082
|
+
function read_manifest(path22) {
|
|
9083
9083
|
let text;
|
|
9084
9084
|
try {
|
|
9085
|
-
text = require_read_text(
|
|
9085
|
+
text = require_read_text(path22);
|
|
9086
9086
|
} catch {
|
|
9087
9087
|
return null;
|
|
9088
9088
|
}
|
|
9089
9089
|
const data = _parse_manual(text);
|
|
9090
9090
|
return _normalise_v2_shape(data);
|
|
9091
9091
|
}
|
|
9092
|
-
function require_read_text(
|
|
9093
|
-
return fs9.readFileSync(
|
|
9092
|
+
function require_read_text(path22) {
|
|
9093
|
+
return fs9.readFileSync(path22, { encoding: "utf-8" });
|
|
9094
9094
|
}
|
|
9095
9095
|
function _normalise_v2_shape(data) {
|
|
9096
9096
|
if (data["tools"] === void 0 || data["tools"] === null) {
|
|
@@ -9271,9 +9271,9 @@ function stable_sort(items, key) {
|
|
|
9271
9271
|
return a.index - b.index;
|
|
9272
9272
|
}).map((entry) => entry.item);
|
|
9273
9273
|
}
|
|
9274
|
-
function write_manifest(
|
|
9274
|
+
function write_manifest(path22, version, tools, options = {}) {
|
|
9275
9275
|
const rendered = _render2(version, tools, { deploy_roots: options.deploy_roots ?? null });
|
|
9276
|
-
return write_atomic(
|
|
9276
|
+
return write_atomic(path22, rendered);
|
|
9277
9277
|
}
|
|
9278
9278
|
var ScopeMismatchError = class extends Error {
|
|
9279
9279
|
name_;
|
|
@@ -10119,12 +10119,106 @@ function ensure_managed_hooks(settings_path, matrix) {
|
|
|
10119
10119
|
});
|
|
10120
10120
|
}
|
|
10121
10121
|
|
|
10122
|
-
// src/scripts/
|
|
10123
|
-
|
|
10122
|
+
// src/scripts/hooks/host_lowering.ts
|
|
10123
|
+
var import_yaml2 = __toESM(require_dist(), 1);
|
|
10124
10124
|
import * as fs14 from "node:fs";
|
|
10125
|
-
import * as os6 from "node:os";
|
|
10126
10125
|
import * as path13 from "node:path";
|
|
10127
10126
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
10127
|
+
var _IN_BUNDLE = true;
|
|
10128
|
+
var _REPO_ROOT = path13.resolve(
|
|
10129
|
+
path13.dirname(fileURLToPath2(import.meta.url)),
|
|
10130
|
+
..._IN_BUNDLE ? ["..", ".."] : ["..", "..", ".."]
|
|
10131
|
+
);
|
|
10132
|
+
var HOST_LOWERING_PATH = path13.join(_REPO_ROOT, "src", "scripts", "hooks", "host_lowering.yaml");
|
|
10133
|
+
var DEFAULT_SURFACE = "any";
|
|
10134
|
+
function _asString(v) {
|
|
10135
|
+
if (v === null || v === void 0) return null;
|
|
10136
|
+
if (v instanceof Date) return v.toISOString().slice(0, 10);
|
|
10137
|
+
return String(v);
|
|
10138
|
+
}
|
|
10139
|
+
function _parse(text) {
|
|
10140
|
+
const raw = (0, import_yaml2.parse)(text);
|
|
10141
|
+
const hostsRaw = raw?.["hosts"];
|
|
10142
|
+
if (typeof hostsRaw !== "object" || hostsRaw === null) {
|
|
10143
|
+
throw new Error("host_lowering.yaml: missing `hosts:` map");
|
|
10144
|
+
}
|
|
10145
|
+
const out = /* @__PURE__ */ new Map();
|
|
10146
|
+
for (const [host, hv] of Object.entries(hostsRaw)) {
|
|
10147
|
+
const surfacesRaw = hv?.["surfaces"];
|
|
10148
|
+
if (typeof surfacesRaw !== "object" || surfacesRaw === null) {
|
|
10149
|
+
throw new Error(`host_lowering.yaml: ${host} has no \`surfaces:\` map`);
|
|
10150
|
+
}
|
|
10151
|
+
const surfaces = /* @__PURE__ */ new Map();
|
|
10152
|
+
for (const [surface, sv] of Object.entries(surfacesRaw)) {
|
|
10153
|
+
const s = sv;
|
|
10154
|
+
const verifiedRaw = s["verified"];
|
|
10155
|
+
let verified = null;
|
|
10156
|
+
if (verifiedRaw) {
|
|
10157
|
+
const expires = _asString(verifiedRaw["expires"]);
|
|
10158
|
+
if (!expires) {
|
|
10159
|
+
throw new Error(`host_lowering.yaml: ${host}/${surface} verified block has no \`expires\``);
|
|
10160
|
+
}
|
|
10161
|
+
verified = {
|
|
10162
|
+
docs_at: _asString(verifiedRaw["docs_at"]),
|
|
10163
|
+
docs_url: _asString(verifiedRaw["docs_url"]),
|
|
10164
|
+
probe_at: _asString(verifiedRaw["probe_at"]),
|
|
10165
|
+
host_version: _asString(verifiedRaw["host_version"]),
|
|
10166
|
+
expires
|
|
10167
|
+
};
|
|
10168
|
+
}
|
|
10169
|
+
const slots = /* @__PURE__ */ new Map();
|
|
10170
|
+
for (const [slot, rvRaw] of Object.entries(s["slots"] ?? {})) {
|
|
10171
|
+
const rv = rvRaw;
|
|
10172
|
+
const nativeRaw = rv["native"];
|
|
10173
|
+
const native = Array.isArray(nativeRaw) ? nativeRaw.map(String) : [String(nativeRaw)];
|
|
10174
|
+
const be = rv["block_exit"];
|
|
10175
|
+
const row = {
|
|
10176
|
+
native,
|
|
10177
|
+
block_exit: typeof be === "number" ? be : null
|
|
10178
|
+
};
|
|
10179
|
+
if (typeof rv["matcher"] === "string") row.matcher = rv["matcher"];
|
|
10180
|
+
slots.set(slot, row);
|
|
10181
|
+
}
|
|
10182
|
+
surfaces.set(surface, {
|
|
10183
|
+
entry_shape: String(s["entry_shape"] ?? "none"),
|
|
10184
|
+
json_shape: String(s["json_shape"] ?? "none"),
|
|
10185
|
+
fail_policy: String(s["fail_policy"] ?? "discard"),
|
|
10186
|
+
timeout_unit: String(s["timeout_unit"] ?? "unknown"),
|
|
10187
|
+
timeout_default: typeof s["timeout_default"] === "number" ? s["timeout_default"] : null,
|
|
10188
|
+
verified,
|
|
10189
|
+
slots
|
|
10190
|
+
});
|
|
10191
|
+
}
|
|
10192
|
+
out.set(host, surfaces);
|
|
10193
|
+
}
|
|
10194
|
+
return out;
|
|
10195
|
+
}
|
|
10196
|
+
var _cache = null;
|
|
10197
|
+
function loadHostLowering() {
|
|
10198
|
+
if (_cache === null) _cache = _parse(fs14.readFileSync(HOST_LOWERING_PATH, "utf-8"));
|
|
10199
|
+
return _cache;
|
|
10200
|
+
}
|
|
10201
|
+
function surfaceRow(host, surface = DEFAULT_SURFACE, table = loadHostLowering()) {
|
|
10202
|
+
return table.get(host)?.get(surface) ?? table.get(host)?.get(DEFAULT_SURFACE) ?? null;
|
|
10203
|
+
}
|
|
10204
|
+
function hostBindings(host, table = loadHostLowering()) {
|
|
10205
|
+
const row = surfaceRow(host, DEFAULT_SURFACE, table);
|
|
10206
|
+
if (!row) return [];
|
|
10207
|
+
const out = [];
|
|
10208
|
+
for (const [slot, sr] of row.slots) {
|
|
10209
|
+
for (const native of sr.native) {
|
|
10210
|
+
out.push({ slot, native, matcher: sr.matcher ?? "" });
|
|
10211
|
+
}
|
|
10212
|
+
}
|
|
10213
|
+
return out;
|
|
10214
|
+
}
|
|
10215
|
+
|
|
10216
|
+
// src/scripts/_lib/agent_settings.ts
|
|
10217
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
10218
|
+
import * as fs15 from "node:fs";
|
|
10219
|
+
import * as os6 from "node:os";
|
|
10220
|
+
import * as path14 from "node:path";
|
|
10221
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
10128
10222
|
|
|
10129
10223
|
// src/shared/settingsCarveOut.ts
|
|
10130
10224
|
var SETTINGS_CARVE_OUT = [
|
|
@@ -10221,10 +10315,10 @@ var DEFAULT_PROJECT_FILE = ".agent-settings.yml";
|
|
|
10221
10315
|
var LOCAL_PROJECT_FILE = ".agent-settings.local.yml";
|
|
10222
10316
|
var LOCAL_PROJECT_SUBDIR = ["agents", "settings"];
|
|
10223
10317
|
function _local_settings_path(project_root) {
|
|
10224
|
-
return
|
|
10318
|
+
return path14.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
|
|
10225
10319
|
}
|
|
10226
10320
|
function _canonical_settings_path(project_root) {
|
|
10227
|
-
return
|
|
10321
|
+
return path14.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
|
|
10228
10322
|
}
|
|
10229
10323
|
var USER_GLOBAL_FILENAME = "agent-settings.yml";
|
|
10230
10324
|
function DEFAULT_USER_GLOBAL_FILE() {
|
|
@@ -10278,10 +10372,10 @@ var MERGEABLE_KEYS = [
|
|
|
10278
10372
|
"knowledge.global_sharing.freshness.hypothesis_after_days",
|
|
10279
10373
|
"knowledge.global_sharing.freshness.stale_after_days"
|
|
10280
10374
|
];
|
|
10281
|
-
var TEMPLATE_RELATIVE =
|
|
10282
|
-
var _PACKAGE_ROOT =
|
|
10375
|
+
var TEMPLATE_RELATIVE = path14.join("src", "config", "agent-settings.template.yml");
|
|
10376
|
+
var _PACKAGE_ROOT = path14.resolve(path14.dirname(fileURLToPath3(import.meta.url)), "..", "..", "..");
|
|
10283
10377
|
function default_template_path() {
|
|
10284
|
-
return
|
|
10378
|
+
return path14.join(_PACKAGE_ROOT, TEMPLATE_RELATIVE);
|
|
10285
10379
|
}
|
|
10286
10380
|
function _is_placeholder(value) {
|
|
10287
10381
|
return typeof value === "string" && /^__[A-Z0-9_]+__$/.test(value);
|
|
@@ -10332,8 +10426,8 @@ var _AGENTS_DIR_MARKERS = [
|
|
|
10332
10426
|
var _LEGACY_ANCHOR_ENV = "AGENT_CONFIG_LEGACY_ANCHOR";
|
|
10333
10427
|
function _exists(p) {
|
|
10334
10428
|
try {
|
|
10335
|
-
|
|
10336
|
-
|
|
10429
|
+
fs15.lstatSync(p);
|
|
10430
|
+
fs15.statSync(p);
|
|
10337
10431
|
return true;
|
|
10338
10432
|
} catch {
|
|
10339
10433
|
return false;
|
|
@@ -10341,22 +10435,22 @@ function _exists(p) {
|
|
|
10341
10435
|
}
|
|
10342
10436
|
function _is_dir2(p) {
|
|
10343
10437
|
try {
|
|
10344
|
-
return
|
|
10438
|
+
return fs15.statSync(p).isDirectory();
|
|
10345
10439
|
} catch {
|
|
10346
10440
|
return false;
|
|
10347
10441
|
}
|
|
10348
10442
|
}
|
|
10349
10443
|
function _is_file(p) {
|
|
10350
10444
|
try {
|
|
10351
|
-
return
|
|
10445
|
+
return fs15.statSync(p).isFile();
|
|
10352
10446
|
} catch {
|
|
10353
10447
|
return false;
|
|
10354
10448
|
}
|
|
10355
10449
|
}
|
|
10356
10450
|
function _resolve(p) {
|
|
10357
|
-
const absolute =
|
|
10451
|
+
const absolute = path14.resolve(p);
|
|
10358
10452
|
try {
|
|
10359
|
-
return
|
|
10453
|
+
return fs15.realpathSync(absolute);
|
|
10360
10454
|
} catch {
|
|
10361
10455
|
return absolute;
|
|
10362
10456
|
}
|
|
@@ -10366,7 +10460,7 @@ function _ancestor_chain(start) {
|
|
|
10366
10460
|
let cursor = start;
|
|
10367
10461
|
for (; ; ) {
|
|
10368
10462
|
chain.push(cursor);
|
|
10369
|
-
const parent =
|
|
10463
|
+
const parent = path14.dirname(cursor);
|
|
10370
10464
|
if (parent === cursor) {
|
|
10371
10465
|
break;
|
|
10372
10466
|
}
|
|
@@ -10375,15 +10469,15 @@ function _ancestor_chain(start) {
|
|
|
10375
10469
|
return chain;
|
|
10376
10470
|
}
|
|
10377
10471
|
function _boundary_anchor_at(dir) {
|
|
10378
|
-
const agents_dir =
|
|
10472
|
+
const agents_dir = path14.join(dir, "agents");
|
|
10379
10473
|
if (_is_dir2(agents_dir)) {
|
|
10380
10474
|
for (const marker of _AGENTS_DIR_MARKERS) {
|
|
10381
|
-
if (_exists(
|
|
10475
|
+
if (_exists(path14.join(agents_dir, marker))) {
|
|
10382
10476
|
return ANCHOR_AGENTS_DIR;
|
|
10383
10477
|
}
|
|
10384
10478
|
}
|
|
10385
10479
|
}
|
|
10386
|
-
if (_exists(
|
|
10480
|
+
if (_exists(path14.join(dir, ".git"))) {
|
|
10387
10481
|
return ANCHOR_GIT;
|
|
10388
10482
|
}
|
|
10389
10483
|
return null;
|
|
@@ -10394,7 +10488,7 @@ function find_project_root_with_anchor(start) {
|
|
|
10394
10488
|
const chain = _ancestor_chain(current);
|
|
10395
10489
|
if (legacy) {
|
|
10396
10490
|
for (const candidate of chain) {
|
|
10397
|
-
if (_exists(
|
|
10491
|
+
if (_exists(path14.join(candidate, ".git"))) {
|
|
10398
10492
|
return [candidate, ANCHOR_GIT];
|
|
10399
10493
|
}
|
|
10400
10494
|
}
|
|
@@ -10408,7 +10502,7 @@ function find_project_root_with_anchor(start) {
|
|
|
10408
10502
|
}
|
|
10409
10503
|
let outermost = null;
|
|
10410
10504
|
for (const candidate of chain) {
|
|
10411
|
-
if (_exists(
|
|
10505
|
+
if (_exists(path14.join(candidate, DEFAULT_PROJECT_FILE))) {
|
|
10412
10506
|
outermost = candidate;
|
|
10413
10507
|
}
|
|
10414
10508
|
}
|
|
@@ -10452,7 +10546,7 @@ function _expanduser(p) {
|
|
|
10452
10546
|
return os6.homedir();
|
|
10453
10547
|
}
|
|
10454
10548
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
10455
|
-
return
|
|
10549
|
+
return path14.join(os6.homedir(), p.slice(2));
|
|
10456
10550
|
}
|
|
10457
10551
|
return p;
|
|
10458
10552
|
}
|
|
@@ -10481,13 +10575,13 @@ function resolve_project_root(arg, options = {}) {
|
|
|
10481
10575
|
function _resolve_cascade_paths(cwd, project_path) {
|
|
10482
10576
|
if (cwd === null) {
|
|
10483
10577
|
const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
|
|
10484
|
-
const parent =
|
|
10578
|
+
const parent = path14.dirname(legacy);
|
|
10485
10579
|
return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
|
|
10486
10580
|
}
|
|
10487
10581
|
const root = find_project_root(cwd);
|
|
10488
10582
|
if (root === null) {
|
|
10489
10583
|
const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
|
|
10490
|
-
const parent =
|
|
10584
|
+
const parent = path14.dirname(legacy);
|
|
10491
10585
|
return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
|
|
10492
10586
|
}
|
|
10493
10587
|
const cwd_resolved = _resolve(cwd);
|
|
@@ -10498,7 +10592,7 @@ function _resolve_cascade_paths(cwd, project_path) {
|
|
|
10498
10592
|
if (cursor === root) {
|
|
10499
10593
|
break;
|
|
10500
10594
|
}
|
|
10501
|
-
const parent =
|
|
10595
|
+
const parent = path14.dirname(cursor);
|
|
10502
10596
|
if (parent === cursor) {
|
|
10503
10597
|
break;
|
|
10504
10598
|
}
|
|
@@ -10506,7 +10600,7 @@ function _resolve_cascade_paths(cwd, project_path) {
|
|
|
10506
10600
|
}
|
|
10507
10601
|
chain.reverse();
|
|
10508
10602
|
return [
|
|
10509
|
-
...chain.map((d) =>
|
|
10603
|
+
...chain.map((d) => path14.join(d, DEFAULT_PROJECT_FILE)),
|
|
10510
10604
|
_canonical_settings_path(root),
|
|
10511
10605
|
_local_settings_path(root)
|
|
10512
10606
|
];
|
|
@@ -10593,7 +10687,7 @@ function _read_yaml(p) {
|
|
|
10593
10687
|
}
|
|
10594
10688
|
let data;
|
|
10595
10689
|
try {
|
|
10596
|
-
const text =
|
|
10690
|
+
const text = fs15.readFileSync(p, "utf-8");
|
|
10597
10691
|
data = YAML3.parse(text, { version: "1.1" });
|
|
10598
10692
|
if (data === null || data === void 0) {
|
|
10599
10693
|
data = {};
|
|
@@ -10693,12 +10787,12 @@ function _is_plain_dict(value) {
|
|
|
10693
10787
|
}
|
|
10694
10788
|
|
|
10695
10789
|
// src/install/rule_scope.ts
|
|
10696
|
-
import * as
|
|
10790
|
+
import * as path15 from "node:path";
|
|
10697
10791
|
|
|
10698
10792
|
// src/install/ruleInScope.ts
|
|
10699
10793
|
var YAML2 = __toESM(require_dist(), 1);
|
|
10700
|
-
import * as
|
|
10701
|
-
function
|
|
10794
|
+
import * as fs16 from "node:fs";
|
|
10795
|
+
function parseYaml3(text) {
|
|
10702
10796
|
try {
|
|
10703
10797
|
const data = YAML2.parse(text, { version: "1.1" });
|
|
10704
10798
|
return data === void 0 ? null : data;
|
|
@@ -10722,7 +10816,7 @@ function parseFrontmatter(content) {
|
|
|
10722
10816
|
}
|
|
10723
10817
|
const raw = strip(content.slice(3, end));
|
|
10724
10818
|
const body = lstripNewlines(content.slice(end + 4));
|
|
10725
|
-
let meta =
|
|
10819
|
+
let meta = parseYaml3(raw);
|
|
10726
10820
|
if (meta === null || meta === void 0) {
|
|
10727
10821
|
meta = {};
|
|
10728
10822
|
}
|
|
@@ -10735,7 +10829,7 @@ function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null)
|
|
|
10735
10829
|
if (scope === null && pack_scope === null && role_scope === null) {
|
|
10736
10830
|
return true;
|
|
10737
10831
|
}
|
|
10738
|
-
const [meta] = parseFrontmatter(
|
|
10832
|
+
const [meta] = parseFrontmatter(fs16.readFileSync(source_path, "utf-8"));
|
|
10739
10833
|
if (meta["type"] === "always" || meta["alwaysApply"] === true) {
|
|
10740
10834
|
return true;
|
|
10741
10835
|
}
|
|
@@ -10786,7 +10880,7 @@ function ruleFileArrives(sourcePath, scope) {
|
|
|
10786
10880
|
if (!sourcePath.endsWith(".md")) {
|
|
10787
10881
|
return true;
|
|
10788
10882
|
}
|
|
10789
|
-
const basename7 =
|
|
10883
|
+
const basename7 = path15.basename(sourcePath);
|
|
10790
10884
|
if (COMPAT_ALWAYS_EXCLUDED.includes(basename7)) {
|
|
10791
10885
|
return false;
|
|
10792
10886
|
}
|
|
@@ -10794,26 +10888,26 @@ function ruleFileArrives(sourcePath, scope) {
|
|
|
10794
10888
|
}
|
|
10795
10889
|
|
|
10796
10890
|
// src/install/partitionEligibility.ts
|
|
10797
|
-
import * as
|
|
10891
|
+
import * as fs18 from "node:fs";
|
|
10798
10892
|
import * as os7 from "node:os";
|
|
10799
10893
|
|
|
10800
10894
|
// src/install/hostLayerFingerprint.ts
|
|
10801
10895
|
import { createHash as createHash4 } from "node:crypto";
|
|
10802
|
-
import * as
|
|
10803
|
-
import * as
|
|
10896
|
+
import * as fs17 from "node:fs";
|
|
10897
|
+
import * as path16 from "node:path";
|
|
10804
10898
|
var FINGERPRINT_SCHEMA = 1;
|
|
10805
10899
|
function collectFiles(dir) {
|
|
10806
10900
|
const out = [];
|
|
10807
10901
|
const walk = (d) => {
|
|
10808
10902
|
let entries;
|
|
10809
10903
|
try {
|
|
10810
|
-
entries =
|
|
10904
|
+
entries = fs17.readdirSync(d, { withFileTypes: true });
|
|
10811
10905
|
} catch {
|
|
10812
10906
|
return;
|
|
10813
10907
|
}
|
|
10814
10908
|
const sorted = [...entries].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
10815
10909
|
for (const e of sorted) {
|
|
10816
|
-
const p =
|
|
10910
|
+
const p = path16.join(d, e.name);
|
|
10817
10911
|
if (e.isDirectory()) {
|
|
10818
10912
|
walk(p);
|
|
10819
10913
|
} else if (e.isFile()) {
|
|
@@ -10830,10 +10924,10 @@ function fingerprintLayers(layers) {
|
|
|
10830
10924
|
for (const layer of layers) {
|
|
10831
10925
|
h.update(`layer:${layer.label}\0`);
|
|
10832
10926
|
for (const file of collectFiles(layer.root)) {
|
|
10833
|
-
h.update(
|
|
10927
|
+
h.update(path16.relative(layer.root, file));
|
|
10834
10928
|
h.update("\0");
|
|
10835
10929
|
try {
|
|
10836
|
-
h.update(
|
|
10930
|
+
h.update(fs17.readFileSync(file));
|
|
10837
10931
|
} catch {
|
|
10838
10932
|
h.update("\0unreadable\0");
|
|
10839
10933
|
}
|
|
@@ -10843,11 +10937,11 @@ function fingerprintLayers(layers) {
|
|
|
10843
10937
|
return h.digest("hex");
|
|
10844
10938
|
}
|
|
10845
10939
|
function hostLayerInputs(userHome) {
|
|
10846
|
-
const claude =
|
|
10940
|
+
const claude = path16.join(userHome, ".claude");
|
|
10847
10941
|
return [
|
|
10848
|
-
{ label: "rules", root:
|
|
10849
|
-
{ label: "skills", root:
|
|
10850
|
-
{ label: "commands", root:
|
|
10942
|
+
{ label: "rules", root: path16.join(claude, "rules") },
|
|
10943
|
+
{ label: "skills", root: path16.join(claude, "skills") },
|
|
10944
|
+
{ label: "commands", root: path16.join(claude, "commands") }
|
|
10851
10945
|
];
|
|
10852
10946
|
}
|
|
10853
10947
|
|
|
@@ -10856,7 +10950,7 @@ var MAINTAINER_WORKSPACE = "agent-config-maintainer";
|
|
|
10856
10950
|
function isExclusivelyPackageOnly(source_path) {
|
|
10857
10951
|
let meta;
|
|
10858
10952
|
try {
|
|
10859
|
-
[meta] = parseFrontmatter(
|
|
10953
|
+
[meta] = parseFrontmatter(fs18.readFileSync(source_path, "utf-8"));
|
|
10860
10954
|
} catch {
|
|
10861
10955
|
return false;
|
|
10862
10956
|
}
|
|
@@ -10887,8 +10981,8 @@ function stampHostLayerFingerprint(installedVersion, tools, lockfilePath, skip2,
|
|
|
10887
10981
|
}
|
|
10888
10982
|
|
|
10889
10983
|
// src/install/claudeRuleRewrite.ts
|
|
10890
|
-
import * as
|
|
10891
|
-
import * as
|
|
10984
|
+
import * as fs19 from "node:fs";
|
|
10985
|
+
import * as path17 from "node:path";
|
|
10892
10986
|
|
|
10893
10987
|
// src/install/claudePathsPlan.ts
|
|
10894
10988
|
function derive_trigger_globs(meta) {
|
|
@@ -11044,22 +11138,22 @@ function rewriteClaudeRules(rulesDir) {
|
|
|
11044
11138
|
const result = { rewritten: 0, scoped: [], dropped: [], failed: [] };
|
|
11045
11139
|
let entries;
|
|
11046
11140
|
try {
|
|
11047
|
-
entries =
|
|
11141
|
+
entries = fs19.readdirSync(rulesDir);
|
|
11048
11142
|
} catch {
|
|
11049
11143
|
return result;
|
|
11050
11144
|
}
|
|
11051
11145
|
for (const name of entries.filter((n) => n.endsWith(".md")).sort()) {
|
|
11052
|
-
const full =
|
|
11146
|
+
const full = path17.join(rulesDir, name);
|
|
11053
11147
|
let stat;
|
|
11054
11148
|
try {
|
|
11055
|
-
stat =
|
|
11149
|
+
stat = fs19.lstatSync(full);
|
|
11056
11150
|
} catch {
|
|
11057
11151
|
continue;
|
|
11058
11152
|
}
|
|
11059
11153
|
if (!stat.isFile() || stat.isSymbolicLink()) continue;
|
|
11060
11154
|
let text;
|
|
11061
11155
|
try {
|
|
11062
|
-
text =
|
|
11156
|
+
text = fs19.readFileSync(full, "utf-8");
|
|
11063
11157
|
} catch {
|
|
11064
11158
|
continue;
|
|
11065
11159
|
}
|
|
@@ -11069,7 +11163,7 @@ function rewriteClaudeRules(rulesDir) {
|
|
|
11069
11163
|
const withOwnership = _withPreservedKeys(rendered.text, text);
|
|
11070
11164
|
if (withOwnership !== text) {
|
|
11071
11165
|
try {
|
|
11072
|
-
|
|
11166
|
+
fs19.writeFileSync(full, withOwnership, "utf-8");
|
|
11073
11167
|
} catch (e) {
|
|
11074
11168
|
result.failed.push({
|
|
11075
11169
|
rule: name.slice(0, -3),
|
|
@@ -11639,8 +11733,8 @@ function getErrorMap() {
|
|
|
11639
11733
|
|
|
11640
11734
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
11641
11735
|
var makeIssue = (params) => {
|
|
11642
|
-
const { data, path:
|
|
11643
|
-
const fullPath = [...
|
|
11736
|
+
const { data, path: path22, errorMaps, issueData } = params;
|
|
11737
|
+
const fullPath = [...path22, ...issueData.path || []];
|
|
11644
11738
|
const fullIssue = {
|
|
11645
11739
|
...issueData,
|
|
11646
11740
|
path: fullPath
|
|
@@ -11756,11 +11850,11 @@ var errorUtil;
|
|
|
11756
11850
|
|
|
11757
11851
|
// node_modules/zod/v3/types.js
|
|
11758
11852
|
var ParseInputLazyPath = class {
|
|
11759
|
-
constructor(parent, value,
|
|
11853
|
+
constructor(parent, value, path22, key) {
|
|
11760
11854
|
this._cachedPath = [];
|
|
11761
11855
|
this.parent = parent;
|
|
11762
11856
|
this.data = value;
|
|
11763
|
-
this._path =
|
|
11857
|
+
this._path = path22;
|
|
11764
11858
|
this._key = key;
|
|
11765
11859
|
}
|
|
11766
11860
|
get path() {
|
|
@@ -17053,8 +17147,8 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
17053
17147
|
};
|
|
17054
17148
|
|
|
17055
17149
|
// src/scripts/_lib/module_detection.ts
|
|
17056
|
-
import * as
|
|
17057
|
-
import * as
|
|
17150
|
+
import * as fs20 from "node:fs";
|
|
17151
|
+
import * as path18 from "node:path";
|
|
17058
17152
|
var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
|
|
17059
17153
|
var _RULES = [
|
|
17060
17154
|
["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
|
|
@@ -17068,14 +17162,14 @@ var _RULES = [
|
|
|
17068
17162
|
];
|
|
17069
17163
|
function _isDir(p) {
|
|
17070
17164
|
try {
|
|
17071
|
-
return
|
|
17165
|
+
return fs20.statSync(p).isDirectory();
|
|
17072
17166
|
} catch {
|
|
17073
17167
|
return false;
|
|
17074
17168
|
}
|
|
17075
17169
|
}
|
|
17076
17170
|
function _isFile(p) {
|
|
17077
17171
|
try {
|
|
17078
|
-
return
|
|
17172
|
+
return fs20.statSync(p).isFile();
|
|
17079
17173
|
} catch {
|
|
17080
17174
|
return false;
|
|
17081
17175
|
}
|
|
@@ -17089,13 +17183,13 @@ function _isUpperChar(ch) {
|
|
|
17089
17183
|
function _list_module_subdirs(root) {
|
|
17090
17184
|
let entries;
|
|
17091
17185
|
try {
|
|
17092
|
-
entries =
|
|
17186
|
+
entries = fs20.readdirSync(root).sort();
|
|
17093
17187
|
} catch {
|
|
17094
17188
|
return [];
|
|
17095
17189
|
}
|
|
17096
17190
|
const out = [];
|
|
17097
17191
|
for (const name of entries) {
|
|
17098
|
-
if (!_isDir(
|
|
17192
|
+
if (!_isDir(path18.join(root, name))) {
|
|
17099
17193
|
continue;
|
|
17100
17194
|
}
|
|
17101
17195
|
if (name.startsWith(".")) {
|
|
@@ -17117,11 +17211,11 @@ function _score_confidence(stack, root, subdirs) {
|
|
|
17117
17211
|
return capitalized.length > 0 ? "high" : "medium";
|
|
17118
17212
|
}
|
|
17119
17213
|
if (stack === "node-monorepo") {
|
|
17120
|
-
const withPkgJson = subdirs.filter((name) => _isFile(
|
|
17214
|
+
const withPkgJson = subdirs.filter((name) => _isFile(path18.join(root, name, "package.json")));
|
|
17121
17215
|
return withPkgJson.length > 0 ? "high" : "medium";
|
|
17122
17216
|
}
|
|
17123
17217
|
if (stack === "python-src") {
|
|
17124
|
-
const withInit = subdirs.filter((name) => _isFile(
|
|
17218
|
+
const withInit = subdirs.filter((name) => _isFile(path18.join(root, name, "__init__.py")));
|
|
17125
17219
|
return withInit.length > 0 ? "high" : "medium";
|
|
17126
17220
|
}
|
|
17127
17221
|
if (stack === "go-internal") {
|
|
@@ -17133,7 +17227,7 @@ function detect_module_roots(project_root) {
|
|
|
17133
17227
|
const high = [];
|
|
17134
17228
|
const medium = [];
|
|
17135
17229
|
for (const [rel_path, stack, namespace_template] of _RULES) {
|
|
17136
|
-
const abs_path =
|
|
17230
|
+
const abs_path = path18.join(project_root, rel_path);
|
|
17137
17231
|
if (!_isDir(abs_path)) {
|
|
17138
17232
|
continue;
|
|
17139
17233
|
}
|
|
@@ -17155,7 +17249,7 @@ function detect_module_roots(project_root) {
|
|
|
17155
17249
|
}
|
|
17156
17250
|
|
|
17157
17251
|
// src/scripts/_lib/model_tier.ts
|
|
17158
|
-
import
|
|
17252
|
+
import fs21 from "node:fs";
|
|
17159
17253
|
var TIER_TO_CLAUDE_MODEL = {
|
|
17160
17254
|
frontier: "fable",
|
|
17161
17255
|
high: "opus",
|
|
@@ -17164,8 +17258,8 @@ var TIER_TO_CLAUDE_MODEL = {
|
|
|
17164
17258
|
};
|
|
17165
17259
|
var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
|
|
17166
17260
|
function read_model_tier(skill_md) {
|
|
17167
|
-
if (!
|
|
17168
|
-
const text =
|
|
17261
|
+
if (!fs21.existsSync(skill_md)) return null;
|
|
17262
|
+
const text = fs21.readFileSync(skill_md).toString("utf-8");
|
|
17169
17263
|
if (!text.startsWith("---\n")) return null;
|
|
17170
17264
|
const end = text.indexOf("\n---\n", 4);
|
|
17171
17265
|
if (end === -1) return null;
|
|
@@ -17182,39 +17276,39 @@ function render_native_model_md(text, tier) {
|
|
|
17182
17276
|
|
|
17183
17277
|
// src/scripts/_cli/cmd_migrate.ts
|
|
17184
17278
|
import { spawnSync } from "node:child_process";
|
|
17185
|
-
import * as
|
|
17186
|
-
import * as
|
|
17279
|
+
import * as fs23 from "node:fs";
|
|
17280
|
+
import * as path20 from "node:path";
|
|
17187
17281
|
import process2 from "node:process";
|
|
17188
|
-
import { fileURLToPath as
|
|
17282
|
+
import { fileURLToPath as fileURLToPath5, pathToFileURL } from "node:url";
|
|
17189
17283
|
|
|
17190
17284
|
// src/scripts/_lib/package_root.ts
|
|
17191
|
-
import * as
|
|
17192
|
-
import * as
|
|
17193
|
-
import { fileURLToPath as
|
|
17285
|
+
import * as fs22 from "node:fs";
|
|
17286
|
+
import * as path19 from "node:path";
|
|
17287
|
+
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
17194
17288
|
var PACKAGE_NAME = "@event4u/agent-config";
|
|
17195
17289
|
var MAX_ASCENT = 16;
|
|
17196
17290
|
function resolvePackageRoot(fromUrlOrPath, legacyHops = 3) {
|
|
17197
|
-
const start = fromUrlOrPath.startsWith("file:") ?
|
|
17198
|
-
const startDir =
|
|
17291
|
+
const start = fromUrlOrPath.startsWith("file:") ? fileURLToPath4(fromUrlOrPath) : fromUrlOrPath;
|
|
17292
|
+
const startDir = path19.dirname(start);
|
|
17199
17293
|
let dir = startDir;
|
|
17200
17294
|
for (let i = 0; i < MAX_ASCENT; i++) {
|
|
17201
|
-
const manifest =
|
|
17202
|
-
if (
|
|
17295
|
+
const manifest = path19.join(dir, "package.json");
|
|
17296
|
+
if (fs22.existsSync(manifest)) {
|
|
17203
17297
|
try {
|
|
17204
|
-
const parsed = JSON.parse(
|
|
17298
|
+
const parsed = JSON.parse(fs22.readFileSync(manifest, "utf8"));
|
|
17205
17299
|
if (parsed.name === PACKAGE_NAME) {
|
|
17206
17300
|
return dir;
|
|
17207
17301
|
}
|
|
17208
17302
|
} catch {
|
|
17209
17303
|
}
|
|
17210
17304
|
}
|
|
17211
|
-
const parent =
|
|
17305
|
+
const parent = path19.dirname(dir);
|
|
17212
17306
|
if (parent === dir) {
|
|
17213
17307
|
break;
|
|
17214
17308
|
}
|
|
17215
17309
|
dir = parent;
|
|
17216
17310
|
}
|
|
17217
|
-
return
|
|
17311
|
+
return path19.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
|
|
17218
17312
|
}
|
|
17219
17313
|
|
|
17220
17314
|
// src/scripts/_cli/cmd_migrate.ts
|
|
@@ -17235,7 +17329,7 @@ var LEGACY_SETTINGS_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
|
17235
17329
|
var LEGACY_STATE_FILENAME = ".implement-ticket-state.json";
|
|
17236
17330
|
var LEGACY_STATE_V1_FILENAME = ".work-state.json";
|
|
17237
17331
|
var LEGACY_AGENT_CONFIG_SHELL = "agent-config";
|
|
17238
|
-
var _HERE_DIR =
|
|
17332
|
+
var _HERE_DIR = path20.dirname(fileURLToPath5(import.meta.url));
|
|
17239
17333
|
var ArgparseExit = class extends Error {
|
|
17240
17334
|
code;
|
|
17241
17335
|
constructor(code) {
|
|
@@ -17334,38 +17428,38 @@ function _jsonDumpsIndentAscii(value, indent) {
|
|
|
17334
17428
|
}
|
|
17335
17429
|
function _isFile2(p) {
|
|
17336
17430
|
try {
|
|
17337
|
-
return
|
|
17431
|
+
return fs23.statSync(p).isFile();
|
|
17338
17432
|
} catch {
|
|
17339
17433
|
return false;
|
|
17340
17434
|
}
|
|
17341
17435
|
}
|
|
17342
17436
|
function _isDir2(p) {
|
|
17343
17437
|
try {
|
|
17344
|
-
return
|
|
17438
|
+
return fs23.statSync(p).isDirectory();
|
|
17345
17439
|
} catch {
|
|
17346
17440
|
return false;
|
|
17347
17441
|
}
|
|
17348
17442
|
}
|
|
17349
17443
|
function _isSymlink(p) {
|
|
17350
17444
|
try {
|
|
17351
|
-
return
|
|
17445
|
+
return fs23.lstatSync(p).isSymbolicLink();
|
|
17352
17446
|
} catch {
|
|
17353
17447
|
return false;
|
|
17354
17448
|
}
|
|
17355
17449
|
}
|
|
17356
17450
|
function _exists2(p) {
|
|
17357
17451
|
try {
|
|
17358
|
-
|
|
17452
|
+
fs23.lstatSync(p);
|
|
17359
17453
|
return true;
|
|
17360
17454
|
} catch {
|
|
17361
17455
|
return false;
|
|
17362
17456
|
}
|
|
17363
17457
|
}
|
|
17364
17458
|
function _readText(p) {
|
|
17365
|
-
return
|
|
17459
|
+
return fs23.readFileSync(p, { encoding: "utf-8" });
|
|
17366
17460
|
}
|
|
17367
17461
|
function _writeText(p, text) {
|
|
17368
|
-
|
|
17462
|
+
fs23.writeFileSync(p, text, { encoding: "utf-8" });
|
|
17369
17463
|
}
|
|
17370
17464
|
function _jsonLoadFile(p) {
|
|
17371
17465
|
return JSON.parse(_readText(p));
|
|
@@ -17421,7 +17515,7 @@ function _classify_symlink(link) {
|
|
|
17421
17515
|
}
|
|
17422
17516
|
let target;
|
|
17423
17517
|
try {
|
|
17424
|
-
target =
|
|
17518
|
+
target = fs23.readlinkSync(link);
|
|
17425
17519
|
} catch {
|
|
17426
17520
|
return null;
|
|
17427
17521
|
}
|
|
@@ -17432,16 +17526,16 @@ function _classify_symlink(link) {
|
|
|
17432
17526
|
return "user";
|
|
17433
17527
|
}
|
|
17434
17528
|
function _detect_legacy_state(project) {
|
|
17435
|
-
return _isFile2(
|
|
17529
|
+
return _isFile2(path20.join(project, LEGACY_STATE_FILENAME));
|
|
17436
17530
|
}
|
|
17437
17531
|
function _detect_legacy_settings(project) {
|
|
17438
17532
|
const found = [];
|
|
17439
17533
|
for (const name of LEGACY_SETTINGS_FILES) {
|
|
17440
|
-
const flat =
|
|
17534
|
+
const flat = path20.join(project, name);
|
|
17441
17535
|
if (_isFile2(flat)) {
|
|
17442
17536
|
found.push(flat);
|
|
17443
17537
|
}
|
|
17444
|
-
const typed =
|
|
17538
|
+
const typed = path20.join(project, "settings", name);
|
|
17445
17539
|
if (_isFile2(typed)) {
|
|
17446
17540
|
found.push(typed);
|
|
17447
17541
|
}
|
|
@@ -17449,25 +17543,25 @@ function _detect_legacy_settings(project) {
|
|
|
17449
17543
|
return found;
|
|
17450
17544
|
}
|
|
17451
17545
|
function _detect_empty_shell(project) {
|
|
17452
|
-
const shell =
|
|
17546
|
+
const shell = path20.join(project, LEGACY_AGENT_CONFIG_SHELL);
|
|
17453
17547
|
if (!_isDir2(shell) || _isSymlink(shell)) {
|
|
17454
17548
|
return false;
|
|
17455
17549
|
}
|
|
17456
17550
|
try {
|
|
17457
|
-
return
|
|
17551
|
+
return fs23.readdirSync(shell).length === 0;
|
|
17458
17552
|
} catch {
|
|
17459
17553
|
return false;
|
|
17460
17554
|
}
|
|
17461
17555
|
}
|
|
17462
17556
|
function _detect_already_migrated(project) {
|
|
17463
|
-
if (_detect_npm(
|
|
17557
|
+
if (_detect_npm(path20.join(project, "package.json"))) {
|
|
17464
17558
|
return false;
|
|
17465
17559
|
}
|
|
17466
|
-
if (_detect_composer(
|
|
17560
|
+
if (_detect_composer(path20.join(project, "composer.json"))) {
|
|
17467
17561
|
return false;
|
|
17468
17562
|
}
|
|
17469
17563
|
for (const name of MANAGED_SYMLINKS) {
|
|
17470
|
-
if (_classify_symlink(
|
|
17564
|
+
if (_classify_symlink(path20.join(project, name)) === "legacy") {
|
|
17471
17565
|
return false;
|
|
17472
17566
|
}
|
|
17473
17567
|
}
|
|
@@ -17538,11 +17632,11 @@ function _purge_legacy_symlinks(project) {
|
|
|
17538
17632
|
const removed = [];
|
|
17539
17633
|
const preserved = [];
|
|
17540
17634
|
for (const name of MANAGED_SYMLINKS) {
|
|
17541
|
-
const link =
|
|
17635
|
+
const link = path20.join(project, name);
|
|
17542
17636
|
const kind = _classify_symlink(link);
|
|
17543
17637
|
if (kind === "legacy") {
|
|
17544
17638
|
try {
|
|
17545
|
-
|
|
17639
|
+
fs23.unlinkSync(link);
|
|
17546
17640
|
removed.push(name);
|
|
17547
17641
|
} catch {
|
|
17548
17642
|
preserved.push(name);
|
|
@@ -17554,14 +17648,14 @@ function _purge_legacy_symlinks(project) {
|
|
|
17554
17648
|
return [removed, preserved];
|
|
17555
17649
|
}
|
|
17556
17650
|
function _migrate_state_file(project) {
|
|
17557
|
-
const source =
|
|
17651
|
+
const source = path20.join(project, LEGACY_STATE_FILENAME);
|
|
17558
17652
|
if (!_isFile2(source)) {
|
|
17559
17653
|
return null;
|
|
17560
17654
|
}
|
|
17561
|
-
const target =
|
|
17655
|
+
const target = path20.join(project, LEGACY_STATE_V1_FILENAME);
|
|
17562
17656
|
if (_exists2(target)) {
|
|
17563
17657
|
try {
|
|
17564
|
-
|
|
17658
|
+
fs23.unlinkSync(source);
|
|
17565
17659
|
return `removed stale ${LEGACY_STATE_FILENAME} (v1 already present)`;
|
|
17566
17660
|
} catch {
|
|
17567
17661
|
return null;
|
|
@@ -17576,7 +17670,7 @@ function _migrate_state_file(project) {
|
|
|
17576
17670
|
}
|
|
17577
17671
|
function _load_state_migrator() {
|
|
17578
17672
|
const pkg_root = resolvePackageRoot(import.meta.url);
|
|
17579
|
-
const rel =
|
|
17673
|
+
const rel = path20.join(
|
|
17580
17674
|
"agent-src",
|
|
17581
17675
|
"templates",
|
|
17582
17676
|
"scripts",
|
|
@@ -17584,8 +17678,8 @@ function _load_state_migrator() {
|
|
|
17584
17678
|
"migration",
|
|
17585
17679
|
"v0_to_v1.ts"
|
|
17586
17680
|
);
|
|
17587
|
-
const driver = [
|
|
17588
|
-
(p) =>
|
|
17681
|
+
const driver = [path20.join(pkg_root, "dist", rel), path20.join(pkg_root, "src", rel)].find(
|
|
17682
|
+
(p) => fs23.existsSync(p)
|
|
17589
17683
|
) ?? null;
|
|
17590
17684
|
if (driver === null) {
|
|
17591
17685
|
return null;
|
|
@@ -17593,12 +17687,12 @@ function _load_state_migrator() {
|
|
|
17593
17687
|
const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
17594
17688
|
let tsxBin = null;
|
|
17595
17689
|
for (let dir = pkg_root; ; ) {
|
|
17596
|
-
const cand =
|
|
17597
|
-
if (
|
|
17690
|
+
const cand = path20.join(dir, "node_modules", ".bin", binName);
|
|
17691
|
+
if (fs23.existsSync(cand)) {
|
|
17598
17692
|
tsxBin = cand;
|
|
17599
17693
|
break;
|
|
17600
17694
|
}
|
|
17601
|
-
const parent =
|
|
17695
|
+
const parent = path20.dirname(dir);
|
|
17602
17696
|
if (parent === dir) break;
|
|
17603
17697
|
dir = parent;
|
|
17604
17698
|
}
|
|
@@ -17625,17 +17719,17 @@ function _delete_legacy_settings(project) {
|
|
|
17625
17719
|
const removed = [];
|
|
17626
17720
|
for (const p of _detect_legacy_settings(project)) {
|
|
17627
17721
|
try {
|
|
17628
|
-
|
|
17629
|
-
removed.push(
|
|
17722
|
+
fs23.unlinkSync(p);
|
|
17723
|
+
removed.push(path20.relative(project, p));
|
|
17630
17724
|
} catch {
|
|
17631
17725
|
continue;
|
|
17632
17726
|
}
|
|
17633
17727
|
}
|
|
17634
|
-
const settings_dir =
|
|
17728
|
+
const settings_dir = path20.join(project, "settings");
|
|
17635
17729
|
if (_isDir2(settings_dir) && !_isSymlink(settings_dir)) {
|
|
17636
17730
|
try {
|
|
17637
|
-
if (
|
|
17638
|
-
|
|
17731
|
+
if (fs23.readdirSync(settings_dir).length === 0) {
|
|
17732
|
+
fs23.rmdirSync(settings_dir);
|
|
17639
17733
|
removed.push("settings/");
|
|
17640
17734
|
}
|
|
17641
17735
|
} catch {
|
|
@@ -17644,12 +17738,12 @@ function _delete_legacy_settings(project) {
|
|
|
17644
17738
|
return removed;
|
|
17645
17739
|
}
|
|
17646
17740
|
function _remove_empty_shell(project) {
|
|
17647
|
-
const shell =
|
|
17741
|
+
const shell = path20.join(project, LEGACY_AGENT_CONFIG_SHELL);
|
|
17648
17742
|
if (!_detect_empty_shell(project)) {
|
|
17649
17743
|
return false;
|
|
17650
17744
|
}
|
|
17651
17745
|
try {
|
|
17652
|
-
|
|
17746
|
+
fs23.rmdirSync(shell);
|
|
17653
17747
|
} catch {
|
|
17654
17748
|
return false;
|
|
17655
17749
|
}
|
|
@@ -17659,7 +17753,7 @@ function _reEscape(s) {
|
|
|
17659
17753
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
17660
17754
|
}
|
|
17661
17755
|
function _update_gitignore(project) {
|
|
17662
|
-
const gitignore =
|
|
17756
|
+
const gitignore = path20.join(project, ".gitignore");
|
|
17663
17757
|
const block = `${GITIGNORE_BLOCK_START}
|
|
17664
17758
|
${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
|
|
17665
17759
|
`;
|
|
@@ -17690,16 +17784,16 @@ ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
|
|
|
17690
17784
|
}
|
|
17691
17785
|
function _build_plan(project) {
|
|
17692
17786
|
return {
|
|
17693
|
-
npm: _detect_npm(
|
|
17694
|
-
composer: _detect_composer(
|
|
17787
|
+
npm: _detect_npm(path20.join(project, "package.json")),
|
|
17788
|
+
composer: _detect_composer(path20.join(project, "composer.json")),
|
|
17695
17789
|
symlinks_legacy: MANAGED_SYMLINKS.filter(
|
|
17696
|
-
(name) => _classify_symlink(
|
|
17790
|
+
(name) => _classify_symlink(path20.join(project, name)) === "legacy"
|
|
17697
17791
|
),
|
|
17698
17792
|
symlinks_user: MANAGED_SYMLINKS.filter(
|
|
17699
|
-
(name) => _classify_symlink(
|
|
17793
|
+
(name) => _classify_symlink(path20.join(project, name)) === "user"
|
|
17700
17794
|
),
|
|
17701
|
-
state_file: _isFile2(
|
|
17702
|
-
settings_files: _detect_legacy_settings(project).map((p) =>
|
|
17795
|
+
state_file: _isFile2(path20.join(project, LEGACY_STATE_FILENAME)),
|
|
17796
|
+
settings_files: _detect_legacy_settings(project).map((p) => path20.relative(project, p)),
|
|
17703
17797
|
empty_shell: _detect_empty_shell(project)
|
|
17704
17798
|
};
|
|
17705
17799
|
}
|
|
@@ -17763,10 +17857,10 @@ function _warn_on_major_mismatch(from_major, plan, out) {
|
|
|
17763
17857
|
}
|
|
17764
17858
|
function _apply(project, out, err) {
|
|
17765
17859
|
const summary = [];
|
|
17766
|
-
if (_strip_npm_entry(
|
|
17860
|
+
if (_strip_npm_entry(path20.join(project, "package.json"))) {
|
|
17767
17861
|
summary.push(`removed ${PACKAGE_NAME_NPM} from package.json`);
|
|
17768
17862
|
}
|
|
17769
|
-
if (_strip_composer_entry(
|
|
17863
|
+
if (_strip_composer_entry(path20.join(project, "composer.json"))) {
|
|
17770
17864
|
summary.push(`removed ${PACKAGE_NAME_COMPOSER} from composer.json`);
|
|
17771
17865
|
}
|
|
17772
17866
|
const [removed_links, preserved_links] = _purge_legacy_symlinks(project);
|
|
@@ -17802,7 +17896,7 @@ function _apply(project, out, err) {
|
|
|
17802
17896
|
_print(out, "\n Next: review the diff and commit.");
|
|
17803
17897
|
return 0;
|
|
17804
17898
|
}
|
|
17805
|
-
function
|
|
17899
|
+
function _parse2(argv, out, err) {
|
|
17806
17900
|
const prog = "agent-config migrate";
|
|
17807
17901
|
const usage = `usage: ${prog} [-h] [--dry-run | --check] [--from {4,5}]
|
|
17808
17902
|
`;
|
|
@@ -17861,7 +17955,7 @@ function _parse(argv, out, err) {
|
|
|
17861
17955
|
function main(argv = null, options = {}) {
|
|
17862
17956
|
const out = options.out ?? _stdoutSink();
|
|
17863
17957
|
const err = options.err ?? _stderrSink();
|
|
17864
|
-
const args =
|
|
17958
|
+
const args = _parse2(argv ?? process2.argv.slice(2), out, err);
|
|
17865
17959
|
const [project] = resolve_project_root(null, { cwd: options.cwd ?? null });
|
|
17866
17960
|
if (args.from_major) {
|
|
17867
17961
|
_print(out, `\u2139\uFE0F declared source major: ${args.from_major}.x`);
|
|
@@ -17887,23 +17981,23 @@ function main(argv = null, options = {}) {
|
|
|
17887
17981
|
return _apply(project, out, err);
|
|
17888
17982
|
}
|
|
17889
17983
|
var _inForeignBundle = !(typeof __AGENT_CONFIG_CLI_DELEGATE__ !== "undefined" && __AGENT_CONFIG_CLI_DELEGATE__);
|
|
17890
|
-
var _HERE =
|
|
17984
|
+
var _HERE = fileURLToPath5(import.meta.url);
|
|
17891
17985
|
function _isCliEntry() {
|
|
17892
17986
|
if (process2.argv[1] === void 0) {
|
|
17893
17987
|
return false;
|
|
17894
17988
|
}
|
|
17895
17989
|
if (typeof __AGENT_CONFIG_CLI_DELEGATE__ !== "undefined" && __AGENT_CONFIG_CLI_DELEGATE__) {
|
|
17896
|
-
if (
|
|
17990
|
+
if (path20.basename(process2.argv[1], ".js") === "cmd_migrate") {
|
|
17897
17991
|
return true;
|
|
17898
17992
|
}
|
|
17899
17993
|
}
|
|
17900
|
-
const argvUrl = pathToFileURL(
|
|
17994
|
+
const argvUrl = pathToFileURL(path20.resolve(process2.argv[1])).href;
|
|
17901
17995
|
if (import.meta.url === argvUrl) {
|
|
17902
17996
|
return true;
|
|
17903
17997
|
}
|
|
17904
17998
|
try {
|
|
17905
|
-
const here =
|
|
17906
|
-
const argv =
|
|
17999
|
+
const here = fs23.realpathSync(fileURLToPath5(import.meta.url));
|
|
18000
|
+
const argv = fs23.realpathSync(path20.resolve(process2.argv[1]));
|
|
17907
18001
|
return here === argv;
|
|
17908
18002
|
} catch {
|
|
17909
18003
|
return false;
|
|
@@ -17946,7 +18040,7 @@ var SCOPE_DETECT_AI_DIRS = [
|
|
|
17946
18040
|
];
|
|
17947
18041
|
|
|
17948
18042
|
// src/scripts/install.ts
|
|
17949
|
-
var _HERE2 =
|
|
18043
|
+
var _HERE2 = fileURLToPath6(import.meta.url);
|
|
17950
18044
|
var SystemExitError = class extends Error {
|
|
17951
18045
|
constructor(code) {
|
|
17952
18046
|
super(`system-exit-${code}`);
|
|
@@ -17964,34 +18058,34 @@ var ArgparseExit2 = class extends Error {
|
|
|
17964
18058
|
function expanduser6(p) {
|
|
17965
18059
|
if (p === "~") return os8.homedir();
|
|
17966
18060
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
17967
|
-
return
|
|
18061
|
+
return path21.join(os8.homedir(), p.slice(2));
|
|
17968
18062
|
}
|
|
17969
18063
|
return p;
|
|
17970
18064
|
}
|
|
17971
18065
|
function resolvePath(p) {
|
|
17972
18066
|
try {
|
|
17973
|
-
return
|
|
18067
|
+
return fs24.realpathSync(path21.resolve(p));
|
|
17974
18068
|
} catch {
|
|
17975
|
-
return
|
|
18069
|
+
return path21.resolve(p);
|
|
17976
18070
|
}
|
|
17977
18071
|
}
|
|
17978
18072
|
function isFile(p) {
|
|
17979
18073
|
try {
|
|
17980
|
-
return
|
|
18074
|
+
return fs24.statSync(p).isFile();
|
|
17981
18075
|
} catch {
|
|
17982
18076
|
return false;
|
|
17983
18077
|
}
|
|
17984
18078
|
}
|
|
17985
18079
|
function isDir(p) {
|
|
17986
18080
|
try {
|
|
17987
|
-
return
|
|
18081
|
+
return fs24.statSync(p).isDirectory();
|
|
17988
18082
|
} catch {
|
|
17989
18083
|
return false;
|
|
17990
18084
|
}
|
|
17991
18085
|
}
|
|
17992
18086
|
function pathExists(p) {
|
|
17993
18087
|
try {
|
|
17994
|
-
|
|
18088
|
+
fs24.statSync(p);
|
|
17995
18089
|
return true;
|
|
17996
18090
|
} catch {
|
|
17997
18091
|
return false;
|
|
@@ -17999,24 +18093,24 @@ function pathExists(p) {
|
|
|
17999
18093
|
}
|
|
18000
18094
|
function isSymlink(p) {
|
|
18001
18095
|
try {
|
|
18002
|
-
return
|
|
18096
|
+
return fs24.lstatSync(p).isSymbolicLink();
|
|
18003
18097
|
} catch {
|
|
18004
18098
|
return false;
|
|
18005
18099
|
}
|
|
18006
18100
|
}
|
|
18007
18101
|
function readText(p) {
|
|
18008
|
-
return
|
|
18102
|
+
return fs24.readFileSync(p, "utf-8");
|
|
18009
18103
|
}
|
|
18010
18104
|
function writeText(p, content) {
|
|
18011
|
-
|
|
18105
|
+
fs24.writeFileSync(p, content, "utf-8");
|
|
18012
18106
|
}
|
|
18013
18107
|
function mkdirp(p) {
|
|
18014
|
-
|
|
18108
|
+
fs24.mkdirSync(p, { recursive: true });
|
|
18015
18109
|
}
|
|
18016
18110
|
function sortedGlobStems(directory, suffix) {
|
|
18017
18111
|
let entries;
|
|
18018
18112
|
try {
|
|
18019
|
-
entries =
|
|
18113
|
+
entries = fs24.readdirSync(directory);
|
|
18020
18114
|
} catch {
|
|
18021
18115
|
return [];
|
|
18022
18116
|
}
|
|
@@ -18036,7 +18130,7 @@ function sortedGlobStems(directory, suffix) {
|
|
|
18036
18130
|
function countZips(directory) {
|
|
18037
18131
|
if (!isDir(directory)) return 0;
|
|
18038
18132
|
let n = 0;
|
|
18039
|
-
for (const name of
|
|
18133
|
+
for (const name of fs24.readdirSync(directory)) {
|
|
18040
18134
|
if (name.endsWith(".zip")) n += 1;
|
|
18041
18135
|
}
|
|
18042
18136
|
return n;
|
|
@@ -18044,35 +18138,35 @@ function countZips(directory) {
|
|
|
18044
18138
|
function sha256OfFile(p) {
|
|
18045
18139
|
let data;
|
|
18046
18140
|
try {
|
|
18047
|
-
data =
|
|
18141
|
+
data = fs24.readFileSync(p);
|
|
18048
18142
|
} catch {
|
|
18049
18143
|
return null;
|
|
18050
18144
|
}
|
|
18051
18145
|
return crypto3.createHash("sha256").update(data).digest("hex");
|
|
18052
18146
|
}
|
|
18053
18147
|
function atomicWrite0644(target, body, prefix) {
|
|
18054
|
-
const dir =
|
|
18055
|
-
const tmpName =
|
|
18148
|
+
const dir = path21.dirname(target);
|
|
18149
|
+
const tmpName = path21.join(
|
|
18056
18150
|
dir,
|
|
18057
18151
|
`${prefix}${process3.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
|
|
18058
18152
|
);
|
|
18059
18153
|
let fd = null;
|
|
18060
18154
|
try {
|
|
18061
|
-
fd =
|
|
18062
|
-
|
|
18063
|
-
|
|
18155
|
+
fd = fs24.openSync(tmpName, "wx", 420);
|
|
18156
|
+
fs24.writeFileSync(fd, body, "utf-8");
|
|
18157
|
+
fs24.closeSync(fd);
|
|
18064
18158
|
fd = null;
|
|
18065
|
-
|
|
18066
|
-
|
|
18159
|
+
fs24.chmodSync(tmpName, 420);
|
|
18160
|
+
fs24.renameSync(tmpName, target);
|
|
18067
18161
|
} catch (err) {
|
|
18068
18162
|
if (fd !== null) {
|
|
18069
18163
|
try {
|
|
18070
|
-
|
|
18164
|
+
fs24.closeSync(fd);
|
|
18071
18165
|
} catch {
|
|
18072
18166
|
}
|
|
18073
18167
|
}
|
|
18074
18168
|
try {
|
|
18075
|
-
|
|
18169
|
+
fs24.unlinkSync(tmpName);
|
|
18076
18170
|
} catch {
|
|
18077
18171
|
}
|
|
18078
18172
|
throw err;
|
|
@@ -18196,12 +18290,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
|
|
|
18196
18290
|
var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
|
|
18197
18291
|
var SETTINGS_SUBDIR = ["agents", "settings"];
|
|
18198
18292
|
function _canonical_settings_target(project_root) {
|
|
18199
|
-
return
|
|
18293
|
+
return path21.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
|
|
18200
18294
|
}
|
|
18201
18295
|
function _resolve_settings_read(project_root) {
|
|
18202
18296
|
const canonical = _canonical_settings_target(project_root);
|
|
18203
18297
|
if (pathExists(canonical)) return canonical;
|
|
18204
|
-
const legacy =
|
|
18298
|
+
const legacy = path21.join(project_root, SETTINGS_FILE);
|
|
18205
18299
|
if (pathExists(legacy)) return legacy;
|
|
18206
18300
|
return canonical;
|
|
18207
18301
|
}
|
|
@@ -18265,9 +18359,9 @@ function fail(msg) {
|
|
|
18265
18359
|
throw new SystemExitError(1);
|
|
18266
18360
|
}
|
|
18267
18361
|
function detect_package_root(project_root) {
|
|
18268
|
-
const npm_path =
|
|
18362
|
+
const npm_path = path21.join(project_root, "node_modules", "@event4u", "agent-config");
|
|
18269
18363
|
if (isDir(npm_path)) return resolvePath(npm_path);
|
|
18270
|
-
if (pathExists(
|
|
18364
|
+
if (pathExists(path21.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
18271
18365
|
return project_root;
|
|
18272
18366
|
}
|
|
18273
18367
|
fail(
|
|
@@ -18275,12 +18369,12 @@ function detect_package_root(project_root) {
|
|
|
18275
18369
|
);
|
|
18276
18370
|
}
|
|
18277
18371
|
function detect_package_type(package_root) {
|
|
18278
|
-
if (package_root.split(
|
|
18372
|
+
if (package_root.split(path21.sep).includes("node_modules")) return "npm";
|
|
18279
18373
|
return "local";
|
|
18280
18374
|
}
|
|
18281
18375
|
function detect_package_type_for_project(project_root, package_root) {
|
|
18282
18376
|
const npm_path = resolvePath(
|
|
18283
|
-
|
|
18377
|
+
path21.join(project_root, "node_modules", "@event4u", "agent-config")
|
|
18284
18378
|
);
|
|
18285
18379
|
const package_resolved = resolvePath(package_root);
|
|
18286
18380
|
if (package_resolved === npm_path) return "npm";
|
|
@@ -18300,7 +18394,7 @@ function ensure_directory(p) {
|
|
|
18300
18394
|
mkdirp(p);
|
|
18301
18395
|
}
|
|
18302
18396
|
function write_file(p, content) {
|
|
18303
|
-
ensure_directory(
|
|
18397
|
+
ensure_directory(path21.dirname(p));
|
|
18304
18398
|
writeText(p, content);
|
|
18305
18399
|
}
|
|
18306
18400
|
function read_json_file(p) {
|
|
@@ -18471,7 +18565,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
|
|
|
18471
18565
|
return rendered + "\n" + suffix;
|
|
18472
18566
|
}
|
|
18473
18567
|
function _migrate_legacy_if_present(project_root, template_body) {
|
|
18474
|
-
const legacy_target =
|
|
18568
|
+
const legacy_target = path21.join(project_root, LEGACY_SETTINGS_FILE);
|
|
18475
18569
|
if (!isFile(legacy_target)) return null;
|
|
18476
18570
|
const legacy_text = readText(legacy_target);
|
|
18477
18571
|
const [values, unknown] = _parse_legacy_settings(legacy_text);
|
|
@@ -18486,9 +18580,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
|
|
|
18486
18580
|
}
|
|
18487
18581
|
}
|
|
18488
18582
|
rendered = _append_unknown_legacy(rendered, values, unknown);
|
|
18489
|
-
const backup_target =
|
|
18583
|
+
const backup_target = path21.join(project_root, LEGACY_BACKUP_FILE);
|
|
18490
18584
|
writeText(backup_target, legacy_text);
|
|
18491
|
-
|
|
18585
|
+
fs24.unlinkSync(legacy_target);
|
|
18492
18586
|
info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
|
|
18493
18587
|
info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
|
|
18494
18588
|
if (unknown.length > 0) {
|
|
@@ -18523,7 +18617,7 @@ function _render_template(template, profile_values) {
|
|
|
18523
18617
|
return body;
|
|
18524
18618
|
}
|
|
18525
18619
|
function _load_valid_user_types(package_root) {
|
|
18526
|
-
const directory =
|
|
18620
|
+
const directory = path21.join(package_root, USER_TYPES_DIR);
|
|
18527
18621
|
if (!isDir(directory)) return [];
|
|
18528
18622
|
return sortedGlobStems(directory, ".yml");
|
|
18529
18623
|
}
|
|
@@ -18580,8 +18674,8 @@ function splitlinesKeepends(text) {
|
|
|
18580
18674
|
}
|
|
18581
18675
|
function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
|
|
18582
18676
|
const target = _canonical_settings_target(project_root);
|
|
18583
|
-
const profile_source =
|
|
18584
|
-
const template_source =
|
|
18677
|
+
const profile_source = path21.join(package_root, "src", "config", "profiles", `${profile}.ini`);
|
|
18678
|
+
const template_source = path21.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
18585
18679
|
if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
|
|
18586
18680
|
if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
|
|
18587
18681
|
const template = readText(template_source);
|
|
@@ -18595,21 +18689,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
18595
18689
|
if (profile_values["rule_loading_tier"] !== profile) {
|
|
18596
18690
|
const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
|
|
18597
18691
|
fail(
|
|
18598
|
-
`Profile preset ${
|
|
18692
|
+
`Profile preset ${path21.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
|
|
18599
18693
|
);
|
|
18600
18694
|
}
|
|
18601
18695
|
profile_values["user_type"] = _validate_user_type(package_root, user_type);
|
|
18602
18696
|
let template_body = _render_template(template, profile_values);
|
|
18603
18697
|
template_body = _inject_packs(template_body, packs ?? []);
|
|
18604
|
-
const legacy_root =
|
|
18698
|
+
const legacy_root = path21.join(project_root, SETTINGS_FILE);
|
|
18605
18699
|
if (isFile(legacy_root) && !pathExists(target)) {
|
|
18606
|
-
mkdirp(
|
|
18700
|
+
mkdirp(path21.dirname(target));
|
|
18607
18701
|
writeText(target, readText(legacy_root));
|
|
18608
|
-
|
|
18702
|
+
fs24.unlinkSync(legacy_root);
|
|
18609
18703
|
success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
|
|
18610
18704
|
return;
|
|
18611
18705
|
}
|
|
18612
|
-
const legacy_target =
|
|
18706
|
+
const legacy_target = path21.join(project_root, LEGACY_SETTINGS_FILE);
|
|
18613
18707
|
if (isFile(legacy_target) && pathExists(target)) {
|
|
18614
18708
|
warn(
|
|
18615
18709
|
`Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
|
|
@@ -18626,7 +18720,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
18626
18720
|
skip(`${SETTINGS_FILE} already exists`);
|
|
18627
18721
|
return;
|
|
18628
18722
|
}
|
|
18629
|
-
mkdirp(
|
|
18723
|
+
mkdirp(path21.dirname(target));
|
|
18630
18724
|
write_file(target, template_body);
|
|
18631
18725
|
const user_type_value = profile_values["user_type"] ?? "";
|
|
18632
18726
|
const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
|
|
@@ -18639,7 +18733,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
18639
18733
|
const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
|
|
18640
18734
|
const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
|
|
18641
18735
|
return merge_json_file(
|
|
18642
|
-
|
|
18736
|
+
path21.join(project_root, ".vscode", "settings.json"),
|
|
18643
18737
|
bridge,
|
|
18644
18738
|
force,
|
|
18645
18739
|
".vscode/settings.json"
|
|
@@ -18648,14 +18742,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
18648
18742
|
function ensure_augment_bridge(project_root, force) {
|
|
18649
18743
|
const bridge = { enabledPlugins: { "agent-config@event4u": true } };
|
|
18650
18744
|
return merge_json_file(
|
|
18651
|
-
|
|
18745
|
+
path21.join(project_root, ".augment", "settings.json"),
|
|
18652
18746
|
bridge,
|
|
18653
18747
|
force,
|
|
18654
18748
|
".augment/settings.json"
|
|
18655
18749
|
);
|
|
18656
18750
|
}
|
|
18657
|
-
var AUGMENT_USER_DIR =
|
|
18658
|
-
var AUGMENT_USER_HOOKS_DIR =
|
|
18751
|
+
var AUGMENT_USER_DIR = path21.join(os8.homedir(), ".augment");
|
|
18752
|
+
var AUGMENT_USER_HOOKS_DIR = path21.join(AUGMENT_USER_DIR, "hooks");
|
|
18659
18753
|
var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
|
|
18660
18754
|
var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
18661
18755
|
"augment-chat-history.sh",
|
|
@@ -18663,37 +18757,30 @@ var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
|
18663
18757
|
"augment-onboarding-gate.sh",
|
|
18664
18758
|
"augment-context-hygiene.sh"
|
|
18665
18759
|
];
|
|
18666
|
-
var AUGMENT_DISPATCHER_BINDINGS = [
|
|
18667
|
-
["session_start", "SessionStart"],
|
|
18668
|
-
["session_end", "SessionEnd"],
|
|
18669
|
-
["stop", "Stop"],
|
|
18670
|
-
["pre_tool_use", "PreToolUse"],
|
|
18671
|
-
["post_tool_use", "PostToolUse"]
|
|
18672
|
-
];
|
|
18673
18760
|
function _deploy_augment_trampoline(package_root, name, force) {
|
|
18674
|
-
const src =
|
|
18761
|
+
const src = path21.join(package_root, "scripts", "hooks", name);
|
|
18675
18762
|
if (!pathExists(src)) {
|
|
18676
18763
|
skip(`augment trampoline missing in package: ${src}`);
|
|
18677
18764
|
return null;
|
|
18678
18765
|
}
|
|
18679
18766
|
mkdirp(AUGMENT_USER_HOOKS_DIR);
|
|
18680
|
-
const dst =
|
|
18767
|
+
const dst = path21.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
18681
18768
|
const src_text = readText(src);
|
|
18682
18769
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
18683
18770
|
skip(`~/.augment/hooks/${name} already up to date`);
|
|
18684
18771
|
} else {
|
|
18685
18772
|
writeText(dst, src_text);
|
|
18686
|
-
|
|
18773
|
+
fs24.chmodSync(dst, 493);
|
|
18687
18774
|
success(`~/.augment/hooks/${name} installed`);
|
|
18688
18775
|
}
|
|
18689
18776
|
return dst;
|
|
18690
18777
|
}
|
|
18691
18778
|
function _remove_legacy_augment_trampolines() {
|
|
18692
18779
|
for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
|
|
18693
|
-
const legacy =
|
|
18780
|
+
const legacy = path21.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
18694
18781
|
try {
|
|
18695
18782
|
if (isFile(legacy)) {
|
|
18696
|
-
|
|
18783
|
+
fs24.unlinkSync(legacy);
|
|
18697
18784
|
skip(`removed legacy ~/.augment/hooks/${name}`);
|
|
18698
18785
|
}
|
|
18699
18786
|
} catch (err) {
|
|
@@ -18706,14 +18793,14 @@ function ensure_augment_user_hooks(package_root, force) {
|
|
|
18706
18793
|
if (dst === null) return [];
|
|
18707
18794
|
_remove_legacy_augment_trampolines();
|
|
18708
18795
|
const per_event = {};
|
|
18709
|
-
for (const
|
|
18710
|
-
const cmd = `${dst} ${
|
|
18796
|
+
for (const { slot, native } of hostBindings("augment")) {
|
|
18797
|
+
const cmd = `${dst} ${slot} ${native}`;
|
|
18711
18798
|
const entry = { hooks: [{ type: "command", command: cmd }] };
|
|
18712
18799
|
(per_event[native] ??= []).push(entry);
|
|
18713
18800
|
}
|
|
18714
18801
|
const settings_patch = { hooks: per_event };
|
|
18715
18802
|
return merge_json_file(
|
|
18716
|
-
|
|
18803
|
+
path21.join(AUGMENT_USER_DIR, "settings.json"),
|
|
18717
18804
|
settings_patch,
|
|
18718
18805
|
force,
|
|
18719
18806
|
"~/.augment/settings.json"
|
|
@@ -18738,7 +18825,7 @@ function _heal_legacy_claude_plugin_ids(p) {
|
|
|
18738
18825
|
return removed;
|
|
18739
18826
|
}
|
|
18740
18827
|
function ensure_claude_bridge(project_root, force) {
|
|
18741
|
-
const target =
|
|
18828
|
+
const target = path21.join(project_root, ".claude", "settings.json");
|
|
18742
18829
|
const healed = _heal_legacy_claude_plugin_ids(target);
|
|
18743
18830
|
for (const pid of healed) {
|
|
18744
18831
|
success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
|
|
@@ -18750,68 +18837,53 @@ var ensure_mcp_bridge = makeEnsureMcpBridge(merge_json_file);
|
|
|
18750
18837
|
var _resolve_tier_b = resolveTierB;
|
|
18751
18838
|
var _tier_b_advisory = tierBAdvisory;
|
|
18752
18839
|
var _prune_tier_b_modules = (dr, tier_b) => _prune_modules_by(dr, tierBPrunePredicate(tier_b));
|
|
18753
|
-
var CURSOR_DISPATCHER_BINDINGS = [
|
|
18754
|
-
["session_start", "sessionStart"],
|
|
18755
|
-
["session_end", "sessionEnd"],
|
|
18756
|
-
["stop", "stop"],
|
|
18757
|
-
["user_prompt_submit", "beforeSubmitPrompt"],
|
|
18758
|
-
["post_tool_use", "postToolUse"]
|
|
18759
|
-
];
|
|
18760
18840
|
function _cursor_dispatch_command(ac_event, native) {
|
|
18761
18841
|
return `[ -x ./agent-config ] || exit 0; ./agent-config dispatch:hook --platform cursor --event ${ac_event} --native-event ${native}`;
|
|
18762
18842
|
}
|
|
18763
18843
|
function ensure_cursor_bridge(project_root, force) {
|
|
18764
18844
|
const hooks = {};
|
|
18765
|
-
for (const
|
|
18766
|
-
(hooks[native] ??= []).push({ command: _cursor_dispatch_command(
|
|
18845
|
+
for (const { slot, native } of hostBindings("cursor")) {
|
|
18846
|
+
(hooks[native] ??= []).push({ command: _cursor_dispatch_command(slot, native) });
|
|
18767
18847
|
}
|
|
18768
18848
|
const bridge = { version: 1, hooks };
|
|
18769
18849
|
return merge_json_file(
|
|
18770
|
-
|
|
18850
|
+
path21.join(project_root, ".cursor", "hooks.json"),
|
|
18771
18851
|
bridge,
|
|
18772
18852
|
force,
|
|
18773
18853
|
".cursor/hooks.json"
|
|
18774
18854
|
);
|
|
18775
18855
|
}
|
|
18776
|
-
var CURSOR_USER_DIR =
|
|
18777
|
-
var CURSOR_USER_HOOKS_DIR =
|
|
18856
|
+
var CURSOR_USER_DIR = path21.join(os8.homedir(), ".cursor");
|
|
18857
|
+
var CURSOR_USER_HOOKS_DIR = path21.join(CURSOR_USER_DIR, "hooks");
|
|
18778
18858
|
var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
|
|
18779
18859
|
function ensure_cursor_user_hooks(package_root, force) {
|
|
18780
|
-
const src =
|
|
18860
|
+
const src = path21.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
|
|
18781
18861
|
if (!pathExists(src)) {
|
|
18782
18862
|
skip(`cursor trampoline missing in package: ${src}`);
|
|
18783
18863
|
return [];
|
|
18784
18864
|
}
|
|
18785
18865
|
mkdirp(CURSOR_USER_HOOKS_DIR);
|
|
18786
|
-
const dst =
|
|
18866
|
+
const dst = path21.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
|
|
18787
18867
|
const src_text = readText(src);
|
|
18788
18868
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
18789
18869
|
skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
18790
18870
|
} else {
|
|
18791
18871
|
writeText(dst, src_text);
|
|
18792
|
-
|
|
18872
|
+
fs24.chmodSync(dst, 493);
|
|
18793
18873
|
success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
|
|
18794
18874
|
}
|
|
18795
18875
|
const hooks = {};
|
|
18796
|
-
for (const
|
|
18797
|
-
(hooks[native] ??= []).push({ command: `${dst} ${
|
|
18876
|
+
for (const { slot, native } of hostBindings("cursor")) {
|
|
18877
|
+
(hooks[native] ??= []).push({ command: `${dst} ${slot} ${native}` });
|
|
18798
18878
|
}
|
|
18799
18879
|
const settings_patch = { version: 1, hooks };
|
|
18800
18880
|
return merge_json_file(
|
|
18801
|
-
|
|
18881
|
+
path21.join(CURSOR_USER_DIR, "hooks.json"),
|
|
18802
18882
|
settings_patch,
|
|
18803
18883
|
force,
|
|
18804
18884
|
"~/.cursor/hooks.json"
|
|
18805
18885
|
);
|
|
18806
18886
|
}
|
|
18807
|
-
var CLINE_DISPATCHER_BINDINGS = [
|
|
18808
|
-
["session_start", "TaskStart"],
|
|
18809
|
-
["session_start", "TaskResume"],
|
|
18810
|
-
["session_end", "TaskComplete"],
|
|
18811
|
-
["stop", "TaskCancel"],
|
|
18812
|
-
["user_prompt_submit", "UserPromptSubmit"],
|
|
18813
|
-
["post_tool_use", "PostToolUse"]
|
|
18814
|
-
];
|
|
18815
18887
|
function shlexQuote(s) {
|
|
18816
18888
|
if (s === "") return "''";
|
|
18817
18889
|
if (/^[A-Za-z0-9_@%+=:,./-]+$/.test(s)) return s;
|
|
@@ -18819,7 +18891,7 @@ function shlexQuote(s) {
|
|
|
18819
18891
|
}
|
|
18820
18892
|
function clineProjectHookBody(native_event, ac_event, workspace_quoted) {
|
|
18821
18893
|
return `#!/usr/bin/env bash
|
|
18822
|
-
# Generated by event4u/agent-config
|
|
18894
|
+
# Generated by event4u/agent-config \u2014 DO NOT EDIT.
|
|
18823
18895
|
# Project-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
|
|
18824
18896
|
# Phase 7.6 (docs/contracts/hook-architecture-v1.md).
|
|
18825
18897
|
set -u
|
|
@@ -18841,22 +18913,22 @@ exit 0
|
|
|
18841
18913
|
`;
|
|
18842
18914
|
}
|
|
18843
18915
|
function ensure_cline_bridge(project_root, force) {
|
|
18844
|
-
const hooks_dir =
|
|
18916
|
+
const hooks_dir = path21.join(project_root, ".clinerules", "hooks");
|
|
18845
18917
|
mkdirp(hooks_dir);
|
|
18846
18918
|
const workspace_quoted = shlexQuote(resolvePath(project_root));
|
|
18847
18919
|
let written = 0;
|
|
18848
|
-
for (const
|
|
18849
|
-
const target =
|
|
18850
|
-
const body = clineProjectHookBody(
|
|
18920
|
+
for (const { slot, native } of hostBindings("cline")) {
|
|
18921
|
+
const target = path21.join(hooks_dir, native);
|
|
18922
|
+
const body = clineProjectHookBody(native, slot, workspace_quoted);
|
|
18851
18923
|
if (pathExists(target) && readText(target) === body && !force) {
|
|
18852
18924
|
continue;
|
|
18853
18925
|
}
|
|
18854
18926
|
if (pathExists(target) && !force) {
|
|
18855
|
-
skip(`.clinerules/hooks/${
|
|
18927
|
+
skip(`.clinerules/hooks/${native} exists, needs update (use --force)`);
|
|
18856
18928
|
continue;
|
|
18857
18929
|
}
|
|
18858
18930
|
writeText(target, body);
|
|
18859
|
-
|
|
18931
|
+
fs24.chmodSync(target, 493);
|
|
18860
18932
|
written += 1;
|
|
18861
18933
|
}
|
|
18862
18934
|
if (written) {
|
|
@@ -18865,113 +18937,101 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
18865
18937
|
skip(".clinerules/hooks/ already up to date");
|
|
18866
18938
|
}
|
|
18867
18939
|
}
|
|
18868
|
-
var CLINE_USER_DIR =
|
|
18940
|
+
var CLINE_USER_DIR = path21.join(os8.homedir(), "Documents", "Cline", "Hooks");
|
|
18869
18941
|
var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
|
|
18870
18942
|
function ensure_cline_user_hooks(package_root, force) {
|
|
18871
|
-
const src =
|
|
18943
|
+
const src = path21.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
|
|
18872
18944
|
if (!pathExists(src)) {
|
|
18873
18945
|
skip(`cline trampoline missing in package: ${src}`);
|
|
18874
18946
|
return;
|
|
18875
18947
|
}
|
|
18876
18948
|
mkdirp(CLINE_USER_DIR);
|
|
18877
|
-
const trampoline =
|
|
18949
|
+
const trampoline = path21.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
|
|
18878
18950
|
const src_text = readText(src);
|
|
18879
18951
|
if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
|
|
18880
18952
|
skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
18881
18953
|
} else {
|
|
18882
18954
|
writeText(trampoline, src_text);
|
|
18883
|
-
|
|
18955
|
+
fs24.chmodSync(trampoline, 493);
|
|
18884
18956
|
success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
|
|
18885
18957
|
}
|
|
18886
18958
|
const trampoline_quoted = shlexQuote(trampoline);
|
|
18887
|
-
for (const
|
|
18888
|
-
const wrapper =
|
|
18959
|
+
for (const { slot, native } of hostBindings("cline")) {
|
|
18960
|
+
const wrapper = path21.join(CLINE_USER_DIR, native);
|
|
18889
18961
|
const body = `#!/usr/bin/env bash
|
|
18890
|
-
# Generated by event4u/agent-config
|
|
18891
|
-
# User-scope Cline hook for ${
|
|
18892
|
-
exec ${trampoline_quoted} ${
|
|
18962
|
+
# Generated by event4u/agent-config \u2014 DO NOT EDIT.
|
|
18963
|
+
# User-scope Cline hook for ${native} \u2192 agent-config ${slot}.
|
|
18964
|
+
exec ${trampoline_quoted} ${slot} ${native}
|
|
18893
18965
|
`;
|
|
18894
18966
|
if (pathExists(wrapper) && readText(wrapper) === body && !force) {
|
|
18895
18967
|
continue;
|
|
18896
18968
|
}
|
|
18897
18969
|
writeText(wrapper, body);
|
|
18898
|
-
|
|
18970
|
+
fs24.chmodSync(wrapper, 493);
|
|
18899
18971
|
}
|
|
18900
18972
|
}
|
|
18901
|
-
var WINDSURF_DISPATCHER_BINDINGS = [
|
|
18902
|
-
["session_start", "post_setup_worktree"],
|
|
18903
|
-
["user_prompt_submit", "pre_user_prompt"],
|
|
18904
|
-
["stop", "post_cascade_response"]
|
|
18905
|
-
];
|
|
18906
18973
|
function _windsurf_dispatch_command(ac_event, native) {
|
|
18907
18974
|
return `[ -x ./agent-config ] || exit 0; ./agent-config dispatch:hook --platform windsurf --event ${ac_event} --native-event ${native}`;
|
|
18908
18975
|
}
|
|
18909
18976
|
function ensure_windsurf_bridge(project_root, force) {
|
|
18910
18977
|
const hooks = {};
|
|
18911
|
-
for (const
|
|
18978
|
+
for (const { slot, native } of hostBindings("windsurf")) {
|
|
18912
18979
|
(hooks[native] ??= []).push({
|
|
18913
|
-
command: _windsurf_dispatch_command(
|
|
18980
|
+
command: _windsurf_dispatch_command(slot, native),
|
|
18914
18981
|
show_output: false
|
|
18915
18982
|
});
|
|
18916
18983
|
}
|
|
18917
18984
|
const bridge = { hooks };
|
|
18918
18985
|
return merge_json_file(
|
|
18919
|
-
|
|
18986
|
+
path21.join(project_root, ".windsurf", "hooks.json"),
|
|
18920
18987
|
bridge,
|
|
18921
18988
|
force,
|
|
18922
18989
|
".windsurf/hooks.json"
|
|
18923
18990
|
);
|
|
18924
18991
|
}
|
|
18925
|
-
var WINDSURF_USER_DIR =
|
|
18926
|
-
var WINDSURF_USER_HOOKS_DIR =
|
|
18992
|
+
var WINDSURF_USER_DIR = path21.join(os8.homedir(), ".codeium", "windsurf");
|
|
18993
|
+
var WINDSURF_USER_HOOKS_DIR = path21.join(WINDSURF_USER_DIR, "hooks");
|
|
18927
18994
|
var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
|
|
18928
18995
|
function ensure_windsurf_user_hooks(package_root, force) {
|
|
18929
|
-
const src =
|
|
18996
|
+
const src = path21.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
18930
18997
|
if (!pathExists(src)) {
|
|
18931
18998
|
skip(`windsurf trampoline missing in package: ${src}`);
|
|
18932
18999
|
return [];
|
|
18933
19000
|
}
|
|
18934
19001
|
mkdirp(WINDSURF_USER_HOOKS_DIR);
|
|
18935
|
-
const dst =
|
|
19002
|
+
const dst = path21.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
18936
19003
|
const src_text = readText(src);
|
|
18937
19004
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
18938
19005
|
skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
18939
19006
|
} else {
|
|
18940
19007
|
writeText(dst, src_text);
|
|
18941
|
-
|
|
19008
|
+
fs24.chmodSync(dst, 493);
|
|
18942
19009
|
success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
|
|
18943
19010
|
}
|
|
18944
19011
|
const hooks = {};
|
|
18945
|
-
for (const
|
|
19012
|
+
for (const { slot, native } of hostBindings("windsurf")) {
|
|
18946
19013
|
(hooks[native] ??= []).push({
|
|
18947
|
-
command: `${dst} ${
|
|
19014
|
+
command: `${dst} ${slot} ${native}`,
|
|
18948
19015
|
show_output: false
|
|
18949
19016
|
});
|
|
18950
19017
|
}
|
|
18951
19018
|
const settings_patch = { hooks };
|
|
18952
19019
|
return merge_json_file(
|
|
18953
|
-
|
|
19020
|
+
path21.join(WINDSURF_USER_DIR, "hooks.json"),
|
|
18954
19021
|
settings_patch,
|
|
18955
19022
|
force,
|
|
18956
19023
|
"~/.codeium/windsurf/hooks.json"
|
|
18957
19024
|
);
|
|
18958
19025
|
}
|
|
18959
|
-
var GEMINI_DISPATCHER_BINDINGS = [
|
|
18960
|
-
["session_start", "SessionStart", ""],
|
|
18961
|
-
["session_end", "SessionEnd", ""],
|
|
18962
|
-
["stop", "AfterAgent", ""],
|
|
18963
|
-
["user_prompt_submit", "BeforeAgent", ""],
|
|
18964
|
-
["post_tool_use", "AfterTool", ".*"]
|
|
18965
|
-
];
|
|
18966
19026
|
function _gemini_dispatch_command(ac_event, native) {
|
|
18967
19027
|
return `[ -x ./agent-config ] || exit 0; ./agent-config dispatch:hook --platform gemini --event ${ac_event} --native-event ${native}`;
|
|
18968
19028
|
}
|
|
18969
19029
|
function _gemini_hooks_dict(command_factory) {
|
|
18970
19030
|
const out = {};
|
|
18971
|
-
for (const
|
|
19031
|
+
for (const { slot, native, matcher } of hostBindings("gemini")) {
|
|
18972
19032
|
(out[native] ??= []).push({
|
|
18973
19033
|
matcher,
|
|
18974
|
-
hooks: [{ type: "command", command: command_factory(
|
|
19034
|
+
hooks: [{ type: "command", command: command_factory(slot, native) }]
|
|
18975
19035
|
});
|
|
18976
19036
|
}
|
|
18977
19037
|
return out;
|
|
@@ -18979,43 +19039,43 @@ function _gemini_hooks_dict(command_factory) {
|
|
|
18979
19039
|
function ensure_gemini_bridge(project_root, force) {
|
|
18980
19040
|
const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
|
|
18981
19041
|
return merge_json_file(
|
|
18982
|
-
|
|
19042
|
+
path21.join(project_root, ".gemini", "settings.json"),
|
|
18983
19043
|
bridge,
|
|
18984
19044
|
force,
|
|
18985
19045
|
".gemini/settings.json"
|
|
18986
19046
|
);
|
|
18987
19047
|
}
|
|
18988
|
-
var GEMINI_USER_DIR =
|
|
18989
|
-
var GEMINI_USER_HOOKS_DIR =
|
|
19048
|
+
var GEMINI_USER_DIR = path21.join(os8.homedir(), ".gemini");
|
|
19049
|
+
var GEMINI_USER_HOOKS_DIR = path21.join(GEMINI_USER_DIR, "hooks");
|
|
18990
19050
|
var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
|
|
18991
19051
|
function ensure_gemini_user_hooks(package_root, force) {
|
|
18992
|
-
const src =
|
|
19052
|
+
const src = path21.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
|
|
18993
19053
|
if (!pathExists(src)) {
|
|
18994
19054
|
skip(`gemini trampoline missing in package: ${src}`);
|
|
18995
19055
|
return [];
|
|
18996
19056
|
}
|
|
18997
19057
|
mkdirp(GEMINI_USER_HOOKS_DIR);
|
|
18998
|
-
const dst =
|
|
19058
|
+
const dst = path21.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
|
|
18999
19059
|
const src_text = readText(src);
|
|
19000
19060
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
19001
19061
|
skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
19002
19062
|
} else {
|
|
19003
19063
|
writeText(dst, src_text);
|
|
19004
|
-
|
|
19064
|
+
fs24.chmodSync(dst, 493);
|
|
19005
19065
|
success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
|
|
19006
19066
|
}
|
|
19007
19067
|
const settings_patch = {
|
|
19008
19068
|
hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
|
|
19009
19069
|
};
|
|
19010
19070
|
return merge_json_file(
|
|
19011
|
-
|
|
19071
|
+
path21.join(GEMINI_USER_DIR, "settings.json"),
|
|
19012
19072
|
settings_patch,
|
|
19013
19073
|
force,
|
|
19014
19074
|
"~/.gemini/settings.json"
|
|
19015
19075
|
);
|
|
19016
19076
|
}
|
|
19017
19077
|
function ensure_copilot_bridge(project_root, force) {
|
|
19018
|
-
const target =
|
|
19078
|
+
const target = path21.join(project_root, ".github", "plugin", "marketplace.json");
|
|
19019
19079
|
const bridge = {
|
|
19020
19080
|
marketplace: {
|
|
19021
19081
|
name: "event4u-agent-marketplace",
|
|
@@ -19058,7 +19118,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
|
|
|
19058
19118
|
Run \`./agent-config --help\` for available commands.
|
|
19059
19119
|
`;
|
|
19060
19120
|
function ensure_roocode_bridge(project_root, force) {
|
|
19061
|
-
const target =
|
|
19121
|
+
const target = path21.join(project_root, ".roo", "rules", "agent-config.md");
|
|
19062
19122
|
if (pathExists(target) && !force) {
|
|
19063
19123
|
skip(".roo/rules/agent-config.md already exists");
|
|
19064
19124
|
return;
|
|
@@ -19080,7 +19140,7 @@ To wire Claude Desktop to this project's rules, run:
|
|
|
19080
19140
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
19081
19141
|
`;
|
|
19082
19142
|
function ensure_claude_desktop_bridge(project_root, force) {
|
|
19083
|
-
const target =
|
|
19143
|
+
const target = path21.join(project_root, ".claude-desktop", "agent-config.md");
|
|
19084
19144
|
if (pathExists(target) && !force) {
|
|
19085
19145
|
skip(".claude-desktop/agent-config.md already exists");
|
|
19086
19146
|
return;
|
|
@@ -19105,7 +19165,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
|
|
|
19105
19165
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
19106
19166
|
`;
|
|
19107
19167
|
function ensure_aider_bridge(project_root, force) {
|
|
19108
|
-
const target =
|
|
19168
|
+
const target = path21.join(project_root, ".aider", "agent-config.md");
|
|
19109
19169
|
if (pathExists(target) && !force) {
|
|
19110
19170
|
skip(".aider/agent-config.md already exists");
|
|
19111
19171
|
return;
|
|
@@ -19124,7 +19184,7 @@ developers where the rules and skills live.
|
|
|
19124
19184
|
Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
|
|
19125
19185
|
`;
|
|
19126
19186
|
function ensure_codex_bridge(project_root, force) {
|
|
19127
|
-
const target =
|
|
19187
|
+
const target = path21.join(project_root, ".codex", "agent-config.md");
|
|
19128
19188
|
if (pathExists(target) && !force) {
|
|
19129
19189
|
skip(".codex/agent-config.md already exists");
|
|
19130
19190
|
return;
|
|
@@ -19142,7 +19202,7 @@ rules per session. The canonical rule and skill source lives under
|
|
|
19142
19202
|
orientation).
|
|
19143
19203
|
`;
|
|
19144
19204
|
function ensure_continue_bridge(project_root, force) {
|
|
19145
|
-
const target =
|
|
19205
|
+
const target = path21.join(project_root, ".continue", "rules", "agent-config.md");
|
|
19146
19206
|
if (pathExists(target) && !force) {
|
|
19147
19207
|
skip(".continue/rules/agent-config.md already exists");
|
|
19148
19208
|
return;
|
|
@@ -19173,7 +19233,7 @@ orientation).
|
|
|
19173
19233
|
See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
|
|
19174
19234
|
`;
|
|
19175
19235
|
function ensure_kilocode_bridge(project_root, force) {
|
|
19176
|
-
const target =
|
|
19236
|
+
const target = path21.join(project_root, ".kilocode", "rules", "agent-config.md");
|
|
19177
19237
|
if (pathExists(target) && !force) {
|
|
19178
19238
|
skip(".kilocode/rules/agent-config.md already exists");
|
|
19179
19239
|
return;
|
|
@@ -19200,7 +19260,7 @@ canonical source (or symlink it):
|
|
|
19200
19260
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
19201
19261
|
`;
|
|
19202
19262
|
function ensure_zed_bridge(project_root, force) {
|
|
19203
|
-
const target =
|
|
19263
|
+
const target = path21.join(project_root, ".zed", "agent-config.md");
|
|
19204
19264
|
if (pathExists(target) && !force) {
|
|
19205
19265
|
skip(".zed/agent-config.md already exists");
|
|
19206
19266
|
return;
|
|
@@ -19221,7 +19281,7 @@ rules into your JetBrains profile.
|
|
|
19221
19281
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
19222
19282
|
`;
|
|
19223
19283
|
function ensure_jetbrains_bridge(project_root, force) {
|
|
19224
|
-
const target =
|
|
19284
|
+
const target = path21.join(project_root, ".jetbrains", "agent-config.md");
|
|
19225
19285
|
if (pathExists(target) && !force) {
|
|
19226
19286
|
skip(".jetbrains/agent-config.md already exists");
|
|
19227
19287
|
return;
|
|
@@ -19252,7 +19312,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
|
|
|
19252
19312
|
See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
|
|
19253
19313
|
`;
|
|
19254
19314
|
function ensure_kiro_bridge(project_root, force) {
|
|
19255
|
-
const target =
|
|
19315
|
+
const target = path21.join(project_root, ".kiro", "steering", "agent-config.md");
|
|
19256
19316
|
if (pathExists(target) && !force) {
|
|
19257
19317
|
skip(".kiro/steering/agent-config.md already exists");
|
|
19258
19318
|
return;
|
|
@@ -19260,14 +19320,25 @@ function ensure_kiro_bridge(project_root, force) {
|
|
|
19260
19320
|
write_file(target, KIRO_MARKER);
|
|
19261
19321
|
success(".kiro/steering/agent-config.md created");
|
|
19262
19322
|
}
|
|
19263
|
-
var
|
|
19323
|
+
var SMOKE_PROBE_SLOTS = [
|
|
19264
19324
|
["augment", "session_start"],
|
|
19265
|
-
["claude", "
|
|
19266
|
-
["cursor", "
|
|
19325
|
+
["claude", "session_start"],
|
|
19326
|
+
["cursor", "session_start"],
|
|
19267
19327
|
["cline", "session_start"],
|
|
19268
|
-
["windsurf", "
|
|
19269
|
-
["gemini", "
|
|
19328
|
+
["windsurf", "session_start"],
|
|
19329
|
+
["gemini", "session_start"]
|
|
19270
19330
|
];
|
|
19331
|
+
function smokeProbeEvents() {
|
|
19332
|
+
return SMOKE_PROBE_SLOTS.map(([platform, slot]) => {
|
|
19333
|
+
const binding = hostBindings(platform).find((b) => b.slot === slot);
|
|
19334
|
+
if (binding === void 0) {
|
|
19335
|
+
throw new Error(
|
|
19336
|
+
`install smoke probe: host_lowering.yaml has no \`${slot}\` binding for \`${platform}\``
|
|
19337
|
+
);
|
|
19338
|
+
}
|
|
19339
|
+
return [platform, binding.native];
|
|
19340
|
+
});
|
|
19341
|
+
}
|
|
19271
19342
|
var SMOKE_BRIDGE_PATHS = {
|
|
19272
19343
|
augment: ".augment/settings.json",
|
|
19273
19344
|
claude: ".claude/settings.json",
|
|
@@ -19278,35 +19349,35 @@ var SMOKE_BRIDGE_PATHS = {
|
|
|
19278
19349
|
};
|
|
19279
19350
|
function dirHasEntries(p) {
|
|
19280
19351
|
try {
|
|
19281
|
-
return
|
|
19352
|
+
return fs24.readdirSync(p).length > 0;
|
|
19282
19353
|
} catch {
|
|
19283
19354
|
return false;
|
|
19284
19355
|
}
|
|
19285
19356
|
}
|
|
19286
19357
|
function _resolve_tsx_invocation(scriptPath, scriptArgs) {
|
|
19287
19358
|
const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
19288
|
-
let dir =
|
|
19359
|
+
let dir = path21.dirname(scriptPath);
|
|
19289
19360
|
for (; ; ) {
|
|
19290
|
-
const candidate =
|
|
19361
|
+
const candidate = path21.join(dir, "node_modules", ".bin", binName);
|
|
19291
19362
|
if (isFile(candidate)) {
|
|
19292
19363
|
return { command: candidate, args: [scriptPath, ...scriptArgs] };
|
|
19293
19364
|
}
|
|
19294
|
-
const parent =
|
|
19365
|
+
const parent = path21.dirname(dir);
|
|
19295
19366
|
if (parent === dir) break;
|
|
19296
19367
|
dir = parent;
|
|
19297
19368
|
}
|
|
19298
19369
|
return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
|
|
19299
19370
|
}
|
|
19300
19371
|
function _smoke_test_hooks(project_root, package_root) {
|
|
19301
|
-
const dispatcher =
|
|
19302
|
-
const manifest =
|
|
19372
|
+
const dispatcher = path21.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
|
|
19373
|
+
const manifest = path21.join(package_root, "scripts", "hook_manifest.yaml");
|
|
19303
19374
|
if (!isFile(dispatcher) || !isFile(manifest)) return 0;
|
|
19304
19375
|
const failed = [];
|
|
19305
19376
|
const skipped = [];
|
|
19306
19377
|
const passed = [];
|
|
19307
|
-
for (const [platform, native] of
|
|
19378
|
+
for (const [platform, native] of smokeProbeEvents()) {
|
|
19308
19379
|
const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
|
|
19309
|
-
const bridge_path = rel_bridge ?
|
|
19380
|
+
const bridge_path = rel_bridge ? path21.join(project_root, rel_bridge) : null;
|
|
19310
19381
|
const bridge_present = Boolean(
|
|
19311
19382
|
bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
|
|
19312
19383
|
);
|
|
@@ -19506,9 +19577,9 @@ To remove this marker, delete this file.
|
|
|
19506
19577
|
`;
|
|
19507
19578
|
}
|
|
19508
19579
|
var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
|
|
19509
|
-
var GLOBAL_ROOT =
|
|
19510
|
-
var GLOBAL_USER_SETTINGS_PATH =
|
|
19511
|
-
var GLOBAL_AGENT_SETTINGS_PATH =
|
|
19580
|
+
var GLOBAL_ROOT = path21.join(os8.homedir(), ".event4u", "agent-config");
|
|
19581
|
+
var GLOBAL_USER_SETTINGS_PATH = path21.join(GLOBAL_ROOT, ".agent-user.yml");
|
|
19582
|
+
var GLOBAL_AGENT_SETTINGS_PATH = path21.join(GLOBAL_ROOT, ".agent-settings.yml");
|
|
19512
19583
|
function _bridge_marker(tool_id, scope) {
|
|
19513
19584
|
if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
|
|
19514
19585
|
return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
|
|
@@ -19557,7 +19628,7 @@ function _load_yaml_doc(p) {
|
|
|
19557
19628
|
return _isPlainObject2(data) ? data : {};
|
|
19558
19629
|
}
|
|
19559
19630
|
function _load_default_settings(package_root) {
|
|
19560
|
-
const template_source =
|
|
19631
|
+
const template_source = path21.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
19561
19632
|
if (!pathExists(template_source)) return {};
|
|
19562
19633
|
let text;
|
|
19563
19634
|
try {
|
|
@@ -19571,11 +19642,11 @@ function _load_default_settings(package_root) {
|
|
|
19571
19642
|
}
|
|
19572
19643
|
var RULE_LAYER_CHOICES = ["global", "project", "both-acknowledged"];
|
|
19573
19644
|
function _suppress_rule_layer(project_root, suppress_dir) {
|
|
19574
|
-
const target =
|
|
19645
|
+
const target = path21.join(project_root, ".claude", "settings.local.json");
|
|
19575
19646
|
const existing = pathExists(target) ? read_json_file(target) : {};
|
|
19576
19647
|
let real_dir = suppress_dir;
|
|
19577
19648
|
try {
|
|
19578
|
-
real_dir =
|
|
19649
|
+
real_dir = fs24.realpathSync(suppress_dir);
|
|
19579
19650
|
} catch {
|
|
19580
19651
|
real_dir = suppress_dir;
|
|
19581
19652
|
}
|
|
@@ -19586,8 +19657,8 @@ function _suppress_rule_layer(project_root, suppress_dir) {
|
|
|
19586
19657
|
success(`.claude/settings.local.json: claudeMdExcludes += ${entry}`);
|
|
19587
19658
|
}
|
|
19588
19659
|
function _gate_rule_layer_overlap(project_root, layer, dry_run) {
|
|
19589
|
-
const global_dir =
|
|
19590
|
-
const project_dir =
|
|
19660
|
+
const global_dir = path21.join(os8.homedir(), ".claude", "rules");
|
|
19661
|
+
const project_dir = path21.join(project_root, ".claude", "rules");
|
|
19591
19662
|
const g = readRuleLayer(global_dir);
|
|
19592
19663
|
const p = readRuleLayer(project_dir);
|
|
19593
19664
|
if (g === null || p === null) return true;
|
|
@@ -19675,9 +19746,9 @@ function detect_scope(cwd) {
|
|
|
19675
19746
|
if (pathExists(_resolve_settings_read(cwd))) {
|
|
19676
19747
|
return ["project", `existing ${SETTINGS_FILE}`];
|
|
19677
19748
|
}
|
|
19678
|
-
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(
|
|
19679
|
-
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(
|
|
19680
|
-
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(
|
|
19749
|
+
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path21.join(cwd, m))) ?? null;
|
|
19750
|
+
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path21.join(cwd, d))) ?? null;
|
|
19751
|
+
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path21.join(cwd, f))) ?? null;
|
|
19681
19752
|
if (has_manifest && (has_ai_dir || has_ai_file)) {
|
|
19682
19753
|
const marker = has_ai_dir || has_ai_file;
|
|
19683
19754
|
return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
|
|
@@ -19698,7 +19769,7 @@ function readLineSyncRaw(promptText) {
|
|
|
19698
19769
|
for (; ; ) {
|
|
19699
19770
|
let n;
|
|
19700
19771
|
try {
|
|
19701
|
-
n =
|
|
19772
|
+
n = fs24.readSync(0, buf, 0, 1, null);
|
|
19702
19773
|
} catch (err) {
|
|
19703
19774
|
const code = err.code;
|
|
19704
19775
|
if (code === "EAGAIN") {
|
|
@@ -19773,8 +19844,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
|
|
|
19773
19844
|
const marker = _bridge_marker(tool_id, scope);
|
|
19774
19845
|
if (!marker) continue;
|
|
19775
19846
|
let marker_path = marker;
|
|
19776
|
-
if (!
|
|
19777
|
-
marker_path =
|
|
19847
|
+
if (!path21.isAbsolute(marker_path)) {
|
|
19848
|
+
marker_path = path21.join(project_root, marker_path);
|
|
19778
19849
|
}
|
|
19779
19850
|
out[tool_id] = [_file_entry(marker_path, "bridge", false)];
|
|
19780
19851
|
}
|
|
@@ -19813,26 +19884,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
|
|
|
19813
19884
|
}
|
|
19814
19885
|
write_manifest(target, version, entries);
|
|
19815
19886
|
if (!state.QUIET) {
|
|
19816
|
-
const rel = isRelativeTo(target, project_root) ?
|
|
19887
|
+
const rel = isRelativeTo(target, project_root) ? path21.relative(project_root, target) : target;
|
|
19817
19888
|
info(`Manifest updated: ${rel}`);
|
|
19818
19889
|
}
|
|
19819
19890
|
return 0;
|
|
19820
19891
|
}
|
|
19821
19892
|
function isRelativeTo(child, parent) {
|
|
19822
|
-
const rel =
|
|
19823
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
19893
|
+
const rel = path21.relative(parent, child);
|
|
19894
|
+
return rel === "" || !rel.startsWith("..") && !path21.isAbsolute(rel);
|
|
19824
19895
|
}
|
|
19825
19896
|
function _resolve_package_root_for_global() {
|
|
19826
19897
|
const here = resolvePath(_HERE2);
|
|
19827
|
-
const candidate =
|
|
19828
|
-
if (!pathExists(
|
|
19898
|
+
const candidate = path21.dirname(path21.dirname(path21.dirname(here)));
|
|
19899
|
+
if (!pathExists(path21.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
|
|
19829
19900
|
fail(
|
|
19830
19901
|
`Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
|
|
19831
19902
|
);
|
|
19832
19903
|
}
|
|
19833
19904
|
return candidate;
|
|
19834
19905
|
}
|
|
19835
|
-
var CONSUMER_BRIDGE_MARKER_RELPATH =
|
|
19906
|
+
var CONSUMER_BRIDGE_MARKER_RELPATH = path21.join("agents", ".event4u-bridge.yml");
|
|
19836
19907
|
var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
19837
19908
|
var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
|
|
19838
19909
|
var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
|
|
@@ -19840,7 +19911,7 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
19840
19911
|
if (process3.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
|
|
19841
19912
|
return [false, "consumer-mode-override"];
|
|
19842
19913
|
}
|
|
19843
|
-
const pkg_json =
|
|
19914
|
+
const pkg_json = path21.join(project_root, "package.json");
|
|
19844
19915
|
if (isFile(pkg_json)) {
|
|
19845
19916
|
let data = {};
|
|
19846
19917
|
try {
|
|
@@ -19852,24 +19923,17 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
19852
19923
|
return [true, "package.json:name"];
|
|
19853
19924
|
}
|
|
19854
19925
|
}
|
|
19855
|
-
if (isDir(
|
|
19926
|
+
if (isDir(path21.join(project_root, ".agent-src.uncondensed"))) {
|
|
19856
19927
|
return [true, ".agent-src.uncondensed/"];
|
|
19857
19928
|
}
|
|
19858
|
-
const packages_dir =
|
|
19929
|
+
const packages_dir = path21.join(project_root, "packages");
|
|
19859
19930
|
if (isDir(packages_dir)) {
|
|
19860
|
-
for (const child of
|
|
19861
|
-
if (isDir(
|
|
19931
|
+
for (const child of fs24.readdirSync(packages_dir)) {
|
|
19932
|
+
if (isDir(path21.join(packages_dir, child, ".agent-src.uncondensed"))) {
|
|
19862
19933
|
return [true, `packages/${child}/.agent-src.uncondensed/`];
|
|
19863
19934
|
}
|
|
19864
19935
|
}
|
|
19865
19936
|
}
|
|
19866
|
-
const installer_self = path20.join(project_root, "scripts", "install.py");
|
|
19867
|
-
try {
|
|
19868
|
-
if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE2)) {
|
|
19869
|
-
return [true, "src/scripts/install.py (self)"];
|
|
19870
|
-
}
|
|
19871
|
-
} catch {
|
|
19872
|
-
}
|
|
19873
19937
|
return [false, ""];
|
|
19874
19938
|
}
|
|
19875
19939
|
function _detect_legacy_for_migration(project_root) {
|
|
@@ -19883,17 +19947,17 @@ function _detect_legacy_for_migration(project_root) {
|
|
|
19883
19947
|
}
|
|
19884
19948
|
return [];
|
|
19885
19949
|
}
|
|
19886
|
-
if (isFile(
|
|
19950
|
+
if (isFile(path21.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
|
|
19887
19951
|
const found = [];
|
|
19888
19952
|
for (const name of MIGRATE_LEGACY_YAML_FILES) {
|
|
19889
|
-
if (isFile(
|
|
19953
|
+
if (isFile(path21.join(project_root, name))) {
|
|
19890
19954
|
found.push(name);
|
|
19891
|
-
} else if (isFile(
|
|
19955
|
+
} else if (isFile(path21.join(project_root, "settings", name))) {
|
|
19892
19956
|
found.push(`settings/${name}`);
|
|
19893
19957
|
}
|
|
19894
19958
|
}
|
|
19895
19959
|
for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
|
|
19896
|
-
const p =
|
|
19960
|
+
const p = path21.join(project_root, name);
|
|
19897
19961
|
if (isDir(p) && !isSymlink(p)) {
|
|
19898
19962
|
found.push(`${name}/`);
|
|
19899
19963
|
}
|
|
@@ -19905,7 +19969,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
|
|
|
19905
19969
|
process3.stdout.write("\n");
|
|
19906
19970
|
warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
|
|
19907
19971
|
for (const rel of artefacts) {
|
|
19908
|
-
info(` ${
|
|
19972
|
+
info(` ${path21.join(project_root, rel)}`);
|
|
19909
19973
|
}
|
|
19910
19974
|
info("The unified `agent-config migrate` sweeps these in one pass.");
|
|
19911
19975
|
info("The wizard recreates fresh config afterwards.");
|
|
@@ -19936,20 +20000,20 @@ function _run_migrate_to_global(project_root) {
|
|
|
19936
20000
|
function _format_global_root_for_marker(global_root) {
|
|
19937
20001
|
const home = resolvePath(os8.homedir());
|
|
19938
20002
|
const resolved = resolvePath(global_root);
|
|
19939
|
-
const rel =
|
|
19940
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
20003
|
+
const rel = path21.relative(home, resolved);
|
|
20004
|
+
if (rel === "" || rel.startsWith("..") || path21.isAbsolute(rel)) {
|
|
19941
20005
|
return global_root;
|
|
19942
20006
|
}
|
|
19943
|
-
return `~/${rel.split(
|
|
20007
|
+
return `~/${rel.split(path21.sep).join("/")}`;
|
|
19944
20008
|
}
|
|
19945
20009
|
function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
|
|
19946
20010
|
const env_map = env ?? process3.env;
|
|
19947
20011
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
|
|
19948
|
-
if (isDir(
|
|
19949
|
-
const target =
|
|
20012
|
+
if (isDir(path21.join(project_root, ".agent-src.uncondensed"))) return null;
|
|
20013
|
+
const target = path21.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
|
|
19950
20014
|
if (!isFile(target)) return null;
|
|
19951
20015
|
try {
|
|
19952
|
-
|
|
20016
|
+
fs24.rmSync(target);
|
|
19953
20017
|
} catch {
|
|
19954
20018
|
return null;
|
|
19955
20019
|
}
|
|
@@ -19963,7 +20027,7 @@ var PROJECT_ANCHOR_TOOLS = {
|
|
|
19963
20027
|
function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
|
|
19964
20028
|
const env_map = env ?? process3.env;
|
|
19965
20029
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
|
|
19966
|
-
if (isDir(
|
|
20030
|
+
if (isDir(path21.join(project_root, ".agent-src.uncondensed"))) return [];
|
|
19967
20031
|
const global_root_str = _format_global_root_for_marker(
|
|
19968
20032
|
event4u_root(env_map)
|
|
19969
20033
|
);
|
|
@@ -19972,8 +20036,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
|
|
|
19972
20036
|
for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
|
|
19973
20037
|
const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
|
|
19974
20038
|
if (!tools.has(tool_id)) continue;
|
|
19975
|
-
const target =
|
|
19976
|
-
mkdirp(
|
|
20039
|
+
const target = path21.join(project_root, rel_path);
|
|
20040
|
+
mkdirp(path21.dirname(target));
|
|
19977
20041
|
const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
|
|
19978
20042
|
# Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
|
|
19979
20043
|
# Tool: ${tool_id}. Resolves the global install directly \u2014 no
|
|
@@ -19991,7 +20055,7 @@ installed_at: ${stamp}
|
|
|
19991
20055
|
}
|
|
19992
20056
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
19993
20057
|
function _inject_package_tag(target, source, package_root) {
|
|
19994
|
-
if (
|
|
20058
|
+
if (path21.extname(target) !== ".md") return;
|
|
19995
20059
|
let text;
|
|
19996
20060
|
try {
|
|
19997
20061
|
text = readText(target);
|
|
@@ -20019,8 +20083,8 @@ function _inject_package_tag(target, source, package_root) {
|
|
|
20019
20083
|
resolved_src = source;
|
|
20020
20084
|
}
|
|
20021
20085
|
if (package_root !== null) {
|
|
20022
|
-
const rel =
|
|
20023
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
20086
|
+
const rel = path21.relative(resolvePath(package_root), resolved_src);
|
|
20087
|
+
if (rel !== "" && !rel.startsWith("..") && !path21.isAbsolute(rel)) {
|
|
20024
20088
|
source_value = rel;
|
|
20025
20089
|
} else {
|
|
20026
20090
|
source_value = resolved_src;
|
|
@@ -20055,7 +20119,7 @@ function _escapes_package_root(resolved, package_root) {
|
|
|
20055
20119
|
if (package_root === null) return false;
|
|
20056
20120
|
let root;
|
|
20057
20121
|
try {
|
|
20058
|
-
root =
|
|
20122
|
+
root = fs24.realpathSync(package_root);
|
|
20059
20123
|
} catch {
|
|
20060
20124
|
return false;
|
|
20061
20125
|
}
|
|
@@ -20070,7 +20134,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
20070
20134
|
if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
|
|
20071
20135
|
let resolved_src = src;
|
|
20072
20136
|
try {
|
|
20073
|
-
resolved_src =
|
|
20137
|
+
resolved_src = fs24.realpathSync(src);
|
|
20074
20138
|
} catch {
|
|
20075
20139
|
resolved_src = src;
|
|
20076
20140
|
}
|
|
@@ -20078,10 +20142,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
20078
20142
|
warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
|
|
20079
20143
|
return [0, 0, written_paths];
|
|
20080
20144
|
}
|
|
20081
|
-
mkdirp(
|
|
20145
|
+
mkdirp(path21.dirname(dest));
|
|
20082
20146
|
const decision = _resolve_file_conflict(dest, force);
|
|
20083
20147
|
if (decision === "skip") return [0, 1, written_paths];
|
|
20084
|
-
|
|
20148
|
+
fs24.copyFileSync(src, dest);
|
|
20085
20149
|
_inject_package_tag(dest, src, package_root);
|
|
20086
20150
|
written_paths.push(dest);
|
|
20087
20151
|
return [1, 0, written_paths];
|
|
@@ -20089,11 +20153,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
20089
20153
|
mkdirp(dest);
|
|
20090
20154
|
const walk = (node) => {
|
|
20091
20155
|
const acc = [];
|
|
20092
|
-
const names =
|
|
20156
|
+
const names = fs24.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
20093
20157
|
for (const name of names) {
|
|
20094
|
-
const entry =
|
|
20158
|
+
const entry = path21.join(node, name);
|
|
20095
20159
|
acc.push(entry);
|
|
20096
|
-
const lst =
|
|
20160
|
+
const lst = fs24.lstatSync(entry);
|
|
20097
20161
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
20098
20162
|
acc.push(...walk(entry));
|
|
20099
20163
|
}
|
|
@@ -20101,9 +20165,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
20101
20165
|
return acc;
|
|
20102
20166
|
};
|
|
20103
20167
|
for (const entry of walk(src)) {
|
|
20104
|
-
const rel =
|
|
20105
|
-
const target =
|
|
20106
|
-
const lst =
|
|
20168
|
+
const rel = path21.relative(src, entry);
|
|
20169
|
+
const target = path21.join(dest, rel);
|
|
20170
|
+
const lst = fs24.lstatSync(entry);
|
|
20107
20171
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
20108
20172
|
mkdirp(target);
|
|
20109
20173
|
continue;
|
|
@@ -20111,8 +20175,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
20111
20175
|
let resolvedIsDir = false;
|
|
20112
20176
|
let resolved = entry;
|
|
20113
20177
|
try {
|
|
20114
|
-
resolved =
|
|
20115
|
-
resolvedIsDir =
|
|
20178
|
+
resolved = fs24.realpathSync(entry);
|
|
20179
|
+
resolvedIsDir = fs24.statSync(entry).isDirectory();
|
|
20116
20180
|
} catch {
|
|
20117
20181
|
resolvedIsDir = false;
|
|
20118
20182
|
}
|
|
@@ -20142,8 +20206,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
20142
20206
|
skipped += 1;
|
|
20143
20207
|
continue;
|
|
20144
20208
|
}
|
|
20145
|
-
mkdirp(
|
|
20146
|
-
|
|
20209
|
+
mkdirp(path21.dirname(target));
|
|
20210
|
+
fs24.copyFileSync(resolved, target);
|
|
20147
20211
|
_inject_package_tag(target, resolved, package_root);
|
|
20148
20212
|
written += 1;
|
|
20149
20213
|
written_paths.push(target);
|
|
@@ -20155,7 +20219,7 @@ function _claude_desktop_bundles_dir() {
|
|
|
20155
20219
|
}
|
|
20156
20220
|
function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
|
|
20157
20221
|
const anchor = expanduser6(USER_SCOPE_PATHS["claude-desktop"]);
|
|
20158
|
-
const target =
|
|
20222
|
+
const target = path21.join(anchor, "agent-config.md");
|
|
20159
20223
|
mkdirp(anchor);
|
|
20160
20224
|
const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
|
|
20161
20225
|
writeText(target, body);
|
|
@@ -20179,23 +20243,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
20179
20243
|
const wrapped = [];
|
|
20180
20244
|
const collisions = [];
|
|
20181
20245
|
const reserved = [];
|
|
20182
|
-
const commands_dir =
|
|
20246
|
+
const commands_dir = path21.join(anchor, "commands");
|
|
20183
20247
|
let flat_entries = [];
|
|
20184
20248
|
try {
|
|
20185
|
-
flat_entries =
|
|
20249
|
+
flat_entries = fs24.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
|
|
20186
20250
|
} catch {
|
|
20187
20251
|
}
|
|
20188
20252
|
for (const fname of flat_entries.sort()) {
|
|
20189
20253
|
const slug = fname.slice(0, -".md".length);
|
|
20190
20254
|
if (!is_claude_builtin_name(slug)) continue;
|
|
20191
|
-
|
|
20255
|
+
fs24.rmSync(path21.join(commands_dir, fname), { force: true });
|
|
20192
20256
|
current_files.delete(`commands/${fname}`);
|
|
20193
20257
|
reserved.push(slug);
|
|
20194
20258
|
}
|
|
20195
20259
|
const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
|
|
20196
20260
|
try {
|
|
20197
20261
|
const manifest = JSON.parse(
|
|
20198
|
-
|
|
20262
|
+
fs24.readFileSync(path21.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
|
|
20199
20263
|
);
|
|
20200
20264
|
for (const a of manifest.artefacts ?? []) {
|
|
20201
20265
|
if (a.category !== "command" || typeof a.slug !== "string") continue;
|
|
@@ -20206,22 +20270,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
20206
20270
|
}
|
|
20207
20271
|
for (const slug of [...eligible].sort()) {
|
|
20208
20272
|
const flat_rel = `commands/${slug}.md`;
|
|
20209
|
-
const flat_abs =
|
|
20210
|
-
if (!
|
|
20211
|
-
const skill_dir =
|
|
20212
|
-
if (
|
|
20273
|
+
const flat_abs = path21.join(anchor, "commands", `${slug}.md`);
|
|
20274
|
+
if (!fs24.existsSync(flat_abs)) continue;
|
|
20275
|
+
const skill_dir = path21.join(anchor, "skills", slug);
|
|
20276
|
+
if (fs24.existsSync(skill_dir)) {
|
|
20213
20277
|
collisions.push(slug);
|
|
20214
20278
|
continue;
|
|
20215
20279
|
}
|
|
20216
|
-
let body =
|
|
20280
|
+
let body = fs24.readFileSync(flat_abs, "utf8");
|
|
20217
20281
|
if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
|
|
20218
20282
|
body = body.replace("---\n", `---
|
|
20219
20283
|
name: ${slug}
|
|
20220
20284
|
`);
|
|
20221
20285
|
}
|
|
20222
|
-
|
|
20223
|
-
|
|
20224
|
-
|
|
20286
|
+
fs24.mkdirSync(skill_dir, { recursive: true });
|
|
20287
|
+
fs24.writeFileSync(path21.join(skill_dir, "SKILL.md"), body, "utf8");
|
|
20288
|
+
fs24.rmSync(flat_abs, { force: true });
|
|
20225
20289
|
current_files.delete(flat_rel);
|
|
20226
20290
|
current_files.add(`skills/${slug}/SKILL.md`);
|
|
20227
20291
|
wrapped.push(slug);
|
|
@@ -20253,8 +20317,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
20253
20317
|
const written_paths = [];
|
|
20254
20318
|
let current_files = /* @__PURE__ */ new Set();
|
|
20255
20319
|
for (const [src_rel, dest_sub] of plan) {
|
|
20256
|
-
const src =
|
|
20257
|
-
const dest = dest_sub ?
|
|
20320
|
+
const src = path21.join(package_root, src_rel);
|
|
20321
|
+
const dest = dest_sub ? path21.join(anchor, dest_sub) : anchor;
|
|
20258
20322
|
const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
|
|
20259
20323
|
const [w, s, paths] = _copy_dir_dereferencing_symlinks(
|
|
20260
20324
|
src,
|
|
@@ -20278,7 +20342,7 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
20278
20342
|
if (tool_id === "claude-code") {
|
|
20279
20343
|
const res = _apply_claude_flat_command_wrappers(anchor, package_root, current_files);
|
|
20280
20344
|
rewriteAndReport(
|
|
20281
|
-
|
|
20345
|
+
path21.join(anchor, "rules"),
|
|
20282
20346
|
state.QUIET,
|
|
20283
20347
|
info,
|
|
20284
20348
|
warn,
|
|
@@ -20325,10 +20389,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
20325
20389
|
results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
|
|
20326
20390
|
if (tool_id === "claude-code") {
|
|
20327
20391
|
try {
|
|
20328
|
-
const manifest =
|
|
20392
|
+
const manifest = path21.join(package_root, "src", "scripts", "hook_manifest.yaml");
|
|
20329
20393
|
const matrix = build_claude_hook_matrix(manifest);
|
|
20330
20394
|
const res = ensure_managed_hooks(
|
|
20331
|
-
|
|
20395
|
+
path21.join(anchor, "settings.json"),
|
|
20332
20396
|
matrix
|
|
20333
20397
|
);
|
|
20334
20398
|
if (!state.QUIET) {
|
|
@@ -20365,7 +20429,7 @@ function _preview_global_reap(tools, package_root) {
|
|
|
20365
20429
|
const anchor = expanduser6(anchor_raw);
|
|
20366
20430
|
let current_files = /* @__PURE__ */ new Set();
|
|
20367
20431
|
for (const [src_rel, dest_sub] of plan) {
|
|
20368
|
-
const src =
|
|
20432
|
+
const src = path21.join(package_root, src_rel);
|
|
20369
20433
|
current_files = setUnion(
|
|
20370
20434
|
current_files,
|
|
20371
20435
|
expected_deploy_files(
|
|
@@ -20399,14 +20463,14 @@ function _preview_global_reap(tools, package_root) {
|
|
|
20399
20463
|
function _verify_deploy_targets(anchor, plan) {
|
|
20400
20464
|
const missing = [];
|
|
20401
20465
|
for (const [, dest_sub] of plan) {
|
|
20402
|
-
const target = dest_sub ?
|
|
20466
|
+
const target = dest_sub ? path21.join(anchor, dest_sub) : anchor;
|
|
20403
20467
|
const label = dest_sub || ".";
|
|
20404
20468
|
if (!isDir(target)) {
|
|
20405
20469
|
missing.push(label);
|
|
20406
20470
|
continue;
|
|
20407
20471
|
}
|
|
20408
20472
|
try {
|
|
20409
|
-
const entries =
|
|
20473
|
+
const entries = fs24.readdirSync(target);
|
|
20410
20474
|
if (entries.length === 0) missing.push(label);
|
|
20411
20475
|
} catch {
|
|
20412
20476
|
missing.push(label);
|
|
@@ -20424,9 +20488,9 @@ function _resolve_global_settings_doc() {
|
|
|
20424
20488
|
}
|
|
20425
20489
|
function _resolve_global_settings_path() {
|
|
20426
20490
|
const root = event4u_root();
|
|
20427
|
-
const canonical =
|
|
20491
|
+
const canonical = path21.join(root, "settings", SETTINGS_FILE);
|
|
20428
20492
|
if (pathExists(canonical)) return canonical;
|
|
20429
|
-
const legacy =
|
|
20493
|
+
const legacy = path21.join(root, SETTINGS_FILE);
|
|
20430
20494
|
if (pathExists(legacy)) return legacy;
|
|
20431
20495
|
return null;
|
|
20432
20496
|
}
|
|
@@ -20537,7 +20601,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
20537
20601
|
info(` schema_version=1, agent_config_version=${installed_version}`);
|
|
20538
20602
|
info(` tools=${merged_tools.join(",")}`);
|
|
20539
20603
|
}
|
|
20540
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
20604
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path21.join(project_root, ".agent-src.uncondensed"))) {
|
|
20541
20605
|
const drift = collect_drift(project_root);
|
|
20542
20606
|
if (!state.QUIET) {
|
|
20543
20607
|
process3.stdout.write("\n");
|
|
@@ -20651,19 +20715,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
20651
20715
|
}
|
|
20652
20716
|
}
|
|
20653
20717
|
}
|
|
20654
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
20718
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path21.join(project_root, ".agent-src.uncondensed"))) {
|
|
20655
20719
|
const files_by_tool = _files_by_tool_from_deploy(deploy_results);
|
|
20656
20720
|
const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
|
|
20657
20721
|
if (rc !== 0) return rc;
|
|
20658
20722
|
const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
|
|
20659
20723
|
if (removed_marker !== null && !state.QUIET) {
|
|
20660
|
-
const rel = isRelativeTo(removed_marker, project_root) ?
|
|
20724
|
+
const rel = isRelativeTo(removed_marker, project_root) ? path21.relative(project_root, removed_marker) : removed_marker;
|
|
20661
20725
|
info(`Removed legacy bridge marker: ${rel}`);
|
|
20662
20726
|
}
|
|
20663
20727
|
const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
|
|
20664
20728
|
if (anchor_paths.length > 0 && !state.QUIET) {
|
|
20665
20729
|
for (const p of anchor_paths) {
|
|
20666
|
-
const rel = isRelativeTo(p, project_root) ?
|
|
20730
|
+
const rel = isRelativeTo(p, project_root) ? path21.relative(project_root, p) : p;
|
|
20667
20731
|
info(`Project anchor written: ${rel}`);
|
|
20668
20732
|
}
|
|
20669
20733
|
}
|
|
@@ -20699,8 +20763,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
20699
20763
|
}
|
|
20700
20764
|
function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
20701
20765
|
const log_candidates = [
|
|
20702
|
-
|
|
20703
|
-
...project_root ? [
|
|
20766
|
+
path21.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
20767
|
+
...project_root ? [path21.join(project_root, OBSERVATION_LOG)] : []
|
|
20704
20768
|
];
|
|
20705
20769
|
const records = log_candidates.flatMap((p) => readObservationLog(p));
|
|
20706
20770
|
if (records.length === 0) return [];
|
|
@@ -20723,13 +20787,13 @@ function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
|
20723
20787
|
function _scoped_migration_notice(deploy_results, project_root, package_root, probe) {
|
|
20724
20788
|
if (!isInteractiveSession(probe)) return [];
|
|
20725
20789
|
const log_candidates = [
|
|
20726
|
-
|
|
20727
|
-
...project_root ? [
|
|
20790
|
+
path21.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
20791
|
+
...project_root ? [path21.join(project_root, OBSERVATION_LOG)] : []
|
|
20728
20792
|
];
|
|
20729
20793
|
const limits = knownHostLimits(log_candidates.flatMap((p) => readObservationLog(p)));
|
|
20730
20794
|
if (limits.size === 0) return [];
|
|
20731
20795
|
const resolved = _resolve_scoped_projection(package_root);
|
|
20732
|
-
const settings_path = _resolve_global_settings_path() ??
|
|
20796
|
+
const settings_path = _resolve_global_settings_path() ?? path21.join(event4u_root(), "settings", SETTINGS_FILE);
|
|
20733
20797
|
for (const tool_id of Object.keys(deploy_results).sort()) {
|
|
20734
20798
|
const [, , status] = deploy_results[tool_id];
|
|
20735
20799
|
if (status !== "deployed") continue;
|
|
@@ -20748,8 +20812,8 @@ function _scoped_migration_notice(deploy_results, project_root, package_root, pr
|
|
|
20748
20812
|
}
|
|
20749
20813
|
return [];
|
|
20750
20814
|
}
|
|
20751
|
-
var SETTINGS_SURFACE_REL =
|
|
20752
|
-
var SETTINGS_DELTA_REL =
|
|
20815
|
+
var SETTINGS_SURFACE_REL = path21.join("state", "settings-surface.json");
|
|
20816
|
+
var SETTINGS_DELTA_REL = path21.join("state", "settings-delta.json");
|
|
20753
20817
|
function _current_settings_surface(version) {
|
|
20754
20818
|
const jsonSchema = zodToJsonSchema(settingsSchema, {
|
|
20755
20819
|
name: "AgentSettings",
|
|
@@ -20760,20 +20824,20 @@ function _current_settings_surface(version) {
|
|
|
20760
20824
|
}
|
|
20761
20825
|
function _write_settings_surface_snapshot(installed_version) {
|
|
20762
20826
|
const root = event4u_root();
|
|
20763
|
-
const surface_path =
|
|
20764
|
-
const delta_path =
|
|
20827
|
+
const surface_path = path21.join(root, SETTINGS_SURFACE_REL);
|
|
20828
|
+
const delta_path = path21.join(root, SETTINGS_DELTA_REL);
|
|
20765
20829
|
const next = _current_settings_surface(installed_version);
|
|
20766
20830
|
let previous = null;
|
|
20767
20831
|
try {
|
|
20768
|
-
const parsed = JSON.parse(
|
|
20832
|
+
const parsed = JSON.parse(fs24.readFileSync(surface_path, "utf8"));
|
|
20769
20833
|
if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
|
|
20770
20834
|
} catch {
|
|
20771
20835
|
}
|
|
20772
20836
|
if (previous !== null && previous.version !== next.version) {
|
|
20773
20837
|
const delta = computeSurfaceDelta(previous, next);
|
|
20774
20838
|
if (delta.changes.length > 0) {
|
|
20775
|
-
|
|
20776
|
-
|
|
20839
|
+
fs24.mkdirSync(path21.dirname(delta_path), { recursive: true, mode: 448 });
|
|
20840
|
+
fs24.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
|
|
20777
20841
|
`, { mode: 384 });
|
|
20778
20842
|
if (!state.QUIET) {
|
|
20779
20843
|
const counts = {};
|
|
@@ -20785,8 +20849,8 @@ function _write_settings_surface_snapshot(installed_version) {
|
|
|
20785
20849
|
}
|
|
20786
20850
|
}
|
|
20787
20851
|
}
|
|
20788
|
-
|
|
20789
|
-
|
|
20852
|
+
fs24.mkdirSync(path21.dirname(surface_path), { recursive: true, mode: 448 });
|
|
20853
|
+
fs24.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
|
|
20790
20854
|
`, { mode: 384 });
|
|
20791
20855
|
}
|
|
20792
20856
|
function arrayStrEqual(a, b) {
|
|
@@ -20803,7 +20867,7 @@ function _merge_tools_aliases(tools, ai) {
|
|
|
20803
20867
|
}
|
|
20804
20868
|
return items.length > 0 ? items.join(",") : "all";
|
|
20805
20869
|
}
|
|
20806
|
-
var PROG = "install
|
|
20870
|
+
var PROG = "agent-config install";
|
|
20807
20871
|
var USAGE = `usage: ${PROG} [-h] [--profile PROFILE] [--user-type USER_TYPE] [--force]
|
|
20808
20872
|
[--skip-bridges] [--augment-user-hooks]
|
|
20809
20873
|
[--cursor-user-hooks] [--cline-user-hooks]
|
|
@@ -21006,13 +21070,13 @@ function _minimal_templates_root() {
|
|
|
21006
21070
|
const chain = [start];
|
|
21007
21071
|
let cur = start;
|
|
21008
21072
|
for (; ; ) {
|
|
21009
|
-
const parent =
|
|
21073
|
+
const parent = path21.dirname(cur);
|
|
21010
21074
|
if (parent === cur) break;
|
|
21011
21075
|
chain.push(parent);
|
|
21012
21076
|
cur = parent;
|
|
21013
21077
|
}
|
|
21014
21078
|
for (const ancestor of chain) {
|
|
21015
|
-
const candidate =
|
|
21079
|
+
const candidate = path21.join(ancestor, "src", "templates", "minimal");
|
|
21016
21080
|
if (isDir(candidate)) return candidate;
|
|
21017
21081
|
}
|
|
21018
21082
|
fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
|
|
@@ -21020,9 +21084,9 @@ function _minimal_templates_root() {
|
|
|
21020
21084
|
var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
21021
21085
|
function _write_install_mode_marker(project_root, mode) {
|
|
21022
21086
|
if (mode !== "minimal" && mode !== "full") return;
|
|
21023
|
-
const marker =
|
|
21087
|
+
const marker = path21.join(project_root, INSTALL_MODE_MARKER_REL);
|
|
21024
21088
|
try {
|
|
21025
|
-
mkdirp(
|
|
21089
|
+
mkdirp(path21.dirname(marker));
|
|
21026
21090
|
writeText(marker, `${mode}
|
|
21027
21091
|
`);
|
|
21028
21092
|
} catch {
|
|
@@ -21031,7 +21095,7 @@ function _write_install_mode_marker(project_root, mode) {
|
|
|
21031
21095
|
function install_minimal(target_root_in, force, user_type = "") {
|
|
21032
21096
|
let target_root = resolvePath(target_root_in);
|
|
21033
21097
|
mkdirp(target_root);
|
|
21034
|
-
const parent =
|
|
21098
|
+
const parent = path21.dirname(target_root);
|
|
21035
21099
|
if (parent !== target_root) {
|
|
21036
21100
|
const existing = find_project_root_with_anchor(parent);
|
|
21037
21101
|
if (existing !== null && existing[0] !== target_root) {
|
|
@@ -21042,21 +21106,21 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
21042
21106
|
}
|
|
21043
21107
|
}
|
|
21044
21108
|
const templates = _minimal_templates_root();
|
|
21045
|
-
const settings_src =
|
|
21046
|
-
const overrides_gitkeep_src =
|
|
21047
|
-
const overrides_readme_src =
|
|
21109
|
+
const settings_src = path21.join(templates, SETTINGS_FILE);
|
|
21110
|
+
const overrides_gitkeep_src = path21.join(templates, "overrides-gitkeep");
|
|
21111
|
+
const overrides_readme_src = path21.join(templates, "agents-overrides-readme.md");
|
|
21048
21112
|
if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
|
|
21049
21113
|
if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
|
|
21050
21114
|
fail(`Bundled overrides scaffold templates missing under ${templates}`);
|
|
21051
21115
|
}
|
|
21052
21116
|
info(`Minimal init \u2192 ${target_root}`);
|
|
21053
|
-
const overrides_root =
|
|
21117
|
+
const overrides_root = path21.join(target_root, "agents", "overrides");
|
|
21054
21118
|
mkdirp(overrides_root);
|
|
21055
21119
|
const gitkeep_body = readText(overrides_gitkeep_src);
|
|
21056
21120
|
for (const sub of ["rules", "skills", "commands"]) {
|
|
21057
|
-
const sub_dir =
|
|
21121
|
+
const sub_dir = path21.join(overrides_root, sub);
|
|
21058
21122
|
mkdirp(sub_dir);
|
|
21059
|
-
const gitkeep_dst =
|
|
21123
|
+
const gitkeep_dst = path21.join(sub_dir, ".gitkeep");
|
|
21060
21124
|
if (pathExists(gitkeep_dst) && !force) {
|
|
21061
21125
|
skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
|
|
21062
21126
|
} else {
|
|
@@ -21064,7 +21128,7 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
21064
21128
|
success(`Wrote agents/overrides/${sub}/.gitkeep`);
|
|
21065
21129
|
}
|
|
21066
21130
|
}
|
|
21067
|
-
const readme_dst =
|
|
21131
|
+
const readme_dst = path21.join(overrides_root, "README.md");
|
|
21068
21132
|
if (pathExists(readme_dst) && !force) {
|
|
21069
21133
|
skip("agents/overrides/README.md already exists (use --force to overwrite)");
|
|
21070
21134
|
} else {
|
|
@@ -21082,14 +21146,14 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
21082
21146
|
personal:
|
|
21083
21147
|
user_type: ${user_type}
|
|
21084
21148
|
`;
|
|
21085
|
-
mkdirp(
|
|
21149
|
+
mkdirp(path21.dirname(settings_dst));
|
|
21086
21150
|
writeText(settings_dst, body);
|
|
21087
21151
|
success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
|
|
21088
21152
|
}
|
|
21089
21153
|
}
|
|
21090
21154
|
const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
|
|
21091
21155
|
if (removed_marker !== null) {
|
|
21092
|
-
const rel = isRelativeTo(removed_marker, target_root) ?
|
|
21156
|
+
const rel = isRelativeTo(removed_marker, target_root) ? path21.relative(target_root, removed_marker) : removed_marker;
|
|
21093
21157
|
success(`Removed legacy bridge marker: ${rel}`);
|
|
21094
21158
|
}
|
|
21095
21159
|
_write_install_mode_marker(target_root, "minimal");
|
|
@@ -21163,7 +21227,7 @@ function run_interactive_init(project_root, force) {
|
|
|
21163
21227
|
);
|
|
21164
21228
|
return 0;
|
|
21165
21229
|
}
|
|
21166
|
-
const target =
|
|
21230
|
+
const target = path21.join(project_root, _LOCAL_CONFIG_FILE);
|
|
21167
21231
|
if (pathExists(target) && !force) {
|
|
21168
21232
|
warn(
|
|
21169
21233
|
`${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
|
|
@@ -21190,7 +21254,7 @@ function run_interactive_init(project_root, force) {
|
|
|
21190
21254
|
warn(`Could not write ${target}: ${String(exc)}`);
|
|
21191
21255
|
return 1;
|
|
21192
21256
|
}
|
|
21193
|
-
success(`Wrote ${
|
|
21257
|
+
success(`Wrote ${path21.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
|
|
21194
21258
|
return 0;
|
|
21195
21259
|
}
|
|
21196
21260
|
var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
|
|
@@ -21208,12 +21272,12 @@ function _wizard_should_launch(opts) {
|
|
|
21208
21272
|
return [true, ""];
|
|
21209
21273
|
}
|
|
21210
21274
|
function _wizard_cli_dist(_project_root) {
|
|
21211
|
-
const package_root =
|
|
21212
|
-
const cli =
|
|
21275
|
+
const package_root = path21.dirname(path21.dirname(path21.dirname(resolvePath(_HERE2))));
|
|
21276
|
+
const cli = path21.join(package_root, "dist", "cli", "agent-config.js");
|
|
21213
21277
|
return pathExists(cli) ? cli : null;
|
|
21214
21278
|
}
|
|
21215
21279
|
function _server_info_path() {
|
|
21216
|
-
return
|
|
21280
|
+
return path21.join(os8.homedir(), ".event4u", "agent-config", "local-server.json");
|
|
21217
21281
|
}
|
|
21218
21282
|
function _pid_is_agent_config(pid) {
|
|
21219
21283
|
let res;
|
|
@@ -21230,7 +21294,7 @@ function _pid_is_agent_config(pid) {
|
|
|
21230
21294
|
}
|
|
21231
21295
|
function unlinkMissingOk(p) {
|
|
21232
21296
|
try {
|
|
21233
|
-
|
|
21297
|
+
fs24.unlinkSync(p);
|
|
21234
21298
|
} catch {
|
|
21235
21299
|
}
|
|
21236
21300
|
}
|
|
@@ -21308,14 +21372,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
|
|
|
21308
21372
|
}
|
|
21309
21373
|
function _wizard_run_sync(cmd, env, cli) {
|
|
21310
21374
|
const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
|
|
21311
|
-
const log_path =
|
|
21375
|
+
const log_path = path21.join(
|
|
21312
21376
|
os8.tmpdir(),
|
|
21313
21377
|
`agent-config-wizard-${process3.pid}-${Date.now()}.log`
|
|
21314
21378
|
);
|
|
21315
21379
|
let child;
|
|
21316
21380
|
let log_fd = null;
|
|
21317
21381
|
try {
|
|
21318
|
-
log_fd =
|
|
21382
|
+
log_fd = fs24.openSync(log_path, "w");
|
|
21319
21383
|
child = spawn(cmd[0], cmd.slice(1), {
|
|
21320
21384
|
env,
|
|
21321
21385
|
detached: true,
|
|
@@ -21333,7 +21397,7 @@ function _wizard_run_sync(cmd, env, cli) {
|
|
|
21333
21397
|
} finally {
|
|
21334
21398
|
if (log_fd !== null) {
|
|
21335
21399
|
try {
|
|
21336
|
-
|
|
21400
|
+
fs24.closeSync(log_fd);
|
|
21337
21401
|
} catch {
|
|
21338
21402
|
}
|
|
21339
21403
|
}
|
|
@@ -21583,8 +21647,8 @@ function main2(argv) {
|
|
|
21583
21647
|
const target_root = resolvePath(
|
|
21584
21648
|
opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
|
|
21585
21649
|
);
|
|
21586
|
-
const minimal_package_root =
|
|
21587
|
-
|
|
21650
|
+
const minimal_package_root = path21.dirname(
|
|
21651
|
+
path21.dirname(path21.dirname(_minimal_templates_root()))
|
|
21588
21652
|
);
|
|
21589
21653
|
const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
|
|
21590
21654
|
return install_minimal(target_root, opts.force, validated_user_type);
|
|
@@ -21616,7 +21680,7 @@ function main2(argv) {
|
|
|
21616
21680
|
return rc2;
|
|
21617
21681
|
}
|
|
21618
21682
|
const project_root = custom_path || resolvePath(opts.project || process3.env["PROJECT_ROOT"] || process3.cwd());
|
|
21619
|
-
const is_first_run = !pathExists(
|
|
21683
|
+
const is_first_run = !pathExists(path21.join(project_root, SETTINGS_FILE));
|
|
21620
21684
|
const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
|
|
21621
21685
|
if (rc === 0 && opts.interactive) {
|
|
21622
21686
|
run_interactive_init(project_root, opts.force);
|
|
@@ -21680,16 +21744,16 @@ function _team_setup_hint_line(project_root) {
|
|
|
21680
21744
|
return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
|
|
21681
21745
|
}
|
|
21682
21746
|
function finalize_claude_model_tiers(project_root) {
|
|
21683
|
-
const claude_skills =
|
|
21684
|
-
const augment_skills =
|
|
21747
|
+
const claude_skills = path21.join(project_root, ".claude", "skills");
|
|
21748
|
+
const augment_skills = path21.join(project_root, ".augment", "skills");
|
|
21685
21749
|
if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
|
|
21686
21750
|
if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
|
|
21687
21751
|
let rendered = 0;
|
|
21688
|
-
const entries =
|
|
21752
|
+
const entries = fs24.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
21689
21753
|
for (const name of entries) {
|
|
21690
|
-
const entry =
|
|
21691
|
-
const src_dir =
|
|
21692
|
-
const src_md =
|
|
21754
|
+
const entry = path21.join(claude_skills, name);
|
|
21755
|
+
const src_dir = path21.join(augment_skills, name);
|
|
21756
|
+
const src_md = path21.join(src_dir, "SKILL.md");
|
|
21693
21757
|
let tier;
|
|
21694
21758
|
try {
|
|
21695
21759
|
tier = read_model_tier(src_md);
|
|
@@ -21698,22 +21762,22 @@ function finalize_claude_model_tiers(project_root) {
|
|
|
21698
21762
|
}
|
|
21699
21763
|
if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
|
|
21700
21764
|
if (isSymlink(entry) || isFile(entry)) {
|
|
21701
|
-
|
|
21765
|
+
fs24.unlinkSync(entry);
|
|
21702
21766
|
} else if (isDir(entry)) {
|
|
21703
|
-
|
|
21767
|
+
fs24.rmSync(entry, { recursive: true, force: true });
|
|
21704
21768
|
}
|
|
21705
21769
|
mkdirp(entry);
|
|
21706
|
-
const srcFiles =
|
|
21770
|
+
const srcFiles = fs24.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
21707
21771
|
for (const fname of srcFiles) {
|
|
21708
21772
|
if (fname === "SKILL.md") {
|
|
21709
21773
|
writeText(
|
|
21710
|
-
|
|
21774
|
+
path21.join(entry, "SKILL.md"),
|
|
21711
21775
|
render_native_model_md(readText(src_md), tier)
|
|
21712
21776
|
);
|
|
21713
21777
|
} else {
|
|
21714
|
-
|
|
21715
|
-
|
|
21716
|
-
|
|
21778
|
+
fs24.symlinkSync(
|
|
21779
|
+
path21.join("../../../.augment/skills", name, fname),
|
|
21780
|
+
path21.join(entry, fname)
|
|
21717
21781
|
);
|
|
21718
21782
|
}
|
|
21719
21783
|
}
|
|
@@ -21731,7 +21795,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
21731
21795
|
let package_type;
|
|
21732
21796
|
if (opts.package) {
|
|
21733
21797
|
package_root = resolvePath(opts.package);
|
|
21734
|
-
if (!pathExists(
|
|
21798
|
+
if (!pathExists(path21.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
21735
21799
|
fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
|
|
21736
21800
|
}
|
|
21737
21801
|
package_type = detect_package_type_for_project(project_root, package_root);
|
|
@@ -21875,9 +21939,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
21875
21939
|
function _resolvedArgv1() {
|
|
21876
21940
|
if (process3.argv[1] === void 0) return void 0;
|
|
21877
21941
|
try {
|
|
21878
|
-
return
|
|
21942
|
+
return fs24.realpathSync(path21.resolve(process3.argv[1]));
|
|
21879
21943
|
} catch {
|
|
21880
|
-
return
|
|
21944
|
+
return path21.resolve(process3.argv[1]);
|
|
21881
21945
|
}
|
|
21882
21946
|
}
|
|
21883
21947
|
var _argv1 = _resolvedArgv1();
|
|
@@ -21897,12 +21961,9 @@ export {
|
|
|
21897
21961
|
AIDER_MARKER,
|
|
21898
21962
|
ArgparseExit2 as ArgparseExit,
|
|
21899
21963
|
CLAUDE_DESKTOP_MARKER,
|
|
21900
|
-
CLINE_DISPATCHER_BINDINGS,
|
|
21901
21964
|
CODEX_MARKER,
|
|
21902
21965
|
CONTINUE_MARKER,
|
|
21903
|
-
CURSOR_DISPATCHER_BINDINGS,
|
|
21904
21966
|
DEFAULT_PROFILE,
|
|
21905
|
-
GEMINI_DISPATCHER_BINDINGS,
|
|
21906
21967
|
GLOBAL_AGENT_SETTINGS_PATH,
|
|
21907
21968
|
GLOBAL_USER_SETTINGS_PATH,
|
|
21908
21969
|
JETBRAINS_MARKER,
|
|
@@ -21915,7 +21976,6 @@ export {
|
|
|
21915
21976
|
SUPPORTED_PROFILES,
|
|
21916
21977
|
SystemExitError,
|
|
21917
21978
|
USER_SCOPE_PATHS,
|
|
21918
|
-
WINDSURF_DISPATCHER_BINDINGS,
|
|
21919
21979
|
ZED_MARKER,
|
|
21920
21980
|
_VALID_TOOLS,
|
|
21921
21981
|
_append_unknown_legacy,
|
|
@@ -21980,5 +22040,6 @@ export {
|
|
|
21980
22040
|
jsonDumpsIndent,
|
|
21981
22041
|
main2 as main,
|
|
21982
22042
|
parse_options,
|
|
22043
|
+
smokeProbeEvents,
|
|
21983
22044
|
state
|
|
21984
22045
|
};
|