@event4u/agent-config 16.1.0 → 16.2.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 +237 -248
- package/dist/agent-src/commands/roadmap/process-full.md +1 -1
- package/dist/agent-src/commands/work.md +4 -0
- package/dist/agent-src/contexts/execution/autonomy-mechanics.md +4 -8
- package/dist/agent-src/rules/ui-audit-gate.md +1 -2
- package/dist/agent-src/skills/accessibility-auditor/data/aria-patterns.csv +1 -1
- package/dist/agent-src/skills/accessibility-auditor/data/manifest.json +2 -2
- package/dist/agent-src/skills/design-review/SKILL.md +30 -4
- package/dist/agent-src/skills/design-review/references/verification-automation.md +32 -0
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +16 -1
- package/dist/agent-src/skills/existing-ui-audit/references/component-taxonomy-detection.md +56 -0
- package/dist/agent-src/skills/markitdown/SKILL.md +4 -0
- package/dist/agent-src/skills/playwright-testing/SKILL.md +30 -6
- package/dist/agent-src/skills/ui-component-architect/SKILL.md +23 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +30 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/app_spec.ts +10 -4
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +260 -21
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/audit.ts +22 -3
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/scaffold.ts +6 -1
- package/dist/agent-src/templates/scripts/work_engine/state.ts +57 -7
- package/dist/agent-src/templates/scripts/work_engine/taxonomy/detect.ts +500 -0
- package/dist/agent-src/templates/scripts/work_engine/taxonomy/place.ts +183 -0
- package/dist/cli/python/knowledge_ingest.js +1 -1
- package/dist/cli/python/workspace_drive.js +1 -1
- package/dist/cli-delegate/{chunk-S3VFXMTM.js → chunk-4XFP2Y3E.js} +1 -1
- package/dist/cli-delegate/{chunk-HDVVGPQW.js → chunk-7XGBX6ZH.js} +471 -387
- package/dist/cli-delegate/{chunk-GJCBB2UG.js → chunk-FP36SWJD.js} +432 -144
- package/dist/cli-delegate/{chunk-UNCRJBT3.js → chunk-IGD6ERX6.js} +31 -0
- package/dist/cli-delegate/{chunk-FXYUYU4N.js → chunk-JNMVLWLR.js} +42 -1
- package/dist/cli-delegate/{chunk-QJWAUMJW.js → chunk-YJ72UIAK.js} +730 -15
- package/dist/cli-delegate/cmd_conformance.js +902 -782
- 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 +4 -4
- 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 +1 -1
- package/dist/cli-delegate/cmd_session_recycle.js +2 -2
- package/dist/cli-delegate/cmd_settings_migrate.js +2 -2
- package/dist/cli-delegate/cmd_settings_set.js +1 -1
- 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 +10 -10
- 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 +6666 -2581
- package/dist/hooks/dispatch.sha256 +1 -0
- package/dist/install/install.mjs +848 -733
- package/dist/mcp/registry-manifest.json +2 -2
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +2747 -1510
- package/dist/server/schemas/settings.js +23 -0
- package/dist/ui/assets/index-Cwq4d0hX.js +23 -0
- package/dist/ui/assets/index-Cyjy8bWO.css +1 -0
- package/dist/ui/index.html +2 -2
- package/docs/contracts/settings-classes.md +6 -4
- package/package.json +4 -4
- package/src/agent-src/templates/scripts/work_engine/directives/ui/app_spec.ts +10 -4
- package/src/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +260 -21
- package/src/agent-src/templates/scripts/work_engine/directives/ui/audit.ts +22 -3
- package/src/agent-src/templates/scripts/work_engine/directives/ui/scaffold.ts +6 -1
- package/src/agent-src/templates/scripts/work_engine/state.ts +57 -7
- package/src/agent-src/templates/scripts/work_engine/taxonomy/detect.ts +500 -0
- package/src/agent-src/templates/scripts/work_engine/taxonomy/place.ts +183 -0
- package/src/config/agent-settings.template.yml +29 -0
- package/src/config/ci-local-parity.yml +18 -0
- package/src/config/continuity-surface.json +2 -2
- package/src/config/gate-coverage.yml +234 -3
- package/src/config/gate-violation-baselines.json +7 -3
- package/src/config/hook-latency-budget.json +21 -0
- package/src/config/hook-token-budget.json +2 -2
- package/src/config/metric-registry.yml +114 -0
- package/src/config/placeholder-drift-budget.json +10 -0
- package/src/config/routing-coverage-seed.json +18 -4
- package/src/scripts/_cli/cmd_doctor.ts +5 -19
- package/src/scripts/_cli/doctor_execution.ts +100 -17
- package/src/scripts/_cli/doctor_network_posture.ts +226 -0
- package/src/scripts/_lib/body_portable.ts +102 -0
- package/src/scripts/_lib/cc_transcript.ts +132 -1
- package/src/scripts/_lib/concern_sla_window.ts +200 -0
- package/src/scripts/_lib/forge_protection.ts +114 -0
- package/src/scripts/_lib/forge_reader.ts +558 -0
- package/src/scripts/_lib/host_env_write.ts +111 -0
- package/src/scripts/_lib/llm_proposer_transport.ts +14 -4
- package/src/scripts/_lib/obligations.ts +119 -8
- package/src/scripts/_lib/probe_inputs.ts +271 -0
- package/src/scripts/_lib/read_surface_scan.ts +322 -0
- package/src/scripts/_lib/release_highlights.ts +2 -1
- package/src/scripts/_lib/retrieval_sanitize.ts +77 -16
- package/src/scripts/_lib/shell_write_shapes.ts +108 -0
- package/src/scripts/_lib/structural_hiding.ts +622 -0
- package/src/scripts/_lib/turn_end_refusals.ts +525 -4
- package/src/scripts/_lib/turn_end_transcript.ts +216 -0
- package/src/scripts/_lib/verification_command.ts +324 -0
- package/src/scripts/_lib/verification_evidence.ts +647 -0
- package/src/scripts/_lib/verify_clause.ts +280 -0
- package/src/scripts/ai_team/team_dispatch.ts +4 -0
- package/src/scripts/before_complete_hook.ts +340 -23
- package/src/scripts/bench_hook_latency.ts +412 -5
- package/src/scripts/cache_realization_report.ts +61 -1
- package/src/scripts/check_argument_hint.ts +287 -0
- package/src/scripts/check_claims.ts +125 -1
- package/src/scripts/check_enforcement_coverage.ts +38 -9
- package/src/scripts/check_enforcement_matrix.ts +245 -3
- package/src/scripts/check_finding_dispositions.ts +22 -3
- package/src/scripts/check_generator_sync.ts +71 -0
- package/src/scripts/check_host_docs_digest.ts +786 -0
- package/src/scripts/check_host_format_column.ts +559 -0
- package/src/scripts/check_input_references.ts +228 -0
- package/src/scripts/check_inputs_parity.ts +235 -0
- package/src/scripts/check_kernel_edit_ratified.ts +47 -5
- package/src/scripts/check_kill_switch_table.ts +294 -0
- package/src/scripts/check_placeholder_drift.ts +221 -0
- package/src/scripts/check_read_surface_coverage.ts +515 -0
- package/src/scripts/check_release_holds.ts +2 -1
- package/src/scripts/check_routing_coverage.ts +378 -11
- package/src/scripts/check_static_parity.ts +17 -0
- package/src/scripts/ci_settle.ts +145 -19
- package/src/scripts/closure_scan.ts +115 -1
- package/src/scripts/compile_hook_manifest.ts +60 -16
- package/src/scripts/external_sources_denylist.json +29 -4
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +42 -5
- package/src/scripts/hooks/block_config_weakening.ts +229 -4
- package/src/scripts/hooks/block_kernel_rule_writes.ts +9 -78
- package/src/scripts/hooks/block_plumbing_writes.ts +314 -0
- package/src/scripts/hooks/bundle_integrity.ts +291 -0
- package/src/scripts/hooks/chain_nudge_hook.ts +1 -2
- package/src/scripts/hooks/code_graph_context_hook.ts +1 -2
- package/src/scripts/hooks/comment_discipline_hook.ts +1 -3
- package/src/scripts/hooks/concern_registry.ts +2 -0
- package/src/scripts/hooks/concern_timings.ts +94 -0
- package/src/scripts/hooks/delegation_nudge_hook.ts +1 -2
- package/src/scripts/hooks/design_pass_hook.ts +100 -9
- package/src/scripts/hooks/design_slop_hook.ts +1 -2
- package/src/scripts/hooks/dispatch_hook.ts +25 -19
- package/src/scripts/hooks/edit_shape_hook.ts +1 -2
- package/src/scripts/hooks/end_review_nudge_hook.ts +1 -1
- package/src/scripts/hooks/evidence_independence.ts +1 -2
- package/src/scripts/hooks/exit_codes.ts +128 -0
- package/src/scripts/hooks/host_lowering.json +1 -0
- package/src/scripts/hooks/host_lowering.ts +128 -3
- package/src/scripts/hooks/host_lowering.yaml +262 -46
- package/src/scripts/hooks/host_semantics.ts +30 -2
- package/src/scripts/hooks/injection_budget.ts +9 -2
- package/src/scripts/hooks/interruption_ledger_hook.ts +1 -2
- package/src/scripts/hooks/journal_record_hook.ts +1 -2
- package/src/scripts/hooks/memory_recall_hook.ts +1 -2
- package/src/scripts/hooks/obligation_settle_hook.ts +151 -5
- package/src/scripts/hooks/one_question_per_ask_hook.ts +25 -4
- package/src/scripts/hooks/orchestration_record_hook.ts +1 -2
- package/src/scripts/hooks/permission_gate.ts +1 -2
- package/src/scripts/hooks/push_settle_hook.ts +1 -3
- package/src/scripts/hooks/replay_hook.ts +2 -1
- package/src/scripts/hooks/reread_guard_hook.ts +1 -2
- package/src/scripts/hooks/review_baseline_hook.ts +1 -2
- package/src/scripts/hooks/rtk_wrap_hook.ts +1 -2
- package/src/scripts/hooks/rule_inject_hook.ts +8 -5
- package/src/scripts/hooks/run_continuation_hook.ts +13 -15
- package/src/scripts/hooks/skill_route_hook.ts +1 -2
- package/src/scripts/hooks/source_first_gate_hook.ts +1 -2
- package/src/scripts/hooks/spawn_guard_shadow_hook.ts +1 -2
- package/src/scripts/hooks/subagent_ledger_hook.ts +1 -2
- package/src/scripts/hooks/suggestion_capture_hook.ts +1 -1
- package/src/scripts/hooks/table_fingerprint.ts +49 -0
- package/src/scripts/hooks/telemetry_flush_hook.ts +1 -2
- package/src/scripts/hooks/telemetry_usage_hook.ts +1 -2
- package/src/scripts/hooks/tool_result_bytes_hook.ts +93 -9
- package/src/scripts/hooks/turn_end_gate_hook.ts +337 -324
- package/src/scripts/hooks/ui_route_nudge_hook.ts +1 -2
- package/src/scripts/install.ts +3 -4
- package/src/scripts/lint_deny_text.ts +419 -0
- package/src/scripts/lint_exit_codes.ts +262 -0
- package/src/scripts/lint_hook_manifest.ts +55 -0
- package/src/scripts/lint_roadmap_blockers.ts +78 -12
- package/src/scripts/lint_skill_descriptions.ts +1 -1
- package/src/scripts/lint_skill_scripts_readonly.ts +1 -1
- package/src/scripts/mcp_server/prompts.ts +142 -1
- package/src/scripts/measure_skill_ranker_baseline.ts +305 -51
- package/src/scripts/measure_turn_end_gate.ts +193 -0
- package/src/scripts/memory_lookup.ts +1 -1
- package/src/scripts/prepack-check.mjs +53 -0
- package/src/scripts/release_publication.ts +13 -1
- package/src/scripts/report_invocation_surface.ts +383 -0
- package/src/scripts/report_obligation_carriers.ts +699 -0
- package/src/scripts/report_obligation_writer_split.ts +236 -0
- package/src/scripts/report_skill_menu_census.ts +208 -0
- package/src/scripts/report_standing_payload_by_host.ts +1 -1
- package/src/scripts/roadmap_verify_share.ts +213 -0
- package/src/scripts/schemas/command.schema.json +44 -0
- package/src/scripts/schemas/review-findings.schema.json +4 -0
- package/src/scripts/schemas/skill.schema.json +44 -0
- package/src/scripts/self_review_gate.ts +359 -10
- package/src/scripts/semantic_parity_census.ts +314 -0
- package/src/scripts/session_eol_report.ts +54 -1
- package/src/scripts/sweep_dead_scan_roots.ts +1 -1
- package/src/scripts/trigger_eval_grandfather.json +0 -2
- package/src/scripts/trigger_eval_rotation.ts +122 -27
- package/src/scripts/ui_conformance_probe.ts +156 -4
- package/src/scripts/update_prices.ts +85 -3
- package/src/scripts/write_bundle_digest.mjs +74 -0
- package/src/server/schemas/settings.ts +31 -0
- package/src/templates/consumer-settings/ONBOARDING.md +1 -0
- package/dist/ui/assets/index-DH1xc62v.js +0 -29
- package/dist/ui/assets/index-jSfMW8_t.css +0 -1
- /package/dist/cli-delegate/{chunk-YUM5KURG.js → chunk-7RQP4UDH.js} +0 -0
|
@@ -27,13 +27,15 @@ import {
|
|
|
27
27
|
billableInputTokens,
|
|
28
28
|
clients_exports,
|
|
29
29
|
config_exports,
|
|
30
|
+
derivedBytes,
|
|
30
31
|
hardenedSpawnEnv,
|
|
31
32
|
load_cli_call_counts,
|
|
33
|
+
measureBytesPerToken,
|
|
32
34
|
policyExclusionReason,
|
|
33
35
|
projectStoreSlug,
|
|
34
36
|
scanTranscripts,
|
|
35
37
|
weightedInputUnits
|
|
36
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-JNMVLWLR.js";
|
|
37
39
|
import {
|
|
38
40
|
git_common_dir
|
|
39
41
|
} from "./chunk-E4XIZDIB.js";
|
|
@@ -85,9 +87,9 @@ import {
|
|
|
85
87
|
// src/scripts/_cli/cmd_doctor.ts
|
|
86
88
|
var YAML2 = __toESM(require_dist(), 1);
|
|
87
89
|
import * as crypto2 from "node:crypto";
|
|
88
|
-
import * as
|
|
90
|
+
import * as fs16 from "node:fs";
|
|
89
91
|
import * as os4 from "node:os";
|
|
90
|
-
import * as
|
|
92
|
+
import * as path21 from "node:path";
|
|
91
93
|
import process3 from "node:process";
|
|
92
94
|
import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL6 } from "node:url";
|
|
93
95
|
|
|
@@ -1355,7 +1357,8 @@ function computePrefixStability(drift) {
|
|
|
1355
1357
|
};
|
|
1356
1358
|
}
|
|
1357
1359
|
function buildReport2(opts) {
|
|
1358
|
-
const scan = scanTranscripts({ root: opts.root, maxAgeDays: opts.maxAgeDays });
|
|
1360
|
+
const scan = scanTranscripts({ root: opts.root, maxAgeDays: opts.maxAgeDays, measureBytes: true });
|
|
1361
|
+
const bytesFactor = measureBytesPerToken(scan.records);
|
|
1359
1362
|
const buckets = aggregateByBucket(scan.records);
|
|
1360
1363
|
const subagentColdStart = computeColdStarts(scan.records);
|
|
1361
1364
|
const byAgent = aggregateByAgent(scan.records);
|
|
@@ -1400,6 +1403,11 @@ function buildReport2(opts) {
|
|
|
1400
1403
|
council_mispricing: councilMispricing,
|
|
1401
1404
|
worktree_fragmentation: worktreeFragmentation,
|
|
1402
1405
|
prefix_stability: prefixStability,
|
|
1406
|
+
provider_bytes: {
|
|
1407
|
+
factor: bytesFactor,
|
|
1408
|
+
main: derivedBytes(billableInputTokens(buckets.main), bytesFactor),
|
|
1409
|
+
subagent: derivedBytes(billableInputTokens(buckets.subagent), bytesFactor)
|
|
1410
|
+
},
|
|
1403
1411
|
claims
|
|
1404
1412
|
};
|
|
1405
1413
|
}
|
|
@@ -1425,6 +1433,25 @@ function renderText3(r) {
|
|
|
1425
1433
|
out.push(` unstable cohort: n=${ps.unstable_cohort.n} read_share=${share(ps.unstable_cohort.read_share)}`);
|
|
1426
1434
|
out.push(` ${ps.reason}`);
|
|
1427
1435
|
out.push("");
|
|
1436
|
+
const pb = r.provider_bytes;
|
|
1437
|
+
out.push("Provider bytes (DERIVED - never a counted wire figure):");
|
|
1438
|
+
if (pb.factor === null) {
|
|
1439
|
+
out.push(" basis: unavailable - this corpus supplied no bytes-per-token factor");
|
|
1440
|
+
out.push(" no figure is emitted; a ratio from another corpus would not be this one");
|
|
1441
|
+
} else {
|
|
1442
|
+
out.push(
|
|
1443
|
+
` factor: ${pb.factor.bytes_per_token.toFixed(4)} bytes/token (basis: ${pb.factor.basis}, ${pb.factor.content_bytes} content bytes / ${pb.factor.output_tokens} output tokens over ${pb.factor.records} records)`
|
|
1444
|
+
);
|
|
1445
|
+
for (const bucket of ["main", "subagent"]) {
|
|
1446
|
+
const d = pb[bucket];
|
|
1447
|
+
out.push(
|
|
1448
|
+
d === null ? ` ${bucket}: basis: unavailable` : ` ${bucket}: ${d.bytes} bytes (basis: ${d.basis}, from ${d.tokens} billable input tokens)`
|
|
1449
|
+
);
|
|
1450
|
+
}
|
|
1451
|
+
out.push(" the factor is measured over assistant OUTPUT content; the request payload is");
|
|
1452
|
+
out.push(" not in any transcript, so this is an estimate of volume, not a wire measurement");
|
|
1453
|
+
}
|
|
1454
|
+
out.push("");
|
|
1428
1455
|
out.push("By bucket:");
|
|
1429
1456
|
for (const bucket of ["main", "subagent"]) {
|
|
1430
1457
|
const b = r.buckets[bucket];
|
|
@@ -2842,6 +2869,24 @@ function checkHumanizerRuntime(which) {
|
|
|
2842
2869
|
}
|
|
2843
2870
|
|
|
2844
2871
|
// src/scripts/_lib/forge_protection.ts
|
|
2872
|
+
var UNREAD_FORGE = {
|
|
2873
|
+
rulesets: null,
|
|
2874
|
+
defaultBranch: null,
|
|
2875
|
+
allowAutoMerge: null,
|
|
2876
|
+
deployRestricted: null
|
|
2877
|
+
};
|
|
2878
|
+
function deployRestrictedFrom(environments, patternsByEnv) {
|
|
2879
|
+
if (environments.length === 0) return null;
|
|
2880
|
+
return environments.every((env) => {
|
|
2881
|
+
const policy = env.deployment_branch_policy;
|
|
2882
|
+
if (policy === null || policy === void 0) return false;
|
|
2883
|
+
if (policy.protected_branches === true) return true;
|
|
2884
|
+
if (policy.custom_branch_policies !== true) return false;
|
|
2885
|
+
const patterns = patternsByEnv?.[env.name];
|
|
2886
|
+
if (patterns === void 0) return true;
|
|
2887
|
+
return patterns.length > 0 && !patterns.some((p) => p === "*" || p === "**");
|
|
2888
|
+
});
|
|
2889
|
+
}
|
|
2845
2890
|
var SOURCE = {
|
|
2846
2891
|
rulesets: "GET repos/{owner}/{repo}/rulesets + GET .../rulesets/{id}",
|
|
2847
2892
|
repo: "GET repos/{owner}/{repo} (allow_auto_merge)",
|
|
@@ -2960,6 +3005,175 @@ function protectionActions(rows) {
|
|
|
2960
3005
|
return rows.filter((r) => r.state !== "satisfied").map((r) => `${r.id}: ${r.state} \u2014 ${r.detail} (source: ${r.source})`);
|
|
2961
3006
|
}
|
|
2962
3007
|
|
|
3008
|
+
// src/scripts/_lib/forge_reader.ts
|
|
3009
|
+
import { spawnSync } from "node:child_process";
|
|
3010
|
+
var FORGE_CALL_TIMEOUT_MS = 1e4;
|
|
3011
|
+
var GIT_REMOTE_TIMEOUT_MS = 2e3;
|
|
3012
|
+
var FORGE_TOTAL_BUDGET_MS = 15e3;
|
|
3013
|
+
var NO_FORGE_ENV = ["AGENT_CONFIG_DOCTOR_NO_FORGE", "AGENT_CONFIG_OFFLINE"];
|
|
3014
|
+
function forgeReadDisabled(env) {
|
|
3015
|
+
return NO_FORGE_ENV.some((k) => env[k] === "1");
|
|
3016
|
+
}
|
|
3017
|
+
function asObject(v) {
|
|
3018
|
+
return v !== null && typeof v === "object" && !Array.isArray(v) ? v : null;
|
|
3019
|
+
}
|
|
3020
|
+
var defaultRunner = (cmd, args, timeoutMs, cwd) => spawnSync(cmd, [...args], {
|
|
3021
|
+
encoding: "utf8",
|
|
3022
|
+
timeout: timeoutMs,
|
|
3023
|
+
maxBuffer: 32 * 1024 * 1024,
|
|
3024
|
+
...cwd === void 0 ? {} : { cwd }
|
|
3025
|
+
});
|
|
3026
|
+
function callTimeout(remainingMs) {
|
|
3027
|
+
return Math.max(1, Math.floor(Math.min(FORGE_CALL_TIMEOUT_MS, remainingMs)));
|
|
3028
|
+
}
|
|
3029
|
+
function liveForgeApi(timeoutFor = () => FORGE_CALL_TIMEOUT_MS, run = defaultRunner, where = {}) {
|
|
3030
|
+
const hostArgs = where.host === void 0 || where.host.toLowerCase() === "github.com" ? [] : ["--hostname", where.host];
|
|
3031
|
+
return {
|
|
3032
|
+
get(apiPath, paginate = false) {
|
|
3033
|
+
const budget = timeoutFor();
|
|
3034
|
+
if (budget <= 0) return null;
|
|
3035
|
+
const args = paginate ? ["api", "--paginate", "--slurp", ...hostArgs, apiPath] : ["api", ...hostArgs, apiPath];
|
|
3036
|
+
let r;
|
|
3037
|
+
try {
|
|
3038
|
+
r = run("gh", args, callTimeout(budget), where.cwd);
|
|
3039
|
+
} catch {
|
|
3040
|
+
return null;
|
|
3041
|
+
}
|
|
3042
|
+
if (r.status !== 0 || typeof r.stdout !== "string" || r.stdout.trim() === "") {
|
|
3043
|
+
return null;
|
|
3044
|
+
}
|
|
3045
|
+
try {
|
|
3046
|
+
return JSON.parse(r.stdout);
|
|
3047
|
+
} catch {
|
|
3048
|
+
return null;
|
|
3049
|
+
}
|
|
3050
|
+
}
|
|
3051
|
+
};
|
|
3052
|
+
}
|
|
3053
|
+
function resolveForgeRepo(originUrl2) {
|
|
3054
|
+
if (originUrl2 === null || originUrl2.trim() === "") return null;
|
|
3055
|
+
const url = originUrl2.trim();
|
|
3056
|
+
const m = /^(?:[A-Za-z][A-Za-z0-9+.-]*:\/\/)?(?:[^@/]+@)?([^/:]+)[:/]([^/:]+\/[^/]+?)(?:\.git)?$/.exec(
|
|
3057
|
+
url
|
|
3058
|
+
);
|
|
3059
|
+
const host = m?.[1];
|
|
3060
|
+
const slug = m?.[2];
|
|
3061
|
+
if (host === void 0 || slug === void 0) return null;
|
|
3062
|
+
if (!host.toLowerCase().includes("github")) return null;
|
|
3063
|
+
if (!/^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/.test(slug)) return null;
|
|
3064
|
+
if (slug.split("/").some((seg) => seg === "." || seg === "..")) return null;
|
|
3065
|
+
return { host, slug };
|
|
3066
|
+
}
|
|
3067
|
+
function originUrl(root, run = defaultRunner, timeoutMs = GIT_REMOTE_TIMEOUT_MS) {
|
|
3068
|
+
let r;
|
|
3069
|
+
try {
|
|
3070
|
+
r = run("git", ["ls-remote", "--get-url", "origin"], timeoutMs, root);
|
|
3071
|
+
} catch {
|
|
3072
|
+
return null;
|
|
3073
|
+
}
|
|
3074
|
+
if (r.status !== 0 || typeof r.stdout !== "string") return null;
|
|
3075
|
+
const out = r.stdout.trim();
|
|
3076
|
+
return out === "" || out === "origin" ? null : out;
|
|
3077
|
+
}
|
|
3078
|
+
function readRulesets(repo, api) {
|
|
3079
|
+
const list = slurped(api.get(`repos/${repo}/rulesets`, true), "rulesets");
|
|
3080
|
+
if (list === null) return null;
|
|
3081
|
+
const out = [];
|
|
3082
|
+
for (const entry of list) {
|
|
3083
|
+
const id = asObject(entry)?.["id"];
|
|
3084
|
+
if (typeof id !== "number") return null;
|
|
3085
|
+
const detail = api.get(`repos/${repo}/rulesets/${String(id)}`);
|
|
3086
|
+
if (asObject(detail) === null) return null;
|
|
3087
|
+
out.push(detail);
|
|
3088
|
+
}
|
|
3089
|
+
return out;
|
|
3090
|
+
}
|
|
3091
|
+
function slurped(payload, key) {
|
|
3092
|
+
if (Array.isArray(payload)) {
|
|
3093
|
+
if (payload.length > 0 && payload.every((p) => Array.isArray(p))) {
|
|
3094
|
+
return payload.flat();
|
|
3095
|
+
}
|
|
3096
|
+
if (payload.length > 0 && payload.every((p) => Array.isArray(asObject(p)?.[key]))) {
|
|
3097
|
+
return payload.flatMap((p) => asObject(p)?.[key]);
|
|
3098
|
+
}
|
|
3099
|
+
return payload;
|
|
3100
|
+
}
|
|
3101
|
+
const listed = asObject(payload)?.[key];
|
|
3102
|
+
return Array.isArray(listed) ? [...listed] : null;
|
|
3103
|
+
}
|
|
3104
|
+
function readDeployRestricted(repo, api) {
|
|
3105
|
+
const envsRaw = slurped(api.get(`repos/${repo}/environments`, true), "environments");
|
|
3106
|
+
if (envsRaw === null) return null;
|
|
3107
|
+
const envs = [];
|
|
3108
|
+
const patternsByEnv = {};
|
|
3109
|
+
for (const raw of envsRaw) {
|
|
3110
|
+
const env = asObject(raw);
|
|
3111
|
+
const name = env?.["name"];
|
|
3112
|
+
if (typeof name !== "string") return null;
|
|
3113
|
+
const policy = asObject(env?.["deployment_branch_policy"]);
|
|
3114
|
+
for (const k of ["protected_branches", "custom_branch_policies"]) {
|
|
3115
|
+
const v = policy?.[k];
|
|
3116
|
+
if (v !== void 0 && typeof v !== "boolean") return null;
|
|
3117
|
+
}
|
|
3118
|
+
envs.push({
|
|
3119
|
+
name,
|
|
3120
|
+
deployment_branch_policy: policy === null ? null : {
|
|
3121
|
+
...typeof policy["protected_branches"] === "boolean" ? { protected_branches: policy["protected_branches"] } : {},
|
|
3122
|
+
...typeof policy["custom_branch_policies"] === "boolean" ? { custom_branch_policies: policy["custom_branch_policies"] } : {}
|
|
3123
|
+
}
|
|
3124
|
+
});
|
|
3125
|
+
if (policy?.["custom_branch_policies"] !== true) continue;
|
|
3126
|
+
if (policy["protected_branches"] === true) continue;
|
|
3127
|
+
const names = api.get(
|
|
3128
|
+
`repos/${repo}/environments/${encodeURIComponent(name)}/deployment-branch-policies`,
|
|
3129
|
+
true
|
|
3130
|
+
);
|
|
3131
|
+
const listed = slurped(names, "branch_policies");
|
|
3132
|
+
if (listed === null) return null;
|
|
3133
|
+
const patterns = listed.map((p) => asObject(p)?.["name"]);
|
|
3134
|
+
if (patterns.some((n) => typeof n !== "string")) return null;
|
|
3135
|
+
patternsByEnv[name] = patterns;
|
|
3136
|
+
}
|
|
3137
|
+
return deployRestrictedFrom(envs, patternsByEnv);
|
|
3138
|
+
}
|
|
3139
|
+
function readForge(repo, api) {
|
|
3140
|
+
const record = asObject(api.get(`repos/${repo}`));
|
|
3141
|
+
if (record === null) return UNREAD_FORGE;
|
|
3142
|
+
const branch = record["default_branch"];
|
|
3143
|
+
const autoMerge = record["allow_auto_merge"];
|
|
3144
|
+
return {
|
|
3145
|
+
defaultBranch: typeof branch === "string" && branch !== "" ? branch : null,
|
|
3146
|
+
// Never coerced: a flag the payload did not carry as a boolean is a flag
|
|
3147
|
+
// nobody read, and `unread` is the state reserved for exactly that.
|
|
3148
|
+
allowAutoMerge: typeof autoMerge === "boolean" ? autoMerge : null,
|
|
3149
|
+
rulesets: readRulesets(repo, api),
|
|
3150
|
+
deployRestricted: readDeployRestricted(repo, api)
|
|
3151
|
+
};
|
|
3152
|
+
}
|
|
3153
|
+
function withDeadline(api, remaining) {
|
|
3154
|
+
return {
|
|
3155
|
+
get(apiPath, paginate) {
|
|
3156
|
+
return remaining() <= 0 ? null : api.get(apiPath, paginate);
|
|
3157
|
+
}
|
|
3158
|
+
};
|
|
3159
|
+
}
|
|
3160
|
+
function budgetOf(ms, now = () => performance.now()) {
|
|
3161
|
+
const until = now() + ms;
|
|
3162
|
+
return () => Math.max(0, until - now());
|
|
3163
|
+
}
|
|
3164
|
+
function forgeReadingFor(req) {
|
|
3165
|
+
if (forgeReadDisabled(req.env)) return { repo: null, reading: UNREAD_FORGE };
|
|
3166
|
+
const remaining = req.remaining ?? budgetOf(FORGE_TOTAL_BUDGET_MS);
|
|
3167
|
+
try {
|
|
3168
|
+
const target = req.resolveRepo();
|
|
3169
|
+
if (target === null) return { repo: null, reading: UNREAD_FORGE };
|
|
3170
|
+
const reading = readForge(target.slug, withDeadline(req.apiFor(target), remaining));
|
|
3171
|
+
return { repo: target.slug, reading };
|
|
3172
|
+
} catch {
|
|
3173
|
+
return { repo: null, reading: UNREAD_FORGE };
|
|
3174
|
+
}
|
|
3175
|
+
}
|
|
3176
|
+
|
|
2963
3177
|
// src/scripts/_cli/doctor_execution.ts
|
|
2964
3178
|
function executionJson(overrides) {
|
|
2965
3179
|
let posture;
|
|
@@ -2973,36 +3187,125 @@ function executionJson(overrides) {
|
|
|
2973
3187
|
escalation: [...posture.escalation]
|
|
2974
3188
|
};
|
|
2975
3189
|
}
|
|
2976
|
-
function forgeProtectionJson(reading) {
|
|
3190
|
+
function forgeProtectionJson(reading, repo = null) {
|
|
2977
3191
|
const rows = forgeProtectionRows(reading);
|
|
3192
|
+
const readFromForge = rows.some((r) => r.state !== "unread");
|
|
3193
|
+
const anonymous = repo === null || !readFromForge;
|
|
3194
|
+
const name = (s) => anonymous ? s : s.replace(/\{owner\}\/\{repo\}/g, () => repo);
|
|
2978
3195
|
return {
|
|
3196
|
+
repository: readFromForge ? repo : null,
|
|
2979
3197
|
rows: rows.map((r) => ({
|
|
2980
3198
|
id: r.id,
|
|
2981
3199
|
state: r.state,
|
|
2982
|
-
source: r.source,
|
|
3200
|
+
source: name(r.source),
|
|
2983
3201
|
detail: r.detail
|
|
2984
3202
|
})),
|
|
2985
|
-
actions: protectionActions(rows),
|
|
2986
|
-
read_from_forge:
|
|
3203
|
+
actions: protectionActions(rows).map(name),
|
|
3204
|
+
read_from_forge: readFromForge
|
|
2987
3205
|
};
|
|
2988
3206
|
}
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
3207
|
+
function forgeProtectionJsonFor(root, deps = {}) {
|
|
3208
|
+
const env = deps.env ?? process.env;
|
|
3209
|
+
const run = deps.run;
|
|
3210
|
+
const remaining = budgetOf(FORGE_TOTAL_BUDGET_MS);
|
|
3211
|
+
const read = forgeReadingFor({
|
|
3212
|
+
env,
|
|
3213
|
+
// A thunk, so the opt-out short-circuits before `git` spawns.
|
|
3214
|
+
resolveRepo: () => resolveForgeRepo(originUrl(root, run)),
|
|
3215
|
+
// Built from the RESOLVED target, so `gh` is addressed at the host and
|
|
3216
|
+
// directory the slug came from. The per-call ceiling is whatever is
|
|
3217
|
+
// left of the whole-read budget, so a call admitted near the deadline
|
|
3218
|
+
// cannot run past it.
|
|
3219
|
+
apiFor: (t) => liveForgeApi(remaining, run, { host: t.host, cwd: root }),
|
|
3220
|
+
remaining
|
|
3221
|
+
});
|
|
3222
|
+
return forgeProtectionJson(read.reading, read.repo);
|
|
3223
|
+
}
|
|
2995
3224
|
|
|
2996
|
-
// src/scripts/
|
|
2997
|
-
import { spawnSync } from "node:child_process";
|
|
3225
|
+
// src/scripts/_cli/doctor_network_posture.ts
|
|
2998
3226
|
import * as fs13 from "node:fs";
|
|
2999
|
-
import * as os2 from "node:os";
|
|
3000
3227
|
import * as path17 from "node:path";
|
|
3228
|
+
var NOT_APPLICABLE = "not applicable on this host";
|
|
3229
|
+
var TRAFFIC_DOC = "docs/setup/host-traffic-environment.md";
|
|
3230
|
+
var UNKNOWN_HOST = "unknown";
|
|
3231
|
+
var CHECKED = "claude-code 2.1.284 \xB7 2026-09-29";
|
|
3232
|
+
var TRAFFIC_VARIABLES = [
|
|
3233
|
+
// Both traffic variables reach the host's update-disabled resolver, the
|
|
3234
|
+
// blanket one as its third rung, so neither is writable by this package —
|
|
3235
|
+
// owner-decided 2026-09-30.
|
|
3236
|
+
{ variable: "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC", hosts: ["claude-code"], checked_against: CHECKED, writable_by_this_package: false },
|
|
3237
|
+
{ variable: "DISABLE_AUTOUPDATER", hosts: ["claude-code"], checked_against: CHECKED, writable_by_this_package: false },
|
|
3238
|
+
// Size caps. Neither reaches the updater resolver, and neither suppresses a
|
|
3239
|
+
// call, an update check or a download.
|
|
3240
|
+
{ variable: "BASH_MAX_OUTPUT_LENGTH", hosts: ["claude-code"], checked_against: CHECKED, writable_by_this_package: true },
|
|
3241
|
+
{ variable: "MAX_MCP_OUTPUT_TOKENS", hosts: ["claude-code"], checked_against: CHECKED, writable_by_this_package: true }
|
|
3242
|
+
];
|
|
3243
|
+
function resolveTrafficHost(env) {
|
|
3244
|
+
const claude = (env["CLAUDECODE"] ?? "").trim() !== "" || (env["CLAUDE_CODE_SESSION_ID"] ?? "").trim() !== "";
|
|
3245
|
+
if (claude) return { host: "claude-code", observed: true };
|
|
3246
|
+
return { host: UNKNOWN_HOST, observed: false };
|
|
3247
|
+
}
|
|
3248
|
+
function trafficRow(spec, env, host) {
|
|
3249
|
+
const raw = env[spec.variable];
|
|
3250
|
+
const present = raw !== void 0 && raw !== "";
|
|
3251
|
+
const applicable = spec.hosts.includes(host);
|
|
3252
|
+
return {
|
|
3253
|
+
variable: spec.variable,
|
|
3254
|
+
state: applicable ? present ? "set" : "unset" : NOT_APPLICABLE,
|
|
3255
|
+
value: present ? String(raw) : null,
|
|
3256
|
+
checked_against: spec.checked_against,
|
|
3257
|
+
writable_by_this_package: spec.writable_by_this_package
|
|
3258
|
+
};
|
|
3259
|
+
}
|
|
3260
|
+
function trafficEnvironmentJson(env, hostOverride) {
|
|
3261
|
+
const resolved = hostOverride ?? resolveTrafficHost(env);
|
|
3262
|
+
return {
|
|
3263
|
+
host: resolved.host,
|
|
3264
|
+
host_observed: resolved.observed,
|
|
3265
|
+
doc: TRAFFIC_DOC,
|
|
3266
|
+
reporting_read_only: true,
|
|
3267
|
+
writable_by_this_package: TRAFFIC_VARIABLES.filter((v) => v.writable_by_this_package).map(
|
|
3268
|
+
(v) => v.variable
|
|
3269
|
+
),
|
|
3270
|
+
rows: TRAFFIC_VARIABLES.map((spec) => trafficRow(spec, env, resolved.host))
|
|
3271
|
+
};
|
|
3272
|
+
}
|
|
3273
|
+
function pathExists(p) {
|
|
3274
|
+
try {
|
|
3275
|
+
fs13.statSync(p);
|
|
3276
|
+
return true;
|
|
3277
|
+
} catch {
|
|
3278
|
+
return false;
|
|
3279
|
+
}
|
|
3280
|
+
}
|
|
3281
|
+
function checkOfflineReadiness(packageRoot) {
|
|
3282
|
+
const script = path17.join(packageRoot, "src", "scripts", "hermetic-install.sh");
|
|
3283
|
+
if (!pathExists(script)) {
|
|
3284
|
+
return {
|
|
3285
|
+
id: "offline-readiness",
|
|
3286
|
+
status: "warn",
|
|
3287
|
+
message: "src/scripts/hermetic-install.sh not found in package",
|
|
3288
|
+
remedy: "reinstall @event4u/agent-config or pull missing files"
|
|
3289
|
+
};
|
|
3290
|
+
}
|
|
3291
|
+
return {
|
|
3292
|
+
id: "offline-readiness",
|
|
3293
|
+
status: "ok",
|
|
3294
|
+
message: "verified-offline install entrypoint present",
|
|
3295
|
+
remedy: ""
|
|
3296
|
+
};
|
|
3297
|
+
}
|
|
3298
|
+
|
|
3299
|
+
// src/scripts/_lib/environment_detector.ts
|
|
3300
|
+
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
3301
|
+
import * as fs14 from "node:fs";
|
|
3302
|
+
import * as os2 from "node:os";
|
|
3303
|
+
import * as path18 from "node:path";
|
|
3001
3304
|
|
|
3002
3305
|
// src/install/toolDetection.ts
|
|
3003
3306
|
import { existsSync as existsSync9 } from "node:fs";
|
|
3004
3307
|
import { homedir as homedir4 } from "node:os";
|
|
3005
|
-
import { delimiter, join as
|
|
3308
|
+
import { delimiter, join as join17 } from "node:path";
|
|
3006
3309
|
var TOOL_SIGNALS = {
|
|
3007
3310
|
"claude-code": { bins: ["claude"], homePaths: [".claude", ".claude.json", ".config/claude"] },
|
|
3008
3311
|
"claude-desktop": { absPaths: ["/Applications/Claude.app"], homePaths: ["Library/Application Support/Claude", ".config/Claude"] },
|
|
@@ -3047,7 +3350,7 @@ function resolveBinaryPath(name, pathEnv) {
|
|
|
3047
3350
|
for (const dir of pathEnv.split(delimiter)) {
|
|
3048
3351
|
if (dir.length === 0) continue;
|
|
3049
3352
|
for (const candidate of [name, `${name}.exe`, `${name}.cmd`]) {
|
|
3050
|
-
const full =
|
|
3353
|
+
const full = join17(dir, candidate);
|
|
3051
3354
|
if (existsSync9(full)) return full;
|
|
3052
3355
|
}
|
|
3053
3356
|
}
|
|
@@ -3058,7 +3361,7 @@ function binOnPath(name, pathEnv) {
|
|
|
3058
3361
|
}
|
|
3059
3362
|
function isToolInstalled(signal, home, pathEnv) {
|
|
3060
3363
|
for (const rel of signal.homePaths ?? []) {
|
|
3061
|
-
if (existsSync9(
|
|
3364
|
+
if (existsSync9(join17(home, rel))) return true;
|
|
3062
3365
|
}
|
|
3063
3366
|
for (const abs of signal.absPaths ?? []) {
|
|
3064
3367
|
if (existsSync9(abs)) return true;
|
|
@@ -3120,7 +3423,7 @@ function classifyBilling(provider, source) {
|
|
|
3120
3423
|
function codexHome(env) {
|
|
3121
3424
|
const map = env ?? process.env;
|
|
3122
3425
|
const override = (map["CODEX_HOME"] ?? "").trim();
|
|
3123
|
-
return override !== "" ? override :
|
|
3426
|
+
return override !== "" ? override : path18.join(homeOf(env), ".codex");
|
|
3124
3427
|
}
|
|
3125
3428
|
function homeOf(env) {
|
|
3126
3429
|
const map = env ?? process.env;
|
|
@@ -3132,7 +3435,7 @@ var CLAUDE_KEYCHAIN_SERVICE = "Claude Code-credentials";
|
|
|
3132
3435
|
function defaultProbeKeychain(service) {
|
|
3133
3436
|
if (process.platform !== "darwin") return false;
|
|
3134
3437
|
try {
|
|
3135
|
-
const res =
|
|
3438
|
+
const res = spawnSync2("security", ["find-generic-password", "-s", service], {
|
|
3136
3439
|
timeout: VERSION_PROBE_TIMEOUT_MS,
|
|
3137
3440
|
encoding: "utf-8",
|
|
3138
3441
|
windowsHide: true,
|
|
@@ -3146,7 +3449,7 @@ function defaultProbeKeychain(service) {
|
|
|
3146
3449
|
}
|
|
3147
3450
|
function defaultProbeVersion(binary) {
|
|
3148
3451
|
try {
|
|
3149
|
-
const res =
|
|
3452
|
+
const res = spawnSync2(binary, ["--version"], {
|
|
3150
3453
|
timeout: VERSION_PROBE_TIMEOUT_MS,
|
|
3151
3454
|
encoding: "utf-8",
|
|
3152
3455
|
windowsHide: true,
|
|
@@ -3161,14 +3464,14 @@ ${res.stderr ?? ""}`;
|
|
|
3161
3464
|
}
|
|
3162
3465
|
function isFile3(p) {
|
|
3163
3466
|
try {
|
|
3164
|
-
return
|
|
3467
|
+
return fs14.statSync(p).isFile();
|
|
3165
3468
|
} catch {
|
|
3166
3469
|
return false;
|
|
3167
3470
|
}
|
|
3168
3471
|
}
|
|
3169
3472
|
function exists(p) {
|
|
3170
3473
|
try {
|
|
3171
|
-
return
|
|
3474
|
+
return fs14.existsSync(p);
|
|
3172
3475
|
} catch {
|
|
3173
3476
|
return false;
|
|
3174
3477
|
}
|
|
@@ -3176,7 +3479,7 @@ function exists(p) {
|
|
|
3176
3479
|
function classifyCodexAuth(authPath) {
|
|
3177
3480
|
let data;
|
|
3178
3481
|
try {
|
|
3179
|
-
data = JSON.parse(
|
|
3482
|
+
data = JSON.parse(fs14.readFileSync(authPath, "utf-8"));
|
|
3180
3483
|
} catch {
|
|
3181
3484
|
return "cli-api-key";
|
|
3182
3485
|
}
|
|
@@ -3193,7 +3496,7 @@ function cliSubscriptionEvidence(provider, home, env, claudeConfigDir, probeKeyc
|
|
|
3193
3496
|
if (provider === "anthropic") {
|
|
3194
3497
|
const configDir = claudeConfigDir;
|
|
3195
3498
|
for (const rel of [".credentials.json", "credentials.json"]) {
|
|
3196
|
-
const p =
|
|
3499
|
+
const p = path18.join(configDir, rel);
|
|
3197
3500
|
if (isFile3(p)) return { source: "cli-subscription", evidence: p };
|
|
3198
3501
|
}
|
|
3199
3502
|
if (probeKeychain(CLAUDE_KEYCHAIN_SERVICE)) {
|
|
@@ -3202,12 +3505,12 @@ function cliSubscriptionEvidence(provider, home, env, claudeConfigDir, probeKeyc
|
|
|
3202
3505
|
return null;
|
|
3203
3506
|
}
|
|
3204
3507
|
if (provider === "openai") {
|
|
3205
|
-
const p =
|
|
3508
|
+
const p = path18.join(codexHome(env), "auth.json");
|
|
3206
3509
|
if (isFile3(p)) return { source: classifyCodexAuth(p), evidence: p };
|
|
3207
3510
|
return null;
|
|
3208
3511
|
}
|
|
3209
3512
|
if (provider === "gemini") {
|
|
3210
|
-
const p =
|
|
3513
|
+
const p = path18.join(home, ".gemini", "oauth_creds.json");
|
|
3211
3514
|
if (isFile3(p)) return { source: "cli-subscription", evidence: p };
|
|
3212
3515
|
return null;
|
|
3213
3516
|
}
|
|
@@ -3239,7 +3542,7 @@ function detectHosts(opts) {
|
|
|
3239
3542
|
function detectAuth(opts) {
|
|
3240
3543
|
const env = opts.env ?? process.env;
|
|
3241
3544
|
const home = opts.home ?? homeOf(opts.env);
|
|
3242
|
-
const claudeConfigDir = opts.home === void 0 && opts.env === void 0 ? claude_config_dir() : (env["CLAUDE_CONFIG_DIR"] ?? "").trim() ||
|
|
3545
|
+
const claudeConfigDir = opts.home === void 0 && opts.env === void 0 ? claude_config_dir() : (env["CLAUDE_CONFIG_DIR"] ?? "").trim() || path18.join(home, ".claude");
|
|
3243
3546
|
const probeKeychain = opts.probeKeychain ?? defaultProbeKeychain;
|
|
3244
3547
|
const auth = [];
|
|
3245
3548
|
const keys = [];
|
|
@@ -3294,7 +3597,7 @@ function detectEnvironment(opts = {}) {
|
|
|
3294
3597
|
}
|
|
3295
3598
|
|
|
3296
3599
|
// src/scripts/_cli/detection_report.ts
|
|
3297
|
-
import * as
|
|
3600
|
+
import * as path19 from "node:path";
|
|
3298
3601
|
|
|
3299
3602
|
// src/scripts/ai_council/transport_resolver.ts
|
|
3300
3603
|
var VALID_TRANSPORT_MODES = /* @__PURE__ */ new Set([
|
|
@@ -3512,7 +3815,7 @@ function cliBinaryPresent(environment, provider, binaryOverride) {
|
|
|
3512
3815
|
const expected = PROVIDER_CLI_META[provider]?.[0];
|
|
3513
3816
|
if (expected === void 0) return false;
|
|
3514
3817
|
return environment.hosts.some(
|
|
3515
|
-
(h) => h.binary !== null && stripExe(
|
|
3818
|
+
(h) => h.binary !== null && stripExe(path19.basename(h.binary)) === expected
|
|
3516
3819
|
);
|
|
3517
3820
|
}
|
|
3518
3821
|
function stripExe(name) {
|
|
@@ -3673,9 +3976,9 @@ function absentCouncilFacts(configPath) {
|
|
|
3673
3976
|
|
|
3674
3977
|
// src/scripts/ai_team/review_gate.ts
|
|
3675
3978
|
import * as crypto from "node:crypto";
|
|
3676
|
-
import * as
|
|
3979
|
+
import * as fs15 from "node:fs";
|
|
3677
3980
|
import * as os3 from "node:os";
|
|
3678
|
-
import * as
|
|
3981
|
+
import * as path20 from "node:path";
|
|
3679
3982
|
|
|
3680
3983
|
// src/scripts/ai_team/config.ts
|
|
3681
3984
|
var AI_TEAM_REVIEW_GATE_DEFAULTS = Object.freeze({
|
|
@@ -3691,16 +3994,16 @@ var AI_TEAM_DEFAULTS = Object.freeze({
|
|
|
3691
3994
|
});
|
|
3692
3995
|
|
|
3693
3996
|
// src/scripts/ai_team/review_gate.ts
|
|
3694
|
-
var GATE_LEDGER_RELPATH =
|
|
3997
|
+
var GATE_LEDGER_RELPATH = path20.join("agents", "runtime", "team", "events.log");
|
|
3695
3998
|
var _CODEX_PLUGIN_DATA_DIRNAME = `${CODEX_PLUGIN_ID}-${CODEX_MARKETPLACE_NAME}`;
|
|
3696
3999
|
function _workspace_state_segment(workspace_root) {
|
|
3697
4000
|
let canonical = workspace_root;
|
|
3698
4001
|
try {
|
|
3699
|
-
canonical =
|
|
4002
|
+
canonical = fs15.realpathSync.native(workspace_root);
|
|
3700
4003
|
} catch {
|
|
3701
4004
|
canonical = workspace_root;
|
|
3702
4005
|
}
|
|
3703
|
-
const slug_source =
|
|
4006
|
+
const slug_source = path20.basename(workspace_root) || "workspace";
|
|
3704
4007
|
const slug = slug_source.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "workspace";
|
|
3705
4008
|
const hash = crypto.createHash("sha256").update(canonical).digest("hex").slice(0, 16);
|
|
3706
4009
|
return `${slug}-${hash}`;
|
|
@@ -3710,19 +4013,19 @@ function upstream_state_dir_candidates(workspace_root) {
|
|
|
3710
4013
|
const candidates = [];
|
|
3711
4014
|
const env = (process.env["CLAUDE_PLUGIN_DATA"] ?? "").trim();
|
|
3712
4015
|
if (env !== "") {
|
|
3713
|
-
candidates.push(
|
|
4016
|
+
candidates.push(path20.join(env, "state", segment));
|
|
3714
4017
|
}
|
|
3715
4018
|
candidates.push(
|
|
3716
|
-
|
|
4019
|
+
path20.join(claude_config_dir(), "plugins", "data", _CODEX_PLUGIN_DATA_DIRNAME, "state", segment)
|
|
3717
4020
|
);
|
|
3718
|
-
candidates.push(
|
|
4021
|
+
candidates.push(path20.join(os3.tmpdir(), "codex-companion", segment));
|
|
3719
4022
|
return candidates;
|
|
3720
4023
|
}
|
|
3721
4024
|
function upstream_gate_enabled(workspace_root) {
|
|
3722
4025
|
for (const dir of upstream_state_dir_candidates(workspace_root)) {
|
|
3723
4026
|
let parsed;
|
|
3724
4027
|
try {
|
|
3725
|
-
parsed = JSON.parse(
|
|
4028
|
+
parsed = JSON.parse(fs15.readFileSync(path20.join(dir, "state.json"), "utf-8"));
|
|
3726
4029
|
} catch {
|
|
3727
4030
|
continue;
|
|
3728
4031
|
}
|
|
@@ -3879,13 +4182,13 @@ var ArgparseExit = class extends Error {
|
|
|
3879
4182
|
function expanduser(p) {
|
|
3880
4183
|
if (p === "~") return os4.homedir();
|
|
3881
4184
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
3882
|
-
return
|
|
4185
|
+
return path21.join(os4.homedir(), p.slice(2));
|
|
3883
4186
|
}
|
|
3884
4187
|
return p;
|
|
3885
4188
|
}
|
|
3886
|
-
function
|
|
4189
|
+
function pathExists2(p) {
|
|
3887
4190
|
try {
|
|
3888
|
-
|
|
4191
|
+
fs16.statSync(p);
|
|
3889
4192
|
return true;
|
|
3890
4193
|
} catch {
|
|
3891
4194
|
return false;
|
|
@@ -3893,27 +4196,27 @@ function pathExists(p) {
|
|
|
3893
4196
|
}
|
|
3894
4197
|
function isFile4(p) {
|
|
3895
4198
|
try {
|
|
3896
|
-
return
|
|
4199
|
+
return fs16.statSync(p).isFile();
|
|
3897
4200
|
} catch {
|
|
3898
4201
|
return false;
|
|
3899
4202
|
}
|
|
3900
4203
|
}
|
|
3901
4204
|
function isDir3(p) {
|
|
3902
4205
|
try {
|
|
3903
|
-
return
|
|
4206
|
+
return fs16.statSync(p).isDirectory();
|
|
3904
4207
|
} catch {
|
|
3905
4208
|
return false;
|
|
3906
4209
|
}
|
|
3907
4210
|
}
|
|
3908
4211
|
function resolvePath(p) {
|
|
3909
4212
|
try {
|
|
3910
|
-
return
|
|
4213
|
+
return fs16.realpathSync(path21.resolve(p));
|
|
3911
4214
|
} catch {
|
|
3912
|
-
return
|
|
4215
|
+
return path21.resolve(p);
|
|
3913
4216
|
}
|
|
3914
4217
|
}
|
|
3915
4218
|
function readText(p) {
|
|
3916
|
-
return
|
|
4219
|
+
return fs16.readFileSync(p, "utf-8");
|
|
3917
4220
|
}
|
|
3918
4221
|
function _jsonStrAscii(s) {
|
|
3919
4222
|
let out = '"';
|
|
@@ -4024,7 +4327,7 @@ function _resolve_project_root(arg) {
|
|
|
4024
4327
|
}
|
|
4025
4328
|
var _INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
4026
4329
|
function _detect_install_mode(project_root) {
|
|
4027
|
-
const marker =
|
|
4330
|
+
const marker = path21.join(project_root, _INSTALL_MODE_MARKER_REL);
|
|
4028
4331
|
if (isFile4(marker)) {
|
|
4029
4332
|
let value;
|
|
4030
4333
|
try {
|
|
@@ -4036,9 +4339,9 @@ function _detect_install_mode(project_root) {
|
|
|
4036
4339
|
return [value, "marker-file"];
|
|
4037
4340
|
}
|
|
4038
4341
|
}
|
|
4039
|
-
const has_agents_md =
|
|
4040
|
-
const has_copilot =
|
|
4041
|
-
|
|
4342
|
+
const has_agents_md = pathExists2(path21.join(project_root, "AGENTS.md"));
|
|
4343
|
+
const has_copilot = pathExists2(
|
|
4344
|
+
path21.join(project_root, ".github", "copilot-instructions.md")
|
|
4042
4345
|
);
|
|
4043
4346
|
if (has_agents_md && has_copilot) {
|
|
4044
4347
|
return ["full", "heuristic"];
|
|
@@ -4058,8 +4361,8 @@ function _settings_layer_chain(project_root) {
|
|
|
4058
4361
|
return layers;
|
|
4059
4362
|
}
|
|
4060
4363
|
function _detect_wrapper(project_root) {
|
|
4061
|
-
const wrapper =
|
|
4062
|
-
if (!
|
|
4364
|
+
const wrapper = path21.join(project_root, "agent-config");
|
|
4365
|
+
if (!pathExists2(wrapper)) {
|
|
4063
4366
|
return { path: String(wrapper), exists: false, embedded_root: null };
|
|
4064
4367
|
}
|
|
4065
4368
|
return {
|
|
@@ -4125,14 +4428,14 @@ function _emit_context_text(ctx) {
|
|
|
4125
4428
|
}
|
|
4126
4429
|
function _resolve_path(project_root, raw) {
|
|
4127
4430
|
let p = expanduser(raw);
|
|
4128
|
-
if (!
|
|
4129
|
-
p =
|
|
4431
|
+
if (!path21.isAbsolute(p)) {
|
|
4432
|
+
p = path21.join(project_root, p);
|
|
4130
4433
|
}
|
|
4131
4434
|
return p;
|
|
4132
4435
|
}
|
|
4133
4436
|
function _sha256(p) {
|
|
4134
4437
|
try {
|
|
4135
|
-
const data =
|
|
4438
|
+
const data = fs16.readFileSync(p);
|
|
4136
4439
|
return crypto2.createHash("sha256").update(data).digest("hex");
|
|
4137
4440
|
} catch {
|
|
4138
4441
|
return null;
|
|
@@ -4141,7 +4444,7 @@ function _sha256(p) {
|
|
|
4141
4444
|
var PACKAGE_TAG_ID2 = "event4u/agent-config";
|
|
4142
4445
|
var _FRONTMATTER_PACKAGE_RE = /^package:\s*(.+?)\s*$/m;
|
|
4143
4446
|
function _read_inline_package_tag(p) {
|
|
4144
|
-
if (
|
|
4447
|
+
if (path21.extname(p) !== ".md") {
|
|
4145
4448
|
return NO_FRONTMATTER;
|
|
4146
4449
|
}
|
|
4147
4450
|
let text;
|
|
@@ -4242,7 +4545,7 @@ function _scan_foreign(project_root, manifest, known) {
|
|
|
4242
4545
|
const seen = /* @__PURE__ */ new Set();
|
|
4243
4546
|
for (const root_rel of roots) {
|
|
4244
4547
|
const root = _resolve_path(project_root, String(root_rel));
|
|
4245
|
-
if (!
|
|
4548
|
+
if (!pathExists2(root) || !isDir3(root)) {
|
|
4246
4549
|
continue;
|
|
4247
4550
|
}
|
|
4248
4551
|
for (const child of rglob(root)) {
|
|
@@ -4270,13 +4573,13 @@ function rglob(root) {
|
|
|
4270
4573
|
const walk = (dir) => {
|
|
4271
4574
|
let entries;
|
|
4272
4575
|
try {
|
|
4273
|
-
entries =
|
|
4576
|
+
entries = fs16.readdirSync(dir, { withFileTypes: true });
|
|
4274
4577
|
} catch {
|
|
4275
4578
|
return;
|
|
4276
4579
|
}
|
|
4277
4580
|
entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
4278
4581
|
for (const ent of entries) {
|
|
4279
|
-
const full =
|
|
4582
|
+
const full = path21.join(dir, ent.name);
|
|
4280
4583
|
out.push(full);
|
|
4281
4584
|
let dirLike = ent.isDirectory();
|
|
4282
4585
|
if (ent.isSymbolicLink()) {
|
|
@@ -4295,7 +4598,7 @@ function _classify(records) {
|
|
|
4295
4598
|
const modified = [];
|
|
4296
4599
|
const tag_drift = [];
|
|
4297
4600
|
for (const [tool_id, target, kind, expected] of records) {
|
|
4298
|
-
if (!
|
|
4601
|
+
if (!pathExists2(target)) {
|
|
4299
4602
|
missing.push({
|
|
4300
4603
|
tool: tool_id,
|
|
4301
4604
|
path: String(target),
|
|
@@ -4351,9 +4654,9 @@ function _foreign_records(project_root, foreign) {
|
|
|
4351
4654
|
return out;
|
|
4352
4655
|
}
|
|
4353
4656
|
function relativeTo(p, base) {
|
|
4354
|
-
const rel =
|
|
4657
|
+
const rel = path21.relative(base, p);
|
|
4355
4658
|
if (rel === "") return rel;
|
|
4356
|
-
if (rel.startsWith("..") ||
|
|
4659
|
+
if (rel.startsWith("..") || path21.isAbsolute(rel)) {
|
|
4357
4660
|
return null;
|
|
4358
4661
|
}
|
|
4359
4662
|
return rel;
|
|
@@ -4439,7 +4742,7 @@ var STATUS_SYMBOLS = {
|
|
|
4439
4742
|
var MIN_PYTHON = [3, 10];
|
|
4440
4743
|
function _check_scope(project_root) {
|
|
4441
4744
|
for (const marker of ["pnpm-workspace.yaml", "lerna.json"]) {
|
|
4442
|
-
if (
|
|
4745
|
+
if (pathExists2(path21.join(project_root, marker))) {
|
|
4443
4746
|
return {
|
|
4444
4747
|
id: "scope",
|
|
4445
4748
|
status: "warn",
|
|
@@ -4448,8 +4751,8 @@ function _check_scope(project_root) {
|
|
|
4448
4751
|
};
|
|
4449
4752
|
}
|
|
4450
4753
|
}
|
|
4451
|
-
const pkg =
|
|
4452
|
-
if (
|
|
4754
|
+
const pkg = path21.join(project_root, "package.json");
|
|
4755
|
+
if (pathExists2(pkg)) {
|
|
4453
4756
|
try {
|
|
4454
4757
|
const data = JSON.parse(readText(pkg));
|
|
4455
4758
|
if (data["workspaces"]) {
|
|
@@ -4474,7 +4777,7 @@ var _PLACEHOLDER_EMAIL_RE = /^(t@t\.t|.*@example\.(com|org)|.*@localhost)$/i;
|
|
|
4474
4777
|
var _PLACEHOLDER_NAME_RE = /^(t|test|user|nobody|x)$/i;
|
|
4475
4778
|
function _git_config_path(project_root) {
|
|
4476
4779
|
const common = git_common_dir(project_root);
|
|
4477
|
-
return common === null ? null :
|
|
4780
|
+
return common === null ? null : path21.join(common, "config");
|
|
4478
4781
|
}
|
|
4479
4782
|
function _parse_git_user(configText) {
|
|
4480
4783
|
let inUser = false;
|
|
@@ -4499,13 +4802,13 @@ function _parse_git_user(configText) {
|
|
|
4499
4802
|
}
|
|
4500
4803
|
function _check_git_identity(project_root) {
|
|
4501
4804
|
const cfgPath = _git_config_path(project_root);
|
|
4502
|
-
if (cfgPath === null || !
|
|
4805
|
+
if (cfgPath === null || !pathExists2(cfgPath)) {
|
|
4503
4806
|
return { id: "git-identity", status: "skipped", message: "not a git repository", remedy: "" };
|
|
4504
4807
|
}
|
|
4505
4808
|
let ident = _parse_git_user(readText(cfgPath));
|
|
4506
4809
|
if (ident.name === null && ident.email === null) {
|
|
4507
|
-
const globalCfg =
|
|
4508
|
-
if (
|
|
4810
|
+
const globalCfg = path21.join(os4.homedir(), ".gitconfig");
|
|
4811
|
+
if (pathExists2(globalCfg)) {
|
|
4509
4812
|
ident = _parse_git_user(readText(globalCfg));
|
|
4510
4813
|
}
|
|
4511
4814
|
}
|
|
@@ -4565,7 +4868,7 @@ function _package_root() {
|
|
|
4565
4868
|
}
|
|
4566
4869
|
function _current_package_version() {
|
|
4567
4870
|
try {
|
|
4568
|
-
const data = JSON.parse(readText(
|
|
4871
|
+
const data = JSON.parse(readText(path21.join(_package_root(), "package.json")));
|
|
4569
4872
|
const v = data["version"];
|
|
4570
4873
|
if (typeof v === "string" && v.trim()) {
|
|
4571
4874
|
return v.trim();
|
|
@@ -4609,7 +4912,7 @@ function _check_lockfile_freshness(manifest) {
|
|
|
4609
4912
|
};
|
|
4610
4913
|
}
|
|
4611
4914
|
function shutilWhich(name) {
|
|
4612
|
-
if (
|
|
4915
|
+
if (path21.dirname(name) !== "." && (name.includes("/") || name.includes("\\"))) {
|
|
4613
4916
|
return isExecutableFile(name) ? name : null;
|
|
4614
4917
|
}
|
|
4615
4918
|
const pathEnv = process3.env["PATH"] || "";
|
|
@@ -4622,12 +4925,12 @@ function shutilWhich(name) {
|
|
|
4622
4925
|
if (seenDirs.has(d)) continue;
|
|
4623
4926
|
seenDirs.add(d);
|
|
4624
4927
|
for (const ext of exts) {
|
|
4625
|
-
const candidate =
|
|
4928
|
+
const candidate = path21.join(d, name + (ext === "" ? "" : ext.toLowerCase() === ext ? ext : ext));
|
|
4626
4929
|
if (isExecutableFile(candidate)) {
|
|
4627
4930
|
return candidate;
|
|
4628
4931
|
}
|
|
4629
4932
|
if (ext !== "") {
|
|
4630
|
-
const upper =
|
|
4933
|
+
const upper = path21.join(d, name + ext);
|
|
4631
4934
|
if (isExecutableFile(upper)) return upper;
|
|
4632
4935
|
}
|
|
4633
4936
|
}
|
|
@@ -4636,10 +4939,10 @@ function shutilWhich(name) {
|
|
|
4636
4939
|
}
|
|
4637
4940
|
function isExecutableFile(p) {
|
|
4638
4941
|
try {
|
|
4639
|
-
const st =
|
|
4942
|
+
const st = fs16.statSync(p);
|
|
4640
4943
|
if (!st.isFile()) return false;
|
|
4641
4944
|
if (process3.platform === "win32") return true;
|
|
4642
|
-
|
|
4945
|
+
fs16.accessSync(p, fs16.constants.X_OK);
|
|
4643
4946
|
return true;
|
|
4644
4947
|
} catch {
|
|
4645
4948
|
return false;
|
|
@@ -4703,7 +5006,7 @@ function _check_claude_plugin() {
|
|
|
4703
5006
|
remedy: ""
|
|
4704
5007
|
};
|
|
4705
5008
|
}
|
|
4706
|
-
const projection =
|
|
5009
|
+
const projection = path21.join(os4.homedir(), ".claude", "skills");
|
|
4707
5010
|
const projection_present = isDir3(projection);
|
|
4708
5011
|
if (projection_present) {
|
|
4709
5012
|
return {
|
|
@@ -4740,8 +5043,8 @@ function _check_claude_command_wrappers() {
|
|
|
4740
5043
|
remedy: ""
|
|
4741
5044
|
};
|
|
4742
5045
|
}
|
|
4743
|
-
const anchor =
|
|
4744
|
-
const commands_dir =
|
|
5046
|
+
const anchor = path21.join(os4.homedir(), ".claude");
|
|
5047
|
+
const commands_dir = path21.join(anchor, "commands");
|
|
4745
5048
|
if (!isDir3(commands_dir)) {
|
|
4746
5049
|
return {
|
|
4747
5050
|
id: "claude-command-wrappers",
|
|
@@ -4750,8 +5053,8 @@ function _check_claude_command_wrappers() {
|
|
|
4750
5053
|
remedy: ""
|
|
4751
5054
|
};
|
|
4752
5055
|
}
|
|
4753
|
-
const flat_probe =
|
|
4754
|
-
const wrapper_probe =
|
|
5056
|
+
const flat_probe = fs16.existsSync(path21.join(commands_dir, "commit.md"));
|
|
5057
|
+
const wrapper_probe = fs16.existsSync(path21.join(anchor, "skills", "commit", "SKILL.md"));
|
|
4755
5058
|
if (wrapper_probe) {
|
|
4756
5059
|
return {
|
|
4757
5060
|
id: "claude-command-wrappers",
|
|
@@ -4776,7 +5079,7 @@ function _check_claude_command_wrappers() {
|
|
|
4776
5079
|
};
|
|
4777
5080
|
}
|
|
4778
5081
|
function _check_surface_state() {
|
|
4779
|
-
const matrix_path =
|
|
5082
|
+
const matrix_path = path21.join(_package_root(), "src", "config", "surface-matrix.yml");
|
|
4780
5083
|
if (!isFile4(matrix_path)) {
|
|
4781
5084
|
return {
|
|
4782
5085
|
id: "surface-state",
|
|
@@ -4800,7 +5103,7 @@ function _check_surface_state() {
|
|
|
4800
5103
|
remedy: "agent-config upgrade (reinstalls the package data files)"
|
|
4801
5104
|
};
|
|
4802
5105
|
}
|
|
4803
|
-
const _expand = (p) => p.startsWith("~/") ?
|
|
5106
|
+
const _expand = (p) => p.startsWith("~/") ? path21.join(os4.homedir(), p.slice(2)) : path21.join(_package_root(), p);
|
|
4804
5107
|
const violations = [];
|
|
4805
5108
|
const remedies = [];
|
|
4806
5109
|
let checked = 0;
|
|
@@ -4842,7 +5145,7 @@ function _check_surface_state() {
|
|
|
4842
5145
|
}
|
|
4843
5146
|
function pathExistsAny(p) {
|
|
4844
5147
|
try {
|
|
4845
|
-
|
|
5148
|
+
fs16.statSync(p);
|
|
4846
5149
|
return true;
|
|
4847
5150
|
} catch {
|
|
4848
5151
|
return false;
|
|
@@ -4888,8 +5191,8 @@ function _check_mcp_mode(project_root) {
|
|
|
4888
5191
|
];
|
|
4889
5192
|
const found = [];
|
|
4890
5193
|
for (const [rel, label] of candidates) {
|
|
4891
|
-
const p =
|
|
4892
|
-
if (!
|
|
5194
|
+
const p = path21.join(project_root, rel);
|
|
5195
|
+
if (!pathExists2(p)) {
|
|
4893
5196
|
continue;
|
|
4894
5197
|
}
|
|
4895
5198
|
try {
|
|
@@ -4919,23 +5222,7 @@ function _check_mcp_mode(project_root) {
|
|
|
4919
5222
|
remedy: ""
|
|
4920
5223
|
};
|
|
4921
5224
|
}
|
|
4922
|
-
|
|
4923
|
-
const script = path20.join(_package_root(), "src", "scripts", "hermetic-install.sh");
|
|
4924
|
-
if (!pathExists(script)) {
|
|
4925
|
-
return {
|
|
4926
|
-
id: "offline-readiness",
|
|
4927
|
-
status: "warn",
|
|
4928
|
-
message: "src/scripts/hermetic-install.sh not found in package",
|
|
4929
|
-
remedy: "reinstall @event4u/agent-config or pull missing files"
|
|
4930
|
-
};
|
|
4931
|
-
}
|
|
4932
|
-
return {
|
|
4933
|
-
id: "offline-readiness",
|
|
4934
|
-
status: "ok",
|
|
4935
|
-
message: "verified-offline install entrypoint present",
|
|
4936
|
-
remedy: ""
|
|
4937
|
-
};
|
|
4938
|
-
}
|
|
5225
|
+
var _check_offline_readiness = () => checkOfflineReadiness(_package_root());
|
|
4939
5226
|
function _check_stale_orphans() {
|
|
4940
5227
|
const gdi = global_deploy_inventory_exports;
|
|
4941
5228
|
const inv = gdi.load_inventory();
|
|
@@ -4978,7 +5265,7 @@ function _check_stale_orphans() {
|
|
|
4978
5265
|
(a, b) => a < b ? -1 : a > b ? 1 : 0
|
|
4979
5266
|
);
|
|
4980
5267
|
for (const root_name of ownedSorted) {
|
|
4981
|
-
const root =
|
|
5268
|
+
const root = path21.join(anchor, root_name);
|
|
4982
5269
|
if (!isDir3(root)) {
|
|
4983
5270
|
continue;
|
|
4984
5271
|
}
|
|
@@ -4993,7 +5280,7 @@ function _check_stale_orphans() {
|
|
|
4993
5280
|
if (rel === null) {
|
|
4994
5281
|
continue;
|
|
4995
5282
|
}
|
|
4996
|
-
const relPosix = rel.split(
|
|
5283
|
+
const relPosix = rel.split(path21.sep).join("/");
|
|
4997
5284
|
if (recorded_set.has(relPosix)) {
|
|
4998
5285
|
continue;
|
|
4999
5286
|
}
|
|
@@ -5048,14 +5335,14 @@ function _check_rule_scope_drift(project_root) {
|
|
|
5048
5335
|
let rules_dir = null;
|
|
5049
5336
|
let found = 0;
|
|
5050
5337
|
for (const rel of _RULE_PROJECTION_DIRS) {
|
|
5051
|
-
const cand =
|
|
5338
|
+
const cand = path21.join(project_root, rel);
|
|
5052
5339
|
if (!isDir3(cand)) {
|
|
5053
5340
|
continue;
|
|
5054
5341
|
}
|
|
5055
5342
|
let count = 0;
|
|
5056
5343
|
try {
|
|
5057
|
-
for (const name of
|
|
5058
|
-
if (name.endsWith(".md") && isFile4(
|
|
5344
|
+
for (const name of fs16.readdirSync(cand)) {
|
|
5345
|
+
if (name.endsWith(".md") && isFile4(path21.join(cand, name))) {
|
|
5059
5346
|
count += 1;
|
|
5060
5347
|
}
|
|
5061
5348
|
}
|
|
@@ -5109,14 +5396,14 @@ function _check_rule_scope_drift(project_root) {
|
|
|
5109
5396
|
};
|
|
5110
5397
|
}
|
|
5111
5398
|
function _check_duplicate_scope_rules(project_root, userRulesDirOverride) {
|
|
5112
|
-
const user_rules_dir = userRulesDirOverride ??
|
|
5399
|
+
const user_rules_dir = userRulesDirOverride ?? path21.join(os4.homedir(), ".claude", "rules");
|
|
5113
5400
|
let project_rules_dir = null;
|
|
5114
5401
|
if (_is_source_repo(project_root)) {
|
|
5115
|
-
const cand =
|
|
5402
|
+
const cand = path21.join(project_root, "dist", "agent-src", "rules");
|
|
5116
5403
|
if (isDir3(cand)) project_rules_dir = cand;
|
|
5117
5404
|
} else {
|
|
5118
5405
|
for (const rel of _RULE_PROJECTION_DIRS) {
|
|
5119
|
-
const cand =
|
|
5406
|
+
const cand = path21.join(project_root, rel);
|
|
5120
5407
|
if (isDir3(cand)) {
|
|
5121
5408
|
project_rules_dir = cand;
|
|
5122
5409
|
break;
|
|
@@ -5162,7 +5449,7 @@ function _check_mcp_beta_readiness(project_root) {
|
|
|
5162
5449
|
}
|
|
5163
5450
|
const pending = [];
|
|
5164
5451
|
for (const [gate_id, rel] of MCP_BETA_GATES) {
|
|
5165
|
-
if (!
|
|
5452
|
+
if (!pathExists2(path21.join(project_root, rel))) {
|
|
5166
5453
|
pending.push(`${gate_id} (${rel})`);
|
|
5167
5454
|
}
|
|
5168
5455
|
}
|
|
@@ -5183,7 +5470,7 @@ function _check_mcp_beta_readiness(project_root) {
|
|
|
5183
5470
|
}
|
|
5184
5471
|
function _check_tier_usage_readiness(project_root) {
|
|
5185
5472
|
const settings_file = project_settings_path(project_root);
|
|
5186
|
-
let log_path =
|
|
5473
|
+
let log_path = path21.join(project_root, ".agent-tier-usage.jsonl");
|
|
5187
5474
|
let enabled = false;
|
|
5188
5475
|
if (isFile4(settings_file)) {
|
|
5189
5476
|
let raw;
|
|
@@ -5202,7 +5489,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
5202
5489
|
const outputRaw = tu["output"];
|
|
5203
5490
|
const output = typeof outputRaw === "object" && outputRaw !== null && !Array.isArray(outputRaw) ? outputRaw : {};
|
|
5204
5491
|
if (typeof output["path"] === "string" && output["path"].trim()) {
|
|
5205
|
-
log_path =
|
|
5492
|
+
log_path = path21.join(project_root, output["path"].trim());
|
|
5206
5493
|
}
|
|
5207
5494
|
const val = tu["enabled"];
|
|
5208
5495
|
if (typeof val === "boolean") {
|
|
@@ -5223,11 +5510,11 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
5223
5510
|
remedy: "set `telemetry.tier_usage.enabled: true` in .agent-settings.yml (default-off; opt-in)"
|
|
5224
5511
|
};
|
|
5225
5512
|
}
|
|
5226
|
-
if (!
|
|
5513
|
+
if (!pathExists2(log_path)) {
|
|
5227
5514
|
return {
|
|
5228
5515
|
id: "tier-usage-readiness",
|
|
5229
5516
|
status: "warn",
|
|
5230
|
-
message: `tier-usage telemetry on but ${
|
|
5517
|
+
message: `tier-usage telemetry on but ${path21.basename(log_path)} not yet written \u2014 no signal accumulated`,
|
|
5231
5518
|
remedy: "run any tracked command to seed the log; the dispatcher writes one record per invocation"
|
|
5232
5519
|
};
|
|
5233
5520
|
}
|
|
@@ -5242,7 +5529,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
5242
5529
|
return {
|
|
5243
5530
|
id: "tier-usage-readiness",
|
|
5244
5531
|
status: "fail",
|
|
5245
|
-
message: `cannot read ${
|
|
5532
|
+
message: `cannot read ${path21.basename(log_path)}: ${osErrorStr(exc)}`,
|
|
5246
5533
|
remedy: "fix permissions on the tier-usage log"
|
|
5247
5534
|
};
|
|
5248
5535
|
}
|
|
@@ -5273,7 +5560,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
5273
5560
|
return {
|
|
5274
5561
|
id: "tier-usage-readiness",
|
|
5275
5562
|
status: "fail",
|
|
5276
|
-
message: `${total} record(s) in ${
|
|
5563
|
+
message: `${total} record(s) in ${path21.basename(log_path)} but 0 passed the privacy floor \u2014 report would refuse to render`,
|
|
5277
5564
|
remedy: "inspect the log; the dispatcher is writing records the contract forbids (paths, argv, message bodies)"
|
|
5278
5565
|
};
|
|
5279
5566
|
}
|
|
@@ -5281,19 +5568,19 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
5281
5568
|
return {
|
|
5282
5569
|
id: "tier-usage-readiness",
|
|
5283
5570
|
status: "warn",
|
|
5284
|
-
message: `${
|
|
5571
|
+
message: `${path21.basename(log_path)} present but empty \u2014 no signal yet`,
|
|
5285
5572
|
remedy: "run any tracked command to seed the log"
|
|
5286
5573
|
};
|
|
5287
5574
|
}
|
|
5288
5575
|
return {
|
|
5289
5576
|
id: "tier-usage-readiness",
|
|
5290
5577
|
status: "ok",
|
|
5291
|
-
message: `${valid} record(s) past the privacy floor in ${
|
|
5578
|
+
message: `${valid} record(s) past the privacy floor in ${path21.basename(log_path)} \u2014 retiering signal available`,
|
|
5292
5579
|
remedy: ""
|
|
5293
5580
|
};
|
|
5294
5581
|
}
|
|
5295
5582
|
function readText0(p) {
|
|
5296
|
-
return
|
|
5583
|
+
return fs16.readFileSync(p, "utf-8");
|
|
5297
5584
|
}
|
|
5298
5585
|
function osErrorStr(exc) {
|
|
5299
5586
|
if (exc && typeof exc === "object" && "message" in exc) {
|
|
@@ -5313,7 +5600,7 @@ function _check_council_cli(project_root) {
|
|
|
5313
5600
|
const { load_cli_call_counts: load_cli_call_counts2 } = clients_exports;
|
|
5314
5601
|
const { load_council_config, resolve_config_path } = config_exports;
|
|
5315
5602
|
const council_path = resolve_config_path(project_root);
|
|
5316
|
-
if (!
|
|
5603
|
+
if (!pathExists2(String(council_path))) {
|
|
5317
5604
|
return {
|
|
5318
5605
|
id: "council-cli",
|
|
5319
5606
|
status: "ok",
|
|
@@ -5423,7 +5710,7 @@ function _team_codex_binary_name(project_root) {
|
|
|
5423
5710
|
const default_bin = _CLI_PROVIDER_META["openai"][0];
|
|
5424
5711
|
const { load_council_config, resolve_config_path } = config_exports;
|
|
5425
5712
|
const council_path = resolve_config_path(project_root);
|
|
5426
|
-
if (!
|
|
5713
|
+
if (!pathExists2(String(council_path))) {
|
|
5427
5714
|
return default_bin;
|
|
5428
5715
|
}
|
|
5429
5716
|
let cfg;
|
|
@@ -5466,7 +5753,7 @@ function _epoch_seconds(value) {
|
|
|
5466
5753
|
function _codex_auth_expiry(auth_path) {
|
|
5467
5754
|
let data;
|
|
5468
5755
|
try {
|
|
5469
|
-
data = JSON.parse(
|
|
5756
|
+
data = JSON.parse(fs16.readFileSync(auth_path, "utf-8"));
|
|
5470
5757
|
} catch {
|
|
5471
5758
|
return null;
|
|
5472
5759
|
}
|
|
@@ -5504,7 +5791,7 @@ var _detection_memo = null;
|
|
|
5504
5791
|
function _read_council_facts(project_root) {
|
|
5505
5792
|
const { load_council_config, resolve_config_path } = config_exports;
|
|
5506
5793
|
const config_path = String(resolve_config_path(project_root));
|
|
5507
|
-
if (!
|
|
5794
|
+
if (!pathExists2(config_path)) {
|
|
5508
5795
|
return absentCouncilFacts(config_path);
|
|
5509
5796
|
}
|
|
5510
5797
|
let cfg;
|
|
@@ -5612,8 +5899,8 @@ function _check_team(project_root) {
|
|
|
5612
5899
|
if (binary_missing) {
|
|
5613
5900
|
remedies.push("install the codex CLI: `npm install -g @openai/codex`");
|
|
5614
5901
|
}
|
|
5615
|
-
const auth_path =
|
|
5616
|
-
const authed =
|
|
5902
|
+
const auth_path = path21.join(_codex_home(), "auth.json");
|
|
5903
|
+
const authed = pathExists2(auth_path);
|
|
5617
5904
|
let auth_str;
|
|
5618
5905
|
if (!authed) {
|
|
5619
5906
|
auth_str = `codex auth \u274C (${auth_path})`;
|
|
@@ -5629,7 +5916,7 @@ function _check_team(project_root) {
|
|
|
5629
5916
|
auth_str = `codex auth \u2705 (${auth_path})`;
|
|
5630
5917
|
}
|
|
5631
5918
|
}
|
|
5632
|
-
const is_claude_host = shutilWhich("claude") !== null ||
|
|
5919
|
+
const is_claude_host = shutilWhich("claude") !== null || pathExists2(claude_config_dir());
|
|
5633
5920
|
let plugin_str;
|
|
5634
5921
|
if (is_claude_host) {
|
|
5635
5922
|
const identity = codex_plugin_identity();
|
|
@@ -5700,11 +5987,11 @@ function _check_unsupported_combos(manifest) {
|
|
|
5700
5987
|
};
|
|
5701
5988
|
}
|
|
5702
5989
|
function _wizard_state_path() {
|
|
5703
|
-
return
|
|
5990
|
+
return path21.join(event4u_root(), "state", "wizard-state.json");
|
|
5704
5991
|
}
|
|
5705
5992
|
function _check_wizard_state() {
|
|
5706
5993
|
const state_pth = _wizard_state_path();
|
|
5707
|
-
if (!
|
|
5994
|
+
if (!pathExists2(state_pth)) {
|
|
5708
5995
|
return {
|
|
5709
5996
|
id: "wizard-state",
|
|
5710
5997
|
status: "ok",
|
|
@@ -5780,8 +6067,8 @@ function _check_wizard_state() {
|
|
|
5780
6067
|
};
|
|
5781
6068
|
}
|
|
5782
6069
|
function _check_settings_review_pending() {
|
|
5783
|
-
const delta_pth =
|
|
5784
|
-
if (!
|
|
6070
|
+
const delta_pth = path21.join(event4u_root(), "state", "settings-delta.json");
|
|
6071
|
+
if (!pathExists2(delta_pth)) {
|
|
5785
6072
|
return {
|
|
5786
6073
|
id: "settings-review-pending",
|
|
5787
6074
|
status: "ok",
|
|
@@ -5806,8 +6093,8 @@ function _check_settings_review_pending() {
|
|
|
5806
6093
|
}
|
|
5807
6094
|
function _check_memory_merge_union(project_root) {
|
|
5808
6095
|
const remedy = "run: npx tsx src/scripts/sync_gitattributes.ts (or `agent-config refresh --project`)";
|
|
5809
|
-
const target =
|
|
5810
|
-
if (!
|
|
6096
|
+
const target = path21.join(project_root, DEFAULT_GITATTRIBUTES);
|
|
6097
|
+
if (!pathExists2(target)) {
|
|
5811
6098
|
return {
|
|
5812
6099
|
id: "memory-merge-union",
|
|
5813
6100
|
status: "warn",
|
|
@@ -6079,7 +6366,8 @@ function _emit_json(project_root, missing, modified, foreign, tag_drift, checks
|
|
|
6079
6366
|
};
|
|
6080
6367
|
if (origin !== null) payload["project_root_origin"] = origin;
|
|
6081
6368
|
payload["execution"] = executionJson(() => iter_setting_overrides({ cwd: project_root }));
|
|
6082
|
-
payload["forge_protection"] =
|
|
6369
|
+
payload["forge_protection"] = forgeProtectionJsonFor(String(project_root));
|
|
6370
|
+
payload["traffic_environment"] = trafficEnvironmentJson(process3.env);
|
|
6083
6371
|
if (checks !== null) {
|
|
6084
6372
|
payload["checks"] = checks;
|
|
6085
6373
|
const drift = missing.length + modified.length + foreign.length + tag_drift.length;
|
|
@@ -6271,7 +6559,7 @@ function _run_anatomy(opts) {
|
|
|
6271
6559
|
try {
|
|
6272
6560
|
economyReport = economy.buildReport({
|
|
6273
6561
|
root: economy.DEFAULT_PROJECTS_ROOT,
|
|
6274
|
-
auditDir:
|
|
6562
|
+
auditDir: path21.join(process3.cwd(), economy.DEFAULT_AUDIT_DIR),
|
|
6275
6563
|
maxAgeDays: 14
|
|
6276
6564
|
});
|
|
6277
6565
|
} catch (err) {
|
|
@@ -6302,7 +6590,7 @@ function _run_repair(opts) {
|
|
|
6302
6590
|
const target = opts.repair;
|
|
6303
6591
|
if (target === "wizard-state") {
|
|
6304
6592
|
const state_pth = _wizard_state_path();
|
|
6305
|
-
const exists2 =
|
|
6593
|
+
const exists2 = pathExists2(state_pth);
|
|
6306
6594
|
const payload = {
|
|
6307
6595
|
id: "wizard-state",
|
|
6308
6596
|
path: String(state_pth),
|
|
@@ -6310,7 +6598,7 @@ function _run_repair(opts) {
|
|
|
6310
6598
|
};
|
|
6311
6599
|
if (exists2) {
|
|
6312
6600
|
try {
|
|
6313
|
-
|
|
6601
|
+
fs16.unlinkSync(state_pth);
|
|
6314
6602
|
} catch (exc) {
|
|
6315
6603
|
payload["action"] = "error";
|
|
6316
6604
|
payload["error"] = osErrorStr(exc);
|
|
@@ -6417,17 +6705,17 @@ function _isCliEntry2() {
|
|
|
6417
6705
|
return false;
|
|
6418
6706
|
}
|
|
6419
6707
|
if (cliDelegate) {
|
|
6420
|
-
if (
|
|
6708
|
+
if (path21.basename(process3.argv[1], ".js") === "cmd_doctor") {
|
|
6421
6709
|
return true;
|
|
6422
6710
|
}
|
|
6423
6711
|
}
|
|
6424
|
-
const argvUrl = pathToFileURL6(
|
|
6712
|
+
const argvUrl = pathToFileURL6(path21.resolve(process3.argv[1])).href;
|
|
6425
6713
|
if (import.meta.url === argvUrl) {
|
|
6426
6714
|
return true;
|
|
6427
6715
|
}
|
|
6428
6716
|
try {
|
|
6429
|
-
const here =
|
|
6430
|
-
const argv =
|
|
6717
|
+
const here = fs16.realpathSync(fileURLToPath5(import.meta.url));
|
|
6718
|
+
const argv = fs16.realpathSync(path21.resolve(process3.argv[1]));
|
|
6431
6719
|
return here === argv;
|
|
6432
6720
|
} catch {
|
|
6433
6721
|
return false;
|