@punks/cli 4.0.2 → 4.0.4

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 (164) hide show
  1. package/dist/BASELINE_CHANGELOG.md +29 -0
  2. package/dist/CHANGELOG.md +25 -0
  3. package/dist/baseline/scaffold-baseline/baseline.json +5 -5
  4. package/dist/baseline/scaffold-baseline/data/catalog/lint-assets.json +10 -4
  5. package/dist/baseline/scaffold-baseline/data/catalog/packs.json +0 -1
  6. package/dist/baseline/scaffold-baseline/data/catalog/skills.json +0 -8
  7. package/dist/baseline/scaffold-baseline/data/hooks/format-edited-file.mjs +602 -101
  8. package/dist/baseline/scaffold-baseline/data/scripts/commit-gate-runner.d.ts +11 -0
  9. package/dist/baseline/scaffold-baseline/data/scripts/commit-gate-runner.mjs +103 -0
  10. package/dist/baseline/scaffold-baseline/data/scripts/commit-gate-runner.test.ts +144 -0
  11. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/adapters/claude.mjs +1 -0
  12. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/adapters/codex.mjs +1 -0
  13. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/adapters/cursor.mjs +1 -0
  14. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/adapters/opencode.mjs +1 -0
  15. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/contract.ts +24 -33
  16. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/core.mjs +4 -0
  17. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/core.test.ts +61 -0
  18. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/lint-feedback.test.ts +123 -0
  19. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/test-fixtures/claude/actions.json +1 -0
  20. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/test-fixtures/codex/actions.json +2 -1
  21. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/test-fixtures/cursor/projection.json +1 -0
  22. package/dist/baseline/scaffold-baseline/data/scripts/harness-projection/test-fixtures/opencode/projection.json +1 -0
  23. package/dist/baseline/scaffold-baseline/data/scripts/sync-subagents-validator.test.ts +59 -0
  24. package/dist/baseline/scaffold-baseline/data/scripts/sync-subagents.d.mts +1 -0
  25. package/dist/baseline/scaffold-baseline/data/scripts/sync-subagents.mjs +27 -14
  26. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/docs-onboarding/SKILL.md +2 -2
  27. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-spec/SKILL.md +32 -32
  28. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-spec/assets/SPEC-TEMPLATE.md +7 -7
  29. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-spec/references/readiness.md +14 -13
  30. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-spec/references/spec-quality-bar.md +26 -19
  31. package/dist/baseline/scaffold-baseline/skills/agnostic/quality/autoreview/SKILL.md +2 -2
  32. package/dist/baseline/scaffold-baseline/skills/agnostic/quality/autoreview/scripts/autoreview +3 -0
  33. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/brainstorm/SKILL.md +18 -0
  34. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/requirements-grill/SKILL.md +2 -1
  35. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/EXAMPLES.md +9 -9
  36. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/REFERENCE.md +43 -55
  37. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/SKILL.md +68 -63
  38. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/assets/concepts/backlog-model.md +26 -29
  39. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/assets/concepts/story-shape.md +5 -5
  40. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/assets/providers/azure-devops-create-payload.md +1 -1
  41. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/assets/providers/github-projects-create-payload.md +2 -2
  42. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/assets/providers/linear-create-payload.md +1 -1
  43. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/assets/providers/monday-create-payload.md +2 -2
  44. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/references/business-projection.md +19 -24
  45. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/references/delivery-status.md +17 -13
  46. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/references/fog-intake.md +45 -48
  47. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/references/functional-projection.md +16 -21
  48. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/references/normalization.md +14 -14
  49. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/references/project-context.md +32 -27
  50. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/references/providers/github.md +105 -150
  51. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/references/providers/linear.md +111 -181
  52. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/references/technical-projection.md +51 -47
  53. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/write-backlog/scripts/validate-task-blocker-graph.mjs +49 -35
  54. package/dist/baseline/scaffold-baseline/skills/agnostic/security/security-best-practices/references/javascript-typescript-vue-web-frontend-security.md +1 -1
  55. package/dist/baseline/scaffold-baseline/skills/frameworks/expo/eas-update-insights/references/update-insights-schema.md +2 -6
  56. package/dist/baseline/scaffold-baseline/skills/frameworks/expo/expo-skill-eval/SKILL.md +6 -7
  57. package/dist/baseline/scaffold-baseline/skills/frameworks/pulumi/pulumi-best-practices/SKILL.md +1 -3
  58. package/dist/baseline/scaffold-baseline/skills/frameworks/pulumi/pulumi-component/SKILL.md +2 -14
  59. package/dist/baseline/scaffold-baseline/skills/frameworks/tanstack-query/tanstack-query/references/best-practices.md +7 -1
  60. package/dist/baseline/scaffold-baseline/skills/frameworks/tanstack-query/tanstack-query/templates/devtools-setup.tsx +4 -0
  61. package/dist/baseline/scaffold-baseline/skills/frameworks/trpc/tanstack-query/references/best-practices.md +7 -1
  62. package/dist/baseline/scaffold-baseline/skills/frameworks/trpc/tanstack-query/templates/devtools-setup.tsx +4 -0
  63. package/dist/baseline/scaffold-baseline/skills/languages/typescript/quality-types/SKILL.md +1 -3
  64. package/dist/baseline/scaffold-baseline/skills/phases/business-finder/SKILL.md +29 -16
  65. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/SKILL.md +1 -1
  66. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/router.md +10 -8
  67. package/dist/baseline/scaffold-baseline/skills/phases/design-phase/phases/backlog.md +26 -17
  68. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/AUTHORING-HANDOFF.md +51 -261
  69. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/SKILL.md +22 -25
  70. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/ensure-fog.md +13 -23
  71. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/grilling.md +40 -0
  72. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/handback.md +11 -18
  73. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/prototype.md +13 -21
  74. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/reconcile.md +21 -35
  75. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/research.md +13 -18
  76. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/return-target.md +14 -25
  77. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/router.md +22 -56
  78. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/references/entrypoint-contract.md +25 -26
  79. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/references/root-routing.md +12 -20
  80. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/references/runtime-handoff.md +17 -39
  81. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/references/state-graph.md +27 -49
  82. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/scripts/finder-contract.mjs +40 -359
  83. package/dist/baseline/scaffold-baseline/skills/phases/functional-finder/SKILL.md +29 -62
  84. package/dist/baseline/scaffold-baseline/skills/phases/requirements-phase/SKILL.md +49 -13
  85. package/dist/baseline/scaffold-baseline.json +5 -5
  86. package/dist/baseline/scaffold-baseline.tgz +0 -0
  87. package/dist/data/hooks/format-edited-file.d.mts +21 -0
  88. package/dist/data/hooks/format-edited-file.mjs +588 -98
  89. package/dist/data/scripts/commit-gate-runner.mjs +103 -0
  90. package/dist/data/scripts/harness-projection/adapters/claude.mjs +1 -0
  91. package/dist/data/scripts/harness-projection/adapters/codex.mjs +1 -0
  92. package/dist/data/scripts/harness-projection/adapters/cursor.mjs +1 -0
  93. package/dist/data/scripts/harness-projection/adapters/opencode.mjs +1 -0
  94. package/dist/data/scripts/harness-projection/core.mjs +4 -0
  95. package/dist/data/scripts/harness-projection/test-fixtures/claude/actions.json +1 -0
  96. package/dist/data/scripts/harness-projection/test-fixtures/codex/actions.json +2 -1
  97. package/dist/data/scripts/harness-projection/test-fixtures/cursor/projection.json +1 -0
  98. package/dist/data/scripts/harness-projection/test-fixtures/opencode/projection.json +1 -0
  99. package/dist/data/scripts/sync-subagents.d.mts +1 -0
  100. package/dist/data/scripts/sync-subagents.mjs +30 -13
  101. package/dist/data/shared-agents.md +2 -60
  102. package/dist/index.js +73 -64
  103. package/dist/skills/agnostic/docs/docs-onboarding/SKILL.md +2 -2
  104. package/dist/skills/agnostic/planning/create-spec/SKILL.md +32 -32
  105. package/dist/skills/agnostic/planning/create-spec/assets/SPEC-TEMPLATE.md +7 -7
  106. package/dist/skills/agnostic/planning/create-spec/references/readiness.md +14 -13
  107. package/dist/skills/agnostic/planning/create-spec/references/spec-quality-bar.md +26 -19
  108. package/dist/skills/agnostic/quality/autoreview/SKILL.md +2 -2
  109. package/dist/skills/agnostic/quality/autoreview/scripts/autoreview +3 -0
  110. package/dist/skills/agnostic/requirements/brainstorm/SKILL.md +18 -0
  111. package/dist/skills/agnostic/requirements/requirements-grill/SKILL.md +2 -1
  112. package/dist/skills/agnostic/requirements/write-backlog/EXAMPLES.md +9 -9
  113. package/dist/skills/agnostic/requirements/write-backlog/REFERENCE.md +43 -55
  114. package/dist/skills/agnostic/requirements/write-backlog/SKILL.md +68 -63
  115. package/dist/skills/agnostic/requirements/write-backlog/assets/concepts/backlog-model.md +26 -29
  116. package/dist/skills/agnostic/requirements/write-backlog/assets/concepts/story-shape.md +5 -5
  117. package/dist/skills/agnostic/requirements/write-backlog/assets/providers/azure-devops-create-payload.md +1 -1
  118. package/dist/skills/agnostic/requirements/write-backlog/assets/providers/github-projects-create-payload.md +2 -2
  119. package/dist/skills/agnostic/requirements/write-backlog/assets/providers/linear-create-payload.md +1 -1
  120. package/dist/skills/agnostic/requirements/write-backlog/assets/providers/monday-create-payload.md +2 -2
  121. package/dist/skills/agnostic/requirements/write-backlog/references/business-projection.md +19 -24
  122. package/dist/skills/agnostic/requirements/write-backlog/references/delivery-status.md +17 -13
  123. package/dist/skills/agnostic/requirements/write-backlog/references/fog-intake.md +45 -48
  124. package/dist/skills/agnostic/requirements/write-backlog/references/functional-projection.md +16 -21
  125. package/dist/skills/agnostic/requirements/write-backlog/references/normalization.md +14 -14
  126. package/dist/skills/agnostic/requirements/write-backlog/references/project-context.md +32 -27
  127. package/dist/skills/agnostic/requirements/write-backlog/references/providers/github.md +97 -142
  128. package/dist/skills/agnostic/requirements/write-backlog/references/providers/linear.md +106 -176
  129. package/dist/skills/agnostic/requirements/write-backlog/references/technical-projection.md +51 -47
  130. package/dist/skills/agnostic/requirements/write-backlog/scripts/validate-task-blocker-graph.mjs +55 -31
  131. package/dist/skills/phases/business-finder/SKILL.md +29 -16
  132. package/dist/skills/phases/delivery-phase/SKILL.md +1 -1
  133. package/dist/skills/phases/delivery-phase/phases/router.md +10 -8
  134. package/dist/skills/phases/design-phase/phases/backlog.md +26 -17
  135. package/dist/skills/phases/finder-phase/AUTHORING-HANDOFF.md +51 -261
  136. package/dist/skills/phases/finder-phase/SKILL.md +22 -25
  137. package/dist/skills/phases/finder-phase/phases/ensure-fog.md +13 -23
  138. package/dist/skills/phases/finder-phase/phases/grilling.md +40 -0
  139. package/dist/skills/phases/finder-phase/phases/handback.md +11 -18
  140. package/dist/skills/phases/finder-phase/phases/prototype.md +13 -21
  141. package/dist/skills/phases/finder-phase/phases/reconcile.md +21 -35
  142. package/dist/skills/phases/finder-phase/phases/research.md +13 -18
  143. package/dist/skills/phases/finder-phase/phases/return-target.md +14 -25
  144. package/dist/skills/phases/finder-phase/phases/router.md +22 -56
  145. package/dist/skills/phases/finder-phase/references/entrypoint-contract.md +25 -26
  146. package/dist/skills/phases/finder-phase/references/root-routing.md +12 -20
  147. package/dist/skills/phases/finder-phase/references/runtime-handoff.md +17 -39
  148. package/dist/skills/phases/finder-phase/references/state-graph.md +27 -49
  149. package/dist/skills/phases/finder-phase/scripts/finder-contract.mjs +44 -357
  150. package/dist/skills/phases/functional-finder/SKILL.md +29 -62
  151. package/dist/skills/phases/requirements-phase/SKILL.md +49 -13
  152. package/package.json +7 -5
  153. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/adopt-business-path.md +0 -52
  154. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/business-grilling.md +0 -68
  155. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/functional-grilling.md +0 -53
  156. package/dist/baseline/scaffold-baseline/skills/phases/finder-phase/phases/technical-grilling.md +0 -67
  157. package/dist/baseline/scaffold-baseline/skills/phases/technical-finder/SKILL.md +0 -74
  158. package/dist/baseline/scaffold-baseline/skills/phases/technical-finder/agents/openai.yaml +0 -2
  159. package/dist/skills/phases/finder-phase/phases/adopt-business-path.md +0 -52
  160. package/dist/skills/phases/finder-phase/phases/business-grilling.md +0 -68
  161. package/dist/skills/phases/finder-phase/phases/functional-grilling.md +0 -53
  162. package/dist/skills/phases/finder-phase/phases/technical-grilling.md +0 -67
  163. package/dist/skills/phases/technical-finder/SKILL.md +0 -74
  164. package/dist/skills/phases/technical-finder/agents/openai.yaml +0 -2
@@ -1,383 +1,64 @@
1
- const DEPTHS = ["Business", "Functional", "Technical"];
2
- const CONFLICT_IDENTITIES = ["ambiguous", "duplicate", "conflict"];
3
- const isStableIdentity = (value) => typeof value === "string" && value.trim().length > 0;
1
+ const LENSES = ["Business", "Functional"];
2
+ const CONFLICTS = ["ambiguous", "conflict", "duplicate"];
4
3
 
5
- const hasExactBusinessProjection = (child) =>
6
- isStableIdentity(child?.projectedProductArea) &&
7
- isStableIdentity(child.projectedInitiative) &&
8
- isStableIdentity(child.projectedEpic) &&
9
- child.hierarchyReadback === "exact";
4
+ const conflicts = (value) => CONFLICTS.includes(value);
5
+ const stable = (value) => typeof value === "string" && value.trim().length > 0;
10
6
 
11
- const businessChildCollectionConflicts = (children) => {
12
- if (!Array.isArray(children)) return false;
13
- return (
14
- children.length > 1 ||
15
- children.some(
16
- (child) =>
17
- !child ||
18
- child.identity !== "exact" ||
19
- (child.status === "accepted" &&
20
- child.scope === "in-scope" &&
21
- child.projection === "read-back" &&
22
- !hasExactBusinessProjection(child)),
23
- )
24
- );
25
- };
26
-
27
- const deriveBusinessStageRoute = (state) => {
28
- if (!Array.isArray(state.businessChildren)) {
29
- return state.business === "accepted" ? "human-steering" : "business-grilling";
30
- }
31
- if (state.businessChildren.length === 0) {
32
- return state.business === "accepted" ? "human-steering" : "business-grilling";
33
- }
34
-
35
- const [child] = state.businessChildren;
36
- if (child.status !== "accepted" || child.scope !== "in-scope") {
37
- return "business-grilling";
38
- }
39
- if (child.resolution !== "immutable") return "human-steering";
40
- if (child.projection !== "read-back") return "reconcile";
41
- if (!hasExactBusinessProjection(child)) return "human-steering";
42
- return "ready";
43
- };
44
-
45
- const childCollectionConflicts = (children, foreignKey) => {
46
- if (!Array.isArray(children)) return false;
47
-
48
- const seen = new Set();
7
+ const childConflict = (children) => {
8
+ if (!Array.isArray(children)) return true;
9
+ const ids = new Set();
49
10
  for (const child of children) {
50
- if (!child || CONFLICT_IDENTITIES.includes(child.identity)) return true;
51
- const key = child[foreignKey];
52
- if (!isStableIdentity(key)) return true;
53
- if (seen.has(key)) return true;
54
- seen.add(key);
55
- }
56
-
57
- return false;
58
- };
59
-
60
- const functionalProjectionConflicts = (children, businessChildren) => {
61
- if (!Array.isArray(children)) return false;
62
-
63
- const projectedEpic = businessChildren?.[0]?.projectedEpic;
64
- const stories = new Set();
65
- for (const child of children) {
66
- if (
67
- child?.status !== "accepted" ||
68
- child.scope !== "in-scope" ||
69
- child.projection !== "read-back"
70
- ) {
71
- continue;
72
- }
73
- if (
74
- !isStableIdentity(projectedEpic) ||
75
- !isStableIdentity(child.projectedStory) ||
76
- child.projectedStoryParentEpic !== projectedEpic ||
77
- !isStableIdentity(child.projectedStoryMilestone) ||
78
- child.projectedStoryMilestoneKind !== "V*" ||
79
- child.projectedStoryFogLink !== "exact" ||
80
- child.projectedStorySourceLink !== "exact" ||
81
- child.projectedStoryMembershipReadback !== "exact"
82
- ) {
11
+ if (!child || child.identity !== "exact" || !stable(child.id) || ids.has(child.id)) {
83
12
  return true;
84
13
  }
85
- if (stories.has(child.projectedStory)) return true;
86
- stories.add(child.projectedStory);
14
+ ids.add(child.id);
87
15
  }
88
16
  return false;
89
17
  };
90
18
 
91
- const hasExactWriterTaskGraphValidation = (state, projectedTasks) => {
92
- const validation = state.taskGraphValidation;
93
- const result = validation?.result;
94
- if (
95
- !isStableIdentity(state.providerSnapshotIdentity) ||
96
- validation?.validator !== "write-backlog/validate-task-blocker-graph" ||
97
- validation.scope !== "full-reachable" ||
98
- validation.milestoneOrderReadback !== "exact" ||
99
- validation.providerSnapshotIdentity !== state.providerSnapshotIdentity ||
100
- result?.ok !== true ||
101
- !Array.isArray(result.taskIds) ||
102
- !Array.isArray(result.edges)
103
- ) {
104
- return false;
105
- }
106
-
107
- const validatedTaskIds = new Set();
108
- for (const taskId of result.taskIds) {
109
- if (!isStableIdentity(taskId) || validatedTaskIds.has(taskId)) return false;
110
- validatedTaskIds.add(taskId);
111
- }
112
-
113
- const validatedEdges = new Set();
114
- for (const edge of result.edges) {
115
- if (
116
- !isStableIdentity(edge?.blockedTaskId) ||
117
- !isStableIdentity(edge.blockingTaskId) ||
118
- !validatedTaskIds.has(edge.blockedTaskId) ||
119
- !validatedTaskIds.has(edge.blockingTaskId)
120
- ) {
121
- return false;
122
- }
123
- const key = `${edge.blockedTaskId}\u0000${edge.blockingTaskId}`;
124
- if (validatedEdges.has(key)) return false;
125
- validatedEdges.add(key);
126
- }
127
-
128
- const projectedTaskIds = new Set(projectedTasks.map((task) => task.id));
129
- const projectedEdges = new Set();
130
- for (const task of projectedTasks) {
131
- if (!validatedTaskIds.has(task.id)) return false;
132
- for (const blockingTaskId of task.blockedBy) {
133
- if (!validatedTaskIds.has(blockingTaskId)) return false;
134
- projectedEdges.add(`${task.id}\u0000${blockingTaskId}`);
135
- }
136
- }
137
- if ([...projectedEdges].some((edge) => !validatedEdges.has(edge))) {
138
- return false;
139
- }
140
- if (
141
- [...validatedEdges].some((edge) => {
142
- const [blockedTaskId] = edge.split("\u0000");
143
- return projectedTaskIds.has(blockedTaskId) && !projectedEdges.has(edge);
144
- })
145
- ) {
146
- return false;
147
- }
148
-
149
- return true;
150
- };
151
-
152
- const technicalProjectionConflicts = (state) => {
153
- const children = state.technicalChildren;
154
- const functionalChildren = state.functionalChildren;
155
- if (!Array.isArray(children)) return false;
156
-
157
- const storyMilestones = new Map(
158
- (Array.isArray(functionalChildren) ? functionalChildren : [])
159
- .filter(
160
- (child) =>
161
- child?.status === "accepted" &&
162
- child.scope === "in-scope" &&
163
- child.projection === "read-back" &&
164
- isStableIdentity(child.projectedStory) &&
165
- isStableIdentity(child.projectedStoryMilestone),
166
- )
167
- .map((child) => [child.projectedStory, child.projectedStoryMilestone]),
168
- );
169
- const taskIds = new Set();
170
- const tasks = [];
171
- for (const child of children) {
172
- if (
173
- child?.status !== "accepted" ||
174
- child.scope !== "in-scope" ||
175
- child.projection !== "read-back"
176
- ) {
177
- continue;
178
- }
179
- const storyMilestone = storyMilestones.get(child.story);
180
- if (
181
- !isStableIdentity(storyMilestone) ||
182
- child.taskGraphReadback !== "exact" ||
183
- !Array.isArray(child.projectedTasks) ||
184
- child.projectedTasks.length !== child.taskIntentCount
185
- ) {
186
- return true;
187
- }
188
- for (const task of child.projectedTasks) {
189
- if (
190
- !task ||
191
- !isStableIdentity(task.id) ||
192
- task.story !== child.story ||
193
- task.milestone !== storyMilestone ||
194
- task.readback !== "exact" ||
195
- !Array.isArray(task.blockedBy) ||
196
- task.blockedBy.some((identity) => !isStableIdentity(identity)) ||
197
- taskIds.has(task.id)
198
- ) {
199
- return true;
200
- }
201
- taskIds.add(task.id);
202
- tasks.push(task);
203
- }
204
- }
205
- if (tasks.length === 0) return false;
206
-
207
- for (const task of tasks) {
208
- if (
209
- new Set(task.blockedBy).size !== task.blockedBy.length ||
210
- task.blockedBy.includes(task.id)
211
- ) {
212
- return true;
213
- }
214
- }
215
- return !hasExactWriterTaskGraphValidation(state, tasks);
216
- };
217
-
218
- const technicalSelectionConflicts = ({
219
- selectedStoryIntents,
220
- selectedStories,
221
- functionalChildren,
222
- }) => {
223
- if (!Array.isArray(selectedStories) || selectedStories.length === 0) {
224
- return false;
225
- }
226
-
227
- const selectedIntents = new Set(Array.isArray(selectedStoryIntents) ? selectedStoryIntents : []);
228
- const selectedFunctionalChildren = (
229
- Array.isArray(functionalChildren) ? functionalChildren : []
230
- ).filter(
231
- (child) =>
232
- selectedIntents.has(child.storyIntent) &&
233
- child.status === "accepted" &&
234
- child.scope === "in-scope" &&
235
- child.projection === "read-back",
236
- );
237
-
238
- return (
239
- new Set(selectedStories).size !== selectedStories.length ||
240
- selectedStories.some(
241
- (story) =>
242
- !isStableIdentity(story) ||
243
- selectedFunctionalChildren.filter((child) => child.projectedStory === story).length !== 1,
244
- )
245
- );
246
- };
247
-
248
- const deriveChildStageRoute = ({
249
- selected,
250
- children,
251
- foreignKey,
252
- grillingRoute,
253
- validateAcceptedChild = () => true,
254
- }) => {
255
- if (!Array.isArray(selected)) return grillingRoute;
256
- if (selected.length === 0) return grillingRoute;
257
- if (new Set(selected).size !== selected.length) return "human-steering";
258
-
259
- const matchesBySelected = selected.map((selectedIdentity) =>
260
- (Array.isArray(children) ? children : []).filter(
261
- (child) => child[foreignKey] === selectedIdentity,
262
- ),
263
- );
264
-
265
- if (
266
- matchesBySelected.some(
267
- (matches) =>
268
- matches.length > 1 || matches.some((child) => CONFLICT_IDENTITIES.includes(child.identity)),
269
- )
270
- ) {
271
- return "human-steering";
272
- }
19
+ export const deriveFinderRoute = (state) => {
20
+ if (!LENSES.includes(state.targetLens)) return "human-steering";
21
+ if (state.humanSteering === "required") return "human-steering";
22
+ if (conflicts(state.fogIdentity)) return "human-steering";
23
+ if (state.fogIdentity !== "exact") return "ensure-fog";
24
+ if (!LENSES.includes(state.intakeLens)) return "human-steering";
273
25
 
26
+ if (childConflict(state.grillingChildren)) return "human-steering";
27
+ if (state.selection?.decision === "ambiguous") return "human-steering";
274
28
  if (
275
- matchesBySelected
276
- .filter(
277
- (matches) =>
278
- matches.length === 1 &&
279
- matches[0].status === "accepted" &&
280
- matches[0].scope === "in-scope",
281
- )
282
- .some(
283
- ([child]) =>
284
- child.identity !== "exact" ||
285
- child.resolution !== "immutable" ||
286
- !validateAcceptedChild(child),
287
- )
29
+ state.selection?.decision === "reuse" &&
30
+ !state.grillingChildren?.some((child) => child.id === state.selection.childId)
288
31
  ) {
289
32
  return "human-steering";
290
33
  }
291
34
 
292
- if (
293
- matchesBySelected
294
- .filter(
295
- (matches) =>
296
- matches.length === 1 &&
297
- matches[0].status === "accepted" &&
298
- matches[0].scope === "in-scope",
299
- )
300
- .some(([child]) => child.projection !== "read-back")
301
- ) {
302
- return "reconcile";
303
- }
304
-
305
- if (
306
- matchesBySelected.some(
307
- (matches) =>
308
- matches.length !== 1 || matches[0].status !== "accepted" || matches[0].scope !== "in-scope",
309
- )
310
- ) {
311
- return grillingRoute;
312
- }
313
-
314
- return "ready";
315
- };
316
-
317
- export const deriveFinderRoute = (state) => {
318
- if (!DEPTHS.includes(state.targetDepth)) return "human-steering";
319
- if (state.humanSteering === "required") return "human-steering";
320
- if (CONFLICT_IDENTITIES.includes(state.fogIdentity)) {
321
- return "human-steering";
322
- }
323
- if (
324
- businessChildCollectionConflicts(state.businessChildren) ||
325
- childCollectionConflicts(state.functionalChildren, "storyIntent") ||
326
- childCollectionConflicts(state.technicalChildren, "story") ||
327
- functionalProjectionConflicts(state.functionalChildren, state.businessChildren) ||
328
- technicalProjectionConflicts(state)
329
- ) {
35
+ if (state.support?.decision === "ambiguous") return "human-steering";
36
+ if (["requested", "pending"].includes(state.support?.status)) {
330
37
  return "human-steering";
331
38
  }
332
- if (state.fogIdentity !== "exact") return "ensure-fog";
333
- if (CONFLICT_IDENTITIES.includes(state.businessIdentity)) {
39
+ if (state.support?.status === "unresolved") {
40
+ if (!state.grillingChildren?.some((child) => child.id === state.support.supports)) {
41
+ return "human-steering";
42
+ }
43
+ if (state.support.kind === "Research") return "research";
44
+ if (state.support.kind === "Prototype") return "prototype";
334
45
  return "human-steering";
335
46
  }
336
- if (state.acceptedEvidence === "conflict") return "human-steering";
337
- if (state.scopeExpansion === "approval-required") {
338
- return "scope-expansion-checkpoint";
339
- }
340
- if (state.support === "research") return "research";
341
- if (state.support === "prototype") return "prototype";
342
- if (state.businessEvidenceScope === "out-of-scope") {
343
- return "business-grilling";
344
- }
345
- if (state.business !== "accepted") {
47
+
48
+ if (state.projection?.status === "ambiguous") return "human-steering";
49
+ if (["pending", "read-back"].includes(state.projection?.status)) {
50
+ const ceiling =
51
+ state.targetLens === "Business"
52
+ ? new Set(["ProductArea", "Initiative"])
53
+ : new Set(["ProductArea", "Initiative", "Epic"]);
346
54
  if (
347
- state.targetDepth !== "Business" &&
348
- state.business === "missing" &&
349
- state.businessPathIdentity === "exact" &&
350
- state.businessPathDecision === "reuse-unchanged"
55
+ !Array.isArray(state.projection.kinds) ||
56
+ state.projection.kinds.some((kind) => !ceiling.has(kind))
351
57
  ) {
352
- return "adopt-business-path";
58
+ return "human-steering";
353
59
  }
354
- return "business-grilling";
355
60
  }
356
- const businessRoute = deriveBusinessStageRoute(state);
357
- if (businessRoute !== "ready") return businessRoute;
358
- if (state.targetDepth === "Business") return "return-target";
359
-
360
- const functionalRoute = deriveChildStageRoute({
361
- selected: state.selectedStoryIntents,
362
- children: state.functionalChildren,
363
- foreignKey: "storyIntent",
364
- grillingRoute: "functional-grilling",
365
- });
366
- if (functionalRoute !== "ready") return functionalRoute;
367
- if (state.targetDepth === "Functional") return "return-target";
368
- if (technicalSelectionConflicts(state)) return "human-steering";
369
-
370
- const technicalRoute = deriveChildStageRoute({
371
- selected: state.selectedStories,
372
- children: state.technicalChildren,
373
- foreignKey: "story",
374
- grillingRoute: "technical-grilling",
375
- validateAcceptedChild: (child) =>
376
- child.specReadiness === "agent-ready" &&
377
- child.stableBlob === "verified" &&
378
- Number.isInteger(child.taskIntentCount) &&
379
- child.taskIntentCount > 0,
380
- });
381
- if (technicalRoute !== "ready") return technicalRoute;
382
- return "return-target";
61
+ if (state.projection?.status === "pending") return "reconcile";
62
+ if (state.boundedResult === "ready") return "return-target";
63
+ return "grilling";
383
64
  };
@@ -1,78 +1,45 @@
1
1
  ---
2
2
  name: functional-finder
3
- description: Define shippable product behavior through cumulative Business and Functional grilling.
3
+ description: Develop uncertain product behavior nontechnically and optionally project structure through Epic.
4
4
  disable-model-invocation: true
5
5
  ---
6
6
 
7
7
  # Functional Finder
8
8
 
9
- Human entrypoint for a technical or proficient nontechnical user. Use precise
10
- project language. Define product behavior one level below Business scope and
11
- stop before engineering design or Task decomposition.
9
+ Explicit human entrypoint for a functional colleague. It includes every
10
+ Business Finder capability and adds nontechnical product-behavior guidance.
11
+ It does not require Business Finder to have run first.
12
12
 
13
- ## Inputs
13
+ ## Intake profile
14
14
 
15
- - one product-behavior request
16
- - optional stable provider or durable wiki Fog identity
17
- - optional exact accepted Business child and Product Area -> Initiative -> Epic
18
- path
19
- - product context, constraints, dependencies, and milestone preference supplied
20
- by the human
15
+ Capture the Business profile plus actor, trigger, workflow, observable result,
16
+ applicable domain rules, visible alternate and failure paths, acceptance
17
+ signals, boundaries, known product dependencies, technical handoff questions,
18
+ and target `V*` milestone context. Unknown values remain explicit.
21
19
 
22
- ## Composition
23
-
24
- Directly compose [the Finder engine](../finder-phase/SKILL.md) with target
25
- depth: `Functional`. This is cumulative Business and Functional depth over one
26
- Fog; this adapter supplies only its audience, presentation, and return profile.
27
-
28
- Reuse a fresh accepted Business child. When none exists, an exact existing
29
- Product Area -> Initiative -> Epic path from provider readback plus the
30
- human's explicit `reuse-unchanged` decision takes the fast path without
31
- changing business scope. Its Business-path adoption gate creates the required
32
- Business child and immutable resolution without a Business grill. Otherwise
33
- let the engine complete Business grilling
34
- before Functional grilling. When accepted lower-stage evidence needs repair,
35
- the engine may enrich existing Business structures before it continues. The
36
- engine's
37
- [Functional gate](../finder-phase/phases/functional-grilling.md) composes atomic
38
- `$grilling` and resolves one Functional child per accepted Story intent.
39
-
40
- ## Presentation
20
+ This profile does not require architecture, APIs, data models, component
21
+ boundaries, code structure, Tasks, commands, workers, or implementation design.
41
22
 
42
- Before grilling, use the smallest authoritative `$show-me` view to show the
43
- current Business path, relevant existing Stories and `V*` milestones, and the
44
- requested product behavior. Continue to use `$show-me` at each decision about:
23
+ Use `$wait-what` when terminology or behavior does not land. Use `$show-me` at
24
+ each decision about the observable workflow, an alternate or failure path, a
25
+ product dependency, milestone context, and final Epic projection. Presentation
26
+ informs the human and grants no mutation authority.
45
27
 
46
- - the observable workflow
47
- - the Story split and Story boundaries
48
- - an alternate path or failure path
49
- - a product dependency
50
- - the milestone iteration
51
- - the final Story write
52
-
53
- When terminology or behavior does not land, use `$wait-what`: pause, repitch in
54
- plain language with accepted project terms, and ask again. Preserve the user's
55
- language when it already matches those terms.
56
-
57
- ## Functional depth
58
-
59
- For each proposed Story, settle the actor, trigger, observable workflow and
60
- result, applicable business rules, visible alternate or failure paths,
61
- product-level edge cases, acceptance signals, Story boundaries, known product
62
- dependencies, and unresolved engineering questions.
28
+ ## Composition
63
29
 
64
- Assign exactly one contextual `V*` milestone to each Story. Reuse a fitting
65
- existing `V*` milestone before proposing a new one. Show and obtain approval
66
- before moving accepted work to another milestone.
30
+ Compose [the shared Finder engine](../finder-phase/SKILL.md) with immutable
31
+ intake lens `Functional`, this presentation profile, and projection ceiling
32
+ `Epic`. The engine alone owns the Fog lifecycle, generic support work, resume
33
+ routing, and durable handoff.
67
34
 
68
- After immutable Functional evidence is accepted, hand semantic projection
69
- intent to `$write-backlog`. It is the physical mutation authority and must
70
- write and read back exactly one Story per accepted Functional child.
35
+ Optional structure may reuse, enrich, or create Product Areas, Initiatives,
36
+ and Epics through `$write-backlog`. The ceiling is Epic: Functional Finder
37
+ never projects Stories or Tasks. Skipping projection, or returning an
38
+ unresolved projection, never blocks a valid Fog result.
71
39
 
72
- ## Return
40
+ ## Bounded return
73
41
 
74
- Return the exact Fog identity, accepted Business child identity and resolution
75
- pointer, selected Functional child identities and resolution pointers, the
76
- resolved Product Area -> Initiative -> Epic path, exact Story provider
77
- identities and readback, milestone membership, unresolved decisions, and the
78
- durable Finder handoff. Stop at the engine's `target_depth_reached` outcome.
42
+ Return the exact Fog identity, immutable Functional intake lens, generic
43
+ support work and evidence, optional exact Product Area, Initiative, and Epic
44
+ readback, unresolved decisions, and durable Finder handoff. Return control
45
+ without asserting that the Fog is resolved or complete.
@@ -1,26 +1,62 @@
1
1
  ---
2
2
  name: requirements-phase
3
- description: Close bounded product decisions through requirements-grill, then compile confirmed outcomes into an agent-ready spec.
3
+ description: Close bounded product decisions and project the accepted delivery backlog.
4
4
  disable-model-invocation: true
5
5
  ---
6
6
 
7
7
  # Requirements Phase
8
8
 
9
- Human-centric decision closure: `requirements-grill -> create-spec`.
9
+ Requirements Phase is independently invocable. It is the only orchestration
10
+ route for `requirements-grill -> create-spec -> write-backlog`.
11
+
12
+ ## Inputs
13
+
14
+ - Direct bounded requirements input. This route creates no Fog or Finder
15
+ artifact and no Grilling provider item implicitly.
16
+ - Optional Finder context, only when the caller supplies a Fog, Finder child,
17
+ Research child, Prototype child, or durable Finder handoff. Resolve the exact
18
+ identity and its owning Fog graph. Load only that graph. Requirements Phase
19
+ does not load or take ownership of sibling work.
20
+
21
+ The optional context loader is an input adapter to this phase, not a second
22
+ workflow or a Finder lifecycle owner.
10
23
 
11
24
  ## Workflow
12
25
 
13
- 1. Read existing grill status before its log. Summarize accepted, rejected,
14
- superseded, parked, and unresolved branches.
15
- 2. While material decisions remain open, use `requirements-grill` for the HITL
16
- interview. Research and recommendations are evidence, not decisions.
17
- 3. When the user confirms shared understanding and remaining branches are
18
- closed or explicitly parked, invoke `create-spec` immediately.
19
- 4. Require `create-spec` to push or explicitly retain the spec commit, verify the retained ref contains the spec commit, and construct and verify a stable blob URL before `write-backlog` can run. A local SHA plus path is insufficient; otherwise return the compiler's atomic `spec-not-ready` result.
26
+ 1. Select the applicable input contract above. Complete entry when the direct
27
+ scope is bounded or the supplied context graph resolves exactly.
28
+ 2. Read the matching `requirements-grill` status before its log. Summarize
29
+ accepted, rejected, superseded, parked, and unresolved branches. If no
30
+ matching status exists, start the bounded Requirements Grill directly.
31
+ 3. While material decisions remain open, use `requirements-grill` for the HITL
32
+ interview. Research recommendations are evidence, not decisions. Complete
33
+ this step when every material branch is accepted or explicitly parked.
34
+ 4. When the user confirms shared understanding and the remaining branches are
35
+ closed or explicitly parked, invoke `create-spec` immediately. Create Spec
36
+ compiles the accepted outcomes without choosing provider Story or Task
37
+ identities.
38
+ 5. Require `create-spec` to push or explicitly retain the spec commit, verify
39
+ the retained ref contains the spec commit, and construct and verify a stable
40
+ blob URL before `write-backlog` can run. A local SHA plus path is
41
+ insufficient; otherwise return the compiler's atomic `spec-not-ready`
42
+ result.
43
+ 6. After `spec-written`, pass the verified stable blob URL and current provider
44
+ evidence to `write-backlog`. Write Backlog derives the Stories, Tasks, and
45
+ blocker graph supported by the accepted result. With no prior Finder
46
+ projection, it may reuse, enrich, or create the accepted placement through
47
+ Product Area, Initiative, and Epic before placing those delivery items. Each
48
+ Story is a shippable product outcome. Each Task is atomic, independently
49
+ ownable, and understandable from its Story and stable specification.
50
+ 7. Return one stable Requirements result naming the retained specification and
51
+ its verified stable blob URL, plus the Write Backlog result and exact
52
+ residual delta. The result is ready for `delivery-phase` and `create-plan`.
20
53
 
21
54
  ## Boundary
22
55
 
23
- This phase does not create delivery backlog or implementation plans. After
24
- `spec-written`, its verified stable blob URL must exist before `write-backlog`
25
- may project the provider-neutral spec, followed by `delivery-phase` /
26
- `create-plan`.
56
+ Requirements Phase owns decision closure, compilation order, and authorization
57
+ of delivery-depth projection. `write-backlog` owns hierarchy derivation,
58
+ provider mechanics, mutation approval, and readback. Finder remains optional
59
+ context and owns no part of this workflow.
60
+
61
+ Grilling-child, specification, Story, and Task cardinality are outputs of the
62
+ accepted requirements and current evidence, never invocation prerequisites.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "channel": "stable",
4
- "version": "2026.08.27-b0c53c25",
5
- "tag": "baseline/stable/2026.08.27-b0c53c25",
6
- "commit": "b0c53c2552e3c0a1ab34519e7486a9bfe11d1fbb",
4
+ "version": "2026.09.04-b9bb213d",
5
+ "tag": "baseline/stable/2026.09.04-b9bb213d",
6
+ "commit": "b9bb213dc490753020501ef81f42978d1caee89e",
7
7
  "archive": "scaffold-baseline.tgz",
8
- "archiveSha256": "8e7cc1efabcc54407be899b6fcfa1f66f40e19f5a6b14434b4dd1c85642de748",
8
+ "archiveSha256": "a824ffce8e57bba81028f9dc5bbae307d3dde2fdc9fadbc4cec961842d3a8384",
9
9
  "compatibility": {
10
- "cliVersionRange": ">=4.0.2 <4.1.0"
10
+ "cliVersionRange": ">=4.0.4 <4.1.0"
11
11
  }
12
12
  }
Binary file
@@ -0,0 +1,21 @@
1
+ export interface ProviderLintSummary {
2
+ readonly diagnostics?: readonly unknown[];
3
+ readonly exhausted?: boolean;
4
+ readonly result?: string;
5
+ readonly status?: string;
6
+ }
7
+
8
+ export interface ProviderLintFeedback {
9
+ readonly decision: string;
10
+ readonly hookSpecificOutput: {
11
+ readonly additionalContext: string;
12
+ };
13
+ }
14
+
15
+ export declare const testHooks: {
16
+ readonly codexStateFilePath: (root: string, sessionId: string) => string;
17
+ readonly renderProviderFeedback: (
18
+ provider: string,
19
+ summary: ProviderLintSummary,
20
+ ) => ProviderLintFeedback;
21
+ };