@event4u/agent-config 9.14.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 +110 -112
- package/README.md +8 -0
- 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 +5 -2
- package/dist/agent-src/commands/optimize/skills.md +5 -5
- 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-GCVFLBP2.js → chunk-H574KOUH.js} +338 -494
- 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 +127 -95
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +2 -2
- package/dist/discovery/trust-report.md +1 -1
- package/dist/discovery/workspaces.json +2 -2
- package/dist/hooks/dispatch.js +729 -430
- package/dist/install/install.mjs +52 -11
- package/dist/install/rule_scope.js +18 -2
- package/dist/install/rule_scope.js.map +1 -1
- package/dist/mcp/registry-manifest.json +2 -2
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +518 -411
- 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/gate_baseline.ts +213 -0
- package/src/scripts/_lib/scoped_projection.ts +50 -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_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/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 +2 -2
- 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 +9 -28
- 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 +1 -1
- 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,203 +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/scoped_projection.ts
|
|
384
|
-
import * as fs2 from "node:fs";
|
|
385
|
-
import { createRequire } from "node:module";
|
|
386
|
-
import * as path2 from "node:path";
|
|
387
|
-
|
|
388
|
-
// src/scripts/_lib/surface_tiers.ts
|
|
389
|
-
import * as fs from "node:fs";
|
|
390
|
-
import * as path from "node:path";
|
|
391
|
-
var _LAB_FALLBACK = /* @__PURE__ */ new Set(["ai-video", "ai-image", "fun"]);
|
|
392
|
-
function load_lab_pack_ids(repo_root) {
|
|
393
|
-
const vocab = path.join(repo_root, "src", "config", "discovery", "packs.yml");
|
|
394
|
-
const ids = /* @__PURE__ */ new Set();
|
|
395
|
-
try {
|
|
396
|
-
const YAML = require_dist();
|
|
397
|
-
const data = YAML.parse(fs.readFileSync(vocab, "utf-8"), { version: "1.1" });
|
|
398
|
-
for (const entry of data ?? []) {
|
|
399
|
-
if (entry && typeof entry === "object" && !Array.isArray(entry)) {
|
|
400
|
-
const rec = entry;
|
|
401
|
-
if (rec["surface_tier"] === "lab") {
|
|
402
|
-
const pid = rec["id"];
|
|
403
|
-
if (typeof pid === "string") {
|
|
404
|
-
ids.add(pid);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
} catch {
|
|
410
|
-
return new Set(_LAB_FALLBACK);
|
|
411
|
-
}
|
|
412
|
-
return ids.size > 0 ? ids : new Set(_LAB_FALLBACK);
|
|
413
|
-
}
|
|
414
|
-
function frontmatter_packs(md_path) {
|
|
415
|
-
let text;
|
|
416
|
-
try {
|
|
417
|
-
text = fs.readFileSync(md_path, "utf-8");
|
|
418
|
-
} catch {
|
|
419
|
-
return /* @__PURE__ */ new Set();
|
|
420
|
-
}
|
|
421
|
-
if (!text.startsWith("---")) {
|
|
422
|
-
return /* @__PURE__ */ new Set();
|
|
423
|
-
}
|
|
424
|
-
const end = text.indexOf("\n---", 3);
|
|
425
|
-
const block = end !== -1 ? text.slice(3, end) : text.slice(3);
|
|
426
|
-
const packs = /* @__PURE__ */ new Set();
|
|
427
|
-
let in_packs_list = false;
|
|
428
|
-
for (const raw of block.split("\n")) {
|
|
429
|
-
const line = raw.replace(/\s+$/, "");
|
|
430
|
-
const stripped = line.trim();
|
|
431
|
-
if (in_packs_list) {
|
|
432
|
-
if (stripped.startsWith("- ")) {
|
|
433
|
-
packs.add(_strip_quotes(stripped.slice(2).trim()));
|
|
434
|
-
continue;
|
|
435
|
-
}
|
|
436
|
-
in_packs_list = false;
|
|
437
|
-
}
|
|
438
|
-
if (stripped.startsWith("pack:")) {
|
|
439
|
-
const val = _strip_quotes(stripped.split(":").slice(1).join(":").trim());
|
|
440
|
-
if (val) {
|
|
441
|
-
packs.add(val);
|
|
442
|
-
}
|
|
443
|
-
} else if (stripped.startsWith("packs:")) {
|
|
444
|
-
const inline = stripped.split(":").slice(1).join(":").trim();
|
|
445
|
-
if (inline.startsWith("[") && inline.endsWith("]")) {
|
|
446
|
-
for (const raw_item of inline.slice(1, -1).split(",")) {
|
|
447
|
-
const item = _strip_quotes(raw_item.trim());
|
|
448
|
-
if (item) {
|
|
449
|
-
packs.add(item);
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
} else {
|
|
453
|
-
in_packs_list = true;
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
return packs;
|
|
458
|
-
}
|
|
459
|
-
function is_lab_artefact(md_path, lab_ids) {
|
|
460
|
-
for (const p of frontmatter_packs(md_path)) {
|
|
461
|
-
if (lab_ids.has(p)) {
|
|
462
|
-
return true;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
return false;
|
|
466
|
-
}
|
|
467
|
-
function _strip_quotes(s) {
|
|
468
|
-
let out = s;
|
|
469
|
-
while (out.length > 0 && (out[0] === "'" || out[0] === '"')) {
|
|
470
|
-
out = out.slice(1);
|
|
471
|
-
}
|
|
472
|
-
while (out.length > 0 && (out[out.length - 1] === "'" || out[out.length - 1] === '"')) {
|
|
473
|
-
out = out.slice(0, -1);
|
|
474
|
-
}
|
|
475
|
-
return out;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
// src/scripts/_lib/scoped_projection.ts
|
|
479
|
-
var _require = createRequire(import.meta.url);
|
|
480
|
-
var SCOPED_ACTIVE_WORKSPACES = /* @__PURE__ */ new Set([
|
|
481
|
-
"engineering",
|
|
482
|
-
"agent-config-maintainer"
|
|
483
|
-
]);
|
|
484
|
-
function isPlainObject(v) {
|
|
485
|
-
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
486
|
-
}
|
|
487
|
-
function yamlSafeLoad(text) {
|
|
488
|
-
let YAML;
|
|
489
|
-
try {
|
|
490
|
-
YAML = _require("yaml");
|
|
491
|
-
} catch {
|
|
492
|
-
return null;
|
|
493
|
-
}
|
|
494
|
-
try {
|
|
495
|
-
return YAML.parse(text, { version: "1.1" }) ?? null;
|
|
496
|
-
} catch {
|
|
497
|
-
return null;
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
var PACKS_YML_REL = path2.join("src", "config", "discovery", "packs.yml");
|
|
501
|
-
function load_packs_registry(package_root) {
|
|
502
|
-
const vocab_path = path2.join(package_root, PACKS_YML_REL);
|
|
503
|
-
const data = yamlSafeLoad(fs2.readFileSync(vocab_path, "utf-8"));
|
|
504
|
-
if (!Array.isArray(data)) {
|
|
505
|
-
throw new Error(`packs.yml did not parse to a list: ${vocab_path}`);
|
|
506
|
-
}
|
|
507
|
-
const out = [];
|
|
508
|
-
for (const entry of data) {
|
|
509
|
-
if (!isPlainObject(entry)) continue;
|
|
510
|
-
const id = entry["id"];
|
|
511
|
-
if (typeof id !== "string" || id === "") continue;
|
|
512
|
-
const workspaces_raw = entry["workspaces"];
|
|
513
|
-
const workspaces = Array.isArray(workspaces_raw) ? workspaces_raw.filter((w) => typeof w === "string") : [];
|
|
514
|
-
const requires_raw = entry["requires"] ?? entry["requires_hint"];
|
|
515
|
-
const requires = Array.isArray(requires_raw) ? requires_raw.filter((r) => typeof r === "string") : [];
|
|
516
|
-
out.push({ id, workspaces, requires });
|
|
517
|
-
}
|
|
518
|
-
return out;
|
|
519
|
-
}
|
|
520
|
-
function compute_active_pack_ids(packs, runtime_active_packs) {
|
|
521
|
-
const by_id = /* @__PURE__ */ new Map();
|
|
522
|
-
for (const p of packs) by_id.set(p.id, p);
|
|
523
|
-
const active = /* @__PURE__ */ new Set();
|
|
524
|
-
for (const p of packs) {
|
|
525
|
-
if (p.workspaces.some((w) => SCOPED_ACTIVE_WORKSPACES.has(w))) {
|
|
526
|
-
active.add(p.id);
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
for (const id of runtime_active_packs) {
|
|
530
|
-
active.add(id);
|
|
531
|
-
}
|
|
532
|
-
let frontier = [...active];
|
|
533
|
-
while (frontier.length > 0) {
|
|
534
|
-
const next = [];
|
|
535
|
-
for (const id of frontier) {
|
|
536
|
-
const rec = by_id.get(id);
|
|
537
|
-
if (rec === void 0) continue;
|
|
538
|
-
for (const dep of rec.requires) {
|
|
539
|
-
if (!active.has(dep)) {
|
|
540
|
-
active.add(dep);
|
|
541
|
-
next.push(dep);
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
frontier = next;
|
|
546
|
-
}
|
|
547
|
-
return active;
|
|
548
|
-
}
|
|
549
|
-
function is_pruned_under_scoped(md_path, active_ids) {
|
|
550
|
-
const packs = frontmatter_packs(md_path);
|
|
551
|
-
if (packs.size === 0) return false;
|
|
552
|
-
for (const id of packs) {
|
|
553
|
-
if (active_ids.has(id)) return false;
|
|
554
|
-
}
|
|
555
|
-
return true;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
388
|
// src/scripts/_lib/install_drift.ts
|
|
559
389
|
var import_yaml = __toESM(require_dist(), 1);
|
|
560
390
|
import * as crypto from "node:crypto";
|
|
561
|
-
import * as
|
|
391
|
+
import * as fs from "node:fs";
|
|
562
392
|
import * as os from "node:os";
|
|
563
|
-
import * as
|
|
393
|
+
import * as path from "node:path";
|
|
564
394
|
function expanduser(p) {
|
|
565
395
|
if (p === "~") {
|
|
566
396
|
return os.homedir();
|
|
567
397
|
}
|
|
568
398
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
569
|
-
return
|
|
399
|
+
return path.join(os.homedir(), p.slice(2));
|
|
570
400
|
}
|
|
571
401
|
return p;
|
|
572
402
|
}
|
|
573
403
|
function resolve_entry_path(project_root, raw) {
|
|
574
404
|
const p = expanduser(raw);
|
|
575
|
-
return
|
|
405
|
+
return path.isAbsolute(p) ? p : path.join(project_root, p);
|
|
576
406
|
}
|
|
577
407
|
function sha256_of_file(p) {
|
|
578
408
|
try {
|
|
579
|
-
return crypto.createHash("sha256").update(
|
|
409
|
+
return crypto.createHash("sha256").update(fs.readFileSync(p)).digest("hex");
|
|
580
410
|
} catch {
|
|
581
411
|
return null;
|
|
582
412
|
}
|
|
@@ -585,7 +415,7 @@ function collect_drift(project_root, env) {
|
|
|
585
415
|
const target = manifest_path(project_root, env);
|
|
586
416
|
let text;
|
|
587
417
|
try {
|
|
588
|
-
text =
|
|
418
|
+
text = fs.readFileSync(target, "utf-8");
|
|
589
419
|
} catch {
|
|
590
420
|
return null;
|
|
591
421
|
}
|
|
@@ -630,7 +460,7 @@ function collect_drift(project_root, env) {
|
|
|
630
460
|
continue;
|
|
631
461
|
}
|
|
632
462
|
const resolved = resolve_entry_path(project_root, raw_path);
|
|
633
|
-
if (!
|
|
463
|
+
if (!fs.existsSync(resolved)) {
|
|
634
464
|
out.push({
|
|
635
465
|
tool_id,
|
|
636
466
|
path: resolved,
|
|
@@ -684,8 +514,8 @@ function format_drift_report(entries) {
|
|
|
684
514
|
|
|
685
515
|
// src/scripts/_lib/claude_desktop_bundler.ts
|
|
686
516
|
import * as crypto2 from "node:crypto";
|
|
687
|
-
import * as
|
|
688
|
-
import * as
|
|
517
|
+
import * as fs2 from "node:fs";
|
|
518
|
+
import * as path2 from "node:path";
|
|
689
519
|
|
|
690
520
|
// src/scripts/_lib/zip_min.ts
|
|
691
521
|
import * as zlib from "node:zlib";
|
|
@@ -792,7 +622,7 @@ function _is_excluded(rel_parts) {
|
|
|
792
622
|
}
|
|
793
623
|
function _is_dir(p) {
|
|
794
624
|
try {
|
|
795
|
-
return
|
|
625
|
+
return fs2.statSync(p).isDirectory();
|
|
796
626
|
} catch {
|
|
797
627
|
return false;
|
|
798
628
|
}
|
|
@@ -804,12 +634,12 @@ function _compare_rel_parts(a, b) {
|
|
|
804
634
|
}
|
|
805
635
|
function _walk_skill_files(skill_dir) {
|
|
806
636
|
const out = [];
|
|
807
|
-
const resolved =
|
|
637
|
+
const resolved = fs2.realpathSync(skill_dir);
|
|
808
638
|
const walk = (root, relRoot) => {
|
|
809
639
|
const dirNames = [];
|
|
810
640
|
const fileNames = [];
|
|
811
|
-
for (const dirent of
|
|
812
|
-
const full =
|
|
641
|
+
for (const dirent of fs2.readdirSync(root, { withFileTypes: true })) {
|
|
642
|
+
const full = path2.join(root, dirent.name);
|
|
813
643
|
const isDir2 = dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full);
|
|
814
644
|
if (isDir2) {
|
|
815
645
|
dirNames.push(dirent.name);
|
|
@@ -822,13 +652,13 @@ function _walk_skill_files(skill_dir) {
|
|
|
822
652
|
if (_is_excluded(rel_parts)) {
|
|
823
653
|
continue;
|
|
824
654
|
}
|
|
825
|
-
out.push([
|
|
655
|
+
out.push([path2.join(root, fname), rel_parts]);
|
|
826
656
|
}
|
|
827
657
|
for (const dname of dirNames) {
|
|
828
658
|
if (_is_excluded([dname])) {
|
|
829
659
|
continue;
|
|
830
660
|
}
|
|
831
|
-
walk(
|
|
661
|
+
walk(path2.join(root, dname), [...relRoot, dname]);
|
|
832
662
|
}
|
|
833
663
|
};
|
|
834
664
|
walk(resolved, []);
|
|
@@ -841,53 +671,53 @@ function _manifest_digest(files) {
|
|
|
841
671
|
const rel = rel_parts.join("/");
|
|
842
672
|
h.update(Buffer.from(rel, "utf-8"));
|
|
843
673
|
h.update(Buffer.from([0]));
|
|
844
|
-
h.update(crypto2.createHash("sha256").update(
|
|
674
|
+
h.update(crypto2.createHash("sha256").update(fs2.readFileSync(abs_path)).digest());
|
|
845
675
|
h.update(Buffer.from([0]));
|
|
846
676
|
}
|
|
847
677
|
return h.digest("hex");
|
|
848
678
|
}
|
|
849
679
|
function _atomic_write_zip(zip_path, files) {
|
|
850
|
-
|
|
851
|
-
const stem =
|
|
852
|
-
const tmp_path =
|
|
853
|
-
|
|
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),
|
|
854
684
|
`.${stem}.${crypto2.randomBytes(6).toString("hex")}.zip.tmp`
|
|
855
685
|
);
|
|
856
686
|
try {
|
|
857
687
|
const entries = files.map(([abs_path, rel_parts]) => ({
|
|
858
688
|
name: rel_parts.join("/"),
|
|
859
|
-
data:
|
|
689
|
+
data: fs2.readFileSync(abs_path)
|
|
860
690
|
}));
|
|
861
|
-
|
|
862
|
-
|
|
691
|
+
fs2.writeFileSync(tmp_path, zip_write_sync(entries));
|
|
692
|
+
fs2.renameSync(tmp_path, zip_path);
|
|
863
693
|
} finally {
|
|
864
|
-
if (
|
|
865
|
-
|
|
694
|
+
if (fs2.existsSync(tmp_path)) {
|
|
695
|
+
fs2.unlinkSync(tmp_path);
|
|
866
696
|
}
|
|
867
697
|
}
|
|
868
698
|
}
|
|
869
699
|
function _write_if_changed(dest_dir, slug, files, force, written) {
|
|
870
700
|
const digest = _manifest_digest(files);
|
|
871
|
-
const zip_path =
|
|
872
|
-
const digest_path =
|
|
873
|
-
const recorded =
|
|
874
|
-
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)) {
|
|
875
705
|
return;
|
|
876
706
|
}
|
|
877
707
|
_atomic_write_zip(zip_path, files);
|
|
878
|
-
|
|
708
|
+
fs2.writeFileSync(digest_path, digest + "\n", "utf-8");
|
|
879
709
|
written.push(zip_path);
|
|
880
710
|
}
|
|
881
711
|
function build_skill_bundles(package_root, dest_dir, force = false, curation = null) {
|
|
882
|
-
const skills_root =
|
|
712
|
+
const skills_root = path2.join(package_root, "dist/agent-src", "skills");
|
|
883
713
|
if (!_is_dir(skills_root)) {
|
|
884
714
|
return [];
|
|
885
715
|
}
|
|
886
|
-
|
|
716
|
+
fs2.mkdirSync(dest_dir, { recursive: true });
|
|
887
717
|
const written = [];
|
|
888
|
-
for (const name of
|
|
889
|
-
const entry =
|
|
890
|
-
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();
|
|
891
721
|
if (!(_is_dir(entry) || isSymlink2)) {
|
|
892
722
|
continue;
|
|
893
723
|
}
|
|
@@ -895,8 +725,8 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
|
|
|
895
725
|
if (curation !== null && !curation.includes(skill_name)) {
|
|
896
726
|
continue;
|
|
897
727
|
}
|
|
898
|
-
const skill_md =
|
|
899
|
-
if (!
|
|
728
|
+
const skill_md = path2.join(entry, "SKILL.md");
|
|
729
|
+
if (!fs2.existsSync(skill_md)) {
|
|
900
730
|
continue;
|
|
901
731
|
}
|
|
902
732
|
const files = _walk_skill_files(entry);
|
|
@@ -908,15 +738,15 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
|
|
|
908
738
|
return written;
|
|
909
739
|
}
|
|
910
740
|
function _command_slug(source_file, commands_root) {
|
|
911
|
-
const rel =
|
|
912
|
-
const noExt = rel.slice(0, rel.length -
|
|
913
|
-
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("-");
|
|
914
744
|
}
|
|
915
745
|
function _iter_command_files(commands_root) {
|
|
916
746
|
const found = [];
|
|
917
747
|
const walk = (dir) => {
|
|
918
|
-
for (const dirent of
|
|
919
|
-
const full =
|
|
748
|
+
for (const dirent of fs2.readdirSync(dir, { withFileTypes: true })) {
|
|
749
|
+
const full = path2.join(dir, dirent.name);
|
|
920
750
|
if (dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full)) {
|
|
921
751
|
walk(full);
|
|
922
752
|
} else if (dirent.name.endsWith(".md")) {
|
|
@@ -926,21 +756,21 @@ function _iter_command_files(commands_root) {
|
|
|
926
756
|
};
|
|
927
757
|
walk(commands_root);
|
|
928
758
|
found.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
929
|
-
return found.filter((source_file) =>
|
|
759
|
+
return found.filter((source_file) => path2.basename(source_file) !== "AGENTS.md");
|
|
930
760
|
}
|
|
931
761
|
function build_command_bundles(package_root, dest_dir, force = false, curation = null) {
|
|
932
|
-
const commands_root =
|
|
762
|
+
const commands_root = path2.join(package_root, "dist/agent-src", "commands");
|
|
933
763
|
if (!_is_dir(commands_root)) {
|
|
934
764
|
return [];
|
|
935
765
|
}
|
|
936
|
-
const skills_root =
|
|
766
|
+
const skills_root = path2.join(package_root, "dist/agent-src", "skills");
|
|
937
767
|
let skill_names = /* @__PURE__ */ new Set();
|
|
938
768
|
if (_is_dir(skills_root)) {
|
|
939
769
|
skill_names = new Set(
|
|
940
|
-
|
|
770
|
+
fs2.readdirSync(skills_root).filter((name) => _is_dir(path2.join(skills_root, name)))
|
|
941
771
|
);
|
|
942
772
|
}
|
|
943
|
-
|
|
773
|
+
fs2.mkdirSync(dest_dir, { recursive: true });
|
|
944
774
|
const written = [];
|
|
945
775
|
for (const source_file of _iter_command_files(commands_root)) {
|
|
946
776
|
const slug = _command_slug(source_file, commands_root);
|
|
@@ -950,7 +780,7 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
|
|
|
950
780
|
if (curation !== null && !curation.includes(slug)) {
|
|
951
781
|
continue;
|
|
952
782
|
}
|
|
953
|
-
const files = [[
|
|
783
|
+
const files = [[fs2.realpathSync(source_file), ["SKILL.md"]]];
|
|
954
784
|
_write_if_changed(dest_dir, slug, files, force, written);
|
|
955
785
|
}
|
|
956
786
|
return written;
|
|
@@ -1504,8 +1334,8 @@ function getErrorMap() {
|
|
|
1504
1334
|
|
|
1505
1335
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
1506
1336
|
var makeIssue = (params) => {
|
|
1507
|
-
const { data, path:
|
|
1508
|
-
const fullPath = [...
|
|
1337
|
+
const { data, path: path5, errorMaps, issueData } = params;
|
|
1338
|
+
const fullPath = [...path5, ...issueData.path || []];
|
|
1509
1339
|
const fullIssue = {
|
|
1510
1340
|
...issueData,
|
|
1511
1341
|
path: fullPath
|
|
@@ -1621,11 +1451,11 @@ var errorUtil;
|
|
|
1621
1451
|
|
|
1622
1452
|
// node_modules/zod/v3/types.js
|
|
1623
1453
|
var ParseInputLazyPath = class {
|
|
1624
|
-
constructor(parent, value,
|
|
1454
|
+
constructor(parent, value, path5, key) {
|
|
1625
1455
|
this._cachedPath = [];
|
|
1626
1456
|
this.parent = parent;
|
|
1627
1457
|
this.data = value;
|
|
1628
|
-
this._path =
|
|
1458
|
+
this._path = path5;
|
|
1629
1459
|
this._key = key;
|
|
1630
1460
|
}
|
|
1631
1461
|
get path() {
|
|
@@ -5107,8 +4937,8 @@ var settingsSchema = external_exports.object({
|
|
|
5107
4937
|
rule_workspaces: external_exports.array(external_exports.string()).default([]).describe(
|
|
5108
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."
|
|
5109
4939
|
),
|
|
5110
|
-
rule_packs: external_exports.array(external_exports.string()).default([]).describe(
|
|
5111
|
-
|
|
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.'
|
|
5112
4942
|
)
|
|
5113
4943
|
}).default({ mode: "legacy-all" }),
|
|
5114
4944
|
rule_loading_tier: ruleLoadingTier.default("balanced").describe(
|
|
@@ -5132,7 +4962,18 @@ var settingsSchema = external_exports.object({
|
|
|
5132
4962
|
),
|
|
5133
4963
|
monthly: external_exports.number().min(0).default(0).describe(
|
|
5134
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."
|
|
5135
|
-
)
|
|
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 })
|
|
5136
4977
|
}),
|
|
5137
4978
|
enforcement: enforcementMode.default("advisory").describe(
|
|
5138
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."
|
|
@@ -5157,7 +4998,7 @@ var settingsSchema = external_exports.object({
|
|
|
5157
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."
|
|
5158
4999
|
),
|
|
5159
5000
|
canary_name: external_exports.string().default("").describe(
|
|
5160
|
-
'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.'
|
|
5161
5002
|
),
|
|
5162
5003
|
play_by_play: external_exports.boolean().default(false).describe(
|
|
5163
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.`
|
|
@@ -5241,8 +5082,8 @@ var settingsSchema = external_exports.object({
|
|
|
5241
5082
|
quality_cadence: qualityCadence.default("end_of_roadmap").describe(
|
|
5242
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)."
|
|
5243
5084
|
),
|
|
5244
|
-
dashboard_regen_cadence: regenCadence.default("
|
|
5245
|
-
"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."
|
|
5246
5087
|
),
|
|
5247
5088
|
horizon_weeks: external_exports.number().int().min(0).default(0).describe(
|
|
5248
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.'
|
|
@@ -5342,6 +5183,9 @@ var settingsSchema = external_exports.object({
|
|
|
5342
5183
|
downshift: external_exports.boolean().default(true).describe(
|
|
5343
5184
|
"Route delegable sub-tasks to the lowest-capable model tier (cost + speed via model downshift). false = every subagent runs on the session tier."
|
|
5344
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
|
+
),
|
|
5345
5189
|
quota_arbitrage: external_exports.boolean().default(true).describe(
|
|
5346
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."
|
|
5347
5191
|
),
|
|
@@ -6855,8 +6699,8 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
6855
6699
|
};
|
|
6856
6700
|
|
|
6857
6701
|
// src/scripts/_lib/module_detection.ts
|
|
6858
|
-
import * as
|
|
6859
|
-
import * as
|
|
6702
|
+
import * as fs3 from "node:fs";
|
|
6703
|
+
import * as path3 from "node:path";
|
|
6860
6704
|
var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
|
|
6861
6705
|
var _RULES = [
|
|
6862
6706
|
["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
|
|
@@ -6870,14 +6714,14 @@ var _RULES = [
|
|
|
6870
6714
|
];
|
|
6871
6715
|
function _isDir(p) {
|
|
6872
6716
|
try {
|
|
6873
|
-
return
|
|
6717
|
+
return fs3.statSync(p).isDirectory();
|
|
6874
6718
|
} catch {
|
|
6875
6719
|
return false;
|
|
6876
6720
|
}
|
|
6877
6721
|
}
|
|
6878
6722
|
function _isFile(p) {
|
|
6879
6723
|
try {
|
|
6880
|
-
return
|
|
6724
|
+
return fs3.statSync(p).isFile();
|
|
6881
6725
|
} catch {
|
|
6882
6726
|
return false;
|
|
6883
6727
|
}
|
|
@@ -6891,13 +6735,13 @@ function _isUpperChar(ch) {
|
|
|
6891
6735
|
function _list_module_subdirs(root) {
|
|
6892
6736
|
let entries;
|
|
6893
6737
|
try {
|
|
6894
|
-
entries =
|
|
6738
|
+
entries = fs3.readdirSync(root).sort();
|
|
6895
6739
|
} catch {
|
|
6896
6740
|
return [];
|
|
6897
6741
|
}
|
|
6898
6742
|
const out = [];
|
|
6899
6743
|
for (const name of entries) {
|
|
6900
|
-
if (!_isDir(
|
|
6744
|
+
if (!_isDir(path3.join(root, name))) {
|
|
6901
6745
|
continue;
|
|
6902
6746
|
}
|
|
6903
6747
|
if (name.startsWith(".")) {
|
|
@@ -6919,11 +6763,11 @@ function _score_confidence(stack, root, subdirs) {
|
|
|
6919
6763
|
return capitalized.length > 0 ? "high" : "medium";
|
|
6920
6764
|
}
|
|
6921
6765
|
if (stack === "node-monorepo") {
|
|
6922
|
-
const withPkgJson = subdirs.filter((name) => _isFile(
|
|
6766
|
+
const withPkgJson = subdirs.filter((name) => _isFile(path3.join(root, name, "package.json")));
|
|
6923
6767
|
return withPkgJson.length > 0 ? "high" : "medium";
|
|
6924
6768
|
}
|
|
6925
6769
|
if (stack === "python-src") {
|
|
6926
|
-
const withInit = subdirs.filter((name) => _isFile(
|
|
6770
|
+
const withInit = subdirs.filter((name) => _isFile(path3.join(root, name, "__init__.py")));
|
|
6927
6771
|
return withInit.length > 0 ? "high" : "medium";
|
|
6928
6772
|
}
|
|
6929
6773
|
if (stack === "go-internal") {
|
|
@@ -6935,7 +6779,7 @@ function detect_module_roots(project_root) {
|
|
|
6935
6779
|
const high = [];
|
|
6936
6780
|
const medium = [];
|
|
6937
6781
|
for (const [rel_path, stack, namespace_template] of _RULES) {
|
|
6938
|
-
const abs_path =
|
|
6782
|
+
const abs_path = path3.join(project_root, rel_path);
|
|
6939
6783
|
if (!_isDir(abs_path)) {
|
|
6940
6784
|
continue;
|
|
6941
6785
|
}
|
|
@@ -6957,7 +6801,7 @@ function detect_module_roots(project_root) {
|
|
|
6957
6801
|
}
|
|
6958
6802
|
|
|
6959
6803
|
// src/scripts/_lib/model_tier.ts
|
|
6960
|
-
import
|
|
6804
|
+
import fs4 from "node:fs";
|
|
6961
6805
|
var TIER_TO_CLAUDE_MODEL = {
|
|
6962
6806
|
high: "opus",
|
|
6963
6807
|
medium: "sonnet",
|
|
@@ -6965,8 +6809,8 @@ var TIER_TO_CLAUDE_MODEL = {
|
|
|
6965
6809
|
};
|
|
6966
6810
|
var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
|
|
6967
6811
|
function read_model_tier(skill_md) {
|
|
6968
|
-
if (!
|
|
6969
|
-
const text =
|
|
6812
|
+
if (!fs4.existsSync(skill_md)) return null;
|
|
6813
|
+
const text = fs4.readFileSync(skill_md).toString("utf-8");
|
|
6970
6814
|
if (!text.startsWith("---\n")) return null;
|
|
6971
6815
|
const end = text.indexOf("\n---\n", 4);
|
|
6972
6816
|
if (end === -1) return null;
|
|
@@ -7000,34 +6844,34 @@ var ArgparseExit = class extends Error {
|
|
|
7000
6844
|
function expanduser2(p) {
|
|
7001
6845
|
if (p === "~") return os2.homedir();
|
|
7002
6846
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
7003
|
-
return
|
|
6847
|
+
return path4.join(os2.homedir(), p.slice(2));
|
|
7004
6848
|
}
|
|
7005
6849
|
return p;
|
|
7006
6850
|
}
|
|
7007
6851
|
function resolvePath(p) {
|
|
7008
6852
|
try {
|
|
7009
|
-
return
|
|
6853
|
+
return fs5.realpathSync(path4.resolve(p));
|
|
7010
6854
|
} catch {
|
|
7011
|
-
return
|
|
6855
|
+
return path4.resolve(p);
|
|
7012
6856
|
}
|
|
7013
6857
|
}
|
|
7014
6858
|
function isFile(p) {
|
|
7015
6859
|
try {
|
|
7016
|
-
return
|
|
6860
|
+
return fs5.statSync(p).isFile();
|
|
7017
6861
|
} catch {
|
|
7018
6862
|
return false;
|
|
7019
6863
|
}
|
|
7020
6864
|
}
|
|
7021
6865
|
function isDir(p) {
|
|
7022
6866
|
try {
|
|
7023
|
-
return
|
|
6867
|
+
return fs5.statSync(p).isDirectory();
|
|
7024
6868
|
} catch {
|
|
7025
6869
|
return false;
|
|
7026
6870
|
}
|
|
7027
6871
|
}
|
|
7028
6872
|
function pathExists(p) {
|
|
7029
6873
|
try {
|
|
7030
|
-
|
|
6874
|
+
fs5.statSync(p);
|
|
7031
6875
|
return true;
|
|
7032
6876
|
} catch {
|
|
7033
6877
|
return false;
|
|
@@ -7035,24 +6879,24 @@ function pathExists(p) {
|
|
|
7035
6879
|
}
|
|
7036
6880
|
function isSymlink(p) {
|
|
7037
6881
|
try {
|
|
7038
|
-
return
|
|
6882
|
+
return fs5.lstatSync(p).isSymbolicLink();
|
|
7039
6883
|
} catch {
|
|
7040
6884
|
return false;
|
|
7041
6885
|
}
|
|
7042
6886
|
}
|
|
7043
6887
|
function readText(p) {
|
|
7044
|
-
return
|
|
6888
|
+
return fs5.readFileSync(p, "utf-8");
|
|
7045
6889
|
}
|
|
7046
6890
|
function writeText(p, content) {
|
|
7047
|
-
|
|
6891
|
+
fs5.writeFileSync(p, content, "utf-8");
|
|
7048
6892
|
}
|
|
7049
6893
|
function mkdirp(p) {
|
|
7050
|
-
|
|
6894
|
+
fs5.mkdirSync(p, { recursive: true });
|
|
7051
6895
|
}
|
|
7052
6896
|
function sortedGlobStems(directory, suffix) {
|
|
7053
6897
|
let entries;
|
|
7054
6898
|
try {
|
|
7055
|
-
entries =
|
|
6899
|
+
entries = fs5.readdirSync(directory);
|
|
7056
6900
|
} catch {
|
|
7057
6901
|
return [];
|
|
7058
6902
|
}
|
|
@@ -7072,7 +6916,7 @@ function sortedGlobStems(directory, suffix) {
|
|
|
7072
6916
|
function countZips(directory) {
|
|
7073
6917
|
if (!isDir(directory)) return 0;
|
|
7074
6918
|
let n = 0;
|
|
7075
|
-
for (const name of
|
|
6919
|
+
for (const name of fs5.readdirSync(directory)) {
|
|
7076
6920
|
if (name.endsWith(".zip")) n += 1;
|
|
7077
6921
|
}
|
|
7078
6922
|
return n;
|
|
@@ -7080,35 +6924,35 @@ function countZips(directory) {
|
|
|
7080
6924
|
function sha256OfFile(p) {
|
|
7081
6925
|
let data;
|
|
7082
6926
|
try {
|
|
7083
|
-
data =
|
|
6927
|
+
data = fs5.readFileSync(p);
|
|
7084
6928
|
} catch {
|
|
7085
6929
|
return null;
|
|
7086
6930
|
}
|
|
7087
6931
|
return crypto3.createHash("sha256").update(data).digest("hex");
|
|
7088
6932
|
}
|
|
7089
6933
|
function atomicWrite0644(target, body, prefix) {
|
|
7090
|
-
const dir =
|
|
7091
|
-
const tmpName =
|
|
6934
|
+
const dir = path4.dirname(target);
|
|
6935
|
+
const tmpName = path4.join(
|
|
7092
6936
|
dir,
|
|
7093
6937
|
`${prefix}${process2.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
|
|
7094
6938
|
);
|
|
7095
6939
|
let fd = null;
|
|
7096
6940
|
try {
|
|
7097
|
-
fd =
|
|
7098
|
-
|
|
7099
|
-
|
|
6941
|
+
fd = fs5.openSync(tmpName, "wx", 420);
|
|
6942
|
+
fs5.writeFileSync(fd, body, "utf-8");
|
|
6943
|
+
fs5.closeSync(fd);
|
|
7100
6944
|
fd = null;
|
|
7101
|
-
|
|
7102
|
-
|
|
6945
|
+
fs5.chmodSync(tmpName, 420);
|
|
6946
|
+
fs5.renameSync(tmpName, target);
|
|
7103
6947
|
} catch (err) {
|
|
7104
6948
|
if (fd !== null) {
|
|
7105
6949
|
try {
|
|
7106
|
-
|
|
6950
|
+
fs5.closeSync(fd);
|
|
7107
6951
|
} catch {
|
|
7108
6952
|
}
|
|
7109
6953
|
}
|
|
7110
6954
|
try {
|
|
7111
|
-
|
|
6955
|
+
fs5.unlinkSync(tmpName);
|
|
7112
6956
|
} catch {
|
|
7113
6957
|
}
|
|
7114
6958
|
throw err;
|
|
@@ -7208,7 +7052,7 @@ function jsonDumpsCompact(value) {
|
|
|
7208
7052
|
}
|
|
7209
7053
|
return _jsonStrNoAscii(String(value));
|
|
7210
7054
|
}
|
|
7211
|
-
function
|
|
7055
|
+
function yamlSafeLoad(text) {
|
|
7212
7056
|
let YAML;
|
|
7213
7057
|
try {
|
|
7214
7058
|
YAML = require_dist();
|
|
@@ -7232,12 +7076,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
|
|
|
7232
7076
|
var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
|
|
7233
7077
|
var SETTINGS_SUBDIR = ["agents", "settings"];
|
|
7234
7078
|
function _canonical_settings_target(project_root) {
|
|
7235
|
-
return
|
|
7079
|
+
return path4.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
|
|
7236
7080
|
}
|
|
7237
7081
|
function _resolve_settings_read(project_root) {
|
|
7238
7082
|
const canonical = _canonical_settings_target(project_root);
|
|
7239
7083
|
if (pathExists(canonical)) return canonical;
|
|
7240
|
-
const legacy =
|
|
7084
|
+
const legacy = path4.join(project_root, SETTINGS_FILE);
|
|
7241
7085
|
if (pathExists(legacy)) return legacy;
|
|
7242
7086
|
return canonical;
|
|
7243
7087
|
}
|
|
@@ -7301,9 +7145,9 @@ function fail(msg) {
|
|
|
7301
7145
|
throw new SystemExitError(1);
|
|
7302
7146
|
}
|
|
7303
7147
|
function detect_package_root(project_root) {
|
|
7304
|
-
const npm_path =
|
|
7148
|
+
const npm_path = path4.join(project_root, "node_modules", "@event4u", "agent-config");
|
|
7305
7149
|
if (isDir(npm_path)) return resolvePath(npm_path);
|
|
7306
|
-
if (pathExists(
|
|
7150
|
+
if (pathExists(path4.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
7307
7151
|
return project_root;
|
|
7308
7152
|
}
|
|
7309
7153
|
fail(
|
|
@@ -7311,12 +7155,12 @@ function detect_package_root(project_root) {
|
|
|
7311
7155
|
);
|
|
7312
7156
|
}
|
|
7313
7157
|
function detect_package_type(package_root) {
|
|
7314
|
-
if (package_root.split(
|
|
7158
|
+
if (package_root.split(path4.sep).includes("node_modules")) return "npm";
|
|
7315
7159
|
return "local";
|
|
7316
7160
|
}
|
|
7317
7161
|
function detect_package_type_for_project(project_root, package_root) {
|
|
7318
7162
|
const npm_path = resolvePath(
|
|
7319
|
-
|
|
7163
|
+
path4.join(project_root, "node_modules", "@event4u", "agent-config")
|
|
7320
7164
|
);
|
|
7321
7165
|
const package_resolved = resolvePath(package_root);
|
|
7322
7166
|
if (package_resolved === npm_path) return "npm";
|
|
@@ -7336,7 +7180,7 @@ function ensure_directory(p) {
|
|
|
7336
7180
|
mkdirp(p);
|
|
7337
7181
|
}
|
|
7338
7182
|
function write_file(p, content) {
|
|
7339
|
-
ensure_directory(
|
|
7183
|
+
ensure_directory(path4.dirname(p));
|
|
7340
7184
|
writeText(p, content);
|
|
7341
7185
|
}
|
|
7342
7186
|
function read_json_file(p) {
|
|
@@ -7507,7 +7351,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
|
|
|
7507
7351
|
return rendered + "\n" + suffix;
|
|
7508
7352
|
}
|
|
7509
7353
|
function _migrate_legacy_if_present(project_root, template_body) {
|
|
7510
|
-
const legacy_target =
|
|
7354
|
+
const legacy_target = path4.join(project_root, LEGACY_SETTINGS_FILE);
|
|
7511
7355
|
if (!isFile(legacy_target)) return null;
|
|
7512
7356
|
const legacy_text = readText(legacy_target);
|
|
7513
7357
|
const [values, unknown] = _parse_legacy_settings(legacy_text);
|
|
@@ -7522,9 +7366,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
|
|
|
7522
7366
|
}
|
|
7523
7367
|
}
|
|
7524
7368
|
rendered = _append_unknown_legacy(rendered, values, unknown);
|
|
7525
|
-
const backup_target =
|
|
7369
|
+
const backup_target = path4.join(project_root, LEGACY_BACKUP_FILE);
|
|
7526
7370
|
writeText(backup_target, legacy_text);
|
|
7527
|
-
|
|
7371
|
+
fs5.unlinkSync(legacy_target);
|
|
7528
7372
|
info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
|
|
7529
7373
|
info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
|
|
7530
7374
|
if (unknown.length > 0) {
|
|
@@ -7559,7 +7403,7 @@ function _render_template(template, profile_values) {
|
|
|
7559
7403
|
return body;
|
|
7560
7404
|
}
|
|
7561
7405
|
function _load_valid_user_types(package_root) {
|
|
7562
|
-
const directory =
|
|
7406
|
+
const directory = path4.join(package_root, USER_TYPES_DIR);
|
|
7563
7407
|
if (!isDir(directory)) return [];
|
|
7564
7408
|
return sortedGlobStems(directory, ".yml");
|
|
7565
7409
|
}
|
|
@@ -7616,8 +7460,8 @@ function splitlinesKeepends(text) {
|
|
|
7616
7460
|
}
|
|
7617
7461
|
function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
|
|
7618
7462
|
const target = _canonical_settings_target(project_root);
|
|
7619
|
-
const profile_source =
|
|
7620
|
-
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");
|
|
7621
7465
|
if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
|
|
7622
7466
|
if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
|
|
7623
7467
|
const template = readText(template_source);
|
|
@@ -7631,21 +7475,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
7631
7475
|
if (profile_values["rule_loading_tier"] !== profile) {
|
|
7632
7476
|
const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
|
|
7633
7477
|
fail(
|
|
7634
|
-
`Profile preset ${
|
|
7478
|
+
`Profile preset ${path4.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
|
|
7635
7479
|
);
|
|
7636
7480
|
}
|
|
7637
7481
|
profile_values["user_type"] = _validate_user_type(package_root, user_type);
|
|
7638
7482
|
let template_body = _render_template(template, profile_values);
|
|
7639
7483
|
template_body = _inject_packs(template_body, packs ?? []);
|
|
7640
|
-
const legacy_root =
|
|
7484
|
+
const legacy_root = path4.join(project_root, SETTINGS_FILE);
|
|
7641
7485
|
if (isFile(legacy_root) && !pathExists(target)) {
|
|
7642
|
-
mkdirp(
|
|
7486
|
+
mkdirp(path4.dirname(target));
|
|
7643
7487
|
writeText(target, readText(legacy_root));
|
|
7644
|
-
|
|
7488
|
+
fs5.unlinkSync(legacy_root);
|
|
7645
7489
|
success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
|
|
7646
7490
|
return;
|
|
7647
7491
|
}
|
|
7648
|
-
const legacy_target =
|
|
7492
|
+
const legacy_target = path4.join(project_root, LEGACY_SETTINGS_FILE);
|
|
7649
7493
|
if (isFile(legacy_target) && pathExists(target)) {
|
|
7650
7494
|
warn(
|
|
7651
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.`
|
|
@@ -7662,7 +7506,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
7662
7506
|
skip(`${SETTINGS_FILE} already exists`);
|
|
7663
7507
|
return;
|
|
7664
7508
|
}
|
|
7665
|
-
mkdirp(
|
|
7509
|
+
mkdirp(path4.dirname(target));
|
|
7666
7510
|
write_file(target, template_body);
|
|
7667
7511
|
const user_type_value = profile_values["user_type"] ?? "";
|
|
7668
7512
|
const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
|
|
@@ -7675,7 +7519,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
7675
7519
|
const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
|
|
7676
7520
|
const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
|
|
7677
7521
|
merge_json_file(
|
|
7678
|
-
|
|
7522
|
+
path4.join(project_root, ".vscode", "settings.json"),
|
|
7679
7523
|
bridge,
|
|
7680
7524
|
force,
|
|
7681
7525
|
".vscode/settings.json"
|
|
@@ -7684,14 +7528,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
7684
7528
|
function ensure_augment_bridge(project_root, force) {
|
|
7685
7529
|
const bridge = { enabledPlugins: { "agent-config@event4u": true } };
|
|
7686
7530
|
return merge_json_file(
|
|
7687
|
-
|
|
7531
|
+
path4.join(project_root, ".augment", "settings.json"),
|
|
7688
7532
|
bridge,
|
|
7689
7533
|
force,
|
|
7690
7534
|
".augment/settings.json"
|
|
7691
7535
|
);
|
|
7692
7536
|
}
|
|
7693
|
-
var AUGMENT_USER_DIR =
|
|
7694
|
-
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");
|
|
7695
7539
|
var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
|
|
7696
7540
|
var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
7697
7541
|
"augment-chat-history.sh",
|
|
@@ -7707,29 +7551,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
|
|
|
7707
7551
|
["post_tool_use", "PostToolUse"]
|
|
7708
7552
|
];
|
|
7709
7553
|
function _deploy_augment_trampoline(package_root, name, force) {
|
|
7710
|
-
const src =
|
|
7554
|
+
const src = path4.join(package_root, "scripts", "hooks", name);
|
|
7711
7555
|
if (!pathExists(src)) {
|
|
7712
7556
|
skip(`augment trampoline missing in package: ${src}`);
|
|
7713
7557
|
return null;
|
|
7714
7558
|
}
|
|
7715
7559
|
mkdirp(AUGMENT_USER_HOOKS_DIR);
|
|
7716
|
-
const dst =
|
|
7560
|
+
const dst = path4.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
7717
7561
|
const src_text = readText(src);
|
|
7718
7562
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
7719
7563
|
skip(`~/.augment/hooks/${name} already up to date`);
|
|
7720
7564
|
} else {
|
|
7721
7565
|
writeText(dst, src_text);
|
|
7722
|
-
|
|
7566
|
+
fs5.chmodSync(dst, 493);
|
|
7723
7567
|
success(`~/.augment/hooks/${name} installed`);
|
|
7724
7568
|
}
|
|
7725
7569
|
return dst;
|
|
7726
7570
|
}
|
|
7727
7571
|
function _remove_legacy_augment_trampolines() {
|
|
7728
7572
|
for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
|
|
7729
|
-
const legacy =
|
|
7573
|
+
const legacy = path4.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
7730
7574
|
try {
|
|
7731
7575
|
if (isFile(legacy)) {
|
|
7732
|
-
|
|
7576
|
+
fs5.unlinkSync(legacy);
|
|
7733
7577
|
skip(`removed legacy ~/.augment/hooks/${name}`);
|
|
7734
7578
|
}
|
|
7735
7579
|
} catch {
|
|
@@ -7748,7 +7592,7 @@ function ensure_augment_user_hooks(package_root, force) {
|
|
|
7748
7592
|
}
|
|
7749
7593
|
const settings_patch = { hooks: per_event };
|
|
7750
7594
|
return merge_json_file(
|
|
7751
|
-
|
|
7595
|
+
path4.join(AUGMENT_USER_DIR, "settings.json"),
|
|
7752
7596
|
settings_patch,
|
|
7753
7597
|
force,
|
|
7754
7598
|
"~/.augment/settings.json"
|
|
@@ -7773,7 +7617,7 @@ function _heal_legacy_claude_plugin_ids(p) {
|
|
|
7773
7617
|
return removed;
|
|
7774
7618
|
}
|
|
7775
7619
|
function ensure_claude_bridge(project_root, force) {
|
|
7776
|
-
const target =
|
|
7620
|
+
const target = path4.join(project_root, ".claude", "settings.json");
|
|
7777
7621
|
const healed = _heal_legacy_claude_plugin_ids(target);
|
|
7778
7622
|
for (const pid of healed) {
|
|
7779
7623
|
success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
|
|
@@ -7798,29 +7642,29 @@ function ensure_cursor_bridge(project_root, force) {
|
|
|
7798
7642
|
}
|
|
7799
7643
|
const bridge = { version: 1, hooks };
|
|
7800
7644
|
return merge_json_file(
|
|
7801
|
-
|
|
7645
|
+
path4.join(project_root, ".cursor", "hooks.json"),
|
|
7802
7646
|
bridge,
|
|
7803
7647
|
force,
|
|
7804
7648
|
".cursor/hooks.json"
|
|
7805
7649
|
);
|
|
7806
7650
|
}
|
|
7807
|
-
var CURSOR_USER_DIR =
|
|
7808
|
-
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");
|
|
7809
7653
|
var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
|
|
7810
7654
|
function ensure_cursor_user_hooks(package_root, force) {
|
|
7811
|
-
const src =
|
|
7655
|
+
const src = path4.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
|
|
7812
7656
|
if (!pathExists(src)) {
|
|
7813
7657
|
skip(`cursor trampoline missing in package: ${src}`);
|
|
7814
7658
|
return [];
|
|
7815
7659
|
}
|
|
7816
7660
|
mkdirp(CURSOR_USER_HOOKS_DIR);
|
|
7817
|
-
const dst =
|
|
7661
|
+
const dst = path4.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
|
|
7818
7662
|
const src_text = readText(src);
|
|
7819
7663
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
7820
7664
|
skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
7821
7665
|
} else {
|
|
7822
7666
|
writeText(dst, src_text);
|
|
7823
|
-
|
|
7667
|
+
fs5.chmodSync(dst, 493);
|
|
7824
7668
|
success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
|
|
7825
7669
|
}
|
|
7826
7670
|
const hooks = {};
|
|
@@ -7829,7 +7673,7 @@ function ensure_cursor_user_hooks(package_root, force) {
|
|
|
7829
7673
|
}
|
|
7830
7674
|
const settings_patch = { version: 1, hooks };
|
|
7831
7675
|
return merge_json_file(
|
|
7832
|
-
|
|
7676
|
+
path4.join(CURSOR_USER_DIR, "hooks.json"),
|
|
7833
7677
|
settings_patch,
|
|
7834
7678
|
force,
|
|
7835
7679
|
"~/.cursor/hooks.json"
|
|
@@ -7872,12 +7716,12 @@ exit 0
|
|
|
7872
7716
|
`;
|
|
7873
7717
|
}
|
|
7874
7718
|
function ensure_cline_bridge(project_root, force) {
|
|
7875
|
-
const hooks_dir =
|
|
7719
|
+
const hooks_dir = path4.join(project_root, ".clinerules", "hooks");
|
|
7876
7720
|
mkdirp(hooks_dir);
|
|
7877
7721
|
const workspace_quoted = shlexQuote(resolvePath(project_root));
|
|
7878
7722
|
let written = 0;
|
|
7879
7723
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
7880
|
-
const target =
|
|
7724
|
+
const target = path4.join(hooks_dir, native_event);
|
|
7881
7725
|
const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
|
|
7882
7726
|
if (pathExists(target) && readText(target) === body && !force) {
|
|
7883
7727
|
continue;
|
|
@@ -7887,7 +7731,7 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
7887
7731
|
continue;
|
|
7888
7732
|
}
|
|
7889
7733
|
writeText(target, body);
|
|
7890
|
-
|
|
7734
|
+
fs5.chmodSync(target, 493);
|
|
7891
7735
|
written += 1;
|
|
7892
7736
|
}
|
|
7893
7737
|
if (written) {
|
|
@@ -7896,27 +7740,27 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
7896
7740
|
skip(".clinerules/hooks/ already up to date");
|
|
7897
7741
|
}
|
|
7898
7742
|
}
|
|
7899
|
-
var CLINE_USER_DIR =
|
|
7743
|
+
var CLINE_USER_DIR = path4.join(os2.homedir(), "Documents", "Cline", "Hooks");
|
|
7900
7744
|
var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
|
|
7901
7745
|
function ensure_cline_user_hooks(package_root, force) {
|
|
7902
|
-
const src =
|
|
7746
|
+
const src = path4.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
|
|
7903
7747
|
if (!pathExists(src)) {
|
|
7904
7748
|
skip(`cline trampoline missing in package: ${src}`);
|
|
7905
7749
|
return;
|
|
7906
7750
|
}
|
|
7907
7751
|
mkdirp(CLINE_USER_DIR);
|
|
7908
|
-
const trampoline =
|
|
7752
|
+
const trampoline = path4.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
|
|
7909
7753
|
const src_text = readText(src);
|
|
7910
7754
|
if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
|
|
7911
7755
|
skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
7912
7756
|
} else {
|
|
7913
7757
|
writeText(trampoline, src_text);
|
|
7914
|
-
|
|
7758
|
+
fs5.chmodSync(trampoline, 493);
|
|
7915
7759
|
success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
|
|
7916
7760
|
}
|
|
7917
7761
|
const trampoline_quoted = shlexQuote(trampoline);
|
|
7918
7762
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
7919
|
-
const wrapper =
|
|
7763
|
+
const wrapper = path4.join(CLINE_USER_DIR, native_event);
|
|
7920
7764
|
const body = `#!/usr/bin/env bash
|
|
7921
7765
|
# Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
|
|
7922
7766
|
# User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
|
|
@@ -7926,7 +7770,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
|
|
|
7926
7770
|
continue;
|
|
7927
7771
|
}
|
|
7928
7772
|
writeText(wrapper, body);
|
|
7929
|
-
|
|
7773
|
+
fs5.chmodSync(wrapper, 493);
|
|
7930
7774
|
}
|
|
7931
7775
|
}
|
|
7932
7776
|
var WINDSURF_DISPATCHER_BINDINGS = [
|
|
@@ -7947,29 +7791,29 @@ function ensure_windsurf_bridge(project_root, force) {
|
|
|
7947
7791
|
}
|
|
7948
7792
|
const bridge = { hooks };
|
|
7949
7793
|
return merge_json_file(
|
|
7950
|
-
|
|
7794
|
+
path4.join(project_root, ".windsurf", "hooks.json"),
|
|
7951
7795
|
bridge,
|
|
7952
7796
|
force,
|
|
7953
7797
|
".windsurf/hooks.json"
|
|
7954
7798
|
);
|
|
7955
7799
|
}
|
|
7956
|
-
var WINDSURF_USER_DIR =
|
|
7957
|
-
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");
|
|
7958
7802
|
var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
|
|
7959
7803
|
function ensure_windsurf_user_hooks(package_root, force) {
|
|
7960
|
-
const src =
|
|
7804
|
+
const src = path4.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
7961
7805
|
if (!pathExists(src)) {
|
|
7962
7806
|
skip(`windsurf trampoline missing in package: ${src}`);
|
|
7963
7807
|
return [];
|
|
7964
7808
|
}
|
|
7965
7809
|
mkdirp(WINDSURF_USER_HOOKS_DIR);
|
|
7966
|
-
const dst =
|
|
7810
|
+
const dst = path4.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
7967
7811
|
const src_text = readText(src);
|
|
7968
7812
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
7969
7813
|
skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
7970
7814
|
} else {
|
|
7971
7815
|
writeText(dst, src_text);
|
|
7972
|
-
|
|
7816
|
+
fs5.chmodSync(dst, 493);
|
|
7973
7817
|
success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
|
|
7974
7818
|
}
|
|
7975
7819
|
const hooks = {};
|
|
@@ -7981,7 +7825,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
|
|
|
7981
7825
|
}
|
|
7982
7826
|
const settings_patch = { hooks };
|
|
7983
7827
|
return merge_json_file(
|
|
7984
|
-
|
|
7828
|
+
path4.join(WINDSURF_USER_DIR, "hooks.json"),
|
|
7985
7829
|
settings_patch,
|
|
7986
7830
|
force,
|
|
7987
7831
|
"~/.codeium/windsurf/hooks.json"
|
|
@@ -8010,43 +7854,43 @@ function _gemini_hooks_dict(command_factory) {
|
|
|
8010
7854
|
function ensure_gemini_bridge(project_root, force) {
|
|
8011
7855
|
const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
|
|
8012
7856
|
return merge_json_file(
|
|
8013
|
-
|
|
7857
|
+
path4.join(project_root, ".gemini", "settings.json"),
|
|
8014
7858
|
bridge,
|
|
8015
7859
|
force,
|
|
8016
7860
|
".gemini/settings.json"
|
|
8017
7861
|
);
|
|
8018
7862
|
}
|
|
8019
|
-
var GEMINI_USER_DIR =
|
|
8020
|
-
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");
|
|
8021
7865
|
var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
|
|
8022
7866
|
function ensure_gemini_user_hooks(package_root, force) {
|
|
8023
|
-
const src =
|
|
7867
|
+
const src = path4.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
|
|
8024
7868
|
if (!pathExists(src)) {
|
|
8025
7869
|
skip(`gemini trampoline missing in package: ${src}`);
|
|
8026
7870
|
return [];
|
|
8027
7871
|
}
|
|
8028
7872
|
mkdirp(GEMINI_USER_HOOKS_DIR);
|
|
8029
|
-
const dst =
|
|
7873
|
+
const dst = path4.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
|
|
8030
7874
|
const src_text = readText(src);
|
|
8031
7875
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
8032
7876
|
skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
8033
7877
|
} else {
|
|
8034
7878
|
writeText(dst, src_text);
|
|
8035
|
-
|
|
7879
|
+
fs5.chmodSync(dst, 493);
|
|
8036
7880
|
success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
|
|
8037
7881
|
}
|
|
8038
7882
|
const settings_patch = {
|
|
8039
7883
|
hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
|
|
8040
7884
|
};
|
|
8041
7885
|
return merge_json_file(
|
|
8042
|
-
|
|
7886
|
+
path4.join(GEMINI_USER_DIR, "settings.json"),
|
|
8043
7887
|
settings_patch,
|
|
8044
7888
|
force,
|
|
8045
7889
|
"~/.gemini/settings.json"
|
|
8046
7890
|
);
|
|
8047
7891
|
}
|
|
8048
7892
|
function ensure_copilot_bridge(project_root, force) {
|
|
8049
|
-
const target =
|
|
7893
|
+
const target = path4.join(project_root, ".github", "plugin", "marketplace.json");
|
|
8050
7894
|
const bridge = {
|
|
8051
7895
|
marketplace: {
|
|
8052
7896
|
name: "event4u-agent-marketplace",
|
|
@@ -8089,7 +7933,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
|
|
|
8089
7933
|
Run \`./agent-config --help\` for available commands.
|
|
8090
7934
|
`;
|
|
8091
7935
|
function ensure_roocode_bridge(project_root, force) {
|
|
8092
|
-
const target =
|
|
7936
|
+
const target = path4.join(project_root, ".roo", "rules", "agent-config.md");
|
|
8093
7937
|
if (pathExists(target) && !force) {
|
|
8094
7938
|
skip(".roo/rules/agent-config.md already exists");
|
|
8095
7939
|
return;
|
|
@@ -8111,7 +7955,7 @@ To wire Claude Desktop to this project's rules, run:
|
|
|
8111
7955
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
8112
7956
|
`;
|
|
8113
7957
|
function ensure_claude_desktop_bridge(project_root, force) {
|
|
8114
|
-
const target =
|
|
7958
|
+
const target = path4.join(project_root, ".claude-desktop", "agent-config.md");
|
|
8115
7959
|
if (pathExists(target) && !force) {
|
|
8116
7960
|
skip(".claude-desktop/agent-config.md already exists");
|
|
8117
7961
|
return;
|
|
@@ -8136,7 +7980,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
|
|
|
8136
7980
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
8137
7981
|
`;
|
|
8138
7982
|
function ensure_aider_bridge(project_root, force) {
|
|
8139
|
-
const target =
|
|
7983
|
+
const target = path4.join(project_root, ".aider", "agent-config.md");
|
|
8140
7984
|
if (pathExists(target) && !force) {
|
|
8141
7985
|
skip(".aider/agent-config.md already exists");
|
|
8142
7986
|
return;
|
|
@@ -8155,7 +7999,7 @@ developers where the rules and skills live.
|
|
|
8155
7999
|
Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
|
|
8156
8000
|
`;
|
|
8157
8001
|
function ensure_codex_bridge(project_root, force) {
|
|
8158
|
-
const target =
|
|
8002
|
+
const target = path4.join(project_root, ".codex", "agent-config.md");
|
|
8159
8003
|
if (pathExists(target) && !force) {
|
|
8160
8004
|
skip(".codex/agent-config.md already exists");
|
|
8161
8005
|
return;
|
|
@@ -8173,7 +8017,7 @@ rules per session. The canonical rule and skill source lives under
|
|
|
8173
8017
|
orientation).
|
|
8174
8018
|
`;
|
|
8175
8019
|
function ensure_continue_bridge(project_root, force) {
|
|
8176
|
-
const target =
|
|
8020
|
+
const target = path4.join(project_root, ".continue", "rules", "agent-config.md");
|
|
8177
8021
|
if (pathExists(target) && !force) {
|
|
8178
8022
|
skip(".continue/rules/agent-config.md already exists");
|
|
8179
8023
|
return;
|
|
@@ -8204,7 +8048,7 @@ orientation).
|
|
|
8204
8048
|
See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
|
|
8205
8049
|
`;
|
|
8206
8050
|
function ensure_kilocode_bridge(project_root, force) {
|
|
8207
|
-
const target =
|
|
8051
|
+
const target = path4.join(project_root, ".kilocode", "rules", "agent-config.md");
|
|
8208
8052
|
if (pathExists(target) && !force) {
|
|
8209
8053
|
skip(".kilocode/rules/agent-config.md already exists");
|
|
8210
8054
|
return;
|
|
@@ -8231,7 +8075,7 @@ canonical source (or symlink it):
|
|
|
8231
8075
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
8232
8076
|
`;
|
|
8233
8077
|
function ensure_zed_bridge(project_root, force) {
|
|
8234
|
-
const target =
|
|
8078
|
+
const target = path4.join(project_root, ".zed", "agent-config.md");
|
|
8235
8079
|
if (pathExists(target) && !force) {
|
|
8236
8080
|
skip(".zed/agent-config.md already exists");
|
|
8237
8081
|
return;
|
|
@@ -8252,7 +8096,7 @@ rules into your JetBrains profile.
|
|
|
8252
8096
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
8253
8097
|
`;
|
|
8254
8098
|
function ensure_jetbrains_bridge(project_root, force) {
|
|
8255
|
-
const target =
|
|
8099
|
+
const target = path4.join(project_root, ".jetbrains", "agent-config.md");
|
|
8256
8100
|
if (pathExists(target) && !force) {
|
|
8257
8101
|
skip(".jetbrains/agent-config.md already exists");
|
|
8258
8102
|
return;
|
|
@@ -8283,7 +8127,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
|
|
|
8283
8127
|
See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
|
|
8284
8128
|
`;
|
|
8285
8129
|
function ensure_kiro_bridge(project_root, force) {
|
|
8286
|
-
const target =
|
|
8130
|
+
const target = path4.join(project_root, ".kiro", "steering", "agent-config.md");
|
|
8287
8131
|
if (pathExists(target) && !force) {
|
|
8288
8132
|
skip(".kiro/steering/agent-config.md already exists");
|
|
8289
8133
|
return;
|
|
@@ -8309,35 +8153,35 @@ var SMOKE_BRIDGE_PATHS = {
|
|
|
8309
8153
|
};
|
|
8310
8154
|
function dirHasEntries(p) {
|
|
8311
8155
|
try {
|
|
8312
|
-
return
|
|
8156
|
+
return fs5.readdirSync(p).length > 0;
|
|
8313
8157
|
} catch {
|
|
8314
8158
|
return false;
|
|
8315
8159
|
}
|
|
8316
8160
|
}
|
|
8317
8161
|
function _resolve_tsx_invocation(scriptPath, scriptArgs) {
|
|
8318
8162
|
const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
8319
|
-
let dir =
|
|
8163
|
+
let dir = path4.dirname(scriptPath);
|
|
8320
8164
|
for (; ; ) {
|
|
8321
|
-
const candidate =
|
|
8165
|
+
const candidate = path4.join(dir, "node_modules", ".bin", binName);
|
|
8322
8166
|
if (isFile(candidate)) {
|
|
8323
8167
|
return { command: candidate, args: [scriptPath, ...scriptArgs] };
|
|
8324
8168
|
}
|
|
8325
|
-
const parent =
|
|
8169
|
+
const parent = path4.dirname(dir);
|
|
8326
8170
|
if (parent === dir) break;
|
|
8327
8171
|
dir = parent;
|
|
8328
8172
|
}
|
|
8329
8173
|
return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
|
|
8330
8174
|
}
|
|
8331
8175
|
function _smoke_test_hooks(project_root, package_root) {
|
|
8332
|
-
const dispatcher =
|
|
8333
|
-
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");
|
|
8334
8178
|
if (!isFile(dispatcher) || !isFile(manifest)) return 0;
|
|
8335
8179
|
const failed = [];
|
|
8336
8180
|
const skipped = [];
|
|
8337
8181
|
const passed = [];
|
|
8338
8182
|
for (const [platform, native] of SMOKE_PROBE_EVENTS) {
|
|
8339
8183
|
const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
|
|
8340
|
-
const bridge_path = rel_bridge ?
|
|
8184
|
+
const bridge_path = rel_bridge ? path4.join(project_root, rel_bridge) : null;
|
|
8341
8185
|
const bridge_present = Boolean(
|
|
8342
8186
|
bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
|
|
8343
8187
|
);
|
|
@@ -8537,9 +8381,9 @@ To remove this marker, delete this file.
|
|
|
8537
8381
|
`;
|
|
8538
8382
|
}
|
|
8539
8383
|
var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
|
|
8540
|
-
var GLOBAL_ROOT =
|
|
8541
|
-
var GLOBAL_USER_SETTINGS_PATH =
|
|
8542
|
-
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");
|
|
8543
8387
|
function _bridge_marker(tool_id, scope) {
|
|
8544
8388
|
if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
|
|
8545
8389
|
return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
|
|
@@ -8584,11 +8428,11 @@ function _load_yaml_doc(p) {
|
|
|
8584
8428
|
} catch {
|
|
8585
8429
|
return {};
|
|
8586
8430
|
}
|
|
8587
|
-
const data =
|
|
8431
|
+
const data = yamlSafeLoad(text);
|
|
8588
8432
|
return _isPlainObject(data) ? data : {};
|
|
8589
8433
|
}
|
|
8590
8434
|
function _load_default_settings(package_root) {
|
|
8591
|
-
const template_source =
|
|
8435
|
+
const template_source = path4.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
8592
8436
|
if (!pathExists(template_source)) return {};
|
|
8593
8437
|
let text;
|
|
8594
8438
|
try {
|
|
@@ -8597,7 +8441,7 @@ function _load_default_settings(package_root) {
|
|
|
8597
8441
|
return {};
|
|
8598
8442
|
}
|
|
8599
8443
|
const rendered = text.split(RULE_LOADING_TIER_PLACEHOLDER).join(DEFAULT_PROFILE).split(USER_TYPE_PLACEHOLDER).join("");
|
|
8600
|
-
const data =
|
|
8444
|
+
const data = yamlSafeLoad(rendered);
|
|
8601
8445
|
return _isPlainObject(data) ? data : {};
|
|
8602
8446
|
}
|
|
8603
8447
|
function _resolve_scope(opts, detected, detect_reason, custom_path) {
|
|
@@ -8676,9 +8520,9 @@ function detect_scope(cwd) {
|
|
|
8676
8520
|
if (pathExists(_resolve_settings_read(cwd))) {
|
|
8677
8521
|
return ["project", `existing ${SETTINGS_FILE}`];
|
|
8678
8522
|
}
|
|
8679
|
-
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(
|
|
8680
|
-
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(
|
|
8681
|
-
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;
|
|
8682
8526
|
if (has_manifest && (has_ai_dir || has_ai_file)) {
|
|
8683
8527
|
const marker = has_ai_dir || has_ai_file;
|
|
8684
8528
|
return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
|
|
@@ -8699,7 +8543,7 @@ function readLineSyncRaw(promptText) {
|
|
|
8699
8543
|
for (; ; ) {
|
|
8700
8544
|
let n;
|
|
8701
8545
|
try {
|
|
8702
|
-
n =
|
|
8546
|
+
n = fs5.readSync(0, buf, 0, 1, null);
|
|
8703
8547
|
} catch (err) {
|
|
8704
8548
|
const code = err.code;
|
|
8705
8549
|
if (code === "EAGAIN") {
|
|
@@ -8774,8 +8618,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
|
|
|
8774
8618
|
const marker = _bridge_marker(tool_id, scope);
|
|
8775
8619
|
if (!marker) continue;
|
|
8776
8620
|
let marker_path = marker;
|
|
8777
|
-
if (!
|
|
8778
|
-
marker_path =
|
|
8621
|
+
if (!path4.isAbsolute(marker_path)) {
|
|
8622
|
+
marker_path = path4.join(project_root, marker_path);
|
|
8779
8623
|
}
|
|
8780
8624
|
out[tool_id] = [_file_entry(marker_path, "bridge", false)];
|
|
8781
8625
|
}
|
|
@@ -8814,26 +8658,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
|
|
|
8814
8658
|
}
|
|
8815
8659
|
write_manifest(target, version, entries);
|
|
8816
8660
|
if (!state.QUIET) {
|
|
8817
|
-
const rel = isRelativeTo(target, project_root) ?
|
|
8661
|
+
const rel = isRelativeTo(target, project_root) ? path4.relative(project_root, target) : target;
|
|
8818
8662
|
info(`Manifest updated: ${rel}`);
|
|
8819
8663
|
}
|
|
8820
8664
|
return 0;
|
|
8821
8665
|
}
|
|
8822
8666
|
function isRelativeTo(child, parent) {
|
|
8823
|
-
const rel =
|
|
8824
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
8667
|
+
const rel = path4.relative(parent, child);
|
|
8668
|
+
return rel === "" || !rel.startsWith("..") && !path4.isAbsolute(rel);
|
|
8825
8669
|
}
|
|
8826
8670
|
function _resolve_package_root_for_global() {
|
|
8827
8671
|
const here = resolvePath(_HERE);
|
|
8828
|
-
const candidate =
|
|
8829
|
-
if (!pathExists(
|
|
8672
|
+
const candidate = path4.dirname(path4.dirname(path4.dirname(here)));
|
|
8673
|
+
if (!pathExists(path4.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
|
|
8830
8674
|
fail(
|
|
8831
8675
|
`Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
|
|
8832
8676
|
);
|
|
8833
8677
|
}
|
|
8834
8678
|
return candidate;
|
|
8835
8679
|
}
|
|
8836
|
-
var CONSUMER_BRIDGE_MARKER_RELPATH =
|
|
8680
|
+
var CONSUMER_BRIDGE_MARKER_RELPATH = path4.join("agents", ".event4u-bridge.yml");
|
|
8837
8681
|
var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
8838
8682
|
var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
|
|
8839
8683
|
var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
|
|
@@ -8841,7 +8685,7 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
8841
8685
|
if (process2.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
|
|
8842
8686
|
return [false, "consumer-mode-override"];
|
|
8843
8687
|
}
|
|
8844
|
-
const pkg_json =
|
|
8688
|
+
const pkg_json = path4.join(project_root, "package.json");
|
|
8845
8689
|
if (isFile(pkg_json)) {
|
|
8846
8690
|
let data = {};
|
|
8847
8691
|
try {
|
|
@@ -8853,18 +8697,18 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
8853
8697
|
return [true, "package.json:name"];
|
|
8854
8698
|
}
|
|
8855
8699
|
}
|
|
8856
|
-
if (isDir(
|
|
8700
|
+
if (isDir(path4.join(project_root, ".agent-src.uncondensed"))) {
|
|
8857
8701
|
return [true, ".agent-src.uncondensed/"];
|
|
8858
8702
|
}
|
|
8859
|
-
const packages_dir =
|
|
8703
|
+
const packages_dir = path4.join(project_root, "packages");
|
|
8860
8704
|
if (isDir(packages_dir)) {
|
|
8861
|
-
for (const child of
|
|
8862
|
-
if (isDir(
|
|
8705
|
+
for (const child of fs5.readdirSync(packages_dir)) {
|
|
8706
|
+
if (isDir(path4.join(packages_dir, child, ".agent-src.uncondensed"))) {
|
|
8863
8707
|
return [true, `packages/${child}/.agent-src.uncondensed/`];
|
|
8864
8708
|
}
|
|
8865
8709
|
}
|
|
8866
8710
|
}
|
|
8867
|
-
const installer_self =
|
|
8711
|
+
const installer_self = path4.join(project_root, "scripts", "install.py");
|
|
8868
8712
|
try {
|
|
8869
8713
|
if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE)) {
|
|
8870
8714
|
return [true, "src/scripts/install.py (self)"];
|
|
@@ -8884,17 +8728,17 @@ function _detect_legacy_for_migration(project_root) {
|
|
|
8884
8728
|
}
|
|
8885
8729
|
return [];
|
|
8886
8730
|
}
|
|
8887
|
-
if (isFile(
|
|
8731
|
+
if (isFile(path4.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
|
|
8888
8732
|
const found = [];
|
|
8889
8733
|
for (const name of MIGRATE_LEGACY_YAML_FILES) {
|
|
8890
|
-
if (isFile(
|
|
8734
|
+
if (isFile(path4.join(project_root, name))) {
|
|
8891
8735
|
found.push(name);
|
|
8892
|
-
} else if (isFile(
|
|
8736
|
+
} else if (isFile(path4.join(project_root, "settings", name))) {
|
|
8893
8737
|
found.push(`settings/${name}`);
|
|
8894
8738
|
}
|
|
8895
8739
|
}
|
|
8896
8740
|
for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
|
|
8897
|
-
const p =
|
|
8741
|
+
const p = path4.join(project_root, name);
|
|
8898
8742
|
if (isDir(p) && !isSymlink(p)) {
|
|
8899
8743
|
found.push(`${name}/`);
|
|
8900
8744
|
}
|
|
@@ -8906,7 +8750,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
|
|
|
8906
8750
|
process2.stdout.write("\n");
|
|
8907
8751
|
warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
|
|
8908
8752
|
for (const rel of artefacts) {
|
|
8909
|
-
info(` ${
|
|
8753
|
+
info(` ${path4.join(project_root, rel)}`);
|
|
8910
8754
|
}
|
|
8911
8755
|
info("The unified `agent-config migrate` sweeps these in one pass.");
|
|
8912
8756
|
info("The wizard recreates fresh config afterwards.");
|
|
@@ -8937,20 +8781,20 @@ function _run_migrate_to_global(project_root) {
|
|
|
8937
8781
|
function _format_global_root_for_marker(global_root) {
|
|
8938
8782
|
const home = resolvePath(os2.homedir());
|
|
8939
8783
|
const resolved = resolvePath(global_root);
|
|
8940
|
-
const rel =
|
|
8941
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
8784
|
+
const rel = path4.relative(home, resolved);
|
|
8785
|
+
if (rel === "" || rel.startsWith("..") || path4.isAbsolute(rel)) {
|
|
8942
8786
|
return global_root;
|
|
8943
8787
|
}
|
|
8944
|
-
return `~/${rel.split(
|
|
8788
|
+
return `~/${rel.split(path4.sep).join("/")}`;
|
|
8945
8789
|
}
|
|
8946
8790
|
function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
|
|
8947
8791
|
const env_map = env ?? process2.env;
|
|
8948
8792
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
|
|
8949
|
-
if (isDir(
|
|
8950
|
-
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);
|
|
8951
8795
|
if (!isFile(target)) return null;
|
|
8952
8796
|
try {
|
|
8953
|
-
|
|
8797
|
+
fs5.rmSync(target);
|
|
8954
8798
|
} catch {
|
|
8955
8799
|
return null;
|
|
8956
8800
|
}
|
|
@@ -8964,7 +8808,7 @@ var PROJECT_ANCHOR_TOOLS = {
|
|
|
8964
8808
|
function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
|
|
8965
8809
|
const env_map = env ?? process2.env;
|
|
8966
8810
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
|
|
8967
|
-
if (isDir(
|
|
8811
|
+
if (isDir(path4.join(project_root, ".agent-src.uncondensed"))) return [];
|
|
8968
8812
|
const global_root_str = _format_global_root_for_marker(
|
|
8969
8813
|
event4u_root(env_map)
|
|
8970
8814
|
);
|
|
@@ -8973,8 +8817,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
|
|
|
8973
8817
|
for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
|
|
8974
8818
|
const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
|
|
8975
8819
|
if (!tools.has(tool_id)) continue;
|
|
8976
|
-
const target =
|
|
8977
|
-
mkdirp(
|
|
8820
|
+
const target = path4.join(project_root, rel_path);
|
|
8821
|
+
mkdirp(path4.dirname(target));
|
|
8978
8822
|
const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
|
|
8979
8823
|
# Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
|
|
8980
8824
|
# Tool: ${tool_id}. Resolves the global install directly \u2014 no
|
|
@@ -8992,7 +8836,7 @@ installed_at: ${stamp}
|
|
|
8992
8836
|
}
|
|
8993
8837
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
8994
8838
|
function _inject_package_tag(target, source, package_root) {
|
|
8995
|
-
if (
|
|
8839
|
+
if (path4.extname(target) !== ".md") return;
|
|
8996
8840
|
let text;
|
|
8997
8841
|
try {
|
|
8998
8842
|
text = readText(target);
|
|
@@ -9020,8 +8864,8 @@ function _inject_package_tag(target, source, package_root) {
|
|
|
9020
8864
|
resolved_src = source;
|
|
9021
8865
|
}
|
|
9022
8866
|
if (package_root !== null) {
|
|
9023
|
-
const rel =
|
|
9024
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
8867
|
+
const rel = path4.relative(resolvePath(package_root), resolved_src);
|
|
8868
|
+
if (rel !== "" && !rel.startsWith("..") && !path4.isAbsolute(rel)) {
|
|
9025
8869
|
source_value = rel;
|
|
9026
8870
|
} else {
|
|
9027
8871
|
source_value = resolved_src;
|
|
@@ -9056,7 +8900,7 @@ function _escapes_package_root(resolved, package_root) {
|
|
|
9056
8900
|
if (package_root === null) return false;
|
|
9057
8901
|
let root;
|
|
9058
8902
|
try {
|
|
9059
|
-
root =
|
|
8903
|
+
root = fs5.realpathSync(package_root);
|
|
9060
8904
|
} catch {
|
|
9061
8905
|
return false;
|
|
9062
8906
|
}
|
|
@@ -9071,7 +8915,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
9071
8915
|
if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
|
|
9072
8916
|
let resolved_src = src;
|
|
9073
8917
|
try {
|
|
9074
|
-
resolved_src =
|
|
8918
|
+
resolved_src = fs5.realpathSync(src);
|
|
9075
8919
|
} catch {
|
|
9076
8920
|
resolved_src = src;
|
|
9077
8921
|
}
|
|
@@ -9079,10 +8923,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
9079
8923
|
warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
|
|
9080
8924
|
return [0, 0, written_paths];
|
|
9081
8925
|
}
|
|
9082
|
-
mkdirp(
|
|
8926
|
+
mkdirp(path4.dirname(dest));
|
|
9083
8927
|
const decision = _resolve_file_conflict(dest, force);
|
|
9084
8928
|
if (decision === "skip") return [0, 1, written_paths];
|
|
9085
|
-
|
|
8929
|
+
fs5.copyFileSync(src, dest);
|
|
9086
8930
|
_inject_package_tag(dest, src, package_root);
|
|
9087
8931
|
written_paths.push(dest);
|
|
9088
8932
|
return [1, 0, written_paths];
|
|
@@ -9090,11 +8934,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
9090
8934
|
mkdirp(dest);
|
|
9091
8935
|
const walk = (node) => {
|
|
9092
8936
|
const acc = [];
|
|
9093
|
-
const names =
|
|
8937
|
+
const names = fs5.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
9094
8938
|
for (const name of names) {
|
|
9095
|
-
const entry =
|
|
8939
|
+
const entry = path4.join(node, name);
|
|
9096
8940
|
acc.push(entry);
|
|
9097
|
-
const lst =
|
|
8941
|
+
const lst = fs5.lstatSync(entry);
|
|
9098
8942
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
9099
8943
|
acc.push(...walk(entry));
|
|
9100
8944
|
}
|
|
@@ -9102,9 +8946,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
9102
8946
|
return acc;
|
|
9103
8947
|
};
|
|
9104
8948
|
for (const entry of walk(src)) {
|
|
9105
|
-
const rel =
|
|
9106
|
-
const target =
|
|
9107
|
-
const lst =
|
|
8949
|
+
const rel = path4.relative(src, entry);
|
|
8950
|
+
const target = path4.join(dest, rel);
|
|
8951
|
+
const lst = fs5.lstatSync(entry);
|
|
9108
8952
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
9109
8953
|
mkdirp(target);
|
|
9110
8954
|
continue;
|
|
@@ -9112,8 +8956,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
9112
8956
|
let resolvedIsDir = false;
|
|
9113
8957
|
let resolved = entry;
|
|
9114
8958
|
try {
|
|
9115
|
-
resolved =
|
|
9116
|
-
resolvedIsDir =
|
|
8959
|
+
resolved = fs5.realpathSync(entry);
|
|
8960
|
+
resolvedIsDir = fs5.statSync(entry).isDirectory();
|
|
9117
8961
|
} catch {
|
|
9118
8962
|
resolvedIsDir = false;
|
|
9119
8963
|
}
|
|
@@ -9143,8 +8987,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
9143
8987
|
skipped += 1;
|
|
9144
8988
|
continue;
|
|
9145
8989
|
}
|
|
9146
|
-
mkdirp(
|
|
9147
|
-
|
|
8990
|
+
mkdirp(path4.dirname(target));
|
|
8991
|
+
fs5.copyFileSync(resolved, target);
|
|
9148
8992
|
_inject_package_tag(target, resolved, package_root);
|
|
9149
8993
|
written += 1;
|
|
9150
8994
|
written_paths.push(target);
|
|
@@ -9156,7 +9000,7 @@ function _claude_desktop_bundles_dir() {
|
|
|
9156
9000
|
}
|
|
9157
9001
|
function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
|
|
9158
9002
|
const anchor = expanduser2(USER_SCOPE_PATHS["claude-desktop"]);
|
|
9159
|
-
const target =
|
|
9003
|
+
const target = path4.join(anchor, "agent-config.md");
|
|
9160
9004
|
mkdirp(anchor);
|
|
9161
9005
|
const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
|
|
9162
9006
|
writeText(target, body);
|
|
@@ -9180,23 +9024,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
9180
9024
|
const wrapped = [];
|
|
9181
9025
|
const collisions = [];
|
|
9182
9026
|
const reserved = [];
|
|
9183
|
-
const commands_dir =
|
|
9027
|
+
const commands_dir = path4.join(anchor, "commands");
|
|
9184
9028
|
let flat_entries = [];
|
|
9185
9029
|
try {
|
|
9186
|
-
flat_entries =
|
|
9030
|
+
flat_entries = fs5.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
|
|
9187
9031
|
} catch {
|
|
9188
9032
|
}
|
|
9189
9033
|
for (const fname of flat_entries.sort()) {
|
|
9190
9034
|
const slug = fname.slice(0, -".md".length);
|
|
9191
9035
|
if (!is_claude_builtin_name(slug)) continue;
|
|
9192
|
-
|
|
9036
|
+
fs5.rmSync(path4.join(commands_dir, fname), { force: true });
|
|
9193
9037
|
current_files.delete(`commands/${fname}`);
|
|
9194
9038
|
reserved.push(slug);
|
|
9195
9039
|
}
|
|
9196
9040
|
const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
|
|
9197
9041
|
try {
|
|
9198
9042
|
const manifest = JSON.parse(
|
|
9199
|
-
|
|
9043
|
+
fs5.readFileSync(path4.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
|
|
9200
9044
|
);
|
|
9201
9045
|
for (const a of manifest.artefacts ?? []) {
|
|
9202
9046
|
if (a.category !== "command" || typeof a.slug !== "string") continue;
|
|
@@ -9207,22 +9051,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
9207
9051
|
}
|
|
9208
9052
|
for (const slug of [...eligible].sort()) {
|
|
9209
9053
|
const flat_rel = `commands/${slug}.md`;
|
|
9210
|
-
const flat_abs =
|
|
9211
|
-
if (!
|
|
9212
|
-
const skill_dir =
|
|
9213
|
-
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)) {
|
|
9214
9058
|
collisions.push(slug);
|
|
9215
9059
|
continue;
|
|
9216
9060
|
}
|
|
9217
|
-
let body =
|
|
9061
|
+
let body = fs5.readFileSync(flat_abs, "utf8");
|
|
9218
9062
|
if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
|
|
9219
9063
|
body = body.replace("---\n", `---
|
|
9220
9064
|
name: ${slug}
|
|
9221
9065
|
`);
|
|
9222
9066
|
}
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
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 });
|
|
9226
9070
|
current_files.delete(flat_rel);
|
|
9227
9071
|
current_files.add(`skills/${slug}/SKILL.md`);
|
|
9228
9072
|
wrapped.push(slug);
|
|
@@ -9254,8 +9098,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
9254
9098
|
const written_paths = [];
|
|
9255
9099
|
let current_files = /* @__PURE__ */ new Set();
|
|
9256
9100
|
for (const [src_rel, dest_sub] of plan) {
|
|
9257
|
-
const src =
|
|
9258
|
-
const dest = dest_sub ?
|
|
9101
|
+
const src = path4.join(package_root, src_rel);
|
|
9102
|
+
const dest = dest_sub ? path4.join(anchor, dest_sub) : anchor;
|
|
9259
9103
|
const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
|
|
9260
9104
|
const [w, s, paths] = _copy_dir_dereferencing_symlinks(
|
|
9261
9105
|
src,
|
|
@@ -9329,10 +9173,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
9329
9173
|
results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
|
|
9330
9174
|
if (tool_id === "claude-code") {
|
|
9331
9175
|
try {
|
|
9332
|
-
const manifest =
|
|
9176
|
+
const manifest = path4.join(package_root, "src", "scripts", "hook_manifest.yaml");
|
|
9333
9177
|
const matrix = build_claude_hook_matrix(manifest);
|
|
9334
9178
|
const res = ensure_managed_hooks(
|
|
9335
|
-
|
|
9179
|
+
path4.join(anchor, "settings.json"),
|
|
9336
9180
|
matrix
|
|
9337
9181
|
);
|
|
9338
9182
|
if (!state.QUIET) {
|
|
@@ -9369,7 +9213,7 @@ function _preview_global_reap(tools, package_root) {
|
|
|
9369
9213
|
const anchor = expanduser2(anchor_raw);
|
|
9370
9214
|
let current_files = /* @__PURE__ */ new Set();
|
|
9371
9215
|
for (const [src_rel, dest_sub] of plan) {
|
|
9372
|
-
const src =
|
|
9216
|
+
const src = path4.join(package_root, src_rel);
|
|
9373
9217
|
current_files = setUnion(
|
|
9374
9218
|
current_files,
|
|
9375
9219
|
expected_deploy_files(
|
|
@@ -9403,14 +9247,14 @@ function _preview_global_reap(tools, package_root) {
|
|
|
9403
9247
|
function _verify_deploy_targets(anchor, plan) {
|
|
9404
9248
|
const missing = [];
|
|
9405
9249
|
for (const [, dest_sub] of plan) {
|
|
9406
|
-
const target = dest_sub ?
|
|
9250
|
+
const target = dest_sub ? path4.join(anchor, dest_sub) : anchor;
|
|
9407
9251
|
const label = dest_sub || ".";
|
|
9408
9252
|
if (!isDir(target)) {
|
|
9409
9253
|
missing.push(label);
|
|
9410
9254
|
continue;
|
|
9411
9255
|
}
|
|
9412
9256
|
try {
|
|
9413
|
-
const entries =
|
|
9257
|
+
const entries = fs5.readdirSync(target);
|
|
9414
9258
|
if (entries.length === 0) missing.push(label);
|
|
9415
9259
|
} catch {
|
|
9416
9260
|
missing.push(label);
|
|
@@ -9425,13 +9269,13 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
9425
9269
|
const [written, skipped, status, paths] = deploy_results[tool_id];
|
|
9426
9270
|
const pruned_skill_dirs = /* @__PURE__ */ new Set();
|
|
9427
9271
|
for (const p of paths) {
|
|
9428
|
-
const parts = p.split(
|
|
9272
|
+
const parts = p.split(path4.sep);
|
|
9429
9273
|
if (parts.includes("skills")) {
|
|
9430
9274
|
const i = parts.indexOf("skills");
|
|
9431
9275
|
if (i + 1 < parts.length) {
|
|
9432
|
-
const skill_root = parts.slice(0, i + 2).join(
|
|
9276
|
+
const skill_root = parts.slice(0, i + 2).join(path4.sep);
|
|
9433
9277
|
if (!pruned_skill_dirs.has(skill_root)) {
|
|
9434
|
-
const skillmd =
|
|
9278
|
+
const skillmd = path4.join(skill_root, "SKILL.md");
|
|
9435
9279
|
if (pathExists(skillmd) && is_pruned(skillmd)) {
|
|
9436
9280
|
pruned_skill_dirs.add(skill_root);
|
|
9437
9281
|
}
|
|
@@ -9442,25 +9286,25 @@ function _prune_modules_by(deploy_results, is_pruned) {
|
|
|
9442
9286
|
const keep = [];
|
|
9443
9287
|
const delete_files = [];
|
|
9444
9288
|
for (const p of paths) {
|
|
9445
|
-
const parts = p.split(
|
|
9289
|
+
const parts = p.split(path4.sep);
|
|
9446
9290
|
let is_target = false;
|
|
9447
9291
|
if (parts.includes("skills")) {
|
|
9448
9292
|
const i = parts.indexOf("skills");
|
|
9449
|
-
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))) {
|
|
9450
9294
|
is_target = true;
|
|
9451
9295
|
}
|
|
9452
|
-
} else if (parts.includes("commands") &&
|
|
9296
|
+
} else if (parts.includes("commands") && path4.extname(p) === ".md" && is_pruned(p)) {
|
|
9453
9297
|
is_target = true;
|
|
9454
9298
|
}
|
|
9455
9299
|
(is_target ? delete_files : keep).push(p);
|
|
9456
9300
|
}
|
|
9457
9301
|
for (const d of pruned_skill_dirs) {
|
|
9458
|
-
|
|
9302
|
+
fs5.rmSync(d, { recursive: true, force: true });
|
|
9459
9303
|
}
|
|
9460
9304
|
for (const p of delete_files) {
|
|
9461
|
-
if (p.split(
|
|
9305
|
+
if (p.split(path4.sep).includes("commands") && pathExists(p)) {
|
|
9462
9306
|
try {
|
|
9463
|
-
|
|
9307
|
+
fs5.unlinkSync(p);
|
|
9464
9308
|
} catch {
|
|
9465
9309
|
}
|
|
9466
9310
|
}
|
|
@@ -9481,9 +9325,9 @@ function _resolve_global_settings_doc() {
|
|
|
9481
9325
|
}
|
|
9482
9326
|
function _resolve_global_settings_path() {
|
|
9483
9327
|
const root = event4u_root();
|
|
9484
|
-
const canonical =
|
|
9328
|
+
const canonical = path4.join(root, "settings", SETTINGS_FILE);
|
|
9485
9329
|
if (pathExists(canonical)) return canonical;
|
|
9486
|
-
const legacy =
|
|
9330
|
+
const legacy = path4.join(root, SETTINGS_FILE);
|
|
9487
9331
|
if (pathExists(legacy)) return legacy;
|
|
9488
9332
|
return null;
|
|
9489
9333
|
}
|
|
@@ -9500,7 +9344,7 @@ function _resolve_global_rule_scope(package_root) {
|
|
|
9500
9344
|
const settings_path = _resolve_global_settings_path();
|
|
9501
9345
|
if (settings_path === null) {
|
|
9502
9346
|
try {
|
|
9503
|
-
return ruleScopeFromSettings(_load_default_settings(package_root));
|
|
9347
|
+
return ruleScopeFromSettings(_load_default_settings(package_root), package_root);
|
|
9504
9348
|
} catch {
|
|
9505
9349
|
return LEGACY_ALL;
|
|
9506
9350
|
}
|
|
@@ -9514,7 +9358,7 @@ function _resolve_global_rule_scope(package_root) {
|
|
|
9514
9358
|
);
|
|
9515
9359
|
return LEGACY_ALL;
|
|
9516
9360
|
}
|
|
9517
|
-
const parsed =
|
|
9361
|
+
const parsed = yamlSafeLoad(text);
|
|
9518
9362
|
if (!_isPlainObject(parsed)) {
|
|
9519
9363
|
warn(
|
|
9520
9364
|
`${settings_path} is not a YAML mapping \u2014 rule scoping falls back to legacy-all, so ALL rules including maintainer-only ones will be installed. Fix the file to restore scoping.`
|
|
@@ -9522,7 +9366,7 @@ function _resolve_global_rule_scope(package_root) {
|
|
|
9522
9366
|
return LEGACY_ALL;
|
|
9523
9367
|
}
|
|
9524
9368
|
try {
|
|
9525
|
-
return ruleScopeFromSettings(parsed);
|
|
9369
|
+
return ruleScopeFromSettings(parsed, package_root);
|
|
9526
9370
|
} catch (e) {
|
|
9527
9371
|
warn(
|
|
9528
9372
|
`could not derive rule scope from ${settings_path} (${String(e)}) \u2014 falling back to legacy-all; ALL rules will be installed.`
|
|
@@ -9594,7 +9438,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
9594
9438
|
info(` schema_version=1, agent_config_version=${installed_version}`);
|
|
9595
9439
|
info(` tools=${merged_tools.join(",")}`);
|
|
9596
9440
|
}
|
|
9597
|
-
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"))) {
|
|
9598
9442
|
const drift = collect_drift(project_root);
|
|
9599
9443
|
if (!state.QUIET) {
|
|
9600
9444
|
process2.stdout.write("\n");
|
|
@@ -9694,19 +9538,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
9694
9538
|
}
|
|
9695
9539
|
}
|
|
9696
9540
|
}
|
|
9697
|
-
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"))) {
|
|
9698
9542
|
const files_by_tool = _files_by_tool_from_deploy(deploy_results);
|
|
9699
9543
|
const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
|
|
9700
9544
|
if (rc !== 0) return rc;
|
|
9701
9545
|
const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
|
|
9702
9546
|
if (removed_marker !== null && !state.QUIET) {
|
|
9703
|
-
const rel = isRelativeTo(removed_marker, project_root) ?
|
|
9547
|
+
const rel = isRelativeTo(removed_marker, project_root) ? path4.relative(project_root, removed_marker) : removed_marker;
|
|
9704
9548
|
info(`Removed legacy bridge marker: ${rel}`);
|
|
9705
9549
|
}
|
|
9706
9550
|
const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
|
|
9707
9551
|
if (anchor_paths.length > 0 && !state.QUIET) {
|
|
9708
9552
|
for (const p of anchor_paths) {
|
|
9709
|
-
const rel = isRelativeTo(p, project_root) ?
|
|
9553
|
+
const rel = isRelativeTo(p, project_root) ? path4.relative(project_root, p) : p;
|
|
9710
9554
|
info(`Project anchor written: ${rel}`);
|
|
9711
9555
|
}
|
|
9712
9556
|
}
|
|
@@ -9723,8 +9567,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
9723
9567
|
}
|
|
9724
9568
|
return 0;
|
|
9725
9569
|
}
|
|
9726
|
-
var SETTINGS_SURFACE_REL =
|
|
9727
|
-
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");
|
|
9728
9572
|
function _current_settings_surface(version) {
|
|
9729
9573
|
const jsonSchema = zodToJsonSchema(settingsSchema, {
|
|
9730
9574
|
name: "AgentSettings",
|
|
@@ -9735,20 +9579,20 @@ function _current_settings_surface(version) {
|
|
|
9735
9579
|
}
|
|
9736
9580
|
function _write_settings_surface_snapshot(installed_version) {
|
|
9737
9581
|
const root = event4u_root();
|
|
9738
|
-
const surface_path =
|
|
9739
|
-
const delta_path =
|
|
9582
|
+
const surface_path = path4.join(root, SETTINGS_SURFACE_REL);
|
|
9583
|
+
const delta_path = path4.join(root, SETTINGS_DELTA_REL);
|
|
9740
9584
|
const next = _current_settings_surface(installed_version);
|
|
9741
9585
|
let previous = null;
|
|
9742
9586
|
try {
|
|
9743
|
-
const parsed = JSON.parse(
|
|
9587
|
+
const parsed = JSON.parse(fs5.readFileSync(surface_path, "utf8"));
|
|
9744
9588
|
if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
|
|
9745
9589
|
} catch {
|
|
9746
9590
|
}
|
|
9747
9591
|
if (previous !== null && previous.version !== next.version) {
|
|
9748
9592
|
const delta = computeSurfaceDelta(previous, next);
|
|
9749
9593
|
if (delta.changes.length > 0) {
|
|
9750
|
-
|
|
9751
|
-
|
|
9594
|
+
fs5.mkdirSync(path4.dirname(delta_path), { recursive: true, mode: 448 });
|
|
9595
|
+
fs5.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
|
|
9752
9596
|
`, { mode: 384 });
|
|
9753
9597
|
if (!state.QUIET) {
|
|
9754
9598
|
const counts = {};
|
|
@@ -9760,8 +9604,8 @@ function _write_settings_surface_snapshot(installed_version) {
|
|
|
9760
9604
|
}
|
|
9761
9605
|
}
|
|
9762
9606
|
}
|
|
9763
|
-
|
|
9764
|
-
|
|
9607
|
+
fs5.mkdirSync(path4.dirname(surface_path), { recursive: true, mode: 448 });
|
|
9608
|
+
fs5.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
|
|
9765
9609
|
`, { mode: 384 });
|
|
9766
9610
|
}
|
|
9767
9611
|
function arrayStrEqual(a, b) {
|
|
@@ -9973,13 +9817,13 @@ function _minimal_templates_root() {
|
|
|
9973
9817
|
const chain = [start];
|
|
9974
9818
|
let cur = start;
|
|
9975
9819
|
for (; ; ) {
|
|
9976
|
-
const parent =
|
|
9820
|
+
const parent = path4.dirname(cur);
|
|
9977
9821
|
if (parent === cur) break;
|
|
9978
9822
|
chain.push(parent);
|
|
9979
9823
|
cur = parent;
|
|
9980
9824
|
}
|
|
9981
9825
|
for (const ancestor of chain) {
|
|
9982
|
-
const candidate =
|
|
9826
|
+
const candidate = path4.join(ancestor, "src", "templates", "minimal");
|
|
9983
9827
|
if (isDir(candidate)) return candidate;
|
|
9984
9828
|
}
|
|
9985
9829
|
fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
|
|
@@ -9987,9 +9831,9 @@ function _minimal_templates_root() {
|
|
|
9987
9831
|
var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
9988
9832
|
function _write_install_mode_marker(project_root, mode) {
|
|
9989
9833
|
if (mode !== "minimal" && mode !== "full") return;
|
|
9990
|
-
const marker =
|
|
9834
|
+
const marker = path4.join(project_root, INSTALL_MODE_MARKER_REL);
|
|
9991
9835
|
try {
|
|
9992
|
-
mkdirp(
|
|
9836
|
+
mkdirp(path4.dirname(marker));
|
|
9993
9837
|
writeText(marker, `${mode}
|
|
9994
9838
|
`);
|
|
9995
9839
|
} catch {
|
|
@@ -9998,7 +9842,7 @@ function _write_install_mode_marker(project_root, mode) {
|
|
|
9998
9842
|
function install_minimal(target_root_in, force, user_type = "") {
|
|
9999
9843
|
let target_root = resolvePath(target_root_in);
|
|
10000
9844
|
mkdirp(target_root);
|
|
10001
|
-
const parent =
|
|
9845
|
+
const parent = path4.dirname(target_root);
|
|
10002
9846
|
if (parent !== target_root) {
|
|
10003
9847
|
const existing = find_project_root_with_anchor(parent);
|
|
10004
9848
|
if (existing !== null && existing[0] !== target_root) {
|
|
@@ -10009,21 +9853,21 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
10009
9853
|
}
|
|
10010
9854
|
}
|
|
10011
9855
|
const templates = _minimal_templates_root();
|
|
10012
|
-
const settings_src =
|
|
10013
|
-
const overrides_gitkeep_src =
|
|
10014
|
-
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");
|
|
10015
9859
|
if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
|
|
10016
9860
|
if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
|
|
10017
9861
|
fail(`Bundled overrides scaffold templates missing under ${templates}`);
|
|
10018
9862
|
}
|
|
10019
9863
|
info(`Minimal init \u2192 ${target_root}`);
|
|
10020
|
-
const overrides_root =
|
|
9864
|
+
const overrides_root = path4.join(target_root, "agents", "overrides");
|
|
10021
9865
|
mkdirp(overrides_root);
|
|
10022
9866
|
const gitkeep_body = readText(overrides_gitkeep_src);
|
|
10023
9867
|
for (const sub of ["rules", "skills", "commands"]) {
|
|
10024
|
-
const sub_dir =
|
|
9868
|
+
const sub_dir = path4.join(overrides_root, sub);
|
|
10025
9869
|
mkdirp(sub_dir);
|
|
10026
|
-
const gitkeep_dst =
|
|
9870
|
+
const gitkeep_dst = path4.join(sub_dir, ".gitkeep");
|
|
10027
9871
|
if (pathExists(gitkeep_dst) && !force) {
|
|
10028
9872
|
skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
|
|
10029
9873
|
} else {
|
|
@@ -10031,7 +9875,7 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
10031
9875
|
success(`Wrote agents/overrides/${sub}/.gitkeep`);
|
|
10032
9876
|
}
|
|
10033
9877
|
}
|
|
10034
|
-
const readme_dst =
|
|
9878
|
+
const readme_dst = path4.join(overrides_root, "README.md");
|
|
10035
9879
|
if (pathExists(readme_dst) && !force) {
|
|
10036
9880
|
skip("agents/overrides/README.md already exists (use --force to overwrite)");
|
|
10037
9881
|
} else {
|
|
@@ -10049,14 +9893,14 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
10049
9893
|
personal:
|
|
10050
9894
|
user_type: ${user_type}
|
|
10051
9895
|
`;
|
|
10052
|
-
mkdirp(
|
|
9896
|
+
mkdirp(path4.dirname(settings_dst));
|
|
10053
9897
|
writeText(settings_dst, body);
|
|
10054
9898
|
success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
|
|
10055
9899
|
}
|
|
10056
9900
|
}
|
|
10057
9901
|
const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
|
|
10058
9902
|
if (removed_marker !== null) {
|
|
10059
|
-
const rel = isRelativeTo(removed_marker, target_root) ?
|
|
9903
|
+
const rel = isRelativeTo(removed_marker, target_root) ? path4.relative(target_root, removed_marker) : removed_marker;
|
|
10060
9904
|
success(`Removed legacy bridge marker: ${rel}`);
|
|
10061
9905
|
}
|
|
10062
9906
|
_write_install_mode_marker(target_root, "minimal");
|
|
@@ -10130,7 +9974,7 @@ function run_interactive_init(project_root, force) {
|
|
|
10130
9974
|
);
|
|
10131
9975
|
return 0;
|
|
10132
9976
|
}
|
|
10133
|
-
const target =
|
|
9977
|
+
const target = path4.join(project_root, _LOCAL_CONFIG_FILE);
|
|
10134
9978
|
if (pathExists(target) && !force) {
|
|
10135
9979
|
warn(
|
|
10136
9980
|
`${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
|
|
@@ -10157,7 +10001,7 @@ function run_interactive_init(project_root, force) {
|
|
|
10157
10001
|
warn(`Could not write ${target}: ${String(exc)}`);
|
|
10158
10002
|
return 1;
|
|
10159
10003
|
}
|
|
10160
|
-
success(`Wrote ${
|
|
10004
|
+
success(`Wrote ${path4.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
|
|
10161
10005
|
return 0;
|
|
10162
10006
|
}
|
|
10163
10007
|
var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
|
|
@@ -10175,12 +10019,12 @@ function _wizard_should_launch(opts) {
|
|
|
10175
10019
|
return [true, ""];
|
|
10176
10020
|
}
|
|
10177
10021
|
function _wizard_cli_dist(_project_root) {
|
|
10178
|
-
const package_root =
|
|
10179
|
-
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");
|
|
10180
10024
|
return pathExists(cli) ? cli : null;
|
|
10181
10025
|
}
|
|
10182
10026
|
function _server_info_path() {
|
|
10183
|
-
return
|
|
10027
|
+
return path4.join(os2.homedir(), ".event4u", "agent-config", "local-server.json");
|
|
10184
10028
|
}
|
|
10185
10029
|
function _pid_is_agent_config(pid) {
|
|
10186
10030
|
let res;
|
|
@@ -10197,7 +10041,7 @@ function _pid_is_agent_config(pid) {
|
|
|
10197
10041
|
}
|
|
10198
10042
|
function unlinkMissingOk(p) {
|
|
10199
10043
|
try {
|
|
10200
|
-
|
|
10044
|
+
fs5.unlinkSync(p);
|
|
10201
10045
|
} catch {
|
|
10202
10046
|
}
|
|
10203
10047
|
}
|
|
@@ -10275,14 +10119,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
|
|
|
10275
10119
|
}
|
|
10276
10120
|
function _wizard_run_sync(cmd, env, cli) {
|
|
10277
10121
|
const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
|
|
10278
|
-
const log_path =
|
|
10122
|
+
const log_path = path4.join(
|
|
10279
10123
|
os2.tmpdir(),
|
|
10280
10124
|
`agent-config-wizard-${process2.pid}-${Date.now()}.log`
|
|
10281
10125
|
);
|
|
10282
10126
|
let child;
|
|
10283
10127
|
let log_fd = null;
|
|
10284
10128
|
try {
|
|
10285
|
-
log_fd =
|
|
10129
|
+
log_fd = fs5.openSync(log_path, "w");
|
|
10286
10130
|
child = spawn(cmd[0], cmd.slice(1), {
|
|
10287
10131
|
env,
|
|
10288
10132
|
detached: true,
|
|
@@ -10300,7 +10144,7 @@ function _wizard_run_sync(cmd, env, cli) {
|
|
|
10300
10144
|
} finally {
|
|
10301
10145
|
if (log_fd !== null) {
|
|
10302
10146
|
try {
|
|
10303
|
-
|
|
10147
|
+
fs5.closeSync(log_fd);
|
|
10304
10148
|
} catch {
|
|
10305
10149
|
}
|
|
10306
10150
|
}
|
|
@@ -10550,8 +10394,8 @@ function main2(argv) {
|
|
|
10550
10394
|
const target_root = resolvePath(
|
|
10551
10395
|
opts.custom_path || opts.project || process2.env["PROJECT_ROOT"] || process2.cwd()
|
|
10552
10396
|
);
|
|
10553
|
-
const minimal_package_root =
|
|
10554
|
-
|
|
10397
|
+
const minimal_package_root = path4.dirname(
|
|
10398
|
+
path4.dirname(path4.dirname(_minimal_templates_root()))
|
|
10555
10399
|
);
|
|
10556
10400
|
const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
|
|
10557
10401
|
return install_minimal(target_root, opts.force, validated_user_type);
|
|
@@ -10580,7 +10424,7 @@ function main2(argv) {
|
|
|
10580
10424
|
return rc2;
|
|
10581
10425
|
}
|
|
10582
10426
|
const project_root = custom_path || resolvePath(opts.project || process2.env["PROJECT_ROOT"] || process2.cwd());
|
|
10583
|
-
const is_first_run = !pathExists(
|
|
10427
|
+
const is_first_run = !pathExists(path4.join(project_root, SETTINGS_FILE));
|
|
10584
10428
|
const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
|
|
10585
10429
|
if (rc === 0 && opts.interactive) {
|
|
10586
10430
|
run_interactive_init(project_root, opts.force);
|
|
@@ -10644,16 +10488,16 @@ function _team_setup_hint_line(project_root) {
|
|
|
10644
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.";
|
|
10645
10489
|
}
|
|
10646
10490
|
function finalize_claude_model_tiers(project_root) {
|
|
10647
|
-
const claude_skills =
|
|
10648
|
-
const augment_skills =
|
|
10491
|
+
const claude_skills = path4.join(project_root, ".claude", "skills");
|
|
10492
|
+
const augment_skills = path4.join(project_root, ".augment", "skills");
|
|
10649
10493
|
if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
|
|
10650
10494
|
if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
|
|
10651
10495
|
let rendered = 0;
|
|
10652
|
-
const entries =
|
|
10496
|
+
const entries = fs5.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
10653
10497
|
for (const name of entries) {
|
|
10654
|
-
const entry =
|
|
10655
|
-
const src_dir =
|
|
10656
|
-
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");
|
|
10657
10501
|
let tier;
|
|
10658
10502
|
try {
|
|
10659
10503
|
tier = read_model_tier(src_md);
|
|
@@ -10662,22 +10506,22 @@ function finalize_claude_model_tiers(project_root) {
|
|
|
10662
10506
|
}
|
|
10663
10507
|
if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
|
|
10664
10508
|
if (isSymlink(entry) || isFile(entry)) {
|
|
10665
|
-
|
|
10509
|
+
fs5.unlinkSync(entry);
|
|
10666
10510
|
} else if (isDir(entry)) {
|
|
10667
|
-
|
|
10511
|
+
fs5.rmSync(entry, { recursive: true, force: true });
|
|
10668
10512
|
}
|
|
10669
10513
|
mkdirp(entry);
|
|
10670
|
-
const srcFiles =
|
|
10514
|
+
const srcFiles = fs5.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
10671
10515
|
for (const fname of srcFiles) {
|
|
10672
10516
|
if (fname === "SKILL.md") {
|
|
10673
10517
|
writeText(
|
|
10674
|
-
|
|
10518
|
+
path4.join(entry, "SKILL.md"),
|
|
10675
10519
|
render_native_model_md(readText(src_md), tier)
|
|
10676
10520
|
);
|
|
10677
10521
|
} else {
|
|
10678
|
-
|
|
10679
|
-
|
|
10680
|
-
|
|
10522
|
+
fs5.symlinkSync(
|
|
10523
|
+
path4.join("../../../.augment/skills", name, fname),
|
|
10524
|
+
path4.join(entry, fname)
|
|
10681
10525
|
);
|
|
10682
10526
|
}
|
|
10683
10527
|
}
|
|
@@ -10695,7 +10539,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
10695
10539
|
let package_type;
|
|
10696
10540
|
if (opts.package) {
|
|
10697
10541
|
package_root = resolvePath(opts.package);
|
|
10698
|
-
if (!pathExists(
|
|
10542
|
+
if (!pathExists(path4.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
10699
10543
|
fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
|
|
10700
10544
|
}
|
|
10701
10545
|
package_type = detect_package_type_for_project(project_root, package_root);
|
|
@@ -10830,9 +10674,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
10830
10674
|
function _resolvedArgv1() {
|
|
10831
10675
|
if (process2.argv[1] === void 0) return void 0;
|
|
10832
10676
|
try {
|
|
10833
|
-
return
|
|
10677
|
+
return fs5.realpathSync(path4.resolve(process2.argv[1]));
|
|
10834
10678
|
} catch {
|
|
10835
|
-
return
|
|
10679
|
+
return path4.resolve(process2.argv[1]);
|
|
10836
10680
|
}
|
|
10837
10681
|
}
|
|
10838
10682
|
var _argv1 = _resolvedArgv1();
|