@event4u/agent-config 9.13.0 → 9.15.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 +113 -67
- package/README.md +9 -1
- package/dist/agent-src/commands/agents/audit.md +7 -7
- package/dist/agent-src/commands/agents/optimize.md +1 -1
- package/dist/agent-src/commands/analyze/reference-repo.md +1 -1
- package/dist/agent-src/commands/chat-history.md +1 -0
- package/dist/agent-src/commands/context.md +1 -0
- package/dist/agent-src/commands/council.md +1 -1
- package/dist/agent-src/commands/ghostwriter.md +1 -1
- package/dist/agent-src/commands/memory.md +2 -1
- package/dist/agent-src/commands/module.md +1 -0
- package/dist/agent-src/commands/optimize/agents-dir.md +1 -1
- package/dist/agent-src/commands/optimize/deep.md +150 -0
- package/dist/agent-src/commands/optimize/skills.md +5 -5
- package/dist/agent-src/commands/optimize.md +12 -6
- package/dist/agent-src/commands/override.md +1 -0
- package/dist/agent-src/commands/prediction-pool.md +4 -4
- package/dist/agent-src/commands/research/deep.md +1 -1
- package/dist/agent-src/commands/roadmap.md +2 -1
- package/dist/agent-src/commands/rule-compliance-audit.md +1 -1
- package/dist/agent-src/commands/tdd.md +1 -0
- package/dist/agent-src/commands/tests.md +1 -0
- package/dist/agent-src/commands/upstream-contribute.md +5 -5
- package/dist/agent-src/commands/video/from-script.md +1 -1
- package/dist/agent-src/commands/video/from-song.md +1 -1
- package/dist/agent-src/commands/video/scene.md +1 -1
- package/dist/agent-src/commands/video/stitch.md +1 -1
- package/dist/agent-src/commands/video/storyboard.md +1 -1
- package/dist/agent-src/commands/worktree/create.md +2 -1
- package/dist/agent-src/contexts/augment-infrastructure.md +1 -1
- package/dist/agent-src/contexts/contracts/artifact-engagement-flow.md +5 -5
- package/dist/agent-src/contexts/contracts/command-suggestion-flow.md +3 -3
- package/dist/agent-src/contexts/contracts/emergency-triage-block.md +2 -2
- package/dist/agent-src/contexts/execution/roadmap-process-loop.md +4 -3
- package/dist/agent-src/contexts/execution/subagent-routing.md +19 -0
- package/dist/agent-src/contexts/override-system.md +1 -1
- package/dist/agent-src/ghostwriter/fictional-fixture-v1.md +1 -1
- package/dist/agent-src/rules/augment-edit-discipline.md +1 -1
- package/dist/agent-src/rules/autonomous-execution.md +2 -1
- package/dist/agent-src/rules/brand-consistency.md +1 -0
- package/dist/agent-src/rules/brand-source-of-truth.md +1 -0
- package/dist/agent-src/rules/code-comment-discipline.md +2 -0
- package/dist/agent-src/rules/communication-through-line.md +1 -0
- package/dist/agent-src/rules/content-quoting-floor.md +1 -0
- package/dist/agent-src/rules/cross-source-consistency.md +0 -1
- package/dist/agent-src/rules/downstream-changes.md +1 -0
- package/dist/agent-src/rules/external-code-graph-interop.md +1 -0
- package/dist/agent-src/rules/external-reference-deep-dive.md +1 -0
- package/dist/agent-src/rules/fast-path-marker-visibility.md +1 -0
- package/dist/agent-src/rules/finance-safety-floor.md +0 -1
- package/dist/agent-src/rules/icon-consistency.md +1 -0
- package/dist/agent-src/rules/image-likeness-and-rights.md +1 -0
- package/dist/agent-src/rules/improve-before-implement.md +1 -1
- package/dist/agent-src/rules/invite-challenge.md +1 -0
- package/dist/agent-src/rules/lethal-trifecta-guard.md +1 -0
- package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +1 -0
- package/dist/agent-src/rules/markdown-safe-codeblocks.md +1 -0
- package/dist/agent-src/rules/media-governance-routing.md +4 -3
- package/dist/agent-src/rules/media-sync-ground-truth.md +1 -0
- package/dist/agent-src/rules/no-attribution-footers.md +1 -0
- package/dist/agent-src/rules/no-decorative-emojis-in-git-surfaces.md +1 -0
- package/dist/agent-src/rules/no-pr-progress-comments.md +1 -0
- package/dist/agent-src/rules/onboarding-gate.md +1 -0
- package/dist/agent-src/rules/output-discipline.md +1 -0
- package/dist/agent-src/rules/prefer-enums-over-literals.md +1 -0
- package/dist/agent-src/rules/preservation-guard.md +1 -0
- package/dist/agent-src/rules/question-not-instruction.md +1 -0
- package/dist/agent-src/rules/roadmap-ci-steps-policy.md +1 -0
- package/dist/agent-src/rules/role-mode-adherence.md +1 -0
- package/dist/agent-src/rules/runtime-safety.md +1 -0
- package/dist/agent-src/rules/security-sensitive-stop.md +1 -0
- package/dist/agent-src/rules/session-canary.md +9 -2
- package/dist/agent-src/rules/source-confidentiality.md +1 -0
- package/dist/agent-src/rules/source-of-truth.md +1 -0
- package/dist/agent-src/rules/spreadsheet-source-quality.md +1 -0
- package/dist/agent-src/rules/think-before-action.md +1 -0
- package/dist/agent-src/rules/token-budget-discipline.md +1 -0
- package/dist/agent-src/rules/token-efficiency.md +1 -0
- package/dist/agent-src/rules/token-optimizer-maintenance.md +5 -5
- package/dist/agent-src/rules/tool-safety.md +1 -0
- package/dist/agent-src/rules/untrusted-input-defense.md +2 -0
- package/dist/agent-src/rules/user-interaction.md +1 -0
- package/dist/agent-src/rules/user-interrupt-priority.md +1 -0
- package/dist/agent-src/skills/adr-create/SKILL.md +1 -1
- package/dist/agent-src/skills/check-refs/SKILL.md +1 -1
- package/dist/agent-src/skills/competitive-positioning/SKILL.md +1 -1
- package/dist/agent-src/skills/condense-memory/SKILL.md +1 -1
- package/dist/agent-src/skills/context-authoring/SKILL.md +1 -1
- package/dist/agent-src/skills/copilot-agents-optimization/SKILL.md +1 -1
- package/dist/agent-src/skills/description-assist/SKILL.md +1 -1
- package/dist/agent-src/skills/github-ci/SKILL.md +1 -0
- package/dist/agent-src/skills/guideline-writing/SKILL.md +1 -1
- package/dist/agent-src/skills/lint-skills/SKILL.md +1 -1
- package/dist/agent-src/skills/readme-reviewer/SKILL.md +1 -1
- package/dist/agent-src/skills/roadmap-management/SKILL.md +8 -1
- package/dist/agent-src/skills/roadmap-writing/SKILL.md +1 -1
- package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +1 -1
- package/dist/agent-src/skills/skill-writing/SKILL.md +4 -4
- package/dist/agent-src/skills/token-optimizer/SKILL.md +4 -4
- package/dist/agent-src/skills/upstream-contribute/SKILL.md +6 -6
- package/dist/agent-src/skills/using-git-worktrees/SKILL.md +25 -0
- package/dist/agent-src/templates/AGENTS.md +1 -1
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/command.md +1 -1
- package/dist/agent-src/templates/copilot-instructions.md +3 -3
- package/dist/agent-src/templates/rule.md +2 -2
- package/dist/agent-src/templates/scripts/work_engine/orchestration.ts +1 -1
- package/dist/agent-src/templates/skill-archive-note.md +5 -5
- package/dist/agent-src/templates/skill.md +1 -1
- package/dist/cli/agent-config.js +66 -19
- package/dist/cli/agent-config.js.map +1 -1
- package/dist/cli/main.js +9 -4
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/python/workspace_drive.js +2 -0
- package/dist/cli/python/workspace_drive.js.map +1 -1
- package/dist/cli/python/workspace_drive_health.js +2 -0
- package/dist/cli/python/workspace_drive_health.js.map +1 -1
- package/dist/cli/python/workspace_hosts.js +2 -0
- package/dist/cli/python/workspace_hosts.js.map +1 -1
- package/dist/cli/python/workspace_sessions.js +2 -0
- package/dist/cli/python/workspace_sessions.js.map +1 -1
- package/dist/cli/registry.js +1 -0
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/{chunk-A3HJ6NTI.js → chunk-63WSP6YZ.js} +2 -1
- package/dist/cli-delegate/{chunk-EJYIGZ3T.js → chunk-BKO2AZ7Z.js} +1 -1
- package/dist/cli-delegate/{chunk-QFKQLQ7X.js → chunk-H574KOUH.js} +340 -462
- package/dist/cli-delegate/chunk-NXFWFAYV.js +339 -0
- package/dist/cli-delegate/{chunk-TEGJU2JX.js → chunk-ZXXJLL5K.js} +2 -2
- package/dist/cli-delegate/cmd_conformance.js +29 -23
- package/dist/cli-delegate/cmd_doctor.js +3 -3
- package/dist/cli-delegate/cmd_export.js +4 -4
- package/dist/cli-delegate/cmd_preflight.js +2 -2
- package/dist/cli-delegate/cmd_prune.js +4 -4
- package/dist/cli-delegate/cmd_settings_migrate.js +4 -4
- package/dist/cli-delegate/cmd_sync.js +4 -4
- package/dist/cli-delegate/cmd_uninstall.js +4 -4
- package/dist/cli-delegate/cmd_validate.js +4 -4
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +163 -103
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +3 -3
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +6 -5
- package/dist/discovery/trust-report.md +3 -3
- package/dist/discovery/workspaces.json +5 -4
- package/dist/hooks/dispatch.js +729 -430
- package/dist/install/install.mjs +700 -625
- package/dist/install/rule_scope.js +18 -2
- package/dist/install/rule_scope.js.map +1 -1
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +564 -424
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/claude_settings_hooks.js +30 -5
- package/dist/scripts/_lib/claude_settings_hooks.js.map +1 -1
- package/dist/scripts/_lib/scoped_projection.js +223 -0
- package/dist/scripts/_lib/scoped_projection.js.map +1 -0
- package/dist/scripts/_lib/surface_tiers.js +125 -0
- package/dist/scripts/_lib/surface_tiers.js.map +1 -0
- package/dist/scripts/_lib/token_count.js +166 -0
- package/dist/scripts/_lib/token_count.js.map +1 -0
- package/dist/scripts/_lib/trigger_eval_floors.js +8 -0
- package/dist/scripts/_lib/trigger_eval_floors.js.map +1 -1
- package/dist/scripts/condense.js +139 -9
- package/dist/scripts/condense.js.map +1 -1
- package/dist/scripts/project_thin_rules.js +450 -0
- package/dist/scripts/project_thin_rules.js.map +1 -0
- package/dist/server/routes/workspace.js +2 -0
- package/dist/server/routes/workspace.js.map +1 -1
- package/dist/server/schemas/settings.js +9 -3
- package/dist/server/schemas/settings.js.map +1 -1
- package/dist/ui/assets/index-DJY_vQVn.js +40 -0
- package/dist/ui/assets/index-DJY_vQVn.js.map +1 -0
- package/dist/ui/index.html +1 -1
- package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +1 -1
- package/package.json +11 -11
- package/src/agent-src/templates/AGENTS.md +1 -1
- package/src/agent-src/templates/scripts/work_engine/orchestration.ts +1 -1
- package/src/config/agent-settings.template.yml +59 -11
- package/src/config/ci-local-parity.yml +8 -0
- package/src/config/discovery/unassigned-artefacts.yml +23 -25
- package/src/config/evaluator-budgets.json +35 -5
- package/src/config/gate-coverage.yml +147 -0
- package/src/config/gate-violation-baselines.json +25 -0
- package/src/install/rule_scope.ts +27 -2
- package/src/scripts/_cli/cmd_conformance.ts +13 -24
- package/src/scripts/_dispatch.bash +10 -0
- package/src/scripts/_lib/claude_settings_hooks.ts +30 -4
- package/src/scripts/_lib/exec_evidence.ts +5 -0
- package/src/scripts/_lib/gate_baseline.ts +213 -0
- package/src/scripts/_lib/scoped_projection.ts +262 -0
- package/src/scripts/_lib/tier_budget_routing.ts +234 -0
- package/src/scripts/_lib/tool_adapter_registry.ts +8 -1
- package/src/scripts/_lib/trigger_eval_floors.ts +9 -0
- package/src/scripts/_lib/trigger_routers.ts +17 -5
- package/src/scripts/adr/regenerate_index.ts +4 -3
- package/src/scripts/ai-video/lib/parse-blueprint.sh +1 -1
- package/src/scripts/ai_council/compile_corpus.ts +1 -1
- package/src/scripts/audit_cloud_compatibility.ts +37 -2
- package/src/scripts/audit_initial_context.ts +53 -19
- package/src/scripts/audit_likelihood.ts +31 -2
- package/src/scripts/audit_user_type_axis.ts +58 -11
- package/src/scripts/bench_hook_latency.ts +172 -41
- package/src/scripts/build_mcp_catalog.ts +12 -1
- package/src/scripts/check_always_budget.ts +122 -11
- package/src/scripts/check_artefact_count_messaging.ts +128 -15
- package/src/scripts/check_augment_description_cap.ts +24 -3
- package/src/scripts/check_ci_strict_superset.ts +150 -0
- package/src/scripts/check_cluster_patterns.ts +100 -0
- package/src/scripts/check_consumer_scope_flip.ts +26 -4
- package/src/scripts/check_evaluator_budgets.ts +198 -19
- package/src/scripts/check_gate_coverage.ts +337 -1
- package/src/scripts/check_generator_output_coverage.ts +2 -1
- package/src/scripts/check_iron_law_prominence.ts +1 -1
- package/src/scripts/check_kernel_rule_bundle.ts +1 -1
- package/src/scripts/check_no_new_legacy_path.ts +167 -3
- package/src/scripts/check_pack_size.ts +18 -4
- package/src/scripts/check_portability.ts +37 -7
- package/src/scripts/check_references.ts +19 -3
- package/src/scripts/check_release_pr_shape.ts +13 -0
- package/src/scripts/check_token_regression.ts +9 -2
- package/src/scripts/condense.ts +155 -12
- package/src/scripts/cost/budget.mjs +63 -2
- package/src/scripts/count_scoped_projection.ts +104 -0
- package/src/scripts/evaluator_umbrella.sh +34 -1
- package/src/scripts/generate_capability_matrix.ts +8 -0
- package/src/scripts/generate_router_coverage_from_matrix.ts +155 -0
- package/src/scripts/hook_manifest.yaml +17 -3
- package/src/scripts/hooks/block_config_weakening.ts +337 -0
- package/src/scripts/hooks/concern_registry.ts +2 -0
- package/src/scripts/hooks/probe_throttle.ts +75 -0
- package/src/scripts/install-hooks.sh +24 -2
- package/src/scripts/install.ts +15 -92
- package/src/scripts/lint_agents_md.ts +9 -3
- package/src/scripts/lint_archived_skills.ts +1 -1
- package/src/scripts/lint_artefact_frontmatter.ts +185 -37
- package/src/scripts/lint_command_routing.ts +21 -52
- package/src/scripts/lint_command_verbs.ts +47 -28
- package/src/scripts/lint_context_spine_usage.ts +38 -12
- package/src/scripts/lint_framework_leakage.ts +25 -6
- package/src/scripts/lint_handoffs.ts +49 -2
- package/src/scripts/lint_media_policy_linkage.ts +62 -30
- package/src/scripts/lint_namespace.ts +92 -7
- package/src/scripts/lint_new_skill_gate.ts +39 -31
- package/src/scripts/lint_originality_shingles.ts +7 -1
- package/src/scripts/lint_override_kernel_guard.ts +21 -3
- package/src/scripts/lint_pack_boundaries.ts +461 -91
- package/src/scripts/lint_pack_dependencies.ts +24 -57
- package/src/scripts/lint_persona_governance.ts +1 -1
- package/src/scripts/lint_role_experiences.ts +34 -5
- package/src/scripts/lint_trigger_precision.ts +142 -0
- package/src/scripts/mcp_server/consumer_tool_catalog.json +12 -201
- package/src/scripts/mcp_server/tools.ts +1 -1
- package/src/scripts/prepack-check.mjs +40 -1
- package/src/scripts/prepack_router_targets.d.mts +7 -0
- package/src/scripts/prepack_router_targets.mjs +93 -0
- package/src/scripts/print_required_checks.ts +72 -18
- package/src/scripts/profile_staleness_hook.ts +12 -0
- package/src/scripts/record_evaluator_measurements.mjs +105 -0
- package/src/scripts/recruit_preflight.sh +1 -1
- package/src/scripts/release.ts +105 -1
- package/src/scripts/router_target_paths.d.mts +4 -0
- package/src/scripts/router_target_paths.mjs +69 -0
- package/src/scripts/router_telemetry.ts +52 -1
- package/src/scripts/routing_doctor.ts +485 -0
- package/src/scripts/rule_trigger_eval.ts +403 -0
- package/src/scripts/schemas/rule.schema.json +5 -1
- package/src/scripts/session_canary_hook.ts +96 -5
- package/src/scripts/skill_linter.ts +90 -42
- package/src/scripts/smoke/skills.sh +1 -1
- package/src/scripts/sweep_dead_scan_roots.ts +356 -10
- package/src/scripts/trigger_coverage.ts +13 -2
- package/src/scripts/update_counts.ts +91 -12
- package/src/scripts/validate_telegraph_carveouts.ts +1 -1
- package/src/scripts/wrapper_freshness_hook.ts +14 -0
- package/src/server/schemas/settings.ts +19 -5
- package/dist/cli-delegate/chunk-TJIAM5FW.js +0 -133
- package/dist/ui/assets/index-BpSQt5vm.js +0 -40
- package/dist/ui/assets/index-BpSQt5vm.js.map +0 -1
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-XX6TOPD7.js";
|
|
5
5
|
import {
|
|
6
6
|
RULE_SOURCE_REL
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BKO2AZ7Z.js";
|
|
8
8
|
import {
|
|
9
9
|
ScopeMismatchError,
|
|
10
10
|
build_claude_hook_matrix,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
save_inventory,
|
|
21
21
|
upsert_tool,
|
|
22
22
|
write_manifest
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-63WSP6YZ.js";
|
|
24
24
|
import {
|
|
25
25
|
check_version,
|
|
26
26
|
classify_mismatch,
|
|
@@ -33,9 +33,14 @@ import {
|
|
|
33
33
|
} from "./chunk-GRRPEPRN.js";
|
|
34
34
|
import {
|
|
35
35
|
LEGACY_ALL,
|
|
36
|
+
compute_active_pack_ids,
|
|
37
|
+
is_lab_artefact,
|
|
38
|
+
is_pruned_under_scoped,
|
|
39
|
+
load_lab_pack_ids,
|
|
40
|
+
load_packs_registry,
|
|
36
41
|
ruleFileArrives,
|
|
37
42
|
ruleScopeFromSettings
|
|
38
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-NXFWFAYV.js";
|
|
39
44
|
import {
|
|
40
45
|
find_project_root_with_anchor,
|
|
41
46
|
load_agent_settings
|
|
@@ -258,9 +263,9 @@ function subtract_pointers(doc, entries) {
|
|
|
258
263
|
// src/scripts/install.ts
|
|
259
264
|
import { spawn, spawnSync } from "node:child_process";
|
|
260
265
|
import * as crypto3 from "node:crypto";
|
|
261
|
-
import * as
|
|
266
|
+
import * as fs5 from "node:fs";
|
|
262
267
|
import * as os2 from "node:os";
|
|
263
|
-
import * as
|
|
268
|
+
import * as path4 from "node:path";
|
|
264
269
|
import process2 from "node:process";
|
|
265
270
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
266
271
|
|
|
@@ -380,118 +385,28 @@ function is_claude_builtin_name(slug) {
|
|
|
380
385
|
return CLAUDE_CODE_BUILTIN_NAMES.has(slug.toLowerCase());
|
|
381
386
|
}
|
|
382
387
|
|
|
383
|
-
// src/scripts/_lib/surface_tiers.ts
|
|
384
|
-
import * as fs from "node:fs";
|
|
385
|
-
import * as path from "node:path";
|
|
386
|
-
var _LAB_FALLBACK = /* @__PURE__ */ new Set(["ai-video", "ai-image", "fun"]);
|
|
387
|
-
function load_lab_pack_ids(repo_root) {
|
|
388
|
-
const vocab = path.join(repo_root, "src", "config", "discovery", "packs.yml");
|
|
389
|
-
const ids = /* @__PURE__ */ new Set();
|
|
390
|
-
try {
|
|
391
|
-
const YAML = require_dist();
|
|
392
|
-
const data = YAML.parse(fs.readFileSync(vocab, "utf-8"), { version: "1.1" });
|
|
393
|
-
for (const entry of data ?? []) {
|
|
394
|
-
if (entry && typeof entry === "object" && !Array.isArray(entry)) {
|
|
395
|
-
const rec = entry;
|
|
396
|
-
if (rec["surface_tier"] === "lab") {
|
|
397
|
-
const pid = rec["id"];
|
|
398
|
-
if (typeof pid === "string") {
|
|
399
|
-
ids.add(pid);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
} catch {
|
|
405
|
-
return new Set(_LAB_FALLBACK);
|
|
406
|
-
}
|
|
407
|
-
return ids.size > 0 ? ids : new Set(_LAB_FALLBACK);
|
|
408
|
-
}
|
|
409
|
-
function frontmatter_packs(md_path) {
|
|
410
|
-
let text;
|
|
411
|
-
try {
|
|
412
|
-
text = fs.readFileSync(md_path, "utf-8");
|
|
413
|
-
} catch {
|
|
414
|
-
return /* @__PURE__ */ new Set();
|
|
415
|
-
}
|
|
416
|
-
if (!text.startsWith("---")) {
|
|
417
|
-
return /* @__PURE__ */ new Set();
|
|
418
|
-
}
|
|
419
|
-
const end = text.indexOf("\n---", 3);
|
|
420
|
-
const block = end !== -1 ? text.slice(3, end) : text.slice(3);
|
|
421
|
-
const packs = /* @__PURE__ */ new Set();
|
|
422
|
-
let in_packs_list = false;
|
|
423
|
-
for (const raw of block.split("\n")) {
|
|
424
|
-
const line = raw.replace(/\s+$/, "");
|
|
425
|
-
const stripped = line.trim();
|
|
426
|
-
if (in_packs_list) {
|
|
427
|
-
if (stripped.startsWith("- ")) {
|
|
428
|
-
packs.add(_strip_quotes(stripped.slice(2).trim()));
|
|
429
|
-
continue;
|
|
430
|
-
}
|
|
431
|
-
in_packs_list = false;
|
|
432
|
-
}
|
|
433
|
-
if (stripped.startsWith("pack:")) {
|
|
434
|
-
const val = _strip_quotes(stripped.split(":").slice(1).join(":").trim());
|
|
435
|
-
if (val) {
|
|
436
|
-
packs.add(val);
|
|
437
|
-
}
|
|
438
|
-
} else if (stripped.startsWith("packs:")) {
|
|
439
|
-
const inline = stripped.split(":").slice(1).join(":").trim();
|
|
440
|
-
if (inline.startsWith("[") && inline.endsWith("]")) {
|
|
441
|
-
for (const raw_item of inline.slice(1, -1).split(",")) {
|
|
442
|
-
const item = _strip_quotes(raw_item.trim());
|
|
443
|
-
if (item) {
|
|
444
|
-
packs.add(item);
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
} else {
|
|
448
|
-
in_packs_list = true;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
return packs;
|
|
453
|
-
}
|
|
454
|
-
function is_lab_artefact(md_path, lab_ids) {
|
|
455
|
-
for (const p of frontmatter_packs(md_path)) {
|
|
456
|
-
if (lab_ids.has(p)) {
|
|
457
|
-
return true;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
return false;
|
|
461
|
-
}
|
|
462
|
-
function _strip_quotes(s) {
|
|
463
|
-
let out = s;
|
|
464
|
-
while (out.length > 0 && (out[0] === "'" || out[0] === '"')) {
|
|
465
|
-
out = out.slice(1);
|
|
466
|
-
}
|
|
467
|
-
while (out.length > 0 && (out[out.length - 1] === "'" || out[out.length - 1] === '"')) {
|
|
468
|
-
out = out.slice(0, -1);
|
|
469
|
-
}
|
|
470
|
-
return out;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
388
|
// src/scripts/_lib/install_drift.ts
|
|
474
389
|
var import_yaml = __toESM(require_dist(), 1);
|
|
475
390
|
import * as crypto from "node:crypto";
|
|
476
|
-
import * as
|
|
391
|
+
import * as fs from "node:fs";
|
|
477
392
|
import * as os from "node:os";
|
|
478
|
-
import * as
|
|
393
|
+
import * as path from "node:path";
|
|
479
394
|
function expanduser(p) {
|
|
480
395
|
if (p === "~") {
|
|
481
396
|
return os.homedir();
|
|
482
397
|
}
|
|
483
398
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
484
|
-
return
|
|
399
|
+
return path.join(os.homedir(), p.slice(2));
|
|
485
400
|
}
|
|
486
401
|
return p;
|
|
487
402
|
}
|
|
488
403
|
function resolve_entry_path(project_root, raw) {
|
|
489
404
|
const p = expanduser(raw);
|
|
490
|
-
return
|
|
405
|
+
return path.isAbsolute(p) ? p : path.join(project_root, p);
|
|
491
406
|
}
|
|
492
407
|
function sha256_of_file(p) {
|
|
493
408
|
try {
|
|
494
|
-
return crypto.createHash("sha256").update(
|
|
409
|
+
return crypto.createHash("sha256").update(fs.readFileSync(p)).digest("hex");
|
|
495
410
|
} catch {
|
|
496
411
|
return null;
|
|
497
412
|
}
|
|
@@ -500,7 +415,7 @@ function collect_drift(project_root, env) {
|
|
|
500
415
|
const target = manifest_path(project_root, env);
|
|
501
416
|
let text;
|
|
502
417
|
try {
|
|
503
|
-
text =
|
|
418
|
+
text = fs.readFileSync(target, "utf-8");
|
|
504
419
|
} catch {
|
|
505
420
|
return null;
|
|
506
421
|
}
|
|
@@ -545,7 +460,7 @@ function collect_drift(project_root, env) {
|
|
|
545
460
|
continue;
|
|
546
461
|
}
|
|
547
462
|
const resolved = resolve_entry_path(project_root, raw_path);
|
|
548
|
-
if (!
|
|
463
|
+
if (!fs.existsSync(resolved)) {
|
|
549
464
|
out.push({
|
|
550
465
|
tool_id,
|
|
551
466
|
path: resolved,
|
|
@@ -599,8 +514,8 @@ function format_drift_report(entries) {
|
|
|
599
514
|
|
|
600
515
|
// src/scripts/_lib/claude_desktop_bundler.ts
|
|
601
516
|
import * as crypto2 from "node:crypto";
|
|
602
|
-
import * as
|
|
603
|
-
import * as
|
|
517
|
+
import * as fs2 from "node:fs";
|
|
518
|
+
import * as path2 from "node:path";
|
|
604
519
|
|
|
605
520
|
// src/scripts/_lib/zip_min.ts
|
|
606
521
|
import * as zlib from "node:zlib";
|
|
@@ -707,7 +622,7 @@ function _is_excluded(rel_parts) {
|
|
|
707
622
|
}
|
|
708
623
|
function _is_dir(p) {
|
|
709
624
|
try {
|
|
710
|
-
return
|
|
625
|
+
return fs2.statSync(p).isDirectory();
|
|
711
626
|
} catch {
|
|
712
627
|
return false;
|
|
713
628
|
}
|
|
@@ -719,12 +634,12 @@ function _compare_rel_parts(a, b) {
|
|
|
719
634
|
}
|
|
720
635
|
function _walk_skill_files(skill_dir) {
|
|
721
636
|
const out = [];
|
|
722
|
-
const resolved =
|
|
637
|
+
const resolved = fs2.realpathSync(skill_dir);
|
|
723
638
|
const walk = (root, relRoot) => {
|
|
724
639
|
const dirNames = [];
|
|
725
640
|
const fileNames = [];
|
|
726
|
-
for (const dirent of
|
|
727
|
-
const full =
|
|
641
|
+
for (const dirent of fs2.readdirSync(root, { withFileTypes: true })) {
|
|
642
|
+
const full = path2.join(root, dirent.name);
|
|
728
643
|
const isDir2 = dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full);
|
|
729
644
|
if (isDir2) {
|
|
730
645
|
dirNames.push(dirent.name);
|
|
@@ -737,13 +652,13 @@ function _walk_skill_files(skill_dir) {
|
|
|
737
652
|
if (_is_excluded(rel_parts)) {
|
|
738
653
|
continue;
|
|
739
654
|
}
|
|
740
|
-
out.push([
|
|
655
|
+
out.push([path2.join(root, fname), rel_parts]);
|
|
741
656
|
}
|
|
742
657
|
for (const dname of dirNames) {
|
|
743
658
|
if (_is_excluded([dname])) {
|
|
744
659
|
continue;
|
|
745
660
|
}
|
|
746
|
-
walk(
|
|
661
|
+
walk(path2.join(root, dname), [...relRoot, dname]);
|
|
747
662
|
}
|
|
748
663
|
};
|
|
749
664
|
walk(resolved, []);
|
|
@@ -756,53 +671,53 @@ function _manifest_digest(files) {
|
|
|
756
671
|
const rel = rel_parts.join("/");
|
|
757
672
|
h.update(Buffer.from(rel, "utf-8"));
|
|
758
673
|
h.update(Buffer.from([0]));
|
|
759
|
-
h.update(crypto2.createHash("sha256").update(
|
|
674
|
+
h.update(crypto2.createHash("sha256").update(fs2.readFileSync(abs_path)).digest());
|
|
760
675
|
h.update(Buffer.from([0]));
|
|
761
676
|
}
|
|
762
677
|
return h.digest("hex");
|
|
763
678
|
}
|
|
764
679
|
function _atomic_write_zip(zip_path, files) {
|
|
765
|
-
|
|
766
|
-
const stem =
|
|
767
|
-
const tmp_path =
|
|
768
|
-
|
|
680
|
+
fs2.mkdirSync(path2.dirname(zip_path), { recursive: true });
|
|
681
|
+
const stem = path2.basename(zip_path, path2.extname(zip_path));
|
|
682
|
+
const tmp_path = path2.join(
|
|
683
|
+
path2.dirname(zip_path),
|
|
769
684
|
`.${stem}.${crypto2.randomBytes(6).toString("hex")}.zip.tmp`
|
|
770
685
|
);
|
|
771
686
|
try {
|
|
772
687
|
const entries = files.map(([abs_path, rel_parts]) => ({
|
|
773
688
|
name: rel_parts.join("/"),
|
|
774
|
-
data:
|
|
689
|
+
data: fs2.readFileSync(abs_path)
|
|
775
690
|
}));
|
|
776
|
-
|
|
777
|
-
|
|
691
|
+
fs2.writeFileSync(tmp_path, zip_write_sync(entries));
|
|
692
|
+
fs2.renameSync(tmp_path, zip_path);
|
|
778
693
|
} finally {
|
|
779
|
-
if (
|
|
780
|
-
|
|
694
|
+
if (fs2.existsSync(tmp_path)) {
|
|
695
|
+
fs2.unlinkSync(tmp_path);
|
|
781
696
|
}
|
|
782
697
|
}
|
|
783
698
|
}
|
|
784
699
|
function _write_if_changed(dest_dir, slug, files, force, written) {
|
|
785
700
|
const digest = _manifest_digest(files);
|
|
786
|
-
const zip_path =
|
|
787
|
-
const digest_path =
|
|
788
|
-
const recorded =
|
|
789
|
-
if (!force && recorded === digest &&
|
|
701
|
+
const zip_path = path2.join(dest_dir, `${slug}.zip`);
|
|
702
|
+
const digest_path = path2.join(dest_dir, `${slug}.sha256`);
|
|
703
|
+
const recorded = fs2.existsSync(digest_path) ? fs2.readFileSync(digest_path, "utf-8").trim() : "";
|
|
704
|
+
if (!force && recorded === digest && fs2.existsSync(zip_path)) {
|
|
790
705
|
return;
|
|
791
706
|
}
|
|
792
707
|
_atomic_write_zip(zip_path, files);
|
|
793
|
-
|
|
708
|
+
fs2.writeFileSync(digest_path, digest + "\n", "utf-8");
|
|
794
709
|
written.push(zip_path);
|
|
795
710
|
}
|
|
796
711
|
function build_skill_bundles(package_root, dest_dir, force = false, curation = null) {
|
|
797
|
-
const skills_root =
|
|
712
|
+
const skills_root = path2.join(package_root, "dist/agent-src", "skills");
|
|
798
713
|
if (!_is_dir(skills_root)) {
|
|
799
714
|
return [];
|
|
800
715
|
}
|
|
801
|
-
|
|
716
|
+
fs2.mkdirSync(dest_dir, { recursive: true });
|
|
802
717
|
const written = [];
|
|
803
|
-
for (const name of
|
|
804
|
-
const entry =
|
|
805
|
-
const isSymlink2 =
|
|
718
|
+
for (const name of fs2.readdirSync(skills_root).sort()) {
|
|
719
|
+
const entry = path2.join(skills_root, name);
|
|
720
|
+
const isSymlink2 = fs2.lstatSync(entry).isSymbolicLink();
|
|
806
721
|
if (!(_is_dir(entry) || isSymlink2)) {
|
|
807
722
|
continue;
|
|
808
723
|
}
|
|
@@ -810,8 +725,8 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
|
|
|
810
725
|
if (curation !== null && !curation.includes(skill_name)) {
|
|
811
726
|
continue;
|
|
812
727
|
}
|
|
813
|
-
const skill_md =
|
|
814
|
-
if (!
|
|
728
|
+
const skill_md = path2.join(entry, "SKILL.md");
|
|
729
|
+
if (!fs2.existsSync(skill_md)) {
|
|
815
730
|
continue;
|
|
816
731
|
}
|
|
817
732
|
const files = _walk_skill_files(entry);
|
|
@@ -823,15 +738,15 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
|
|
|
823
738
|
return written;
|
|
824
739
|
}
|
|
825
740
|
function _command_slug(source_file, commands_root) {
|
|
826
|
-
const rel =
|
|
827
|
-
const noExt = rel.slice(0, rel.length -
|
|
828
|
-
return noExt.split(
|
|
741
|
+
const rel = path2.relative(commands_root, source_file);
|
|
742
|
+
const noExt = rel.slice(0, rel.length - path2.extname(rel).length);
|
|
743
|
+
return noExt.split(path2.sep).join("-");
|
|
829
744
|
}
|
|
830
745
|
function _iter_command_files(commands_root) {
|
|
831
746
|
const found = [];
|
|
832
747
|
const walk = (dir) => {
|
|
833
|
-
for (const dirent of
|
|
834
|
-
const full =
|
|
748
|
+
for (const dirent of fs2.readdirSync(dir, { withFileTypes: true })) {
|
|
749
|
+
const full = path2.join(dir, dirent.name);
|
|
835
750
|
if (dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full)) {
|
|
836
751
|
walk(full);
|
|
837
752
|
} else if (dirent.name.endsWith(".md")) {
|
|
@@ -841,21 +756,21 @@ function _iter_command_files(commands_root) {
|
|
|
841
756
|
};
|
|
842
757
|
walk(commands_root);
|
|
843
758
|
found.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
844
|
-
return found.filter((source_file) =>
|
|
759
|
+
return found.filter((source_file) => path2.basename(source_file) !== "AGENTS.md");
|
|
845
760
|
}
|
|
846
761
|
function build_command_bundles(package_root, dest_dir, force = false, curation = null) {
|
|
847
|
-
const commands_root =
|
|
762
|
+
const commands_root = path2.join(package_root, "dist/agent-src", "commands");
|
|
848
763
|
if (!_is_dir(commands_root)) {
|
|
849
764
|
return [];
|
|
850
765
|
}
|
|
851
|
-
const skills_root =
|
|
766
|
+
const skills_root = path2.join(package_root, "dist/agent-src", "skills");
|
|
852
767
|
let skill_names = /* @__PURE__ */ new Set();
|
|
853
768
|
if (_is_dir(skills_root)) {
|
|
854
769
|
skill_names = new Set(
|
|
855
|
-
|
|
770
|
+
fs2.readdirSync(skills_root).filter((name) => _is_dir(path2.join(skills_root, name)))
|
|
856
771
|
);
|
|
857
772
|
}
|
|
858
|
-
|
|
773
|
+
fs2.mkdirSync(dest_dir, { recursive: true });
|
|
859
774
|
const written = [];
|
|
860
775
|
for (const source_file of _iter_command_files(commands_root)) {
|
|
861
776
|
const slug = _command_slug(source_file, commands_root);
|
|
@@ -865,7 +780,7 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
|
|
|
865
780
|
if (curation !== null && !curation.includes(slug)) {
|
|
866
781
|
continue;
|
|
867
782
|
}
|
|
868
|
-
const files = [[
|
|
783
|
+
const files = [[fs2.realpathSync(source_file), ["SKILL.md"]]];
|
|
869
784
|
_write_if_changed(dest_dir, slug, files, force, written);
|
|
870
785
|
}
|
|
871
786
|
return written;
|
|
@@ -1419,8 +1334,8 @@ function getErrorMap() {
|
|
|
1419
1334
|
|
|
1420
1335
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
1421
1336
|
var makeIssue = (params) => {
|
|
1422
|
-
const { data, path:
|
|
1423
|
-
const fullPath = [...
|
|
1337
|
+
const { data, path: path5, errorMaps, issueData } = params;
|
|
1338
|
+
const fullPath = [...path5, ...issueData.path || []];
|
|
1424
1339
|
const fullIssue = {
|
|
1425
1340
|
...issueData,
|
|
1426
1341
|
path: fullPath
|
|
@@ -1536,11 +1451,11 @@ var errorUtil;
|
|
|
1536
1451
|
|
|
1537
1452
|
// node_modules/zod/v3/types.js
|
|
1538
1453
|
var ParseInputLazyPath = class {
|
|
1539
|
-
constructor(parent, value,
|
|
1454
|
+
constructor(parent, value, path5, key) {
|
|
1540
1455
|
this._cachedPath = [];
|
|
1541
1456
|
this.parent = parent;
|
|
1542
1457
|
this.data = value;
|
|
1543
|
-
this._path =
|
|
1458
|
+
this._path = path5;
|
|
1544
1459
|
this._key = key;
|
|
1545
1460
|
}
|
|
1546
1461
|
get path() {
|
|
@@ -5022,8 +4937,8 @@ var settingsSchema = external_exports.object({
|
|
|
5022
4937
|
rule_workspaces: external_exports.array(external_exports.string()).default([]).describe(
|
|
5023
4938
|
"Workspace scope for the RULE layer only (road-to-request-scoped-rule-load P1/P1b, opt-in). Absent or empty = legacy-all: every rule projects AND installs. Non-empty = only rules whose workspaces frontmatter intersects this list are projected (condense) and installed (install.sh + global wizard payload). Kernel rules always ship; untagged rules fail safe. The default flip to a scoped value is a HUMAN release gate \u2014 do not set this from automation."
|
|
5024
4939
|
),
|
|
5025
|
-
rule_packs: external_exports.array(external_exports.string()).default([]).describe(
|
|
5026
|
-
|
|
4940
|
+
rule_packs: external_exports.union([external_exports.literal("auto"), external_exports.array(external_exports.string())]).default([]).describe(
|
|
4941
|
+
'Optional second scoping axis for the RULE layer, per pack ids (src/config/discovery/packs.yml). When set, a non-kernel rule also needs a packs frontmatter intersection to ship \u2014 e.g. deselecting frontend-design drops ui-audit-gate + design-fidelity. Same opt-in / human-gate semantics as rule_workspaces. The literal "auto" derives the id list from the active-pack set (the same set the skill/command prune uses), so a domain safety floor stops shipping into installs that do not have the pack it guards; an explicit list stays supported and wins over the derivation.'
|
|
5027
4942
|
)
|
|
5028
4943
|
}).default({ mode: "legacy-all" }),
|
|
5029
4944
|
rule_loading_tier: ruleLoadingTier.default("balanced").describe(
|
|
@@ -5047,7 +4962,18 @@ var settingsSchema = external_exports.object({
|
|
|
5047
4962
|
),
|
|
5048
4963
|
monthly: external_exports.number().min(0).default(0).describe(
|
|
5049
4964
|
"Calendar-month USD ceiling. Pairs with cost.enforcement = hard-stop for a hard cap on agent spend before the next billing cycle. Set 0 to disable."
|
|
5050
|
-
)
|
|
4965
|
+
),
|
|
4966
|
+
per_tier: external_exports.object({
|
|
4967
|
+
cheap: external_exports.number().min(0).nullable().default(null).describe(
|
|
4968
|
+
"USD ceiling for the cheap model tier under budget-aware delegation (docs/contracts/budget-routing.md). null = no separate tier cap; global ceilings still apply."
|
|
4969
|
+
),
|
|
4970
|
+
medium: external_exports.number().min(0).nullable().default(null).describe(
|
|
4971
|
+
"USD ceiling for the medium model tier. null = no separate tier cap."
|
|
4972
|
+
),
|
|
4973
|
+
strong: external_exports.number().min(0).nullable().default(null).describe(
|
|
4974
|
+
"USD ceiling for the strong model tier. null = no separate tier cap \u2014 with cheap exhausted and strong funded, budget routing uses the strong tier rather than blocking work."
|
|
4975
|
+
)
|
|
4976
|
+
}).default({ cheap: null, medium: null, strong: null })
|
|
5051
4977
|
}),
|
|
5052
4978
|
enforcement: enforcementMode.default("advisory").describe(
|
|
5053
4979
|
"What happens when a budget hits 100%. advisory = show a banner, keep working (default \u2014 never blocks an active task). hard-stop = refuse further model calls until the budget resets or you raise the ceiling."
|
|
@@ -5072,7 +4998,7 @@ var settingsSchema = external_exports.object({
|
|
|
5072
4998
|
"Prefer short bullets and tables (true, default) vs verbose prose with rationale (false). Affects every chat reply; flip to false during debugging when you want the agent to think out loud."
|
|
5073
4999
|
),
|
|
5074
5000
|
canary_name: external_exports.string().default("").describe(
|
|
5075
|
-
'Session canary \u2014 the name the agent addresses you with at the start of every new task (e.g. "Alex"). When the greeting silently disappears, the context window is degrading: start a fresh conversation. Also keeps the reply-close markers (end-summary, PR URL as literal last line) alive. Empty = off. See rules/session-canary.md.'
|
|
5001
|
+
'Session canary \u2014 the name the agent addresses you with at the start of every new task (e.g. "Alex"). When the greeting silently disappears, the context window is degrading: start a fresh conversation. Also keeps the reply-close markers (end-summary, PR URL as literal last line) alive. Empty = fall back to the user-global canary_name, then to identity.name from the setup wizard; no name anywhere = off. See rules/session-canary.md.'
|
|
5076
5002
|
),
|
|
5077
5003
|
play_by_play: external_exports.boolean().default(false).describe(
|
|
5078
5004
|
`Narrate intermediate findings between tool calls ("Found it.", "Let me check Y."). Off by default \u2014 most users find it noisy. Turn on when you want to follow the agent's reasoning step by step.`
|
|
@@ -5156,8 +5082,8 @@ var settingsSchema = external_exports.object({
|
|
|
5156
5082
|
quality_cadence: qualityCadence.default("end_of_roadmap").describe(
|
|
5157
5083
|
"When the agent runs the full quality / test suite during /roadmap:process-* runs. end_of_roadmap = once, after the last step (fastest, default). per_phase = after each phase boundary. per_step = after every single step (slowest, highest confidence)."
|
|
5158
5084
|
),
|
|
5159
|
-
dashboard_regen_cadence: regenCadence.default("
|
|
5160
|
-
"How often the agent regenerates agents/roadmaps/dashboard.md during a roadmap run. per_step = after every step (
|
|
5085
|
+
dashboard_regen_cadence: regenCadence.default("every_5_steps").describe(
|
|
5086
|
+
"How often the agent regenerates agents/roadmaps/dashboard.md during a roadmap run. every_5_steps = batch the regen (default). per_step = after every step (freshest dashboard, highest subprocess overhead). phase_boundary = only at phase edges. A rename, phase add, or archive always regenerates immediately regardless."
|
|
5161
5087
|
),
|
|
5162
5088
|
horizon_weeks: external_exports.number().int().min(0).default(0).describe(
|
|
5163
5089
|
'Optional planning horizon (weeks) the agent shows in roadmap framing ("next 4 weeks"). Set 0 to omit the horizon \u2014 most teams prefer to ship without a hardcoded window.'
|
|
@@ -5257,6 +5183,9 @@ var settingsSchema = external_exports.object({
|
|
|
5257
5183
|
downshift: external_exports.boolean().default(true).describe(
|
|
5258
5184
|
"Route delegable sub-tasks to the lowest-capable model tier (cost + speed via model downshift). false = every subagent runs on the session tier."
|
|
5259
5185
|
),
|
|
5186
|
+
budget_routing: external_exports.enum(["ask", "auto", "off"]).default("ask").describe(
|
|
5187
|
+
"Budget-aware cheap-request delegation (docs/contracts/budget-routing.md): pick the cheapest classifier-adequate tier WITH available budget (cost.budgets.per_tier); cheap exhausted but strong funded \u2192 strong tier; all exhausted \u2192 session model + notice. Work is never blocked to save money; the session model is never switched (delegation with a model override). ask = confirm the first budget-motivated downshift per session (default). auto = apply silently with telemetry. off = today's behavior (single-flip rollback). Distinct from downshift: that is the quality/cost knob, this is the resource-availability gate."
|
|
5188
|
+
),
|
|
5260
5189
|
quota_arbitrage: external_exports.boolean().default(true).describe(
|
|
5261
5190
|
"Prefer a separate quota-pool model for delegable sub-tasks where the host manifest reports one. Optional bonus only \u2014 identical behaviour (minus the quota win) where unsupported. Never load-bearing."
|
|
5262
5191
|
),
|
|
@@ -6770,8 +6699,8 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
6770
6699
|
};
|
|
6771
6700
|
|
|
6772
6701
|
// src/scripts/_lib/module_detection.ts
|
|
6773
|
-
import * as
|
|
6774
|
-
import * as
|
|
6702
|
+
import * as fs3 from "node:fs";
|
|
6703
|
+
import * as path3 from "node:path";
|
|
6775
6704
|
var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
|
|
6776
6705
|
var _RULES = [
|
|
6777
6706
|
["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
|
|
@@ -6785,14 +6714,14 @@ var _RULES = [
|
|
|
6785
6714
|
];
|
|
6786
6715
|
function _isDir(p) {
|
|
6787
6716
|
try {
|
|
6788
|
-
return
|
|
6717
|
+
return fs3.statSync(p).isDirectory();
|
|
6789
6718
|
} catch {
|
|
6790
6719
|
return false;
|
|
6791
6720
|
}
|
|
6792
6721
|
}
|
|
6793
6722
|
function _isFile(p) {
|
|
6794
6723
|
try {
|
|
6795
|
-
return
|
|
6724
|
+
return fs3.statSync(p).isFile();
|
|
6796
6725
|
} catch {
|
|
6797
6726
|
return false;
|
|
6798
6727
|
}
|
|
@@ -6806,13 +6735,13 @@ function _isUpperChar(ch) {
|
|
|
6806
6735
|
function _list_module_subdirs(root) {
|
|
6807
6736
|
let entries;
|
|
6808
6737
|
try {
|
|
6809
|
-
entries =
|
|
6738
|
+
entries = fs3.readdirSync(root).sort();
|
|
6810
6739
|
} catch {
|
|
6811
6740
|
return [];
|
|
6812
6741
|
}
|
|
6813
6742
|
const out = [];
|
|
6814
6743
|
for (const name of entries) {
|
|
6815
|
-
if (!_isDir(
|
|
6744
|
+
if (!_isDir(path3.join(root, name))) {
|
|
6816
6745
|
continue;
|
|
6817
6746
|
}
|
|
6818
6747
|
if (name.startsWith(".")) {
|
|
@@ -6834,11 +6763,11 @@ function _score_confidence(stack, root, subdirs) {
|
|
|
6834
6763
|
return capitalized.length > 0 ? "high" : "medium";
|
|
6835
6764
|
}
|
|
6836
6765
|
if (stack === "node-monorepo") {
|
|
6837
|
-
const withPkgJson = subdirs.filter((name) => _isFile(
|
|
6766
|
+
const withPkgJson = subdirs.filter((name) => _isFile(path3.join(root, name, "package.json")));
|
|
6838
6767
|
return withPkgJson.length > 0 ? "high" : "medium";
|
|
6839
6768
|
}
|
|
6840
6769
|
if (stack === "python-src") {
|
|
6841
|
-
const withInit = subdirs.filter((name) => _isFile(
|
|
6770
|
+
const withInit = subdirs.filter((name) => _isFile(path3.join(root, name, "__init__.py")));
|
|
6842
6771
|
return withInit.length > 0 ? "high" : "medium";
|
|
6843
6772
|
}
|
|
6844
6773
|
if (stack === "go-internal") {
|
|
@@ -6850,7 +6779,7 @@ function detect_module_roots(project_root) {
|
|
|
6850
6779
|
const high = [];
|
|
6851
6780
|
const medium = [];
|
|
6852
6781
|
for (const [rel_path, stack, namespace_template] of _RULES) {
|
|
6853
|
-
const abs_path =
|
|
6782
|
+
const abs_path = path3.join(project_root, rel_path);
|
|
6854
6783
|
if (!_isDir(abs_path)) {
|
|
6855
6784
|
continue;
|
|
6856
6785
|
}
|
|
@@ -6872,7 +6801,7 @@ function detect_module_roots(project_root) {
|
|
|
6872
6801
|
}
|
|
6873
6802
|
|
|
6874
6803
|
// src/scripts/_lib/model_tier.ts
|
|
6875
|
-
import
|
|
6804
|
+
import fs4 from "node:fs";
|
|
6876
6805
|
var TIER_TO_CLAUDE_MODEL = {
|
|
6877
6806
|
high: "opus",
|
|
6878
6807
|
medium: "sonnet",
|
|
@@ -6880,8 +6809,8 @@ var TIER_TO_CLAUDE_MODEL = {
|
|
|
6880
6809
|
};
|
|
6881
6810
|
var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
|
|
6882
6811
|
function read_model_tier(skill_md) {
|
|
6883
|
-
if (!
|
|
6884
|
-
const text =
|
|
6812
|
+
if (!fs4.existsSync(skill_md)) return null;
|
|
6813
|
+
const text = fs4.readFileSync(skill_md).toString("utf-8");
|
|
6885
6814
|
if (!text.startsWith("---\n")) return null;
|
|
6886
6815
|
const end = text.indexOf("\n---\n", 4);
|
|
6887
6816
|
if (end === -1) return null;
|
|
@@ -6915,34 +6844,34 @@ var ArgparseExit = class extends Error {
|
|
|
6915
6844
|
function expanduser2(p) {
|
|
6916
6845
|
if (p === "~") return os2.homedir();
|
|
6917
6846
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
6918
|
-
return
|
|
6847
|
+
return path4.join(os2.homedir(), p.slice(2));
|
|
6919
6848
|
}
|
|
6920
6849
|
return p;
|
|
6921
6850
|
}
|
|
6922
6851
|
function resolvePath(p) {
|
|
6923
6852
|
try {
|
|
6924
|
-
return
|
|
6853
|
+
return fs5.realpathSync(path4.resolve(p));
|
|
6925
6854
|
} catch {
|
|
6926
|
-
return
|
|
6855
|
+
return path4.resolve(p);
|
|
6927
6856
|
}
|
|
6928
6857
|
}
|
|
6929
6858
|
function isFile(p) {
|
|
6930
6859
|
try {
|
|
6931
|
-
return
|
|
6860
|
+
return fs5.statSync(p).isFile();
|
|
6932
6861
|
} catch {
|
|
6933
6862
|
return false;
|
|
6934
6863
|
}
|
|
6935
6864
|
}
|
|
6936
6865
|
function isDir(p) {
|
|
6937
6866
|
try {
|
|
6938
|
-
return
|
|
6867
|
+
return fs5.statSync(p).isDirectory();
|
|
6939
6868
|
} catch {
|
|
6940
6869
|
return false;
|
|
6941
6870
|
}
|
|
6942
6871
|
}
|
|
6943
6872
|
function pathExists(p) {
|
|
6944
6873
|
try {
|
|
6945
|
-
|
|
6874
|
+
fs5.statSync(p);
|
|
6946
6875
|
return true;
|
|
6947
6876
|
} catch {
|
|
6948
6877
|
return false;
|
|
@@ -6950,24 +6879,24 @@ function pathExists(p) {
|
|
|
6950
6879
|
}
|
|
6951
6880
|
function isSymlink(p) {
|
|
6952
6881
|
try {
|
|
6953
|
-
return
|
|
6882
|
+
return fs5.lstatSync(p).isSymbolicLink();
|
|
6954
6883
|
} catch {
|
|
6955
6884
|
return false;
|
|
6956
6885
|
}
|
|
6957
6886
|
}
|
|
6958
6887
|
function readText(p) {
|
|
6959
|
-
return
|
|
6888
|
+
return fs5.readFileSync(p, "utf-8");
|
|
6960
6889
|
}
|
|
6961
6890
|
function writeText(p, content) {
|
|
6962
|
-
|
|
6891
|
+
fs5.writeFileSync(p, content, "utf-8");
|
|
6963
6892
|
}
|
|
6964
6893
|
function mkdirp(p) {
|
|
6965
|
-
|
|
6894
|
+
fs5.mkdirSync(p, { recursive: true });
|
|
6966
6895
|
}
|
|
6967
6896
|
function sortedGlobStems(directory, suffix) {
|
|
6968
6897
|
let entries;
|
|
6969
6898
|
try {
|
|
6970
|
-
entries =
|
|
6899
|
+
entries = fs5.readdirSync(directory);
|
|
6971
6900
|
} catch {
|
|
6972
6901
|
return [];
|
|
6973
6902
|
}
|
|
@@ -6987,7 +6916,7 @@ function sortedGlobStems(directory, suffix) {
|
|
|
6987
6916
|
function countZips(directory) {
|
|
6988
6917
|
if (!isDir(directory)) return 0;
|
|
6989
6918
|
let n = 0;
|
|
6990
|
-
for (const name of
|
|
6919
|
+
for (const name of fs5.readdirSync(directory)) {
|
|
6991
6920
|
if (name.endsWith(".zip")) n += 1;
|
|
6992
6921
|
}
|
|
6993
6922
|
return n;
|
|
@@ -6995,35 +6924,35 @@ function countZips(directory) {
|
|
|
6995
6924
|
function sha256OfFile(p) {
|
|
6996
6925
|
let data;
|
|
6997
6926
|
try {
|
|
6998
|
-
data =
|
|
6927
|
+
data = fs5.readFileSync(p);
|
|
6999
6928
|
} catch {
|
|
7000
6929
|
return null;
|
|
7001
6930
|
}
|
|
7002
6931
|
return crypto3.createHash("sha256").update(data).digest("hex");
|
|
7003
6932
|
}
|
|
7004
6933
|
function atomicWrite0644(target, body, prefix) {
|
|
7005
|
-
const dir =
|
|
7006
|
-
const tmpName =
|
|
6934
|
+
const dir = path4.dirname(target);
|
|
6935
|
+
const tmpName = path4.join(
|
|
7007
6936
|
dir,
|
|
7008
6937
|
`${prefix}${process2.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
|
|
7009
6938
|
);
|
|
7010
6939
|
let fd = null;
|
|
7011
6940
|
try {
|
|
7012
|
-
fd =
|
|
7013
|
-
|
|
7014
|
-
|
|
6941
|
+
fd = fs5.openSync(tmpName, "wx", 420);
|
|
6942
|
+
fs5.writeFileSync(fd, body, "utf-8");
|
|
6943
|
+
fs5.closeSync(fd);
|
|
7015
6944
|
fd = null;
|
|
7016
|
-
|
|
7017
|
-
|
|
6945
|
+
fs5.chmodSync(tmpName, 420);
|
|
6946
|
+
fs5.renameSync(tmpName, target);
|
|
7018
6947
|
} catch (err) {
|
|
7019
6948
|
if (fd !== null) {
|
|
7020
6949
|
try {
|
|
7021
|
-
|
|
6950
|
+
fs5.closeSync(fd);
|
|
7022
6951
|
} catch {
|
|
7023
6952
|
}
|
|
7024
6953
|
}
|
|
7025
6954
|
try {
|
|
7026
|
-
|
|
6955
|
+
fs5.unlinkSync(tmpName);
|
|
7027
6956
|
} catch {
|
|
7028
6957
|
}
|
|
7029
6958
|
throw err;
|
|
@@ -7147,12 +7076,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
|
|
|
7147
7076
|
var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
|
|
7148
7077
|
var SETTINGS_SUBDIR = ["agents", "settings"];
|
|
7149
7078
|
function _canonical_settings_target(project_root) {
|
|
7150
|
-
return
|
|
7079
|
+
return path4.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
|
|
7151
7080
|
}
|
|
7152
7081
|
function _resolve_settings_read(project_root) {
|
|
7153
7082
|
const canonical = _canonical_settings_target(project_root);
|
|
7154
7083
|
if (pathExists(canonical)) return canonical;
|
|
7155
|
-
const legacy =
|
|
7084
|
+
const legacy = path4.join(project_root, SETTINGS_FILE);
|
|
7156
7085
|
if (pathExists(legacy)) return legacy;
|
|
7157
7086
|
return canonical;
|
|
7158
7087
|
}
|
|
@@ -7216,9 +7145,9 @@ function fail(msg) {
|
|
|
7216
7145
|
throw new SystemExitError(1);
|
|
7217
7146
|
}
|
|
7218
7147
|
function detect_package_root(project_root) {
|
|
7219
|
-
const npm_path =
|
|
7148
|
+
const npm_path = path4.join(project_root, "node_modules", "@event4u", "agent-config");
|
|
7220
7149
|
if (isDir(npm_path)) return resolvePath(npm_path);
|
|
7221
|
-
if (pathExists(
|
|
7150
|
+
if (pathExists(path4.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
7222
7151
|
return project_root;
|
|
7223
7152
|
}
|
|
7224
7153
|
fail(
|
|
@@ -7226,12 +7155,12 @@ function detect_package_root(project_root) {
|
|
|
7226
7155
|
);
|
|
7227
7156
|
}
|
|
7228
7157
|
function detect_package_type(package_root) {
|
|
7229
|
-
if (package_root.split(
|
|
7158
|
+
if (package_root.split(path4.sep).includes("node_modules")) return "npm";
|
|
7230
7159
|
return "local";
|
|
7231
7160
|
}
|
|
7232
7161
|
function detect_package_type_for_project(project_root, package_root) {
|
|
7233
7162
|
const npm_path = resolvePath(
|
|
7234
|
-
|
|
7163
|
+
path4.join(project_root, "node_modules", "@event4u", "agent-config")
|
|
7235
7164
|
);
|
|
7236
7165
|
const package_resolved = resolvePath(package_root);
|
|
7237
7166
|
if (package_resolved === npm_path) return "npm";
|
|
@@ -7251,7 +7180,7 @@ function ensure_directory(p) {
|
|
|
7251
7180
|
mkdirp(p);
|
|
7252
7181
|
}
|
|
7253
7182
|
function write_file(p, content) {
|
|
7254
|
-
ensure_directory(
|
|
7183
|
+
ensure_directory(path4.dirname(p));
|
|
7255
7184
|
writeText(p, content);
|
|
7256
7185
|
}
|
|
7257
7186
|
function read_json_file(p) {
|
|
@@ -7422,7 +7351,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
|
|
|
7422
7351
|
return rendered + "\n" + suffix;
|
|
7423
7352
|
}
|
|
7424
7353
|
function _migrate_legacy_if_present(project_root, template_body) {
|
|
7425
|
-
const legacy_target =
|
|
7354
|
+
const legacy_target = path4.join(project_root, LEGACY_SETTINGS_FILE);
|
|
7426
7355
|
if (!isFile(legacy_target)) return null;
|
|
7427
7356
|
const legacy_text = readText(legacy_target);
|
|
7428
7357
|
const [values, unknown] = _parse_legacy_settings(legacy_text);
|
|
@@ -7437,9 +7366,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
|
|
|
7437
7366
|
}
|
|
7438
7367
|
}
|
|
7439
7368
|
rendered = _append_unknown_legacy(rendered, values, unknown);
|
|
7440
|
-
const backup_target =
|
|
7369
|
+
const backup_target = path4.join(project_root, LEGACY_BACKUP_FILE);
|
|
7441
7370
|
writeText(backup_target, legacy_text);
|
|
7442
|
-
|
|
7371
|
+
fs5.unlinkSync(legacy_target);
|
|
7443
7372
|
info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
|
|
7444
7373
|
info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
|
|
7445
7374
|
if (unknown.length > 0) {
|
|
@@ -7474,7 +7403,7 @@ function _render_template(template, profile_values) {
|
|
|
7474
7403
|
return body;
|
|
7475
7404
|
}
|
|
7476
7405
|
function _load_valid_user_types(package_root) {
|
|
7477
|
-
const directory =
|
|
7406
|
+
const directory = path4.join(package_root, USER_TYPES_DIR);
|
|
7478
7407
|
if (!isDir(directory)) return [];
|
|
7479
7408
|
return sortedGlobStems(directory, ".yml");
|
|
7480
7409
|
}
|
|
@@ -7531,8 +7460,8 @@ function splitlinesKeepends(text) {
|
|
|
7531
7460
|
}
|
|
7532
7461
|
function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
|
|
7533
7462
|
const target = _canonical_settings_target(project_root);
|
|
7534
|
-
const profile_source =
|
|
7535
|
-
const template_source =
|
|
7463
|
+
const profile_source = path4.join(package_root, "src", "config", "profiles", `${profile}.ini`);
|
|
7464
|
+
const template_source = path4.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
7536
7465
|
if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
|
|
7537
7466
|
if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
|
|
7538
7467
|
const template = readText(template_source);
|
|
@@ -7546,21 +7475,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
7546
7475
|
if (profile_values["rule_loading_tier"] !== profile) {
|
|
7547
7476
|
const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
|
|
7548
7477
|
fail(
|
|
7549
|
-
`Profile preset ${
|
|
7478
|
+
`Profile preset ${path4.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
|
|
7550
7479
|
);
|
|
7551
7480
|
}
|
|
7552
7481
|
profile_values["user_type"] = _validate_user_type(package_root, user_type);
|
|
7553
7482
|
let template_body = _render_template(template, profile_values);
|
|
7554
7483
|
template_body = _inject_packs(template_body, packs ?? []);
|
|
7555
|
-
const legacy_root =
|
|
7484
|
+
const legacy_root = path4.join(project_root, SETTINGS_FILE);
|
|
7556
7485
|
if (isFile(legacy_root) && !pathExists(target)) {
|
|
7557
|
-
mkdirp(
|
|
7486
|
+
mkdirp(path4.dirname(target));
|
|
7558
7487
|
writeText(target, readText(legacy_root));
|
|
7559
|
-
|
|
7488
|
+
fs5.unlinkSync(legacy_root);
|
|
7560
7489
|
success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
|
|
7561
7490
|
return;
|
|
7562
7491
|
}
|
|
7563
|
-
const legacy_target =
|
|
7492
|
+
const legacy_target = path4.join(project_root, LEGACY_SETTINGS_FILE);
|
|
7564
7493
|
if (isFile(legacy_target) && pathExists(target)) {
|
|
7565
7494
|
warn(
|
|
7566
7495
|
`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 +7506,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
7577
7506
|
skip(`${SETTINGS_FILE} already exists`);
|
|
7578
7507
|
return;
|
|
7579
7508
|
}
|
|
7580
|
-
mkdirp(
|
|
7509
|
+
mkdirp(path4.dirname(target));
|
|
7581
7510
|
write_file(target, template_body);
|
|
7582
7511
|
const user_type_value = profile_values["user_type"] ?? "";
|
|
7583
7512
|
const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
|
|
@@ -7590,7 +7519,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
7590
7519
|
const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
|
|
7591
7520
|
const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
|
|
7592
7521
|
merge_json_file(
|
|
7593
|
-
|
|
7522
|
+
path4.join(project_root, ".vscode", "settings.json"),
|
|
7594
7523
|
bridge,
|
|
7595
7524
|
force,
|
|
7596
7525
|
".vscode/settings.json"
|
|
@@ -7599,14 +7528,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
7599
7528
|
function ensure_augment_bridge(project_root, force) {
|
|
7600
7529
|
const bridge = { enabledPlugins: { "agent-config@event4u": true } };
|
|
7601
7530
|
return merge_json_file(
|
|
7602
|
-
|
|
7531
|
+
path4.join(project_root, ".augment", "settings.json"),
|
|
7603
7532
|
bridge,
|
|
7604
7533
|
force,
|
|
7605
7534
|
".augment/settings.json"
|
|
7606
7535
|
);
|
|
7607
7536
|
}
|
|
7608
|
-
var AUGMENT_USER_DIR =
|
|
7609
|
-
var AUGMENT_USER_HOOKS_DIR =
|
|
7537
|
+
var AUGMENT_USER_DIR = path4.join(os2.homedir(), ".augment");
|
|
7538
|
+
var AUGMENT_USER_HOOKS_DIR = path4.join(AUGMENT_USER_DIR, "hooks");
|
|
7610
7539
|
var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
|
|
7611
7540
|
var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
7612
7541
|
"augment-chat-history.sh",
|
|
@@ -7622,29 +7551,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
|
|
|
7622
7551
|
["post_tool_use", "PostToolUse"]
|
|
7623
7552
|
];
|
|
7624
7553
|
function _deploy_augment_trampoline(package_root, name, force) {
|
|
7625
|
-
const src =
|
|
7554
|
+
const src = path4.join(package_root, "scripts", "hooks", name);
|
|
7626
7555
|
if (!pathExists(src)) {
|
|
7627
7556
|
skip(`augment trampoline missing in package: ${src}`);
|
|
7628
7557
|
return null;
|
|
7629
7558
|
}
|
|
7630
7559
|
mkdirp(AUGMENT_USER_HOOKS_DIR);
|
|
7631
|
-
const dst =
|
|
7560
|
+
const dst = path4.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
7632
7561
|
const src_text = readText(src);
|
|
7633
7562
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
7634
7563
|
skip(`~/.augment/hooks/${name} already up to date`);
|
|
7635
7564
|
} else {
|
|
7636
7565
|
writeText(dst, src_text);
|
|
7637
|
-
|
|
7566
|
+
fs5.chmodSync(dst, 493);
|
|
7638
7567
|
success(`~/.augment/hooks/${name} installed`);
|
|
7639
7568
|
}
|
|
7640
7569
|
return dst;
|
|
7641
7570
|
}
|
|
7642
7571
|
function _remove_legacy_augment_trampolines() {
|
|
7643
7572
|
for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
|
|
7644
|
-
const legacy =
|
|
7573
|
+
const legacy = path4.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
7645
7574
|
try {
|
|
7646
7575
|
if (isFile(legacy)) {
|
|
7647
|
-
|
|
7576
|
+
fs5.unlinkSync(legacy);
|
|
7648
7577
|
skip(`removed legacy ~/.augment/hooks/${name}`);
|
|
7649
7578
|
}
|
|
7650
7579
|
} catch {
|
|
@@ -7663,7 +7592,7 @@ function ensure_augment_user_hooks(package_root, force) {
|
|
|
7663
7592
|
}
|
|
7664
7593
|
const settings_patch = { hooks: per_event };
|
|
7665
7594
|
return merge_json_file(
|
|
7666
|
-
|
|
7595
|
+
path4.join(AUGMENT_USER_DIR, "settings.json"),
|
|
7667
7596
|
settings_patch,
|
|
7668
7597
|
force,
|
|
7669
7598
|
"~/.augment/settings.json"
|
|
@@ -7688,7 +7617,7 @@ function _heal_legacy_claude_plugin_ids(p) {
|
|
|
7688
7617
|
return removed;
|
|
7689
7618
|
}
|
|
7690
7619
|
function ensure_claude_bridge(project_root, force) {
|
|
7691
|
-
const target =
|
|
7620
|
+
const target = path4.join(project_root, ".claude", "settings.json");
|
|
7692
7621
|
const healed = _heal_legacy_claude_plugin_ids(target);
|
|
7693
7622
|
for (const pid of healed) {
|
|
7694
7623
|
success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
|
|
@@ -7713,29 +7642,29 @@ function ensure_cursor_bridge(project_root, force) {
|
|
|
7713
7642
|
}
|
|
7714
7643
|
const bridge = { version: 1, hooks };
|
|
7715
7644
|
return merge_json_file(
|
|
7716
|
-
|
|
7645
|
+
path4.join(project_root, ".cursor", "hooks.json"),
|
|
7717
7646
|
bridge,
|
|
7718
7647
|
force,
|
|
7719
7648
|
".cursor/hooks.json"
|
|
7720
7649
|
);
|
|
7721
7650
|
}
|
|
7722
|
-
var CURSOR_USER_DIR =
|
|
7723
|
-
var CURSOR_USER_HOOKS_DIR =
|
|
7651
|
+
var CURSOR_USER_DIR = path4.join(os2.homedir(), ".cursor");
|
|
7652
|
+
var CURSOR_USER_HOOKS_DIR = path4.join(CURSOR_USER_DIR, "hooks");
|
|
7724
7653
|
var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
|
|
7725
7654
|
function ensure_cursor_user_hooks(package_root, force) {
|
|
7726
|
-
const src =
|
|
7655
|
+
const src = path4.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
|
|
7727
7656
|
if (!pathExists(src)) {
|
|
7728
7657
|
skip(`cursor trampoline missing in package: ${src}`);
|
|
7729
7658
|
return [];
|
|
7730
7659
|
}
|
|
7731
7660
|
mkdirp(CURSOR_USER_HOOKS_DIR);
|
|
7732
|
-
const dst =
|
|
7661
|
+
const dst = path4.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
|
|
7733
7662
|
const src_text = readText(src);
|
|
7734
7663
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
7735
7664
|
skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
7736
7665
|
} else {
|
|
7737
7666
|
writeText(dst, src_text);
|
|
7738
|
-
|
|
7667
|
+
fs5.chmodSync(dst, 493);
|
|
7739
7668
|
success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
|
|
7740
7669
|
}
|
|
7741
7670
|
const hooks = {};
|
|
@@ -7744,7 +7673,7 @@ function ensure_cursor_user_hooks(package_root, force) {
|
|
|
7744
7673
|
}
|
|
7745
7674
|
const settings_patch = { version: 1, hooks };
|
|
7746
7675
|
return merge_json_file(
|
|
7747
|
-
|
|
7676
|
+
path4.join(CURSOR_USER_DIR, "hooks.json"),
|
|
7748
7677
|
settings_patch,
|
|
7749
7678
|
force,
|
|
7750
7679
|
"~/.cursor/hooks.json"
|
|
@@ -7787,12 +7716,12 @@ exit 0
|
|
|
7787
7716
|
`;
|
|
7788
7717
|
}
|
|
7789
7718
|
function ensure_cline_bridge(project_root, force) {
|
|
7790
|
-
const hooks_dir =
|
|
7719
|
+
const hooks_dir = path4.join(project_root, ".clinerules", "hooks");
|
|
7791
7720
|
mkdirp(hooks_dir);
|
|
7792
7721
|
const workspace_quoted = shlexQuote(resolvePath(project_root));
|
|
7793
7722
|
let written = 0;
|
|
7794
7723
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
7795
|
-
const target =
|
|
7724
|
+
const target = path4.join(hooks_dir, native_event);
|
|
7796
7725
|
const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
|
|
7797
7726
|
if (pathExists(target) && readText(target) === body && !force) {
|
|
7798
7727
|
continue;
|
|
@@ -7802,7 +7731,7 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
7802
7731
|
continue;
|
|
7803
7732
|
}
|
|
7804
7733
|
writeText(target, body);
|
|
7805
|
-
|
|
7734
|
+
fs5.chmodSync(target, 493);
|
|
7806
7735
|
written += 1;
|
|
7807
7736
|
}
|
|
7808
7737
|
if (written) {
|
|
@@ -7811,27 +7740,27 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
7811
7740
|
skip(".clinerules/hooks/ already up to date");
|
|
7812
7741
|
}
|
|
7813
7742
|
}
|
|
7814
|
-
var CLINE_USER_DIR =
|
|
7743
|
+
var CLINE_USER_DIR = path4.join(os2.homedir(), "Documents", "Cline", "Hooks");
|
|
7815
7744
|
var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
|
|
7816
7745
|
function ensure_cline_user_hooks(package_root, force) {
|
|
7817
|
-
const src =
|
|
7746
|
+
const src = path4.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
|
|
7818
7747
|
if (!pathExists(src)) {
|
|
7819
7748
|
skip(`cline trampoline missing in package: ${src}`);
|
|
7820
7749
|
return;
|
|
7821
7750
|
}
|
|
7822
7751
|
mkdirp(CLINE_USER_DIR);
|
|
7823
|
-
const trampoline =
|
|
7752
|
+
const trampoline = path4.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
|
|
7824
7753
|
const src_text = readText(src);
|
|
7825
7754
|
if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
|
|
7826
7755
|
skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
7827
7756
|
} else {
|
|
7828
7757
|
writeText(trampoline, src_text);
|
|
7829
|
-
|
|
7758
|
+
fs5.chmodSync(trampoline, 493);
|
|
7830
7759
|
success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
|
|
7831
7760
|
}
|
|
7832
7761
|
const trampoline_quoted = shlexQuote(trampoline);
|
|
7833
7762
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
7834
|
-
const wrapper =
|
|
7763
|
+
const wrapper = path4.join(CLINE_USER_DIR, native_event);
|
|
7835
7764
|
const body = `#!/usr/bin/env bash
|
|
7836
7765
|
# Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
|
|
7837
7766
|
# User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
|
|
@@ -7841,7 +7770,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
|
|
|
7841
7770
|
continue;
|
|
7842
7771
|
}
|
|
7843
7772
|
writeText(wrapper, body);
|
|
7844
|
-
|
|
7773
|
+
fs5.chmodSync(wrapper, 493);
|
|
7845
7774
|
}
|
|
7846
7775
|
}
|
|
7847
7776
|
var WINDSURF_DISPATCHER_BINDINGS = [
|
|
@@ -7862,29 +7791,29 @@ function ensure_windsurf_bridge(project_root, force) {
|
|
|
7862
7791
|
}
|
|
7863
7792
|
const bridge = { hooks };
|
|
7864
7793
|
return merge_json_file(
|
|
7865
|
-
|
|
7794
|
+
path4.join(project_root, ".windsurf", "hooks.json"),
|
|
7866
7795
|
bridge,
|
|
7867
7796
|
force,
|
|
7868
7797
|
".windsurf/hooks.json"
|
|
7869
7798
|
);
|
|
7870
7799
|
}
|
|
7871
|
-
var WINDSURF_USER_DIR =
|
|
7872
|
-
var WINDSURF_USER_HOOKS_DIR =
|
|
7800
|
+
var WINDSURF_USER_DIR = path4.join(os2.homedir(), ".codeium", "windsurf");
|
|
7801
|
+
var WINDSURF_USER_HOOKS_DIR = path4.join(WINDSURF_USER_DIR, "hooks");
|
|
7873
7802
|
var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
|
|
7874
7803
|
function ensure_windsurf_user_hooks(package_root, force) {
|
|
7875
|
-
const src =
|
|
7804
|
+
const src = path4.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
7876
7805
|
if (!pathExists(src)) {
|
|
7877
7806
|
skip(`windsurf trampoline missing in package: ${src}`);
|
|
7878
7807
|
return [];
|
|
7879
7808
|
}
|
|
7880
7809
|
mkdirp(WINDSURF_USER_HOOKS_DIR);
|
|
7881
|
-
const dst =
|
|
7810
|
+
const dst = path4.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
7882
7811
|
const src_text = readText(src);
|
|
7883
7812
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
7884
7813
|
skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
7885
7814
|
} else {
|
|
7886
7815
|
writeText(dst, src_text);
|
|
7887
|
-
|
|
7816
|
+
fs5.chmodSync(dst, 493);
|
|
7888
7817
|
success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
|
|
7889
7818
|
}
|
|
7890
7819
|
const hooks = {};
|
|
@@ -7896,7 +7825,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
|
|
|
7896
7825
|
}
|
|
7897
7826
|
const settings_patch = { hooks };
|
|
7898
7827
|
return merge_json_file(
|
|
7899
|
-
|
|
7828
|
+
path4.join(WINDSURF_USER_DIR, "hooks.json"),
|
|
7900
7829
|
settings_patch,
|
|
7901
7830
|
force,
|
|
7902
7831
|
"~/.codeium/windsurf/hooks.json"
|
|
@@ -7925,43 +7854,43 @@ function _gemini_hooks_dict(command_factory) {
|
|
|
7925
7854
|
function ensure_gemini_bridge(project_root, force) {
|
|
7926
7855
|
const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
|
|
7927
7856
|
return merge_json_file(
|
|
7928
|
-
|
|
7857
|
+
path4.join(project_root, ".gemini", "settings.json"),
|
|
7929
7858
|
bridge,
|
|
7930
7859
|
force,
|
|
7931
7860
|
".gemini/settings.json"
|
|
7932
7861
|
);
|
|
7933
7862
|
}
|
|
7934
|
-
var GEMINI_USER_DIR =
|
|
7935
|
-
var GEMINI_USER_HOOKS_DIR =
|
|
7863
|
+
var GEMINI_USER_DIR = path4.join(os2.homedir(), ".gemini");
|
|
7864
|
+
var GEMINI_USER_HOOKS_DIR = path4.join(GEMINI_USER_DIR, "hooks");
|
|
7936
7865
|
var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
|
|
7937
7866
|
function ensure_gemini_user_hooks(package_root, force) {
|
|
7938
|
-
const src =
|
|
7867
|
+
const src = path4.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
|
|
7939
7868
|
if (!pathExists(src)) {
|
|
7940
7869
|
skip(`gemini trampoline missing in package: ${src}`);
|
|
7941
7870
|
return [];
|
|
7942
7871
|
}
|
|
7943
7872
|
mkdirp(GEMINI_USER_HOOKS_DIR);
|
|
7944
|
-
const dst =
|
|
7873
|
+
const dst = path4.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
|
|
7945
7874
|
const src_text = readText(src);
|
|
7946
7875
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
7947
7876
|
skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
7948
7877
|
} else {
|
|
7949
7878
|
writeText(dst, src_text);
|
|
7950
|
-
|
|
7879
|
+
fs5.chmodSync(dst, 493);
|
|
7951
7880
|
success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
|
|
7952
7881
|
}
|
|
7953
7882
|
const settings_patch = {
|
|
7954
7883
|
hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
|
|
7955
7884
|
};
|
|
7956
7885
|
return merge_json_file(
|
|
7957
|
-
|
|
7886
|
+
path4.join(GEMINI_USER_DIR, "settings.json"),
|
|
7958
7887
|
settings_patch,
|
|
7959
7888
|
force,
|
|
7960
7889
|
"~/.gemini/settings.json"
|
|
7961
7890
|
);
|
|
7962
7891
|
}
|
|
7963
7892
|
function ensure_copilot_bridge(project_root, force) {
|
|
7964
|
-
const target =
|
|
7893
|
+
const target = path4.join(project_root, ".github", "plugin", "marketplace.json");
|
|
7965
7894
|
const bridge = {
|
|
7966
7895
|
marketplace: {
|
|
7967
7896
|
name: "event4u-agent-marketplace",
|
|
@@ -8004,7 +7933,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
|
|
|
8004
7933
|
Run \`./agent-config --help\` for available commands.
|
|
8005
7934
|
`;
|
|
8006
7935
|
function ensure_roocode_bridge(project_root, force) {
|
|
8007
|
-
const target =
|
|
7936
|
+
const target = path4.join(project_root, ".roo", "rules", "agent-config.md");
|
|
8008
7937
|
if (pathExists(target) && !force) {
|
|
8009
7938
|
skip(".roo/rules/agent-config.md already exists");
|
|
8010
7939
|
return;
|
|
@@ -8026,7 +7955,7 @@ To wire Claude Desktop to this project's rules, run:
|
|
|
8026
7955
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
8027
7956
|
`;
|
|
8028
7957
|
function ensure_claude_desktop_bridge(project_root, force) {
|
|
8029
|
-
const target =
|
|
7958
|
+
const target = path4.join(project_root, ".claude-desktop", "agent-config.md");
|
|
8030
7959
|
if (pathExists(target) && !force) {
|
|
8031
7960
|
skip(".claude-desktop/agent-config.md already exists");
|
|
8032
7961
|
return;
|
|
@@ -8051,7 +7980,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
|
|
|
8051
7980
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
8052
7981
|
`;
|
|
8053
7982
|
function ensure_aider_bridge(project_root, force) {
|
|
8054
|
-
const target =
|
|
7983
|
+
const target = path4.join(project_root, ".aider", "agent-config.md");
|
|
8055
7984
|
if (pathExists(target) && !force) {
|
|
8056
7985
|
skip(".aider/agent-config.md already exists");
|
|
8057
7986
|
return;
|
|
@@ -8070,7 +7999,7 @@ developers where the rules and skills live.
|
|
|
8070
7999
|
Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
|
|
8071
8000
|
`;
|
|
8072
8001
|
function ensure_codex_bridge(project_root, force) {
|
|
8073
|
-
const target =
|
|
8002
|
+
const target = path4.join(project_root, ".codex", "agent-config.md");
|
|
8074
8003
|
if (pathExists(target) && !force) {
|
|
8075
8004
|
skip(".codex/agent-config.md already exists");
|
|
8076
8005
|
return;
|
|
@@ -8088,7 +8017,7 @@ rules per session. The canonical rule and skill source lives under
|
|
|
8088
8017
|
orientation).
|
|
8089
8018
|
`;
|
|
8090
8019
|
function ensure_continue_bridge(project_root, force) {
|
|
8091
|
-
const target =
|
|
8020
|
+
const target = path4.join(project_root, ".continue", "rules", "agent-config.md");
|
|
8092
8021
|
if (pathExists(target) && !force) {
|
|
8093
8022
|
skip(".continue/rules/agent-config.md already exists");
|
|
8094
8023
|
return;
|
|
@@ -8119,7 +8048,7 @@ orientation).
|
|
|
8119
8048
|
See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
|
|
8120
8049
|
`;
|
|
8121
8050
|
function ensure_kilocode_bridge(project_root, force) {
|
|
8122
|
-
const target =
|
|
8051
|
+
const target = path4.join(project_root, ".kilocode", "rules", "agent-config.md");
|
|
8123
8052
|
if (pathExists(target) && !force) {
|
|
8124
8053
|
skip(".kilocode/rules/agent-config.md already exists");
|
|
8125
8054
|
return;
|
|
@@ -8146,7 +8075,7 @@ canonical source (or symlink it):
|
|
|
8146
8075
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
8147
8076
|
`;
|
|
8148
8077
|
function ensure_zed_bridge(project_root, force) {
|
|
8149
|
-
const target =
|
|
8078
|
+
const target = path4.join(project_root, ".zed", "agent-config.md");
|
|
8150
8079
|
if (pathExists(target) && !force) {
|
|
8151
8080
|
skip(".zed/agent-config.md already exists");
|
|
8152
8081
|
return;
|
|
@@ -8167,7 +8096,7 @@ rules into your JetBrains profile.
|
|
|
8167
8096
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
8168
8097
|
`;
|
|
8169
8098
|
function ensure_jetbrains_bridge(project_root, force) {
|
|
8170
|
-
const target =
|
|
8099
|
+
const target = path4.join(project_root, ".jetbrains", "agent-config.md");
|
|
8171
8100
|
if (pathExists(target) && !force) {
|
|
8172
8101
|
skip(".jetbrains/agent-config.md already exists");
|
|
8173
8102
|
return;
|
|
@@ -8198,7 +8127,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
|
|
|
8198
8127
|
See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
|
|
8199
8128
|
`;
|
|
8200
8129
|
function ensure_kiro_bridge(project_root, force) {
|
|
8201
|
-
const target =
|
|
8130
|
+
const target = path4.join(project_root, ".kiro", "steering", "agent-config.md");
|
|
8202
8131
|
if (pathExists(target) && !force) {
|
|
8203
8132
|
skip(".kiro/steering/agent-config.md already exists");
|
|
8204
8133
|
return;
|
|
@@ -8224,35 +8153,35 @@ var SMOKE_BRIDGE_PATHS = {
|
|
|
8224
8153
|
};
|
|
8225
8154
|
function dirHasEntries(p) {
|
|
8226
8155
|
try {
|
|
8227
|
-
return
|
|
8156
|
+
return fs5.readdirSync(p).length > 0;
|
|
8228
8157
|
} catch {
|
|
8229
8158
|
return false;
|
|
8230
8159
|
}
|
|
8231
8160
|
}
|
|
8232
8161
|
function _resolve_tsx_invocation(scriptPath, scriptArgs) {
|
|
8233
8162
|
const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
8234
|
-
let dir =
|
|
8163
|
+
let dir = path4.dirname(scriptPath);
|
|
8235
8164
|
for (; ; ) {
|
|
8236
|
-
const candidate =
|
|
8165
|
+
const candidate = path4.join(dir, "node_modules", ".bin", binName);
|
|
8237
8166
|
if (isFile(candidate)) {
|
|
8238
8167
|
return { command: candidate, args: [scriptPath, ...scriptArgs] };
|
|
8239
8168
|
}
|
|
8240
|
-
const parent =
|
|
8169
|
+
const parent = path4.dirname(dir);
|
|
8241
8170
|
if (parent === dir) break;
|
|
8242
8171
|
dir = parent;
|
|
8243
8172
|
}
|
|
8244
8173
|
return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
|
|
8245
8174
|
}
|
|
8246
8175
|
function _smoke_test_hooks(project_root, package_root) {
|
|
8247
|
-
const dispatcher =
|
|
8248
|
-
const manifest =
|
|
8176
|
+
const dispatcher = path4.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
|
|
8177
|
+
const manifest = path4.join(package_root, "scripts", "hook_manifest.yaml");
|
|
8249
8178
|
if (!isFile(dispatcher) || !isFile(manifest)) return 0;
|
|
8250
8179
|
const failed = [];
|
|
8251
8180
|
const skipped = [];
|
|
8252
8181
|
const passed = [];
|
|
8253
8182
|
for (const [platform, native] of SMOKE_PROBE_EVENTS) {
|
|
8254
8183
|
const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
|
|
8255
|
-
const bridge_path = rel_bridge ?
|
|
8184
|
+
const bridge_path = rel_bridge ? path4.join(project_root, rel_bridge) : null;
|
|
8256
8185
|
const bridge_present = Boolean(
|
|
8257
8186
|
bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
|
|
8258
8187
|
);
|
|
@@ -8452,9 +8381,9 @@ To remove this marker, delete this file.
|
|
|
8452
8381
|
`;
|
|
8453
8382
|
}
|
|
8454
8383
|
var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
|
|
8455
|
-
var GLOBAL_ROOT =
|
|
8456
|
-
var GLOBAL_USER_SETTINGS_PATH =
|
|
8457
|
-
var GLOBAL_AGENT_SETTINGS_PATH =
|
|
8384
|
+
var GLOBAL_ROOT = path4.join(os2.homedir(), ".event4u", "agent-config");
|
|
8385
|
+
var GLOBAL_USER_SETTINGS_PATH = path4.join(GLOBAL_ROOT, ".agent-user.yml");
|
|
8386
|
+
var GLOBAL_AGENT_SETTINGS_PATH = path4.join(GLOBAL_ROOT, ".agent-settings.yml");
|
|
8458
8387
|
function _bridge_marker(tool_id, scope) {
|
|
8459
8388
|
if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
|
|
8460
8389
|
return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
|
|
@@ -8503,7 +8432,7 @@ function _load_yaml_doc(p) {
|
|
|
8503
8432
|
return _isPlainObject(data) ? data : {};
|
|
8504
8433
|
}
|
|
8505
8434
|
function _load_default_settings(package_root) {
|
|
8506
|
-
const template_source =
|
|
8435
|
+
const template_source = path4.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
8507
8436
|
if (!pathExists(template_source)) return {};
|
|
8508
8437
|
let text;
|
|
8509
8438
|
try {
|
|
@@ -8591,9 +8520,9 @@ function detect_scope(cwd) {
|
|
|
8591
8520
|
if (pathExists(_resolve_settings_read(cwd))) {
|
|
8592
8521
|
return ["project", `existing ${SETTINGS_FILE}`];
|
|
8593
8522
|
}
|
|
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(
|
|
8523
|
+
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path4.join(cwd, m))) ?? null;
|
|
8524
|
+
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path4.join(cwd, d))) ?? null;
|
|
8525
|
+
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path4.join(cwd, f))) ?? null;
|
|
8597
8526
|
if (has_manifest && (has_ai_dir || has_ai_file)) {
|
|
8598
8527
|
const marker = has_ai_dir || has_ai_file;
|
|
8599
8528
|
return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
|
|
@@ -8614,7 +8543,7 @@ function readLineSyncRaw(promptText) {
|
|
|
8614
8543
|
for (; ; ) {
|
|
8615
8544
|
let n;
|
|
8616
8545
|
try {
|
|
8617
|
-
n =
|
|
8546
|
+
n = fs5.readSync(0, buf, 0, 1, null);
|
|
8618
8547
|
} catch (err) {
|
|
8619
8548
|
const code = err.code;
|
|
8620
8549
|
if (code === "EAGAIN") {
|
|
@@ -8689,8 +8618,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
|
|
|
8689
8618
|
const marker = _bridge_marker(tool_id, scope);
|
|
8690
8619
|
if (!marker) continue;
|
|
8691
8620
|
let marker_path = marker;
|
|
8692
|
-
if (!
|
|
8693
|
-
marker_path =
|
|
8621
|
+
if (!path4.isAbsolute(marker_path)) {
|
|
8622
|
+
marker_path = path4.join(project_root, marker_path);
|
|
8694
8623
|
}
|
|
8695
8624
|
out[tool_id] = [_file_entry(marker_path, "bridge", false)];
|
|
8696
8625
|
}
|
|
@@ -8729,26 +8658,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
|
|
|
8729
8658
|
}
|
|
8730
8659
|
write_manifest(target, version, entries);
|
|
8731
8660
|
if (!state.QUIET) {
|
|
8732
|
-
const rel = isRelativeTo(target, project_root) ?
|
|
8661
|
+
const rel = isRelativeTo(target, project_root) ? path4.relative(project_root, target) : target;
|
|
8733
8662
|
info(`Manifest updated: ${rel}`);
|
|
8734
8663
|
}
|
|
8735
8664
|
return 0;
|
|
8736
8665
|
}
|
|
8737
8666
|
function isRelativeTo(child, parent) {
|
|
8738
|
-
const rel =
|
|
8739
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
8667
|
+
const rel = path4.relative(parent, child);
|
|
8668
|
+
return rel === "" || !rel.startsWith("..") && !path4.isAbsolute(rel);
|
|
8740
8669
|
}
|
|
8741
8670
|
function _resolve_package_root_for_global() {
|
|
8742
8671
|
const here = resolvePath(_HERE);
|
|
8743
|
-
const candidate =
|
|
8744
|
-
if (!pathExists(
|
|
8672
|
+
const candidate = path4.dirname(path4.dirname(path4.dirname(here)));
|
|
8673
|
+
if (!pathExists(path4.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
|
|
8745
8674
|
fail(
|
|
8746
8675
|
`Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
|
|
8747
8676
|
);
|
|
8748
8677
|
}
|
|
8749
8678
|
return candidate;
|
|
8750
8679
|
}
|
|
8751
|
-
var CONSUMER_BRIDGE_MARKER_RELPATH =
|
|
8680
|
+
var CONSUMER_BRIDGE_MARKER_RELPATH = path4.join("agents", ".event4u-bridge.yml");
|
|
8752
8681
|
var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
8753
8682
|
var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
|
|
8754
8683
|
var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
|
|
@@ -8756,7 +8685,7 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
8756
8685
|
if (process2.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
|
|
8757
8686
|
return [false, "consumer-mode-override"];
|
|
8758
8687
|
}
|
|
8759
|
-
const pkg_json =
|
|
8688
|
+
const pkg_json = path4.join(project_root, "package.json");
|
|
8760
8689
|
if (isFile(pkg_json)) {
|
|
8761
8690
|
let data = {};
|
|
8762
8691
|
try {
|
|
@@ -8768,18 +8697,18 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
8768
8697
|
return [true, "package.json:name"];
|
|
8769
8698
|
}
|
|
8770
8699
|
}
|
|
8771
|
-
if (isDir(
|
|
8700
|
+
if (isDir(path4.join(project_root, ".agent-src.uncondensed"))) {
|
|
8772
8701
|
return [true, ".agent-src.uncondensed/"];
|
|
8773
8702
|
}
|
|
8774
|
-
const packages_dir =
|
|
8703
|
+
const packages_dir = path4.join(project_root, "packages");
|
|
8775
8704
|
if (isDir(packages_dir)) {
|
|
8776
|
-
for (const child of
|
|
8777
|
-
if (isDir(
|
|
8705
|
+
for (const child of fs5.readdirSync(packages_dir)) {
|
|
8706
|
+
if (isDir(path4.join(packages_dir, child, ".agent-src.uncondensed"))) {
|
|
8778
8707
|
return [true, `packages/${child}/.agent-src.uncondensed/`];
|
|
8779
8708
|
}
|
|
8780
8709
|
}
|
|
8781
8710
|
}
|
|
8782
|
-
const installer_self =
|
|
8711
|
+
const installer_self = path4.join(project_root, "scripts", "install.py");
|
|
8783
8712
|
try {
|
|
8784
8713
|
if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE)) {
|
|
8785
8714
|
return [true, "src/scripts/install.py (self)"];
|
|
@@ -8799,17 +8728,17 @@ function _detect_legacy_for_migration(project_root) {
|
|
|
8799
8728
|
}
|
|
8800
8729
|
return [];
|
|
8801
8730
|
}
|
|
8802
|
-
if (isFile(
|
|
8731
|
+
if (isFile(path4.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
|
|
8803
8732
|
const found = [];
|
|
8804
8733
|
for (const name of MIGRATE_LEGACY_YAML_FILES) {
|
|
8805
|
-
if (isFile(
|
|
8734
|
+
if (isFile(path4.join(project_root, name))) {
|
|
8806
8735
|
found.push(name);
|
|
8807
|
-
} else if (isFile(
|
|
8736
|
+
} else if (isFile(path4.join(project_root, "settings", name))) {
|
|
8808
8737
|
found.push(`settings/${name}`);
|
|
8809
8738
|
}
|
|
8810
8739
|
}
|
|
8811
8740
|
for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
|
|
8812
|
-
const p =
|
|
8741
|
+
const p = path4.join(project_root, name);
|
|
8813
8742
|
if (isDir(p) && !isSymlink(p)) {
|
|
8814
8743
|
found.push(`${name}/`);
|
|
8815
8744
|
}
|
|
@@ -8821,7 +8750,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
|
|
|
8821
8750
|
process2.stdout.write("\n");
|
|
8822
8751
|
warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
|
|
8823
8752
|
for (const rel of artefacts) {
|
|
8824
|
-
info(` ${
|
|
8753
|
+
info(` ${path4.join(project_root, rel)}`);
|
|
8825
8754
|
}
|
|
8826
8755
|
info("The unified `agent-config migrate` sweeps these in one pass.");
|
|
8827
8756
|
info("The wizard recreates fresh config afterwards.");
|
|
@@ -8852,20 +8781,20 @@ function _run_migrate_to_global(project_root) {
|
|
|
8852
8781
|
function _format_global_root_for_marker(global_root) {
|
|
8853
8782
|
const home = resolvePath(os2.homedir());
|
|
8854
8783
|
const resolved = resolvePath(global_root);
|
|
8855
|
-
const rel =
|
|
8856
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
8784
|
+
const rel = path4.relative(home, resolved);
|
|
8785
|
+
if (rel === "" || rel.startsWith("..") || path4.isAbsolute(rel)) {
|
|
8857
8786
|
return global_root;
|
|
8858
8787
|
}
|
|
8859
|
-
return `~/${rel.split(
|
|
8788
|
+
return `~/${rel.split(path4.sep).join("/")}`;
|
|
8860
8789
|
}
|
|
8861
8790
|
function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
|
|
8862
8791
|
const env_map = env ?? process2.env;
|
|
8863
8792
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
|
|
8864
|
-
if (isDir(
|
|
8865
|
-
const target =
|
|
8793
|
+
if (isDir(path4.join(project_root, ".agent-src.uncondensed"))) return null;
|
|
8794
|
+
const target = path4.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
|
|
8866
8795
|
if (!isFile(target)) return null;
|
|
8867
8796
|
try {
|
|
8868
|
-
|
|
8797
|
+
fs5.rmSync(target);
|
|
8869
8798
|
} catch {
|
|
8870
8799
|
return null;
|
|
8871
8800
|
}
|
|
@@ -8879,7 +8808,7 @@ var PROJECT_ANCHOR_TOOLS = {
|
|
|
8879
8808
|
function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
|
|
8880
8809
|
const env_map = env ?? process2.env;
|
|
8881
8810
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
|
|
8882
|
-
if (isDir(
|
|
8811
|
+
if (isDir(path4.join(project_root, ".agent-src.uncondensed"))) return [];
|
|
8883
8812
|
const global_root_str = _format_global_root_for_marker(
|
|
8884
8813
|
event4u_root(env_map)
|
|
8885
8814
|
);
|
|
@@ -8888,8 +8817,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
|
|
|
8888
8817
|
for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
|
|
8889
8818
|
const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
|
|
8890
8819
|
if (!tools.has(tool_id)) continue;
|
|
8891
|
-
const target =
|
|
8892
|
-
mkdirp(
|
|
8820
|
+
const target = path4.join(project_root, rel_path);
|
|
8821
|
+
mkdirp(path4.dirname(target));
|
|
8893
8822
|
const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
|
|
8894
8823
|
# Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
|
|
8895
8824
|
# Tool: ${tool_id}. Resolves the global install directly \u2014 no
|
|
@@ -8907,7 +8836,7 @@ installed_at: ${stamp}
|
|
|
8907
8836
|
}
|
|
8908
8837
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
8909
8838
|
function _inject_package_tag(target, source, package_root) {
|
|
8910
|
-
if (
|
|
8839
|
+
if (path4.extname(target) !== ".md") return;
|
|
8911
8840
|
let text;
|
|
8912
8841
|
try {
|
|
8913
8842
|
text = readText(target);
|
|
@@ -8935,8 +8864,8 @@ function _inject_package_tag(target, source, package_root) {
|
|
|
8935
8864
|
resolved_src = source;
|
|
8936
8865
|
}
|
|
8937
8866
|
if (package_root !== null) {
|
|
8938
|
-
const rel =
|
|
8939
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
8867
|
+
const rel = path4.relative(resolvePath(package_root), resolved_src);
|
|
8868
|
+
if (rel !== "" && !rel.startsWith("..") && !path4.isAbsolute(rel)) {
|
|
8940
8869
|
source_value = rel;
|
|
8941
8870
|
} else {
|
|
8942
8871
|
source_value = resolved_src;
|
|
@@ -8971,7 +8900,7 @@ function _escapes_package_root(resolved, package_root) {
|
|
|
8971
8900
|
if (package_root === null) return false;
|
|
8972
8901
|
let root;
|
|
8973
8902
|
try {
|
|
8974
|
-
root =
|
|
8903
|
+
root = fs5.realpathSync(package_root);
|
|
8975
8904
|
} catch {
|
|
8976
8905
|
return false;
|
|
8977
8906
|
}
|
|
@@ -8986,7 +8915,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
8986
8915
|
if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
|
|
8987
8916
|
let resolved_src = src;
|
|
8988
8917
|
try {
|
|
8989
|
-
resolved_src =
|
|
8918
|
+
resolved_src = fs5.realpathSync(src);
|
|
8990
8919
|
} catch {
|
|
8991
8920
|
resolved_src = src;
|
|
8992
8921
|
}
|
|
@@ -8994,10 +8923,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
8994
8923
|
warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
|
|
8995
8924
|
return [0, 0, written_paths];
|
|
8996
8925
|
}
|
|
8997
|
-
mkdirp(
|
|
8926
|
+
mkdirp(path4.dirname(dest));
|
|
8998
8927
|
const decision = _resolve_file_conflict(dest, force);
|
|
8999
8928
|
if (decision === "skip") return [0, 1, written_paths];
|
|
9000
|
-
|
|
8929
|
+
fs5.copyFileSync(src, dest);
|
|
9001
8930
|
_inject_package_tag(dest, src, package_root);
|
|
9002
8931
|
written_paths.push(dest);
|
|
9003
8932
|
return [1, 0, written_paths];
|
|
@@ -9005,11 +8934,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
9005
8934
|
mkdirp(dest);
|
|
9006
8935
|
const walk = (node) => {
|
|
9007
8936
|
const acc = [];
|
|
9008
|
-
const names =
|
|
8937
|
+
const names = fs5.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
9009
8938
|
for (const name of names) {
|
|
9010
|
-
const entry =
|
|
8939
|
+
const entry = path4.join(node, name);
|
|
9011
8940
|
acc.push(entry);
|
|
9012
|
-
const lst =
|
|
8941
|
+
const lst = fs5.lstatSync(entry);
|
|
9013
8942
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
9014
8943
|
acc.push(...walk(entry));
|
|
9015
8944
|
}
|
|
@@ -9017,9 +8946,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
9017
8946
|
return acc;
|
|
9018
8947
|
};
|
|
9019
8948
|
for (const entry of walk(src)) {
|
|
9020
|
-
const rel =
|
|
9021
|
-
const target =
|
|
9022
|
-
const lst =
|
|
8949
|
+
const rel = path4.relative(src, entry);
|
|
8950
|
+
const target = path4.join(dest, rel);
|
|
8951
|
+
const lst = fs5.lstatSync(entry);
|
|
9023
8952
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
9024
8953
|
mkdirp(target);
|
|
9025
8954
|
continue;
|
|
@@ -9027,8 +8956,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
9027
8956
|
let resolvedIsDir = false;
|
|
9028
8957
|
let resolved = entry;
|
|
9029
8958
|
try {
|
|
9030
|
-
resolved =
|
|
9031
|
-
resolvedIsDir =
|
|
8959
|
+
resolved = fs5.realpathSync(entry);
|
|
8960
|
+
resolvedIsDir = fs5.statSync(entry).isDirectory();
|
|
9032
8961
|
} catch {
|
|
9033
8962
|
resolvedIsDir = false;
|
|
9034
8963
|
}
|
|
@@ -9058,8 +8987,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
9058
8987
|
skipped += 1;
|
|
9059
8988
|
continue;
|
|
9060
8989
|
}
|
|
9061
|
-
mkdirp(
|
|
9062
|
-
|
|
8990
|
+
mkdirp(path4.dirname(target));
|
|
8991
|
+
fs5.copyFileSync(resolved, target);
|
|
9063
8992
|
_inject_package_tag(target, resolved, package_root);
|
|
9064
8993
|
written += 1;
|
|
9065
8994
|
written_paths.push(target);
|
|
@@ -9071,7 +9000,7 @@ function _claude_desktop_bundles_dir() {
|
|
|
9071
9000
|
}
|
|
9072
9001
|
function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
|
|
9073
9002
|
const anchor = expanduser2(USER_SCOPE_PATHS["claude-desktop"]);
|
|
9074
|
-
const target =
|
|
9003
|
+
const target = path4.join(anchor, "agent-config.md");
|
|
9075
9004
|
mkdirp(anchor);
|
|
9076
9005
|
const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
|
|
9077
9006
|
writeText(target, body);
|
|
@@ -9095,23 +9024,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
9095
9024
|
const wrapped = [];
|
|
9096
9025
|
const collisions = [];
|
|
9097
9026
|
const reserved = [];
|
|
9098
|
-
const commands_dir =
|
|
9027
|
+
const commands_dir = path4.join(anchor, "commands");
|
|
9099
9028
|
let flat_entries = [];
|
|
9100
9029
|
try {
|
|
9101
|
-
flat_entries =
|
|
9030
|
+
flat_entries = fs5.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
|
|
9102
9031
|
} catch {
|
|
9103
9032
|
}
|
|
9104
9033
|
for (const fname of flat_entries.sort()) {
|
|
9105
9034
|
const slug = fname.slice(0, -".md".length);
|
|
9106
9035
|
if (!is_claude_builtin_name(slug)) continue;
|
|
9107
|
-
|
|
9036
|
+
fs5.rmSync(path4.join(commands_dir, fname), { force: true });
|
|
9108
9037
|
current_files.delete(`commands/${fname}`);
|
|
9109
9038
|
reserved.push(slug);
|
|
9110
9039
|
}
|
|
9111
9040
|
const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
|
|
9112
9041
|
try {
|
|
9113
9042
|
const manifest = JSON.parse(
|
|
9114
|
-
|
|
9043
|
+
fs5.readFileSync(path4.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
|
|
9115
9044
|
);
|
|
9116
9045
|
for (const a of manifest.artefacts ?? []) {
|
|
9117
9046
|
if (a.category !== "command" || typeof a.slug !== "string") continue;
|
|
@@ -9122,22 +9051,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
9122
9051
|
}
|
|
9123
9052
|
for (const slug of [...eligible].sort()) {
|
|
9124
9053
|
const flat_rel = `commands/${slug}.md`;
|
|
9125
|
-
const flat_abs =
|
|
9126
|
-
if (!
|
|
9127
|
-
const skill_dir =
|
|
9128
|
-
if (
|
|
9054
|
+
const flat_abs = path4.join(anchor, "commands", `${slug}.md`);
|
|
9055
|
+
if (!fs5.existsSync(flat_abs)) continue;
|
|
9056
|
+
const skill_dir = path4.join(anchor, "skills", slug);
|
|
9057
|
+
if (fs5.existsSync(skill_dir)) {
|
|
9129
9058
|
collisions.push(slug);
|
|
9130
9059
|
continue;
|
|
9131
9060
|
}
|
|
9132
|
-
let body =
|
|
9061
|
+
let body = fs5.readFileSync(flat_abs, "utf8");
|
|
9133
9062
|
if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
|
|
9134
9063
|
body = body.replace("---\n", `---
|
|
9135
9064
|
name: ${slug}
|
|
9136
9065
|
`);
|
|
9137
9066
|
}
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9067
|
+
fs5.mkdirSync(skill_dir, { recursive: true });
|
|
9068
|
+
fs5.writeFileSync(path4.join(skill_dir, "SKILL.md"), body, "utf8");
|
|
9069
|
+
fs5.rmSync(flat_abs, { force: true });
|
|
9141
9070
|
current_files.delete(flat_rel);
|
|
9142
9071
|
current_files.add(`skills/${slug}/SKILL.md`);
|
|
9143
9072
|
wrapped.push(slug);
|
|
@@ -9169,8 +9098,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
9169
9098
|
const written_paths = [];
|
|
9170
9099
|
let current_files = /* @__PURE__ */ new Set();
|
|
9171
9100
|
for (const [src_rel, dest_sub] of plan) {
|
|
9172
|
-
const src =
|
|
9173
|
-
const dest = dest_sub ?
|
|
9101
|
+
const src = path4.join(package_root, src_rel);
|
|
9102
|
+
const dest = dest_sub ? path4.join(anchor, dest_sub) : anchor;
|
|
9174
9103
|
const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
|
|
9175
9104
|
const [w, s, paths] = _copy_dir_dereferencing_symlinks(
|
|
9176
9105
|
src,
|
|
@@ -9244,10 +9173,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
9244
9173
|
results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
|
|
9245
9174
|
if (tool_id === "claude-code") {
|
|
9246
9175
|
try {
|
|
9247
|
-
const manifest =
|
|
9176
|
+
const manifest = path4.join(package_root, "src", "scripts", "hook_manifest.yaml");
|
|
9248
9177
|
const matrix = build_claude_hook_matrix(manifest);
|
|
9249
9178
|
const res = ensure_managed_hooks(
|
|
9250
|
-
|
|
9179
|
+
path4.join(anchor, "settings.json"),
|
|
9251
9180
|
matrix
|
|
9252
9181
|
);
|
|
9253
9182
|
if (!state.QUIET) {
|
|
@@ -9284,7 +9213,7 @@ function _preview_global_reap(tools, package_root) {
|
|
|
9284
9213
|
const anchor = expanduser2(anchor_raw);
|
|
9285
9214
|
let current_files = /* @__PURE__ */ new Set();
|
|
9286
9215
|
for (const [src_rel, dest_sub] of plan) {
|
|
9287
|
-
const src =
|
|
9216
|
+
const src = path4.join(package_root, src_rel);
|
|
9288
9217
|
current_files = setUnion(
|
|
9289
9218
|
current_files,
|
|
9290
9219
|
expected_deploy_files(
|
|
@@ -9318,14 +9247,14 @@ function _preview_global_reap(tools, package_root) {
|
|
|
9318
9247
|
function _verify_deploy_targets(anchor, plan) {
|
|
9319
9248
|
const missing = [];
|
|
9320
9249
|
for (const [, dest_sub] of plan) {
|
|
9321
|
-
const target = dest_sub ?
|
|
9250
|
+
const target = dest_sub ? path4.join(anchor, dest_sub) : anchor;
|
|
9322
9251
|
const label = dest_sub || ".";
|
|
9323
9252
|
if (!isDir(target)) {
|
|
9324
9253
|
missing.push(label);
|
|
9325
9254
|
continue;
|
|
9326
9255
|
}
|
|
9327
9256
|
try {
|
|
9328
|
-
const entries =
|
|
9257
|
+
const entries = fs5.readdirSync(target);
|
|
9329
9258
|
if (entries.length === 0) missing.push(label);
|
|
9330
9259
|
} catch {
|
|
9331
9260
|
missing.push(label);
|
|
@@ -9340,13 +9269,13 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
9340
9269
|
const [written, skipped, status, paths] = deploy_results[tool_id];
|
|
9341
9270
|
const pruned_skill_dirs = /* @__PURE__ */ new Set();
|
|
9342
9271
|
for (const p of paths) {
|
|
9343
|
-
const parts = p.split(
|
|
9272
|
+
const parts = p.split(path4.sep);
|
|
9344
9273
|
if (parts.includes("skills")) {
|
|
9345
9274
|
const i = parts.indexOf("skills");
|
|
9346
9275
|
if (i + 1 < parts.length) {
|
|
9347
|
-
const skill_root = parts.slice(0, i + 2).join(
|
|
9276
|
+
const skill_root = parts.slice(0, i + 2).join(path4.sep);
|
|
9348
9277
|
if (!pruned_skill_dirs.has(skill_root)) {
|
|
9349
|
-
const skillmd =
|
|
9278
|
+
const skillmd = path4.join(skill_root, "SKILL.md");
|
|
9350
9279
|
if (pathExists(skillmd) && is_pruned(skillmd)) {
|
|
9351
9280
|
pruned_skill_dirs.add(skill_root);
|
|
9352
9281
|
}
|
|
@@ -9357,25 +9286,25 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
9357
9286
|
const keep = [];
|
|
9358
9287
|
const delete_files = [];
|
|
9359
9288
|
for (const p of paths) {
|
|
9360
|
-
const parts = p.split(
|
|
9289
|
+
const parts = p.split(path4.sep);
|
|
9361
9290
|
let is_target = false;
|
|
9362
9291
|
if (parts.includes("skills")) {
|
|
9363
9292
|
const i = parts.indexOf("skills");
|
|
9364
|
-
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(
|
|
9293
|
+
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path4.sep))) {
|
|
9365
9294
|
is_target = true;
|
|
9366
9295
|
}
|
|
9367
|
-
} else if (parts.includes("commands") &&
|
|
9296
|
+
} else if (parts.includes("commands") && path4.extname(p) === ".md" && is_pruned(p)) {
|
|
9368
9297
|
is_target = true;
|
|
9369
9298
|
}
|
|
9370
9299
|
(is_target ? delete_files : keep).push(p);
|
|
9371
9300
|
}
|
|
9372
9301
|
for (const d of pruned_skill_dirs) {
|
|
9373
|
-
|
|
9302
|
+
fs5.rmSync(d, { recursive: true, force: true });
|
|
9374
9303
|
}
|
|
9375
9304
|
for (const p of delete_files) {
|
|
9376
|
-
if (p.split(
|
|
9305
|
+
if (p.split(path4.sep).includes("commands") && pathExists(p)) {
|
|
9377
9306
|
try {
|
|
9378
|
-
|
|
9307
|
+
fs5.unlinkSync(p);
|
|
9379
9308
|
} catch {
|
|
9380
9309
|
}
|
|
9381
9310
|
}
|
|
@@ -9388,64 +9317,17 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
9388
9317
|
function _prune_lab_modules(deploy_results, lab_ids) {
|
|
9389
9318
|
return _prune_modules_by(deploy_results, (p) => is_lab_artefact(p, lab_ids));
|
|
9390
9319
|
}
|
|
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
|
-
}
|
|
9320
|
+
var _load_packs_registry = load_packs_registry;
|
|
9321
|
+
var _compute_active_pack_ids = compute_active_pack_ids;
|
|
9440
9322
|
function _resolve_global_settings_doc() {
|
|
9441
9323
|
const p = _resolve_global_settings_path();
|
|
9442
9324
|
return p === null ? null : _load_yaml_doc(p);
|
|
9443
9325
|
}
|
|
9444
9326
|
function _resolve_global_settings_path() {
|
|
9445
9327
|
const root = event4u_root();
|
|
9446
|
-
const canonical =
|
|
9328
|
+
const canonical = path4.join(root, "settings", SETTINGS_FILE);
|
|
9447
9329
|
if (pathExists(canonical)) return canonical;
|
|
9448
|
-
const legacy =
|
|
9330
|
+
const legacy = path4.join(root, SETTINGS_FILE);
|
|
9449
9331
|
if (pathExists(legacy)) return legacy;
|
|
9450
9332
|
return null;
|
|
9451
9333
|
}
|
|
@@ -9462,7 +9344,7 @@ function _resolve_global_rule_scope(package_root) {
|
|
|
9462
9344
|
const settings_path = _resolve_global_settings_path();
|
|
9463
9345
|
if (settings_path === null) {
|
|
9464
9346
|
try {
|
|
9465
|
-
return ruleScopeFromSettings(_load_default_settings(package_root));
|
|
9347
|
+
return ruleScopeFromSettings(_load_default_settings(package_root), package_root);
|
|
9466
9348
|
} catch {
|
|
9467
9349
|
return LEGACY_ALL;
|
|
9468
9350
|
}
|
|
@@ -9484,7 +9366,7 @@ function _resolve_global_rule_scope(package_root) {
|
|
|
9484
9366
|
return LEGACY_ALL;
|
|
9485
9367
|
}
|
|
9486
9368
|
try {
|
|
9487
|
-
return ruleScopeFromSettings(parsed);
|
|
9369
|
+
return ruleScopeFromSettings(parsed, package_root);
|
|
9488
9370
|
} catch (e) {
|
|
9489
9371
|
warn(
|
|
9490
9372
|
`could not derive rule scope from ${settings_path} (${String(e)}) \u2014 falling back to legacy-all; ALL rules will be installed.`
|
|
@@ -9497,14 +9379,10 @@ function _rule_filter_for_source(src_rel, scope) {
|
|
|
9497
9379
|
return (srcFile) => ruleFileArrives(srcFile, scope);
|
|
9498
9380
|
}
|
|
9499
9381
|
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
|
-
});
|
|
9382
|
+
return _prune_modules_by(
|
|
9383
|
+
deploy_results,
|
|
9384
|
+
(p) => is_pruned_under_scoped(p, active_ids)
|
|
9385
|
+
);
|
|
9508
9386
|
}
|
|
9509
9387
|
function install_global(tools, force, project_root = null, core_only = false) {
|
|
9510
9388
|
const migrated = migrate_legacy_namespace();
|
|
@@ -9560,7 +9438,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
9560
9438
|
info(` schema_version=1, agent_config_version=${installed_version}`);
|
|
9561
9439
|
info(` tools=${merged_tools.join(",")}`);
|
|
9562
9440
|
}
|
|
9563
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
9441
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path4.join(project_root, ".agent-src.uncondensed"))) {
|
|
9564
9442
|
const drift = collect_drift(project_root);
|
|
9565
9443
|
if (!state.QUIET) {
|
|
9566
9444
|
process2.stdout.write("\n");
|
|
@@ -9660,19 +9538,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
9660
9538
|
}
|
|
9661
9539
|
}
|
|
9662
9540
|
}
|
|
9663
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
9541
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path4.join(project_root, ".agent-src.uncondensed"))) {
|
|
9664
9542
|
const files_by_tool = _files_by_tool_from_deploy(deploy_results);
|
|
9665
9543
|
const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
|
|
9666
9544
|
if (rc !== 0) return rc;
|
|
9667
9545
|
const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
|
|
9668
9546
|
if (removed_marker !== null && !state.QUIET) {
|
|
9669
|
-
const rel = isRelativeTo(removed_marker, project_root) ?
|
|
9547
|
+
const rel = isRelativeTo(removed_marker, project_root) ? path4.relative(project_root, removed_marker) : removed_marker;
|
|
9670
9548
|
info(`Removed legacy bridge marker: ${rel}`);
|
|
9671
9549
|
}
|
|
9672
9550
|
const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
|
|
9673
9551
|
if (anchor_paths.length > 0 && !state.QUIET) {
|
|
9674
9552
|
for (const p of anchor_paths) {
|
|
9675
|
-
const rel = isRelativeTo(p, project_root) ?
|
|
9553
|
+
const rel = isRelativeTo(p, project_root) ? path4.relative(project_root, p) : p;
|
|
9676
9554
|
info(`Project anchor written: ${rel}`);
|
|
9677
9555
|
}
|
|
9678
9556
|
}
|
|
@@ -9689,8 +9567,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
9689
9567
|
}
|
|
9690
9568
|
return 0;
|
|
9691
9569
|
}
|
|
9692
|
-
var SETTINGS_SURFACE_REL =
|
|
9693
|
-
var SETTINGS_DELTA_REL =
|
|
9570
|
+
var SETTINGS_SURFACE_REL = path4.join("state", "settings-surface.json");
|
|
9571
|
+
var SETTINGS_DELTA_REL = path4.join("state", "settings-delta.json");
|
|
9694
9572
|
function _current_settings_surface(version) {
|
|
9695
9573
|
const jsonSchema = zodToJsonSchema(settingsSchema, {
|
|
9696
9574
|
name: "AgentSettings",
|
|
@@ -9701,20 +9579,20 @@ function _current_settings_surface(version) {
|
|
|
9701
9579
|
}
|
|
9702
9580
|
function _write_settings_surface_snapshot(installed_version) {
|
|
9703
9581
|
const root = event4u_root();
|
|
9704
|
-
const surface_path =
|
|
9705
|
-
const delta_path =
|
|
9582
|
+
const surface_path = path4.join(root, SETTINGS_SURFACE_REL);
|
|
9583
|
+
const delta_path = path4.join(root, SETTINGS_DELTA_REL);
|
|
9706
9584
|
const next = _current_settings_surface(installed_version);
|
|
9707
9585
|
let previous = null;
|
|
9708
9586
|
try {
|
|
9709
|
-
const parsed = JSON.parse(
|
|
9587
|
+
const parsed = JSON.parse(fs5.readFileSync(surface_path, "utf8"));
|
|
9710
9588
|
if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
|
|
9711
9589
|
} catch {
|
|
9712
9590
|
}
|
|
9713
9591
|
if (previous !== null && previous.version !== next.version) {
|
|
9714
9592
|
const delta = computeSurfaceDelta(previous, next);
|
|
9715
9593
|
if (delta.changes.length > 0) {
|
|
9716
|
-
|
|
9717
|
-
|
|
9594
|
+
fs5.mkdirSync(path4.dirname(delta_path), { recursive: true, mode: 448 });
|
|
9595
|
+
fs5.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
|
|
9718
9596
|
`, { mode: 384 });
|
|
9719
9597
|
if (!state.QUIET) {
|
|
9720
9598
|
const counts = {};
|
|
@@ -9726,8 +9604,8 @@ function _write_settings_surface_snapshot(installed_version) {
|
|
|
9726
9604
|
}
|
|
9727
9605
|
}
|
|
9728
9606
|
}
|
|
9729
|
-
|
|
9730
|
-
|
|
9607
|
+
fs5.mkdirSync(path4.dirname(surface_path), { recursive: true, mode: 448 });
|
|
9608
|
+
fs5.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
|
|
9731
9609
|
`, { mode: 384 });
|
|
9732
9610
|
}
|
|
9733
9611
|
function arrayStrEqual(a, b) {
|
|
@@ -9939,13 +9817,13 @@ function _minimal_templates_root() {
|
|
|
9939
9817
|
const chain = [start];
|
|
9940
9818
|
let cur = start;
|
|
9941
9819
|
for (; ; ) {
|
|
9942
|
-
const parent =
|
|
9820
|
+
const parent = path4.dirname(cur);
|
|
9943
9821
|
if (parent === cur) break;
|
|
9944
9822
|
chain.push(parent);
|
|
9945
9823
|
cur = parent;
|
|
9946
9824
|
}
|
|
9947
9825
|
for (const ancestor of chain) {
|
|
9948
|
-
const candidate =
|
|
9826
|
+
const candidate = path4.join(ancestor, "src", "templates", "minimal");
|
|
9949
9827
|
if (isDir(candidate)) return candidate;
|
|
9950
9828
|
}
|
|
9951
9829
|
fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
|
|
@@ -9953,9 +9831,9 @@ function _minimal_templates_root() {
|
|
|
9953
9831
|
var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
9954
9832
|
function _write_install_mode_marker(project_root, mode) {
|
|
9955
9833
|
if (mode !== "minimal" && mode !== "full") return;
|
|
9956
|
-
const marker =
|
|
9834
|
+
const marker = path4.join(project_root, INSTALL_MODE_MARKER_REL);
|
|
9957
9835
|
try {
|
|
9958
|
-
mkdirp(
|
|
9836
|
+
mkdirp(path4.dirname(marker));
|
|
9959
9837
|
writeText(marker, `${mode}
|
|
9960
9838
|
`);
|
|
9961
9839
|
} catch {
|
|
@@ -9964,7 +9842,7 @@ function _write_install_mode_marker(project_root, mode) {
|
|
|
9964
9842
|
function install_minimal(target_root_in, force, user_type = "") {
|
|
9965
9843
|
let target_root = resolvePath(target_root_in);
|
|
9966
9844
|
mkdirp(target_root);
|
|
9967
|
-
const parent =
|
|
9845
|
+
const parent = path4.dirname(target_root);
|
|
9968
9846
|
if (parent !== target_root) {
|
|
9969
9847
|
const existing = find_project_root_with_anchor(parent);
|
|
9970
9848
|
if (existing !== null && existing[0] !== target_root) {
|
|
@@ -9975,21 +9853,21 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
9975
9853
|
}
|
|
9976
9854
|
}
|
|
9977
9855
|
const templates = _minimal_templates_root();
|
|
9978
|
-
const settings_src =
|
|
9979
|
-
const overrides_gitkeep_src =
|
|
9980
|
-
const overrides_readme_src =
|
|
9856
|
+
const settings_src = path4.join(templates, SETTINGS_FILE);
|
|
9857
|
+
const overrides_gitkeep_src = path4.join(templates, "overrides-gitkeep");
|
|
9858
|
+
const overrides_readme_src = path4.join(templates, "agents-overrides-readme.md");
|
|
9981
9859
|
if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
|
|
9982
9860
|
if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
|
|
9983
9861
|
fail(`Bundled overrides scaffold templates missing under ${templates}`);
|
|
9984
9862
|
}
|
|
9985
9863
|
info(`Minimal init \u2192 ${target_root}`);
|
|
9986
|
-
const overrides_root =
|
|
9864
|
+
const overrides_root = path4.join(target_root, "agents", "overrides");
|
|
9987
9865
|
mkdirp(overrides_root);
|
|
9988
9866
|
const gitkeep_body = readText(overrides_gitkeep_src);
|
|
9989
9867
|
for (const sub of ["rules", "skills", "commands"]) {
|
|
9990
|
-
const sub_dir =
|
|
9868
|
+
const sub_dir = path4.join(overrides_root, sub);
|
|
9991
9869
|
mkdirp(sub_dir);
|
|
9992
|
-
const gitkeep_dst =
|
|
9870
|
+
const gitkeep_dst = path4.join(sub_dir, ".gitkeep");
|
|
9993
9871
|
if (pathExists(gitkeep_dst) && !force) {
|
|
9994
9872
|
skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
|
|
9995
9873
|
} else {
|
|
@@ -9997,7 +9875,7 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
9997
9875
|
success(`Wrote agents/overrides/${sub}/.gitkeep`);
|
|
9998
9876
|
}
|
|
9999
9877
|
}
|
|
10000
|
-
const readme_dst =
|
|
9878
|
+
const readme_dst = path4.join(overrides_root, "README.md");
|
|
10001
9879
|
if (pathExists(readme_dst) && !force) {
|
|
10002
9880
|
skip("agents/overrides/README.md already exists (use --force to overwrite)");
|
|
10003
9881
|
} else {
|
|
@@ -10015,14 +9893,14 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
10015
9893
|
personal:
|
|
10016
9894
|
user_type: ${user_type}
|
|
10017
9895
|
`;
|
|
10018
|
-
mkdirp(
|
|
9896
|
+
mkdirp(path4.dirname(settings_dst));
|
|
10019
9897
|
writeText(settings_dst, body);
|
|
10020
9898
|
success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
|
|
10021
9899
|
}
|
|
10022
9900
|
}
|
|
10023
9901
|
const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
|
|
10024
9902
|
if (removed_marker !== null) {
|
|
10025
|
-
const rel = isRelativeTo(removed_marker, target_root) ?
|
|
9903
|
+
const rel = isRelativeTo(removed_marker, target_root) ? path4.relative(target_root, removed_marker) : removed_marker;
|
|
10026
9904
|
success(`Removed legacy bridge marker: ${rel}`);
|
|
10027
9905
|
}
|
|
10028
9906
|
_write_install_mode_marker(target_root, "minimal");
|
|
@@ -10096,7 +9974,7 @@ function run_interactive_init(project_root, force) {
|
|
|
10096
9974
|
);
|
|
10097
9975
|
return 0;
|
|
10098
9976
|
}
|
|
10099
|
-
const target =
|
|
9977
|
+
const target = path4.join(project_root, _LOCAL_CONFIG_FILE);
|
|
10100
9978
|
if (pathExists(target) && !force) {
|
|
10101
9979
|
warn(
|
|
10102
9980
|
`${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
|
|
@@ -10123,7 +10001,7 @@ function run_interactive_init(project_root, force) {
|
|
|
10123
10001
|
warn(`Could not write ${target}: ${String(exc)}`);
|
|
10124
10002
|
return 1;
|
|
10125
10003
|
}
|
|
10126
|
-
success(`Wrote ${
|
|
10004
|
+
success(`Wrote ${path4.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
|
|
10127
10005
|
return 0;
|
|
10128
10006
|
}
|
|
10129
10007
|
var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
|
|
@@ -10141,12 +10019,12 @@ function _wizard_should_launch(opts) {
|
|
|
10141
10019
|
return [true, ""];
|
|
10142
10020
|
}
|
|
10143
10021
|
function _wizard_cli_dist(_project_root) {
|
|
10144
|
-
const package_root =
|
|
10145
|
-
const cli =
|
|
10022
|
+
const package_root = path4.dirname(path4.dirname(path4.dirname(resolvePath(_HERE))));
|
|
10023
|
+
const cli = path4.join(package_root, "dist", "cli", "agent-config.js");
|
|
10146
10024
|
return pathExists(cli) ? cli : null;
|
|
10147
10025
|
}
|
|
10148
10026
|
function _server_info_path() {
|
|
10149
|
-
return
|
|
10027
|
+
return path4.join(os2.homedir(), ".event4u", "agent-config", "local-server.json");
|
|
10150
10028
|
}
|
|
10151
10029
|
function _pid_is_agent_config(pid) {
|
|
10152
10030
|
let res;
|
|
@@ -10163,7 +10041,7 @@ function _pid_is_agent_config(pid) {
|
|
|
10163
10041
|
}
|
|
10164
10042
|
function unlinkMissingOk(p) {
|
|
10165
10043
|
try {
|
|
10166
|
-
|
|
10044
|
+
fs5.unlinkSync(p);
|
|
10167
10045
|
} catch {
|
|
10168
10046
|
}
|
|
10169
10047
|
}
|
|
@@ -10241,14 +10119,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
|
|
|
10241
10119
|
}
|
|
10242
10120
|
function _wizard_run_sync(cmd, env, cli) {
|
|
10243
10121
|
const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
|
|
10244
|
-
const log_path =
|
|
10122
|
+
const log_path = path4.join(
|
|
10245
10123
|
os2.tmpdir(),
|
|
10246
10124
|
`agent-config-wizard-${process2.pid}-${Date.now()}.log`
|
|
10247
10125
|
);
|
|
10248
10126
|
let child;
|
|
10249
10127
|
let log_fd = null;
|
|
10250
10128
|
try {
|
|
10251
|
-
log_fd =
|
|
10129
|
+
log_fd = fs5.openSync(log_path, "w");
|
|
10252
10130
|
child = spawn(cmd[0], cmd.slice(1), {
|
|
10253
10131
|
env,
|
|
10254
10132
|
detached: true,
|
|
@@ -10266,7 +10144,7 @@ function _wizard_run_sync(cmd, env, cli) {
|
|
|
10266
10144
|
} finally {
|
|
10267
10145
|
if (log_fd !== null) {
|
|
10268
10146
|
try {
|
|
10269
|
-
|
|
10147
|
+
fs5.closeSync(log_fd);
|
|
10270
10148
|
} catch {
|
|
10271
10149
|
}
|
|
10272
10150
|
}
|
|
@@ -10516,8 +10394,8 @@ function main2(argv) {
|
|
|
10516
10394
|
const target_root = resolvePath(
|
|
10517
10395
|
opts.custom_path || opts.project || process2.env["PROJECT_ROOT"] || process2.cwd()
|
|
10518
10396
|
);
|
|
10519
|
-
const minimal_package_root =
|
|
10520
|
-
|
|
10397
|
+
const minimal_package_root = path4.dirname(
|
|
10398
|
+
path4.dirname(path4.dirname(_minimal_templates_root()))
|
|
10521
10399
|
);
|
|
10522
10400
|
const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
|
|
10523
10401
|
return install_minimal(target_root, opts.force, validated_user_type);
|
|
@@ -10546,7 +10424,7 @@ function main2(argv) {
|
|
|
10546
10424
|
return rc2;
|
|
10547
10425
|
}
|
|
10548
10426
|
const project_root = custom_path || resolvePath(opts.project || process2.env["PROJECT_ROOT"] || process2.cwd());
|
|
10549
|
-
const is_first_run = !pathExists(
|
|
10427
|
+
const is_first_run = !pathExists(path4.join(project_root, SETTINGS_FILE));
|
|
10550
10428
|
const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
|
|
10551
10429
|
if (rc === 0 && opts.interactive) {
|
|
10552
10430
|
run_interactive_init(project_root, opts.force);
|
|
@@ -10610,16 +10488,16 @@ function _team_setup_hint_line(project_root) {
|
|
|
10610
10488
|
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
10489
|
}
|
|
10612
10490
|
function finalize_claude_model_tiers(project_root) {
|
|
10613
|
-
const claude_skills =
|
|
10614
|
-
const augment_skills =
|
|
10491
|
+
const claude_skills = path4.join(project_root, ".claude", "skills");
|
|
10492
|
+
const augment_skills = path4.join(project_root, ".augment", "skills");
|
|
10615
10493
|
if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
|
|
10616
10494
|
if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
|
|
10617
10495
|
let rendered = 0;
|
|
10618
|
-
const entries =
|
|
10496
|
+
const entries = fs5.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
10619
10497
|
for (const name of entries) {
|
|
10620
|
-
const entry =
|
|
10621
|
-
const src_dir =
|
|
10622
|
-
const src_md =
|
|
10498
|
+
const entry = path4.join(claude_skills, name);
|
|
10499
|
+
const src_dir = path4.join(augment_skills, name);
|
|
10500
|
+
const src_md = path4.join(src_dir, "SKILL.md");
|
|
10623
10501
|
let tier;
|
|
10624
10502
|
try {
|
|
10625
10503
|
tier = read_model_tier(src_md);
|
|
@@ -10628,22 +10506,22 @@ function finalize_claude_model_tiers(project_root) {
|
|
|
10628
10506
|
}
|
|
10629
10507
|
if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
|
|
10630
10508
|
if (isSymlink(entry) || isFile(entry)) {
|
|
10631
|
-
|
|
10509
|
+
fs5.unlinkSync(entry);
|
|
10632
10510
|
} else if (isDir(entry)) {
|
|
10633
|
-
|
|
10511
|
+
fs5.rmSync(entry, { recursive: true, force: true });
|
|
10634
10512
|
}
|
|
10635
10513
|
mkdirp(entry);
|
|
10636
|
-
const srcFiles =
|
|
10514
|
+
const srcFiles = fs5.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
10637
10515
|
for (const fname of srcFiles) {
|
|
10638
10516
|
if (fname === "SKILL.md") {
|
|
10639
10517
|
writeText(
|
|
10640
|
-
|
|
10518
|
+
path4.join(entry, "SKILL.md"),
|
|
10641
10519
|
render_native_model_md(readText(src_md), tier)
|
|
10642
10520
|
);
|
|
10643
10521
|
} else {
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10522
|
+
fs5.symlinkSync(
|
|
10523
|
+
path4.join("../../../.augment/skills", name, fname),
|
|
10524
|
+
path4.join(entry, fname)
|
|
10647
10525
|
);
|
|
10648
10526
|
}
|
|
10649
10527
|
}
|
|
@@ -10661,7 +10539,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
10661
10539
|
let package_type;
|
|
10662
10540
|
if (opts.package) {
|
|
10663
10541
|
package_root = resolvePath(opts.package);
|
|
10664
|
-
if (!pathExists(
|
|
10542
|
+
if (!pathExists(path4.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
10665
10543
|
fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
|
|
10666
10544
|
}
|
|
10667
10545
|
package_type = detect_package_type_for_project(project_root, package_root);
|
|
@@ -10796,9 +10674,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
10796
10674
|
function _resolvedArgv1() {
|
|
10797
10675
|
if (process2.argv[1] === void 0) return void 0;
|
|
10798
10676
|
try {
|
|
10799
|
-
return
|
|
10677
|
+
return fs5.realpathSync(path4.resolve(process2.argv[1]));
|
|
10800
10678
|
} catch {
|
|
10801
|
-
return
|
|
10679
|
+
return path4.resolve(process2.argv[1]);
|
|
10802
10680
|
}
|
|
10803
10681
|
}
|
|
10804
10682
|
var _argv1 = _resolvedArgv1();
|