@event4u/agent-config 9.11.0 → 9.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +80 -204
- package/README.md +8 -1
- package/dist/agent-src/commands/fix/ci.md +29 -0
- package/dist/agent-src/commands/pr/create.md +60 -0
- package/dist/agent-src/contexts/authority/kernel-rule-edits.md +18 -2
- package/dist/agent-src/rules/active-remediation.md +0 -2
- package/dist/agent-src/rules/architecture.md +0 -1
- package/dist/agent-src/rules/artifact-drafting-protocol.md +0 -4
- package/dist/agent-src/rules/autonomous-execution.md +1 -2
- package/dist/agent-src/rules/broken-access-control.md +0 -2
- package/dist/agent-src/rules/code-comment-discipline.md +0 -3
- package/dist/agent-src/rules/code-provenance.md +0 -3
- package/dist/agent-src/rules/communication-through-line.md +2 -3
- package/dist/agent-src/rules/content-quoting-floor.md +0 -2
- package/dist/agent-src/rules/context-hygiene.md +1 -3
- package/dist/agent-src/rules/decision-revisit-gate.md +0 -2
- package/dist/agent-src/rules/design-fidelity.md +30 -1
- package/dist/agent-src/rules/domain-adoption-policy.md +0 -3
- package/dist/agent-src/rules/downstream-changes.md +10 -1
- package/dist/agent-src/rules/external-reference-deep-dive.md +0 -7
- package/dist/agent-src/rules/fast-path-marker-visibility.md +0 -1
- package/dist/agent-src/rules/git-history-discipline.md +0 -7
- package/dist/agent-src/rules/guidelines.md +0 -2
- package/dist/agent-src/rules/improve-before-implement.md +4 -2
- package/dist/agent-src/rules/invite-challenge.md +0 -4
- package/dist/agent-src/rules/linked-projects-onboarding-gate.md +0 -2
- package/dist/agent-src/rules/markdown-safe-codeblocks.md +0 -1
- package/dist/agent-src/rules/minimal-safe-diff.md +2 -2
- package/dist/agent-src/rules/missing-tool-handling.md +0 -1
- package/dist/agent-src/rules/no-attribution-footers.md +0 -3
- package/dist/agent-src/rules/no-decorative-emojis-in-git-surfaces.md +8 -5
- package/dist/agent-src/rules/no-pr-progress-comments.md +1 -3
- package/dist/agent-src/rules/no-roadmap-references.md +0 -2
- package/dist/agent-src/rules/output-discipline.md +0 -1
- package/dist/agent-src/rules/prefer-enums-over-literals.md +0 -2
- package/dist/agent-src/rules/preservation-guard.md +0 -3
- package/dist/agent-src/rules/role-mode-adherence.md +0 -1
- package/dist/agent-src/rules/secret-vcs-guard.md +0 -2
- package/dist/agent-src/rules/senior-engineering-discipline.md +0 -2
- package/dist/agent-src/rules/session-canary.md +0 -2
- package/dist/agent-src/rules/size-enforcement.md +0 -5
- package/dist/agent-src/rules/source-confidentiality.md +0 -3
- package/dist/agent-src/rules/source-discovery-gate.md +0 -2
- package/dist/agent-src/rules/think-before-action.md +3 -3
- package/dist/agent-src/rules/token-budget-discipline.md +0 -1
- package/dist/agent-src/rules/token-efficiency.md +1 -2
- package/dist/agent-src/rules/tool-safety.md +0 -1
- package/dist/agent-src/rules/user-interaction.md +0 -3
- package/dist/agent-src/rules/user-interrupt-priority.md +0 -1
- package/dist/agent-src/skills/agent-docs-writing/SKILL.md +8 -0
- package/dist/agent-src/skills/ai-code-blindspots/SKILL.md +1 -0
- package/dist/agent-src/skills/analysis-skill-router/SKILL.md +55 -86
- package/dist/agent-src/skills/character-consistency/SKILL.md +7 -4
- package/dist/agent-src/skills/decision-record/SKILL.md +8 -0
- package/dist/agent-src/skills/design-intelligence/SKILL.md +27 -1
- package/dist/agent-src/skills/design-intelligence/data/font-pairings-reference.csv +74 -74
- package/dist/agent-src/skills/design-intelligence/data/manifest.json +2 -0
- package/dist/agent-src/skills/design-review/SKILL.md +11 -0
- package/dist/agent-src/skills/design-system-capture/reference/design-system-json.md +8 -0
- package/dist/agent-src/skills/design-tokens/scripts/tokens.ts +0 -7
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +34 -3
- package/dist/agent-src/skills/fe-design/SKILL.md +10 -0
- package/dist/agent-src/skills/motion-choreographer/SKILL.md +7 -4
- package/dist/agent-src/skills/overbuild-review-lens/SKILL.md +201 -0
- package/dist/agent-src/skills/performance/SKILL.md +14 -0
- package/dist/agent-src/skills/pixar-storyteller/SKILL.md +8 -5
- package/dist/agent-src/skills/scene-expander/SKILL.md +9 -6
- package/dist/agent-src/skills/supply-chain-intake/SKILL.md +10 -0
- package/dist/agent-src/skills/typography-system/SKILL.md +55 -11
- package/dist/agent-src/skills/ui-apply-generic/SKILL.md +180 -0
- package/dist/agent-src/skills/universal-project-analysis/SKILL.md +14 -37
- package/dist/agent-src/skills/video-director/SKILL.md +9 -6
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +162 -17
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/design.ts +118 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +49 -6
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/review.ts +9 -5
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +182 -29
- package/dist/agent-src/templates/scripts/work_engine/stack/detect.ts +311 -24
- package/dist/agent-src/templates/scripts/work_engine/state.ts +55 -0
- package/dist/cli-delegate/chunk-523HCFYO.js +90 -0
- package/dist/cli-delegate/{chunk-IR7P7JWA.js → chunk-A3HJ6NTI.js} +271 -59
- package/dist/cli-delegate/chunk-EJYIGZ3T.js +125 -0
- package/dist/cli-delegate/{chunk-RDGRHAAB.js → chunk-HYWSRNUX.js} +6 -86
- package/dist/cli-delegate/{chunk-YMFO6FDN.js → chunk-QFKQLQ7X.js} +313 -81
- package/dist/cli-delegate/{chunk-4SV3XGFA.js → chunk-TEGJU2JX.js} +7 -9
- package/dist/cli-delegate/chunk-TJIAM5FW.js +133 -0
- package/dist/cli-delegate/cmd_conformance.js +4 -7
- package/dist/cli-delegate/cmd_doctor.js +3 -5
- package/dist/cli-delegate/cmd_explain.js +153 -85
- package/dist/cli-delegate/cmd_export.js +5 -3
- package/dist/cli-delegate/cmd_fleet.js +2 -1
- package/dist/cli-delegate/cmd_preflight.js +6 -123
- package/dist/cli-delegate/cmd_prune.js +5 -3
- package/dist/cli-delegate/cmd_settings_migrate.js +5 -3
- package/dist/cli-delegate/cmd_sync.js +5 -3
- package/dist/cli-delegate/cmd_uninstall.js +6 -5
- package/dist/cli-delegate/cmd_validate.js +5 -3
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +116 -72
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +3 -3
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +7 -5
- package/dist/discovery/trust-report.md +2 -2
- package/dist/discovery/workspaces.json +6 -4
- package/dist/hooks/dispatch.js +174 -13
- package/dist/install/install.mjs +605 -412
- package/dist/install/ruleInScope.js +123 -0
- package/dist/install/ruleInScope.js.map +1 -0
- package/dist/install/rule_scope.js +2 -2
- package/dist/install/rule_scope.js.map +1 -1
- package/dist/install/wizard-plan.js +10 -1
- package/dist/install/wizard-plan.js.map +1 -1
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +710 -2491
- package/dist/router.json +1 -1
- package/dist/scripts/condense.js +8 -24
- package/dist/scripts/condense.js.map +1 -1
- package/docs/MIGRATION.md +1 -1
- package/docs/guidelines/agent-infra/agent-interaction-and-decision-quality.md +71 -0
- package/docs/guidelines/agent-infra/minimal-safe-diff-mechanics.md +24 -1
- package/docs/guidelines/code-clarity.md +9 -2
- package/docs/guidelines/design-fidelity-mechanics.md +58 -0
- package/llms.txt +63 -27
- package/package.json +4 -4
- package/src/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +162 -17
- package/src/agent-src/templates/scripts/work_engine/directives/ui/design.ts +118 -0
- package/src/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +49 -6
- package/src/agent-src/templates/scripts/work_engine/directives/ui/review.ts +9 -5
- package/src/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +182 -29
- package/src/agent-src/templates/scripts/work_engine/stack/detect.ts +311 -24
- package/src/agent-src/templates/scripts/work_engine/state.ts +55 -0
- package/src/config/agent-settings.template.yml +8 -0
- package/src/install/ruleInScope.ts +133 -0
- package/src/install/rule_scope.ts +2 -2
- package/src/install/wizard-plan.ts +11 -1
- package/src/scripts/_lib/counted_probe.ts +142 -0
- package/src/scripts/_lib/global_deploy_inventory.ts +38 -2
- package/src/scripts/_lib/overbuild_lens_contract.ts +196 -0
- package/src/scripts/_lib/release_scope.ts +207 -0
- package/src/scripts/ai_council/stance_tally.ts +37 -2
- package/src/scripts/audit_auto_rules.ts +9 -9
- package/src/scripts/audit_likelihood.ts +3 -3
- package/src/scripts/audit_overlap.ts +2 -2
- package/src/scripts/audit_skill_overlap.ts +233 -95
- package/src/scripts/audit_skill_overlap_allowlist.json +4 -0
- package/src/scripts/build_proof.ts +15 -1
- package/src/scripts/check_dependency_floors.ts +16 -6
- package/src/scripts/check_gate_coverage.ts +6 -6
- package/src/scripts/check_installer_import_purity.ts +295 -0
- package/src/scripts/check_kernel_rule_bundle.ts +5 -4
- package/src/scripts/check_token_quality_golden.ts +0 -18
- package/src/scripts/code_graph/loader.ts +35 -6
- package/src/scripts/compile_router.ts +3 -8
- package/src/scripts/condense.ts +9 -30
- package/src/scripts/explain_run.ts +0 -1
- package/src/scripts/generate_pack_manifests.ts +3 -20
- package/src/scripts/hooks/block_kernel_rule_writes.ts +145 -10
- package/src/scripts/hooks/block_no_verify.ts +101 -0
- package/src/scripts/install-hooks.sh +36 -4
- package/src/scripts/install.ts +210 -5
- package/src/scripts/lint_agent_security.ts +5 -4
- package/src/scripts/lint_framework_leakage_allowlist.json +2 -2
- package/src/scripts/lint_regression.ts +92 -1
- package/src/scripts/lint_skill_descriptions.ts +93 -5
- package/src/scripts/lint_ui_stack_bundles.ts +31 -0
- package/src/scripts/project_thin_rules.ts +2 -2
- package/src/scripts/release.ts +107 -3
- package/src/scripts/resolve_lint_scope.ts +53 -0
- package/src/scripts/router_telemetry.ts +0 -5
- package/src/scripts/runtime_dispatcher.ts +40 -0
- package/src/scripts/schemas/pack.schema.json +1 -5
- package/src/scripts/schemas/rule.schema.json +1 -2
- package/src/scripts/self_review_gate.ts +15 -73
- package/src/scripts/skill_linter.ts +93 -11
- package/src/scripts/sweep_dead_scan_roots.ts +550 -0
- package/src/scripts/trigger_coverage.ts +11 -37
- package/dist/cli-delegate/chunk-7DSAMZFU.js +0 -356
- package/dist/cli-delegate/chunk-BJGXZNPM.js +0 -266
- package/dist/cli-delegate/chunk-TFG57JJM.js +0 -1969
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, path15) {
|
|
121
|
+
const ctrl = callVisitor(key, node, visitor, path15);
|
|
122
122
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
123
|
-
replaceNode(key,
|
|
124
|
-
return visit_(key, ctrl, visitor,
|
|
123
|
+
replaceNode(key, path15, ctrl);
|
|
124
|
+
return visit_(key, ctrl, visitor, path15);
|
|
125
125
|
}
|
|
126
126
|
if (typeof ctrl !== "symbol") {
|
|
127
127
|
if (identity.isCollection(node)) {
|
|
128
|
-
|
|
128
|
+
path15 = Object.freeze(path15.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, path15);
|
|
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
|
+
path15 = Object.freeze(path15.concat(node));
|
|
142
|
+
const ck = visit_("key", node.key, visitor, path15);
|
|
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, path15);
|
|
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, path15) {
|
|
169
|
+
const ctrl = await callVisitor(key, node, visitor, path15);
|
|
170
170
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
171
|
-
replaceNode(key,
|
|
172
|
-
return visitAsync_(key, ctrl, visitor,
|
|
171
|
+
replaceNode(key, path15, ctrl);
|
|
172
|
+
return visitAsync_(key, ctrl, visitor, path15);
|
|
173
173
|
}
|
|
174
174
|
if (typeof ctrl !== "symbol") {
|
|
175
175
|
if (identity.isCollection(node)) {
|
|
176
|
-
|
|
176
|
+
path15 = Object.freeze(path15.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, path15);
|
|
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
|
+
path15 = Object.freeze(path15.concat(node));
|
|
190
|
+
const ck = await visitAsync_("key", node.key, visitor, path15);
|
|
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, path15);
|
|
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, path15) {
|
|
223
223
|
if (typeof visitor === "function")
|
|
224
|
-
return visitor(key, node,
|
|
224
|
+
return visitor(key, node, path15);
|
|
225
225
|
if (identity.isMap(node))
|
|
226
|
-
return visitor.Map?.(key, node,
|
|
226
|
+
return visitor.Map?.(key, node, path15);
|
|
227
227
|
if (identity.isSeq(node))
|
|
228
|
-
return visitor.Seq?.(key, node,
|
|
228
|
+
return visitor.Seq?.(key, node, path15);
|
|
229
229
|
if (identity.isPair(node))
|
|
230
|
-
return visitor.Pair?.(key, node,
|
|
230
|
+
return visitor.Pair?.(key, node, path15);
|
|
231
231
|
if (identity.isScalar(node))
|
|
232
|
-
return visitor.Scalar?.(key, node,
|
|
232
|
+
return visitor.Scalar?.(key, node, path15);
|
|
233
233
|
if (identity.isAlias(node))
|
|
234
|
-
return visitor.Alias?.(key, node,
|
|
234
|
+
return visitor.Alias?.(key, node, path15);
|
|
235
235
|
return void 0;
|
|
236
236
|
}
|
|
237
|
-
function replaceNode(key,
|
|
238
|
-
const parent =
|
|
237
|
+
function replaceNode(key, path15, node) {
|
|
238
|
+
const parent = path15[path15.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, path15, value) {
|
|
849
849
|
let v = value;
|
|
850
|
-
for (let i =
|
|
851
|
-
const k =
|
|
850
|
+
for (let i = path15.length - 1; i >= 0; --i) {
|
|
851
|
+
const k = path15[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 = (path15) => path15 == null || typeof path15 === "object" && !!path15[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(path15, value) {
|
|
901
|
+
if (isEmptyPath(path15))
|
|
902
902
|
this.add(value);
|
|
903
903
|
else {
|
|
904
|
-
const [key, ...rest] =
|
|
904
|
+
const [key, ...rest] = path15;
|
|
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(path15) {
|
|
919
|
+
const [key, ...rest] = path15;
|
|
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(path15, keepScalar) {
|
|
934
|
+
const [key, ...rest] = path15;
|
|
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(path15) {
|
|
953
|
+
const [key, ...rest] = path15;
|
|
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(path15, value) {
|
|
964
|
+
const [key, ...rest] = path15;
|
|
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(path15, value) {
|
|
3480
3480
|
if (assertCollection(this.contents))
|
|
3481
|
-
this.contents.addIn(
|
|
3481
|
+
this.contents.addIn(path15, 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(path15) {
|
|
3557
|
+
if (Collection.isEmptyPath(path15)) {
|
|
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(path15) : 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(path15, keepScalar) {
|
|
3579
|
+
if (Collection.isEmptyPath(path15))
|
|
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(path15, 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(path15) {
|
|
3593
|
+
if (Collection.isEmptyPath(path15))
|
|
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(path15) : 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(path15, value) {
|
|
3613
|
+
if (Collection.isEmptyPath(path15)) {
|
|
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(path15), value);
|
|
3617
3617
|
} else if (assertCollection(this.contents)) {
|
|
3618
|
-
this.contents.setIn(
|
|
3618
|
+
this.contents.setIn(path15, 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, path15) => {
|
|
5579
5579
|
let item = cst;
|
|
5580
|
-
for (const [field, index] of
|
|
5580
|
+
for (const [field, index] of path15) {
|
|
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, path15) => {
|
|
5590
|
+
const parent = visit.itemAtPath(cst, path15.slice(0, -1));
|
|
5591
|
+
const field = path15[path15.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(path15, item, visitor) {
|
|
5598
|
+
let ctrl = visitor(item, path15);
|
|
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(path15.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, path15);
|
|
5617
5617
|
}
|
|
5618
5618
|
}
|
|
5619
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5619
|
+
return typeof ctrl === "function" ? ctrl(item, path15) : 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 fs17 = this.flowScalar(this.type);
|
|
6922
6922
|
if (atNextItem || it.value) {
|
|
6923
|
-
map.items.push({ start, key:
|
|
6923
|
+
map.items.push({ start, key: fs17, sep: [] });
|
|
6924
6924
|
this.onKeyLine = true;
|
|
6925
6925
|
} else if (it.sep) {
|
|
6926
|
-
this.stack.push(
|
|
6926
|
+
this.stack.push(fs17);
|
|
6927
6927
|
} else {
|
|
6928
|
-
Object.assign(it, { key:
|
|
6928
|
+
Object.assign(it, { key: fs17, 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 fs17 = this.flowScalar(this.type);
|
|
7057
7057
|
if (!it || it.value)
|
|
7058
|
-
fc.items.push({ start: [], key:
|
|
7058
|
+
fc.items.push({ start: [], key: fs17, sep: [] });
|
|
7059
7059
|
else if (it.sep)
|
|
7060
|
-
this.stack.push(
|
|
7060
|
+
this.stack.push(fs17);
|
|
7061
7061
|
else
|
|
7062
|
-
Object.assign(it, { key:
|
|
7062
|
+
Object.assign(it, { key: fs17, sep: [] });
|
|
7063
7063
|
return;
|
|
7064
7064
|
}
|
|
7065
7065
|
case "flow-map-end":
|
|
@@ -7267,7 +7267,7 @@ var require_public_api = __commonJS({
|
|
|
7267
7267
|
}
|
|
7268
7268
|
return doc;
|
|
7269
7269
|
}
|
|
7270
|
-
function
|
|
7270
|
+
function parse3(src, reviver, options) {
|
|
7271
7271
|
let _reviver = void 0;
|
|
7272
7272
|
if (typeof reviver === "function") {
|
|
7273
7273
|
_reviver = reviver;
|
|
@@ -7308,7 +7308,7 @@ var require_public_api = __commonJS({
|
|
|
7308
7308
|
return value.toString(options);
|
|
7309
7309
|
return new Document.Document(value, _replacer, options).toString(options);
|
|
7310
7310
|
}
|
|
7311
|
-
exports.parse =
|
|
7311
|
+
exports.parse = parse3;
|
|
7312
7312
|
exports.parseAllDocuments = parseAllDocuments;
|
|
7313
7313
|
exports.parseDocument = parseDocument;
|
|
7314
7314
|
exports.stringify = stringify;
|
|
@@ -7370,9 +7370,9 @@ var require_dist = __commonJS({
|
|
|
7370
7370
|
// src/scripts/install.ts
|
|
7371
7371
|
import { spawn, spawnSync as spawnSync2 } from "node:child_process";
|
|
7372
7372
|
import * as crypto3 from "node:crypto";
|
|
7373
|
-
import * as
|
|
7373
|
+
import * as fs16 from "node:fs";
|
|
7374
7374
|
import * as os7 from "node:os";
|
|
7375
|
-
import * as
|
|
7375
|
+
import * as path14 from "node:path";
|
|
7376
7376
|
import process3 from "node:process";
|
|
7377
7377
|
import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
7378
7378
|
|
|
@@ -7872,8 +7872,8 @@ function lockfile_write_path(env) {
|
|
|
7872
7872
|
}
|
|
7873
7873
|
return write_target("installed.lock", { env: env ?? null });
|
|
7874
7874
|
}
|
|
7875
|
-
function read_lockfile(
|
|
7876
|
-
const target =
|
|
7875
|
+
function read_lockfile(path15) {
|
|
7876
|
+
const target = path15 ?? lockfile_path();
|
|
7877
7877
|
let text;
|
|
7878
7878
|
try {
|
|
7879
7879
|
text = fs2.readFileSync(target, { encoding: "utf-8" });
|
|
@@ -8116,8 +8116,8 @@ function load_lab_pack_ids(repo_root) {
|
|
|
8116
8116
|
const vocab = path3.join(repo_root, "src", "config", "discovery", "packs.yml");
|
|
8117
8117
|
const ids = /* @__PURE__ */ new Set();
|
|
8118
8118
|
try {
|
|
8119
|
-
const
|
|
8120
|
-
const data =
|
|
8119
|
+
const YAML3 = require_dist();
|
|
8120
|
+
const data = YAML3.parse(fs3.readFileSync(vocab, "utf-8"), { version: "1.1" });
|
|
8121
8121
|
for (const entry of data ?? []) {
|
|
8122
8122
|
if (entry && typeof entry === "object" && !Array.isArray(entry)) {
|
|
8123
8123
|
const rec = entry;
|
|
@@ -8350,7 +8350,7 @@ function json_string_ascii(s) {
|
|
|
8350
8350
|
}
|
|
8351
8351
|
return out;
|
|
8352
8352
|
}
|
|
8353
|
-
function expected_deploy_files(src, dest_rel) {
|
|
8353
|
+
function expected_deploy_files(src, dest_rel, file_filter = null) {
|
|
8354
8354
|
const out = /* @__PURE__ */ new Set();
|
|
8355
8355
|
let src_stat;
|
|
8356
8356
|
try {
|
|
@@ -8359,6 +8359,9 @@ function expected_deploy_files(src, dest_rel) {
|
|
|
8359
8359
|
return out;
|
|
8360
8360
|
}
|
|
8361
8361
|
if (!src_stat.isDirectory()) {
|
|
8362
|
+
if (file_filter !== null && !file_filter(src)) {
|
|
8363
|
+
return out;
|
|
8364
|
+
}
|
|
8362
8365
|
out.add(as_posix(dest_rel));
|
|
8363
8366
|
return out;
|
|
8364
8367
|
}
|
|
@@ -8382,6 +8385,9 @@ function expected_deploy_files(src, dest_rel) {
|
|
|
8382
8385
|
_walk(fs4.realpathSync(entry), rel);
|
|
8383
8386
|
continue;
|
|
8384
8387
|
}
|
|
8388
|
+
if (file_filter !== null && !file_filter(entry)) {
|
|
8389
|
+
continue;
|
|
8390
|
+
}
|
|
8385
8391
|
out.add(as_posix(rel));
|
|
8386
8392
|
}
|
|
8387
8393
|
};
|
|
@@ -8741,18 +8747,18 @@ function manifest_path(project_root, env) {
|
|
|
8741
8747
|
var _TOP_KEY_RE = /^([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
|
|
8742
8748
|
var _LIST_DASH_RE = /^\s*-\s*(.+?)\s*$/;
|
|
8743
8749
|
var _INDENT_KEY_RE = /^\s+([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
|
|
8744
|
-
function read_manifest(
|
|
8750
|
+
function read_manifest(path15) {
|
|
8745
8751
|
let text;
|
|
8746
8752
|
try {
|
|
8747
|
-
text = require_read_text(
|
|
8753
|
+
text = require_read_text(path15);
|
|
8748
8754
|
} catch {
|
|
8749
8755
|
return null;
|
|
8750
8756
|
}
|
|
8751
8757
|
const data = _parse_manual(text);
|
|
8752
8758
|
return _normalise_v2_shape(data);
|
|
8753
8759
|
}
|
|
8754
|
-
function require_read_text(
|
|
8755
|
-
return fs6.readFileSync(
|
|
8760
|
+
function require_read_text(path15) {
|
|
8761
|
+
return fs6.readFileSync(path15, { encoding: "utf-8" });
|
|
8756
8762
|
}
|
|
8757
8763
|
function _normalise_v2_shape(data) {
|
|
8758
8764
|
if (data["tools"] === void 0 || data["tools"] === null) {
|
|
@@ -8933,9 +8939,9 @@ function stable_sort(items, key) {
|
|
|
8933
8939
|
return a.index - b.index;
|
|
8934
8940
|
}).map((entry) => entry.item);
|
|
8935
8941
|
}
|
|
8936
|
-
function write_manifest(
|
|
8942
|
+
function write_manifest(path15, version, tools, options = {}) {
|
|
8937
8943
|
const rendered = _render2(version, tools, { deploy_roots: options.deploy_roots ?? null });
|
|
8938
|
-
return write_atomic(
|
|
8944
|
+
return write_atomic(path15, rendered);
|
|
8939
8945
|
}
|
|
8940
8946
|
var ScopeMismatchError = class extends Error {
|
|
8941
8947
|
name_;
|
|
@@ -9882,16 +9888,16 @@ function _read_yaml(p) {
|
|
|
9882
9888
|
if (!_is_file(p)) {
|
|
9883
9889
|
return null;
|
|
9884
9890
|
}
|
|
9885
|
-
let
|
|
9891
|
+
let YAML3;
|
|
9886
9892
|
try {
|
|
9887
|
-
|
|
9893
|
+
YAML3 = _require("yaml");
|
|
9888
9894
|
} catch {
|
|
9889
9895
|
return null;
|
|
9890
9896
|
}
|
|
9891
9897
|
let data;
|
|
9892
9898
|
try {
|
|
9893
9899
|
const text = fs10.readFileSync(p, "utf-8");
|
|
9894
|
-
data =
|
|
9900
|
+
data = YAML3.parse(text, { version: "1.1" });
|
|
9895
9901
|
if (data === null || data === void 0) {
|
|
9896
9902
|
data = {};
|
|
9897
9903
|
}
|
|
@@ -9981,6 +9987,101 @@ function _is_plain_dict(value) {
|
|
|
9981
9987
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9982
9988
|
}
|
|
9983
9989
|
|
|
9990
|
+
// src/install/rule_scope.ts
|
|
9991
|
+
import * as path10 from "node:path";
|
|
9992
|
+
|
|
9993
|
+
// src/install/ruleInScope.ts
|
|
9994
|
+
var YAML2 = __toESM(require_dist(), 1);
|
|
9995
|
+
import * as fs11 from "node:fs";
|
|
9996
|
+
function parseYaml2(text) {
|
|
9997
|
+
try {
|
|
9998
|
+
const data = YAML2.parse(text, { version: "1.1" });
|
|
9999
|
+
return data === void 0 ? null : data;
|
|
10000
|
+
} catch {
|
|
10001
|
+
return null;
|
|
10002
|
+
}
|
|
10003
|
+
}
|
|
10004
|
+
function strip(s) {
|
|
10005
|
+
return s.replace(/^\s+/u, "").replace(/\s+$/u, "");
|
|
10006
|
+
}
|
|
10007
|
+
function lstripNewlines(s) {
|
|
10008
|
+
return s.replace(/^\n+/, "");
|
|
10009
|
+
}
|
|
10010
|
+
function parseFrontmatter(content) {
|
|
10011
|
+
if (!content.startsWith("---")) {
|
|
10012
|
+
return [{}, content];
|
|
10013
|
+
}
|
|
10014
|
+
const end = content.indexOf("\n---", 3);
|
|
10015
|
+
if (end === -1) {
|
|
10016
|
+
return [{}, content];
|
|
10017
|
+
}
|
|
10018
|
+
const raw = strip(content.slice(3, end));
|
|
10019
|
+
const body = lstripNewlines(content.slice(end + 4));
|
|
10020
|
+
let meta = parseYaml2(raw);
|
|
10021
|
+
if (meta === null || meta === void 0) {
|
|
10022
|
+
meta = {};
|
|
10023
|
+
}
|
|
10024
|
+
if (typeof meta === "object" && meta !== null && !Array.isArray(meta)) {
|
|
10025
|
+
return [meta, body];
|
|
10026
|
+
}
|
|
10027
|
+
return [{}, body];
|
|
10028
|
+
}
|
|
10029
|
+
function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null) {
|
|
10030
|
+
if (scope === null && pack_scope === null && role_scope === null) {
|
|
10031
|
+
return true;
|
|
10032
|
+
}
|
|
10033
|
+
const [meta] = parseFrontmatter(fs11.readFileSync(source_path, "utf-8"));
|
|
10034
|
+
if (meta["type"] === "always" || meta["alwaysApply"] === true) {
|
|
10035
|
+
return true;
|
|
10036
|
+
}
|
|
10037
|
+
const axis = (key, configured) => {
|
|
10038
|
+
if (configured === null) {
|
|
10039
|
+
return true;
|
|
10040
|
+
}
|
|
10041
|
+
const values = Array.isArray(meta[key]) ? meta[key].map((w) => String(w)) : [];
|
|
10042
|
+
if (values.length === 0) {
|
|
10043
|
+
return true;
|
|
10044
|
+
}
|
|
10045
|
+
return values.some((v) => configured.includes(v));
|
|
10046
|
+
};
|
|
10047
|
+
return axis("workspaces", scope) && axis("packs", pack_scope) && axis("roles", role_scope);
|
|
10048
|
+
}
|
|
10049
|
+
|
|
10050
|
+
// src/install/rule_scope.ts
|
|
10051
|
+
var COMPAT_ALWAYS_EXCLUDED = ["source-of-truth.md"];
|
|
10052
|
+
var LEGACY_ALL = { workspaces: null, packs: null };
|
|
10053
|
+
function _list(value) {
|
|
10054
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
10055
|
+
return value.map((v) => String(v));
|
|
10056
|
+
}
|
|
10057
|
+
return null;
|
|
10058
|
+
}
|
|
10059
|
+
function ruleScopeFromSettings(settings) {
|
|
10060
|
+
const proj = settings["projection"];
|
|
10061
|
+
if (typeof proj !== "object" || proj === null || Array.isArray(proj)) {
|
|
10062
|
+
return LEGACY_ALL;
|
|
10063
|
+
}
|
|
10064
|
+
const p = proj;
|
|
10065
|
+
return {
|
|
10066
|
+
workspaces: _list(p["rule_workspaces"]),
|
|
10067
|
+
packs: _list(p["rule_packs"]),
|
|
10068
|
+
roles: _list(p["rule_roles"])
|
|
10069
|
+
};
|
|
10070
|
+
}
|
|
10071
|
+
function ruleFileArrives(sourcePath, scope) {
|
|
10072
|
+
if (!sourcePath.endsWith(".md")) {
|
|
10073
|
+
return true;
|
|
10074
|
+
}
|
|
10075
|
+
const basename5 = path10.basename(sourcePath);
|
|
10076
|
+
if (COMPAT_ALWAYS_EXCLUDED.includes(basename5)) {
|
|
10077
|
+
return false;
|
|
10078
|
+
}
|
|
10079
|
+
return rule_in_scope(sourcePath, scope.workspaces, scope.packs, scope.roles ?? null);
|
|
10080
|
+
}
|
|
10081
|
+
|
|
10082
|
+
// src/install/wizard-plan.ts
|
|
10083
|
+
var RULE_SOURCE_REL = "dist/agent-src/rules";
|
|
10084
|
+
|
|
9984
10085
|
// src/shared/settingsSurface.ts
|
|
9985
10086
|
function unwrapRef(root) {
|
|
9986
10087
|
if (root.$ref !== void 0 && root.definitions !== void 0) {
|
|
@@ -10529,8 +10630,8 @@ function getErrorMap() {
|
|
|
10529
10630
|
|
|
10530
10631
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
10531
10632
|
var makeIssue = (params) => {
|
|
10532
|
-
const { data, path:
|
|
10533
|
-
const fullPath = [...
|
|
10633
|
+
const { data, path: path15, errorMaps, issueData } = params;
|
|
10634
|
+
const fullPath = [...path15, ...issueData.path || []];
|
|
10534
10635
|
const fullIssue = {
|
|
10535
10636
|
...issueData,
|
|
10536
10637
|
path: fullPath
|
|
@@ -10646,11 +10747,11 @@ var errorUtil;
|
|
|
10646
10747
|
|
|
10647
10748
|
// node_modules/zod/v3/types.js
|
|
10648
10749
|
var ParseInputLazyPath = class {
|
|
10649
|
-
constructor(parent, value,
|
|
10750
|
+
constructor(parent, value, path15, key) {
|
|
10650
10751
|
this._cachedPath = [];
|
|
10651
10752
|
this.parent = parent;
|
|
10652
10753
|
this.data = value;
|
|
10653
|
-
this._path =
|
|
10754
|
+
this._path = path15;
|
|
10654
10755
|
this._key = key;
|
|
10655
10756
|
}
|
|
10656
10757
|
get path() {
|
|
@@ -15880,8 +15981,8 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
15880
15981
|
};
|
|
15881
15982
|
|
|
15882
15983
|
// src/scripts/_lib/module_detection.ts
|
|
15883
|
-
import * as
|
|
15884
|
-
import * as
|
|
15984
|
+
import * as fs12 from "node:fs";
|
|
15985
|
+
import * as path11 from "node:path";
|
|
15885
15986
|
var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
|
|
15886
15987
|
var _RULES = [
|
|
15887
15988
|
["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
|
|
@@ -15895,14 +15996,14 @@ var _RULES = [
|
|
|
15895
15996
|
];
|
|
15896
15997
|
function _isDir(p) {
|
|
15897
15998
|
try {
|
|
15898
|
-
return
|
|
15999
|
+
return fs12.statSync(p).isDirectory();
|
|
15899
16000
|
} catch {
|
|
15900
16001
|
return false;
|
|
15901
16002
|
}
|
|
15902
16003
|
}
|
|
15903
16004
|
function _isFile(p) {
|
|
15904
16005
|
try {
|
|
15905
|
-
return
|
|
16006
|
+
return fs12.statSync(p).isFile();
|
|
15906
16007
|
} catch {
|
|
15907
16008
|
return false;
|
|
15908
16009
|
}
|
|
@@ -15916,13 +16017,13 @@ function _isUpperChar(ch) {
|
|
|
15916
16017
|
function _list_module_subdirs(root) {
|
|
15917
16018
|
let entries;
|
|
15918
16019
|
try {
|
|
15919
|
-
entries =
|
|
16020
|
+
entries = fs12.readdirSync(root).sort();
|
|
15920
16021
|
} catch {
|
|
15921
16022
|
return [];
|
|
15922
16023
|
}
|
|
15923
16024
|
const out = [];
|
|
15924
16025
|
for (const name of entries) {
|
|
15925
|
-
if (!_isDir(
|
|
16026
|
+
if (!_isDir(path11.join(root, name))) {
|
|
15926
16027
|
continue;
|
|
15927
16028
|
}
|
|
15928
16029
|
if (name.startsWith(".")) {
|
|
@@ -15944,11 +16045,11 @@ function _score_confidence(stack, root, subdirs) {
|
|
|
15944
16045
|
return capitalized.length > 0 ? "high" : "medium";
|
|
15945
16046
|
}
|
|
15946
16047
|
if (stack === "node-monorepo") {
|
|
15947
|
-
const withPkgJson = subdirs.filter((name) => _isFile(
|
|
16048
|
+
const withPkgJson = subdirs.filter((name) => _isFile(path11.join(root, name, "package.json")));
|
|
15948
16049
|
return withPkgJson.length > 0 ? "high" : "medium";
|
|
15949
16050
|
}
|
|
15950
16051
|
if (stack === "python-src") {
|
|
15951
|
-
const withInit = subdirs.filter((name) => _isFile(
|
|
16052
|
+
const withInit = subdirs.filter((name) => _isFile(path11.join(root, name, "__init__.py")));
|
|
15952
16053
|
return withInit.length > 0 ? "high" : "medium";
|
|
15953
16054
|
}
|
|
15954
16055
|
if (stack === "go-internal") {
|
|
@@ -15960,7 +16061,7 @@ function detect_module_roots(project_root) {
|
|
|
15960
16061
|
const high = [];
|
|
15961
16062
|
const medium = [];
|
|
15962
16063
|
for (const [rel_path, stack, namespace_template] of _RULES) {
|
|
15963
|
-
const abs_path =
|
|
16064
|
+
const abs_path = path11.join(project_root, rel_path);
|
|
15964
16065
|
if (!_isDir(abs_path)) {
|
|
15965
16066
|
continue;
|
|
15966
16067
|
}
|
|
@@ -15982,7 +16083,7 @@ function detect_module_roots(project_root) {
|
|
|
15982
16083
|
}
|
|
15983
16084
|
|
|
15984
16085
|
// src/scripts/_lib/model_tier.ts
|
|
15985
|
-
import
|
|
16086
|
+
import fs13 from "node:fs";
|
|
15986
16087
|
var TIER_TO_CLAUDE_MODEL = {
|
|
15987
16088
|
high: "opus",
|
|
15988
16089
|
medium: "sonnet",
|
|
@@ -15990,8 +16091,8 @@ var TIER_TO_CLAUDE_MODEL = {
|
|
|
15990
16091
|
};
|
|
15991
16092
|
var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
|
|
15992
16093
|
function read_model_tier(skill_md) {
|
|
15993
|
-
if (!
|
|
15994
|
-
const text =
|
|
16094
|
+
if (!fs13.existsSync(skill_md)) return null;
|
|
16095
|
+
const text = fs13.readFileSync(skill_md).toString("utf-8");
|
|
15995
16096
|
if (!text.startsWith("---\n")) return null;
|
|
15996
16097
|
const end = text.indexOf("\n---\n", 4);
|
|
15997
16098
|
if (end === -1) return null;
|
|
@@ -16008,39 +16109,39 @@ function render_native_model_md(text, tier) {
|
|
|
16008
16109
|
|
|
16009
16110
|
// src/scripts/_cli/cmd_migrate.ts
|
|
16010
16111
|
import { spawnSync } from "node:child_process";
|
|
16011
|
-
import * as
|
|
16012
|
-
import * as
|
|
16112
|
+
import * as fs15 from "node:fs";
|
|
16113
|
+
import * as path13 from "node:path";
|
|
16013
16114
|
import process2 from "node:process";
|
|
16014
16115
|
import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
|
|
16015
16116
|
|
|
16016
16117
|
// src/scripts/_lib/package_root.ts
|
|
16017
|
-
import * as
|
|
16018
|
-
import * as
|
|
16118
|
+
import * as fs14 from "node:fs";
|
|
16119
|
+
import * as path12 from "node:path";
|
|
16019
16120
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
16020
16121
|
var PACKAGE_NAME = "@event4u/agent-config";
|
|
16021
16122
|
var MAX_ASCENT = 16;
|
|
16022
16123
|
function resolvePackageRoot(fromUrlOrPath, legacyHops = 3) {
|
|
16023
16124
|
const start = fromUrlOrPath.startsWith("file:") ? fileURLToPath2(fromUrlOrPath) : fromUrlOrPath;
|
|
16024
|
-
const startDir =
|
|
16125
|
+
const startDir = path12.dirname(start);
|
|
16025
16126
|
let dir = startDir;
|
|
16026
16127
|
for (let i = 0; i < MAX_ASCENT; i++) {
|
|
16027
|
-
const manifest =
|
|
16028
|
-
if (
|
|
16128
|
+
const manifest = path12.join(dir, "package.json");
|
|
16129
|
+
if (fs14.existsSync(manifest)) {
|
|
16029
16130
|
try {
|
|
16030
|
-
const parsed = JSON.parse(
|
|
16131
|
+
const parsed = JSON.parse(fs14.readFileSync(manifest, "utf8"));
|
|
16031
16132
|
if (parsed.name === PACKAGE_NAME) {
|
|
16032
16133
|
return dir;
|
|
16033
16134
|
}
|
|
16034
16135
|
} catch {
|
|
16035
16136
|
}
|
|
16036
16137
|
}
|
|
16037
|
-
const parent =
|
|
16138
|
+
const parent = path12.dirname(dir);
|
|
16038
16139
|
if (parent === dir) {
|
|
16039
16140
|
break;
|
|
16040
16141
|
}
|
|
16041
16142
|
dir = parent;
|
|
16042
16143
|
}
|
|
16043
|
-
return
|
|
16144
|
+
return path12.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
|
|
16044
16145
|
}
|
|
16045
16146
|
|
|
16046
16147
|
// src/scripts/_cli/cmd_migrate.ts
|
|
@@ -16061,7 +16162,7 @@ var LEGACY_SETTINGS_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
|
16061
16162
|
var LEGACY_STATE_FILENAME = ".implement-ticket-state.json";
|
|
16062
16163
|
var LEGACY_STATE_V1_FILENAME = ".work-state.json";
|
|
16063
16164
|
var LEGACY_AGENT_CONFIG_SHELL = "agent-config";
|
|
16064
|
-
var _HERE_DIR =
|
|
16165
|
+
var _HERE_DIR = path13.dirname(fileURLToPath3(import.meta.url));
|
|
16065
16166
|
var ArgparseExit = class extends Error {
|
|
16066
16167
|
code;
|
|
16067
16168
|
constructor(code) {
|
|
@@ -16160,38 +16261,38 @@ function _jsonDumpsIndentAscii(value, indent) {
|
|
|
16160
16261
|
}
|
|
16161
16262
|
function _isFile2(p) {
|
|
16162
16263
|
try {
|
|
16163
|
-
return
|
|
16264
|
+
return fs15.statSync(p).isFile();
|
|
16164
16265
|
} catch {
|
|
16165
16266
|
return false;
|
|
16166
16267
|
}
|
|
16167
16268
|
}
|
|
16168
16269
|
function _isDir2(p) {
|
|
16169
16270
|
try {
|
|
16170
|
-
return
|
|
16271
|
+
return fs15.statSync(p).isDirectory();
|
|
16171
16272
|
} catch {
|
|
16172
16273
|
return false;
|
|
16173
16274
|
}
|
|
16174
16275
|
}
|
|
16175
16276
|
function _isSymlink(p) {
|
|
16176
16277
|
try {
|
|
16177
|
-
return
|
|
16278
|
+
return fs15.lstatSync(p).isSymbolicLink();
|
|
16178
16279
|
} catch {
|
|
16179
16280
|
return false;
|
|
16180
16281
|
}
|
|
16181
16282
|
}
|
|
16182
16283
|
function _exists2(p) {
|
|
16183
16284
|
try {
|
|
16184
|
-
|
|
16285
|
+
fs15.lstatSync(p);
|
|
16185
16286
|
return true;
|
|
16186
16287
|
} catch {
|
|
16187
16288
|
return false;
|
|
16188
16289
|
}
|
|
16189
16290
|
}
|
|
16190
16291
|
function _readText(p) {
|
|
16191
|
-
return
|
|
16292
|
+
return fs15.readFileSync(p, { encoding: "utf-8" });
|
|
16192
16293
|
}
|
|
16193
16294
|
function _writeText(p, text) {
|
|
16194
|
-
|
|
16295
|
+
fs15.writeFileSync(p, text, { encoding: "utf-8" });
|
|
16195
16296
|
}
|
|
16196
16297
|
function _jsonLoadFile(p) {
|
|
16197
16298
|
return JSON.parse(_readText(p));
|
|
@@ -16247,7 +16348,7 @@ function _classify_symlink(link) {
|
|
|
16247
16348
|
}
|
|
16248
16349
|
let target;
|
|
16249
16350
|
try {
|
|
16250
|
-
target =
|
|
16351
|
+
target = fs15.readlinkSync(link);
|
|
16251
16352
|
} catch {
|
|
16252
16353
|
return null;
|
|
16253
16354
|
}
|
|
@@ -16258,16 +16359,16 @@ function _classify_symlink(link) {
|
|
|
16258
16359
|
return "user";
|
|
16259
16360
|
}
|
|
16260
16361
|
function _detect_legacy_state(project) {
|
|
16261
|
-
return _isFile2(
|
|
16362
|
+
return _isFile2(path13.join(project, LEGACY_STATE_FILENAME));
|
|
16262
16363
|
}
|
|
16263
16364
|
function _detect_legacy_settings(project) {
|
|
16264
16365
|
const found = [];
|
|
16265
16366
|
for (const name of LEGACY_SETTINGS_FILES) {
|
|
16266
|
-
const flat =
|
|
16367
|
+
const flat = path13.join(project, name);
|
|
16267
16368
|
if (_isFile2(flat)) {
|
|
16268
16369
|
found.push(flat);
|
|
16269
16370
|
}
|
|
16270
|
-
const typed =
|
|
16371
|
+
const typed = path13.join(project, "settings", name);
|
|
16271
16372
|
if (_isFile2(typed)) {
|
|
16272
16373
|
found.push(typed);
|
|
16273
16374
|
}
|
|
@@ -16275,25 +16376,25 @@ function _detect_legacy_settings(project) {
|
|
|
16275
16376
|
return found;
|
|
16276
16377
|
}
|
|
16277
16378
|
function _detect_empty_shell(project) {
|
|
16278
|
-
const shell =
|
|
16379
|
+
const shell = path13.join(project, LEGACY_AGENT_CONFIG_SHELL);
|
|
16279
16380
|
if (!_isDir2(shell) || _isSymlink(shell)) {
|
|
16280
16381
|
return false;
|
|
16281
16382
|
}
|
|
16282
16383
|
try {
|
|
16283
|
-
return
|
|
16384
|
+
return fs15.readdirSync(shell).length === 0;
|
|
16284
16385
|
} catch {
|
|
16285
16386
|
return false;
|
|
16286
16387
|
}
|
|
16287
16388
|
}
|
|
16288
16389
|
function _detect_already_migrated(project) {
|
|
16289
|
-
if (_detect_npm(
|
|
16390
|
+
if (_detect_npm(path13.join(project, "package.json"))) {
|
|
16290
16391
|
return false;
|
|
16291
16392
|
}
|
|
16292
|
-
if (_detect_composer(
|
|
16393
|
+
if (_detect_composer(path13.join(project, "composer.json"))) {
|
|
16293
16394
|
return false;
|
|
16294
16395
|
}
|
|
16295
16396
|
for (const name of MANAGED_SYMLINKS) {
|
|
16296
|
-
if (_classify_symlink(
|
|
16397
|
+
if (_classify_symlink(path13.join(project, name)) === "legacy") {
|
|
16297
16398
|
return false;
|
|
16298
16399
|
}
|
|
16299
16400
|
}
|
|
@@ -16364,11 +16465,11 @@ function _purge_legacy_symlinks(project) {
|
|
|
16364
16465
|
const removed = [];
|
|
16365
16466
|
const preserved = [];
|
|
16366
16467
|
for (const name of MANAGED_SYMLINKS) {
|
|
16367
|
-
const link =
|
|
16468
|
+
const link = path13.join(project, name);
|
|
16368
16469
|
const kind = _classify_symlink(link);
|
|
16369
16470
|
if (kind === "legacy") {
|
|
16370
16471
|
try {
|
|
16371
|
-
|
|
16472
|
+
fs15.unlinkSync(link);
|
|
16372
16473
|
removed.push(name);
|
|
16373
16474
|
} catch {
|
|
16374
16475
|
preserved.push(name);
|
|
@@ -16380,14 +16481,14 @@ function _purge_legacy_symlinks(project) {
|
|
|
16380
16481
|
return [removed, preserved];
|
|
16381
16482
|
}
|
|
16382
16483
|
function _migrate_state_file(project) {
|
|
16383
|
-
const source =
|
|
16484
|
+
const source = path13.join(project, LEGACY_STATE_FILENAME);
|
|
16384
16485
|
if (!_isFile2(source)) {
|
|
16385
16486
|
return null;
|
|
16386
16487
|
}
|
|
16387
|
-
const target =
|
|
16488
|
+
const target = path13.join(project, LEGACY_STATE_V1_FILENAME);
|
|
16388
16489
|
if (_exists2(target)) {
|
|
16389
16490
|
try {
|
|
16390
|
-
|
|
16491
|
+
fs15.unlinkSync(source);
|
|
16391
16492
|
return `removed stale ${LEGACY_STATE_FILENAME} (v1 already present)`;
|
|
16392
16493
|
} catch {
|
|
16393
16494
|
return null;
|
|
@@ -16402,7 +16503,7 @@ function _migrate_state_file(project) {
|
|
|
16402
16503
|
}
|
|
16403
16504
|
function _load_state_migrator() {
|
|
16404
16505
|
const pkg_root = resolvePackageRoot(import.meta.url);
|
|
16405
|
-
const rel =
|
|
16506
|
+
const rel = path13.join(
|
|
16406
16507
|
"agent-src",
|
|
16407
16508
|
"templates",
|
|
16408
16509
|
"scripts",
|
|
@@ -16410,8 +16511,8 @@ function _load_state_migrator() {
|
|
|
16410
16511
|
"migration",
|
|
16411
16512
|
"v0_to_v1.ts"
|
|
16412
16513
|
);
|
|
16413
|
-
const driver = [
|
|
16414
|
-
(p) =>
|
|
16514
|
+
const driver = [path13.join(pkg_root, "dist", rel), path13.join(pkg_root, "src", rel)].find(
|
|
16515
|
+
(p) => fs15.existsSync(p)
|
|
16415
16516
|
) ?? null;
|
|
16416
16517
|
if (driver === null) {
|
|
16417
16518
|
return null;
|
|
@@ -16419,12 +16520,12 @@ function _load_state_migrator() {
|
|
|
16419
16520
|
const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
16420
16521
|
let tsxBin = null;
|
|
16421
16522
|
for (let dir = pkg_root; ; ) {
|
|
16422
|
-
const cand =
|
|
16423
|
-
if (
|
|
16523
|
+
const cand = path13.join(dir, "node_modules", ".bin", binName);
|
|
16524
|
+
if (fs15.existsSync(cand)) {
|
|
16424
16525
|
tsxBin = cand;
|
|
16425
16526
|
break;
|
|
16426
16527
|
}
|
|
16427
|
-
const parent =
|
|
16528
|
+
const parent = path13.dirname(dir);
|
|
16428
16529
|
if (parent === dir) break;
|
|
16429
16530
|
dir = parent;
|
|
16430
16531
|
}
|
|
@@ -16451,17 +16552,17 @@ function _delete_legacy_settings(project) {
|
|
|
16451
16552
|
const removed = [];
|
|
16452
16553
|
for (const p of _detect_legacy_settings(project)) {
|
|
16453
16554
|
try {
|
|
16454
|
-
|
|
16455
|
-
removed.push(
|
|
16555
|
+
fs15.unlinkSync(p);
|
|
16556
|
+
removed.push(path13.relative(project, p));
|
|
16456
16557
|
} catch {
|
|
16457
16558
|
continue;
|
|
16458
16559
|
}
|
|
16459
16560
|
}
|
|
16460
|
-
const settings_dir =
|
|
16561
|
+
const settings_dir = path13.join(project, "settings");
|
|
16461
16562
|
if (_isDir2(settings_dir) && !_isSymlink(settings_dir)) {
|
|
16462
16563
|
try {
|
|
16463
|
-
if (
|
|
16464
|
-
|
|
16564
|
+
if (fs15.readdirSync(settings_dir).length === 0) {
|
|
16565
|
+
fs15.rmdirSync(settings_dir);
|
|
16465
16566
|
removed.push("settings/");
|
|
16466
16567
|
}
|
|
16467
16568
|
} catch {
|
|
@@ -16470,12 +16571,12 @@ function _delete_legacy_settings(project) {
|
|
|
16470
16571
|
return removed;
|
|
16471
16572
|
}
|
|
16472
16573
|
function _remove_empty_shell(project) {
|
|
16473
|
-
const shell =
|
|
16574
|
+
const shell = path13.join(project, LEGACY_AGENT_CONFIG_SHELL);
|
|
16474
16575
|
if (!_detect_empty_shell(project)) {
|
|
16475
16576
|
return false;
|
|
16476
16577
|
}
|
|
16477
16578
|
try {
|
|
16478
|
-
|
|
16579
|
+
fs15.rmdirSync(shell);
|
|
16479
16580
|
} catch {
|
|
16480
16581
|
return false;
|
|
16481
16582
|
}
|
|
@@ -16485,7 +16586,7 @@ function _reEscape(s) {
|
|
|
16485
16586
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
16486
16587
|
}
|
|
16487
16588
|
function _update_gitignore(project) {
|
|
16488
|
-
const gitignore =
|
|
16589
|
+
const gitignore = path13.join(project, ".gitignore");
|
|
16489
16590
|
const block = `${GITIGNORE_BLOCK_START}
|
|
16490
16591
|
${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
|
|
16491
16592
|
`;
|
|
@@ -16516,16 +16617,16 @@ ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
|
|
|
16516
16617
|
}
|
|
16517
16618
|
function _build_plan(project) {
|
|
16518
16619
|
return {
|
|
16519
|
-
npm: _detect_npm(
|
|
16520
|
-
composer: _detect_composer(
|
|
16620
|
+
npm: _detect_npm(path13.join(project, "package.json")),
|
|
16621
|
+
composer: _detect_composer(path13.join(project, "composer.json")),
|
|
16521
16622
|
symlinks_legacy: MANAGED_SYMLINKS.filter(
|
|
16522
|
-
(name) => _classify_symlink(
|
|
16623
|
+
(name) => _classify_symlink(path13.join(project, name)) === "legacy"
|
|
16523
16624
|
),
|
|
16524
16625
|
symlinks_user: MANAGED_SYMLINKS.filter(
|
|
16525
|
-
(name) => _classify_symlink(
|
|
16626
|
+
(name) => _classify_symlink(path13.join(project, name)) === "user"
|
|
16526
16627
|
),
|
|
16527
|
-
state_file: _isFile2(
|
|
16528
|
-
settings_files: _detect_legacy_settings(project).map((p) =>
|
|
16628
|
+
state_file: _isFile2(path13.join(project, LEGACY_STATE_FILENAME)),
|
|
16629
|
+
settings_files: _detect_legacy_settings(project).map((p) => path13.relative(project, p)),
|
|
16529
16630
|
empty_shell: _detect_empty_shell(project)
|
|
16530
16631
|
};
|
|
16531
16632
|
}
|
|
@@ -16589,10 +16690,10 @@ function _warn_on_major_mismatch(from_major, plan, out) {
|
|
|
16589
16690
|
}
|
|
16590
16691
|
function _apply(project, out, err) {
|
|
16591
16692
|
const summary = [];
|
|
16592
|
-
if (_strip_npm_entry(
|
|
16693
|
+
if (_strip_npm_entry(path13.join(project, "package.json"))) {
|
|
16593
16694
|
summary.push(`removed ${PACKAGE_NAME_NPM} from package.json`);
|
|
16594
16695
|
}
|
|
16595
|
-
if (_strip_composer_entry(
|
|
16696
|
+
if (_strip_composer_entry(path13.join(project, "composer.json"))) {
|
|
16596
16697
|
summary.push(`removed ${PACKAGE_NAME_COMPOSER} from composer.json`);
|
|
16597
16698
|
}
|
|
16598
16699
|
const [removed_links, preserved_links] = _purge_legacy_symlinks(project);
|
|
@@ -16718,13 +16819,13 @@ function _isCliEntry() {
|
|
|
16718
16819
|
if (process2.argv[1] === void 0) {
|
|
16719
16820
|
return false;
|
|
16720
16821
|
}
|
|
16721
|
-
const argvUrl = pathToFileURL(
|
|
16822
|
+
const argvUrl = pathToFileURL(path13.resolve(process2.argv[1])).href;
|
|
16722
16823
|
if (import.meta.url === argvUrl) {
|
|
16723
16824
|
return true;
|
|
16724
16825
|
}
|
|
16725
16826
|
try {
|
|
16726
|
-
const here =
|
|
16727
|
-
const argv =
|
|
16827
|
+
const here = fs15.realpathSync(fileURLToPath3(import.meta.url));
|
|
16828
|
+
const argv = fs15.realpathSync(path13.resolve(process2.argv[1]));
|
|
16728
16829
|
return here === argv;
|
|
16729
16830
|
} catch {
|
|
16730
16831
|
return false;
|
|
@@ -16761,34 +16862,34 @@ var ArgparseExit2 = class extends Error {
|
|
|
16761
16862
|
function expanduser6(p) {
|
|
16762
16863
|
if (p === "~") return os7.homedir();
|
|
16763
16864
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
16764
|
-
return
|
|
16865
|
+
return path14.join(os7.homedir(), p.slice(2));
|
|
16765
16866
|
}
|
|
16766
16867
|
return p;
|
|
16767
16868
|
}
|
|
16768
16869
|
function resolvePath(p) {
|
|
16769
16870
|
try {
|
|
16770
|
-
return
|
|
16871
|
+
return fs16.realpathSync(path14.resolve(p));
|
|
16771
16872
|
} catch {
|
|
16772
|
-
return
|
|
16873
|
+
return path14.resolve(p);
|
|
16773
16874
|
}
|
|
16774
16875
|
}
|
|
16775
16876
|
function isFile(p) {
|
|
16776
16877
|
try {
|
|
16777
|
-
return
|
|
16878
|
+
return fs16.statSync(p).isFile();
|
|
16778
16879
|
} catch {
|
|
16779
16880
|
return false;
|
|
16780
16881
|
}
|
|
16781
16882
|
}
|
|
16782
16883
|
function isDir(p) {
|
|
16783
16884
|
try {
|
|
16784
|
-
return
|
|
16885
|
+
return fs16.statSync(p).isDirectory();
|
|
16785
16886
|
} catch {
|
|
16786
16887
|
return false;
|
|
16787
16888
|
}
|
|
16788
16889
|
}
|
|
16789
16890
|
function pathExists(p) {
|
|
16790
16891
|
try {
|
|
16791
|
-
|
|
16892
|
+
fs16.statSync(p);
|
|
16792
16893
|
return true;
|
|
16793
16894
|
} catch {
|
|
16794
16895
|
return false;
|
|
@@ -16796,24 +16897,24 @@ function pathExists(p) {
|
|
|
16796
16897
|
}
|
|
16797
16898
|
function isSymlink(p) {
|
|
16798
16899
|
try {
|
|
16799
|
-
return
|
|
16900
|
+
return fs16.lstatSync(p).isSymbolicLink();
|
|
16800
16901
|
} catch {
|
|
16801
16902
|
return false;
|
|
16802
16903
|
}
|
|
16803
16904
|
}
|
|
16804
16905
|
function readText(p) {
|
|
16805
|
-
return
|
|
16906
|
+
return fs16.readFileSync(p, "utf-8");
|
|
16806
16907
|
}
|
|
16807
16908
|
function writeText(p, content) {
|
|
16808
|
-
|
|
16909
|
+
fs16.writeFileSync(p, content, "utf-8");
|
|
16809
16910
|
}
|
|
16810
16911
|
function mkdirp(p) {
|
|
16811
|
-
|
|
16912
|
+
fs16.mkdirSync(p, { recursive: true });
|
|
16812
16913
|
}
|
|
16813
16914
|
function sortedGlobStems(directory, suffix) {
|
|
16814
16915
|
let entries;
|
|
16815
16916
|
try {
|
|
16816
|
-
entries =
|
|
16917
|
+
entries = fs16.readdirSync(directory);
|
|
16817
16918
|
} catch {
|
|
16818
16919
|
return [];
|
|
16819
16920
|
}
|
|
@@ -16833,7 +16934,7 @@ function sortedGlobStems(directory, suffix) {
|
|
|
16833
16934
|
function countZips(directory) {
|
|
16834
16935
|
if (!isDir(directory)) return 0;
|
|
16835
16936
|
let n = 0;
|
|
16836
|
-
for (const name of
|
|
16937
|
+
for (const name of fs16.readdirSync(directory)) {
|
|
16837
16938
|
if (name.endsWith(".zip")) n += 1;
|
|
16838
16939
|
}
|
|
16839
16940
|
return n;
|
|
@@ -16841,35 +16942,35 @@ function countZips(directory) {
|
|
|
16841
16942
|
function sha256OfFile(p) {
|
|
16842
16943
|
let data;
|
|
16843
16944
|
try {
|
|
16844
|
-
data =
|
|
16945
|
+
data = fs16.readFileSync(p);
|
|
16845
16946
|
} catch {
|
|
16846
16947
|
return null;
|
|
16847
16948
|
}
|
|
16848
16949
|
return crypto3.createHash("sha256").update(data).digest("hex");
|
|
16849
16950
|
}
|
|
16850
16951
|
function atomicWrite0644(target, body, prefix) {
|
|
16851
|
-
const dir =
|
|
16852
|
-
const tmpName =
|
|
16952
|
+
const dir = path14.dirname(target);
|
|
16953
|
+
const tmpName = path14.join(
|
|
16853
16954
|
dir,
|
|
16854
16955
|
`${prefix}${process3.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
|
|
16855
16956
|
);
|
|
16856
16957
|
let fd = null;
|
|
16857
16958
|
try {
|
|
16858
|
-
fd =
|
|
16859
|
-
|
|
16860
|
-
|
|
16959
|
+
fd = fs16.openSync(tmpName, "wx", 420);
|
|
16960
|
+
fs16.writeFileSync(fd, body, "utf-8");
|
|
16961
|
+
fs16.closeSync(fd);
|
|
16861
16962
|
fd = null;
|
|
16862
|
-
|
|
16863
|
-
|
|
16963
|
+
fs16.chmodSync(tmpName, 420);
|
|
16964
|
+
fs16.renameSync(tmpName, target);
|
|
16864
16965
|
} catch (err) {
|
|
16865
16966
|
if (fd !== null) {
|
|
16866
16967
|
try {
|
|
16867
|
-
|
|
16968
|
+
fs16.closeSync(fd);
|
|
16868
16969
|
} catch {
|
|
16869
16970
|
}
|
|
16870
16971
|
}
|
|
16871
16972
|
try {
|
|
16872
|
-
|
|
16973
|
+
fs16.unlinkSync(tmpName);
|
|
16873
16974
|
} catch {
|
|
16874
16975
|
}
|
|
16875
16976
|
throw err;
|
|
@@ -16970,14 +17071,14 @@ function jsonDumpsCompact(value) {
|
|
|
16970
17071
|
return _jsonStrNoAscii(String(value));
|
|
16971
17072
|
}
|
|
16972
17073
|
function yamlSafeLoad(text) {
|
|
16973
|
-
let
|
|
17074
|
+
let YAML3;
|
|
16974
17075
|
try {
|
|
16975
|
-
|
|
17076
|
+
YAML3 = require_dist();
|
|
16976
17077
|
} catch {
|
|
16977
17078
|
return null;
|
|
16978
17079
|
}
|
|
16979
17080
|
try {
|
|
16980
|
-
const data =
|
|
17081
|
+
const data = YAML3.parse(text, { version: "1.1" });
|
|
16981
17082
|
return data;
|
|
16982
17083
|
} catch {
|
|
16983
17084
|
return void 0;
|
|
@@ -16993,12 +17094,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
|
|
|
16993
17094
|
var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
|
|
16994
17095
|
var SETTINGS_SUBDIR = ["agents", "settings"];
|
|
16995
17096
|
function _canonical_settings_target(project_root) {
|
|
16996
|
-
return
|
|
17097
|
+
return path14.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
|
|
16997
17098
|
}
|
|
16998
17099
|
function _resolve_settings_read(project_root) {
|
|
16999
17100
|
const canonical = _canonical_settings_target(project_root);
|
|
17000
17101
|
if (pathExists(canonical)) return canonical;
|
|
17001
|
-
const legacy =
|
|
17102
|
+
const legacy = path14.join(project_root, SETTINGS_FILE);
|
|
17002
17103
|
if (pathExists(legacy)) return legacy;
|
|
17003
17104
|
return canonical;
|
|
17004
17105
|
}
|
|
@@ -17062,9 +17163,9 @@ function fail(msg) {
|
|
|
17062
17163
|
throw new SystemExitError(1);
|
|
17063
17164
|
}
|
|
17064
17165
|
function detect_package_root(project_root) {
|
|
17065
|
-
const npm_path =
|
|
17166
|
+
const npm_path = path14.join(project_root, "node_modules", "@event4u", "agent-config");
|
|
17066
17167
|
if (isDir(npm_path)) return resolvePath(npm_path);
|
|
17067
|
-
if (pathExists(
|
|
17168
|
+
if (pathExists(path14.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
17068
17169
|
return project_root;
|
|
17069
17170
|
}
|
|
17070
17171
|
fail(
|
|
@@ -17072,12 +17173,12 @@ function detect_package_root(project_root) {
|
|
|
17072
17173
|
);
|
|
17073
17174
|
}
|
|
17074
17175
|
function detect_package_type(package_root) {
|
|
17075
|
-
if (package_root.split(
|
|
17176
|
+
if (package_root.split(path14.sep).includes("node_modules")) return "npm";
|
|
17076
17177
|
return "local";
|
|
17077
17178
|
}
|
|
17078
17179
|
function detect_package_type_for_project(project_root, package_root) {
|
|
17079
17180
|
const npm_path = resolvePath(
|
|
17080
|
-
|
|
17181
|
+
path14.join(project_root, "node_modules", "@event4u", "agent-config")
|
|
17081
17182
|
);
|
|
17082
17183
|
const package_resolved = resolvePath(package_root);
|
|
17083
17184
|
if (package_resolved === npm_path) return "npm";
|
|
@@ -17097,7 +17198,7 @@ function ensure_directory(p) {
|
|
|
17097
17198
|
mkdirp(p);
|
|
17098
17199
|
}
|
|
17099
17200
|
function write_file(p, content) {
|
|
17100
|
-
ensure_directory(
|
|
17201
|
+
ensure_directory(path14.dirname(p));
|
|
17101
17202
|
writeText(p, content);
|
|
17102
17203
|
}
|
|
17103
17204
|
function read_json_file(p) {
|
|
@@ -17268,7 +17369,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
|
|
|
17268
17369
|
return rendered + "\n" + suffix;
|
|
17269
17370
|
}
|
|
17270
17371
|
function _migrate_legacy_if_present(project_root, template_body) {
|
|
17271
|
-
const legacy_target =
|
|
17372
|
+
const legacy_target = path14.join(project_root, LEGACY_SETTINGS_FILE);
|
|
17272
17373
|
if (!isFile(legacy_target)) return null;
|
|
17273
17374
|
const legacy_text = readText(legacy_target);
|
|
17274
17375
|
const [values, unknown] = _parse_legacy_settings(legacy_text);
|
|
@@ -17283,9 +17384,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
|
|
|
17283
17384
|
}
|
|
17284
17385
|
}
|
|
17285
17386
|
rendered = _append_unknown_legacy(rendered, values, unknown);
|
|
17286
|
-
const backup_target =
|
|
17387
|
+
const backup_target = path14.join(project_root, LEGACY_BACKUP_FILE);
|
|
17287
17388
|
writeText(backup_target, legacy_text);
|
|
17288
|
-
|
|
17389
|
+
fs16.unlinkSync(legacy_target);
|
|
17289
17390
|
info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
|
|
17290
17391
|
info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
|
|
17291
17392
|
if (unknown.length > 0) {
|
|
@@ -17320,7 +17421,7 @@ function _render_template(template, profile_values) {
|
|
|
17320
17421
|
return body;
|
|
17321
17422
|
}
|
|
17322
17423
|
function _load_valid_user_types(package_root) {
|
|
17323
|
-
const directory =
|
|
17424
|
+
const directory = path14.join(package_root, USER_TYPES_DIR);
|
|
17324
17425
|
if (!isDir(directory)) return [];
|
|
17325
17426
|
return sortedGlobStems(directory, ".yml");
|
|
17326
17427
|
}
|
|
@@ -17377,8 +17478,8 @@ function splitlinesKeepends(text) {
|
|
|
17377
17478
|
}
|
|
17378
17479
|
function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
|
|
17379
17480
|
const target = _canonical_settings_target(project_root);
|
|
17380
|
-
const profile_source =
|
|
17381
|
-
const template_source =
|
|
17481
|
+
const profile_source = path14.join(package_root, "src", "config", "profiles", `${profile}.ini`);
|
|
17482
|
+
const template_source = path14.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
17382
17483
|
if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
|
|
17383
17484
|
if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
|
|
17384
17485
|
const template = readText(template_source);
|
|
@@ -17392,21 +17493,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
17392
17493
|
if (profile_values["rule_loading_tier"] !== profile) {
|
|
17393
17494
|
const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
|
|
17394
17495
|
fail(
|
|
17395
|
-
`Profile preset ${
|
|
17496
|
+
`Profile preset ${path14.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
|
|
17396
17497
|
);
|
|
17397
17498
|
}
|
|
17398
17499
|
profile_values["user_type"] = _validate_user_type(package_root, user_type);
|
|
17399
17500
|
let template_body = _render_template(template, profile_values);
|
|
17400
17501
|
template_body = _inject_packs(template_body, packs ?? []);
|
|
17401
|
-
const legacy_root =
|
|
17502
|
+
const legacy_root = path14.join(project_root, SETTINGS_FILE);
|
|
17402
17503
|
if (isFile(legacy_root) && !pathExists(target)) {
|
|
17403
|
-
mkdirp(
|
|
17504
|
+
mkdirp(path14.dirname(target));
|
|
17404
17505
|
writeText(target, readText(legacy_root));
|
|
17405
|
-
|
|
17506
|
+
fs16.unlinkSync(legacy_root);
|
|
17406
17507
|
success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
|
|
17407
17508
|
return;
|
|
17408
17509
|
}
|
|
17409
|
-
const legacy_target =
|
|
17510
|
+
const legacy_target = path14.join(project_root, LEGACY_SETTINGS_FILE);
|
|
17410
17511
|
if (isFile(legacy_target) && pathExists(target)) {
|
|
17411
17512
|
warn(
|
|
17412
17513
|
`Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
|
|
@@ -17423,7 +17524,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
17423
17524
|
skip(`${SETTINGS_FILE} already exists`);
|
|
17424
17525
|
return;
|
|
17425
17526
|
}
|
|
17426
|
-
mkdirp(
|
|
17527
|
+
mkdirp(path14.dirname(target));
|
|
17427
17528
|
write_file(target, template_body);
|
|
17428
17529
|
const user_type_value = profile_values["user_type"] ?? "";
|
|
17429
17530
|
const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
|
|
@@ -17436,7 +17537,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
17436
17537
|
const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
|
|
17437
17538
|
const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
|
|
17438
17539
|
merge_json_file(
|
|
17439
|
-
|
|
17540
|
+
path14.join(project_root, ".vscode", "settings.json"),
|
|
17440
17541
|
bridge,
|
|
17441
17542
|
force,
|
|
17442
17543
|
".vscode/settings.json"
|
|
@@ -17445,14 +17546,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
17445
17546
|
function ensure_augment_bridge(project_root, force) {
|
|
17446
17547
|
const bridge = { enabledPlugins: { "agent-config@event4u": true } };
|
|
17447
17548
|
return merge_json_file(
|
|
17448
|
-
|
|
17549
|
+
path14.join(project_root, ".augment", "settings.json"),
|
|
17449
17550
|
bridge,
|
|
17450
17551
|
force,
|
|
17451
17552
|
".augment/settings.json"
|
|
17452
17553
|
);
|
|
17453
17554
|
}
|
|
17454
|
-
var AUGMENT_USER_DIR =
|
|
17455
|
-
var AUGMENT_USER_HOOKS_DIR =
|
|
17555
|
+
var AUGMENT_USER_DIR = path14.join(os7.homedir(), ".augment");
|
|
17556
|
+
var AUGMENT_USER_HOOKS_DIR = path14.join(AUGMENT_USER_DIR, "hooks");
|
|
17456
17557
|
var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
|
|
17457
17558
|
var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
17458
17559
|
"augment-chat-history.sh",
|
|
@@ -17468,29 +17569,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
|
|
|
17468
17569
|
["post_tool_use", "PostToolUse"]
|
|
17469
17570
|
];
|
|
17470
17571
|
function _deploy_augment_trampoline(package_root, name, force) {
|
|
17471
|
-
const src =
|
|
17572
|
+
const src = path14.join(package_root, "scripts", "hooks", name);
|
|
17472
17573
|
if (!pathExists(src)) {
|
|
17473
17574
|
skip(`augment trampoline missing in package: ${src}`);
|
|
17474
17575
|
return null;
|
|
17475
17576
|
}
|
|
17476
17577
|
mkdirp(AUGMENT_USER_HOOKS_DIR);
|
|
17477
|
-
const dst =
|
|
17578
|
+
const dst = path14.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
17478
17579
|
const src_text = readText(src);
|
|
17479
17580
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
17480
17581
|
skip(`~/.augment/hooks/${name} already up to date`);
|
|
17481
17582
|
} else {
|
|
17482
17583
|
writeText(dst, src_text);
|
|
17483
|
-
|
|
17584
|
+
fs16.chmodSync(dst, 493);
|
|
17484
17585
|
success(`~/.augment/hooks/${name} installed`);
|
|
17485
17586
|
}
|
|
17486
17587
|
return dst;
|
|
17487
17588
|
}
|
|
17488
17589
|
function _remove_legacy_augment_trampolines() {
|
|
17489
17590
|
for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
|
|
17490
|
-
const legacy =
|
|
17591
|
+
const legacy = path14.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
17491
17592
|
try {
|
|
17492
17593
|
if (isFile(legacy)) {
|
|
17493
|
-
|
|
17594
|
+
fs16.unlinkSync(legacy);
|
|
17494
17595
|
skip(`removed legacy ~/.augment/hooks/${name}`);
|
|
17495
17596
|
}
|
|
17496
17597
|
} catch {
|
|
@@ -17509,7 +17610,7 @@ function ensure_augment_user_hooks(package_root, force) {
|
|
|
17509
17610
|
}
|
|
17510
17611
|
const settings_patch = { hooks: per_event };
|
|
17511
17612
|
return merge_json_file(
|
|
17512
|
-
|
|
17613
|
+
path14.join(AUGMENT_USER_DIR, "settings.json"),
|
|
17513
17614
|
settings_patch,
|
|
17514
17615
|
force,
|
|
17515
17616
|
"~/.augment/settings.json"
|
|
@@ -17534,7 +17635,7 @@ function _heal_legacy_claude_plugin_ids(p) {
|
|
|
17534
17635
|
return removed;
|
|
17535
17636
|
}
|
|
17536
17637
|
function ensure_claude_bridge(project_root, force) {
|
|
17537
|
-
const target =
|
|
17638
|
+
const target = path14.join(project_root, ".claude", "settings.json");
|
|
17538
17639
|
const healed = _heal_legacy_claude_plugin_ids(target);
|
|
17539
17640
|
for (const pid of healed) {
|
|
17540
17641
|
success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
|
|
@@ -17559,29 +17660,29 @@ function ensure_cursor_bridge(project_root, force) {
|
|
|
17559
17660
|
}
|
|
17560
17661
|
const bridge = { version: 1, hooks };
|
|
17561
17662
|
return merge_json_file(
|
|
17562
|
-
|
|
17663
|
+
path14.join(project_root, ".cursor", "hooks.json"),
|
|
17563
17664
|
bridge,
|
|
17564
17665
|
force,
|
|
17565
17666
|
".cursor/hooks.json"
|
|
17566
17667
|
);
|
|
17567
17668
|
}
|
|
17568
|
-
var CURSOR_USER_DIR =
|
|
17569
|
-
var CURSOR_USER_HOOKS_DIR =
|
|
17669
|
+
var CURSOR_USER_DIR = path14.join(os7.homedir(), ".cursor");
|
|
17670
|
+
var CURSOR_USER_HOOKS_DIR = path14.join(CURSOR_USER_DIR, "hooks");
|
|
17570
17671
|
var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
|
|
17571
17672
|
function ensure_cursor_user_hooks(package_root, force) {
|
|
17572
|
-
const src =
|
|
17673
|
+
const src = path14.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
|
|
17573
17674
|
if (!pathExists(src)) {
|
|
17574
17675
|
skip(`cursor trampoline missing in package: ${src}`);
|
|
17575
17676
|
return [];
|
|
17576
17677
|
}
|
|
17577
17678
|
mkdirp(CURSOR_USER_HOOKS_DIR);
|
|
17578
|
-
const dst =
|
|
17679
|
+
const dst = path14.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
|
|
17579
17680
|
const src_text = readText(src);
|
|
17580
17681
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
17581
17682
|
skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
17582
17683
|
} else {
|
|
17583
17684
|
writeText(dst, src_text);
|
|
17584
|
-
|
|
17685
|
+
fs16.chmodSync(dst, 493);
|
|
17585
17686
|
success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
|
|
17586
17687
|
}
|
|
17587
17688
|
const hooks = {};
|
|
@@ -17590,7 +17691,7 @@ function ensure_cursor_user_hooks(package_root, force) {
|
|
|
17590
17691
|
}
|
|
17591
17692
|
const settings_patch = { version: 1, hooks };
|
|
17592
17693
|
return merge_json_file(
|
|
17593
|
-
|
|
17694
|
+
path14.join(CURSOR_USER_DIR, "hooks.json"),
|
|
17594
17695
|
settings_patch,
|
|
17595
17696
|
force,
|
|
17596
17697
|
"~/.cursor/hooks.json"
|
|
@@ -17633,12 +17734,12 @@ exit 0
|
|
|
17633
17734
|
`;
|
|
17634
17735
|
}
|
|
17635
17736
|
function ensure_cline_bridge(project_root, force) {
|
|
17636
|
-
const hooks_dir =
|
|
17737
|
+
const hooks_dir = path14.join(project_root, ".clinerules", "hooks");
|
|
17637
17738
|
mkdirp(hooks_dir);
|
|
17638
17739
|
const workspace_quoted = shlexQuote(resolvePath(project_root));
|
|
17639
17740
|
let written = 0;
|
|
17640
17741
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
17641
|
-
const target =
|
|
17742
|
+
const target = path14.join(hooks_dir, native_event);
|
|
17642
17743
|
const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
|
|
17643
17744
|
if (pathExists(target) && readText(target) === body && !force) {
|
|
17644
17745
|
continue;
|
|
@@ -17648,7 +17749,7 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
17648
17749
|
continue;
|
|
17649
17750
|
}
|
|
17650
17751
|
writeText(target, body);
|
|
17651
|
-
|
|
17752
|
+
fs16.chmodSync(target, 493);
|
|
17652
17753
|
written += 1;
|
|
17653
17754
|
}
|
|
17654
17755
|
if (written) {
|
|
@@ -17657,27 +17758,27 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
17657
17758
|
skip(".clinerules/hooks/ already up to date");
|
|
17658
17759
|
}
|
|
17659
17760
|
}
|
|
17660
|
-
var CLINE_USER_DIR =
|
|
17761
|
+
var CLINE_USER_DIR = path14.join(os7.homedir(), "Documents", "Cline", "Hooks");
|
|
17661
17762
|
var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
|
|
17662
17763
|
function ensure_cline_user_hooks(package_root, force) {
|
|
17663
|
-
const src =
|
|
17764
|
+
const src = path14.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
|
|
17664
17765
|
if (!pathExists(src)) {
|
|
17665
17766
|
skip(`cline trampoline missing in package: ${src}`);
|
|
17666
17767
|
return;
|
|
17667
17768
|
}
|
|
17668
17769
|
mkdirp(CLINE_USER_DIR);
|
|
17669
|
-
const trampoline =
|
|
17770
|
+
const trampoline = path14.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
|
|
17670
17771
|
const src_text = readText(src);
|
|
17671
17772
|
if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
|
|
17672
17773
|
skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
17673
17774
|
} else {
|
|
17674
17775
|
writeText(trampoline, src_text);
|
|
17675
|
-
|
|
17776
|
+
fs16.chmodSync(trampoline, 493);
|
|
17676
17777
|
success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
|
|
17677
17778
|
}
|
|
17678
17779
|
const trampoline_quoted = shlexQuote(trampoline);
|
|
17679
17780
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
17680
|
-
const wrapper =
|
|
17781
|
+
const wrapper = path14.join(CLINE_USER_DIR, native_event);
|
|
17681
17782
|
const body = `#!/usr/bin/env bash
|
|
17682
17783
|
# Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
|
|
17683
17784
|
# User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
|
|
@@ -17687,7 +17788,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
|
|
|
17687
17788
|
continue;
|
|
17688
17789
|
}
|
|
17689
17790
|
writeText(wrapper, body);
|
|
17690
|
-
|
|
17791
|
+
fs16.chmodSync(wrapper, 493);
|
|
17691
17792
|
}
|
|
17692
17793
|
}
|
|
17693
17794
|
var WINDSURF_DISPATCHER_BINDINGS = [
|
|
@@ -17708,29 +17809,29 @@ function ensure_windsurf_bridge(project_root, force) {
|
|
|
17708
17809
|
}
|
|
17709
17810
|
const bridge = { hooks };
|
|
17710
17811
|
return merge_json_file(
|
|
17711
|
-
|
|
17812
|
+
path14.join(project_root, ".windsurf", "hooks.json"),
|
|
17712
17813
|
bridge,
|
|
17713
17814
|
force,
|
|
17714
17815
|
".windsurf/hooks.json"
|
|
17715
17816
|
);
|
|
17716
17817
|
}
|
|
17717
|
-
var WINDSURF_USER_DIR =
|
|
17718
|
-
var WINDSURF_USER_HOOKS_DIR =
|
|
17818
|
+
var WINDSURF_USER_DIR = path14.join(os7.homedir(), ".codeium", "windsurf");
|
|
17819
|
+
var WINDSURF_USER_HOOKS_DIR = path14.join(WINDSURF_USER_DIR, "hooks");
|
|
17719
17820
|
var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
|
|
17720
17821
|
function ensure_windsurf_user_hooks(package_root, force) {
|
|
17721
|
-
const src =
|
|
17822
|
+
const src = path14.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
17722
17823
|
if (!pathExists(src)) {
|
|
17723
17824
|
skip(`windsurf trampoline missing in package: ${src}`);
|
|
17724
17825
|
return [];
|
|
17725
17826
|
}
|
|
17726
17827
|
mkdirp(WINDSURF_USER_HOOKS_DIR);
|
|
17727
|
-
const dst =
|
|
17828
|
+
const dst = path14.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
17728
17829
|
const src_text = readText(src);
|
|
17729
17830
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
17730
17831
|
skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
17731
17832
|
} else {
|
|
17732
17833
|
writeText(dst, src_text);
|
|
17733
|
-
|
|
17834
|
+
fs16.chmodSync(dst, 493);
|
|
17734
17835
|
success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
|
|
17735
17836
|
}
|
|
17736
17837
|
const hooks = {};
|
|
@@ -17742,7 +17843,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
|
|
|
17742
17843
|
}
|
|
17743
17844
|
const settings_patch = { hooks };
|
|
17744
17845
|
return merge_json_file(
|
|
17745
|
-
|
|
17846
|
+
path14.join(WINDSURF_USER_DIR, "hooks.json"),
|
|
17746
17847
|
settings_patch,
|
|
17747
17848
|
force,
|
|
17748
17849
|
"~/.codeium/windsurf/hooks.json"
|
|
@@ -17771,43 +17872,43 @@ function _gemini_hooks_dict(command_factory) {
|
|
|
17771
17872
|
function ensure_gemini_bridge(project_root, force) {
|
|
17772
17873
|
const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
|
|
17773
17874
|
return merge_json_file(
|
|
17774
|
-
|
|
17875
|
+
path14.join(project_root, ".gemini", "settings.json"),
|
|
17775
17876
|
bridge,
|
|
17776
17877
|
force,
|
|
17777
17878
|
".gemini/settings.json"
|
|
17778
17879
|
);
|
|
17779
17880
|
}
|
|
17780
|
-
var GEMINI_USER_DIR =
|
|
17781
|
-
var GEMINI_USER_HOOKS_DIR =
|
|
17881
|
+
var GEMINI_USER_DIR = path14.join(os7.homedir(), ".gemini");
|
|
17882
|
+
var GEMINI_USER_HOOKS_DIR = path14.join(GEMINI_USER_DIR, "hooks");
|
|
17782
17883
|
var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
|
|
17783
17884
|
function ensure_gemini_user_hooks(package_root, force) {
|
|
17784
|
-
const src =
|
|
17885
|
+
const src = path14.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
|
|
17785
17886
|
if (!pathExists(src)) {
|
|
17786
17887
|
skip(`gemini trampoline missing in package: ${src}`);
|
|
17787
17888
|
return [];
|
|
17788
17889
|
}
|
|
17789
17890
|
mkdirp(GEMINI_USER_HOOKS_DIR);
|
|
17790
|
-
const dst =
|
|
17891
|
+
const dst = path14.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
|
|
17791
17892
|
const src_text = readText(src);
|
|
17792
17893
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
17793
17894
|
skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
17794
17895
|
} else {
|
|
17795
17896
|
writeText(dst, src_text);
|
|
17796
|
-
|
|
17897
|
+
fs16.chmodSync(dst, 493);
|
|
17797
17898
|
success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
|
|
17798
17899
|
}
|
|
17799
17900
|
const settings_patch = {
|
|
17800
17901
|
hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
|
|
17801
17902
|
};
|
|
17802
17903
|
return merge_json_file(
|
|
17803
|
-
|
|
17904
|
+
path14.join(GEMINI_USER_DIR, "settings.json"),
|
|
17804
17905
|
settings_patch,
|
|
17805
17906
|
force,
|
|
17806
17907
|
"~/.gemini/settings.json"
|
|
17807
17908
|
);
|
|
17808
17909
|
}
|
|
17809
17910
|
function ensure_copilot_bridge(project_root, force) {
|
|
17810
|
-
const target =
|
|
17911
|
+
const target = path14.join(project_root, ".github", "plugin", "marketplace.json");
|
|
17811
17912
|
const bridge = {
|
|
17812
17913
|
marketplace: {
|
|
17813
17914
|
name: "event4u-agent-marketplace",
|
|
@@ -17850,7 +17951,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
|
|
|
17850
17951
|
Run \`./agent-config --help\` for available commands.
|
|
17851
17952
|
`;
|
|
17852
17953
|
function ensure_roocode_bridge(project_root, force) {
|
|
17853
|
-
const target =
|
|
17954
|
+
const target = path14.join(project_root, ".roo", "rules", "agent-config.md");
|
|
17854
17955
|
if (pathExists(target) && !force) {
|
|
17855
17956
|
skip(".roo/rules/agent-config.md already exists");
|
|
17856
17957
|
return;
|
|
@@ -17872,7 +17973,7 @@ To wire Claude Desktop to this project's rules, run:
|
|
|
17872
17973
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
17873
17974
|
`;
|
|
17874
17975
|
function ensure_claude_desktop_bridge(project_root, force) {
|
|
17875
|
-
const target =
|
|
17976
|
+
const target = path14.join(project_root, ".claude-desktop", "agent-config.md");
|
|
17876
17977
|
if (pathExists(target) && !force) {
|
|
17877
17978
|
skip(".claude-desktop/agent-config.md already exists");
|
|
17878
17979
|
return;
|
|
@@ -17897,7 +17998,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
|
|
|
17897
17998
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
17898
17999
|
`;
|
|
17899
18000
|
function ensure_aider_bridge(project_root, force) {
|
|
17900
|
-
const target =
|
|
18001
|
+
const target = path14.join(project_root, ".aider", "agent-config.md");
|
|
17901
18002
|
if (pathExists(target) && !force) {
|
|
17902
18003
|
skip(".aider/agent-config.md already exists");
|
|
17903
18004
|
return;
|
|
@@ -17916,7 +18017,7 @@ developers where the rules and skills live.
|
|
|
17916
18017
|
Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
|
|
17917
18018
|
`;
|
|
17918
18019
|
function ensure_codex_bridge(project_root, force) {
|
|
17919
|
-
const target =
|
|
18020
|
+
const target = path14.join(project_root, ".codex", "agent-config.md");
|
|
17920
18021
|
if (pathExists(target) && !force) {
|
|
17921
18022
|
skip(".codex/agent-config.md already exists");
|
|
17922
18023
|
return;
|
|
@@ -17934,7 +18035,7 @@ rules per session. The canonical rule and skill source lives under
|
|
|
17934
18035
|
orientation).
|
|
17935
18036
|
`;
|
|
17936
18037
|
function ensure_continue_bridge(project_root, force) {
|
|
17937
|
-
const target =
|
|
18038
|
+
const target = path14.join(project_root, ".continue", "rules", "agent-config.md");
|
|
17938
18039
|
if (pathExists(target) && !force) {
|
|
17939
18040
|
skip(".continue/rules/agent-config.md already exists");
|
|
17940
18041
|
return;
|
|
@@ -17965,7 +18066,7 @@ orientation).
|
|
|
17965
18066
|
See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
|
|
17966
18067
|
`;
|
|
17967
18068
|
function ensure_kilocode_bridge(project_root, force) {
|
|
17968
|
-
const target =
|
|
18069
|
+
const target = path14.join(project_root, ".kilocode", "rules", "agent-config.md");
|
|
17969
18070
|
if (pathExists(target) && !force) {
|
|
17970
18071
|
skip(".kilocode/rules/agent-config.md already exists");
|
|
17971
18072
|
return;
|
|
@@ -17992,7 +18093,7 @@ canonical source (or symlink it):
|
|
|
17992
18093
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
17993
18094
|
`;
|
|
17994
18095
|
function ensure_zed_bridge(project_root, force) {
|
|
17995
|
-
const target =
|
|
18096
|
+
const target = path14.join(project_root, ".zed", "agent-config.md");
|
|
17996
18097
|
if (pathExists(target) && !force) {
|
|
17997
18098
|
skip(".zed/agent-config.md already exists");
|
|
17998
18099
|
return;
|
|
@@ -18013,7 +18114,7 @@ rules into your JetBrains profile.
|
|
|
18013
18114
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18014
18115
|
`;
|
|
18015
18116
|
function ensure_jetbrains_bridge(project_root, force) {
|
|
18016
|
-
const target =
|
|
18117
|
+
const target = path14.join(project_root, ".jetbrains", "agent-config.md");
|
|
18017
18118
|
if (pathExists(target) && !force) {
|
|
18018
18119
|
skip(".jetbrains/agent-config.md already exists");
|
|
18019
18120
|
return;
|
|
@@ -18044,7 +18145,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
|
|
|
18044
18145
|
See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
|
|
18045
18146
|
`;
|
|
18046
18147
|
function ensure_kiro_bridge(project_root, force) {
|
|
18047
|
-
const target =
|
|
18148
|
+
const target = path14.join(project_root, ".kiro", "steering", "agent-config.md");
|
|
18048
18149
|
if (pathExists(target) && !force) {
|
|
18049
18150
|
skip(".kiro/steering/agent-config.md already exists");
|
|
18050
18151
|
return;
|
|
@@ -18070,35 +18171,35 @@ var SMOKE_BRIDGE_PATHS = {
|
|
|
18070
18171
|
};
|
|
18071
18172
|
function dirHasEntries(p) {
|
|
18072
18173
|
try {
|
|
18073
|
-
return
|
|
18174
|
+
return fs16.readdirSync(p).length > 0;
|
|
18074
18175
|
} catch {
|
|
18075
18176
|
return false;
|
|
18076
18177
|
}
|
|
18077
18178
|
}
|
|
18078
18179
|
function _resolve_tsx_invocation(scriptPath, scriptArgs) {
|
|
18079
18180
|
const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
18080
|
-
let dir =
|
|
18181
|
+
let dir = path14.dirname(scriptPath);
|
|
18081
18182
|
for (; ; ) {
|
|
18082
|
-
const candidate =
|
|
18183
|
+
const candidate = path14.join(dir, "node_modules", ".bin", binName);
|
|
18083
18184
|
if (isFile(candidate)) {
|
|
18084
18185
|
return { command: candidate, args: [scriptPath, ...scriptArgs] };
|
|
18085
18186
|
}
|
|
18086
|
-
const parent =
|
|
18187
|
+
const parent = path14.dirname(dir);
|
|
18087
18188
|
if (parent === dir) break;
|
|
18088
18189
|
dir = parent;
|
|
18089
18190
|
}
|
|
18090
18191
|
return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
|
|
18091
18192
|
}
|
|
18092
18193
|
function _smoke_test_hooks(project_root, package_root) {
|
|
18093
|
-
const dispatcher =
|
|
18094
|
-
const manifest =
|
|
18194
|
+
const dispatcher = path14.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
|
|
18195
|
+
const manifest = path14.join(package_root, "scripts", "hook_manifest.yaml");
|
|
18095
18196
|
if (!isFile(dispatcher) || !isFile(manifest)) return 0;
|
|
18096
18197
|
const failed = [];
|
|
18097
18198
|
const skipped = [];
|
|
18098
18199
|
const passed = [];
|
|
18099
18200
|
for (const [platform, native] of SMOKE_PROBE_EVENTS) {
|
|
18100
18201
|
const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
|
|
18101
|
-
const bridge_path = rel_bridge ?
|
|
18202
|
+
const bridge_path = rel_bridge ? path14.join(project_root, rel_bridge) : null;
|
|
18102
18203
|
const bridge_present = Boolean(
|
|
18103
18204
|
bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
|
|
18104
18205
|
);
|
|
@@ -18298,9 +18399,9 @@ To remove this marker, delete this file.
|
|
|
18298
18399
|
`;
|
|
18299
18400
|
}
|
|
18300
18401
|
var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
|
|
18301
|
-
var GLOBAL_ROOT =
|
|
18302
|
-
var GLOBAL_USER_SETTINGS_PATH =
|
|
18303
|
-
var GLOBAL_AGENT_SETTINGS_PATH =
|
|
18402
|
+
var GLOBAL_ROOT = path14.join(os7.homedir(), ".event4u", "agent-config");
|
|
18403
|
+
var GLOBAL_USER_SETTINGS_PATH = path14.join(GLOBAL_ROOT, ".agent-user.yml");
|
|
18404
|
+
var GLOBAL_AGENT_SETTINGS_PATH = path14.join(GLOBAL_ROOT, ".agent-settings.yml");
|
|
18304
18405
|
function _bridge_marker(tool_id, scope) {
|
|
18305
18406
|
if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
|
|
18306
18407
|
return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
|
|
@@ -18349,7 +18450,7 @@ function _load_yaml_doc(p) {
|
|
|
18349
18450
|
return _isPlainObject2(data) ? data : {};
|
|
18350
18451
|
}
|
|
18351
18452
|
function _load_default_settings(package_root) {
|
|
18352
|
-
const template_source =
|
|
18453
|
+
const template_source = path14.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
18353
18454
|
if (!pathExists(template_source)) return {};
|
|
18354
18455
|
let text;
|
|
18355
18456
|
try {
|
|
@@ -18437,9 +18538,9 @@ function detect_scope(cwd) {
|
|
|
18437
18538
|
if (pathExists(_resolve_settings_read(cwd))) {
|
|
18438
18539
|
return ["project", `existing ${SETTINGS_FILE}`];
|
|
18439
18540
|
}
|
|
18440
|
-
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(
|
|
18441
|
-
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(
|
|
18442
|
-
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(
|
|
18541
|
+
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path14.join(cwd, m))) ?? null;
|
|
18542
|
+
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path14.join(cwd, d))) ?? null;
|
|
18543
|
+
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path14.join(cwd, f))) ?? null;
|
|
18443
18544
|
if (has_manifest && (has_ai_dir || has_ai_file)) {
|
|
18444
18545
|
const marker = has_ai_dir || has_ai_file;
|
|
18445
18546
|
return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
|
|
@@ -18460,7 +18561,7 @@ function readLineSyncRaw(promptText) {
|
|
|
18460
18561
|
for (; ; ) {
|
|
18461
18562
|
let n;
|
|
18462
18563
|
try {
|
|
18463
|
-
n =
|
|
18564
|
+
n = fs16.readSync(0, buf, 0, 1, null);
|
|
18464
18565
|
} catch (err) {
|
|
18465
18566
|
const code = err.code;
|
|
18466
18567
|
if (code === "EAGAIN") {
|
|
@@ -18535,8 +18636,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
|
|
|
18535
18636
|
const marker = _bridge_marker(tool_id, scope);
|
|
18536
18637
|
if (!marker) continue;
|
|
18537
18638
|
let marker_path = marker;
|
|
18538
|
-
if (!
|
|
18539
|
-
marker_path =
|
|
18639
|
+
if (!path14.isAbsolute(marker_path)) {
|
|
18640
|
+
marker_path = path14.join(project_root, marker_path);
|
|
18540
18641
|
}
|
|
18541
18642
|
out[tool_id] = [_file_entry(marker_path, "bridge", false)];
|
|
18542
18643
|
}
|
|
@@ -18575,26 +18676,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
|
|
|
18575
18676
|
}
|
|
18576
18677
|
write_manifest(target, version, entries);
|
|
18577
18678
|
if (!state.QUIET) {
|
|
18578
|
-
const rel = isRelativeTo(target, project_root) ?
|
|
18679
|
+
const rel = isRelativeTo(target, project_root) ? path14.relative(project_root, target) : target;
|
|
18579
18680
|
info(`Manifest updated: ${rel}`);
|
|
18580
18681
|
}
|
|
18581
18682
|
return 0;
|
|
18582
18683
|
}
|
|
18583
18684
|
function isRelativeTo(child, parent) {
|
|
18584
|
-
const rel =
|
|
18585
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
18685
|
+
const rel = path14.relative(parent, child);
|
|
18686
|
+
return rel === "" || !rel.startsWith("..") && !path14.isAbsolute(rel);
|
|
18586
18687
|
}
|
|
18587
18688
|
function _resolve_package_root_for_global() {
|
|
18588
18689
|
const here = resolvePath(_HERE2);
|
|
18589
|
-
const candidate =
|
|
18590
|
-
if (!pathExists(
|
|
18690
|
+
const candidate = path14.dirname(path14.dirname(path14.dirname(here)));
|
|
18691
|
+
if (!pathExists(path14.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
|
|
18591
18692
|
fail(
|
|
18592
18693
|
`Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
|
|
18593
18694
|
);
|
|
18594
18695
|
}
|
|
18595
18696
|
return candidate;
|
|
18596
18697
|
}
|
|
18597
|
-
var CONSUMER_BRIDGE_MARKER_RELPATH =
|
|
18698
|
+
var CONSUMER_BRIDGE_MARKER_RELPATH = path14.join("agents", ".event4u-bridge.yml");
|
|
18598
18699
|
var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
18599
18700
|
var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
|
|
18600
18701
|
var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
|
|
@@ -18602,7 +18703,7 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
18602
18703
|
if (process3.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
|
|
18603
18704
|
return [false, "consumer-mode-override"];
|
|
18604
18705
|
}
|
|
18605
|
-
const pkg_json =
|
|
18706
|
+
const pkg_json = path14.join(project_root, "package.json");
|
|
18606
18707
|
if (isFile(pkg_json)) {
|
|
18607
18708
|
let data = {};
|
|
18608
18709
|
try {
|
|
@@ -18614,18 +18715,18 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
18614
18715
|
return [true, "package.json:name"];
|
|
18615
18716
|
}
|
|
18616
18717
|
}
|
|
18617
|
-
if (isDir(
|
|
18718
|
+
if (isDir(path14.join(project_root, ".agent-src.uncondensed"))) {
|
|
18618
18719
|
return [true, ".agent-src.uncondensed/"];
|
|
18619
18720
|
}
|
|
18620
|
-
const packages_dir =
|
|
18721
|
+
const packages_dir = path14.join(project_root, "packages");
|
|
18621
18722
|
if (isDir(packages_dir)) {
|
|
18622
|
-
for (const child of
|
|
18623
|
-
if (isDir(
|
|
18723
|
+
for (const child of fs16.readdirSync(packages_dir)) {
|
|
18724
|
+
if (isDir(path14.join(packages_dir, child, ".agent-src.uncondensed"))) {
|
|
18624
18725
|
return [true, `packages/${child}/.agent-src.uncondensed/`];
|
|
18625
18726
|
}
|
|
18626
18727
|
}
|
|
18627
18728
|
}
|
|
18628
|
-
const installer_self =
|
|
18729
|
+
const installer_self = path14.join(project_root, "scripts", "install.py");
|
|
18629
18730
|
try {
|
|
18630
18731
|
if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE2)) {
|
|
18631
18732
|
return [true, "src/scripts/install.py (self)"];
|
|
@@ -18645,17 +18746,17 @@ function _detect_legacy_for_migration(project_root) {
|
|
|
18645
18746
|
}
|
|
18646
18747
|
return [];
|
|
18647
18748
|
}
|
|
18648
|
-
if (isFile(
|
|
18749
|
+
if (isFile(path14.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
|
|
18649
18750
|
const found = [];
|
|
18650
18751
|
for (const name of MIGRATE_LEGACY_YAML_FILES) {
|
|
18651
|
-
if (isFile(
|
|
18752
|
+
if (isFile(path14.join(project_root, name))) {
|
|
18652
18753
|
found.push(name);
|
|
18653
|
-
} else if (isFile(
|
|
18754
|
+
} else if (isFile(path14.join(project_root, "settings", name))) {
|
|
18654
18755
|
found.push(`settings/${name}`);
|
|
18655
18756
|
}
|
|
18656
18757
|
}
|
|
18657
18758
|
for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
|
|
18658
|
-
const p =
|
|
18759
|
+
const p = path14.join(project_root, name);
|
|
18659
18760
|
if (isDir(p) && !isSymlink(p)) {
|
|
18660
18761
|
found.push(`${name}/`);
|
|
18661
18762
|
}
|
|
@@ -18667,7 +18768,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
|
|
|
18667
18768
|
process3.stdout.write("\n");
|
|
18668
18769
|
warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
|
|
18669
18770
|
for (const rel of artefacts) {
|
|
18670
|
-
info(` ${
|
|
18771
|
+
info(` ${path14.join(project_root, rel)}`);
|
|
18671
18772
|
}
|
|
18672
18773
|
info("The unified `agent-config migrate` sweeps these in one pass.");
|
|
18673
18774
|
info("The wizard recreates fresh config afterwards.");
|
|
@@ -18698,20 +18799,20 @@ function _run_migrate_to_global(project_root) {
|
|
|
18698
18799
|
function _format_global_root_for_marker(global_root) {
|
|
18699
18800
|
const home = resolvePath(os7.homedir());
|
|
18700
18801
|
const resolved = resolvePath(global_root);
|
|
18701
|
-
const rel =
|
|
18702
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
18802
|
+
const rel = path14.relative(home, resolved);
|
|
18803
|
+
if (rel === "" || rel.startsWith("..") || path14.isAbsolute(rel)) {
|
|
18703
18804
|
return global_root;
|
|
18704
18805
|
}
|
|
18705
|
-
return `~/${rel.split(
|
|
18806
|
+
return `~/${rel.split(path14.sep).join("/")}`;
|
|
18706
18807
|
}
|
|
18707
18808
|
function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
|
|
18708
18809
|
const env_map = env ?? process3.env;
|
|
18709
18810
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
|
|
18710
|
-
if (isDir(
|
|
18711
|
-
const target =
|
|
18811
|
+
if (isDir(path14.join(project_root, ".agent-src.uncondensed"))) return null;
|
|
18812
|
+
const target = path14.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
|
|
18712
18813
|
if (!isFile(target)) return null;
|
|
18713
18814
|
try {
|
|
18714
|
-
|
|
18815
|
+
fs16.rmSync(target);
|
|
18715
18816
|
} catch {
|
|
18716
18817
|
return null;
|
|
18717
18818
|
}
|
|
@@ -18725,7 +18826,7 @@ var PROJECT_ANCHOR_TOOLS = {
|
|
|
18725
18826
|
function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
|
|
18726
18827
|
const env_map = env ?? process3.env;
|
|
18727
18828
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
|
|
18728
|
-
if (isDir(
|
|
18829
|
+
if (isDir(path14.join(project_root, ".agent-src.uncondensed"))) return [];
|
|
18729
18830
|
const global_root_str = _format_global_root_for_marker(
|
|
18730
18831
|
event4u_root(env_map)
|
|
18731
18832
|
);
|
|
@@ -18734,8 +18835,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
|
|
|
18734
18835
|
for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
|
|
18735
18836
|
const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
|
|
18736
18837
|
if (!tools.has(tool_id)) continue;
|
|
18737
|
-
const target =
|
|
18738
|
-
mkdirp(
|
|
18838
|
+
const target = path14.join(project_root, rel_path);
|
|
18839
|
+
mkdirp(path14.dirname(target));
|
|
18739
18840
|
const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
|
|
18740
18841
|
# Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
|
|
18741
18842
|
# Tool: ${tool_id}. Resolves the global install directly \u2014 no
|
|
@@ -18753,7 +18854,7 @@ installed_at: ${stamp}
|
|
|
18753
18854
|
}
|
|
18754
18855
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
18755
18856
|
function _inject_package_tag(target, source, package_root) {
|
|
18756
|
-
if (
|
|
18857
|
+
if (path14.extname(target) !== ".md") return;
|
|
18757
18858
|
let text;
|
|
18758
18859
|
try {
|
|
18759
18860
|
text = readText(target);
|
|
@@ -18781,8 +18882,8 @@ function _inject_package_tag(target, source, package_root) {
|
|
|
18781
18882
|
resolved_src = source;
|
|
18782
18883
|
}
|
|
18783
18884
|
if (package_root !== null) {
|
|
18784
|
-
const rel =
|
|
18785
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
18885
|
+
const rel = path14.relative(resolvePath(package_root), resolved_src);
|
|
18886
|
+
if (rel !== "" && !rel.startsWith("..") && !path14.isAbsolute(rel)) {
|
|
18786
18887
|
source_value = rel;
|
|
18787
18888
|
} else {
|
|
18788
18889
|
source_value = resolved_src;
|
|
@@ -18813,16 +18914,37 @@ function _inject_package_tag(target, source, package_root) {
|
|
|
18813
18914
|
writeText(target, new_text);
|
|
18814
18915
|
}
|
|
18815
18916
|
}
|
|
18816
|
-
function
|
|
18917
|
+
function _escapes_package_root(resolved, package_root) {
|
|
18918
|
+
if (package_root === null) return false;
|
|
18919
|
+
let root;
|
|
18920
|
+
try {
|
|
18921
|
+
root = fs16.realpathSync(package_root);
|
|
18922
|
+
} catch {
|
|
18923
|
+
return false;
|
|
18924
|
+
}
|
|
18925
|
+
return !is_ancestor(root, resolved);
|
|
18926
|
+
}
|
|
18927
|
+
function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null, file_filter = null) {
|
|
18817
18928
|
let written = 0;
|
|
18818
18929
|
let skipped = 0;
|
|
18819
18930
|
const written_paths = [];
|
|
18820
18931
|
if (!pathExists(src)) return [0, 0, written_paths];
|
|
18821
18932
|
if (!isDir(src)) {
|
|
18822
|
-
|
|
18933
|
+
if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
|
|
18934
|
+
let resolved_src = src;
|
|
18935
|
+
try {
|
|
18936
|
+
resolved_src = fs16.realpathSync(src);
|
|
18937
|
+
} catch {
|
|
18938
|
+
resolved_src = src;
|
|
18939
|
+
}
|
|
18940
|
+
if (_escapes_package_root(resolved_src, package_root)) {
|
|
18941
|
+
warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
|
|
18942
|
+
return [0, 0, written_paths];
|
|
18943
|
+
}
|
|
18944
|
+
mkdirp(path14.dirname(dest));
|
|
18823
18945
|
const decision = _resolve_file_conflict(dest, force);
|
|
18824
18946
|
if (decision === "skip") return [0, 1, written_paths];
|
|
18825
|
-
|
|
18947
|
+
fs16.copyFileSync(src, dest);
|
|
18826
18948
|
_inject_package_tag(dest, src, package_root);
|
|
18827
18949
|
written_paths.push(dest);
|
|
18828
18950
|
return [1, 0, written_paths];
|
|
@@ -18830,11 +18952,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
|
|
|
18830
18952
|
mkdirp(dest);
|
|
18831
18953
|
const walk = (node) => {
|
|
18832
18954
|
const acc = [];
|
|
18833
|
-
const names =
|
|
18955
|
+
const names = fs16.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
18834
18956
|
for (const name of names) {
|
|
18835
|
-
const entry =
|
|
18957
|
+
const entry = path14.join(node, name);
|
|
18836
18958
|
acc.push(entry);
|
|
18837
|
-
const lst =
|
|
18959
|
+
const lst = fs16.lstatSync(entry);
|
|
18838
18960
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
18839
18961
|
acc.push(...walk(entry));
|
|
18840
18962
|
}
|
|
@@ -18842,9 +18964,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
|
|
|
18842
18964
|
return acc;
|
|
18843
18965
|
};
|
|
18844
18966
|
for (const entry of walk(src)) {
|
|
18845
|
-
const rel =
|
|
18846
|
-
const target =
|
|
18847
|
-
const lst =
|
|
18967
|
+
const rel = path14.relative(src, entry);
|
|
18968
|
+
const target = path14.join(dest, rel);
|
|
18969
|
+
const lst = fs16.lstatSync(entry);
|
|
18848
18970
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
18849
18971
|
mkdirp(target);
|
|
18850
18972
|
continue;
|
|
@@ -18852,31 +18974,39 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
|
|
|
18852
18974
|
let resolvedIsDir = false;
|
|
18853
18975
|
let resolved = entry;
|
|
18854
18976
|
try {
|
|
18855
|
-
resolved =
|
|
18856
|
-
resolvedIsDir =
|
|
18977
|
+
resolved = fs16.realpathSync(entry);
|
|
18978
|
+
resolvedIsDir = fs16.statSync(entry).isDirectory();
|
|
18857
18979
|
} catch {
|
|
18858
18980
|
resolvedIsDir = false;
|
|
18859
18981
|
}
|
|
18982
|
+
if (_escapes_package_root(resolved, package_root)) {
|
|
18983
|
+
warn(`refused: ${entry} dereferences outside the package root \u2014 not copied`);
|
|
18984
|
+
continue;
|
|
18985
|
+
}
|
|
18860
18986
|
if (resolvedIsDir) {
|
|
18861
18987
|
mkdirp(target);
|
|
18862
18988
|
const [sub_w, sub_s, sub_p] = _copy_dir_dereferencing_symlinks(
|
|
18863
18989
|
resolved,
|
|
18864
18990
|
target,
|
|
18865
18991
|
force,
|
|
18866
|
-
package_root
|
|
18992
|
+
package_root,
|
|
18993
|
+
file_filter
|
|
18867
18994
|
);
|
|
18868
18995
|
written += sub_w;
|
|
18869
18996
|
skipped += sub_s;
|
|
18870
18997
|
written_paths.push(...sub_p);
|
|
18871
18998
|
continue;
|
|
18872
18999
|
}
|
|
19000
|
+
if (file_filter !== null && !file_filter(entry)) {
|
|
19001
|
+
continue;
|
|
19002
|
+
}
|
|
18873
19003
|
const decision = _resolve_file_conflict(target, force);
|
|
18874
19004
|
if (decision === "skip") {
|
|
18875
19005
|
skipped += 1;
|
|
18876
19006
|
continue;
|
|
18877
19007
|
}
|
|
18878
|
-
mkdirp(
|
|
18879
|
-
|
|
19008
|
+
mkdirp(path14.dirname(target));
|
|
19009
|
+
fs16.copyFileSync(resolved, target);
|
|
18880
19010
|
_inject_package_tag(target, resolved, package_root);
|
|
18881
19011
|
written += 1;
|
|
18882
19012
|
written_paths.push(target);
|
|
@@ -18888,7 +19018,7 @@ function _claude_desktop_bundles_dir() {
|
|
|
18888
19018
|
}
|
|
18889
19019
|
function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
|
|
18890
19020
|
const anchor = expanduser6(USER_SCOPE_PATHS["claude-desktop"]);
|
|
18891
|
-
const target =
|
|
19021
|
+
const target = path14.join(anchor, "agent-config.md");
|
|
18892
19022
|
mkdirp(anchor);
|
|
18893
19023
|
const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
|
|
18894
19024
|
writeText(target, body);
|
|
@@ -18912,23 +19042,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
18912
19042
|
const wrapped = [];
|
|
18913
19043
|
const collisions = [];
|
|
18914
19044
|
const reserved = [];
|
|
18915
|
-
const commands_dir =
|
|
19045
|
+
const commands_dir = path14.join(anchor, "commands");
|
|
18916
19046
|
let flat_entries = [];
|
|
18917
19047
|
try {
|
|
18918
|
-
flat_entries =
|
|
19048
|
+
flat_entries = fs16.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
|
|
18919
19049
|
} catch {
|
|
18920
19050
|
}
|
|
18921
19051
|
for (const fname of flat_entries.sort()) {
|
|
18922
19052
|
const slug = fname.slice(0, -".md".length);
|
|
18923
19053
|
if (!is_claude_builtin_name(slug)) continue;
|
|
18924
|
-
|
|
19054
|
+
fs16.rmSync(path14.join(commands_dir, fname), { force: true });
|
|
18925
19055
|
current_files.delete(`commands/${fname}`);
|
|
18926
19056
|
reserved.push(slug);
|
|
18927
19057
|
}
|
|
18928
19058
|
const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
|
|
18929
19059
|
try {
|
|
18930
19060
|
const manifest = JSON.parse(
|
|
18931
|
-
|
|
19061
|
+
fs16.readFileSync(path14.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
|
|
18932
19062
|
);
|
|
18933
19063
|
for (const a of manifest.artefacts ?? []) {
|
|
18934
19064
|
if (a.category !== "command" || typeof a.slug !== "string") continue;
|
|
@@ -18939,22 +19069,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
18939
19069
|
}
|
|
18940
19070
|
for (const slug of [...eligible].sort()) {
|
|
18941
19071
|
const flat_rel = `commands/${slug}.md`;
|
|
18942
|
-
const flat_abs =
|
|
18943
|
-
if (!
|
|
18944
|
-
const skill_dir =
|
|
18945
|
-
if (
|
|
19072
|
+
const flat_abs = path14.join(anchor, "commands", `${slug}.md`);
|
|
19073
|
+
if (!fs16.existsSync(flat_abs)) continue;
|
|
19074
|
+
const skill_dir = path14.join(anchor, "skills", slug);
|
|
19075
|
+
if (fs16.existsSync(skill_dir)) {
|
|
18946
19076
|
collisions.push(slug);
|
|
18947
19077
|
continue;
|
|
18948
19078
|
}
|
|
18949
|
-
let body =
|
|
19079
|
+
let body = fs16.readFileSync(flat_abs, "utf8");
|
|
18950
19080
|
if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
|
|
18951
19081
|
body = body.replace("---\n", `---
|
|
18952
19082
|
name: ${slug}
|
|
18953
19083
|
`);
|
|
18954
19084
|
}
|
|
18955
|
-
|
|
18956
|
-
|
|
18957
|
-
|
|
19085
|
+
fs16.mkdirSync(skill_dir, { recursive: true });
|
|
19086
|
+
fs16.writeFileSync(path14.join(skill_dir, "SKILL.md"), body, "utf8");
|
|
19087
|
+
fs16.rmSync(flat_abs, { force: true });
|
|
18958
19088
|
current_files.delete(flat_rel);
|
|
18959
19089
|
current_files.add(`skills/${slug}/SKILL.md`);
|
|
18960
19090
|
wrapped.push(slug);
|
|
@@ -18963,6 +19093,7 @@ name: ${slug}
|
|
|
18963
19093
|
}
|
|
18964
19094
|
function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
18965
19095
|
const results = {};
|
|
19096
|
+
const rule_scope = _resolve_global_rule_scope(package_root);
|
|
18966
19097
|
for (const tool_id of [...tools].sort()) {
|
|
18967
19098
|
if (tool_id === "claude-desktop") {
|
|
18968
19099
|
results[tool_id] = _deploy_claude_desktop(force, package_root, lockfile_path2);
|
|
@@ -18985,15 +19116,26 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
18985
19116
|
const written_paths = [];
|
|
18986
19117
|
let current_files = /* @__PURE__ */ new Set();
|
|
18987
19118
|
for (const [src_rel, dest_sub] of plan) {
|
|
18988
|
-
const src =
|
|
18989
|
-
const dest = dest_sub ?
|
|
18990
|
-
const
|
|
19119
|
+
const src = path14.join(package_root, src_rel);
|
|
19120
|
+
const dest = dest_sub ? path14.join(anchor, dest_sub) : anchor;
|
|
19121
|
+
const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
|
|
19122
|
+
const [w, s, paths] = _copy_dir_dereferencing_symlinks(
|
|
19123
|
+
src,
|
|
19124
|
+
dest,
|
|
19125
|
+
force,
|
|
19126
|
+
package_root,
|
|
19127
|
+
rule_filter
|
|
19128
|
+
);
|
|
18991
19129
|
written_total += w;
|
|
18992
19130
|
skipped_total += s;
|
|
18993
19131
|
written_paths.push(...paths);
|
|
18994
19132
|
current_files = setUnion(
|
|
18995
19133
|
current_files,
|
|
18996
|
-
expected_deploy_files(
|
|
19134
|
+
expected_deploy_files(
|
|
19135
|
+
src,
|
|
19136
|
+
dest_sub ? dest_sub : "",
|
|
19137
|
+
rule_filter
|
|
19138
|
+
)
|
|
18997
19139
|
);
|
|
18998
19140
|
}
|
|
18999
19141
|
if (tool_id === "claude-code") {
|
|
@@ -19049,10 +19191,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
19049
19191
|
results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
|
|
19050
19192
|
if (tool_id === "claude-code") {
|
|
19051
19193
|
try {
|
|
19052
|
-
const manifest =
|
|
19194
|
+
const manifest = path14.join(package_root, "src", "scripts", "hook_manifest.yaml");
|
|
19053
19195
|
const matrix = build_claude_hook_matrix(manifest);
|
|
19054
19196
|
const res = ensure_managed_hooks(
|
|
19055
|
-
|
|
19197
|
+
path14.join(anchor, "settings.json"),
|
|
19056
19198
|
matrix
|
|
19057
19199
|
);
|
|
19058
19200
|
if (!state.QUIET) {
|
|
@@ -19080,6 +19222,7 @@ function setUnion(a, b) {
|
|
|
19080
19222
|
function _preview_global_reap(tools, package_root) {
|
|
19081
19223
|
const inventory = load_inventory();
|
|
19082
19224
|
const preview = {};
|
|
19225
|
+
const rule_scope = _resolve_global_rule_scope(package_root);
|
|
19083
19226
|
for (const tool_id of [...tools].sort()) {
|
|
19084
19227
|
const plan = GLOBAL_DEPLOY_SOURCES[tool_id];
|
|
19085
19228
|
if (plan === void 0) continue;
|
|
@@ -19088,10 +19231,14 @@ function _preview_global_reap(tools, package_root) {
|
|
|
19088
19231
|
const anchor = expanduser6(anchor_raw);
|
|
19089
19232
|
let current_files = /* @__PURE__ */ new Set();
|
|
19090
19233
|
for (const [src_rel, dest_sub] of plan) {
|
|
19091
|
-
const src =
|
|
19234
|
+
const src = path14.join(package_root, src_rel);
|
|
19092
19235
|
current_files = setUnion(
|
|
19093
19236
|
current_files,
|
|
19094
|
-
expected_deploy_files(
|
|
19237
|
+
expected_deploy_files(
|
|
19238
|
+
src,
|
|
19239
|
+
dest_sub ? dest_sub : "",
|
|
19240
|
+
_rule_filter_for_source(src_rel, rule_scope)
|
|
19241
|
+
)
|
|
19095
19242
|
);
|
|
19096
19243
|
}
|
|
19097
19244
|
let would_reap = [];
|
|
@@ -19118,14 +19265,14 @@ function _preview_global_reap(tools, package_root) {
|
|
|
19118
19265
|
function _verify_deploy_targets(anchor, plan) {
|
|
19119
19266
|
const missing = [];
|
|
19120
19267
|
for (const [, dest_sub] of plan) {
|
|
19121
|
-
const target = dest_sub ?
|
|
19268
|
+
const target = dest_sub ? path14.join(anchor, dest_sub) : anchor;
|
|
19122
19269
|
const label = dest_sub || ".";
|
|
19123
19270
|
if (!isDir(target)) {
|
|
19124
19271
|
missing.push(label);
|
|
19125
19272
|
continue;
|
|
19126
19273
|
}
|
|
19127
19274
|
try {
|
|
19128
|
-
const entries =
|
|
19275
|
+
const entries = fs16.readdirSync(target);
|
|
19129
19276
|
if (entries.length === 0) missing.push(label);
|
|
19130
19277
|
} catch {
|
|
19131
19278
|
missing.push(label);
|
|
@@ -19140,13 +19287,13 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
19140
19287
|
const [written, skipped, status, paths] = deploy_results[tool_id];
|
|
19141
19288
|
const pruned_skill_dirs = /* @__PURE__ */ new Set();
|
|
19142
19289
|
for (const p of paths) {
|
|
19143
|
-
const parts = p.split(
|
|
19290
|
+
const parts = p.split(path14.sep);
|
|
19144
19291
|
if (parts.includes("skills")) {
|
|
19145
19292
|
const i = parts.indexOf("skills");
|
|
19146
19293
|
if (i + 1 < parts.length) {
|
|
19147
|
-
const skill_root = parts.slice(0, i + 2).join(
|
|
19294
|
+
const skill_root = parts.slice(0, i + 2).join(path14.sep);
|
|
19148
19295
|
if (!pruned_skill_dirs.has(skill_root)) {
|
|
19149
|
-
const skillmd =
|
|
19296
|
+
const skillmd = path14.join(skill_root, "SKILL.md");
|
|
19150
19297
|
if (pathExists(skillmd) && is_pruned(skillmd)) {
|
|
19151
19298
|
pruned_skill_dirs.add(skill_root);
|
|
19152
19299
|
}
|
|
@@ -19157,25 +19304,25 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
19157
19304
|
const keep = [];
|
|
19158
19305
|
const delete_files = [];
|
|
19159
19306
|
for (const p of paths) {
|
|
19160
|
-
const parts = p.split(
|
|
19307
|
+
const parts = p.split(path14.sep);
|
|
19161
19308
|
let is_target = false;
|
|
19162
19309
|
if (parts.includes("skills")) {
|
|
19163
19310
|
const i = parts.indexOf("skills");
|
|
19164
|
-
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(
|
|
19311
|
+
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path14.sep))) {
|
|
19165
19312
|
is_target = true;
|
|
19166
19313
|
}
|
|
19167
|
-
} else if (parts.includes("commands") &&
|
|
19314
|
+
} else if (parts.includes("commands") && path14.extname(p) === ".md" && is_pruned(p)) {
|
|
19168
19315
|
is_target = true;
|
|
19169
19316
|
}
|
|
19170
19317
|
(is_target ? delete_files : keep).push(p);
|
|
19171
19318
|
}
|
|
19172
19319
|
for (const d of pruned_skill_dirs) {
|
|
19173
|
-
|
|
19320
|
+
fs16.rmSync(d, { recursive: true, force: true });
|
|
19174
19321
|
}
|
|
19175
19322
|
for (const p of delete_files) {
|
|
19176
|
-
if (p.split(
|
|
19323
|
+
if (p.split(path14.sep).includes("commands") && pathExists(p)) {
|
|
19177
19324
|
try {
|
|
19178
|
-
|
|
19325
|
+
fs16.unlinkSync(p);
|
|
19179
19326
|
} catch {
|
|
19180
19327
|
}
|
|
19181
19328
|
}
|
|
@@ -19190,7 +19337,7 @@ function _prune_lab_modules(deploy_results, lab_ids) {
|
|
|
19190
19337
|
}
|
|
19191
19338
|
var SCOPED_ACTIVE_WORKSPACES = /* @__PURE__ */ new Set(["engineering", "agent-config-maintainer"]);
|
|
19192
19339
|
function _load_packs_registry(package_root) {
|
|
19193
|
-
const vocab_path =
|
|
19340
|
+
const vocab_path = path14.join(package_root, "src", "config", "discovery", "packs.yml");
|
|
19194
19341
|
const data = yamlSafeLoad(readText(vocab_path));
|
|
19195
19342
|
if (!Array.isArray(data)) {
|
|
19196
19343
|
throw new Error(`packs.yml did not parse to a list: ${vocab_path}`);
|
|
@@ -19238,11 +19385,15 @@ function _compute_active_pack_ids(packs, runtime_active_packs) {
|
|
|
19238
19385
|
return active;
|
|
19239
19386
|
}
|
|
19240
19387
|
function _resolve_global_settings_doc() {
|
|
19388
|
+
const p = _resolve_global_settings_path();
|
|
19389
|
+
return p === null ? null : _load_yaml_doc(p);
|
|
19390
|
+
}
|
|
19391
|
+
function _resolve_global_settings_path() {
|
|
19241
19392
|
const root = event4u_root();
|
|
19242
|
-
const canonical =
|
|
19243
|
-
if (pathExists(canonical)) return
|
|
19244
|
-
const legacy =
|
|
19245
|
-
if (pathExists(legacy)) return
|
|
19393
|
+
const canonical = path14.join(root, "settings", SETTINGS_FILE);
|
|
19394
|
+
if (pathExists(canonical)) return canonical;
|
|
19395
|
+
const legacy = path14.join(root, SETTINGS_FILE);
|
|
19396
|
+
if (pathExists(legacy)) return legacy;
|
|
19246
19397
|
return null;
|
|
19247
19398
|
}
|
|
19248
19399
|
function _resolve_scoped_projection(package_root) {
|
|
@@ -19254,6 +19405,44 @@ function _resolve_scoped_projection(package_root) {
|
|
|
19254
19405
|
const active_packs = Array.isArray(active_packs_raw) ? active_packs_raw.filter((v) => typeof v === "string") : [];
|
|
19255
19406
|
return { mode, active_packs };
|
|
19256
19407
|
}
|
|
19408
|
+
function _resolve_global_rule_scope(package_root) {
|
|
19409
|
+
const settings_path = _resolve_global_settings_path();
|
|
19410
|
+
if (settings_path === null) {
|
|
19411
|
+
try {
|
|
19412
|
+
return ruleScopeFromSettings(_load_default_settings(package_root));
|
|
19413
|
+
} catch {
|
|
19414
|
+
return LEGACY_ALL;
|
|
19415
|
+
}
|
|
19416
|
+
}
|
|
19417
|
+
let text;
|
|
19418
|
+
try {
|
|
19419
|
+
text = readText(settings_path);
|
|
19420
|
+
} catch (e) {
|
|
19421
|
+
warn(
|
|
19422
|
+
`could not read ${settings_path} (${String(e)}) \u2014 rule scoping falls back to legacy-all, so ALL rules including maintainer-only ones will be installed. Fix the file to restore scoping.`
|
|
19423
|
+
);
|
|
19424
|
+
return LEGACY_ALL;
|
|
19425
|
+
}
|
|
19426
|
+
const parsed = yamlSafeLoad(text);
|
|
19427
|
+
if (!_isPlainObject2(parsed)) {
|
|
19428
|
+
warn(
|
|
19429
|
+
`${settings_path} is not a YAML mapping \u2014 rule scoping falls back to legacy-all, so ALL rules including maintainer-only ones will be installed. Fix the file to restore scoping.`
|
|
19430
|
+
);
|
|
19431
|
+
return LEGACY_ALL;
|
|
19432
|
+
}
|
|
19433
|
+
try {
|
|
19434
|
+
return ruleScopeFromSettings(parsed);
|
|
19435
|
+
} catch (e) {
|
|
19436
|
+
warn(
|
|
19437
|
+
`could not derive rule scope from ${settings_path} (${String(e)}) \u2014 falling back to legacy-all; ALL rules will be installed.`
|
|
19438
|
+
);
|
|
19439
|
+
return LEGACY_ALL;
|
|
19440
|
+
}
|
|
19441
|
+
}
|
|
19442
|
+
function _rule_filter_for_source(src_rel, scope) {
|
|
19443
|
+
if (src_rel !== RULE_SOURCE_REL) return null;
|
|
19444
|
+
return (srcFile) => ruleFileArrives(srcFile, scope);
|
|
19445
|
+
}
|
|
19257
19446
|
function _prune_scoped_modules(deploy_results, active_ids) {
|
|
19258
19447
|
return _prune_modules_by(deploy_results, (p) => {
|
|
19259
19448
|
const packs = frontmatter_packs(p);
|
|
@@ -19318,7 +19507,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
19318
19507
|
info(` schema_version=1, agent_config_version=${installed_version}`);
|
|
19319
19508
|
info(` tools=${merged_tools.join(",")}`);
|
|
19320
19509
|
}
|
|
19321
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
19510
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path14.join(project_root, ".agent-src.uncondensed"))) {
|
|
19322
19511
|
const drift = collect_drift(project_root);
|
|
19323
19512
|
if (!state.QUIET) {
|
|
19324
19513
|
process3.stdout.write("\n");
|
|
@@ -19418,19 +19607,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
19418
19607
|
}
|
|
19419
19608
|
}
|
|
19420
19609
|
}
|
|
19421
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
19610
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path14.join(project_root, ".agent-src.uncondensed"))) {
|
|
19422
19611
|
const files_by_tool = _files_by_tool_from_deploy(deploy_results);
|
|
19423
19612
|
const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
|
|
19424
19613
|
if (rc !== 0) return rc;
|
|
19425
19614
|
const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
|
|
19426
19615
|
if (removed_marker !== null && !state.QUIET) {
|
|
19427
|
-
const rel = isRelativeTo(removed_marker, project_root) ?
|
|
19616
|
+
const rel = isRelativeTo(removed_marker, project_root) ? path14.relative(project_root, removed_marker) : removed_marker;
|
|
19428
19617
|
info(`Removed legacy bridge marker: ${rel}`);
|
|
19429
19618
|
}
|
|
19430
19619
|
const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
|
|
19431
19620
|
if (anchor_paths.length > 0 && !state.QUIET) {
|
|
19432
19621
|
for (const p of anchor_paths) {
|
|
19433
|
-
const rel = isRelativeTo(p, project_root) ?
|
|
19622
|
+
const rel = isRelativeTo(p, project_root) ? path14.relative(project_root, p) : p;
|
|
19434
19623
|
info(`Project anchor written: ${rel}`);
|
|
19435
19624
|
}
|
|
19436
19625
|
}
|
|
@@ -19447,8 +19636,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
19447
19636
|
}
|
|
19448
19637
|
return 0;
|
|
19449
19638
|
}
|
|
19450
|
-
var SETTINGS_SURFACE_REL =
|
|
19451
|
-
var SETTINGS_DELTA_REL =
|
|
19639
|
+
var SETTINGS_SURFACE_REL = path14.join("state", "settings-surface.json");
|
|
19640
|
+
var SETTINGS_DELTA_REL = path14.join("state", "settings-delta.json");
|
|
19452
19641
|
function _current_settings_surface(version) {
|
|
19453
19642
|
const jsonSchema = zodToJsonSchema(settingsSchema, {
|
|
19454
19643
|
name: "AgentSettings",
|
|
@@ -19459,20 +19648,20 @@ function _current_settings_surface(version) {
|
|
|
19459
19648
|
}
|
|
19460
19649
|
function _write_settings_surface_snapshot(installed_version) {
|
|
19461
19650
|
const root = event4u_root();
|
|
19462
|
-
const surface_path =
|
|
19463
|
-
const delta_path =
|
|
19651
|
+
const surface_path = path14.join(root, SETTINGS_SURFACE_REL);
|
|
19652
|
+
const delta_path = path14.join(root, SETTINGS_DELTA_REL);
|
|
19464
19653
|
const next = _current_settings_surface(installed_version);
|
|
19465
19654
|
let previous = null;
|
|
19466
19655
|
try {
|
|
19467
|
-
const parsed = JSON.parse(
|
|
19656
|
+
const parsed = JSON.parse(fs16.readFileSync(surface_path, "utf8"));
|
|
19468
19657
|
if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
|
|
19469
19658
|
} catch {
|
|
19470
19659
|
}
|
|
19471
19660
|
if (previous !== null && previous.version !== next.version) {
|
|
19472
19661
|
const delta = computeSurfaceDelta(previous, next);
|
|
19473
19662
|
if (delta.changes.length > 0) {
|
|
19474
|
-
|
|
19475
|
-
|
|
19663
|
+
fs16.mkdirSync(path14.dirname(delta_path), { recursive: true, mode: 448 });
|
|
19664
|
+
fs16.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
|
|
19476
19665
|
`, { mode: 384 });
|
|
19477
19666
|
if (!state.QUIET) {
|
|
19478
19667
|
const counts = {};
|
|
@@ -19484,8 +19673,8 @@ function _write_settings_surface_snapshot(installed_version) {
|
|
|
19484
19673
|
}
|
|
19485
19674
|
}
|
|
19486
19675
|
}
|
|
19487
|
-
|
|
19488
|
-
|
|
19676
|
+
fs16.mkdirSync(path14.dirname(surface_path), { recursive: true, mode: 448 });
|
|
19677
|
+
fs16.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
|
|
19489
19678
|
`, { mode: 384 });
|
|
19490
19679
|
}
|
|
19491
19680
|
function arrayStrEqual(a, b) {
|
|
@@ -19697,13 +19886,13 @@ function _minimal_templates_root() {
|
|
|
19697
19886
|
const chain = [start];
|
|
19698
19887
|
let cur = start;
|
|
19699
19888
|
for (; ; ) {
|
|
19700
|
-
const parent =
|
|
19889
|
+
const parent = path14.dirname(cur);
|
|
19701
19890
|
if (parent === cur) break;
|
|
19702
19891
|
chain.push(parent);
|
|
19703
19892
|
cur = parent;
|
|
19704
19893
|
}
|
|
19705
19894
|
for (const ancestor of chain) {
|
|
19706
|
-
const candidate =
|
|
19895
|
+
const candidate = path14.join(ancestor, "src", "templates", "minimal");
|
|
19707
19896
|
if (isDir(candidate)) return candidate;
|
|
19708
19897
|
}
|
|
19709
19898
|
fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
|
|
@@ -19711,9 +19900,9 @@ function _minimal_templates_root() {
|
|
|
19711
19900
|
var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
19712
19901
|
function _write_install_mode_marker(project_root, mode) {
|
|
19713
19902
|
if (mode !== "minimal" && mode !== "full") return;
|
|
19714
|
-
const marker =
|
|
19903
|
+
const marker = path14.join(project_root, INSTALL_MODE_MARKER_REL);
|
|
19715
19904
|
try {
|
|
19716
|
-
mkdirp(
|
|
19905
|
+
mkdirp(path14.dirname(marker));
|
|
19717
19906
|
writeText(marker, `${mode}
|
|
19718
19907
|
`);
|
|
19719
19908
|
} catch {
|
|
@@ -19722,7 +19911,7 @@ function _write_install_mode_marker(project_root, mode) {
|
|
|
19722
19911
|
function install_minimal(target_root_in, force, user_type = "") {
|
|
19723
19912
|
let target_root = resolvePath(target_root_in);
|
|
19724
19913
|
mkdirp(target_root);
|
|
19725
|
-
const parent =
|
|
19914
|
+
const parent = path14.dirname(target_root);
|
|
19726
19915
|
if (parent !== target_root) {
|
|
19727
19916
|
const existing = find_project_root_with_anchor(parent);
|
|
19728
19917
|
if (existing !== null && existing[0] !== target_root) {
|
|
@@ -19733,21 +19922,21 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
19733
19922
|
}
|
|
19734
19923
|
}
|
|
19735
19924
|
const templates = _minimal_templates_root();
|
|
19736
|
-
const settings_src =
|
|
19737
|
-
const overrides_gitkeep_src =
|
|
19738
|
-
const overrides_readme_src =
|
|
19925
|
+
const settings_src = path14.join(templates, SETTINGS_FILE);
|
|
19926
|
+
const overrides_gitkeep_src = path14.join(templates, "overrides-gitkeep");
|
|
19927
|
+
const overrides_readme_src = path14.join(templates, "agents-overrides-readme.md");
|
|
19739
19928
|
if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
|
|
19740
19929
|
if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
|
|
19741
19930
|
fail(`Bundled overrides scaffold templates missing under ${templates}`);
|
|
19742
19931
|
}
|
|
19743
19932
|
info(`Minimal init \u2192 ${target_root}`);
|
|
19744
|
-
const overrides_root =
|
|
19933
|
+
const overrides_root = path14.join(target_root, "agents", "overrides");
|
|
19745
19934
|
mkdirp(overrides_root);
|
|
19746
19935
|
const gitkeep_body = readText(overrides_gitkeep_src);
|
|
19747
19936
|
for (const sub of ["rules", "skills", "commands"]) {
|
|
19748
|
-
const sub_dir =
|
|
19937
|
+
const sub_dir = path14.join(overrides_root, sub);
|
|
19749
19938
|
mkdirp(sub_dir);
|
|
19750
|
-
const gitkeep_dst =
|
|
19939
|
+
const gitkeep_dst = path14.join(sub_dir, ".gitkeep");
|
|
19751
19940
|
if (pathExists(gitkeep_dst) && !force) {
|
|
19752
19941
|
skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
|
|
19753
19942
|
} else {
|
|
@@ -19755,7 +19944,7 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
19755
19944
|
success(`Wrote agents/overrides/${sub}/.gitkeep`);
|
|
19756
19945
|
}
|
|
19757
19946
|
}
|
|
19758
|
-
const readme_dst =
|
|
19947
|
+
const readme_dst = path14.join(overrides_root, "README.md");
|
|
19759
19948
|
if (pathExists(readme_dst) && !force) {
|
|
19760
19949
|
skip("agents/overrides/README.md already exists (use --force to overwrite)");
|
|
19761
19950
|
} else {
|
|
@@ -19773,14 +19962,14 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
19773
19962
|
personal:
|
|
19774
19963
|
user_type: ${user_type}
|
|
19775
19964
|
`;
|
|
19776
|
-
mkdirp(
|
|
19965
|
+
mkdirp(path14.dirname(settings_dst));
|
|
19777
19966
|
writeText(settings_dst, body);
|
|
19778
19967
|
success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
|
|
19779
19968
|
}
|
|
19780
19969
|
}
|
|
19781
19970
|
const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
|
|
19782
19971
|
if (removed_marker !== null) {
|
|
19783
|
-
const rel = isRelativeTo(removed_marker, target_root) ?
|
|
19972
|
+
const rel = isRelativeTo(removed_marker, target_root) ? path14.relative(target_root, removed_marker) : removed_marker;
|
|
19784
19973
|
success(`Removed legacy bridge marker: ${rel}`);
|
|
19785
19974
|
}
|
|
19786
19975
|
_write_install_mode_marker(target_root, "minimal");
|
|
@@ -19854,7 +20043,7 @@ function run_interactive_init(project_root, force) {
|
|
|
19854
20043
|
);
|
|
19855
20044
|
return 0;
|
|
19856
20045
|
}
|
|
19857
|
-
const target =
|
|
20046
|
+
const target = path14.join(project_root, _LOCAL_CONFIG_FILE);
|
|
19858
20047
|
if (pathExists(target) && !force) {
|
|
19859
20048
|
warn(
|
|
19860
20049
|
`${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
|
|
@@ -19881,7 +20070,7 @@ function run_interactive_init(project_root, force) {
|
|
|
19881
20070
|
warn(`Could not write ${target}: ${String(exc)}`);
|
|
19882
20071
|
return 1;
|
|
19883
20072
|
}
|
|
19884
|
-
success(`Wrote ${
|
|
20073
|
+
success(`Wrote ${path14.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
|
|
19885
20074
|
return 0;
|
|
19886
20075
|
}
|
|
19887
20076
|
var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
|
|
@@ -19899,12 +20088,12 @@ function _wizard_should_launch(opts) {
|
|
|
19899
20088
|
return [true, ""];
|
|
19900
20089
|
}
|
|
19901
20090
|
function _wizard_cli_dist(_project_root) {
|
|
19902
|
-
const package_root =
|
|
19903
|
-
const cli =
|
|
20091
|
+
const package_root = path14.dirname(path14.dirname(path14.dirname(resolvePath(_HERE2))));
|
|
20092
|
+
const cli = path14.join(package_root, "dist", "cli", "agent-config.js");
|
|
19904
20093
|
return pathExists(cli) ? cli : null;
|
|
19905
20094
|
}
|
|
19906
20095
|
function _server_info_path() {
|
|
19907
|
-
return
|
|
20096
|
+
return path14.join(os7.homedir(), ".event4u", "agent-config", "local-server.json");
|
|
19908
20097
|
}
|
|
19909
20098
|
function _pid_is_agent_config(pid) {
|
|
19910
20099
|
let res;
|
|
@@ -19921,7 +20110,7 @@ function _pid_is_agent_config(pid) {
|
|
|
19921
20110
|
}
|
|
19922
20111
|
function unlinkMissingOk(p) {
|
|
19923
20112
|
try {
|
|
19924
|
-
|
|
20113
|
+
fs16.unlinkSync(p);
|
|
19925
20114
|
} catch {
|
|
19926
20115
|
}
|
|
19927
20116
|
}
|
|
@@ -19999,14 +20188,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
|
|
|
19999
20188
|
}
|
|
20000
20189
|
function _wizard_run_sync(cmd, env, cli) {
|
|
20001
20190
|
const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
|
|
20002
|
-
const log_path =
|
|
20191
|
+
const log_path = path14.join(
|
|
20003
20192
|
os7.tmpdir(),
|
|
20004
20193
|
`agent-config-wizard-${process3.pid}-${Date.now()}.log`
|
|
20005
20194
|
);
|
|
20006
20195
|
let child;
|
|
20007
20196
|
let log_fd = null;
|
|
20008
20197
|
try {
|
|
20009
|
-
log_fd =
|
|
20198
|
+
log_fd = fs16.openSync(log_path, "w");
|
|
20010
20199
|
child = spawn(cmd[0], cmd.slice(1), {
|
|
20011
20200
|
env,
|
|
20012
20201
|
detached: true,
|
|
@@ -20024,7 +20213,7 @@ function _wizard_run_sync(cmd, env, cli) {
|
|
|
20024
20213
|
} finally {
|
|
20025
20214
|
if (log_fd !== null) {
|
|
20026
20215
|
try {
|
|
20027
|
-
|
|
20216
|
+
fs16.closeSync(log_fd);
|
|
20028
20217
|
} catch {
|
|
20029
20218
|
}
|
|
20030
20219
|
}
|
|
@@ -20274,8 +20463,8 @@ function main2(argv) {
|
|
|
20274
20463
|
const target_root = resolvePath(
|
|
20275
20464
|
opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
|
|
20276
20465
|
);
|
|
20277
|
-
const minimal_package_root =
|
|
20278
|
-
|
|
20466
|
+
const minimal_package_root = path14.dirname(
|
|
20467
|
+
path14.dirname(path14.dirname(_minimal_templates_root()))
|
|
20279
20468
|
);
|
|
20280
20469
|
const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
|
|
20281
20470
|
return install_minimal(target_root, opts.force, validated_user_type);
|
|
@@ -20304,7 +20493,7 @@ function main2(argv) {
|
|
|
20304
20493
|
return rc2;
|
|
20305
20494
|
}
|
|
20306
20495
|
const project_root = custom_path || resolvePath(opts.project || process3.env["PROJECT_ROOT"] || process3.cwd());
|
|
20307
|
-
const is_first_run = !pathExists(
|
|
20496
|
+
const is_first_run = !pathExists(path14.join(project_root, SETTINGS_FILE));
|
|
20308
20497
|
const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
|
|
20309
20498
|
if (rc === 0 && opts.interactive) {
|
|
20310
20499
|
run_interactive_init(project_root, opts.force);
|
|
@@ -20368,16 +20557,16 @@ function _team_setup_hint_line(project_root) {
|
|
|
20368
20557
|
return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
|
|
20369
20558
|
}
|
|
20370
20559
|
function finalize_claude_model_tiers(project_root) {
|
|
20371
|
-
const claude_skills =
|
|
20372
|
-
const augment_skills =
|
|
20560
|
+
const claude_skills = path14.join(project_root, ".claude", "skills");
|
|
20561
|
+
const augment_skills = path14.join(project_root, ".augment", "skills");
|
|
20373
20562
|
if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
|
|
20374
20563
|
if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
|
|
20375
20564
|
let rendered = 0;
|
|
20376
|
-
const entries =
|
|
20565
|
+
const entries = fs16.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
20377
20566
|
for (const name of entries) {
|
|
20378
|
-
const entry =
|
|
20379
|
-
const src_dir =
|
|
20380
|
-
const src_md =
|
|
20567
|
+
const entry = path14.join(claude_skills, name);
|
|
20568
|
+
const src_dir = path14.join(augment_skills, name);
|
|
20569
|
+
const src_md = path14.join(src_dir, "SKILL.md");
|
|
20381
20570
|
let tier;
|
|
20382
20571
|
try {
|
|
20383
20572
|
tier = read_model_tier(src_md);
|
|
@@ -20386,22 +20575,22 @@ function finalize_claude_model_tiers(project_root) {
|
|
|
20386
20575
|
}
|
|
20387
20576
|
if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
|
|
20388
20577
|
if (isSymlink(entry) || isFile(entry)) {
|
|
20389
|
-
|
|
20578
|
+
fs16.unlinkSync(entry);
|
|
20390
20579
|
} else if (isDir(entry)) {
|
|
20391
|
-
|
|
20580
|
+
fs16.rmSync(entry, { recursive: true, force: true });
|
|
20392
20581
|
}
|
|
20393
20582
|
mkdirp(entry);
|
|
20394
|
-
const srcFiles =
|
|
20583
|
+
const srcFiles = fs16.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
20395
20584
|
for (const fname of srcFiles) {
|
|
20396
20585
|
if (fname === "SKILL.md") {
|
|
20397
20586
|
writeText(
|
|
20398
|
-
|
|
20587
|
+
path14.join(entry, "SKILL.md"),
|
|
20399
20588
|
render_native_model_md(readText(src_md), tier)
|
|
20400
20589
|
);
|
|
20401
20590
|
} else {
|
|
20402
|
-
|
|
20403
|
-
|
|
20404
|
-
|
|
20591
|
+
fs16.symlinkSync(
|
|
20592
|
+
path14.join("../../../.augment/skills", name, fname),
|
|
20593
|
+
path14.join(entry, fname)
|
|
20405
20594
|
);
|
|
20406
20595
|
}
|
|
20407
20596
|
}
|
|
@@ -20419,7 +20608,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
20419
20608
|
let package_type;
|
|
20420
20609
|
if (opts.package) {
|
|
20421
20610
|
package_root = resolvePath(opts.package);
|
|
20422
|
-
if (!pathExists(
|
|
20611
|
+
if (!pathExists(path14.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
20423
20612
|
fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
|
|
20424
20613
|
}
|
|
20425
20614
|
package_type = detect_package_type_for_project(project_root, package_root);
|
|
@@ -20554,9 +20743,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
20554
20743
|
function _resolvedArgv1() {
|
|
20555
20744
|
if (process3.argv[1] === void 0) return void 0;
|
|
20556
20745
|
try {
|
|
20557
|
-
return
|
|
20746
|
+
return fs16.realpathSync(path14.resolve(process3.argv[1]));
|
|
20558
20747
|
} catch {
|
|
20559
|
-
return
|
|
20748
|
+
return path14.resolve(process3.argv[1]);
|
|
20560
20749
|
}
|
|
20561
20750
|
}
|
|
20562
20751
|
var _argv1 = _resolvedArgv1();
|
|
@@ -20602,7 +20791,9 @@ export {
|
|
|
20602
20791
|
_bridge_marker,
|
|
20603
20792
|
_canonical_settings_target,
|
|
20604
20793
|
_compute_active_pack_ids,
|
|
20794
|
+
_copy_dir_dereferencing_symlinks,
|
|
20605
20795
|
_current_settings_surface,
|
|
20796
|
+
_deploy_global_content,
|
|
20606
20797
|
_detect_legacy_for_migration,
|
|
20607
20798
|
_dry_run_summary,
|
|
20608
20799
|
_files_by_tool_from_bridges,
|
|
@@ -20616,12 +20807,14 @@ export {
|
|
|
20616
20807
|
_parse_legacy_settings,
|
|
20617
20808
|
_parse_profile_ini,
|
|
20618
20809
|
_parse_tools,
|
|
20810
|
+
_preview_global_reap,
|
|
20619
20811
|
_prune_lab_modules,
|
|
20620
20812
|
_prune_modules_by,
|
|
20621
20813
|
_prune_scoped_modules,
|
|
20622
20814
|
_render_template,
|
|
20623
20815
|
_replace_template_value,
|
|
20624
20816
|
_replace_template_value_raw,
|
|
20817
|
+
_resolve_global_rule_scope,
|
|
20625
20818
|
_resolve_global_settings_doc,
|
|
20626
20819
|
_resolve_scope,
|
|
20627
20820
|
_resolve_scoped_projection,
|