@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
|
@@ -34,11 +34,13 @@ import {
|
|
|
34
34
|
DEFAULT_DEPLOY_ROOTS,
|
|
35
35
|
MANAGED_SIGNATURE,
|
|
36
36
|
SCHEMA_VERSIONS_SUPPORTED,
|
|
37
|
+
TOOL_TO_HOST,
|
|
37
38
|
build_claude_hook_matrix,
|
|
38
39
|
global_deploy_inventory_exports,
|
|
39
40
|
manifest_path,
|
|
40
|
-
read_manifest
|
|
41
|
-
|
|
41
|
+
read_manifest,
|
|
42
|
+
residualReport
|
|
43
|
+
} from "./chunk-PI2GU3DP.js";
|
|
42
44
|
import {
|
|
43
45
|
read_lockfile
|
|
44
46
|
} from "./chunk-T7L2QK3K.js";
|
|
@@ -74,9 +76,9 @@ import {
|
|
|
74
76
|
// src/scripts/_cli/cmd_doctor.ts
|
|
75
77
|
var YAML2 = __toESM(require_dist(), 1);
|
|
76
78
|
import * as crypto2 from "node:crypto";
|
|
77
|
-
import * as
|
|
78
|
-
import * as
|
|
79
|
-
import * as
|
|
79
|
+
import * as fs15 from "node:fs";
|
|
80
|
+
import * as os4 from "node:os";
|
|
81
|
+
import * as path20 from "node:path";
|
|
80
82
|
import process3 from "node:process";
|
|
81
83
|
import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL6 } from "node:url";
|
|
82
84
|
|
|
@@ -2132,8 +2134,8 @@ if (_isCliEntry()) process.exit(main5(process.argv.slice(2)));
|
|
|
2132
2134
|
|
|
2133
2135
|
// src/scripts/_lib/runtime_wiring_checks.ts
|
|
2134
2136
|
var import_yaml = __toESM(require_dist(), 1);
|
|
2135
|
-
import * as
|
|
2136
|
-
import * as
|
|
2137
|
+
import * as fs11 from "node:fs";
|
|
2138
|
+
import * as path15 from "node:path";
|
|
2137
2139
|
import process2 from "node:process";
|
|
2138
2140
|
|
|
2139
2141
|
// src/scripts/_lib/repo_root.ts
|
|
@@ -2152,6 +2154,152 @@ function inheritedGitOverrides(env = process.env) {
|
|
|
2152
2154
|
return out;
|
|
2153
2155
|
}
|
|
2154
2156
|
|
|
2157
|
+
// src/scripts/_lib/host_permission_checks.ts
|
|
2158
|
+
import * as fs10 from "node:fs";
|
|
2159
|
+
import * as os from "node:os";
|
|
2160
|
+
import * as path14 from "node:path";
|
|
2161
|
+
var READ_SHAPED = [
|
|
2162
|
+
"Read",
|
|
2163
|
+
"Glob",
|
|
2164
|
+
"Grep",
|
|
2165
|
+
"LS",
|
|
2166
|
+
"NotebookRead",
|
|
2167
|
+
"Bash(cat",
|
|
2168
|
+
"Bash(ls",
|
|
2169
|
+
"Bash(head",
|
|
2170
|
+
"Bash(tail",
|
|
2171
|
+
"Bash(grep",
|
|
2172
|
+
"Bash(rg",
|
|
2173
|
+
"Bash(find",
|
|
2174
|
+
"Bash(wc",
|
|
2175
|
+
"Bash(git status",
|
|
2176
|
+
"Bash(git log",
|
|
2177
|
+
"Bash(git diff",
|
|
2178
|
+
"Bash(git show"
|
|
2179
|
+
];
|
|
2180
|
+
var KNOWN_MODES = ["default", "acceptEdits", "plan", "bypassPermissions"];
|
|
2181
|
+
function _strings(value) {
|
|
2182
|
+
return Array.isArray(value) ? value.filter((v) => typeof v === "string") : [];
|
|
2183
|
+
}
|
|
2184
|
+
function defaultHostPermissionDeps(projectRoot) {
|
|
2185
|
+
return {
|
|
2186
|
+
projectRoot,
|
|
2187
|
+
homeDir: os.homedir(),
|
|
2188
|
+
readFile: (p) => {
|
|
2189
|
+
try {
|
|
2190
|
+
return fs10.readFileSync(p, "utf8");
|
|
2191
|
+
} catch {
|
|
2192
|
+
return null;
|
|
2193
|
+
}
|
|
2194
|
+
},
|
|
2195
|
+
isDirectory: (p) => {
|
|
2196
|
+
try {
|
|
2197
|
+
return fs10.statSync(p).isDirectory();
|
|
2198
|
+
} catch {
|
|
2199
|
+
return false;
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
};
|
|
2203
|
+
}
|
|
2204
|
+
function readSettingsLayers(deps) {
|
|
2205
|
+
const candidates = [
|
|
2206
|
+
["user-global", path14.join(deps.homeDir, ".claude", "settings.json")],
|
|
2207
|
+
["project", path14.join(deps.projectRoot, ".claude", "settings.json")],
|
|
2208
|
+
["project-local", path14.join(deps.projectRoot, ".claude", "settings.local.json")]
|
|
2209
|
+
];
|
|
2210
|
+
return candidates.map(([label, file]) => {
|
|
2211
|
+
const raw = deps.readFile(file);
|
|
2212
|
+
if (raw === null) {
|
|
2213
|
+
return { label, file, present: false, unreadable: false, permissions: {} };
|
|
2214
|
+
}
|
|
2215
|
+
try {
|
|
2216
|
+
const parsed = JSON.parse(raw);
|
|
2217
|
+
const perms = parsed["permissions"];
|
|
2218
|
+
return {
|
|
2219
|
+
label,
|
|
2220
|
+
file,
|
|
2221
|
+
present: true,
|
|
2222
|
+
unreadable: false,
|
|
2223
|
+
permissions: perms !== null && typeof perms === "object" ? perms : {}
|
|
2224
|
+
};
|
|
2225
|
+
} catch {
|
|
2226
|
+
return { label, file, present: true, unreadable: true, permissions: {} };
|
|
2227
|
+
}
|
|
2228
|
+
});
|
|
2229
|
+
}
|
|
2230
|
+
function readDenyRules(layers) {
|
|
2231
|
+
const hits = [];
|
|
2232
|
+
for (const layer of layers) {
|
|
2233
|
+
for (const rule of _strings(layer.permissions.deny)) {
|
|
2234
|
+
if (READ_SHAPED.some((prefix) => rule.startsWith(prefix))) {
|
|
2235
|
+
hits.push([layer.label, rule]);
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
return hits;
|
|
2240
|
+
}
|
|
2241
|
+
function additionalDirectories(layers) {
|
|
2242
|
+
const seen = [];
|
|
2243
|
+
for (const layer of layers) {
|
|
2244
|
+
for (const dir of _strings(layer.permissions.additionalDirectories)) {
|
|
2245
|
+
if (!seen.includes(dir)) seen.push(dir);
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2248
|
+
return seen;
|
|
2249
|
+
}
|
|
2250
|
+
function resolvedDefaultMode(layers) {
|
|
2251
|
+
let winner = null;
|
|
2252
|
+
for (const layer of layers) {
|
|
2253
|
+
const mode = layer.permissions.defaultMode;
|
|
2254
|
+
if (typeof mode === "string" && mode.trim()) winner = mode.trim();
|
|
2255
|
+
}
|
|
2256
|
+
return winner;
|
|
2257
|
+
}
|
|
2258
|
+
function isLinkedWorktree(deps) {
|
|
2259
|
+
const dotGit = path14.join(deps.projectRoot, ".git");
|
|
2260
|
+
const raw = deps.readFile(dotGit);
|
|
2261
|
+
if (raw === null) return false;
|
|
2262
|
+
return !deps.isDirectory(dotGit) && raw.trimStart().startsWith("gitdir:");
|
|
2263
|
+
}
|
|
2264
|
+
function permissionSnippet(projectRoot) {
|
|
2265
|
+
return JSON.stringify(
|
|
2266
|
+
{ permissions: { additionalDirectories: [projectRoot], defaultMode: "default" } },
|
|
2267
|
+
null,
|
|
2268
|
+
2
|
|
2269
|
+
);
|
|
2270
|
+
}
|
|
2271
|
+
function checkHostPermissionSettings(deps) {
|
|
2272
|
+
const layers = readSettingsLayers(deps);
|
|
2273
|
+
const unreadable = layers.filter((l) => l.unreadable);
|
|
2274
|
+
const denies = readDenyRules(layers);
|
|
2275
|
+
const dirs = additionalDirectories(layers);
|
|
2276
|
+
const mode = resolvedDefaultMode(layers);
|
|
2277
|
+
const worktree = isLinkedWorktree(deps);
|
|
2278
|
+
const rootListed = dirs.some(
|
|
2279
|
+
(d) => path14.resolve(d) === path14.resolve(deps.projectRoot)
|
|
2280
|
+
);
|
|
2281
|
+
const lines = [];
|
|
2282
|
+
lines.push(
|
|
2283
|
+
denies.length === 0 ? "read-deny rules: absent \u2014 no permissions.deny rule covers a read" : `read-deny rules: ${denies.length} \u2014 ` + denies.map(([layer, rule]) => `${rule} (${layer})`).join(", ")
|
|
2284
|
+
);
|
|
2285
|
+
lines.push(
|
|
2286
|
+
rootListed ? `working tree in additionalDirectories: present (${deps.projectRoot})` : `working tree in additionalDirectories: absent (${deps.projectRoot}${worktree ? ", a linked worktree" : ""})`
|
|
2287
|
+
);
|
|
2288
|
+
lines.push(
|
|
2289
|
+
mode === null ? "permissions.defaultMode: absent \u2014 the host's own built-in default applies" : `permissions.defaultMode: ${mode}` + (KNOWN_MODES.includes(mode) ? "" : " \u2014 not a value this tree has probed")
|
|
2290
|
+
);
|
|
2291
|
+
for (const layer of unreadable) {
|
|
2292
|
+
lines.push(`unreadable: ${layer.file} (${layer.label}) is not valid JSON`);
|
|
2293
|
+
}
|
|
2294
|
+
const reportable = denies.length > 0 || unreadable.length > 0 || worktree && !rootListed;
|
|
2295
|
+
return {
|
|
2296
|
+
id: "host-permission-settings",
|
|
2297
|
+
status: reportable ? "warn" : "ok",
|
|
2298
|
+
message: lines.join("; "),
|
|
2299
|
+
remedy: `agent-config never writes permissions \u2014 paste this into ${path14.join(deps.projectRoot, ".claude", "settings.local.json")} yourself if you want it: ` + permissionSnippet(deps.projectRoot).replace(/\s+/g, " ")
|
|
2300
|
+
};
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2155
2303
|
// src/scripts/_lib/runtime_wiring_checks.ts
|
|
2156
2304
|
function checkSettingsResolution(iterOverrides) {
|
|
2157
2305
|
let pairs;
|
|
@@ -2182,7 +2330,7 @@ function checkSettingsResolution(iterOverrides) {
|
|
|
2182
2330
|
for (const [key, , file] of pairs) winner.set(key, file);
|
|
2183
2331
|
const byFile = /* @__PURE__ */ new Map();
|
|
2184
2332
|
for (const file of winner.values()) byFile.set(file, (byFile.get(file) ?? 0) + 1);
|
|
2185
|
-
const summary = [...byFile.entries()].sort((a, b) => b[1] - a[1]).map(([f, n]) => `${
|
|
2333
|
+
const summary = [...byFile.entries()].sort((a, b) => b[1] - a[1]).map(([f, n]) => `${path15.basename(f)}=${String(n)}`).join(" \xB7 ");
|
|
2186
2334
|
return {
|
|
2187
2335
|
id: "settings-resolution",
|
|
2188
2336
|
status: "ok",
|
|
@@ -2191,8 +2339,8 @@ function checkSettingsResolution(iterOverrides) {
|
|
|
2191
2339
|
};
|
|
2192
2340
|
}
|
|
2193
2341
|
function checkRouterArtifact(repoRoot, rel = "dist/router.json") {
|
|
2194
|
-
const abs =
|
|
2195
|
-
if (!
|
|
2342
|
+
const abs = path15.join(repoRoot, rel);
|
|
2343
|
+
if (!fs11.existsSync(abs)) {
|
|
2196
2344
|
return {
|
|
2197
2345
|
id: "router-artifact",
|
|
2198
2346
|
status: "warn",
|
|
@@ -2202,7 +2350,7 @@ function checkRouterArtifact(repoRoot, rel = "dist/router.json") {
|
|
|
2202
2350
|
}
|
|
2203
2351
|
let doc;
|
|
2204
2352
|
try {
|
|
2205
|
-
doc = JSON.parse(
|
|
2353
|
+
doc = JSON.parse(fs11.readFileSync(abs, "utf8"));
|
|
2206
2354
|
} catch (e) {
|
|
2207
2355
|
return {
|
|
2208
2356
|
id: "router-artifact",
|
|
@@ -2234,8 +2382,8 @@ function _routerRuleCount(doc) {
|
|
|
2234
2382
|
return n;
|
|
2235
2383
|
}
|
|
2236
2384
|
function checkHookResolution(repoRoot, manifestRel = "src/scripts/hook_manifest.yaml", probe = null) {
|
|
2237
|
-
const abs =
|
|
2238
|
-
if (!
|
|
2385
|
+
const abs = path15.join(repoRoot, manifestRel);
|
|
2386
|
+
if (!fs11.existsSync(abs)) {
|
|
2239
2387
|
return {
|
|
2240
2388
|
check: {
|
|
2241
2389
|
id: "hook-resolution",
|
|
@@ -2248,7 +2396,7 @@ function checkHookResolution(repoRoot, manifestRel = "src/scripts/hook_manifest.
|
|
|
2248
2396
|
}
|
|
2249
2397
|
let concerns;
|
|
2250
2398
|
try {
|
|
2251
|
-
const doc = (0, import_yaml.parse)(
|
|
2399
|
+
const doc = (0, import_yaml.parse)(fs11.readFileSync(abs, "utf8"));
|
|
2252
2400
|
concerns = doc.concerns ?? {};
|
|
2253
2401
|
} catch (e) {
|
|
2254
2402
|
return {
|
|
@@ -2264,7 +2412,7 @@ function checkHookResolution(repoRoot, manifestRel = "src/scripts/hook_manifest.
|
|
|
2264
2412
|
const probes = [];
|
|
2265
2413
|
for (const [id, c] of Object.entries(concerns)) {
|
|
2266
2414
|
const script = typeof c.script === "string" ? c.script : "";
|
|
2267
|
-
const resolves = script !== "" &&
|
|
2415
|
+
const resolves = script !== "" && fs11.existsSync(path15.join(repoRoot, script));
|
|
2268
2416
|
probes.push({ id, script, resolves, ms: resolves && probe !== null ? probe(script) : null });
|
|
2269
2417
|
}
|
|
2270
2418
|
const broken = probes.filter((p) => !p.resolves);
|
|
@@ -2308,7 +2456,7 @@ function checkInheritedGitEnv(env = process2.env) {
|
|
|
2308
2456
|
remedy: "unset them before running a gate from inside a git hook (`env -u GIT_DIR -u GIT_WORK_TREE \u2026`), or resolve the root with _lib/repo_root.ts, which refuses instead of guessing"
|
|
2309
2457
|
};
|
|
2310
2458
|
}
|
|
2311
|
-
var WIRING_CHECK_IDS = ["settings-resolution", "router-artifact", "hook-resolution", "inherited-git-env", "hooks-kill-switch"];
|
|
2459
|
+
var WIRING_CHECK_IDS = ["settings-resolution", "router-artifact", "hook-resolution", "inherited-git-env", "hooks-kill-switch", "host-permission-settings"];
|
|
2312
2460
|
function checkHooksDisabled(env = process2.env) {
|
|
2313
2461
|
const raw = env["AGENT_CONFIG_DISABLE_HOOKS"];
|
|
2314
2462
|
if (raw !== "1") {
|
|
@@ -2335,7 +2483,12 @@ function wiringRunners(opts) {
|
|
|
2335
2483
|
// a multi-second one. `probeHookCost` is exported for a caller that wants it.
|
|
2336
2484
|
"hook-resolution": () => checkHookResolution(opts.packageRoot).check,
|
|
2337
2485
|
"inherited-git-env": () => checkInheritedGitEnv(),
|
|
2338
|
-
"hooks-kill-switch": () => checkHooksDisabled()
|
|
2486
|
+
"hooks-kill-switch": () => checkHooksDisabled(),
|
|
2487
|
+
// The host's own permission settings, which decide how often a call is
|
|
2488
|
+
// confirmed. It lives with this family rather than its own because
|
|
2489
|
+
// `checkHookWiring` below already reads the same `~/.claude/settings.json`
|
|
2490
|
+
// for the same host — the question is the same surface, one key over.
|
|
2491
|
+
"host-permission-settings": () => checkHostPermissionSettings(defaultHostPermissionDeps(opts.projectRoot))
|
|
2339
2492
|
};
|
|
2340
2493
|
}
|
|
2341
2494
|
function checkHookWiring(deps) {
|
|
@@ -2348,11 +2501,11 @@ function checkHookWiring(deps) {
|
|
|
2348
2501
|
remedy: ""
|
|
2349
2502
|
};
|
|
2350
2503
|
}
|
|
2351
|
-
const settings_path =
|
|
2504
|
+
const settings_path = path15.join(deps.homeDir, ".claude", "settings.json");
|
|
2352
2505
|
let missing;
|
|
2353
2506
|
try {
|
|
2354
|
-
const matrix = deps.buildMatrix(
|
|
2355
|
-
const settings =
|
|
2507
|
+
const matrix = deps.buildMatrix(path15.join(deps.packageRoot, "src", "scripts", "hook_manifest.yaml"));
|
|
2508
|
+
const settings = fs11.existsSync(settings_path) ? JSON.parse(fs11.readFileSync(settings_path, "utf8")) : {};
|
|
2356
2509
|
const hooks = (settings["hooks"] ?? {}) || {};
|
|
2357
2510
|
missing = Object.keys(matrix).filter((ev) => {
|
|
2358
2511
|
const groups = hooks[ev];
|
|
@@ -2399,8 +2552,8 @@ function checkHookWiring(deps) {
|
|
|
2399
2552
|
}
|
|
2400
2553
|
|
|
2401
2554
|
// src/scripts/_lib/install_reach_checks.ts
|
|
2402
|
-
import * as
|
|
2403
|
-
import * as
|
|
2555
|
+
import * as fs12 from "node:fs";
|
|
2556
|
+
import * as path16 from "node:path";
|
|
2404
2557
|
var ROOT_INSTRUCTION_FILES = [
|
|
2405
2558
|
"AGENTS.md",
|
|
2406
2559
|
"CLAUDE.md",
|
|
@@ -2433,7 +2586,7 @@ function _isAnchored(projectRoot, token) {
|
|
|
2433
2586
|
const first = token.split("/")[0];
|
|
2434
2587
|
if (first === void 0 || first === "" || first === token) return false;
|
|
2435
2588
|
try {
|
|
2436
|
-
return
|
|
2589
|
+
return fs12.statSync(path16.join(projectRoot, first)).isDirectory();
|
|
2437
2590
|
} catch {
|
|
2438
2591
|
return false;
|
|
2439
2592
|
}
|
|
@@ -2470,19 +2623,19 @@ function classifyNamedPath(projectRoot, entry) {
|
|
|
2470
2623
|
if (rel === "") {
|
|
2471
2624
|
return { ...entry, normalised: null, outcome: "unresolvable", reason: "empty after normalisation" };
|
|
2472
2625
|
}
|
|
2473
|
-
const abs =
|
|
2474
|
-
if (!
|
|
2626
|
+
const abs = path16.join(projectRoot, rel);
|
|
2627
|
+
if (!path16.resolve(abs).startsWith(path16.resolve(projectRoot))) {
|
|
2475
2628
|
return { ...entry, normalised: rel, outcome: "unresolvable", reason: "escapes the repository root" };
|
|
2476
2629
|
}
|
|
2477
|
-
return { ...entry, normalised: rel, outcome:
|
|
2630
|
+
return { ...entry, normalised: rel, outcome: fs12.existsSync(abs) ? "present" : "dangling" };
|
|
2478
2631
|
}
|
|
2479
2632
|
function resolveInstructionPaths(projectRoot) {
|
|
2480
2633
|
const out = [];
|
|
2481
2634
|
for (const rel of ROOT_INSTRUCTION_FILES) {
|
|
2482
|
-
const abs =
|
|
2635
|
+
const abs = path16.join(projectRoot, rel);
|
|
2483
2636
|
let text;
|
|
2484
2637
|
try {
|
|
2485
|
-
text =
|
|
2638
|
+
text = fs12.readFileSync(abs, "utf8");
|
|
2486
2639
|
} catch {
|
|
2487
2640
|
continue;
|
|
2488
2641
|
}
|
|
@@ -2523,7 +2676,7 @@ function checkInstructionPaths(projectRoot) {
|
|
|
2523
2676
|
};
|
|
2524
2677
|
}
|
|
2525
2678
|
var SETTINGS_PIN_FILES = [
|
|
2526
|
-
{ rel:
|
|
2679
|
+
{ rel: path16.join("agents", "settings", ".agent-settings.yml"), legacy: false },
|
|
2527
2680
|
{ rel: ".agent-settings.yml", legacy: true },
|
|
2528
2681
|
{ rel: ".agent-project-settings.yml", legacy: true },
|
|
2529
2682
|
{ rel: "agent-settings.yml", legacy: true }
|
|
@@ -2535,7 +2688,7 @@ function readVersionPins(projectRoot) {
|
|
|
2535
2688
|
for (const { rel, legacy } of SETTINGS_PIN_FILES) {
|
|
2536
2689
|
let text;
|
|
2537
2690
|
try {
|
|
2538
|
-
text =
|
|
2691
|
+
text = fs12.readFileSync(path16.join(projectRoot, rel), "utf8");
|
|
2539
2692
|
} catch {
|
|
2540
2693
|
continue;
|
|
2541
2694
|
}
|
|
@@ -2546,7 +2699,7 @@ function readVersionPins(projectRoot) {
|
|
|
2546
2699
|
}
|
|
2547
2700
|
function readInstalledVersion(projectRoot) {
|
|
2548
2701
|
try {
|
|
2549
|
-
const text =
|
|
2702
|
+
const text = fs12.readFileSync(path16.join(projectRoot, "agents", "installed-tools.lock"), "utf8");
|
|
2550
2703
|
return LOCK_VERSION_RE.exec(text)?.[1] ?? null;
|
|
2551
2704
|
} catch {
|
|
2552
2705
|
return null;
|
|
@@ -2573,8 +2726,8 @@ function checkVersionAxis(projectRoot, resolvableNow) {
|
|
|
2573
2726
|
};
|
|
2574
2727
|
}
|
|
2575
2728
|
var OVERRIDE_LAYERS = [
|
|
2576
|
-
|
|
2577
|
-
|
|
2729
|
+
path16.join("agents", "overrides"),
|
|
2730
|
+
path16.join(".agent", "overrides")
|
|
2578
2731
|
];
|
|
2579
2732
|
var KIND_DIRS = [
|
|
2580
2733
|
{ dir: "rules", kind: "rule" },
|
|
@@ -2587,7 +2740,7 @@ function collectOverrideSet(projectRoot) {
|
|
|
2587
2740
|
for (const { dir, kind } of KIND_DIRS) {
|
|
2588
2741
|
let entries;
|
|
2589
2742
|
try {
|
|
2590
|
-
entries =
|
|
2743
|
+
entries = fs12.readdirSync(path16.join(projectRoot, layer, dir));
|
|
2591
2744
|
} catch {
|
|
2592
2745
|
continue;
|
|
2593
2746
|
}
|
|
@@ -2628,12 +2781,27 @@ function checkOverrideSet(projectRoot) {
|
|
|
2628
2781
|
remedy: "route it through the upstream-contribution path, never by changing a shipped default on one install"
|
|
2629
2782
|
};
|
|
2630
2783
|
}
|
|
2631
|
-
|
|
2784
|
+
function checkMcpConsentResidual() {
|
|
2785
|
+
const id = "mcp-consent-residual";
|
|
2786
|
+
const lines = residualReport(Object.keys(TOOL_TO_HOST));
|
|
2787
|
+
if (lines.length === 0) {
|
|
2788
|
+
return { id, status: "ok", message: "no MCP consent residual recorded for any known host", remedy: "" };
|
|
2789
|
+
}
|
|
2790
|
+
const actionable = lines.filter((l) => l.state === "residual");
|
|
2791
|
+
return {
|
|
2792
|
+
id,
|
|
2793
|
+
status: "warn",
|
|
2794
|
+
message: lines.map((l) => l.text).join(" \xB7 "),
|
|
2795
|
+
remedy: actionable.length > 0 ? "complete the step named above on each host you use" : "record an observation for the unchecked hosts, or ignore if you do not use them"
|
|
2796
|
+
};
|
|
2797
|
+
}
|
|
2798
|
+
var REACH_CHECK_IDS = ["instruction-path-reach", "version-axis", "override-set", "mcp-consent-residual"];
|
|
2632
2799
|
function reachRunners(opts) {
|
|
2633
2800
|
return {
|
|
2634
2801
|
"instruction-path-reach": () => checkInstructionPaths(opts.projectRoot),
|
|
2635
2802
|
"version-axis": () => checkVersionAxis(opts.projectRoot, opts.resolvableVersion),
|
|
2636
|
-
"override-set": () => checkOverrideSet(opts.projectRoot)
|
|
2803
|
+
"override-set": () => checkOverrideSet(opts.projectRoot),
|
|
2804
|
+
"mcp-consent-residual": () => checkMcpConsentResidual()
|
|
2637
2805
|
};
|
|
2638
2806
|
}
|
|
2639
2807
|
|
|
@@ -2666,14 +2834,14 @@ function checkHumanizerRuntime(which) {
|
|
|
2666
2834
|
|
|
2667
2835
|
// src/scripts/_lib/environment_detector.ts
|
|
2668
2836
|
import { spawnSync } from "node:child_process";
|
|
2669
|
-
import * as
|
|
2670
|
-
import * as
|
|
2671
|
-
import * as
|
|
2837
|
+
import * as fs13 from "node:fs";
|
|
2838
|
+
import * as os2 from "node:os";
|
|
2839
|
+
import * as path17 from "node:path";
|
|
2672
2840
|
|
|
2673
2841
|
// src/install/toolDetection.ts
|
|
2674
2842
|
import { existsSync as existsSync9 } from "node:fs";
|
|
2675
|
-
import { homedir as
|
|
2676
|
-
import { delimiter, join as
|
|
2843
|
+
import { homedir as homedir4 } from "node:os";
|
|
2844
|
+
import { delimiter, join as join16 } from "node:path";
|
|
2677
2845
|
var TOOL_SIGNALS = {
|
|
2678
2846
|
"claude-code": { bins: ["claude"], homePaths: [".claude", ".claude.json", ".config/claude"] },
|
|
2679
2847
|
"claude-desktop": { absPaths: ["/Applications/Claude.app"], homePaths: ["Library/Application Support/Claude", ".config/Claude"] },
|
|
@@ -2718,7 +2886,7 @@ function resolveBinaryPath(name, pathEnv) {
|
|
|
2718
2886
|
for (const dir of pathEnv.split(delimiter)) {
|
|
2719
2887
|
if (dir.length === 0) continue;
|
|
2720
2888
|
for (const candidate of [name, `${name}.exe`, `${name}.cmd`]) {
|
|
2721
|
-
const full =
|
|
2889
|
+
const full = join16(dir, candidate);
|
|
2722
2890
|
if (existsSync9(full)) return full;
|
|
2723
2891
|
}
|
|
2724
2892
|
}
|
|
@@ -2729,7 +2897,7 @@ function binOnPath(name, pathEnv) {
|
|
|
2729
2897
|
}
|
|
2730
2898
|
function isToolInstalled(signal, home, pathEnv) {
|
|
2731
2899
|
for (const rel of signal.homePaths ?? []) {
|
|
2732
|
-
if (existsSync9(
|
|
2900
|
+
if (existsSync9(join16(home, rel))) return true;
|
|
2733
2901
|
}
|
|
2734
2902
|
for (const abs of signal.absPaths ?? []) {
|
|
2735
2903
|
if (existsSync9(abs)) return true;
|
|
@@ -2740,7 +2908,7 @@ function isToolInstalled(signal, home, pathEnv) {
|
|
|
2740
2908
|
return false;
|
|
2741
2909
|
}
|
|
2742
2910
|
function detectInstalledTools(opts = {}) {
|
|
2743
|
-
const home = opts.home ??
|
|
2911
|
+
const home = opts.home ?? homedir4();
|
|
2744
2912
|
const pathEnv = opts.pathEnv ?? process.env["PATH"] ?? "";
|
|
2745
2913
|
const out = {};
|
|
2746
2914
|
for (const [id, signal] of Object.entries(TOOL_SIGNALS)) {
|
|
@@ -2791,12 +2959,12 @@ function classifyBilling(provider, source) {
|
|
|
2791
2959
|
function codexHome(env) {
|
|
2792
2960
|
const map = env ?? process.env;
|
|
2793
2961
|
const override = (map["CODEX_HOME"] ?? "").trim();
|
|
2794
|
-
return override !== "" ? override :
|
|
2962
|
+
return override !== "" ? override : path17.join(homeOf(env), ".codex");
|
|
2795
2963
|
}
|
|
2796
2964
|
function homeOf(env) {
|
|
2797
2965
|
const map = env ?? process.env;
|
|
2798
2966
|
const injected = (map["HOME"] ?? "").trim();
|
|
2799
|
-
return injected !== "" ? injected :
|
|
2967
|
+
return injected !== "" ? injected : os2.homedir();
|
|
2800
2968
|
}
|
|
2801
2969
|
var VERSION_PROBE_TIMEOUT_MS = 2e3;
|
|
2802
2970
|
var CLAUDE_KEYCHAIN_SERVICE = "Claude Code-credentials";
|
|
@@ -2832,14 +3000,14 @@ ${res.stderr ?? ""}`;
|
|
|
2832
3000
|
}
|
|
2833
3001
|
function isFile3(p) {
|
|
2834
3002
|
try {
|
|
2835
|
-
return
|
|
3003
|
+
return fs13.statSync(p).isFile();
|
|
2836
3004
|
} catch {
|
|
2837
3005
|
return false;
|
|
2838
3006
|
}
|
|
2839
3007
|
}
|
|
2840
3008
|
function exists(p) {
|
|
2841
3009
|
try {
|
|
2842
|
-
return
|
|
3010
|
+
return fs13.existsSync(p);
|
|
2843
3011
|
} catch {
|
|
2844
3012
|
return false;
|
|
2845
3013
|
}
|
|
@@ -2847,7 +3015,7 @@ function exists(p) {
|
|
|
2847
3015
|
function classifyCodexAuth(authPath) {
|
|
2848
3016
|
let data;
|
|
2849
3017
|
try {
|
|
2850
|
-
data = JSON.parse(
|
|
3018
|
+
data = JSON.parse(fs13.readFileSync(authPath, "utf-8"));
|
|
2851
3019
|
} catch {
|
|
2852
3020
|
return "cli-api-key";
|
|
2853
3021
|
}
|
|
@@ -2864,7 +3032,7 @@ function cliSubscriptionEvidence(provider, home, env, claudeConfigDir, probeKeyc
|
|
|
2864
3032
|
if (provider === "anthropic") {
|
|
2865
3033
|
const configDir = claudeConfigDir;
|
|
2866
3034
|
for (const rel of [".credentials.json", "credentials.json"]) {
|
|
2867
|
-
const p =
|
|
3035
|
+
const p = path17.join(configDir, rel);
|
|
2868
3036
|
if (isFile3(p)) return { source: "cli-subscription", evidence: p };
|
|
2869
3037
|
}
|
|
2870
3038
|
if (probeKeychain(CLAUDE_KEYCHAIN_SERVICE)) {
|
|
@@ -2873,12 +3041,12 @@ function cliSubscriptionEvidence(provider, home, env, claudeConfigDir, probeKeyc
|
|
|
2873
3041
|
return null;
|
|
2874
3042
|
}
|
|
2875
3043
|
if (provider === "openai") {
|
|
2876
|
-
const p =
|
|
3044
|
+
const p = path17.join(codexHome(env), "auth.json");
|
|
2877
3045
|
if (isFile3(p)) return { source: classifyCodexAuth(p), evidence: p };
|
|
2878
3046
|
return null;
|
|
2879
3047
|
}
|
|
2880
3048
|
if (provider === "gemini") {
|
|
2881
|
-
const p =
|
|
3049
|
+
const p = path17.join(home, ".gemini", "oauth_creds.json");
|
|
2882
3050
|
if (isFile3(p)) return { source: "cli-subscription", evidence: p };
|
|
2883
3051
|
return null;
|
|
2884
3052
|
}
|
|
@@ -2910,7 +3078,7 @@ function detectHosts(opts) {
|
|
|
2910
3078
|
function detectAuth(opts) {
|
|
2911
3079
|
const env = opts.env ?? process.env;
|
|
2912
3080
|
const home = opts.home ?? homeOf(opts.env);
|
|
2913
|
-
const claudeConfigDir = opts.home === void 0 && opts.env === void 0 ? claude_config_dir() : (env["CLAUDE_CONFIG_DIR"] ?? "").trim() ||
|
|
3081
|
+
const claudeConfigDir = opts.home === void 0 && opts.env === void 0 ? claude_config_dir() : (env["CLAUDE_CONFIG_DIR"] ?? "").trim() || path17.join(home, ".claude");
|
|
2914
3082
|
const probeKeychain = opts.probeKeychain ?? defaultProbeKeychain;
|
|
2915
3083
|
const auth = [];
|
|
2916
3084
|
const keys = [];
|
|
@@ -2965,7 +3133,7 @@ function detectEnvironment(opts = {}) {
|
|
|
2965
3133
|
}
|
|
2966
3134
|
|
|
2967
3135
|
// src/scripts/_cli/detection_report.ts
|
|
2968
|
-
import * as
|
|
3136
|
+
import * as path18 from "node:path";
|
|
2969
3137
|
|
|
2970
3138
|
// src/scripts/ai_council/transport_resolver.ts
|
|
2971
3139
|
var VALID_TRANSPORT_MODES = /* @__PURE__ */ new Set([
|
|
@@ -3167,7 +3335,7 @@ function cliBinaryPresent(environment, provider, binaryOverride) {
|
|
|
3167
3335
|
const expected = PROVIDER_CLI_META[provider]?.[0];
|
|
3168
3336
|
if (expected === void 0) return false;
|
|
3169
3337
|
return environment.hosts.some(
|
|
3170
|
-
(h) => h.binary !== null && stripExe(
|
|
3338
|
+
(h) => h.binary !== null && stripExe(path18.basename(h.binary)) === expected
|
|
3171
3339
|
);
|
|
3172
3340
|
}
|
|
3173
3341
|
function stripExe(name) {
|
|
@@ -3328,9 +3496,9 @@ function absentCouncilFacts(configPath) {
|
|
|
3328
3496
|
|
|
3329
3497
|
// src/scripts/ai_team/review_gate.ts
|
|
3330
3498
|
import * as crypto from "node:crypto";
|
|
3331
|
-
import * as
|
|
3332
|
-
import * as
|
|
3333
|
-
import * as
|
|
3499
|
+
import * as fs14 from "node:fs";
|
|
3500
|
+
import * as os3 from "node:os";
|
|
3501
|
+
import * as path19 from "node:path";
|
|
3334
3502
|
|
|
3335
3503
|
// src/scripts/ai_team/config.ts
|
|
3336
3504
|
var AI_TEAM_REVIEW_GATE_DEFAULTS = Object.freeze({
|
|
@@ -3346,16 +3514,16 @@ var AI_TEAM_DEFAULTS = Object.freeze({
|
|
|
3346
3514
|
});
|
|
3347
3515
|
|
|
3348
3516
|
// src/scripts/ai_team/review_gate.ts
|
|
3349
|
-
var GATE_LEDGER_RELPATH =
|
|
3517
|
+
var GATE_LEDGER_RELPATH = path19.join("agents", "runtime", "team", "events.log");
|
|
3350
3518
|
var _CODEX_PLUGIN_DATA_DIRNAME = `${CODEX_PLUGIN_ID}-${CODEX_MARKETPLACE_NAME}`;
|
|
3351
3519
|
function _workspace_state_segment(workspace_root) {
|
|
3352
3520
|
let canonical = workspace_root;
|
|
3353
3521
|
try {
|
|
3354
|
-
canonical =
|
|
3522
|
+
canonical = fs14.realpathSync.native(workspace_root);
|
|
3355
3523
|
} catch {
|
|
3356
3524
|
canonical = workspace_root;
|
|
3357
3525
|
}
|
|
3358
|
-
const slug_source =
|
|
3526
|
+
const slug_source = path19.basename(workspace_root) || "workspace";
|
|
3359
3527
|
const slug = slug_source.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "workspace";
|
|
3360
3528
|
const hash = crypto.createHash("sha256").update(canonical).digest("hex").slice(0, 16);
|
|
3361
3529
|
return `${slug}-${hash}`;
|
|
@@ -3365,19 +3533,19 @@ function upstream_state_dir_candidates(workspace_root) {
|
|
|
3365
3533
|
const candidates = [];
|
|
3366
3534
|
const env = (process.env["CLAUDE_PLUGIN_DATA"] ?? "").trim();
|
|
3367
3535
|
if (env !== "") {
|
|
3368
|
-
candidates.push(
|
|
3536
|
+
candidates.push(path19.join(env, "state", segment));
|
|
3369
3537
|
}
|
|
3370
3538
|
candidates.push(
|
|
3371
|
-
|
|
3539
|
+
path19.join(claude_config_dir(), "plugins", "data", _CODEX_PLUGIN_DATA_DIRNAME, "state", segment)
|
|
3372
3540
|
);
|
|
3373
|
-
candidates.push(
|
|
3541
|
+
candidates.push(path19.join(os3.tmpdir(), "codex-companion", segment));
|
|
3374
3542
|
return candidates;
|
|
3375
3543
|
}
|
|
3376
3544
|
function upstream_gate_enabled(workspace_root) {
|
|
3377
3545
|
for (const dir of upstream_state_dir_candidates(workspace_root)) {
|
|
3378
3546
|
let parsed;
|
|
3379
3547
|
try {
|
|
3380
|
-
parsed = JSON.parse(
|
|
3548
|
+
parsed = JSON.parse(fs14.readFileSync(path19.join(dir, "state.json"), "utf-8"));
|
|
3381
3549
|
} catch {
|
|
3382
3550
|
continue;
|
|
3383
3551
|
}
|
|
@@ -3532,15 +3700,15 @@ var ArgparseExit = class extends Error {
|
|
|
3532
3700
|
code;
|
|
3533
3701
|
};
|
|
3534
3702
|
function expanduser(p) {
|
|
3535
|
-
if (p === "~") return
|
|
3703
|
+
if (p === "~") return os4.homedir();
|
|
3536
3704
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
3537
|
-
return
|
|
3705
|
+
return path20.join(os4.homedir(), p.slice(2));
|
|
3538
3706
|
}
|
|
3539
3707
|
return p;
|
|
3540
3708
|
}
|
|
3541
3709
|
function pathExists(p) {
|
|
3542
3710
|
try {
|
|
3543
|
-
|
|
3711
|
+
fs15.statSync(p);
|
|
3544
3712
|
return true;
|
|
3545
3713
|
} catch {
|
|
3546
3714
|
return false;
|
|
@@ -3548,27 +3716,27 @@ function pathExists(p) {
|
|
|
3548
3716
|
}
|
|
3549
3717
|
function isFile4(p) {
|
|
3550
3718
|
try {
|
|
3551
|
-
return
|
|
3719
|
+
return fs15.statSync(p).isFile();
|
|
3552
3720
|
} catch {
|
|
3553
3721
|
return false;
|
|
3554
3722
|
}
|
|
3555
3723
|
}
|
|
3556
3724
|
function isDir3(p) {
|
|
3557
3725
|
try {
|
|
3558
|
-
return
|
|
3726
|
+
return fs15.statSync(p).isDirectory();
|
|
3559
3727
|
} catch {
|
|
3560
3728
|
return false;
|
|
3561
3729
|
}
|
|
3562
3730
|
}
|
|
3563
3731
|
function resolvePath(p) {
|
|
3564
3732
|
try {
|
|
3565
|
-
return
|
|
3733
|
+
return fs15.realpathSync(path20.resolve(p));
|
|
3566
3734
|
} catch {
|
|
3567
|
-
return
|
|
3735
|
+
return path20.resolve(p);
|
|
3568
3736
|
}
|
|
3569
3737
|
}
|
|
3570
3738
|
function readText(p) {
|
|
3571
|
-
return
|
|
3739
|
+
return fs15.readFileSync(p, "utf-8");
|
|
3572
3740
|
}
|
|
3573
3741
|
function _jsonStrAscii(s) {
|
|
3574
3742
|
let out = '"';
|
|
@@ -3679,7 +3847,7 @@ function _resolve_project_root(arg) {
|
|
|
3679
3847
|
}
|
|
3680
3848
|
var _INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
3681
3849
|
function _detect_install_mode(project_root) {
|
|
3682
|
-
const marker =
|
|
3850
|
+
const marker = path20.join(project_root, _INSTALL_MODE_MARKER_REL);
|
|
3683
3851
|
if (isFile4(marker)) {
|
|
3684
3852
|
let value;
|
|
3685
3853
|
try {
|
|
@@ -3691,9 +3859,9 @@ function _detect_install_mode(project_root) {
|
|
|
3691
3859
|
return [value, "marker-file"];
|
|
3692
3860
|
}
|
|
3693
3861
|
}
|
|
3694
|
-
const has_agents_md = pathExists(
|
|
3862
|
+
const has_agents_md = pathExists(path20.join(project_root, "AGENTS.md"));
|
|
3695
3863
|
const has_copilot = pathExists(
|
|
3696
|
-
|
|
3864
|
+
path20.join(project_root, ".github", "copilot-instructions.md")
|
|
3697
3865
|
);
|
|
3698
3866
|
if (has_agents_md && has_copilot) {
|
|
3699
3867
|
return ["full", "heuristic"];
|
|
@@ -3713,7 +3881,7 @@ function _settings_layer_chain(project_root) {
|
|
|
3713
3881
|
return layers;
|
|
3714
3882
|
}
|
|
3715
3883
|
function _detect_wrapper(project_root) {
|
|
3716
|
-
const wrapper =
|
|
3884
|
+
const wrapper = path20.join(project_root, "agent-config");
|
|
3717
3885
|
if (!pathExists(wrapper)) {
|
|
3718
3886
|
return { path: String(wrapper), exists: false, embedded_root: null };
|
|
3719
3887
|
}
|
|
@@ -3780,14 +3948,14 @@ function _emit_context_text(ctx) {
|
|
|
3780
3948
|
}
|
|
3781
3949
|
function _resolve_path(project_root, raw) {
|
|
3782
3950
|
let p = expanduser(raw);
|
|
3783
|
-
if (!
|
|
3784
|
-
p =
|
|
3951
|
+
if (!path20.isAbsolute(p)) {
|
|
3952
|
+
p = path20.join(project_root, p);
|
|
3785
3953
|
}
|
|
3786
3954
|
return p;
|
|
3787
3955
|
}
|
|
3788
3956
|
function _sha256(p) {
|
|
3789
3957
|
try {
|
|
3790
|
-
const data =
|
|
3958
|
+
const data = fs15.readFileSync(p);
|
|
3791
3959
|
return crypto2.createHash("sha256").update(data).digest("hex");
|
|
3792
3960
|
} catch {
|
|
3793
3961
|
return null;
|
|
@@ -3796,7 +3964,7 @@ function _sha256(p) {
|
|
|
3796
3964
|
var PACKAGE_TAG_ID2 = "event4u/agent-config";
|
|
3797
3965
|
var _FRONTMATTER_PACKAGE_RE = /^package:\s*(.+?)\s*$/m;
|
|
3798
3966
|
function _read_inline_package_tag(p) {
|
|
3799
|
-
if (
|
|
3967
|
+
if (path20.extname(p) !== ".md") {
|
|
3800
3968
|
return NO_FRONTMATTER;
|
|
3801
3969
|
}
|
|
3802
3970
|
let text;
|
|
@@ -3925,13 +4093,13 @@ function rglob(root) {
|
|
|
3925
4093
|
const walk = (dir) => {
|
|
3926
4094
|
let entries;
|
|
3927
4095
|
try {
|
|
3928
|
-
entries =
|
|
4096
|
+
entries = fs15.readdirSync(dir, { withFileTypes: true });
|
|
3929
4097
|
} catch {
|
|
3930
4098
|
return;
|
|
3931
4099
|
}
|
|
3932
4100
|
entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
3933
4101
|
for (const ent of entries) {
|
|
3934
|
-
const full =
|
|
4102
|
+
const full = path20.join(dir, ent.name);
|
|
3935
4103
|
out.push(full);
|
|
3936
4104
|
let dirLike = ent.isDirectory();
|
|
3937
4105
|
if (ent.isSymbolicLink()) {
|
|
@@ -4006,9 +4174,9 @@ function _foreign_records(project_root, foreign) {
|
|
|
4006
4174
|
return out;
|
|
4007
4175
|
}
|
|
4008
4176
|
function relativeTo(p, base) {
|
|
4009
|
-
const rel =
|
|
4177
|
+
const rel = path20.relative(base, p);
|
|
4010
4178
|
if (rel === "") return rel;
|
|
4011
|
-
if (rel.startsWith("..") ||
|
|
4179
|
+
if (rel.startsWith("..") || path20.isAbsolute(rel)) {
|
|
4012
4180
|
return null;
|
|
4013
4181
|
}
|
|
4014
4182
|
return rel;
|
|
@@ -4094,7 +4262,7 @@ var STATUS_SYMBOLS = {
|
|
|
4094
4262
|
var MIN_PYTHON = [3, 10];
|
|
4095
4263
|
function _check_scope(project_root) {
|
|
4096
4264
|
for (const marker of ["pnpm-workspace.yaml", "lerna.json"]) {
|
|
4097
|
-
if (pathExists(
|
|
4265
|
+
if (pathExists(path20.join(project_root, marker))) {
|
|
4098
4266
|
return {
|
|
4099
4267
|
id: "scope",
|
|
4100
4268
|
status: "warn",
|
|
@@ -4103,7 +4271,7 @@ function _check_scope(project_root) {
|
|
|
4103
4271
|
};
|
|
4104
4272
|
}
|
|
4105
4273
|
}
|
|
4106
|
-
const pkg =
|
|
4274
|
+
const pkg = path20.join(project_root, "package.json");
|
|
4107
4275
|
if (pathExists(pkg)) {
|
|
4108
4276
|
try {
|
|
4109
4277
|
const data = JSON.parse(readText(pkg));
|
|
@@ -4129,7 +4297,7 @@ var _PLACEHOLDER_EMAIL_RE = /^(t@t\.t|.*@example\.(com|org)|.*@localhost)$/i;
|
|
|
4129
4297
|
var _PLACEHOLDER_NAME_RE = /^(t|test|user|nobody|x)$/i;
|
|
4130
4298
|
function _git_config_path(project_root) {
|
|
4131
4299
|
const common = git_common_dir(project_root);
|
|
4132
|
-
return common === null ? null :
|
|
4300
|
+
return common === null ? null : path20.join(common, "config");
|
|
4133
4301
|
}
|
|
4134
4302
|
function _parse_git_user(configText) {
|
|
4135
4303
|
let inUser = false;
|
|
@@ -4159,7 +4327,7 @@ function _check_git_identity(project_root) {
|
|
|
4159
4327
|
}
|
|
4160
4328
|
let ident = _parse_git_user(readText(cfgPath));
|
|
4161
4329
|
if (ident.name === null && ident.email === null) {
|
|
4162
|
-
const globalCfg =
|
|
4330
|
+
const globalCfg = path20.join(os4.homedir(), ".gitconfig");
|
|
4163
4331
|
if (pathExists(globalCfg)) {
|
|
4164
4332
|
ident = _parse_git_user(readText(globalCfg));
|
|
4165
4333
|
}
|
|
@@ -4220,7 +4388,7 @@ function _package_root() {
|
|
|
4220
4388
|
}
|
|
4221
4389
|
function _current_package_version() {
|
|
4222
4390
|
try {
|
|
4223
|
-
const data = JSON.parse(readText(
|
|
4391
|
+
const data = JSON.parse(readText(path20.join(_package_root(), "package.json")));
|
|
4224
4392
|
const v = data["version"];
|
|
4225
4393
|
if (typeof v === "string" && v.trim()) {
|
|
4226
4394
|
return v.trim();
|
|
@@ -4264,7 +4432,7 @@ function _check_lockfile_freshness(manifest) {
|
|
|
4264
4432
|
};
|
|
4265
4433
|
}
|
|
4266
4434
|
function shutilWhich(name) {
|
|
4267
|
-
if (
|
|
4435
|
+
if (path20.dirname(name) !== "." && (name.includes("/") || name.includes("\\"))) {
|
|
4268
4436
|
return isExecutableFile(name) ? name : null;
|
|
4269
4437
|
}
|
|
4270
4438
|
const pathEnv = process3.env["PATH"] || "";
|
|
@@ -4277,12 +4445,12 @@ function shutilWhich(name) {
|
|
|
4277
4445
|
if (seenDirs.has(d)) continue;
|
|
4278
4446
|
seenDirs.add(d);
|
|
4279
4447
|
for (const ext of exts) {
|
|
4280
|
-
const candidate =
|
|
4448
|
+
const candidate = path20.join(d, name + (ext === "" ? "" : ext.toLowerCase() === ext ? ext : ext));
|
|
4281
4449
|
if (isExecutableFile(candidate)) {
|
|
4282
4450
|
return candidate;
|
|
4283
4451
|
}
|
|
4284
4452
|
if (ext !== "") {
|
|
4285
|
-
const upper =
|
|
4453
|
+
const upper = path20.join(d, name + ext);
|
|
4286
4454
|
if (isExecutableFile(upper)) return upper;
|
|
4287
4455
|
}
|
|
4288
4456
|
}
|
|
@@ -4291,10 +4459,10 @@ function shutilWhich(name) {
|
|
|
4291
4459
|
}
|
|
4292
4460
|
function isExecutableFile(p) {
|
|
4293
4461
|
try {
|
|
4294
|
-
const st =
|
|
4462
|
+
const st = fs15.statSync(p);
|
|
4295
4463
|
if (!st.isFile()) return false;
|
|
4296
4464
|
if (process3.platform === "win32") return true;
|
|
4297
|
-
|
|
4465
|
+
fs15.accessSync(p, fs15.constants.X_OK);
|
|
4298
4466
|
return true;
|
|
4299
4467
|
} catch {
|
|
4300
4468
|
return false;
|
|
@@ -4358,7 +4526,7 @@ function _check_claude_plugin() {
|
|
|
4358
4526
|
remedy: ""
|
|
4359
4527
|
};
|
|
4360
4528
|
}
|
|
4361
|
-
const projection =
|
|
4529
|
+
const projection = path20.join(os4.homedir(), ".claude", "skills");
|
|
4362
4530
|
const projection_present = isDir3(projection);
|
|
4363
4531
|
if (projection_present) {
|
|
4364
4532
|
return {
|
|
@@ -4395,8 +4563,8 @@ function _check_claude_command_wrappers() {
|
|
|
4395
4563
|
remedy: ""
|
|
4396
4564
|
};
|
|
4397
4565
|
}
|
|
4398
|
-
const anchor =
|
|
4399
|
-
const commands_dir =
|
|
4566
|
+
const anchor = path20.join(os4.homedir(), ".claude");
|
|
4567
|
+
const commands_dir = path20.join(anchor, "commands");
|
|
4400
4568
|
if (!isDir3(commands_dir)) {
|
|
4401
4569
|
return {
|
|
4402
4570
|
id: "claude-command-wrappers",
|
|
@@ -4405,8 +4573,8 @@ function _check_claude_command_wrappers() {
|
|
|
4405
4573
|
remedy: ""
|
|
4406
4574
|
};
|
|
4407
4575
|
}
|
|
4408
|
-
const flat_probe =
|
|
4409
|
-
const wrapper_probe =
|
|
4576
|
+
const flat_probe = fs15.existsSync(path20.join(commands_dir, "commit.md"));
|
|
4577
|
+
const wrapper_probe = fs15.existsSync(path20.join(anchor, "skills", "commit", "SKILL.md"));
|
|
4410
4578
|
if (wrapper_probe) {
|
|
4411
4579
|
return {
|
|
4412
4580
|
id: "claude-command-wrappers",
|
|
@@ -4431,7 +4599,7 @@ function _check_claude_command_wrappers() {
|
|
|
4431
4599
|
};
|
|
4432
4600
|
}
|
|
4433
4601
|
function _check_surface_state() {
|
|
4434
|
-
const matrix_path =
|
|
4602
|
+
const matrix_path = path20.join(_package_root(), "src", "config", "surface-matrix.yml");
|
|
4435
4603
|
if (!isFile4(matrix_path)) {
|
|
4436
4604
|
return {
|
|
4437
4605
|
id: "surface-state",
|
|
@@ -4455,7 +4623,7 @@ function _check_surface_state() {
|
|
|
4455
4623
|
remedy: "agent-config upgrade (reinstalls the package data files)"
|
|
4456
4624
|
};
|
|
4457
4625
|
}
|
|
4458
|
-
const _expand = (p) => p.startsWith("~/") ?
|
|
4626
|
+
const _expand = (p) => p.startsWith("~/") ? path20.join(os4.homedir(), p.slice(2)) : path20.join(_package_root(), p);
|
|
4459
4627
|
const violations = [];
|
|
4460
4628
|
const remedies = [];
|
|
4461
4629
|
let checked = 0;
|
|
@@ -4497,7 +4665,7 @@ function _check_surface_state() {
|
|
|
4497
4665
|
}
|
|
4498
4666
|
function pathExistsAny(p) {
|
|
4499
4667
|
try {
|
|
4500
|
-
|
|
4668
|
+
fs15.statSync(p);
|
|
4501
4669
|
return true;
|
|
4502
4670
|
} catch {
|
|
4503
4671
|
return false;
|
|
@@ -4507,7 +4675,7 @@ function _check_hook_wiring() {
|
|
|
4507
4675
|
return checkHookWiring({
|
|
4508
4676
|
which: shutilWhich,
|
|
4509
4677
|
packageRoot: _package_root(),
|
|
4510
|
-
homeDir:
|
|
4678
|
+
homeDir: os4.homedir(),
|
|
4511
4679
|
buildMatrix: (mp) => build_claude_hook_matrix(mp),
|
|
4512
4680
|
managedSignature: MANAGED_SIGNATURE,
|
|
4513
4681
|
pluginInstalled: () => claude_plugin_installed()
|
|
@@ -4543,7 +4711,7 @@ function _check_mcp_mode(project_root) {
|
|
|
4543
4711
|
];
|
|
4544
4712
|
const found = [];
|
|
4545
4713
|
for (const [rel, label] of candidates) {
|
|
4546
|
-
const p =
|
|
4714
|
+
const p = path20.join(project_root, rel);
|
|
4547
4715
|
if (!pathExists(p)) {
|
|
4548
4716
|
continue;
|
|
4549
4717
|
}
|
|
@@ -4575,7 +4743,7 @@ function _check_mcp_mode(project_root) {
|
|
|
4575
4743
|
};
|
|
4576
4744
|
}
|
|
4577
4745
|
function _check_offline_readiness() {
|
|
4578
|
-
const script =
|
|
4746
|
+
const script = path20.join(_package_root(), "src", "scripts", "hermetic-install.sh");
|
|
4579
4747
|
if (!pathExists(script)) {
|
|
4580
4748
|
return {
|
|
4581
4749
|
id: "offline-readiness",
|
|
@@ -4633,7 +4801,7 @@ function _check_stale_orphans() {
|
|
|
4633
4801
|
(a, b) => a < b ? -1 : a > b ? 1 : 0
|
|
4634
4802
|
);
|
|
4635
4803
|
for (const root_name of ownedSorted) {
|
|
4636
|
-
const root =
|
|
4804
|
+
const root = path20.join(anchor, root_name);
|
|
4637
4805
|
if (!isDir3(root)) {
|
|
4638
4806
|
continue;
|
|
4639
4807
|
}
|
|
@@ -4648,7 +4816,7 @@ function _check_stale_orphans() {
|
|
|
4648
4816
|
if (rel === null) {
|
|
4649
4817
|
continue;
|
|
4650
4818
|
}
|
|
4651
|
-
const relPosix = rel.split(
|
|
4819
|
+
const relPosix = rel.split(path20.sep).join("/");
|
|
4652
4820
|
if (recorded_set.has(relPosix)) {
|
|
4653
4821
|
continue;
|
|
4654
4822
|
}
|
|
@@ -4703,14 +4871,14 @@ function _check_rule_scope_drift(project_root) {
|
|
|
4703
4871
|
let rules_dir = null;
|
|
4704
4872
|
let found = 0;
|
|
4705
4873
|
for (const rel of _RULE_PROJECTION_DIRS) {
|
|
4706
|
-
const cand =
|
|
4874
|
+
const cand = path20.join(project_root, rel);
|
|
4707
4875
|
if (!isDir3(cand)) {
|
|
4708
4876
|
continue;
|
|
4709
4877
|
}
|
|
4710
4878
|
let count = 0;
|
|
4711
4879
|
try {
|
|
4712
|
-
for (const name of
|
|
4713
|
-
if (name.endsWith(".md") && isFile4(
|
|
4880
|
+
for (const name of fs15.readdirSync(cand)) {
|
|
4881
|
+
if (name.endsWith(".md") && isFile4(path20.join(cand, name))) {
|
|
4714
4882
|
count += 1;
|
|
4715
4883
|
}
|
|
4716
4884
|
}
|
|
@@ -4764,14 +4932,14 @@ function _check_rule_scope_drift(project_root) {
|
|
|
4764
4932
|
};
|
|
4765
4933
|
}
|
|
4766
4934
|
function _check_duplicate_scope_rules(project_root, userRulesDirOverride) {
|
|
4767
|
-
const user_rules_dir = userRulesDirOverride ??
|
|
4935
|
+
const user_rules_dir = userRulesDirOverride ?? path20.join(os4.homedir(), ".claude", "rules");
|
|
4768
4936
|
let project_rules_dir = null;
|
|
4769
4937
|
if (_is_source_repo(project_root)) {
|
|
4770
|
-
const cand =
|
|
4938
|
+
const cand = path20.join(project_root, "dist", "agent-src", "rules");
|
|
4771
4939
|
if (isDir3(cand)) project_rules_dir = cand;
|
|
4772
4940
|
} else {
|
|
4773
4941
|
for (const rel of _RULE_PROJECTION_DIRS) {
|
|
4774
|
-
const cand =
|
|
4942
|
+
const cand = path20.join(project_root, rel);
|
|
4775
4943
|
if (isDir3(cand)) {
|
|
4776
4944
|
project_rules_dir = cand;
|
|
4777
4945
|
break;
|
|
@@ -4817,7 +4985,7 @@ function _check_mcp_beta_readiness(project_root) {
|
|
|
4817
4985
|
}
|
|
4818
4986
|
const pending = [];
|
|
4819
4987
|
for (const [gate_id, rel] of MCP_BETA_GATES) {
|
|
4820
|
-
if (!pathExists(
|
|
4988
|
+
if (!pathExists(path20.join(project_root, rel))) {
|
|
4821
4989
|
pending.push(`${gate_id} (${rel})`);
|
|
4822
4990
|
}
|
|
4823
4991
|
}
|
|
@@ -4838,7 +5006,7 @@ function _check_mcp_beta_readiness(project_root) {
|
|
|
4838
5006
|
}
|
|
4839
5007
|
function _check_tier_usage_readiness(project_root) {
|
|
4840
5008
|
const settings_file = project_settings_path(project_root);
|
|
4841
|
-
let log_path =
|
|
5009
|
+
let log_path = path20.join(project_root, ".agent-tier-usage.jsonl");
|
|
4842
5010
|
let enabled = false;
|
|
4843
5011
|
if (isFile4(settings_file)) {
|
|
4844
5012
|
let raw;
|
|
@@ -4857,7 +5025,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
4857
5025
|
const outputRaw = tu["output"];
|
|
4858
5026
|
const output = typeof outputRaw === "object" && outputRaw !== null && !Array.isArray(outputRaw) ? outputRaw : {};
|
|
4859
5027
|
if (typeof output["path"] === "string" && output["path"].trim()) {
|
|
4860
|
-
log_path =
|
|
5028
|
+
log_path = path20.join(project_root, output["path"].trim());
|
|
4861
5029
|
}
|
|
4862
5030
|
const val = tu["enabled"];
|
|
4863
5031
|
if (typeof val === "boolean") {
|
|
@@ -4882,7 +5050,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
4882
5050
|
return {
|
|
4883
5051
|
id: "tier-usage-readiness",
|
|
4884
5052
|
status: "warn",
|
|
4885
|
-
message: `tier-usage telemetry on but ${
|
|
5053
|
+
message: `tier-usage telemetry on but ${path20.basename(log_path)} not yet written \u2014 no signal accumulated`,
|
|
4886
5054
|
remedy: "run any tracked command to seed the log; the dispatcher writes one record per invocation"
|
|
4887
5055
|
};
|
|
4888
5056
|
}
|
|
@@ -4897,7 +5065,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
4897
5065
|
return {
|
|
4898
5066
|
id: "tier-usage-readiness",
|
|
4899
5067
|
status: "fail",
|
|
4900
|
-
message: `cannot read ${
|
|
5068
|
+
message: `cannot read ${path20.basename(log_path)}: ${osErrorStr(exc)}`,
|
|
4901
5069
|
remedy: "fix permissions on the tier-usage log"
|
|
4902
5070
|
};
|
|
4903
5071
|
}
|
|
@@ -4928,7 +5096,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
4928
5096
|
return {
|
|
4929
5097
|
id: "tier-usage-readiness",
|
|
4930
5098
|
status: "fail",
|
|
4931
|
-
message: `${total} record(s) in ${
|
|
5099
|
+
message: `${total} record(s) in ${path20.basename(log_path)} but 0 passed the privacy floor \u2014 report would refuse to render`,
|
|
4932
5100
|
remedy: "inspect the log; the dispatcher is writing records the contract forbids (paths, argv, message bodies)"
|
|
4933
5101
|
};
|
|
4934
5102
|
}
|
|
@@ -4936,19 +5104,19 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
4936
5104
|
return {
|
|
4937
5105
|
id: "tier-usage-readiness",
|
|
4938
5106
|
status: "warn",
|
|
4939
|
-
message: `${
|
|
5107
|
+
message: `${path20.basename(log_path)} present but empty \u2014 no signal yet`,
|
|
4940
5108
|
remedy: "run any tracked command to seed the log"
|
|
4941
5109
|
};
|
|
4942
5110
|
}
|
|
4943
5111
|
return {
|
|
4944
5112
|
id: "tier-usage-readiness",
|
|
4945
5113
|
status: "ok",
|
|
4946
|
-
message: `${valid} record(s) past the privacy floor in ${
|
|
5114
|
+
message: `${valid} record(s) past the privacy floor in ${path20.basename(log_path)} \u2014 retiering signal available`,
|
|
4947
5115
|
remedy: ""
|
|
4948
5116
|
};
|
|
4949
5117
|
}
|
|
4950
5118
|
function readText0(p) {
|
|
4951
|
-
return
|
|
5119
|
+
return fs15.readFileSync(p, "utf-8");
|
|
4952
5120
|
}
|
|
4953
5121
|
function osErrorStr(exc) {
|
|
4954
5122
|
if (exc && typeof exc === "object" && "message" in exc) {
|
|
@@ -5121,7 +5289,7 @@ function _epoch_seconds(value) {
|
|
|
5121
5289
|
function _codex_auth_expiry(auth_path) {
|
|
5122
5290
|
let data;
|
|
5123
5291
|
try {
|
|
5124
|
-
data = JSON.parse(
|
|
5292
|
+
data = JSON.parse(fs15.readFileSync(auth_path, "utf-8"));
|
|
5125
5293
|
} catch {
|
|
5126
5294
|
return null;
|
|
5127
5295
|
}
|
|
@@ -5267,7 +5435,7 @@ function _check_team(project_root) {
|
|
|
5267
5435
|
if (binary_missing) {
|
|
5268
5436
|
remedies.push("install the codex CLI: `npm install -g @openai/codex`");
|
|
5269
5437
|
}
|
|
5270
|
-
const auth_path =
|
|
5438
|
+
const auth_path = path20.join(_codex_home(), "auth.json");
|
|
5271
5439
|
const authed = pathExists(auth_path);
|
|
5272
5440
|
let auth_str;
|
|
5273
5441
|
if (!authed) {
|
|
@@ -5355,7 +5523,7 @@ function _check_unsupported_combos(manifest) {
|
|
|
5355
5523
|
};
|
|
5356
5524
|
}
|
|
5357
5525
|
function _wizard_state_path() {
|
|
5358
|
-
return
|
|
5526
|
+
return path20.join(event4u_root(), "state", "wizard-state.json");
|
|
5359
5527
|
}
|
|
5360
5528
|
function _check_wizard_state() {
|
|
5361
5529
|
const state_pth = _wizard_state_path();
|
|
@@ -5435,7 +5603,7 @@ function _check_wizard_state() {
|
|
|
5435
5603
|
};
|
|
5436
5604
|
}
|
|
5437
5605
|
function _check_settings_review_pending() {
|
|
5438
|
-
const delta_pth =
|
|
5606
|
+
const delta_pth = path20.join(event4u_root(), "state", "settings-delta.json");
|
|
5439
5607
|
if (!pathExists(delta_pth)) {
|
|
5440
5608
|
return {
|
|
5441
5609
|
id: "settings-review-pending",
|
|
@@ -5461,7 +5629,7 @@ function _check_settings_review_pending() {
|
|
|
5461
5629
|
}
|
|
5462
5630
|
function _check_memory_merge_union(project_root) {
|
|
5463
5631
|
const remedy = "run: npx tsx src/scripts/sync_gitattributes.ts (or `agent-config refresh --project`)";
|
|
5464
|
-
const target =
|
|
5632
|
+
const target = path20.join(project_root, DEFAULT_GITATTRIBUTES);
|
|
5465
5633
|
if (!pathExists(target)) {
|
|
5466
5634
|
return {
|
|
5467
5635
|
id: "memory-merge-union",
|
|
@@ -5578,7 +5746,7 @@ function _run_checks(project_root, manifest, drift, only = null) {
|
|
|
5578
5746
|
"claude-command-wrappers": _check_claude_command_wrappers,
|
|
5579
5747
|
"surface-state": _check_surface_state,
|
|
5580
5748
|
"hook-wiring": _check_hook_wiring,
|
|
5581
|
-
...wiringRunners({ packageRoot: _package_root(), iterOverrides: () => iter_setting_overrides({ cwd: project_root }) }),
|
|
5749
|
+
...wiringRunners({ packageRoot: _package_root(), projectRoot: project_root, iterOverrides: () => iter_setting_overrides({ cwd: project_root }) }),
|
|
5582
5750
|
...reachRunners({ projectRoot: project_root, resolvableVersion: _current_package_version() }),
|
|
5583
5751
|
"stale-orphans": _check_stale_orphans,
|
|
5584
5752
|
overrides: () => _check_overrides(project_root),
|
|
@@ -5648,7 +5816,7 @@ function _run_checks_no_manifest(project_root, bridge_present, only = null) {
|
|
|
5648
5816
|
"claude-command-wrappers": _check_claude_command_wrappers,
|
|
5649
5817
|
"surface-state": _check_surface_state,
|
|
5650
5818
|
"hook-wiring": _check_hook_wiring,
|
|
5651
|
-
...wiringRunners({ packageRoot: _package_root(), iterOverrides: () => iter_setting_overrides({ cwd: project_root }) }),
|
|
5819
|
+
...wiringRunners({ packageRoot: _package_root(), projectRoot: project_root, iterOverrides: () => iter_setting_overrides({ cwd: project_root }) }),
|
|
5652
5820
|
...reachRunners({ projectRoot: project_root, resolvableVersion: _current_package_version() }),
|
|
5653
5821
|
"stale-orphans": _check_stale_orphans,
|
|
5654
5822
|
// BOTH registries need the id. Registering only the first one crashed with
|
|
@@ -5926,7 +6094,7 @@ function _run_anatomy(opts) {
|
|
|
5926
6094
|
try {
|
|
5927
6095
|
economyReport = economy.buildReport({
|
|
5928
6096
|
root: economy.DEFAULT_PROJECTS_ROOT,
|
|
5929
|
-
auditDir:
|
|
6097
|
+
auditDir: path20.join(process3.cwd(), economy.DEFAULT_AUDIT_DIR),
|
|
5930
6098
|
maxAgeDays: 14
|
|
5931
6099
|
});
|
|
5932
6100
|
} catch (err) {
|
|
@@ -5965,7 +6133,7 @@ function _run_repair(opts) {
|
|
|
5965
6133
|
};
|
|
5966
6134
|
if (exists2) {
|
|
5967
6135
|
try {
|
|
5968
|
-
|
|
6136
|
+
fs15.unlinkSync(state_pth);
|
|
5969
6137
|
} catch (exc) {
|
|
5970
6138
|
payload["action"] = "error";
|
|
5971
6139
|
payload["error"] = osErrorStr(exc);
|
|
@@ -6072,17 +6240,17 @@ function _isCliEntry2() {
|
|
|
6072
6240
|
return false;
|
|
6073
6241
|
}
|
|
6074
6242
|
if (cliDelegate) {
|
|
6075
|
-
if (
|
|
6243
|
+
if (path20.basename(process3.argv[1], ".js") === "cmd_doctor") {
|
|
6076
6244
|
return true;
|
|
6077
6245
|
}
|
|
6078
6246
|
}
|
|
6079
|
-
const argvUrl = pathToFileURL6(
|
|
6247
|
+
const argvUrl = pathToFileURL6(path20.resolve(process3.argv[1])).href;
|
|
6080
6248
|
if (import.meta.url === argvUrl) {
|
|
6081
6249
|
return true;
|
|
6082
6250
|
}
|
|
6083
6251
|
try {
|
|
6084
|
-
const here =
|
|
6085
|
-
const argv =
|
|
6252
|
+
const here = fs15.realpathSync(fileURLToPath5(import.meta.url));
|
|
6253
|
+
const argv = fs15.realpathSync(path20.resolve(process3.argv[1]));
|
|
6086
6254
|
return here === argv;
|
|
6087
6255
|
} catch {
|
|
6088
6256
|
return false;
|