@event4u/agent-config 14.13.0 → 14.14.1

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.
Files changed (138) hide show
  1. package/.augment-plugin/marketplace.json +3 -3
  2. package/.augment-plugin/plugin.json +1 -1
  3. package/.claude-plugin/marketplace.json +1 -1
  4. package/CHANGELOG.md +138 -376
  5. package/README.md +1 -1
  6. package/dist/agent-src/commands/analyze/inbox.md +36 -0
  7. package/dist/agent-src/commands/pr/create.md +16 -1
  8. package/dist/agent-src/contexts/execution/terminal-states.md +25 -4
  9. package/dist/agent-src/rules/code-comment-discipline.md +6 -0
  10. package/dist/agent-src/rules/missing-skill-recovery.md +2 -2
  11. package/dist/agent-src/rules/token-budget-discipline.md +2 -2
  12. package/dist/agent-src/scripts/archive_completed_roadmaps.ts +6 -6
  13. package/dist/agent-src/scripts/guarded_baseline.ts +22 -7
  14. package/dist/agent-src/scripts/stubs_due.ts +118 -2
  15. package/dist/agent-src/scripts/update_roadmap_progress.ts +8 -8
  16. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  17. package/dist/cli/registry.js +1 -0
  18. package/dist/cli-delegate/{chunk-ILMUPLGW.js → chunk-7RXIKF62.js} +159 -86
  19. package/dist/cli-delegate/cmd_conformance.js +39 -2
  20. package/dist/cli-delegate/cmd_doctor.js +1 -1
  21. package/dist/discovery/deprecation-report.md +1 -1
  22. package/dist/discovery/discovery-manifest.json +7 -7
  23. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  24. package/dist/discovery/discovery-manifest.summary.md +1 -1
  25. package/dist/discovery/dormancy-report.md +1 -1
  26. package/dist/discovery/orphan-report.md +1 -1
  27. package/dist/discovery/packs.json +2 -2
  28. package/dist/discovery/trust-report.md +1 -1
  29. package/dist/discovery/workspaces.json +2 -2
  30. package/dist/hooks/dispatch.js +1696 -812
  31. package/dist/mcp/registry-manifest.json +2 -2
  32. package/dist/mcp/server.json +2 -2
  33. package/dist/mcp/server.mjs +297 -115
  34. package/docs/guidelines/agent-infra/guarded-baseline.md +1 -1
  35. package/docs/guidelines/code-clarity.md +18 -0
  36. package/package.json +1 -1
  37. package/src/agent-src/scripts/archive_completed_roadmaps.ts +6 -6
  38. package/src/agent-src/scripts/guarded_baseline.ts +22 -7
  39. package/src/agent-src/scripts/stubs_due.ts +118 -2
  40. package/src/agent-src/scripts/update_roadmap_progress.ts +8 -8
  41. package/src/config/assurance-capability-registry.json +1 -1
  42. package/src/config/estate-count-budget.json +20 -1
  43. package/src/config/evaluator-budgets.json +4 -4
  44. package/src/config/gate-coverage.yml +211 -1
  45. package/src/config/gate-reachability-exemptions.json +1 -0
  46. package/src/config/gate-violation-baselines.json +9 -3
  47. package/src/config/preamble-payload-budget.json +19 -11
  48. package/src/config/rule-stub-ceilings.json +14 -7
  49. package/src/config/web-launch-readiness.json +4 -2
  50. package/src/scripts/_cli/_doctor_emit.ts +71 -0
  51. package/src/scripts/_cli/_doctor_strict.ts +163 -0
  52. package/src/scripts/_cli/cmd_doctor.ts +16 -37
  53. package/src/scripts/_dispatch.bash +11 -4
  54. package/src/scripts/_lib/activation_ladder.ts +47 -3
  55. package/src/scripts/_lib/activation_receipt_producer.ts +341 -0
  56. package/src/scripts/_lib/adr_frontmatter.ts +26 -0
  57. package/src/scripts/_lib/branch_convergence.ts +186 -0
  58. package/src/scripts/_lib/candidate_pair_delta.ts +349 -0
  59. package/src/scripts/_lib/carrier_status.ts +118 -0
  60. package/src/scripts/_lib/cascade_stage_enumeration.ts +92 -0
  61. package/src/scripts/_lib/context_observation.ts +132 -0
  62. package/src/scripts/_lib/continuation_ladder.ts +188 -0
  63. package/src/scripts/_lib/corpus_manifest.ts +726 -0
  64. package/src/scripts/_lib/delivery_arm_experiment.ts +18 -2
  65. package/src/scripts/_lib/estate_carrier_cases.ts +72 -0
  66. package/src/scripts/_lib/evaluation_cascade.ts +452 -0
  67. package/src/scripts/_lib/evolution_roi.ts +562 -0
  68. package/src/scripts/_lib/experiment_binding.ts +95 -0
  69. package/src/scripts/_lib/harness_evolution_guards.ts +10 -0
  70. package/src/scripts/_lib/ignored_blocker.ts +8 -1
  71. package/src/scripts/_lib/lexical_shortlist.ts +215 -0
  72. package/src/scripts/_lib/llm_candidate_proposer.ts +461 -0
  73. package/src/scripts/_lib/llm_proposer_transport.ts +153 -0
  74. package/src/scripts/_lib/outcome_envelope.ts +6 -1
  75. package/src/scripts/_lib/outcome_vocabularies.ts +135 -5
  76. package/src/scripts/_lib/pathology_archive.ts +393 -0
  77. package/src/scripts/_lib/promotion_capability.ts +315 -0
  78. package/src/scripts/_lib/promotion_evidence.ts +414 -0
  79. package/src/scripts/_lib/promotion_review.ts +294 -0
  80. package/src/scripts/_lib/prompt_shape.ts +92 -0
  81. package/src/scripts/_lib/release_highlights.ts +79 -1
  82. package/src/scripts/_lib/release_material.ts +125 -2
  83. package/src/scripts/_lib/repeated_failure.ts +19 -2
  84. package/src/scripts/_lib/routing_corpus.ts +307 -0
  85. package/src/scripts/_lib/routing_index_input.ts +104 -0
  86. package/src/scripts/_lib/rule_injection.ts +22 -1
  87. package/src/scripts/_lib/runtime_journal.ts +11 -4
  88. package/src/scripts/_lib/semantic_noop.ts +167 -0
  89. package/src/scripts/activation_receipt.ts +258 -0
  90. package/src/scripts/ai_council/cross_exam.ts +128 -0
  91. package/src/scripts/ai_council/explain_route.ts +157 -0
  92. package/src/scripts/ai_council/information_gain.ts +293 -0
  93. package/src/scripts/ai_council/leakage_corpus.ts +385 -0
  94. package/src/scripts/ai_council/leakage_patterns.ts +453 -0
  95. package/src/scripts/ai_council/minority_retention.ts +171 -0
  96. package/src/scripts/ai_council/recouncil_savings.ts +299 -0
  97. package/src/scripts/ai_council/replay_route.ts +223 -0
  98. package/src/scripts/ai_council/reviewer_assignment.ts +279 -0
  99. package/src/scripts/ai_council/routing_training_row.ts +197 -0
  100. package/src/scripts/ai_council/synthesis_strategy.ts +159 -0
  101. package/src/scripts/check_adr_frontmatter.ts +4 -9
  102. package/src/scripts/check_agent_artifact_location.ts +337 -0
  103. package/src/scripts/check_artefact_count_messaging.ts +74 -8
  104. package/src/scripts/check_enforcement_coverage.ts +40 -1
  105. package/src/scripts/check_estate_count.ts +205 -24
  106. package/src/scripts/check_release_highlights.ts +113 -14
  107. package/src/scripts/check_roadmap_trackable.ts +17 -2
  108. package/src/scripts/check_web_launch_readiness.ts +310 -20
  109. package/src/scripts/corpus_manifest.ts +235 -0
  110. package/src/scripts/evolution_lab.ts +234 -9
  111. package/src/scripts/generate_capability_matrix.ts +16 -9
  112. package/src/scripts/grade_target_readiness.ts +221 -2
  113. package/src/scripts/hook_effect_doctor.ts +47 -4
  114. package/src/scripts/hook_manifest.json +1 -1
  115. package/src/scripts/hook_manifest.yaml +28 -6
  116. package/src/scripts/hooks/comment_discipline_hook.ts +146 -0
  117. package/src/scripts/hooks/concern_registry.ts +2 -0
  118. package/src/scripts/hooks/run_continuation_hook.ts +78 -88
  119. package/src/scripts/hooks/session_eol_hook.ts +12 -1
  120. package/src/scripts/hooks/turn_end_gate_hook.ts +9 -1
  121. package/src/scripts/install-hooks.sh +18 -0
  122. package/src/scripts/language_mirror_hook.ts +14 -2
  123. package/src/scripts/lint_carrier_integrity.ts +820 -0
  124. package/src/scripts/lint_code_comments.ts +748 -0
  125. package/src/scripts/lint_plan_risk_register.ts +39 -19
  126. package/src/scripts/lint_promotion_paths.ts +779 -0
  127. package/src/scripts/llm_propose.ts +256 -0
  128. package/src/scripts/measure_delivery_sets.ts +361 -0
  129. package/src/scripts/measure_routing_signal.ts +307 -0
  130. package/src/scripts/model_rule_injection.ts +19 -3
  131. package/src/scripts/probe_council_retention.ts +495 -0
  132. package/src/scripts/release.ts +21 -37
  133. package/src/scripts/release_drill.ts +199 -0
  134. package/src/scripts/release_env.ts +35 -0
  135. package/src/scripts/release_publication.ts +142 -0
  136. package/src/scripts/roadmap_context.ts +15 -0
  137. package/src/scripts/skill_scout.ts +633 -0
  138. package/src/scripts/sync_pr_branch.ts +521 -42
@@ -18969,6 +18969,11 @@ var init_dashboard_mode = __esm({
18969
18969
  import * as fs23 from "node:fs";
18970
18970
  import * as path22 from "node:path";
18971
18971
  import { fileURLToPath as fileURLToPath17, pathToFileURL as pathToFileURL9 } from "node:url";
18972
+ function is_blocked_quickwin(design_validated, capability_gap, blocker_class2) {
18973
+ if (design_validated === null || design_validated === "") return false;
18974
+ if (capability_gap !== "none") return false;
18975
+ return QUICKWIN_BLOCKER_CLASSES.includes(blocker_class2 ?? "");
18976
+ }
18972
18977
  function _isDir8(p) {
18973
18978
  try {
18974
18979
  return fs23.statSync(p).isDirectory();
@@ -19063,9 +19068,27 @@ function _parseIso(s) {
19063
19068
  return Number.isNaN(d.getTime()) ? null : d;
19064
19069
  }
19065
19070
  function scan(root, today) {
19066
- return scan_dir(path22.join(root, STUB_DIR), today);
19071
+ return scan_dir(path22.join(root, STUB_DIR), today, release_dates(root));
19067
19072
  }
19068
- function scan_dir(base, today) {
19073
+ function release_dates(root) {
19074
+ const out = [];
19075
+ for (const rel of CHANGELOG_ERAS) {
19076
+ let text;
19077
+ try {
19078
+ text = fs23.readFileSync(path22.join(root, rel), "utf8");
19079
+ } catch {
19080
+ continue;
19081
+ }
19082
+ for (const m of text.matchAll(RELEASE_HEADING)) {
19083
+ if (m[1] !== void 0) out.push(m[1]);
19084
+ }
19085
+ }
19086
+ return out;
19087
+ }
19088
+ function releases_since(opened, dates) {
19089
+ return dates.filter((d) => d > opened).length;
19090
+ }
19091
+ function scan_dir(base, today, releaseDates = []) {
19069
19092
  if (!_isDir8(base)) return [];
19070
19093
  const now = _parseIso(today);
19071
19094
  const out = [];
@@ -19086,6 +19109,10 @@ function scan_dir(base, today) {
19086
19109
  const review_by = _scalar(front, "review_by");
19087
19110
  const reviewed_at = _scalar(front, "reviewed_at");
19088
19111
  const probeVal = _scalar(front, "probe");
19112
+ const design_validated = _scalar(front, "design_validated");
19113
+ const capability_gap = _scalar(front, "capability_gap");
19114
+ const blocker_class2 = _scalar(front, "blocker_class");
19115
+ const blocker_opened = _scalar(front, "blocker_opened");
19089
19116
  const shape = text.includes(TRANSFER_MARKER) ? "transfer" : "orgmode";
19090
19117
  let overdue = false;
19091
19118
  let days_overdue = null;
@@ -19105,7 +19132,13 @@ function scan_dir(base, today) {
19105
19132
  has_probe_heading: /^#{1,4} *(Probe|Promotion)/m.test(text),
19106
19133
  owner_decisions: count_owner_decisions(text),
19107
19134
  overdue,
19108
- days_overdue
19135
+ days_overdue,
19136
+ design_validated,
19137
+ capability_gap,
19138
+ blocker_class: blocker_class2,
19139
+ blocker_opened,
19140
+ releases_since_blocked: blocker_opened === null ? null : releases_since(blocker_opened, releaseDates),
19141
+ blocked_quickwin: is_blocked_quickwin(design_validated, capability_gap, blocker_class2)
19109
19142
  });
19110
19143
  }
19111
19144
  return out;
@@ -19115,6 +19148,7 @@ function counts(records) {
19115
19148
  overdue: records.filter((r) => r.overdue).length,
19116
19149
  owner_decisions: records.reduce((s, r) => s + r.owner_decisions, 0),
19117
19150
  missing_review_by: records.filter((r) => r.review_by === null).length,
19151
+ blocked_quickwin: records.filter((r) => r.blocked_quickwin).length,
19118
19152
  total: records.length
19119
19153
  };
19120
19154
  }
@@ -19178,6 +19212,20 @@ function main9(argv = process.argv.slice(2)) {
19178
19212
  process.stdout.write(":\n");
19179
19213
  for (const r of withDecisions) {
19180
19214
  process.stdout.write(` ${r.file} (${r.owner_decisions})
19215
+ `);
19216
+ }
19217
+ }
19218
+ const quickwins = records.filter((r) => r.blocked_quickwin);
19219
+ if (quickwins.length > 0) {
19220
+ process.stdout.write(
19221
+ `
19222
+ \u{1F513} ${quickwins.length} BLOCKED QUICK-WIN(S) \u2014 design validated, no capability gap,
19223
+ held by an estate or budget decision rather than a product one:
19224
+ `
19225
+ );
19226
+ for (const r of quickwins) {
19227
+ const since = r.releases_since_blocked === null ? "no `blocker_opened:`" : `${String(r.releases_since_blocked)} release(s) since ${r.blocker_opened}`;
19228
+ process.stdout.write(` ${r.file} (${r.blocker_class}, ${since})
19181
19229
  `);
19182
19230
  }
19183
19231
  }
@@ -19227,7 +19275,7 @@ function headerFragment(stubsDir, today) {
19227
19275
  }
19228
19276
  return ` \xB7 **${overdue}** overdue stub${overdue !== 1 ? "s" : ""}, **${decisions}** owner decision${decisions !== 1 ? "s" : ""} \u2192 \`agent-config stubs:due\``;
19229
19277
  }
19230
- var STUB_DIR, CADENCE_DAYS, TRANSFER_MARKER, _HERE6;
19278
+ var STUB_DIR, CADENCE_DAYS, TRANSFER_MARKER, _HERE6, QUICKWIN_BLOCKER_CLASSES, CHANGELOG_ERAS, RELEASE_HEADING;
19231
19279
  var init_stubs_due = __esm({
19232
19280
  "src/agent-src/scripts/stubs_due.ts"() {
19233
19281
  "use strict";
@@ -19235,6 +19283,9 @@ var init_stubs_due = __esm({
19235
19283
  CADENCE_DAYS = { transfer: 30, orgmode: 120 };
19236
19284
  TRANSFER_MARKER = "drain-run transfer";
19237
19285
  _HERE6 = path22.resolve(fileURLToPath17(import.meta.url));
19286
+ QUICKWIN_BLOCKER_CLASSES = ["estate", "budget"];
19287
+ CHANGELOG_ERAS = ["CHANGELOG.md", "docs/archive/CHANGELOG-pre-14.12.0.md"];
19288
+ RELEASE_HEADING = /^## \[\d+\.\d+\.\d+\][^\n]*\((\d{4}-\d{2}-\d{2})\)\s*$/gm;
19238
19289
  if (_isCliEntry9() || process.argv[1] === _HERE6) {
19239
19290
  process.exitCode = main9();
19240
19291
  }
@@ -19348,15 +19399,21 @@ function guardedBaselineStaleness(items, repo_root2) {
19348
19399
  if (trigger === "") {
19349
19400
  continue;
19350
19401
  }
19351
- for (const token of trigger.split(/[\s,]+/).filter((t) => t !== "")) {
19352
- if (!token.includes("/")) {
19353
- unverifiable.push(`line ${it.line} (${it.label}): recheck_when \`${token}\``);
19354
- } else if (fs24.existsSync(path23.join(repo_root2, token))) {
19402
+ const tokens = trigger.split(/[\s,]+/).filter((t) => t !== "");
19403
+ const paths = tokens.filter((t) => t.includes("/"));
19404
+ for (const token of paths) {
19405
+ if (fs24.existsSync(path23.join(repo_root2, token))) {
19355
19406
  stale.push(
19356
19407
  `line ${it.line} (${it.label}): recheck_when \`${token}\` now exists \u2014 re-verify against the real mechanism`
19357
19408
  );
19358
19409
  }
19359
19410
  }
19411
+ if (paths.length > 0) {
19412
+ continue;
19413
+ }
19414
+ for (const token of tokens) {
19415
+ unverifiable.push(`line ${it.line} (${it.label}): recheck_when \`${token}\``);
19416
+ }
19360
19417
  }
19361
19418
  return { stale, unverifiable };
19362
19419
  }
@@ -19435,8 +19492,8 @@ __export(update_roadmap_progress_exports, {
19435
19492
  collect: () => collect,
19436
19493
  collect_bundles: () => collect_bundles,
19437
19494
  count_checkboxes: () => count_checkboxes,
19438
- is_draft: () => is_draft,
19439
19495
  is_roadmap_candidate: () => is_roadmap_candidate,
19496
+ is_unscheduled: () => is_unscheduled,
19440
19497
  main: () => main10,
19441
19498
  merge_gated_pending: () => merge_gated_pending,
19442
19499
  parse_blockers: () => parse_blockers,
@@ -19492,8 +19549,8 @@ function _stripQuotes2(s) {
19492
19549
  out = out.replace(/^'+/, "").replace(/'+$/, "");
19493
19550
  return out;
19494
19551
  }
19495
- function is_draft(fm) {
19496
- return DRAFT_VALUES.has((fm["status"] ?? "").toLowerCase());
19552
+ function is_unscheduled(fm) {
19553
+ return UNSCHEDULED_VALUES.has((fm["status"] ?? "").toLowerCase());
19497
19554
  }
19498
19555
  function is_roadmap_name(name) {
19499
19556
  if (EXCLUDE_NAMES.has(name)) {
@@ -19785,7 +19842,7 @@ function collect(roadmap_root) {
19785
19842
  continue;
19786
19843
  }
19787
19844
  const text = fs25.readFileSync(p, { encoding: "utf-8" });
19788
- if (is_draft(parse_frontmatter2(text))) {
19845
+ if (is_unscheduled(parse_frontmatter2(text))) {
19789
19846
  continue;
19790
19847
  }
19791
19848
  const stats = parse_roadmap(p, roadmap_root);
@@ -19815,7 +19872,7 @@ function collect_parked(roadmap_root) {
19815
19872
  } catch {
19816
19873
  continue;
19817
19874
  }
19818
- if (is_draft(parse_frontmatter2(text))) {
19875
+ if (is_unscheduled(parse_frontmatter2(text))) {
19819
19876
  continue;
19820
19877
  }
19821
19878
  const cell = resume_cell(text);
@@ -20270,7 +20327,7 @@ function _isCliEntry10() {
20270
20327
  return false;
20271
20328
  }
20272
20329
  }
20273
- var _HERE7, _require3, CHECKBOX_RE, PHASE_RE, TITLE_RE, EXCLUDE_NAMES, EXCLUDE_PREFIXES, EXCLUDE_DIRS, FRONTMATTER_RE, DRAFT_VALUES, MERGE_GATED_RE, PR_NUM_RE, PhaseStats, RoadmapStats, FENCED_CODE_RE, BLOCKERS_SECTION_RE, BLOCKER_HEADING_RE, NEXT_H2_RE, LEGACY_BLOCKED_UNTIL_RE, BLOCKER_FIELD_RE, RESUME_STATEMENT, RESUME_LOOSE, ArgparseExit, _PROG5;
20330
+ var _HERE7, _require3, CHECKBOX_RE, PHASE_RE, TITLE_RE, EXCLUDE_NAMES, EXCLUDE_PREFIXES, EXCLUDE_DIRS, FRONTMATTER_RE, UNSCHEDULED_VALUES, MERGE_GATED_RE, PR_NUM_RE, PhaseStats, RoadmapStats, FENCED_CODE_RE, BLOCKERS_SECTION_RE, BLOCKER_HEADING_RE, NEXT_H2_RE, LEGACY_BLOCKED_UNTIL_RE, BLOCKER_FIELD_RE, RESUME_STATEMENT, RESUME_LOOSE, ArgparseExit, _PROG5;
20274
20331
  var init_update_roadmap_progress = __esm({
20275
20332
  "src/agent-src/scripts/update_roadmap_progress.ts"() {
20276
20333
  "use strict";
@@ -20292,7 +20349,7 @@ var init_update_roadmap_progress = __esm({
20292
20349
  EXCLUDE_PREFIXES = ["open-questions"];
20293
20350
  EXCLUDE_DIRS = /* @__PURE__ */ new Set(["archive", "skipped", "stubs", "later"]);
20294
20351
  FRONTMATTER_RE = /^---\n([\s\S]*?)\n---[ \t\n\r\f\v]*\n/;
20295
- DRAFT_VALUES = /* @__PURE__ */ new Set(["draft"]);
20352
+ UNSCHEDULED_VALUES = /* @__PURE__ */ new Set(["draft", "carrier"]);
20296
20353
  MERGE_GATED_RE = /merge-gated/i;
20297
20354
  PR_NUM_RE = /pr[ \t\n\r\f\v]*[=#:]?[ \t\n\r\f\v]*#?[ \t\n\r\f\v]*(\d+)/gi;
20298
20355
  PhaseStats = class {
@@ -20432,6 +20489,7 @@ __export(archive_completed_roadmaps_exports, {
20432
20489
  _git_mv: () => _git_mv,
20433
20490
  _inbound_ref_rewrite: () => _inbound_ref_rewrite,
20434
20491
  _is_frozen_record: () => _is_frozen_record,
20492
+ _relatesTo: () => _relatesTo,
20435
20493
  _repo_root: () => _repo_root,
20436
20494
  archive_completed: () => archive_completed,
20437
20495
  deferralProblems: () => deferralProblems,
@@ -33689,6 +33747,115 @@ var init_rule_scope = __esm({
33689
33747
  }
33690
33748
  });
33691
33749
 
33750
+ // src/scripts/_cli/_doctor_strict.ts
33751
+ function eprint(msg) {
33752
+ process.stderr.write(`${msg}
33753
+ `);
33754
+ }
33755
+ function strictTripping(level) {
33756
+ return level === "warn" ? /* @__PURE__ */ new Set(["fail", "warn"]) : /* @__PURE__ */ new Set(["fail"]);
33757
+ }
33758
+ function canProceed(driftPresent, checks) {
33759
+ return !driftPresent && !checks.some((c) => c["status"] === "fail");
33760
+ }
33761
+ function validateStrictLevel(level) {
33762
+ if (!STRICT_LEVELS.has(level)) {
33763
+ throw new StrictLevelError(
33764
+ `argument --strict-level: invalid choice: '${level}' (choose from 'fail', 'warn')`
33765
+ );
33766
+ }
33767
+ }
33768
+ function strictExit(opts, checks, driftPresent) {
33769
+ if (!opts.strict) {
33770
+ return null;
33771
+ }
33772
+ const tripping = strictTripping(opts.strict_level);
33773
+ const tripped = checks.filter((c) => tripping.has(c["status"]));
33774
+ if (!driftPresent && tripped.length === 0) {
33775
+ return 0;
33776
+ }
33777
+ if (process.env[STRICT_KILL_SWITCH] === "1") {
33778
+ eprint(
33779
+ `\u26A0\uFE0F doctor --strict: ${String(tripped.length)} finding(s) at or above '${opts.strict_level}'` + (driftPresent ? " plus manifest drift" : "") + `, but ${STRICT_KILL_SWITCH}=1 suppressed the failing exit. The findings above still stand; unset it to restore the gate.`
33780
+ );
33781
+ return 0;
33782
+ }
33783
+ return 1;
33784
+ }
33785
+ function attachProceedFields(payload, driftPresent, checks) {
33786
+ const proceed = canProceed(driftPresent, checks);
33787
+ payload["can_proceed"] = proceed;
33788
+ payload["status"] = proceed ? checks.some((c) => c["status"] === "warn") ? "warn" : "ok" : "fail";
33789
+ }
33790
+ function validateStrictLevelOr(level, onError) {
33791
+ try {
33792
+ validateStrictLevel(level);
33793
+ } catch (e) {
33794
+ if (e instanceof StrictLevelError) onError(e.message);
33795
+ throw e;
33796
+ }
33797
+ }
33798
+ var StrictLevelError, STRICT_DEFAULT_LEVEL, STRICT_LEVELS, STRICT_KILL_SWITCH, STRICT_STORE_TRUE, STRICT_VALUE_FLAGS, STRICT_DEFAULTS, STRICT_USAGE;
33799
+ var init_doctor_strict = __esm({
33800
+ "src/scripts/_cli/_doctor_strict.ts"() {
33801
+ "use strict";
33802
+ StrictLevelError = class extends Error {
33803
+ };
33804
+ STRICT_DEFAULT_LEVEL = "fail";
33805
+ STRICT_LEVELS = /* @__PURE__ */ new Set(["fail", "warn"]);
33806
+ STRICT_KILL_SWITCH = "AGENT_CONFIG_DOCTOR_NO_FAIL";
33807
+ STRICT_STORE_TRUE = { "--strict": "strict" };
33808
+ STRICT_VALUE_FLAGS = { "--strict-level": "strict_level" };
33809
+ STRICT_DEFAULTS = { strict: false, strict_level: STRICT_DEFAULT_LEVEL };
33810
+ STRICT_USAGE = " [--strict] [--strict-level {fail,warn}]\n";
33811
+ }
33812
+ });
33813
+
33814
+ // src/scripts/_cli/_doctor_emit.ts
33815
+ function print(line = "") {
33816
+ process.stdout.write(`${line}
33817
+ `);
33818
+ }
33819
+ function _emit_text(project_root, missing, modified, foreign, tag_drift) {
33820
+ const total = missing.length + modified.length + foreign.length + tag_drift.length;
33821
+ if (total === 0) {
33822
+ print(`\u2705 doctor: manifest matches filesystem under ${project_root}`);
33823
+ return;
33824
+ }
33825
+ print(`\u26A0\uFE0F doctor: ${total} drift item(s) under ${project_root}`);
33826
+ const groups = [
33827
+ ["missing", missing],
33828
+ ["modified", modified],
33829
+ ["foreign", foreign],
33830
+ ["tag-drift", tag_drift]
33831
+ ];
33832
+ for (const [label, items] of groups) {
33833
+ if (items.length === 0) {
33834
+ continue;
33835
+ }
33836
+ print(`
33837
+ ${label} (${items.length}):`);
33838
+ for (const it of items) {
33839
+ const tool = it["tool"] || "?";
33840
+ print(` \xB7 [${tool}] ${it["path"]}`);
33841
+ if (label === "tag-drift") {
33842
+ const found = it["found"] || "(missing)";
33843
+ const expected = "expected" in it ? it["expected"] : PACKAGE_TAG_ID;
33844
+ print(` expected: ${expected}`);
33845
+ print(` found: ${found}`);
33846
+ }
33847
+ print(` fix: ${it["fix"]}`);
33848
+ }
33849
+ }
33850
+ }
33851
+ var PACKAGE_TAG_ID;
33852
+ var init_doctor_emit = __esm({
33853
+ "src/scripts/_cli/_doctor_emit.ts"() {
33854
+ "use strict";
33855
+ PACKAGE_TAG_ID = "event4u/agent-config";
33856
+ }
33857
+ });
33858
+
33692
33859
  // src/scripts/_cli/cmd_doctor.ts
33693
33860
  var cmd_doctor_exports = {};
33694
33861
  __export(cmd_doctor_exports, {
@@ -33700,7 +33867,7 @@ __export(cmd_doctor_exports, {
33700
33867
  MCP_BETA_GATES: () => MCP_BETA_GATES,
33701
33868
  MIN_PYTHON: () => MIN_PYTHON,
33702
33869
  NO_FRONTMATTER: () => NO_FRONTMATTER,
33703
- PACKAGE_TAG_ID: () => PACKAGE_TAG_ID,
33870
+ PACKAGE_TAG_ID: () => PACKAGE_TAG_ID2,
33704
33871
  REPAIR_IDS: () => REPAIR_IDS,
33705
33872
  STATUS_SYMBOLS: () => STATUS_SYMBOLS,
33706
33873
  _check_bridge_drift: () => _check_bridge_drift,
@@ -33898,10 +34065,10 @@ function yamlSafeLoad2(text) {
33898
34065
  return void 0;
33899
34066
  }
33900
34067
  }
33901
- function print(line = "") {
34068
+ function print2(line = "") {
33902
34069
  process16.stdout.write(line + "\n");
33903
34070
  }
33904
- function eprint(line = "") {
34071
+ function eprint2(line = "") {
33905
34072
  process16.stderr.write(line + "\n");
33906
34073
  }
33907
34074
  function _resolve_project_root(arg) {
@@ -33953,22 +34120,22 @@ function _detect_wrapper(project_root) {
33953
34120
  };
33954
34121
  }
33955
34122
  function _emit_trace_text(root, anchor, trace, origin) {
33956
- print(` \u{1F4CD} start: ${process16.cwd()}`);
33957
- print(` \u{1F4CD} origin: ${origin}`);
34123
+ print2(` \u{1F4CD} start: ${process16.cwd()}`);
34124
+ print2(` \u{1F4CD} origin: ${origin}`);
33958
34125
  if (trace.length > 0) {
33959
- print(" trace:");
34126
+ print2(" trace:");
33960
34127
  for (const record of trace) {
33961
34128
  const hit = record.hit;
33962
34129
  const symbol = hit ? "\u2705" : "\xB7";
33963
34130
  const tag = `[${record.pass}]`;
33964
34131
  const anchor_str = hit ? ` \u2192 ${hit}` : "";
33965
- print(` ${symbol} ${tag} ${record.ancestor}${anchor_str} (${record.reason})`);
34132
+ print2(` ${symbol} ${tag} ${record.ancestor}${anchor_str} (${record.reason})`);
33966
34133
  }
33967
34134
  }
33968
34135
  if (root !== null) {
33969
- print(` \u{1F4CD} resolved root: ${root} (anchor: ${anchor || "n/a"})`);
34136
+ print2(` \u{1F4CD} resolved root: ${root} (anchor: ${anchor || "n/a"})`);
33970
34137
  } else {
33971
- print(" \u26A0\uFE0F no anchor found in chain");
34138
+ print2(" \u26A0\uFE0F no anchor found in chain");
33972
34139
  }
33973
34140
  }
33974
34141
  function _emit_trace_json(root, anchor, trace, origin) {
@@ -33979,32 +34146,32 @@ function _emit_trace_json(root, anchor, trace, origin) {
33979
34146
  anchor,
33980
34147
  trace
33981
34148
  };
33982
- print(_jsonDumpsIndentAscii(payload, 2));
34149
+ print2(_jsonDumpsIndentAscii(payload, 2));
33983
34150
  }
33984
34151
  function _emit_context_text(ctx) {
33985
- print(` \u{1F4CD} project_root: ${ctx["project_root"]} (origin: ${ctx["origin"]})`);
33986
- print(` \u{1F4E6} install_mode: ${ctx["install_mode"]} (source: ${ctx["install_mode_source"]})`);
34152
+ print2(` \u{1F4CD} project_root: ${ctx["project_root"]} (origin: ${ctx["origin"]})`);
34153
+ print2(` \u{1F4E6} install_mode: ${ctx["install_mode"]} (source: ${ctx["install_mode_source"]})`);
33987
34154
  const env_pin = ctx["env_pin"];
33988
34155
  if (env_pin) {
33989
34156
  const marker = ctx["root_override"] ? " (--root override)" : "";
33990
- print(` \u{1F512} env_pin: ${env_pin}${marker}`);
34157
+ print2(` \u{1F512} env_pin: ${env_pin}${marker}`);
33991
34158
  } else {
33992
- print(" \u{1F512} env_pin: (unset)");
34159
+ print2(" \u{1F512} env_pin: (unset)");
33993
34160
  }
33994
34161
  const layers = ctx["settings_layers"] || [];
33995
34162
  if (layers.length > 0) {
33996
- print(` \u{1F4D1} settings layers (${layers.length}):`);
34163
+ print2(` \u{1F4D1} settings layers (${layers.length}):`);
33997
34164
  for (const layer of layers) {
33998
- print(` - ${layer}`);
34165
+ print2(` - ${layer}`);
33999
34166
  }
34000
34167
  } else {
34001
- print(" \u{1F4D1} settings layers: (none)");
34168
+ print2(" \u{1F4D1} settings layers: (none)");
34002
34169
  }
34003
34170
  const wrapper = ctx["wrapper"] || {};
34004
34171
  if (wrapper["exists"]) {
34005
- print(` \u{1F9E9} wrapper: ${wrapper["path"]} (embedded root: ${wrapper["embedded_root"]})`);
34172
+ print2(` \u{1F9E9} wrapper: ${wrapper["path"]} (embedded root: ${wrapper["embedded_root"]})`);
34006
34173
  } else {
34007
- print(` \u{1F9E9} wrapper: (not present at ${wrapper["path"]})`);
34174
+ print2(` \u{1F9E9} wrapper: (not present at ${wrapper["path"]})`);
34008
34175
  }
34009
34176
  }
34010
34177
  function _resolve_path(project_root, raw) {
@@ -34187,12 +34354,12 @@ function _classify2(records) {
34187
34354
  continue;
34188
34355
  }
34189
34356
  const tag = _read_inline_package_tag(target);
34190
- if (!(tag instanceof _Sentinel) && tag !== PACKAGE_TAG_ID) {
34357
+ if (!(tag instanceof _Sentinel) && tag !== PACKAGE_TAG_ID2) {
34191
34358
  tag_drift.push({
34192
34359
  tool: tool_id,
34193
34360
  path: String(target),
34194
34361
  kind,
34195
- expected: PACKAGE_TAG_ID,
34362
+ expected: PACKAGE_TAG_ID2,
34196
34363
  found: tag === null ? "" : tag,
34197
34364
  fix: _fix_hint("tag-drift", kind)
34198
34365
  });
@@ -34799,7 +34966,7 @@ function _check_stale_orphans() {
34799
34966
  continue;
34800
34967
  }
34801
34968
  const tag = _read_inline_package_tag(md);
34802
- if (tag instanceof _Sentinel || tag !== PACKAGE_TAG_ID) {
34969
+ if (tag instanceof _Sentinel || tag !== PACKAGE_TAG_ID2) {
34803
34970
  continue;
34804
34971
  }
34805
34972
  orphan_count += 1;
@@ -35827,17 +35994,17 @@ function _run_no_manifest(opts, project_root, origin, bridge_present) {
35827
35994
  if (opts.json) {
35828
35995
  _emit_json(project_root, [], [], [], [], checks, origin);
35829
35996
  } else if (opts.check === null) {
35830
- print(` \u{1F4CD} project_root: ${project_root} (origin: ${origin})`);
35997
+ print2(` \u{1F4CD} project_root: ${project_root} (origin: ${origin})`);
35831
35998
  if (bridge_present) {
35832
- print(
35999
+ print2(
35833
36000
  " \u2139\uFE0F global-only consumer: install marker present, no project lockfile (expected under ADR-020)"
35834
36001
  );
35835
- print(
36002
+ print2(
35836
36003
  " project-manifest checks are skipped \u2014 they apply only to project-local distributed tools"
35837
36004
  );
35838
36005
  } else {
35839
- eprint(` \u26A0\uFE0F no project lockfile and no consumer install marker at ${project_root}`);
35840
- eprint(
36006
+ eprint2(` \u26A0\uFE0F no project lockfile and no consumer install marker at ${project_root}`);
36007
+ eprint2(
35841
36008
  " run `agent-config init` (project install) or `agent-config refresh --project` (global-only consumer)"
35842
36009
  );
35843
36010
  }
@@ -35853,6 +36020,8 @@ function _run_no_manifest(opts, project_root, origin, bridge_present) {
35853
36020
  }
35854
36021
  return fail_check ? 1 : 0;
35855
36022
  }
36023
+ const sx = strictExit(opts, checks, false);
36024
+ if (sx !== null) return bridge_present ? sx : 2;
35856
36025
  if (opts.ci && bridge_present) {
35857
36026
  return fail_check ? 1 : 0;
35858
36027
  }
@@ -35871,66 +36040,36 @@ function _emit_json(project_root, missing, modified, foreign, tag_drift, checks
35871
36040
  }
35872
36041
  if (checks !== null) {
35873
36042
  payload["checks"] = checks;
36043
+ const drift = missing.length + modified.length + foreign.length + tag_drift.length;
36044
+ attachProceedFields(payload, drift > 0, checks);
35874
36045
  if (checks.some((c) => c["id"] === "detection")) {
35875
36046
  payload["detection"] = detectionJson(_detection_report(project_root));
35876
36047
  }
35877
36048
  }
35878
- print(_jsonDumpsIndentAscii(payload, 2));
36049
+ print2(_jsonDumpsIndentAscii(payload, 2));
35879
36050
  }
35880
36051
  function _emit_checks_text(checks) {
35881
36052
  if (checks.length === 0) {
35882
36053
  return;
35883
36054
  }
35884
- print("checks:");
36055
+ print2("checks:");
35885
36056
  for (const c of checks) {
35886
36057
  const sym = STATUS_SYMBOLS[c["status"]] ?? "?";
35887
- print(` ${sym} ${c["id"]}: ${c["message"]}`);
36058
+ print2(` ${sym} ${c["id"]}: ${c["message"]}`);
35888
36059
  if (c["status"] !== "ok" && c["remedy"]) {
35889
- print(` fix: ${c["remedy"]}`);
36060
+ print2(` fix: ${c["remedy"]}`);
35890
36061
  }
35891
36062
  }
35892
- print("");
36063
+ print2("");
35893
36064
  }
35894
36065
  function _emit_detection_text(project_root, checks) {
35895
36066
  if (!checks.some((c) => c["id"] === "detection")) {
35896
36067
  return;
35897
36068
  }
35898
36069
  for (const line of renderDetectionLines(_detection_report(project_root))) {
35899
- print(line);
35900
- }
35901
- print("");
35902
- }
35903
- function _emit_text(project_root, missing, modified, foreign, tag_drift) {
35904
- const total = missing.length + modified.length + foreign.length + tag_drift.length;
35905
- if (total === 0) {
35906
- print(`\u2705 doctor: manifest matches filesystem under ${project_root}`);
35907
- return;
35908
- }
35909
- print(`\u26A0\uFE0F doctor: ${total} drift item(s) under ${project_root}`);
35910
- const groups = [
35911
- ["missing", missing],
35912
- ["modified", modified],
35913
- ["foreign", foreign],
35914
- ["tag-drift", tag_drift]
35915
- ];
35916
- for (const [label, items] of groups) {
35917
- if (items.length === 0) {
35918
- continue;
35919
- }
35920
- print(`
35921
- ${label} (${items.length}):`);
35922
- for (const it of items) {
35923
- const tool = it["tool"] || "?";
35924
- print(` \xB7 [${tool}] ${it["path"]}`);
35925
- if (label === "tag-drift") {
35926
- const found = it["found"] || "(missing)";
35927
- const expected = "expected" in it ? it["expected"] : PACKAGE_TAG_ID;
35928
- print(` expected: ${expected}`);
35929
- print(` found: ${found}`);
35930
- }
35931
- print(` fix: ${it["fix"]}`);
35932
- }
36070
+ print2(line);
35933
36071
  }
36072
+ print2("");
35934
36073
  }
35935
36074
  function _argError9(msg) {
35936
36075
  process16.stderr.write(USAGE2);
@@ -35943,6 +36082,7 @@ function _parse3(argv) {
35943
36082
  project: null,
35944
36083
  json: false,
35945
36084
  ci: false,
36085
+ ...STRICT_DEFAULTS,
35946
36086
  check: null,
35947
36087
  trace_root: false,
35948
36088
  context: false,
@@ -36040,7 +36180,7 @@ function _run_context(opts) {
36040
36180
  [project_root, origin] = _resolve_project_root(opts.project);
36041
36181
  } catch (exc) {
36042
36182
  if (exc instanceof ProjectRootError) {
36043
- eprint(`\u274C doctor: ${exc.message}`);
36183
+ eprint2(`\u274C doctor: ${exc.message}`);
36044
36184
  return 2;
36045
36185
  }
36046
36186
  throw exc;
@@ -36057,7 +36197,7 @@ function _run_context(opts) {
36057
36197
  wrapper: _detect_wrapper(project_root)
36058
36198
  };
36059
36199
  if (opts.json) {
36060
- print(_jsonDumpsIndentAscii(ctx, 2));
36200
+ print2(_jsonDumpsIndentAscii(ctx, 2));
36061
36201
  } else {
36062
36202
  _emit_context_text(ctx);
36063
36203
  }
@@ -36079,7 +36219,7 @@ function _run_anatomy(opts) {
36079
36219
  economyError = err instanceof Error ? err.message : String(err);
36080
36220
  }
36081
36221
  if (opts.json) {
36082
- print(
36222
+ print2(
36083
36223
  _jsonDumpsIndentAscii(
36084
36224
  {
36085
36225
  preamble_byte_census: byteCensus,
@@ -36091,10 +36231,10 @@ function _run_anatomy(opts) {
36091
36231
  );
36092
36232
  return 0;
36093
36233
  }
36094
- print("\u2500\u2500 injection anatomy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
36095
- print(census.renderText(byteCensus));
36096
- print("");
36097
- print(
36234
+ print2("\u2500\u2500 injection anatomy \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
36235
+ print2(census.renderText(byteCensus));
36236
+ print2("");
36237
+ print2(
36098
36238
  economyReport !== null ? economy.renderText(economyReport) : `dispatch-economy report unavailable: ${economyError}`
36099
36239
  );
36100
36240
  return 0;
@@ -36116,29 +36256,30 @@ function _run_repair(opts) {
36116
36256
  payload["action"] = "error";
36117
36257
  payload["error"] = osErrorStr2(exc);
36118
36258
  if (opts.json) {
36119
- print(_jsonDumpsIndentAscii(payload, 2));
36259
+ print2(_jsonDumpsIndentAscii(payload, 2));
36120
36260
  } else {
36121
- eprint(`\u274C doctor: could not remove ${state_pth}: ${osErrorStr2(exc)}`);
36261
+ eprint2(`\u274C doctor: could not remove ${state_pth}: ${osErrorStr2(exc)}`);
36122
36262
  }
36123
36263
  return 2;
36124
36264
  }
36125
36265
  }
36126
36266
  if (opts.json) {
36127
- print(_jsonDumpsIndentAscii(payload, 2));
36267
+ print2(_jsonDumpsIndentAscii(payload, 2));
36128
36268
  } else {
36129
36269
  if (payload["action"] === "remove") {
36130
- print(`\u2705 doctor: reset wizard-state (${state_pth})`);
36270
+ print2(`\u2705 doctor: reset wizard-state (${state_pth})`);
36131
36271
  } else {
36132
- print(`\u2705 doctor: nothing to repair (no wizard-state at ${state_pth})`);
36272
+ print2(`\u2705 doctor: nothing to repair (no wizard-state at ${state_pth})`);
36133
36273
  }
36134
36274
  }
36135
36275
  return 0;
36136
36276
  }
36137
- eprint(`\u274C doctor: unknown repair target ${pyRepr2(target)}`);
36277
+ eprint2(`\u274C doctor: unknown repair target ${pyRepr2(target)}`);
36138
36278
  return 2;
36139
36279
  }
36140
36280
  function main21(argv = null) {
36141
36281
  const opts = _parse3(argv !== null ? Array.from(argv) : process16.argv.slice(2));
36282
+ validateStrictLevelOr(opts.strict_level, _argError9);
36142
36283
  if (opts.ci) {
36143
36284
  opts.json = true;
36144
36285
  }
@@ -36160,7 +36301,7 @@ function main21(argv = null) {
36160
36301
  [project_root, origin] = _resolve_project_root(opts.project);
36161
36302
  } catch (exc) {
36162
36303
  if (exc instanceof ProjectRootError) {
36163
- eprint(`\u274C doctor: ${exc.message}`);
36304
+ eprint2(`\u274C doctor: ${exc.message}`);
36164
36305
  return 2;
36165
36306
  }
36166
36307
  throw exc;
@@ -36186,7 +36327,7 @@ function main21(argv = null) {
36186
36327
  _emit_json(project_root, missing, modified, foreign, tag_drift, checks, origin);
36187
36328
  } else {
36188
36329
  if (opts.check === null) {
36189
- print(` \u{1F4CD} project_root: ${project_root} (origin: ${origin})`);
36330
+ print2(` \u{1F4CD} project_root: ${project_root} (origin: ${origin})`);
36190
36331
  }
36191
36332
  _emit_checks_text(checks);
36192
36333
  _emit_detection_text(project_root, checks);
@@ -36203,6 +36344,8 @@ function main21(argv = null) {
36203
36344
  if (opts.ci) {
36204
36345
  return drift_present || fail_check ? 1 : 0;
36205
36346
  }
36347
+ const strict = strictExit(opts, checks, drift_present);
36348
+ if (strict !== null) return strict;
36206
36349
  return drift_present ? 1 : 0;
36207
36350
  }
36208
36351
  function _isCliEntry17() {
@@ -36231,7 +36374,7 @@ function _isCliEntry17() {
36231
36374
  return false;
36232
36375
  }
36233
36376
  }
36234
- var YAML6, _HERE18, ArgparseExit4, _Sentinel, NO_FRONTMATTER, _INSTALL_MODE_MARKER_REL, PACKAGE_TAG_ID, _FRONTMATTER_PACKAGE_RE, CHECK_IDS, GLOBAL_CHECK_IDS, MANIFEST_REQUIRED_CHECK_IDS, REPAIR_IDS, MCP_BETA_GATES, STATUS_SYMBOLS, MIN_PYTHON, _PLACEHOLDER_EMAIL_RE, _PLACEHOLDER_NAME_RE, _RULE_PROJECTION_DIRS, _check_python_runtime, _check_humanizer_runtime, _CLI_PROVIDER_META, _detection_memo, PROG4, USAGE2, _STORE_TRUE_FLAGS, _VALUE_FLAGS;
36377
+ var YAML6, _HERE18, ArgparseExit4, _Sentinel, NO_FRONTMATTER, _INSTALL_MODE_MARKER_REL, PACKAGE_TAG_ID2, _FRONTMATTER_PACKAGE_RE, CHECK_IDS, GLOBAL_CHECK_IDS, MANIFEST_REQUIRED_CHECK_IDS, REPAIR_IDS, MCP_BETA_GATES, STATUS_SYMBOLS, MIN_PYTHON, _PLACEHOLDER_EMAIL_RE, _PLACEHOLDER_NAME_RE, _RULE_PROJECTION_DIRS, _check_python_runtime, _check_humanizer_runtime, _CLI_PROVIDER_META, _detection_memo, PROG4, USAGE2, _STORE_TRUE_FLAGS, _VALUE_FLAGS;
36235
36378
  var init_cmd_doctor = __esm({
36236
36379
  "src/scripts/_cli/cmd_doctor.ts"() {
36237
36380
  "use strict";
@@ -36262,6 +36405,8 @@ var init_cmd_doctor = __esm({
36262
36405
  init_review_gate();
36263
36406
  init_package_root();
36264
36407
  init_rule_scope();
36408
+ init_doctor_strict();
36409
+ init_doctor_emit();
36265
36410
  _HERE18 = fileURLToPath31(import.meta.url);
36266
36411
  ArgparseExit4 = class extends Error {
36267
36412
  constructor(code) {
@@ -36274,7 +36419,7 @@ var init_cmd_doctor = __esm({
36274
36419
  };
36275
36420
  NO_FRONTMATTER = new _Sentinel();
36276
36421
  _INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
36277
- PACKAGE_TAG_ID = "event4u/agent-config";
36422
+ PACKAGE_TAG_ID2 = "event4u/agent-config";
36278
36423
  _FRONTMATTER_PACKAGE_RE = /^package:\s*(.+?)\s*$/m;
36279
36424
  CHECK_IDS = [
36280
36425
  "scope",
@@ -36369,17 +36514,17 @@ var init_cmd_doctor = __esm({
36369
36514
  _detection_memo = null;
36370
36515
  PROG4 = "agent-config doctor";
36371
36516
  USAGE2 = `usage: ${PROG4} [-h] [--project PROJECT] [--json] [--ci] [--check ID]
36372
- [--trace-root] [--context] [--anatomy]
36373
- [--repair ID]
36374
- `;
36517
+ ` + STRICT_USAGE + " [--trace-root] [--context] [--anatomy]\n [--repair ID]\n";
36375
36518
  _STORE_TRUE_FLAGS = {
36376
36519
  "--json": "json",
36377
36520
  "--ci": "ci",
36521
+ ...STRICT_STORE_TRUE,
36378
36522
  "--trace-root": "trace_root",
36379
36523
  "--context": "context",
36380
36524
  "--anatomy": "anatomy"
36381
36525
  };
36382
36526
  _VALUE_FLAGS = {
36527
+ ...STRICT_VALUE_FLAGS,
36383
36528
  "--project": "project",
36384
36529
  "--check": "check",
36385
36530
  "--repair": "repair"
@@ -36552,11 +36697,48 @@ function humanAuthoredLead(text) {
36552
36697
  }
36553
36698
  return kept.join("\n");
36554
36699
  }
36555
- var DOCUMENT_HEAD;
36700
+ function stripInjectedRegions(text) {
36701
+ const lines = text.split("\n");
36702
+ const kept = [];
36703
+ for (let i = 0; i < lines.length; i++) {
36704
+ const line = lines[i] ?? "";
36705
+ const open = REGION_OPEN.exec(line);
36706
+ if (open === null) {
36707
+ kept.push(line);
36708
+ continue;
36709
+ }
36710
+ const close = new RegExp(`^\\s*</${open[1] ?? ""}>\\s*$`);
36711
+ let end = -1;
36712
+ for (let j = i + 1; j < lines.length; j++) {
36713
+ if (close.test(lines[j] ?? "")) {
36714
+ end = j;
36715
+ break;
36716
+ }
36717
+ }
36718
+ if (end === -1) {
36719
+ kept.push(line);
36720
+ continue;
36721
+ }
36722
+ if (kept.length > 0 && REGION_NOTE.test(kept[kept.length - 1] ?? "")) {
36723
+ kept.pop();
36724
+ }
36725
+ i = end;
36726
+ while (i + 1 < lines.length && (lines[i + 1] ?? "").trim() !== "") {
36727
+ if (!REGION_NOTE.test(lines[i + 1] ?? "")) {
36728
+ break;
36729
+ }
36730
+ i++;
36731
+ }
36732
+ }
36733
+ return kept.join("\n");
36734
+ }
36735
+ var DOCUMENT_HEAD, REGION_OPEN, REGION_NOTE;
36556
36736
  var init_prompt_shape = __esm({
36557
36737
  "src/scripts/_lib/prompt_shape.ts"() {
36558
36738
  "use strict";
36559
36739
  DOCUMENT_HEAD = /^\s*(#{1,6}\s|-{3,}\s*$|={3,}\s*$|<[A-Za-z][\w-]*>\s*$)/;
36740
+ REGION_OPEN = /^\s*<([A-Za-z][\w-]*)>\s*$/;
36741
+ REGION_NOTE = /\b(content (above|below) is from|treat (it|this|that|the (content|text|above|following)) as data)\b/i;
36560
36742
  }
36561
36743
  });
36562
36744
 
@@ -36599,7 +36781,7 @@ function instructionText(prompt) {
36599
36781
  return kept.join("\n");
36600
36782
  }
36601
36783
  function classify(prompt) {
36602
- const text = instructionText(prompt);
36784
+ const text = instructionText(stripInjectedRegions(prompt));
36603
36785
  const lead = humanAuthoredLead(text);
36604
36786
  const leadVerdict = _score2(lead);
36605
36787
  if (leadVerdict.language !== "und") {
@@ -42066,11 +42248,11 @@ import * as path80 from "node:path";
42066
42248
  import process21 from "node:process";
42067
42249
  import { spawnSync as spawnSync12 } from "node:child_process";
42068
42250
  import { fileURLToPath as fileURLToPath46, pathToFileURL as pathToFileURL36 } from "node:url";
42069
- function print2(s = "") {
42251
+ function print3(s = "") {
42070
42252
  process21.stdout.write(`${s}
42071
42253
  `);
42072
42254
  }
42073
- function eprint2(s = "") {
42255
+ function eprint3(s = "") {
42074
42256
  process21.stderr.write(`${s}
42075
42257
  `);
42076
42258
  }
@@ -42454,14 +42636,14 @@ function _parse4(argv) {
42454
42636
  function main36(argv = null) {
42455
42637
  const opts = _parse4(argv !== null ? Array.from(argv) : process21.argv.slice(2));
42456
42638
  if (opts.funnel) {
42457
- print2(render6(buildFunnel()));
42639
+ print3(render6(buildFunnel()));
42458
42640
  return 0;
42459
42641
  }
42460
42642
  let project_root;
42461
42643
  try {
42462
42644
  [project_root] = _resolve_project_root(opts.project);
42463
42645
  } catch (exc) {
42464
- eprint2(`\u274C conformance: ${exc.message}`);
42646
+ eprint3(`\u274C conformance: ${exc.message}`);
42465
42647
  return 2;
42466
42648
  }
42467
42649
  const manifest_pth = manifest_path(project_root);
@@ -42490,7 +42672,7 @@ function main36(argv = null) {
42490
42672
  const failed = allChecks.some((c) => c["status"] === "fail") || driftCount > 0;
42491
42673
  appendConformanceReport(conformanceChecks, project_root);
42492
42674
  if (opts.json) {
42493
- print2(
42675
+ print3(
42494
42676
  _jsonDumpsIndentAscii(
42495
42677
  {
42496
42678
  project_root,
@@ -42503,20 +42685,20 @@ function main36(argv = null) {
42503
42685
  )
42504
42686
  );
42505
42687
  } else {
42506
- print2(` \u{1F4CD} project_root: ${project_root}`);
42507
- print2("conformance:");
42688
+ print3(` \u{1F4CD} project_root: ${project_root}`);
42689
+ print3("conformance:");
42508
42690
  for (const c of allChecks) {
42509
42691
  const sym = STATUS_SYMBOLS[c["status"]] ?? "?";
42510
- print2(` ${sym} ${c["id"]}: ${c["message"]}`);
42692
+ print3(` ${sym} ${c["id"]}: ${c["message"]}`);
42511
42693
  if (c["status"] !== "ok" && c["remedy"]) {
42512
- print2(` fix: ${c["remedy"]}`);
42694
+ print3(` fix: ${c["remedy"]}`);
42513
42695
  }
42514
42696
  }
42515
42697
  if (driftCount > 0) {
42516
- print2(` \u274C drift: ${driftCount} drifted file(s) \u2014 run \`agent-config doctor\` for detail`);
42698
+ print3(` \u274C drift: ${driftCount} drifted file(s) \u2014 run \`agent-config doctor\` for detail`);
42517
42699
  }
42518
- print2("");
42519
- print2(
42700
+ print3("");
42701
+ print3(
42520
42702
  failed ? "\u274C conformance: red \u2014 the OS is not fully installed/firing here" : "\u2705 conformance: green \u2014 installed and firing"
42521
42703
  );
42522
42704
  }