@event4u/agent-config 9.12.0 → 9.14.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 +110 -238
- package/README.md +1 -1
- package/dist/agent-src/commands/optimize/deep.md +147 -0
- package/dist/agent-src/commands/optimize.md +12 -6
- package/dist/agent-src/rules/active-remediation.md +0 -2
- package/dist/agent-src/rules/architecture.md +0 -1
- package/dist/agent-src/rules/artifact-drafting-protocol.md +0 -4
- package/dist/agent-src/rules/autonomous-execution.md +1 -2
- package/dist/agent-src/rules/broken-access-control.md +0 -2
- package/dist/agent-src/rules/code-comment-discipline.md +0 -3
- package/dist/agent-src/rules/code-provenance.md +0 -3
- package/dist/agent-src/rules/communication-through-line.md +2 -3
- package/dist/agent-src/rules/content-quoting-floor.md +0 -2
- package/dist/agent-src/rules/context-hygiene.md +1 -3
- package/dist/agent-src/rules/decision-revisit-gate.md +0 -2
- package/dist/agent-src/rules/design-fidelity.md +29 -0
- package/dist/agent-src/rules/domain-adoption-policy.md +0 -3
- package/dist/agent-src/rules/downstream-changes.md +10 -1
- package/dist/agent-src/rules/external-reference-deep-dive.md +0 -7
- package/dist/agent-src/rules/fast-path-marker-visibility.md +0 -1
- package/dist/agent-src/rules/git-history-discipline.md +0 -7
- package/dist/agent-src/rules/guidelines.md +0 -2
- package/dist/agent-src/rules/improve-before-implement.md +4 -2
- package/dist/agent-src/rules/invite-challenge.md +0 -4
- package/dist/agent-src/rules/linked-projects-onboarding-gate.md +0 -2
- package/dist/agent-src/rules/markdown-safe-codeblocks.md +0 -1
- package/dist/agent-src/rules/minimal-safe-diff.md +2 -2
- package/dist/agent-src/rules/missing-tool-handling.md +0 -1
- package/dist/agent-src/rules/no-attribution-footers.md +0 -3
- package/dist/agent-src/rules/no-decorative-emojis-in-git-surfaces.md +8 -5
- package/dist/agent-src/rules/no-pr-progress-comments.md +1 -3
- package/dist/agent-src/rules/no-roadmap-references.md +0 -2
- package/dist/agent-src/rules/output-discipline.md +0 -1
- package/dist/agent-src/rules/prefer-enums-over-literals.md +0 -2
- package/dist/agent-src/rules/preservation-guard.md +0 -3
- package/dist/agent-src/rules/role-mode-adherence.md +0 -1
- package/dist/agent-src/rules/secret-vcs-guard.md +0 -2
- package/dist/agent-src/rules/senior-engineering-discipline.md +0 -2
- package/dist/agent-src/rules/session-canary.md +0 -2
- package/dist/agent-src/rules/size-enforcement.md +0 -5
- package/dist/agent-src/rules/source-confidentiality.md +0 -3
- package/dist/agent-src/rules/source-discovery-gate.md +0 -2
- package/dist/agent-src/rules/think-before-action.md +3 -3
- package/dist/agent-src/rules/token-budget-discipline.md +0 -1
- package/dist/agent-src/rules/token-efficiency.md +1 -2
- package/dist/agent-src/rules/tool-safety.md +0 -1
- package/dist/agent-src/rules/user-interaction.md +0 -3
- package/dist/agent-src/rules/user-interrupt-priority.md +0 -1
- package/dist/agent-src/skills/agent-docs-writing/SKILL.md +8 -0
- package/dist/agent-src/skills/analysis-skill-router/SKILL.md +55 -86
- package/dist/agent-src/skills/character-consistency/SKILL.md +7 -4
- package/dist/agent-src/skills/decision-record/SKILL.md +8 -0
- package/dist/agent-src/skills/design-review/SKILL.md +11 -0
- package/dist/agent-src/skills/design-system-capture/reference/design-system-json.md +8 -0
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +34 -3
- package/dist/agent-src/skills/fe-design/SKILL.md +10 -0
- package/dist/agent-src/skills/motion-choreographer/SKILL.md +7 -4
- package/dist/agent-src/skills/overbuild-review-lens/SKILL.md +201 -0
- package/dist/agent-src/skills/performance/SKILL.md +14 -0
- package/dist/agent-src/skills/pixar-storyteller/SKILL.md +8 -5
- package/dist/agent-src/skills/scene-expander/SKILL.md +9 -6
- package/dist/agent-src/skills/supply-chain-intake/SKILL.md +10 -0
- package/dist/agent-src/skills/universal-project-analysis/SKILL.md +14 -37
- package/dist/agent-src/skills/video-director/SKILL.md +9 -6
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +154 -13
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/design.ts +118 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +40 -0
- package/dist/agent-src/templates/scripts/work_engine/state.ts +55 -0
- package/dist/cli-delegate/{chunk-QFKQLQ7X.js → chunk-GCVFLBP2.js} +399 -365
- package/dist/cli-delegate/cmd_export.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 +123 -73
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +4 -4
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +10 -8
- package/dist/discovery/trust-report.md +3 -3
- package/dist/discovery/workspaces.json +8 -6
- package/dist/hooks/dispatch.js +174 -13
- package/dist/install/install.mjs +648 -614
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +783 -507
- package/dist/router.json +1 -1
- package/dist/scripts/condense.js +2 -2
- package/docs/MIGRATION.md +1 -1
- package/docs/guidelines/agent-infra/agent-interaction-and-decision-quality.md +71 -0
- package/docs/guidelines/agent-infra/minimal-safe-diff-mechanics.md +24 -1
- package/docs/guidelines/code-clarity.md +9 -2
- package/docs/guidelines/design-fidelity-mechanics.md +44 -0
- package/llms.txt +63 -27
- package/package.json +4 -4
- package/src/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +154 -13
- package/src/agent-src/templates/scripts/work_engine/directives/ui/design.ts +118 -0
- package/src/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +40 -0
- package/src/agent-src/templates/scripts/work_engine/state.ts +55 -0
- package/src/config/agent-settings.template.yml +8 -0
- package/src/scripts/_lib/counted_probe.ts +142 -0
- package/src/scripts/_lib/exec_evidence.ts +5 -0
- package/src/scripts/_lib/overbuild_lens_contract.ts +196 -0
- package/src/scripts/_lib/release_scope.ts +207 -0
- package/src/scripts/_lib/scoped_projection.ts +212 -0
- package/src/scripts/ai_council/stance_tally.ts +37 -2
- package/src/scripts/audit_auto_rules.ts +9 -9
- package/src/scripts/audit_likelihood.ts +3 -3
- package/src/scripts/audit_overlap.ts +2 -2
- package/src/scripts/audit_skill_overlap.ts +233 -95
- package/src/scripts/audit_skill_overlap_allowlist.json +4 -0
- package/src/scripts/build_proof.ts +15 -1
- package/src/scripts/check_artefact_count_messaging.ts +128 -15
- package/src/scripts/check_dependency_floors.ts +16 -6
- package/src/scripts/check_gate_coverage.ts +6 -6
- package/src/scripts/check_kernel_rule_bundle.ts +5 -4
- package/src/scripts/check_token_quality_golden.ts +0 -18
- package/src/scripts/code_graph/loader.ts +35 -6
- package/src/scripts/compile_router.ts +3 -8
- package/src/scripts/condense.ts +2 -2
- package/src/scripts/count_scoped_projection.ts +104 -0
- package/src/scripts/explain_run.ts +0 -1
- package/src/scripts/generate_pack_manifests.ts +3 -20
- package/src/scripts/hooks/block_kernel_rule_writes.ts +145 -10
- package/src/scripts/hooks/block_no_verify.ts +101 -0
- package/src/scripts/install.ts +13 -90
- package/src/scripts/lint_agent_security.ts +5 -4
- package/src/scripts/lint_framework_leakage_allowlist.json +2 -2
- package/src/scripts/lint_regression.ts +92 -1
- package/src/scripts/lint_skill_descriptions.ts +93 -5
- package/src/scripts/project_thin_rules.ts +2 -2
- package/src/scripts/release.ts +107 -3
- package/src/scripts/resolve_lint_scope.ts +53 -0
- package/src/scripts/router_telemetry.ts +0 -5
- package/src/scripts/runtime_dispatcher.ts +40 -0
- package/src/scripts/schemas/pack.schema.json +1 -5
- package/src/scripts/schemas/rule.schema.json +1 -2
- package/src/scripts/self_review_gate.ts +15 -73
- package/src/scripts/skill_linter.ts +160 -11
- package/src/scripts/sweep_dead_scan_roots.ts +550 -0
- package/src/scripts/trigger_coverage.ts +11 -37
- package/src/scripts/update_counts.ts +90 -11
|
@@ -258,9 +258,9 @@ function subtract_pointers(doc, entries) {
|
|
|
258
258
|
// src/scripts/install.ts
|
|
259
259
|
import { spawn, spawnSync } from "node:child_process";
|
|
260
260
|
import * as crypto3 from "node:crypto";
|
|
261
|
-
import * as
|
|
261
|
+
import * as fs7 from "node:fs";
|
|
262
262
|
import * as os2 from "node:os";
|
|
263
|
-
import * as
|
|
263
|
+
import * as path6 from "node:path";
|
|
264
264
|
import process2 from "node:process";
|
|
265
265
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
266
266
|
|
|
@@ -380,6 +380,11 @@ function is_claude_builtin_name(slug) {
|
|
|
380
380
|
return CLAUDE_CODE_BUILTIN_NAMES.has(slug.toLowerCase());
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
+
// src/scripts/_lib/scoped_projection.ts
|
|
384
|
+
import * as fs2 from "node:fs";
|
|
385
|
+
import { createRequire } from "node:module";
|
|
386
|
+
import * as path2 from "node:path";
|
|
387
|
+
|
|
383
388
|
// src/scripts/_lib/surface_tiers.ts
|
|
384
389
|
import * as fs from "node:fs";
|
|
385
390
|
import * as path from "node:path";
|
|
@@ -470,28 +475,108 @@ function _strip_quotes(s) {
|
|
|
470
475
|
return out;
|
|
471
476
|
}
|
|
472
477
|
|
|
478
|
+
// src/scripts/_lib/scoped_projection.ts
|
|
479
|
+
var _require = createRequire(import.meta.url);
|
|
480
|
+
var SCOPED_ACTIVE_WORKSPACES = /* @__PURE__ */ new Set([
|
|
481
|
+
"engineering",
|
|
482
|
+
"agent-config-maintainer"
|
|
483
|
+
]);
|
|
484
|
+
function isPlainObject(v) {
|
|
485
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
486
|
+
}
|
|
487
|
+
function yamlSafeLoad(text) {
|
|
488
|
+
let YAML;
|
|
489
|
+
try {
|
|
490
|
+
YAML = _require("yaml");
|
|
491
|
+
} catch {
|
|
492
|
+
return null;
|
|
493
|
+
}
|
|
494
|
+
try {
|
|
495
|
+
return YAML.parse(text, { version: "1.1" }) ?? null;
|
|
496
|
+
} catch {
|
|
497
|
+
return null;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
var PACKS_YML_REL = path2.join("src", "config", "discovery", "packs.yml");
|
|
501
|
+
function load_packs_registry(package_root) {
|
|
502
|
+
const vocab_path = path2.join(package_root, PACKS_YML_REL);
|
|
503
|
+
const data = yamlSafeLoad(fs2.readFileSync(vocab_path, "utf-8"));
|
|
504
|
+
if (!Array.isArray(data)) {
|
|
505
|
+
throw new Error(`packs.yml did not parse to a list: ${vocab_path}`);
|
|
506
|
+
}
|
|
507
|
+
const out = [];
|
|
508
|
+
for (const entry of data) {
|
|
509
|
+
if (!isPlainObject(entry)) continue;
|
|
510
|
+
const id = entry["id"];
|
|
511
|
+
if (typeof id !== "string" || id === "") continue;
|
|
512
|
+
const workspaces_raw = entry["workspaces"];
|
|
513
|
+
const workspaces = Array.isArray(workspaces_raw) ? workspaces_raw.filter((w) => typeof w === "string") : [];
|
|
514
|
+
const requires_raw = entry["requires"] ?? entry["requires_hint"];
|
|
515
|
+
const requires = Array.isArray(requires_raw) ? requires_raw.filter((r) => typeof r === "string") : [];
|
|
516
|
+
out.push({ id, workspaces, requires });
|
|
517
|
+
}
|
|
518
|
+
return out;
|
|
519
|
+
}
|
|
520
|
+
function compute_active_pack_ids(packs, runtime_active_packs) {
|
|
521
|
+
const by_id = /* @__PURE__ */ new Map();
|
|
522
|
+
for (const p of packs) by_id.set(p.id, p);
|
|
523
|
+
const active = /* @__PURE__ */ new Set();
|
|
524
|
+
for (const p of packs) {
|
|
525
|
+
if (p.workspaces.some((w) => SCOPED_ACTIVE_WORKSPACES.has(w))) {
|
|
526
|
+
active.add(p.id);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
for (const id of runtime_active_packs) {
|
|
530
|
+
active.add(id);
|
|
531
|
+
}
|
|
532
|
+
let frontier = [...active];
|
|
533
|
+
while (frontier.length > 0) {
|
|
534
|
+
const next = [];
|
|
535
|
+
for (const id of frontier) {
|
|
536
|
+
const rec = by_id.get(id);
|
|
537
|
+
if (rec === void 0) continue;
|
|
538
|
+
for (const dep of rec.requires) {
|
|
539
|
+
if (!active.has(dep)) {
|
|
540
|
+
active.add(dep);
|
|
541
|
+
next.push(dep);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
frontier = next;
|
|
546
|
+
}
|
|
547
|
+
return active;
|
|
548
|
+
}
|
|
549
|
+
function is_pruned_under_scoped(md_path, active_ids) {
|
|
550
|
+
const packs = frontmatter_packs(md_path);
|
|
551
|
+
if (packs.size === 0) return false;
|
|
552
|
+
for (const id of packs) {
|
|
553
|
+
if (active_ids.has(id)) return false;
|
|
554
|
+
}
|
|
555
|
+
return true;
|
|
556
|
+
}
|
|
557
|
+
|
|
473
558
|
// src/scripts/_lib/install_drift.ts
|
|
474
559
|
var import_yaml = __toESM(require_dist(), 1);
|
|
475
560
|
import * as crypto from "node:crypto";
|
|
476
|
-
import * as
|
|
561
|
+
import * as fs3 from "node:fs";
|
|
477
562
|
import * as os from "node:os";
|
|
478
|
-
import * as
|
|
563
|
+
import * as path3 from "node:path";
|
|
479
564
|
function expanduser(p) {
|
|
480
565
|
if (p === "~") {
|
|
481
566
|
return os.homedir();
|
|
482
567
|
}
|
|
483
568
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
484
|
-
return
|
|
569
|
+
return path3.join(os.homedir(), p.slice(2));
|
|
485
570
|
}
|
|
486
571
|
return p;
|
|
487
572
|
}
|
|
488
573
|
function resolve_entry_path(project_root, raw) {
|
|
489
574
|
const p = expanduser(raw);
|
|
490
|
-
return
|
|
575
|
+
return path3.isAbsolute(p) ? p : path3.join(project_root, p);
|
|
491
576
|
}
|
|
492
577
|
function sha256_of_file(p) {
|
|
493
578
|
try {
|
|
494
|
-
return crypto.createHash("sha256").update(
|
|
579
|
+
return crypto.createHash("sha256").update(fs3.readFileSync(p)).digest("hex");
|
|
495
580
|
} catch {
|
|
496
581
|
return null;
|
|
497
582
|
}
|
|
@@ -500,7 +585,7 @@ function collect_drift(project_root, env) {
|
|
|
500
585
|
const target = manifest_path(project_root, env);
|
|
501
586
|
let text;
|
|
502
587
|
try {
|
|
503
|
-
text =
|
|
588
|
+
text = fs3.readFileSync(target, "utf-8");
|
|
504
589
|
} catch {
|
|
505
590
|
return null;
|
|
506
591
|
}
|
|
@@ -545,7 +630,7 @@ function collect_drift(project_root, env) {
|
|
|
545
630
|
continue;
|
|
546
631
|
}
|
|
547
632
|
const resolved = resolve_entry_path(project_root, raw_path);
|
|
548
|
-
if (!
|
|
633
|
+
if (!fs3.existsSync(resolved)) {
|
|
549
634
|
out.push({
|
|
550
635
|
tool_id,
|
|
551
636
|
path: resolved,
|
|
@@ -599,8 +684,8 @@ function format_drift_report(entries) {
|
|
|
599
684
|
|
|
600
685
|
// src/scripts/_lib/claude_desktop_bundler.ts
|
|
601
686
|
import * as crypto2 from "node:crypto";
|
|
602
|
-
import * as
|
|
603
|
-
import * as
|
|
687
|
+
import * as fs4 from "node:fs";
|
|
688
|
+
import * as path4 from "node:path";
|
|
604
689
|
|
|
605
690
|
// src/scripts/_lib/zip_min.ts
|
|
606
691
|
import * as zlib from "node:zlib";
|
|
@@ -707,7 +792,7 @@ function _is_excluded(rel_parts) {
|
|
|
707
792
|
}
|
|
708
793
|
function _is_dir(p) {
|
|
709
794
|
try {
|
|
710
|
-
return
|
|
795
|
+
return fs4.statSync(p).isDirectory();
|
|
711
796
|
} catch {
|
|
712
797
|
return false;
|
|
713
798
|
}
|
|
@@ -719,12 +804,12 @@ function _compare_rel_parts(a, b) {
|
|
|
719
804
|
}
|
|
720
805
|
function _walk_skill_files(skill_dir) {
|
|
721
806
|
const out = [];
|
|
722
|
-
const resolved =
|
|
807
|
+
const resolved = fs4.realpathSync(skill_dir);
|
|
723
808
|
const walk = (root, relRoot) => {
|
|
724
809
|
const dirNames = [];
|
|
725
810
|
const fileNames = [];
|
|
726
|
-
for (const dirent of
|
|
727
|
-
const full =
|
|
811
|
+
for (const dirent of fs4.readdirSync(root, { withFileTypes: true })) {
|
|
812
|
+
const full = path4.join(root, dirent.name);
|
|
728
813
|
const isDir2 = dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full);
|
|
729
814
|
if (isDir2) {
|
|
730
815
|
dirNames.push(dirent.name);
|
|
@@ -737,13 +822,13 @@ function _walk_skill_files(skill_dir) {
|
|
|
737
822
|
if (_is_excluded(rel_parts)) {
|
|
738
823
|
continue;
|
|
739
824
|
}
|
|
740
|
-
out.push([
|
|
825
|
+
out.push([path4.join(root, fname), rel_parts]);
|
|
741
826
|
}
|
|
742
827
|
for (const dname of dirNames) {
|
|
743
828
|
if (_is_excluded([dname])) {
|
|
744
829
|
continue;
|
|
745
830
|
}
|
|
746
|
-
walk(
|
|
831
|
+
walk(path4.join(root, dname), [...relRoot, dname]);
|
|
747
832
|
}
|
|
748
833
|
};
|
|
749
834
|
walk(resolved, []);
|
|
@@ -756,53 +841,53 @@ function _manifest_digest(files) {
|
|
|
756
841
|
const rel = rel_parts.join("/");
|
|
757
842
|
h.update(Buffer.from(rel, "utf-8"));
|
|
758
843
|
h.update(Buffer.from([0]));
|
|
759
|
-
h.update(crypto2.createHash("sha256").update(
|
|
844
|
+
h.update(crypto2.createHash("sha256").update(fs4.readFileSync(abs_path)).digest());
|
|
760
845
|
h.update(Buffer.from([0]));
|
|
761
846
|
}
|
|
762
847
|
return h.digest("hex");
|
|
763
848
|
}
|
|
764
849
|
function _atomic_write_zip(zip_path, files) {
|
|
765
|
-
|
|
766
|
-
const stem =
|
|
767
|
-
const tmp_path =
|
|
768
|
-
|
|
850
|
+
fs4.mkdirSync(path4.dirname(zip_path), { recursive: true });
|
|
851
|
+
const stem = path4.basename(zip_path, path4.extname(zip_path));
|
|
852
|
+
const tmp_path = path4.join(
|
|
853
|
+
path4.dirname(zip_path),
|
|
769
854
|
`.${stem}.${crypto2.randomBytes(6).toString("hex")}.zip.tmp`
|
|
770
855
|
);
|
|
771
856
|
try {
|
|
772
857
|
const entries = files.map(([abs_path, rel_parts]) => ({
|
|
773
858
|
name: rel_parts.join("/"),
|
|
774
|
-
data:
|
|
859
|
+
data: fs4.readFileSync(abs_path)
|
|
775
860
|
}));
|
|
776
|
-
|
|
777
|
-
|
|
861
|
+
fs4.writeFileSync(tmp_path, zip_write_sync(entries));
|
|
862
|
+
fs4.renameSync(tmp_path, zip_path);
|
|
778
863
|
} finally {
|
|
779
|
-
if (
|
|
780
|
-
|
|
864
|
+
if (fs4.existsSync(tmp_path)) {
|
|
865
|
+
fs4.unlinkSync(tmp_path);
|
|
781
866
|
}
|
|
782
867
|
}
|
|
783
868
|
}
|
|
784
869
|
function _write_if_changed(dest_dir, slug, files, force, written) {
|
|
785
870
|
const digest = _manifest_digest(files);
|
|
786
|
-
const zip_path =
|
|
787
|
-
const digest_path =
|
|
788
|
-
const recorded =
|
|
789
|
-
if (!force && recorded === digest &&
|
|
871
|
+
const zip_path = path4.join(dest_dir, `${slug}.zip`);
|
|
872
|
+
const digest_path = path4.join(dest_dir, `${slug}.sha256`);
|
|
873
|
+
const recorded = fs4.existsSync(digest_path) ? fs4.readFileSync(digest_path, "utf-8").trim() : "";
|
|
874
|
+
if (!force && recorded === digest && fs4.existsSync(zip_path)) {
|
|
790
875
|
return;
|
|
791
876
|
}
|
|
792
877
|
_atomic_write_zip(zip_path, files);
|
|
793
|
-
|
|
878
|
+
fs4.writeFileSync(digest_path, digest + "\n", "utf-8");
|
|
794
879
|
written.push(zip_path);
|
|
795
880
|
}
|
|
796
881
|
function build_skill_bundles(package_root, dest_dir, force = false, curation = null) {
|
|
797
|
-
const skills_root =
|
|
882
|
+
const skills_root = path4.join(package_root, "dist/agent-src", "skills");
|
|
798
883
|
if (!_is_dir(skills_root)) {
|
|
799
884
|
return [];
|
|
800
885
|
}
|
|
801
|
-
|
|
886
|
+
fs4.mkdirSync(dest_dir, { recursive: true });
|
|
802
887
|
const written = [];
|
|
803
|
-
for (const name of
|
|
804
|
-
const entry =
|
|
805
|
-
const isSymlink2 =
|
|
888
|
+
for (const name of fs4.readdirSync(skills_root).sort()) {
|
|
889
|
+
const entry = path4.join(skills_root, name);
|
|
890
|
+
const isSymlink2 = fs4.lstatSync(entry).isSymbolicLink();
|
|
806
891
|
if (!(_is_dir(entry) || isSymlink2)) {
|
|
807
892
|
continue;
|
|
808
893
|
}
|
|
@@ -810,8 +895,8 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
|
|
|
810
895
|
if (curation !== null && !curation.includes(skill_name)) {
|
|
811
896
|
continue;
|
|
812
897
|
}
|
|
813
|
-
const skill_md =
|
|
814
|
-
if (!
|
|
898
|
+
const skill_md = path4.join(entry, "SKILL.md");
|
|
899
|
+
if (!fs4.existsSync(skill_md)) {
|
|
815
900
|
continue;
|
|
816
901
|
}
|
|
817
902
|
const files = _walk_skill_files(entry);
|
|
@@ -823,15 +908,15 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
|
|
|
823
908
|
return written;
|
|
824
909
|
}
|
|
825
910
|
function _command_slug(source_file, commands_root) {
|
|
826
|
-
const rel =
|
|
827
|
-
const noExt = rel.slice(0, rel.length -
|
|
828
|
-
return noExt.split(
|
|
911
|
+
const rel = path4.relative(commands_root, source_file);
|
|
912
|
+
const noExt = rel.slice(0, rel.length - path4.extname(rel).length);
|
|
913
|
+
return noExt.split(path4.sep).join("-");
|
|
829
914
|
}
|
|
830
915
|
function _iter_command_files(commands_root) {
|
|
831
916
|
const found = [];
|
|
832
917
|
const walk = (dir) => {
|
|
833
|
-
for (const dirent of
|
|
834
|
-
const full =
|
|
918
|
+
for (const dirent of fs4.readdirSync(dir, { withFileTypes: true })) {
|
|
919
|
+
const full = path4.join(dir, dirent.name);
|
|
835
920
|
if (dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full)) {
|
|
836
921
|
walk(full);
|
|
837
922
|
} else if (dirent.name.endsWith(".md")) {
|
|
@@ -841,21 +926,21 @@ function _iter_command_files(commands_root) {
|
|
|
841
926
|
};
|
|
842
927
|
walk(commands_root);
|
|
843
928
|
found.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
844
|
-
return found.filter((source_file) =>
|
|
929
|
+
return found.filter((source_file) => path4.basename(source_file) !== "AGENTS.md");
|
|
845
930
|
}
|
|
846
931
|
function build_command_bundles(package_root, dest_dir, force = false, curation = null) {
|
|
847
|
-
const commands_root =
|
|
932
|
+
const commands_root = path4.join(package_root, "dist/agent-src", "commands");
|
|
848
933
|
if (!_is_dir(commands_root)) {
|
|
849
934
|
return [];
|
|
850
935
|
}
|
|
851
|
-
const skills_root =
|
|
936
|
+
const skills_root = path4.join(package_root, "dist/agent-src", "skills");
|
|
852
937
|
let skill_names = /* @__PURE__ */ new Set();
|
|
853
938
|
if (_is_dir(skills_root)) {
|
|
854
939
|
skill_names = new Set(
|
|
855
|
-
|
|
940
|
+
fs4.readdirSync(skills_root).filter((name) => _is_dir(path4.join(skills_root, name)))
|
|
856
941
|
);
|
|
857
942
|
}
|
|
858
|
-
|
|
943
|
+
fs4.mkdirSync(dest_dir, { recursive: true });
|
|
859
944
|
const written = [];
|
|
860
945
|
for (const source_file of _iter_command_files(commands_root)) {
|
|
861
946
|
const slug = _command_slug(source_file, commands_root);
|
|
@@ -865,7 +950,7 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
|
|
|
865
950
|
if (curation !== null && !curation.includes(slug)) {
|
|
866
951
|
continue;
|
|
867
952
|
}
|
|
868
|
-
const files = [[
|
|
953
|
+
const files = [[fs4.realpathSync(source_file), ["SKILL.md"]]];
|
|
869
954
|
_write_if_changed(dest_dir, slug, files, force, written);
|
|
870
955
|
}
|
|
871
956
|
return written;
|
|
@@ -1419,8 +1504,8 @@ function getErrorMap() {
|
|
|
1419
1504
|
|
|
1420
1505
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
1421
1506
|
var makeIssue = (params) => {
|
|
1422
|
-
const { data, path:
|
|
1423
|
-
const fullPath = [...
|
|
1507
|
+
const { data, path: path7, errorMaps, issueData } = params;
|
|
1508
|
+
const fullPath = [...path7, ...issueData.path || []];
|
|
1424
1509
|
const fullIssue = {
|
|
1425
1510
|
...issueData,
|
|
1426
1511
|
path: fullPath
|
|
@@ -1536,11 +1621,11 @@ var errorUtil;
|
|
|
1536
1621
|
|
|
1537
1622
|
// node_modules/zod/v3/types.js
|
|
1538
1623
|
var ParseInputLazyPath = class {
|
|
1539
|
-
constructor(parent, value,
|
|
1624
|
+
constructor(parent, value, path7, key) {
|
|
1540
1625
|
this._cachedPath = [];
|
|
1541
1626
|
this.parent = parent;
|
|
1542
1627
|
this.data = value;
|
|
1543
|
-
this._path =
|
|
1628
|
+
this._path = path7;
|
|
1544
1629
|
this._key = key;
|
|
1545
1630
|
}
|
|
1546
1631
|
get path() {
|
|
@@ -6770,8 +6855,8 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
6770
6855
|
};
|
|
6771
6856
|
|
|
6772
6857
|
// src/scripts/_lib/module_detection.ts
|
|
6773
|
-
import * as
|
|
6774
|
-
import * as
|
|
6858
|
+
import * as fs5 from "node:fs";
|
|
6859
|
+
import * as path5 from "node:path";
|
|
6775
6860
|
var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
|
|
6776
6861
|
var _RULES = [
|
|
6777
6862
|
["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
|
|
@@ -6785,14 +6870,14 @@ var _RULES = [
|
|
|
6785
6870
|
];
|
|
6786
6871
|
function _isDir(p) {
|
|
6787
6872
|
try {
|
|
6788
|
-
return
|
|
6873
|
+
return fs5.statSync(p).isDirectory();
|
|
6789
6874
|
} catch {
|
|
6790
6875
|
return false;
|
|
6791
6876
|
}
|
|
6792
6877
|
}
|
|
6793
6878
|
function _isFile(p) {
|
|
6794
6879
|
try {
|
|
6795
|
-
return
|
|
6880
|
+
return fs5.statSync(p).isFile();
|
|
6796
6881
|
} catch {
|
|
6797
6882
|
return false;
|
|
6798
6883
|
}
|
|
@@ -6806,13 +6891,13 @@ function _isUpperChar(ch) {
|
|
|
6806
6891
|
function _list_module_subdirs(root) {
|
|
6807
6892
|
let entries;
|
|
6808
6893
|
try {
|
|
6809
|
-
entries =
|
|
6894
|
+
entries = fs5.readdirSync(root).sort();
|
|
6810
6895
|
} catch {
|
|
6811
6896
|
return [];
|
|
6812
6897
|
}
|
|
6813
6898
|
const out = [];
|
|
6814
6899
|
for (const name of entries) {
|
|
6815
|
-
if (!_isDir(
|
|
6900
|
+
if (!_isDir(path5.join(root, name))) {
|
|
6816
6901
|
continue;
|
|
6817
6902
|
}
|
|
6818
6903
|
if (name.startsWith(".")) {
|
|
@@ -6834,11 +6919,11 @@ function _score_confidence(stack, root, subdirs) {
|
|
|
6834
6919
|
return capitalized.length > 0 ? "high" : "medium";
|
|
6835
6920
|
}
|
|
6836
6921
|
if (stack === "node-monorepo") {
|
|
6837
|
-
const withPkgJson = subdirs.filter((name) => _isFile(
|
|
6922
|
+
const withPkgJson = subdirs.filter((name) => _isFile(path5.join(root, name, "package.json")));
|
|
6838
6923
|
return withPkgJson.length > 0 ? "high" : "medium";
|
|
6839
6924
|
}
|
|
6840
6925
|
if (stack === "python-src") {
|
|
6841
|
-
const withInit = subdirs.filter((name) => _isFile(
|
|
6926
|
+
const withInit = subdirs.filter((name) => _isFile(path5.join(root, name, "__init__.py")));
|
|
6842
6927
|
return withInit.length > 0 ? "high" : "medium";
|
|
6843
6928
|
}
|
|
6844
6929
|
if (stack === "go-internal") {
|
|
@@ -6850,7 +6935,7 @@ function detect_module_roots(project_root) {
|
|
|
6850
6935
|
const high = [];
|
|
6851
6936
|
const medium = [];
|
|
6852
6937
|
for (const [rel_path, stack, namespace_template] of _RULES) {
|
|
6853
|
-
const abs_path =
|
|
6938
|
+
const abs_path = path5.join(project_root, rel_path);
|
|
6854
6939
|
if (!_isDir(abs_path)) {
|
|
6855
6940
|
continue;
|
|
6856
6941
|
}
|
|
@@ -6872,7 +6957,7 @@ function detect_module_roots(project_root) {
|
|
|
6872
6957
|
}
|
|
6873
6958
|
|
|
6874
6959
|
// src/scripts/_lib/model_tier.ts
|
|
6875
|
-
import
|
|
6960
|
+
import fs6 from "node:fs";
|
|
6876
6961
|
var TIER_TO_CLAUDE_MODEL = {
|
|
6877
6962
|
high: "opus",
|
|
6878
6963
|
medium: "sonnet",
|
|
@@ -6880,8 +6965,8 @@ var TIER_TO_CLAUDE_MODEL = {
|
|
|
6880
6965
|
};
|
|
6881
6966
|
var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
|
|
6882
6967
|
function read_model_tier(skill_md) {
|
|
6883
|
-
if (!
|
|
6884
|
-
const text =
|
|
6968
|
+
if (!fs6.existsSync(skill_md)) return null;
|
|
6969
|
+
const text = fs6.readFileSync(skill_md).toString("utf-8");
|
|
6885
6970
|
if (!text.startsWith("---\n")) return null;
|
|
6886
6971
|
const end = text.indexOf("\n---\n", 4);
|
|
6887
6972
|
if (end === -1) return null;
|
|
@@ -6915,34 +7000,34 @@ var ArgparseExit = class extends Error {
|
|
|
6915
7000
|
function expanduser2(p) {
|
|
6916
7001
|
if (p === "~") return os2.homedir();
|
|
6917
7002
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
6918
|
-
return
|
|
7003
|
+
return path6.join(os2.homedir(), p.slice(2));
|
|
6919
7004
|
}
|
|
6920
7005
|
return p;
|
|
6921
7006
|
}
|
|
6922
7007
|
function resolvePath(p) {
|
|
6923
7008
|
try {
|
|
6924
|
-
return
|
|
7009
|
+
return fs7.realpathSync(path6.resolve(p));
|
|
6925
7010
|
} catch {
|
|
6926
|
-
return
|
|
7011
|
+
return path6.resolve(p);
|
|
6927
7012
|
}
|
|
6928
7013
|
}
|
|
6929
7014
|
function isFile(p) {
|
|
6930
7015
|
try {
|
|
6931
|
-
return
|
|
7016
|
+
return fs7.statSync(p).isFile();
|
|
6932
7017
|
} catch {
|
|
6933
7018
|
return false;
|
|
6934
7019
|
}
|
|
6935
7020
|
}
|
|
6936
7021
|
function isDir(p) {
|
|
6937
7022
|
try {
|
|
6938
|
-
return
|
|
7023
|
+
return fs7.statSync(p).isDirectory();
|
|
6939
7024
|
} catch {
|
|
6940
7025
|
return false;
|
|
6941
7026
|
}
|
|
6942
7027
|
}
|
|
6943
7028
|
function pathExists(p) {
|
|
6944
7029
|
try {
|
|
6945
|
-
|
|
7030
|
+
fs7.statSync(p);
|
|
6946
7031
|
return true;
|
|
6947
7032
|
} catch {
|
|
6948
7033
|
return false;
|
|
@@ -6950,24 +7035,24 @@ function pathExists(p) {
|
|
|
6950
7035
|
}
|
|
6951
7036
|
function isSymlink(p) {
|
|
6952
7037
|
try {
|
|
6953
|
-
return
|
|
7038
|
+
return fs7.lstatSync(p).isSymbolicLink();
|
|
6954
7039
|
} catch {
|
|
6955
7040
|
return false;
|
|
6956
7041
|
}
|
|
6957
7042
|
}
|
|
6958
7043
|
function readText(p) {
|
|
6959
|
-
return
|
|
7044
|
+
return fs7.readFileSync(p, "utf-8");
|
|
6960
7045
|
}
|
|
6961
7046
|
function writeText(p, content) {
|
|
6962
|
-
|
|
7047
|
+
fs7.writeFileSync(p, content, "utf-8");
|
|
6963
7048
|
}
|
|
6964
7049
|
function mkdirp(p) {
|
|
6965
|
-
|
|
7050
|
+
fs7.mkdirSync(p, { recursive: true });
|
|
6966
7051
|
}
|
|
6967
7052
|
function sortedGlobStems(directory, suffix) {
|
|
6968
7053
|
let entries;
|
|
6969
7054
|
try {
|
|
6970
|
-
entries =
|
|
7055
|
+
entries = fs7.readdirSync(directory);
|
|
6971
7056
|
} catch {
|
|
6972
7057
|
return [];
|
|
6973
7058
|
}
|
|
@@ -6987,7 +7072,7 @@ function sortedGlobStems(directory, suffix) {
|
|
|
6987
7072
|
function countZips(directory) {
|
|
6988
7073
|
if (!isDir(directory)) return 0;
|
|
6989
7074
|
let n = 0;
|
|
6990
|
-
for (const name of
|
|
7075
|
+
for (const name of fs7.readdirSync(directory)) {
|
|
6991
7076
|
if (name.endsWith(".zip")) n += 1;
|
|
6992
7077
|
}
|
|
6993
7078
|
return n;
|
|
@@ -6995,35 +7080,35 @@ function countZips(directory) {
|
|
|
6995
7080
|
function sha256OfFile(p) {
|
|
6996
7081
|
let data;
|
|
6997
7082
|
try {
|
|
6998
|
-
data =
|
|
7083
|
+
data = fs7.readFileSync(p);
|
|
6999
7084
|
} catch {
|
|
7000
7085
|
return null;
|
|
7001
7086
|
}
|
|
7002
7087
|
return crypto3.createHash("sha256").update(data).digest("hex");
|
|
7003
7088
|
}
|
|
7004
7089
|
function atomicWrite0644(target, body, prefix) {
|
|
7005
|
-
const dir =
|
|
7006
|
-
const tmpName =
|
|
7090
|
+
const dir = path6.dirname(target);
|
|
7091
|
+
const tmpName = path6.join(
|
|
7007
7092
|
dir,
|
|
7008
7093
|
`${prefix}${process2.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
|
|
7009
7094
|
);
|
|
7010
7095
|
let fd = null;
|
|
7011
7096
|
try {
|
|
7012
|
-
fd =
|
|
7013
|
-
|
|
7014
|
-
|
|
7097
|
+
fd = fs7.openSync(tmpName, "wx", 420);
|
|
7098
|
+
fs7.writeFileSync(fd, body, "utf-8");
|
|
7099
|
+
fs7.closeSync(fd);
|
|
7015
7100
|
fd = null;
|
|
7016
|
-
|
|
7017
|
-
|
|
7101
|
+
fs7.chmodSync(tmpName, 420);
|
|
7102
|
+
fs7.renameSync(tmpName, target);
|
|
7018
7103
|
} catch (err) {
|
|
7019
7104
|
if (fd !== null) {
|
|
7020
7105
|
try {
|
|
7021
|
-
|
|
7106
|
+
fs7.closeSync(fd);
|
|
7022
7107
|
} catch {
|
|
7023
7108
|
}
|
|
7024
7109
|
}
|
|
7025
7110
|
try {
|
|
7026
|
-
|
|
7111
|
+
fs7.unlinkSync(tmpName);
|
|
7027
7112
|
} catch {
|
|
7028
7113
|
}
|
|
7029
7114
|
throw err;
|
|
@@ -7123,7 +7208,7 @@ function jsonDumpsCompact(value) {
|
|
|
7123
7208
|
}
|
|
7124
7209
|
return _jsonStrNoAscii(String(value));
|
|
7125
7210
|
}
|
|
7126
|
-
function
|
|
7211
|
+
function yamlSafeLoad2(text) {
|
|
7127
7212
|
let YAML;
|
|
7128
7213
|
try {
|
|
7129
7214
|
YAML = require_dist();
|
|
@@ -7147,12 +7232,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
|
|
|
7147
7232
|
var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
|
|
7148
7233
|
var SETTINGS_SUBDIR = ["agents", "settings"];
|
|
7149
7234
|
function _canonical_settings_target(project_root) {
|
|
7150
|
-
return
|
|
7235
|
+
return path6.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
|
|
7151
7236
|
}
|
|
7152
7237
|
function _resolve_settings_read(project_root) {
|
|
7153
7238
|
const canonical = _canonical_settings_target(project_root);
|
|
7154
7239
|
if (pathExists(canonical)) return canonical;
|
|
7155
|
-
const legacy =
|
|
7240
|
+
const legacy = path6.join(project_root, SETTINGS_FILE);
|
|
7156
7241
|
if (pathExists(legacy)) return legacy;
|
|
7157
7242
|
return canonical;
|
|
7158
7243
|
}
|
|
@@ -7216,9 +7301,9 @@ function fail(msg) {
|
|
|
7216
7301
|
throw new SystemExitError(1);
|
|
7217
7302
|
}
|
|
7218
7303
|
function detect_package_root(project_root) {
|
|
7219
|
-
const npm_path =
|
|
7304
|
+
const npm_path = path6.join(project_root, "node_modules", "@event4u", "agent-config");
|
|
7220
7305
|
if (isDir(npm_path)) return resolvePath(npm_path);
|
|
7221
|
-
if (pathExists(
|
|
7306
|
+
if (pathExists(path6.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
7222
7307
|
return project_root;
|
|
7223
7308
|
}
|
|
7224
7309
|
fail(
|
|
@@ -7226,12 +7311,12 @@ function detect_package_root(project_root) {
|
|
|
7226
7311
|
);
|
|
7227
7312
|
}
|
|
7228
7313
|
function detect_package_type(package_root) {
|
|
7229
|
-
if (package_root.split(
|
|
7314
|
+
if (package_root.split(path6.sep).includes("node_modules")) return "npm";
|
|
7230
7315
|
return "local";
|
|
7231
7316
|
}
|
|
7232
7317
|
function detect_package_type_for_project(project_root, package_root) {
|
|
7233
7318
|
const npm_path = resolvePath(
|
|
7234
|
-
|
|
7319
|
+
path6.join(project_root, "node_modules", "@event4u", "agent-config")
|
|
7235
7320
|
);
|
|
7236
7321
|
const package_resolved = resolvePath(package_root);
|
|
7237
7322
|
if (package_resolved === npm_path) return "npm";
|
|
@@ -7251,7 +7336,7 @@ function ensure_directory(p) {
|
|
|
7251
7336
|
mkdirp(p);
|
|
7252
7337
|
}
|
|
7253
7338
|
function write_file(p, content) {
|
|
7254
|
-
ensure_directory(
|
|
7339
|
+
ensure_directory(path6.dirname(p));
|
|
7255
7340
|
writeText(p, content);
|
|
7256
7341
|
}
|
|
7257
7342
|
function read_json_file(p) {
|
|
@@ -7422,7 +7507,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
|
|
|
7422
7507
|
return rendered + "\n" + suffix;
|
|
7423
7508
|
}
|
|
7424
7509
|
function _migrate_legacy_if_present(project_root, template_body) {
|
|
7425
|
-
const legacy_target =
|
|
7510
|
+
const legacy_target = path6.join(project_root, LEGACY_SETTINGS_FILE);
|
|
7426
7511
|
if (!isFile(legacy_target)) return null;
|
|
7427
7512
|
const legacy_text = readText(legacy_target);
|
|
7428
7513
|
const [values, unknown] = _parse_legacy_settings(legacy_text);
|
|
@@ -7437,9 +7522,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
|
|
|
7437
7522
|
}
|
|
7438
7523
|
}
|
|
7439
7524
|
rendered = _append_unknown_legacy(rendered, values, unknown);
|
|
7440
|
-
const backup_target =
|
|
7525
|
+
const backup_target = path6.join(project_root, LEGACY_BACKUP_FILE);
|
|
7441
7526
|
writeText(backup_target, legacy_text);
|
|
7442
|
-
|
|
7527
|
+
fs7.unlinkSync(legacy_target);
|
|
7443
7528
|
info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
|
|
7444
7529
|
info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
|
|
7445
7530
|
if (unknown.length > 0) {
|
|
@@ -7474,7 +7559,7 @@ function _render_template(template, profile_values) {
|
|
|
7474
7559
|
return body;
|
|
7475
7560
|
}
|
|
7476
7561
|
function _load_valid_user_types(package_root) {
|
|
7477
|
-
const directory =
|
|
7562
|
+
const directory = path6.join(package_root, USER_TYPES_DIR);
|
|
7478
7563
|
if (!isDir(directory)) return [];
|
|
7479
7564
|
return sortedGlobStems(directory, ".yml");
|
|
7480
7565
|
}
|
|
@@ -7531,8 +7616,8 @@ function splitlinesKeepends(text) {
|
|
|
7531
7616
|
}
|
|
7532
7617
|
function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
|
|
7533
7618
|
const target = _canonical_settings_target(project_root);
|
|
7534
|
-
const profile_source =
|
|
7535
|
-
const template_source =
|
|
7619
|
+
const profile_source = path6.join(package_root, "src", "config", "profiles", `${profile}.ini`);
|
|
7620
|
+
const template_source = path6.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
7536
7621
|
if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
|
|
7537
7622
|
if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
|
|
7538
7623
|
const template = readText(template_source);
|
|
@@ -7546,21 +7631,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
7546
7631
|
if (profile_values["rule_loading_tier"] !== profile) {
|
|
7547
7632
|
const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
|
|
7548
7633
|
fail(
|
|
7549
|
-
`Profile preset ${
|
|
7634
|
+
`Profile preset ${path6.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
|
|
7550
7635
|
);
|
|
7551
7636
|
}
|
|
7552
7637
|
profile_values["user_type"] = _validate_user_type(package_root, user_type);
|
|
7553
7638
|
let template_body = _render_template(template, profile_values);
|
|
7554
7639
|
template_body = _inject_packs(template_body, packs ?? []);
|
|
7555
|
-
const legacy_root =
|
|
7640
|
+
const legacy_root = path6.join(project_root, SETTINGS_FILE);
|
|
7556
7641
|
if (isFile(legacy_root) && !pathExists(target)) {
|
|
7557
|
-
mkdirp(
|
|
7642
|
+
mkdirp(path6.dirname(target));
|
|
7558
7643
|
writeText(target, readText(legacy_root));
|
|
7559
|
-
|
|
7644
|
+
fs7.unlinkSync(legacy_root);
|
|
7560
7645
|
success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
|
|
7561
7646
|
return;
|
|
7562
7647
|
}
|
|
7563
|
-
const legacy_target =
|
|
7648
|
+
const legacy_target = path6.join(project_root, LEGACY_SETTINGS_FILE);
|
|
7564
7649
|
if (isFile(legacy_target) && pathExists(target)) {
|
|
7565
7650
|
warn(
|
|
7566
7651
|
`Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
|
|
@@ -7577,7 +7662,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
7577
7662
|
skip(`${SETTINGS_FILE} already exists`);
|
|
7578
7663
|
return;
|
|
7579
7664
|
}
|
|
7580
|
-
mkdirp(
|
|
7665
|
+
mkdirp(path6.dirname(target));
|
|
7581
7666
|
write_file(target, template_body);
|
|
7582
7667
|
const user_type_value = profile_values["user_type"] ?? "";
|
|
7583
7668
|
const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
|
|
@@ -7590,7 +7675,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
7590
7675
|
const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
|
|
7591
7676
|
const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
|
|
7592
7677
|
merge_json_file(
|
|
7593
|
-
|
|
7678
|
+
path6.join(project_root, ".vscode", "settings.json"),
|
|
7594
7679
|
bridge,
|
|
7595
7680
|
force,
|
|
7596
7681
|
".vscode/settings.json"
|
|
@@ -7599,14 +7684,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
7599
7684
|
function ensure_augment_bridge(project_root, force) {
|
|
7600
7685
|
const bridge = { enabledPlugins: { "agent-config@event4u": true } };
|
|
7601
7686
|
return merge_json_file(
|
|
7602
|
-
|
|
7687
|
+
path6.join(project_root, ".augment", "settings.json"),
|
|
7603
7688
|
bridge,
|
|
7604
7689
|
force,
|
|
7605
7690
|
".augment/settings.json"
|
|
7606
7691
|
);
|
|
7607
7692
|
}
|
|
7608
|
-
var AUGMENT_USER_DIR =
|
|
7609
|
-
var AUGMENT_USER_HOOKS_DIR =
|
|
7693
|
+
var AUGMENT_USER_DIR = path6.join(os2.homedir(), ".augment");
|
|
7694
|
+
var AUGMENT_USER_HOOKS_DIR = path6.join(AUGMENT_USER_DIR, "hooks");
|
|
7610
7695
|
var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
|
|
7611
7696
|
var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
7612
7697
|
"augment-chat-history.sh",
|
|
@@ -7622,29 +7707,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
|
|
|
7622
7707
|
["post_tool_use", "PostToolUse"]
|
|
7623
7708
|
];
|
|
7624
7709
|
function _deploy_augment_trampoline(package_root, name, force) {
|
|
7625
|
-
const src =
|
|
7710
|
+
const src = path6.join(package_root, "scripts", "hooks", name);
|
|
7626
7711
|
if (!pathExists(src)) {
|
|
7627
7712
|
skip(`augment trampoline missing in package: ${src}`);
|
|
7628
7713
|
return null;
|
|
7629
7714
|
}
|
|
7630
7715
|
mkdirp(AUGMENT_USER_HOOKS_DIR);
|
|
7631
|
-
const dst =
|
|
7716
|
+
const dst = path6.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
7632
7717
|
const src_text = readText(src);
|
|
7633
7718
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
7634
7719
|
skip(`~/.augment/hooks/${name} already up to date`);
|
|
7635
7720
|
} else {
|
|
7636
7721
|
writeText(dst, src_text);
|
|
7637
|
-
|
|
7722
|
+
fs7.chmodSync(dst, 493);
|
|
7638
7723
|
success(`~/.augment/hooks/${name} installed`);
|
|
7639
7724
|
}
|
|
7640
7725
|
return dst;
|
|
7641
7726
|
}
|
|
7642
7727
|
function _remove_legacy_augment_trampolines() {
|
|
7643
7728
|
for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
|
|
7644
|
-
const legacy =
|
|
7729
|
+
const legacy = path6.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
7645
7730
|
try {
|
|
7646
7731
|
if (isFile(legacy)) {
|
|
7647
|
-
|
|
7732
|
+
fs7.unlinkSync(legacy);
|
|
7648
7733
|
skip(`removed legacy ~/.augment/hooks/${name}`);
|
|
7649
7734
|
}
|
|
7650
7735
|
} catch {
|
|
@@ -7663,7 +7748,7 @@ function ensure_augment_user_hooks(package_root, force) {
|
|
|
7663
7748
|
}
|
|
7664
7749
|
const settings_patch = { hooks: per_event };
|
|
7665
7750
|
return merge_json_file(
|
|
7666
|
-
|
|
7751
|
+
path6.join(AUGMENT_USER_DIR, "settings.json"),
|
|
7667
7752
|
settings_patch,
|
|
7668
7753
|
force,
|
|
7669
7754
|
"~/.augment/settings.json"
|
|
@@ -7688,7 +7773,7 @@ function _heal_legacy_claude_plugin_ids(p) {
|
|
|
7688
7773
|
return removed;
|
|
7689
7774
|
}
|
|
7690
7775
|
function ensure_claude_bridge(project_root, force) {
|
|
7691
|
-
const target =
|
|
7776
|
+
const target = path6.join(project_root, ".claude", "settings.json");
|
|
7692
7777
|
const healed = _heal_legacy_claude_plugin_ids(target);
|
|
7693
7778
|
for (const pid of healed) {
|
|
7694
7779
|
success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
|
|
@@ -7713,29 +7798,29 @@ function ensure_cursor_bridge(project_root, force) {
|
|
|
7713
7798
|
}
|
|
7714
7799
|
const bridge = { version: 1, hooks };
|
|
7715
7800
|
return merge_json_file(
|
|
7716
|
-
|
|
7801
|
+
path6.join(project_root, ".cursor", "hooks.json"),
|
|
7717
7802
|
bridge,
|
|
7718
7803
|
force,
|
|
7719
7804
|
".cursor/hooks.json"
|
|
7720
7805
|
);
|
|
7721
7806
|
}
|
|
7722
|
-
var CURSOR_USER_DIR =
|
|
7723
|
-
var CURSOR_USER_HOOKS_DIR =
|
|
7807
|
+
var CURSOR_USER_DIR = path6.join(os2.homedir(), ".cursor");
|
|
7808
|
+
var CURSOR_USER_HOOKS_DIR = path6.join(CURSOR_USER_DIR, "hooks");
|
|
7724
7809
|
var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
|
|
7725
7810
|
function ensure_cursor_user_hooks(package_root, force) {
|
|
7726
|
-
const src =
|
|
7811
|
+
const src = path6.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
|
|
7727
7812
|
if (!pathExists(src)) {
|
|
7728
7813
|
skip(`cursor trampoline missing in package: ${src}`);
|
|
7729
7814
|
return [];
|
|
7730
7815
|
}
|
|
7731
7816
|
mkdirp(CURSOR_USER_HOOKS_DIR);
|
|
7732
|
-
const dst =
|
|
7817
|
+
const dst = path6.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
|
|
7733
7818
|
const src_text = readText(src);
|
|
7734
7819
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
7735
7820
|
skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
7736
7821
|
} else {
|
|
7737
7822
|
writeText(dst, src_text);
|
|
7738
|
-
|
|
7823
|
+
fs7.chmodSync(dst, 493);
|
|
7739
7824
|
success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
|
|
7740
7825
|
}
|
|
7741
7826
|
const hooks = {};
|
|
@@ -7744,7 +7829,7 @@ function ensure_cursor_user_hooks(package_root, force) {
|
|
|
7744
7829
|
}
|
|
7745
7830
|
const settings_patch = { version: 1, hooks };
|
|
7746
7831
|
return merge_json_file(
|
|
7747
|
-
|
|
7832
|
+
path6.join(CURSOR_USER_DIR, "hooks.json"),
|
|
7748
7833
|
settings_patch,
|
|
7749
7834
|
force,
|
|
7750
7835
|
"~/.cursor/hooks.json"
|
|
@@ -7787,12 +7872,12 @@ exit 0
|
|
|
7787
7872
|
`;
|
|
7788
7873
|
}
|
|
7789
7874
|
function ensure_cline_bridge(project_root, force) {
|
|
7790
|
-
const hooks_dir =
|
|
7875
|
+
const hooks_dir = path6.join(project_root, ".clinerules", "hooks");
|
|
7791
7876
|
mkdirp(hooks_dir);
|
|
7792
7877
|
const workspace_quoted = shlexQuote(resolvePath(project_root));
|
|
7793
7878
|
let written = 0;
|
|
7794
7879
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
7795
|
-
const target =
|
|
7880
|
+
const target = path6.join(hooks_dir, native_event);
|
|
7796
7881
|
const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
|
|
7797
7882
|
if (pathExists(target) && readText(target) === body && !force) {
|
|
7798
7883
|
continue;
|
|
@@ -7802,7 +7887,7 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
7802
7887
|
continue;
|
|
7803
7888
|
}
|
|
7804
7889
|
writeText(target, body);
|
|
7805
|
-
|
|
7890
|
+
fs7.chmodSync(target, 493);
|
|
7806
7891
|
written += 1;
|
|
7807
7892
|
}
|
|
7808
7893
|
if (written) {
|
|
@@ -7811,27 +7896,27 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
7811
7896
|
skip(".clinerules/hooks/ already up to date");
|
|
7812
7897
|
}
|
|
7813
7898
|
}
|
|
7814
|
-
var CLINE_USER_DIR =
|
|
7899
|
+
var CLINE_USER_DIR = path6.join(os2.homedir(), "Documents", "Cline", "Hooks");
|
|
7815
7900
|
var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
|
|
7816
7901
|
function ensure_cline_user_hooks(package_root, force) {
|
|
7817
|
-
const src =
|
|
7902
|
+
const src = path6.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
|
|
7818
7903
|
if (!pathExists(src)) {
|
|
7819
7904
|
skip(`cline trampoline missing in package: ${src}`);
|
|
7820
7905
|
return;
|
|
7821
7906
|
}
|
|
7822
7907
|
mkdirp(CLINE_USER_DIR);
|
|
7823
|
-
const trampoline =
|
|
7908
|
+
const trampoline = path6.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
|
|
7824
7909
|
const src_text = readText(src);
|
|
7825
7910
|
if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
|
|
7826
7911
|
skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
7827
7912
|
} else {
|
|
7828
7913
|
writeText(trampoline, src_text);
|
|
7829
|
-
|
|
7914
|
+
fs7.chmodSync(trampoline, 493);
|
|
7830
7915
|
success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
|
|
7831
7916
|
}
|
|
7832
7917
|
const trampoline_quoted = shlexQuote(trampoline);
|
|
7833
7918
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
7834
|
-
const wrapper =
|
|
7919
|
+
const wrapper = path6.join(CLINE_USER_DIR, native_event);
|
|
7835
7920
|
const body = `#!/usr/bin/env bash
|
|
7836
7921
|
# Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
|
|
7837
7922
|
# User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
|
|
@@ -7841,7 +7926,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
|
|
|
7841
7926
|
continue;
|
|
7842
7927
|
}
|
|
7843
7928
|
writeText(wrapper, body);
|
|
7844
|
-
|
|
7929
|
+
fs7.chmodSync(wrapper, 493);
|
|
7845
7930
|
}
|
|
7846
7931
|
}
|
|
7847
7932
|
var WINDSURF_DISPATCHER_BINDINGS = [
|
|
@@ -7862,29 +7947,29 @@ function ensure_windsurf_bridge(project_root, force) {
|
|
|
7862
7947
|
}
|
|
7863
7948
|
const bridge = { hooks };
|
|
7864
7949
|
return merge_json_file(
|
|
7865
|
-
|
|
7950
|
+
path6.join(project_root, ".windsurf", "hooks.json"),
|
|
7866
7951
|
bridge,
|
|
7867
7952
|
force,
|
|
7868
7953
|
".windsurf/hooks.json"
|
|
7869
7954
|
);
|
|
7870
7955
|
}
|
|
7871
|
-
var WINDSURF_USER_DIR =
|
|
7872
|
-
var WINDSURF_USER_HOOKS_DIR =
|
|
7956
|
+
var WINDSURF_USER_DIR = path6.join(os2.homedir(), ".codeium", "windsurf");
|
|
7957
|
+
var WINDSURF_USER_HOOKS_DIR = path6.join(WINDSURF_USER_DIR, "hooks");
|
|
7873
7958
|
var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
|
|
7874
7959
|
function ensure_windsurf_user_hooks(package_root, force) {
|
|
7875
|
-
const src =
|
|
7960
|
+
const src = path6.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
7876
7961
|
if (!pathExists(src)) {
|
|
7877
7962
|
skip(`windsurf trampoline missing in package: ${src}`);
|
|
7878
7963
|
return [];
|
|
7879
7964
|
}
|
|
7880
7965
|
mkdirp(WINDSURF_USER_HOOKS_DIR);
|
|
7881
|
-
const dst =
|
|
7966
|
+
const dst = path6.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
7882
7967
|
const src_text = readText(src);
|
|
7883
7968
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
7884
7969
|
skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
7885
7970
|
} else {
|
|
7886
7971
|
writeText(dst, src_text);
|
|
7887
|
-
|
|
7972
|
+
fs7.chmodSync(dst, 493);
|
|
7888
7973
|
success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
|
|
7889
7974
|
}
|
|
7890
7975
|
const hooks = {};
|
|
@@ -7896,7 +7981,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
|
|
|
7896
7981
|
}
|
|
7897
7982
|
const settings_patch = { hooks };
|
|
7898
7983
|
return merge_json_file(
|
|
7899
|
-
|
|
7984
|
+
path6.join(WINDSURF_USER_DIR, "hooks.json"),
|
|
7900
7985
|
settings_patch,
|
|
7901
7986
|
force,
|
|
7902
7987
|
"~/.codeium/windsurf/hooks.json"
|
|
@@ -7925,43 +8010,43 @@ function _gemini_hooks_dict(command_factory) {
|
|
|
7925
8010
|
function ensure_gemini_bridge(project_root, force) {
|
|
7926
8011
|
const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
|
|
7927
8012
|
return merge_json_file(
|
|
7928
|
-
|
|
8013
|
+
path6.join(project_root, ".gemini", "settings.json"),
|
|
7929
8014
|
bridge,
|
|
7930
8015
|
force,
|
|
7931
8016
|
".gemini/settings.json"
|
|
7932
8017
|
);
|
|
7933
8018
|
}
|
|
7934
|
-
var GEMINI_USER_DIR =
|
|
7935
|
-
var GEMINI_USER_HOOKS_DIR =
|
|
8019
|
+
var GEMINI_USER_DIR = path6.join(os2.homedir(), ".gemini");
|
|
8020
|
+
var GEMINI_USER_HOOKS_DIR = path6.join(GEMINI_USER_DIR, "hooks");
|
|
7936
8021
|
var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
|
|
7937
8022
|
function ensure_gemini_user_hooks(package_root, force) {
|
|
7938
|
-
const src =
|
|
8023
|
+
const src = path6.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
|
|
7939
8024
|
if (!pathExists(src)) {
|
|
7940
8025
|
skip(`gemini trampoline missing in package: ${src}`);
|
|
7941
8026
|
return [];
|
|
7942
8027
|
}
|
|
7943
8028
|
mkdirp(GEMINI_USER_HOOKS_DIR);
|
|
7944
|
-
const dst =
|
|
8029
|
+
const dst = path6.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
|
|
7945
8030
|
const src_text = readText(src);
|
|
7946
8031
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
7947
8032
|
skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
7948
8033
|
} else {
|
|
7949
8034
|
writeText(dst, src_text);
|
|
7950
|
-
|
|
8035
|
+
fs7.chmodSync(dst, 493);
|
|
7951
8036
|
success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
|
|
7952
8037
|
}
|
|
7953
8038
|
const settings_patch = {
|
|
7954
8039
|
hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
|
|
7955
8040
|
};
|
|
7956
8041
|
return merge_json_file(
|
|
7957
|
-
|
|
8042
|
+
path6.join(GEMINI_USER_DIR, "settings.json"),
|
|
7958
8043
|
settings_patch,
|
|
7959
8044
|
force,
|
|
7960
8045
|
"~/.gemini/settings.json"
|
|
7961
8046
|
);
|
|
7962
8047
|
}
|
|
7963
8048
|
function ensure_copilot_bridge(project_root, force) {
|
|
7964
|
-
const target =
|
|
8049
|
+
const target = path6.join(project_root, ".github", "plugin", "marketplace.json");
|
|
7965
8050
|
const bridge = {
|
|
7966
8051
|
marketplace: {
|
|
7967
8052
|
name: "event4u-agent-marketplace",
|
|
@@ -8004,7 +8089,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
|
|
|
8004
8089
|
Run \`./agent-config --help\` for available commands.
|
|
8005
8090
|
`;
|
|
8006
8091
|
function ensure_roocode_bridge(project_root, force) {
|
|
8007
|
-
const target =
|
|
8092
|
+
const target = path6.join(project_root, ".roo", "rules", "agent-config.md");
|
|
8008
8093
|
if (pathExists(target) && !force) {
|
|
8009
8094
|
skip(".roo/rules/agent-config.md already exists");
|
|
8010
8095
|
return;
|
|
@@ -8026,7 +8111,7 @@ To wire Claude Desktop to this project's rules, run:
|
|
|
8026
8111
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
8027
8112
|
`;
|
|
8028
8113
|
function ensure_claude_desktop_bridge(project_root, force) {
|
|
8029
|
-
const target =
|
|
8114
|
+
const target = path6.join(project_root, ".claude-desktop", "agent-config.md");
|
|
8030
8115
|
if (pathExists(target) && !force) {
|
|
8031
8116
|
skip(".claude-desktop/agent-config.md already exists");
|
|
8032
8117
|
return;
|
|
@@ -8051,7 +8136,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
|
|
|
8051
8136
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
8052
8137
|
`;
|
|
8053
8138
|
function ensure_aider_bridge(project_root, force) {
|
|
8054
|
-
const target =
|
|
8139
|
+
const target = path6.join(project_root, ".aider", "agent-config.md");
|
|
8055
8140
|
if (pathExists(target) && !force) {
|
|
8056
8141
|
skip(".aider/agent-config.md already exists");
|
|
8057
8142
|
return;
|
|
@@ -8070,7 +8155,7 @@ developers where the rules and skills live.
|
|
|
8070
8155
|
Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
|
|
8071
8156
|
`;
|
|
8072
8157
|
function ensure_codex_bridge(project_root, force) {
|
|
8073
|
-
const target =
|
|
8158
|
+
const target = path6.join(project_root, ".codex", "agent-config.md");
|
|
8074
8159
|
if (pathExists(target) && !force) {
|
|
8075
8160
|
skip(".codex/agent-config.md already exists");
|
|
8076
8161
|
return;
|
|
@@ -8088,7 +8173,7 @@ rules per session. The canonical rule and skill source lives under
|
|
|
8088
8173
|
orientation).
|
|
8089
8174
|
`;
|
|
8090
8175
|
function ensure_continue_bridge(project_root, force) {
|
|
8091
|
-
const target =
|
|
8176
|
+
const target = path6.join(project_root, ".continue", "rules", "agent-config.md");
|
|
8092
8177
|
if (pathExists(target) && !force) {
|
|
8093
8178
|
skip(".continue/rules/agent-config.md already exists");
|
|
8094
8179
|
return;
|
|
@@ -8119,7 +8204,7 @@ orientation).
|
|
|
8119
8204
|
See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
|
|
8120
8205
|
`;
|
|
8121
8206
|
function ensure_kilocode_bridge(project_root, force) {
|
|
8122
|
-
const target =
|
|
8207
|
+
const target = path6.join(project_root, ".kilocode", "rules", "agent-config.md");
|
|
8123
8208
|
if (pathExists(target) && !force) {
|
|
8124
8209
|
skip(".kilocode/rules/agent-config.md already exists");
|
|
8125
8210
|
return;
|
|
@@ -8146,7 +8231,7 @@ canonical source (or symlink it):
|
|
|
8146
8231
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
8147
8232
|
`;
|
|
8148
8233
|
function ensure_zed_bridge(project_root, force) {
|
|
8149
|
-
const target =
|
|
8234
|
+
const target = path6.join(project_root, ".zed", "agent-config.md");
|
|
8150
8235
|
if (pathExists(target) && !force) {
|
|
8151
8236
|
skip(".zed/agent-config.md already exists");
|
|
8152
8237
|
return;
|
|
@@ -8167,7 +8252,7 @@ rules into your JetBrains profile.
|
|
|
8167
8252
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
8168
8253
|
`;
|
|
8169
8254
|
function ensure_jetbrains_bridge(project_root, force) {
|
|
8170
|
-
const target =
|
|
8255
|
+
const target = path6.join(project_root, ".jetbrains", "agent-config.md");
|
|
8171
8256
|
if (pathExists(target) && !force) {
|
|
8172
8257
|
skip(".jetbrains/agent-config.md already exists");
|
|
8173
8258
|
return;
|
|
@@ -8198,7 +8283,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
|
|
|
8198
8283
|
See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
|
|
8199
8284
|
`;
|
|
8200
8285
|
function ensure_kiro_bridge(project_root, force) {
|
|
8201
|
-
const target =
|
|
8286
|
+
const target = path6.join(project_root, ".kiro", "steering", "agent-config.md");
|
|
8202
8287
|
if (pathExists(target) && !force) {
|
|
8203
8288
|
skip(".kiro/steering/agent-config.md already exists");
|
|
8204
8289
|
return;
|
|
@@ -8224,35 +8309,35 @@ var SMOKE_BRIDGE_PATHS = {
|
|
|
8224
8309
|
};
|
|
8225
8310
|
function dirHasEntries(p) {
|
|
8226
8311
|
try {
|
|
8227
|
-
return
|
|
8312
|
+
return fs7.readdirSync(p).length > 0;
|
|
8228
8313
|
} catch {
|
|
8229
8314
|
return false;
|
|
8230
8315
|
}
|
|
8231
8316
|
}
|
|
8232
8317
|
function _resolve_tsx_invocation(scriptPath, scriptArgs) {
|
|
8233
8318
|
const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
8234
|
-
let dir =
|
|
8319
|
+
let dir = path6.dirname(scriptPath);
|
|
8235
8320
|
for (; ; ) {
|
|
8236
|
-
const candidate =
|
|
8321
|
+
const candidate = path6.join(dir, "node_modules", ".bin", binName);
|
|
8237
8322
|
if (isFile(candidate)) {
|
|
8238
8323
|
return { command: candidate, args: [scriptPath, ...scriptArgs] };
|
|
8239
8324
|
}
|
|
8240
|
-
const parent =
|
|
8325
|
+
const parent = path6.dirname(dir);
|
|
8241
8326
|
if (parent === dir) break;
|
|
8242
8327
|
dir = parent;
|
|
8243
8328
|
}
|
|
8244
8329
|
return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
|
|
8245
8330
|
}
|
|
8246
8331
|
function _smoke_test_hooks(project_root, package_root) {
|
|
8247
|
-
const dispatcher =
|
|
8248
|
-
const manifest =
|
|
8332
|
+
const dispatcher = path6.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
|
|
8333
|
+
const manifest = path6.join(package_root, "scripts", "hook_manifest.yaml");
|
|
8249
8334
|
if (!isFile(dispatcher) || !isFile(manifest)) return 0;
|
|
8250
8335
|
const failed = [];
|
|
8251
8336
|
const skipped = [];
|
|
8252
8337
|
const passed = [];
|
|
8253
8338
|
for (const [platform, native] of SMOKE_PROBE_EVENTS) {
|
|
8254
8339
|
const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
|
|
8255
|
-
const bridge_path = rel_bridge ?
|
|
8340
|
+
const bridge_path = rel_bridge ? path6.join(project_root, rel_bridge) : null;
|
|
8256
8341
|
const bridge_present = Boolean(
|
|
8257
8342
|
bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
|
|
8258
8343
|
);
|
|
@@ -8452,9 +8537,9 @@ To remove this marker, delete this file.
|
|
|
8452
8537
|
`;
|
|
8453
8538
|
}
|
|
8454
8539
|
var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
|
|
8455
|
-
var GLOBAL_ROOT =
|
|
8456
|
-
var GLOBAL_USER_SETTINGS_PATH =
|
|
8457
|
-
var GLOBAL_AGENT_SETTINGS_PATH =
|
|
8540
|
+
var GLOBAL_ROOT = path6.join(os2.homedir(), ".event4u", "agent-config");
|
|
8541
|
+
var GLOBAL_USER_SETTINGS_PATH = path6.join(GLOBAL_ROOT, ".agent-user.yml");
|
|
8542
|
+
var GLOBAL_AGENT_SETTINGS_PATH = path6.join(GLOBAL_ROOT, ".agent-settings.yml");
|
|
8458
8543
|
function _bridge_marker(tool_id, scope) {
|
|
8459
8544
|
if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
|
|
8460
8545
|
return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
|
|
@@ -8499,11 +8584,11 @@ function _load_yaml_doc(p) {
|
|
|
8499
8584
|
} catch {
|
|
8500
8585
|
return {};
|
|
8501
8586
|
}
|
|
8502
|
-
const data =
|
|
8587
|
+
const data = yamlSafeLoad2(text);
|
|
8503
8588
|
return _isPlainObject(data) ? data : {};
|
|
8504
8589
|
}
|
|
8505
8590
|
function _load_default_settings(package_root) {
|
|
8506
|
-
const template_source =
|
|
8591
|
+
const template_source = path6.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
8507
8592
|
if (!pathExists(template_source)) return {};
|
|
8508
8593
|
let text;
|
|
8509
8594
|
try {
|
|
@@ -8512,7 +8597,7 @@ function _load_default_settings(package_root) {
|
|
|
8512
8597
|
return {};
|
|
8513
8598
|
}
|
|
8514
8599
|
const rendered = text.split(RULE_LOADING_TIER_PLACEHOLDER).join(DEFAULT_PROFILE).split(USER_TYPE_PLACEHOLDER).join("");
|
|
8515
|
-
const data =
|
|
8600
|
+
const data = yamlSafeLoad2(rendered);
|
|
8516
8601
|
return _isPlainObject(data) ? data : {};
|
|
8517
8602
|
}
|
|
8518
8603
|
function _resolve_scope(opts, detected, detect_reason, custom_path) {
|
|
@@ -8591,9 +8676,9 @@ function detect_scope(cwd) {
|
|
|
8591
8676
|
if (pathExists(_resolve_settings_read(cwd))) {
|
|
8592
8677
|
return ["project", `existing ${SETTINGS_FILE}`];
|
|
8593
8678
|
}
|
|
8594
|
-
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(
|
|
8595
|
-
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(
|
|
8596
|
-
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(
|
|
8679
|
+
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path6.join(cwd, m))) ?? null;
|
|
8680
|
+
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path6.join(cwd, d))) ?? null;
|
|
8681
|
+
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path6.join(cwd, f))) ?? null;
|
|
8597
8682
|
if (has_manifest && (has_ai_dir || has_ai_file)) {
|
|
8598
8683
|
const marker = has_ai_dir || has_ai_file;
|
|
8599
8684
|
return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
|
|
@@ -8614,7 +8699,7 @@ function readLineSyncRaw(promptText) {
|
|
|
8614
8699
|
for (; ; ) {
|
|
8615
8700
|
let n;
|
|
8616
8701
|
try {
|
|
8617
|
-
n =
|
|
8702
|
+
n = fs7.readSync(0, buf, 0, 1, null);
|
|
8618
8703
|
} catch (err) {
|
|
8619
8704
|
const code = err.code;
|
|
8620
8705
|
if (code === "EAGAIN") {
|
|
@@ -8689,8 +8774,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
|
|
|
8689
8774
|
const marker = _bridge_marker(tool_id, scope);
|
|
8690
8775
|
if (!marker) continue;
|
|
8691
8776
|
let marker_path = marker;
|
|
8692
|
-
if (!
|
|
8693
|
-
marker_path =
|
|
8777
|
+
if (!path6.isAbsolute(marker_path)) {
|
|
8778
|
+
marker_path = path6.join(project_root, marker_path);
|
|
8694
8779
|
}
|
|
8695
8780
|
out[tool_id] = [_file_entry(marker_path, "bridge", false)];
|
|
8696
8781
|
}
|
|
@@ -8729,26 +8814,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
|
|
|
8729
8814
|
}
|
|
8730
8815
|
write_manifest(target, version, entries);
|
|
8731
8816
|
if (!state.QUIET) {
|
|
8732
|
-
const rel = isRelativeTo(target, project_root) ?
|
|
8817
|
+
const rel = isRelativeTo(target, project_root) ? path6.relative(project_root, target) : target;
|
|
8733
8818
|
info(`Manifest updated: ${rel}`);
|
|
8734
8819
|
}
|
|
8735
8820
|
return 0;
|
|
8736
8821
|
}
|
|
8737
8822
|
function isRelativeTo(child, parent) {
|
|
8738
|
-
const rel =
|
|
8739
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
8823
|
+
const rel = path6.relative(parent, child);
|
|
8824
|
+
return rel === "" || !rel.startsWith("..") && !path6.isAbsolute(rel);
|
|
8740
8825
|
}
|
|
8741
8826
|
function _resolve_package_root_for_global() {
|
|
8742
8827
|
const here = resolvePath(_HERE);
|
|
8743
|
-
const candidate =
|
|
8744
|
-
if (!pathExists(
|
|
8828
|
+
const candidate = path6.dirname(path6.dirname(path6.dirname(here)));
|
|
8829
|
+
if (!pathExists(path6.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
|
|
8745
8830
|
fail(
|
|
8746
8831
|
`Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
|
|
8747
8832
|
);
|
|
8748
8833
|
}
|
|
8749
8834
|
return candidate;
|
|
8750
8835
|
}
|
|
8751
|
-
var CONSUMER_BRIDGE_MARKER_RELPATH =
|
|
8836
|
+
var CONSUMER_BRIDGE_MARKER_RELPATH = path6.join("agents", ".event4u-bridge.yml");
|
|
8752
8837
|
var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
8753
8838
|
var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
|
|
8754
8839
|
var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
|
|
@@ -8756,7 +8841,7 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
8756
8841
|
if (process2.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
|
|
8757
8842
|
return [false, "consumer-mode-override"];
|
|
8758
8843
|
}
|
|
8759
|
-
const pkg_json =
|
|
8844
|
+
const pkg_json = path6.join(project_root, "package.json");
|
|
8760
8845
|
if (isFile(pkg_json)) {
|
|
8761
8846
|
let data = {};
|
|
8762
8847
|
try {
|
|
@@ -8768,18 +8853,18 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
8768
8853
|
return [true, "package.json:name"];
|
|
8769
8854
|
}
|
|
8770
8855
|
}
|
|
8771
|
-
if (isDir(
|
|
8856
|
+
if (isDir(path6.join(project_root, ".agent-src.uncondensed"))) {
|
|
8772
8857
|
return [true, ".agent-src.uncondensed/"];
|
|
8773
8858
|
}
|
|
8774
|
-
const packages_dir =
|
|
8859
|
+
const packages_dir = path6.join(project_root, "packages");
|
|
8775
8860
|
if (isDir(packages_dir)) {
|
|
8776
|
-
for (const child of
|
|
8777
|
-
if (isDir(
|
|
8861
|
+
for (const child of fs7.readdirSync(packages_dir)) {
|
|
8862
|
+
if (isDir(path6.join(packages_dir, child, ".agent-src.uncondensed"))) {
|
|
8778
8863
|
return [true, `packages/${child}/.agent-src.uncondensed/`];
|
|
8779
8864
|
}
|
|
8780
8865
|
}
|
|
8781
8866
|
}
|
|
8782
|
-
const installer_self =
|
|
8867
|
+
const installer_self = path6.join(project_root, "scripts", "install.py");
|
|
8783
8868
|
try {
|
|
8784
8869
|
if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE)) {
|
|
8785
8870
|
return [true, "src/scripts/install.py (self)"];
|
|
@@ -8799,17 +8884,17 @@ function _detect_legacy_for_migration(project_root) {
|
|
|
8799
8884
|
}
|
|
8800
8885
|
return [];
|
|
8801
8886
|
}
|
|
8802
|
-
if (isFile(
|
|
8887
|
+
if (isFile(path6.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
|
|
8803
8888
|
const found = [];
|
|
8804
8889
|
for (const name of MIGRATE_LEGACY_YAML_FILES) {
|
|
8805
|
-
if (isFile(
|
|
8890
|
+
if (isFile(path6.join(project_root, name))) {
|
|
8806
8891
|
found.push(name);
|
|
8807
|
-
} else if (isFile(
|
|
8892
|
+
} else if (isFile(path6.join(project_root, "settings", name))) {
|
|
8808
8893
|
found.push(`settings/${name}`);
|
|
8809
8894
|
}
|
|
8810
8895
|
}
|
|
8811
8896
|
for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
|
|
8812
|
-
const p =
|
|
8897
|
+
const p = path6.join(project_root, name);
|
|
8813
8898
|
if (isDir(p) && !isSymlink(p)) {
|
|
8814
8899
|
found.push(`${name}/`);
|
|
8815
8900
|
}
|
|
@@ -8821,7 +8906,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
|
|
|
8821
8906
|
process2.stdout.write("\n");
|
|
8822
8907
|
warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
|
|
8823
8908
|
for (const rel of artefacts) {
|
|
8824
|
-
info(` ${
|
|
8909
|
+
info(` ${path6.join(project_root, rel)}`);
|
|
8825
8910
|
}
|
|
8826
8911
|
info("The unified `agent-config migrate` sweeps these in one pass.");
|
|
8827
8912
|
info("The wizard recreates fresh config afterwards.");
|
|
@@ -8852,20 +8937,20 @@ function _run_migrate_to_global(project_root) {
|
|
|
8852
8937
|
function _format_global_root_for_marker(global_root) {
|
|
8853
8938
|
const home = resolvePath(os2.homedir());
|
|
8854
8939
|
const resolved = resolvePath(global_root);
|
|
8855
|
-
const rel =
|
|
8856
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
8940
|
+
const rel = path6.relative(home, resolved);
|
|
8941
|
+
if (rel === "" || rel.startsWith("..") || path6.isAbsolute(rel)) {
|
|
8857
8942
|
return global_root;
|
|
8858
8943
|
}
|
|
8859
|
-
return `~/${rel.split(
|
|
8944
|
+
return `~/${rel.split(path6.sep).join("/")}`;
|
|
8860
8945
|
}
|
|
8861
8946
|
function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
|
|
8862
8947
|
const env_map = env ?? process2.env;
|
|
8863
8948
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
|
|
8864
|
-
if (isDir(
|
|
8865
|
-
const target =
|
|
8949
|
+
if (isDir(path6.join(project_root, ".agent-src.uncondensed"))) return null;
|
|
8950
|
+
const target = path6.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
|
|
8866
8951
|
if (!isFile(target)) return null;
|
|
8867
8952
|
try {
|
|
8868
|
-
|
|
8953
|
+
fs7.rmSync(target);
|
|
8869
8954
|
} catch {
|
|
8870
8955
|
return null;
|
|
8871
8956
|
}
|
|
@@ -8879,7 +8964,7 @@ var PROJECT_ANCHOR_TOOLS = {
|
|
|
8879
8964
|
function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
|
|
8880
8965
|
const env_map = env ?? process2.env;
|
|
8881
8966
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
|
|
8882
|
-
if (isDir(
|
|
8967
|
+
if (isDir(path6.join(project_root, ".agent-src.uncondensed"))) return [];
|
|
8883
8968
|
const global_root_str = _format_global_root_for_marker(
|
|
8884
8969
|
event4u_root(env_map)
|
|
8885
8970
|
);
|
|
@@ -8888,8 +8973,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
|
|
|
8888
8973
|
for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
|
|
8889
8974
|
const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
|
|
8890
8975
|
if (!tools.has(tool_id)) continue;
|
|
8891
|
-
const target =
|
|
8892
|
-
mkdirp(
|
|
8976
|
+
const target = path6.join(project_root, rel_path);
|
|
8977
|
+
mkdirp(path6.dirname(target));
|
|
8893
8978
|
const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
|
|
8894
8979
|
# Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
|
|
8895
8980
|
# Tool: ${tool_id}. Resolves the global install directly \u2014 no
|
|
@@ -8907,7 +8992,7 @@ installed_at: ${stamp}
|
|
|
8907
8992
|
}
|
|
8908
8993
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
8909
8994
|
function _inject_package_tag(target, source, package_root) {
|
|
8910
|
-
if (
|
|
8995
|
+
if (path6.extname(target) !== ".md") return;
|
|
8911
8996
|
let text;
|
|
8912
8997
|
try {
|
|
8913
8998
|
text = readText(target);
|
|
@@ -8935,8 +9020,8 @@ function _inject_package_tag(target, source, package_root) {
|
|
|
8935
9020
|
resolved_src = source;
|
|
8936
9021
|
}
|
|
8937
9022
|
if (package_root !== null) {
|
|
8938
|
-
const rel =
|
|
8939
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
9023
|
+
const rel = path6.relative(resolvePath(package_root), resolved_src);
|
|
9024
|
+
if (rel !== "" && !rel.startsWith("..") && !path6.isAbsolute(rel)) {
|
|
8940
9025
|
source_value = rel;
|
|
8941
9026
|
} else {
|
|
8942
9027
|
source_value = resolved_src;
|
|
@@ -8971,7 +9056,7 @@ function _escapes_package_root(resolved, package_root) {
|
|
|
8971
9056
|
if (package_root === null) return false;
|
|
8972
9057
|
let root;
|
|
8973
9058
|
try {
|
|
8974
|
-
root =
|
|
9059
|
+
root = fs7.realpathSync(package_root);
|
|
8975
9060
|
} catch {
|
|
8976
9061
|
return false;
|
|
8977
9062
|
}
|
|
@@ -8986,7 +9071,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
8986
9071
|
if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
|
|
8987
9072
|
let resolved_src = src;
|
|
8988
9073
|
try {
|
|
8989
|
-
resolved_src =
|
|
9074
|
+
resolved_src = fs7.realpathSync(src);
|
|
8990
9075
|
} catch {
|
|
8991
9076
|
resolved_src = src;
|
|
8992
9077
|
}
|
|
@@ -8994,10 +9079,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
8994
9079
|
warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
|
|
8995
9080
|
return [0, 0, written_paths];
|
|
8996
9081
|
}
|
|
8997
|
-
mkdirp(
|
|
9082
|
+
mkdirp(path6.dirname(dest));
|
|
8998
9083
|
const decision = _resolve_file_conflict(dest, force);
|
|
8999
9084
|
if (decision === "skip") return [0, 1, written_paths];
|
|
9000
|
-
|
|
9085
|
+
fs7.copyFileSync(src, dest);
|
|
9001
9086
|
_inject_package_tag(dest, src, package_root);
|
|
9002
9087
|
written_paths.push(dest);
|
|
9003
9088
|
return [1, 0, written_paths];
|
|
@@ -9005,11 +9090,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
9005
9090
|
mkdirp(dest);
|
|
9006
9091
|
const walk = (node) => {
|
|
9007
9092
|
const acc = [];
|
|
9008
|
-
const names =
|
|
9093
|
+
const names = fs7.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
9009
9094
|
for (const name of names) {
|
|
9010
|
-
const entry =
|
|
9095
|
+
const entry = path6.join(node, name);
|
|
9011
9096
|
acc.push(entry);
|
|
9012
|
-
const lst =
|
|
9097
|
+
const lst = fs7.lstatSync(entry);
|
|
9013
9098
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
9014
9099
|
acc.push(...walk(entry));
|
|
9015
9100
|
}
|
|
@@ -9017,9 +9102,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
9017
9102
|
return acc;
|
|
9018
9103
|
};
|
|
9019
9104
|
for (const entry of walk(src)) {
|
|
9020
|
-
const rel =
|
|
9021
|
-
const target =
|
|
9022
|
-
const lst =
|
|
9105
|
+
const rel = path6.relative(src, entry);
|
|
9106
|
+
const target = path6.join(dest, rel);
|
|
9107
|
+
const lst = fs7.lstatSync(entry);
|
|
9023
9108
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
9024
9109
|
mkdirp(target);
|
|
9025
9110
|
continue;
|
|
@@ -9027,8 +9112,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
9027
9112
|
let resolvedIsDir = false;
|
|
9028
9113
|
let resolved = entry;
|
|
9029
9114
|
try {
|
|
9030
|
-
resolved =
|
|
9031
|
-
resolvedIsDir =
|
|
9115
|
+
resolved = fs7.realpathSync(entry);
|
|
9116
|
+
resolvedIsDir = fs7.statSync(entry).isDirectory();
|
|
9032
9117
|
} catch {
|
|
9033
9118
|
resolvedIsDir = false;
|
|
9034
9119
|
}
|
|
@@ -9058,8 +9143,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
9058
9143
|
skipped += 1;
|
|
9059
9144
|
continue;
|
|
9060
9145
|
}
|
|
9061
|
-
mkdirp(
|
|
9062
|
-
|
|
9146
|
+
mkdirp(path6.dirname(target));
|
|
9147
|
+
fs7.copyFileSync(resolved, target);
|
|
9063
9148
|
_inject_package_tag(target, resolved, package_root);
|
|
9064
9149
|
written += 1;
|
|
9065
9150
|
written_paths.push(target);
|
|
@@ -9071,7 +9156,7 @@ function _claude_desktop_bundles_dir() {
|
|
|
9071
9156
|
}
|
|
9072
9157
|
function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
|
|
9073
9158
|
const anchor = expanduser2(USER_SCOPE_PATHS["claude-desktop"]);
|
|
9074
|
-
const target =
|
|
9159
|
+
const target = path6.join(anchor, "agent-config.md");
|
|
9075
9160
|
mkdirp(anchor);
|
|
9076
9161
|
const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
|
|
9077
9162
|
writeText(target, body);
|
|
@@ -9095,23 +9180,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
9095
9180
|
const wrapped = [];
|
|
9096
9181
|
const collisions = [];
|
|
9097
9182
|
const reserved = [];
|
|
9098
|
-
const commands_dir =
|
|
9183
|
+
const commands_dir = path6.join(anchor, "commands");
|
|
9099
9184
|
let flat_entries = [];
|
|
9100
9185
|
try {
|
|
9101
|
-
flat_entries =
|
|
9186
|
+
flat_entries = fs7.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
|
|
9102
9187
|
} catch {
|
|
9103
9188
|
}
|
|
9104
9189
|
for (const fname of flat_entries.sort()) {
|
|
9105
9190
|
const slug = fname.slice(0, -".md".length);
|
|
9106
9191
|
if (!is_claude_builtin_name(slug)) continue;
|
|
9107
|
-
|
|
9192
|
+
fs7.rmSync(path6.join(commands_dir, fname), { force: true });
|
|
9108
9193
|
current_files.delete(`commands/${fname}`);
|
|
9109
9194
|
reserved.push(slug);
|
|
9110
9195
|
}
|
|
9111
9196
|
const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
|
|
9112
9197
|
try {
|
|
9113
9198
|
const manifest = JSON.parse(
|
|
9114
|
-
|
|
9199
|
+
fs7.readFileSync(path6.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
|
|
9115
9200
|
);
|
|
9116
9201
|
for (const a of manifest.artefacts ?? []) {
|
|
9117
9202
|
if (a.category !== "command" || typeof a.slug !== "string") continue;
|
|
@@ -9122,22 +9207,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
9122
9207
|
}
|
|
9123
9208
|
for (const slug of [...eligible].sort()) {
|
|
9124
9209
|
const flat_rel = `commands/${slug}.md`;
|
|
9125
|
-
const flat_abs =
|
|
9126
|
-
if (!
|
|
9127
|
-
const skill_dir =
|
|
9128
|
-
if (
|
|
9210
|
+
const flat_abs = path6.join(anchor, "commands", `${slug}.md`);
|
|
9211
|
+
if (!fs7.existsSync(flat_abs)) continue;
|
|
9212
|
+
const skill_dir = path6.join(anchor, "skills", slug);
|
|
9213
|
+
if (fs7.existsSync(skill_dir)) {
|
|
9129
9214
|
collisions.push(slug);
|
|
9130
9215
|
continue;
|
|
9131
9216
|
}
|
|
9132
|
-
let body =
|
|
9217
|
+
let body = fs7.readFileSync(flat_abs, "utf8");
|
|
9133
9218
|
if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
|
|
9134
9219
|
body = body.replace("---\n", `---
|
|
9135
9220
|
name: ${slug}
|
|
9136
9221
|
`);
|
|
9137
9222
|
}
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9223
|
+
fs7.mkdirSync(skill_dir, { recursive: true });
|
|
9224
|
+
fs7.writeFileSync(path6.join(skill_dir, "SKILL.md"), body, "utf8");
|
|
9225
|
+
fs7.rmSync(flat_abs, { force: true });
|
|
9141
9226
|
current_files.delete(flat_rel);
|
|
9142
9227
|
current_files.add(`skills/${slug}/SKILL.md`);
|
|
9143
9228
|
wrapped.push(slug);
|
|
@@ -9169,8 +9254,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
9169
9254
|
const written_paths = [];
|
|
9170
9255
|
let current_files = /* @__PURE__ */ new Set();
|
|
9171
9256
|
for (const [src_rel, dest_sub] of plan) {
|
|
9172
|
-
const src =
|
|
9173
|
-
const dest = dest_sub ?
|
|
9257
|
+
const src = path6.join(package_root, src_rel);
|
|
9258
|
+
const dest = dest_sub ? path6.join(anchor, dest_sub) : anchor;
|
|
9174
9259
|
const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
|
|
9175
9260
|
const [w, s, paths] = _copy_dir_dereferencing_symlinks(
|
|
9176
9261
|
src,
|
|
@@ -9244,10 +9329,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
9244
9329
|
results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
|
|
9245
9330
|
if (tool_id === "claude-code") {
|
|
9246
9331
|
try {
|
|
9247
|
-
const manifest =
|
|
9332
|
+
const manifest = path6.join(package_root, "src", "scripts", "hook_manifest.yaml");
|
|
9248
9333
|
const matrix = build_claude_hook_matrix(manifest);
|
|
9249
9334
|
const res = ensure_managed_hooks(
|
|
9250
|
-
|
|
9335
|
+
path6.join(anchor, "settings.json"),
|
|
9251
9336
|
matrix
|
|
9252
9337
|
);
|
|
9253
9338
|
if (!state.QUIET) {
|
|
@@ -9284,7 +9369,7 @@ function _preview_global_reap(tools, package_root) {
|
|
|
9284
9369
|
const anchor = expanduser2(anchor_raw);
|
|
9285
9370
|
let current_files = /* @__PURE__ */ new Set();
|
|
9286
9371
|
for (const [src_rel, dest_sub] of plan) {
|
|
9287
|
-
const src =
|
|
9372
|
+
const src = path6.join(package_root, src_rel);
|
|
9288
9373
|
current_files = setUnion(
|
|
9289
9374
|
current_files,
|
|
9290
9375
|
expected_deploy_files(
|
|
@@ -9318,14 +9403,14 @@ function _preview_global_reap(tools, package_root) {
|
|
|
9318
9403
|
function _verify_deploy_targets(anchor, plan) {
|
|
9319
9404
|
const missing = [];
|
|
9320
9405
|
for (const [, dest_sub] of plan) {
|
|
9321
|
-
const target = dest_sub ?
|
|
9406
|
+
const target = dest_sub ? path6.join(anchor, dest_sub) : anchor;
|
|
9322
9407
|
const label = dest_sub || ".";
|
|
9323
9408
|
if (!isDir(target)) {
|
|
9324
9409
|
missing.push(label);
|
|
9325
9410
|
continue;
|
|
9326
9411
|
}
|
|
9327
9412
|
try {
|
|
9328
|
-
const entries =
|
|
9413
|
+
const entries = fs7.readdirSync(target);
|
|
9329
9414
|
if (entries.length === 0) missing.push(label);
|
|
9330
9415
|
} catch {
|
|
9331
9416
|
missing.push(label);
|
|
@@ -9340,13 +9425,13 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
9340
9425
|
const [written, skipped, status, paths] = deploy_results[tool_id];
|
|
9341
9426
|
const pruned_skill_dirs = /* @__PURE__ */ new Set();
|
|
9342
9427
|
for (const p of paths) {
|
|
9343
|
-
const parts = p.split(
|
|
9428
|
+
const parts = p.split(path6.sep);
|
|
9344
9429
|
if (parts.includes("skills")) {
|
|
9345
9430
|
const i = parts.indexOf("skills");
|
|
9346
9431
|
if (i + 1 < parts.length) {
|
|
9347
|
-
const skill_root = parts.slice(0, i + 2).join(
|
|
9432
|
+
const skill_root = parts.slice(0, i + 2).join(path6.sep);
|
|
9348
9433
|
if (!pruned_skill_dirs.has(skill_root)) {
|
|
9349
|
-
const skillmd =
|
|
9434
|
+
const skillmd = path6.join(skill_root, "SKILL.md");
|
|
9350
9435
|
if (pathExists(skillmd) && is_pruned(skillmd)) {
|
|
9351
9436
|
pruned_skill_dirs.add(skill_root);
|
|
9352
9437
|
}
|
|
@@ -9357,25 +9442,25 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
9357
9442
|
const keep = [];
|
|
9358
9443
|
const delete_files = [];
|
|
9359
9444
|
for (const p of paths) {
|
|
9360
|
-
const parts = p.split(
|
|
9445
|
+
const parts = p.split(path6.sep);
|
|
9361
9446
|
let is_target = false;
|
|
9362
9447
|
if (parts.includes("skills")) {
|
|
9363
9448
|
const i = parts.indexOf("skills");
|
|
9364
|
-
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(
|
|
9449
|
+
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path6.sep))) {
|
|
9365
9450
|
is_target = true;
|
|
9366
9451
|
}
|
|
9367
|
-
} else if (parts.includes("commands") &&
|
|
9452
|
+
} else if (parts.includes("commands") && path6.extname(p) === ".md" && is_pruned(p)) {
|
|
9368
9453
|
is_target = true;
|
|
9369
9454
|
}
|
|
9370
9455
|
(is_target ? delete_files : keep).push(p);
|
|
9371
9456
|
}
|
|
9372
9457
|
for (const d of pruned_skill_dirs) {
|
|
9373
|
-
|
|
9458
|
+
fs7.rmSync(d, { recursive: true, force: true });
|
|
9374
9459
|
}
|
|
9375
9460
|
for (const p of delete_files) {
|
|
9376
|
-
if (p.split(
|
|
9461
|
+
if (p.split(path6.sep).includes("commands") && pathExists(p)) {
|
|
9377
9462
|
try {
|
|
9378
|
-
|
|
9463
|
+
fs7.unlinkSync(p);
|
|
9379
9464
|
} catch {
|
|
9380
9465
|
}
|
|
9381
9466
|
}
|
|
@@ -9388,64 +9473,17 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
9388
9473
|
function _prune_lab_modules(deploy_results, lab_ids) {
|
|
9389
9474
|
return _prune_modules_by(deploy_results, (p) => is_lab_artefact(p, lab_ids));
|
|
9390
9475
|
}
|
|
9391
|
-
var
|
|
9392
|
-
|
|
9393
|
-
const vocab_path = path5.join(package_root, "src", "config", "discovery", "packs.yml");
|
|
9394
|
-
const data = yamlSafeLoad(readText(vocab_path));
|
|
9395
|
-
if (!Array.isArray(data)) {
|
|
9396
|
-
throw new Error(`packs.yml did not parse to a list: ${vocab_path}`);
|
|
9397
|
-
}
|
|
9398
|
-
const out = [];
|
|
9399
|
-
for (const entry of data) {
|
|
9400
|
-
if (!_isPlainObject(entry)) continue;
|
|
9401
|
-
const id = entry["id"];
|
|
9402
|
-
if (typeof id !== "string" || id === "") continue;
|
|
9403
|
-
const workspaces_raw = entry["workspaces"];
|
|
9404
|
-
const workspaces = Array.isArray(workspaces_raw) ? workspaces_raw.filter((w) => typeof w === "string") : [];
|
|
9405
|
-
const requires_raw = entry["requires"] ?? entry["requires_hint"];
|
|
9406
|
-
const requires = Array.isArray(requires_raw) ? requires_raw.filter((r) => typeof r === "string") : [];
|
|
9407
|
-
out.push({ id, workspaces, requires });
|
|
9408
|
-
}
|
|
9409
|
-
return out;
|
|
9410
|
-
}
|
|
9411
|
-
function _compute_active_pack_ids(packs, runtime_active_packs) {
|
|
9412
|
-
const by_id = /* @__PURE__ */ new Map();
|
|
9413
|
-
for (const p of packs) by_id.set(p.id, p);
|
|
9414
|
-
const active = /* @__PURE__ */ new Set();
|
|
9415
|
-
for (const p of packs) {
|
|
9416
|
-
if (p.workspaces.some((w) => SCOPED_ACTIVE_WORKSPACES.has(w))) {
|
|
9417
|
-
active.add(p.id);
|
|
9418
|
-
}
|
|
9419
|
-
}
|
|
9420
|
-
for (const id of runtime_active_packs) {
|
|
9421
|
-
active.add(id);
|
|
9422
|
-
}
|
|
9423
|
-
let frontier = [...active];
|
|
9424
|
-
while (frontier.length > 0) {
|
|
9425
|
-
const next = [];
|
|
9426
|
-
for (const id of frontier) {
|
|
9427
|
-
const rec = by_id.get(id);
|
|
9428
|
-
if (rec === void 0) continue;
|
|
9429
|
-
for (const dep of rec.requires) {
|
|
9430
|
-
if (!active.has(dep)) {
|
|
9431
|
-
active.add(dep);
|
|
9432
|
-
next.push(dep);
|
|
9433
|
-
}
|
|
9434
|
-
}
|
|
9435
|
-
}
|
|
9436
|
-
frontier = next;
|
|
9437
|
-
}
|
|
9438
|
-
return active;
|
|
9439
|
-
}
|
|
9476
|
+
var _load_packs_registry = load_packs_registry;
|
|
9477
|
+
var _compute_active_pack_ids = compute_active_pack_ids;
|
|
9440
9478
|
function _resolve_global_settings_doc() {
|
|
9441
9479
|
const p = _resolve_global_settings_path();
|
|
9442
9480
|
return p === null ? null : _load_yaml_doc(p);
|
|
9443
9481
|
}
|
|
9444
9482
|
function _resolve_global_settings_path() {
|
|
9445
9483
|
const root = event4u_root();
|
|
9446
|
-
const canonical =
|
|
9484
|
+
const canonical = path6.join(root, "settings", SETTINGS_FILE);
|
|
9447
9485
|
if (pathExists(canonical)) return canonical;
|
|
9448
|
-
const legacy =
|
|
9486
|
+
const legacy = path6.join(root, SETTINGS_FILE);
|
|
9449
9487
|
if (pathExists(legacy)) return legacy;
|
|
9450
9488
|
return null;
|
|
9451
9489
|
}
|
|
@@ -9476,7 +9514,7 @@ function _resolve_global_rule_scope(package_root) {
|
|
|
9476
9514
|
);
|
|
9477
9515
|
return LEGACY_ALL;
|
|
9478
9516
|
}
|
|
9479
|
-
const parsed =
|
|
9517
|
+
const parsed = yamlSafeLoad2(text);
|
|
9480
9518
|
if (!_isPlainObject(parsed)) {
|
|
9481
9519
|
warn(
|
|
9482
9520
|
`${settings_path} is not a YAML mapping \u2014 rule scoping falls back to legacy-all, so ALL rules including maintainer-only ones will be installed. Fix the file to restore scoping.`
|
|
@@ -9497,14 +9535,10 @@ function _rule_filter_for_source(src_rel, scope) {
|
|
|
9497
9535
|
return (srcFile) => ruleFileArrives(srcFile, scope);
|
|
9498
9536
|
}
|
|
9499
9537
|
function _prune_scoped_modules(deploy_results, active_ids) {
|
|
9500
|
-
return _prune_modules_by(
|
|
9501
|
-
|
|
9502
|
-
|
|
9503
|
-
|
|
9504
|
-
if (active_ids.has(id)) return false;
|
|
9505
|
-
}
|
|
9506
|
-
return true;
|
|
9507
|
-
});
|
|
9538
|
+
return _prune_modules_by(
|
|
9539
|
+
deploy_results,
|
|
9540
|
+
(p) => is_pruned_under_scoped(p, active_ids)
|
|
9541
|
+
);
|
|
9508
9542
|
}
|
|
9509
9543
|
function install_global(tools, force, project_root = null, core_only = false) {
|
|
9510
9544
|
const migrated = migrate_legacy_namespace();
|
|
@@ -9560,7 +9594,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
9560
9594
|
info(` schema_version=1, agent_config_version=${installed_version}`);
|
|
9561
9595
|
info(` tools=${merged_tools.join(",")}`);
|
|
9562
9596
|
}
|
|
9563
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
9597
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path6.join(project_root, ".agent-src.uncondensed"))) {
|
|
9564
9598
|
const drift = collect_drift(project_root);
|
|
9565
9599
|
if (!state.QUIET) {
|
|
9566
9600
|
process2.stdout.write("\n");
|
|
@@ -9660,19 +9694,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
9660
9694
|
}
|
|
9661
9695
|
}
|
|
9662
9696
|
}
|
|
9663
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
9697
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path6.join(project_root, ".agent-src.uncondensed"))) {
|
|
9664
9698
|
const files_by_tool = _files_by_tool_from_deploy(deploy_results);
|
|
9665
9699
|
const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
|
|
9666
9700
|
if (rc !== 0) return rc;
|
|
9667
9701
|
const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
|
|
9668
9702
|
if (removed_marker !== null && !state.QUIET) {
|
|
9669
|
-
const rel = isRelativeTo(removed_marker, project_root) ?
|
|
9703
|
+
const rel = isRelativeTo(removed_marker, project_root) ? path6.relative(project_root, removed_marker) : removed_marker;
|
|
9670
9704
|
info(`Removed legacy bridge marker: ${rel}`);
|
|
9671
9705
|
}
|
|
9672
9706
|
const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
|
|
9673
9707
|
if (anchor_paths.length > 0 && !state.QUIET) {
|
|
9674
9708
|
for (const p of anchor_paths) {
|
|
9675
|
-
const rel = isRelativeTo(p, project_root) ?
|
|
9709
|
+
const rel = isRelativeTo(p, project_root) ? path6.relative(project_root, p) : p;
|
|
9676
9710
|
info(`Project anchor written: ${rel}`);
|
|
9677
9711
|
}
|
|
9678
9712
|
}
|
|
@@ -9689,8 +9723,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
9689
9723
|
}
|
|
9690
9724
|
return 0;
|
|
9691
9725
|
}
|
|
9692
|
-
var SETTINGS_SURFACE_REL =
|
|
9693
|
-
var SETTINGS_DELTA_REL =
|
|
9726
|
+
var SETTINGS_SURFACE_REL = path6.join("state", "settings-surface.json");
|
|
9727
|
+
var SETTINGS_DELTA_REL = path6.join("state", "settings-delta.json");
|
|
9694
9728
|
function _current_settings_surface(version) {
|
|
9695
9729
|
const jsonSchema = zodToJsonSchema(settingsSchema, {
|
|
9696
9730
|
name: "AgentSettings",
|
|
@@ -9701,20 +9735,20 @@ function _current_settings_surface(version) {
|
|
|
9701
9735
|
}
|
|
9702
9736
|
function _write_settings_surface_snapshot(installed_version) {
|
|
9703
9737
|
const root = event4u_root();
|
|
9704
|
-
const surface_path =
|
|
9705
|
-
const delta_path =
|
|
9738
|
+
const surface_path = path6.join(root, SETTINGS_SURFACE_REL);
|
|
9739
|
+
const delta_path = path6.join(root, SETTINGS_DELTA_REL);
|
|
9706
9740
|
const next = _current_settings_surface(installed_version);
|
|
9707
9741
|
let previous = null;
|
|
9708
9742
|
try {
|
|
9709
|
-
const parsed = JSON.parse(
|
|
9743
|
+
const parsed = JSON.parse(fs7.readFileSync(surface_path, "utf8"));
|
|
9710
9744
|
if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
|
|
9711
9745
|
} catch {
|
|
9712
9746
|
}
|
|
9713
9747
|
if (previous !== null && previous.version !== next.version) {
|
|
9714
9748
|
const delta = computeSurfaceDelta(previous, next);
|
|
9715
9749
|
if (delta.changes.length > 0) {
|
|
9716
|
-
|
|
9717
|
-
|
|
9750
|
+
fs7.mkdirSync(path6.dirname(delta_path), { recursive: true, mode: 448 });
|
|
9751
|
+
fs7.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
|
|
9718
9752
|
`, { mode: 384 });
|
|
9719
9753
|
if (!state.QUIET) {
|
|
9720
9754
|
const counts = {};
|
|
@@ -9726,8 +9760,8 @@ function _write_settings_surface_snapshot(installed_version) {
|
|
|
9726
9760
|
}
|
|
9727
9761
|
}
|
|
9728
9762
|
}
|
|
9729
|
-
|
|
9730
|
-
|
|
9763
|
+
fs7.mkdirSync(path6.dirname(surface_path), { recursive: true, mode: 448 });
|
|
9764
|
+
fs7.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
|
|
9731
9765
|
`, { mode: 384 });
|
|
9732
9766
|
}
|
|
9733
9767
|
function arrayStrEqual(a, b) {
|
|
@@ -9939,13 +9973,13 @@ function _minimal_templates_root() {
|
|
|
9939
9973
|
const chain = [start];
|
|
9940
9974
|
let cur = start;
|
|
9941
9975
|
for (; ; ) {
|
|
9942
|
-
const parent =
|
|
9976
|
+
const parent = path6.dirname(cur);
|
|
9943
9977
|
if (parent === cur) break;
|
|
9944
9978
|
chain.push(parent);
|
|
9945
9979
|
cur = parent;
|
|
9946
9980
|
}
|
|
9947
9981
|
for (const ancestor of chain) {
|
|
9948
|
-
const candidate =
|
|
9982
|
+
const candidate = path6.join(ancestor, "src", "templates", "minimal");
|
|
9949
9983
|
if (isDir(candidate)) return candidate;
|
|
9950
9984
|
}
|
|
9951
9985
|
fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
|
|
@@ -9953,9 +9987,9 @@ function _minimal_templates_root() {
|
|
|
9953
9987
|
var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
9954
9988
|
function _write_install_mode_marker(project_root, mode) {
|
|
9955
9989
|
if (mode !== "minimal" && mode !== "full") return;
|
|
9956
|
-
const marker =
|
|
9990
|
+
const marker = path6.join(project_root, INSTALL_MODE_MARKER_REL);
|
|
9957
9991
|
try {
|
|
9958
|
-
mkdirp(
|
|
9992
|
+
mkdirp(path6.dirname(marker));
|
|
9959
9993
|
writeText(marker, `${mode}
|
|
9960
9994
|
`);
|
|
9961
9995
|
} catch {
|
|
@@ -9964,7 +9998,7 @@ function _write_install_mode_marker(project_root, mode) {
|
|
|
9964
9998
|
function install_minimal(target_root_in, force, user_type = "") {
|
|
9965
9999
|
let target_root = resolvePath(target_root_in);
|
|
9966
10000
|
mkdirp(target_root);
|
|
9967
|
-
const parent =
|
|
10001
|
+
const parent = path6.dirname(target_root);
|
|
9968
10002
|
if (parent !== target_root) {
|
|
9969
10003
|
const existing = find_project_root_with_anchor(parent);
|
|
9970
10004
|
if (existing !== null && existing[0] !== target_root) {
|
|
@@ -9975,21 +10009,21 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
9975
10009
|
}
|
|
9976
10010
|
}
|
|
9977
10011
|
const templates = _minimal_templates_root();
|
|
9978
|
-
const settings_src =
|
|
9979
|
-
const overrides_gitkeep_src =
|
|
9980
|
-
const overrides_readme_src =
|
|
10012
|
+
const settings_src = path6.join(templates, SETTINGS_FILE);
|
|
10013
|
+
const overrides_gitkeep_src = path6.join(templates, "overrides-gitkeep");
|
|
10014
|
+
const overrides_readme_src = path6.join(templates, "agents-overrides-readme.md");
|
|
9981
10015
|
if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
|
|
9982
10016
|
if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
|
|
9983
10017
|
fail(`Bundled overrides scaffold templates missing under ${templates}`);
|
|
9984
10018
|
}
|
|
9985
10019
|
info(`Minimal init \u2192 ${target_root}`);
|
|
9986
|
-
const overrides_root =
|
|
10020
|
+
const overrides_root = path6.join(target_root, "agents", "overrides");
|
|
9987
10021
|
mkdirp(overrides_root);
|
|
9988
10022
|
const gitkeep_body = readText(overrides_gitkeep_src);
|
|
9989
10023
|
for (const sub of ["rules", "skills", "commands"]) {
|
|
9990
|
-
const sub_dir =
|
|
10024
|
+
const sub_dir = path6.join(overrides_root, sub);
|
|
9991
10025
|
mkdirp(sub_dir);
|
|
9992
|
-
const gitkeep_dst =
|
|
10026
|
+
const gitkeep_dst = path6.join(sub_dir, ".gitkeep");
|
|
9993
10027
|
if (pathExists(gitkeep_dst) && !force) {
|
|
9994
10028
|
skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
|
|
9995
10029
|
} else {
|
|
@@ -9997,7 +10031,7 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
9997
10031
|
success(`Wrote agents/overrides/${sub}/.gitkeep`);
|
|
9998
10032
|
}
|
|
9999
10033
|
}
|
|
10000
|
-
const readme_dst =
|
|
10034
|
+
const readme_dst = path6.join(overrides_root, "README.md");
|
|
10001
10035
|
if (pathExists(readme_dst) && !force) {
|
|
10002
10036
|
skip("agents/overrides/README.md already exists (use --force to overwrite)");
|
|
10003
10037
|
} else {
|
|
@@ -10015,14 +10049,14 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
10015
10049
|
personal:
|
|
10016
10050
|
user_type: ${user_type}
|
|
10017
10051
|
`;
|
|
10018
|
-
mkdirp(
|
|
10052
|
+
mkdirp(path6.dirname(settings_dst));
|
|
10019
10053
|
writeText(settings_dst, body);
|
|
10020
10054
|
success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
|
|
10021
10055
|
}
|
|
10022
10056
|
}
|
|
10023
10057
|
const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
|
|
10024
10058
|
if (removed_marker !== null) {
|
|
10025
|
-
const rel = isRelativeTo(removed_marker, target_root) ?
|
|
10059
|
+
const rel = isRelativeTo(removed_marker, target_root) ? path6.relative(target_root, removed_marker) : removed_marker;
|
|
10026
10060
|
success(`Removed legacy bridge marker: ${rel}`);
|
|
10027
10061
|
}
|
|
10028
10062
|
_write_install_mode_marker(target_root, "minimal");
|
|
@@ -10096,7 +10130,7 @@ function run_interactive_init(project_root, force) {
|
|
|
10096
10130
|
);
|
|
10097
10131
|
return 0;
|
|
10098
10132
|
}
|
|
10099
|
-
const target =
|
|
10133
|
+
const target = path6.join(project_root, _LOCAL_CONFIG_FILE);
|
|
10100
10134
|
if (pathExists(target) && !force) {
|
|
10101
10135
|
warn(
|
|
10102
10136
|
`${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
|
|
@@ -10123,7 +10157,7 @@ function run_interactive_init(project_root, force) {
|
|
|
10123
10157
|
warn(`Could not write ${target}: ${String(exc)}`);
|
|
10124
10158
|
return 1;
|
|
10125
10159
|
}
|
|
10126
|
-
success(`Wrote ${
|
|
10160
|
+
success(`Wrote ${path6.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
|
|
10127
10161
|
return 0;
|
|
10128
10162
|
}
|
|
10129
10163
|
var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
|
|
@@ -10141,12 +10175,12 @@ function _wizard_should_launch(opts) {
|
|
|
10141
10175
|
return [true, ""];
|
|
10142
10176
|
}
|
|
10143
10177
|
function _wizard_cli_dist(_project_root) {
|
|
10144
|
-
const package_root =
|
|
10145
|
-
const cli =
|
|
10178
|
+
const package_root = path6.dirname(path6.dirname(path6.dirname(resolvePath(_HERE))));
|
|
10179
|
+
const cli = path6.join(package_root, "dist", "cli", "agent-config.js");
|
|
10146
10180
|
return pathExists(cli) ? cli : null;
|
|
10147
10181
|
}
|
|
10148
10182
|
function _server_info_path() {
|
|
10149
|
-
return
|
|
10183
|
+
return path6.join(os2.homedir(), ".event4u", "agent-config", "local-server.json");
|
|
10150
10184
|
}
|
|
10151
10185
|
function _pid_is_agent_config(pid) {
|
|
10152
10186
|
let res;
|
|
@@ -10163,7 +10197,7 @@ function _pid_is_agent_config(pid) {
|
|
|
10163
10197
|
}
|
|
10164
10198
|
function unlinkMissingOk(p) {
|
|
10165
10199
|
try {
|
|
10166
|
-
|
|
10200
|
+
fs7.unlinkSync(p);
|
|
10167
10201
|
} catch {
|
|
10168
10202
|
}
|
|
10169
10203
|
}
|
|
@@ -10241,14 +10275,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
|
|
|
10241
10275
|
}
|
|
10242
10276
|
function _wizard_run_sync(cmd, env, cli) {
|
|
10243
10277
|
const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
|
|
10244
|
-
const log_path =
|
|
10278
|
+
const log_path = path6.join(
|
|
10245
10279
|
os2.tmpdir(),
|
|
10246
10280
|
`agent-config-wizard-${process2.pid}-${Date.now()}.log`
|
|
10247
10281
|
);
|
|
10248
10282
|
let child;
|
|
10249
10283
|
let log_fd = null;
|
|
10250
10284
|
try {
|
|
10251
|
-
log_fd =
|
|
10285
|
+
log_fd = fs7.openSync(log_path, "w");
|
|
10252
10286
|
child = spawn(cmd[0], cmd.slice(1), {
|
|
10253
10287
|
env,
|
|
10254
10288
|
detached: true,
|
|
@@ -10266,7 +10300,7 @@ function _wizard_run_sync(cmd, env, cli) {
|
|
|
10266
10300
|
} finally {
|
|
10267
10301
|
if (log_fd !== null) {
|
|
10268
10302
|
try {
|
|
10269
|
-
|
|
10303
|
+
fs7.closeSync(log_fd);
|
|
10270
10304
|
} catch {
|
|
10271
10305
|
}
|
|
10272
10306
|
}
|
|
@@ -10516,8 +10550,8 @@ function main2(argv) {
|
|
|
10516
10550
|
const target_root = resolvePath(
|
|
10517
10551
|
opts.custom_path || opts.project || process2.env["PROJECT_ROOT"] || process2.cwd()
|
|
10518
10552
|
);
|
|
10519
|
-
const minimal_package_root =
|
|
10520
|
-
|
|
10553
|
+
const minimal_package_root = path6.dirname(
|
|
10554
|
+
path6.dirname(path6.dirname(_minimal_templates_root()))
|
|
10521
10555
|
);
|
|
10522
10556
|
const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
|
|
10523
10557
|
return install_minimal(target_root, opts.force, validated_user_type);
|
|
@@ -10546,7 +10580,7 @@ function main2(argv) {
|
|
|
10546
10580
|
return rc2;
|
|
10547
10581
|
}
|
|
10548
10582
|
const project_root = custom_path || resolvePath(opts.project || process2.env["PROJECT_ROOT"] || process2.cwd());
|
|
10549
|
-
const is_first_run = !pathExists(
|
|
10583
|
+
const is_first_run = !pathExists(path6.join(project_root, SETTINGS_FILE));
|
|
10550
10584
|
const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
|
|
10551
10585
|
if (rc === 0 && opts.interactive) {
|
|
10552
10586
|
run_interactive_init(project_root, opts.force);
|
|
@@ -10610,16 +10644,16 @@ function _team_setup_hint_line(project_root) {
|
|
|
10610
10644
|
return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
|
|
10611
10645
|
}
|
|
10612
10646
|
function finalize_claude_model_tiers(project_root) {
|
|
10613
|
-
const claude_skills =
|
|
10614
|
-
const augment_skills =
|
|
10647
|
+
const claude_skills = path6.join(project_root, ".claude", "skills");
|
|
10648
|
+
const augment_skills = path6.join(project_root, ".augment", "skills");
|
|
10615
10649
|
if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
|
|
10616
10650
|
if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
|
|
10617
10651
|
let rendered = 0;
|
|
10618
|
-
const entries =
|
|
10652
|
+
const entries = fs7.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
10619
10653
|
for (const name of entries) {
|
|
10620
|
-
const entry =
|
|
10621
|
-
const src_dir =
|
|
10622
|
-
const src_md =
|
|
10654
|
+
const entry = path6.join(claude_skills, name);
|
|
10655
|
+
const src_dir = path6.join(augment_skills, name);
|
|
10656
|
+
const src_md = path6.join(src_dir, "SKILL.md");
|
|
10623
10657
|
let tier;
|
|
10624
10658
|
try {
|
|
10625
10659
|
tier = read_model_tier(src_md);
|
|
@@ -10628,22 +10662,22 @@ function finalize_claude_model_tiers(project_root) {
|
|
|
10628
10662
|
}
|
|
10629
10663
|
if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
|
|
10630
10664
|
if (isSymlink(entry) || isFile(entry)) {
|
|
10631
|
-
|
|
10665
|
+
fs7.unlinkSync(entry);
|
|
10632
10666
|
} else if (isDir(entry)) {
|
|
10633
|
-
|
|
10667
|
+
fs7.rmSync(entry, { recursive: true, force: true });
|
|
10634
10668
|
}
|
|
10635
10669
|
mkdirp(entry);
|
|
10636
|
-
const srcFiles =
|
|
10670
|
+
const srcFiles = fs7.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
10637
10671
|
for (const fname of srcFiles) {
|
|
10638
10672
|
if (fname === "SKILL.md") {
|
|
10639
10673
|
writeText(
|
|
10640
|
-
|
|
10674
|
+
path6.join(entry, "SKILL.md"),
|
|
10641
10675
|
render_native_model_md(readText(src_md), tier)
|
|
10642
10676
|
);
|
|
10643
10677
|
} else {
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10678
|
+
fs7.symlinkSync(
|
|
10679
|
+
path6.join("../../../.augment/skills", name, fname),
|
|
10680
|
+
path6.join(entry, fname)
|
|
10647
10681
|
);
|
|
10648
10682
|
}
|
|
10649
10683
|
}
|
|
@@ -10661,7 +10695,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
10661
10695
|
let package_type;
|
|
10662
10696
|
if (opts.package) {
|
|
10663
10697
|
package_root = resolvePath(opts.package);
|
|
10664
|
-
if (!pathExists(
|
|
10698
|
+
if (!pathExists(path6.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
10665
10699
|
fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
|
|
10666
10700
|
}
|
|
10667
10701
|
package_type = detect_package_type_for_project(project_root, package_root);
|
|
@@ -10796,9 +10830,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
10796
10830
|
function _resolvedArgv1() {
|
|
10797
10831
|
if (process2.argv[1] === void 0) return void 0;
|
|
10798
10832
|
try {
|
|
10799
|
-
return
|
|
10833
|
+
return fs7.realpathSync(path6.resolve(process2.argv[1]));
|
|
10800
10834
|
} catch {
|
|
10801
|
-
return
|
|
10835
|
+
return path6.resolve(process2.argv[1]);
|
|
10802
10836
|
}
|
|
10803
10837
|
}
|
|
10804
10838
|
var _argv1 = _resolvedArgv1();
|