@popoverai/dotrequirements 0.37.0 → 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.
@@ -97,8 +97,11 @@ const PR_STATUS_HELP = `
97
97
  Reads the pull request of the outcome you are at, or of the outcome it awaits that
98
98
  is kept on one, as GitHub reports it. The merge state is GitHub's word for whether
99
99
  it can merge: clean means it can, with every required check passing and no
100
- conflict. Failed checks come with a link to them; checks still running are named.
101
- Reading it changes nothing.
100
+ conflict. Failed checks come with a link to them and what they reported, as GitHub
101
+ gives it: their output and annotations, or the end of their job's log. Checks still
102
+ running are named. Each review follows, with its verdict and its comments, from the
103
+ repository's owners, members and collaborators and the apps installed on it; those
104
+ by anyone else are left out and counted. Reading it changes nothing.
102
105
  `;
103
106
  /** What `pr open` does, on its `--help`, where `author --help` sends the agent (PULL-2). */
104
107
  const PULL_REQUEST_HELP = `
@@ -18,12 +18,15 @@ export type PullRequestState = {
18
18
  name: string;
19
19
  result: string;
20
20
  link: string | null;
21
+ /** What the check reported, as GitHub gave it, or why it couldn't (PULL-4.7). */
22
+ reported?: unknown;
21
23
  }>;
22
24
  running: Array<{
23
25
  name: string;
24
26
  link: string | null;
25
27
  }>;
26
28
  head: string;
29
+ reviews?: unknown;
27
30
  };
28
31
  /** Where the pull request stands, as a reviewer reads it (PULL-4). */
29
32
  export declare function describeState(state: PullRequestState): string;
@@ -27,7 +27,14 @@ async function stateFor(where) {
27
27
  }
28
28
  if (!said.state)
29
29
  throw new Error("The app gave no pull request.");
30
- return said.state;
30
+ return said.reviews === undefined
31
+ ? said.state
32
+ : { ...said.state, reviews: said.reviews };
33
+ }
34
+ /** What GitHub reported, as it gave it, indented under the line it belongs to. */
35
+ function asGiven(reported, indent) {
36
+ const text = typeof reported === "string" ? reported : JSON.stringify(reported, null, 2);
37
+ return text.split("\n").map((line) => `${indent}${line}`);
31
38
  }
32
39
  /** Where the pull request stands, as a reviewer reads it (PULL-4). */
33
40
  export function describeState(state) {
@@ -40,6 +47,10 @@ export function describeState(state) {
40
47
  ];
41
48
  for (const check of state.failed) {
42
49
  lines.push(` failed: ${check.name} (${check.result})${check.link ? ` ${check.link}` : ""}`);
50
+ // PULL-4.7: what it reported, as GitHub gave it.
51
+ if (check.reported !== undefined) {
52
+ lines.push(" It reported:", ...asGiven(check.reported, " "));
53
+ }
43
54
  }
44
55
  for (const check of state.running) {
45
56
  lines.push(` still running: ${check.name}${check.link ? ` ${check.link}` : ""}`);
@@ -48,6 +59,10 @@ export function describeState(state) {
48
59
  // PULL-4.3.
49
60
  lines.push("GitHub hasn't yet worked out whether it can merge: read it again shortly.");
50
61
  }
62
+ // PULL-4.8: each review, with its verdict and its comments.
63
+ if (state.reviews !== undefined) {
64
+ lines.push("Reviews and their comments, as GitHub gave them:", ...asGiven(state.reviews, " "));
65
+ }
51
66
  return lines.join("\n");
52
67
  }
53
68
  /**
@@ -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.0",
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": {