@event4u/agent-config 14.6.0 → 14.8.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 +255 -145
- package/README.md +1 -1
- package/dist/agent-src/commands/analyze/inbox.md +264 -10
- package/dist/agent-src/commands/analyze.md +1 -1
- package/dist/agent-src/commands/evals/git-pr-merge.json +13 -0
- package/dist/agent-src/commands/evals/roadmap.json +17 -1
- package/dist/agent-src/commands/pr/create.md +14 -2
- package/dist/agent-src/commands/pr/merge.md +379 -0
- package/dist/agent-src/commands/roadmap/process-full.md +272 -32
- package/dist/agent-src/commands/roadmap.md +1 -1
- package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +46 -36
- package/dist/agent-src/contexts/execution/autonomy-mechanics.md +37 -2
- package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +95 -2
- package/dist/agent-src/contexts/execution/roadmap-process-loop.md +289 -106
- package/dist/agent-src/rules/artifact-drafting-protocol.md +5 -1
- package/dist/agent-src/rules/context-hygiene.md +2 -0
- package/dist/agent-src/rules/decision-revisit-gate.md +67 -32
- package/dist/agent-src/rules/fix-what-you-see.md +108 -0
- package/dist/agent-src/rules/no-roadmap-references.md +0 -5
- package/dist/agent-src/rules/recurring-criticism.md +110 -0
- package/dist/agent-src/rules/roadmap-progress-sync.md +20 -1
- package/dist/agent-src/rules/rule-type-governance.md +0 -2
- package/dist/agent-src/rules/self-repair-loop.md +17 -0
- package/dist/agent-src/rules/skill-quality.md +0 -2
- package/dist/agent-src/rules/source-confidentiality.md +37 -7
- package/dist/agent-src/scripts/archival_sweep.ts +117 -0
- package/dist/agent-src/scripts/archive_completed_roadmaps.ts +26 -7
- package/dist/agent-src/scripts/dashboard_mode.ts +212 -0
- package/dist/agent-src/scripts/gate_budget.ts +282 -0
- package/dist/agent-src/scripts/gate_execute.ts +72 -31
- package/dist/agent-src/scripts/roadmap_gates.ts +74 -3
- package/dist/agent-src/scripts/update_roadmap_progress.ts +296 -53
- package/dist/agent-src/skills/adr-create/SKILL.md +124 -5
- package/dist/agent-src/skills/ai-council/SKILL.md +48 -807
- package/dist/agent-src/skills/ai-council/references/advanced-modes.md +320 -0
- package/dist/agent-src/skills/ai-council/references/cost-and-redaction.md +99 -0
- package/dist/agent-src/skills/ai-council/references/execution-modes.md +162 -0
- package/dist/agent-src/skills/ai-council/references/output-and-synthesis.md +125 -0
- package/dist/agent-src/skills/ai-council/references/procedure.md +143 -0
- package/dist/agent-src/skills/decision-record/SKILL.md +61 -3
- package/dist/agent-src/skills/decision-review/SKILL.md +65 -0
- package/dist/agent-src/skills/merge-conflicts/SKILL.md +26 -0
- package/dist/agent-src/skills/quality-tools/SKILL.md +34 -326
- package/dist/agent-src/skills/quality-tools/references/js-ts-tools.md +113 -0
- package/dist/agent-src/skills/quality-tools/references/php-tools.md +222 -0
- package/dist/agent-src/skills/roadmap-management/SKILL.md +15 -409
- package/dist/agent-src/skills/roadmap-management/references/archival.md +226 -0
- package/dist/agent-src/skills/roadmap-management/references/authoring.md +107 -0
- package/dist/agent-src/skills/roadmap-management/references/dashboard.md +47 -0
- package/dist/agent-src/skills/roadmap-management/references/lifecycle.md +58 -0
- package/dist/agent-src/skills/security/SKILL.md +8 -0
- package/dist/agent-src/skills/security-audit/SKILL.md +12 -1
- package/dist/agent-src/skills/skill-writing/SKILL.md +34 -570
- package/dist/agent-src/skills/skill-writing/references/procedure.md +275 -0
- package/dist/agent-src/skills/skill-writing/references/read-only-scripts.md +18 -0
- package/dist/agent-src/skills/skill-writing/references/section-patterns.md +298 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +65 -4
- package/dist/agent-src/templates/scripts/telemetry/flush_sender.mjs +163 -0
- package/dist/agent-src/templates/scripts/telemetry/remote.ts +160 -7
- package/dist/agent-src/templates/scripts/telemetry/transport.ts +169 -0
- package/dist/cli/registry.js +2 -1
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/chunk-2GNWGMAL.js +172 -0
- package/dist/cli-delegate/{chunk-P6LQDIWK.js → chunk-7PRE6ZV2.js} +338 -0
- package/dist/cli-delegate/{chunk-BKO2AZ7Z.js → chunk-B2ERU2VA.js} +1 -1
- package/dist/cli-delegate/chunk-E4XIZDIB.js +402 -0
- package/dist/cli-delegate/{chunk-3UCJWMMP.js → chunk-EEJUMCDZ.js} +16 -16
- package/dist/cli-delegate/{chunk-NXFWFAYV.js → chunk-G23AT6GD.js} +1 -0
- package/dist/cli-delegate/{chunk-XURJ4AQC.js → chunk-H4VIVD4C.js} +385 -284
- package/dist/cli-delegate/chunk-I3EIN2YG.js +36 -0
- package/dist/cli-delegate/{chunk-RLN73PR5.js → chunk-LPPWO5CE.js} +12 -8
- package/dist/cli-delegate/chunk-MWRD5YOH.js +100 -0
- package/dist/cli-delegate/{chunk-UEZ7D35A.js → chunk-N7CDDGI3.js} +4 -23
- package/dist/cli-delegate/{chunk-63WSP6YZ.js → chunk-PMEKGDED.js} +74 -167
- package/dist/cli-delegate/{chunk-GRRPEPRN.js → chunk-T7L2QK3K.js} +24 -5
- package/dist/cli-delegate/{chunk-EVTY7ISR.js → chunk-YM4GZDJG.js} +9 -1
- package/dist/cli-delegate/cmd_adr_effective.js +1162 -0
- package/dist/cli-delegate/cmd_conformance.js +466 -716
- package/dist/cli-delegate/cmd_converge.js +3 -3
- package/dist/cli-delegate/cmd_doctor.js +10 -10
- package/dist/cli-delegate/cmd_explain.js +1 -1
- package/dist/cli-delegate/cmd_export.js +10 -9
- package/dist/cli-delegate/cmd_handoff.js +10 -9
- package/dist/cli-delegate/cmd_memory_get.js +2 -1
- package/dist/cli-delegate/cmd_migrate.js +2 -2
- package/dist/cli-delegate/cmd_packs_active.js +1 -1
- package/dist/cli-delegate/cmd_preflight.js +5 -5
- package/dist/cli-delegate/cmd_prune.js +11 -10
- package/dist/cli-delegate/cmd_route_audit.js +6 -5
- package/dist/cli-delegate/cmd_route_explain.js +3 -3
- package/dist/cli-delegate/cmd_session_recycle.js +840 -30
- package/dist/cli-delegate/cmd_settings_get.js +3 -3
- package/dist/cli-delegate/cmd_settings_migrate.js +10 -9
- package/dist/cli-delegate/cmd_settings_set.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +11 -10
- package/dist/cli-delegate/cmd_uninstall.js +13 -11
- package/dist/cli-delegate/cmd_update.js +4 -4
- package/dist/cli-delegate/cmd_upgrade.js +4 -4
- package/dist/cli-delegate/cmd_validate.js +11 -10
- package/dist/cli-delegate/cmd_versions.js +3 -3
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +111 -37
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +5 -5
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +15 -12
- package/dist/discovery/trust-report.md +3 -3
- package/dist/discovery/workspaces.json +11 -8
- package/dist/hooks/dispatch.js +3165 -2192
- package/dist/install/claudePathsPlan.js +187 -0
- package/dist/install/claudePathsPlan.js.map +1 -0
- package/dist/install/globalRuleLayers.js +169 -0
- package/dist/install/globalRuleLayers.js.map +1 -0
- package/dist/install/hostLayerFingerprint.js +136 -0
- package/dist/install/hostLayerFingerprint.js.map +1 -0
- package/dist/install/install.mjs +553 -425
- package/dist/install/partitionEligibility.js +432 -0
- package/dist/install/partitionEligibility.js.map +1 -0
- package/dist/install/ruleLayerPartition.js +157 -0
- package/dist/install/ruleLayerPartition.js.map +1 -0
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +1863 -1234
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/agent_src.js +41 -0
- package/dist/scripts/_lib/agent_src.js.map +1 -1
- package/dist/scripts/_lib/install_layout.js +83 -0
- package/dist/scripts/_lib/install_layout.js.map +1 -0
- package/dist/scripts/_lib/installed_lock.js +444 -0
- package/dist/scripts/_lib/installed_lock.js.map +1 -0
- package/dist/scripts/_lib/prune_empty_dirs.js +85 -0
- package/dist/scripts/_lib/prune_empty_dirs.js.map +1 -0
- package/dist/scripts/condense.js +63 -251
- package/dist/scripts/condense.js.map +1 -1
- package/dist/server/schemas/settings.js +4 -0
- package/dist/server/schemas/settings.js.map +1 -1
- package/docs/contracts/settings-classes.md +12 -6
- package/docs/guidelines/agent-infra/agent-interaction-and-decision-quality.md +8 -3
- package/docs/guidelines/agent-infra/artifact-drafting-protocol-mechanics.md +45 -1
- package/docs/guidelines/agent-infra/context-hygiene-mechanics.md +26 -0
- package/docs/guidelines/agent-infra/false-green.md +47 -1
- package/docs/guidelines/agent-infra/memory-access.md +17 -0
- package/docs/guidelines/agent-infra/recurring-criticism-mechanics.md +96 -0
- package/package.json +1 -1
- package/src/agent-src/scripts/archival_sweep.ts +117 -0
- package/src/agent-src/scripts/archive_completed_roadmaps.ts +26 -7
- package/src/agent-src/scripts/dashboard_mode.ts +212 -0
- package/src/agent-src/scripts/gate_budget.ts +282 -0
- package/src/agent-src/scripts/gate_execute.ts +72 -31
- package/src/agent-src/scripts/roadmap_gates.ts +74 -3
- package/src/agent-src/scripts/update_roadmap_progress.ts +296 -53
- package/src/agent-src/templates/scripts/telemetry/flush_sender.mjs +163 -0
- package/src/agent-src/templates/scripts/telemetry/remote.ts +160 -7
- package/src/agent-src/templates/scripts/telemetry/transport.ts +169 -0
- package/src/config/agent-settings.template.yml +27 -2
- package/src/config/ci-local-parity.yml +39 -0
- package/src/config/estate-count-budget.json +612 -3
- package/src/config/evaluator-budgets.json +3 -3
- package/src/config/gate-coverage.yml +220 -12
- package/src/config/gate-violation-baselines.json +73 -63
- package/src/config/gitignore-block.txt +15 -2
- package/src/config/hook-latency-budget.json +5 -0
- package/src/config/rule-activation-census.json +14 -6
- package/src/config/rule-stub-ceilings.json +34 -7
- package/src/install/claudePathsPlan.ts +196 -0
- package/src/install/globalRuleLayers.ts +197 -0
- package/src/install/hostLayerFingerprint.ts +145 -0
- package/src/install/partitionEligibility.ts +502 -0
- package/src/install/ruleLayerPartition.ts +212 -0
- package/src/scripts/_cli/cmd_adr_effective.ts +484 -0
- package/src/scripts/_cli/cmd_session_recycle.ts +9 -1
- package/src/scripts/_dispatch.bash +17 -1
- package/src/scripts/_lib/ac_heading.ts +30 -0
- package/src/scripts/_lib/adr_frontmatter.test.ts +365 -0
- package/src/scripts/_lib/adr_frontmatter.ts +459 -0
- package/src/scripts/_lib/agent_src.ts +42 -0
- package/src/scripts/_lib/bench_ab_pinned_repo.ts +162 -0
- package/src/scripts/_lib/bench_ab_workspace.ts +10 -1
- package/src/scripts/_lib/envelope_grounding.ts +49 -9
- package/src/scripts/_lib/installed_lock.ts +50 -5
- package/src/scripts/_lib/layer_overlap_notice.ts +11 -2
- package/src/scripts/_lib/md_section.ts +129 -0
- package/src/scripts/_lib/prune_empty_dirs.ts +80 -0
- package/src/scripts/_lib/scope_guard.sh +26 -3
- package/src/scripts/_lib/self_repair.ts +19 -0
- package/src/scripts/_lib/self_repair_class_b.ts +171 -0
- package/src/scripts/adr/evidence_census.ts +899 -0
- package/src/scripts/adr/regenerate_index.ts +12 -32
- package/src/scripts/adr_cite_check.ts +540 -39
- package/src/scripts/ai_council/cli_help.ts +55 -0
- package/src/scripts/audit_adr_coverage.ts +103 -17
- package/src/scripts/before_complete_hook.ts +153 -28
- package/src/scripts/bench_ab_v2_complexity.ts +27 -7
- package/src/scripts/bench_hook_latency.ts +204 -0
- package/src/scripts/build_archive_index.ts +34 -0
- package/src/scripts/check_adr_frontmatter.ts +574 -39
- package/src/scripts/check_hook_bundle_content.ts +219 -0
- package/src/scripts/check_new_adr_evidence.ts +529 -0
- package/src/scripts/check_references.ts +78 -0
- package/src/scripts/check_release_published.ts +32 -11
- package/src/scripts/check_rule_layer_partition.ts +531 -0
- package/src/scripts/check_single_delivery.ts +194 -17
- package/src/scripts/check_standing_rule_delivery.ts +8 -2
- package/src/scripts/ci_settle.ts +170 -0
- package/src/scripts/condense.ts +79 -259
- package/src/scripts/council_cli.ts +3 -3
- package/src/scripts/dispatch_r2_reviewer.ts +6 -14
- package/src/scripts/external_sources_denylist.json +4 -1
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +77 -14
- package/src/scripts/hooks/block_no_verify.ts +61 -10
- package/src/scripts/hooks/block_unauthorized_git.ts +21 -1
- package/src/scripts/hooks/concern_registry.ts +4 -0
- package/src/scripts/hooks/dispatch_hook.ts +154 -187
- package/src/scripts/hooks/dispatch_issues.ts +38 -19
- package/src/scripts/hooks/fallback_yaml.ts +66 -0
- package/src/scripts/hooks/host_semantics.ts +21 -0
- package/src/scripts/hooks/injection_budget.ts +13 -3
- package/src/scripts/hooks/py_json_dumps.ts +103 -0
- package/src/scripts/hooks/rtk_wrap_hook.ts +8 -3
- package/src/scripts/hooks/run_continuation_hook.ts +8 -5
- package/src/scripts/hooks/ship_diff_volume_hook.ts +81 -15
- package/src/scripts/hooks/source_first_gate_hook.ts +464 -0
- package/src/scripts/hooks/state_io.ts +870 -21
- package/src/scripts/hooks/stdin_failure_policy.ts +96 -0
- package/src/scripts/hooks/subagent_ledger_hook.ts +44 -15
- package/src/scripts/hooks/telemetry_flush_hook.ts +139 -0
- package/src/scripts/hooks/telemetry_self_repair.ts +128 -0
- package/src/scripts/hooks/telemetry_usage_hook.ts +22 -4
- package/src/scripts/hooks/turn_end_gate_hook.ts +81 -15
- package/src/scripts/injection_scan_hook.ts +137 -5
- package/src/scripts/install.ts +16 -11
- package/src/scripts/language_mirror_hook.ts +561 -25
- package/src/scripts/lint_framework_leakage_allowlist.json +2 -2
- package/src/scripts/lint_hook_manifest.ts +49 -0
- package/src/scripts/lint_plan_risk_register.ts +4 -3
- package/src/scripts/lint_provenance_vocabulary.ts +472 -4
- package/src/scripts/lint_skill_router_head.ts +4 -4
- package/src/scripts/mcp_server/tools.ts +2 -2
- package/src/scripts/new_roadmap.ts +136 -0
- package/src/scripts/pack_mcp_content.ts +20 -5
- package/src/scripts/release.ts +37 -38
- package/src/scripts/report_layer_overlap.ts +6 -0
- package/src/scripts/routing_doctor.ts +5 -1
- package/src/scripts/self_repair_hook.ts +37 -5
- package/src/scripts/session_register_hook.ts +11 -0
- package/src/scripts/skill_usage_collect.ts +11 -1
- package/src/scripts/skill_usage_report.ts +278 -8
- package/src/scripts/sync_pr_branch.ts +170 -20
- package/src/server/schemas/settings.ts +8 -0
- package/dist/cli-delegate/chunk-EJITJBJX.js +0 -172
- package/dist/cli-delegate/chunk-PZWRPRWP.js +0 -38
- package/dist/cli-delegate/{chunk-PPQO4NGR.js → chunk-6RJA2F5A.js} +3 -3
- package/dist/cli-delegate/{chunk-RYNADUFG.js → chunk-LWTYTX6F.js} +0 -0
- package/dist/cli-delegate/{chunk-FBKL6JWT.js → chunk-MMSGVZKV.js} +3 -3
|
@@ -2,13 +2,13 @@ import { createRequire as __acCreateRequire } from 'node:module'; const require
|
|
|
2
2
|
import {
|
|
3
3
|
ZodFirstPartyTypeKind,
|
|
4
4
|
settingsSchema
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YM4GZDJG.js";
|
|
6
6
|
import {
|
|
7
7
|
main
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6RJA2F5A.js";
|
|
9
9
|
import {
|
|
10
10
|
RULE_SOURCE_REL
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-B2ERU2VA.js";
|
|
12
12
|
import {
|
|
13
13
|
ScopeMismatchError,
|
|
14
14
|
build_claude_hook_matrix,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
save_inventory,
|
|
25
25
|
upsert_tool,
|
|
26
26
|
write_manifest
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-PMEKGDED.js";
|
|
28
28
|
import {
|
|
29
29
|
check_version,
|
|
30
30
|
classify_mismatch,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
migrate_layout,
|
|
35
35
|
read_lockfile,
|
|
36
36
|
write_lockfile
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-T7L2QK3K.js";
|
|
38
38
|
import {
|
|
39
39
|
LEGACY_ALL,
|
|
40
40
|
compute_active_pack_ids,
|
|
@@ -42,9 +42,13 @@ import {
|
|
|
42
42
|
is_pruned_under_scoped,
|
|
43
43
|
load_lab_pack_ids,
|
|
44
44
|
load_packs_registry,
|
|
45
|
+
parseFrontmatter,
|
|
45
46
|
ruleFileArrives,
|
|
46
47
|
ruleScopeFromSettings
|
|
47
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-G23AT6GD.js";
|
|
49
|
+
import {
|
|
50
|
+
require_dist
|
|
51
|
+
} from "./chunk-OY53J6II.js";
|
|
48
52
|
import {
|
|
49
53
|
find_project_root_with_anchor,
|
|
50
54
|
load_agent_settings
|
|
@@ -55,9 +59,6 @@ import {
|
|
|
55
59
|
migrate_legacy_namespace,
|
|
56
60
|
write_target
|
|
57
61
|
} from "./chunk-NDJLNC6Q.js";
|
|
58
|
-
import {
|
|
59
|
-
require_dist
|
|
60
|
-
} from "./chunk-OY53J6II.js";
|
|
61
62
|
import {
|
|
62
63
|
__toESM
|
|
63
64
|
} from "./chunk-J55WI3RR.js";
|
|
@@ -266,9 +267,9 @@ function subtract_pointers(doc, entries) {
|
|
|
266
267
|
// src/scripts/install.ts
|
|
267
268
|
import { spawn, spawnSync } from "node:child_process";
|
|
268
269
|
import * as crypto3 from "node:crypto";
|
|
269
|
-
import * as
|
|
270
|
-
import * as
|
|
271
|
-
import * as
|
|
270
|
+
import * as fs9 from "node:fs";
|
|
271
|
+
import * as os3 from "node:os";
|
|
272
|
+
import * as path7 from "node:path";
|
|
272
273
|
import process2 from "node:process";
|
|
273
274
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
274
275
|
|
|
@@ -1087,6 +1088,99 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
|
|
|
1087
1088
|
return written;
|
|
1088
1089
|
}
|
|
1089
1090
|
|
|
1091
|
+
// src/install/partitionEligibility.ts
|
|
1092
|
+
import * as fs6 from "node:fs";
|
|
1093
|
+
import * as os2 from "node:os";
|
|
1094
|
+
|
|
1095
|
+
// src/install/hostLayerFingerprint.ts
|
|
1096
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
1097
|
+
import * as fs5 from "node:fs";
|
|
1098
|
+
import * as path5 from "node:path";
|
|
1099
|
+
var FINGERPRINT_SCHEMA = 1;
|
|
1100
|
+
function collectFiles(dir) {
|
|
1101
|
+
const out = [];
|
|
1102
|
+
const walk = (d) => {
|
|
1103
|
+
let entries;
|
|
1104
|
+
try {
|
|
1105
|
+
entries = fs5.readdirSync(d, { withFileTypes: true });
|
|
1106
|
+
} catch {
|
|
1107
|
+
return;
|
|
1108
|
+
}
|
|
1109
|
+
const sorted = [...entries].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
1110
|
+
for (const e of sorted) {
|
|
1111
|
+
const p = path5.join(d, e.name);
|
|
1112
|
+
if (e.isDirectory()) {
|
|
1113
|
+
walk(p);
|
|
1114
|
+
} else if (e.isFile()) {
|
|
1115
|
+
out.push(p);
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
walk(dir);
|
|
1120
|
+
return out.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
1121
|
+
}
|
|
1122
|
+
function fingerprintLayers(layers) {
|
|
1123
|
+
const h = createHash4("sha256");
|
|
1124
|
+
h.update(`v${FINGERPRINT_SCHEMA}\0`);
|
|
1125
|
+
for (const layer of layers) {
|
|
1126
|
+
h.update(`layer:${layer.label}\0`);
|
|
1127
|
+
for (const file of collectFiles(layer.root)) {
|
|
1128
|
+
h.update(path5.relative(layer.root, file));
|
|
1129
|
+
h.update("\0");
|
|
1130
|
+
try {
|
|
1131
|
+
h.update(fs5.readFileSync(file));
|
|
1132
|
+
} catch {
|
|
1133
|
+
h.update("\0unreadable\0");
|
|
1134
|
+
}
|
|
1135
|
+
h.update("\0");
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
return h.digest("hex");
|
|
1139
|
+
}
|
|
1140
|
+
function hostLayerInputs(userHome) {
|
|
1141
|
+
const claude = path5.join(userHome, ".claude");
|
|
1142
|
+
return [
|
|
1143
|
+
{ label: "rules", root: path5.join(claude, "rules") },
|
|
1144
|
+
{ label: "skills", root: path5.join(claude, "skills") },
|
|
1145
|
+
{ label: "commands", root: path5.join(claude, "commands") }
|
|
1146
|
+
];
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
// src/install/partitionEligibility.ts
|
|
1150
|
+
var MAINTAINER_WORKSPACE = "agent-config-maintainer";
|
|
1151
|
+
function isExclusivelyPackageOnly(source_path) {
|
|
1152
|
+
let meta;
|
|
1153
|
+
try {
|
|
1154
|
+
[meta] = parseFrontmatter(fs6.readFileSync(source_path, "utf-8"));
|
|
1155
|
+
} catch {
|
|
1156
|
+
return false;
|
|
1157
|
+
}
|
|
1158
|
+
const raw = meta["workspaces"];
|
|
1159
|
+
if (!Array.isArray(raw) || raw.length === 0) {
|
|
1160
|
+
return false;
|
|
1161
|
+
}
|
|
1162
|
+
return raw.every((w) => String(w) === MAINTAINER_WORKSPACE);
|
|
1163
|
+
}
|
|
1164
|
+
function stampHostLayerFingerprint(installedVersion, tools, lockfilePath, skip2, report) {
|
|
1165
|
+
if (skip2) {
|
|
1166
|
+
return null;
|
|
1167
|
+
}
|
|
1168
|
+
try {
|
|
1169
|
+
const fingerprint = fingerprintLayers(hostLayerInputs(os2.homedir()));
|
|
1170
|
+
write_lockfile(installedVersion, [...tools], {
|
|
1171
|
+
path: lockfilePath,
|
|
1172
|
+
host_layer_fingerprint: fingerprint
|
|
1173
|
+
});
|
|
1174
|
+
report(`Host-layer fingerprint recorded: ${fingerprint.slice(0, 12)} (enables single delivery)`);
|
|
1175
|
+
return fingerprint;
|
|
1176
|
+
} catch (e) {
|
|
1177
|
+
report(
|
|
1178
|
+
`Host-layer fingerprint NOT recorded (${String(e)}) \u2014 the project layer keeps the full projection.`
|
|
1179
|
+
);
|
|
1180
|
+
return null;
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1090
1184
|
// src/shared/settingsSurface.ts
|
|
1091
1185
|
function unwrapRef(root) {
|
|
1092
1186
|
if (root.$ref !== void 0 && root.definitions !== void 0) {
|
|
@@ -2442,8 +2536,8 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
2442
2536
|
};
|
|
2443
2537
|
|
|
2444
2538
|
// src/scripts/_lib/module_detection.ts
|
|
2445
|
-
import * as
|
|
2446
|
-
import * as
|
|
2539
|
+
import * as fs7 from "node:fs";
|
|
2540
|
+
import * as path6 from "node:path";
|
|
2447
2541
|
var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
|
|
2448
2542
|
var _RULES = [
|
|
2449
2543
|
["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
|
|
@@ -2457,14 +2551,14 @@ var _RULES = [
|
|
|
2457
2551
|
];
|
|
2458
2552
|
function _isDir(p) {
|
|
2459
2553
|
try {
|
|
2460
|
-
return
|
|
2554
|
+
return fs7.statSync(p).isDirectory();
|
|
2461
2555
|
} catch {
|
|
2462
2556
|
return false;
|
|
2463
2557
|
}
|
|
2464
2558
|
}
|
|
2465
2559
|
function _isFile(p) {
|
|
2466
2560
|
try {
|
|
2467
|
-
return
|
|
2561
|
+
return fs7.statSync(p).isFile();
|
|
2468
2562
|
} catch {
|
|
2469
2563
|
return false;
|
|
2470
2564
|
}
|
|
@@ -2478,13 +2572,13 @@ function _isUpperChar(ch) {
|
|
|
2478
2572
|
function _list_module_subdirs(root) {
|
|
2479
2573
|
let entries;
|
|
2480
2574
|
try {
|
|
2481
|
-
entries =
|
|
2575
|
+
entries = fs7.readdirSync(root).sort();
|
|
2482
2576
|
} catch {
|
|
2483
2577
|
return [];
|
|
2484
2578
|
}
|
|
2485
2579
|
const out = [];
|
|
2486
2580
|
for (const name of entries) {
|
|
2487
|
-
if (!_isDir(
|
|
2581
|
+
if (!_isDir(path6.join(root, name))) {
|
|
2488
2582
|
continue;
|
|
2489
2583
|
}
|
|
2490
2584
|
if (name.startsWith(".")) {
|
|
@@ -2506,11 +2600,11 @@ function _score_confidence(stack, root, subdirs) {
|
|
|
2506
2600
|
return capitalized.length > 0 ? "high" : "medium";
|
|
2507
2601
|
}
|
|
2508
2602
|
if (stack === "node-monorepo") {
|
|
2509
|
-
const withPkgJson = subdirs.filter((name) => _isFile(
|
|
2603
|
+
const withPkgJson = subdirs.filter((name) => _isFile(path6.join(root, name, "package.json")));
|
|
2510
2604
|
return withPkgJson.length > 0 ? "high" : "medium";
|
|
2511
2605
|
}
|
|
2512
2606
|
if (stack === "python-src") {
|
|
2513
|
-
const withInit = subdirs.filter((name) => _isFile(
|
|
2607
|
+
const withInit = subdirs.filter((name) => _isFile(path6.join(root, name, "__init__.py")));
|
|
2514
2608
|
return withInit.length > 0 ? "high" : "medium";
|
|
2515
2609
|
}
|
|
2516
2610
|
if (stack === "go-internal") {
|
|
@@ -2522,7 +2616,7 @@ function detect_module_roots(project_root) {
|
|
|
2522
2616
|
const high = [];
|
|
2523
2617
|
const medium = [];
|
|
2524
2618
|
for (const [rel_path, stack, namespace_template] of _RULES) {
|
|
2525
|
-
const abs_path =
|
|
2619
|
+
const abs_path = path6.join(project_root, rel_path);
|
|
2526
2620
|
if (!_isDir(abs_path)) {
|
|
2527
2621
|
continue;
|
|
2528
2622
|
}
|
|
@@ -2544,7 +2638,7 @@ function detect_module_roots(project_root) {
|
|
|
2544
2638
|
}
|
|
2545
2639
|
|
|
2546
2640
|
// src/scripts/_lib/model_tier.ts
|
|
2547
|
-
import
|
|
2641
|
+
import fs8 from "node:fs";
|
|
2548
2642
|
var TIER_TO_CLAUDE_MODEL = {
|
|
2549
2643
|
frontier: "fable",
|
|
2550
2644
|
high: "opus",
|
|
@@ -2553,8 +2647,8 @@ var TIER_TO_CLAUDE_MODEL = {
|
|
|
2553
2647
|
};
|
|
2554
2648
|
var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
|
|
2555
2649
|
function read_model_tier(skill_md) {
|
|
2556
|
-
if (!
|
|
2557
|
-
const text =
|
|
2650
|
+
if (!fs8.existsSync(skill_md)) return null;
|
|
2651
|
+
const text = fs8.readFileSync(skill_md).toString("utf-8");
|
|
2558
2652
|
if (!text.startsWith("---\n")) return null;
|
|
2559
2653
|
const end = text.indexOf("\n---\n", 4);
|
|
2560
2654
|
if (end === -1) return null;
|
|
@@ -2586,36 +2680,36 @@ var ArgparseExit = class extends Error {
|
|
|
2586
2680
|
code;
|
|
2587
2681
|
};
|
|
2588
2682
|
function expanduser2(p) {
|
|
2589
|
-
if (p === "~") return
|
|
2683
|
+
if (p === "~") return os3.homedir();
|
|
2590
2684
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
2591
|
-
return
|
|
2685
|
+
return path7.join(os3.homedir(), p.slice(2));
|
|
2592
2686
|
}
|
|
2593
2687
|
return p;
|
|
2594
2688
|
}
|
|
2595
2689
|
function resolvePath(p) {
|
|
2596
2690
|
try {
|
|
2597
|
-
return
|
|
2691
|
+
return fs9.realpathSync(path7.resolve(p));
|
|
2598
2692
|
} catch {
|
|
2599
|
-
return
|
|
2693
|
+
return path7.resolve(p);
|
|
2600
2694
|
}
|
|
2601
2695
|
}
|
|
2602
2696
|
function isFile(p) {
|
|
2603
2697
|
try {
|
|
2604
|
-
return
|
|
2698
|
+
return fs9.statSync(p).isFile();
|
|
2605
2699
|
} catch {
|
|
2606
2700
|
return false;
|
|
2607
2701
|
}
|
|
2608
2702
|
}
|
|
2609
2703
|
function isDir(p) {
|
|
2610
2704
|
try {
|
|
2611
|
-
return
|
|
2705
|
+
return fs9.statSync(p).isDirectory();
|
|
2612
2706
|
} catch {
|
|
2613
2707
|
return false;
|
|
2614
2708
|
}
|
|
2615
2709
|
}
|
|
2616
2710
|
function pathExists(p) {
|
|
2617
2711
|
try {
|
|
2618
|
-
|
|
2712
|
+
fs9.statSync(p);
|
|
2619
2713
|
return true;
|
|
2620
2714
|
} catch {
|
|
2621
2715
|
return false;
|
|
@@ -2623,24 +2717,24 @@ function pathExists(p) {
|
|
|
2623
2717
|
}
|
|
2624
2718
|
function isSymlink(p) {
|
|
2625
2719
|
try {
|
|
2626
|
-
return
|
|
2720
|
+
return fs9.lstatSync(p).isSymbolicLink();
|
|
2627
2721
|
} catch {
|
|
2628
2722
|
return false;
|
|
2629
2723
|
}
|
|
2630
2724
|
}
|
|
2631
2725
|
function readText(p) {
|
|
2632
|
-
return
|
|
2726
|
+
return fs9.readFileSync(p, "utf-8");
|
|
2633
2727
|
}
|
|
2634
2728
|
function writeText(p, content) {
|
|
2635
|
-
|
|
2729
|
+
fs9.writeFileSync(p, content, "utf-8");
|
|
2636
2730
|
}
|
|
2637
2731
|
function mkdirp(p) {
|
|
2638
|
-
|
|
2732
|
+
fs9.mkdirSync(p, { recursive: true });
|
|
2639
2733
|
}
|
|
2640
2734
|
function sortedGlobStems(directory, suffix) {
|
|
2641
2735
|
let entries;
|
|
2642
2736
|
try {
|
|
2643
|
-
entries =
|
|
2737
|
+
entries = fs9.readdirSync(directory);
|
|
2644
2738
|
} catch {
|
|
2645
2739
|
return [];
|
|
2646
2740
|
}
|
|
@@ -2660,7 +2754,7 @@ function sortedGlobStems(directory, suffix) {
|
|
|
2660
2754
|
function countZips(directory) {
|
|
2661
2755
|
if (!isDir(directory)) return 0;
|
|
2662
2756
|
let n = 0;
|
|
2663
|
-
for (const name of
|
|
2757
|
+
for (const name of fs9.readdirSync(directory)) {
|
|
2664
2758
|
if (name.endsWith(".zip")) n += 1;
|
|
2665
2759
|
}
|
|
2666
2760
|
return n;
|
|
@@ -2668,35 +2762,35 @@ function countZips(directory) {
|
|
|
2668
2762
|
function sha256OfFile(p) {
|
|
2669
2763
|
let data;
|
|
2670
2764
|
try {
|
|
2671
|
-
data =
|
|
2765
|
+
data = fs9.readFileSync(p);
|
|
2672
2766
|
} catch {
|
|
2673
2767
|
return null;
|
|
2674
2768
|
}
|
|
2675
2769
|
return crypto3.createHash("sha256").update(data).digest("hex");
|
|
2676
2770
|
}
|
|
2677
2771
|
function atomicWrite0644(target, body, prefix) {
|
|
2678
|
-
const dir =
|
|
2679
|
-
const tmpName =
|
|
2772
|
+
const dir = path7.dirname(target);
|
|
2773
|
+
const tmpName = path7.join(
|
|
2680
2774
|
dir,
|
|
2681
2775
|
`${prefix}${process2.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
|
|
2682
2776
|
);
|
|
2683
2777
|
let fd = null;
|
|
2684
2778
|
try {
|
|
2685
|
-
fd =
|
|
2686
|
-
|
|
2687
|
-
|
|
2779
|
+
fd = fs9.openSync(tmpName, "wx", 420);
|
|
2780
|
+
fs9.writeFileSync(fd, body, "utf-8");
|
|
2781
|
+
fs9.closeSync(fd);
|
|
2688
2782
|
fd = null;
|
|
2689
|
-
|
|
2690
|
-
|
|
2783
|
+
fs9.chmodSync(tmpName, 420);
|
|
2784
|
+
fs9.renameSync(tmpName, target);
|
|
2691
2785
|
} catch (err) {
|
|
2692
2786
|
if (fd !== null) {
|
|
2693
2787
|
try {
|
|
2694
|
-
|
|
2788
|
+
fs9.closeSync(fd);
|
|
2695
2789
|
} catch {
|
|
2696
2790
|
}
|
|
2697
2791
|
}
|
|
2698
2792
|
try {
|
|
2699
|
-
|
|
2793
|
+
fs9.unlinkSync(tmpName);
|
|
2700
2794
|
} catch {
|
|
2701
2795
|
}
|
|
2702
2796
|
throw err;
|
|
@@ -2820,12 +2914,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
|
|
|
2820
2914
|
var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
|
|
2821
2915
|
var SETTINGS_SUBDIR = ["agents", "settings"];
|
|
2822
2916
|
function _canonical_settings_target(project_root) {
|
|
2823
|
-
return
|
|
2917
|
+
return path7.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
|
|
2824
2918
|
}
|
|
2825
2919
|
function _resolve_settings_read(project_root) {
|
|
2826
2920
|
const canonical = _canonical_settings_target(project_root);
|
|
2827
2921
|
if (pathExists(canonical)) return canonical;
|
|
2828
|
-
const legacy =
|
|
2922
|
+
const legacy = path7.join(project_root, SETTINGS_FILE);
|
|
2829
2923
|
if (pathExists(legacy)) return legacy;
|
|
2830
2924
|
return canonical;
|
|
2831
2925
|
}
|
|
@@ -2889,9 +2983,9 @@ function fail(msg) {
|
|
|
2889
2983
|
throw new SystemExitError(1);
|
|
2890
2984
|
}
|
|
2891
2985
|
function detect_package_root(project_root) {
|
|
2892
|
-
const npm_path =
|
|
2986
|
+
const npm_path = path7.join(project_root, "node_modules", "@event4u", "agent-config");
|
|
2893
2987
|
if (isDir(npm_path)) return resolvePath(npm_path);
|
|
2894
|
-
if (pathExists(
|
|
2988
|
+
if (pathExists(path7.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
2895
2989
|
return project_root;
|
|
2896
2990
|
}
|
|
2897
2991
|
fail(
|
|
@@ -2899,12 +2993,12 @@ function detect_package_root(project_root) {
|
|
|
2899
2993
|
);
|
|
2900
2994
|
}
|
|
2901
2995
|
function detect_package_type(package_root) {
|
|
2902
|
-
if (package_root.split(
|
|
2996
|
+
if (package_root.split(path7.sep).includes("node_modules")) return "npm";
|
|
2903
2997
|
return "local";
|
|
2904
2998
|
}
|
|
2905
2999
|
function detect_package_type_for_project(project_root, package_root) {
|
|
2906
3000
|
const npm_path = resolvePath(
|
|
2907
|
-
|
|
3001
|
+
path7.join(project_root, "node_modules", "@event4u", "agent-config")
|
|
2908
3002
|
);
|
|
2909
3003
|
const package_resolved = resolvePath(package_root);
|
|
2910
3004
|
if (package_resolved === npm_path) return "npm";
|
|
@@ -2924,7 +3018,7 @@ function ensure_directory(p) {
|
|
|
2924
3018
|
mkdirp(p);
|
|
2925
3019
|
}
|
|
2926
3020
|
function write_file(p, content) {
|
|
2927
|
-
ensure_directory(
|
|
3021
|
+
ensure_directory(path7.dirname(p));
|
|
2928
3022
|
writeText(p, content);
|
|
2929
3023
|
}
|
|
2930
3024
|
function read_json_file(p) {
|
|
@@ -3095,7 +3189,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
|
|
|
3095
3189
|
return rendered + "\n" + suffix;
|
|
3096
3190
|
}
|
|
3097
3191
|
function _migrate_legacy_if_present(project_root, template_body) {
|
|
3098
|
-
const legacy_target =
|
|
3192
|
+
const legacy_target = path7.join(project_root, LEGACY_SETTINGS_FILE);
|
|
3099
3193
|
if (!isFile(legacy_target)) return null;
|
|
3100
3194
|
const legacy_text = readText(legacy_target);
|
|
3101
3195
|
const [values, unknown] = _parse_legacy_settings(legacy_text);
|
|
@@ -3110,9 +3204,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
|
|
|
3110
3204
|
}
|
|
3111
3205
|
}
|
|
3112
3206
|
rendered = _append_unknown_legacy(rendered, values, unknown);
|
|
3113
|
-
const backup_target =
|
|
3207
|
+
const backup_target = path7.join(project_root, LEGACY_BACKUP_FILE);
|
|
3114
3208
|
writeText(backup_target, legacy_text);
|
|
3115
|
-
|
|
3209
|
+
fs9.unlinkSync(legacy_target);
|
|
3116
3210
|
info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
|
|
3117
3211
|
info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
|
|
3118
3212
|
if (unknown.length > 0) {
|
|
@@ -3147,7 +3241,7 @@ function _render_template(template, profile_values) {
|
|
|
3147
3241
|
return body;
|
|
3148
3242
|
}
|
|
3149
3243
|
function _load_valid_user_types(package_root) {
|
|
3150
|
-
const directory =
|
|
3244
|
+
const directory = path7.join(package_root, USER_TYPES_DIR);
|
|
3151
3245
|
if (!isDir(directory)) return [];
|
|
3152
3246
|
return sortedGlobStems(directory, ".yml");
|
|
3153
3247
|
}
|
|
@@ -3204,8 +3298,8 @@ function splitlinesKeepends(text) {
|
|
|
3204
3298
|
}
|
|
3205
3299
|
function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
|
|
3206
3300
|
const target = _canonical_settings_target(project_root);
|
|
3207
|
-
const profile_source =
|
|
3208
|
-
const template_source =
|
|
3301
|
+
const profile_source = path7.join(package_root, "src", "config", "profiles", `${profile}.ini`);
|
|
3302
|
+
const template_source = path7.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
3209
3303
|
if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
|
|
3210
3304
|
if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
|
|
3211
3305
|
const template = readText(template_source);
|
|
@@ -3219,21 +3313,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
3219
3313
|
if (profile_values["rule_loading_tier"] !== profile) {
|
|
3220
3314
|
const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
|
|
3221
3315
|
fail(
|
|
3222
|
-
`Profile preset ${
|
|
3316
|
+
`Profile preset ${path7.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
|
|
3223
3317
|
);
|
|
3224
3318
|
}
|
|
3225
3319
|
profile_values["user_type"] = _validate_user_type(package_root, user_type);
|
|
3226
3320
|
let template_body = _render_template(template, profile_values);
|
|
3227
3321
|
template_body = _inject_packs(template_body, packs ?? []);
|
|
3228
|
-
const legacy_root =
|
|
3322
|
+
const legacy_root = path7.join(project_root, SETTINGS_FILE);
|
|
3229
3323
|
if (isFile(legacy_root) && !pathExists(target)) {
|
|
3230
|
-
mkdirp(
|
|
3324
|
+
mkdirp(path7.dirname(target));
|
|
3231
3325
|
writeText(target, readText(legacy_root));
|
|
3232
|
-
|
|
3326
|
+
fs9.unlinkSync(legacy_root);
|
|
3233
3327
|
success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
|
|
3234
3328
|
return;
|
|
3235
3329
|
}
|
|
3236
|
-
const legacy_target =
|
|
3330
|
+
const legacy_target = path7.join(project_root, LEGACY_SETTINGS_FILE);
|
|
3237
3331
|
if (isFile(legacy_target) && pathExists(target)) {
|
|
3238
3332
|
warn(
|
|
3239
3333
|
`Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
|
|
@@ -3250,7 +3344,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
3250
3344
|
skip(`${SETTINGS_FILE} already exists`);
|
|
3251
3345
|
return;
|
|
3252
3346
|
}
|
|
3253
|
-
mkdirp(
|
|
3347
|
+
mkdirp(path7.dirname(target));
|
|
3254
3348
|
write_file(target, template_body);
|
|
3255
3349
|
const user_type_value = profile_values["user_type"] ?? "";
|
|
3256
3350
|
const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
|
|
@@ -3263,7 +3357,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
3263
3357
|
const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
|
|
3264
3358
|
const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
|
|
3265
3359
|
return merge_json_file(
|
|
3266
|
-
|
|
3360
|
+
path7.join(project_root, ".vscode", "settings.json"),
|
|
3267
3361
|
bridge,
|
|
3268
3362
|
force,
|
|
3269
3363
|
".vscode/settings.json"
|
|
@@ -3272,14 +3366,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
3272
3366
|
function ensure_augment_bridge(project_root, force) {
|
|
3273
3367
|
const bridge = { enabledPlugins: { "agent-config@event4u": true } };
|
|
3274
3368
|
return merge_json_file(
|
|
3275
|
-
|
|
3369
|
+
path7.join(project_root, ".augment", "settings.json"),
|
|
3276
3370
|
bridge,
|
|
3277
3371
|
force,
|
|
3278
3372
|
".augment/settings.json"
|
|
3279
3373
|
);
|
|
3280
3374
|
}
|
|
3281
|
-
var AUGMENT_USER_DIR =
|
|
3282
|
-
var AUGMENT_USER_HOOKS_DIR =
|
|
3375
|
+
var AUGMENT_USER_DIR = path7.join(os3.homedir(), ".augment");
|
|
3376
|
+
var AUGMENT_USER_HOOKS_DIR = path7.join(AUGMENT_USER_DIR, "hooks");
|
|
3283
3377
|
var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
|
|
3284
3378
|
var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
3285
3379
|
"augment-chat-history.sh",
|
|
@@ -3295,29 +3389,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
|
|
|
3295
3389
|
["post_tool_use", "PostToolUse"]
|
|
3296
3390
|
];
|
|
3297
3391
|
function _deploy_augment_trampoline(package_root, name, force) {
|
|
3298
|
-
const src =
|
|
3392
|
+
const src = path7.join(package_root, "scripts", "hooks", name);
|
|
3299
3393
|
if (!pathExists(src)) {
|
|
3300
3394
|
skip(`augment trampoline missing in package: ${src}`);
|
|
3301
3395
|
return null;
|
|
3302
3396
|
}
|
|
3303
3397
|
mkdirp(AUGMENT_USER_HOOKS_DIR);
|
|
3304
|
-
const dst =
|
|
3398
|
+
const dst = path7.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
3305
3399
|
const src_text = readText(src);
|
|
3306
3400
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3307
3401
|
skip(`~/.augment/hooks/${name} already up to date`);
|
|
3308
3402
|
} else {
|
|
3309
3403
|
writeText(dst, src_text);
|
|
3310
|
-
|
|
3404
|
+
fs9.chmodSync(dst, 493);
|
|
3311
3405
|
success(`~/.augment/hooks/${name} installed`);
|
|
3312
3406
|
}
|
|
3313
3407
|
return dst;
|
|
3314
3408
|
}
|
|
3315
3409
|
function _remove_legacy_augment_trampolines() {
|
|
3316
3410
|
for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
|
|
3317
|
-
const legacy =
|
|
3411
|
+
const legacy = path7.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
3318
3412
|
try {
|
|
3319
3413
|
if (isFile(legacy)) {
|
|
3320
|
-
|
|
3414
|
+
fs9.unlinkSync(legacy);
|
|
3321
3415
|
skip(`removed legacy ~/.augment/hooks/${name}`);
|
|
3322
3416
|
}
|
|
3323
3417
|
} catch (err) {
|
|
@@ -3337,7 +3431,7 @@ function ensure_augment_user_hooks(package_root, force) {
|
|
|
3337
3431
|
}
|
|
3338
3432
|
const settings_patch = { hooks: per_event };
|
|
3339
3433
|
return merge_json_file(
|
|
3340
|
-
|
|
3434
|
+
path7.join(AUGMENT_USER_DIR, "settings.json"),
|
|
3341
3435
|
settings_patch,
|
|
3342
3436
|
force,
|
|
3343
3437
|
"~/.augment/settings.json"
|
|
@@ -3362,7 +3456,7 @@ function _heal_legacy_claude_plugin_ids(p) {
|
|
|
3362
3456
|
return removed;
|
|
3363
3457
|
}
|
|
3364
3458
|
function ensure_claude_bridge(project_root, force) {
|
|
3365
|
-
const target =
|
|
3459
|
+
const target = path7.join(project_root, ".claude", "settings.json");
|
|
3366
3460
|
const healed = _heal_legacy_claude_plugin_ids(target);
|
|
3367
3461
|
for (const pid of healed) {
|
|
3368
3462
|
success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
|
|
@@ -3387,29 +3481,29 @@ function ensure_cursor_bridge(project_root, force) {
|
|
|
3387
3481
|
}
|
|
3388
3482
|
const bridge = { version: 1, hooks };
|
|
3389
3483
|
return merge_json_file(
|
|
3390
|
-
|
|
3484
|
+
path7.join(project_root, ".cursor", "hooks.json"),
|
|
3391
3485
|
bridge,
|
|
3392
3486
|
force,
|
|
3393
3487
|
".cursor/hooks.json"
|
|
3394
3488
|
);
|
|
3395
3489
|
}
|
|
3396
|
-
var CURSOR_USER_DIR =
|
|
3397
|
-
var CURSOR_USER_HOOKS_DIR =
|
|
3490
|
+
var CURSOR_USER_DIR = path7.join(os3.homedir(), ".cursor");
|
|
3491
|
+
var CURSOR_USER_HOOKS_DIR = path7.join(CURSOR_USER_DIR, "hooks");
|
|
3398
3492
|
var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
|
|
3399
3493
|
function ensure_cursor_user_hooks(package_root, force) {
|
|
3400
|
-
const src =
|
|
3494
|
+
const src = path7.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
|
|
3401
3495
|
if (!pathExists(src)) {
|
|
3402
3496
|
skip(`cursor trampoline missing in package: ${src}`);
|
|
3403
3497
|
return [];
|
|
3404
3498
|
}
|
|
3405
3499
|
mkdirp(CURSOR_USER_HOOKS_DIR);
|
|
3406
|
-
const dst =
|
|
3500
|
+
const dst = path7.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
|
|
3407
3501
|
const src_text = readText(src);
|
|
3408
3502
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3409
3503
|
skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3410
3504
|
} else {
|
|
3411
3505
|
writeText(dst, src_text);
|
|
3412
|
-
|
|
3506
|
+
fs9.chmodSync(dst, 493);
|
|
3413
3507
|
success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
|
|
3414
3508
|
}
|
|
3415
3509
|
const hooks = {};
|
|
@@ -3418,7 +3512,7 @@ function ensure_cursor_user_hooks(package_root, force) {
|
|
|
3418
3512
|
}
|
|
3419
3513
|
const settings_patch = { version: 1, hooks };
|
|
3420
3514
|
return merge_json_file(
|
|
3421
|
-
|
|
3515
|
+
path7.join(CURSOR_USER_DIR, "hooks.json"),
|
|
3422
3516
|
settings_patch,
|
|
3423
3517
|
force,
|
|
3424
3518
|
"~/.cursor/hooks.json"
|
|
@@ -3461,12 +3555,12 @@ exit 0
|
|
|
3461
3555
|
`;
|
|
3462
3556
|
}
|
|
3463
3557
|
function ensure_cline_bridge(project_root, force) {
|
|
3464
|
-
const hooks_dir =
|
|
3558
|
+
const hooks_dir = path7.join(project_root, ".clinerules", "hooks");
|
|
3465
3559
|
mkdirp(hooks_dir);
|
|
3466
3560
|
const workspace_quoted = shlexQuote(resolvePath(project_root));
|
|
3467
3561
|
let written = 0;
|
|
3468
3562
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
3469
|
-
const target =
|
|
3563
|
+
const target = path7.join(hooks_dir, native_event);
|
|
3470
3564
|
const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
|
|
3471
3565
|
if (pathExists(target) && readText(target) === body && !force) {
|
|
3472
3566
|
continue;
|
|
@@ -3476,7 +3570,7 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
3476
3570
|
continue;
|
|
3477
3571
|
}
|
|
3478
3572
|
writeText(target, body);
|
|
3479
|
-
|
|
3573
|
+
fs9.chmodSync(target, 493);
|
|
3480
3574
|
written += 1;
|
|
3481
3575
|
}
|
|
3482
3576
|
if (written) {
|
|
@@ -3485,27 +3579,27 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
3485
3579
|
skip(".clinerules/hooks/ already up to date");
|
|
3486
3580
|
}
|
|
3487
3581
|
}
|
|
3488
|
-
var CLINE_USER_DIR =
|
|
3582
|
+
var CLINE_USER_DIR = path7.join(os3.homedir(), "Documents", "Cline", "Hooks");
|
|
3489
3583
|
var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
|
|
3490
3584
|
function ensure_cline_user_hooks(package_root, force) {
|
|
3491
|
-
const src =
|
|
3585
|
+
const src = path7.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
|
|
3492
3586
|
if (!pathExists(src)) {
|
|
3493
3587
|
skip(`cline trampoline missing in package: ${src}`);
|
|
3494
3588
|
return;
|
|
3495
3589
|
}
|
|
3496
3590
|
mkdirp(CLINE_USER_DIR);
|
|
3497
|
-
const trampoline =
|
|
3591
|
+
const trampoline = path7.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
|
|
3498
3592
|
const src_text = readText(src);
|
|
3499
3593
|
if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
|
|
3500
3594
|
skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3501
3595
|
} else {
|
|
3502
3596
|
writeText(trampoline, src_text);
|
|
3503
|
-
|
|
3597
|
+
fs9.chmodSync(trampoline, 493);
|
|
3504
3598
|
success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
|
|
3505
3599
|
}
|
|
3506
3600
|
const trampoline_quoted = shlexQuote(trampoline);
|
|
3507
3601
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
3508
|
-
const wrapper =
|
|
3602
|
+
const wrapper = path7.join(CLINE_USER_DIR, native_event);
|
|
3509
3603
|
const body = `#!/usr/bin/env bash
|
|
3510
3604
|
# Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
|
|
3511
3605
|
# User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
|
|
@@ -3515,7 +3609,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
|
|
|
3515
3609
|
continue;
|
|
3516
3610
|
}
|
|
3517
3611
|
writeText(wrapper, body);
|
|
3518
|
-
|
|
3612
|
+
fs9.chmodSync(wrapper, 493);
|
|
3519
3613
|
}
|
|
3520
3614
|
}
|
|
3521
3615
|
var WINDSURF_DISPATCHER_BINDINGS = [
|
|
@@ -3536,29 +3630,29 @@ function ensure_windsurf_bridge(project_root, force) {
|
|
|
3536
3630
|
}
|
|
3537
3631
|
const bridge = { hooks };
|
|
3538
3632
|
return merge_json_file(
|
|
3539
|
-
|
|
3633
|
+
path7.join(project_root, ".windsurf", "hooks.json"),
|
|
3540
3634
|
bridge,
|
|
3541
3635
|
force,
|
|
3542
3636
|
".windsurf/hooks.json"
|
|
3543
3637
|
);
|
|
3544
3638
|
}
|
|
3545
|
-
var WINDSURF_USER_DIR =
|
|
3546
|
-
var WINDSURF_USER_HOOKS_DIR =
|
|
3639
|
+
var WINDSURF_USER_DIR = path7.join(os3.homedir(), ".codeium", "windsurf");
|
|
3640
|
+
var WINDSURF_USER_HOOKS_DIR = path7.join(WINDSURF_USER_DIR, "hooks");
|
|
3547
3641
|
var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
|
|
3548
3642
|
function ensure_windsurf_user_hooks(package_root, force) {
|
|
3549
|
-
const src =
|
|
3643
|
+
const src = path7.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
3550
3644
|
if (!pathExists(src)) {
|
|
3551
3645
|
skip(`windsurf trampoline missing in package: ${src}`);
|
|
3552
3646
|
return [];
|
|
3553
3647
|
}
|
|
3554
3648
|
mkdirp(WINDSURF_USER_HOOKS_DIR);
|
|
3555
|
-
const dst =
|
|
3649
|
+
const dst = path7.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
3556
3650
|
const src_text = readText(src);
|
|
3557
3651
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3558
3652
|
skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3559
3653
|
} else {
|
|
3560
3654
|
writeText(dst, src_text);
|
|
3561
|
-
|
|
3655
|
+
fs9.chmodSync(dst, 493);
|
|
3562
3656
|
success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
|
|
3563
3657
|
}
|
|
3564
3658
|
const hooks = {};
|
|
@@ -3570,7 +3664,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
|
|
|
3570
3664
|
}
|
|
3571
3665
|
const settings_patch = { hooks };
|
|
3572
3666
|
return merge_json_file(
|
|
3573
|
-
|
|
3667
|
+
path7.join(WINDSURF_USER_DIR, "hooks.json"),
|
|
3574
3668
|
settings_patch,
|
|
3575
3669
|
force,
|
|
3576
3670
|
"~/.codeium/windsurf/hooks.json"
|
|
@@ -3599,43 +3693,43 @@ function _gemini_hooks_dict(command_factory) {
|
|
|
3599
3693
|
function ensure_gemini_bridge(project_root, force) {
|
|
3600
3694
|
const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
|
|
3601
3695
|
return merge_json_file(
|
|
3602
|
-
|
|
3696
|
+
path7.join(project_root, ".gemini", "settings.json"),
|
|
3603
3697
|
bridge,
|
|
3604
3698
|
force,
|
|
3605
3699
|
".gemini/settings.json"
|
|
3606
3700
|
);
|
|
3607
3701
|
}
|
|
3608
|
-
var GEMINI_USER_DIR =
|
|
3609
|
-
var GEMINI_USER_HOOKS_DIR =
|
|
3702
|
+
var GEMINI_USER_DIR = path7.join(os3.homedir(), ".gemini");
|
|
3703
|
+
var GEMINI_USER_HOOKS_DIR = path7.join(GEMINI_USER_DIR, "hooks");
|
|
3610
3704
|
var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
|
|
3611
3705
|
function ensure_gemini_user_hooks(package_root, force) {
|
|
3612
|
-
const src =
|
|
3706
|
+
const src = path7.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
|
|
3613
3707
|
if (!pathExists(src)) {
|
|
3614
3708
|
skip(`gemini trampoline missing in package: ${src}`);
|
|
3615
3709
|
return [];
|
|
3616
3710
|
}
|
|
3617
3711
|
mkdirp(GEMINI_USER_HOOKS_DIR);
|
|
3618
|
-
const dst =
|
|
3712
|
+
const dst = path7.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
|
|
3619
3713
|
const src_text = readText(src);
|
|
3620
3714
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3621
3715
|
skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3622
3716
|
} else {
|
|
3623
3717
|
writeText(dst, src_text);
|
|
3624
|
-
|
|
3718
|
+
fs9.chmodSync(dst, 493);
|
|
3625
3719
|
success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
|
|
3626
3720
|
}
|
|
3627
3721
|
const settings_patch = {
|
|
3628
3722
|
hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
|
|
3629
3723
|
};
|
|
3630
3724
|
return merge_json_file(
|
|
3631
|
-
|
|
3725
|
+
path7.join(GEMINI_USER_DIR, "settings.json"),
|
|
3632
3726
|
settings_patch,
|
|
3633
3727
|
force,
|
|
3634
3728
|
"~/.gemini/settings.json"
|
|
3635
3729
|
);
|
|
3636
3730
|
}
|
|
3637
3731
|
function ensure_copilot_bridge(project_root, force) {
|
|
3638
|
-
const target =
|
|
3732
|
+
const target = path7.join(project_root, ".github", "plugin", "marketplace.json");
|
|
3639
3733
|
const bridge = {
|
|
3640
3734
|
marketplace: {
|
|
3641
3735
|
name: "event4u-agent-marketplace",
|
|
@@ -3678,7 +3772,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
|
|
|
3678
3772
|
Run \`./agent-config --help\` for available commands.
|
|
3679
3773
|
`;
|
|
3680
3774
|
function ensure_roocode_bridge(project_root, force) {
|
|
3681
|
-
const target =
|
|
3775
|
+
const target = path7.join(project_root, ".roo", "rules", "agent-config.md");
|
|
3682
3776
|
if (pathExists(target) && !force) {
|
|
3683
3777
|
skip(".roo/rules/agent-config.md already exists");
|
|
3684
3778
|
return;
|
|
@@ -3700,7 +3794,7 @@ To wire Claude Desktop to this project's rules, run:
|
|
|
3700
3794
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
3701
3795
|
`;
|
|
3702
3796
|
function ensure_claude_desktop_bridge(project_root, force) {
|
|
3703
|
-
const target =
|
|
3797
|
+
const target = path7.join(project_root, ".claude-desktop", "agent-config.md");
|
|
3704
3798
|
if (pathExists(target) && !force) {
|
|
3705
3799
|
skip(".claude-desktop/agent-config.md already exists");
|
|
3706
3800
|
return;
|
|
@@ -3725,7 +3819,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
|
|
|
3725
3819
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
3726
3820
|
`;
|
|
3727
3821
|
function ensure_aider_bridge(project_root, force) {
|
|
3728
|
-
const target =
|
|
3822
|
+
const target = path7.join(project_root, ".aider", "agent-config.md");
|
|
3729
3823
|
if (pathExists(target) && !force) {
|
|
3730
3824
|
skip(".aider/agent-config.md already exists");
|
|
3731
3825
|
return;
|
|
@@ -3744,7 +3838,7 @@ developers where the rules and skills live.
|
|
|
3744
3838
|
Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
|
|
3745
3839
|
`;
|
|
3746
3840
|
function ensure_codex_bridge(project_root, force) {
|
|
3747
|
-
const target =
|
|
3841
|
+
const target = path7.join(project_root, ".codex", "agent-config.md");
|
|
3748
3842
|
if (pathExists(target) && !force) {
|
|
3749
3843
|
skip(".codex/agent-config.md already exists");
|
|
3750
3844
|
return;
|
|
@@ -3762,7 +3856,7 @@ rules per session. The canonical rule and skill source lives under
|
|
|
3762
3856
|
orientation).
|
|
3763
3857
|
`;
|
|
3764
3858
|
function ensure_continue_bridge(project_root, force) {
|
|
3765
|
-
const target =
|
|
3859
|
+
const target = path7.join(project_root, ".continue", "rules", "agent-config.md");
|
|
3766
3860
|
if (pathExists(target) && !force) {
|
|
3767
3861
|
skip(".continue/rules/agent-config.md already exists");
|
|
3768
3862
|
return;
|
|
@@ -3793,7 +3887,7 @@ orientation).
|
|
|
3793
3887
|
See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
|
|
3794
3888
|
`;
|
|
3795
3889
|
function ensure_kilocode_bridge(project_root, force) {
|
|
3796
|
-
const target =
|
|
3890
|
+
const target = path7.join(project_root, ".kilocode", "rules", "agent-config.md");
|
|
3797
3891
|
if (pathExists(target) && !force) {
|
|
3798
3892
|
skip(".kilocode/rules/agent-config.md already exists");
|
|
3799
3893
|
return;
|
|
@@ -3820,7 +3914,7 @@ canonical source (or symlink it):
|
|
|
3820
3914
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
3821
3915
|
`;
|
|
3822
3916
|
function ensure_zed_bridge(project_root, force) {
|
|
3823
|
-
const target =
|
|
3917
|
+
const target = path7.join(project_root, ".zed", "agent-config.md");
|
|
3824
3918
|
if (pathExists(target) && !force) {
|
|
3825
3919
|
skip(".zed/agent-config.md already exists");
|
|
3826
3920
|
return;
|
|
@@ -3841,7 +3935,7 @@ rules into your JetBrains profile.
|
|
|
3841
3935
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
3842
3936
|
`;
|
|
3843
3937
|
function ensure_jetbrains_bridge(project_root, force) {
|
|
3844
|
-
const target =
|
|
3938
|
+
const target = path7.join(project_root, ".jetbrains", "agent-config.md");
|
|
3845
3939
|
if (pathExists(target) && !force) {
|
|
3846
3940
|
skip(".jetbrains/agent-config.md already exists");
|
|
3847
3941
|
return;
|
|
@@ -3872,7 +3966,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
|
|
|
3872
3966
|
See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
|
|
3873
3967
|
`;
|
|
3874
3968
|
function ensure_kiro_bridge(project_root, force) {
|
|
3875
|
-
const target =
|
|
3969
|
+
const target = path7.join(project_root, ".kiro", "steering", "agent-config.md");
|
|
3876
3970
|
if (pathExists(target) && !force) {
|
|
3877
3971
|
skip(".kiro/steering/agent-config.md already exists");
|
|
3878
3972
|
return;
|
|
@@ -3898,35 +3992,35 @@ var SMOKE_BRIDGE_PATHS = {
|
|
|
3898
3992
|
};
|
|
3899
3993
|
function dirHasEntries(p) {
|
|
3900
3994
|
try {
|
|
3901
|
-
return
|
|
3995
|
+
return fs9.readdirSync(p).length > 0;
|
|
3902
3996
|
} catch {
|
|
3903
3997
|
return false;
|
|
3904
3998
|
}
|
|
3905
3999
|
}
|
|
3906
4000
|
function _resolve_tsx_invocation(scriptPath, scriptArgs) {
|
|
3907
4001
|
const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
3908
|
-
let dir =
|
|
4002
|
+
let dir = path7.dirname(scriptPath);
|
|
3909
4003
|
for (; ; ) {
|
|
3910
|
-
const candidate =
|
|
4004
|
+
const candidate = path7.join(dir, "node_modules", ".bin", binName);
|
|
3911
4005
|
if (isFile(candidate)) {
|
|
3912
4006
|
return { command: candidate, args: [scriptPath, ...scriptArgs] };
|
|
3913
4007
|
}
|
|
3914
|
-
const parent =
|
|
4008
|
+
const parent = path7.dirname(dir);
|
|
3915
4009
|
if (parent === dir) break;
|
|
3916
4010
|
dir = parent;
|
|
3917
4011
|
}
|
|
3918
4012
|
return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
|
|
3919
4013
|
}
|
|
3920
4014
|
function _smoke_test_hooks(project_root, package_root) {
|
|
3921
|
-
const dispatcher =
|
|
3922
|
-
const manifest =
|
|
4015
|
+
const dispatcher = path7.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
|
|
4016
|
+
const manifest = path7.join(package_root, "scripts", "hook_manifest.yaml");
|
|
3923
4017
|
if (!isFile(dispatcher) || !isFile(manifest)) return 0;
|
|
3924
4018
|
const failed = [];
|
|
3925
4019
|
const skipped = [];
|
|
3926
4020
|
const passed = [];
|
|
3927
4021
|
for (const [platform, native] of SMOKE_PROBE_EVENTS) {
|
|
3928
4022
|
const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
|
|
3929
|
-
const bridge_path = rel_bridge ?
|
|
4023
|
+
const bridge_path = rel_bridge ? path7.join(project_root, rel_bridge) : null;
|
|
3930
4024
|
const bridge_present = Boolean(
|
|
3931
4025
|
bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
|
|
3932
4026
|
);
|
|
@@ -4126,9 +4220,9 @@ To remove this marker, delete this file.
|
|
|
4126
4220
|
`;
|
|
4127
4221
|
}
|
|
4128
4222
|
var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
|
|
4129
|
-
var GLOBAL_ROOT =
|
|
4130
|
-
var GLOBAL_USER_SETTINGS_PATH =
|
|
4131
|
-
var GLOBAL_AGENT_SETTINGS_PATH =
|
|
4223
|
+
var GLOBAL_ROOT = path7.join(os3.homedir(), ".event4u", "agent-config");
|
|
4224
|
+
var GLOBAL_USER_SETTINGS_PATH = path7.join(GLOBAL_ROOT, ".agent-user.yml");
|
|
4225
|
+
var GLOBAL_AGENT_SETTINGS_PATH = path7.join(GLOBAL_ROOT, ".agent-settings.yml");
|
|
4132
4226
|
function _bridge_marker(tool_id, scope) {
|
|
4133
4227
|
if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
|
|
4134
4228
|
return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
|
|
@@ -4177,7 +4271,7 @@ function _load_yaml_doc(p) {
|
|
|
4177
4271
|
return _isPlainObject(data) ? data : {};
|
|
4178
4272
|
}
|
|
4179
4273
|
function _load_default_settings(package_root) {
|
|
4180
|
-
const template_source =
|
|
4274
|
+
const template_source = path7.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
4181
4275
|
if (!pathExists(template_source)) return {};
|
|
4182
4276
|
let text;
|
|
4183
4277
|
try {
|
|
@@ -4191,11 +4285,11 @@ function _load_default_settings(package_root) {
|
|
|
4191
4285
|
}
|
|
4192
4286
|
var RULE_LAYER_CHOICES = ["global", "project", "both-acknowledged"];
|
|
4193
4287
|
function _suppress_rule_layer(project_root, suppress_dir) {
|
|
4194
|
-
const target =
|
|
4288
|
+
const target = path7.join(project_root, ".claude", "settings.local.json");
|
|
4195
4289
|
const existing = pathExists(target) ? read_json_file(target) : {};
|
|
4196
4290
|
let real_dir = suppress_dir;
|
|
4197
4291
|
try {
|
|
4198
|
-
real_dir =
|
|
4292
|
+
real_dir = fs9.realpathSync(suppress_dir);
|
|
4199
4293
|
} catch {
|
|
4200
4294
|
real_dir = suppress_dir;
|
|
4201
4295
|
}
|
|
@@ -4206,8 +4300,8 @@ function _suppress_rule_layer(project_root, suppress_dir) {
|
|
|
4206
4300
|
success(`.claude/settings.local.json: claudeMdExcludes += ${entry}`);
|
|
4207
4301
|
}
|
|
4208
4302
|
function _gate_rule_layer_overlap(project_root, layer, dry_run) {
|
|
4209
|
-
const global_dir =
|
|
4210
|
-
const project_dir =
|
|
4303
|
+
const global_dir = path7.join(os3.homedir(), ".claude", "rules");
|
|
4304
|
+
const project_dir = path7.join(project_root, ".claude", "rules");
|
|
4211
4305
|
const g = readRuleLayer(global_dir);
|
|
4212
4306
|
const p = readRuleLayer(project_dir);
|
|
4213
4307
|
if (g === null || p === null) return true;
|
|
@@ -4317,9 +4411,9 @@ function detect_scope(cwd) {
|
|
|
4317
4411
|
if (pathExists(_resolve_settings_read(cwd))) {
|
|
4318
4412
|
return ["project", `existing ${SETTINGS_FILE}`];
|
|
4319
4413
|
}
|
|
4320
|
-
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(
|
|
4321
|
-
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(
|
|
4322
|
-
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(
|
|
4414
|
+
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path7.join(cwd, m))) ?? null;
|
|
4415
|
+
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path7.join(cwd, d))) ?? null;
|
|
4416
|
+
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path7.join(cwd, f))) ?? null;
|
|
4323
4417
|
if (has_manifest && (has_ai_dir || has_ai_file)) {
|
|
4324
4418
|
const marker = has_ai_dir || has_ai_file;
|
|
4325
4419
|
return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
|
|
@@ -4340,7 +4434,7 @@ function readLineSyncRaw(promptText) {
|
|
|
4340
4434
|
for (; ; ) {
|
|
4341
4435
|
let n;
|
|
4342
4436
|
try {
|
|
4343
|
-
n =
|
|
4437
|
+
n = fs9.readSync(0, buf, 0, 1, null);
|
|
4344
4438
|
} catch (err) {
|
|
4345
4439
|
const code = err.code;
|
|
4346
4440
|
if (code === "EAGAIN") {
|
|
@@ -4415,8 +4509,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
|
|
|
4415
4509
|
const marker = _bridge_marker(tool_id, scope);
|
|
4416
4510
|
if (!marker) continue;
|
|
4417
4511
|
let marker_path = marker;
|
|
4418
|
-
if (!
|
|
4419
|
-
marker_path =
|
|
4512
|
+
if (!path7.isAbsolute(marker_path)) {
|
|
4513
|
+
marker_path = path7.join(project_root, marker_path);
|
|
4420
4514
|
}
|
|
4421
4515
|
out[tool_id] = [_file_entry(marker_path, "bridge", false)];
|
|
4422
4516
|
}
|
|
@@ -4455,26 +4549,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
|
|
|
4455
4549
|
}
|
|
4456
4550
|
write_manifest(target, version, entries);
|
|
4457
4551
|
if (!state.QUIET) {
|
|
4458
|
-
const rel = isRelativeTo(target, project_root) ?
|
|
4552
|
+
const rel = isRelativeTo(target, project_root) ? path7.relative(project_root, target) : target;
|
|
4459
4553
|
info(`Manifest updated: ${rel}`);
|
|
4460
4554
|
}
|
|
4461
4555
|
return 0;
|
|
4462
4556
|
}
|
|
4463
4557
|
function isRelativeTo(child, parent) {
|
|
4464
|
-
const rel =
|
|
4465
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
4558
|
+
const rel = path7.relative(parent, child);
|
|
4559
|
+
return rel === "" || !rel.startsWith("..") && !path7.isAbsolute(rel);
|
|
4466
4560
|
}
|
|
4467
4561
|
function _resolve_package_root_for_global() {
|
|
4468
4562
|
const here = resolvePath(_HERE);
|
|
4469
|
-
const candidate =
|
|
4470
|
-
if (!pathExists(
|
|
4563
|
+
const candidate = path7.dirname(path7.dirname(path7.dirname(here)));
|
|
4564
|
+
if (!pathExists(path7.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
|
|
4471
4565
|
fail(
|
|
4472
4566
|
`Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
|
|
4473
4567
|
);
|
|
4474
4568
|
}
|
|
4475
4569
|
return candidate;
|
|
4476
4570
|
}
|
|
4477
|
-
var CONSUMER_BRIDGE_MARKER_RELPATH =
|
|
4571
|
+
var CONSUMER_BRIDGE_MARKER_RELPATH = path7.join("agents", ".event4u-bridge.yml");
|
|
4478
4572
|
var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
4479
4573
|
var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
|
|
4480
4574
|
var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
|
|
@@ -4482,7 +4576,7 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
4482
4576
|
if (process2.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
|
|
4483
4577
|
return [false, "consumer-mode-override"];
|
|
4484
4578
|
}
|
|
4485
|
-
const pkg_json =
|
|
4579
|
+
const pkg_json = path7.join(project_root, "package.json");
|
|
4486
4580
|
if (isFile(pkg_json)) {
|
|
4487
4581
|
let data = {};
|
|
4488
4582
|
try {
|
|
@@ -4494,18 +4588,18 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
4494
4588
|
return [true, "package.json:name"];
|
|
4495
4589
|
}
|
|
4496
4590
|
}
|
|
4497
|
-
if (isDir(
|
|
4591
|
+
if (isDir(path7.join(project_root, ".agent-src.uncondensed"))) {
|
|
4498
4592
|
return [true, ".agent-src.uncondensed/"];
|
|
4499
4593
|
}
|
|
4500
|
-
const packages_dir =
|
|
4594
|
+
const packages_dir = path7.join(project_root, "packages");
|
|
4501
4595
|
if (isDir(packages_dir)) {
|
|
4502
|
-
for (const child of
|
|
4503
|
-
if (isDir(
|
|
4596
|
+
for (const child of fs9.readdirSync(packages_dir)) {
|
|
4597
|
+
if (isDir(path7.join(packages_dir, child, ".agent-src.uncondensed"))) {
|
|
4504
4598
|
return [true, `packages/${child}/.agent-src.uncondensed/`];
|
|
4505
4599
|
}
|
|
4506
4600
|
}
|
|
4507
4601
|
}
|
|
4508
|
-
const installer_self =
|
|
4602
|
+
const installer_self = path7.join(project_root, "scripts", "install.py");
|
|
4509
4603
|
try {
|
|
4510
4604
|
if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE)) {
|
|
4511
4605
|
return [true, "src/scripts/install.py (self)"];
|
|
@@ -4525,17 +4619,17 @@ function _detect_legacy_for_migration(project_root) {
|
|
|
4525
4619
|
}
|
|
4526
4620
|
return [];
|
|
4527
4621
|
}
|
|
4528
|
-
if (isFile(
|
|
4622
|
+
if (isFile(path7.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
|
|
4529
4623
|
const found = [];
|
|
4530
4624
|
for (const name of MIGRATE_LEGACY_YAML_FILES) {
|
|
4531
|
-
if (isFile(
|
|
4625
|
+
if (isFile(path7.join(project_root, name))) {
|
|
4532
4626
|
found.push(name);
|
|
4533
|
-
} else if (isFile(
|
|
4627
|
+
} else if (isFile(path7.join(project_root, "settings", name))) {
|
|
4534
4628
|
found.push(`settings/${name}`);
|
|
4535
4629
|
}
|
|
4536
4630
|
}
|
|
4537
4631
|
for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
|
|
4538
|
-
const p =
|
|
4632
|
+
const p = path7.join(project_root, name);
|
|
4539
4633
|
if (isDir(p) && !isSymlink(p)) {
|
|
4540
4634
|
found.push(`${name}/`);
|
|
4541
4635
|
}
|
|
@@ -4547,7 +4641,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
|
|
|
4547
4641
|
process2.stdout.write("\n");
|
|
4548
4642
|
warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
|
|
4549
4643
|
for (const rel of artefacts) {
|
|
4550
|
-
info(` ${
|
|
4644
|
+
info(` ${path7.join(project_root, rel)}`);
|
|
4551
4645
|
}
|
|
4552
4646
|
info("The unified `agent-config migrate` sweeps these in one pass.");
|
|
4553
4647
|
info("The wizard recreates fresh config afterwards.");
|
|
@@ -4576,22 +4670,22 @@ function _run_migrate_to_global(project_root) {
|
|
|
4576
4670
|
}
|
|
4577
4671
|
}
|
|
4578
4672
|
function _format_global_root_for_marker(global_root) {
|
|
4579
|
-
const home = resolvePath(
|
|
4673
|
+
const home = resolvePath(os3.homedir());
|
|
4580
4674
|
const resolved = resolvePath(global_root);
|
|
4581
|
-
const rel =
|
|
4582
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
4675
|
+
const rel = path7.relative(home, resolved);
|
|
4676
|
+
if (rel === "" || rel.startsWith("..") || path7.isAbsolute(rel)) {
|
|
4583
4677
|
return global_root;
|
|
4584
4678
|
}
|
|
4585
|
-
return `~/${rel.split(
|
|
4679
|
+
return `~/${rel.split(path7.sep).join("/")}`;
|
|
4586
4680
|
}
|
|
4587
4681
|
function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
|
|
4588
4682
|
const env_map = env ?? process2.env;
|
|
4589
4683
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
|
|
4590
|
-
if (isDir(
|
|
4591
|
-
const target =
|
|
4684
|
+
if (isDir(path7.join(project_root, ".agent-src.uncondensed"))) return null;
|
|
4685
|
+
const target = path7.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
|
|
4592
4686
|
if (!isFile(target)) return null;
|
|
4593
4687
|
try {
|
|
4594
|
-
|
|
4688
|
+
fs9.rmSync(target);
|
|
4595
4689
|
} catch {
|
|
4596
4690
|
return null;
|
|
4597
4691
|
}
|
|
@@ -4605,7 +4699,7 @@ var PROJECT_ANCHOR_TOOLS = {
|
|
|
4605
4699
|
function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
|
|
4606
4700
|
const env_map = env ?? process2.env;
|
|
4607
4701
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
|
|
4608
|
-
if (isDir(
|
|
4702
|
+
if (isDir(path7.join(project_root, ".agent-src.uncondensed"))) return [];
|
|
4609
4703
|
const global_root_str = _format_global_root_for_marker(
|
|
4610
4704
|
event4u_root(env_map)
|
|
4611
4705
|
);
|
|
@@ -4614,8 +4708,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
|
|
|
4614
4708
|
for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
|
|
4615
4709
|
const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
|
|
4616
4710
|
if (!tools.has(tool_id)) continue;
|
|
4617
|
-
const target =
|
|
4618
|
-
mkdirp(
|
|
4711
|
+
const target = path7.join(project_root, rel_path);
|
|
4712
|
+
mkdirp(path7.dirname(target));
|
|
4619
4713
|
const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
|
|
4620
4714
|
# Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
|
|
4621
4715
|
# Tool: ${tool_id}. Resolves the global install directly \u2014 no
|
|
@@ -4633,7 +4727,7 @@ installed_at: ${stamp}
|
|
|
4633
4727
|
}
|
|
4634
4728
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
4635
4729
|
function _inject_package_tag(target, source, package_root) {
|
|
4636
|
-
if (
|
|
4730
|
+
if (path7.extname(target) !== ".md") return;
|
|
4637
4731
|
let text;
|
|
4638
4732
|
try {
|
|
4639
4733
|
text = readText(target);
|
|
@@ -4661,8 +4755,8 @@ function _inject_package_tag(target, source, package_root) {
|
|
|
4661
4755
|
resolved_src = source;
|
|
4662
4756
|
}
|
|
4663
4757
|
if (package_root !== null) {
|
|
4664
|
-
const rel =
|
|
4665
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
4758
|
+
const rel = path7.relative(resolvePath(package_root), resolved_src);
|
|
4759
|
+
if (rel !== "" && !rel.startsWith("..") && !path7.isAbsolute(rel)) {
|
|
4666
4760
|
source_value = rel;
|
|
4667
4761
|
} else {
|
|
4668
4762
|
source_value = resolved_src;
|
|
@@ -4697,7 +4791,7 @@ function _escapes_package_root(resolved, package_root) {
|
|
|
4697
4791
|
if (package_root === null) return false;
|
|
4698
4792
|
let root;
|
|
4699
4793
|
try {
|
|
4700
|
-
root =
|
|
4794
|
+
root = fs9.realpathSync(package_root);
|
|
4701
4795
|
} catch {
|
|
4702
4796
|
return false;
|
|
4703
4797
|
}
|
|
@@ -4712,7 +4806,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
4712
4806
|
if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
|
|
4713
4807
|
let resolved_src = src;
|
|
4714
4808
|
try {
|
|
4715
|
-
resolved_src =
|
|
4809
|
+
resolved_src = fs9.realpathSync(src);
|
|
4716
4810
|
} catch {
|
|
4717
4811
|
resolved_src = src;
|
|
4718
4812
|
}
|
|
@@ -4720,10 +4814,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
4720
4814
|
warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
|
|
4721
4815
|
return [0, 0, written_paths];
|
|
4722
4816
|
}
|
|
4723
|
-
mkdirp(
|
|
4817
|
+
mkdirp(path7.dirname(dest));
|
|
4724
4818
|
const decision = _resolve_file_conflict(dest, force);
|
|
4725
4819
|
if (decision === "skip") return [0, 1, written_paths];
|
|
4726
|
-
|
|
4820
|
+
fs9.copyFileSync(src, dest);
|
|
4727
4821
|
_inject_package_tag(dest, src, package_root);
|
|
4728
4822
|
written_paths.push(dest);
|
|
4729
4823
|
return [1, 0, written_paths];
|
|
@@ -4731,11 +4825,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
4731
4825
|
mkdirp(dest);
|
|
4732
4826
|
const walk = (node) => {
|
|
4733
4827
|
const acc = [];
|
|
4734
|
-
const names =
|
|
4828
|
+
const names = fs9.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
4735
4829
|
for (const name of names) {
|
|
4736
|
-
const entry =
|
|
4830
|
+
const entry = path7.join(node, name);
|
|
4737
4831
|
acc.push(entry);
|
|
4738
|
-
const lst =
|
|
4832
|
+
const lst = fs9.lstatSync(entry);
|
|
4739
4833
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
4740
4834
|
acc.push(...walk(entry));
|
|
4741
4835
|
}
|
|
@@ -4743,9 +4837,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
4743
4837
|
return acc;
|
|
4744
4838
|
};
|
|
4745
4839
|
for (const entry of walk(src)) {
|
|
4746
|
-
const rel =
|
|
4747
|
-
const target =
|
|
4748
|
-
const lst =
|
|
4840
|
+
const rel = path7.relative(src, entry);
|
|
4841
|
+
const target = path7.join(dest, rel);
|
|
4842
|
+
const lst = fs9.lstatSync(entry);
|
|
4749
4843
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
4750
4844
|
mkdirp(target);
|
|
4751
4845
|
continue;
|
|
@@ -4753,8 +4847,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
4753
4847
|
let resolvedIsDir = false;
|
|
4754
4848
|
let resolved = entry;
|
|
4755
4849
|
try {
|
|
4756
|
-
resolved =
|
|
4757
|
-
resolvedIsDir =
|
|
4850
|
+
resolved = fs9.realpathSync(entry);
|
|
4851
|
+
resolvedIsDir = fs9.statSync(entry).isDirectory();
|
|
4758
4852
|
} catch {
|
|
4759
4853
|
resolvedIsDir = false;
|
|
4760
4854
|
}
|
|
@@ -4784,8 +4878,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
4784
4878
|
skipped += 1;
|
|
4785
4879
|
continue;
|
|
4786
4880
|
}
|
|
4787
|
-
mkdirp(
|
|
4788
|
-
|
|
4881
|
+
mkdirp(path7.dirname(target));
|
|
4882
|
+
fs9.copyFileSync(resolved, target);
|
|
4789
4883
|
_inject_package_tag(target, resolved, package_root);
|
|
4790
4884
|
written += 1;
|
|
4791
4885
|
written_paths.push(target);
|
|
@@ -4797,7 +4891,7 @@ function _claude_desktop_bundles_dir() {
|
|
|
4797
4891
|
}
|
|
4798
4892
|
function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
|
|
4799
4893
|
const anchor = expanduser2(USER_SCOPE_PATHS["claude-desktop"]);
|
|
4800
|
-
const target =
|
|
4894
|
+
const target = path7.join(anchor, "agent-config.md");
|
|
4801
4895
|
mkdirp(anchor);
|
|
4802
4896
|
const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
|
|
4803
4897
|
writeText(target, body);
|
|
@@ -4821,23 +4915,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
4821
4915
|
const wrapped = [];
|
|
4822
4916
|
const collisions = [];
|
|
4823
4917
|
const reserved = [];
|
|
4824
|
-
const commands_dir =
|
|
4918
|
+
const commands_dir = path7.join(anchor, "commands");
|
|
4825
4919
|
let flat_entries = [];
|
|
4826
4920
|
try {
|
|
4827
|
-
flat_entries =
|
|
4921
|
+
flat_entries = fs9.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
|
|
4828
4922
|
} catch {
|
|
4829
4923
|
}
|
|
4830
4924
|
for (const fname of flat_entries.sort()) {
|
|
4831
4925
|
const slug = fname.slice(0, -".md".length);
|
|
4832
4926
|
if (!is_claude_builtin_name(slug)) continue;
|
|
4833
|
-
|
|
4927
|
+
fs9.rmSync(path7.join(commands_dir, fname), { force: true });
|
|
4834
4928
|
current_files.delete(`commands/${fname}`);
|
|
4835
4929
|
reserved.push(slug);
|
|
4836
4930
|
}
|
|
4837
4931
|
const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
|
|
4838
4932
|
try {
|
|
4839
4933
|
const manifest = JSON.parse(
|
|
4840
|
-
|
|
4934
|
+
fs9.readFileSync(path7.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
|
|
4841
4935
|
);
|
|
4842
4936
|
for (const a of manifest.artefacts ?? []) {
|
|
4843
4937
|
if (a.category !== "command" || typeof a.slug !== "string") continue;
|
|
@@ -4848,22 +4942,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
4848
4942
|
}
|
|
4849
4943
|
for (const slug of [...eligible].sort()) {
|
|
4850
4944
|
const flat_rel = `commands/${slug}.md`;
|
|
4851
|
-
const flat_abs =
|
|
4852
|
-
if (!
|
|
4853
|
-
const skill_dir =
|
|
4854
|
-
if (
|
|
4945
|
+
const flat_abs = path7.join(anchor, "commands", `${slug}.md`);
|
|
4946
|
+
if (!fs9.existsSync(flat_abs)) continue;
|
|
4947
|
+
const skill_dir = path7.join(anchor, "skills", slug);
|
|
4948
|
+
if (fs9.existsSync(skill_dir)) {
|
|
4855
4949
|
collisions.push(slug);
|
|
4856
4950
|
continue;
|
|
4857
4951
|
}
|
|
4858
|
-
let body =
|
|
4952
|
+
let body = fs9.readFileSync(flat_abs, "utf8");
|
|
4859
4953
|
if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
|
|
4860
4954
|
body = body.replace("---\n", `---
|
|
4861
4955
|
name: ${slug}
|
|
4862
4956
|
`);
|
|
4863
4957
|
}
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4958
|
+
fs9.mkdirSync(skill_dir, { recursive: true });
|
|
4959
|
+
fs9.writeFileSync(path7.join(skill_dir, "SKILL.md"), body, "utf8");
|
|
4960
|
+
fs9.rmSync(flat_abs, { force: true });
|
|
4867
4961
|
current_files.delete(flat_rel);
|
|
4868
4962
|
current_files.add(`skills/${slug}/SKILL.md`);
|
|
4869
4963
|
wrapped.push(slug);
|
|
@@ -4895,8 +4989,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
4895
4989
|
const written_paths = [];
|
|
4896
4990
|
let current_files = /* @__PURE__ */ new Set();
|
|
4897
4991
|
for (const [src_rel, dest_sub] of plan) {
|
|
4898
|
-
const src =
|
|
4899
|
-
const dest = dest_sub ?
|
|
4992
|
+
const src = path7.join(package_root, src_rel);
|
|
4993
|
+
const dest = dest_sub ? path7.join(anchor, dest_sub) : anchor;
|
|
4900
4994
|
const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
|
|
4901
4995
|
const [w, s, paths] = _copy_dir_dereferencing_symlinks(
|
|
4902
4996
|
src,
|
|
@@ -4970,10 +5064,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
4970
5064
|
results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
|
|
4971
5065
|
if (tool_id === "claude-code") {
|
|
4972
5066
|
try {
|
|
4973
|
-
const manifest =
|
|
5067
|
+
const manifest = path7.join(package_root, "src", "scripts", "hook_manifest.yaml");
|
|
4974
5068
|
const matrix = build_claude_hook_matrix(manifest);
|
|
4975
5069
|
const res = ensure_managed_hooks(
|
|
4976
|
-
|
|
5070
|
+
path7.join(anchor, "settings.json"),
|
|
4977
5071
|
matrix
|
|
4978
5072
|
);
|
|
4979
5073
|
if (!state.QUIET) {
|
|
@@ -5010,7 +5104,7 @@ function _preview_global_reap(tools, package_root) {
|
|
|
5010
5104
|
const anchor = expanduser2(anchor_raw);
|
|
5011
5105
|
let current_files = /* @__PURE__ */ new Set();
|
|
5012
5106
|
for (const [src_rel, dest_sub] of plan) {
|
|
5013
|
-
const src =
|
|
5107
|
+
const src = path7.join(package_root, src_rel);
|
|
5014
5108
|
current_files = setUnion(
|
|
5015
5109
|
current_files,
|
|
5016
5110
|
expected_deploy_files(
|
|
@@ -5044,14 +5138,14 @@ function _preview_global_reap(tools, package_root) {
|
|
|
5044
5138
|
function _verify_deploy_targets(anchor, plan) {
|
|
5045
5139
|
const missing = [];
|
|
5046
5140
|
for (const [, dest_sub] of plan) {
|
|
5047
|
-
const target = dest_sub ?
|
|
5141
|
+
const target = dest_sub ? path7.join(anchor, dest_sub) : anchor;
|
|
5048
5142
|
const label = dest_sub || ".";
|
|
5049
5143
|
if (!isDir(target)) {
|
|
5050
5144
|
missing.push(label);
|
|
5051
5145
|
continue;
|
|
5052
5146
|
}
|
|
5053
5147
|
try {
|
|
5054
|
-
const entries =
|
|
5148
|
+
const entries = fs9.readdirSync(target);
|
|
5055
5149
|
if (entries.length === 0) missing.push(label);
|
|
5056
5150
|
} catch {
|
|
5057
5151
|
missing.push(label);
|
|
@@ -5066,13 +5160,13 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
5066
5160
|
const [written, skipped, status, paths] = deploy_results[tool_id];
|
|
5067
5161
|
const pruned_skill_dirs = /* @__PURE__ */ new Set();
|
|
5068
5162
|
for (const p of paths) {
|
|
5069
|
-
const parts = p.split(
|
|
5163
|
+
const parts = p.split(path7.sep);
|
|
5070
5164
|
if (parts.includes("skills")) {
|
|
5071
5165
|
const i = parts.indexOf("skills");
|
|
5072
5166
|
if (i + 1 < parts.length) {
|
|
5073
|
-
const skill_root = parts.slice(0, i + 2).join(
|
|
5167
|
+
const skill_root = parts.slice(0, i + 2).join(path7.sep);
|
|
5074
5168
|
if (!pruned_skill_dirs.has(skill_root)) {
|
|
5075
|
-
const skillmd =
|
|
5169
|
+
const skillmd = path7.join(skill_root, "SKILL.md");
|
|
5076
5170
|
if (pathExists(skillmd) && is_pruned(skillmd)) {
|
|
5077
5171
|
pruned_skill_dirs.add(skill_root);
|
|
5078
5172
|
}
|
|
@@ -5083,25 +5177,25 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
5083
5177
|
const keep = [];
|
|
5084
5178
|
const delete_files = [];
|
|
5085
5179
|
for (const p of paths) {
|
|
5086
|
-
const parts = p.split(
|
|
5180
|
+
const parts = p.split(path7.sep);
|
|
5087
5181
|
let is_target = false;
|
|
5088
5182
|
if (parts.includes("skills")) {
|
|
5089
5183
|
const i = parts.indexOf("skills");
|
|
5090
|
-
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(
|
|
5184
|
+
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path7.sep))) {
|
|
5091
5185
|
is_target = true;
|
|
5092
5186
|
}
|
|
5093
|
-
} else if (parts.includes("commands") &&
|
|
5187
|
+
} else if (parts.includes("commands") && path7.extname(p) === ".md" && is_pruned(p)) {
|
|
5094
5188
|
is_target = true;
|
|
5095
5189
|
}
|
|
5096
5190
|
(is_target ? delete_files : keep).push(p);
|
|
5097
5191
|
}
|
|
5098
5192
|
for (const d of pruned_skill_dirs) {
|
|
5099
|
-
|
|
5193
|
+
fs9.rmSync(d, { recursive: true, force: true });
|
|
5100
5194
|
}
|
|
5101
5195
|
for (const p of delete_files) {
|
|
5102
|
-
if (p.split(
|
|
5196
|
+
if (p.split(path7.sep).includes("commands") && pathExists(p)) {
|
|
5103
5197
|
try {
|
|
5104
|
-
|
|
5198
|
+
fs9.unlinkSync(p);
|
|
5105
5199
|
} catch {
|
|
5106
5200
|
}
|
|
5107
5201
|
}
|
|
@@ -5122,9 +5216,9 @@ function _resolve_global_settings_doc() {
|
|
|
5122
5216
|
}
|
|
5123
5217
|
function _resolve_global_settings_path() {
|
|
5124
5218
|
const root = event4u_root();
|
|
5125
|
-
const canonical =
|
|
5219
|
+
const canonical = path7.join(root, "settings", SETTINGS_FILE);
|
|
5126
5220
|
if (pathExists(canonical)) return canonical;
|
|
5127
|
-
const legacy =
|
|
5221
|
+
const legacy = path7.join(root, SETTINGS_FILE);
|
|
5128
5222
|
if (pathExists(legacy)) return legacy;
|
|
5129
5223
|
return null;
|
|
5130
5224
|
}
|
|
@@ -5173,7 +5267,7 @@ function _resolve_global_rule_scope(package_root) {
|
|
|
5173
5267
|
}
|
|
5174
5268
|
function _rule_filter_for_source(src_rel, scope) {
|
|
5175
5269
|
if (src_rel !== RULE_SOURCE_REL) return null;
|
|
5176
|
-
return (srcFile) => ruleFileArrives(srcFile, scope);
|
|
5270
|
+
return (srcFile) => ruleFileArrives(srcFile, scope) && !isExclusivelyPackageOnly(srcFile);
|
|
5177
5271
|
}
|
|
5178
5272
|
function _prune_scoped_modules(deploy_results, active_ids) {
|
|
5179
5273
|
return _prune_modules_by(
|
|
@@ -5235,7 +5329,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
5235
5329
|
info(` schema_version=1, agent_config_version=${installed_version}`);
|
|
5236
5330
|
info(` tools=${merged_tools.join(",")}`);
|
|
5237
5331
|
}
|
|
5238
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
5332
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path7.join(project_root, ".agent-src.uncondensed"))) {
|
|
5239
5333
|
const drift = collect_drift(project_root);
|
|
5240
5334
|
if (!state.QUIET) {
|
|
5241
5335
|
process2.stdout.write("\n");
|
|
@@ -5279,17 +5373,24 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
5279
5373
|
(tool_id) => deploy_results[tool_id][2] === "deploy_failed"
|
|
5280
5374
|
)
|
|
5281
5375
|
);
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
);
|
|
5290
|
-
}
|
|
5376
|
+
const corrected_tools = failed_tools.size > 0 ? merged_tools.filter((t) => !failed_tools.has(t)) : merged_tools;
|
|
5377
|
+
if (failed_tools.size > 0 && !arrayStrEqual(corrected_tools, merged_tools)) {
|
|
5378
|
+
write_lockfile(installed_version, corrected_tools, { path: write_path });
|
|
5379
|
+
if (!state.QUIET) {
|
|
5380
|
+
warn(
|
|
5381
|
+
`Lockfile corrected after deploy postcheck \u2014 dropped ${[...failed_tools].sort().join(", ")} (verification failed).`
|
|
5382
|
+
);
|
|
5291
5383
|
}
|
|
5292
5384
|
}
|
|
5385
|
+
stampHostLayerFingerprint(
|
|
5386
|
+
installed_version,
|
|
5387
|
+
corrected_tools,
|
|
5388
|
+
write_path,
|
|
5389
|
+
failed_tools.has("claude-code"),
|
|
5390
|
+
(m) => {
|
|
5391
|
+
if (!state.QUIET) info(m);
|
|
5392
|
+
}
|
|
5393
|
+
);
|
|
5293
5394
|
if (state.PROGRESS_NDJSON) {
|
|
5294
5395
|
const ordered = Object.keys(deploy_results).sort();
|
|
5295
5396
|
const total = ordered.length;
|
|
@@ -5335,19 +5436,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
5335
5436
|
}
|
|
5336
5437
|
}
|
|
5337
5438
|
}
|
|
5338
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
5439
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path7.join(project_root, ".agent-src.uncondensed"))) {
|
|
5339
5440
|
const files_by_tool = _files_by_tool_from_deploy(deploy_results);
|
|
5340
5441
|
const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
|
|
5341
5442
|
if (rc !== 0) return rc;
|
|
5342
5443
|
const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
|
|
5343
5444
|
if (removed_marker !== null && !state.QUIET) {
|
|
5344
|
-
const rel = isRelativeTo(removed_marker, project_root) ?
|
|
5445
|
+
const rel = isRelativeTo(removed_marker, project_root) ? path7.relative(project_root, removed_marker) : removed_marker;
|
|
5345
5446
|
info(`Removed legacy bridge marker: ${rel}`);
|
|
5346
5447
|
}
|
|
5347
5448
|
const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
|
|
5348
5449
|
if (anchor_paths.length > 0 && !state.QUIET) {
|
|
5349
5450
|
for (const p of anchor_paths) {
|
|
5350
|
-
const rel = isRelativeTo(p, project_root) ?
|
|
5451
|
+
const rel = isRelativeTo(p, project_root) ? path7.relative(project_root, p) : p;
|
|
5351
5452
|
info(`Project anchor written: ${rel}`);
|
|
5352
5453
|
}
|
|
5353
5454
|
}
|
|
@@ -5383,8 +5484,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
5383
5484
|
}
|
|
5384
5485
|
function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
5385
5486
|
const log_candidates = [
|
|
5386
|
-
|
|
5387
|
-
...project_root ? [
|
|
5487
|
+
path7.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
5488
|
+
...project_root ? [path7.join(project_root, OBSERVATION_LOG)] : []
|
|
5388
5489
|
];
|
|
5389
5490
|
const records = log_candidates.flatMap((p) => readObservationLog(p));
|
|
5390
5491
|
if (records.length === 0) return [];
|
|
@@ -5407,13 +5508,13 @@ function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
|
5407
5508
|
function _scoped_migration_notice(deploy_results, project_root, package_root, probe) {
|
|
5408
5509
|
if (!isInteractiveSession(probe)) return [];
|
|
5409
5510
|
const log_candidates = [
|
|
5410
|
-
|
|
5411
|
-
...project_root ? [
|
|
5511
|
+
path7.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
5512
|
+
...project_root ? [path7.join(project_root, OBSERVATION_LOG)] : []
|
|
5412
5513
|
];
|
|
5413
5514
|
const limits = knownHostLimits(log_candidates.flatMap((p) => readObservationLog(p)));
|
|
5414
5515
|
if (limits.size === 0) return [];
|
|
5415
5516
|
const resolved = _resolve_scoped_projection(package_root);
|
|
5416
|
-
const settings_path = _resolve_global_settings_path() ??
|
|
5517
|
+
const settings_path = _resolve_global_settings_path() ?? path7.join(event4u_root(), "settings", SETTINGS_FILE);
|
|
5417
5518
|
for (const tool_id of Object.keys(deploy_results).sort()) {
|
|
5418
5519
|
const [, , status] = deploy_results[tool_id];
|
|
5419
5520
|
if (status !== "deployed") continue;
|
|
@@ -5432,8 +5533,8 @@ function _scoped_migration_notice(deploy_results, project_root, package_root, pr
|
|
|
5432
5533
|
}
|
|
5433
5534
|
return [];
|
|
5434
5535
|
}
|
|
5435
|
-
var SETTINGS_SURFACE_REL =
|
|
5436
|
-
var SETTINGS_DELTA_REL =
|
|
5536
|
+
var SETTINGS_SURFACE_REL = path7.join("state", "settings-surface.json");
|
|
5537
|
+
var SETTINGS_DELTA_REL = path7.join("state", "settings-delta.json");
|
|
5437
5538
|
function _current_settings_surface(version) {
|
|
5438
5539
|
const jsonSchema = zodToJsonSchema(settingsSchema, {
|
|
5439
5540
|
name: "AgentSettings",
|
|
@@ -5444,20 +5545,20 @@ function _current_settings_surface(version) {
|
|
|
5444
5545
|
}
|
|
5445
5546
|
function _write_settings_surface_snapshot(installed_version) {
|
|
5446
5547
|
const root = event4u_root();
|
|
5447
|
-
const surface_path =
|
|
5448
|
-
const delta_path =
|
|
5548
|
+
const surface_path = path7.join(root, SETTINGS_SURFACE_REL);
|
|
5549
|
+
const delta_path = path7.join(root, SETTINGS_DELTA_REL);
|
|
5449
5550
|
const next = _current_settings_surface(installed_version);
|
|
5450
5551
|
let previous = null;
|
|
5451
5552
|
try {
|
|
5452
|
-
const parsed = JSON.parse(
|
|
5553
|
+
const parsed = JSON.parse(fs9.readFileSync(surface_path, "utf8"));
|
|
5453
5554
|
if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
|
|
5454
5555
|
} catch {
|
|
5455
5556
|
}
|
|
5456
5557
|
if (previous !== null && previous.version !== next.version) {
|
|
5457
5558
|
const delta = computeSurfaceDelta(previous, next);
|
|
5458
5559
|
if (delta.changes.length > 0) {
|
|
5459
|
-
|
|
5460
|
-
|
|
5560
|
+
fs9.mkdirSync(path7.dirname(delta_path), { recursive: true, mode: 448 });
|
|
5561
|
+
fs9.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
|
|
5461
5562
|
`, { mode: 384 });
|
|
5462
5563
|
if (!state.QUIET) {
|
|
5463
5564
|
const counts = {};
|
|
@@ -5469,8 +5570,8 @@ function _write_settings_surface_snapshot(installed_version) {
|
|
|
5469
5570
|
}
|
|
5470
5571
|
}
|
|
5471
5572
|
}
|
|
5472
|
-
|
|
5473
|
-
|
|
5573
|
+
fs9.mkdirSync(path7.dirname(surface_path), { recursive: true, mode: 448 });
|
|
5574
|
+
fs9.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
|
|
5474
5575
|
`, { mode: 384 });
|
|
5475
5576
|
}
|
|
5476
5577
|
function arrayStrEqual(a, b) {
|
|
@@ -5690,13 +5791,13 @@ function _minimal_templates_root() {
|
|
|
5690
5791
|
const chain = [start];
|
|
5691
5792
|
let cur = start;
|
|
5692
5793
|
for (; ; ) {
|
|
5693
|
-
const parent =
|
|
5794
|
+
const parent = path7.dirname(cur);
|
|
5694
5795
|
if (parent === cur) break;
|
|
5695
5796
|
chain.push(parent);
|
|
5696
5797
|
cur = parent;
|
|
5697
5798
|
}
|
|
5698
5799
|
for (const ancestor of chain) {
|
|
5699
|
-
const candidate =
|
|
5800
|
+
const candidate = path7.join(ancestor, "src", "templates", "minimal");
|
|
5700
5801
|
if (isDir(candidate)) return candidate;
|
|
5701
5802
|
}
|
|
5702
5803
|
fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
|
|
@@ -5704,9 +5805,9 @@ function _minimal_templates_root() {
|
|
|
5704
5805
|
var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
5705
5806
|
function _write_install_mode_marker(project_root, mode) {
|
|
5706
5807
|
if (mode !== "minimal" && mode !== "full") return;
|
|
5707
|
-
const marker =
|
|
5808
|
+
const marker = path7.join(project_root, INSTALL_MODE_MARKER_REL);
|
|
5708
5809
|
try {
|
|
5709
|
-
mkdirp(
|
|
5810
|
+
mkdirp(path7.dirname(marker));
|
|
5710
5811
|
writeText(marker, `${mode}
|
|
5711
5812
|
`);
|
|
5712
5813
|
} catch {
|
|
@@ -5715,7 +5816,7 @@ function _write_install_mode_marker(project_root, mode) {
|
|
|
5715
5816
|
function install_minimal(target_root_in, force, user_type = "") {
|
|
5716
5817
|
let target_root = resolvePath(target_root_in);
|
|
5717
5818
|
mkdirp(target_root);
|
|
5718
|
-
const parent =
|
|
5819
|
+
const parent = path7.dirname(target_root);
|
|
5719
5820
|
if (parent !== target_root) {
|
|
5720
5821
|
const existing = find_project_root_with_anchor(parent);
|
|
5721
5822
|
if (existing !== null && existing[0] !== target_root) {
|
|
@@ -5726,21 +5827,21 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
5726
5827
|
}
|
|
5727
5828
|
}
|
|
5728
5829
|
const templates = _minimal_templates_root();
|
|
5729
|
-
const settings_src =
|
|
5730
|
-
const overrides_gitkeep_src =
|
|
5731
|
-
const overrides_readme_src =
|
|
5830
|
+
const settings_src = path7.join(templates, SETTINGS_FILE);
|
|
5831
|
+
const overrides_gitkeep_src = path7.join(templates, "overrides-gitkeep");
|
|
5832
|
+
const overrides_readme_src = path7.join(templates, "agents-overrides-readme.md");
|
|
5732
5833
|
if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
|
|
5733
5834
|
if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
|
|
5734
5835
|
fail(`Bundled overrides scaffold templates missing under ${templates}`);
|
|
5735
5836
|
}
|
|
5736
5837
|
info(`Minimal init \u2192 ${target_root}`);
|
|
5737
|
-
const overrides_root =
|
|
5838
|
+
const overrides_root = path7.join(target_root, "agents", "overrides");
|
|
5738
5839
|
mkdirp(overrides_root);
|
|
5739
5840
|
const gitkeep_body = readText(overrides_gitkeep_src);
|
|
5740
5841
|
for (const sub of ["rules", "skills", "commands"]) {
|
|
5741
|
-
const sub_dir =
|
|
5842
|
+
const sub_dir = path7.join(overrides_root, sub);
|
|
5742
5843
|
mkdirp(sub_dir);
|
|
5743
|
-
const gitkeep_dst =
|
|
5844
|
+
const gitkeep_dst = path7.join(sub_dir, ".gitkeep");
|
|
5744
5845
|
if (pathExists(gitkeep_dst) && !force) {
|
|
5745
5846
|
skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
|
|
5746
5847
|
} else {
|
|
@@ -5748,7 +5849,7 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
5748
5849
|
success(`Wrote agents/overrides/${sub}/.gitkeep`);
|
|
5749
5850
|
}
|
|
5750
5851
|
}
|
|
5751
|
-
const readme_dst =
|
|
5852
|
+
const readme_dst = path7.join(overrides_root, "README.md");
|
|
5752
5853
|
if (pathExists(readme_dst) && !force) {
|
|
5753
5854
|
skip("agents/overrides/README.md already exists (use --force to overwrite)");
|
|
5754
5855
|
} else {
|
|
@@ -5766,14 +5867,14 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
5766
5867
|
personal:
|
|
5767
5868
|
user_type: ${user_type}
|
|
5768
5869
|
`;
|
|
5769
|
-
mkdirp(
|
|
5870
|
+
mkdirp(path7.dirname(settings_dst));
|
|
5770
5871
|
writeText(settings_dst, body);
|
|
5771
5872
|
success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
|
|
5772
5873
|
}
|
|
5773
5874
|
}
|
|
5774
5875
|
const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
|
|
5775
5876
|
if (removed_marker !== null) {
|
|
5776
|
-
const rel = isRelativeTo(removed_marker, target_root) ?
|
|
5877
|
+
const rel = isRelativeTo(removed_marker, target_root) ? path7.relative(target_root, removed_marker) : removed_marker;
|
|
5777
5878
|
success(`Removed legacy bridge marker: ${rel}`);
|
|
5778
5879
|
}
|
|
5779
5880
|
_write_install_mode_marker(target_root, "minimal");
|
|
@@ -5847,7 +5948,7 @@ function run_interactive_init(project_root, force) {
|
|
|
5847
5948
|
);
|
|
5848
5949
|
return 0;
|
|
5849
5950
|
}
|
|
5850
|
-
const target =
|
|
5951
|
+
const target = path7.join(project_root, _LOCAL_CONFIG_FILE);
|
|
5851
5952
|
if (pathExists(target) && !force) {
|
|
5852
5953
|
warn(
|
|
5853
5954
|
`${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
|
|
@@ -5874,7 +5975,7 @@ function run_interactive_init(project_root, force) {
|
|
|
5874
5975
|
warn(`Could not write ${target}: ${String(exc)}`);
|
|
5875
5976
|
return 1;
|
|
5876
5977
|
}
|
|
5877
|
-
success(`Wrote ${
|
|
5978
|
+
success(`Wrote ${path7.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
|
|
5878
5979
|
return 0;
|
|
5879
5980
|
}
|
|
5880
5981
|
var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
|
|
@@ -5892,12 +5993,12 @@ function _wizard_should_launch(opts) {
|
|
|
5892
5993
|
return [true, ""];
|
|
5893
5994
|
}
|
|
5894
5995
|
function _wizard_cli_dist(_project_root) {
|
|
5895
|
-
const package_root =
|
|
5896
|
-
const cli =
|
|
5996
|
+
const package_root = path7.dirname(path7.dirname(path7.dirname(resolvePath(_HERE))));
|
|
5997
|
+
const cli = path7.join(package_root, "dist", "cli", "agent-config.js");
|
|
5897
5998
|
return pathExists(cli) ? cli : null;
|
|
5898
5999
|
}
|
|
5899
6000
|
function _server_info_path() {
|
|
5900
|
-
return
|
|
6001
|
+
return path7.join(os3.homedir(), ".event4u", "agent-config", "local-server.json");
|
|
5901
6002
|
}
|
|
5902
6003
|
function _pid_is_agent_config(pid) {
|
|
5903
6004
|
let res;
|
|
@@ -5914,7 +6015,7 @@ function _pid_is_agent_config(pid) {
|
|
|
5914
6015
|
}
|
|
5915
6016
|
function unlinkMissingOk(p) {
|
|
5916
6017
|
try {
|
|
5917
|
-
|
|
6018
|
+
fs9.unlinkSync(p);
|
|
5918
6019
|
} catch {
|
|
5919
6020
|
}
|
|
5920
6021
|
}
|
|
@@ -5992,14 +6093,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
|
|
|
5992
6093
|
}
|
|
5993
6094
|
function _wizard_run_sync(cmd, env, cli) {
|
|
5994
6095
|
const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
|
|
5995
|
-
const log_path =
|
|
5996
|
-
|
|
6096
|
+
const log_path = path7.join(
|
|
6097
|
+
os3.tmpdir(),
|
|
5997
6098
|
`agent-config-wizard-${process2.pid}-${Date.now()}.log`
|
|
5998
6099
|
);
|
|
5999
6100
|
let child;
|
|
6000
6101
|
let log_fd = null;
|
|
6001
6102
|
try {
|
|
6002
|
-
log_fd =
|
|
6103
|
+
log_fd = fs9.openSync(log_path, "w");
|
|
6003
6104
|
child = spawn(cmd[0], cmd.slice(1), {
|
|
6004
6105
|
env,
|
|
6005
6106
|
detached: true,
|
|
@@ -6017,7 +6118,7 @@ function _wizard_run_sync(cmd, env, cli) {
|
|
|
6017
6118
|
} finally {
|
|
6018
6119
|
if (log_fd !== null) {
|
|
6019
6120
|
try {
|
|
6020
|
-
|
|
6121
|
+
fs9.closeSync(log_fd);
|
|
6021
6122
|
} catch {
|
|
6022
6123
|
}
|
|
6023
6124
|
}
|
|
@@ -6267,8 +6368,8 @@ function main2(argv) {
|
|
|
6267
6368
|
const target_root = resolvePath(
|
|
6268
6369
|
opts.custom_path || opts.project || process2.env["PROJECT_ROOT"] || process2.cwd()
|
|
6269
6370
|
);
|
|
6270
|
-
const minimal_package_root =
|
|
6271
|
-
|
|
6371
|
+
const minimal_package_root = path7.dirname(
|
|
6372
|
+
path7.dirname(path7.dirname(_minimal_templates_root()))
|
|
6272
6373
|
);
|
|
6273
6374
|
const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
|
|
6274
6375
|
return install_minimal(target_root, opts.force, validated_user_type);
|
|
@@ -6300,7 +6401,7 @@ function main2(argv) {
|
|
|
6300
6401
|
return rc2;
|
|
6301
6402
|
}
|
|
6302
6403
|
const project_root = custom_path || resolvePath(opts.project || process2.env["PROJECT_ROOT"] || process2.cwd());
|
|
6303
|
-
const is_first_run = !pathExists(
|
|
6404
|
+
const is_first_run = !pathExists(path7.join(project_root, SETTINGS_FILE));
|
|
6304
6405
|
const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
|
|
6305
6406
|
if (rc === 0 && opts.interactive) {
|
|
6306
6407
|
run_interactive_init(project_root, opts.force);
|
|
@@ -6364,16 +6465,16 @@ function _team_setup_hint_line(project_root) {
|
|
|
6364
6465
|
return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
|
|
6365
6466
|
}
|
|
6366
6467
|
function finalize_claude_model_tiers(project_root) {
|
|
6367
|
-
const claude_skills =
|
|
6368
|
-
const augment_skills =
|
|
6468
|
+
const claude_skills = path7.join(project_root, ".claude", "skills");
|
|
6469
|
+
const augment_skills = path7.join(project_root, ".augment", "skills");
|
|
6369
6470
|
if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
|
|
6370
6471
|
if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
|
|
6371
6472
|
let rendered = 0;
|
|
6372
|
-
const entries =
|
|
6473
|
+
const entries = fs9.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
6373
6474
|
for (const name of entries) {
|
|
6374
|
-
const entry =
|
|
6375
|
-
const src_dir =
|
|
6376
|
-
const src_md =
|
|
6475
|
+
const entry = path7.join(claude_skills, name);
|
|
6476
|
+
const src_dir = path7.join(augment_skills, name);
|
|
6477
|
+
const src_md = path7.join(src_dir, "SKILL.md");
|
|
6377
6478
|
let tier;
|
|
6378
6479
|
try {
|
|
6379
6480
|
tier = read_model_tier(src_md);
|
|
@@ -6382,22 +6483,22 @@ function finalize_claude_model_tiers(project_root) {
|
|
|
6382
6483
|
}
|
|
6383
6484
|
if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
|
|
6384
6485
|
if (isSymlink(entry) || isFile(entry)) {
|
|
6385
|
-
|
|
6486
|
+
fs9.unlinkSync(entry);
|
|
6386
6487
|
} else if (isDir(entry)) {
|
|
6387
|
-
|
|
6488
|
+
fs9.rmSync(entry, { recursive: true, force: true });
|
|
6388
6489
|
}
|
|
6389
6490
|
mkdirp(entry);
|
|
6390
|
-
const srcFiles =
|
|
6491
|
+
const srcFiles = fs9.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
6391
6492
|
for (const fname of srcFiles) {
|
|
6392
6493
|
if (fname === "SKILL.md") {
|
|
6393
6494
|
writeText(
|
|
6394
|
-
|
|
6495
|
+
path7.join(entry, "SKILL.md"),
|
|
6395
6496
|
render_native_model_md(readText(src_md), tier)
|
|
6396
6497
|
);
|
|
6397
6498
|
} else {
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6499
|
+
fs9.symlinkSync(
|
|
6500
|
+
path7.join("../../../.augment/skills", name, fname),
|
|
6501
|
+
path7.join(entry, fname)
|
|
6401
6502
|
);
|
|
6402
6503
|
}
|
|
6403
6504
|
}
|
|
@@ -6415,7 +6516,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
6415
6516
|
let package_type;
|
|
6416
6517
|
if (opts.package) {
|
|
6417
6518
|
package_root = resolvePath(opts.package);
|
|
6418
|
-
if (!pathExists(
|
|
6519
|
+
if (!pathExists(path7.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
6419
6520
|
fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
|
|
6420
6521
|
}
|
|
6421
6522
|
package_type = detect_package_type_for_project(project_root, package_root);
|
|
@@ -6552,9 +6653,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
6552
6653
|
function _resolvedArgv1() {
|
|
6553
6654
|
if (process2.argv[1] === void 0) return void 0;
|
|
6554
6655
|
try {
|
|
6555
|
-
return
|
|
6656
|
+
return fs9.realpathSync(path7.resolve(process2.argv[1]));
|
|
6556
6657
|
} catch {
|
|
6557
|
-
return
|
|
6658
|
+
return path7.resolve(process2.argv[1]);
|
|
6558
6659
|
}
|
|
6559
6660
|
}
|
|
6560
6661
|
var _argv1 = _resolvedArgv1();
|