@event4u/agent-config 16.0.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 +289 -140
- package/CONTRIBUTING.md +9 -0
- package/README.md +2 -2
- package/dist/agent-src/commands/analyze/inbox.md +26 -0
- package/dist/agent-src/commands/analyze/roadmap-repos.md +27 -0
- package/dist/agent-src/commands/challenge-me/closure.md +178 -0
- package/dist/agent-src/commands/challenge-me.md +9 -2
- package/dist/agent-src/commands/council/default.md +25 -5
- package/dist/agent-src/commands/feature/plan.md +28 -1
- package/dist/agent-src/commands/feature/roadmap.md +28 -1
- package/dist/agent-src/commands/implement-ticket.md +27 -0
- package/dist/agent-src/commands/jira-ticket.md +27 -0
- package/dist/agent-src/commands/pr/create.md +29 -0
- package/dist/agent-src/commands/pr/merge.md +60 -9
- package/dist/agent-src/commands/roadmap/ai-council.md +7 -1
- package/dist/agent-src/commands/roadmap/create.md +74 -27
- package/dist/agent-src/commands/roadmap/materialize.md +27 -0
- package/dist/agent-src/commands/roadmap/process-full.md +123 -18
- package/dist/agent-src/commands/team.md +22 -0
- package/dist/agent-src/commands/work.md +4 -0
- package/dist/agent-src/contexts/authority/scope-growth-ownership.md +80 -0
- package/dist/agent-src/contexts/communication/rules-auto/user-interaction-mechanics.md +47 -0
- package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +44 -3
- package/dist/agent-src/contexts/execution/autonomy-mechanics.md +19 -23
- package/dist/agent-src/contexts/execution/decision-closure-execution.md +93 -0
- package/dist/agent-src/contexts/execution/fix-loop-ladder.md +108 -0
- package/dist/agent-src/contexts/execution/plan-confidence-gate.md +4 -2
- package/dist/agent-src/contexts/execution/roadmap-process-loop.md +75 -6
- package/dist/agent-src/guidelines/agent-infra/active-remediation-mechanics.md +57 -0
- package/dist/agent-src/guidelines/agent-infra/evaluator-independence-mechanics.md +102 -0
- package/dist/agent-src/guidelines/design-fidelity-routing.md +29 -0
- package/dist/agent-src/rules/autonomous-execution.md +15 -8
- package/dist/agent-src/rules/delegation-policy.md +23 -45
- package/dist/agent-src/rules/design-fidelity.md +32 -37
- package/dist/agent-src/rules/evaluator-independence.md +43 -49
- package/dist/agent-src/rules/test-first.md +41 -0
- 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 +3 -3
- package/dist/agent-src/skills/ai-council/SKILL.md +11 -3
- package/dist/agent-src/skills/api-design/data/manifest.json +3 -3
- package/dist/agent-src/skills/database/data/manifest.json +4 -4
- package/dist/agent-src/skills/database/data/query-tuning.csv +3 -3
- package/dist/agent-src/skills/design-review/SKILL.md +80 -4
- package/dist/agent-src/skills/design-review/references/verification-automation.md +32 -0
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +30 -5
- package/dist/agent-src/skills/existing-ui-audit/references/component-taxonomy-detection.md +56 -0
- package/dist/agent-src/skills/experiment-loop/SKILL.md +31 -1
- 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/roadmap-writing/SKILL.md +1 -1
- package/dist/agent-src/skills/storybook-workshop/SKILL.md +42 -3
- package/dist/agent-src/skills/threat-modeling/SKILL.md +9 -4
- package/dist/agent-src/skills/threat-modeling/data/manifest.json +4 -4
- package/dist/agent-src/skills/ui-component-architect/SKILL.md +23 -0
- package/dist/agent-src/skills/verify-repair-loop/SKILL.md +37 -3
- package/dist/agent-src/templates/agent-settings.md +1 -1
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +218 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +62 -2
- package/dist/agent-src/templates/scripts/work_engine/directives/backend/test.ts +1 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/backend/verify.ts +1 -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/check_update_banner.js +40 -2
- package/dist/cli-delegate/chunk-4E2W63DA.js +335 -0
- package/dist/cli-delegate/{chunk-S3VFXMTM.js → chunk-4XFP2Y3E.js} +1 -1
- package/dist/cli-delegate/chunk-5R7HOLAF.js +99 -0
- package/dist/cli-delegate/{chunk-IVBPRCQO.js → chunk-6KFEC3G7.js} +1 -1
- package/dist/cli-delegate/{chunk-2TAQ2K4V.js → chunk-6KM6ORRY.js} +55 -386
- package/dist/cli-delegate/{chunk-AK6HODNQ.js → chunk-7XGBX6ZH.js} +973 -555
- package/dist/cli-delegate/{chunk-2XY7ILBT.js → chunk-FC75PGJE.js} +42 -2
- package/dist/cli-delegate/{chunk-55ACLDUE.js → chunk-FP36SWJD.js} +587 -141
- package/dist/cli-delegate/{chunk-3FKR64R5.js → chunk-IGD6ERX6.js} +62 -7
- package/dist/cli-delegate/{chunk-GYC3VRYN.js → chunk-JNMVLWLR.js} +99 -14
- package/dist/cli-delegate/{chunk-H32DGUJH.js → chunk-P6ZHP5W2.js} +1 -1
- package/dist/cli-delegate/{chunk-57PN4GYJ.js → chunk-RGNIWTEA.js} +1 -1
- package/dist/cli-delegate/chunk-ROYYTEZU.js +39 -0
- package/dist/cli-delegate/{chunk-2DK2VJWG.js → chunk-WGXTVKCQ.js} +20 -6
- package/dist/cli-delegate/chunk-YDPILCOL.js +152 -0
- package/dist/cli-delegate/{chunk-QJWAUMJW.js → chunk-YJ72UIAK.js} +730 -15
- package/dist/cli-delegate/cmd_analyze_session.js +1 -1
- package/dist/cli-delegate/cmd_brand_status.js +1 -1
- package/dist/cli-delegate/cmd_conformance.js +985 -831
- package/dist/cli-delegate/cmd_doctor.js +7 -5
- package/dist/cli-delegate/cmd_explain.js +2 -2
- package/dist/cli-delegate/cmd_export.js +9 -7
- package/dist/cli-delegate/cmd_fleet.js +4 -2
- package/dist/cli-delegate/cmd_handoff.js +7 -7
- package/dist/cli-delegate/cmd_mcp_available.js +1 -1
- package/dist/cli-delegate/cmd_memory_get.js +1 -1
- package/dist/cli-delegate/cmd_migrate.js +2 -2
- package/dist/cli-delegate/cmd_packs_active.js +2 -2
- package/dist/cli-delegate/cmd_preflight.js +4 -2
- package/dist/cli-delegate/cmd_prune.js +10 -8
- package/dist/cli-delegate/cmd_route_audit.js +3 -3
- package/dist/cli-delegate/cmd_route_explain.js +1 -1
- package/dist/cli-delegate/cmd_session_recycle.js +4 -4
- package/dist/cli-delegate/cmd_settings_get.js +28 -2
- package/dist/cli-delegate/cmd_settings_migrate.js +9 -7
- package/dist/cli-delegate/cmd_settings_set.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +10 -8
- package/dist/cli-delegate/cmd_uninstall.js +16 -13
- package/dist/cli-delegate/cmd_update.js +1 -1
- package/dist/cli-delegate/cmd_upgrade.js +1 -1
- package/dist/cli-delegate/cmd_validate.js +12 -10
- package/dist/cli-delegate/cmd_versions.js +1 -1
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +90 -43
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +4 -4
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +10 -8
- package/dist/discovery/trust-report.md +3 -3
- package/dist/discovery/workspaces.json +8 -6
- package/dist/hooks/dispatch.js +7682 -2772
- package/dist/hooks/dispatch.sha256 +1 -0
- package/dist/install/claudeRuleRewrite.js +14 -3
- package/dist/install/conflict.js +60 -10
- package/dist/install/conflictTracker.js +218 -0
- package/dist/install/fsPrimitives.js +54 -0
- package/dist/install/install.mjs +2200 -1559
- package/dist/install/manifestFiles.js +259 -0
- package/dist/install/preflight.js +14 -2
- package/dist/install/preserve.js +157 -0
- package/dist/install/recordedOwnership.js +132 -0
- package/dist/install/txlog.js +11 -2
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +3066 -1470
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/agent_settings.js +3 -2
- package/dist/scripts/_lib/fs_atomic.js +167 -0
- package/dist/scripts/_lib/installed_tools.js +460 -0
- package/dist/scripts/_lib/lean_projection_mode.js +3 -2
- package/dist/scripts/_lib/settings_renamed_keys.js +78 -0
- package/dist/server/routes/install.js +8 -0
- package/dist/server/routes/wizard.js +9 -3
- package/dist/server/schemas/settings.js +40 -5
- package/dist/shared/missionExecution.js +97 -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/MIGRATION.md +103 -0
- package/docs/contracts/settings-classes.md +28 -7
- package/docs/guidelines/agent-infra/active-remediation-mechanics.md +57 -0
- package/docs/guidelines/agent-infra/evaluator-independence-mechanics.md +102 -0
- package/docs/guidelines/design-fidelity-routing.md +29 -0
- package/package.json +4 -4
- package/src/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +62 -2
- package/src/agent-src/templates/scripts/work_engine/directives/backend/test.ts +1 -0
- package/src/agent-src/templates/scripts/work_engine/directives/backend/verify.ts +1 -0
- 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 +168 -27
- package/src/config/auto-rule-budget.json +16 -0
- package/src/config/ci-local-parity.yml +36 -5
- package/src/config/continuity-surface.json +23 -2
- package/src/config/gate-coverage.yml +377 -13
- package/src/config/gate-violation-baselines.json +10 -6
- package/src/config/hook-latency-budget.json +21 -0
- package/src/config/hook-token-budget.json +4 -2
- package/src/config/loop-surfaces.yaml +215 -0
- package/src/config/metric-registry.yml +114 -0
- package/src/config/placeholder-drift-budget.json +10 -0
- package/src/config/platform-anchor.json +3 -2
- package/src/config/release-gate-locality.yml +11 -0
- package/src/config/routing-coverage-seed.json +33 -5
- package/src/config/rule-enforcement-baseline.json +0 -1
- package/src/install/claudeRuleRewrite.ts +16 -2
- package/src/install/conflict.ts +65 -9
- package/src/install/conflictTracker.ts +299 -0
- package/src/install/fsPrimitives.ts +54 -0
- package/src/install/manifestFiles.ts +312 -0
- package/src/install/preflight.ts +16 -2
- package/src/install/preserve.ts +205 -0
- package/src/install/recordedOwnership.ts +149 -0
- package/src/install/txlog.ts +11 -2
- package/src/install/types.ts +19 -4
- package/src/scripts/_cli/cmd_conformance.ts +88 -15
- package/src/scripts/_cli/cmd_doctor.ts +7 -20
- package/src/scripts/_cli/cmd_route_explain.ts +9 -2
- package/src/scripts/_cli/cmd_settings_get.ts +44 -0
- package/src/scripts/_cli/doctor_execution.ts +173 -0
- package/src/scripts/_cli/doctor_network_posture.ts +226 -0
- package/src/scripts/_lib/activation_payload.ts +247 -0
- package/src/scripts/_lib/agent_settings.ts +4 -2
- package/src/scripts/_lib/authority_path.ts +102 -0
- package/src/scripts/_lib/body_portable.ts +102 -0
- package/src/scripts/_lib/cascade_base.ts +94 -0
- package/src/scripts/_lib/cc_transcript.ts +132 -1
- package/src/scripts/_lib/changelog_eras.ts +7 -2
- package/src/scripts/_lib/concern_sla_window.ts +200 -0
- package/src/scripts/_lib/continuation_ladder.ts +149 -2
- package/src/scripts/_lib/council_transport.ts +129 -0
- package/src/scripts/_lib/delivery_ready.ts +112 -0
- package/src/scripts/_lib/forge_protection.ts +381 -0
- package/src/scripts/_lib/forge_reader.ts +558 -0
- package/src/scripts/_lib/hook_platform_keys.ts +27 -0
- package/src/scripts/_lib/host_env_write.ts +111 -0
- package/src/scripts/_lib/json_python_parity.ts +127 -0
- package/src/scripts/_lib/lean_projection_mode.ts +14 -3
- package/src/scripts/_lib/llm_proposer_transport.ts +14 -4
- package/src/scripts/_lib/loop_surfaces.ts +382 -0
- package/src/scripts/_lib/mission_record.ts +190 -0
- package/src/scripts/_lib/obligation_frequency.ts +217 -0
- package/src/scripts/_lib/obligations.ts +513 -0
- package/src/scripts/_lib/orchestration_record.ts +11 -20
- 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 +201 -11
- package/src/scripts/_lib/release_holds.ts +493 -0
- package/src/scripts/_lib/release_migration_gate.ts +184 -0
- package/src/scripts/_lib/retrieval_sanitize.ts +77 -16
- package/src/scripts/_lib/rides_along.ts +102 -0
- package/src/scripts/_lib/settings_renamed_keys.ts +82 -0
- package/src/scripts/_lib/shell_write_shapes.ts +108 -0
- package/src/scripts/_lib/structural_hiding.ts +622 -0
- package/src/scripts/_lib/test_delta.ts +166 -0
- package/src/scripts/_lib/test_provenance.ts +171 -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/typed_op_grant.ts +246 -0
- package/src/scripts/_lib/typed_op_watch.ts +185 -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_council/config.ts +8 -11
- package/src/scripts/ai_council/fallback_config.ts +5 -3
- package/src/scripts/ai_council/ownership_classes.ts +118 -0
- package/src/scripts/ai_team/team_dispatch.ts +4 -0
- package/src/scripts/ask_block_census.ts +285 -15
- 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 +866 -0
- package/src/scripts/check_finding_dispositions.ts +22 -3
- package/src/scripts/check_gate_reachability.ts +173 -10
- package/src/scripts/check_generator_sync.ts +1025 -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_preamble_payload_budget.ts +75 -2
- package/src/scripts/check_read_surface_coverage.ts +515 -0
- package/src/scripts/check_release_highlights.ts +33 -1
- package/src/scripts/check_release_holds.ts +568 -0
- package/src/scripts/check_routing_coverage.ts +378 -11
- package/src/scripts/check_rule_projection_integrity.ts +22 -12
- package/src/scripts/check_static_parity.ts +17 -0
- package/src/scripts/check_test_delta.ts +294 -0
- package/src/scripts/check_test_weakening.ts +299 -0
- package/src/scripts/ci_settle.ts +145 -19
- package/src/scripts/closure_scan.ts +447 -0
- package/src/scripts/compile_hook_manifest.ts +102 -18
- package/src/scripts/council_record_shape.ts +209 -0
- package/src/scripts/external_sources_denylist.json +29 -4
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +127 -11
- 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 +6 -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 +221 -5
- 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 +97 -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 +539 -0
- package/src/scripts/hooks/obligation_settle_hook.ts +328 -0
- 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 +55 -4
- package/src/scripts/hooks/run_continuation_hook.ts +30 -35
- 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/hooks_doctor.ts +85 -0
- package/src/scripts/hooks_status.ts +19 -0
- package/src/scripts/install.ts +109 -210
- package/src/scripts/janitor.ts +7 -0
- package/src/scripts/lint_decision_classes.ts +464 -0
- 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 +66 -0
- package/src/scripts/lint_major_migration_sections.ts +450 -0
- package/src/scripts/lint_plan_risk_register.ts +47 -3
- package/src/scripts/lint_roadmap_blockers.ts +139 -12
- package/src/scripts/lint_roadmap_producers.ts +202 -0
- 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_rule_budget.ts +101 -5
- 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/new_roadmap.ts +37 -0
- package/src/scripts/orchestration_record.ts +0 -5
- package/src/scripts/prepack-check.mjs +53 -0
- package/src/scripts/release.ts +14 -98
- package/src/scripts/release_drill.ts +267 -1
- package/src/scripts/release_publication.ts +64 -1
- package/src/scripts/report_enforcement_drift.ts +566 -0
- package/src/scripts/report_host_injection_effect.ts +3 -11
- 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 +26 -152
- package/src/scripts/roadmap_verify_share.ts +213 -0
- package/src/scripts/schemas/agent-settings.schema.json +23 -0
- package/src/scripts/schemas/command.schema.json +48 -0
- package/src/scripts/schemas/review-findings.schema.json +4 -0
- package/src/scripts/schemas/skill.schema.json +44 -0
- package/src/scripts/scope_growth.ts +219 -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 -3
- package/src/scripts/trigger_eval_rotation.ts +122 -27
- package/src/scripts/ui_conformance_probe.ts +774 -0
- package/src/scripts/update_prices.ts +85 -3
- package/src/scripts/write_bundle_digest.mjs +74 -0
- package/src/server/schemas/settings.ts +62 -7
- package/src/shared/missionExecution.ts +126 -0
- package/src/templates/consumer-settings/ONBOARDING.md +1 -0
- package/dist/cli-delegate/chunk-523HCFYO.js +0 -90
- package/dist/ui/assets/index-D0jaCRPM.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
|
@@ -15,6 +15,10 @@ import {
|
|
|
15
15
|
SECTION_HEADER,
|
|
16
16
|
_is_source_repo
|
|
17
17
|
} from "./chunk-M2DPGFZ4.js";
|
|
18
|
+
import {
|
|
19
|
+
executionPostureFromOverrides,
|
|
20
|
+
resolveExecutionPosture
|
|
21
|
+
} from "./chunk-ROYYTEZU.js";
|
|
18
22
|
import {
|
|
19
23
|
DEFAULT_PROJECTS_ROOT,
|
|
20
24
|
DEFAULT_SEAT_CEILING,
|
|
@@ -23,27 +27,25 @@ import {
|
|
|
23
27
|
billableInputTokens,
|
|
24
28
|
clients_exports,
|
|
25
29
|
config_exports,
|
|
30
|
+
derivedBytes,
|
|
26
31
|
hardenedSpawnEnv,
|
|
27
32
|
load_cli_call_counts,
|
|
33
|
+
measureBytesPerToken,
|
|
28
34
|
policyExclusionReason,
|
|
29
35
|
projectStoreSlug,
|
|
30
36
|
scanTranscripts,
|
|
31
37
|
weightedInputUnits
|
|
32
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-JNMVLWLR.js";
|
|
33
39
|
import {
|
|
34
40
|
git_common_dir
|
|
35
41
|
} from "./chunk-E4XIZDIB.js";
|
|
36
42
|
import {
|
|
37
|
-
DEFAULT_DEPLOY_ROOTS,
|
|
38
43
|
MANAGED_SIGNATURE,
|
|
39
|
-
SCHEMA_VERSIONS_SUPPORTED,
|
|
40
44
|
TOOL_TO_HOST,
|
|
41
45
|
build_claude_hook_matrix,
|
|
42
46
|
global_deploy_inventory_exports,
|
|
43
|
-
manifest_path,
|
|
44
|
-
read_manifest,
|
|
45
47
|
residualReport
|
|
46
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-6KM6ORRY.js";
|
|
47
49
|
import {
|
|
48
50
|
read_lockfile
|
|
49
51
|
} from "./chunk-T7L2QK3K.js";
|
|
@@ -52,6 +54,12 @@ import {
|
|
|
52
54
|
excludedRuleBasenames,
|
|
53
55
|
ruleScopeFromSettings
|
|
54
56
|
} from "./chunk-DMSZHXZS.js";
|
|
57
|
+
import {
|
|
58
|
+
DEFAULT_DEPLOY_ROOTS,
|
|
59
|
+
SCHEMA_VERSIONS_SUPPORTED,
|
|
60
|
+
manifest_path,
|
|
61
|
+
read_manifest
|
|
62
|
+
} from "./chunk-4E2W63DA.js";
|
|
55
63
|
import {
|
|
56
64
|
require_dist
|
|
57
65
|
} from "./chunk-OY53J6II.js";
|
|
@@ -66,7 +74,7 @@ import {
|
|
|
66
74
|
iter_setting_overrides,
|
|
67
75
|
project_settings_path,
|
|
68
76
|
resolve_project_root
|
|
69
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-FC75PGJE.js";
|
|
70
78
|
import {
|
|
71
79
|
event4u_root,
|
|
72
80
|
resolve_with_fallback
|
|
@@ -79,9 +87,9 @@ import {
|
|
|
79
87
|
// src/scripts/_cli/cmd_doctor.ts
|
|
80
88
|
var YAML2 = __toESM(require_dist(), 1);
|
|
81
89
|
import * as crypto2 from "node:crypto";
|
|
82
|
-
import * as
|
|
90
|
+
import * as fs16 from "node:fs";
|
|
83
91
|
import * as os4 from "node:os";
|
|
84
|
-
import * as
|
|
92
|
+
import * as path21 from "node:path";
|
|
85
93
|
import process3 from "node:process";
|
|
86
94
|
import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL6 } from "node:url";
|
|
87
95
|
|
|
@@ -1349,7 +1357,8 @@ function computePrefixStability(drift) {
|
|
|
1349
1357
|
};
|
|
1350
1358
|
}
|
|
1351
1359
|
function buildReport2(opts) {
|
|
1352
|
-
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);
|
|
1353
1362
|
const buckets = aggregateByBucket(scan.records);
|
|
1354
1363
|
const subagentColdStart = computeColdStarts(scan.records);
|
|
1355
1364
|
const byAgent = aggregateByAgent(scan.records);
|
|
@@ -1394,6 +1403,11 @@ function buildReport2(opts) {
|
|
|
1394
1403
|
council_mispricing: councilMispricing,
|
|
1395
1404
|
worktree_fragmentation: worktreeFragmentation,
|
|
1396
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
|
+
},
|
|
1397
1411
|
claims
|
|
1398
1412
|
};
|
|
1399
1413
|
}
|
|
@@ -1419,6 +1433,25 @@ function renderText3(r) {
|
|
|
1419
1433
|
out.push(` unstable cohort: n=${ps.unstable_cohort.n} read_share=${share(ps.unstable_cohort.read_share)}`);
|
|
1420
1434
|
out.push(` ${ps.reason}`);
|
|
1421
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("");
|
|
1422
1455
|
out.push("By bucket:");
|
|
1423
1456
|
for (const bucket of ["main", "subagent"]) {
|
|
1424
1457
|
const b = r.buckets[bucket];
|
|
@@ -2835,16 +2868,444 @@ function checkHumanizerRuntime(which) {
|
|
|
2835
2868
|
};
|
|
2836
2869
|
}
|
|
2837
2870
|
|
|
2838
|
-
// src/scripts/_lib/
|
|
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
|
+
}
|
|
2890
|
+
var SOURCE = {
|
|
2891
|
+
rulesets: "GET repos/{owner}/{repo}/rulesets + GET .../rulesets/{id}",
|
|
2892
|
+
repo: "GET repos/{owner}/{repo} (allow_auto_merge)",
|
|
2893
|
+
environments: "GET repos/{owner}/{repo}/environments (deployment_branch_policy)"
|
|
2894
|
+
};
|
|
2895
|
+
function isActiveBranchRuleset(rs) {
|
|
2896
|
+
return rs.enforcement === "active" && rs.target === "branch";
|
|
2897
|
+
}
|
|
2898
|
+
function reachesDefaultBranch(rs, defaultBranch) {
|
|
2899
|
+
const include = rs.conditions?.ref_name?.include ?? [];
|
|
2900
|
+
return include.some(
|
|
2901
|
+
(p) => p === "~DEFAULT_BRANCH" || p === "~ALL" || p === `refs/heads/${defaultBranch}`
|
|
2902
|
+
);
|
|
2903
|
+
}
|
|
2904
|
+
function hasRule(rs, type) {
|
|
2905
|
+
return (rs.rules ?? []).some((r) => r.type === type);
|
|
2906
|
+
}
|
|
2907
|
+
function requiredContexts(rs) {
|
|
2908
|
+
for (const r of rs.rules ?? []) {
|
|
2909
|
+
if (r.type !== "required_status_checks") continue;
|
|
2910
|
+
const p = r.parameters;
|
|
2911
|
+
if (p === null || typeof p !== "object") continue;
|
|
2912
|
+
const list = p["required_status_checks"];
|
|
2913
|
+
if (!Array.isArray(list)) continue;
|
|
2914
|
+
return list.map(
|
|
2915
|
+
(e) => e !== null && typeof e === "object" ? e["context"] : null
|
|
2916
|
+
).filter((c) => typeof c === "string");
|
|
2917
|
+
}
|
|
2918
|
+
return [];
|
|
2919
|
+
}
|
|
2920
|
+
function forgeProtectionRows(reading) {
|
|
2921
|
+
const rows = [];
|
|
2922
|
+
const rulesets = reading.rulesets;
|
|
2923
|
+
const branch = reading.defaultBranch;
|
|
2924
|
+
const covering = rulesets === null || branch === null ? null : rulesets.filter((rs) => isActiveBranchRuleset(rs) && reachesDefaultBranch(rs, branch));
|
|
2925
|
+
rows.push(
|
|
2926
|
+
covering === null ? {
|
|
2927
|
+
id: "default_branch_protected",
|
|
2928
|
+
state: "unread",
|
|
2929
|
+
source: SOURCE.rulesets,
|
|
2930
|
+
detail: "the rulesets were not queried"
|
|
2931
|
+
} : covering.length > 0 ? {
|
|
2932
|
+
id: "default_branch_protected",
|
|
2933
|
+
state: "satisfied",
|
|
2934
|
+
source: SOURCE.rulesets,
|
|
2935
|
+
detail: `${String(covering.length)} active branch ruleset(s) cover the default branch`
|
|
2936
|
+
} : {
|
|
2937
|
+
id: "default_branch_protected",
|
|
2938
|
+
state: "unsatisfied",
|
|
2939
|
+
source: SOURCE.rulesets,
|
|
2940
|
+
detail: "no active branch ruleset covers the default branch. NOTE: the classic branches/<b>/protection endpoint 404s on a ruleset-protected repository, so a 404 there is not evidence for this row."
|
|
2941
|
+
}
|
|
2942
|
+
);
|
|
2943
|
+
const contexts = covering === null ? null : covering.flatMap(requiredContexts);
|
|
2944
|
+
rows.push(
|
|
2945
|
+
contexts === null ? {
|
|
2946
|
+
id: "required_checks_present",
|
|
2947
|
+
state: "unread",
|
|
2948
|
+
source: SOURCE.rulesets,
|
|
2949
|
+
detail: "the rulesets were not queried"
|
|
2950
|
+
} : contexts.length > 0 ? {
|
|
2951
|
+
id: "required_checks_present",
|
|
2952
|
+
state: "satisfied",
|
|
2953
|
+
source: SOURCE.rulesets,
|
|
2954
|
+
detail: `${String(contexts.length)} required context(s): ${contexts.join(", ")}`
|
|
2955
|
+
} : {
|
|
2956
|
+
id: "required_checks_present",
|
|
2957
|
+
state: "unsatisfied",
|
|
2958
|
+
source: SOURCE.rulesets,
|
|
2959
|
+
detail: "no required status check context is configured"
|
|
2960
|
+
}
|
|
2961
|
+
);
|
|
2962
|
+
const noFastForward = covering === null ? null : covering.some((rs) => hasRule(rs, "non_fast_forward"));
|
|
2963
|
+
rows.push(
|
|
2964
|
+
noFastForward === null ? {
|
|
2965
|
+
id: "force_push_disabled",
|
|
2966
|
+
state: "unread",
|
|
2967
|
+
source: SOURCE.rulesets,
|
|
2968
|
+
detail: "the rulesets were not queried"
|
|
2969
|
+
} : {
|
|
2970
|
+
id: "force_push_disabled",
|
|
2971
|
+
state: noFastForward ? "satisfied" : "unsatisfied",
|
|
2972
|
+
source: SOURCE.rulesets,
|
|
2973
|
+
detail: noFastForward ? "a non_fast_forward rule is active on the default branch" : "no non_fast_forward rule covers the default branch"
|
|
2974
|
+
}
|
|
2975
|
+
);
|
|
2976
|
+
rows.push(
|
|
2977
|
+
reading.allowAutoMerge === null ? {
|
|
2978
|
+
id: "auto_merge_available",
|
|
2979
|
+
state: "unread",
|
|
2980
|
+
source: SOURCE.repo,
|
|
2981
|
+
detail: "the repository record was not queried"
|
|
2982
|
+
} : {
|
|
2983
|
+
id: "auto_merge_available",
|
|
2984
|
+
state: reading.allowAutoMerge ? "satisfied" : "unsatisfied",
|
|
2985
|
+
source: SOURCE.repo,
|
|
2986
|
+
detail: reading.allowAutoMerge ? "allow_auto_merge is enabled" : "allow_auto_merge is disabled \u2014 merge delivery cannot queue behind checks"
|
|
2987
|
+
}
|
|
2988
|
+
);
|
|
2989
|
+
rows.push(
|
|
2990
|
+
reading.deployRestricted === null ? {
|
|
2991
|
+
id: "deploy_via_pipeline_only",
|
|
2992
|
+
state: "unread",
|
|
2993
|
+
source: SOURCE.environments,
|
|
2994
|
+
detail: "the environments were not queried"
|
|
2995
|
+
} : {
|
|
2996
|
+
id: "deploy_via_pipeline_only",
|
|
2997
|
+
state: reading.deployRestricted ? "satisfied" : "unsatisfied",
|
|
2998
|
+
source: SOURCE.environments,
|
|
2999
|
+
detail: reading.deployRestricted ? "every environment restricts its deployment branches" : "at least one environment accepts a deployment from any branch"
|
|
3000
|
+
}
|
|
3001
|
+
);
|
|
3002
|
+
return rows;
|
|
3003
|
+
}
|
|
3004
|
+
function protectionActions(rows) {
|
|
3005
|
+
return rows.filter((r) => r.state !== "satisfied").map((r) => `${r.id}: ${r.state} \u2014 ${r.detail} (source: ${r.source})`);
|
|
3006
|
+
}
|
|
3007
|
+
|
|
3008
|
+
// src/scripts/_lib/forge_reader.ts
|
|
2839
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
|
+
|
|
3177
|
+
// src/scripts/_cli/doctor_execution.ts
|
|
3178
|
+
function executionJson(overrides) {
|
|
3179
|
+
let posture;
|
|
3180
|
+
try {
|
|
3181
|
+
posture = executionPostureFromOverrides(overrides());
|
|
3182
|
+
} catch {
|
|
3183
|
+
posture = resolveExecutionPosture({});
|
|
3184
|
+
}
|
|
3185
|
+
return {
|
|
3186
|
+
fix_loop_max: posture.fix_loop_max,
|
|
3187
|
+
escalation: [...posture.escalation]
|
|
3188
|
+
};
|
|
3189
|
+
}
|
|
3190
|
+
function forgeProtectionJson(reading, repo = null) {
|
|
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);
|
|
3195
|
+
return {
|
|
3196
|
+
repository: readFromForge ? repo : null,
|
|
3197
|
+
rows: rows.map((r) => ({
|
|
3198
|
+
id: r.id,
|
|
3199
|
+
state: r.state,
|
|
3200
|
+
source: name(r.source),
|
|
3201
|
+
detail: r.detail
|
|
3202
|
+
})),
|
|
3203
|
+
actions: protectionActions(rows).map(name),
|
|
3204
|
+
read_from_forge: readFromForge
|
|
3205
|
+
};
|
|
3206
|
+
}
|
|
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
|
+
}
|
|
3224
|
+
|
|
3225
|
+
// src/scripts/_cli/doctor_network_posture.ts
|
|
2840
3226
|
import * as fs13 from "node:fs";
|
|
2841
|
-
import * as os2 from "node:os";
|
|
2842
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";
|
|
2843
3304
|
|
|
2844
3305
|
// src/install/toolDetection.ts
|
|
2845
3306
|
import { existsSync as existsSync9 } from "node:fs";
|
|
2846
3307
|
import { homedir as homedir4 } from "node:os";
|
|
2847
|
-
import { delimiter, join as
|
|
3308
|
+
import { delimiter, join as join17 } from "node:path";
|
|
2848
3309
|
var TOOL_SIGNALS = {
|
|
2849
3310
|
"claude-code": { bins: ["claude"], homePaths: [".claude", ".claude.json", ".config/claude"] },
|
|
2850
3311
|
"claude-desktop": { absPaths: ["/Applications/Claude.app"], homePaths: ["Library/Application Support/Claude", ".config/Claude"] },
|
|
@@ -2889,7 +3350,7 @@ function resolveBinaryPath(name, pathEnv) {
|
|
|
2889
3350
|
for (const dir of pathEnv.split(delimiter)) {
|
|
2890
3351
|
if (dir.length === 0) continue;
|
|
2891
3352
|
for (const candidate of [name, `${name}.exe`, `${name}.cmd`]) {
|
|
2892
|
-
const full =
|
|
3353
|
+
const full = join17(dir, candidate);
|
|
2893
3354
|
if (existsSync9(full)) return full;
|
|
2894
3355
|
}
|
|
2895
3356
|
}
|
|
@@ -2900,7 +3361,7 @@ function binOnPath(name, pathEnv) {
|
|
|
2900
3361
|
}
|
|
2901
3362
|
function isToolInstalled(signal, home, pathEnv) {
|
|
2902
3363
|
for (const rel of signal.homePaths ?? []) {
|
|
2903
|
-
if (existsSync9(
|
|
3364
|
+
if (existsSync9(join17(home, rel))) return true;
|
|
2904
3365
|
}
|
|
2905
3366
|
for (const abs of signal.absPaths ?? []) {
|
|
2906
3367
|
if (existsSync9(abs)) return true;
|
|
@@ -2962,7 +3423,7 @@ function classifyBilling(provider, source) {
|
|
|
2962
3423
|
function codexHome(env) {
|
|
2963
3424
|
const map = env ?? process.env;
|
|
2964
3425
|
const override = (map["CODEX_HOME"] ?? "").trim();
|
|
2965
|
-
return override !== "" ? override :
|
|
3426
|
+
return override !== "" ? override : path18.join(homeOf(env), ".codex");
|
|
2966
3427
|
}
|
|
2967
3428
|
function homeOf(env) {
|
|
2968
3429
|
const map = env ?? process.env;
|
|
@@ -2974,7 +3435,7 @@ var CLAUDE_KEYCHAIN_SERVICE = "Claude Code-credentials";
|
|
|
2974
3435
|
function defaultProbeKeychain(service) {
|
|
2975
3436
|
if (process.platform !== "darwin") return false;
|
|
2976
3437
|
try {
|
|
2977
|
-
const res =
|
|
3438
|
+
const res = spawnSync2("security", ["find-generic-password", "-s", service], {
|
|
2978
3439
|
timeout: VERSION_PROBE_TIMEOUT_MS,
|
|
2979
3440
|
encoding: "utf-8",
|
|
2980
3441
|
windowsHide: true,
|
|
@@ -2988,7 +3449,7 @@ function defaultProbeKeychain(service) {
|
|
|
2988
3449
|
}
|
|
2989
3450
|
function defaultProbeVersion(binary) {
|
|
2990
3451
|
try {
|
|
2991
|
-
const res =
|
|
3452
|
+
const res = spawnSync2(binary, ["--version"], {
|
|
2992
3453
|
timeout: VERSION_PROBE_TIMEOUT_MS,
|
|
2993
3454
|
encoding: "utf-8",
|
|
2994
3455
|
windowsHide: true,
|
|
@@ -3003,14 +3464,14 @@ ${res.stderr ?? ""}`;
|
|
|
3003
3464
|
}
|
|
3004
3465
|
function isFile3(p) {
|
|
3005
3466
|
try {
|
|
3006
|
-
return
|
|
3467
|
+
return fs14.statSync(p).isFile();
|
|
3007
3468
|
} catch {
|
|
3008
3469
|
return false;
|
|
3009
3470
|
}
|
|
3010
3471
|
}
|
|
3011
3472
|
function exists(p) {
|
|
3012
3473
|
try {
|
|
3013
|
-
return
|
|
3474
|
+
return fs14.existsSync(p);
|
|
3014
3475
|
} catch {
|
|
3015
3476
|
return false;
|
|
3016
3477
|
}
|
|
@@ -3018,7 +3479,7 @@ function exists(p) {
|
|
|
3018
3479
|
function classifyCodexAuth(authPath) {
|
|
3019
3480
|
let data;
|
|
3020
3481
|
try {
|
|
3021
|
-
data = JSON.parse(
|
|
3482
|
+
data = JSON.parse(fs14.readFileSync(authPath, "utf-8"));
|
|
3022
3483
|
} catch {
|
|
3023
3484
|
return "cli-api-key";
|
|
3024
3485
|
}
|
|
@@ -3035,7 +3496,7 @@ function cliSubscriptionEvidence(provider, home, env, claudeConfigDir, probeKeyc
|
|
|
3035
3496
|
if (provider === "anthropic") {
|
|
3036
3497
|
const configDir = claudeConfigDir;
|
|
3037
3498
|
for (const rel of [".credentials.json", "credentials.json"]) {
|
|
3038
|
-
const p =
|
|
3499
|
+
const p = path18.join(configDir, rel);
|
|
3039
3500
|
if (isFile3(p)) return { source: "cli-subscription", evidence: p };
|
|
3040
3501
|
}
|
|
3041
3502
|
if (probeKeychain(CLAUDE_KEYCHAIN_SERVICE)) {
|
|
@@ -3044,12 +3505,12 @@ function cliSubscriptionEvidence(provider, home, env, claudeConfigDir, probeKeyc
|
|
|
3044
3505
|
return null;
|
|
3045
3506
|
}
|
|
3046
3507
|
if (provider === "openai") {
|
|
3047
|
-
const p =
|
|
3508
|
+
const p = path18.join(codexHome(env), "auth.json");
|
|
3048
3509
|
if (isFile3(p)) return { source: classifyCodexAuth(p), evidence: p };
|
|
3049
3510
|
return null;
|
|
3050
3511
|
}
|
|
3051
3512
|
if (provider === "gemini") {
|
|
3052
|
-
const p =
|
|
3513
|
+
const p = path18.join(home, ".gemini", "oauth_creds.json");
|
|
3053
3514
|
if (isFile3(p)) return { source: "cli-subscription", evidence: p };
|
|
3054
3515
|
return null;
|
|
3055
3516
|
}
|
|
@@ -3081,7 +3542,7 @@ function detectHosts(opts) {
|
|
|
3081
3542
|
function detectAuth(opts) {
|
|
3082
3543
|
const env = opts.env ?? process.env;
|
|
3083
3544
|
const home = opts.home ?? homeOf(opts.env);
|
|
3084
|
-
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");
|
|
3085
3546
|
const probeKeychain = opts.probeKeychain ?? defaultProbeKeychain;
|
|
3086
3547
|
const auth = [];
|
|
3087
3548
|
const keys = [];
|
|
@@ -3136,7 +3597,7 @@ function detectEnvironment(opts = {}) {
|
|
|
3136
3597
|
}
|
|
3137
3598
|
|
|
3138
3599
|
// src/scripts/_cli/detection_report.ts
|
|
3139
|
-
import * as
|
|
3600
|
+
import * as path19 from "node:path";
|
|
3140
3601
|
|
|
3141
3602
|
// src/scripts/ai_council/transport_resolver.ts
|
|
3142
3603
|
var VALID_TRANSPORT_MODES = /* @__PURE__ */ new Set([
|
|
@@ -3354,7 +3815,7 @@ function cliBinaryPresent(environment, provider, binaryOverride) {
|
|
|
3354
3815
|
const expected = PROVIDER_CLI_META[provider]?.[0];
|
|
3355
3816
|
if (expected === void 0) return false;
|
|
3356
3817
|
return environment.hosts.some(
|
|
3357
|
-
(h) => h.binary !== null && stripExe(
|
|
3818
|
+
(h) => h.binary !== null && stripExe(path19.basename(h.binary)) === expected
|
|
3358
3819
|
);
|
|
3359
3820
|
}
|
|
3360
3821
|
function stripExe(name) {
|
|
@@ -3515,9 +3976,9 @@ function absentCouncilFacts(configPath) {
|
|
|
3515
3976
|
|
|
3516
3977
|
// src/scripts/ai_team/review_gate.ts
|
|
3517
3978
|
import * as crypto from "node:crypto";
|
|
3518
|
-
import * as
|
|
3979
|
+
import * as fs15 from "node:fs";
|
|
3519
3980
|
import * as os3 from "node:os";
|
|
3520
|
-
import * as
|
|
3981
|
+
import * as path20 from "node:path";
|
|
3521
3982
|
|
|
3522
3983
|
// src/scripts/ai_team/config.ts
|
|
3523
3984
|
var AI_TEAM_REVIEW_GATE_DEFAULTS = Object.freeze({
|
|
@@ -3533,16 +3994,16 @@ var AI_TEAM_DEFAULTS = Object.freeze({
|
|
|
3533
3994
|
});
|
|
3534
3995
|
|
|
3535
3996
|
// src/scripts/ai_team/review_gate.ts
|
|
3536
|
-
var GATE_LEDGER_RELPATH =
|
|
3997
|
+
var GATE_LEDGER_RELPATH = path20.join("agents", "runtime", "team", "events.log");
|
|
3537
3998
|
var _CODEX_PLUGIN_DATA_DIRNAME = `${CODEX_PLUGIN_ID}-${CODEX_MARKETPLACE_NAME}`;
|
|
3538
3999
|
function _workspace_state_segment(workspace_root) {
|
|
3539
4000
|
let canonical = workspace_root;
|
|
3540
4001
|
try {
|
|
3541
|
-
canonical =
|
|
4002
|
+
canonical = fs15.realpathSync.native(workspace_root);
|
|
3542
4003
|
} catch {
|
|
3543
4004
|
canonical = workspace_root;
|
|
3544
4005
|
}
|
|
3545
|
-
const slug_source =
|
|
4006
|
+
const slug_source = path20.basename(workspace_root) || "workspace";
|
|
3546
4007
|
const slug = slug_source.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "workspace";
|
|
3547
4008
|
const hash = crypto.createHash("sha256").update(canonical).digest("hex").slice(0, 16);
|
|
3548
4009
|
return `${slug}-${hash}`;
|
|
@@ -3552,19 +4013,19 @@ function upstream_state_dir_candidates(workspace_root) {
|
|
|
3552
4013
|
const candidates = [];
|
|
3553
4014
|
const env = (process.env["CLAUDE_PLUGIN_DATA"] ?? "").trim();
|
|
3554
4015
|
if (env !== "") {
|
|
3555
|
-
candidates.push(
|
|
4016
|
+
candidates.push(path20.join(env, "state", segment));
|
|
3556
4017
|
}
|
|
3557
4018
|
candidates.push(
|
|
3558
|
-
|
|
4019
|
+
path20.join(claude_config_dir(), "plugins", "data", _CODEX_PLUGIN_DATA_DIRNAME, "state", segment)
|
|
3559
4020
|
);
|
|
3560
|
-
candidates.push(
|
|
4021
|
+
candidates.push(path20.join(os3.tmpdir(), "codex-companion", segment));
|
|
3561
4022
|
return candidates;
|
|
3562
4023
|
}
|
|
3563
4024
|
function upstream_gate_enabled(workspace_root) {
|
|
3564
4025
|
for (const dir of upstream_state_dir_candidates(workspace_root)) {
|
|
3565
4026
|
let parsed;
|
|
3566
4027
|
try {
|
|
3567
|
-
parsed = JSON.parse(
|
|
4028
|
+
parsed = JSON.parse(fs15.readFileSync(path20.join(dir, "state.json"), "utf-8"));
|
|
3568
4029
|
} catch {
|
|
3569
4030
|
continue;
|
|
3570
4031
|
}
|
|
@@ -3721,13 +4182,13 @@ var ArgparseExit = class extends Error {
|
|
|
3721
4182
|
function expanduser(p) {
|
|
3722
4183
|
if (p === "~") return os4.homedir();
|
|
3723
4184
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
3724
|
-
return
|
|
4185
|
+
return path21.join(os4.homedir(), p.slice(2));
|
|
3725
4186
|
}
|
|
3726
4187
|
return p;
|
|
3727
4188
|
}
|
|
3728
|
-
function
|
|
4189
|
+
function pathExists2(p) {
|
|
3729
4190
|
try {
|
|
3730
|
-
|
|
4191
|
+
fs16.statSync(p);
|
|
3731
4192
|
return true;
|
|
3732
4193
|
} catch {
|
|
3733
4194
|
return false;
|
|
@@ -3735,27 +4196,27 @@ function pathExists(p) {
|
|
|
3735
4196
|
}
|
|
3736
4197
|
function isFile4(p) {
|
|
3737
4198
|
try {
|
|
3738
|
-
return
|
|
4199
|
+
return fs16.statSync(p).isFile();
|
|
3739
4200
|
} catch {
|
|
3740
4201
|
return false;
|
|
3741
4202
|
}
|
|
3742
4203
|
}
|
|
3743
4204
|
function isDir3(p) {
|
|
3744
4205
|
try {
|
|
3745
|
-
return
|
|
4206
|
+
return fs16.statSync(p).isDirectory();
|
|
3746
4207
|
} catch {
|
|
3747
4208
|
return false;
|
|
3748
4209
|
}
|
|
3749
4210
|
}
|
|
3750
4211
|
function resolvePath(p) {
|
|
3751
4212
|
try {
|
|
3752
|
-
return
|
|
4213
|
+
return fs16.realpathSync(path21.resolve(p));
|
|
3753
4214
|
} catch {
|
|
3754
|
-
return
|
|
4215
|
+
return path21.resolve(p);
|
|
3755
4216
|
}
|
|
3756
4217
|
}
|
|
3757
4218
|
function readText(p) {
|
|
3758
|
-
return
|
|
4219
|
+
return fs16.readFileSync(p, "utf-8");
|
|
3759
4220
|
}
|
|
3760
4221
|
function _jsonStrAscii(s) {
|
|
3761
4222
|
let out = '"';
|
|
@@ -3866,7 +4327,7 @@ function _resolve_project_root(arg) {
|
|
|
3866
4327
|
}
|
|
3867
4328
|
var _INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
3868
4329
|
function _detect_install_mode(project_root) {
|
|
3869
|
-
const marker =
|
|
4330
|
+
const marker = path21.join(project_root, _INSTALL_MODE_MARKER_REL);
|
|
3870
4331
|
if (isFile4(marker)) {
|
|
3871
4332
|
let value;
|
|
3872
4333
|
try {
|
|
@@ -3878,9 +4339,9 @@ function _detect_install_mode(project_root) {
|
|
|
3878
4339
|
return [value, "marker-file"];
|
|
3879
4340
|
}
|
|
3880
4341
|
}
|
|
3881
|
-
const has_agents_md =
|
|
3882
|
-
const has_copilot =
|
|
3883
|
-
|
|
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")
|
|
3884
4345
|
);
|
|
3885
4346
|
if (has_agents_md && has_copilot) {
|
|
3886
4347
|
return ["full", "heuristic"];
|
|
@@ -3900,8 +4361,8 @@ function _settings_layer_chain(project_root) {
|
|
|
3900
4361
|
return layers;
|
|
3901
4362
|
}
|
|
3902
4363
|
function _detect_wrapper(project_root) {
|
|
3903
|
-
const wrapper =
|
|
3904
|
-
if (!
|
|
4364
|
+
const wrapper = path21.join(project_root, "agent-config");
|
|
4365
|
+
if (!pathExists2(wrapper)) {
|
|
3905
4366
|
return { path: String(wrapper), exists: false, embedded_root: null };
|
|
3906
4367
|
}
|
|
3907
4368
|
return {
|
|
@@ -3967,14 +4428,14 @@ function _emit_context_text(ctx) {
|
|
|
3967
4428
|
}
|
|
3968
4429
|
function _resolve_path(project_root, raw) {
|
|
3969
4430
|
let p = expanduser(raw);
|
|
3970
|
-
if (!
|
|
3971
|
-
p =
|
|
4431
|
+
if (!path21.isAbsolute(p)) {
|
|
4432
|
+
p = path21.join(project_root, p);
|
|
3972
4433
|
}
|
|
3973
4434
|
return p;
|
|
3974
4435
|
}
|
|
3975
4436
|
function _sha256(p) {
|
|
3976
4437
|
try {
|
|
3977
|
-
const data =
|
|
4438
|
+
const data = fs16.readFileSync(p);
|
|
3978
4439
|
return crypto2.createHash("sha256").update(data).digest("hex");
|
|
3979
4440
|
} catch {
|
|
3980
4441
|
return null;
|
|
@@ -3983,7 +4444,7 @@ function _sha256(p) {
|
|
|
3983
4444
|
var PACKAGE_TAG_ID2 = "event4u/agent-config";
|
|
3984
4445
|
var _FRONTMATTER_PACKAGE_RE = /^package:\s*(.+?)\s*$/m;
|
|
3985
4446
|
function _read_inline_package_tag(p) {
|
|
3986
|
-
if (
|
|
4447
|
+
if (path21.extname(p) !== ".md") {
|
|
3987
4448
|
return NO_FRONTMATTER;
|
|
3988
4449
|
}
|
|
3989
4450
|
let text;
|
|
@@ -4084,7 +4545,7 @@ function _scan_foreign(project_root, manifest, known) {
|
|
|
4084
4545
|
const seen = /* @__PURE__ */ new Set();
|
|
4085
4546
|
for (const root_rel of roots) {
|
|
4086
4547
|
const root = _resolve_path(project_root, String(root_rel));
|
|
4087
|
-
if (!
|
|
4548
|
+
if (!pathExists2(root) || !isDir3(root)) {
|
|
4088
4549
|
continue;
|
|
4089
4550
|
}
|
|
4090
4551
|
for (const child of rglob(root)) {
|
|
@@ -4112,13 +4573,13 @@ function rglob(root) {
|
|
|
4112
4573
|
const walk = (dir) => {
|
|
4113
4574
|
let entries;
|
|
4114
4575
|
try {
|
|
4115
|
-
entries =
|
|
4576
|
+
entries = fs16.readdirSync(dir, { withFileTypes: true });
|
|
4116
4577
|
} catch {
|
|
4117
4578
|
return;
|
|
4118
4579
|
}
|
|
4119
4580
|
entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
4120
4581
|
for (const ent of entries) {
|
|
4121
|
-
const full =
|
|
4582
|
+
const full = path21.join(dir, ent.name);
|
|
4122
4583
|
out.push(full);
|
|
4123
4584
|
let dirLike = ent.isDirectory();
|
|
4124
4585
|
if (ent.isSymbolicLink()) {
|
|
@@ -4137,7 +4598,7 @@ function _classify(records) {
|
|
|
4137
4598
|
const modified = [];
|
|
4138
4599
|
const tag_drift = [];
|
|
4139
4600
|
for (const [tool_id, target, kind, expected] of records) {
|
|
4140
|
-
if (!
|
|
4601
|
+
if (!pathExists2(target)) {
|
|
4141
4602
|
missing.push({
|
|
4142
4603
|
tool: tool_id,
|
|
4143
4604
|
path: String(target),
|
|
@@ -4193,9 +4654,9 @@ function _foreign_records(project_root, foreign) {
|
|
|
4193
4654
|
return out;
|
|
4194
4655
|
}
|
|
4195
4656
|
function relativeTo(p, base) {
|
|
4196
|
-
const rel =
|
|
4657
|
+
const rel = path21.relative(base, p);
|
|
4197
4658
|
if (rel === "") return rel;
|
|
4198
|
-
if (rel.startsWith("..") ||
|
|
4659
|
+
if (rel.startsWith("..") || path21.isAbsolute(rel)) {
|
|
4199
4660
|
return null;
|
|
4200
4661
|
}
|
|
4201
4662
|
return rel;
|
|
@@ -4281,7 +4742,7 @@ var STATUS_SYMBOLS = {
|
|
|
4281
4742
|
var MIN_PYTHON = [3, 10];
|
|
4282
4743
|
function _check_scope(project_root) {
|
|
4283
4744
|
for (const marker of ["pnpm-workspace.yaml", "lerna.json"]) {
|
|
4284
|
-
if (
|
|
4745
|
+
if (pathExists2(path21.join(project_root, marker))) {
|
|
4285
4746
|
return {
|
|
4286
4747
|
id: "scope",
|
|
4287
4748
|
status: "warn",
|
|
@@ -4290,8 +4751,8 @@ function _check_scope(project_root) {
|
|
|
4290
4751
|
};
|
|
4291
4752
|
}
|
|
4292
4753
|
}
|
|
4293
|
-
const pkg =
|
|
4294
|
-
if (
|
|
4754
|
+
const pkg = path21.join(project_root, "package.json");
|
|
4755
|
+
if (pathExists2(pkg)) {
|
|
4295
4756
|
try {
|
|
4296
4757
|
const data = JSON.parse(readText(pkg));
|
|
4297
4758
|
if (data["workspaces"]) {
|
|
@@ -4316,7 +4777,7 @@ var _PLACEHOLDER_EMAIL_RE = /^(t@t\.t|.*@example\.(com|org)|.*@localhost)$/i;
|
|
|
4316
4777
|
var _PLACEHOLDER_NAME_RE = /^(t|test|user|nobody|x)$/i;
|
|
4317
4778
|
function _git_config_path(project_root) {
|
|
4318
4779
|
const common = git_common_dir(project_root);
|
|
4319
|
-
return common === null ? null :
|
|
4780
|
+
return common === null ? null : path21.join(common, "config");
|
|
4320
4781
|
}
|
|
4321
4782
|
function _parse_git_user(configText) {
|
|
4322
4783
|
let inUser = false;
|
|
@@ -4341,13 +4802,13 @@ function _parse_git_user(configText) {
|
|
|
4341
4802
|
}
|
|
4342
4803
|
function _check_git_identity(project_root) {
|
|
4343
4804
|
const cfgPath = _git_config_path(project_root);
|
|
4344
|
-
if (cfgPath === null || !
|
|
4805
|
+
if (cfgPath === null || !pathExists2(cfgPath)) {
|
|
4345
4806
|
return { id: "git-identity", status: "skipped", message: "not a git repository", remedy: "" };
|
|
4346
4807
|
}
|
|
4347
4808
|
let ident = _parse_git_user(readText(cfgPath));
|
|
4348
4809
|
if (ident.name === null && ident.email === null) {
|
|
4349
|
-
const globalCfg =
|
|
4350
|
-
if (
|
|
4810
|
+
const globalCfg = path21.join(os4.homedir(), ".gitconfig");
|
|
4811
|
+
if (pathExists2(globalCfg)) {
|
|
4351
4812
|
ident = _parse_git_user(readText(globalCfg));
|
|
4352
4813
|
}
|
|
4353
4814
|
}
|
|
@@ -4407,7 +4868,7 @@ function _package_root() {
|
|
|
4407
4868
|
}
|
|
4408
4869
|
function _current_package_version() {
|
|
4409
4870
|
try {
|
|
4410
|
-
const data = JSON.parse(readText(
|
|
4871
|
+
const data = JSON.parse(readText(path21.join(_package_root(), "package.json")));
|
|
4411
4872
|
const v = data["version"];
|
|
4412
4873
|
if (typeof v === "string" && v.trim()) {
|
|
4413
4874
|
return v.trim();
|
|
@@ -4451,7 +4912,7 @@ function _check_lockfile_freshness(manifest) {
|
|
|
4451
4912
|
};
|
|
4452
4913
|
}
|
|
4453
4914
|
function shutilWhich(name) {
|
|
4454
|
-
if (
|
|
4915
|
+
if (path21.dirname(name) !== "." && (name.includes("/") || name.includes("\\"))) {
|
|
4455
4916
|
return isExecutableFile(name) ? name : null;
|
|
4456
4917
|
}
|
|
4457
4918
|
const pathEnv = process3.env["PATH"] || "";
|
|
@@ -4464,12 +4925,12 @@ function shutilWhich(name) {
|
|
|
4464
4925
|
if (seenDirs.has(d)) continue;
|
|
4465
4926
|
seenDirs.add(d);
|
|
4466
4927
|
for (const ext of exts) {
|
|
4467
|
-
const candidate =
|
|
4928
|
+
const candidate = path21.join(d, name + (ext === "" ? "" : ext.toLowerCase() === ext ? ext : ext));
|
|
4468
4929
|
if (isExecutableFile(candidate)) {
|
|
4469
4930
|
return candidate;
|
|
4470
4931
|
}
|
|
4471
4932
|
if (ext !== "") {
|
|
4472
|
-
const upper =
|
|
4933
|
+
const upper = path21.join(d, name + ext);
|
|
4473
4934
|
if (isExecutableFile(upper)) return upper;
|
|
4474
4935
|
}
|
|
4475
4936
|
}
|
|
@@ -4478,10 +4939,10 @@ function shutilWhich(name) {
|
|
|
4478
4939
|
}
|
|
4479
4940
|
function isExecutableFile(p) {
|
|
4480
4941
|
try {
|
|
4481
|
-
const st =
|
|
4942
|
+
const st = fs16.statSync(p);
|
|
4482
4943
|
if (!st.isFile()) return false;
|
|
4483
4944
|
if (process3.platform === "win32") return true;
|
|
4484
|
-
|
|
4945
|
+
fs16.accessSync(p, fs16.constants.X_OK);
|
|
4485
4946
|
return true;
|
|
4486
4947
|
} catch {
|
|
4487
4948
|
return false;
|
|
@@ -4545,7 +5006,7 @@ function _check_claude_plugin() {
|
|
|
4545
5006
|
remedy: ""
|
|
4546
5007
|
};
|
|
4547
5008
|
}
|
|
4548
|
-
const projection =
|
|
5009
|
+
const projection = path21.join(os4.homedir(), ".claude", "skills");
|
|
4549
5010
|
const projection_present = isDir3(projection);
|
|
4550
5011
|
if (projection_present) {
|
|
4551
5012
|
return {
|
|
@@ -4582,8 +5043,8 @@ function _check_claude_command_wrappers() {
|
|
|
4582
5043
|
remedy: ""
|
|
4583
5044
|
};
|
|
4584
5045
|
}
|
|
4585
|
-
const anchor =
|
|
4586
|
-
const commands_dir =
|
|
5046
|
+
const anchor = path21.join(os4.homedir(), ".claude");
|
|
5047
|
+
const commands_dir = path21.join(anchor, "commands");
|
|
4587
5048
|
if (!isDir3(commands_dir)) {
|
|
4588
5049
|
return {
|
|
4589
5050
|
id: "claude-command-wrappers",
|
|
@@ -4592,8 +5053,8 @@ function _check_claude_command_wrappers() {
|
|
|
4592
5053
|
remedy: ""
|
|
4593
5054
|
};
|
|
4594
5055
|
}
|
|
4595
|
-
const flat_probe =
|
|
4596
|
-
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"));
|
|
4597
5058
|
if (wrapper_probe) {
|
|
4598
5059
|
return {
|
|
4599
5060
|
id: "claude-command-wrappers",
|
|
@@ -4618,7 +5079,7 @@ function _check_claude_command_wrappers() {
|
|
|
4618
5079
|
};
|
|
4619
5080
|
}
|
|
4620
5081
|
function _check_surface_state() {
|
|
4621
|
-
const matrix_path =
|
|
5082
|
+
const matrix_path = path21.join(_package_root(), "src", "config", "surface-matrix.yml");
|
|
4622
5083
|
if (!isFile4(matrix_path)) {
|
|
4623
5084
|
return {
|
|
4624
5085
|
id: "surface-state",
|
|
@@ -4642,7 +5103,7 @@ function _check_surface_state() {
|
|
|
4642
5103
|
remedy: "agent-config upgrade (reinstalls the package data files)"
|
|
4643
5104
|
};
|
|
4644
5105
|
}
|
|
4645
|
-
const _expand = (p) => p.startsWith("~/") ?
|
|
5106
|
+
const _expand = (p) => p.startsWith("~/") ? path21.join(os4.homedir(), p.slice(2)) : path21.join(_package_root(), p);
|
|
4646
5107
|
const violations = [];
|
|
4647
5108
|
const remedies = [];
|
|
4648
5109
|
let checked = 0;
|
|
@@ -4684,7 +5145,7 @@ function _check_surface_state() {
|
|
|
4684
5145
|
}
|
|
4685
5146
|
function pathExistsAny(p) {
|
|
4686
5147
|
try {
|
|
4687
|
-
|
|
5148
|
+
fs16.statSync(p);
|
|
4688
5149
|
return true;
|
|
4689
5150
|
} catch {
|
|
4690
5151
|
return false;
|
|
@@ -4730,8 +5191,8 @@ function _check_mcp_mode(project_root) {
|
|
|
4730
5191
|
];
|
|
4731
5192
|
const found = [];
|
|
4732
5193
|
for (const [rel, label] of candidates) {
|
|
4733
|
-
const p =
|
|
4734
|
-
if (!
|
|
5194
|
+
const p = path21.join(project_root, rel);
|
|
5195
|
+
if (!pathExists2(p)) {
|
|
4735
5196
|
continue;
|
|
4736
5197
|
}
|
|
4737
5198
|
try {
|
|
@@ -4761,23 +5222,7 @@ function _check_mcp_mode(project_root) {
|
|
|
4761
5222
|
remedy: ""
|
|
4762
5223
|
};
|
|
4763
5224
|
}
|
|
4764
|
-
|
|
4765
|
-
const script = path20.join(_package_root(), "src", "scripts", "hermetic-install.sh");
|
|
4766
|
-
if (!pathExists(script)) {
|
|
4767
|
-
return {
|
|
4768
|
-
id: "offline-readiness",
|
|
4769
|
-
status: "warn",
|
|
4770
|
-
message: "src/scripts/hermetic-install.sh not found in package",
|
|
4771
|
-
remedy: "reinstall @event4u/agent-config or pull missing files"
|
|
4772
|
-
};
|
|
4773
|
-
}
|
|
4774
|
-
return {
|
|
4775
|
-
id: "offline-readiness",
|
|
4776
|
-
status: "ok",
|
|
4777
|
-
message: "verified-offline install entrypoint present",
|
|
4778
|
-
remedy: ""
|
|
4779
|
-
};
|
|
4780
|
-
}
|
|
5225
|
+
var _check_offline_readiness = () => checkOfflineReadiness(_package_root());
|
|
4781
5226
|
function _check_stale_orphans() {
|
|
4782
5227
|
const gdi = global_deploy_inventory_exports;
|
|
4783
5228
|
const inv = gdi.load_inventory();
|
|
@@ -4820,7 +5265,7 @@ function _check_stale_orphans() {
|
|
|
4820
5265
|
(a, b) => a < b ? -1 : a > b ? 1 : 0
|
|
4821
5266
|
);
|
|
4822
5267
|
for (const root_name of ownedSorted) {
|
|
4823
|
-
const root =
|
|
5268
|
+
const root = path21.join(anchor, root_name);
|
|
4824
5269
|
if (!isDir3(root)) {
|
|
4825
5270
|
continue;
|
|
4826
5271
|
}
|
|
@@ -4835,7 +5280,7 @@ function _check_stale_orphans() {
|
|
|
4835
5280
|
if (rel === null) {
|
|
4836
5281
|
continue;
|
|
4837
5282
|
}
|
|
4838
|
-
const relPosix = rel.split(
|
|
5283
|
+
const relPosix = rel.split(path21.sep).join("/");
|
|
4839
5284
|
if (recorded_set.has(relPosix)) {
|
|
4840
5285
|
continue;
|
|
4841
5286
|
}
|
|
@@ -4890,14 +5335,14 @@ function _check_rule_scope_drift(project_root) {
|
|
|
4890
5335
|
let rules_dir = null;
|
|
4891
5336
|
let found = 0;
|
|
4892
5337
|
for (const rel of _RULE_PROJECTION_DIRS) {
|
|
4893
|
-
const cand =
|
|
5338
|
+
const cand = path21.join(project_root, rel);
|
|
4894
5339
|
if (!isDir3(cand)) {
|
|
4895
5340
|
continue;
|
|
4896
5341
|
}
|
|
4897
5342
|
let count = 0;
|
|
4898
5343
|
try {
|
|
4899
|
-
for (const name of
|
|
4900
|
-
if (name.endsWith(".md") && isFile4(
|
|
5344
|
+
for (const name of fs16.readdirSync(cand)) {
|
|
5345
|
+
if (name.endsWith(".md") && isFile4(path21.join(cand, name))) {
|
|
4901
5346
|
count += 1;
|
|
4902
5347
|
}
|
|
4903
5348
|
}
|
|
@@ -4951,14 +5396,14 @@ function _check_rule_scope_drift(project_root) {
|
|
|
4951
5396
|
};
|
|
4952
5397
|
}
|
|
4953
5398
|
function _check_duplicate_scope_rules(project_root, userRulesDirOverride) {
|
|
4954
|
-
const user_rules_dir = userRulesDirOverride ??
|
|
5399
|
+
const user_rules_dir = userRulesDirOverride ?? path21.join(os4.homedir(), ".claude", "rules");
|
|
4955
5400
|
let project_rules_dir = null;
|
|
4956
5401
|
if (_is_source_repo(project_root)) {
|
|
4957
|
-
const cand =
|
|
5402
|
+
const cand = path21.join(project_root, "dist", "agent-src", "rules");
|
|
4958
5403
|
if (isDir3(cand)) project_rules_dir = cand;
|
|
4959
5404
|
} else {
|
|
4960
5405
|
for (const rel of _RULE_PROJECTION_DIRS) {
|
|
4961
|
-
const cand =
|
|
5406
|
+
const cand = path21.join(project_root, rel);
|
|
4962
5407
|
if (isDir3(cand)) {
|
|
4963
5408
|
project_rules_dir = cand;
|
|
4964
5409
|
break;
|
|
@@ -5004,7 +5449,7 @@ function _check_mcp_beta_readiness(project_root) {
|
|
|
5004
5449
|
}
|
|
5005
5450
|
const pending = [];
|
|
5006
5451
|
for (const [gate_id, rel] of MCP_BETA_GATES) {
|
|
5007
|
-
if (!
|
|
5452
|
+
if (!pathExists2(path21.join(project_root, rel))) {
|
|
5008
5453
|
pending.push(`${gate_id} (${rel})`);
|
|
5009
5454
|
}
|
|
5010
5455
|
}
|
|
@@ -5025,7 +5470,7 @@ function _check_mcp_beta_readiness(project_root) {
|
|
|
5025
5470
|
}
|
|
5026
5471
|
function _check_tier_usage_readiness(project_root) {
|
|
5027
5472
|
const settings_file = project_settings_path(project_root);
|
|
5028
|
-
let log_path =
|
|
5473
|
+
let log_path = path21.join(project_root, ".agent-tier-usage.jsonl");
|
|
5029
5474
|
let enabled = false;
|
|
5030
5475
|
if (isFile4(settings_file)) {
|
|
5031
5476
|
let raw;
|
|
@@ -5044,7 +5489,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
5044
5489
|
const outputRaw = tu["output"];
|
|
5045
5490
|
const output = typeof outputRaw === "object" && outputRaw !== null && !Array.isArray(outputRaw) ? outputRaw : {};
|
|
5046
5491
|
if (typeof output["path"] === "string" && output["path"].trim()) {
|
|
5047
|
-
log_path =
|
|
5492
|
+
log_path = path21.join(project_root, output["path"].trim());
|
|
5048
5493
|
}
|
|
5049
5494
|
const val = tu["enabled"];
|
|
5050
5495
|
if (typeof val === "boolean") {
|
|
@@ -5065,11 +5510,11 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
5065
5510
|
remedy: "set `telemetry.tier_usage.enabled: true` in .agent-settings.yml (default-off; opt-in)"
|
|
5066
5511
|
};
|
|
5067
5512
|
}
|
|
5068
|
-
if (!
|
|
5513
|
+
if (!pathExists2(log_path)) {
|
|
5069
5514
|
return {
|
|
5070
5515
|
id: "tier-usage-readiness",
|
|
5071
5516
|
status: "warn",
|
|
5072
|
-
message: `tier-usage telemetry on but ${
|
|
5517
|
+
message: `tier-usage telemetry on but ${path21.basename(log_path)} not yet written \u2014 no signal accumulated`,
|
|
5073
5518
|
remedy: "run any tracked command to seed the log; the dispatcher writes one record per invocation"
|
|
5074
5519
|
};
|
|
5075
5520
|
}
|
|
@@ -5084,7 +5529,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
5084
5529
|
return {
|
|
5085
5530
|
id: "tier-usage-readiness",
|
|
5086
5531
|
status: "fail",
|
|
5087
|
-
message: `cannot read ${
|
|
5532
|
+
message: `cannot read ${path21.basename(log_path)}: ${osErrorStr(exc)}`,
|
|
5088
5533
|
remedy: "fix permissions on the tier-usage log"
|
|
5089
5534
|
};
|
|
5090
5535
|
}
|
|
@@ -5115,7 +5560,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
5115
5560
|
return {
|
|
5116
5561
|
id: "tier-usage-readiness",
|
|
5117
5562
|
status: "fail",
|
|
5118
|
-
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`,
|
|
5119
5564
|
remedy: "inspect the log; the dispatcher is writing records the contract forbids (paths, argv, message bodies)"
|
|
5120
5565
|
};
|
|
5121
5566
|
}
|
|
@@ -5123,19 +5568,19 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
5123
5568
|
return {
|
|
5124
5569
|
id: "tier-usage-readiness",
|
|
5125
5570
|
status: "warn",
|
|
5126
|
-
message: `${
|
|
5571
|
+
message: `${path21.basename(log_path)} present but empty \u2014 no signal yet`,
|
|
5127
5572
|
remedy: "run any tracked command to seed the log"
|
|
5128
5573
|
};
|
|
5129
5574
|
}
|
|
5130
5575
|
return {
|
|
5131
5576
|
id: "tier-usage-readiness",
|
|
5132
5577
|
status: "ok",
|
|
5133
|
-
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`,
|
|
5134
5579
|
remedy: ""
|
|
5135
5580
|
};
|
|
5136
5581
|
}
|
|
5137
5582
|
function readText0(p) {
|
|
5138
|
-
return
|
|
5583
|
+
return fs16.readFileSync(p, "utf-8");
|
|
5139
5584
|
}
|
|
5140
5585
|
function osErrorStr(exc) {
|
|
5141
5586
|
if (exc && typeof exc === "object" && "message" in exc) {
|
|
@@ -5155,7 +5600,7 @@ function _check_council_cli(project_root) {
|
|
|
5155
5600
|
const { load_cli_call_counts: load_cli_call_counts2 } = clients_exports;
|
|
5156
5601
|
const { load_council_config, resolve_config_path } = config_exports;
|
|
5157
5602
|
const council_path = resolve_config_path(project_root);
|
|
5158
|
-
if (!
|
|
5603
|
+
if (!pathExists2(String(council_path))) {
|
|
5159
5604
|
return {
|
|
5160
5605
|
id: "council-cli",
|
|
5161
5606
|
status: "ok",
|
|
@@ -5265,7 +5710,7 @@ function _team_codex_binary_name(project_root) {
|
|
|
5265
5710
|
const default_bin = _CLI_PROVIDER_META["openai"][0];
|
|
5266
5711
|
const { load_council_config, resolve_config_path } = config_exports;
|
|
5267
5712
|
const council_path = resolve_config_path(project_root);
|
|
5268
|
-
if (!
|
|
5713
|
+
if (!pathExists2(String(council_path))) {
|
|
5269
5714
|
return default_bin;
|
|
5270
5715
|
}
|
|
5271
5716
|
let cfg;
|
|
@@ -5308,7 +5753,7 @@ function _epoch_seconds(value) {
|
|
|
5308
5753
|
function _codex_auth_expiry(auth_path) {
|
|
5309
5754
|
let data;
|
|
5310
5755
|
try {
|
|
5311
|
-
data = JSON.parse(
|
|
5756
|
+
data = JSON.parse(fs16.readFileSync(auth_path, "utf-8"));
|
|
5312
5757
|
} catch {
|
|
5313
5758
|
return null;
|
|
5314
5759
|
}
|
|
@@ -5346,7 +5791,7 @@ var _detection_memo = null;
|
|
|
5346
5791
|
function _read_council_facts(project_root) {
|
|
5347
5792
|
const { load_council_config, resolve_config_path } = config_exports;
|
|
5348
5793
|
const config_path = String(resolve_config_path(project_root));
|
|
5349
|
-
if (!
|
|
5794
|
+
if (!pathExists2(config_path)) {
|
|
5350
5795
|
return absentCouncilFacts(config_path);
|
|
5351
5796
|
}
|
|
5352
5797
|
let cfg;
|
|
@@ -5454,8 +5899,8 @@ function _check_team(project_root) {
|
|
|
5454
5899
|
if (binary_missing) {
|
|
5455
5900
|
remedies.push("install the codex CLI: `npm install -g @openai/codex`");
|
|
5456
5901
|
}
|
|
5457
|
-
const auth_path =
|
|
5458
|
-
const authed =
|
|
5902
|
+
const auth_path = path21.join(_codex_home(), "auth.json");
|
|
5903
|
+
const authed = pathExists2(auth_path);
|
|
5459
5904
|
let auth_str;
|
|
5460
5905
|
if (!authed) {
|
|
5461
5906
|
auth_str = `codex auth \u274C (${auth_path})`;
|
|
@@ -5471,7 +5916,7 @@ function _check_team(project_root) {
|
|
|
5471
5916
|
auth_str = `codex auth \u2705 (${auth_path})`;
|
|
5472
5917
|
}
|
|
5473
5918
|
}
|
|
5474
|
-
const is_claude_host = shutilWhich("claude") !== null ||
|
|
5919
|
+
const is_claude_host = shutilWhich("claude") !== null || pathExists2(claude_config_dir());
|
|
5475
5920
|
let plugin_str;
|
|
5476
5921
|
if (is_claude_host) {
|
|
5477
5922
|
const identity = codex_plugin_identity();
|
|
@@ -5542,11 +5987,11 @@ function _check_unsupported_combos(manifest) {
|
|
|
5542
5987
|
};
|
|
5543
5988
|
}
|
|
5544
5989
|
function _wizard_state_path() {
|
|
5545
|
-
return
|
|
5990
|
+
return path21.join(event4u_root(), "state", "wizard-state.json");
|
|
5546
5991
|
}
|
|
5547
5992
|
function _check_wizard_state() {
|
|
5548
5993
|
const state_pth = _wizard_state_path();
|
|
5549
|
-
if (!
|
|
5994
|
+
if (!pathExists2(state_pth)) {
|
|
5550
5995
|
return {
|
|
5551
5996
|
id: "wizard-state",
|
|
5552
5997
|
status: "ok",
|
|
@@ -5622,8 +6067,8 @@ function _check_wizard_state() {
|
|
|
5622
6067
|
};
|
|
5623
6068
|
}
|
|
5624
6069
|
function _check_settings_review_pending() {
|
|
5625
|
-
const delta_pth =
|
|
5626
|
-
if (!
|
|
6070
|
+
const delta_pth = path21.join(event4u_root(), "state", "settings-delta.json");
|
|
6071
|
+
if (!pathExists2(delta_pth)) {
|
|
5627
6072
|
return {
|
|
5628
6073
|
id: "settings-review-pending",
|
|
5629
6074
|
status: "ok",
|
|
@@ -5648,8 +6093,8 @@ function _check_settings_review_pending() {
|
|
|
5648
6093
|
}
|
|
5649
6094
|
function _check_memory_merge_union(project_root) {
|
|
5650
6095
|
const remedy = "run: npx tsx src/scripts/sync_gitattributes.ts (or `agent-config refresh --project`)";
|
|
5651
|
-
const target =
|
|
5652
|
-
if (!
|
|
6096
|
+
const target = path21.join(project_root, DEFAULT_GITATTRIBUTES);
|
|
6097
|
+
if (!pathExists2(target)) {
|
|
5653
6098
|
return {
|
|
5654
6099
|
id: "memory-merge-union",
|
|
5655
6100
|
status: "warn",
|
|
@@ -5919,9 +6364,10 @@ function _emit_json(project_root, missing, modified, foreign, tag_drift, checks
|
|
|
5919
6364
|
foreign,
|
|
5920
6365
|
tag_drift
|
|
5921
6366
|
};
|
|
5922
|
-
if (origin !== null)
|
|
5923
|
-
|
|
5924
|
-
|
|
6367
|
+
if (origin !== null) payload["project_root_origin"] = origin;
|
|
6368
|
+
payload["execution"] = executionJson(() => iter_setting_overrides({ cwd: project_root }));
|
|
6369
|
+
payload["forge_protection"] = forgeProtectionJsonFor(String(project_root));
|
|
6370
|
+
payload["traffic_environment"] = trafficEnvironmentJson(process3.env);
|
|
5925
6371
|
if (checks !== null) {
|
|
5926
6372
|
payload["checks"] = checks;
|
|
5927
6373
|
const drift = missing.length + modified.length + foreign.length + tag_drift.length;
|
|
@@ -6113,7 +6559,7 @@ function _run_anatomy(opts) {
|
|
|
6113
6559
|
try {
|
|
6114
6560
|
economyReport = economy.buildReport({
|
|
6115
6561
|
root: economy.DEFAULT_PROJECTS_ROOT,
|
|
6116
|
-
auditDir:
|
|
6562
|
+
auditDir: path21.join(process3.cwd(), economy.DEFAULT_AUDIT_DIR),
|
|
6117
6563
|
maxAgeDays: 14
|
|
6118
6564
|
});
|
|
6119
6565
|
} catch (err) {
|
|
@@ -6144,7 +6590,7 @@ function _run_repair(opts) {
|
|
|
6144
6590
|
const target = opts.repair;
|
|
6145
6591
|
if (target === "wizard-state") {
|
|
6146
6592
|
const state_pth = _wizard_state_path();
|
|
6147
|
-
const exists2 =
|
|
6593
|
+
const exists2 = pathExists2(state_pth);
|
|
6148
6594
|
const payload = {
|
|
6149
6595
|
id: "wizard-state",
|
|
6150
6596
|
path: String(state_pth),
|
|
@@ -6152,7 +6598,7 @@ function _run_repair(opts) {
|
|
|
6152
6598
|
};
|
|
6153
6599
|
if (exists2) {
|
|
6154
6600
|
try {
|
|
6155
|
-
|
|
6601
|
+
fs16.unlinkSync(state_pth);
|
|
6156
6602
|
} catch (exc) {
|
|
6157
6603
|
payload["action"] = "error";
|
|
6158
6604
|
payload["error"] = osErrorStr(exc);
|
|
@@ -6259,17 +6705,17 @@ function _isCliEntry2() {
|
|
|
6259
6705
|
return false;
|
|
6260
6706
|
}
|
|
6261
6707
|
if (cliDelegate) {
|
|
6262
|
-
if (
|
|
6708
|
+
if (path21.basename(process3.argv[1], ".js") === "cmd_doctor") {
|
|
6263
6709
|
return true;
|
|
6264
6710
|
}
|
|
6265
6711
|
}
|
|
6266
|
-
const argvUrl = pathToFileURL6(
|
|
6712
|
+
const argvUrl = pathToFileURL6(path21.resolve(process3.argv[1])).href;
|
|
6267
6713
|
if (import.meta.url === argvUrl) {
|
|
6268
6714
|
return true;
|
|
6269
6715
|
}
|
|
6270
6716
|
try {
|
|
6271
|
-
const here =
|
|
6272
|
-
const argv =
|
|
6717
|
+
const here = fs16.realpathSync(fileURLToPath5(import.meta.url));
|
|
6718
|
+
const argv = fs16.realpathSync(path21.resolve(process3.argv[1]));
|
|
6273
6719
|
return here === argv;
|
|
6274
6720
|
} catch {
|
|
6275
6721
|
return false;
|