@defrex/autobuild 1.0.0-beta.1 → 1.0.0-beta.3

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 (172) hide show
  1. package/SPEC.md +310 -56
  2. package/bin/ab-build-runner.ts +10 -8
  3. package/docs/architecture.md +177 -23
  4. package/docs/configuration.md +35 -4
  5. package/docs/hosted-service.md +35 -0
  6. package/docs/integration-tree.md +83 -4
  7. package/docs/landing-policy.md +11 -0
  8. package/docs/migration-1.0.md +9 -0
  9. package/docs/operator-api.md +18 -0
  10. package/docs/remote-store-protocol.md +16 -0
  11. package/docs/remote-ticket-protocol.md +5 -0
  12. package/docs/restacking.md +42 -7
  13. package/docs/setup.md +25 -0
  14. package/docs/spec-standard.md +71 -0
  15. package/docs/ticket-dependencies.md +6 -45
  16. package/docs/ticket-migration.md +50 -4
  17. package/package.json +3 -3
  18. package/packages/core/src/cli/attention.ts +4 -1
  19. package/packages/core/src/cli/binary.ts +17 -1
  20. package/packages/core/src/cli/build-control.ts +3 -3
  21. package/packages/core/src/cli/context.ts +53 -1
  22. package/packages/core/src/cli/dashboard/actions.ts +4 -0
  23. package/packages/core/src/cli/dashboard/detail.ts +45 -1
  24. package/packages/core/src/cli/dashboard/facts.ts +7 -2
  25. package/packages/core/src/cli/dashboard/integration-detail.ts +144 -0
  26. package/packages/core/src/cli/dashboard/integration-row.ts +255 -0
  27. package/packages/core/src/cli/dashboard/landing-display.ts +64 -0
  28. package/packages/core/src/cli/dashboard/model.ts +147 -16
  29. package/packages/core/src/cli/dashboard/poll.ts +40 -4
  30. package/packages/core/src/cli/dashboard/render.ts +106 -5
  31. package/packages/core/src/cli/dashboard/transcript.ts +2 -1
  32. package/packages/core/src/cli/dispatch-frontend.ts +11 -0
  33. package/packages/core/src/cli/dispatch-repository-feed.ts +2 -1
  34. package/packages/core/src/cli/dispatch.ts +49 -14
  35. package/packages/core/src/cli/help.ts +17 -1
  36. package/packages/core/src/cli/main.ts +48 -8
  37. package/packages/core/src/cli/publication-settlement.ts +49 -5
  38. package/packages/core/src/cli/repository-status.ts +103 -2
  39. package/packages/core/src/cli/status.ts +24 -1
  40. package/packages/core/src/cli/terminals.ts +94 -93
  41. package/packages/core/src/cli/ticket.ts +35 -11
  42. package/packages/core/src/cli/wait.ts +11 -2
  43. package/packages/core/src/cli/watch.ts +12 -0
  44. package/packages/core/src/config/schema.ts +3 -0
  45. package/packages/core/src/events/catalog.ts +38 -0
  46. package/packages/core/src/events/compatibility.ts +183 -0
  47. package/packages/core/src/events/native-session.ts +13 -0
  48. package/packages/core/src/events/payloads.ts +150 -2
  49. package/packages/core/src/events/policy.ts +210 -0
  50. package/packages/core/src/events/repository.ts +69 -0
  51. package/packages/core/src/integration/harness.ts +4 -4
  52. package/packages/core/src/kernel/__snapshots__/{reducer-registry.test.ts.snap → reducer-accumulator-shapes.json} +4286 -4006
  53. package/packages/core/src/kernel/change-presence.ts +11 -3
  54. package/packages/core/src/kernel/dispatch-capacity.ts +127 -0
  55. package/packages/core/src/kernel/dispatcher-liveness.ts +5 -1
  56. package/packages/core/src/kernel/engine.ts +25 -5
  57. package/packages/core/src/kernel/forge-health.ts +19 -0
  58. package/packages/core/src/kernel/generators/build-log.ts +18 -0
  59. package/packages/core/src/kernel/generators/node-restack-log.ts +1 -1
  60. package/packages/core/src/kernel/generators/repository-journals.ts +10 -0
  61. package/packages/core/src/kernel/guarded-forge.ts +159 -0
  62. package/packages/core/src/kernel/incremental.ts +4 -2
  63. package/packages/core/src/kernel/integration-completeness.ts +108 -9
  64. package/packages/core/src/kernel/integration-landing.ts +5 -4
  65. package/packages/core/src/kernel/janitor-failure.ts +36 -0
  66. package/packages/core/src/kernel/landing-publication.ts +35 -15
  67. package/packages/core/src/kernel/landing-state.ts +7 -0
  68. package/packages/core/src/kernel/leaf-restack-state.ts +1 -1
  69. package/packages/core/src/kernel/log-index.ts +12 -1
  70. package/packages/core/src/kernel/mixed-version.ts +52 -0
  71. package/packages/core/src/kernel/node-landing.ts +14 -11
  72. package/packages/core/src/kernel/node-parent.ts +35 -10
  73. package/packages/core/src/kernel/node-restack-demand.ts +29 -0
  74. package/packages/core/src/kernel/node-restack-state.ts +46 -16
  75. package/packages/core/src/kernel/node-restack-transaction.ts +151 -8
  76. package/packages/core/src/kernel/node-restack.ts +34 -10
  77. package/packages/core/src/kernel/publication.ts +22 -0
  78. package/packages/core/src/kernel/read-deferrals.ts +111 -0
  79. package/packages/core/src/kernel/read-facts.ts +34 -6
  80. package/packages/core/src/kernel/reconcile-restack.ts +23 -2
  81. package/packages/core/src/kernel/reducer-registry.ts +18 -2
  82. package/packages/core/src/kernel/reducer.ts +196 -10
  83. package/packages/core/src/kernel/repository-attention.ts +38 -1
  84. package/packages/core/src/kernel/terminal-guard.ts +11 -4
  85. package/packages/core/src/kernel/ticket-migrations.ts +139 -0
  86. package/packages/core/src/operator/annotations.ts +6 -0
  87. package/packages/core/src/operator/index.ts +2 -0
  88. package/packages/core/src/operator/presentation.ts +5 -0
  89. package/packages/core/src/operator/query.ts +51 -11
  90. package/packages/core/src/operator/registry.ts +17 -1
  91. package/packages/core/src/operator/restack.ts +51 -0
  92. package/packages/core/src/operator/tickets.ts +30 -26
  93. package/packages/core/src/plugin-sdk/index.ts +10 -0
  94. package/packages/core/src/plugins/manifest.ts +1 -1
  95. package/packages/core/src/ports/forge/contract.ts +23 -0
  96. package/packages/core/src/ports/forge/fake.ts +6 -2
  97. package/packages/core/src/ports/forge/git-rewrite.ts +92 -64
  98. package/packages/core/src/ports/forge/github-transport.ts +45 -2
  99. package/packages/core/src/ports/forge/github.ts +56 -17
  100. package/packages/core/src/ports/forge/local-git.ts +7 -2
  101. package/packages/core/src/ports/forge-failure.ts +40 -0
  102. package/packages/core/src/ports/forge-request-context.ts +35 -0
  103. package/packages/core/src/ports/forge-telemetry.ts +16 -0
  104. package/packages/core/src/ports/runner/claude.ts +136 -9
  105. package/packages/core/src/ports/runner/codex.ts +112 -7
  106. package/packages/core/src/ports/runner/contract.ts +78 -0
  107. package/packages/core/src/ports/runner/fake.ts +59 -1
  108. package/packages/core/src/ports/runner/native-cli-fixture.ts +86 -0
  109. package/packages/core/src/ports/runner/native-process-fixture.ts +38 -0
  110. package/packages/core/src/ports/runner/native-session.ts +110 -0
  111. package/packages/core/src/ports/runner/pi-rpc.ts +7 -1
  112. package/packages/core/src/ports/runner/pi.ts +162 -2
  113. package/packages/core/src/ports/tickets/linear.ts +180 -12
  114. package/packages/core/src/ports/tickets/migration.ts +92 -9
  115. package/packages/core/src/ports/types.ts +60 -5
  116. package/packages/core/src/ports/workspace/git-worktree.ts +45 -51
  117. package/packages/core/src/ports/workspace/vercel-sandbox.ts +28 -12
  118. package/packages/core/src/processes/build-child-exit.ts +50 -2
  119. package/packages/core/src/processes/build-child.ts +15 -7
  120. package/packages/core/src/processes/build-runner.ts +909 -213
  121. package/packages/core/src/processes/dispatcher.ts +815 -369
  122. package/packages/core/src/processes/execution-no-progress.ts +15 -0
  123. package/packages/core/src/processes/pause-execution-fixture.ts +37 -0
  124. package/packages/core/src/processes/phase-failure-budget.ts +2 -1
  125. package/packages/core/src/processes/publication-loss.ts +7 -3
  126. package/packages/core/src/processes/repo-view.ts +53 -6
  127. package/packages/core/src/processes/tick-publication.ts +6 -2
  128. package/packages/core/src/runtime-identity.ts +37 -0
  129. package/packages/core/src/store/adapter.ts +4 -2
  130. package/packages/core/src/store/build-scope.ts +9 -0
  131. package/packages/core/src/store/contract.ts +233 -16
  132. package/packages/core/src/store/digest.ts +20 -2
  133. package/packages/core/src/store/local/schema.ts +6 -0
  134. package/packages/core/src/store/local/store.ts +57 -4
  135. package/packages/core/src/store/memory.ts +83 -2
  136. package/packages/core/src/store/new-build.ts +2 -2
  137. package/packages/core/src/store/phase-session.ts +13 -0
  138. package/packages/core/src/store/reduced-reads.ts +43 -4
  139. package/packages/core/src/store/reducer-value-shapes.json +8911 -6344
  140. package/packages/core/src/store/reducer-value-validation.ts +103 -3
  141. package/packages/core/src/store/reducer-values.ts +21 -6
  142. package/packages/core/src/store/remote/client.ts +145 -20
  143. package/packages/core/src/store/remote/index.ts +2 -0
  144. package/packages/core/src/store/remote/protocol.ts +19 -0
  145. package/packages/core/src/store/remote/version.ts +2 -0
  146. package/packages/core/src/store/repo-state-events.ts +5 -2
  147. package/packages/core/src/store/repo-tick.ts +6 -1
  148. package/packages/core/src/store/session-handle.ts +8 -0
  149. package/packages/core/src/store/snapshots.ts +21 -5
  150. package/packages/core/src/store/types.ts +17 -1
  151. package/packages/core/src/testing/dispatch-read-budget.ts +18 -2
  152. package/packages/core/src/testing/index.ts +7 -0
  153. package/packages/core/src/testing/newer-writer.ts +37 -0
  154. package/packages/core/src/testing/reduced-read-budget.ts +3 -0
  155. package/skills/guide/SKILL.md +140 -25
  156. package/skills/guide/references/integration-tree.md +83 -4
  157. package/skills/guide/references/landing-policy.md +11 -0
  158. package/skills/guide/references/migration-1.0.md +9 -0
  159. package/skills/guide/references/operator-api.md +18 -0
  160. package/skills/guide/references/plugin-authoring.md +47 -4
  161. package/skills/guide/references/remote-store-protocol.md +16 -0
  162. package/skills/guide/references/remote-ticket-protocol.md +5 -0
  163. package/skills/guide/references/restacking.md +42 -7
  164. package/skills/guide/references/setup.md +25 -0
  165. package/skills/guide/references/spec-standard.md +71 -0
  166. package/skills/guide/references/ticket-dependencies.md +6 -45
  167. package/skills/guide/references/ticket-migration.md +50 -4
  168. package/skills/implement/SKILL.md +4 -2
  169. package/skills/operate/SKILL.md +63 -6
  170. package/skills/reconcile/SKILL.md +3 -1
  171. package/skills/spec/SKILL.md +62 -40
  172. package/skills/tickets/SKILL.md +15 -43
@@ -8,45 +8,41 @@ description: Design a feature spec-first through conversation, or flesh out an e
8
8
  The conversational surface over the complete
9
9
  [spec standard](../ab-guide/references/spec-standard.md) installed with
10
10
  `ab-guide` — read it first. It defines "buildable": what and why but never how,
11
- verifiable acceptance criteria, explicit out-of-scope, and evidence. This skill
11
+ verifiable acceptance criteria, explicit out-of-scope, and evidence, plus how
12
+ to size work and where to split it. This skill
12
13
  runs *before* a build exists, so it takes a ticket, not a build slug — and
13
14
  unlike the phase skills, it is a conversation with a human, not an autonomous
14
15
  session.
15
16
 
16
17
  ## Node tickets and targets
17
18
 
18
- Tickets have `kind = "work"` by default, or `kind = "node"` for a named
19
- integration point. The optional `target` is a node ticket id in the same source;
20
- omission means the configured `baseBranch` root. Nodes may target other nodes.
21
- These fields currently describe intent only: dispatch, branches and landing
22
- behavior are unchanged in this increment. Blockers remain a separate graph.
23
-
24
- Use `ab ticket create "Integration" --body spec.md --kind node`, then
25
- `ab ticket update <id> --target <node-id>`. Clear a target with `--no-target`;
26
- reset kind with `--kind work`. Omitted fields preserve existing values.
27
- `ab ticket show <id> [--json]` exposes both fields; `ab ticket tree [--json]`
28
- shows the configured root and every ticket, including completed work and empty
29
- nodes, nested by target with state. Siblings are sorted by id. Invalid external
30
- graphs and listing diagnostics are reported explicitly.
31
-
32
- Targets must exist and be nodes in the configured source. Self-targeting,
33
- ancestor cycles and demoting a node with targeting tickets are refused before
34
- any part of the requested update is written, regardless of ticket state.
35
- Clear or reparent its children before demotion. File frontmatter persists the
36
- fields; `ab ticket edit` displays them read-only. Change them through update.
37
- Kind and target participate in content revisions and revision-checked writes.
38
- File writes retain their existing best-effort, unlocked concurrency semantics.
39
-
40
- Linear uses the exact `node` issue label for kind and the parent relation for
41
- target, only when the parent carries that label. Ordinary grouping parents do
42
- not impose targets and survive unrelated updates. Explicit target clear clears
43
- the parent relation. Label replacements can demote nodes and receive the same
44
- guards; explicit kind and label instructions must agree about `node`. Label
45
- and parent connections are fully paginated. Linear still refuses guarded writes.
46
-
47
- Hosted sources and legacy plugins read as work with no target and refuse any
48
- explicit metadata write, including clears and mixed patches, with guidance to
49
- use a capable source. No hosted storage or protocol change is implied.
19
+ For node lifecycle, target validation and source-specific storage, read
20
+ [nodes and targets](../ab-guide/references/integration-tree.md). When filing
21
+ related work, follow the shared
22
+ [destination choice](../ab-guide/references/integration-tree.md#choosing-a-destination)
23
+ guidance before choosing root or a node.
24
+
25
+ ```sh
26
+ ab ticket create "Integration" --body spec.md --kind node
27
+ ab ticket create "Child" --body child.md --target <node-id>
28
+ ab ticket update <id> --target <node-id>
29
+ ab ticket update <id> --no-target
30
+ ab ticket update <id> --kind work
31
+ ab ticket show <id> --json
32
+ ab ticket tree --json
33
+ ```
34
+
35
+ Whenever grooming produces more than one ticket for a feature, first confirm
36
+ the split is warranted under the standard's
37
+ [sizing and splitting](../ab-guide/references/spec-standard.md#sizing-and-splitting)
38
+ guidance, then explicitly choose root or a node before filing,
39
+ including when fleshing out an existing ticket splits it into several tickets.
40
+ Consult the shared destination criteria and read
41
+ the repository's effective landing policy in `autobuild.toml`; explain the actual
42
+ landing and consent flow to the human in plain terms. Ask the human when the
43
+ choice is unclear from grooming. Root is valid when each ticket can ship alone.
44
+ Choosing root or a node never changes the requested workflow state or silently
45
+ promotes tickets; the placement instructions below still apply.
50
46
 
51
47
  ## Ticket operations
52
48
 
@@ -69,6 +65,11 @@ in order, but as a conversation, not a form:
69
65
  conversation in what actually exists.
70
66
  2. **Acceptance criteria.** Propose them yourself from the discussion; let
71
67
  the user correct. Each must be checkable by a reviewer or a verify step.
68
+ If the criteria fall into separate groups, apply
69
+ [sizing and splitting](../ab-guide/references/spec-standard.md#sizing-and-splitting)
70
+ before treating the work as several tickets: default to one larger ticket,
71
+ and when a split is warranted, propose the seams and the blocker graph to
72
+ the user with the reason for each cut.
72
73
  3. **Out of scope.** Ask what adjacent work is explicitly excluded. Propose
73
74
  candidates — the tempting expansions you noticed while reading the code.
74
75
  4. **Evidence.** Link what exists: the error rates, the user reports, the
@@ -104,25 +105,43 @@ blockers at creation, read back and verify them, then move to ready last. The
104
105
  human's requested final placement still wins; temporary staging needs no new
105
106
  placement question. Never assume the source default is non-ready.
106
107
 
107
- For a dependency chain, create in dependency order and obtain each new id from
108
- the command's complete JSON result. This example assumes the repository's triage
109
- state is `Triage`, its ready state is `Ready`, and the human requested ready:
108
+ For a dependency chain explicitly chosen to ship together under a node, create
109
+ in dependency order and obtain each new id from the command's complete JSON
110
+ result. Write a spec-standard node body in `integration.md` as well as the child
111
+ specs. This example assumes the repository's triage state is `Triage`, its ready
112
+ state is `Ready`, and the human requested ready placement for the whole set.
113
+ Use the repository's actual states; if final placement is non-ready, leave the
114
+ set there after verification instead of promoting it. Root remains a valid
115
+ explicit choice when each ticket is independently useful and safe to ship:
110
116
 
111
117
  ```sh
112
- ab ticket create "A" --body a.md --json --state Triage > a-ticket.json
118
+ ab ticket create "Integration" --body integration.md --kind node --json --state Triage > node-ticket.json
119
+ node_id="$(jq -r '.ref.id' node-ticket.json)"
120
+ ab ticket create "A" --body a.md --target "$node_id" --json --state Triage > a-ticket.json
113
121
  a_id="$(jq -r '.ref.id' a-ticket.json)"
114
- ab ticket create "B" --body b.md --blocked-by "$a_id" --json --state Triage > b-ticket.json
122
+ ab ticket create "B" --body b.md --blocked-by "$a_id" --target "$node_id" --json --state Triage > b-ticket.json
115
123
  b_id="$(jq -r '.ref.id' b-ticket.json)"
116
- ab ticket create "C" --body c.md --blocked-by "$b_id" --json --state Triage > c-ticket.json
124
+ ab ticket create "C" --body c.md --blocked-by "$b_id" --target "$node_id" --json --state Triage > c-ticket.json
117
125
  c_id="$(jq -r '.ref.id' c-ticket.json)"
126
+ ab ticket show "$node_id" --json
127
+ ab ticket show "$a_id" --json
118
128
  ab ticket show "$b_id" --json
119
129
  ab ticket show "$c_id" --json
120
- # Verify both tickets remain in Triage and their full blocker sets are present.
130
+ # Verify the node and all children remain in Triage, all child targets equal
131
+ # node_id, and every complete blocker set is correct (A: none; B: A; C: B).
132
+ # Repair and read back any mismatch before publishing any ticket.
133
+ ab ticket move "$node_id" Ready --json
121
134
  ab ticket move "$a_id" Ready --json
122
135
  ab ticket move "$b_id" Ready --json
123
136
  ab ticket move "$c_id" Ready --json
124
137
  ```
125
138
 
139
+ Register and verify all planned children before making the node ready, so it
140
+ cannot collect a partial feature. The node must satisfy the repository's ready
141
+ gates and open before children can be claimed; a CLI move alone does not prove
142
+ admission. After publication, read back the final states, targets and blockers;
143
+ repair partial writes without blindly creating duplicates.
144
+
126
145
  Never parse an id from the human-readable confirmation line: it can contain the
127
146
  new ticket id and blocker ids in the same source-local form. Dependency order
128
147
  alone does not close the ready-publication race. Blockers are evaluated when
@@ -221,6 +240,9 @@ repository, report that rather than waiting on builds that cannot start.
221
240
 
222
241
  ## Rules
223
242
 
243
+ - **Fewer, larger tickets.** Split only when sizing calls for it, cut at
244
+ seams, and keep the blocker graph wide so independent tickets build
245
+ together.
224
246
  - The spec says **what and why, never how.** An exported, attached `design`
225
247
  asset is a contract on observable visual and reference outcomes — layout,
226
248
  content, states, copy, look — that plan, review, and verify judge against;
@@ -11,49 +11,21 @@ content and blocker relationships. The default file source needs no secret.
11
11
 
12
12
  ## Node tickets and targets
13
13
 
14
- Tickets have `kind = "work"` by default, or `kind = "node"` for a named
15
- integration point. The optional `target` is a node ticket id in the same source;
16
- omission means the configured `baseBranch` root. Nodes may target other nodes.
17
- Ready node tickets open integration branches. Work claims freeze their target
18
- identity and branch. Blockers remain a separate graph.
19
-
20
- Use `ab ticket create "Integration" --body spec.md --kind node`, then
21
- `ab ticket update <id> --target <node-id>`. Clear a target with `--no-target`;
22
- reset kind with `--kind work`. Omitted fields preserve existing values.
23
- `ab ticket show <id> [--json]` exposes both fields; `ab ticket tree [--json]`
24
- shows the configured root and every ticket, including completed work and empty
25
- nodes, nested by target with state. Siblings are sorted by id. Invalid external
26
- graphs and listing diagnostics are reported explicitly.
27
-
28
- Changing an open node target re-parents its branch and existing PR; `--no-target`
29
- moves it to the configured root. The dispatcher confirms source metadata, replays
30
- only node-owned contributions onto the new parent, then retargets the same review.
31
- Children follow through the ordinary cascade; conflicts use normal source-aware
32
- reconcile. Pending moves block verification and landing. Cycles, non-open parents,
33
- landing/closing nodes and unsupported forge retargeting are refused with a reason.
34
- Busy operations must settle first. Changing a claimed work target is refused before
35
- any combined patch is written: abort and re-dispatch instead. Direct provider edits
36
- are observed too; invalid edits leave effective ancestry unchanged with a durable
37
- diagnostic. Status shows effective ancestry; ticket tree shows source metadata.
38
-
39
- Targets must exist and be nodes in the configured source. Self-targeting,
40
- ancestor cycles and demoting a node with targeting tickets are refused before
41
- any part of the requested update is written, regardless of ticket state.
42
- Clear or reparent its children before demotion. File frontmatter persists the
43
- fields; `ab ticket edit` displays them read-only. Change them through update.
44
- Kind and target participate in content revisions and revision-checked writes.
45
- File writes retain their existing best-effort, unlocked concurrency semantics.
46
-
47
- Linear uses the exact `node` issue label for kind and the parent relation for
48
- target, only when the parent carries that label. Ordinary grouping parents do
49
- not impose targets and survive unrelated updates. Explicit target clear clears
50
- the parent relation. Label replacements can demote nodes and receive the same
51
- guards; explicit kind and label instructions must agree about `node`. Label
52
- and parent connections are fully paginated. Linear still refuses guarded writes.
53
-
54
- Hosted sources and legacy plugins read as work with no target and refuse any
55
- explicit metadata write, including clears and mixed patches, with guidance to
56
- use a capable source. No hosted storage or protocol change is implied.
14
+ For node lifecycle, target validation and source-specific storage, read
15
+ [nodes and targets](../ab-guide/references/integration-tree.md). When filing
16
+ related work, follow the shared
17
+ [destination choice](../ab-guide/references/integration-tree.md#choosing-a-destination)
18
+ guidance before choosing root or a node.
19
+
20
+ ```sh
21
+ ab ticket create "Integration" --body spec.md --kind node
22
+ ab ticket create "Child" --body child.md --target <node-id>
23
+ ab ticket update <id> --target <node-id>
24
+ ab ticket update <id> --no-target
25
+ ab ticket update <id> --kind work
26
+ ab ticket show <id> --json
27
+ ab ticket tree --json
28
+ ```
57
29
 
58
30
  ## Hosted ticket ids
59
31