@quolu/lattice 0.85.0 → 0.85.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.
- package/bin/lattice.mjs +31 -16
- package/docs/schemas/lattice.plan_create_input.v4.schema.json +1 -1
- package/docs/schemas/lattice.plan_create_input.v5.schema.json +1 -1
- package/package.json +1 -1
- package/src/cli-help.mjs +21 -14
- package/src/cli-refusal-guidance.mjs +54 -2
- package/src/hooks-cli.mjs +4 -1
- package/src/plan-backchain.mjs +48 -8
- package/src/plan-scope-review.mjs +3 -2
- package/src/project-cli.mjs +103 -12
- package/src/runtime-cli.mjs +4 -1
- package/src/sensor-cli.mjs +8 -2
- package/src/sensor-diff.mjs +8 -0
- package/src/setup-cli.mjs +6 -2
- package/src/todo-authoring-input.mjs +14 -6
- package/src/todo-cli.mjs +284 -136
- package/src/todo-readiness.mjs +13 -3
package/src/todo-readiness.mjs
CHANGED
|
@@ -118,9 +118,13 @@ export function createTodoReadiness(store) {
|
|
|
118
118
|
return node?.schema !== 'lattice.todo_plan.v4' || node.phase_status === 'active';
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
/** a28: the successors that already left pending, sorted, so a refusal can name them. */
|
|
122
|
+
function startedSuccessors(key) {
|
|
123
|
+
return [...(outgoing.get(key) ?? [])].map((successor) => nodes.get(successor))
|
|
124
|
+
.filter((node) => node !== undefined && node.status !== 'pending')
|
|
125
|
+
.map(({ plan_key, task_id, status }) => ({ plan_key, task_id, status })).sort(byRef);
|
|
123
126
|
}
|
|
127
|
+
const startedSuccessor = (key) => startedSuccessors(key).length > 0;
|
|
124
128
|
|
|
125
129
|
return {
|
|
126
130
|
key: taskKey,
|
|
@@ -131,6 +135,7 @@ export function createTodoReadiness(store) {
|
|
|
131
135
|
isReady: (key) => nodes.get(key)?.status === 'pending'
|
|
132
136
|
&& ownPhaseReady(key) && prerequisites(key).dependenciesDone,
|
|
133
137
|
startedSuccessor,
|
|
138
|
+
startedSuccessors,
|
|
134
139
|
phaseHasStartedSuccessor: (member, phaseId) => member.plan.schema === 'lattice.todo_plan.v4'
|
|
135
140
|
? member.plan.tasks.filter(({ phase_id }) => phase_id === phaseId)
|
|
136
141
|
.some((task) => startedSuccessor(taskKey({ ...member.plan, ...task })))
|
|
@@ -173,8 +178,13 @@ export function validateProspectiveEvent({ store, member, event }) {
|
|
|
173
178
|
return refused('invalid_done_transition', prerequisites.cause, prerequisites.blocking);
|
|
174
179
|
}
|
|
175
180
|
if (event.kind === 'reopen' && event.payload.override_reason === null && readiness.startedSuccessor(key)) {
|
|
181
|
+
const started = readiness.startedSuccessors(key);
|
|
182
|
+
const on = `--plan ${member.plan.plan_key} --task ${event.task_id}`;
|
|
176
183
|
return refused('reopen_has_started_successor', 'task_state', {
|
|
177
|
-
|
|
184
|
+
started_successors: started,
|
|
185
|
+
next_action: `${started.map((task) => `${task.plan_key}/${task.task_id} (${task.status})`).join(', ')}`
|
|
186
|
+
+ ` already left pending after ${member.plan.plan_key}/${event.task_id}; to reopen it anyway run`
|
|
187
|
+
+ ` \`lattice todo reopen ${on} --reason <text> --override-reason <text>\`.`,
|
|
178
188
|
});
|
|
179
189
|
}
|
|
180
190
|
if (event.kind === 'phase_reopen' && event.payload.override_reason === null
|