@deftai/directive-core 0.103.0 → 0.105.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.
Files changed (255) hide show
  1. package/dist/authz/classify.js +682 -35
  2. package/dist/check/cached-orchestrator.d.ts +1 -1
  3. package/dist/check/cached-orchestrator.js +2 -2
  4. package/dist/check/gate-lists.d.ts +3 -2
  5. package/dist/check/gate-lists.js +5 -2
  6. package/dist/check/index.d.ts +1 -0
  7. package/dist/check/index.js +1 -0
  8. package/dist/check/named-cause.d.ts +1 -1
  9. package/dist/check/named-cause.js +33 -3
  10. package/dist/check/session-completed-ac.d.ts +39 -0
  11. package/dist/check/session-completed-ac.js +198 -0
  12. package/dist/codebase/default-extractor.d.ts +5 -0
  13. package/dist/codebase/default-extractor.js +7 -15
  14. package/dist/deposit/copy-tree.js +60 -0
  15. package/dist/deposit/python-free.js +26 -18
  16. package/dist/doctor/checks.d.ts +8 -0
  17. package/dist/doctor/checks.js +37 -25
  18. package/dist/doctor/doctor-state.d.ts +4 -0
  19. package/dist/doctor/doctor-state.js +7 -1
  20. package/dist/doctor/main.js +9 -14
  21. package/dist/doctor/types.d.ts +9 -0
  22. package/dist/fs/contained-write.d.ts +115 -1
  23. package/dist/fs/contained-write.js +242 -5
  24. package/dist/fs/mutation-ledger.d.ts +54 -0
  25. package/dist/fs/mutation-ledger.js +133 -0
  26. package/dist/fs/non-product-dirs.d.ts +79 -0
  27. package/dist/fs/non-product-dirs.js +96 -0
  28. package/dist/hooks/dispatcher.d.ts +3 -1
  29. package/dist/hooks/dispatcher.js +14 -0
  30. package/dist/index.d.ts +2 -0
  31. package/dist/index.js +3 -0
  32. package/dist/init-deposit/agent-hooks.js +17 -15
  33. package/dist/init-deposit/core-guard-pin-content.d.ts +7 -0
  34. package/dist/init-deposit/core-guard-pin-content.js +393 -0
  35. package/dist/init-deposit/gitignore.js +9 -0
  36. package/dist/init-deposit/hygiene.d.ts +47 -11
  37. package/dist/init-deposit/hygiene.js +172 -37
  38. package/dist/init-deposit/legacy-detect.js +6 -2
  39. package/dist/init-deposit/refresh.d.ts +21 -1
  40. package/dist/init-deposit/refresh.js +106 -9
  41. package/dist/init-deposit/scaffold.js +28 -279
  42. package/dist/init-deposit/slash-deposit.js +13 -7
  43. package/dist/init-deposit/xbrief-projections.d.ts +8 -1
  44. package/dist/init-deposit/xbrief-projections.js +24 -11
  45. package/dist/intake/clause-derivation.d.ts +74 -0
  46. package/dist/intake/clause-derivation.js +409 -0
  47. package/dist/intake/index.d.ts +1 -0
  48. package/dist/intake/index.js +1 -0
  49. package/dist/intake/issue-ingest.d.ts +3 -1
  50. package/dist/intake/issue-ingest.js +36 -43
  51. package/dist/lifecycle/completed-tracked-on-delivery.d.ts +5 -0
  52. package/dist/lifecycle/completed-tracked-on-delivery.js +85 -18
  53. package/dist/literal-acceptance/capture.d.ts +10 -0
  54. package/dist/literal-acceptance/capture.js +224 -75
  55. package/dist/literal-acceptance/evaluate.d.ts +29 -4
  56. package/dist/literal-acceptance/evaluate.js +70 -2
  57. package/dist/literal-acceptance/index.d.ts +3 -3
  58. package/dist/literal-acceptance/index.js +3 -3
  59. package/dist/literal-acceptance/safety.d.ts +41 -0
  60. package/dist/literal-acceptance/safety.js +126 -2
  61. package/dist/literal-acceptance/types.d.ts +8 -0
  62. package/dist/orphan-active/evaluate.d.ts +7 -1
  63. package/dist/orphan-active/evaluate.js +102 -23
  64. package/dist/platform/platform-capabilities.js +2 -3
  65. package/dist/policy/base-branch.d.ts +37 -0
  66. package/dist/policy/base-branch.js +114 -0
  67. package/dist/policy/branch-sync.d.ts +80 -0
  68. package/dist/policy/branch-sync.js +211 -0
  69. package/dist/policy/ceremony-dial-escalation.js +1 -0
  70. package/dist/policy/ceremony-dial.js +4 -14
  71. package/dist/policy/delivery-branch.d.ts +5 -3
  72. package/dist/policy/delivery-branch.js +7 -3
  73. package/dist/policy/file-size-thresholds.d.ts +24 -0
  74. package/dist/policy/file-size-thresholds.js +23 -0
  75. package/dist/policy/forge-outage-retry.d.ts +47 -0
  76. package/dist/policy/forge-outage-retry.js +157 -0
  77. package/dist/policy/index.d.ts +7 -0
  78. package/dist/policy/index.js +66 -7
  79. package/dist/policy/project-invariants.d.ts +50 -0
  80. package/dist/policy/project-invariants.js +205 -0
  81. package/dist/policy/sync-default.d.ts +129 -0
  82. package/dist/policy/sync-default.js +452 -0
  83. package/dist/policy/sync-max-files.d.ts +93 -0
  84. package/dist/policy/sync-max-files.js +192 -0
  85. package/dist/pr-monitor/absent-required.d.ts +11 -0
  86. package/dist/pr-monitor/absent-required.js +61 -0
  87. package/dist/pr-monitor/constants.d.ts +7 -0
  88. package/dist/pr-monitor/constants.js +7 -0
  89. package/dist/pr-monitor/index.d.ts +2 -1
  90. package/dist/pr-monitor/index.js +2 -1
  91. package/dist/pr-monitor/main.js +4 -0
  92. package/dist/pr-monitor/monitor.js +24 -1
  93. package/dist/pr-wait-mergeable/classify.js +6 -0
  94. package/dist/preflight/evaluate.d.ts +9 -0
  95. package/dist/preflight/evaluate.js +49 -1
  96. package/dist/preflight/index.d.ts +5 -1
  97. package/dist/preflight/index.js +2 -0
  98. package/dist/preflight/intended-placement.d.ts +62 -0
  99. package/dist/preflight/intended-placement.js +275 -0
  100. package/dist/preflight/project-invariants-gate.d.ts +29 -0
  101. package/dist/preflight/project-invariants-gate.js +82 -0
  102. package/dist/product-first-done-gate/acceptance-resolver.d.ts +128 -0
  103. package/dist/product-first-done-gate/acceptance-resolver.js +144 -0
  104. package/dist/product-first-done-gate/acceptance.d.ts +7 -4
  105. package/dist/product-first-done-gate/acceptance.js +79 -8
  106. package/dist/product-first-done-gate/empty-resolution.d.ts +5 -2
  107. package/dist/product-first-done-gate/empty-resolution.js +13 -2
  108. package/dist/product-first-done-gate/evaluate.d.ts +29 -0
  109. package/dist/product-first-done-gate/evaluate.js +307 -33
  110. package/dist/product-first-done-gate/index.d.ts +3 -1
  111. package/dist/product-first-done-gate/index.js +2 -1
  112. package/dist/release/build-dist.d.ts +101 -0
  113. package/dist/release/build-dist.js +428 -46
  114. package/dist/run-summary/emit.d.ts +50 -4
  115. package/dist/run-summary/emit.js +262 -26
  116. package/dist/run-summary/index.d.ts +3 -2
  117. package/dist/run-summary/index.js +2 -1
  118. package/dist/run-summary/session-id.d.ts +21 -0
  119. package/dist/run-summary/session-id.js +92 -0
  120. package/dist/run-summary/share.d.ts +1 -1
  121. package/dist/run-summary/share.js +2 -2
  122. package/dist/run-summary/types.d.ts +38 -6
  123. package/dist/run-summary/types.js +1 -0
  124. package/dist/scope/acceptance-activate-gate.d.ts +1 -1
  125. package/dist/scope/acceptance-activate-gate.js +4 -4
  126. package/dist/scope/acceptance-evidence.d.ts +27 -0
  127. package/dist/scope/acceptance-evidence.js +66 -0
  128. package/dist/scope/capacity-stamp.d.ts +2 -0
  129. package/dist/scope/capacity-stamp.js +4 -0
  130. package/dist/scope/delivery-evidence.d.ts +9 -3
  131. package/dist/scope/delivery-evidence.js +39 -27
  132. package/dist/scope/index.d.ts +1 -0
  133. package/dist/scope/index.js +1 -0
  134. package/dist/scope/parent-lineage.js +7 -6
  135. package/dist/scope/project-invariant-coverage.d.ts +54 -0
  136. package/dist/scope/project-invariant-coverage.js +322 -0
  137. package/dist/scope/transition.js +66 -4
  138. package/dist/scope-provenance/compare-intent.d.ts +27 -0
  139. package/dist/scope-provenance/compare-intent.js +233 -0
  140. package/dist/scope-provenance/digest.d.ts +18 -1
  141. package/dist/scope-provenance/digest.js +16 -11
  142. package/dist/scope-provenance/evaluate.d.ts +5 -1
  143. package/dist/scope-provenance/evaluate.js +64 -4
  144. package/dist/scope-provenance/extract-intent.d.ts +43 -0
  145. package/dist/scope-provenance/extract-intent.js +262 -0
  146. package/dist/scope-provenance/index.d.ts +7 -1
  147. package/dist/scope-provenance/index.js +7 -1
  148. package/dist/scope-provenance/intent-digest.d.ts +12 -0
  149. package/dist/scope-provenance/intent-digest.js +33 -0
  150. package/dist/scope-provenance/intent-evaluate.d.ts +43 -0
  151. package/dist/scope-provenance/intent-evaluate.js +149 -0
  152. package/dist/scope-provenance/json-tokenizer.d.ts +19 -0
  153. package/dist/scope-provenance/json-tokenizer.js +225 -0
  154. package/dist/scope-provenance/known-machine.d.ts +38 -0
  155. package/dist/scope-provenance/known-machine.js +157 -0
  156. package/dist/scope-provenance/mint-artifacts.d.ts +102 -0
  157. package/dist/scope-provenance/mint-artifacts.js +425 -0
  158. package/dist/session/ac-pass-banking.d.ts +4 -36
  159. package/dist/session/ac-pass-banking.js +30 -77
  160. package/dist/session/ac-pass-reuse.d.ts +53 -0
  161. package/dist/session/ac-pass-reuse.js +95 -0
  162. package/dist/session/ceremony-dial-evidence.d.ts +42 -0
  163. package/dist/session/ceremony-dial-evidence.js +194 -0
  164. package/dist/session/git.js +19 -4
  165. package/dist/session/index.d.ts +5 -0
  166. package/dist/session/index.js +5 -0
  167. package/dist/session/occupancy-stress-worker.d.ts +7 -0
  168. package/dist/session/occupancy-stress-worker.js +36 -0
  169. package/dist/session/occupancy.d.ts +97 -0
  170. package/dist/session/occupancy.js +422 -0
  171. package/dist/session/openclaw-soft-rebind-deposit.js +6 -6
  172. package/dist/session/product-state-hash.d.ts +26 -0
  173. package/dist/session/product-state-hash.js +683 -0
  174. package/dist/session/session-ready.d.ts +2 -0
  175. package/dist/session/session-ready.js +52 -30
  176. package/dist/session/session-start.d.ts +7 -0
  177. package/dist/session/session-start.js +88 -5
  178. package/dist/session/verify-ac-session-cache.d.ts +42 -0
  179. package/dist/session/verify-ac-session-cache.js +126 -0
  180. package/dist/session/verify-session-ritual.d.ts +5 -0
  181. package/dist/session/verify-session-ritual.js +9 -0
  182. package/dist/slash/openclaw-deposit.js +13 -9
  183. package/dist/slice/constants.d.ts +2 -2
  184. package/dist/slice/constants.js +2 -2
  185. package/dist/slice/existing.js +21 -4
  186. package/dist/slice/lock.d.ts +16 -1
  187. package/dist/slice/lock.js +137 -11
  188. package/dist/slice/record.d.ts +8 -5
  189. package/dist/slice/record.js +21 -13
  190. package/dist/story-ready/evaluate.d.ts +2 -0
  191. package/dist/story-ready/evaluate.js +13 -0
  192. package/dist/swarm/complete-cohort.d.ts +3 -0
  193. package/dist/swarm/complete-cohort.js +59 -11
  194. package/dist/swarm/finalize-cohort.js +33 -2
  195. package/dist/swarm/launch.d.ts +22 -0
  196. package/dist/swarm/launch.js +155 -0
  197. package/dist/swarm/routing-set-cli.d.ts +11 -1
  198. package/dist/swarm/routing-set-cli.js +13 -3
  199. package/dist/swarm/routing-verify.d.ts +12 -0
  200. package/dist/swarm/routing-verify.js +59 -20
  201. package/dist/swarm/routing.d.ts +14 -0
  202. package/dist/swarm/routing.js +53 -3
  203. package/dist/telemetry-coverage/evaluate.d.ts +42 -0
  204. package/dist/telemetry-coverage/evaluate.js +148 -0
  205. package/dist/telemetry-coverage/fake-trial.d.ts +45 -0
  206. package/dist/telemetry-coverage/fake-trial.js +204 -0
  207. package/dist/telemetry-coverage/index.d.ts +5 -0
  208. package/dist/telemetry-coverage/index.js +5 -0
  209. package/dist/telemetry-coverage/kinds.d.ts +19 -0
  210. package/dist/telemetry-coverage/kinds.js +54 -0
  211. package/dist/telemetry-coverage/scan-callers.d.ts +25 -0
  212. package/dist/telemetry-coverage/scan-callers.js +168 -0
  213. package/dist/triage/actions/index.js +4 -1
  214. package/dist/ts-check-lane/index.d.ts +3 -0
  215. package/dist/ts-check-lane/index.js +2 -0
  216. package/dist/ts-check-lane/progress-reporter.d.ts +17 -0
  217. package/dist/ts-check-lane/progress-reporter.js +38 -0
  218. package/dist/ts-check-lane/progress.d.ts +32 -0
  219. package/dist/ts-check-lane/progress.js +57 -0
  220. package/dist/ts-check-lane/run-lane.d.ts +3 -1
  221. package/dist/ts-check-lane/run-lane.js +8 -6
  222. package/dist/validate-content/validate-links.d.ts +8 -0
  223. package/dist/validate-content/validate-links.js +9 -15
  224. package/dist/value/feedback-file.js +12 -2
  225. package/dist/vbrief-build/index.d.ts +1 -0
  226. package/dist/vbrief-build/index.js +1 -0
  227. package/dist/vbrief-build/project-invariants-io.d.ts +16 -0
  228. package/dist/vbrief-build/project-invariants-io.js +41 -0
  229. package/dist/vbrief-reconcile/graph.js +18 -1
  230. package/dist/vbrief-reconcile/index.d.ts +3 -1
  231. package/dist/vbrief-reconcile/index.js +2 -1
  232. package/dist/vbrief-reconcile/origin-freshness.d.ts +44 -0
  233. package/dist/vbrief-reconcile/origin-freshness.js +221 -0
  234. package/dist/vbrief-reconcile/types.d.ts +13 -0
  235. package/dist/vbrief-reconcile/umbrellas.d.ts +14 -0
  236. package/dist/vbrief-reconcile/umbrellas.js +261 -26
  237. package/dist/vbrief-validate/index.d.ts +1 -1
  238. package/dist/vbrief-validate/index.js +1 -1
  239. package/dist/vbrief-validate/plan-hooks.d.ts +4 -0
  240. package/dist/vbrief-validate/plan-hooks.js +68 -0
  241. package/dist/verify-ac/evaluate.d.ts +7 -1
  242. package/dist/verify-ac/evaluate.js +34 -26
  243. package/dist/verify-ac/flag.d.ts +4 -0
  244. package/dist/verify-ac/flag.js +16 -0
  245. package/dist/verify-ac/index.d.ts +2 -2
  246. package/dist/verify-ac/index.js +2 -2
  247. package/dist/verify-source/contained-writes.js +2 -0
  248. package/dist/verify-source/index.d.ts +1 -0
  249. package/dist/verify-source/index.js +1 -0
  250. package/dist/verify-source/verify-stubs.d.ts +15 -1
  251. package/dist/verify-source/verify-stubs.js +20 -16
  252. package/dist/vitest-runner/win32-coverage-tmp-setup.d.ts +5 -6
  253. package/dist/vitest-runner/win32-coverage-tmp-setup.js +5 -6
  254. package/dist/xbrief-migrate/migrate-project.js +2 -5
  255. package/package.json +3 -3
@@ -5,8 +5,8 @@ import { scan } from "../cache/scanner.js";
5
5
  import { assertWriteTargetSafe, ProjectionContainmentError } from "../fs/projection-containment.js";
6
6
  import { hasArtifactSuffix, resolveLifecycleRoot } from "../layout/resolve.js";
7
7
  import { captureAndAttachLiteralAcceptance } from "../literal-acceptance/index.js";
8
+ import { stampIntendedPlacement } from "../preflight/intended-placement.js";
8
9
  import { stampAcceptanceFromLiteralCapture } from "../product-first-done-gate/index.js";
9
- import { ENV_RUN_SUMMARY_PATH, RunSummaryEmitter } from "../run-summary/index.js";
10
10
  import { call } from "../scm/call.js";
11
11
  import { resolveProjectRoot } from "../scope/project-context.js";
12
12
  import { resolveProjectRepo } from "../slice/project-context.js";
@@ -15,6 +15,7 @@ import { slugify, TODAY } from "../vbrief-build/build.js";
15
15
  import { EMITTED_VBRIEF_VERSION } from "../vbrief-build/constants.js";
16
16
  import { stampDerivedClausesOnAcceptance } from "../verify-ac/clauses.js";
17
17
  import { LEGACY_ARTIFACT_SUFFIX, LEGACY_INFO_ROOT_KEY, MIGRATED_ARTIFACT_DIR, MIGRATED_ARTIFACT_SUFFIX, MIGRATED_INFO_ROOT_KEY, VBRIEF_VERSION, } from "../xbrief-migrate/constants.js";
18
+ import { applyClauseQualityForIngest, emitAcceptanceStampFromPlan } from "./clause-derivation.js";
18
19
  import { findAcHeading, parseCheckboxItems, parseListItems, sliceAcSection, stripCodeBlocks, stripFencedCodeBlocks, } from "./markdown-scanners.js";
19
20
  import { detectRepo, extractReferencesFromVbrief, fetchOpenIssues, GITHUB_ISSUE_REF_TYPES, LIFECYCLE_FOLDERS, parseIssueNumber, } from "./reconcile-issues.js";
20
21
  /** Reference type pointing at the canonical current-shape comment permalink (#1870). */
@@ -480,11 +481,13 @@ export function buildIssueVbrief(issue, status, repoUrl, options = {}) {
480
481
  // #3323: when no commands were stated, derive numbered clauses before product edit.
481
482
  const derived = stampDerivedClausesOnAcceptance(plan, [title, overviewSource].filter((s) => s.length > 0).join("\n\n"));
482
483
  Object.assign(plan, derived.plan);
484
+ applyClauseQualityForIngest(plan);
483
485
  }
484
486
  else {
485
487
  // No body: still record none_stated acceptance so absence is a decision.
486
488
  Object.assign(plan, stampAcceptanceFromLiteralCapture(plan));
487
489
  }
490
+ stampIntendedPlacement(plan);
488
491
  const infoRootKey = options.infoRootKey ?? LEGACY_INFO_ROOT_KEY;
489
492
  const infoVersion = options.infoVersion ?? EMITTED_VBRIEF_VERSION;
490
493
  const briefLabel = infoRootKey === MIGRATED_INFO_ROOT_KEY ? "xBRIEF" : "vBRIEF";
@@ -499,6 +502,24 @@ export function buildIssueVbrief(issue, status, repoUrl, options = {}) {
499
502
  folder,
500
503
  ];
501
504
  }
505
+ /** Include a refused-stamp remediation on the ingest result so it is not silent. */
506
+ export function formatIngestCreatedMessage(folder, filename, plan, dryRun = false) {
507
+ const lead = dryRun
508
+ ? `DRY-RUN would write ${folder}/${filename}`
509
+ : `CREATED ${folder}/${filename}`;
510
+ if (typeof plan !== "object" || plan === null || Array.isArray(plan)) {
511
+ return lead;
512
+ }
513
+ const acceptance = plan.acceptance;
514
+ if (typeof acceptance !== "object" || acceptance === null || Array.isArray(acceptance)) {
515
+ return lead;
516
+ }
517
+ const notice = acceptance.quality_notice;
518
+ if (typeof notice !== "string" || notice.trim().length === 0) {
519
+ return lead;
520
+ }
521
+ return `${lead}\n${notice.trim()}`;
522
+ }
502
523
  export function targetFilename(number, title, artifactSuffix = LEGACY_ARTIFACT_SUFFIX) {
503
524
  const slug = slugify(title) || `issue-${number}`;
504
525
  return `${TODAY}-${number}-${slug}${artifactSuffix}`;
@@ -707,7 +728,7 @@ export function ingestOne(issue, options) {
707
728
  const folderPath = join(options.vbriefDir, folder);
708
729
  const target = join(folderPath, filename);
709
730
  if (options.dryRun) {
710
- return ["dryrun", target, `DRY-RUN would write ${folder}/${filename}`];
731
+ return ["dryrun", target, formatIngestCreatedMessage(folder, filename, vbrief.plan, true)];
711
732
  }
712
733
  // Gate lifecycle folder + leaf before mkdir/write so folder/parent symlinks
713
734
  // cannot divert issue:ingest / triage:accept outside the project (#2869).
@@ -723,44 +744,8 @@ export function ingestOne(issue, options) {
723
744
  assertWriteTargetSafe(projectRoot, target);
724
745
  mkdirSync(folderPath, { recursive: true });
725
746
  writeFileSync(target, `${JSON.stringify(vbrief, null, 2)}\n`, "utf8");
726
- emitIntakeAcceptanceStamp(projectRoot, vbrief.plan);
727
- return ["created", target, `CREATED ${folder}/${filename}`];
728
- }
729
- function emitIntakeAcceptanceStamp(projectRoot, plan) {
730
- const rec = plan !== null && typeof plan === "object" && !Array.isArray(plan)
731
- ? plan
732
- : null;
733
- if (rec === null) {
734
- return;
735
- }
736
- const acceptance = rec.acceptance !== null && typeof rec.acceptance === "object" && !Array.isArray(rec.acceptance)
737
- ? rec.acceptance
738
- : null;
739
- if (acceptance === null) {
740
- return;
741
- }
742
- const env = process.env;
743
- const dest = env[ENV_RUN_SUMMARY_PATH];
744
- if (dest === undefined || dest.trim().length === 0) {
745
- return;
746
- }
747
- try {
748
- const sessionId = typeof env.DEFT_SESSION_ID === "string" && env.DEFT_SESSION_ID.trim().length > 0
749
- ? env.DEFT_SESSION_ID.trim()
750
- : "issue-ingest";
751
- const emitter = new RunSummaryEmitter({ projectRoot, sessionId, env });
752
- const commands = Array.isArray(acceptance.commands) ? acceptance.commands.length : 0;
753
- const clauses = Array.isArray(acceptance.clauses) ? acceptance.clauses.length : 0;
754
- emitter.emitAcceptanceStamp({
755
- rung: typeof acceptance.source_rung === "string" ? acceptance.source_rung : "project_floor",
756
- none_stated: acceptance.none_stated === true,
757
- command_count: commands,
758
- clause_count: clauses,
759
- });
760
- }
761
- catch {
762
- // fail-open
763
- }
747
+ emitAcceptanceStampFromPlan(projectRoot, vbrief.plan);
748
+ return ["created", target, formatIngestCreatedMessage(folder, filename, vbrief.plan)];
764
749
  }
765
750
  export function ingestBulk(issues, options) {
766
751
  let filtered = issues;
@@ -789,6 +774,7 @@ export function ingestBulk(issues, options) {
789
774
  duplicate: [],
790
775
  dryrun: [],
791
776
  failed: [],
777
+ notices: [],
792
778
  };
793
779
  for (const issue of filtered) {
794
780
  let ingested;
@@ -806,9 +792,12 @@ export function ingestBulk(issues, options) {
806
792
  }
807
793
  throw exc;
808
794
  }
809
- const [result, path, _msg] = ingested;
795
+ const [result, path, msg] = ingested;
810
796
  const rel = path !== null ? path.replace(`${options.vbriefDir}/`, "").replace(/\\/g, "/") : "";
811
797
  summary[result].push(rel);
798
+ if (msg.includes("\n")) {
799
+ summary.notices.push(msg);
800
+ }
812
801
  if (result === "created" && path !== null) {
813
802
  const num = Number(issue.number);
814
803
  const existing = refs.get(num) ?? [];
@@ -876,6 +865,9 @@ export function issueIngestMain(args) {
876
865
  for (const entry of created) {
877
866
  process.stdout.write(` CREATED ${entry}\n`);
878
867
  }
868
+ for (const notice of summary.notices ?? []) {
869
+ process.stdout.write(`${notice}\n`);
870
+ }
879
871
  for (const entry of dryrun) {
880
872
  process.stdout.write(` DRY-RUN ${entry}\n`);
881
873
  }
@@ -926,12 +918,13 @@ export function ingestSingleForAccept(n, repo, options = {}) {
926
918
  if (issue === null) {
927
919
  throw new Error(`failed to fetch GitHub issue #${n} from ${repo} (unified cache miss + live gh api fetch failed; see stderr)`);
928
920
  }
929
- const [result, path] = ingestOne(issue, {
921
+ // Forward ingestOne's notice-bearing third return so triage:accept can
922
+ // print a refused-stamp remediation instead of only the decision id (#3398).
923
+ return ingestOne(issue, {
930
924
  vbriefDir,
931
925
  status: options.status ?? "proposed",
932
926
  repoUrl,
933
927
  cwd: root,
934
928
  });
935
- return [result, path];
936
929
  }
937
930
  //# sourceMappingURL=issue-ingest.js.map
@@ -25,6 +25,11 @@ export interface EvaluateCompletedTrackedOptions {
25
25
  readonly repo?: string | null;
26
26
  /** Explicit delivery tip ref (e.g. origin/master). Overrides policy/git default. */
27
27
  readonly tip?: string | null;
28
+ /**
29
+ * When set, check only this issue number (#3476 drive-to DONE).
30
+ * Sibling unlanded closed issues do not fail the per-issue scan.
31
+ */
32
+ readonly issue?: number | null;
28
33
  readonly runGh?: RunGhFn;
29
34
  readonly skipGh?: boolean;
30
35
  readonly runGit?: GitRunner;
@@ -198,13 +198,16 @@ export function resolveDeliveryTip(projectRoot, tipOverride, runGit) {
198
198
  return { tip: candidate, error: null };
199
199
  }
200
200
  }
201
- // Last resort: HEAD of current checkout (still a real tip for fixtures).
202
- if (refExists(projectRoot, "HEAD", runGit)) {
203
- return { tip: "HEAD", error: null };
204
- }
201
+ // HEAD fallback (#3478 review). This gate exists to prove an artifact landed
202
+ // on the delivery tip rather than on feature-worktree HEAD; falling back to
203
+ // HEAD when the delivery ref is missing (shallow clone, unfetched worktree,
204
+ // fetch-depth:1 checkout) checks the very branch whose land is in question and
205
+ // silently passes. Unresolvable delivery tip must fail closed -- pass an
206
+ // explicit --tip (e.g. --tip HEAD for an in-flight land PR) to opt in.
205
207
  return {
206
208
  tip: null,
207
- error: `could not resolve delivery tip for branch '${branch}' (no origin/${branch}, ${branch}, or HEAD)`,
209
+ error: `could not resolve delivery tip for branch '${branch}' (no origin/${branch} or ${branch}); ` +
210
+ "fetch the delivery branch or pass an explicit --tip",
208
211
  };
209
212
  }
210
213
  function listTreePaths(projectRoot, tip, prefixes, runGit) {
@@ -270,6 +273,28 @@ function issuesFromBlobPaths(projectRoot, tip, paths, defaultRepo, runGit, origi
270
273
  }
271
274
  return hits;
272
275
  }
276
+ /**
277
+ * Narrow the origin map to the requested issue.
278
+ *
279
+ * Matching is repo-scoped when the caller's repo is known (#3478 review): a
280
+ * corpus entry for another repository's same-numbered issue must NOT survive
281
+ * this filter. Letting it through leaves `originMap` non-empty, which suppresses
282
+ * the synthesis below and makes the gate resolve the wrong `repo#number` --
283
+ * a foreign open issue then green-skips an unlanded local one.
284
+ */
285
+ function filterOriginsByIssue(originMap, issue, repo) {
286
+ const out = new Map();
287
+ for (const [key, entry] of originMap) {
288
+ if (entry.issue.number !== issue) {
289
+ continue;
290
+ }
291
+ if (repo !== null && entry.issue.repo !== repo) {
292
+ continue;
293
+ }
294
+ out.set(key, entry);
295
+ }
296
+ return out;
297
+ }
273
298
  function mergeOrigins(hits) {
274
299
  const map = new Map();
275
300
  for (const hit of hits) {
@@ -353,7 +378,47 @@ export function evaluateCompletedTracked(projectRoot, options = {}) {
353
378
  const localHits = scanLocalOrigins(root, defaultRepo);
354
379
  const tipNonterminalPaths = listTreePaths(root, tip, nonterminalPrefixes(), runGit);
355
380
  const tipNonterminalHits = issuesFromBlobPaths(root, tip, tipNonterminalPaths, defaultRepo, runGit, `tip:${tip}`);
356
- const originMap = mergeOrigins([...localHits, ...tipNonterminalHits]);
381
+ let originMap = mergeOrigins([...localHits, ...tipNonterminalHits]);
382
+ // Delivery tip only — the land invariant is post-merge tip truth (#3264 AC).
383
+ // Lifecycle PRs that commit completed/ on a feature branch are not expected
384
+ // to satisfy this gate until merge; run the verb with --tip HEAD when
385
+ // validating an in-flight land PR. The gate is a standalone verify verb
386
+ // (not wired into check:consumer) so product PRs are not deadlocked.
387
+ const tipTerminalPaths = listTreePaths(root, tip, terminalPrefixes(), runGit);
388
+ const tipTerminalHits = issuesFromBlobPaths(root, tip, tipTerminalPaths, defaultRepo, runGit, `tip:${tip}`);
389
+ const landedKeys = new Set(tipTerminalHits.map((h) => issueKey(h.issue)));
390
+ const issueFilter = options.issue ?? null;
391
+ if (issueFilter !== null) {
392
+ if (!Number.isInteger(issueFilter) || issueFilter <= 0) {
393
+ return {
394
+ code: 2,
395
+ message: `verify:completed-tracked: --issue must be a positive integer (got ${issueFilter})`,
396
+ stream: "stderr",
397
+ missing: [],
398
+ tip,
399
+ };
400
+ }
401
+ originMap = filterOriginsByIssue(originMap, issueFilter, defaultRepo);
402
+ // Drive-to DONE must not green-skip a named origin with no local brief
403
+ // (#3476). Synthesize the requested issue so closed+unlanded fails.
404
+ if (originMap.size === 0) {
405
+ if (defaultRepo === null) {
406
+ return {
407
+ code: 2,
408
+ message: `verify:completed-tracked: --issue ${issueFilter} requires --repo or a resolvable ` +
409
+ "origin remote when no scoped xBRIEF origin is present.",
410
+ stream: "stderr",
411
+ missing: [],
412
+ tip,
413
+ };
414
+ }
415
+ const synthetic = {
416
+ issue: { repo: defaultRepo, number: issueFilter },
417
+ origins: [`--issue ${issueFilter}`],
418
+ };
419
+ originMap.set(issueKey(synthetic.issue), synthetic);
420
+ }
421
+ }
357
422
  if (originMap.size === 0) {
358
423
  if (quiet) {
359
424
  return { code: 0, message: "", stream: "none", missing: [], tip };
@@ -366,14 +431,6 @@ export function evaluateCompletedTracked(projectRoot, options = {}) {
366
431
  tip,
367
432
  };
368
433
  }
369
- // Delivery tip only — the land invariant is post-merge tip truth (#3264 AC).
370
- // Lifecycle PRs that commit completed/ on a feature branch are not expected
371
- // to satisfy this gate until merge; run the verb with --tip HEAD when
372
- // validating an in-flight land PR. The gate is a standalone verify verb
373
- // (not wired into check:consumer) so product PRs are not deadlocked.
374
- const tipTerminalPaths = listTreePaths(root, tip, terminalPrefixes(), runGit);
375
- const tipTerminalHits = issuesFromBlobPaths(root, tip, tipTerminalPaths, defaultRepo, runGit, `tip:${tip}`);
376
- const landedKeys = new Set(tipTerminalHits.map((h) => issueKey(h.issue)));
377
434
  const missing = [];
378
435
  for (const [key, entry] of originMap) {
379
436
  if (landedKeys.has(key)) {
@@ -383,10 +440,20 @@ export function evaluateCompletedTracked(projectRoot, options = {}) {
383
440
  if (state === "open") {
384
441
  continue;
385
442
  }
386
- // Closed: always fail. Unknown with live expected (!skipGh): also fail —
387
- // cannot prove the issue is still open, so do not green-skip land debt
388
- // (#3264 Greptile residual on live lookup failure).
389
- if (state === "closed" || (state === null && !skipGh)) {
443
+ // Closed: always fail.
444
+ //
445
+ // Unknown: fail when live lookup was expected (!skipGh) -- cannot prove the
446
+ // issue is still open, so do not green-skip land debt (#3264 Greptile
447
+ // residual on live lookup failure).
448
+ //
449
+ // Unknown also fails for an explicitly named --issue even under --skip-gh
450
+ // (#3478 review): that is the drive-to DONE form, where the caller asserts
451
+ // this specific issue is done. An uncached issue must not exit 0 there --
452
+ // otherwise --skip-gh silently turns the DONE gate into a no-op. The
453
+ // unscoped corpus scan keeps the offline allowance, since a cold cache
454
+ // legitimately knows nothing about most scoped issues.
455
+ const unknownIsTerminal = !skipGh || issueFilter !== null;
456
+ if (state === "closed" || (state === null && unknownIsTerminal)) {
390
457
  missing.push(entry);
391
458
  }
392
459
  }
@@ -13,6 +13,8 @@ import type { LiteralAcceptanceCommand, RejectedLiteralCommand } from "./types.j
13
13
  export interface CaptureLiteralAcceptanceResult {
14
14
  readonly commands: readonly LiteralAcceptanceCommand[];
15
15
  readonly rejected: readonly RejectedLiteralCommand[];
16
+ /** Prompt lines skipped inside a transcript-shaped fence (#3511). */
17
+ readonly transcriptPromptSkipped: number;
16
18
  }
17
19
  /**
18
20
  * Capture literal acceptance commands from free-form task statement text.
@@ -47,6 +49,14 @@ export declare function captureAndAttachLiteralAcceptance(plan: Record<string, u
47
49
  readonly commands: readonly LiteralAcceptanceCommand[];
48
50
  readonly rejected: readonly RejectedLiteralCommand[];
49
51
  };
52
+ /** True when a rejected ledger entry was scraped from narrative prose (#3484). */
53
+ export declare function isProseDerivedRejection(rejected: RejectedLiteralCommand): boolean;
54
+ /**
55
+ * True when the author stated acceptance commands structurally — `swarm.verify_commands`
56
+ * or `plan.acceptance.commands` (#3484). Still used by intake/tests; demotion of
57
+ * prose-derived rejections no longer depends on this (#3511).
58
+ */
59
+ export declare function hasStructuredAcceptanceCommands(plan: Record<string, unknown> | null | undefined): boolean;
50
60
  /** Format rejected ledger for CLI / complete-gate messages. */
51
61
  export declare function formatRejectedLedger(rejected: readonly RejectedLiteralCommand[]): string;
52
62
  //# sourceMappingURL=capture.d.ts.map