@event4u/agent-config 9.26.0 → 9.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/AGENTS.md +12 -11
- package/CHANGELOG.md +134 -207
- package/README.md +1 -1
- package/dist/agent-src/commands/analyze/conformance.md +43 -0
- package/dist/agent-src/commands/roadmap/next.md +65 -3
- package/dist/agent-src/contexts/execution/orchestration-telemetry.md +10 -3
- package/dist/agent-src/rules/active-remediation.md +2 -0
- package/dist/agent-src/rules/analysis-skill-routing.md +2 -0
- package/dist/agent-src/rules/architecture.md +2 -0
- package/dist/agent-src/rules/artifact-drafting-protocol.md +2 -0
- package/dist/agent-src/rules/artifact-engagement-recording.md +6 -1
- package/dist/agent-src/rules/augment-edit-discipline.md +2 -0
- package/dist/agent-src/rules/autonomous-execution.md +3 -1
- package/dist/agent-src/rules/brand-consistency.md +2 -0
- package/dist/agent-src/rules/brand-source-of-truth.md +35 -6
- package/dist/agent-src/rules/broken-access-control.md +2 -0
- package/dist/agent-src/rules/cli-output-handling.md +2 -0
- package/dist/agent-src/rules/code-comment-discipline.md +2 -0
- package/dist/agent-src/rules/code-provenance.md +2 -0
- package/dist/agent-src/rules/command-suggestion-policy.md +2 -0
- package/dist/agent-src/rules/commit-conventions.md +2 -0
- package/dist/agent-src/rules/communication-through-line.md +2 -0
- package/dist/agent-src/rules/content-quoting-floor.md +2 -0
- package/dist/agent-src/rules/context-hygiene.md +13 -1
- package/dist/agent-src/rules/copilot-routing.md +2 -0
- package/dist/agent-src/rules/council-availability.md +93 -0
- package/dist/agent-src/rules/cross-source-consistency.md +5 -0
- package/dist/agent-src/rules/decision-revisit-gate.md +2 -0
- package/dist/agent-src/rules/delegation-policy.md +31 -5
- package/dist/agent-src/rules/design-fidelity.md +5 -0
- package/dist/agent-src/rules/design-review-after-ui-write.md +4 -0
- package/dist/agent-src/rules/devcontainer-routing.md +2 -0
- package/dist/agent-src/rules/doc-screenshot-hygiene.md +2 -0
- package/dist/agent-src/rules/docker-commands.md +2 -0
- package/dist/agent-src/rules/domain-adoption-policy.md +2 -0
- package/dist/agent-src/rules/domain-safety-disclaimer.md +2 -0
- package/dist/agent-src/rules/domain-safety-pii.md +2 -0
- package/dist/agent-src/rules/domain-safety-retention.md +2 -0
- package/dist/agent-src/rules/downstream-changes.md +2 -0
- package/dist/agent-src/rules/engineering-safety-floor.md +2 -0
- package/dist/agent-src/rules/evaluator-independence.md +14 -3
- package/dist/agent-src/rules/external-code-graph-interop.md +4 -1
- package/dist/agent-src/rules/external-reference-deep-dive.md +2 -0
- package/dist/agent-src/rules/fast-path-marker-visibility.md +2 -0
- package/dist/agent-src/rules/finance-safety-floor.md +3 -1
- package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +2 -0
- package/dist/agent-src/rules/git-history-discipline.md +3 -1
- package/dist/agent-src/rules/guidelines.md +2 -0
- package/dist/agent-src/rules/history-discipline.md +5 -1
- package/dist/agent-src/rules/icon-consistency.md +2 -0
- package/dist/agent-src/rules/image-likeness-and-rights.md +2 -0
- package/dist/agent-src/rules/improve-before-implement.md +2 -0
- package/dist/agent-src/rules/invite-challenge.md +2 -0
- package/dist/agent-src/rules/laravel-routing.md +2 -0
- package/dist/agent-src/rules/laravel-translations.md +2 -0
- package/dist/agent-src/rules/legal-safety-floor.md +3 -1
- package/dist/agent-src/rules/lethal-trifecta-guard.md +2 -0
- package/dist/agent-src/rules/linked-projects-onboarding-gate.md +2 -0
- package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +2 -0
- package/dist/agent-src/rules/markdown-safe-codeblocks.md +2 -0
- package/dist/agent-src/rules/media-governance-routing.md +2 -0
- package/dist/agent-src/rules/media-sync-ground-truth.md +2 -0
- package/dist/agent-src/rules/minimal-safe-diff.md +2 -0
- package/dist/agent-src/rules/missing-tool-handling.md +2 -0
- package/dist/agent-src/rules/model-recommendation.md +2 -0
- package/dist/agent-src/rules/no-attribution-footers.md +2 -0
- package/dist/agent-src/rules/no-decorative-emojis-in-git-surfaces.md +2 -0
- package/dist/agent-src/rules/no-pr-progress-comments.md +5 -1
- package/dist/agent-src/rules/no-roadmap-references.md +2 -0
- package/dist/agent-src/rules/notes-first-reasoning.md +2 -0
- package/dist/agent-src/rules/onboarding-gate.md +5 -1
- package/dist/agent-src/rules/output-discipline.md +2 -0
- package/dist/agent-src/rules/package-ci-checks.md +2 -0
- package/dist/agent-src/rules/persona-governance.md +2 -0
- package/dist/agent-src/rules/php-coding.md +2 -0
- package/dist/agent-src/rules/prefer-enums-over-literals.md +2 -0
- package/dist/agent-src/rules/preservation-guard.md +2 -0
- package/dist/agent-src/rules/provider-lifecycle-discipline.md +2 -0
- package/dist/agent-src/rules/question-not-instruction.md +2 -0
- package/dist/agent-src/rules/reviewer-awareness.md +2 -0
- package/dist/agent-src/rules/roadmap-ci-steps-policy.md +6 -1
- package/dist/agent-src/rules/roadmap-progress-sync.md +2 -0
- package/dist/agent-src/rules/role-mode-adherence.md +3 -1
- package/dist/agent-src/rules/rule-type-governance.md +2 -0
- package/dist/agent-src/rules/runtime-safety.md +2 -0
- package/dist/agent-src/rules/scale-discipline.md +5 -1
- package/dist/agent-src/rules/secret-vcs-guard.md +2 -0
- package/dist/agent-src/rules/security-sensitive-stop.md +2 -0
- package/dist/agent-src/rules/self-repair-loop.md +103 -0
- package/dist/agent-src/rules/senior-engineering-discipline.md +2 -0
- package/dist/agent-src/rules/session-canary.md +62 -19
- package/dist/agent-src/rules/settings-ask-protocol.md +4 -0
- package/dist/agent-src/rules/size-enforcement.md +2 -0
- package/dist/agent-src/rules/skill-improvement-trigger.md +2 -0
- package/dist/agent-src/rules/skill-quality.md +2 -0
- package/dist/agent-src/rules/slash-command-routing-policy.md +2 -0
- package/dist/agent-src/rules/source-confidentiality.md +2 -0
- package/dist/agent-src/rules/source-discovery-gate.md +2 -0
- package/dist/agent-src/rules/source-of-truth.md +2 -0
- package/dist/agent-src/rules/spreadsheet-source-quality.md +2 -0
- package/dist/agent-src/rules/strategy-safety-floor.md +3 -1
- package/dist/agent-src/rules/symfony-routing.md +2 -0
- package/dist/agent-src/rules/think-before-action.md +2 -0
- package/dist/agent-src/rules/token-budget-discipline.md +5 -1
- package/dist/agent-src/rules/token-efficiency.md +2 -0
- package/dist/agent-src/rules/token-optimizer-maintenance.md +2 -0
- package/dist/agent-src/rules/tool-safety.md +7 -1
- package/dist/agent-src/rules/ui-audit-gate.md +4 -0
- package/dist/agent-src/rules/untrusted-input-defense.md +2 -0
- package/dist/agent-src/rules/upstream-proposal.md +2 -0
- package/dist/agent-src/rules/user-interaction.md +2 -0
- package/dist/agent-src/rules/user-interrupt-priority.md +2 -0
- package/dist/agent-src/skills/adversarial-review/SKILL.md +1 -1
- package/dist/agent-src/skills/analysis-autonomous-mode/SKILL.md +1 -1
- package/dist/agent-src/skills/performance-analysis/SKILL.md +1 -1
- package/dist/agent-src/skills/persona-improvement/SKILL.md +1 -1
- package/dist/agent-src/skills/project-analyzer/SKILL.md +1 -1
- package/dist/agent-src/skills/security-audit/SKILL.md +1 -1
- package/dist/agent-src/skills/sequential-thinking/SKILL.md +1 -1
- package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +1 -1
- package/dist/agent-src/skills/universal-project-analysis/SKILL.md +1 -1
- package/dist/agent-src/templates/AGENTS.md +6 -10
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/cli/registry.js +9 -0
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/chunk-22GCIJ2O.js +270 -0
- package/dist/cli-delegate/{chunk-BSLUHV2F.js → chunk-2BE5I2MN.js} +156 -141
- package/dist/cli-delegate/{chunk-AIIUU73N.js → chunk-7OMQCH4V.js} +1 -1
- package/dist/cli-delegate/{chunk-HJ6DAJHR.js → chunk-GB2FSUEE.js} +57 -7
- package/dist/cli-delegate/{chunk-WR6GTRHJ.js → chunk-JXARCGVN.js} +3 -3
- package/dist/cli-delegate/{chunk-SJQMJI7M.js → chunk-PQSAQKHW.js} +467 -305
- package/dist/cli-delegate/chunk-REKCMYOU.js +2991 -0
- package/dist/cli-delegate/cmd_analyze_session.js +1 -1
- package/dist/cli-delegate/cmd_brand_status.js +134 -0
- package/dist/cli-delegate/cmd_conformance.js +7 -7
- package/dist/cli-delegate/cmd_converge.js +3 -3
- package/dist/cli-delegate/cmd_doctor.js +4 -4
- package/dist/cli-delegate/cmd_explain.js +80 -330
- package/dist/cli-delegate/cmd_export.js +5 -5
- package/dist/cli-delegate/cmd_fleet.js +3 -3
- package/dist/cli-delegate/cmd_handoff.js +2 -2
- package/dist/cli-delegate/cmd_mcp_available.js +433 -0
- package/dist/cli-delegate/cmd_migrate.js +3 -3
- package/dist/cli-delegate/cmd_packs_active.js +153 -0
- package/dist/cli-delegate/cmd_preflight.js +1 -1
- package/dist/cli-delegate/cmd_prune.js +5 -5
- package/dist/cli-delegate/cmd_route_audit.js +8 -8
- package/dist/cli-delegate/cmd_route_explain.js +4 -4
- package/dist/cli-delegate/cmd_settings_get.js +272 -0
- package/dist/cli-delegate/cmd_settings_migrate.js +5 -5
- package/dist/cli-delegate/cmd_settings_set.js +7 -2967
- package/dist/cli-delegate/cmd_sync.js +5 -5
- package/dist/cli-delegate/cmd_uninstall.js +5 -5
- package/dist/cli-delegate/cmd_update.js +4 -4
- package/dist/cli-delegate/cmd_upgrade.js +4 -4
- package/dist/cli-delegate/cmd_validate.js +5 -5
- package/dist/cli-delegate/cmd_versions.js +4 -4
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +184 -124
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +3 -3
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +7 -5
- package/dist/discovery/trust-report.md +11 -11
- package/dist/discovery/workspaces.json +6 -4
- package/dist/hooks/dispatch.js +9080 -5701
- package/dist/install/install.mjs +698 -508
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +698 -437
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/agent_settings.js +80 -15
- package/dist/scripts/_lib/agent_settings.js.map +1 -1
- package/dist/scripts/condense.js +33 -2
- package/dist/scripts/condense.js.map +1 -1
- package/dist/server/io/yamlIO.js +85 -0
- package/dist/server/io/yamlIO.js.map +1 -1
- package/dist/server/routes/settings.js +1 -12
- package/dist/server/routes/settings.js.map +1 -1
- package/dist/server/routes/wizard.js +52 -2
- package/dist/server/routes/wizard.js.map +1 -1
- package/dist/shared/settingsCarveOut.js +118 -0
- package/dist/shared/settingsCarveOut.js.map +1 -0
- package/dist/shared/settingsSurface.js +7 -1
- package/dist/shared/settingsSurface.js.map +1 -1
- package/dist/ui/assets/index-DmR0mbk4.js.map +1 -1
- package/docs/contracts/settings-classes.md +29 -8
- package/docs/guidelines/agent-infra/memory-access.md +14 -3
- package/package.json +1 -1
- package/src/agent-src/templates/AGENTS.md +6 -10
- package/src/config/budgets.yml +29 -0
- package/src/config/evaluator-budgets.json +4 -4
- package/src/config/gate-coverage.yml +26 -0
- package/src/scripts/_cli/cmd_brand_status.ts +174 -0
- package/src/scripts/_cli/cmd_doctor.ts +6 -21
- package/src/scripts/_cli/cmd_mcp_available.ts +266 -0
- package/src/scripts/_cli/cmd_packs_active.ts +225 -0
- package/src/scripts/_cli/cmd_settings_get.ts +324 -0
- package/src/scripts/_dispatch.bash +75 -0
- package/src/scripts/_lib/agent_settings.ts +82 -16
- package/src/scripts/_lib/carrier_divergence.ts +135 -0
- package/src/scripts/_lib/git_common_dir.ts +128 -0
- package/src/scripts/_lib/host_capability.ts +84 -1
- package/src/scripts/_lib/obligation_frequency.ts +391 -0
- package/src/scripts/_lib/prompt_shape.ts +88 -0
- package/src/scripts/_lib/review_skipped_record.ts +102 -0
- package/src/scripts/_lib/rule_layer_overlap.ts +254 -0
- package/src/scripts/_lib/self_repair.ts +342 -0
- package/src/scripts/_lib/self_repair_store.ts +100 -0
- package/src/scripts/_lib/session_register.ts +361 -0
- package/src/scripts/_lib/transcript_entry.ts +80 -0
- package/src/scripts/check_branch_freshness.ts +255 -0
- package/src/scripts/check_council_config_location.ts +125 -1
- package/src/scripts/check_enforcement_coverage.ts +192 -7
- package/src/scripts/check_rule_projection_integrity.ts +364 -0
- package/src/scripts/check_standing_rule_delivery.ts +314 -0
- package/src/scripts/condense.ts +36 -2
- package/src/scripts/config/profiles.ts +13 -3
- package/src/scripts/conformance_scan.ts +307 -24
- package/src/scripts/council_availability_hook.ts +188 -0
- package/src/scripts/council_cli.ts +126 -7
- package/src/scripts/generate_settings_reference.ts +232 -0
- package/src/scripts/hook_manifest.yaml +155 -33
- package/src/scripts/hooks/block_no_verify.ts +95 -3
- package/src/scripts/hooks/block_unauthorized_git.ts +217 -2
- package/src/scripts/hooks/concern_registry.ts +12 -0
- package/src/scripts/hooks/delegation_nudge_hook.ts +450 -0
- package/src/scripts/hooks/end_review_nudge_hook.ts +726 -0
- package/src/scripts/hooks/orchestration_record_hook.ts +342 -0
- package/src/scripts/install.ts +151 -0
- package/src/scripts/language_mirror_hook.ts +49 -6
- package/src/scripts/measure_scope_dedup.ts +19 -13
- package/src/scripts/onboarding_gate_hook.ts +40 -1
- package/src/scripts/orchestration_backfill.ts +354 -0
- package/src/scripts/orchestration_record.ts +4 -1
- package/src/scripts/preamble_byte_census.ts +9 -20
- package/src/scripts/release.ts +142 -36
- package/src/scripts/report_carrier_divergence.ts +364 -0
- package/src/scripts/report_skill_activation.ts +257 -0
- package/src/scripts/report_skill_obligation_violations.ts +579 -0
- package/src/scripts/routing_doctor.ts +77 -6
- package/src/scripts/schemas/rule.schema.json +5 -0
- package/src/scripts/self_repair_cli.ts +240 -0
- package/src/scripts/self_repair_hook.ts +241 -0
- package/src/scripts/session_canary_hook.ts +35 -3
- package/src/scripts/session_register_hook.ts +288 -0
- package/src/scripts/sessions_cli.ts +140 -0
- package/src/scripts/validate_frontmatter.ts +68 -0
- package/src/server/io/yamlIO.ts +87 -0
- package/src/shared/settingsCarveOut.ts +143 -0
- package/src/shared/settingsSurface.ts +7 -1
|
@@ -10,6 +10,10 @@ import {
|
|
|
10
10
|
claude_plugin_snapshot_version,
|
|
11
11
|
codex_plugin_identity
|
|
12
12
|
} from "./chunk-FTAISGDQ.js";
|
|
13
|
+
import {
|
|
14
|
+
config_exports,
|
|
15
|
+
hardenedSpawnEnv
|
|
16
|
+
} from "./chunk-VSYT7OHO.js";
|
|
13
17
|
import {
|
|
14
18
|
DEFAULT_GITATTRIBUTES,
|
|
15
19
|
SECTION_HEADER,
|
|
@@ -32,13 +36,6 @@ import {
|
|
|
32
36
|
excludedRuleBasenames,
|
|
33
37
|
ruleScopeFromSettings
|
|
34
38
|
} from "./chunk-NXFWFAYV.js";
|
|
35
|
-
import {
|
|
36
|
-
resolvePackageRoot
|
|
37
|
-
} from "./chunk-MCJYCQPF.js";
|
|
38
|
-
import {
|
|
39
|
-
config_exports,
|
|
40
|
-
hardenedSpawnEnv
|
|
41
|
-
} from "./chunk-VSYT7OHO.js";
|
|
42
39
|
import {
|
|
43
40
|
PROJECT_ROOT_ENV,
|
|
44
41
|
ProjectRootError,
|
|
@@ -46,7 +43,7 @@ import {
|
|
|
46
43
|
find_project_root_with_trace,
|
|
47
44
|
project_settings_path,
|
|
48
45
|
resolve_project_root
|
|
49
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-GB2FSUEE.js";
|
|
50
47
|
import {
|
|
51
48
|
event4u_root,
|
|
52
49
|
resolve_with_fallback,
|
|
@@ -55,6 +52,9 @@ import {
|
|
|
55
52
|
import {
|
|
56
53
|
require_dist
|
|
57
54
|
} from "./chunk-OY53J6II.js";
|
|
55
|
+
import {
|
|
56
|
+
resolvePackageRoot
|
|
57
|
+
} from "./chunk-MCJYCQPF.js";
|
|
58
58
|
import {
|
|
59
59
|
__export,
|
|
60
60
|
__toESM
|
|
@@ -63,9 +63,9 @@ import {
|
|
|
63
63
|
// src/scripts/_cli/cmd_doctor.ts
|
|
64
64
|
var YAML = __toESM(require_dist(), 1);
|
|
65
65
|
import * as crypto3 from "node:crypto";
|
|
66
|
-
import * as
|
|
66
|
+
import * as fs7 from "node:fs";
|
|
67
67
|
import * as os3 from "node:os";
|
|
68
|
-
import * as
|
|
68
|
+
import * as path8 from "node:path";
|
|
69
69
|
import process2 from "node:process";
|
|
70
70
|
import { fileURLToPath as fileURLToPath2, pathToFileURL } from "node:url";
|
|
71
71
|
|
|
@@ -108,6 +108,39 @@ function censusDuplicateScope(userRulesDir, projectRulesDir) {
|
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
// src/scripts/_lib/git_common_dir.ts
|
|
112
|
+
import fs2 from "node:fs";
|
|
113
|
+
import path2 from "node:path";
|
|
114
|
+
function realpath_or_self(p) {
|
|
115
|
+
try {
|
|
116
|
+
return fs2.realpathSync(p);
|
|
117
|
+
} catch {
|
|
118
|
+
return p;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function git_common_dir(project_root) {
|
|
122
|
+
const dot_git = path2.join(project_root, ".git");
|
|
123
|
+
try {
|
|
124
|
+
const st = fs2.statSync(dot_git);
|
|
125
|
+
if (st.isDirectory()) {
|
|
126
|
+
return realpath_or_self(dot_git);
|
|
127
|
+
}
|
|
128
|
+
const m = fs2.readFileSync(dot_git, "utf-8").match(/^gitdir:\s*(.+)\s*$/m);
|
|
129
|
+
if (m === null) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
const gitdir = path2.resolve(project_root, m[1].trim());
|
|
133
|
+
const commondir_file = path2.join(gitdir, "commondir");
|
|
134
|
+
if (fs2.existsSync(commondir_file)) {
|
|
135
|
+
const common = path2.resolve(gitdir, fs2.readFileSync(commondir_file, "utf-8").trim());
|
|
136
|
+
return realpath_or_self(common);
|
|
137
|
+
}
|
|
138
|
+
return realpath_or_self(gitdir);
|
|
139
|
+
} catch {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
111
144
|
// src/scripts/ai_council/clients.ts
|
|
112
145
|
var clients_exports = {};
|
|
113
146
|
__export(clients_exports, {
|
|
@@ -164,13 +197,13 @@ __export(clients_exports, {
|
|
|
164
197
|
reset_cli_call_counts: () => reset_cli_call_counts
|
|
165
198
|
});
|
|
166
199
|
import { spawnSync } from "node:child_process";
|
|
167
|
-
import * as
|
|
168
|
-
import * as
|
|
200
|
+
import * as fs4 from "node:fs";
|
|
201
|
+
import * as path4 from "node:path";
|
|
169
202
|
|
|
170
203
|
// src/scripts/ai_council/events_log.ts
|
|
171
204
|
import * as crypto from "node:crypto";
|
|
172
|
-
import * as
|
|
173
|
-
import * as
|
|
205
|
+
import * as fs3 from "node:fs";
|
|
206
|
+
import * as path3 from "node:path";
|
|
174
207
|
import { fileURLToPath } from "node:url";
|
|
175
208
|
var SCHEMA_VERSION = 1;
|
|
176
209
|
var _VALID_ACTIONS = /* @__PURE__ */ new Set([
|
|
@@ -180,8 +213,8 @@ var _VALID_ACTIONS = /* @__PURE__ */ new Set([
|
|
|
180
213
|
]);
|
|
181
214
|
var _KILL_SWITCH_ENV = "AGENT_CONFIG_NO_EVENTS_LOG";
|
|
182
215
|
var _HERE = fileURLToPath(import.meta.url);
|
|
183
|
-
var _REPO_ROOT =
|
|
184
|
-
var _DEFAULT_LOG_PATH =
|
|
216
|
+
var _REPO_ROOT = path3.resolve(path3.dirname(_HERE), "..", "..", "..");
|
|
217
|
+
var _DEFAULT_LOG_PATH = path3.join(
|
|
185
218
|
_REPO_ROOT,
|
|
186
219
|
"agents",
|
|
187
220
|
"runtime",
|
|
@@ -282,9 +315,9 @@ function appendEvent(event, opts = {}) {
|
|
|
282
315
|
}
|
|
283
316
|
}
|
|
284
317
|
const target = opts.logPath != null ? opts.logPath : _DEFAULT_LOG_PATH;
|
|
285
|
-
|
|
318
|
+
fs3.mkdirSync(path3.dirname(target), { recursive: true });
|
|
286
319
|
const line = _pyJsonDumpsCompact(record);
|
|
287
|
-
|
|
320
|
+
fs3.appendFileSync(target, line + "\n", { encoding: "utf-8" });
|
|
288
321
|
return true;
|
|
289
322
|
}
|
|
290
323
|
function _isoSecondsZ(d) {
|
|
@@ -468,13 +501,13 @@ function _setMonotonicSource(fn) {
|
|
|
468
501
|
return prev;
|
|
469
502
|
}
|
|
470
503
|
function _loadKey(p, prefix, installScript) {
|
|
471
|
-
if (!
|
|
504
|
+
if (!fs4.existsSync(p)) {
|
|
472
505
|
throw new KeyGateError(
|
|
473
506
|
`Key not found at ${p}.
|
|
474
507
|
Install it with: bash ${installScript}`
|
|
475
508
|
);
|
|
476
509
|
}
|
|
477
|
-
const st =
|
|
510
|
+
const st = fs4.statSync(p);
|
|
478
511
|
const mode = st.mode & 511;
|
|
479
512
|
if (mode !== 384) {
|
|
480
513
|
throw new KeyGateError(
|
|
@@ -482,7 +515,7 @@ function _loadKey(p, prefix, installScript) {
|
|
|
482
515
|
Fix: chmod 600 ${p}`
|
|
483
516
|
);
|
|
484
517
|
}
|
|
485
|
-
const key =
|
|
518
|
+
const key = fs4.readFileSync(p, { encoding: "utf-8" }).trim();
|
|
486
519
|
if (!key) {
|
|
487
520
|
throw new KeyGateError(`${p} is empty.`);
|
|
488
521
|
}
|
|
@@ -940,12 +973,12 @@ function _today_utc_iso() {
|
|
|
940
973
|
}
|
|
941
974
|
function load_cli_call_counts(p = null) {
|
|
942
975
|
const target = p !== null ? p : _cliCallsStatePath();
|
|
943
|
-
if (!
|
|
976
|
+
if (!fs4.existsSync(target)) {
|
|
944
977
|
return {};
|
|
945
978
|
}
|
|
946
979
|
let data;
|
|
947
980
|
try {
|
|
948
|
-
data = JSON.parse(
|
|
981
|
+
data = JSON.parse(fs4.readFileSync(target, { encoding: "utf-8" }));
|
|
949
982
|
} catch {
|
|
950
983
|
return {};
|
|
951
984
|
}
|
|
@@ -972,8 +1005,8 @@ function record_cli_call(provider, p = null) {
|
|
|
972
1005
|
const target = p !== null ? p : _cliCallsStatePath();
|
|
973
1006
|
const counts = load_cli_call_counts(target);
|
|
974
1007
|
counts[provider] = (counts[provider] ?? 0) + 1;
|
|
975
|
-
|
|
976
|
-
|
|
1008
|
+
fs4.mkdirSync(path4.dirname(target), { recursive: true });
|
|
1009
|
+
fs4.writeFileSync(
|
|
977
1010
|
target,
|
|
978
1011
|
_jsonDumpsIndent2({ date: _today_utc_iso(), counts }),
|
|
979
1012
|
{ encoding: "utf-8" }
|
|
@@ -988,8 +1021,8 @@ function reset_cli_call_counts(provider = null, p = null) {
|
|
|
988
1021
|
} else {
|
|
989
1022
|
delete counts[provider];
|
|
990
1023
|
}
|
|
991
|
-
|
|
992
|
-
|
|
1024
|
+
fs4.mkdirSync(path4.dirname(target), { recursive: true });
|
|
1025
|
+
fs4.writeFileSync(
|
|
993
1026
|
target,
|
|
994
1027
|
_jsonDumpsIndent2({ date: _today_utc_iso(), counts }),
|
|
995
1028
|
{ encoding: "utf-8" }
|
|
@@ -2023,7 +2056,7 @@ function _pyJsonStringAscii(s) {
|
|
|
2023
2056
|
return out + '"';
|
|
2024
2057
|
}
|
|
2025
2058
|
function _which(name) {
|
|
2026
|
-
if (name.includes(
|
|
2059
|
+
if (name.includes(path4.sep) || path4.sep !== "/" && name.includes("/")) {
|
|
2027
2060
|
return _isExecutable(name) ? name : null;
|
|
2028
2061
|
}
|
|
2029
2062
|
const pathEnv = process.env.PATH ?? "";
|
|
@@ -2031,12 +2064,12 @@ function _which(name) {
|
|
|
2031
2064
|
return null;
|
|
2032
2065
|
}
|
|
2033
2066
|
const exts = process.platform === "win32" ? (process.env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean) : [""];
|
|
2034
|
-
for (const dir of pathEnv.split(
|
|
2067
|
+
for (const dir of pathEnv.split(path4.delimiter)) {
|
|
2035
2068
|
if (!dir) {
|
|
2036
2069
|
continue;
|
|
2037
2070
|
}
|
|
2038
2071
|
for (const ext of exts) {
|
|
2039
|
-
const candidate =
|
|
2072
|
+
const candidate = path4.join(dir, name + ext);
|
|
2040
2073
|
if (_isExecutable(candidate)) {
|
|
2041
2074
|
return candidate;
|
|
2042
2075
|
}
|
|
@@ -2046,7 +2079,7 @@ function _which(name) {
|
|
|
2046
2079
|
}
|
|
2047
2080
|
function _isExecutable(p) {
|
|
2048
2081
|
try {
|
|
2049
|
-
const st =
|
|
2082
|
+
const st = fs4.statSync(p);
|
|
2050
2083
|
if (!st.isFile()) {
|
|
2051
2084
|
return false;
|
|
2052
2085
|
}
|
|
@@ -2073,7 +2106,7 @@ function _defaultStdin() {
|
|
|
2073
2106
|
function ensure() {
|
|
2074
2107
|
if (buffer === null) {
|
|
2075
2108
|
try {
|
|
2076
|
-
buffer =
|
|
2109
|
+
buffer = fs4.readFileSync(0, { encoding: "utf-8" });
|
|
2077
2110
|
} catch {
|
|
2078
2111
|
buffer = "";
|
|
2079
2112
|
}
|
|
@@ -2115,9 +2148,9 @@ function _defaultStdin() {
|
|
|
2115
2148
|
|
|
2116
2149
|
// src/scripts/_lib/environment_detector.ts
|
|
2117
2150
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
2118
|
-
import * as
|
|
2151
|
+
import * as fs5 from "node:fs";
|
|
2119
2152
|
import * as os from "node:os";
|
|
2120
|
-
import * as
|
|
2153
|
+
import * as path5 from "node:path";
|
|
2121
2154
|
|
|
2122
2155
|
// src/install/toolDetection.ts
|
|
2123
2156
|
import { existsSync as existsSync3 } from "node:fs";
|
|
@@ -2240,7 +2273,7 @@ function classifyBilling(provider, source) {
|
|
|
2240
2273
|
function codexHome(env) {
|
|
2241
2274
|
const map = env ?? process.env;
|
|
2242
2275
|
const override = (map["CODEX_HOME"] ?? "").trim();
|
|
2243
|
-
return override !== "" ? override :
|
|
2276
|
+
return override !== "" ? override : path5.join(homeOf(env), ".codex");
|
|
2244
2277
|
}
|
|
2245
2278
|
function homeOf(env) {
|
|
2246
2279
|
const map = env ?? process.env;
|
|
@@ -2265,14 +2298,14 @@ ${res.stderr ?? ""}`;
|
|
|
2265
2298
|
}
|
|
2266
2299
|
function isFile(p) {
|
|
2267
2300
|
try {
|
|
2268
|
-
return
|
|
2301
|
+
return fs5.statSync(p).isFile();
|
|
2269
2302
|
} catch {
|
|
2270
2303
|
return false;
|
|
2271
2304
|
}
|
|
2272
2305
|
}
|
|
2273
2306
|
function exists(p) {
|
|
2274
2307
|
try {
|
|
2275
|
-
return
|
|
2308
|
+
return fs5.existsSync(p);
|
|
2276
2309
|
} catch {
|
|
2277
2310
|
return false;
|
|
2278
2311
|
}
|
|
@@ -2280,7 +2313,7 @@ function exists(p) {
|
|
|
2280
2313
|
function classifyCodexAuth(authPath) {
|
|
2281
2314
|
let data;
|
|
2282
2315
|
try {
|
|
2283
|
-
data = JSON.parse(
|
|
2316
|
+
data = JSON.parse(fs5.readFileSync(authPath, "utf-8"));
|
|
2284
2317
|
} catch {
|
|
2285
2318
|
return "cli-api-key";
|
|
2286
2319
|
}
|
|
@@ -2297,18 +2330,18 @@ function cliSubscriptionEvidence(provider, home, env, claudeConfigDir) {
|
|
|
2297
2330
|
if (provider === "anthropic") {
|
|
2298
2331
|
const configDir = claudeConfigDir;
|
|
2299
2332
|
for (const rel of [".credentials.json", "credentials.json"]) {
|
|
2300
|
-
const p =
|
|
2333
|
+
const p = path5.join(configDir, rel);
|
|
2301
2334
|
if (isFile(p)) return { source: "cli-subscription", evidence: p };
|
|
2302
2335
|
}
|
|
2303
2336
|
return null;
|
|
2304
2337
|
}
|
|
2305
2338
|
if (provider === "openai") {
|
|
2306
|
-
const p =
|
|
2339
|
+
const p = path5.join(codexHome(env), "auth.json");
|
|
2307
2340
|
if (isFile(p)) return { source: classifyCodexAuth(p), evidence: p };
|
|
2308
2341
|
return null;
|
|
2309
2342
|
}
|
|
2310
2343
|
if (provider === "gemini") {
|
|
2311
|
-
const p =
|
|
2344
|
+
const p = path5.join(home, ".gemini", "oauth_creds.json");
|
|
2312
2345
|
if (isFile(p)) return { source: "cli-subscription", evidence: p };
|
|
2313
2346
|
return null;
|
|
2314
2347
|
}
|
|
@@ -2340,7 +2373,7 @@ function detectHosts(opts) {
|
|
|
2340
2373
|
function detectAuth(opts) {
|
|
2341
2374
|
const env = opts.env ?? process.env;
|
|
2342
2375
|
const home = opts.home ?? homeOf(opts.env);
|
|
2343
|
-
const claudeConfigDir = opts.home === void 0 && opts.env === void 0 ? claude_config_dir() : (env["CLAUDE_CONFIG_DIR"] ?? "").trim() ||
|
|
2376
|
+
const claudeConfigDir = opts.home === void 0 && opts.env === void 0 ? claude_config_dir() : (env["CLAUDE_CONFIG_DIR"] ?? "").trim() || path5.join(home, ".claude");
|
|
2344
2377
|
const auth = [];
|
|
2345
2378
|
const keys = [];
|
|
2346
2379
|
for (const provider of knownProviders()) {
|
|
@@ -2394,7 +2427,7 @@ function detectEnvironment(opts = {}) {
|
|
|
2394
2427
|
}
|
|
2395
2428
|
|
|
2396
2429
|
// src/scripts/_cli/detection_report.ts
|
|
2397
|
-
import * as
|
|
2430
|
+
import * as path6 from "node:path";
|
|
2398
2431
|
|
|
2399
2432
|
// src/scripts/ai_council/transport_resolver.ts
|
|
2400
2433
|
var VALID_TRANSPORT_MODES = /* @__PURE__ */ new Set([
|
|
@@ -2583,7 +2616,7 @@ function cliBinaryPresent(environment, provider, binaryOverride) {
|
|
|
2583
2616
|
const expected = PROVIDER_CLI_META[provider]?.[0];
|
|
2584
2617
|
if (expected === void 0) return false;
|
|
2585
2618
|
return environment.hosts.some(
|
|
2586
|
-
(h) => h.binary !== null && stripExe(
|
|
2619
|
+
(h) => h.binary !== null && stripExe(path6.basename(h.binary)) === expected
|
|
2587
2620
|
);
|
|
2588
2621
|
}
|
|
2589
2622
|
function stripExe(name) {
|
|
@@ -2744,9 +2777,9 @@ function absentCouncilFacts(configPath) {
|
|
|
2744
2777
|
|
|
2745
2778
|
// src/scripts/ai_team/review_gate.ts
|
|
2746
2779
|
import * as crypto2 from "node:crypto";
|
|
2747
|
-
import * as
|
|
2780
|
+
import * as fs6 from "node:fs";
|
|
2748
2781
|
import * as os2 from "node:os";
|
|
2749
|
-
import * as
|
|
2782
|
+
import * as path7 from "node:path";
|
|
2750
2783
|
|
|
2751
2784
|
// src/scripts/ai_team/config.ts
|
|
2752
2785
|
var AI_TEAM_REVIEW_GATE_DEFAULTS = Object.freeze({
|
|
@@ -2763,16 +2796,16 @@ var AI_TEAM_DEFAULTS = Object.freeze({
|
|
|
2763
2796
|
});
|
|
2764
2797
|
|
|
2765
2798
|
// src/scripts/ai_team/review_gate.ts
|
|
2766
|
-
var GATE_LEDGER_RELPATH =
|
|
2799
|
+
var GATE_LEDGER_RELPATH = path7.join("agents", "runtime", "team", "events.log");
|
|
2767
2800
|
var _CODEX_PLUGIN_DATA_DIRNAME = `${CODEX_PLUGIN_ID}-${CODEX_MARKETPLACE_NAME}`;
|
|
2768
2801
|
function _workspace_state_segment(workspace_root) {
|
|
2769
2802
|
let canonical = workspace_root;
|
|
2770
2803
|
try {
|
|
2771
|
-
canonical =
|
|
2804
|
+
canonical = fs6.realpathSync.native(workspace_root);
|
|
2772
2805
|
} catch {
|
|
2773
2806
|
canonical = workspace_root;
|
|
2774
2807
|
}
|
|
2775
|
-
const slug_source =
|
|
2808
|
+
const slug_source = path7.basename(workspace_root) || "workspace";
|
|
2776
2809
|
const slug = slug_source.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "workspace";
|
|
2777
2810
|
const hash = crypto2.createHash("sha256").update(canonical).digest("hex").slice(0, 16);
|
|
2778
2811
|
return `${slug}-${hash}`;
|
|
@@ -2782,19 +2815,19 @@ function upstream_state_dir_candidates(workspace_root) {
|
|
|
2782
2815
|
const candidates = [];
|
|
2783
2816
|
const env = (process.env["CLAUDE_PLUGIN_DATA"] ?? "").trim();
|
|
2784
2817
|
if (env !== "") {
|
|
2785
|
-
candidates.push(
|
|
2818
|
+
candidates.push(path7.join(env, "state", segment));
|
|
2786
2819
|
}
|
|
2787
2820
|
candidates.push(
|
|
2788
|
-
|
|
2821
|
+
path7.join(claude_config_dir(), "plugins", "data", _CODEX_PLUGIN_DATA_DIRNAME, "state", segment)
|
|
2789
2822
|
);
|
|
2790
|
-
candidates.push(
|
|
2823
|
+
candidates.push(path7.join(os2.tmpdir(), "codex-companion", segment));
|
|
2791
2824
|
return candidates;
|
|
2792
2825
|
}
|
|
2793
2826
|
function upstream_gate_enabled(workspace_root) {
|
|
2794
2827
|
for (const dir of upstream_state_dir_candidates(workspace_root)) {
|
|
2795
2828
|
let parsed;
|
|
2796
2829
|
try {
|
|
2797
|
-
parsed = JSON.parse(
|
|
2830
|
+
parsed = JSON.parse(fs6.readFileSync(path7.join(dir, "state.json"), "utf-8"));
|
|
2798
2831
|
} catch {
|
|
2799
2832
|
continue;
|
|
2800
2833
|
}
|
|
@@ -2854,13 +2887,13 @@ var ArgparseExit = class extends Error {
|
|
|
2854
2887
|
function expanduser(p) {
|
|
2855
2888
|
if (p === "~") return os3.homedir();
|
|
2856
2889
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
2857
|
-
return
|
|
2890
|
+
return path8.join(os3.homedir(), p.slice(2));
|
|
2858
2891
|
}
|
|
2859
2892
|
return p;
|
|
2860
2893
|
}
|
|
2861
2894
|
function pathExists(p) {
|
|
2862
2895
|
try {
|
|
2863
|
-
|
|
2896
|
+
fs7.statSync(p);
|
|
2864
2897
|
return true;
|
|
2865
2898
|
} catch {
|
|
2866
2899
|
return false;
|
|
@@ -2868,27 +2901,27 @@ function pathExists(p) {
|
|
|
2868
2901
|
}
|
|
2869
2902
|
function isFile2(p) {
|
|
2870
2903
|
try {
|
|
2871
|
-
return
|
|
2904
|
+
return fs7.statSync(p).isFile();
|
|
2872
2905
|
} catch {
|
|
2873
2906
|
return false;
|
|
2874
2907
|
}
|
|
2875
2908
|
}
|
|
2876
2909
|
function isDir(p) {
|
|
2877
2910
|
try {
|
|
2878
|
-
return
|
|
2911
|
+
return fs7.statSync(p).isDirectory();
|
|
2879
2912
|
} catch {
|
|
2880
2913
|
return false;
|
|
2881
2914
|
}
|
|
2882
2915
|
}
|
|
2883
2916
|
function resolvePath(p) {
|
|
2884
2917
|
try {
|
|
2885
|
-
return
|
|
2918
|
+
return fs7.realpathSync(path8.resolve(p));
|
|
2886
2919
|
} catch {
|
|
2887
|
-
return
|
|
2920
|
+
return path8.resolve(p);
|
|
2888
2921
|
}
|
|
2889
2922
|
}
|
|
2890
2923
|
function readText(p) {
|
|
2891
|
-
return
|
|
2924
|
+
return fs7.readFileSync(p, "utf-8");
|
|
2892
2925
|
}
|
|
2893
2926
|
function _jsonStrAscii(s) {
|
|
2894
2927
|
let out = '"';
|
|
@@ -2999,7 +3032,7 @@ function _resolve_project_root(arg) {
|
|
|
2999
3032
|
}
|
|
3000
3033
|
var _INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
3001
3034
|
function _detect_install_mode(project_root) {
|
|
3002
|
-
const marker =
|
|
3035
|
+
const marker = path8.join(project_root, _INSTALL_MODE_MARKER_REL);
|
|
3003
3036
|
if (isFile2(marker)) {
|
|
3004
3037
|
let value;
|
|
3005
3038
|
try {
|
|
@@ -3011,9 +3044,9 @@ function _detect_install_mode(project_root) {
|
|
|
3011
3044
|
return [value, "marker-file"];
|
|
3012
3045
|
}
|
|
3013
3046
|
}
|
|
3014
|
-
const has_agents_md = pathExists(
|
|
3047
|
+
const has_agents_md = pathExists(path8.join(project_root, "AGENTS.md"));
|
|
3015
3048
|
const has_copilot = pathExists(
|
|
3016
|
-
|
|
3049
|
+
path8.join(project_root, ".github", "copilot-instructions.md")
|
|
3017
3050
|
);
|
|
3018
3051
|
if (has_agents_md && has_copilot) {
|
|
3019
3052
|
return ["full", "heuristic"];
|
|
@@ -3033,7 +3066,7 @@ function _settings_layer_chain(project_root) {
|
|
|
3033
3066
|
return layers;
|
|
3034
3067
|
}
|
|
3035
3068
|
function _detect_wrapper(project_root) {
|
|
3036
|
-
const wrapper =
|
|
3069
|
+
const wrapper = path8.join(project_root, "agent-config");
|
|
3037
3070
|
if (!pathExists(wrapper)) {
|
|
3038
3071
|
return { path: String(wrapper), exists: false, embedded_root: null };
|
|
3039
3072
|
}
|
|
@@ -3100,14 +3133,14 @@ function _emit_context_text(ctx) {
|
|
|
3100
3133
|
}
|
|
3101
3134
|
function _resolve_path(project_root, raw) {
|
|
3102
3135
|
let p = expanduser(raw);
|
|
3103
|
-
if (!
|
|
3104
|
-
p =
|
|
3136
|
+
if (!path8.isAbsolute(p)) {
|
|
3137
|
+
p = path8.join(project_root, p);
|
|
3105
3138
|
}
|
|
3106
3139
|
return p;
|
|
3107
3140
|
}
|
|
3108
3141
|
function _sha256(p) {
|
|
3109
3142
|
try {
|
|
3110
|
-
const data =
|
|
3143
|
+
const data = fs7.readFileSync(p);
|
|
3111
3144
|
return crypto3.createHash("sha256").update(data).digest("hex");
|
|
3112
3145
|
} catch {
|
|
3113
3146
|
return null;
|
|
@@ -3116,7 +3149,7 @@ function _sha256(p) {
|
|
|
3116
3149
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
3117
3150
|
var _FRONTMATTER_PACKAGE_RE = /^package:\s*(.+?)\s*$/m;
|
|
3118
3151
|
function _read_inline_package_tag(p) {
|
|
3119
|
-
if (
|
|
3152
|
+
if (path8.extname(p) !== ".md") {
|
|
3120
3153
|
return NO_FRONTMATTER;
|
|
3121
3154
|
}
|
|
3122
3155
|
let text;
|
|
@@ -3245,13 +3278,13 @@ function rglob(root) {
|
|
|
3245
3278
|
const walk = (dir) => {
|
|
3246
3279
|
let entries;
|
|
3247
3280
|
try {
|
|
3248
|
-
entries =
|
|
3281
|
+
entries = fs7.readdirSync(dir, { withFileTypes: true });
|
|
3249
3282
|
} catch {
|
|
3250
3283
|
return;
|
|
3251
3284
|
}
|
|
3252
3285
|
entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
3253
3286
|
for (const ent of entries) {
|
|
3254
|
-
const full =
|
|
3287
|
+
const full = path8.join(dir, ent.name);
|
|
3255
3288
|
out.push(full);
|
|
3256
3289
|
let dirLike = ent.isDirectory();
|
|
3257
3290
|
if (ent.isSymbolicLink()) {
|
|
@@ -3326,9 +3359,9 @@ function _foreign_records(project_root, foreign) {
|
|
|
3326
3359
|
return out;
|
|
3327
3360
|
}
|
|
3328
3361
|
function relativeTo(p, base) {
|
|
3329
|
-
const rel =
|
|
3362
|
+
const rel = path8.relative(base, p);
|
|
3330
3363
|
if (rel === "") return rel;
|
|
3331
|
-
if (rel.startsWith("..") ||
|
|
3364
|
+
if (rel.startsWith("..") || path8.isAbsolute(rel)) {
|
|
3332
3365
|
return null;
|
|
3333
3366
|
}
|
|
3334
3367
|
return rel;
|
|
@@ -3392,7 +3425,7 @@ var MANIFEST_REQUIRED_CHECK_IDS = /* @__PURE__ */ new Set([
|
|
|
3392
3425
|
]);
|
|
3393
3426
|
var INSTALL_MODE_MARKER_RELATIVE = "agents/.agent-state/install-mode.txt";
|
|
3394
3427
|
function _is_global_only_consumer(project_root) {
|
|
3395
|
-
return isFile2(
|
|
3428
|
+
return isFile2(path8.join(project_root, INSTALL_MODE_MARKER_RELATIVE)) || isDir(path8.join(project_root, "agents", "overrides"));
|
|
3396
3429
|
}
|
|
3397
3430
|
var REPAIR_IDS = ["wizard-state"];
|
|
3398
3431
|
var MCP_BETA_GATES = [
|
|
@@ -3412,7 +3445,7 @@ var STATUS_SYMBOLS = {
|
|
|
3412
3445
|
var MIN_PYTHON = [3, 10];
|
|
3413
3446
|
function _check_scope(project_root) {
|
|
3414
3447
|
for (const marker of ["pnpm-workspace.yaml", "lerna.json"]) {
|
|
3415
|
-
if (pathExists(
|
|
3448
|
+
if (pathExists(path8.join(project_root, marker))) {
|
|
3416
3449
|
return {
|
|
3417
3450
|
id: "scope",
|
|
3418
3451
|
status: "warn",
|
|
@@ -3421,7 +3454,7 @@ function _check_scope(project_root) {
|
|
|
3421
3454
|
};
|
|
3422
3455
|
}
|
|
3423
3456
|
}
|
|
3424
|
-
const pkg =
|
|
3457
|
+
const pkg = path8.join(project_root, "package.json");
|
|
3425
3458
|
if (pathExists(pkg)) {
|
|
3426
3459
|
try {
|
|
3427
3460
|
const data = JSON.parse(readText(pkg));
|
|
@@ -3446,26 +3479,8 @@ function _check_scope(project_root) {
|
|
|
3446
3479
|
var _PLACEHOLDER_EMAIL_RE = /^(t@t\.t|.*@example\.(com|org)|.*@localhost)$/i;
|
|
3447
3480
|
var _PLACEHOLDER_NAME_RE = /^(t|test|user|nobody|x)$/i;
|
|
3448
3481
|
function _git_config_path(project_root) {
|
|
3449
|
-
const
|
|
3450
|
-
|
|
3451
|
-
const st = fs6.statSync(gd);
|
|
3452
|
-
if (st.isDirectory()) {
|
|
3453
|
-
return path7.join(gd, "config");
|
|
3454
|
-
}
|
|
3455
|
-
const m = readText(gd).match(/^gitdir:\s*(.+)\s*$/m);
|
|
3456
|
-
if (m === null) {
|
|
3457
|
-
return null;
|
|
3458
|
-
}
|
|
3459
|
-
const gdPath = path7.resolve(project_root, m[1].trim());
|
|
3460
|
-
const commondirFile = path7.join(gdPath, "commondir");
|
|
3461
|
-
if (pathExists(commondirFile)) {
|
|
3462
|
-
const common = path7.resolve(gdPath, readText(commondirFile).trim());
|
|
3463
|
-
return path7.join(common, "config");
|
|
3464
|
-
}
|
|
3465
|
-
return path7.join(gdPath, "config");
|
|
3466
|
-
} catch {
|
|
3467
|
-
return null;
|
|
3468
|
-
}
|
|
3482
|
+
const common = git_common_dir(project_root);
|
|
3483
|
+
return common === null ? null : path8.join(common, "config");
|
|
3469
3484
|
}
|
|
3470
3485
|
function _parse_git_user(configText) {
|
|
3471
3486
|
let inUser = false;
|
|
@@ -3495,7 +3510,7 @@ function _check_git_identity(project_root) {
|
|
|
3495
3510
|
}
|
|
3496
3511
|
let ident = _parse_git_user(readText(cfgPath));
|
|
3497
3512
|
if (ident.name === null && ident.email === null) {
|
|
3498
|
-
const globalCfg =
|
|
3513
|
+
const globalCfg = path8.join(os3.homedir(), ".gitconfig");
|
|
3499
3514
|
if (pathExists(globalCfg)) {
|
|
3500
3515
|
ident = _parse_git_user(readText(globalCfg));
|
|
3501
3516
|
}
|
|
@@ -3556,7 +3571,7 @@ function _package_root() {
|
|
|
3556
3571
|
}
|
|
3557
3572
|
function _current_package_version() {
|
|
3558
3573
|
try {
|
|
3559
|
-
const data = JSON.parse(readText(
|
|
3574
|
+
const data = JSON.parse(readText(path8.join(_package_root(), "package.json")));
|
|
3560
3575
|
const v = data["version"];
|
|
3561
3576
|
if (typeof v === "string" && v.trim()) {
|
|
3562
3577
|
return v.trim();
|
|
@@ -3600,7 +3615,7 @@ function _check_lockfile_freshness(manifest) {
|
|
|
3600
3615
|
};
|
|
3601
3616
|
}
|
|
3602
3617
|
function shutilWhich(name) {
|
|
3603
|
-
if (
|
|
3618
|
+
if (path8.dirname(name) !== "." && (name.includes("/") || name.includes("\\"))) {
|
|
3604
3619
|
return isExecutableFile(name) ? name : null;
|
|
3605
3620
|
}
|
|
3606
3621
|
const pathEnv = process2.env["PATH"] || "";
|
|
@@ -3613,12 +3628,12 @@ function shutilWhich(name) {
|
|
|
3613
3628
|
if (seenDirs.has(d)) continue;
|
|
3614
3629
|
seenDirs.add(d);
|
|
3615
3630
|
for (const ext of exts) {
|
|
3616
|
-
const candidate =
|
|
3631
|
+
const candidate = path8.join(d, name + (ext === "" ? "" : ext.toLowerCase() === ext ? ext : ext));
|
|
3617
3632
|
if (isExecutableFile(candidate)) {
|
|
3618
3633
|
return candidate;
|
|
3619
3634
|
}
|
|
3620
3635
|
if (ext !== "") {
|
|
3621
|
-
const upper =
|
|
3636
|
+
const upper = path8.join(d, name + ext);
|
|
3622
3637
|
if (isExecutableFile(upper)) return upper;
|
|
3623
3638
|
}
|
|
3624
3639
|
}
|
|
@@ -3627,10 +3642,10 @@ function shutilWhich(name) {
|
|
|
3627
3642
|
}
|
|
3628
3643
|
function isExecutableFile(p) {
|
|
3629
3644
|
try {
|
|
3630
|
-
const st =
|
|
3645
|
+
const st = fs7.statSync(p);
|
|
3631
3646
|
if (!st.isFile()) return false;
|
|
3632
3647
|
if (process2.platform === "win32") return true;
|
|
3633
|
-
|
|
3648
|
+
fs7.accessSync(p, fs7.constants.X_OK);
|
|
3634
3649
|
return true;
|
|
3635
3650
|
} catch {
|
|
3636
3651
|
return false;
|
|
@@ -3694,7 +3709,7 @@ function _check_claude_plugin() {
|
|
|
3694
3709
|
remedy: ""
|
|
3695
3710
|
};
|
|
3696
3711
|
}
|
|
3697
|
-
const projection =
|
|
3712
|
+
const projection = path8.join(os3.homedir(), ".claude", "skills");
|
|
3698
3713
|
const projection_present = isDir(projection);
|
|
3699
3714
|
if (projection_present) {
|
|
3700
3715
|
return {
|
|
@@ -3731,8 +3746,8 @@ function _check_claude_command_wrappers() {
|
|
|
3731
3746
|
remedy: ""
|
|
3732
3747
|
};
|
|
3733
3748
|
}
|
|
3734
|
-
const anchor =
|
|
3735
|
-
const commands_dir =
|
|
3749
|
+
const anchor = path8.join(os3.homedir(), ".claude");
|
|
3750
|
+
const commands_dir = path8.join(anchor, "commands");
|
|
3736
3751
|
if (!isDir(commands_dir)) {
|
|
3737
3752
|
return {
|
|
3738
3753
|
id: "claude-command-wrappers",
|
|
@@ -3741,8 +3756,8 @@ function _check_claude_command_wrappers() {
|
|
|
3741
3756
|
remedy: ""
|
|
3742
3757
|
};
|
|
3743
3758
|
}
|
|
3744
|
-
const flat_probe =
|
|
3745
|
-
const wrapper_probe =
|
|
3759
|
+
const flat_probe = fs7.existsSync(path8.join(commands_dir, "commit.md"));
|
|
3760
|
+
const wrapper_probe = fs7.existsSync(path8.join(anchor, "skills", "commit", "SKILL.md"));
|
|
3746
3761
|
if (wrapper_probe) {
|
|
3747
3762
|
return {
|
|
3748
3763
|
id: "claude-command-wrappers",
|
|
@@ -3767,7 +3782,7 @@ function _check_claude_command_wrappers() {
|
|
|
3767
3782
|
};
|
|
3768
3783
|
}
|
|
3769
3784
|
function _check_surface_state() {
|
|
3770
|
-
const matrix_path =
|
|
3785
|
+
const matrix_path = path8.join(_package_root(), "src", "config", "surface-matrix.yml");
|
|
3771
3786
|
if (!isFile2(matrix_path)) {
|
|
3772
3787
|
return {
|
|
3773
3788
|
id: "surface-state",
|
|
@@ -3791,7 +3806,7 @@ function _check_surface_state() {
|
|
|
3791
3806
|
remedy: "agent-config upgrade (reinstalls the package data files)"
|
|
3792
3807
|
};
|
|
3793
3808
|
}
|
|
3794
|
-
const _expand = (p) => p.startsWith("~/") ?
|
|
3809
|
+
const _expand = (p) => p.startsWith("~/") ? path8.join(os3.homedir(), p.slice(2)) : path8.join(_package_root(), p);
|
|
3795
3810
|
const violations = [];
|
|
3796
3811
|
const remedies = [];
|
|
3797
3812
|
let checked = 0;
|
|
@@ -3833,7 +3848,7 @@ function _check_surface_state() {
|
|
|
3833
3848
|
}
|
|
3834
3849
|
function pathExistsAny(p) {
|
|
3835
3850
|
try {
|
|
3836
|
-
|
|
3851
|
+
fs7.statSync(p);
|
|
3837
3852
|
return true;
|
|
3838
3853
|
} catch {
|
|
3839
3854
|
return false;
|
|
@@ -3849,13 +3864,13 @@ function _check_hook_wiring() {
|
|
|
3849
3864
|
remedy: ""
|
|
3850
3865
|
};
|
|
3851
3866
|
}
|
|
3852
|
-
const settings_path =
|
|
3867
|
+
const settings_path = path8.join(os3.homedir(), ".claude", "settings.json");
|
|
3853
3868
|
let missing;
|
|
3854
3869
|
try {
|
|
3855
3870
|
const matrix = build_claude_hook_matrix(
|
|
3856
|
-
|
|
3871
|
+
path8.join(_package_root(), "src", "scripts", "hook_manifest.yaml")
|
|
3857
3872
|
);
|
|
3858
|
-
const settings = pathExists(settings_path) ? JSON.parse(
|
|
3873
|
+
const settings = pathExists(settings_path) ? JSON.parse(fs7.readFileSync(settings_path, "utf8")) : {};
|
|
3859
3874
|
const hooks = (settings["hooks"] ?? {}) || {};
|
|
3860
3875
|
missing = Object.keys(matrix).filter((ev) => {
|
|
3861
3876
|
const groups = hooks[ev];
|
|
@@ -3930,7 +3945,7 @@ function _check_mcp_mode(project_root) {
|
|
|
3930
3945
|
];
|
|
3931
3946
|
const found = [];
|
|
3932
3947
|
for (const [rel, label] of candidates) {
|
|
3933
|
-
const p =
|
|
3948
|
+
const p = path8.join(project_root, rel);
|
|
3934
3949
|
if (!pathExists(p)) {
|
|
3935
3950
|
continue;
|
|
3936
3951
|
}
|
|
@@ -3962,7 +3977,7 @@ function _check_mcp_mode(project_root) {
|
|
|
3962
3977
|
};
|
|
3963
3978
|
}
|
|
3964
3979
|
function _check_offline_readiness() {
|
|
3965
|
-
const script =
|
|
3980
|
+
const script = path8.join(_package_root(), "src", "scripts", "hermetic-install.sh");
|
|
3966
3981
|
if (!pathExists(script)) {
|
|
3967
3982
|
return {
|
|
3968
3983
|
id: "offline-readiness",
|
|
@@ -4020,7 +4035,7 @@ function _check_stale_orphans() {
|
|
|
4020
4035
|
(a, b) => a < b ? -1 : a > b ? 1 : 0
|
|
4021
4036
|
);
|
|
4022
4037
|
for (const root_name of ownedSorted) {
|
|
4023
|
-
const root =
|
|
4038
|
+
const root = path8.join(anchor, root_name);
|
|
4024
4039
|
if (!isDir(root)) {
|
|
4025
4040
|
continue;
|
|
4026
4041
|
}
|
|
@@ -4035,7 +4050,7 @@ function _check_stale_orphans() {
|
|
|
4035
4050
|
if (rel === null) {
|
|
4036
4051
|
continue;
|
|
4037
4052
|
}
|
|
4038
|
-
const relPosix = rel.split(
|
|
4053
|
+
const relPosix = rel.split(path8.sep).join("/");
|
|
4039
4054
|
if (recorded_set.has(relPosix)) {
|
|
4040
4055
|
continue;
|
|
4041
4056
|
}
|
|
@@ -4090,14 +4105,14 @@ function _check_rule_scope_drift(project_root) {
|
|
|
4090
4105
|
let rules_dir = null;
|
|
4091
4106
|
let found = 0;
|
|
4092
4107
|
for (const rel of _RULE_PROJECTION_DIRS) {
|
|
4093
|
-
const cand =
|
|
4108
|
+
const cand = path8.join(project_root, rel);
|
|
4094
4109
|
if (!isDir(cand)) {
|
|
4095
4110
|
continue;
|
|
4096
4111
|
}
|
|
4097
4112
|
let count = 0;
|
|
4098
4113
|
try {
|
|
4099
|
-
for (const name of
|
|
4100
|
-
if (name.endsWith(".md") && isFile2(
|
|
4114
|
+
for (const name of fs7.readdirSync(cand)) {
|
|
4115
|
+
if (name.endsWith(".md") && isFile2(path8.join(cand, name))) {
|
|
4101
4116
|
count += 1;
|
|
4102
4117
|
}
|
|
4103
4118
|
}
|
|
@@ -4151,14 +4166,14 @@ function _check_rule_scope_drift(project_root) {
|
|
|
4151
4166
|
};
|
|
4152
4167
|
}
|
|
4153
4168
|
function _check_duplicate_scope_rules(project_root, userRulesDirOverride) {
|
|
4154
|
-
const user_rules_dir = userRulesDirOverride ??
|
|
4169
|
+
const user_rules_dir = userRulesDirOverride ?? path8.join(os3.homedir(), ".claude", "rules");
|
|
4155
4170
|
let project_rules_dir = null;
|
|
4156
4171
|
if (_is_source_repo(project_root)) {
|
|
4157
|
-
const cand =
|
|
4172
|
+
const cand = path8.join(project_root, "dist", "agent-src", "rules");
|
|
4158
4173
|
if (isDir(cand)) project_rules_dir = cand;
|
|
4159
4174
|
} else {
|
|
4160
4175
|
for (const rel of _RULE_PROJECTION_DIRS) {
|
|
4161
|
-
const cand =
|
|
4176
|
+
const cand = path8.join(project_root, rel);
|
|
4162
4177
|
if (isDir(cand)) {
|
|
4163
4178
|
project_rules_dir = cand;
|
|
4164
4179
|
break;
|
|
@@ -4227,7 +4242,7 @@ function _check_mcp_beta_readiness(project_root) {
|
|
|
4227
4242
|
}
|
|
4228
4243
|
const pending = [];
|
|
4229
4244
|
for (const [gate_id, rel] of MCP_BETA_GATES) {
|
|
4230
|
-
if (!pathExists(
|
|
4245
|
+
if (!pathExists(path8.join(project_root, rel))) {
|
|
4231
4246
|
pending.push(`${gate_id} (${rel})`);
|
|
4232
4247
|
}
|
|
4233
4248
|
}
|
|
@@ -4248,7 +4263,7 @@ function _check_mcp_beta_readiness(project_root) {
|
|
|
4248
4263
|
}
|
|
4249
4264
|
function _check_tier_usage_readiness(project_root) {
|
|
4250
4265
|
const settings_file = project_settings_path(project_root);
|
|
4251
|
-
let log_path =
|
|
4266
|
+
let log_path = path8.join(project_root, ".agent-tier-usage.jsonl");
|
|
4252
4267
|
let enabled = false;
|
|
4253
4268
|
if (isFile2(settings_file)) {
|
|
4254
4269
|
let raw;
|
|
@@ -4267,7 +4282,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
4267
4282
|
const outputRaw = tu["output"];
|
|
4268
4283
|
const output = typeof outputRaw === "object" && outputRaw !== null && !Array.isArray(outputRaw) ? outputRaw : {};
|
|
4269
4284
|
if (typeof output["path"] === "string" && output["path"].trim()) {
|
|
4270
|
-
log_path =
|
|
4285
|
+
log_path = path8.join(project_root, output["path"].trim());
|
|
4271
4286
|
}
|
|
4272
4287
|
const val = tu["enabled"];
|
|
4273
4288
|
if (typeof val === "boolean") {
|
|
@@ -4292,7 +4307,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
4292
4307
|
return {
|
|
4293
4308
|
id: "tier-usage-readiness",
|
|
4294
4309
|
status: "warn",
|
|
4295
|
-
message: `tier-usage telemetry on but ${
|
|
4310
|
+
message: `tier-usage telemetry on but ${path8.basename(log_path)} not yet written \u2014 no signal accumulated`,
|
|
4296
4311
|
remedy: "run any tracked command to seed the log; the dispatcher writes one record per invocation"
|
|
4297
4312
|
};
|
|
4298
4313
|
}
|
|
@@ -4307,7 +4322,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
4307
4322
|
return {
|
|
4308
4323
|
id: "tier-usage-readiness",
|
|
4309
4324
|
status: "fail",
|
|
4310
|
-
message: `cannot read ${
|
|
4325
|
+
message: `cannot read ${path8.basename(log_path)}: ${osErrorStr(exc)}`,
|
|
4311
4326
|
remedy: "fix permissions on the tier-usage log"
|
|
4312
4327
|
};
|
|
4313
4328
|
}
|
|
@@ -4338,7 +4353,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
4338
4353
|
return {
|
|
4339
4354
|
id: "tier-usage-readiness",
|
|
4340
4355
|
status: "fail",
|
|
4341
|
-
message: `${total} record(s) in ${
|
|
4356
|
+
message: `${total} record(s) in ${path8.basename(log_path)} but 0 passed the privacy floor \u2014 report would refuse to render`,
|
|
4342
4357
|
remedy: "inspect the log; the dispatcher is writing records the contract forbids (paths, argv, message bodies)"
|
|
4343
4358
|
};
|
|
4344
4359
|
}
|
|
@@ -4346,19 +4361,19 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
4346
4361
|
return {
|
|
4347
4362
|
id: "tier-usage-readiness",
|
|
4348
4363
|
status: "warn",
|
|
4349
|
-
message: `${
|
|
4364
|
+
message: `${path8.basename(log_path)} present but empty \u2014 no signal yet`,
|
|
4350
4365
|
remedy: "run any tracked command to seed the log"
|
|
4351
4366
|
};
|
|
4352
4367
|
}
|
|
4353
4368
|
return {
|
|
4354
4369
|
id: "tier-usage-readiness",
|
|
4355
4370
|
status: "ok",
|
|
4356
|
-
message: `${valid} record(s) past the privacy floor in ${
|
|
4371
|
+
message: `${valid} record(s) past the privacy floor in ${path8.basename(log_path)} \u2014 retiering signal available`,
|
|
4357
4372
|
remedy: ""
|
|
4358
4373
|
};
|
|
4359
4374
|
}
|
|
4360
4375
|
function readText0(p) {
|
|
4361
|
-
return
|
|
4376
|
+
return fs7.readFileSync(p, "utf-8");
|
|
4362
4377
|
}
|
|
4363
4378
|
function osErrorStr(exc) {
|
|
4364
4379
|
if (exc && typeof exc === "object" && "message" in exc) {
|
|
@@ -4531,7 +4546,7 @@ function _epoch_seconds(value) {
|
|
|
4531
4546
|
function _codex_auth_expiry(auth_path) {
|
|
4532
4547
|
let data;
|
|
4533
4548
|
try {
|
|
4534
|
-
data = JSON.parse(
|
|
4549
|
+
data = JSON.parse(fs7.readFileSync(auth_path, "utf-8"));
|
|
4535
4550
|
} catch {
|
|
4536
4551
|
return null;
|
|
4537
4552
|
}
|
|
@@ -4694,7 +4709,7 @@ function _check_team(project_root) {
|
|
|
4694
4709
|
if (binary_resolved === null) {
|
|
4695
4710
|
remedies.push("install the codex CLI: `npm install -g @openai/codex`");
|
|
4696
4711
|
}
|
|
4697
|
-
const auth_path =
|
|
4712
|
+
const auth_path = path8.join(_codex_home(), "auth.json");
|
|
4698
4713
|
const authed = pathExists(auth_path);
|
|
4699
4714
|
let auth_str;
|
|
4700
4715
|
if (!authed) {
|
|
@@ -4774,7 +4789,7 @@ function _check_unsupported_combos(manifest) {
|
|
|
4774
4789
|
};
|
|
4775
4790
|
}
|
|
4776
4791
|
function _wizard_state_path() {
|
|
4777
|
-
return
|
|
4792
|
+
return path8.join(event4u_root(), "state", "wizard-state.json");
|
|
4778
4793
|
}
|
|
4779
4794
|
function _check_wizard_state() {
|
|
4780
4795
|
const state_pth = _wizard_state_path();
|
|
@@ -4854,7 +4869,7 @@ function _check_wizard_state() {
|
|
|
4854
4869
|
};
|
|
4855
4870
|
}
|
|
4856
4871
|
function _check_settings_review_pending() {
|
|
4857
|
-
const delta_pth =
|
|
4872
|
+
const delta_pth = path8.join(event4u_root(), "state", "settings-delta.json");
|
|
4858
4873
|
if (!pathExists(delta_pth)) {
|
|
4859
4874
|
return {
|
|
4860
4875
|
id: "settings-review-pending",
|
|
@@ -4880,7 +4895,7 @@ function _check_settings_review_pending() {
|
|
|
4880
4895
|
}
|
|
4881
4896
|
function _check_memory_merge_union(project_root) {
|
|
4882
4897
|
const remedy = "run: npx tsx src/scripts/sync_gitattributes.ts (or `agent-config refresh --project`)";
|
|
4883
|
-
const target =
|
|
4898
|
+
const target = path8.join(project_root, DEFAULT_GITATTRIBUTES);
|
|
4884
4899
|
if (!pathExists(target)) {
|
|
4885
4900
|
return {
|
|
4886
4901
|
id: "memory-merge-union",
|
|
@@ -5362,7 +5377,7 @@ function _run_repair(opts) {
|
|
|
5362
5377
|
};
|
|
5363
5378
|
if (exists2) {
|
|
5364
5379
|
try {
|
|
5365
|
-
|
|
5380
|
+
fs7.unlinkSync(state_pth);
|
|
5366
5381
|
} catch (exc) {
|
|
5367
5382
|
payload["action"] = "error";
|
|
5368
5383
|
payload["error"] = osErrorStr(exc);
|
|
@@ -5457,13 +5472,13 @@ function _isCliEntry() {
|
|
|
5457
5472
|
if (process2.argv[1] === void 0) {
|
|
5458
5473
|
return false;
|
|
5459
5474
|
}
|
|
5460
|
-
const argvUrl = pathToFileURL(
|
|
5475
|
+
const argvUrl = pathToFileURL(path8.resolve(process2.argv[1])).href;
|
|
5461
5476
|
if (import.meta.url === argvUrl) {
|
|
5462
5477
|
return true;
|
|
5463
5478
|
}
|
|
5464
5479
|
try {
|
|
5465
|
-
const here =
|
|
5466
|
-
const argv =
|
|
5480
|
+
const here = fs7.realpathSync(fileURLToPath2(import.meta.url));
|
|
5481
|
+
const argv = fs7.realpathSync(path8.resolve(process2.argv[1]));
|
|
5467
5482
|
return here === argv;
|
|
5468
5483
|
} catch {
|
|
5469
5484
|
return false;
|