@popoverai/dotrequirements 0.37.1 → 0.37.2

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.
@@ -7,7 +7,9 @@ import type { Plan, PlanPart } from "./types.js";
7
7
  * So a scenario naming Scores alone, of the default plan, runs the scores
8
8
  * with the pitch an input. An outcome on one left out is kept on that
9
9
  * one's surface instead. The checkpoints on what is kept stay, presenting
10
- * what is still there; loops go, since part of a plan starts or ends
10
+ * what is still there, and one named into a phase the part doesn't have
11
+ * names none; a pull-request surface's ready for review or draft on an
12
+ * outcome left out goes; and loops go, since part of a plan starts or ends
11
13
  * nothing.
12
14
  *
13
15
  * The one exception is the outcome that makes the solution exist: the
@@ -35,7 +35,9 @@ const worksFrom = (plan, outcome) => [
35
35
  * So a scenario naming Scores alone, of the default plan, runs the scores
36
36
  * with the pitch an input. An outcome on one left out is kept on that
37
37
  * one's surface instead. The checkpoints on what is kept stay, presenting
38
- * what is still there; loops go, since part of a plan starts or ends
38
+ * what is still there, and one named into a phase the part doesn't have
39
+ * names none; a pull-request surface's ready for review or draft on an
40
+ * outcome left out goes; and loops go, since part of a plan starts or ends
39
41
  * nothing.
40
42
  *
41
43
  * The one exception is the outcome that makes the solution exist: the
@@ -85,18 +87,38 @@ export function planForOutcomes(plan, names) {
85
87
  const known = new Set([...kept, ...inputs]);
86
88
  const keptOn = (on) => kept.has(on) ||
87
89
  [...kept].some((name) => surfaceOf(plan, name) === on && name !== on);
90
+ // A checkpoint named into a phase the part no longer has sits after what
91
+ // it presents, as it would naming none.
92
+ const placed = (checkpoint) => {
93
+ if (checkpoint.phase === undefined ||
94
+ phases.some((phase) => phase.name === checkpoint.phase)) {
95
+ return checkpoint;
96
+ }
97
+ const { phase: _phase, ...rest } = checkpoint;
98
+ return rest;
99
+ };
88
100
  const checkpoints = plan.checkpoints.flatMap((checkpoint) => {
89
101
  if (!keptOn(checkpoint.on))
90
102
  return [];
91
103
  if (!checkpoint.presents?.length)
92
- return [checkpoint];
104
+ return [placed(checkpoint)];
93
105
  const presents = checkpoint.presents.filter((name) => known.has(name));
94
- return presents.length > 0 ? [{ ...checkpoint, presents }] : [];
106
+ return presents.length > 0 ? [placed({ ...checkpoint, presents })] : [];
95
107
  });
96
108
  return {
97
109
  format: "outcomes",
98
110
  inputs,
99
- surfaces: plan.surfaces,
111
+ // A pull request's moment on an outcome left out never comes (PULL-7.3).
112
+ surfaces: plan.surfaces.map((surface) => {
113
+ const own = { ...surface };
114
+ if (surface.readyForReview && !kept.has(surface.readyForReview.outcome)) {
115
+ delete own.readyForReview;
116
+ }
117
+ if (surface.draft && !kept.has(surface.draft.outcome)) {
118
+ delete own.draft;
119
+ }
120
+ return own;
121
+ }),
100
122
  phases,
101
123
  checkpoints,
102
124
  agents: plan.agents,
@@ -93,6 +93,16 @@ export type Plan = {
93
93
  surfaces: Array<{
94
94
  name: string;
95
95
  kind: string;
96
+ /** When a pull-request surface's pull request asks for review, or goes back to draft (PULL-7). */
97
+ readyForReview?: {
98
+ outcome: string;
99
+ when: string;
100
+ };
101
+ draft?: {
102
+ outcome: string;
103
+ when: string;
104
+ };
105
+ watchedBy?: string;
96
106
  }>;
97
107
  phases: Array<{
98
108
  name: string;
@@ -103,6 +113,7 @@ export type Plan = {
103
113
  name: string;
104
114
  on: string;
105
115
  presents?: string[];
116
+ phase?: string;
106
117
  }>;
107
118
  agents: Array<{
108
119
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popoverai/dotrequirements",
3
- "version": "0.37.1",
3
+ "version": "0.37.2",
4
4
  "description": "Requirements as testable, human-readable data — CLI and test harness for spec-driven development with AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {