@event4u/agent-config 14.18.0 → 14.20.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/.augment-plugin/marketplace.json +3 -3
- package/.augment-plugin/plugin.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +120 -129
- package/README.md +71 -149
- package/dist/agent-src/README.md +1 -1
- package/dist/agent-src/commands/agent-handoff.md +44 -43
- package/dist/agent-src/commands/review/changes.md +19 -19
- package/dist/agent-src/commands/review.md +2 -2
- package/dist/agent-src/contexts/execution/host-capability-manifest.md +37 -4
- package/dist/agent-src/rules/autonomous-execution.md +1 -1
- package/dist/agent-src/rules/git-history-discipline.md +2 -2
- package/dist/agent-src/rules/guidelines.md +1 -1
- package/dist/agent-src/rules/session-canary.md +2 -2
- package/dist/agent-src/rules/token-efficiency.md +1 -1
- package/dist/agent-src/rules/untrusted-input-defense.md +0 -2
- package/dist/agent-src/skills/adversarial-review/SKILL.md +0 -8
- package/dist/agent-src/skills/canvas-design/SKILL.md +1 -1
- package/dist/agent-src/skills/design-intelligence/SKILL.md +1 -1
- package/dist/agent-src/skills/design-intelligence/data/app-interface.csv +1 -1
- package/dist/agent-src/skills/design-intelligence/data/motion.csv +17 -17
- package/dist/agent-src/skills/design-intelligence/data/ux-guidelines.csv +2 -2
- package/dist/agent-src/skills/design-intelligence/references/context-and-registers.md +17 -0
- package/dist/agent-src/skills/design-intelligence/references/design-rules-checklist.md +4 -4
- package/dist/agent-src/skills/design-review/SKILL.md +1 -1
- package/dist/agent-src/skills/design-variations/SKILL.md +1 -1
- package/dist/agent-src/skills/evaluate-llm-feature/SKILL.md +1 -1
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +1 -1
- package/dist/agent-src/skills/fe-design/SKILL.md +32 -5
- package/dist/agent-src/skills/fe-design/references/craft-floor.md +7 -0
- package/dist/agent-src/skills/fe-design/references/design-patterns.md +47 -2
- package/dist/agent-src/skills/laravel-scheduling/SKILL.md +3 -1
- package/dist/agent-src/skills/markitdown/SKILL.md +1 -1
- package/dist/agent-src/skills/project-analyzer/SKILL.md +0 -6
- package/dist/agent-src/skills/react-native-setup/SKILL.md +3 -3
- package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +1 -1
- package/dist/agent-src/skills/sequential-thinking/SKILL.md +18 -8
- package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +28 -6
- package/dist/agent-src/skills/tailwind-engineer/SKILL.md +1 -1
- package/dist/agent-src/skills/test-driven-development/SKILL.md +1 -3
- package/dist/agent-src/skills/ui-apply-generic/SKILL.md +1 -1
- package/dist/agent-src/skills/ui-component-architect/SKILL.md +1 -1
- package/dist/agent-src/skills/using-git-worktrees/SKILL.md +17 -2
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +14 -1
- package/dist/agent-src/templates/scripts/telemetry/mcp_lite.ts +213 -0
- package/dist/agent-src/templates/scripts/telemetry/report_renderer.ts +16 -0
- package/dist/agent-src/templates/scripts/telemetry_report.ts +22 -2
- package/dist/cli/commands/recordTriggerEval.js +2 -2
- package/dist/cli/main.js +1 -1
- package/dist/cli/mcp/dispatch.js +10 -0
- package/dist/cli/mcp/stdio.js +33 -2
- package/dist/cli/mcp/telemetry.js +227 -0
- package/dist/cli-delegate/{chunk-AKJGUQNO.js → chunk-C6IPZRDA.js} +484 -353
- package/dist/cli-delegate/{chunk-CYH5SP6M.js → chunk-I6RHFQEG.js} +151 -16
- package/dist/cli-delegate/{chunk-7RXIKF62.js → chunk-NUMQHLS5.js} +304 -136
- package/dist/cli-delegate/{chunk-PMEKGDED.js → chunk-PI2GU3DP.js} +163 -1
- package/dist/cli-delegate/{chunk-7PRE6ZV2.js → chunk-YS6XTLEK.js} +199 -4
- package/dist/cli-delegate/chunk-ZVBOHSVF.js +1109 -0
- package/dist/cli-delegate/cmd_adr_effective.js +318 -81
- package/dist/cli-delegate/cmd_conformance.js +489 -121
- package/dist/cli-delegate/cmd_doctor.js +2 -2
- package/dist/cli-delegate/cmd_export.js +2 -2
- package/dist/cli-delegate/cmd_handoff.js +42 -12
- package/dist/cli-delegate/cmd_memory_get.js +1 -1
- package/dist/cli-delegate/cmd_prune.js +2 -2
- package/dist/cli-delegate/cmd_route_audit.js +2 -2
- package/dist/cli-delegate/cmd_session_recycle.js +59 -902
- package/dist/cli-delegate/cmd_settings_migrate.js +2 -2
- package/dist/cli-delegate/cmd_sync.js +2 -2
- package/dist/cli-delegate/cmd_uninstall.js +2 -2
- package/dist/cli-delegate/cmd_validate.js +2 -2
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +34 -33
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +1 -1
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +2 -2
- package/dist/discovery/trust-report.md +1 -1
- package/dist/discovery/workspaces.json +2 -2
- package/dist/hooks/dispatch.js +4455 -3025
- package/dist/install/install.mjs +975 -689
- package/dist/mcp/registry-manifest.json +2 -2
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +2087 -1134
- package/dist/scripts/_lib/model_tier.js +1 -1
- package/dist/scripts/mcp_server/telemetry.js +148 -0
- package/docs/guidelines/agent-infra/evaluator-independence-mechanics.md +1 -1
- package/docs/guidelines/agent-infra/naming.md +1 -1
- package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +1 -1
- package/docs/guidelines/agent-infra/security-lint-containment.md +46 -6
- package/docs/guidelines/agent-infra/self-improvement-pipeline.md +4 -4
- package/docs/guidelines/agent-infra/untrusted-input-spotlighting.md +1 -1
- package/docs/guidelines/design-antipatterns.md +87 -64
- package/docs/guidelines/redundancy-taxonomy.md +28 -0
- package/package.json +1 -1
- package/src/agent-src/README.md +1 -1
- package/src/agent-src/templates/scripts/telemetry/mcp_lite.ts +213 -0
- package/src/agent-src/templates/scripts/telemetry/report_renderer.ts +16 -0
- package/src/agent-src/templates/scripts/telemetry_report.ts +22 -2
- package/src/config/assurance-capability-registry.json +9 -0
- package/src/config/ci-local-parity.yml +6 -0
- package/src/config/gate-coverage.yml +225 -0
- package/src/config/gate-violation-baselines.json +18 -6
- package/src/config/release-gate-locality.yml +12 -0
- package/src/scripts/_cli/cmd_doctor.ts +2 -2
- package/src/scripts/_cli/cmd_handoff.ts +1 -1
- package/src/scripts/_cli/cmd_session_recycle.ts +51 -3
- package/src/scripts/_cli/cmd_update.ts +1 -1
- package/src/scripts/_cli/cmd_versions.ts +1 -1
- package/src/scripts/_lib/adr_frontmatter.ts +44 -0
- package/src/scripts/_lib/audit_field_provenance.ts +44 -3
- package/src/scripts/_lib/consequence_objects.ts +152 -0
- package/src/scripts/_lib/exec_evidence.ts +7 -0
- package/src/scripts/_lib/global_deploy_inventory.ts +2 -2
- package/src/scripts/_lib/host_capability.ts +38 -0
- package/src/scripts/_lib/host_permission_checks.ts +251 -0
- package/src/scripts/_lib/install_reach_checks.ts +33 -1
- package/src/scripts/_lib/mcp_bridge.ts +222 -10
- package/src/scripts/_lib/mcp_consent_residual.ts +173 -0
- package/src/scripts/_lib/model_tier.ts +1 -1
- package/src/scripts/_lib/obligation_frequency.ts +2 -2
- package/src/scripts/_lib/orchestration_record.ts +23 -1
- package/src/scripts/_lib/recycle_envelope_paths.ts +190 -0
- package/src/scripts/_lib/release_highlights.ts +93 -0
- package/src/scripts/_lib/release_material.ts +64 -1
- package/src/scripts/_lib/release_position.ts +96 -0
- package/src/scripts/_lib/review_skipped_record.ts +17 -1
- package/src/scripts/_lib/runtime_journal.ts +26 -3
- package/src/scripts/_lib/runtime_wiring_checks.ts +12 -1
- package/src/scripts/_lib/security_lint.ts +179 -7
- package/src/scripts/_lib/self_repair.ts +141 -6
- package/src/scripts/_lib/self_repair_store.ts +273 -7
- package/src/scripts/_lib/session_register.ts +11 -6
- package/src/scripts/_lib/sqlite_schema.ts +22 -0
- package/src/scripts/_lib/subagent_capsule.ts +155 -3
- package/src/scripts/_lib/surface.ts +86 -0
- package/src/scripts/_lib/ui_authority.ts +116 -0
- package/src/scripts/adr/regenerate_index.ts +54 -1
- package/src/scripts/adr_cite_check.ts +71 -15
- package/src/scripts/ai_council/clients.ts +1 -1
- package/src/scripts/autonomy_friction_corpus.ts +229 -0
- package/src/scripts/build_proof.ts +15 -2
- package/src/scripts/build_rule_trigger_matrix.ts +5 -0
- package/src/scripts/check_beta_review_markers.ts +141 -17
- package/src/scripts/check_enforcement_coverage.ts +1 -1
- package/src/scripts/check_enforcement_denominator.ts +121 -11
- package/src/scripts/check_finding_dispositions.ts +66 -9
- package/src/scripts/check_gate_coverage.ts +96 -0
- package/src/scripts/check_mcp_doc_drift.ts +217 -0
- package/src/scripts/check_pack_size.ts +321 -3
- package/src/scripts/check_release_highlights.ts +74 -1
- package/src/scripts/check_skill_activation_claim.ts +179 -0
- package/src/scripts/check_trigger_evals.ts +1 -1
- package/src/scripts/conformance_scan.ts +44 -3
- package/src/scripts/explain_run.ts +1 -1
- package/src/scripts/generate_capability_matrix.ts +1 -1
- package/src/scripts/git_authorization_hook.ts +75 -1
- package/src/scripts/handoff_context_hook.ts +54 -7
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +14 -11
- package/src/scripts/hooks/augment-dispatcher.sh +1 -1
- package/src/scripts/hooks/category_a.ts +291 -0
- package/src/scripts/hooks/cline-dispatcher.sh +1 -1
- package/src/scripts/hooks/cursor-dispatcher.sh +11 -5
- package/src/scripts/hooks/dispatch_hook.ts +17 -22
- package/src/scripts/hooks/git_command_classifier.ts +156 -1
- package/src/scripts/hooks/host_lowering.ts +215 -0
- package/src/scripts/hooks/host_lowering.yaml +185 -0
- package/src/scripts/hooks/host_semantics.ts +105 -37
- package/src/scripts/hooks/journal_record_hook.ts +10 -0
- package/src/scripts/hooks/permission_gate.ts +117 -0
- package/src/scripts/hooks/session_eol_hook.ts +18 -7
- package/src/scripts/hooks_status.ts +12 -10
- package/src/scripts/install.ts +57 -86
- package/src/scripts/install_anthropic_key.sh +2 -2
- package/src/scripts/lint_agent_security.ts +316 -25
- package/src/scripts/lint_confusables.ts +42 -6
- package/src/scripts/lint_design_antipattern_parity.ts +80 -0
- package/src/scripts/lint_evidence_artifacts.ts +45 -1
- package/src/scripts/lint_handoffs.ts +0 -132
- package/src/scripts/lint_hidden_unicode.ts +49 -7
- package/src/scripts/lint_hook_manifest.ts +87 -3
- package/src/scripts/lint_instruction_smuggling.ts +42 -6
- package/src/scripts/lint_mcp_config_security.ts +42 -6
- package/src/scripts/lint_motion_authority_drift.ts +731 -0
- package/src/scripts/lint_readme_size.ts +158 -12
- package/src/scripts/lint_reasoning_fixtures.ts +216 -0
- package/src/scripts/lint_roadmap_later_disposition.ts +217 -27
- package/src/scripts/lint_skill_frontmatter_safety.ts +43 -7
- package/src/scripts/lint_skill_trigger_contradiction.ts +161 -0
- package/src/scripts/mcp_server/resources.ts +41 -0
- package/src/scripts/mcp_server/telemetry.ts +19 -4
- package/src/scripts/measure_sibling_naming.ts +150 -0
- package/src/scripts/orchestration_record.ts +12 -1
- package/src/scripts/redact_hook_capture.ts +1 -1
- package/src/scripts/release.ts +24 -24
- package/src/scripts/release_publication.ts +6 -2
- package/src/scripts/report_skill_activation.ts +319 -7
- package/src/scripts/schemas/review-findings.schema.json +5 -0
- package/src/scripts/schemas/skill.schema.json +2 -2
- package/src/scripts/self_repair_cli.ts +31 -1
- package/src/scripts/session_canary_hook.ts +1 -1
- package/src/scripts/session_register_hook.ts +4 -3
- package/src/scripts/skill_scout.ts +69 -0
- package/src/scripts/trigger_eval_grandfather.json +5 -1
- package/src/scripts/validate_agent_settings.ts +1 -1
- package/dist/cli-delegate/chunk-2GNWGMAL.js +0 -172
- package/dist/cli-delegate/chunk-LPPWO5CE.js +0 -161
|
@@ -21,6 +21,8 @@ import {
|
|
|
21
21
|
is_ancestor,
|
|
22
22
|
load_inventory,
|
|
23
23
|
manifest_path,
|
|
24
|
+
printResiduals,
|
|
25
|
+
probeHostCapabilities,
|
|
24
26
|
read_manifest,
|
|
25
27
|
reap_stale,
|
|
26
28
|
reap_tagged_orphans,
|
|
@@ -28,7 +30,7 @@ import {
|
|
|
28
30
|
save_inventory,
|
|
29
31
|
upsert_tool,
|
|
30
32
|
write_manifest
|
|
31
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-PI2GU3DP.js";
|
|
32
34
|
import {
|
|
33
35
|
check_version,
|
|
34
36
|
classify_mismatch,
|
|
@@ -272,11 +274,11 @@ function subtract_pointers(doc, entries) {
|
|
|
272
274
|
// src/scripts/install.ts
|
|
273
275
|
import { spawn, spawnSync } from "node:child_process";
|
|
274
276
|
import * as crypto3 from "node:crypto";
|
|
275
|
-
import * as
|
|
277
|
+
import * as fs12 from "node:fs";
|
|
276
278
|
import * as os3 from "node:os";
|
|
277
|
-
import * as
|
|
279
|
+
import * as path10 from "node:path";
|
|
278
280
|
import process2 from "node:process";
|
|
279
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
281
|
+
import { fileURLToPath as fileURLToPath2, pathToFileURL } from "node:url";
|
|
280
282
|
|
|
281
283
|
// src/scripts/_lib/claude_builtin_names.ts
|
|
282
284
|
var _CURRENT = [
|
|
@@ -398,16 +400,82 @@ function is_claude_builtin_name(slug) {
|
|
|
398
400
|
import * as fs from "node:fs";
|
|
399
401
|
import * as path from "node:path";
|
|
400
402
|
var MCP_SERVER_KEY = "agent-config";
|
|
401
|
-
var
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
403
|
+
var MCP_PACKAGE_NAME = "@event4u/agent-config";
|
|
404
|
+
function mcpBridgeEntry(packageRoot) {
|
|
405
|
+
const version = readPackageVersion(packageRoot);
|
|
406
|
+
const spec = version === null ? MCP_PACKAGE_NAME : `${MCP_PACKAGE_NAME}@${version}`;
|
|
407
|
+
return {
|
|
408
|
+
mcpServers: {
|
|
409
|
+
[MCP_SERVER_KEY]: {
|
|
410
|
+
command: "npx",
|
|
411
|
+
args: ["-y", spec, "mcp-server"]
|
|
412
|
+
}
|
|
406
413
|
}
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
function readPackageVersion(packageRoot) {
|
|
417
|
+
try {
|
|
418
|
+
const raw = fs.readFileSync(path.join(packageRoot, "package.json"), "utf-8");
|
|
419
|
+
const v = JSON.parse(raw).version;
|
|
420
|
+
return typeof v === "string" && v.trim() !== "" ? v : null;
|
|
421
|
+
} catch {
|
|
422
|
+
return null;
|
|
407
423
|
}
|
|
408
|
-
}
|
|
424
|
+
}
|
|
409
425
|
function makeEnsureMcpBridge(mergeJsonFile) {
|
|
410
|
-
return (projectRoot, force) => mergeJsonFile(
|
|
426
|
+
return (projectRoot, force, packageRoot = projectRoot) => mergeJsonFile(
|
|
427
|
+
path.join(projectRoot, ".mcp.json"),
|
|
428
|
+
mcpBridgeEntry(packageRoot),
|
|
429
|
+
force,
|
|
430
|
+
".mcp.json"
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
var MCP_PROJECT_CONFIG = {
|
|
434
|
+
"claude-code": { hostId: "claude", relPath: ".mcp.json" },
|
|
435
|
+
cursor: { hostId: "cursor", relPath: ".cursor/mcp.json" },
|
|
436
|
+
"gemini-cli": { hostId: "gemini", relPath: ".gemini/settings.json" }
|
|
437
|
+
};
|
|
438
|
+
function mcpRegistrationTargets(tools, readsConfig) {
|
|
439
|
+
const out = [];
|
|
440
|
+
for (const [toolId, spec] of Object.entries(MCP_PROJECT_CONFIG)) {
|
|
441
|
+
if (toolId === "claude-code") continue;
|
|
442
|
+
if (!tools.has(toolId)) continue;
|
|
443
|
+
if (!readsConfig(spec.hostId)) continue;
|
|
444
|
+
out.push({ toolId, hostId: spec.hostId, relPath: spec.relPath });
|
|
445
|
+
}
|
|
446
|
+
return out;
|
|
447
|
+
}
|
|
448
|
+
function makeEnsureMcpRegistrations(mergeJsonFile) {
|
|
449
|
+
return (projectRoot, force, packageRoot, targets) => {
|
|
450
|
+
const merged = {};
|
|
451
|
+
for (const t of targets) {
|
|
452
|
+
merged[t.toolId] = mergeJsonFile(
|
|
453
|
+
path.join(projectRoot, ...t.relPath.split("/")),
|
|
454
|
+
mcpBridgeEntry(packageRoot),
|
|
455
|
+
force,
|
|
456
|
+
t.relPath
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
return merged;
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
function readsProjectMcpConfig(hostId) {
|
|
463
|
+
return probeHostCapabilities(hostId).reads_project_mcp_config;
|
|
464
|
+
}
|
|
465
|
+
function registerMcpHosts(mergeJsonFile, projectRoot, force, packageRoot, tools, into, readsConfig = readsProjectMcpConfig) {
|
|
466
|
+
const ensure = makeEnsureMcpRegistrations(mergeJsonFile);
|
|
467
|
+
const claude = MCP_PROJECT_CONFIG["claude-code"];
|
|
468
|
+
if (tools.has("claude-code") && claude !== void 0) {
|
|
469
|
+
const merged = ensure(projectRoot, force, packageRoot, [
|
|
470
|
+
{ toolId: "claude-code", hostId: claude.hostId, relPath: claude.relPath }
|
|
471
|
+
]);
|
|
472
|
+
(into["claude-code"] ??= []).push(...merged["claude-code"] ?? []);
|
|
473
|
+
}
|
|
474
|
+
for (const [toolId, keys] of Object.entries(
|
|
475
|
+
ensure(projectRoot, force, packageRoot, mcpRegistrationTargets(tools, readsConfig))
|
|
476
|
+
)) {
|
|
477
|
+
(into[toolId] ??= []).push(...keys);
|
|
478
|
+
}
|
|
411
479
|
}
|
|
412
480
|
function projectionModeOf(raw) {
|
|
413
481
|
return raw === "scoped" ? "scoped" : raw === "tiered" ? "tiered" : "legacy-all";
|
|
@@ -1151,27 +1219,121 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
|
|
|
1151
1219
|
return written;
|
|
1152
1220
|
}
|
|
1153
1221
|
|
|
1222
|
+
// src/scripts/hooks/host_lowering.ts
|
|
1223
|
+
var import_yaml2 = __toESM(require_dist(), 1);
|
|
1224
|
+
import * as fs6 from "node:fs";
|
|
1225
|
+
import * as path6 from "node:path";
|
|
1226
|
+
import { fileURLToPath } from "node:url";
|
|
1227
|
+
var _IN_BUNDLE = true;
|
|
1228
|
+
var _REPO_ROOT = path6.resolve(
|
|
1229
|
+
path6.dirname(fileURLToPath(import.meta.url)),
|
|
1230
|
+
..._IN_BUNDLE ? ["..", ".."] : ["..", "..", ".."]
|
|
1231
|
+
);
|
|
1232
|
+
var HOST_LOWERING_PATH = path6.join(_REPO_ROOT, "src", "scripts", "hooks", "host_lowering.yaml");
|
|
1233
|
+
var DEFAULT_SURFACE = "any";
|
|
1234
|
+
function _asString(v) {
|
|
1235
|
+
if (v === null || v === void 0) return null;
|
|
1236
|
+
if (v instanceof Date) return v.toISOString().slice(0, 10);
|
|
1237
|
+
return String(v);
|
|
1238
|
+
}
|
|
1239
|
+
function _parse(text) {
|
|
1240
|
+
const raw = (0, import_yaml2.parse)(text);
|
|
1241
|
+
const hostsRaw = raw?.["hosts"];
|
|
1242
|
+
if (typeof hostsRaw !== "object" || hostsRaw === null) {
|
|
1243
|
+
throw new Error("host_lowering.yaml: missing `hosts:` map");
|
|
1244
|
+
}
|
|
1245
|
+
const out = /* @__PURE__ */ new Map();
|
|
1246
|
+
for (const [host, hv] of Object.entries(hostsRaw)) {
|
|
1247
|
+
const surfacesRaw = hv?.["surfaces"];
|
|
1248
|
+
if (typeof surfacesRaw !== "object" || surfacesRaw === null) {
|
|
1249
|
+
throw new Error(`host_lowering.yaml: ${host} has no \`surfaces:\` map`);
|
|
1250
|
+
}
|
|
1251
|
+
const surfaces = /* @__PURE__ */ new Map();
|
|
1252
|
+
for (const [surface, sv] of Object.entries(surfacesRaw)) {
|
|
1253
|
+
const s = sv;
|
|
1254
|
+
const verifiedRaw = s["verified"];
|
|
1255
|
+
let verified = null;
|
|
1256
|
+
if (verifiedRaw) {
|
|
1257
|
+
const expires = _asString(verifiedRaw["expires"]);
|
|
1258
|
+
if (!expires) {
|
|
1259
|
+
throw new Error(`host_lowering.yaml: ${host}/${surface} verified block has no \`expires\``);
|
|
1260
|
+
}
|
|
1261
|
+
verified = {
|
|
1262
|
+
docs_at: _asString(verifiedRaw["docs_at"]),
|
|
1263
|
+
docs_url: _asString(verifiedRaw["docs_url"]),
|
|
1264
|
+
probe_at: _asString(verifiedRaw["probe_at"]),
|
|
1265
|
+
host_version: _asString(verifiedRaw["host_version"]),
|
|
1266
|
+
expires
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
const slots = /* @__PURE__ */ new Map();
|
|
1270
|
+
for (const [slot, rvRaw] of Object.entries(s["slots"] ?? {})) {
|
|
1271
|
+
const rv = rvRaw;
|
|
1272
|
+
const nativeRaw = rv["native"];
|
|
1273
|
+
const native = Array.isArray(nativeRaw) ? nativeRaw.map(String) : [String(nativeRaw)];
|
|
1274
|
+
const be = rv["block_exit"];
|
|
1275
|
+
const row = {
|
|
1276
|
+
native,
|
|
1277
|
+
block_exit: typeof be === "number" ? be : null
|
|
1278
|
+
};
|
|
1279
|
+
if (typeof rv["matcher"] === "string") row.matcher = rv["matcher"];
|
|
1280
|
+
slots.set(slot, row);
|
|
1281
|
+
}
|
|
1282
|
+
surfaces.set(surface, {
|
|
1283
|
+
entry_shape: String(s["entry_shape"] ?? "none"),
|
|
1284
|
+
json_shape: String(s["json_shape"] ?? "none"),
|
|
1285
|
+
fail_policy: String(s["fail_policy"] ?? "discard"),
|
|
1286
|
+
timeout_unit: String(s["timeout_unit"] ?? "unknown"),
|
|
1287
|
+
timeout_default: typeof s["timeout_default"] === "number" ? s["timeout_default"] : null,
|
|
1288
|
+
verified,
|
|
1289
|
+
slots
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
out.set(host, surfaces);
|
|
1293
|
+
}
|
|
1294
|
+
return out;
|
|
1295
|
+
}
|
|
1296
|
+
var _cache = null;
|
|
1297
|
+
function loadHostLowering() {
|
|
1298
|
+
if (_cache === null) _cache = _parse(fs6.readFileSync(HOST_LOWERING_PATH, "utf-8"));
|
|
1299
|
+
return _cache;
|
|
1300
|
+
}
|
|
1301
|
+
function surfaceRow(host, surface = DEFAULT_SURFACE, table = loadHostLowering()) {
|
|
1302
|
+
return table.get(host)?.get(surface) ?? table.get(host)?.get(DEFAULT_SURFACE) ?? null;
|
|
1303
|
+
}
|
|
1304
|
+
function hostBindings(host, table = loadHostLowering()) {
|
|
1305
|
+
const row = surfaceRow(host, DEFAULT_SURFACE, table);
|
|
1306
|
+
if (!row) return [];
|
|
1307
|
+
const out = [];
|
|
1308
|
+
for (const [slot, sr] of row.slots) {
|
|
1309
|
+
for (const native of sr.native) {
|
|
1310
|
+
out.push({ slot, native, matcher: sr.matcher ?? "" });
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
return out;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1154
1316
|
// src/install/partitionEligibility.ts
|
|
1155
|
-
import * as
|
|
1317
|
+
import * as fs8 from "node:fs";
|
|
1156
1318
|
import * as os2 from "node:os";
|
|
1157
1319
|
|
|
1158
1320
|
// src/install/hostLayerFingerprint.ts
|
|
1159
1321
|
import { createHash as createHash4 } from "node:crypto";
|
|
1160
|
-
import * as
|
|
1161
|
-
import * as
|
|
1322
|
+
import * as fs7 from "node:fs";
|
|
1323
|
+
import * as path7 from "node:path";
|
|
1162
1324
|
var FINGERPRINT_SCHEMA = 1;
|
|
1163
1325
|
function collectFiles(dir) {
|
|
1164
1326
|
const out = [];
|
|
1165
1327
|
const walk = (d) => {
|
|
1166
1328
|
let entries;
|
|
1167
1329
|
try {
|
|
1168
|
-
entries =
|
|
1330
|
+
entries = fs7.readdirSync(d, { withFileTypes: true });
|
|
1169
1331
|
} catch {
|
|
1170
1332
|
return;
|
|
1171
1333
|
}
|
|
1172
1334
|
const sorted = [...entries].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
1173
1335
|
for (const e of sorted) {
|
|
1174
|
-
const p =
|
|
1336
|
+
const p = path7.join(d, e.name);
|
|
1175
1337
|
if (e.isDirectory()) {
|
|
1176
1338
|
walk(p);
|
|
1177
1339
|
} else if (e.isFile()) {
|
|
@@ -1188,10 +1350,10 @@ function fingerprintLayers(layers) {
|
|
|
1188
1350
|
for (const layer of layers) {
|
|
1189
1351
|
h.update(`layer:${layer.label}\0`);
|
|
1190
1352
|
for (const file of collectFiles(layer.root)) {
|
|
1191
|
-
h.update(
|
|
1353
|
+
h.update(path7.relative(layer.root, file));
|
|
1192
1354
|
h.update("\0");
|
|
1193
1355
|
try {
|
|
1194
|
-
h.update(
|
|
1356
|
+
h.update(fs7.readFileSync(file));
|
|
1195
1357
|
} catch {
|
|
1196
1358
|
h.update("\0unreadable\0");
|
|
1197
1359
|
}
|
|
@@ -1201,11 +1363,11 @@ function fingerprintLayers(layers) {
|
|
|
1201
1363
|
return h.digest("hex");
|
|
1202
1364
|
}
|
|
1203
1365
|
function hostLayerInputs(userHome) {
|
|
1204
|
-
const claude =
|
|
1366
|
+
const claude = path7.join(userHome, ".claude");
|
|
1205
1367
|
return [
|
|
1206
|
-
{ label: "rules", root:
|
|
1207
|
-
{ label: "skills", root:
|
|
1208
|
-
{ label: "commands", root:
|
|
1368
|
+
{ label: "rules", root: path7.join(claude, "rules") },
|
|
1369
|
+
{ label: "skills", root: path7.join(claude, "skills") },
|
|
1370
|
+
{ label: "commands", root: path7.join(claude, "commands") }
|
|
1209
1371
|
];
|
|
1210
1372
|
}
|
|
1211
1373
|
|
|
@@ -1214,7 +1376,7 @@ var MAINTAINER_WORKSPACE = "agent-config-maintainer";
|
|
|
1214
1376
|
function isExclusivelyPackageOnly(source_path) {
|
|
1215
1377
|
let meta;
|
|
1216
1378
|
try {
|
|
1217
|
-
[meta] = parseFrontmatter(
|
|
1379
|
+
[meta] = parseFrontmatter(fs8.readFileSync(source_path, "utf-8"));
|
|
1218
1380
|
} catch {
|
|
1219
1381
|
return false;
|
|
1220
1382
|
}
|
|
@@ -1245,8 +1407,8 @@ function stampHostLayerFingerprint(installedVersion, tools, lockfilePath, skip2,
|
|
|
1245
1407
|
}
|
|
1246
1408
|
|
|
1247
1409
|
// src/install/claudeRuleRewrite.ts
|
|
1248
|
-
import * as
|
|
1249
|
-
import * as
|
|
1410
|
+
import * as fs9 from "node:fs";
|
|
1411
|
+
import * as path8 from "node:path";
|
|
1250
1412
|
|
|
1251
1413
|
// src/install/claudePathsPlan.ts
|
|
1252
1414
|
function derive_trigger_globs(meta) {
|
|
@@ -1402,22 +1564,22 @@ function rewriteClaudeRules(rulesDir) {
|
|
|
1402
1564
|
const result = { rewritten: 0, scoped: [], dropped: [], failed: [] };
|
|
1403
1565
|
let entries;
|
|
1404
1566
|
try {
|
|
1405
|
-
entries =
|
|
1567
|
+
entries = fs9.readdirSync(rulesDir);
|
|
1406
1568
|
} catch {
|
|
1407
1569
|
return result;
|
|
1408
1570
|
}
|
|
1409
1571
|
for (const name of entries.filter((n) => n.endsWith(".md")).sort()) {
|
|
1410
|
-
const full =
|
|
1572
|
+
const full = path8.join(rulesDir, name);
|
|
1411
1573
|
let stat;
|
|
1412
1574
|
try {
|
|
1413
|
-
stat =
|
|
1575
|
+
stat = fs9.lstatSync(full);
|
|
1414
1576
|
} catch {
|
|
1415
1577
|
continue;
|
|
1416
1578
|
}
|
|
1417
1579
|
if (!stat.isFile() || stat.isSymbolicLink()) continue;
|
|
1418
1580
|
let text;
|
|
1419
1581
|
try {
|
|
1420
|
-
text =
|
|
1582
|
+
text = fs9.readFileSync(full, "utf-8");
|
|
1421
1583
|
} catch {
|
|
1422
1584
|
continue;
|
|
1423
1585
|
}
|
|
@@ -1427,7 +1589,7 @@ function rewriteClaudeRules(rulesDir) {
|
|
|
1427
1589
|
const withOwnership = _withPreservedKeys(rendered.text, text);
|
|
1428
1590
|
if (withOwnership !== text) {
|
|
1429
1591
|
try {
|
|
1430
|
-
|
|
1592
|
+
fs9.writeFileSync(full, withOwnership, "utf-8");
|
|
1431
1593
|
} catch (e) {
|
|
1432
1594
|
result.failed.push({
|
|
1433
1595
|
rule: name.slice(0, -3),
|
|
@@ -2801,8 +2963,8 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
2801
2963
|
};
|
|
2802
2964
|
|
|
2803
2965
|
// src/scripts/_lib/module_detection.ts
|
|
2804
|
-
import * as
|
|
2805
|
-
import * as
|
|
2966
|
+
import * as fs10 from "node:fs";
|
|
2967
|
+
import * as path9 from "node:path";
|
|
2806
2968
|
var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
|
|
2807
2969
|
var _RULES = [
|
|
2808
2970
|
["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
|
|
@@ -2816,14 +2978,14 @@ var _RULES = [
|
|
|
2816
2978
|
];
|
|
2817
2979
|
function _isDir(p) {
|
|
2818
2980
|
try {
|
|
2819
|
-
return
|
|
2981
|
+
return fs10.statSync(p).isDirectory();
|
|
2820
2982
|
} catch {
|
|
2821
2983
|
return false;
|
|
2822
2984
|
}
|
|
2823
2985
|
}
|
|
2824
2986
|
function _isFile(p) {
|
|
2825
2987
|
try {
|
|
2826
|
-
return
|
|
2988
|
+
return fs10.statSync(p).isFile();
|
|
2827
2989
|
} catch {
|
|
2828
2990
|
return false;
|
|
2829
2991
|
}
|
|
@@ -2837,13 +2999,13 @@ function _isUpperChar(ch) {
|
|
|
2837
2999
|
function _list_module_subdirs(root) {
|
|
2838
3000
|
let entries;
|
|
2839
3001
|
try {
|
|
2840
|
-
entries =
|
|
3002
|
+
entries = fs10.readdirSync(root).sort();
|
|
2841
3003
|
} catch {
|
|
2842
3004
|
return [];
|
|
2843
3005
|
}
|
|
2844
3006
|
const out = [];
|
|
2845
3007
|
for (const name of entries) {
|
|
2846
|
-
if (!_isDir(
|
|
3008
|
+
if (!_isDir(path9.join(root, name))) {
|
|
2847
3009
|
continue;
|
|
2848
3010
|
}
|
|
2849
3011
|
if (name.startsWith(".")) {
|
|
@@ -2865,11 +3027,11 @@ function _score_confidence(stack, root, subdirs) {
|
|
|
2865
3027
|
return capitalized.length > 0 ? "high" : "medium";
|
|
2866
3028
|
}
|
|
2867
3029
|
if (stack === "node-monorepo") {
|
|
2868
|
-
const withPkgJson = subdirs.filter((name) => _isFile(
|
|
3030
|
+
const withPkgJson = subdirs.filter((name) => _isFile(path9.join(root, name, "package.json")));
|
|
2869
3031
|
return withPkgJson.length > 0 ? "high" : "medium";
|
|
2870
3032
|
}
|
|
2871
3033
|
if (stack === "python-src") {
|
|
2872
|
-
const withInit = subdirs.filter((name) => _isFile(
|
|
3034
|
+
const withInit = subdirs.filter((name) => _isFile(path9.join(root, name, "__init__.py")));
|
|
2873
3035
|
return withInit.length > 0 ? "high" : "medium";
|
|
2874
3036
|
}
|
|
2875
3037
|
if (stack === "go-internal") {
|
|
@@ -2881,7 +3043,7 @@ function detect_module_roots(project_root) {
|
|
|
2881
3043
|
const high = [];
|
|
2882
3044
|
const medium = [];
|
|
2883
3045
|
for (const [rel_path, stack, namespace_template] of _RULES) {
|
|
2884
|
-
const abs_path =
|
|
3046
|
+
const abs_path = path9.join(project_root, rel_path);
|
|
2885
3047
|
if (!_isDir(abs_path)) {
|
|
2886
3048
|
continue;
|
|
2887
3049
|
}
|
|
@@ -2903,7 +3065,7 @@ function detect_module_roots(project_root) {
|
|
|
2903
3065
|
}
|
|
2904
3066
|
|
|
2905
3067
|
// src/scripts/_lib/model_tier.ts
|
|
2906
|
-
import
|
|
3068
|
+
import fs11 from "node:fs";
|
|
2907
3069
|
var TIER_TO_CLAUDE_MODEL = {
|
|
2908
3070
|
frontier: "fable",
|
|
2909
3071
|
high: "opus",
|
|
@@ -2912,8 +3074,8 @@ var TIER_TO_CLAUDE_MODEL = {
|
|
|
2912
3074
|
};
|
|
2913
3075
|
var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
|
|
2914
3076
|
function read_model_tier(skill_md) {
|
|
2915
|
-
if (!
|
|
2916
|
-
const text =
|
|
3077
|
+
if (!fs11.existsSync(skill_md)) return null;
|
|
3078
|
+
const text = fs11.readFileSync(skill_md).toString("utf-8");
|
|
2917
3079
|
if (!text.startsWith("---\n")) return null;
|
|
2918
3080
|
const end = text.indexOf("\n---\n", 4);
|
|
2919
3081
|
if (end === -1) return null;
|
|
@@ -2929,7 +3091,7 @@ function render_native_model_md(text, tier) {
|
|
|
2929
3091
|
}
|
|
2930
3092
|
|
|
2931
3093
|
// src/scripts/install.ts
|
|
2932
|
-
var _HERE =
|
|
3094
|
+
var _HERE = fileURLToPath2(import.meta.url);
|
|
2933
3095
|
var SystemExitError = class extends Error {
|
|
2934
3096
|
constructor(code) {
|
|
2935
3097
|
super(`system-exit-${code}`);
|
|
@@ -2947,34 +3109,34 @@ var ArgparseExit = class extends Error {
|
|
|
2947
3109
|
function expanduser2(p) {
|
|
2948
3110
|
if (p === "~") return os3.homedir();
|
|
2949
3111
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
2950
|
-
return
|
|
3112
|
+
return path10.join(os3.homedir(), p.slice(2));
|
|
2951
3113
|
}
|
|
2952
3114
|
return p;
|
|
2953
3115
|
}
|
|
2954
3116
|
function resolvePath(p) {
|
|
2955
3117
|
try {
|
|
2956
|
-
return
|
|
3118
|
+
return fs12.realpathSync(path10.resolve(p));
|
|
2957
3119
|
} catch {
|
|
2958
|
-
return
|
|
3120
|
+
return path10.resolve(p);
|
|
2959
3121
|
}
|
|
2960
3122
|
}
|
|
2961
3123
|
function isFile(p) {
|
|
2962
3124
|
try {
|
|
2963
|
-
return
|
|
3125
|
+
return fs12.statSync(p).isFile();
|
|
2964
3126
|
} catch {
|
|
2965
3127
|
return false;
|
|
2966
3128
|
}
|
|
2967
3129
|
}
|
|
2968
3130
|
function isDir(p) {
|
|
2969
3131
|
try {
|
|
2970
|
-
return
|
|
3132
|
+
return fs12.statSync(p).isDirectory();
|
|
2971
3133
|
} catch {
|
|
2972
3134
|
return false;
|
|
2973
3135
|
}
|
|
2974
3136
|
}
|
|
2975
3137
|
function pathExists(p) {
|
|
2976
3138
|
try {
|
|
2977
|
-
|
|
3139
|
+
fs12.statSync(p);
|
|
2978
3140
|
return true;
|
|
2979
3141
|
} catch {
|
|
2980
3142
|
return false;
|
|
@@ -2982,24 +3144,24 @@ function pathExists(p) {
|
|
|
2982
3144
|
}
|
|
2983
3145
|
function isSymlink(p) {
|
|
2984
3146
|
try {
|
|
2985
|
-
return
|
|
3147
|
+
return fs12.lstatSync(p).isSymbolicLink();
|
|
2986
3148
|
} catch {
|
|
2987
3149
|
return false;
|
|
2988
3150
|
}
|
|
2989
3151
|
}
|
|
2990
3152
|
function readText(p) {
|
|
2991
|
-
return
|
|
3153
|
+
return fs12.readFileSync(p, "utf-8");
|
|
2992
3154
|
}
|
|
2993
3155
|
function writeText(p, content) {
|
|
2994
|
-
|
|
3156
|
+
fs12.writeFileSync(p, content, "utf-8");
|
|
2995
3157
|
}
|
|
2996
3158
|
function mkdirp(p) {
|
|
2997
|
-
|
|
3159
|
+
fs12.mkdirSync(p, { recursive: true });
|
|
2998
3160
|
}
|
|
2999
3161
|
function sortedGlobStems(directory, suffix) {
|
|
3000
3162
|
let entries;
|
|
3001
3163
|
try {
|
|
3002
|
-
entries =
|
|
3164
|
+
entries = fs12.readdirSync(directory);
|
|
3003
3165
|
} catch {
|
|
3004
3166
|
return [];
|
|
3005
3167
|
}
|
|
@@ -3019,7 +3181,7 @@ function sortedGlobStems(directory, suffix) {
|
|
|
3019
3181
|
function countZips(directory) {
|
|
3020
3182
|
if (!isDir(directory)) return 0;
|
|
3021
3183
|
let n = 0;
|
|
3022
|
-
for (const name of
|
|
3184
|
+
for (const name of fs12.readdirSync(directory)) {
|
|
3023
3185
|
if (name.endsWith(".zip")) n += 1;
|
|
3024
3186
|
}
|
|
3025
3187
|
return n;
|
|
@@ -3027,35 +3189,35 @@ function countZips(directory) {
|
|
|
3027
3189
|
function sha256OfFile(p) {
|
|
3028
3190
|
let data;
|
|
3029
3191
|
try {
|
|
3030
|
-
data =
|
|
3192
|
+
data = fs12.readFileSync(p);
|
|
3031
3193
|
} catch {
|
|
3032
3194
|
return null;
|
|
3033
3195
|
}
|
|
3034
3196
|
return crypto3.createHash("sha256").update(data).digest("hex");
|
|
3035
3197
|
}
|
|
3036
3198
|
function atomicWrite0644(target, body, prefix) {
|
|
3037
|
-
const dir =
|
|
3038
|
-
const tmpName =
|
|
3199
|
+
const dir = path10.dirname(target);
|
|
3200
|
+
const tmpName = path10.join(
|
|
3039
3201
|
dir,
|
|
3040
3202
|
`${prefix}${process2.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
|
|
3041
3203
|
);
|
|
3042
3204
|
let fd = null;
|
|
3043
3205
|
try {
|
|
3044
|
-
fd =
|
|
3045
|
-
|
|
3046
|
-
|
|
3206
|
+
fd = fs12.openSync(tmpName, "wx", 420);
|
|
3207
|
+
fs12.writeFileSync(fd, body, "utf-8");
|
|
3208
|
+
fs12.closeSync(fd);
|
|
3047
3209
|
fd = null;
|
|
3048
|
-
|
|
3049
|
-
|
|
3210
|
+
fs12.chmodSync(tmpName, 420);
|
|
3211
|
+
fs12.renameSync(tmpName, target);
|
|
3050
3212
|
} catch (err) {
|
|
3051
3213
|
if (fd !== null) {
|
|
3052
3214
|
try {
|
|
3053
|
-
|
|
3215
|
+
fs12.closeSync(fd);
|
|
3054
3216
|
} catch {
|
|
3055
3217
|
}
|
|
3056
3218
|
}
|
|
3057
3219
|
try {
|
|
3058
|
-
|
|
3220
|
+
fs12.unlinkSync(tmpName);
|
|
3059
3221
|
} catch {
|
|
3060
3222
|
}
|
|
3061
3223
|
throw err;
|
|
@@ -3179,12 +3341,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
|
|
|
3179
3341
|
var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
|
|
3180
3342
|
var SETTINGS_SUBDIR = ["agents", "settings"];
|
|
3181
3343
|
function _canonical_settings_target(project_root) {
|
|
3182
|
-
return
|
|
3344
|
+
return path10.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
|
|
3183
3345
|
}
|
|
3184
3346
|
function _resolve_settings_read(project_root) {
|
|
3185
3347
|
const canonical = _canonical_settings_target(project_root);
|
|
3186
3348
|
if (pathExists(canonical)) return canonical;
|
|
3187
|
-
const legacy =
|
|
3349
|
+
const legacy = path10.join(project_root, SETTINGS_FILE);
|
|
3188
3350
|
if (pathExists(legacy)) return legacy;
|
|
3189
3351
|
return canonical;
|
|
3190
3352
|
}
|
|
@@ -3248,9 +3410,9 @@ function fail(msg) {
|
|
|
3248
3410
|
throw new SystemExitError(1);
|
|
3249
3411
|
}
|
|
3250
3412
|
function detect_package_root(project_root) {
|
|
3251
|
-
const npm_path =
|
|
3413
|
+
const npm_path = path10.join(project_root, "node_modules", "@event4u", "agent-config");
|
|
3252
3414
|
if (isDir(npm_path)) return resolvePath(npm_path);
|
|
3253
|
-
if (pathExists(
|
|
3415
|
+
if (pathExists(path10.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
3254
3416
|
return project_root;
|
|
3255
3417
|
}
|
|
3256
3418
|
fail(
|
|
@@ -3258,12 +3420,12 @@ function detect_package_root(project_root) {
|
|
|
3258
3420
|
);
|
|
3259
3421
|
}
|
|
3260
3422
|
function detect_package_type(package_root) {
|
|
3261
|
-
if (package_root.split(
|
|
3423
|
+
if (package_root.split(path10.sep).includes("node_modules")) return "npm";
|
|
3262
3424
|
return "local";
|
|
3263
3425
|
}
|
|
3264
3426
|
function detect_package_type_for_project(project_root, package_root) {
|
|
3265
3427
|
const npm_path = resolvePath(
|
|
3266
|
-
|
|
3428
|
+
path10.join(project_root, "node_modules", "@event4u", "agent-config")
|
|
3267
3429
|
);
|
|
3268
3430
|
const package_resolved = resolvePath(package_root);
|
|
3269
3431
|
if (package_resolved === npm_path) return "npm";
|
|
@@ -3283,7 +3445,7 @@ function ensure_directory(p) {
|
|
|
3283
3445
|
mkdirp(p);
|
|
3284
3446
|
}
|
|
3285
3447
|
function write_file(p, content) {
|
|
3286
|
-
ensure_directory(
|
|
3448
|
+
ensure_directory(path10.dirname(p));
|
|
3287
3449
|
writeText(p, content);
|
|
3288
3450
|
}
|
|
3289
3451
|
function read_json_file(p) {
|
|
@@ -3454,7 +3616,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
|
|
|
3454
3616
|
return rendered + "\n" + suffix;
|
|
3455
3617
|
}
|
|
3456
3618
|
function _migrate_legacy_if_present(project_root, template_body) {
|
|
3457
|
-
const legacy_target =
|
|
3619
|
+
const legacy_target = path10.join(project_root, LEGACY_SETTINGS_FILE);
|
|
3458
3620
|
if (!isFile(legacy_target)) return null;
|
|
3459
3621
|
const legacy_text = readText(legacy_target);
|
|
3460
3622
|
const [values, unknown] = _parse_legacy_settings(legacy_text);
|
|
@@ -3469,9 +3631,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
|
|
|
3469
3631
|
}
|
|
3470
3632
|
}
|
|
3471
3633
|
rendered = _append_unknown_legacy(rendered, values, unknown);
|
|
3472
|
-
const backup_target =
|
|
3634
|
+
const backup_target = path10.join(project_root, LEGACY_BACKUP_FILE);
|
|
3473
3635
|
writeText(backup_target, legacy_text);
|
|
3474
|
-
|
|
3636
|
+
fs12.unlinkSync(legacy_target);
|
|
3475
3637
|
info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
|
|
3476
3638
|
info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
|
|
3477
3639
|
if (unknown.length > 0) {
|
|
@@ -3506,7 +3668,7 @@ function _render_template(template, profile_values) {
|
|
|
3506
3668
|
return body;
|
|
3507
3669
|
}
|
|
3508
3670
|
function _load_valid_user_types(package_root) {
|
|
3509
|
-
const directory =
|
|
3671
|
+
const directory = path10.join(package_root, USER_TYPES_DIR);
|
|
3510
3672
|
if (!isDir(directory)) return [];
|
|
3511
3673
|
return sortedGlobStems(directory, ".yml");
|
|
3512
3674
|
}
|
|
@@ -3563,8 +3725,8 @@ function splitlinesKeepends(text) {
|
|
|
3563
3725
|
}
|
|
3564
3726
|
function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
|
|
3565
3727
|
const target = _canonical_settings_target(project_root);
|
|
3566
|
-
const profile_source =
|
|
3567
|
-
const template_source =
|
|
3728
|
+
const profile_source = path10.join(package_root, "src", "config", "profiles", `${profile}.ini`);
|
|
3729
|
+
const template_source = path10.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
3568
3730
|
if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
|
|
3569
3731
|
if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
|
|
3570
3732
|
const template = readText(template_source);
|
|
@@ -3578,21 +3740,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
3578
3740
|
if (profile_values["rule_loading_tier"] !== profile) {
|
|
3579
3741
|
const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
|
|
3580
3742
|
fail(
|
|
3581
|
-
`Profile preset ${
|
|
3743
|
+
`Profile preset ${path10.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
|
|
3582
3744
|
);
|
|
3583
3745
|
}
|
|
3584
3746
|
profile_values["user_type"] = _validate_user_type(package_root, user_type);
|
|
3585
3747
|
let template_body = _render_template(template, profile_values);
|
|
3586
3748
|
template_body = _inject_packs(template_body, packs ?? []);
|
|
3587
|
-
const legacy_root =
|
|
3749
|
+
const legacy_root = path10.join(project_root, SETTINGS_FILE);
|
|
3588
3750
|
if (isFile(legacy_root) && !pathExists(target)) {
|
|
3589
|
-
mkdirp(
|
|
3751
|
+
mkdirp(path10.dirname(target));
|
|
3590
3752
|
writeText(target, readText(legacy_root));
|
|
3591
|
-
|
|
3753
|
+
fs12.unlinkSync(legacy_root);
|
|
3592
3754
|
success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
|
|
3593
3755
|
return;
|
|
3594
3756
|
}
|
|
3595
|
-
const legacy_target =
|
|
3757
|
+
const legacy_target = path10.join(project_root, LEGACY_SETTINGS_FILE);
|
|
3596
3758
|
if (isFile(legacy_target) && pathExists(target)) {
|
|
3597
3759
|
warn(
|
|
3598
3760
|
`Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
|
|
@@ -3609,7 +3771,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
3609
3771
|
skip(`${SETTINGS_FILE} already exists`);
|
|
3610
3772
|
return;
|
|
3611
3773
|
}
|
|
3612
|
-
mkdirp(
|
|
3774
|
+
mkdirp(path10.dirname(target));
|
|
3613
3775
|
write_file(target, template_body);
|
|
3614
3776
|
const user_type_value = profile_values["user_type"] ?? "";
|
|
3615
3777
|
const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
|
|
@@ -3622,7 +3784,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
3622
3784
|
const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
|
|
3623
3785
|
const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
|
|
3624
3786
|
return merge_json_file(
|
|
3625
|
-
|
|
3787
|
+
path10.join(project_root, ".vscode", "settings.json"),
|
|
3626
3788
|
bridge,
|
|
3627
3789
|
force,
|
|
3628
3790
|
".vscode/settings.json"
|
|
@@ -3631,14 +3793,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
3631
3793
|
function ensure_augment_bridge(project_root, force) {
|
|
3632
3794
|
const bridge = { enabledPlugins: { "agent-config@event4u": true } };
|
|
3633
3795
|
return merge_json_file(
|
|
3634
|
-
|
|
3796
|
+
path10.join(project_root, ".augment", "settings.json"),
|
|
3635
3797
|
bridge,
|
|
3636
3798
|
force,
|
|
3637
3799
|
".augment/settings.json"
|
|
3638
3800
|
);
|
|
3639
3801
|
}
|
|
3640
|
-
var AUGMENT_USER_DIR =
|
|
3641
|
-
var AUGMENT_USER_HOOKS_DIR =
|
|
3802
|
+
var AUGMENT_USER_DIR = path10.join(os3.homedir(), ".augment");
|
|
3803
|
+
var AUGMENT_USER_HOOKS_DIR = path10.join(AUGMENT_USER_DIR, "hooks");
|
|
3642
3804
|
var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
|
|
3643
3805
|
var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
3644
3806
|
"augment-chat-history.sh",
|
|
@@ -3646,37 +3808,30 @@ var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
|
3646
3808
|
"augment-onboarding-gate.sh",
|
|
3647
3809
|
"augment-context-hygiene.sh"
|
|
3648
3810
|
];
|
|
3649
|
-
var AUGMENT_DISPATCHER_BINDINGS = [
|
|
3650
|
-
["session_start", "SessionStart"],
|
|
3651
|
-
["session_end", "SessionEnd"],
|
|
3652
|
-
["stop", "Stop"],
|
|
3653
|
-
["pre_tool_use", "PreToolUse"],
|
|
3654
|
-
["post_tool_use", "PostToolUse"]
|
|
3655
|
-
];
|
|
3656
3811
|
function _deploy_augment_trampoline(package_root, name, force) {
|
|
3657
|
-
const src =
|
|
3812
|
+
const src = path10.join(package_root, "scripts", "hooks", name);
|
|
3658
3813
|
if (!pathExists(src)) {
|
|
3659
3814
|
skip(`augment trampoline missing in package: ${src}`);
|
|
3660
3815
|
return null;
|
|
3661
3816
|
}
|
|
3662
3817
|
mkdirp(AUGMENT_USER_HOOKS_DIR);
|
|
3663
|
-
const dst =
|
|
3818
|
+
const dst = path10.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
3664
3819
|
const src_text = readText(src);
|
|
3665
3820
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3666
3821
|
skip(`~/.augment/hooks/${name} already up to date`);
|
|
3667
3822
|
} else {
|
|
3668
3823
|
writeText(dst, src_text);
|
|
3669
|
-
|
|
3824
|
+
fs12.chmodSync(dst, 493);
|
|
3670
3825
|
success(`~/.augment/hooks/${name} installed`);
|
|
3671
3826
|
}
|
|
3672
3827
|
return dst;
|
|
3673
3828
|
}
|
|
3674
3829
|
function _remove_legacy_augment_trampolines() {
|
|
3675
3830
|
for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
|
|
3676
|
-
const legacy =
|
|
3831
|
+
const legacy = path10.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
3677
3832
|
try {
|
|
3678
3833
|
if (isFile(legacy)) {
|
|
3679
|
-
|
|
3834
|
+
fs12.unlinkSync(legacy);
|
|
3680
3835
|
skip(`removed legacy ~/.augment/hooks/${name}`);
|
|
3681
3836
|
}
|
|
3682
3837
|
} catch (err) {
|
|
@@ -3689,14 +3844,14 @@ function ensure_augment_user_hooks(package_root, force) {
|
|
|
3689
3844
|
if (dst === null) return [];
|
|
3690
3845
|
_remove_legacy_augment_trampolines();
|
|
3691
3846
|
const per_event = {};
|
|
3692
|
-
for (const
|
|
3693
|
-
const cmd = `${dst} ${
|
|
3847
|
+
for (const { slot, native } of hostBindings("augment")) {
|
|
3848
|
+
const cmd = `${dst} ${slot} ${native}`;
|
|
3694
3849
|
const entry = { hooks: [{ type: "command", command: cmd }] };
|
|
3695
3850
|
(per_event[native] ??= []).push(entry);
|
|
3696
3851
|
}
|
|
3697
3852
|
const settings_patch = { hooks: per_event };
|
|
3698
3853
|
return merge_json_file(
|
|
3699
|
-
|
|
3854
|
+
path10.join(AUGMENT_USER_DIR, "settings.json"),
|
|
3700
3855
|
settings_patch,
|
|
3701
3856
|
force,
|
|
3702
3857
|
"~/.augment/settings.json"
|
|
@@ -3721,7 +3876,7 @@ function _heal_legacy_claude_plugin_ids(p) {
|
|
|
3721
3876
|
return removed;
|
|
3722
3877
|
}
|
|
3723
3878
|
function ensure_claude_bridge(project_root, force) {
|
|
3724
|
-
const target =
|
|
3879
|
+
const target = path10.join(project_root, ".claude", "settings.json");
|
|
3725
3880
|
const healed = _heal_legacy_claude_plugin_ids(target);
|
|
3726
3881
|
for (const pid of healed) {
|
|
3727
3882
|
success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
|
|
@@ -3731,68 +3886,53 @@ function ensure_claude_bridge(project_root, force) {
|
|
|
3731
3886
|
}
|
|
3732
3887
|
var ensure_mcp_bridge = makeEnsureMcpBridge(merge_json_file);
|
|
3733
3888
|
var _tier_b_advisory = tierBAdvisory;
|
|
3734
|
-
var CURSOR_DISPATCHER_BINDINGS = [
|
|
3735
|
-
["session_start", "sessionStart"],
|
|
3736
|
-
["session_end", "sessionEnd"],
|
|
3737
|
-
["stop", "stop"],
|
|
3738
|
-
["user_prompt_submit", "beforeSubmitPrompt"],
|
|
3739
|
-
["post_tool_use", "postToolUse"]
|
|
3740
|
-
];
|
|
3741
3889
|
function _cursor_dispatch_command(ac_event, native) {
|
|
3742
3890
|
return `[ -x ./agent-config ] || exit 0; ./agent-config dispatch:hook --platform cursor --event ${ac_event} --native-event ${native}`;
|
|
3743
3891
|
}
|
|
3744
3892
|
function ensure_cursor_bridge(project_root, force) {
|
|
3745
3893
|
const hooks = {};
|
|
3746
|
-
for (const
|
|
3747
|
-
(hooks[native] ??= []).push({ command: _cursor_dispatch_command(
|
|
3894
|
+
for (const { slot, native } of hostBindings("cursor")) {
|
|
3895
|
+
(hooks[native] ??= []).push({ command: _cursor_dispatch_command(slot, native) });
|
|
3748
3896
|
}
|
|
3749
3897
|
const bridge = { version: 1, hooks };
|
|
3750
3898
|
return merge_json_file(
|
|
3751
|
-
|
|
3899
|
+
path10.join(project_root, ".cursor", "hooks.json"),
|
|
3752
3900
|
bridge,
|
|
3753
3901
|
force,
|
|
3754
3902
|
".cursor/hooks.json"
|
|
3755
3903
|
);
|
|
3756
3904
|
}
|
|
3757
|
-
var CURSOR_USER_DIR =
|
|
3758
|
-
var CURSOR_USER_HOOKS_DIR =
|
|
3905
|
+
var CURSOR_USER_DIR = path10.join(os3.homedir(), ".cursor");
|
|
3906
|
+
var CURSOR_USER_HOOKS_DIR = path10.join(CURSOR_USER_DIR, "hooks");
|
|
3759
3907
|
var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
|
|
3760
3908
|
function ensure_cursor_user_hooks(package_root, force) {
|
|
3761
|
-
const src =
|
|
3909
|
+
const src = path10.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
|
|
3762
3910
|
if (!pathExists(src)) {
|
|
3763
3911
|
skip(`cursor trampoline missing in package: ${src}`);
|
|
3764
3912
|
return [];
|
|
3765
3913
|
}
|
|
3766
3914
|
mkdirp(CURSOR_USER_HOOKS_DIR);
|
|
3767
|
-
const dst =
|
|
3915
|
+
const dst = path10.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
|
|
3768
3916
|
const src_text = readText(src);
|
|
3769
3917
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3770
3918
|
skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3771
3919
|
} else {
|
|
3772
3920
|
writeText(dst, src_text);
|
|
3773
|
-
|
|
3921
|
+
fs12.chmodSync(dst, 493);
|
|
3774
3922
|
success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
|
|
3775
3923
|
}
|
|
3776
3924
|
const hooks = {};
|
|
3777
|
-
for (const
|
|
3778
|
-
(hooks[native] ??= []).push({ command: `${dst} ${
|
|
3925
|
+
for (const { slot, native } of hostBindings("cursor")) {
|
|
3926
|
+
(hooks[native] ??= []).push({ command: `${dst} ${slot} ${native}` });
|
|
3779
3927
|
}
|
|
3780
3928
|
const settings_patch = { version: 1, hooks };
|
|
3781
3929
|
return merge_json_file(
|
|
3782
|
-
|
|
3930
|
+
path10.join(CURSOR_USER_DIR, "hooks.json"),
|
|
3783
3931
|
settings_patch,
|
|
3784
3932
|
force,
|
|
3785
3933
|
"~/.cursor/hooks.json"
|
|
3786
3934
|
);
|
|
3787
3935
|
}
|
|
3788
|
-
var CLINE_DISPATCHER_BINDINGS = [
|
|
3789
|
-
["session_start", "TaskStart"],
|
|
3790
|
-
["session_start", "TaskResume"],
|
|
3791
|
-
["session_end", "TaskComplete"],
|
|
3792
|
-
["stop", "TaskCancel"],
|
|
3793
|
-
["user_prompt_submit", "UserPromptSubmit"],
|
|
3794
|
-
["post_tool_use", "PostToolUse"]
|
|
3795
|
-
];
|
|
3796
3936
|
function shlexQuote(s) {
|
|
3797
3937
|
if (s === "") return "''";
|
|
3798
3938
|
if (/^[A-Za-z0-9_@%+=:,./-]+$/.test(s)) return s;
|
|
@@ -3800,7 +3940,7 @@ function shlexQuote(s) {
|
|
|
3800
3940
|
}
|
|
3801
3941
|
function clineProjectHookBody(native_event, ac_event, workspace_quoted) {
|
|
3802
3942
|
return `#!/usr/bin/env bash
|
|
3803
|
-
# Generated by event4u/agent-config
|
|
3943
|
+
# Generated by event4u/agent-config \u2014 DO NOT EDIT.
|
|
3804
3944
|
# Project-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
|
|
3805
3945
|
# Phase 7.6 (docs/contracts/hook-architecture-v1.md).
|
|
3806
3946
|
set -u
|
|
@@ -3822,22 +3962,22 @@ exit 0
|
|
|
3822
3962
|
`;
|
|
3823
3963
|
}
|
|
3824
3964
|
function ensure_cline_bridge(project_root, force) {
|
|
3825
|
-
const hooks_dir =
|
|
3965
|
+
const hooks_dir = path10.join(project_root, ".clinerules", "hooks");
|
|
3826
3966
|
mkdirp(hooks_dir);
|
|
3827
3967
|
const workspace_quoted = shlexQuote(resolvePath(project_root));
|
|
3828
3968
|
let written = 0;
|
|
3829
|
-
for (const
|
|
3830
|
-
const target =
|
|
3831
|
-
const body = clineProjectHookBody(
|
|
3969
|
+
for (const { slot, native } of hostBindings("cline")) {
|
|
3970
|
+
const target = path10.join(hooks_dir, native);
|
|
3971
|
+
const body = clineProjectHookBody(native, slot, workspace_quoted);
|
|
3832
3972
|
if (pathExists(target) && readText(target) === body && !force) {
|
|
3833
3973
|
continue;
|
|
3834
3974
|
}
|
|
3835
3975
|
if (pathExists(target) && !force) {
|
|
3836
|
-
skip(`.clinerules/hooks/${
|
|
3976
|
+
skip(`.clinerules/hooks/${native} exists, needs update (use --force)`);
|
|
3837
3977
|
continue;
|
|
3838
3978
|
}
|
|
3839
3979
|
writeText(target, body);
|
|
3840
|
-
|
|
3980
|
+
fs12.chmodSync(target, 493);
|
|
3841
3981
|
written += 1;
|
|
3842
3982
|
}
|
|
3843
3983
|
if (written) {
|
|
@@ -3846,113 +3986,101 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
3846
3986
|
skip(".clinerules/hooks/ already up to date");
|
|
3847
3987
|
}
|
|
3848
3988
|
}
|
|
3849
|
-
var CLINE_USER_DIR =
|
|
3989
|
+
var CLINE_USER_DIR = path10.join(os3.homedir(), "Documents", "Cline", "Hooks");
|
|
3850
3990
|
var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
|
|
3851
3991
|
function ensure_cline_user_hooks(package_root, force) {
|
|
3852
|
-
const src =
|
|
3992
|
+
const src = path10.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
|
|
3853
3993
|
if (!pathExists(src)) {
|
|
3854
3994
|
skip(`cline trampoline missing in package: ${src}`);
|
|
3855
3995
|
return;
|
|
3856
3996
|
}
|
|
3857
3997
|
mkdirp(CLINE_USER_DIR);
|
|
3858
|
-
const trampoline =
|
|
3998
|
+
const trampoline = path10.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
|
|
3859
3999
|
const src_text = readText(src);
|
|
3860
4000
|
if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
|
|
3861
4001
|
skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3862
4002
|
} else {
|
|
3863
4003
|
writeText(trampoline, src_text);
|
|
3864
|
-
|
|
4004
|
+
fs12.chmodSync(trampoline, 493);
|
|
3865
4005
|
success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
|
|
3866
4006
|
}
|
|
3867
4007
|
const trampoline_quoted = shlexQuote(trampoline);
|
|
3868
|
-
for (const
|
|
3869
|
-
const wrapper =
|
|
4008
|
+
for (const { slot, native } of hostBindings("cline")) {
|
|
4009
|
+
const wrapper = path10.join(CLINE_USER_DIR, native);
|
|
3870
4010
|
const body = `#!/usr/bin/env bash
|
|
3871
|
-
# Generated by event4u/agent-config
|
|
3872
|
-
# User-scope Cline hook for ${
|
|
3873
|
-
exec ${trampoline_quoted} ${
|
|
4011
|
+
# Generated by event4u/agent-config \u2014 DO NOT EDIT.
|
|
4012
|
+
# User-scope Cline hook for ${native} \u2192 agent-config ${slot}.
|
|
4013
|
+
exec ${trampoline_quoted} ${slot} ${native}
|
|
3874
4014
|
`;
|
|
3875
4015
|
if (pathExists(wrapper) && readText(wrapper) === body && !force) {
|
|
3876
4016
|
continue;
|
|
3877
4017
|
}
|
|
3878
4018
|
writeText(wrapper, body);
|
|
3879
|
-
|
|
4019
|
+
fs12.chmodSync(wrapper, 493);
|
|
3880
4020
|
}
|
|
3881
4021
|
}
|
|
3882
|
-
var WINDSURF_DISPATCHER_BINDINGS = [
|
|
3883
|
-
["session_start", "post_setup_worktree"],
|
|
3884
|
-
["user_prompt_submit", "pre_user_prompt"],
|
|
3885
|
-
["stop", "post_cascade_response"]
|
|
3886
|
-
];
|
|
3887
4022
|
function _windsurf_dispatch_command(ac_event, native) {
|
|
3888
4023
|
return `[ -x ./agent-config ] || exit 0; ./agent-config dispatch:hook --platform windsurf --event ${ac_event} --native-event ${native}`;
|
|
3889
4024
|
}
|
|
3890
4025
|
function ensure_windsurf_bridge(project_root, force) {
|
|
3891
4026
|
const hooks = {};
|
|
3892
|
-
for (const
|
|
4027
|
+
for (const { slot, native } of hostBindings("windsurf")) {
|
|
3893
4028
|
(hooks[native] ??= []).push({
|
|
3894
|
-
command: _windsurf_dispatch_command(
|
|
4029
|
+
command: _windsurf_dispatch_command(slot, native),
|
|
3895
4030
|
show_output: false
|
|
3896
4031
|
});
|
|
3897
4032
|
}
|
|
3898
4033
|
const bridge = { hooks };
|
|
3899
4034
|
return merge_json_file(
|
|
3900
|
-
|
|
4035
|
+
path10.join(project_root, ".windsurf", "hooks.json"),
|
|
3901
4036
|
bridge,
|
|
3902
4037
|
force,
|
|
3903
4038
|
".windsurf/hooks.json"
|
|
3904
4039
|
);
|
|
3905
4040
|
}
|
|
3906
|
-
var WINDSURF_USER_DIR =
|
|
3907
|
-
var WINDSURF_USER_HOOKS_DIR =
|
|
4041
|
+
var WINDSURF_USER_DIR = path10.join(os3.homedir(), ".codeium", "windsurf");
|
|
4042
|
+
var WINDSURF_USER_HOOKS_DIR = path10.join(WINDSURF_USER_DIR, "hooks");
|
|
3908
4043
|
var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
|
|
3909
4044
|
function ensure_windsurf_user_hooks(package_root, force) {
|
|
3910
|
-
const src =
|
|
4045
|
+
const src = path10.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
3911
4046
|
if (!pathExists(src)) {
|
|
3912
4047
|
skip(`windsurf trampoline missing in package: ${src}`);
|
|
3913
4048
|
return [];
|
|
3914
4049
|
}
|
|
3915
4050
|
mkdirp(WINDSURF_USER_HOOKS_DIR);
|
|
3916
|
-
const dst =
|
|
4051
|
+
const dst = path10.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
3917
4052
|
const src_text = readText(src);
|
|
3918
4053
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3919
4054
|
skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3920
4055
|
} else {
|
|
3921
4056
|
writeText(dst, src_text);
|
|
3922
|
-
|
|
4057
|
+
fs12.chmodSync(dst, 493);
|
|
3923
4058
|
success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
|
|
3924
4059
|
}
|
|
3925
4060
|
const hooks = {};
|
|
3926
|
-
for (const
|
|
4061
|
+
for (const { slot, native } of hostBindings("windsurf")) {
|
|
3927
4062
|
(hooks[native] ??= []).push({
|
|
3928
|
-
command: `${dst} ${
|
|
4063
|
+
command: `${dst} ${slot} ${native}`,
|
|
3929
4064
|
show_output: false
|
|
3930
4065
|
});
|
|
3931
4066
|
}
|
|
3932
4067
|
const settings_patch = { hooks };
|
|
3933
4068
|
return merge_json_file(
|
|
3934
|
-
|
|
4069
|
+
path10.join(WINDSURF_USER_DIR, "hooks.json"),
|
|
3935
4070
|
settings_patch,
|
|
3936
4071
|
force,
|
|
3937
4072
|
"~/.codeium/windsurf/hooks.json"
|
|
3938
4073
|
);
|
|
3939
4074
|
}
|
|
3940
|
-
var GEMINI_DISPATCHER_BINDINGS = [
|
|
3941
|
-
["session_start", "SessionStart", ""],
|
|
3942
|
-
["session_end", "SessionEnd", ""],
|
|
3943
|
-
["stop", "AfterAgent", ""],
|
|
3944
|
-
["user_prompt_submit", "BeforeAgent", ""],
|
|
3945
|
-
["post_tool_use", "AfterTool", ".*"]
|
|
3946
|
-
];
|
|
3947
4075
|
function _gemini_dispatch_command(ac_event, native) {
|
|
3948
4076
|
return `[ -x ./agent-config ] || exit 0; ./agent-config dispatch:hook --platform gemini --event ${ac_event} --native-event ${native}`;
|
|
3949
4077
|
}
|
|
3950
4078
|
function _gemini_hooks_dict(command_factory) {
|
|
3951
4079
|
const out = {};
|
|
3952
|
-
for (const
|
|
4080
|
+
for (const { slot, native, matcher } of hostBindings("gemini")) {
|
|
3953
4081
|
(out[native] ??= []).push({
|
|
3954
4082
|
matcher,
|
|
3955
|
-
hooks: [{ type: "command", command: command_factory(
|
|
4083
|
+
hooks: [{ type: "command", command: command_factory(slot, native) }]
|
|
3956
4084
|
});
|
|
3957
4085
|
}
|
|
3958
4086
|
return out;
|
|
@@ -3960,43 +4088,43 @@ function _gemini_hooks_dict(command_factory) {
|
|
|
3960
4088
|
function ensure_gemini_bridge(project_root, force) {
|
|
3961
4089
|
const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
|
|
3962
4090
|
return merge_json_file(
|
|
3963
|
-
|
|
4091
|
+
path10.join(project_root, ".gemini", "settings.json"),
|
|
3964
4092
|
bridge,
|
|
3965
4093
|
force,
|
|
3966
4094
|
".gemini/settings.json"
|
|
3967
4095
|
);
|
|
3968
4096
|
}
|
|
3969
|
-
var GEMINI_USER_DIR =
|
|
3970
|
-
var GEMINI_USER_HOOKS_DIR =
|
|
4097
|
+
var GEMINI_USER_DIR = path10.join(os3.homedir(), ".gemini");
|
|
4098
|
+
var GEMINI_USER_HOOKS_DIR = path10.join(GEMINI_USER_DIR, "hooks");
|
|
3971
4099
|
var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
|
|
3972
4100
|
function ensure_gemini_user_hooks(package_root, force) {
|
|
3973
|
-
const src =
|
|
4101
|
+
const src = path10.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
|
|
3974
4102
|
if (!pathExists(src)) {
|
|
3975
4103
|
skip(`gemini trampoline missing in package: ${src}`);
|
|
3976
4104
|
return [];
|
|
3977
4105
|
}
|
|
3978
4106
|
mkdirp(GEMINI_USER_HOOKS_DIR);
|
|
3979
|
-
const dst =
|
|
4107
|
+
const dst = path10.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
|
|
3980
4108
|
const src_text = readText(src);
|
|
3981
4109
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3982
4110
|
skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3983
4111
|
} else {
|
|
3984
4112
|
writeText(dst, src_text);
|
|
3985
|
-
|
|
4113
|
+
fs12.chmodSync(dst, 493);
|
|
3986
4114
|
success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
|
|
3987
4115
|
}
|
|
3988
4116
|
const settings_patch = {
|
|
3989
4117
|
hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
|
|
3990
4118
|
};
|
|
3991
4119
|
return merge_json_file(
|
|
3992
|
-
|
|
4120
|
+
path10.join(GEMINI_USER_DIR, "settings.json"),
|
|
3993
4121
|
settings_patch,
|
|
3994
4122
|
force,
|
|
3995
4123
|
"~/.gemini/settings.json"
|
|
3996
4124
|
);
|
|
3997
4125
|
}
|
|
3998
4126
|
function ensure_copilot_bridge(project_root, force) {
|
|
3999
|
-
const target =
|
|
4127
|
+
const target = path10.join(project_root, ".github", "plugin", "marketplace.json");
|
|
4000
4128
|
const bridge = {
|
|
4001
4129
|
marketplace: {
|
|
4002
4130
|
name: "event4u-agent-marketplace",
|
|
@@ -4039,7 +4167,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
|
|
|
4039
4167
|
Run \`./agent-config --help\` for available commands.
|
|
4040
4168
|
`;
|
|
4041
4169
|
function ensure_roocode_bridge(project_root, force) {
|
|
4042
|
-
const target =
|
|
4170
|
+
const target = path10.join(project_root, ".roo", "rules", "agent-config.md");
|
|
4043
4171
|
if (pathExists(target) && !force) {
|
|
4044
4172
|
skip(".roo/rules/agent-config.md already exists");
|
|
4045
4173
|
return;
|
|
@@ -4061,7 +4189,7 @@ To wire Claude Desktop to this project's rules, run:
|
|
|
4061
4189
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
4062
4190
|
`;
|
|
4063
4191
|
function ensure_claude_desktop_bridge(project_root, force) {
|
|
4064
|
-
const target =
|
|
4192
|
+
const target = path10.join(project_root, ".claude-desktop", "agent-config.md");
|
|
4065
4193
|
if (pathExists(target) && !force) {
|
|
4066
4194
|
skip(".claude-desktop/agent-config.md already exists");
|
|
4067
4195
|
return;
|
|
@@ -4086,7 +4214,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
|
|
|
4086
4214
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
4087
4215
|
`;
|
|
4088
4216
|
function ensure_aider_bridge(project_root, force) {
|
|
4089
|
-
const target =
|
|
4217
|
+
const target = path10.join(project_root, ".aider", "agent-config.md");
|
|
4090
4218
|
if (pathExists(target) && !force) {
|
|
4091
4219
|
skip(".aider/agent-config.md already exists");
|
|
4092
4220
|
return;
|
|
@@ -4105,7 +4233,7 @@ developers where the rules and skills live.
|
|
|
4105
4233
|
Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
|
|
4106
4234
|
`;
|
|
4107
4235
|
function ensure_codex_bridge(project_root, force) {
|
|
4108
|
-
const target =
|
|
4236
|
+
const target = path10.join(project_root, ".codex", "agent-config.md");
|
|
4109
4237
|
if (pathExists(target) && !force) {
|
|
4110
4238
|
skip(".codex/agent-config.md already exists");
|
|
4111
4239
|
return;
|
|
@@ -4123,7 +4251,7 @@ rules per session. The canonical rule and skill source lives under
|
|
|
4123
4251
|
orientation).
|
|
4124
4252
|
`;
|
|
4125
4253
|
function ensure_continue_bridge(project_root, force) {
|
|
4126
|
-
const target =
|
|
4254
|
+
const target = path10.join(project_root, ".continue", "rules", "agent-config.md");
|
|
4127
4255
|
if (pathExists(target) && !force) {
|
|
4128
4256
|
skip(".continue/rules/agent-config.md already exists");
|
|
4129
4257
|
return;
|
|
@@ -4154,7 +4282,7 @@ orientation).
|
|
|
4154
4282
|
See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
|
|
4155
4283
|
`;
|
|
4156
4284
|
function ensure_kilocode_bridge(project_root, force) {
|
|
4157
|
-
const target =
|
|
4285
|
+
const target = path10.join(project_root, ".kilocode", "rules", "agent-config.md");
|
|
4158
4286
|
if (pathExists(target) && !force) {
|
|
4159
4287
|
skip(".kilocode/rules/agent-config.md already exists");
|
|
4160
4288
|
return;
|
|
@@ -4181,7 +4309,7 @@ canonical source (or symlink it):
|
|
|
4181
4309
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
4182
4310
|
`;
|
|
4183
4311
|
function ensure_zed_bridge(project_root, force) {
|
|
4184
|
-
const target =
|
|
4312
|
+
const target = path10.join(project_root, ".zed", "agent-config.md");
|
|
4185
4313
|
if (pathExists(target) && !force) {
|
|
4186
4314
|
skip(".zed/agent-config.md already exists");
|
|
4187
4315
|
return;
|
|
@@ -4202,7 +4330,7 @@ rules into your JetBrains profile.
|
|
|
4202
4330
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
4203
4331
|
`;
|
|
4204
4332
|
function ensure_jetbrains_bridge(project_root, force) {
|
|
4205
|
-
const target =
|
|
4333
|
+
const target = path10.join(project_root, ".jetbrains", "agent-config.md");
|
|
4206
4334
|
if (pathExists(target) && !force) {
|
|
4207
4335
|
skip(".jetbrains/agent-config.md already exists");
|
|
4208
4336
|
return;
|
|
@@ -4233,7 +4361,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
|
|
|
4233
4361
|
See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
|
|
4234
4362
|
`;
|
|
4235
4363
|
function ensure_kiro_bridge(project_root, force) {
|
|
4236
|
-
const target =
|
|
4364
|
+
const target = path10.join(project_root, ".kiro", "steering", "agent-config.md");
|
|
4237
4365
|
if (pathExists(target) && !force) {
|
|
4238
4366
|
skip(".kiro/steering/agent-config.md already exists");
|
|
4239
4367
|
return;
|
|
@@ -4241,14 +4369,25 @@ function ensure_kiro_bridge(project_root, force) {
|
|
|
4241
4369
|
write_file(target, KIRO_MARKER);
|
|
4242
4370
|
success(".kiro/steering/agent-config.md created");
|
|
4243
4371
|
}
|
|
4244
|
-
var
|
|
4372
|
+
var SMOKE_PROBE_SLOTS = [
|
|
4245
4373
|
["augment", "session_start"],
|
|
4246
|
-
["claude", "
|
|
4247
|
-
["cursor", "
|
|
4374
|
+
["claude", "session_start"],
|
|
4375
|
+
["cursor", "session_start"],
|
|
4248
4376
|
["cline", "session_start"],
|
|
4249
|
-
["windsurf", "
|
|
4250
|
-
["gemini", "
|
|
4377
|
+
["windsurf", "session_start"],
|
|
4378
|
+
["gemini", "session_start"]
|
|
4251
4379
|
];
|
|
4380
|
+
function smokeProbeEvents() {
|
|
4381
|
+
return SMOKE_PROBE_SLOTS.map(([platform, slot]) => {
|
|
4382
|
+
const binding = hostBindings(platform).find((b) => b.slot === slot);
|
|
4383
|
+
if (binding === void 0) {
|
|
4384
|
+
throw new Error(
|
|
4385
|
+
`install smoke probe: host_lowering.yaml has no \`${slot}\` binding for \`${platform}\``
|
|
4386
|
+
);
|
|
4387
|
+
}
|
|
4388
|
+
return [platform, binding.native];
|
|
4389
|
+
});
|
|
4390
|
+
}
|
|
4252
4391
|
var SMOKE_BRIDGE_PATHS = {
|
|
4253
4392
|
augment: ".augment/settings.json",
|
|
4254
4393
|
claude: ".claude/settings.json",
|
|
@@ -4259,35 +4398,35 @@ var SMOKE_BRIDGE_PATHS = {
|
|
|
4259
4398
|
};
|
|
4260
4399
|
function dirHasEntries(p) {
|
|
4261
4400
|
try {
|
|
4262
|
-
return
|
|
4401
|
+
return fs12.readdirSync(p).length > 0;
|
|
4263
4402
|
} catch {
|
|
4264
4403
|
return false;
|
|
4265
4404
|
}
|
|
4266
4405
|
}
|
|
4267
4406
|
function _resolve_tsx_invocation(scriptPath, scriptArgs) {
|
|
4268
4407
|
const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
4269
|
-
let dir =
|
|
4408
|
+
let dir = path10.dirname(scriptPath);
|
|
4270
4409
|
for (; ; ) {
|
|
4271
|
-
const candidate =
|
|
4410
|
+
const candidate = path10.join(dir, "node_modules", ".bin", binName);
|
|
4272
4411
|
if (isFile(candidate)) {
|
|
4273
4412
|
return { command: candidate, args: [scriptPath, ...scriptArgs] };
|
|
4274
4413
|
}
|
|
4275
|
-
const parent =
|
|
4414
|
+
const parent = path10.dirname(dir);
|
|
4276
4415
|
if (parent === dir) break;
|
|
4277
4416
|
dir = parent;
|
|
4278
4417
|
}
|
|
4279
4418
|
return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
|
|
4280
4419
|
}
|
|
4281
4420
|
function _smoke_test_hooks(project_root, package_root) {
|
|
4282
|
-
const dispatcher =
|
|
4283
|
-
const manifest =
|
|
4421
|
+
const dispatcher = path10.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
|
|
4422
|
+
const manifest = path10.join(package_root, "scripts", "hook_manifest.yaml");
|
|
4284
4423
|
if (!isFile(dispatcher) || !isFile(manifest)) return 0;
|
|
4285
4424
|
const failed = [];
|
|
4286
4425
|
const skipped = [];
|
|
4287
4426
|
const passed = [];
|
|
4288
|
-
for (const [platform, native] of
|
|
4427
|
+
for (const [platform, native] of smokeProbeEvents()) {
|
|
4289
4428
|
const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
|
|
4290
|
-
const bridge_path = rel_bridge ?
|
|
4429
|
+
const bridge_path = rel_bridge ? path10.join(project_root, rel_bridge) : null;
|
|
4291
4430
|
const bridge_present = Boolean(
|
|
4292
4431
|
bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
|
|
4293
4432
|
);
|
|
@@ -4487,9 +4626,9 @@ To remove this marker, delete this file.
|
|
|
4487
4626
|
`;
|
|
4488
4627
|
}
|
|
4489
4628
|
var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
|
|
4490
|
-
var GLOBAL_ROOT =
|
|
4491
|
-
var GLOBAL_USER_SETTINGS_PATH =
|
|
4492
|
-
var GLOBAL_AGENT_SETTINGS_PATH =
|
|
4629
|
+
var GLOBAL_ROOT = path10.join(os3.homedir(), ".event4u", "agent-config");
|
|
4630
|
+
var GLOBAL_USER_SETTINGS_PATH = path10.join(GLOBAL_ROOT, ".agent-user.yml");
|
|
4631
|
+
var GLOBAL_AGENT_SETTINGS_PATH = path10.join(GLOBAL_ROOT, ".agent-settings.yml");
|
|
4493
4632
|
function _bridge_marker(tool_id, scope) {
|
|
4494
4633
|
if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
|
|
4495
4634
|
return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
|
|
@@ -4538,7 +4677,7 @@ function _load_yaml_doc(p) {
|
|
|
4538
4677
|
return _isPlainObject(data) ? data : {};
|
|
4539
4678
|
}
|
|
4540
4679
|
function _load_default_settings(package_root) {
|
|
4541
|
-
const template_source =
|
|
4680
|
+
const template_source = path10.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
4542
4681
|
if (!pathExists(template_source)) return {};
|
|
4543
4682
|
let text;
|
|
4544
4683
|
try {
|
|
@@ -4552,11 +4691,11 @@ function _load_default_settings(package_root) {
|
|
|
4552
4691
|
}
|
|
4553
4692
|
var RULE_LAYER_CHOICES = ["global", "project", "both-acknowledged"];
|
|
4554
4693
|
function _suppress_rule_layer(project_root, suppress_dir) {
|
|
4555
|
-
const target =
|
|
4694
|
+
const target = path10.join(project_root, ".claude", "settings.local.json");
|
|
4556
4695
|
const existing = pathExists(target) ? read_json_file(target) : {};
|
|
4557
4696
|
let real_dir = suppress_dir;
|
|
4558
4697
|
try {
|
|
4559
|
-
real_dir =
|
|
4698
|
+
real_dir = fs12.realpathSync(suppress_dir);
|
|
4560
4699
|
} catch {
|
|
4561
4700
|
real_dir = suppress_dir;
|
|
4562
4701
|
}
|
|
@@ -4567,8 +4706,8 @@ function _suppress_rule_layer(project_root, suppress_dir) {
|
|
|
4567
4706
|
success(`.claude/settings.local.json: claudeMdExcludes += ${entry}`);
|
|
4568
4707
|
}
|
|
4569
4708
|
function _gate_rule_layer_overlap(project_root, layer, dry_run) {
|
|
4570
|
-
const global_dir =
|
|
4571
|
-
const project_dir =
|
|
4709
|
+
const global_dir = path10.join(os3.homedir(), ".claude", "rules");
|
|
4710
|
+
const project_dir = path10.join(project_root, ".claude", "rules");
|
|
4572
4711
|
const g = readRuleLayer(global_dir);
|
|
4573
4712
|
const p = readRuleLayer(project_dir);
|
|
4574
4713
|
if (g === null || p === null) return true;
|
|
@@ -4656,9 +4795,9 @@ function detect_scope(cwd) {
|
|
|
4656
4795
|
if (pathExists(_resolve_settings_read(cwd))) {
|
|
4657
4796
|
return ["project", `existing ${SETTINGS_FILE}`];
|
|
4658
4797
|
}
|
|
4659
|
-
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(
|
|
4660
|
-
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(
|
|
4661
|
-
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(
|
|
4798
|
+
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path10.join(cwd, m))) ?? null;
|
|
4799
|
+
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path10.join(cwd, d))) ?? null;
|
|
4800
|
+
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path10.join(cwd, f))) ?? null;
|
|
4662
4801
|
if (has_manifest && (has_ai_dir || has_ai_file)) {
|
|
4663
4802
|
const marker = has_ai_dir || has_ai_file;
|
|
4664
4803
|
return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
|
|
@@ -4679,7 +4818,7 @@ function readLineSyncRaw(promptText) {
|
|
|
4679
4818
|
for (; ; ) {
|
|
4680
4819
|
let n;
|
|
4681
4820
|
try {
|
|
4682
|
-
n =
|
|
4821
|
+
n = fs12.readSync(0, buf, 0, 1, null);
|
|
4683
4822
|
} catch (err) {
|
|
4684
4823
|
const code = err.code;
|
|
4685
4824
|
if (code === "EAGAIN") {
|
|
@@ -4754,8 +4893,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
|
|
|
4754
4893
|
const marker = _bridge_marker(tool_id, scope);
|
|
4755
4894
|
if (!marker) continue;
|
|
4756
4895
|
let marker_path = marker;
|
|
4757
|
-
if (!
|
|
4758
|
-
marker_path =
|
|
4896
|
+
if (!path10.isAbsolute(marker_path)) {
|
|
4897
|
+
marker_path = path10.join(project_root, marker_path);
|
|
4759
4898
|
}
|
|
4760
4899
|
out[tool_id] = [_file_entry(marker_path, "bridge", false)];
|
|
4761
4900
|
}
|
|
@@ -4794,26 +4933,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
|
|
|
4794
4933
|
}
|
|
4795
4934
|
write_manifest(target, version, entries);
|
|
4796
4935
|
if (!state.QUIET) {
|
|
4797
|
-
const rel = isRelativeTo(target, project_root) ?
|
|
4936
|
+
const rel = isRelativeTo(target, project_root) ? path10.relative(project_root, target) : target;
|
|
4798
4937
|
info(`Manifest updated: ${rel}`);
|
|
4799
4938
|
}
|
|
4800
4939
|
return 0;
|
|
4801
4940
|
}
|
|
4802
4941
|
function isRelativeTo(child, parent) {
|
|
4803
|
-
const rel =
|
|
4804
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
4942
|
+
const rel = path10.relative(parent, child);
|
|
4943
|
+
return rel === "" || !rel.startsWith("..") && !path10.isAbsolute(rel);
|
|
4805
4944
|
}
|
|
4806
4945
|
function _resolve_package_root_for_global() {
|
|
4807
4946
|
const here = resolvePath(_HERE);
|
|
4808
|
-
const candidate =
|
|
4809
|
-
if (!pathExists(
|
|
4947
|
+
const candidate = path10.dirname(path10.dirname(path10.dirname(here)));
|
|
4948
|
+
if (!pathExists(path10.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
|
|
4810
4949
|
fail(
|
|
4811
4950
|
`Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
|
|
4812
4951
|
);
|
|
4813
4952
|
}
|
|
4814
4953
|
return candidate;
|
|
4815
4954
|
}
|
|
4816
|
-
var CONSUMER_BRIDGE_MARKER_RELPATH =
|
|
4955
|
+
var CONSUMER_BRIDGE_MARKER_RELPATH = path10.join("agents", ".event4u-bridge.yml");
|
|
4817
4956
|
var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
4818
4957
|
var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
|
|
4819
4958
|
var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
|
|
@@ -4821,7 +4960,7 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
4821
4960
|
if (process2.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
|
|
4822
4961
|
return [false, "consumer-mode-override"];
|
|
4823
4962
|
}
|
|
4824
|
-
const pkg_json =
|
|
4963
|
+
const pkg_json = path10.join(project_root, "package.json");
|
|
4825
4964
|
if (isFile(pkg_json)) {
|
|
4826
4965
|
let data = {};
|
|
4827
4966
|
try {
|
|
@@ -4833,24 +4972,17 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
4833
4972
|
return [true, "package.json:name"];
|
|
4834
4973
|
}
|
|
4835
4974
|
}
|
|
4836
|
-
if (isDir(
|
|
4975
|
+
if (isDir(path10.join(project_root, ".agent-src.uncondensed"))) {
|
|
4837
4976
|
return [true, ".agent-src.uncondensed/"];
|
|
4838
4977
|
}
|
|
4839
|
-
const packages_dir =
|
|
4978
|
+
const packages_dir = path10.join(project_root, "packages");
|
|
4840
4979
|
if (isDir(packages_dir)) {
|
|
4841
|
-
for (const child of
|
|
4842
|
-
if (isDir(
|
|
4980
|
+
for (const child of fs12.readdirSync(packages_dir)) {
|
|
4981
|
+
if (isDir(path10.join(packages_dir, child, ".agent-src.uncondensed"))) {
|
|
4843
4982
|
return [true, `packages/${child}/.agent-src.uncondensed/`];
|
|
4844
4983
|
}
|
|
4845
4984
|
}
|
|
4846
4985
|
}
|
|
4847
|
-
const installer_self = path9.join(project_root, "scripts", "install.py");
|
|
4848
|
-
try {
|
|
4849
|
-
if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE)) {
|
|
4850
|
-
return [true, "src/scripts/install.py (self)"];
|
|
4851
|
-
}
|
|
4852
|
-
} catch {
|
|
4853
|
-
}
|
|
4854
4986
|
return [false, ""];
|
|
4855
4987
|
}
|
|
4856
4988
|
function _detect_legacy_for_migration(project_root) {
|
|
@@ -4864,17 +4996,17 @@ function _detect_legacy_for_migration(project_root) {
|
|
|
4864
4996
|
}
|
|
4865
4997
|
return [];
|
|
4866
4998
|
}
|
|
4867
|
-
if (isFile(
|
|
4999
|
+
if (isFile(path10.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
|
|
4868
5000
|
const found = [];
|
|
4869
5001
|
for (const name of MIGRATE_LEGACY_YAML_FILES) {
|
|
4870
|
-
if (isFile(
|
|
5002
|
+
if (isFile(path10.join(project_root, name))) {
|
|
4871
5003
|
found.push(name);
|
|
4872
|
-
} else if (isFile(
|
|
5004
|
+
} else if (isFile(path10.join(project_root, "settings", name))) {
|
|
4873
5005
|
found.push(`settings/${name}`);
|
|
4874
5006
|
}
|
|
4875
5007
|
}
|
|
4876
5008
|
for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
|
|
4877
|
-
const p =
|
|
5009
|
+
const p = path10.join(project_root, name);
|
|
4878
5010
|
if (isDir(p) && !isSymlink(p)) {
|
|
4879
5011
|
found.push(`${name}/`);
|
|
4880
5012
|
}
|
|
@@ -4886,7 +5018,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
|
|
|
4886
5018
|
process2.stdout.write("\n");
|
|
4887
5019
|
warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
|
|
4888
5020
|
for (const rel of artefacts) {
|
|
4889
|
-
info(` ${
|
|
5021
|
+
info(` ${path10.join(project_root, rel)}`);
|
|
4890
5022
|
}
|
|
4891
5023
|
info("The unified `agent-config migrate` sweeps these in one pass.");
|
|
4892
5024
|
info("The wizard recreates fresh config afterwards.");
|
|
@@ -4917,20 +5049,20 @@ function _run_migrate_to_global(project_root) {
|
|
|
4917
5049
|
function _format_global_root_for_marker(global_root) {
|
|
4918
5050
|
const home = resolvePath(os3.homedir());
|
|
4919
5051
|
const resolved = resolvePath(global_root);
|
|
4920
|
-
const rel =
|
|
4921
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
5052
|
+
const rel = path10.relative(home, resolved);
|
|
5053
|
+
if (rel === "" || rel.startsWith("..") || path10.isAbsolute(rel)) {
|
|
4922
5054
|
return global_root;
|
|
4923
5055
|
}
|
|
4924
|
-
return `~/${rel.split(
|
|
5056
|
+
return `~/${rel.split(path10.sep).join("/")}`;
|
|
4925
5057
|
}
|
|
4926
5058
|
function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
|
|
4927
5059
|
const env_map = env ?? process2.env;
|
|
4928
5060
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
|
|
4929
|
-
if (isDir(
|
|
4930
|
-
const target =
|
|
5061
|
+
if (isDir(path10.join(project_root, ".agent-src.uncondensed"))) return null;
|
|
5062
|
+
const target = path10.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
|
|
4931
5063
|
if (!isFile(target)) return null;
|
|
4932
5064
|
try {
|
|
4933
|
-
|
|
5065
|
+
fs12.rmSync(target);
|
|
4934
5066
|
} catch {
|
|
4935
5067
|
return null;
|
|
4936
5068
|
}
|
|
@@ -4944,7 +5076,7 @@ var PROJECT_ANCHOR_TOOLS = {
|
|
|
4944
5076
|
function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
|
|
4945
5077
|
const env_map = env ?? process2.env;
|
|
4946
5078
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
|
|
4947
|
-
if (isDir(
|
|
5079
|
+
if (isDir(path10.join(project_root, ".agent-src.uncondensed"))) return [];
|
|
4948
5080
|
const global_root_str = _format_global_root_for_marker(
|
|
4949
5081
|
event4u_root(env_map)
|
|
4950
5082
|
);
|
|
@@ -4953,8 +5085,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
|
|
|
4953
5085
|
for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
|
|
4954
5086
|
const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
|
|
4955
5087
|
if (!tools.has(tool_id)) continue;
|
|
4956
|
-
const target =
|
|
4957
|
-
mkdirp(
|
|
5088
|
+
const target = path10.join(project_root, rel_path);
|
|
5089
|
+
mkdirp(path10.dirname(target));
|
|
4958
5090
|
const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
|
|
4959
5091
|
# Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
|
|
4960
5092
|
# Tool: ${tool_id}. Resolves the global install directly \u2014 no
|
|
@@ -4972,7 +5104,7 @@ installed_at: ${stamp}
|
|
|
4972
5104
|
}
|
|
4973
5105
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
4974
5106
|
function _inject_package_tag(target, source, package_root) {
|
|
4975
|
-
if (
|
|
5107
|
+
if (path10.extname(target) !== ".md") return;
|
|
4976
5108
|
let text;
|
|
4977
5109
|
try {
|
|
4978
5110
|
text = readText(target);
|
|
@@ -5000,8 +5132,8 @@ function _inject_package_tag(target, source, package_root) {
|
|
|
5000
5132
|
resolved_src = source;
|
|
5001
5133
|
}
|
|
5002
5134
|
if (package_root !== null) {
|
|
5003
|
-
const rel =
|
|
5004
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
5135
|
+
const rel = path10.relative(resolvePath(package_root), resolved_src);
|
|
5136
|
+
if (rel !== "" && !rel.startsWith("..") && !path10.isAbsolute(rel)) {
|
|
5005
5137
|
source_value = rel;
|
|
5006
5138
|
} else {
|
|
5007
5139
|
source_value = resolved_src;
|
|
@@ -5036,7 +5168,7 @@ function _escapes_package_root(resolved, package_root) {
|
|
|
5036
5168
|
if (package_root === null) return false;
|
|
5037
5169
|
let root;
|
|
5038
5170
|
try {
|
|
5039
|
-
root =
|
|
5171
|
+
root = fs12.realpathSync(package_root);
|
|
5040
5172
|
} catch {
|
|
5041
5173
|
return false;
|
|
5042
5174
|
}
|
|
@@ -5051,7 +5183,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
5051
5183
|
if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
|
|
5052
5184
|
let resolved_src = src;
|
|
5053
5185
|
try {
|
|
5054
|
-
resolved_src =
|
|
5186
|
+
resolved_src = fs12.realpathSync(src);
|
|
5055
5187
|
} catch {
|
|
5056
5188
|
resolved_src = src;
|
|
5057
5189
|
}
|
|
@@ -5059,10 +5191,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
5059
5191
|
warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
|
|
5060
5192
|
return [0, 0, written_paths];
|
|
5061
5193
|
}
|
|
5062
|
-
mkdirp(
|
|
5194
|
+
mkdirp(path10.dirname(dest));
|
|
5063
5195
|
const decision = _resolve_file_conflict(dest, force);
|
|
5064
5196
|
if (decision === "skip") return [0, 1, written_paths];
|
|
5065
|
-
|
|
5197
|
+
fs12.copyFileSync(src, dest);
|
|
5066
5198
|
_inject_package_tag(dest, src, package_root);
|
|
5067
5199
|
written_paths.push(dest);
|
|
5068
5200
|
return [1, 0, written_paths];
|
|
@@ -5070,11 +5202,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
5070
5202
|
mkdirp(dest);
|
|
5071
5203
|
const walk = (node) => {
|
|
5072
5204
|
const acc = [];
|
|
5073
|
-
const names =
|
|
5205
|
+
const names = fs12.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
5074
5206
|
for (const name of names) {
|
|
5075
|
-
const entry =
|
|
5207
|
+
const entry = path10.join(node, name);
|
|
5076
5208
|
acc.push(entry);
|
|
5077
|
-
const lst =
|
|
5209
|
+
const lst = fs12.lstatSync(entry);
|
|
5078
5210
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
5079
5211
|
acc.push(...walk(entry));
|
|
5080
5212
|
}
|
|
@@ -5082,9 +5214,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
5082
5214
|
return acc;
|
|
5083
5215
|
};
|
|
5084
5216
|
for (const entry of walk(src)) {
|
|
5085
|
-
const rel =
|
|
5086
|
-
const target =
|
|
5087
|
-
const lst =
|
|
5217
|
+
const rel = path10.relative(src, entry);
|
|
5218
|
+
const target = path10.join(dest, rel);
|
|
5219
|
+
const lst = fs12.lstatSync(entry);
|
|
5088
5220
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
5089
5221
|
mkdirp(target);
|
|
5090
5222
|
continue;
|
|
@@ -5092,8 +5224,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
5092
5224
|
let resolvedIsDir = false;
|
|
5093
5225
|
let resolved = entry;
|
|
5094
5226
|
try {
|
|
5095
|
-
resolved =
|
|
5096
|
-
resolvedIsDir =
|
|
5227
|
+
resolved = fs12.realpathSync(entry);
|
|
5228
|
+
resolvedIsDir = fs12.statSync(entry).isDirectory();
|
|
5097
5229
|
} catch {
|
|
5098
5230
|
resolvedIsDir = false;
|
|
5099
5231
|
}
|
|
@@ -5123,8 +5255,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
5123
5255
|
skipped += 1;
|
|
5124
5256
|
continue;
|
|
5125
5257
|
}
|
|
5126
|
-
mkdirp(
|
|
5127
|
-
|
|
5258
|
+
mkdirp(path10.dirname(target));
|
|
5259
|
+
fs12.copyFileSync(resolved, target);
|
|
5128
5260
|
_inject_package_tag(target, resolved, package_root);
|
|
5129
5261
|
written += 1;
|
|
5130
5262
|
written_paths.push(target);
|
|
@@ -5136,7 +5268,7 @@ function _claude_desktop_bundles_dir() {
|
|
|
5136
5268
|
}
|
|
5137
5269
|
function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
|
|
5138
5270
|
const anchor = expanduser2(USER_SCOPE_PATHS["claude-desktop"]);
|
|
5139
|
-
const target =
|
|
5271
|
+
const target = path10.join(anchor, "agent-config.md");
|
|
5140
5272
|
mkdirp(anchor);
|
|
5141
5273
|
const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
|
|
5142
5274
|
writeText(target, body);
|
|
@@ -5160,23 +5292,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
5160
5292
|
const wrapped = [];
|
|
5161
5293
|
const collisions = [];
|
|
5162
5294
|
const reserved = [];
|
|
5163
|
-
const commands_dir =
|
|
5295
|
+
const commands_dir = path10.join(anchor, "commands");
|
|
5164
5296
|
let flat_entries = [];
|
|
5165
5297
|
try {
|
|
5166
|
-
flat_entries =
|
|
5298
|
+
flat_entries = fs12.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
|
|
5167
5299
|
} catch {
|
|
5168
5300
|
}
|
|
5169
5301
|
for (const fname of flat_entries.sort()) {
|
|
5170
5302
|
const slug = fname.slice(0, -".md".length);
|
|
5171
5303
|
if (!is_claude_builtin_name(slug)) continue;
|
|
5172
|
-
|
|
5304
|
+
fs12.rmSync(path10.join(commands_dir, fname), { force: true });
|
|
5173
5305
|
current_files.delete(`commands/${fname}`);
|
|
5174
5306
|
reserved.push(slug);
|
|
5175
5307
|
}
|
|
5176
5308
|
const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
|
|
5177
5309
|
try {
|
|
5178
5310
|
const manifest = JSON.parse(
|
|
5179
|
-
|
|
5311
|
+
fs12.readFileSync(path10.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
|
|
5180
5312
|
);
|
|
5181
5313
|
for (const a of manifest.artefacts ?? []) {
|
|
5182
5314
|
if (a.category !== "command" || typeof a.slug !== "string") continue;
|
|
@@ -5187,22 +5319,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
5187
5319
|
}
|
|
5188
5320
|
for (const slug of [...eligible].sort()) {
|
|
5189
5321
|
const flat_rel = `commands/${slug}.md`;
|
|
5190
|
-
const flat_abs =
|
|
5191
|
-
if (!
|
|
5192
|
-
const skill_dir =
|
|
5193
|
-
if (
|
|
5322
|
+
const flat_abs = path10.join(anchor, "commands", `${slug}.md`);
|
|
5323
|
+
if (!fs12.existsSync(flat_abs)) continue;
|
|
5324
|
+
const skill_dir = path10.join(anchor, "skills", slug);
|
|
5325
|
+
if (fs12.existsSync(skill_dir)) {
|
|
5194
5326
|
collisions.push(slug);
|
|
5195
5327
|
continue;
|
|
5196
5328
|
}
|
|
5197
|
-
let body =
|
|
5329
|
+
let body = fs12.readFileSync(flat_abs, "utf8");
|
|
5198
5330
|
if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
|
|
5199
5331
|
body = body.replace("---\n", `---
|
|
5200
5332
|
name: ${slug}
|
|
5201
5333
|
`);
|
|
5202
5334
|
}
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5335
|
+
fs12.mkdirSync(skill_dir, { recursive: true });
|
|
5336
|
+
fs12.writeFileSync(path10.join(skill_dir, "SKILL.md"), body, "utf8");
|
|
5337
|
+
fs12.rmSync(flat_abs, { force: true });
|
|
5206
5338
|
current_files.delete(flat_rel);
|
|
5207
5339
|
current_files.add(`skills/${slug}/SKILL.md`);
|
|
5208
5340
|
wrapped.push(slug);
|
|
@@ -5234,8 +5366,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
5234
5366
|
const written_paths = [];
|
|
5235
5367
|
let current_files = /* @__PURE__ */ new Set();
|
|
5236
5368
|
for (const [src_rel, dest_sub] of plan) {
|
|
5237
|
-
const src =
|
|
5238
|
-
const dest = dest_sub ?
|
|
5369
|
+
const src = path10.join(package_root, src_rel);
|
|
5370
|
+
const dest = dest_sub ? path10.join(anchor, dest_sub) : anchor;
|
|
5239
5371
|
const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
|
|
5240
5372
|
const [w, s, paths] = _copy_dir_dereferencing_symlinks(
|
|
5241
5373
|
src,
|
|
@@ -5259,7 +5391,7 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
5259
5391
|
if (tool_id === "claude-code") {
|
|
5260
5392
|
const res = _apply_claude_flat_command_wrappers(anchor, package_root, current_files);
|
|
5261
5393
|
rewriteAndReport(
|
|
5262
|
-
|
|
5394
|
+
path10.join(anchor, "rules"),
|
|
5263
5395
|
state.QUIET,
|
|
5264
5396
|
info,
|
|
5265
5397
|
warn,
|
|
@@ -5306,10 +5438,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
5306
5438
|
results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
|
|
5307
5439
|
if (tool_id === "claude-code") {
|
|
5308
5440
|
try {
|
|
5309
|
-
const manifest =
|
|
5441
|
+
const manifest = path10.join(package_root, "src", "scripts", "hook_manifest.yaml");
|
|
5310
5442
|
const matrix = build_claude_hook_matrix(manifest);
|
|
5311
5443
|
const res = ensure_managed_hooks(
|
|
5312
|
-
|
|
5444
|
+
path10.join(anchor, "settings.json"),
|
|
5313
5445
|
matrix
|
|
5314
5446
|
);
|
|
5315
5447
|
if (!state.QUIET) {
|
|
@@ -5346,7 +5478,7 @@ function _preview_global_reap(tools, package_root) {
|
|
|
5346
5478
|
const anchor = expanduser2(anchor_raw);
|
|
5347
5479
|
let current_files = /* @__PURE__ */ new Set();
|
|
5348
5480
|
for (const [src_rel, dest_sub] of plan) {
|
|
5349
|
-
const src =
|
|
5481
|
+
const src = path10.join(package_root, src_rel);
|
|
5350
5482
|
current_files = setUnion(
|
|
5351
5483
|
current_files,
|
|
5352
5484
|
expected_deploy_files(
|
|
@@ -5380,14 +5512,14 @@ function _preview_global_reap(tools, package_root) {
|
|
|
5380
5512
|
function _verify_deploy_targets(anchor, plan) {
|
|
5381
5513
|
const missing = [];
|
|
5382
5514
|
for (const [, dest_sub] of plan) {
|
|
5383
|
-
const target = dest_sub ?
|
|
5515
|
+
const target = dest_sub ? path10.join(anchor, dest_sub) : anchor;
|
|
5384
5516
|
const label = dest_sub || ".";
|
|
5385
5517
|
if (!isDir(target)) {
|
|
5386
5518
|
missing.push(label);
|
|
5387
5519
|
continue;
|
|
5388
5520
|
}
|
|
5389
5521
|
try {
|
|
5390
|
-
const entries =
|
|
5522
|
+
const entries = fs12.readdirSync(target);
|
|
5391
5523
|
if (entries.length === 0) missing.push(label);
|
|
5392
5524
|
} catch {
|
|
5393
5525
|
missing.push(label);
|
|
@@ -5405,9 +5537,9 @@ function _resolve_global_settings_doc() {
|
|
|
5405
5537
|
}
|
|
5406
5538
|
function _resolve_global_settings_path() {
|
|
5407
5539
|
const root = event4u_root();
|
|
5408
|
-
const canonical =
|
|
5540
|
+
const canonical = path10.join(root, "settings", SETTINGS_FILE);
|
|
5409
5541
|
if (pathExists(canonical)) return canonical;
|
|
5410
|
-
const legacy =
|
|
5542
|
+
const legacy = path10.join(root, SETTINGS_FILE);
|
|
5411
5543
|
if (pathExists(legacy)) return legacy;
|
|
5412
5544
|
return null;
|
|
5413
5545
|
}
|
|
@@ -5518,7 +5650,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
5518
5650
|
info(` schema_version=1, agent_config_version=${installed_version}`);
|
|
5519
5651
|
info(` tools=${merged_tools.join(",")}`);
|
|
5520
5652
|
}
|
|
5521
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
5653
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path10.join(project_root, ".agent-src.uncondensed"))) {
|
|
5522
5654
|
const drift = collect_drift(project_root);
|
|
5523
5655
|
if (!state.QUIET) {
|
|
5524
5656
|
process2.stdout.write("\n");
|
|
@@ -5632,19 +5764,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
5632
5764
|
}
|
|
5633
5765
|
}
|
|
5634
5766
|
}
|
|
5635
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
5767
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path10.join(project_root, ".agent-src.uncondensed"))) {
|
|
5636
5768
|
const files_by_tool = _files_by_tool_from_deploy(deploy_results);
|
|
5637
5769
|
const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
|
|
5638
5770
|
if (rc !== 0) return rc;
|
|
5639
5771
|
const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
|
|
5640
5772
|
if (removed_marker !== null && !state.QUIET) {
|
|
5641
|
-
const rel = isRelativeTo(removed_marker, project_root) ?
|
|
5773
|
+
const rel = isRelativeTo(removed_marker, project_root) ? path10.relative(project_root, removed_marker) : removed_marker;
|
|
5642
5774
|
info(`Removed legacy bridge marker: ${rel}`);
|
|
5643
5775
|
}
|
|
5644
5776
|
const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
|
|
5645
5777
|
if (anchor_paths.length > 0 && !state.QUIET) {
|
|
5646
5778
|
for (const p of anchor_paths) {
|
|
5647
|
-
const rel = isRelativeTo(p, project_root) ?
|
|
5779
|
+
const rel = isRelativeTo(p, project_root) ? path10.relative(project_root, p) : p;
|
|
5648
5780
|
info(`Project anchor written: ${rel}`);
|
|
5649
5781
|
}
|
|
5650
5782
|
}
|
|
@@ -5680,8 +5812,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
5680
5812
|
}
|
|
5681
5813
|
function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
5682
5814
|
const log_candidates = [
|
|
5683
|
-
|
|
5684
|
-
...project_root ? [
|
|
5815
|
+
path10.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
5816
|
+
...project_root ? [path10.join(project_root, OBSERVATION_LOG)] : []
|
|
5685
5817
|
];
|
|
5686
5818
|
const records = log_candidates.flatMap((p) => readObservationLog(p));
|
|
5687
5819
|
if (records.length === 0) return [];
|
|
@@ -5704,13 +5836,13 @@ function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
|
5704
5836
|
function _scoped_migration_notice(deploy_results, project_root, package_root, probe) {
|
|
5705
5837
|
if (!isInteractiveSession(probe)) return [];
|
|
5706
5838
|
const log_candidates = [
|
|
5707
|
-
|
|
5708
|
-
...project_root ? [
|
|
5839
|
+
path10.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
5840
|
+
...project_root ? [path10.join(project_root, OBSERVATION_LOG)] : []
|
|
5709
5841
|
];
|
|
5710
5842
|
const limits = knownHostLimits(log_candidates.flatMap((p) => readObservationLog(p)));
|
|
5711
5843
|
if (limits.size === 0) return [];
|
|
5712
5844
|
const resolved = _resolve_scoped_projection(package_root);
|
|
5713
|
-
const settings_path = _resolve_global_settings_path() ??
|
|
5845
|
+
const settings_path = _resolve_global_settings_path() ?? path10.join(event4u_root(), "settings", SETTINGS_FILE);
|
|
5714
5846
|
for (const tool_id of Object.keys(deploy_results).sort()) {
|
|
5715
5847
|
const [, , status] = deploy_results[tool_id];
|
|
5716
5848
|
if (status !== "deployed") continue;
|
|
@@ -5729,8 +5861,8 @@ function _scoped_migration_notice(deploy_results, project_root, package_root, pr
|
|
|
5729
5861
|
}
|
|
5730
5862
|
return [];
|
|
5731
5863
|
}
|
|
5732
|
-
var SETTINGS_SURFACE_REL =
|
|
5733
|
-
var SETTINGS_DELTA_REL =
|
|
5864
|
+
var SETTINGS_SURFACE_REL = path10.join("state", "settings-surface.json");
|
|
5865
|
+
var SETTINGS_DELTA_REL = path10.join("state", "settings-delta.json");
|
|
5734
5866
|
function _current_settings_surface(version) {
|
|
5735
5867
|
const jsonSchema = zodToJsonSchema(settingsSchema, {
|
|
5736
5868
|
name: "AgentSettings",
|
|
@@ -5741,20 +5873,20 @@ function _current_settings_surface(version) {
|
|
|
5741
5873
|
}
|
|
5742
5874
|
function _write_settings_surface_snapshot(installed_version) {
|
|
5743
5875
|
const root = event4u_root();
|
|
5744
|
-
const surface_path =
|
|
5745
|
-
const delta_path =
|
|
5876
|
+
const surface_path = path10.join(root, SETTINGS_SURFACE_REL);
|
|
5877
|
+
const delta_path = path10.join(root, SETTINGS_DELTA_REL);
|
|
5746
5878
|
const next = _current_settings_surface(installed_version);
|
|
5747
5879
|
let previous = null;
|
|
5748
5880
|
try {
|
|
5749
|
-
const parsed = JSON.parse(
|
|
5881
|
+
const parsed = JSON.parse(fs12.readFileSync(surface_path, "utf8"));
|
|
5750
5882
|
if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
|
|
5751
5883
|
} catch {
|
|
5752
5884
|
}
|
|
5753
5885
|
if (previous !== null && previous.version !== next.version) {
|
|
5754
5886
|
const delta = computeSurfaceDelta(previous, next);
|
|
5755
5887
|
if (delta.changes.length > 0) {
|
|
5756
|
-
|
|
5757
|
-
|
|
5888
|
+
fs12.mkdirSync(path10.dirname(delta_path), { recursive: true, mode: 448 });
|
|
5889
|
+
fs12.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
|
|
5758
5890
|
`, { mode: 384 });
|
|
5759
5891
|
if (!state.QUIET) {
|
|
5760
5892
|
const counts = {};
|
|
@@ -5766,8 +5898,8 @@ function _write_settings_surface_snapshot(installed_version) {
|
|
|
5766
5898
|
}
|
|
5767
5899
|
}
|
|
5768
5900
|
}
|
|
5769
|
-
|
|
5770
|
-
|
|
5901
|
+
fs12.mkdirSync(path10.dirname(surface_path), { recursive: true, mode: 448 });
|
|
5902
|
+
fs12.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
|
|
5771
5903
|
`, { mode: 384 });
|
|
5772
5904
|
}
|
|
5773
5905
|
function arrayStrEqual(a, b) {
|
|
@@ -5784,7 +5916,7 @@ function _merge_tools_aliases(tools, ai) {
|
|
|
5784
5916
|
}
|
|
5785
5917
|
return items.length > 0 ? items.join(",") : "all";
|
|
5786
5918
|
}
|
|
5787
|
-
var PROG = "install
|
|
5919
|
+
var PROG = "agent-config install";
|
|
5788
5920
|
var USAGE = `usage: ${PROG} [-h] [--profile PROFILE] [--user-type USER_TYPE] [--force]
|
|
5789
5921
|
[--skip-bridges] [--augment-user-hooks]
|
|
5790
5922
|
[--cursor-user-hooks] [--cline-user-hooks]
|
|
@@ -5987,13 +6119,13 @@ function _minimal_templates_root() {
|
|
|
5987
6119
|
const chain = [start];
|
|
5988
6120
|
let cur = start;
|
|
5989
6121
|
for (; ; ) {
|
|
5990
|
-
const parent =
|
|
6122
|
+
const parent = path10.dirname(cur);
|
|
5991
6123
|
if (parent === cur) break;
|
|
5992
6124
|
chain.push(parent);
|
|
5993
6125
|
cur = parent;
|
|
5994
6126
|
}
|
|
5995
6127
|
for (const ancestor of chain) {
|
|
5996
|
-
const candidate =
|
|
6128
|
+
const candidate = path10.join(ancestor, "src", "templates", "minimal");
|
|
5997
6129
|
if (isDir(candidate)) return candidate;
|
|
5998
6130
|
}
|
|
5999
6131
|
fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
|
|
@@ -6001,9 +6133,9 @@ function _minimal_templates_root() {
|
|
|
6001
6133
|
var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
6002
6134
|
function _write_install_mode_marker(project_root, mode) {
|
|
6003
6135
|
if (mode !== "minimal" && mode !== "full") return;
|
|
6004
|
-
const marker =
|
|
6136
|
+
const marker = path10.join(project_root, INSTALL_MODE_MARKER_REL);
|
|
6005
6137
|
try {
|
|
6006
|
-
mkdirp(
|
|
6138
|
+
mkdirp(path10.dirname(marker));
|
|
6007
6139
|
writeText(marker, `${mode}
|
|
6008
6140
|
`);
|
|
6009
6141
|
} catch {
|
|
@@ -6012,7 +6144,7 @@ function _write_install_mode_marker(project_root, mode) {
|
|
|
6012
6144
|
function install_minimal(target_root_in, force, user_type = "") {
|
|
6013
6145
|
let target_root = resolvePath(target_root_in);
|
|
6014
6146
|
mkdirp(target_root);
|
|
6015
|
-
const parent =
|
|
6147
|
+
const parent = path10.dirname(target_root);
|
|
6016
6148
|
if (parent !== target_root) {
|
|
6017
6149
|
const existing = find_project_root_with_anchor(parent);
|
|
6018
6150
|
if (existing !== null && existing[0] !== target_root) {
|
|
@@ -6023,21 +6155,21 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
6023
6155
|
}
|
|
6024
6156
|
}
|
|
6025
6157
|
const templates = _minimal_templates_root();
|
|
6026
|
-
const settings_src =
|
|
6027
|
-
const overrides_gitkeep_src =
|
|
6028
|
-
const overrides_readme_src =
|
|
6158
|
+
const settings_src = path10.join(templates, SETTINGS_FILE);
|
|
6159
|
+
const overrides_gitkeep_src = path10.join(templates, "overrides-gitkeep");
|
|
6160
|
+
const overrides_readme_src = path10.join(templates, "agents-overrides-readme.md");
|
|
6029
6161
|
if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
|
|
6030
6162
|
if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
|
|
6031
6163
|
fail(`Bundled overrides scaffold templates missing under ${templates}`);
|
|
6032
6164
|
}
|
|
6033
6165
|
info(`Minimal init \u2192 ${target_root}`);
|
|
6034
|
-
const overrides_root =
|
|
6166
|
+
const overrides_root = path10.join(target_root, "agents", "overrides");
|
|
6035
6167
|
mkdirp(overrides_root);
|
|
6036
6168
|
const gitkeep_body = readText(overrides_gitkeep_src);
|
|
6037
6169
|
for (const sub of ["rules", "skills", "commands"]) {
|
|
6038
|
-
const sub_dir =
|
|
6170
|
+
const sub_dir = path10.join(overrides_root, sub);
|
|
6039
6171
|
mkdirp(sub_dir);
|
|
6040
|
-
const gitkeep_dst =
|
|
6172
|
+
const gitkeep_dst = path10.join(sub_dir, ".gitkeep");
|
|
6041
6173
|
if (pathExists(gitkeep_dst) && !force) {
|
|
6042
6174
|
skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
|
|
6043
6175
|
} else {
|
|
@@ -6045,7 +6177,7 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
6045
6177
|
success(`Wrote agents/overrides/${sub}/.gitkeep`);
|
|
6046
6178
|
}
|
|
6047
6179
|
}
|
|
6048
|
-
const readme_dst =
|
|
6180
|
+
const readme_dst = path10.join(overrides_root, "README.md");
|
|
6049
6181
|
if (pathExists(readme_dst) && !force) {
|
|
6050
6182
|
skip("agents/overrides/README.md already exists (use --force to overwrite)");
|
|
6051
6183
|
} else {
|
|
@@ -6063,14 +6195,14 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
6063
6195
|
personal:
|
|
6064
6196
|
user_type: ${user_type}
|
|
6065
6197
|
`;
|
|
6066
|
-
mkdirp(
|
|
6198
|
+
mkdirp(path10.dirname(settings_dst));
|
|
6067
6199
|
writeText(settings_dst, body);
|
|
6068
6200
|
success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
|
|
6069
6201
|
}
|
|
6070
6202
|
}
|
|
6071
6203
|
const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
|
|
6072
6204
|
if (removed_marker !== null) {
|
|
6073
|
-
const rel = isRelativeTo(removed_marker, target_root) ?
|
|
6205
|
+
const rel = isRelativeTo(removed_marker, target_root) ? path10.relative(target_root, removed_marker) : removed_marker;
|
|
6074
6206
|
success(`Removed legacy bridge marker: ${rel}`);
|
|
6075
6207
|
}
|
|
6076
6208
|
_write_install_mode_marker(target_root, "minimal");
|
|
@@ -6144,7 +6276,7 @@ function run_interactive_init(project_root, force) {
|
|
|
6144
6276
|
);
|
|
6145
6277
|
return 0;
|
|
6146
6278
|
}
|
|
6147
|
-
const target =
|
|
6279
|
+
const target = path10.join(project_root, _LOCAL_CONFIG_FILE);
|
|
6148
6280
|
if (pathExists(target) && !force) {
|
|
6149
6281
|
warn(
|
|
6150
6282
|
`${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
|
|
@@ -6171,7 +6303,7 @@ function run_interactive_init(project_root, force) {
|
|
|
6171
6303
|
warn(`Could not write ${target}: ${String(exc)}`);
|
|
6172
6304
|
return 1;
|
|
6173
6305
|
}
|
|
6174
|
-
success(`Wrote ${
|
|
6306
|
+
success(`Wrote ${path10.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
|
|
6175
6307
|
return 0;
|
|
6176
6308
|
}
|
|
6177
6309
|
var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
|
|
@@ -6189,12 +6321,12 @@ function _wizard_should_launch(opts) {
|
|
|
6189
6321
|
return [true, ""];
|
|
6190
6322
|
}
|
|
6191
6323
|
function _wizard_cli_dist(_project_root) {
|
|
6192
|
-
const package_root =
|
|
6193
|
-
const cli =
|
|
6324
|
+
const package_root = path10.dirname(path10.dirname(path10.dirname(resolvePath(_HERE))));
|
|
6325
|
+
const cli = path10.join(package_root, "dist", "cli", "agent-config.js");
|
|
6194
6326
|
return pathExists(cli) ? cli : null;
|
|
6195
6327
|
}
|
|
6196
6328
|
function _server_info_path() {
|
|
6197
|
-
return
|
|
6329
|
+
return path10.join(os3.homedir(), ".event4u", "agent-config", "local-server.json");
|
|
6198
6330
|
}
|
|
6199
6331
|
function _pid_is_agent_config(pid) {
|
|
6200
6332
|
let res;
|
|
@@ -6211,7 +6343,7 @@ function _pid_is_agent_config(pid) {
|
|
|
6211
6343
|
}
|
|
6212
6344
|
function unlinkMissingOk(p) {
|
|
6213
6345
|
try {
|
|
6214
|
-
|
|
6346
|
+
fs12.unlinkSync(p);
|
|
6215
6347
|
} catch {
|
|
6216
6348
|
}
|
|
6217
6349
|
}
|
|
@@ -6289,14 +6421,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
|
|
|
6289
6421
|
}
|
|
6290
6422
|
function _wizard_run_sync(cmd, env, cli) {
|
|
6291
6423
|
const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
|
|
6292
|
-
const log_path =
|
|
6424
|
+
const log_path = path10.join(
|
|
6293
6425
|
os3.tmpdir(),
|
|
6294
6426
|
`agent-config-wizard-${process2.pid}-${Date.now()}.log`
|
|
6295
6427
|
);
|
|
6296
6428
|
let child;
|
|
6297
6429
|
let log_fd = null;
|
|
6298
6430
|
try {
|
|
6299
|
-
log_fd =
|
|
6431
|
+
log_fd = fs12.openSync(log_path, "w");
|
|
6300
6432
|
child = spawn(cmd[0], cmd.slice(1), {
|
|
6301
6433
|
env,
|
|
6302
6434
|
detached: true,
|
|
@@ -6314,7 +6446,7 @@ function _wizard_run_sync(cmd, env, cli) {
|
|
|
6314
6446
|
} finally {
|
|
6315
6447
|
if (log_fd !== null) {
|
|
6316
6448
|
try {
|
|
6317
|
-
|
|
6449
|
+
fs12.closeSync(log_fd);
|
|
6318
6450
|
} catch {
|
|
6319
6451
|
}
|
|
6320
6452
|
}
|
|
@@ -6564,8 +6696,8 @@ function main2(argv) {
|
|
|
6564
6696
|
const target_root = resolvePath(
|
|
6565
6697
|
opts.custom_path || opts.project || process2.env["PROJECT_ROOT"] || process2.cwd()
|
|
6566
6698
|
);
|
|
6567
|
-
const minimal_package_root =
|
|
6568
|
-
|
|
6699
|
+
const minimal_package_root = path10.dirname(
|
|
6700
|
+
path10.dirname(path10.dirname(_minimal_templates_root()))
|
|
6569
6701
|
);
|
|
6570
6702
|
const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
|
|
6571
6703
|
return install_minimal(target_root, opts.force, validated_user_type);
|
|
@@ -6597,7 +6729,7 @@ function main2(argv) {
|
|
|
6597
6729
|
return rc2;
|
|
6598
6730
|
}
|
|
6599
6731
|
const project_root = custom_path || resolvePath(opts.project || process2.env["PROJECT_ROOT"] || process2.cwd());
|
|
6600
|
-
const is_first_run = !pathExists(
|
|
6732
|
+
const is_first_run = !pathExists(path10.join(project_root, SETTINGS_FILE));
|
|
6601
6733
|
const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
|
|
6602
6734
|
if (rc === 0 && opts.interactive) {
|
|
6603
6735
|
run_interactive_init(project_root, opts.force);
|
|
@@ -6661,16 +6793,16 @@ function _team_setup_hint_line(project_root) {
|
|
|
6661
6793
|
return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
|
|
6662
6794
|
}
|
|
6663
6795
|
function finalize_claude_model_tiers(project_root) {
|
|
6664
|
-
const claude_skills =
|
|
6665
|
-
const augment_skills =
|
|
6796
|
+
const claude_skills = path10.join(project_root, ".claude", "skills");
|
|
6797
|
+
const augment_skills = path10.join(project_root, ".augment", "skills");
|
|
6666
6798
|
if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
|
|
6667
6799
|
if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
|
|
6668
6800
|
let rendered = 0;
|
|
6669
|
-
const entries =
|
|
6801
|
+
const entries = fs12.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
6670
6802
|
for (const name of entries) {
|
|
6671
|
-
const entry =
|
|
6672
|
-
const src_dir =
|
|
6673
|
-
const src_md =
|
|
6803
|
+
const entry = path10.join(claude_skills, name);
|
|
6804
|
+
const src_dir = path10.join(augment_skills, name);
|
|
6805
|
+
const src_md = path10.join(src_dir, "SKILL.md");
|
|
6674
6806
|
let tier;
|
|
6675
6807
|
try {
|
|
6676
6808
|
tier = read_model_tier(src_md);
|
|
@@ -6679,22 +6811,22 @@ function finalize_claude_model_tiers(project_root) {
|
|
|
6679
6811
|
}
|
|
6680
6812
|
if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
|
|
6681
6813
|
if (isSymlink(entry) || isFile(entry)) {
|
|
6682
|
-
|
|
6814
|
+
fs12.unlinkSync(entry);
|
|
6683
6815
|
} else if (isDir(entry)) {
|
|
6684
|
-
|
|
6816
|
+
fs12.rmSync(entry, { recursive: true, force: true });
|
|
6685
6817
|
}
|
|
6686
6818
|
mkdirp(entry);
|
|
6687
|
-
const srcFiles =
|
|
6819
|
+
const srcFiles = fs12.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
6688
6820
|
for (const fname of srcFiles) {
|
|
6689
6821
|
if (fname === "SKILL.md") {
|
|
6690
6822
|
writeText(
|
|
6691
|
-
|
|
6823
|
+
path10.join(entry, "SKILL.md"),
|
|
6692
6824
|
render_native_model_md(readText(src_md), tier)
|
|
6693
6825
|
);
|
|
6694
6826
|
} else {
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6827
|
+
fs12.symlinkSync(
|
|
6828
|
+
path10.join("../../../.augment/skills", name, fname),
|
|
6829
|
+
path10.join(entry, fname)
|
|
6698
6830
|
);
|
|
6699
6831
|
}
|
|
6700
6832
|
}
|
|
@@ -6712,7 +6844,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
6712
6844
|
let package_type;
|
|
6713
6845
|
if (opts.package) {
|
|
6714
6846
|
package_root = resolvePath(opts.package);
|
|
6715
|
-
if (!pathExists(
|
|
6847
|
+
if (!pathExists(path10.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
6716
6848
|
fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
|
|
6717
6849
|
}
|
|
6718
6850
|
package_type = detect_package_type_for_project(project_root, package_root);
|
|
@@ -6740,11 +6872,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
6740
6872
|
...ensure_augment_bridge(project_root, opts.force)
|
|
6741
6873
|
];
|
|
6742
6874
|
if (_is_tool_enabled(tools, "claude-code")) {
|
|
6743
|
-
merged_keys_by_tool["claude-code"] =
|
|
6744
|
-
...ensure_claude_bridge(project_root, opts.force),
|
|
6745
|
-
...ensure_mcp_bridge(project_root, opts.force)
|
|
6746
|
-
];
|
|
6875
|
+
merged_keys_by_tool["claude-code"] = ensure_claude_bridge(project_root, opts.force);
|
|
6747
6876
|
}
|
|
6877
|
+
registerMcpHosts(merge_json_file, project_root, opts.force, package_root, tools, merged_keys_by_tool);
|
|
6748
6878
|
if (_is_tool_enabled(tools, "cursor")) {
|
|
6749
6879
|
merged_keys_by_tool["cursor"] = ensure_cursor_bridge(project_root, opts.force);
|
|
6750
6880
|
}
|
|
@@ -6838,6 +6968,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
6838
6968
|
);
|
|
6839
6969
|
process2.stdout.write("\n");
|
|
6840
6970
|
}
|
|
6971
|
+
printResiduals(tools, state.QUIET);
|
|
6841
6972
|
if (_is_tool_enabled(tools, "claude-code")) {
|
|
6842
6973
|
const team_hint = _team_setup_hint_line(project_root);
|
|
6843
6974
|
if (team_hint !== null) {
|
|
@@ -6856,9 +6987,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
6856
6987
|
function _resolvedArgv1() {
|
|
6857
6988
|
if (process2.argv[1] === void 0) return void 0;
|
|
6858
6989
|
try {
|
|
6859
|
-
return
|
|
6990
|
+
return fs12.realpathSync(path10.resolve(process2.argv[1]));
|
|
6860
6991
|
} catch {
|
|
6861
|
-
return
|
|
6992
|
+
return path10.resolve(process2.argv[1]);
|
|
6862
6993
|
}
|
|
6863
6994
|
}
|
|
6864
6995
|
var _argv1 = _resolvedArgv1();
|