@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
@@ -1,25 +1,31 @@
1
1
  import { FIELD_HOST_SKILL_DISCOVERY, FIELD_HOST_SKILL_DISCOVERY_CLI_ALIAS, inspectHostSkillDiscovery, } from "../init-deposit/skill-discovery-hosts.js";
2
2
  import { FIELD_OPENCLAW_PRODUCT_COMMANDS, FIELD_OPENCLAW_PRODUCT_COMMANDS_CLI_ALIAS, inspectOpenClawProductCommands, } from "../slash/openclaw-deposit.js";
3
3
  import { FIELD_AC_PASS_BANKING, FIELD_AC_PASS_BANKING_CLI_ALIAS, inspectAcPassBanking, } from "./ac-pass-banking.js";
4
+ import { FIELD_BASE_BRANCH, FIELD_BASE_BRANCH_CLI_ALIAS, inspectBaseBranch, } from "./base-branch.js";
4
5
  import { FIELD_CEREMONY_DIAL, FIELD_CEREMONY_DIAL_CLI_ALIAS, inspectCeremonyDial, } from "./ceremony-dial.js";
5
6
  import { FIELD_CHECK_RESUME, FIELD_CHECK_RESUME_CLI_ALIAS, inspectCheckResume, } from "./check-resume.js";
6
7
  import { FIELD_COVERAGE_DEBT, FIELD_COVERAGE_DEBT_CLI_ALIAS, inspectCoverageDebt, } from "./coverage-debt.js";
7
8
  import { FIELD_DELIVERY_BRANCH, FIELD_DELIVERY_BRANCH_CLI_ALIAS, inspectDeliveryBranch, } from "./delivery-branch.js";
9
+ import { FIELD_FORGE_OUTAGE_RETRY_MINUTES, FIELD_FORGE_OUTAGE_RETRY_MINUTES_CLI_ALIAS, inspectForgeOutageRetryMinutes, } from "./forge-outage-retry.js";
8
10
  import { FIELD_HOST_HOOKS, FIELD_HOST_HOOKS_CLI_ALIAS, inspectHostHooks } from "./host-hooks.js";
9
11
  import { FIELD_HOST_SLASH_COMMANDS, FIELD_HOST_SLASH_COMMANDS_CLI_ALIAS, inspectHostSlashCommands, } from "./host-slash-commands.js";
10
12
  import { FIELD_HOTFIX_CRITERIA, FIELD_HOTFIX_CRITERIA_CLI_ALIAS, inspectHotfixCriteria, } from "./hotfix-criteria.js";
11
13
  import { FIELD_MIN_GREPTILE_CONFIDENCE, FIELD_MIN_GREPTILE_CONFIDENCE_CLI_ALIAS, inspectMinGreptileConfidence, } from "./min-greptile-confidence.js";
12
14
  import { readPlanPolicy } from "./plan-extensions.js";
13
15
  import { FIELD_PRODUCT_SIGNAL, FIELD_PRODUCT_SIGNAL_CLI_ALIAS, inspectProductSignal, } from "./product-signal.js";
16
+ import { FIELD_PROJECT_INVARIANTS, FIELD_PROJECT_INVARIANTS_CLI_ALIAS, inspectProjectInvariants, } from "./project-invariants.js";
14
17
  import { FIELD_REQUIRE_HUMAN_MERGE, FIELD_REQUIRE_HUMAN_MERGE_CLI_ALIAS, inspectRequireHumanMerge, } from "./require-human-merge.js";
15
18
  import { coerceLegacyNarrative, LEGACY_NARRATIVE_KEY, loadProjectDefinition } from "./resolve.js";
16
19
  import { FIELD_RUNTIME_AUTHORITY, FIELD_RUNTIME_AUTHORITY_CLI_ALIAS, inspectRuntimeAuthority, } from "./runtime-authority.js";
17
20
  import { FIELD_STALENESS_TICKLER, FIELD_STALENESS_TICKLER_CLI_ALIAS, inspectStalenessTickler, } from "./staleness-tickler.js";
21
+ import { FIELD_SYNC_MAX_FILES, FIELD_SYNC_MAX_FILES_CLI_ALIAS, inspectSyncMaxFiles, } from "./sync-max-files.js";
18
22
  import { FIELD_VALUE_FEEDBACK, FIELD_VALUE_FEEDBACK_CLI_ALIAS, inspectValueFeedback, } from "./value-feedback.js";
19
23
  import { DEFAULT_WIP_CAP } from "./wip.js";
20
24
  export * from "./ac-pass-banking.js";
21
25
  export * from "./agents-md-advisory.js";
22
26
  export * from "./autonomy.js";
27
+ export * from "./base-branch.js";
28
+ export * from "./branch-sync.js";
23
29
  export * from "./capacity.js";
24
30
  export * from "./ceremony-dial.js";
25
31
  export * from "./ceremony-dial-escalation.js";
@@ -29,6 +35,8 @@ export * from "./decisions.js";
29
35
  export * from "./deft-directive-disable.js";
30
36
  export * from "./delivery-branch.js";
31
37
  export * from "./disclosure.js";
38
+ export * from "./file-size-thresholds.js";
39
+ export * from "./forge-outage-retry.js";
32
40
  export * from "./host-hooks.js";
33
41
  export * from "./host-slash-commands.js";
34
42
  export * from "./hotfix-criteria.js";
@@ -40,10 +48,13 @@ export * from "./org-force-on-migration.js";
40
48
  export * from "./plan-extensions.js";
41
49
  export * from "./policy-invocation.js";
42
50
  export * from "./product-signal.js";
51
+ export * from "./project-invariants.js";
43
52
  export * from "./require-human-merge.js";
44
53
  export * from "./resolve.js";
45
54
  export * from "./runtime-authority.js";
46
55
  export * from "./staleness-tickler.js";
56
+ export * from "./sync-default.js";
57
+ export * from "./sync-max-files.js";
47
58
  export * from "./value-feedback.js";
48
59
  export * from "./value-feedback-autoenable.js";
49
60
  export * from "./wip.js";
@@ -404,6 +415,15 @@ function inspectDeliveryBranchField(data, projectRoot) {
404
415
  source: field.source,
405
416
  };
406
417
  }
418
+ function inspectBaseBranchField(data, projectRoot) {
419
+ const field = inspectBaseBranch(data, projectRoot);
420
+ return {
421
+ name: field.name,
422
+ current: field.current,
423
+ default: field.default,
424
+ source: field.source,
425
+ };
426
+ }
407
427
  function inspectMinGreptileConfidenceField(data, projectRoot) {
408
428
  const field = inspectMinGreptileConfidence(data, projectRoot);
409
429
  return {
@@ -431,6 +451,33 @@ function inspectAcPassBankingField(data, projectRoot) {
431
451
  source: field.source,
432
452
  };
433
453
  }
454
+ function inspectSyncMaxFilesField(data, projectRoot) {
455
+ const field = inspectSyncMaxFiles(data, projectRoot);
456
+ return {
457
+ name: field.name,
458
+ current: field.current,
459
+ default: field.default,
460
+ source: field.source,
461
+ };
462
+ }
463
+ function inspectForgeOutageRetryMinutesField(data, projectRoot) {
464
+ const field = inspectForgeOutageRetryMinutes(data, projectRoot);
465
+ return {
466
+ name: field.name,
467
+ current: field.current,
468
+ default: field.default,
469
+ source: field.source,
470
+ };
471
+ }
472
+ function inspectProjectInvariantsField(data, projectRoot) {
473
+ const field = inspectProjectInvariants(data, projectRoot);
474
+ return {
475
+ name: field.name,
476
+ current: field.current,
477
+ default: field.default,
478
+ source: field.source,
479
+ };
480
+ }
434
481
  const REGISTERED_POLICIES = [
435
482
  inspectAllowDirectCommits,
436
483
  inspectWipCap,
@@ -445,6 +492,7 @@ const REGISTERED_POLICIES = [
445
492
  inspectTriageLabelMirrorField,
446
493
  inspectSwarmSubagentBackend,
447
494
  inspectDeliveryBranchField,
495
+ inspectBaseBranchField,
448
496
  inspectMinGreptileConfidenceField,
449
497
  inspectHostHooksField,
450
498
  inspectHostSlashCommandsField,
@@ -460,6 +508,9 @@ const REGISTERED_POLICIES = [
460
508
  inspectHotfixCriteriaField,
461
509
  inspectCeremonyDialField,
462
510
  inspectAcPassBankingField,
511
+ inspectSyncMaxFilesField,
512
+ inspectForgeOutageRetryMinutesField,
513
+ inspectProjectInvariantsField,
463
514
  ];
464
515
  /** Walk registered inspectors and return one row per field (#1148). */
465
516
  export function inspectAllPolicies(projectRoot) {
@@ -494,13 +545,21 @@ export function inspectOnePolicy(name, projectRoot) {
494
545
  ? FIELD_HOTFIX_CRITERIA
495
546
  : name === FIELD_DELIVERY_BRANCH_CLI_ALIAS
496
547
  ? FIELD_DELIVERY_BRANCH
497
- : name === FIELD_MIN_GREPTILE_CONFIDENCE_CLI_ALIAS
498
- ? FIELD_MIN_GREPTILE_CONFIDENCE
499
- : name === FIELD_CEREMONY_DIAL_CLI_ALIAS
500
- ? FIELD_CEREMONY_DIAL
501
- : name === FIELD_AC_PASS_BANKING_CLI_ALIAS
502
- ? FIELD_AC_PASS_BANKING
503
- : name;
548
+ : name === FIELD_BASE_BRANCH_CLI_ALIAS
549
+ ? FIELD_BASE_BRANCH
550
+ : name === FIELD_MIN_GREPTILE_CONFIDENCE_CLI_ALIAS
551
+ ? FIELD_MIN_GREPTILE_CONFIDENCE
552
+ : name === FIELD_CEREMONY_DIAL_CLI_ALIAS
553
+ ? FIELD_CEREMONY_DIAL
554
+ : name === FIELD_AC_PASS_BANKING_CLI_ALIAS
555
+ ? FIELD_AC_PASS_BANKING
556
+ : name === FIELD_SYNC_MAX_FILES_CLI_ALIAS
557
+ ? FIELD_SYNC_MAX_FILES
558
+ : name === FIELD_FORGE_OUTAGE_RETRY_MINUTES_CLI_ALIAS
559
+ ? FIELD_FORGE_OUTAGE_RETRY_MINUTES
560
+ : name === FIELD_PROJECT_INVARIANTS_CLI_ALIAS
561
+ ? FIELD_PROJECT_INVARIANTS
562
+ : name;
504
563
  for (const field of inspectAllPolicies(projectRoot)) {
505
564
  if (field.name === normalized)
506
565
  return field;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Typed plan.policy.projectInvariants (#3425 Story A).
3
+ *
4
+ * Authored project-level must-not-break contracts. Empty or absent list is a
5
+ * no-op. Parse/validate only — preflight fail-closed is Story B.
6
+ */
7
+ export declare const FIELD_PROJECT_INVARIANTS = "plan.policy.projectInvariants";
8
+ export declare const FIELD_PROJECT_INVARIANTS_CLI_ALIAS = "projectInvariants";
9
+ export interface ProjectInvariantContractSurface {
10
+ readonly paths: readonly string[];
11
+ readonly moduleIds: readonly string[];
12
+ }
13
+ export interface ProjectInvariant {
14
+ readonly id: string;
15
+ readonly statement: string;
16
+ readonly contractSurface: ProjectInvariantContractSurface;
17
+ }
18
+ export type ProjectInvariantsSource = "typed" | "default" | "default-on-error";
19
+ export interface ProjectInvariantsParseResult {
20
+ readonly invariants: readonly ProjectInvariant[];
21
+ readonly errors: readonly string[];
22
+ }
23
+ export interface ProjectInvariantsResolved {
24
+ readonly invariants: readonly ProjectInvariant[];
25
+ readonly source: ProjectInvariantsSource;
26
+ readonly error: string | null;
27
+ }
28
+ export interface ProjectInvariantsPolicyField {
29
+ readonly name: typeof FIELD_PROJECT_INVARIANTS;
30
+ readonly current: readonly ProjectInvariant[];
31
+ readonly default: readonly ProjectInvariant[];
32
+ readonly source: string;
33
+ }
34
+ /** Parse a raw projectInvariants value. Absent/null → empty list, no errors. */
35
+ export declare function parseProjectInvariants(raw: unknown): ProjectInvariantsParseResult;
36
+ /**
37
+ * Map codeStructure.modules[] id → pathGlobs for applicability intersection.
38
+ * Pure: pass PROJECT-DEFINITION (or plan) data, no disk IO.
39
+ */
40
+ export declare function extractModulePathGlobs(projectDefinition: unknown): Record<string, string[]>;
41
+ /**
42
+ * Resolve projectInvariants from PROJECT-DEFINITION data already in memory.
43
+ * Absent/null → default empty. Present invalid → default-on-error + message.
44
+ */
45
+ export declare function resolveProjectInvariantsFromData(data: Record<string, unknown> | null): ProjectInvariantsResolved;
46
+ /** Resolve from a project root via the PROJECT-DEFINITION IO path. */
47
+ export declare function resolveProjectInvariants(projectRoot: string): ProjectInvariantsResolved;
48
+ /** Inspector row for `task policy:show --field=projectInvariants`. */
49
+ export declare function inspectProjectInvariants(data: Record<string, unknown> | null, projectRoot?: string): ProjectInvariantsPolicyField;
50
+ //# sourceMappingURL=project-invariants.d.ts.map
@@ -0,0 +1,205 @@
1
+ /**
2
+ * Typed plan.policy.projectInvariants (#3425 Story A).
3
+ *
4
+ * Authored project-level must-not-break contracts. Empty or absent list is a
5
+ * no-op. Parse/validate only — preflight fail-closed is Story B.
6
+ */
7
+ import { readPlanPolicy } from "./plan-extensions.js";
8
+ import { loadProjectDefinition } from "./resolve.js";
9
+ export const FIELD_PROJECT_INVARIANTS = "plan.policy.projectInvariants";
10
+ export const FIELD_PROJECT_INVARIANTS_CLI_ALIAS = "projectInvariants";
11
+ const EMPTY = [];
12
+ function asRecord(value) {
13
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
14
+ return value;
15
+ }
16
+ return null;
17
+ }
18
+ function isNonEmptyString(value) {
19
+ return typeof value === "string" && value.trim().length > 0;
20
+ }
21
+ function asStrList(value) {
22
+ if (value === null || value === undefined)
23
+ return [];
24
+ if (typeof value === "string")
25
+ return value.trim().length > 0 ? [value.trim()] : [];
26
+ if (Array.isArray(value)) {
27
+ return value.map((item) => String(item).trim()).filter((s) => s.length > 0);
28
+ }
29
+ return [];
30
+ }
31
+ function pythonTypeName(value) {
32
+ if (value === null)
33
+ return "None";
34
+ if (Array.isArray(value))
35
+ return "list";
36
+ if (typeof value === "boolean")
37
+ return "bool";
38
+ if (typeof value === "number")
39
+ return Number.isInteger(value) ? "int" : "float";
40
+ if (typeof value === "string")
41
+ return "str";
42
+ if (typeof value === "object")
43
+ return "dict";
44
+ return typeof value;
45
+ }
46
+ function parseContractSurface(body, loc) {
47
+ const nested = asRecord(body.contractSurface) ?? asRecord(body.contract_surface) ?? asRecord(body.contract);
48
+ const pathSource = nested ?? body;
49
+ const moduleSource = nested ?? body;
50
+ const pathsRaw = pathSource.paths ?? pathSource.pathGlobs ?? pathSource.path_globs ?? body.paths;
51
+ const moduleRaw = moduleSource.moduleIds ??
52
+ moduleSource.module_ids ??
53
+ moduleSource.modules ??
54
+ body.moduleIds ??
55
+ body.module_ids;
56
+ // Shorthand: contractSurface / contract_surface as a string list of paths.
57
+ const shorthand = body.contractSurface ?? body.contract_surface ?? body.contract;
58
+ const paths = [...asStrList(pathsRaw), ...(nested === null ? asStrList(shorthand) : [])];
59
+ const moduleIds = asStrList(moduleRaw);
60
+ if (paths.length === 0 && moduleIds.length === 0) {
61
+ return {
62
+ surface: null,
63
+ errors: [
64
+ `${loc}: contract surface requires paths[] and/or moduleIds[] ` +
65
+ `(must-not-break module/contract)`,
66
+ ],
67
+ };
68
+ }
69
+ return {
70
+ surface: { paths, moduleIds },
71
+ errors: [],
72
+ };
73
+ }
74
+ /** Parse a raw projectInvariants value. Absent/null → empty list, no errors. */
75
+ export function parseProjectInvariants(raw) {
76
+ if (raw === null || raw === undefined) {
77
+ return { invariants: EMPTY, errors: [] };
78
+ }
79
+ if (!Array.isArray(raw)) {
80
+ return {
81
+ invariants: EMPTY,
82
+ errors: [`${FIELD_PROJECT_INVARIANTS} must be an array; got ${pythonTypeName(raw)}`],
83
+ };
84
+ }
85
+ const invariants = [];
86
+ const errors = [];
87
+ const seen = new Set();
88
+ for (let i = 0; i < raw.length; i += 1) {
89
+ const loc = `${FIELD_PROJECT_INVARIANTS}[${i}]`;
90
+ const item = raw[i];
91
+ const rec = asRecord(item);
92
+ if (rec === null) {
93
+ errors.push(`${loc}: entry must be an object`);
94
+ continue;
95
+ }
96
+ const id = rec.id;
97
+ const statement = rec.statement ?? rec.Statement;
98
+ if (!isNonEmptyString(id)) {
99
+ errors.push(`${loc}: id is required`);
100
+ continue;
101
+ }
102
+ const trimmedId = id.trim();
103
+ if (seen.has(trimmedId)) {
104
+ errors.push(`${loc}: duplicate id '${trimmedId}'`);
105
+ continue;
106
+ }
107
+ if (!isNonEmptyString(statement)) {
108
+ errors.push(`${loc}: statement is required`);
109
+ continue;
110
+ }
111
+ const { surface, errors: surfaceErrors } = parseContractSurface(rec, loc);
112
+ errors.push(...surfaceErrors);
113
+ if (surface === null)
114
+ continue;
115
+ seen.add(trimmedId);
116
+ invariants.push({
117
+ id: trimmedId,
118
+ statement: String(statement).trim(),
119
+ contractSurface: surface,
120
+ });
121
+ }
122
+ return { invariants, errors };
123
+ }
124
+ /**
125
+ * Map codeStructure.modules[] id → pathGlobs for applicability intersection.
126
+ * Pure: pass PROJECT-DEFINITION (or plan) data, no disk IO.
127
+ */
128
+ export function extractModulePathGlobs(projectDefinition) {
129
+ const root = asRecord(projectDefinition);
130
+ if (root === null)
131
+ return {};
132
+ const plan = asRecord(root.plan) ?? root;
133
+ const architecture = asRecord(plan.architecture);
134
+ if (architecture === null)
135
+ return {};
136
+ const codeStructure = asRecord(architecture.codeStructure ?? architecture.code_structure);
137
+ if (codeStructure === null)
138
+ return {};
139
+ const modules = codeStructure.modules;
140
+ if (!Array.isArray(modules))
141
+ return {};
142
+ const out = {};
143
+ for (const item of modules) {
144
+ const rec = asRecord(item);
145
+ if (rec === null || !isNonEmptyString(rec.id))
146
+ continue;
147
+ const globs = asStrList(rec.pathGlobs ?? rec.path_globs ?? rec.paths);
148
+ if (globs.length === 0)
149
+ continue;
150
+ out[rec.id.trim()] = globs;
151
+ }
152
+ return out;
153
+ }
154
+ function readPolicyBlock(data) {
155
+ if (data === null)
156
+ return null;
157
+ const policy = readPlanPolicy(data.plan);
158
+ return asRecord(policy);
159
+ }
160
+ /**
161
+ * Resolve projectInvariants from PROJECT-DEFINITION data already in memory.
162
+ * Absent/null → default empty. Present invalid → default-on-error + message.
163
+ */
164
+ export function resolveProjectInvariantsFromData(data) {
165
+ const policy = readPolicyBlock(data);
166
+ if (policy === null || !("projectInvariants" in policy)) {
167
+ return { invariants: EMPTY, source: "default", error: null };
168
+ }
169
+ const raw = policy.projectInvariants;
170
+ if (raw === null) {
171
+ return { invariants: EMPTY, source: "default", error: null };
172
+ }
173
+ const parsed = parseProjectInvariants(raw);
174
+ if (parsed.errors.length > 0) {
175
+ return {
176
+ invariants: EMPTY,
177
+ source: "default-on-error",
178
+ error: parsed.errors.join("; "),
179
+ };
180
+ }
181
+ return { invariants: parsed.invariants, source: "typed", error: null };
182
+ }
183
+ /** Resolve from a project root via the PROJECT-DEFINITION IO path. */
184
+ export function resolveProjectInvariants(projectRoot) {
185
+ const [data, err] = loadProjectDefinition(projectRoot);
186
+ if (data === null) {
187
+ return { invariants: EMPTY, source: "default", error: err };
188
+ }
189
+ return resolveProjectInvariantsFromData(data);
190
+ }
191
+ /** Inspector row for `task policy:show --field=projectInvariants`. */
192
+ export function inspectProjectInvariants(data, projectRoot) {
193
+ const resolved = data !== null
194
+ ? resolveProjectInvariantsFromData(data)
195
+ : projectRoot !== undefined && projectRoot.length > 0
196
+ ? resolveProjectInvariants(projectRoot)
197
+ : { invariants: EMPTY, source: "default", error: null };
198
+ return {
199
+ name: FIELD_PROJECT_INVARIANTS,
200
+ current: resolved.invariants,
201
+ default: EMPTY,
202
+ source: resolved.source,
203
+ };
204
+ }
205
+ //# sourceMappingURL=project-invariants.js.map
@@ -0,0 +1,129 @@
1
+ /**
2
+ * scm:sync-default (#3391 / #3377 Wave 3).
3
+ *
4
+ * Consumes the shared #3388 detector and #3390 syncMaxFiles. Opens dest-targeted
5
+ * sync PRs. Over the file limit, cut at merge commits when possible so each
6
+ * dest-based leg is at or under the threshold. Each leg is a new branch and a
7
+ * new PR. Never retarget or reuse an oversized PR.
8
+ */
9
+ import { type GitRunner } from "../session/git.js";
10
+ import { type BranchSyncDetection } from "./branch-sync.js";
11
+ import { type SyncMaxFilesProvenance } from "./sync-max-files.js";
12
+ export declare const SYNC_DEFAULT_VERB = "scm:sync-default";
13
+ export declare const FORBIDDEN_SYNC_PR_RETARGET = "gh pr edit --base";
14
+ export type SyncDefaultAction = "noop" | "single" | "staged";
15
+ export type SyncDefaultNoopReason = "not-sync" | "already-synced" | "zero-files" | "fetch-failed" | "diff-failed";
16
+ export type SyncDefaultCutKind = "merge" | "commit" | "tip";
17
+ export interface SyncDefaultCommit {
18
+ readonly sha: string;
19
+ readonly isMerge: boolean;
20
+ }
21
+ export interface SyncDefaultLeg {
22
+ readonly index: number;
23
+ readonly sha: string;
24
+ readonly fileCount: number;
25
+ readonly cutKind: SyncDefaultCutKind;
26
+ readonly branchName: string;
27
+ }
28
+ export interface SyncDefaultPlan {
29
+ readonly action: SyncDefaultAction;
30
+ readonly noopReason: SyncDefaultNoopReason | null;
31
+ readonly dest: string;
32
+ readonly source: string;
33
+ readonly threshold: number;
34
+ readonly provenance: SyncMaxFilesProvenance;
35
+ readonly totalCount: number | null;
36
+ readonly legs: readonly SyncDefaultLeg[];
37
+ readonly nextLegIndex: number | null;
38
+ readonly message: string;
39
+ readonly detectorReason: BranchSyncDetection["reason"];
40
+ }
41
+ export interface SyncDefaultOpenPull {
42
+ readonly number: number;
43
+ readonly htmlUrl: string;
44
+ readonly headRef: string;
45
+ readonly headSha: string;
46
+ readonly baseRef: string;
47
+ }
48
+ export interface SyncDefaultForge {
49
+ listOpenPulls(repo: string, base: string): readonly SyncDefaultOpenPull[];
50
+ createPull(repo: string, input: {
51
+ readonly title: string;
52
+ readonly head: string;
53
+ readonly base: string;
54
+ readonly body: string;
55
+ }): {
56
+ readonly number: number;
57
+ readonly htmlUrl: string;
58
+ };
59
+ }
60
+ export interface SyncDefaultOpened {
61
+ readonly leg: SyncDefaultLeg;
62
+ readonly prNumber: number;
63
+ readonly prUrl: string;
64
+ readonly branch: string;
65
+ readonly reusedExisting: boolean;
66
+ }
67
+ export interface SyncDefaultApplyResult {
68
+ readonly plan: SyncDefaultPlan;
69
+ readonly opened: readonly SyncDefaultOpened[];
70
+ readonly retargeted: false;
71
+ }
72
+ export declare function syncDefaultBranchName(dest: string, source: string, index: number, sha: string): string;
73
+ export declare function parseGithubOwnerRepo(remoteUrl: string): string | null;
74
+ export declare function countChangedFilesOnRange(options: {
75
+ readonly projectRoot: string;
76
+ readonly left: string;
77
+ readonly right: string;
78
+ readonly runGit?: GitRunner;
79
+ }): {
80
+ readonly count: number | null;
81
+ readonly error: string | null;
82
+ };
83
+ export declare function listCommitsAfter(options: {
84
+ readonly projectRoot: string;
85
+ readonly dest: string;
86
+ readonly source: string;
87
+ readonly runGit?: GitRunner;
88
+ }): {
89
+ readonly commits: readonly SyncDefaultCommit[];
90
+ readonly error: string | null;
91
+ };
92
+ /**
93
+ * Cut dest..source into dest-targeted legs whose dest-based file count is at
94
+ * or under the threshold when a merge (or other) cut exists.
95
+ */
96
+ export declare function cutSyncLegs(options: {
97
+ readonly dest: string;
98
+ readonly source: string;
99
+ readonly destRef: string;
100
+ readonly sourceSha: string;
101
+ readonly commits: readonly SyncDefaultCommit[];
102
+ readonly threshold: number;
103
+ readonly countFiles: (left: string, right: string) => number | null;
104
+ /** When set, later cuts must be descendants of the previous cut. */
105
+ readonly isAncestor?: (ancestor: string, descendant: string) => boolean;
106
+ }): {
107
+ readonly legs: readonly SyncDefaultLeg[];
108
+ readonly error: string | null;
109
+ };
110
+ export declare function planSyncDefault(options: {
111
+ readonly projectRoot: string;
112
+ readonly maxFiles?: number | null;
113
+ readonly destTipSha?: string;
114
+ readonly runGit?: GitRunner;
115
+ }): SyncDefaultPlan;
116
+ export declare function nextOpenableLeg(legs: readonly SyncDefaultLeg[], destTipSha: string, projectRoot: string, runGit: GitRunner): SyncDefaultLeg | null;
117
+ export declare function applySyncDefault(options: {
118
+ readonly projectRoot: string;
119
+ readonly repo: string;
120
+ readonly plan?: SyncDefaultPlan;
121
+ readonly maxFiles?: number | null;
122
+ readonly destTipSha?: string;
123
+ readonly dryRun?: boolean;
124
+ readonly runGit?: GitRunner;
125
+ readonly forge?: SyncDefaultForge;
126
+ }): SyncDefaultApplyResult;
127
+ export declare function syncDefaultPrBody(plan: SyncDefaultPlan, leg: SyncDefaultLeg): string;
128
+ export declare function formatSyncDefaultHuman(result: SyncDefaultApplyResult): string;
129
+ //# sourceMappingURL=sync-default.d.ts.map