@event4u/agent-config 12.0.0 → 12.1.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 +122 -0
- package/agents/templates/.ai-council.yml.example +46 -3
- package/dist/agent-src/contexts/model-recommendations.md +6 -4
- package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +1 -0
- package/dist/agent-src/scripts/roadmap_gates.ts +30 -2
- package/dist/agent-src/scripts/update_roadmap_progress.ts +32 -1
- package/dist/agent-src/skills/roadmap-writing/SKILL.md +7 -7
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +41 -3
- package/dist/cli/registry.js +1 -0
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/chunk-K34QTSD5.js +3895 -0
- package/dist/cli-delegate/{chunk-L565YFXH.js → chunk-LKZ5DOYW.js} +557 -297
- package/dist/cli-delegate/{chunk-NN4KW4HZ.js → chunk-O52B4F5S.js} +123 -2338
- package/dist/cli-delegate/cmd_conformance.js +4 -4
- package/dist/cli-delegate/cmd_doctor.js +2 -2
- package/dist/cli-delegate/cmd_export.js +1 -1
- package/dist/cli-delegate/cmd_handoff.js +1 -1
- package/dist/cli-delegate/cmd_prune.js +1 -1
- package/dist/cli-delegate/cmd_settings_migrate.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +1 -1
- package/dist/cli-delegate/cmd_uninstall.js +1 -1
- package/dist/cli-delegate/cmd_validate.js +1 -1
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +4 -4
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +1 -1
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +2 -2
- package/dist/discovery/trust-report.md +1 -1
- package/dist/discovery/workspaces.json +2 -2
- package/dist/hooks/dispatch.js +2574 -1080
- package/dist/install/install.mjs +744 -482
- package/dist/mcp/registry-manifest.json +2 -2
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +113 -10
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/model_tier.js +9 -0
- package/dist/scripts/_lib/model_tier.js.map +1 -1
- package/dist/scripts/condense.js +50 -0
- package/dist/scripts/condense.js.map +1 -1
- package/docs/MIGRATION.md +20 -1
- package/package.json +1 -1
- package/src/agent-src/scripts/roadmap_gates.ts +30 -2
- package/src/agent-src/scripts/update_roadmap_progress.ts +32 -1
- package/src/config/evaluator-budgets.json +4 -4
- package/src/config/gate-coverage.yml +39 -9
- package/src/config/gate-violation-baselines.json +6 -0
- package/src/config/hook-token-budget.json +7 -1
- package/src/config/preamble-payload-budget.json +28 -0
- package/src/scripts/_dispatch.bash +10 -0
- package/src/scripts/_lib/git_common_dir.ts +173 -0
- package/src/scripts/_lib/model_tier.ts +9 -0
- package/src/scripts/_lib/release_highlights.ts +108 -7
- package/src/scripts/_lib/skill_catalogue.ts +862 -0
- package/src/scripts/ai_council/clients.ts +182 -3
- package/src/scripts/ai_council/config.ts +16 -1
- package/src/scripts/ai_council/low_impact.ts +14 -1
- package/src/scripts/ai_council/orchestrator.ts +14 -1
- package/src/scripts/ai_council/transport_resolver.ts +32 -2
- package/src/scripts/capture_skill_catalogue.ts +185 -328
- package/src/scripts/check_branch_freshness.ts +7 -1
- package/src/scripts/check_release_published.ts +6 -2
- package/src/scripts/check_release_trunk_sync.ts +18 -2
- package/src/scripts/condense.ts +50 -1
- package/src/scripts/dispatch_r2_reviewer.ts +15 -5
- package/src/scripts/evidence_report.ts +15 -4
- package/src/scripts/hook_manifest.yaml +47 -13
- package/src/scripts/hooks/concern_registry.ts +2 -0
- package/src/scripts/hooks/orchestration_record_hook.ts +21 -0
- package/src/scripts/hooks/tool_result_bytes_hook.ts +219 -0
- package/src/scripts/hot_context_hook.ts +13 -1
- package/src/scripts/install.ts +129 -0
- package/src/scripts/janitor.ts +77 -2
- package/src/scripts/lint_plan_risk_register.ts +22 -9
- package/src/scripts/lint_roadmap_blockers.ts +109 -6
- package/src/scripts/lint_scheduled_deprecations.ts +738 -0
- package/src/scripts/migration_status.ts +17 -1
- package/src/scripts/probe_review_binding_drift.ts +731 -0
- package/src/scripts/release.ts +95 -1
- package/src/scripts/schemas/command.schema.json +2 -2
- package/src/scripts/schemas/skill.schema.json +2 -1
- package/src/scripts/schemas/subagent.schema.json +2 -2
- package/src/scripts/session_eol_report.ts +81 -0
- package/src/scripts/workspace_doctor.ts +464 -0
- package/src/scripts/worktree_cleanup_check.ts +2 -1
- package/dist/cli-delegate/chunk-AYKQGIBG.js +0 -1594
|
@@ -266,9 +266,9 @@ function subtract_pointers(doc, entries) {
|
|
|
266
266
|
// src/scripts/install.ts
|
|
267
267
|
import { spawn, spawnSync } from "node:child_process";
|
|
268
268
|
import * as crypto3 from "node:crypto";
|
|
269
|
-
import * as
|
|
269
|
+
import * as fs7 from "node:fs";
|
|
270
270
|
import * as os2 from "node:os";
|
|
271
|
-
import * as
|
|
271
|
+
import * as path6 from "node:path";
|
|
272
272
|
import process2 from "node:process";
|
|
273
273
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
274
274
|
|
|
@@ -614,10 +614,201 @@ function format_drift_report(entries) {
|
|
|
614
614
|
return lines.join("\n") + "\n";
|
|
615
615
|
}
|
|
616
616
|
|
|
617
|
-
// src/scripts/_lib/
|
|
618
|
-
import * as crypto2 from "node:crypto";
|
|
617
|
+
// src/scripts/_lib/skill_catalogue.ts
|
|
619
618
|
import * as fs3 from "node:fs";
|
|
620
619
|
import * as path3 from "node:path";
|
|
620
|
+
var OBSERVATION_LOG = path3.join(
|
|
621
|
+
"agents",
|
|
622
|
+
"evidence",
|
|
623
|
+
"metrics",
|
|
624
|
+
"skill-catalogue.jsonl"
|
|
625
|
+
);
|
|
626
|
+
function frontmatterOf(content) {
|
|
627
|
+
if (!content.startsWith("---")) return "";
|
|
628
|
+
const end = content.indexOf("\n---", 3);
|
|
629
|
+
if (end === -1) return "";
|
|
630
|
+
return content.slice(3, end);
|
|
631
|
+
}
|
|
632
|
+
function topLevelKeys(frontmatter) {
|
|
633
|
+
const keys = [];
|
|
634
|
+
for (const line of frontmatter.split("\n")) {
|
|
635
|
+
const match = /^([A-Za-z_][A-Za-z0-9_-]*):/.exec(line);
|
|
636
|
+
if (match) keys.push(match[1]);
|
|
637
|
+
}
|
|
638
|
+
return keys;
|
|
639
|
+
}
|
|
640
|
+
function descriptionOf(frontmatter) {
|
|
641
|
+
const lines = frontmatter.split("\n");
|
|
642
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
643
|
+
const match = /^description:\s*(.*)$/.exec(lines[i]);
|
|
644
|
+
if (!match) continue;
|
|
645
|
+
const rest = match[1].trim();
|
|
646
|
+
if (/^[|>][-+]?\d*$/.test(rest)) {
|
|
647
|
+
const body = [];
|
|
648
|
+
for (let j = i + 1; j < lines.length; j += 1) {
|
|
649
|
+
const line = lines[j];
|
|
650
|
+
if (line.trim() === "") {
|
|
651
|
+
body.push("");
|
|
652
|
+
continue;
|
|
653
|
+
}
|
|
654
|
+
if (!/^\s/.test(line)) break;
|
|
655
|
+
body.push(line.trim());
|
|
656
|
+
}
|
|
657
|
+
return body.join(" ").trim();
|
|
658
|
+
}
|
|
659
|
+
return rest.replace(/^["']|["']$/g, "");
|
|
660
|
+
}
|
|
661
|
+
return "";
|
|
662
|
+
}
|
|
663
|
+
function readProjectedCatalogue(root) {
|
|
664
|
+
const names = fs3.readdirSync(root).filter((n) => fs3.existsSync(path3.join(root, n, "SKILL.md"))).sort();
|
|
665
|
+
return names.map((name, index) => {
|
|
666
|
+
const content = fs3.readFileSync(path3.join(root, name, "SKILL.md"), "utf-8");
|
|
667
|
+
const frontmatter = frontmatterOf(content);
|
|
668
|
+
const description = descriptionOf(frontmatter);
|
|
669
|
+
return {
|
|
670
|
+
name,
|
|
671
|
+
position: index + 1,
|
|
672
|
+
hasDescription: description.length > 0,
|
|
673
|
+
descriptionLength: description.length,
|
|
674
|
+
description,
|
|
675
|
+
frontmatterKeys: topLevelKeys(frontmatter)
|
|
676
|
+
};
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
function truncationModeOf(record) {
|
|
680
|
+
return record.truncation_mode ?? "per-entry";
|
|
681
|
+
}
|
|
682
|
+
function markdownFilesUnder(root) {
|
|
683
|
+
if (!fs3.existsSync(root)) return [];
|
|
684
|
+
const out = [];
|
|
685
|
+
const walk = (dir) => {
|
|
686
|
+
for (const entry of fs3.readdirSync(dir, { withFileTypes: true })) {
|
|
687
|
+
const full = path3.join(dir, entry.name);
|
|
688
|
+
if (fs3.statSync(full).isDirectory()) walk(full);
|
|
689
|
+
else if (entry.name.endsWith(".md")) out.push(full);
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
walk(root);
|
|
693
|
+
return out;
|
|
694
|
+
}
|
|
695
|
+
function measureCatalogueVolume(host, root) {
|
|
696
|
+
const skillsRoot = path3.join(root, "skills");
|
|
697
|
+
const skills = fs3.existsSync(skillsRoot) ? readProjectedCatalogue(skillsRoot) : [];
|
|
698
|
+
const commandEntries = markdownFilesUnder(path3.join(root, "commands")).length;
|
|
699
|
+
return {
|
|
700
|
+
host,
|
|
701
|
+
root,
|
|
702
|
+
skillEntries: skills.length,
|
|
703
|
+
commandEntries,
|
|
704
|
+
artefacts: skills.length + commandEntries,
|
|
705
|
+
descriptionBytes: skills.reduce((sum, e) => sum + Buffer.byteLength(e.description), 0)
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
function knownHostLimits(records) {
|
|
709
|
+
const out = /* @__PURE__ */ new Map();
|
|
710
|
+
for (const record of records) {
|
|
711
|
+
if (truncationModeOf(record) !== "budget-strip-and-drop") continue;
|
|
712
|
+
if (typeof record.dropped_count !== "number") continue;
|
|
713
|
+
if (record.dropped_count <= 0) continue;
|
|
714
|
+
const previous = out.get(record.host);
|
|
715
|
+
if (previous !== void 0 && previous.observedAt > record.observed_at) continue;
|
|
716
|
+
out.set(record.host, {
|
|
717
|
+
host: record.host,
|
|
718
|
+
droppedEntries: record.dropped_count,
|
|
719
|
+
projectedVolume: record.entries_total,
|
|
720
|
+
projectedSkills: record.projected_skill_count ?? null,
|
|
721
|
+
observedAt: record.observed_at
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
return out;
|
|
725
|
+
}
|
|
726
|
+
function catalogueLimitWarning(volume, limit) {
|
|
727
|
+
if (limit === void 0) return null;
|
|
728
|
+
if (limit.projectedSkills === null) return null;
|
|
729
|
+
if (volume.skillEntries < limit.projectedSkills) return null;
|
|
730
|
+
return `${volume.host}: deploying ${volume.skillEntries} skills. This host reported dropping ${limit.droppedEntries} entries from the model-visible list when last measured (${limit.observedAt}, at ${limit.projectedSkills} skills) \u2014 that much never reaches the model. Explain: \`agent-config exec capture_skill_catalogue --limits\``;
|
|
731
|
+
}
|
|
732
|
+
function migrationEligibility(host, resolvedMode, currentSkillCount, limits) {
|
|
733
|
+
if (resolvedMode === "scoped") return { eligible: false, reason: "already-scoped" };
|
|
734
|
+
const limit = limits.get(host);
|
|
735
|
+
if (limit === void 0) return { eligible: false, reason: "no-observation-for-host" };
|
|
736
|
+
if (limit.projectedSkills === null) return { eligible: false, reason: "observation-not-comparable" };
|
|
737
|
+
if (limit.droppedEntries <= 0) return { eligible: false, reason: "no-truncation-observed" };
|
|
738
|
+
if (currentSkillCount < limit.projectedSkills) {
|
|
739
|
+
return { eligible: false, reason: "below-observed-skill-volume" };
|
|
740
|
+
}
|
|
741
|
+
return {
|
|
742
|
+
eligible: true,
|
|
743
|
+
reason: "eligible",
|
|
744
|
+
droppedEntries: limit.droppedEntries,
|
|
745
|
+
observedAt: limit.observedAt
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
function migrationPromptLines(host, eligibility, settingsPath) {
|
|
749
|
+
return [
|
|
750
|
+
`${host}: ${eligibility.droppedEntries} catalogue entries never reach the model.`,
|
|
751
|
+
`Measured on this machine (${eligibility.observedAt}). This install is on \`legacy-all\`,`,
|
|
752
|
+
"which ships everything and lets the host drop what does not fit \u2014 silently.",
|
|
753
|
+
"",
|
|
754
|
+
"Scoping the projection to your active packs is the alternative. Nothing here",
|
|
755
|
+
"changes it for you: `projection.mode` is yours to set, by hand or in the GUI.",
|
|
756
|
+
"",
|
|
757
|
+
` edit ${settingsPath}`,
|
|
758
|
+
" projection:",
|
|
759
|
+
" mode: scoped",
|
|
760
|
+
"",
|
|
761
|
+
" or agent-config config (Settings \u2192 projection)",
|
|
762
|
+
"",
|
|
763
|
+
"Keeping `legacy-all` is a legitimate choice \u2014 this is a notification, not a gate."
|
|
764
|
+
];
|
|
765
|
+
}
|
|
766
|
+
function readObservationLog(logPath) {
|
|
767
|
+
if (!fs3.existsSync(logPath)) return [];
|
|
768
|
+
const out = [];
|
|
769
|
+
for (const line of fs3.readFileSync(logPath, "utf-8").split("\n")) {
|
|
770
|
+
const trimmed = line.trim();
|
|
771
|
+
if (trimmed.length === 0) continue;
|
|
772
|
+
try {
|
|
773
|
+
out.push(JSON.parse(trimmed));
|
|
774
|
+
} catch {
|
|
775
|
+
continue;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
return out;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
// src/shared/interactiveContext.ts
|
|
782
|
+
var CI_ENV_KEYS = ["CI", "GITHUB_ACTIONS", "AGENT_CONFIG_CI"];
|
|
783
|
+
function _flagSet(env, key) {
|
|
784
|
+
const raw = (env[key] ?? "").trim();
|
|
785
|
+
return raw !== "" && raw !== "0";
|
|
786
|
+
}
|
|
787
|
+
function nonInteractiveReason(probe) {
|
|
788
|
+
for (const key of CI_ENV_KEYS) {
|
|
789
|
+
if (_flagSet(probe.env, key)) {
|
|
790
|
+
return "ci";
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
if (_flagSet(probe.env, "AGENT_CONFIG_NO_UI")) {
|
|
794
|
+
return "no-ui-requested";
|
|
795
|
+
}
|
|
796
|
+
if (!probe.stdinTty || !probe.stdoutTty) {
|
|
797
|
+
return "not-a-tty";
|
|
798
|
+
}
|
|
799
|
+
if (probe.headless === true) {
|
|
800
|
+
return "headless";
|
|
801
|
+
}
|
|
802
|
+
return null;
|
|
803
|
+
}
|
|
804
|
+
function isInteractiveSession(probe) {
|
|
805
|
+
return nonInteractiveReason(probe) === null;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
// src/scripts/_lib/claude_desktop_bundler.ts
|
|
809
|
+
import * as crypto2 from "node:crypto";
|
|
810
|
+
import * as fs4 from "node:fs";
|
|
811
|
+
import * as path4 from "node:path";
|
|
621
812
|
|
|
622
813
|
// src/scripts/_lib/zip_min.ts
|
|
623
814
|
import * as zlib from "node:zlib";
|
|
@@ -724,7 +915,7 @@ function _is_excluded(rel_parts) {
|
|
|
724
915
|
}
|
|
725
916
|
function _is_dir(p) {
|
|
726
917
|
try {
|
|
727
|
-
return
|
|
918
|
+
return fs4.statSync(p).isDirectory();
|
|
728
919
|
} catch {
|
|
729
920
|
return false;
|
|
730
921
|
}
|
|
@@ -736,12 +927,12 @@ function _compare_rel_parts(a, b) {
|
|
|
736
927
|
}
|
|
737
928
|
function _walk_skill_files(skill_dir) {
|
|
738
929
|
const out = [];
|
|
739
|
-
const resolved =
|
|
930
|
+
const resolved = fs4.realpathSync(skill_dir);
|
|
740
931
|
const walk = (root, relRoot) => {
|
|
741
932
|
const dirNames = [];
|
|
742
933
|
const fileNames = [];
|
|
743
|
-
for (const dirent of
|
|
744
|
-
const full =
|
|
934
|
+
for (const dirent of fs4.readdirSync(root, { withFileTypes: true })) {
|
|
935
|
+
const full = path4.join(root, dirent.name);
|
|
745
936
|
const isDir2 = dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full);
|
|
746
937
|
if (isDir2) {
|
|
747
938
|
dirNames.push(dirent.name);
|
|
@@ -754,13 +945,13 @@ function _walk_skill_files(skill_dir) {
|
|
|
754
945
|
if (_is_excluded(rel_parts)) {
|
|
755
946
|
continue;
|
|
756
947
|
}
|
|
757
|
-
out.push([
|
|
948
|
+
out.push([path4.join(root, fname), rel_parts]);
|
|
758
949
|
}
|
|
759
950
|
for (const dname of dirNames) {
|
|
760
951
|
if (_is_excluded([dname])) {
|
|
761
952
|
continue;
|
|
762
953
|
}
|
|
763
|
-
walk(
|
|
954
|
+
walk(path4.join(root, dname), [...relRoot, dname]);
|
|
764
955
|
}
|
|
765
956
|
};
|
|
766
957
|
walk(resolved, []);
|
|
@@ -773,53 +964,53 @@ function _manifest_digest(files) {
|
|
|
773
964
|
const rel = rel_parts.join("/");
|
|
774
965
|
h.update(Buffer.from(rel, "utf-8"));
|
|
775
966
|
h.update(Buffer.from([0]));
|
|
776
|
-
h.update(crypto2.createHash("sha256").update(
|
|
967
|
+
h.update(crypto2.createHash("sha256").update(fs4.readFileSync(abs_path)).digest());
|
|
777
968
|
h.update(Buffer.from([0]));
|
|
778
969
|
}
|
|
779
970
|
return h.digest("hex");
|
|
780
971
|
}
|
|
781
972
|
function _atomic_write_zip(zip_path, files) {
|
|
782
|
-
|
|
783
|
-
const stem =
|
|
784
|
-
const tmp_path =
|
|
785
|
-
|
|
973
|
+
fs4.mkdirSync(path4.dirname(zip_path), { recursive: true });
|
|
974
|
+
const stem = path4.basename(zip_path, path4.extname(zip_path));
|
|
975
|
+
const tmp_path = path4.join(
|
|
976
|
+
path4.dirname(zip_path),
|
|
786
977
|
`.${stem}.${crypto2.randomBytes(6).toString("hex")}.zip.tmp`
|
|
787
978
|
);
|
|
788
979
|
try {
|
|
789
980
|
const entries = files.map(([abs_path, rel_parts]) => ({
|
|
790
981
|
name: rel_parts.join("/"),
|
|
791
|
-
data:
|
|
982
|
+
data: fs4.readFileSync(abs_path)
|
|
792
983
|
}));
|
|
793
|
-
|
|
794
|
-
|
|
984
|
+
fs4.writeFileSync(tmp_path, zip_write_sync(entries));
|
|
985
|
+
fs4.renameSync(tmp_path, zip_path);
|
|
795
986
|
} finally {
|
|
796
|
-
if (
|
|
797
|
-
|
|
987
|
+
if (fs4.existsSync(tmp_path)) {
|
|
988
|
+
fs4.unlinkSync(tmp_path);
|
|
798
989
|
}
|
|
799
990
|
}
|
|
800
991
|
}
|
|
801
992
|
function _write_if_changed(dest_dir, slug, files, force, written) {
|
|
802
993
|
const digest = _manifest_digest(files);
|
|
803
|
-
const zip_path =
|
|
804
|
-
const digest_path =
|
|
805
|
-
const recorded =
|
|
806
|
-
if (!force && recorded === digest &&
|
|
994
|
+
const zip_path = path4.join(dest_dir, `${slug}.zip`);
|
|
995
|
+
const digest_path = path4.join(dest_dir, `${slug}.sha256`);
|
|
996
|
+
const recorded = fs4.existsSync(digest_path) ? fs4.readFileSync(digest_path, "utf-8").trim() : "";
|
|
997
|
+
if (!force && recorded === digest && fs4.existsSync(zip_path)) {
|
|
807
998
|
return;
|
|
808
999
|
}
|
|
809
1000
|
_atomic_write_zip(zip_path, files);
|
|
810
|
-
|
|
1001
|
+
fs4.writeFileSync(digest_path, digest + "\n", "utf-8");
|
|
811
1002
|
written.push(zip_path);
|
|
812
1003
|
}
|
|
813
1004
|
function build_skill_bundles(package_root, dest_dir, force = false, curation = null) {
|
|
814
|
-
const skills_root =
|
|
1005
|
+
const skills_root = path4.join(package_root, "dist/agent-src", "skills");
|
|
815
1006
|
if (!_is_dir(skills_root)) {
|
|
816
1007
|
return [];
|
|
817
1008
|
}
|
|
818
|
-
|
|
1009
|
+
fs4.mkdirSync(dest_dir, { recursive: true });
|
|
819
1010
|
const written = [];
|
|
820
|
-
for (const name of
|
|
821
|
-
const entry =
|
|
822
|
-
const isSymlink2 =
|
|
1011
|
+
for (const name of fs4.readdirSync(skills_root).sort()) {
|
|
1012
|
+
const entry = path4.join(skills_root, name);
|
|
1013
|
+
const isSymlink2 = fs4.lstatSync(entry).isSymbolicLink();
|
|
823
1014
|
if (!(_is_dir(entry) || isSymlink2)) {
|
|
824
1015
|
continue;
|
|
825
1016
|
}
|
|
@@ -827,8 +1018,8 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
|
|
|
827
1018
|
if (curation !== null && !curation.includes(skill_name)) {
|
|
828
1019
|
continue;
|
|
829
1020
|
}
|
|
830
|
-
const skill_md =
|
|
831
|
-
if (!
|
|
1021
|
+
const skill_md = path4.join(entry, "SKILL.md");
|
|
1022
|
+
if (!fs4.existsSync(skill_md)) {
|
|
832
1023
|
continue;
|
|
833
1024
|
}
|
|
834
1025
|
const files = _walk_skill_files(entry);
|
|
@@ -840,15 +1031,15 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
|
|
|
840
1031
|
return written;
|
|
841
1032
|
}
|
|
842
1033
|
function _command_slug(source_file, commands_root) {
|
|
843
|
-
const rel =
|
|
844
|
-
const noExt = rel.slice(0, rel.length -
|
|
845
|
-
return noExt.split(
|
|
1034
|
+
const rel = path4.relative(commands_root, source_file);
|
|
1035
|
+
const noExt = rel.slice(0, rel.length - path4.extname(rel).length);
|
|
1036
|
+
return noExt.split(path4.sep).join("-");
|
|
846
1037
|
}
|
|
847
1038
|
function _iter_command_files(commands_root) {
|
|
848
1039
|
const found = [];
|
|
849
1040
|
const walk = (dir) => {
|
|
850
|
-
for (const dirent of
|
|
851
|
-
const full =
|
|
1041
|
+
for (const dirent of fs4.readdirSync(dir, { withFileTypes: true })) {
|
|
1042
|
+
const full = path4.join(dir, dirent.name);
|
|
852
1043
|
if (dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full)) {
|
|
853
1044
|
walk(full);
|
|
854
1045
|
} else if (dirent.name.endsWith(".md")) {
|
|
@@ -858,21 +1049,21 @@ function _iter_command_files(commands_root) {
|
|
|
858
1049
|
};
|
|
859
1050
|
walk(commands_root);
|
|
860
1051
|
found.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
861
|
-
return found.filter((source_file) =>
|
|
1052
|
+
return found.filter((source_file) => path4.basename(source_file) !== "AGENTS.md");
|
|
862
1053
|
}
|
|
863
1054
|
function build_command_bundles(package_root, dest_dir, force = false, curation = null) {
|
|
864
|
-
const commands_root =
|
|
1055
|
+
const commands_root = path4.join(package_root, "dist/agent-src", "commands");
|
|
865
1056
|
if (!_is_dir(commands_root)) {
|
|
866
1057
|
return [];
|
|
867
1058
|
}
|
|
868
|
-
const skills_root =
|
|
1059
|
+
const skills_root = path4.join(package_root, "dist/agent-src", "skills");
|
|
869
1060
|
let skill_names = /* @__PURE__ */ new Set();
|
|
870
1061
|
if (_is_dir(skills_root)) {
|
|
871
1062
|
skill_names = new Set(
|
|
872
|
-
|
|
1063
|
+
fs4.readdirSync(skills_root).filter((name) => _is_dir(path4.join(skills_root, name)))
|
|
873
1064
|
);
|
|
874
1065
|
}
|
|
875
|
-
|
|
1066
|
+
fs4.mkdirSync(dest_dir, { recursive: true });
|
|
876
1067
|
const written = [];
|
|
877
1068
|
for (const source_file of _iter_command_files(commands_root)) {
|
|
878
1069
|
const slug = _command_slug(source_file, commands_root);
|
|
@@ -882,7 +1073,7 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
|
|
|
882
1073
|
if (curation !== null && !curation.includes(slug)) {
|
|
883
1074
|
continue;
|
|
884
1075
|
}
|
|
885
|
-
const files = [[
|
|
1076
|
+
const files = [[fs4.realpathSync(source_file), ["SKILL.md"]]];
|
|
886
1077
|
_write_if_changed(dest_dir, slug, files, force, written);
|
|
887
1078
|
}
|
|
888
1079
|
return written;
|
|
@@ -2243,8 +2434,8 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
2243
2434
|
};
|
|
2244
2435
|
|
|
2245
2436
|
// src/scripts/_lib/module_detection.ts
|
|
2246
|
-
import * as
|
|
2247
|
-
import * as
|
|
2437
|
+
import * as fs5 from "node:fs";
|
|
2438
|
+
import * as path5 from "node:path";
|
|
2248
2439
|
var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
|
|
2249
2440
|
var _RULES = [
|
|
2250
2441
|
["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
|
|
@@ -2258,14 +2449,14 @@ var _RULES = [
|
|
|
2258
2449
|
];
|
|
2259
2450
|
function _isDir(p) {
|
|
2260
2451
|
try {
|
|
2261
|
-
return
|
|
2452
|
+
return fs5.statSync(p).isDirectory();
|
|
2262
2453
|
} catch {
|
|
2263
2454
|
return false;
|
|
2264
2455
|
}
|
|
2265
2456
|
}
|
|
2266
2457
|
function _isFile(p) {
|
|
2267
2458
|
try {
|
|
2268
|
-
return
|
|
2459
|
+
return fs5.statSync(p).isFile();
|
|
2269
2460
|
} catch {
|
|
2270
2461
|
return false;
|
|
2271
2462
|
}
|
|
@@ -2279,13 +2470,13 @@ function _isUpperChar(ch) {
|
|
|
2279
2470
|
function _list_module_subdirs(root) {
|
|
2280
2471
|
let entries;
|
|
2281
2472
|
try {
|
|
2282
|
-
entries =
|
|
2473
|
+
entries = fs5.readdirSync(root).sort();
|
|
2283
2474
|
} catch {
|
|
2284
2475
|
return [];
|
|
2285
2476
|
}
|
|
2286
2477
|
const out = [];
|
|
2287
2478
|
for (const name of entries) {
|
|
2288
|
-
if (!_isDir(
|
|
2479
|
+
if (!_isDir(path5.join(root, name))) {
|
|
2289
2480
|
continue;
|
|
2290
2481
|
}
|
|
2291
2482
|
if (name.startsWith(".")) {
|
|
@@ -2307,11 +2498,11 @@ function _score_confidence(stack, root, subdirs) {
|
|
|
2307
2498
|
return capitalized.length > 0 ? "high" : "medium";
|
|
2308
2499
|
}
|
|
2309
2500
|
if (stack === "node-monorepo") {
|
|
2310
|
-
const withPkgJson = subdirs.filter((name) => _isFile(
|
|
2501
|
+
const withPkgJson = subdirs.filter((name) => _isFile(path5.join(root, name, "package.json")));
|
|
2311
2502
|
return withPkgJson.length > 0 ? "high" : "medium";
|
|
2312
2503
|
}
|
|
2313
2504
|
if (stack === "python-src") {
|
|
2314
|
-
const withInit = subdirs.filter((name) => _isFile(
|
|
2505
|
+
const withInit = subdirs.filter((name) => _isFile(path5.join(root, name, "__init__.py")));
|
|
2315
2506
|
return withInit.length > 0 ? "high" : "medium";
|
|
2316
2507
|
}
|
|
2317
2508
|
if (stack === "go-internal") {
|
|
@@ -2323,7 +2514,7 @@ function detect_module_roots(project_root) {
|
|
|
2323
2514
|
const high = [];
|
|
2324
2515
|
const medium = [];
|
|
2325
2516
|
for (const [rel_path, stack, namespace_template] of _RULES) {
|
|
2326
|
-
const abs_path =
|
|
2517
|
+
const abs_path = path5.join(project_root, rel_path);
|
|
2327
2518
|
if (!_isDir(abs_path)) {
|
|
2328
2519
|
continue;
|
|
2329
2520
|
}
|
|
@@ -2345,16 +2536,17 @@ function detect_module_roots(project_root) {
|
|
|
2345
2536
|
}
|
|
2346
2537
|
|
|
2347
2538
|
// src/scripts/_lib/model_tier.ts
|
|
2348
|
-
import
|
|
2539
|
+
import fs6 from "node:fs";
|
|
2349
2540
|
var TIER_TO_CLAUDE_MODEL = {
|
|
2541
|
+
frontier: "fable",
|
|
2350
2542
|
high: "opus",
|
|
2351
2543
|
medium: "sonnet",
|
|
2352
2544
|
lite: "haiku"
|
|
2353
2545
|
};
|
|
2354
2546
|
var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
|
|
2355
2547
|
function read_model_tier(skill_md) {
|
|
2356
|
-
if (!
|
|
2357
|
-
const text =
|
|
2548
|
+
if (!fs6.existsSync(skill_md)) return null;
|
|
2549
|
+
const text = fs6.readFileSync(skill_md).toString("utf-8");
|
|
2358
2550
|
if (!text.startsWith("---\n")) return null;
|
|
2359
2551
|
const end = text.indexOf("\n---\n", 4);
|
|
2360
2552
|
if (end === -1) return null;
|
|
@@ -2388,34 +2580,34 @@ var ArgparseExit = class extends Error {
|
|
|
2388
2580
|
function expanduser2(p) {
|
|
2389
2581
|
if (p === "~") return os2.homedir();
|
|
2390
2582
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
2391
|
-
return
|
|
2583
|
+
return path6.join(os2.homedir(), p.slice(2));
|
|
2392
2584
|
}
|
|
2393
2585
|
return p;
|
|
2394
2586
|
}
|
|
2395
2587
|
function resolvePath(p) {
|
|
2396
2588
|
try {
|
|
2397
|
-
return
|
|
2589
|
+
return fs7.realpathSync(path6.resolve(p));
|
|
2398
2590
|
} catch {
|
|
2399
|
-
return
|
|
2591
|
+
return path6.resolve(p);
|
|
2400
2592
|
}
|
|
2401
2593
|
}
|
|
2402
2594
|
function isFile(p) {
|
|
2403
2595
|
try {
|
|
2404
|
-
return
|
|
2596
|
+
return fs7.statSync(p).isFile();
|
|
2405
2597
|
} catch {
|
|
2406
2598
|
return false;
|
|
2407
2599
|
}
|
|
2408
2600
|
}
|
|
2409
2601
|
function isDir(p) {
|
|
2410
2602
|
try {
|
|
2411
|
-
return
|
|
2603
|
+
return fs7.statSync(p).isDirectory();
|
|
2412
2604
|
} catch {
|
|
2413
2605
|
return false;
|
|
2414
2606
|
}
|
|
2415
2607
|
}
|
|
2416
2608
|
function pathExists(p) {
|
|
2417
2609
|
try {
|
|
2418
|
-
|
|
2610
|
+
fs7.statSync(p);
|
|
2419
2611
|
return true;
|
|
2420
2612
|
} catch {
|
|
2421
2613
|
return false;
|
|
@@ -2423,24 +2615,24 @@ function pathExists(p) {
|
|
|
2423
2615
|
}
|
|
2424
2616
|
function isSymlink(p) {
|
|
2425
2617
|
try {
|
|
2426
|
-
return
|
|
2618
|
+
return fs7.lstatSync(p).isSymbolicLink();
|
|
2427
2619
|
} catch {
|
|
2428
2620
|
return false;
|
|
2429
2621
|
}
|
|
2430
2622
|
}
|
|
2431
2623
|
function readText(p) {
|
|
2432
|
-
return
|
|
2624
|
+
return fs7.readFileSync(p, "utf-8");
|
|
2433
2625
|
}
|
|
2434
2626
|
function writeText(p, content) {
|
|
2435
|
-
|
|
2627
|
+
fs7.writeFileSync(p, content, "utf-8");
|
|
2436
2628
|
}
|
|
2437
2629
|
function mkdirp(p) {
|
|
2438
|
-
|
|
2630
|
+
fs7.mkdirSync(p, { recursive: true });
|
|
2439
2631
|
}
|
|
2440
2632
|
function sortedGlobStems(directory, suffix) {
|
|
2441
2633
|
let entries;
|
|
2442
2634
|
try {
|
|
2443
|
-
entries =
|
|
2635
|
+
entries = fs7.readdirSync(directory);
|
|
2444
2636
|
} catch {
|
|
2445
2637
|
return [];
|
|
2446
2638
|
}
|
|
@@ -2460,7 +2652,7 @@ function sortedGlobStems(directory, suffix) {
|
|
|
2460
2652
|
function countZips(directory) {
|
|
2461
2653
|
if (!isDir(directory)) return 0;
|
|
2462
2654
|
let n = 0;
|
|
2463
|
-
for (const name of
|
|
2655
|
+
for (const name of fs7.readdirSync(directory)) {
|
|
2464
2656
|
if (name.endsWith(".zip")) n += 1;
|
|
2465
2657
|
}
|
|
2466
2658
|
return n;
|
|
@@ -2468,35 +2660,35 @@ function countZips(directory) {
|
|
|
2468
2660
|
function sha256OfFile(p) {
|
|
2469
2661
|
let data;
|
|
2470
2662
|
try {
|
|
2471
|
-
data =
|
|
2663
|
+
data = fs7.readFileSync(p);
|
|
2472
2664
|
} catch {
|
|
2473
2665
|
return null;
|
|
2474
2666
|
}
|
|
2475
2667
|
return crypto3.createHash("sha256").update(data).digest("hex");
|
|
2476
2668
|
}
|
|
2477
2669
|
function atomicWrite0644(target, body, prefix) {
|
|
2478
|
-
const dir =
|
|
2479
|
-
const tmpName =
|
|
2670
|
+
const dir = path6.dirname(target);
|
|
2671
|
+
const tmpName = path6.join(
|
|
2480
2672
|
dir,
|
|
2481
2673
|
`${prefix}${process2.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
|
|
2482
2674
|
);
|
|
2483
2675
|
let fd = null;
|
|
2484
2676
|
try {
|
|
2485
|
-
fd =
|
|
2486
|
-
|
|
2487
|
-
|
|
2677
|
+
fd = fs7.openSync(tmpName, "wx", 420);
|
|
2678
|
+
fs7.writeFileSync(fd, body, "utf-8");
|
|
2679
|
+
fs7.closeSync(fd);
|
|
2488
2680
|
fd = null;
|
|
2489
|
-
|
|
2490
|
-
|
|
2681
|
+
fs7.chmodSync(tmpName, 420);
|
|
2682
|
+
fs7.renameSync(tmpName, target);
|
|
2491
2683
|
} catch (err) {
|
|
2492
2684
|
if (fd !== null) {
|
|
2493
2685
|
try {
|
|
2494
|
-
|
|
2686
|
+
fs7.closeSync(fd);
|
|
2495
2687
|
} catch {
|
|
2496
2688
|
}
|
|
2497
2689
|
}
|
|
2498
2690
|
try {
|
|
2499
|
-
|
|
2691
|
+
fs7.unlinkSync(tmpName);
|
|
2500
2692
|
} catch {
|
|
2501
2693
|
}
|
|
2502
2694
|
throw err;
|
|
@@ -2620,12 +2812,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
|
|
|
2620
2812
|
var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
|
|
2621
2813
|
var SETTINGS_SUBDIR = ["agents", "settings"];
|
|
2622
2814
|
function _canonical_settings_target(project_root) {
|
|
2623
|
-
return
|
|
2815
|
+
return path6.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
|
|
2624
2816
|
}
|
|
2625
2817
|
function _resolve_settings_read(project_root) {
|
|
2626
2818
|
const canonical = _canonical_settings_target(project_root);
|
|
2627
2819
|
if (pathExists(canonical)) return canonical;
|
|
2628
|
-
const legacy =
|
|
2820
|
+
const legacy = path6.join(project_root, SETTINGS_FILE);
|
|
2629
2821
|
if (pathExists(legacy)) return legacy;
|
|
2630
2822
|
return canonical;
|
|
2631
2823
|
}
|
|
@@ -2689,9 +2881,9 @@ function fail(msg) {
|
|
|
2689
2881
|
throw new SystemExitError(1);
|
|
2690
2882
|
}
|
|
2691
2883
|
function detect_package_root(project_root) {
|
|
2692
|
-
const npm_path =
|
|
2884
|
+
const npm_path = path6.join(project_root, "node_modules", "@event4u", "agent-config");
|
|
2693
2885
|
if (isDir(npm_path)) return resolvePath(npm_path);
|
|
2694
|
-
if (pathExists(
|
|
2886
|
+
if (pathExists(path6.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
2695
2887
|
return project_root;
|
|
2696
2888
|
}
|
|
2697
2889
|
fail(
|
|
@@ -2699,12 +2891,12 @@ function detect_package_root(project_root) {
|
|
|
2699
2891
|
);
|
|
2700
2892
|
}
|
|
2701
2893
|
function detect_package_type(package_root) {
|
|
2702
|
-
if (package_root.split(
|
|
2894
|
+
if (package_root.split(path6.sep).includes("node_modules")) return "npm";
|
|
2703
2895
|
return "local";
|
|
2704
2896
|
}
|
|
2705
2897
|
function detect_package_type_for_project(project_root, package_root) {
|
|
2706
2898
|
const npm_path = resolvePath(
|
|
2707
|
-
|
|
2899
|
+
path6.join(project_root, "node_modules", "@event4u", "agent-config")
|
|
2708
2900
|
);
|
|
2709
2901
|
const package_resolved = resolvePath(package_root);
|
|
2710
2902
|
if (package_resolved === npm_path) return "npm";
|
|
@@ -2724,7 +2916,7 @@ function ensure_directory(p) {
|
|
|
2724
2916
|
mkdirp(p);
|
|
2725
2917
|
}
|
|
2726
2918
|
function write_file(p, content) {
|
|
2727
|
-
ensure_directory(
|
|
2919
|
+
ensure_directory(path6.dirname(p));
|
|
2728
2920
|
writeText(p, content);
|
|
2729
2921
|
}
|
|
2730
2922
|
function read_json_file(p) {
|
|
@@ -2895,7 +3087,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
|
|
|
2895
3087
|
return rendered + "\n" + suffix;
|
|
2896
3088
|
}
|
|
2897
3089
|
function _migrate_legacy_if_present(project_root, template_body) {
|
|
2898
|
-
const legacy_target =
|
|
3090
|
+
const legacy_target = path6.join(project_root, LEGACY_SETTINGS_FILE);
|
|
2899
3091
|
if (!isFile(legacy_target)) return null;
|
|
2900
3092
|
const legacy_text = readText(legacy_target);
|
|
2901
3093
|
const [values, unknown] = _parse_legacy_settings(legacy_text);
|
|
@@ -2910,9 +3102,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
|
|
|
2910
3102
|
}
|
|
2911
3103
|
}
|
|
2912
3104
|
rendered = _append_unknown_legacy(rendered, values, unknown);
|
|
2913
|
-
const backup_target =
|
|
3105
|
+
const backup_target = path6.join(project_root, LEGACY_BACKUP_FILE);
|
|
2914
3106
|
writeText(backup_target, legacy_text);
|
|
2915
|
-
|
|
3107
|
+
fs7.unlinkSync(legacy_target);
|
|
2916
3108
|
info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
|
|
2917
3109
|
info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
|
|
2918
3110
|
if (unknown.length > 0) {
|
|
@@ -2947,7 +3139,7 @@ function _render_template(template, profile_values) {
|
|
|
2947
3139
|
return body;
|
|
2948
3140
|
}
|
|
2949
3141
|
function _load_valid_user_types(package_root) {
|
|
2950
|
-
const directory =
|
|
3142
|
+
const directory = path6.join(package_root, USER_TYPES_DIR);
|
|
2951
3143
|
if (!isDir(directory)) return [];
|
|
2952
3144
|
return sortedGlobStems(directory, ".yml");
|
|
2953
3145
|
}
|
|
@@ -3004,8 +3196,8 @@ function splitlinesKeepends(text) {
|
|
|
3004
3196
|
}
|
|
3005
3197
|
function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
|
|
3006
3198
|
const target = _canonical_settings_target(project_root);
|
|
3007
|
-
const profile_source =
|
|
3008
|
-
const template_source =
|
|
3199
|
+
const profile_source = path6.join(package_root, "src", "config", "profiles", `${profile}.ini`);
|
|
3200
|
+
const template_source = path6.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
3009
3201
|
if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
|
|
3010
3202
|
if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
|
|
3011
3203
|
const template = readText(template_source);
|
|
@@ -3019,21 +3211,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
3019
3211
|
if (profile_values["rule_loading_tier"] !== profile) {
|
|
3020
3212
|
const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
|
|
3021
3213
|
fail(
|
|
3022
|
-
`Profile preset ${
|
|
3214
|
+
`Profile preset ${path6.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
|
|
3023
3215
|
);
|
|
3024
3216
|
}
|
|
3025
3217
|
profile_values["user_type"] = _validate_user_type(package_root, user_type);
|
|
3026
3218
|
let template_body = _render_template(template, profile_values);
|
|
3027
3219
|
template_body = _inject_packs(template_body, packs ?? []);
|
|
3028
|
-
const legacy_root =
|
|
3220
|
+
const legacy_root = path6.join(project_root, SETTINGS_FILE);
|
|
3029
3221
|
if (isFile(legacy_root) && !pathExists(target)) {
|
|
3030
|
-
mkdirp(
|
|
3222
|
+
mkdirp(path6.dirname(target));
|
|
3031
3223
|
writeText(target, readText(legacy_root));
|
|
3032
|
-
|
|
3224
|
+
fs7.unlinkSync(legacy_root);
|
|
3033
3225
|
success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
|
|
3034
3226
|
return;
|
|
3035
3227
|
}
|
|
3036
|
-
const legacy_target =
|
|
3228
|
+
const legacy_target = path6.join(project_root, LEGACY_SETTINGS_FILE);
|
|
3037
3229
|
if (isFile(legacy_target) && pathExists(target)) {
|
|
3038
3230
|
warn(
|
|
3039
3231
|
`Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
|
|
@@ -3050,7 +3242,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
3050
3242
|
skip(`${SETTINGS_FILE} already exists`);
|
|
3051
3243
|
return;
|
|
3052
3244
|
}
|
|
3053
|
-
mkdirp(
|
|
3245
|
+
mkdirp(path6.dirname(target));
|
|
3054
3246
|
write_file(target, template_body);
|
|
3055
3247
|
const user_type_value = profile_values["user_type"] ?? "";
|
|
3056
3248
|
const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
|
|
@@ -3063,7 +3255,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
3063
3255
|
const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
|
|
3064
3256
|
const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
|
|
3065
3257
|
return merge_json_file(
|
|
3066
|
-
|
|
3258
|
+
path6.join(project_root, ".vscode", "settings.json"),
|
|
3067
3259
|
bridge,
|
|
3068
3260
|
force,
|
|
3069
3261
|
".vscode/settings.json"
|
|
@@ -3072,14 +3264,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
3072
3264
|
function ensure_augment_bridge(project_root, force) {
|
|
3073
3265
|
const bridge = { enabledPlugins: { "agent-config@event4u": true } };
|
|
3074
3266
|
return merge_json_file(
|
|
3075
|
-
|
|
3267
|
+
path6.join(project_root, ".augment", "settings.json"),
|
|
3076
3268
|
bridge,
|
|
3077
3269
|
force,
|
|
3078
3270
|
".augment/settings.json"
|
|
3079
3271
|
);
|
|
3080
3272
|
}
|
|
3081
|
-
var AUGMENT_USER_DIR =
|
|
3082
|
-
var AUGMENT_USER_HOOKS_DIR =
|
|
3273
|
+
var AUGMENT_USER_DIR = path6.join(os2.homedir(), ".augment");
|
|
3274
|
+
var AUGMENT_USER_HOOKS_DIR = path6.join(AUGMENT_USER_DIR, "hooks");
|
|
3083
3275
|
var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
|
|
3084
3276
|
var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
3085
3277
|
"augment-chat-history.sh",
|
|
@@ -3095,29 +3287,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
|
|
|
3095
3287
|
["post_tool_use", "PostToolUse"]
|
|
3096
3288
|
];
|
|
3097
3289
|
function _deploy_augment_trampoline(package_root, name, force) {
|
|
3098
|
-
const src =
|
|
3290
|
+
const src = path6.join(package_root, "scripts", "hooks", name);
|
|
3099
3291
|
if (!pathExists(src)) {
|
|
3100
3292
|
skip(`augment trampoline missing in package: ${src}`);
|
|
3101
3293
|
return null;
|
|
3102
3294
|
}
|
|
3103
3295
|
mkdirp(AUGMENT_USER_HOOKS_DIR);
|
|
3104
|
-
const dst =
|
|
3296
|
+
const dst = path6.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
3105
3297
|
const src_text = readText(src);
|
|
3106
3298
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3107
3299
|
skip(`~/.augment/hooks/${name} already up to date`);
|
|
3108
3300
|
} else {
|
|
3109
3301
|
writeText(dst, src_text);
|
|
3110
|
-
|
|
3302
|
+
fs7.chmodSync(dst, 493);
|
|
3111
3303
|
success(`~/.augment/hooks/${name} installed`);
|
|
3112
3304
|
}
|
|
3113
3305
|
return dst;
|
|
3114
3306
|
}
|
|
3115
3307
|
function _remove_legacy_augment_trampolines() {
|
|
3116
3308
|
for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
|
|
3117
|
-
const legacy =
|
|
3309
|
+
const legacy = path6.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
3118
3310
|
try {
|
|
3119
3311
|
if (isFile(legacy)) {
|
|
3120
|
-
|
|
3312
|
+
fs7.unlinkSync(legacy);
|
|
3121
3313
|
skip(`removed legacy ~/.augment/hooks/${name}`);
|
|
3122
3314
|
}
|
|
3123
3315
|
} catch (err) {
|
|
@@ -3137,7 +3329,7 @@ function ensure_augment_user_hooks(package_root, force) {
|
|
|
3137
3329
|
}
|
|
3138
3330
|
const settings_patch = { hooks: per_event };
|
|
3139
3331
|
return merge_json_file(
|
|
3140
|
-
|
|
3332
|
+
path6.join(AUGMENT_USER_DIR, "settings.json"),
|
|
3141
3333
|
settings_patch,
|
|
3142
3334
|
force,
|
|
3143
3335
|
"~/.augment/settings.json"
|
|
@@ -3162,7 +3354,7 @@ function _heal_legacy_claude_plugin_ids(p) {
|
|
|
3162
3354
|
return removed;
|
|
3163
3355
|
}
|
|
3164
3356
|
function ensure_claude_bridge(project_root, force) {
|
|
3165
|
-
const target =
|
|
3357
|
+
const target = path6.join(project_root, ".claude", "settings.json");
|
|
3166
3358
|
const healed = _heal_legacy_claude_plugin_ids(target);
|
|
3167
3359
|
for (const pid of healed) {
|
|
3168
3360
|
success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
|
|
@@ -3187,29 +3379,29 @@ function ensure_cursor_bridge(project_root, force) {
|
|
|
3187
3379
|
}
|
|
3188
3380
|
const bridge = { version: 1, hooks };
|
|
3189
3381
|
return merge_json_file(
|
|
3190
|
-
|
|
3382
|
+
path6.join(project_root, ".cursor", "hooks.json"),
|
|
3191
3383
|
bridge,
|
|
3192
3384
|
force,
|
|
3193
3385
|
".cursor/hooks.json"
|
|
3194
3386
|
);
|
|
3195
3387
|
}
|
|
3196
|
-
var CURSOR_USER_DIR =
|
|
3197
|
-
var CURSOR_USER_HOOKS_DIR =
|
|
3388
|
+
var CURSOR_USER_DIR = path6.join(os2.homedir(), ".cursor");
|
|
3389
|
+
var CURSOR_USER_HOOKS_DIR = path6.join(CURSOR_USER_DIR, "hooks");
|
|
3198
3390
|
var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
|
|
3199
3391
|
function ensure_cursor_user_hooks(package_root, force) {
|
|
3200
|
-
const src =
|
|
3392
|
+
const src = path6.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
|
|
3201
3393
|
if (!pathExists(src)) {
|
|
3202
3394
|
skip(`cursor trampoline missing in package: ${src}`);
|
|
3203
3395
|
return [];
|
|
3204
3396
|
}
|
|
3205
3397
|
mkdirp(CURSOR_USER_HOOKS_DIR);
|
|
3206
|
-
const dst =
|
|
3398
|
+
const dst = path6.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
|
|
3207
3399
|
const src_text = readText(src);
|
|
3208
3400
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3209
3401
|
skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3210
3402
|
} else {
|
|
3211
3403
|
writeText(dst, src_text);
|
|
3212
|
-
|
|
3404
|
+
fs7.chmodSync(dst, 493);
|
|
3213
3405
|
success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
|
|
3214
3406
|
}
|
|
3215
3407
|
const hooks = {};
|
|
@@ -3218,7 +3410,7 @@ function ensure_cursor_user_hooks(package_root, force) {
|
|
|
3218
3410
|
}
|
|
3219
3411
|
const settings_patch = { version: 1, hooks };
|
|
3220
3412
|
return merge_json_file(
|
|
3221
|
-
|
|
3413
|
+
path6.join(CURSOR_USER_DIR, "hooks.json"),
|
|
3222
3414
|
settings_patch,
|
|
3223
3415
|
force,
|
|
3224
3416
|
"~/.cursor/hooks.json"
|
|
@@ -3261,12 +3453,12 @@ exit 0
|
|
|
3261
3453
|
`;
|
|
3262
3454
|
}
|
|
3263
3455
|
function ensure_cline_bridge(project_root, force) {
|
|
3264
|
-
const hooks_dir =
|
|
3456
|
+
const hooks_dir = path6.join(project_root, ".clinerules", "hooks");
|
|
3265
3457
|
mkdirp(hooks_dir);
|
|
3266
3458
|
const workspace_quoted = shlexQuote(resolvePath(project_root));
|
|
3267
3459
|
let written = 0;
|
|
3268
3460
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
3269
|
-
const target =
|
|
3461
|
+
const target = path6.join(hooks_dir, native_event);
|
|
3270
3462
|
const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
|
|
3271
3463
|
if (pathExists(target) && readText(target) === body && !force) {
|
|
3272
3464
|
continue;
|
|
@@ -3276,7 +3468,7 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
3276
3468
|
continue;
|
|
3277
3469
|
}
|
|
3278
3470
|
writeText(target, body);
|
|
3279
|
-
|
|
3471
|
+
fs7.chmodSync(target, 493);
|
|
3280
3472
|
written += 1;
|
|
3281
3473
|
}
|
|
3282
3474
|
if (written) {
|
|
@@ -3285,27 +3477,27 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
3285
3477
|
skip(".clinerules/hooks/ already up to date");
|
|
3286
3478
|
}
|
|
3287
3479
|
}
|
|
3288
|
-
var CLINE_USER_DIR =
|
|
3480
|
+
var CLINE_USER_DIR = path6.join(os2.homedir(), "Documents", "Cline", "Hooks");
|
|
3289
3481
|
var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
|
|
3290
3482
|
function ensure_cline_user_hooks(package_root, force) {
|
|
3291
|
-
const src =
|
|
3483
|
+
const src = path6.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
|
|
3292
3484
|
if (!pathExists(src)) {
|
|
3293
3485
|
skip(`cline trampoline missing in package: ${src}`);
|
|
3294
3486
|
return;
|
|
3295
3487
|
}
|
|
3296
3488
|
mkdirp(CLINE_USER_DIR);
|
|
3297
|
-
const trampoline =
|
|
3489
|
+
const trampoline = path6.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
|
|
3298
3490
|
const src_text = readText(src);
|
|
3299
3491
|
if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
|
|
3300
3492
|
skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3301
3493
|
} else {
|
|
3302
3494
|
writeText(trampoline, src_text);
|
|
3303
|
-
|
|
3495
|
+
fs7.chmodSync(trampoline, 493);
|
|
3304
3496
|
success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
|
|
3305
3497
|
}
|
|
3306
3498
|
const trampoline_quoted = shlexQuote(trampoline);
|
|
3307
3499
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
3308
|
-
const wrapper =
|
|
3500
|
+
const wrapper = path6.join(CLINE_USER_DIR, native_event);
|
|
3309
3501
|
const body = `#!/usr/bin/env bash
|
|
3310
3502
|
# Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
|
|
3311
3503
|
# User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
|
|
@@ -3315,7 +3507,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
|
|
|
3315
3507
|
continue;
|
|
3316
3508
|
}
|
|
3317
3509
|
writeText(wrapper, body);
|
|
3318
|
-
|
|
3510
|
+
fs7.chmodSync(wrapper, 493);
|
|
3319
3511
|
}
|
|
3320
3512
|
}
|
|
3321
3513
|
var WINDSURF_DISPATCHER_BINDINGS = [
|
|
@@ -3336,29 +3528,29 @@ function ensure_windsurf_bridge(project_root, force) {
|
|
|
3336
3528
|
}
|
|
3337
3529
|
const bridge = { hooks };
|
|
3338
3530
|
return merge_json_file(
|
|
3339
|
-
|
|
3531
|
+
path6.join(project_root, ".windsurf", "hooks.json"),
|
|
3340
3532
|
bridge,
|
|
3341
3533
|
force,
|
|
3342
3534
|
".windsurf/hooks.json"
|
|
3343
3535
|
);
|
|
3344
3536
|
}
|
|
3345
|
-
var WINDSURF_USER_DIR =
|
|
3346
|
-
var WINDSURF_USER_HOOKS_DIR =
|
|
3537
|
+
var WINDSURF_USER_DIR = path6.join(os2.homedir(), ".codeium", "windsurf");
|
|
3538
|
+
var WINDSURF_USER_HOOKS_DIR = path6.join(WINDSURF_USER_DIR, "hooks");
|
|
3347
3539
|
var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
|
|
3348
3540
|
function ensure_windsurf_user_hooks(package_root, force) {
|
|
3349
|
-
const src =
|
|
3541
|
+
const src = path6.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
3350
3542
|
if (!pathExists(src)) {
|
|
3351
3543
|
skip(`windsurf trampoline missing in package: ${src}`);
|
|
3352
3544
|
return [];
|
|
3353
3545
|
}
|
|
3354
3546
|
mkdirp(WINDSURF_USER_HOOKS_DIR);
|
|
3355
|
-
const dst =
|
|
3547
|
+
const dst = path6.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
3356
3548
|
const src_text = readText(src);
|
|
3357
3549
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3358
3550
|
skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3359
3551
|
} else {
|
|
3360
3552
|
writeText(dst, src_text);
|
|
3361
|
-
|
|
3553
|
+
fs7.chmodSync(dst, 493);
|
|
3362
3554
|
success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
|
|
3363
3555
|
}
|
|
3364
3556
|
const hooks = {};
|
|
@@ -3370,7 +3562,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
|
|
|
3370
3562
|
}
|
|
3371
3563
|
const settings_patch = { hooks };
|
|
3372
3564
|
return merge_json_file(
|
|
3373
|
-
|
|
3565
|
+
path6.join(WINDSURF_USER_DIR, "hooks.json"),
|
|
3374
3566
|
settings_patch,
|
|
3375
3567
|
force,
|
|
3376
3568
|
"~/.codeium/windsurf/hooks.json"
|
|
@@ -3399,43 +3591,43 @@ function _gemini_hooks_dict(command_factory) {
|
|
|
3399
3591
|
function ensure_gemini_bridge(project_root, force) {
|
|
3400
3592
|
const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
|
|
3401
3593
|
return merge_json_file(
|
|
3402
|
-
|
|
3594
|
+
path6.join(project_root, ".gemini", "settings.json"),
|
|
3403
3595
|
bridge,
|
|
3404
3596
|
force,
|
|
3405
3597
|
".gemini/settings.json"
|
|
3406
3598
|
);
|
|
3407
3599
|
}
|
|
3408
|
-
var GEMINI_USER_DIR =
|
|
3409
|
-
var GEMINI_USER_HOOKS_DIR =
|
|
3600
|
+
var GEMINI_USER_DIR = path6.join(os2.homedir(), ".gemini");
|
|
3601
|
+
var GEMINI_USER_HOOKS_DIR = path6.join(GEMINI_USER_DIR, "hooks");
|
|
3410
3602
|
var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
|
|
3411
3603
|
function ensure_gemini_user_hooks(package_root, force) {
|
|
3412
|
-
const src =
|
|
3604
|
+
const src = path6.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
|
|
3413
3605
|
if (!pathExists(src)) {
|
|
3414
3606
|
skip(`gemini trampoline missing in package: ${src}`);
|
|
3415
3607
|
return [];
|
|
3416
3608
|
}
|
|
3417
3609
|
mkdirp(GEMINI_USER_HOOKS_DIR);
|
|
3418
|
-
const dst =
|
|
3610
|
+
const dst = path6.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
|
|
3419
3611
|
const src_text = readText(src);
|
|
3420
3612
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3421
3613
|
skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3422
3614
|
} else {
|
|
3423
3615
|
writeText(dst, src_text);
|
|
3424
|
-
|
|
3616
|
+
fs7.chmodSync(dst, 493);
|
|
3425
3617
|
success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
|
|
3426
3618
|
}
|
|
3427
3619
|
const settings_patch = {
|
|
3428
3620
|
hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
|
|
3429
3621
|
};
|
|
3430
3622
|
return merge_json_file(
|
|
3431
|
-
|
|
3623
|
+
path6.join(GEMINI_USER_DIR, "settings.json"),
|
|
3432
3624
|
settings_patch,
|
|
3433
3625
|
force,
|
|
3434
3626
|
"~/.gemini/settings.json"
|
|
3435
3627
|
);
|
|
3436
3628
|
}
|
|
3437
3629
|
function ensure_copilot_bridge(project_root, force) {
|
|
3438
|
-
const target =
|
|
3630
|
+
const target = path6.join(project_root, ".github", "plugin", "marketplace.json");
|
|
3439
3631
|
const bridge = {
|
|
3440
3632
|
marketplace: {
|
|
3441
3633
|
name: "event4u-agent-marketplace",
|
|
@@ -3478,7 +3670,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
|
|
|
3478
3670
|
Run \`./agent-config --help\` for available commands.
|
|
3479
3671
|
`;
|
|
3480
3672
|
function ensure_roocode_bridge(project_root, force) {
|
|
3481
|
-
const target =
|
|
3673
|
+
const target = path6.join(project_root, ".roo", "rules", "agent-config.md");
|
|
3482
3674
|
if (pathExists(target) && !force) {
|
|
3483
3675
|
skip(".roo/rules/agent-config.md already exists");
|
|
3484
3676
|
return;
|
|
@@ -3500,7 +3692,7 @@ To wire Claude Desktop to this project's rules, run:
|
|
|
3500
3692
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
3501
3693
|
`;
|
|
3502
3694
|
function ensure_claude_desktop_bridge(project_root, force) {
|
|
3503
|
-
const target =
|
|
3695
|
+
const target = path6.join(project_root, ".claude-desktop", "agent-config.md");
|
|
3504
3696
|
if (pathExists(target) && !force) {
|
|
3505
3697
|
skip(".claude-desktop/agent-config.md already exists");
|
|
3506
3698
|
return;
|
|
@@ -3525,7 +3717,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
|
|
|
3525
3717
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
3526
3718
|
`;
|
|
3527
3719
|
function ensure_aider_bridge(project_root, force) {
|
|
3528
|
-
const target =
|
|
3720
|
+
const target = path6.join(project_root, ".aider", "agent-config.md");
|
|
3529
3721
|
if (pathExists(target) && !force) {
|
|
3530
3722
|
skip(".aider/agent-config.md already exists");
|
|
3531
3723
|
return;
|
|
@@ -3544,7 +3736,7 @@ developers where the rules and skills live.
|
|
|
3544
3736
|
Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
|
|
3545
3737
|
`;
|
|
3546
3738
|
function ensure_codex_bridge(project_root, force) {
|
|
3547
|
-
const target =
|
|
3739
|
+
const target = path6.join(project_root, ".codex", "agent-config.md");
|
|
3548
3740
|
if (pathExists(target) && !force) {
|
|
3549
3741
|
skip(".codex/agent-config.md already exists");
|
|
3550
3742
|
return;
|
|
@@ -3562,7 +3754,7 @@ rules per session. The canonical rule and skill source lives under
|
|
|
3562
3754
|
orientation).
|
|
3563
3755
|
`;
|
|
3564
3756
|
function ensure_continue_bridge(project_root, force) {
|
|
3565
|
-
const target =
|
|
3757
|
+
const target = path6.join(project_root, ".continue", "rules", "agent-config.md");
|
|
3566
3758
|
if (pathExists(target) && !force) {
|
|
3567
3759
|
skip(".continue/rules/agent-config.md already exists");
|
|
3568
3760
|
return;
|
|
@@ -3593,7 +3785,7 @@ orientation).
|
|
|
3593
3785
|
See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
|
|
3594
3786
|
`;
|
|
3595
3787
|
function ensure_kilocode_bridge(project_root, force) {
|
|
3596
|
-
const target =
|
|
3788
|
+
const target = path6.join(project_root, ".kilocode", "rules", "agent-config.md");
|
|
3597
3789
|
if (pathExists(target) && !force) {
|
|
3598
3790
|
skip(".kilocode/rules/agent-config.md already exists");
|
|
3599
3791
|
return;
|
|
@@ -3620,7 +3812,7 @@ canonical source (or symlink it):
|
|
|
3620
3812
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
3621
3813
|
`;
|
|
3622
3814
|
function ensure_zed_bridge(project_root, force) {
|
|
3623
|
-
const target =
|
|
3815
|
+
const target = path6.join(project_root, ".zed", "agent-config.md");
|
|
3624
3816
|
if (pathExists(target) && !force) {
|
|
3625
3817
|
skip(".zed/agent-config.md already exists");
|
|
3626
3818
|
return;
|
|
@@ -3641,7 +3833,7 @@ rules into your JetBrains profile.
|
|
|
3641
3833
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
3642
3834
|
`;
|
|
3643
3835
|
function ensure_jetbrains_bridge(project_root, force) {
|
|
3644
|
-
const target =
|
|
3836
|
+
const target = path6.join(project_root, ".jetbrains", "agent-config.md");
|
|
3645
3837
|
if (pathExists(target) && !force) {
|
|
3646
3838
|
skip(".jetbrains/agent-config.md already exists");
|
|
3647
3839
|
return;
|
|
@@ -3672,7 +3864,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
|
|
|
3672
3864
|
See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
|
|
3673
3865
|
`;
|
|
3674
3866
|
function ensure_kiro_bridge(project_root, force) {
|
|
3675
|
-
const target =
|
|
3867
|
+
const target = path6.join(project_root, ".kiro", "steering", "agent-config.md");
|
|
3676
3868
|
if (pathExists(target) && !force) {
|
|
3677
3869
|
skip(".kiro/steering/agent-config.md already exists");
|
|
3678
3870
|
return;
|
|
@@ -3698,35 +3890,35 @@ var SMOKE_BRIDGE_PATHS = {
|
|
|
3698
3890
|
};
|
|
3699
3891
|
function dirHasEntries(p) {
|
|
3700
3892
|
try {
|
|
3701
|
-
return
|
|
3893
|
+
return fs7.readdirSync(p).length > 0;
|
|
3702
3894
|
} catch {
|
|
3703
3895
|
return false;
|
|
3704
3896
|
}
|
|
3705
3897
|
}
|
|
3706
3898
|
function _resolve_tsx_invocation(scriptPath, scriptArgs) {
|
|
3707
3899
|
const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
3708
|
-
let dir =
|
|
3900
|
+
let dir = path6.dirname(scriptPath);
|
|
3709
3901
|
for (; ; ) {
|
|
3710
|
-
const candidate =
|
|
3902
|
+
const candidate = path6.join(dir, "node_modules", ".bin", binName);
|
|
3711
3903
|
if (isFile(candidate)) {
|
|
3712
3904
|
return { command: candidate, args: [scriptPath, ...scriptArgs] };
|
|
3713
3905
|
}
|
|
3714
|
-
const parent =
|
|
3906
|
+
const parent = path6.dirname(dir);
|
|
3715
3907
|
if (parent === dir) break;
|
|
3716
3908
|
dir = parent;
|
|
3717
3909
|
}
|
|
3718
3910
|
return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
|
|
3719
3911
|
}
|
|
3720
3912
|
function _smoke_test_hooks(project_root, package_root) {
|
|
3721
|
-
const dispatcher =
|
|
3722
|
-
const manifest =
|
|
3913
|
+
const dispatcher = path6.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
|
|
3914
|
+
const manifest = path6.join(package_root, "scripts", "hook_manifest.yaml");
|
|
3723
3915
|
if (!isFile(dispatcher) || !isFile(manifest)) return 0;
|
|
3724
3916
|
const failed = [];
|
|
3725
3917
|
const skipped = [];
|
|
3726
3918
|
const passed = [];
|
|
3727
3919
|
for (const [platform, native] of SMOKE_PROBE_EVENTS) {
|
|
3728
3920
|
const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
|
|
3729
|
-
const bridge_path = rel_bridge ?
|
|
3921
|
+
const bridge_path = rel_bridge ? path6.join(project_root, rel_bridge) : null;
|
|
3730
3922
|
const bridge_present = Boolean(
|
|
3731
3923
|
bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
|
|
3732
3924
|
);
|
|
@@ -3926,9 +4118,9 @@ To remove this marker, delete this file.
|
|
|
3926
4118
|
`;
|
|
3927
4119
|
}
|
|
3928
4120
|
var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
|
|
3929
|
-
var GLOBAL_ROOT =
|
|
3930
|
-
var GLOBAL_USER_SETTINGS_PATH =
|
|
3931
|
-
var GLOBAL_AGENT_SETTINGS_PATH =
|
|
4121
|
+
var GLOBAL_ROOT = path6.join(os2.homedir(), ".event4u", "agent-config");
|
|
4122
|
+
var GLOBAL_USER_SETTINGS_PATH = path6.join(GLOBAL_ROOT, ".agent-user.yml");
|
|
4123
|
+
var GLOBAL_AGENT_SETTINGS_PATH = path6.join(GLOBAL_ROOT, ".agent-settings.yml");
|
|
3932
4124
|
function _bridge_marker(tool_id, scope) {
|
|
3933
4125
|
if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
|
|
3934
4126
|
return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
|
|
@@ -3977,7 +4169,7 @@ function _load_yaml_doc(p) {
|
|
|
3977
4169
|
return _isPlainObject(data) ? data : {};
|
|
3978
4170
|
}
|
|
3979
4171
|
function _load_default_settings(package_root) {
|
|
3980
|
-
const template_source =
|
|
4172
|
+
const template_source = path6.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
3981
4173
|
if (!pathExists(template_source)) return {};
|
|
3982
4174
|
let text;
|
|
3983
4175
|
try {
|
|
@@ -3991,11 +4183,11 @@ function _load_default_settings(package_root) {
|
|
|
3991
4183
|
}
|
|
3992
4184
|
var RULE_LAYER_CHOICES = ["global", "project", "both-acknowledged"];
|
|
3993
4185
|
function _suppress_rule_layer(project_root, suppress_dir) {
|
|
3994
|
-
const target =
|
|
4186
|
+
const target = path6.join(project_root, ".claude", "settings.local.json");
|
|
3995
4187
|
const existing = pathExists(target) ? read_json_file(target) : {};
|
|
3996
4188
|
let real_dir = suppress_dir;
|
|
3997
4189
|
try {
|
|
3998
|
-
real_dir =
|
|
4190
|
+
real_dir = fs7.realpathSync(suppress_dir);
|
|
3999
4191
|
} catch {
|
|
4000
4192
|
real_dir = suppress_dir;
|
|
4001
4193
|
}
|
|
@@ -4006,8 +4198,8 @@ function _suppress_rule_layer(project_root, suppress_dir) {
|
|
|
4006
4198
|
success(`.claude/settings.local.json: claudeMdExcludes += ${entry}`);
|
|
4007
4199
|
}
|
|
4008
4200
|
function _gate_rule_layer_overlap(project_root, layer, dry_run) {
|
|
4009
|
-
const global_dir =
|
|
4010
|
-
const project_dir =
|
|
4201
|
+
const global_dir = path6.join(os2.homedir(), ".claude", "rules");
|
|
4202
|
+
const project_dir = path6.join(project_root, ".claude", "rules");
|
|
4011
4203
|
const g = readRuleLayer(global_dir);
|
|
4012
4204
|
const p = readRuleLayer(project_dir);
|
|
4013
4205
|
if (g === null || p === null) return true;
|
|
@@ -4117,9 +4309,9 @@ function detect_scope(cwd) {
|
|
|
4117
4309
|
if (pathExists(_resolve_settings_read(cwd))) {
|
|
4118
4310
|
return ["project", `existing ${SETTINGS_FILE}`];
|
|
4119
4311
|
}
|
|
4120
|
-
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(
|
|
4121
|
-
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(
|
|
4122
|
-
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(
|
|
4312
|
+
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path6.join(cwd, m))) ?? null;
|
|
4313
|
+
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path6.join(cwd, d))) ?? null;
|
|
4314
|
+
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path6.join(cwd, f))) ?? null;
|
|
4123
4315
|
if (has_manifest && (has_ai_dir || has_ai_file)) {
|
|
4124
4316
|
const marker = has_ai_dir || has_ai_file;
|
|
4125
4317
|
return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
|
|
@@ -4140,7 +4332,7 @@ function readLineSyncRaw(promptText) {
|
|
|
4140
4332
|
for (; ; ) {
|
|
4141
4333
|
let n;
|
|
4142
4334
|
try {
|
|
4143
|
-
n =
|
|
4335
|
+
n = fs7.readSync(0, buf, 0, 1, null);
|
|
4144
4336
|
} catch (err) {
|
|
4145
4337
|
const code = err.code;
|
|
4146
4338
|
if (code === "EAGAIN") {
|
|
@@ -4215,8 +4407,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
|
|
|
4215
4407
|
const marker = _bridge_marker(tool_id, scope);
|
|
4216
4408
|
if (!marker) continue;
|
|
4217
4409
|
let marker_path = marker;
|
|
4218
|
-
if (!
|
|
4219
|
-
marker_path =
|
|
4410
|
+
if (!path6.isAbsolute(marker_path)) {
|
|
4411
|
+
marker_path = path6.join(project_root, marker_path);
|
|
4220
4412
|
}
|
|
4221
4413
|
out[tool_id] = [_file_entry(marker_path, "bridge", false)];
|
|
4222
4414
|
}
|
|
@@ -4255,26 +4447,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
|
|
|
4255
4447
|
}
|
|
4256
4448
|
write_manifest(target, version, entries);
|
|
4257
4449
|
if (!state.QUIET) {
|
|
4258
|
-
const rel = isRelativeTo(target, project_root) ?
|
|
4450
|
+
const rel = isRelativeTo(target, project_root) ? path6.relative(project_root, target) : target;
|
|
4259
4451
|
info(`Manifest updated: ${rel}`);
|
|
4260
4452
|
}
|
|
4261
4453
|
return 0;
|
|
4262
4454
|
}
|
|
4263
4455
|
function isRelativeTo(child, parent) {
|
|
4264
|
-
const rel =
|
|
4265
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
4456
|
+
const rel = path6.relative(parent, child);
|
|
4457
|
+
return rel === "" || !rel.startsWith("..") && !path6.isAbsolute(rel);
|
|
4266
4458
|
}
|
|
4267
4459
|
function _resolve_package_root_for_global() {
|
|
4268
4460
|
const here = resolvePath(_HERE);
|
|
4269
|
-
const candidate =
|
|
4270
|
-
if (!pathExists(
|
|
4461
|
+
const candidate = path6.dirname(path6.dirname(path6.dirname(here)));
|
|
4462
|
+
if (!pathExists(path6.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
|
|
4271
4463
|
fail(
|
|
4272
4464
|
`Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
|
|
4273
4465
|
);
|
|
4274
4466
|
}
|
|
4275
4467
|
return candidate;
|
|
4276
4468
|
}
|
|
4277
|
-
var CONSUMER_BRIDGE_MARKER_RELPATH =
|
|
4469
|
+
var CONSUMER_BRIDGE_MARKER_RELPATH = path6.join("agents", ".event4u-bridge.yml");
|
|
4278
4470
|
var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
4279
4471
|
var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
|
|
4280
4472
|
var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
|
|
@@ -4282,7 +4474,7 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
4282
4474
|
if (process2.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
|
|
4283
4475
|
return [false, "consumer-mode-override"];
|
|
4284
4476
|
}
|
|
4285
|
-
const pkg_json =
|
|
4477
|
+
const pkg_json = path6.join(project_root, "package.json");
|
|
4286
4478
|
if (isFile(pkg_json)) {
|
|
4287
4479
|
let data = {};
|
|
4288
4480
|
try {
|
|
@@ -4294,18 +4486,18 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
4294
4486
|
return [true, "package.json:name"];
|
|
4295
4487
|
}
|
|
4296
4488
|
}
|
|
4297
|
-
if (isDir(
|
|
4489
|
+
if (isDir(path6.join(project_root, ".agent-src.uncondensed"))) {
|
|
4298
4490
|
return [true, ".agent-src.uncondensed/"];
|
|
4299
4491
|
}
|
|
4300
|
-
const packages_dir =
|
|
4492
|
+
const packages_dir = path6.join(project_root, "packages");
|
|
4301
4493
|
if (isDir(packages_dir)) {
|
|
4302
|
-
for (const child of
|
|
4303
|
-
if (isDir(
|
|
4494
|
+
for (const child of fs7.readdirSync(packages_dir)) {
|
|
4495
|
+
if (isDir(path6.join(packages_dir, child, ".agent-src.uncondensed"))) {
|
|
4304
4496
|
return [true, `packages/${child}/.agent-src.uncondensed/`];
|
|
4305
4497
|
}
|
|
4306
4498
|
}
|
|
4307
4499
|
}
|
|
4308
|
-
const installer_self =
|
|
4500
|
+
const installer_self = path6.join(project_root, "scripts", "install.py");
|
|
4309
4501
|
try {
|
|
4310
4502
|
if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE)) {
|
|
4311
4503
|
return [true, "src/scripts/install.py (self)"];
|
|
@@ -4325,17 +4517,17 @@ function _detect_legacy_for_migration(project_root) {
|
|
|
4325
4517
|
}
|
|
4326
4518
|
return [];
|
|
4327
4519
|
}
|
|
4328
|
-
if (isFile(
|
|
4520
|
+
if (isFile(path6.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
|
|
4329
4521
|
const found = [];
|
|
4330
4522
|
for (const name of MIGRATE_LEGACY_YAML_FILES) {
|
|
4331
|
-
if (isFile(
|
|
4523
|
+
if (isFile(path6.join(project_root, name))) {
|
|
4332
4524
|
found.push(name);
|
|
4333
|
-
} else if (isFile(
|
|
4525
|
+
} else if (isFile(path6.join(project_root, "settings", name))) {
|
|
4334
4526
|
found.push(`settings/${name}`);
|
|
4335
4527
|
}
|
|
4336
4528
|
}
|
|
4337
4529
|
for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
|
|
4338
|
-
const p =
|
|
4530
|
+
const p = path6.join(project_root, name);
|
|
4339
4531
|
if (isDir(p) && !isSymlink(p)) {
|
|
4340
4532
|
found.push(`${name}/`);
|
|
4341
4533
|
}
|
|
@@ -4347,7 +4539,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
|
|
|
4347
4539
|
process2.stdout.write("\n");
|
|
4348
4540
|
warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
|
|
4349
4541
|
for (const rel of artefacts) {
|
|
4350
|
-
info(` ${
|
|
4542
|
+
info(` ${path6.join(project_root, rel)}`);
|
|
4351
4543
|
}
|
|
4352
4544
|
info("The unified `agent-config migrate` sweeps these in one pass.");
|
|
4353
4545
|
info("The wizard recreates fresh config afterwards.");
|
|
@@ -4378,20 +4570,20 @@ function _run_migrate_to_global(project_root) {
|
|
|
4378
4570
|
function _format_global_root_for_marker(global_root) {
|
|
4379
4571
|
const home = resolvePath(os2.homedir());
|
|
4380
4572
|
const resolved = resolvePath(global_root);
|
|
4381
|
-
const rel =
|
|
4382
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
4573
|
+
const rel = path6.relative(home, resolved);
|
|
4574
|
+
if (rel === "" || rel.startsWith("..") || path6.isAbsolute(rel)) {
|
|
4383
4575
|
return global_root;
|
|
4384
4576
|
}
|
|
4385
|
-
return `~/${rel.split(
|
|
4577
|
+
return `~/${rel.split(path6.sep).join("/")}`;
|
|
4386
4578
|
}
|
|
4387
4579
|
function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
|
|
4388
4580
|
const env_map = env ?? process2.env;
|
|
4389
4581
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
|
|
4390
|
-
if (isDir(
|
|
4391
|
-
const target =
|
|
4582
|
+
if (isDir(path6.join(project_root, ".agent-src.uncondensed"))) return null;
|
|
4583
|
+
const target = path6.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
|
|
4392
4584
|
if (!isFile(target)) return null;
|
|
4393
4585
|
try {
|
|
4394
|
-
|
|
4586
|
+
fs7.rmSync(target);
|
|
4395
4587
|
} catch {
|
|
4396
4588
|
return null;
|
|
4397
4589
|
}
|
|
@@ -4405,7 +4597,7 @@ var PROJECT_ANCHOR_TOOLS = {
|
|
|
4405
4597
|
function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
|
|
4406
4598
|
const env_map = env ?? process2.env;
|
|
4407
4599
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
|
|
4408
|
-
if (isDir(
|
|
4600
|
+
if (isDir(path6.join(project_root, ".agent-src.uncondensed"))) return [];
|
|
4409
4601
|
const global_root_str = _format_global_root_for_marker(
|
|
4410
4602
|
event4u_root(env_map)
|
|
4411
4603
|
);
|
|
@@ -4414,8 +4606,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
|
|
|
4414
4606
|
for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
|
|
4415
4607
|
const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
|
|
4416
4608
|
if (!tools.has(tool_id)) continue;
|
|
4417
|
-
const target =
|
|
4418
|
-
mkdirp(
|
|
4609
|
+
const target = path6.join(project_root, rel_path);
|
|
4610
|
+
mkdirp(path6.dirname(target));
|
|
4419
4611
|
const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
|
|
4420
4612
|
# Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
|
|
4421
4613
|
# Tool: ${tool_id}. Resolves the global install directly \u2014 no
|
|
@@ -4433,7 +4625,7 @@ installed_at: ${stamp}
|
|
|
4433
4625
|
}
|
|
4434
4626
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
4435
4627
|
function _inject_package_tag(target, source, package_root) {
|
|
4436
|
-
if (
|
|
4628
|
+
if (path6.extname(target) !== ".md") return;
|
|
4437
4629
|
let text;
|
|
4438
4630
|
try {
|
|
4439
4631
|
text = readText(target);
|
|
@@ -4461,8 +4653,8 @@ function _inject_package_tag(target, source, package_root) {
|
|
|
4461
4653
|
resolved_src = source;
|
|
4462
4654
|
}
|
|
4463
4655
|
if (package_root !== null) {
|
|
4464
|
-
const rel =
|
|
4465
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
4656
|
+
const rel = path6.relative(resolvePath(package_root), resolved_src);
|
|
4657
|
+
if (rel !== "" && !rel.startsWith("..") && !path6.isAbsolute(rel)) {
|
|
4466
4658
|
source_value = rel;
|
|
4467
4659
|
} else {
|
|
4468
4660
|
source_value = resolved_src;
|
|
@@ -4497,7 +4689,7 @@ function _escapes_package_root(resolved, package_root) {
|
|
|
4497
4689
|
if (package_root === null) return false;
|
|
4498
4690
|
let root;
|
|
4499
4691
|
try {
|
|
4500
|
-
root =
|
|
4692
|
+
root = fs7.realpathSync(package_root);
|
|
4501
4693
|
} catch {
|
|
4502
4694
|
return false;
|
|
4503
4695
|
}
|
|
@@ -4512,7 +4704,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
4512
4704
|
if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
|
|
4513
4705
|
let resolved_src = src;
|
|
4514
4706
|
try {
|
|
4515
|
-
resolved_src =
|
|
4707
|
+
resolved_src = fs7.realpathSync(src);
|
|
4516
4708
|
} catch {
|
|
4517
4709
|
resolved_src = src;
|
|
4518
4710
|
}
|
|
@@ -4520,10 +4712,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
4520
4712
|
warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
|
|
4521
4713
|
return [0, 0, written_paths];
|
|
4522
4714
|
}
|
|
4523
|
-
mkdirp(
|
|
4715
|
+
mkdirp(path6.dirname(dest));
|
|
4524
4716
|
const decision = _resolve_file_conflict(dest, force);
|
|
4525
4717
|
if (decision === "skip") return [0, 1, written_paths];
|
|
4526
|
-
|
|
4718
|
+
fs7.copyFileSync(src, dest);
|
|
4527
4719
|
_inject_package_tag(dest, src, package_root);
|
|
4528
4720
|
written_paths.push(dest);
|
|
4529
4721
|
return [1, 0, written_paths];
|
|
@@ -4531,11 +4723,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
4531
4723
|
mkdirp(dest);
|
|
4532
4724
|
const walk = (node) => {
|
|
4533
4725
|
const acc = [];
|
|
4534
|
-
const names =
|
|
4726
|
+
const names = fs7.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
4535
4727
|
for (const name of names) {
|
|
4536
|
-
const entry =
|
|
4728
|
+
const entry = path6.join(node, name);
|
|
4537
4729
|
acc.push(entry);
|
|
4538
|
-
const lst =
|
|
4730
|
+
const lst = fs7.lstatSync(entry);
|
|
4539
4731
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
4540
4732
|
acc.push(...walk(entry));
|
|
4541
4733
|
}
|
|
@@ -4543,9 +4735,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
4543
4735
|
return acc;
|
|
4544
4736
|
};
|
|
4545
4737
|
for (const entry of walk(src)) {
|
|
4546
|
-
const rel =
|
|
4547
|
-
const target =
|
|
4548
|
-
const lst =
|
|
4738
|
+
const rel = path6.relative(src, entry);
|
|
4739
|
+
const target = path6.join(dest, rel);
|
|
4740
|
+
const lst = fs7.lstatSync(entry);
|
|
4549
4741
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
4550
4742
|
mkdirp(target);
|
|
4551
4743
|
continue;
|
|
@@ -4553,8 +4745,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
4553
4745
|
let resolvedIsDir = false;
|
|
4554
4746
|
let resolved = entry;
|
|
4555
4747
|
try {
|
|
4556
|
-
resolved =
|
|
4557
|
-
resolvedIsDir =
|
|
4748
|
+
resolved = fs7.realpathSync(entry);
|
|
4749
|
+
resolvedIsDir = fs7.statSync(entry).isDirectory();
|
|
4558
4750
|
} catch {
|
|
4559
4751
|
resolvedIsDir = false;
|
|
4560
4752
|
}
|
|
@@ -4584,8 +4776,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
4584
4776
|
skipped += 1;
|
|
4585
4777
|
continue;
|
|
4586
4778
|
}
|
|
4587
|
-
mkdirp(
|
|
4588
|
-
|
|
4779
|
+
mkdirp(path6.dirname(target));
|
|
4780
|
+
fs7.copyFileSync(resolved, target);
|
|
4589
4781
|
_inject_package_tag(target, resolved, package_root);
|
|
4590
4782
|
written += 1;
|
|
4591
4783
|
written_paths.push(target);
|
|
@@ -4597,7 +4789,7 @@ function _claude_desktop_bundles_dir() {
|
|
|
4597
4789
|
}
|
|
4598
4790
|
function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
|
|
4599
4791
|
const anchor = expanduser2(USER_SCOPE_PATHS["claude-desktop"]);
|
|
4600
|
-
const target =
|
|
4792
|
+
const target = path6.join(anchor, "agent-config.md");
|
|
4601
4793
|
mkdirp(anchor);
|
|
4602
4794
|
const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
|
|
4603
4795
|
writeText(target, body);
|
|
@@ -4621,23 +4813,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
4621
4813
|
const wrapped = [];
|
|
4622
4814
|
const collisions = [];
|
|
4623
4815
|
const reserved = [];
|
|
4624
|
-
const commands_dir =
|
|
4816
|
+
const commands_dir = path6.join(anchor, "commands");
|
|
4625
4817
|
let flat_entries = [];
|
|
4626
4818
|
try {
|
|
4627
|
-
flat_entries =
|
|
4819
|
+
flat_entries = fs7.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
|
|
4628
4820
|
} catch {
|
|
4629
4821
|
}
|
|
4630
4822
|
for (const fname of flat_entries.sort()) {
|
|
4631
4823
|
const slug = fname.slice(0, -".md".length);
|
|
4632
4824
|
if (!is_claude_builtin_name(slug)) continue;
|
|
4633
|
-
|
|
4825
|
+
fs7.rmSync(path6.join(commands_dir, fname), { force: true });
|
|
4634
4826
|
current_files.delete(`commands/${fname}`);
|
|
4635
4827
|
reserved.push(slug);
|
|
4636
4828
|
}
|
|
4637
4829
|
const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
|
|
4638
4830
|
try {
|
|
4639
4831
|
const manifest = JSON.parse(
|
|
4640
|
-
|
|
4832
|
+
fs7.readFileSync(path6.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
|
|
4641
4833
|
);
|
|
4642
4834
|
for (const a of manifest.artefacts ?? []) {
|
|
4643
4835
|
if (a.category !== "command" || typeof a.slug !== "string") continue;
|
|
@@ -4648,22 +4840,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
4648
4840
|
}
|
|
4649
4841
|
for (const slug of [...eligible].sort()) {
|
|
4650
4842
|
const flat_rel = `commands/${slug}.md`;
|
|
4651
|
-
const flat_abs =
|
|
4652
|
-
if (!
|
|
4653
|
-
const skill_dir =
|
|
4654
|
-
if (
|
|
4843
|
+
const flat_abs = path6.join(anchor, "commands", `${slug}.md`);
|
|
4844
|
+
if (!fs7.existsSync(flat_abs)) continue;
|
|
4845
|
+
const skill_dir = path6.join(anchor, "skills", slug);
|
|
4846
|
+
if (fs7.existsSync(skill_dir)) {
|
|
4655
4847
|
collisions.push(slug);
|
|
4656
4848
|
continue;
|
|
4657
4849
|
}
|
|
4658
|
-
let body =
|
|
4850
|
+
let body = fs7.readFileSync(flat_abs, "utf8");
|
|
4659
4851
|
if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
|
|
4660
4852
|
body = body.replace("---\n", `---
|
|
4661
4853
|
name: ${slug}
|
|
4662
4854
|
`);
|
|
4663
4855
|
}
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4856
|
+
fs7.mkdirSync(skill_dir, { recursive: true });
|
|
4857
|
+
fs7.writeFileSync(path6.join(skill_dir, "SKILL.md"), body, "utf8");
|
|
4858
|
+
fs7.rmSync(flat_abs, { force: true });
|
|
4667
4859
|
current_files.delete(flat_rel);
|
|
4668
4860
|
current_files.add(`skills/${slug}/SKILL.md`);
|
|
4669
4861
|
wrapped.push(slug);
|
|
@@ -4695,8 +4887,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
4695
4887
|
const written_paths = [];
|
|
4696
4888
|
let current_files = /* @__PURE__ */ new Set();
|
|
4697
4889
|
for (const [src_rel, dest_sub] of plan) {
|
|
4698
|
-
const src =
|
|
4699
|
-
const dest = dest_sub ?
|
|
4890
|
+
const src = path6.join(package_root, src_rel);
|
|
4891
|
+
const dest = dest_sub ? path6.join(anchor, dest_sub) : anchor;
|
|
4700
4892
|
const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
|
|
4701
4893
|
const [w, s, paths] = _copy_dir_dereferencing_symlinks(
|
|
4702
4894
|
src,
|
|
@@ -4770,10 +4962,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
4770
4962
|
results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
|
|
4771
4963
|
if (tool_id === "claude-code") {
|
|
4772
4964
|
try {
|
|
4773
|
-
const manifest =
|
|
4965
|
+
const manifest = path6.join(package_root, "src", "scripts", "hook_manifest.yaml");
|
|
4774
4966
|
const matrix = build_claude_hook_matrix(manifest);
|
|
4775
4967
|
const res = ensure_managed_hooks(
|
|
4776
|
-
|
|
4968
|
+
path6.join(anchor, "settings.json"),
|
|
4777
4969
|
matrix
|
|
4778
4970
|
);
|
|
4779
4971
|
if (!state.QUIET) {
|
|
@@ -4810,7 +5002,7 @@ function _preview_global_reap(tools, package_root) {
|
|
|
4810
5002
|
const anchor = expanduser2(anchor_raw);
|
|
4811
5003
|
let current_files = /* @__PURE__ */ new Set();
|
|
4812
5004
|
for (const [src_rel, dest_sub] of plan) {
|
|
4813
|
-
const src =
|
|
5005
|
+
const src = path6.join(package_root, src_rel);
|
|
4814
5006
|
current_files = setUnion(
|
|
4815
5007
|
current_files,
|
|
4816
5008
|
expected_deploy_files(
|
|
@@ -4844,14 +5036,14 @@ function _preview_global_reap(tools, package_root) {
|
|
|
4844
5036
|
function _verify_deploy_targets(anchor, plan) {
|
|
4845
5037
|
const missing = [];
|
|
4846
5038
|
for (const [, dest_sub] of plan) {
|
|
4847
|
-
const target = dest_sub ?
|
|
5039
|
+
const target = dest_sub ? path6.join(anchor, dest_sub) : anchor;
|
|
4848
5040
|
const label = dest_sub || ".";
|
|
4849
5041
|
if (!isDir(target)) {
|
|
4850
5042
|
missing.push(label);
|
|
4851
5043
|
continue;
|
|
4852
5044
|
}
|
|
4853
5045
|
try {
|
|
4854
|
-
const entries =
|
|
5046
|
+
const entries = fs7.readdirSync(target);
|
|
4855
5047
|
if (entries.length === 0) missing.push(label);
|
|
4856
5048
|
} catch {
|
|
4857
5049
|
missing.push(label);
|
|
@@ -4866,13 +5058,13 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
4866
5058
|
const [written, skipped, status, paths] = deploy_results[tool_id];
|
|
4867
5059
|
const pruned_skill_dirs = /* @__PURE__ */ new Set();
|
|
4868
5060
|
for (const p of paths) {
|
|
4869
|
-
const parts = p.split(
|
|
5061
|
+
const parts = p.split(path6.sep);
|
|
4870
5062
|
if (parts.includes("skills")) {
|
|
4871
5063
|
const i = parts.indexOf("skills");
|
|
4872
5064
|
if (i + 1 < parts.length) {
|
|
4873
|
-
const skill_root = parts.slice(0, i + 2).join(
|
|
5065
|
+
const skill_root = parts.slice(0, i + 2).join(path6.sep);
|
|
4874
5066
|
if (!pruned_skill_dirs.has(skill_root)) {
|
|
4875
|
-
const skillmd =
|
|
5067
|
+
const skillmd = path6.join(skill_root, "SKILL.md");
|
|
4876
5068
|
if (pathExists(skillmd) && is_pruned(skillmd)) {
|
|
4877
5069
|
pruned_skill_dirs.add(skill_root);
|
|
4878
5070
|
}
|
|
@@ -4883,25 +5075,25 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
4883
5075
|
const keep = [];
|
|
4884
5076
|
const delete_files = [];
|
|
4885
5077
|
for (const p of paths) {
|
|
4886
|
-
const parts = p.split(
|
|
5078
|
+
const parts = p.split(path6.sep);
|
|
4887
5079
|
let is_target = false;
|
|
4888
5080
|
if (parts.includes("skills")) {
|
|
4889
5081
|
const i = parts.indexOf("skills");
|
|
4890
|
-
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(
|
|
5082
|
+
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path6.sep))) {
|
|
4891
5083
|
is_target = true;
|
|
4892
5084
|
}
|
|
4893
|
-
} else if (parts.includes("commands") &&
|
|
5085
|
+
} else if (parts.includes("commands") && path6.extname(p) === ".md" && is_pruned(p)) {
|
|
4894
5086
|
is_target = true;
|
|
4895
5087
|
}
|
|
4896
5088
|
(is_target ? delete_files : keep).push(p);
|
|
4897
5089
|
}
|
|
4898
5090
|
for (const d of pruned_skill_dirs) {
|
|
4899
|
-
|
|
5091
|
+
fs7.rmSync(d, { recursive: true, force: true });
|
|
4900
5092
|
}
|
|
4901
5093
|
for (const p of delete_files) {
|
|
4902
|
-
if (p.split(
|
|
5094
|
+
if (p.split(path6.sep).includes("commands") && pathExists(p)) {
|
|
4903
5095
|
try {
|
|
4904
|
-
|
|
5096
|
+
fs7.unlinkSync(p);
|
|
4905
5097
|
} catch {
|
|
4906
5098
|
}
|
|
4907
5099
|
}
|
|
@@ -4922,9 +5114,9 @@ function _resolve_global_settings_doc() {
|
|
|
4922
5114
|
}
|
|
4923
5115
|
function _resolve_global_settings_path() {
|
|
4924
5116
|
const root = event4u_root();
|
|
4925
|
-
const canonical =
|
|
5117
|
+
const canonical = path6.join(root, "settings", SETTINGS_FILE);
|
|
4926
5118
|
if (pathExists(canonical)) return canonical;
|
|
4927
|
-
const legacy =
|
|
5119
|
+
const legacy = path6.join(root, SETTINGS_FILE);
|
|
4928
5120
|
if (pathExists(legacy)) return legacy;
|
|
4929
5121
|
return null;
|
|
4930
5122
|
}
|
|
@@ -5035,7 +5227,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
5035
5227
|
info(` schema_version=1, agent_config_version=${installed_version}`);
|
|
5036
5228
|
info(` tools=${merged_tools.join(",")}`);
|
|
5037
5229
|
}
|
|
5038
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
5230
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path6.join(project_root, ".agent-src.uncondensed"))) {
|
|
5039
5231
|
const drift = collect_drift(project_root);
|
|
5040
5232
|
if (!state.QUIET) {
|
|
5041
5233
|
process2.stdout.write("\n");
|
|
@@ -5135,19 +5327,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
5135
5327
|
}
|
|
5136
5328
|
}
|
|
5137
5329
|
}
|
|
5138
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
5330
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path6.join(project_root, ".agent-src.uncondensed"))) {
|
|
5139
5331
|
const files_by_tool = _files_by_tool_from_deploy(deploy_results);
|
|
5140
5332
|
const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
|
|
5141
5333
|
if (rc !== 0) return rc;
|
|
5142
5334
|
const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
|
|
5143
5335
|
if (removed_marker !== null && !state.QUIET) {
|
|
5144
|
-
const rel = isRelativeTo(removed_marker, project_root) ?
|
|
5336
|
+
const rel = isRelativeTo(removed_marker, project_root) ? path6.relative(project_root, removed_marker) : removed_marker;
|
|
5145
5337
|
info(`Removed legacy bridge marker: ${rel}`);
|
|
5146
5338
|
}
|
|
5147
5339
|
const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
|
|
5148
5340
|
if (anchor_paths.length > 0 && !state.QUIET) {
|
|
5149
5341
|
for (const p of anchor_paths) {
|
|
5150
|
-
const rel = isRelativeTo(p, project_root) ?
|
|
5342
|
+
const rel = isRelativeTo(p, project_root) ? path6.relative(project_root, p) : p;
|
|
5151
5343
|
info(`Project anchor written: ${rel}`);
|
|
5152
5344
|
}
|
|
5153
5345
|
}
|
|
@@ -5157,6 +5349,23 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
5157
5349
|
} catch (e) {
|
|
5158
5350
|
if (!state.QUIET) warn(`settings-surface snapshot failed \u2014 ${String(e)}`);
|
|
5159
5351
|
}
|
|
5352
|
+
if (!state.QUIET) {
|
|
5353
|
+
try {
|
|
5354
|
+
for (const line of _catalogue_truncation_warnings(deploy_results, project_root)) {
|
|
5355
|
+
warn(line);
|
|
5356
|
+
}
|
|
5357
|
+
const notice = _scoped_migration_notice(deploy_results, project_root, package_root, {
|
|
5358
|
+
env: process2.env,
|
|
5359
|
+
stdinTty: process2.stdin.isTTY === true,
|
|
5360
|
+
stdoutTty: process2.stdout.isTTY === true
|
|
5361
|
+
});
|
|
5362
|
+
if (notice.length > 0) {
|
|
5363
|
+
process2.stdout.write("\n");
|
|
5364
|
+
for (const line of notice) info(line);
|
|
5365
|
+
}
|
|
5366
|
+
} catch {
|
|
5367
|
+
}
|
|
5368
|
+
}
|
|
5160
5369
|
if (!state.QUIET) {
|
|
5161
5370
|
process2.stdout.write("\n");
|
|
5162
5371
|
success(`Global install completed (v${installed_version}).`);
|
|
@@ -5164,8 +5373,59 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
5164
5373
|
}
|
|
5165
5374
|
return 0;
|
|
5166
5375
|
}
|
|
5167
|
-
|
|
5168
|
-
|
|
5376
|
+
function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
5377
|
+
const log_candidates = [
|
|
5378
|
+
path6.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
5379
|
+
...project_root ? [path6.join(project_root, OBSERVATION_LOG)] : []
|
|
5380
|
+
];
|
|
5381
|
+
const records = log_candidates.flatMap((p) => readObservationLog(p));
|
|
5382
|
+
if (records.length === 0) return [];
|
|
5383
|
+
const limits = knownHostLimits(records);
|
|
5384
|
+
if (limits.size === 0) return [];
|
|
5385
|
+
const lines = [];
|
|
5386
|
+
for (const tool_id of Object.keys(deploy_results).sort()) {
|
|
5387
|
+
const [, , status] = deploy_results[tool_id];
|
|
5388
|
+
if (status !== "deployed") continue;
|
|
5389
|
+
const limit = limits.get(tool_id);
|
|
5390
|
+
if (limit === void 0) continue;
|
|
5391
|
+
const anchor_raw = USER_SCOPE_PATHS[tool_id];
|
|
5392
|
+
if (!anchor_raw) continue;
|
|
5393
|
+
const volume = measureCatalogueVolume(tool_id, expanduser2(anchor_raw));
|
|
5394
|
+
const warning = catalogueLimitWarning(volume, limit);
|
|
5395
|
+
if (warning !== null) lines.push(warning);
|
|
5396
|
+
}
|
|
5397
|
+
return lines;
|
|
5398
|
+
}
|
|
5399
|
+
function _scoped_migration_notice(deploy_results, project_root, package_root, probe) {
|
|
5400
|
+
if (!isInteractiveSession(probe)) return [];
|
|
5401
|
+
const log_candidates = [
|
|
5402
|
+
path6.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
5403
|
+
...project_root ? [path6.join(project_root, OBSERVATION_LOG)] : []
|
|
5404
|
+
];
|
|
5405
|
+
const limits = knownHostLimits(log_candidates.flatMap((p) => readObservationLog(p)));
|
|
5406
|
+
if (limits.size === 0) return [];
|
|
5407
|
+
const resolved = _resolve_scoped_projection(package_root);
|
|
5408
|
+
const settings_path = _resolve_global_settings_path() ?? path6.join(event4u_root(), "settings", SETTINGS_FILE);
|
|
5409
|
+
for (const tool_id of Object.keys(deploy_results).sort()) {
|
|
5410
|
+
const [, , status] = deploy_results[tool_id];
|
|
5411
|
+
if (status !== "deployed") continue;
|
|
5412
|
+
const anchor_raw = USER_SCOPE_PATHS[tool_id];
|
|
5413
|
+
if (!anchor_raw) continue;
|
|
5414
|
+
const volume = measureCatalogueVolume(tool_id, expanduser2(anchor_raw));
|
|
5415
|
+
const eligibility = migrationEligibility(
|
|
5416
|
+
tool_id,
|
|
5417
|
+
resolved.mode,
|
|
5418
|
+
volume.skillEntries,
|
|
5419
|
+
limits
|
|
5420
|
+
);
|
|
5421
|
+
if (eligibility.eligible) {
|
|
5422
|
+
return migrationPromptLines(tool_id, eligibility, settings_path);
|
|
5423
|
+
}
|
|
5424
|
+
}
|
|
5425
|
+
return [];
|
|
5426
|
+
}
|
|
5427
|
+
var SETTINGS_SURFACE_REL = path6.join("state", "settings-surface.json");
|
|
5428
|
+
var SETTINGS_DELTA_REL = path6.join("state", "settings-delta.json");
|
|
5169
5429
|
function _current_settings_surface(version) {
|
|
5170
5430
|
const jsonSchema = zodToJsonSchema(settingsSchema, {
|
|
5171
5431
|
name: "AgentSettings",
|
|
@@ -5176,20 +5436,20 @@ function _current_settings_surface(version) {
|
|
|
5176
5436
|
}
|
|
5177
5437
|
function _write_settings_surface_snapshot(installed_version) {
|
|
5178
5438
|
const root = event4u_root();
|
|
5179
|
-
const surface_path =
|
|
5180
|
-
const delta_path =
|
|
5439
|
+
const surface_path = path6.join(root, SETTINGS_SURFACE_REL);
|
|
5440
|
+
const delta_path = path6.join(root, SETTINGS_DELTA_REL);
|
|
5181
5441
|
const next = _current_settings_surface(installed_version);
|
|
5182
5442
|
let previous = null;
|
|
5183
5443
|
try {
|
|
5184
|
-
const parsed = JSON.parse(
|
|
5444
|
+
const parsed = JSON.parse(fs7.readFileSync(surface_path, "utf8"));
|
|
5185
5445
|
if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
|
|
5186
5446
|
} catch {
|
|
5187
5447
|
}
|
|
5188
5448
|
if (previous !== null && previous.version !== next.version) {
|
|
5189
5449
|
const delta = computeSurfaceDelta(previous, next);
|
|
5190
5450
|
if (delta.changes.length > 0) {
|
|
5191
|
-
|
|
5192
|
-
|
|
5451
|
+
fs7.mkdirSync(path6.dirname(delta_path), { recursive: true, mode: 448 });
|
|
5452
|
+
fs7.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
|
|
5193
5453
|
`, { mode: 384 });
|
|
5194
5454
|
if (!state.QUIET) {
|
|
5195
5455
|
const counts = {};
|
|
@@ -5201,8 +5461,8 @@ function _write_settings_surface_snapshot(installed_version) {
|
|
|
5201
5461
|
}
|
|
5202
5462
|
}
|
|
5203
5463
|
}
|
|
5204
|
-
|
|
5205
|
-
|
|
5464
|
+
fs7.mkdirSync(path6.dirname(surface_path), { recursive: true, mode: 448 });
|
|
5465
|
+
fs7.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
|
|
5206
5466
|
`, { mode: 384 });
|
|
5207
5467
|
}
|
|
5208
5468
|
function arrayStrEqual(a, b) {
|
|
@@ -5422,13 +5682,13 @@ function _minimal_templates_root() {
|
|
|
5422
5682
|
const chain = [start];
|
|
5423
5683
|
let cur = start;
|
|
5424
5684
|
for (; ; ) {
|
|
5425
|
-
const parent =
|
|
5685
|
+
const parent = path6.dirname(cur);
|
|
5426
5686
|
if (parent === cur) break;
|
|
5427
5687
|
chain.push(parent);
|
|
5428
5688
|
cur = parent;
|
|
5429
5689
|
}
|
|
5430
5690
|
for (const ancestor of chain) {
|
|
5431
|
-
const candidate =
|
|
5691
|
+
const candidate = path6.join(ancestor, "src", "templates", "minimal");
|
|
5432
5692
|
if (isDir(candidate)) return candidate;
|
|
5433
5693
|
}
|
|
5434
5694
|
fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
|
|
@@ -5436,9 +5696,9 @@ function _minimal_templates_root() {
|
|
|
5436
5696
|
var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
5437
5697
|
function _write_install_mode_marker(project_root, mode) {
|
|
5438
5698
|
if (mode !== "minimal" && mode !== "full") return;
|
|
5439
|
-
const marker =
|
|
5699
|
+
const marker = path6.join(project_root, INSTALL_MODE_MARKER_REL);
|
|
5440
5700
|
try {
|
|
5441
|
-
mkdirp(
|
|
5701
|
+
mkdirp(path6.dirname(marker));
|
|
5442
5702
|
writeText(marker, `${mode}
|
|
5443
5703
|
`);
|
|
5444
5704
|
} catch {
|
|
@@ -5447,7 +5707,7 @@ function _write_install_mode_marker(project_root, mode) {
|
|
|
5447
5707
|
function install_minimal(target_root_in, force, user_type = "") {
|
|
5448
5708
|
let target_root = resolvePath(target_root_in);
|
|
5449
5709
|
mkdirp(target_root);
|
|
5450
|
-
const parent =
|
|
5710
|
+
const parent = path6.dirname(target_root);
|
|
5451
5711
|
if (parent !== target_root) {
|
|
5452
5712
|
const existing = find_project_root_with_anchor(parent);
|
|
5453
5713
|
if (existing !== null && existing[0] !== target_root) {
|
|
@@ -5458,21 +5718,21 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
5458
5718
|
}
|
|
5459
5719
|
}
|
|
5460
5720
|
const templates = _minimal_templates_root();
|
|
5461
|
-
const settings_src =
|
|
5462
|
-
const overrides_gitkeep_src =
|
|
5463
|
-
const overrides_readme_src =
|
|
5721
|
+
const settings_src = path6.join(templates, SETTINGS_FILE);
|
|
5722
|
+
const overrides_gitkeep_src = path6.join(templates, "overrides-gitkeep");
|
|
5723
|
+
const overrides_readme_src = path6.join(templates, "agents-overrides-readme.md");
|
|
5464
5724
|
if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
|
|
5465
5725
|
if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
|
|
5466
5726
|
fail(`Bundled overrides scaffold templates missing under ${templates}`);
|
|
5467
5727
|
}
|
|
5468
5728
|
info(`Minimal init \u2192 ${target_root}`);
|
|
5469
|
-
const overrides_root =
|
|
5729
|
+
const overrides_root = path6.join(target_root, "agents", "overrides");
|
|
5470
5730
|
mkdirp(overrides_root);
|
|
5471
5731
|
const gitkeep_body = readText(overrides_gitkeep_src);
|
|
5472
5732
|
for (const sub of ["rules", "skills", "commands"]) {
|
|
5473
|
-
const sub_dir =
|
|
5733
|
+
const sub_dir = path6.join(overrides_root, sub);
|
|
5474
5734
|
mkdirp(sub_dir);
|
|
5475
|
-
const gitkeep_dst =
|
|
5735
|
+
const gitkeep_dst = path6.join(sub_dir, ".gitkeep");
|
|
5476
5736
|
if (pathExists(gitkeep_dst) && !force) {
|
|
5477
5737
|
skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
|
|
5478
5738
|
} else {
|
|
@@ -5480,7 +5740,7 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
5480
5740
|
success(`Wrote agents/overrides/${sub}/.gitkeep`);
|
|
5481
5741
|
}
|
|
5482
5742
|
}
|
|
5483
|
-
const readme_dst =
|
|
5743
|
+
const readme_dst = path6.join(overrides_root, "README.md");
|
|
5484
5744
|
if (pathExists(readme_dst) && !force) {
|
|
5485
5745
|
skip("agents/overrides/README.md already exists (use --force to overwrite)");
|
|
5486
5746
|
} else {
|
|
@@ -5498,14 +5758,14 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
5498
5758
|
personal:
|
|
5499
5759
|
user_type: ${user_type}
|
|
5500
5760
|
`;
|
|
5501
|
-
mkdirp(
|
|
5761
|
+
mkdirp(path6.dirname(settings_dst));
|
|
5502
5762
|
writeText(settings_dst, body);
|
|
5503
5763
|
success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
|
|
5504
5764
|
}
|
|
5505
5765
|
}
|
|
5506
5766
|
const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
|
|
5507
5767
|
if (removed_marker !== null) {
|
|
5508
|
-
const rel = isRelativeTo(removed_marker, target_root) ?
|
|
5768
|
+
const rel = isRelativeTo(removed_marker, target_root) ? path6.relative(target_root, removed_marker) : removed_marker;
|
|
5509
5769
|
success(`Removed legacy bridge marker: ${rel}`);
|
|
5510
5770
|
}
|
|
5511
5771
|
_write_install_mode_marker(target_root, "minimal");
|
|
@@ -5579,7 +5839,7 @@ function run_interactive_init(project_root, force) {
|
|
|
5579
5839
|
);
|
|
5580
5840
|
return 0;
|
|
5581
5841
|
}
|
|
5582
|
-
const target =
|
|
5842
|
+
const target = path6.join(project_root, _LOCAL_CONFIG_FILE);
|
|
5583
5843
|
if (pathExists(target) && !force) {
|
|
5584
5844
|
warn(
|
|
5585
5845
|
`${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
|
|
@@ -5606,7 +5866,7 @@ function run_interactive_init(project_root, force) {
|
|
|
5606
5866
|
warn(`Could not write ${target}: ${String(exc)}`);
|
|
5607
5867
|
return 1;
|
|
5608
5868
|
}
|
|
5609
|
-
success(`Wrote ${
|
|
5869
|
+
success(`Wrote ${path6.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
|
|
5610
5870
|
return 0;
|
|
5611
5871
|
}
|
|
5612
5872
|
var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
|
|
@@ -5624,12 +5884,12 @@ function _wizard_should_launch(opts) {
|
|
|
5624
5884
|
return [true, ""];
|
|
5625
5885
|
}
|
|
5626
5886
|
function _wizard_cli_dist(_project_root) {
|
|
5627
|
-
const package_root =
|
|
5628
|
-
const cli =
|
|
5887
|
+
const package_root = path6.dirname(path6.dirname(path6.dirname(resolvePath(_HERE))));
|
|
5888
|
+
const cli = path6.join(package_root, "dist", "cli", "agent-config.js");
|
|
5629
5889
|
return pathExists(cli) ? cli : null;
|
|
5630
5890
|
}
|
|
5631
5891
|
function _server_info_path() {
|
|
5632
|
-
return
|
|
5892
|
+
return path6.join(os2.homedir(), ".event4u", "agent-config", "local-server.json");
|
|
5633
5893
|
}
|
|
5634
5894
|
function _pid_is_agent_config(pid) {
|
|
5635
5895
|
let res;
|
|
@@ -5646,7 +5906,7 @@ function _pid_is_agent_config(pid) {
|
|
|
5646
5906
|
}
|
|
5647
5907
|
function unlinkMissingOk(p) {
|
|
5648
5908
|
try {
|
|
5649
|
-
|
|
5909
|
+
fs7.unlinkSync(p);
|
|
5650
5910
|
} catch {
|
|
5651
5911
|
}
|
|
5652
5912
|
}
|
|
@@ -5724,14 +5984,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
|
|
|
5724
5984
|
}
|
|
5725
5985
|
function _wizard_run_sync(cmd, env, cli) {
|
|
5726
5986
|
const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
|
|
5727
|
-
const log_path =
|
|
5987
|
+
const log_path = path6.join(
|
|
5728
5988
|
os2.tmpdir(),
|
|
5729
5989
|
`agent-config-wizard-${process2.pid}-${Date.now()}.log`
|
|
5730
5990
|
);
|
|
5731
5991
|
let child;
|
|
5732
5992
|
let log_fd = null;
|
|
5733
5993
|
try {
|
|
5734
|
-
log_fd =
|
|
5994
|
+
log_fd = fs7.openSync(log_path, "w");
|
|
5735
5995
|
child = spawn(cmd[0], cmd.slice(1), {
|
|
5736
5996
|
env,
|
|
5737
5997
|
detached: true,
|
|
@@ -5749,7 +6009,7 @@ function _wizard_run_sync(cmd, env, cli) {
|
|
|
5749
6009
|
} finally {
|
|
5750
6010
|
if (log_fd !== null) {
|
|
5751
6011
|
try {
|
|
5752
|
-
|
|
6012
|
+
fs7.closeSync(log_fd);
|
|
5753
6013
|
} catch {
|
|
5754
6014
|
}
|
|
5755
6015
|
}
|
|
@@ -5999,8 +6259,8 @@ function main2(argv) {
|
|
|
5999
6259
|
const target_root = resolvePath(
|
|
6000
6260
|
opts.custom_path || opts.project || process2.env["PROJECT_ROOT"] || process2.cwd()
|
|
6001
6261
|
);
|
|
6002
|
-
const minimal_package_root =
|
|
6003
|
-
|
|
6262
|
+
const minimal_package_root = path6.dirname(
|
|
6263
|
+
path6.dirname(path6.dirname(_minimal_templates_root()))
|
|
6004
6264
|
);
|
|
6005
6265
|
const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
|
|
6006
6266
|
return install_minimal(target_root, opts.force, validated_user_type);
|
|
@@ -6032,7 +6292,7 @@ function main2(argv) {
|
|
|
6032
6292
|
return rc2;
|
|
6033
6293
|
}
|
|
6034
6294
|
const project_root = custom_path || resolvePath(opts.project || process2.env["PROJECT_ROOT"] || process2.cwd());
|
|
6035
|
-
const is_first_run = !pathExists(
|
|
6295
|
+
const is_first_run = !pathExists(path6.join(project_root, SETTINGS_FILE));
|
|
6036
6296
|
const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
|
|
6037
6297
|
if (rc === 0 && opts.interactive) {
|
|
6038
6298
|
run_interactive_init(project_root, opts.force);
|
|
@@ -6096,16 +6356,16 @@ function _team_setup_hint_line(project_root) {
|
|
|
6096
6356
|
return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
|
|
6097
6357
|
}
|
|
6098
6358
|
function finalize_claude_model_tiers(project_root) {
|
|
6099
|
-
const claude_skills =
|
|
6100
|
-
const augment_skills =
|
|
6359
|
+
const claude_skills = path6.join(project_root, ".claude", "skills");
|
|
6360
|
+
const augment_skills = path6.join(project_root, ".augment", "skills");
|
|
6101
6361
|
if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
|
|
6102
6362
|
if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
|
|
6103
6363
|
let rendered = 0;
|
|
6104
|
-
const entries =
|
|
6364
|
+
const entries = fs7.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
6105
6365
|
for (const name of entries) {
|
|
6106
|
-
const entry =
|
|
6107
|
-
const src_dir =
|
|
6108
|
-
const src_md =
|
|
6366
|
+
const entry = path6.join(claude_skills, name);
|
|
6367
|
+
const src_dir = path6.join(augment_skills, name);
|
|
6368
|
+
const src_md = path6.join(src_dir, "SKILL.md");
|
|
6109
6369
|
let tier;
|
|
6110
6370
|
try {
|
|
6111
6371
|
tier = read_model_tier(src_md);
|
|
@@ -6114,22 +6374,22 @@ function finalize_claude_model_tiers(project_root) {
|
|
|
6114
6374
|
}
|
|
6115
6375
|
if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
|
|
6116
6376
|
if (isSymlink(entry) || isFile(entry)) {
|
|
6117
|
-
|
|
6377
|
+
fs7.unlinkSync(entry);
|
|
6118
6378
|
} else if (isDir(entry)) {
|
|
6119
|
-
|
|
6379
|
+
fs7.rmSync(entry, { recursive: true, force: true });
|
|
6120
6380
|
}
|
|
6121
6381
|
mkdirp(entry);
|
|
6122
|
-
const srcFiles =
|
|
6382
|
+
const srcFiles = fs7.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
6123
6383
|
for (const fname of srcFiles) {
|
|
6124
6384
|
if (fname === "SKILL.md") {
|
|
6125
6385
|
writeText(
|
|
6126
|
-
|
|
6386
|
+
path6.join(entry, "SKILL.md"),
|
|
6127
6387
|
render_native_model_md(readText(src_md), tier)
|
|
6128
6388
|
);
|
|
6129
6389
|
} else {
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6390
|
+
fs7.symlinkSync(
|
|
6391
|
+
path6.join("../../../.augment/skills", name, fname),
|
|
6392
|
+
path6.join(entry, fname)
|
|
6133
6393
|
);
|
|
6134
6394
|
}
|
|
6135
6395
|
}
|
|
@@ -6147,7 +6407,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
6147
6407
|
let package_type;
|
|
6148
6408
|
if (opts.package) {
|
|
6149
6409
|
package_root = resolvePath(opts.package);
|
|
6150
|
-
if (!pathExists(
|
|
6410
|
+
if (!pathExists(path6.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
6151
6411
|
fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
|
|
6152
6412
|
}
|
|
6153
6413
|
package_type = detect_package_type_for_project(project_root, package_root);
|
|
@@ -6284,9 +6544,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
6284
6544
|
function _resolvedArgv1() {
|
|
6285
6545
|
if (process2.argv[1] === void 0) return void 0;
|
|
6286
6546
|
try {
|
|
6287
|
-
return
|
|
6547
|
+
return fs7.realpathSync(path6.resolve(process2.argv[1]));
|
|
6288
6548
|
} catch {
|
|
6289
|
-
return
|
|
6549
|
+
return path6.resolve(process2.argv[1]);
|
|
6290
6550
|
}
|
|
6291
6551
|
}
|
|
6292
6552
|
var _argv1 = _resolvedArgv1();
|