@staff0rd/assist 0.643.2 → 0.643.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.
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.643.2",
9
+ version: "0.643.4",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -8853,16 +8853,21 @@ function buildReviewPhase() {
8853
8853
  };
8854
8854
  }
8855
8855
 
8856
+ // src/commands/backlog/appendReviewPhase.ts
8857
+ function appendReviewPhase(plan2) {
8858
+ if (plan2.at(-1)?.name === REVIEW_PHASE_NAME) return plan2;
8859
+ return [...plan2, buildReviewPhase()];
8860
+ }
8861
+
8856
8862
  // src/commands/backlog/runReview.ts
8857
8863
  async function runReview(item, fallbackPlan, spawnOptions) {
8858
8864
  const plan2 = await reloadPlan(item.id) ?? fallbackPlan;
8859
- const reviewPhase = buildReviewPhase();
8860
- const allPhases = [...plan2, reviewPhase];
8865
+ const allPhases = appendReviewPhase(plan2);
8861
8866
  let reviewOptions = spawnOptions;
8862
8867
  while (true) {
8863
8868
  const outcome = await executePhase(
8864
8869
  item,
8865
- plan2.length,
8870
+ allPhases.length - 1,
8866
8871
  allPhases,
8867
8872
  reviewOptions
8868
8873
  );
@@ -9297,6 +9302,9 @@ function printPhase(phase, index3, isCurrent, sessions) {
9297
9302
  printPhaseTasks(phase);
9298
9303
  printPhaseSessions(sessions);
9299
9304
  }
9305
+ function reviewPhaseIndex(plan2) {
9306
+ return plan2.at(-1)?.name === REVIEW_PHASE_NAME ? plan2.length - 1 : plan2.length;
9307
+ }
9300
9308
  function printReviewSessions(item, planLength) {
9301
9309
  const sessions = (item.phaseSessions ?? []).filter(
9302
9310
  (s) => s.phaseIdx >= planLength
@@ -9308,13 +9316,17 @@ function printReviewSessions(item, planLength) {
9308
9316
  }
9309
9317
  function printPlan(item) {
9310
9318
  if (!item.plan || item.plan.length === 0) return;
9319
+ const plan2 = item.plan;
9320
+ const reviewIdx = reviewPhaseIndex(plan2);
9311
9321
  console.log(chalk55.bold("Plan"));
9312
- for (const [i, phase] of item.plan.entries()) {
9322
+ for (const [i, phase] of plan2.entries()) {
9313
9323
  const isCurrent = item.currentPhase === i + 1;
9314
- const sessions = (item.phaseSessions ?? []).filter((s) => s.phaseIdx === i);
9324
+ const sessions = (item.phaseSessions ?? []).filter(
9325
+ (s) => i === reviewIdx ? s.phaseIdx >= i : s.phaseIdx === i
9326
+ );
9315
9327
  printPhase(phase, i, isCurrent, sessions);
9316
9328
  }
9317
- printReviewSessions(item, item.plan.length);
9329
+ if (reviewIdx === plan2.length) printReviewSessions(item, plan2.length);
9318
9330
  console.log();
9319
9331
  }
9320
9332
 
@@ -10198,7 +10210,7 @@ async function parseStarBody(req) {
10198
10210
 
10199
10211
  // src/commands/backlog/resolveRewindPlan.ts
10200
10212
  function resolveRewindPlan(item) {
10201
- return [...resolvePlan(item), buildReviewPhase()];
10213
+ return appendReviewPhase(resolvePlan(item));
10202
10214
  }
10203
10215
 
10204
10216
  // src/commands/backlog/web/withReviewPhase.ts
@@ -14831,7 +14843,10 @@ ${issues}`);
14831
14843
  // src/commands/backlog/propose/proposedItemSchema.ts
14832
14844
  import { z as z6 } from "zod";
14833
14845
  var proposedPhaseSchema = z6.strictObject({
14834
- name: z6.string().trim().min(1, "phase name is required"),
14846
+ name: z6.string().trim().min(1, "phase name is required").refine(
14847
+ (name) => name.toLowerCase() !== REVIEW_PHASE_NAME.toLowerCase(),
14848
+ `"${REVIEW_PHASE_NAME}" is owned by the runner and appended to every plan automatically \u2014 remove this phase`
14849
+ ),
14835
14850
  tasks: z6.array(z6.string().trim().min(1)).min(1, "a phase needs at least one task"),
14836
14851
  manualChecks: z6.array(z6.string().trim().min(1)).default([])
14837
14852
  });
@@ -14913,6 +14928,15 @@ async function propose(options2) {
14913
14928
  console.log(chalk82.green(`Added item ${formatItemId(id)}: ${item.name}`));
14914
14929
  }
14915
14930
 
14931
+ // src/commands/backlog/propose/proposeHelpText.ts
14932
+ var proposeHelpText = `The payload is strict JSON: { name, type, description?, acceptanceCriteria?, phases? }.
14933
+ Each phase is { name, tasks, manualChecks? } and needs at least one task.
14934
+
14935
+ The Review phase is owned by the runner and appended to every plan automatically,
14936
+ so it must not be authored: a phase named "Review" is rejected. Do not add a final
14937
+ phase for verifying acceptance criteria, confirming manual checks, committing or
14938
+ marking the item done \u2014 that is what the appended Review phase does.`;
14939
+
14916
14940
  // src/commands/backlog/registerItemCommands.ts
14917
14941
  function registerItemCommands(cmd) {
14918
14942
  cmd.command("list").alias("ls").description("List all backlog items").option(
@@ -14931,7 +14955,8 @@ function registerItemCommands(cmd) {
14931
14955
  ).option(
14932
14956
  "--confirmed",
14933
14957
  "Create the item after its draft has been reviewed in chat (agent use outside a web session)"
14934
- ).action(propose);
14958
+ ).addHelpText("after", `
14959
+ ${proposeHelpText}`).action(propose);
14935
14960
  cmd.command("add-phase <id> <name>").description("Add a phase to an existing backlog item").option("--task <task...>", "Task description (repeatable)").option(
14936
14961
  "--manual-check <check...>",
14937
14962
  "Manual check description (repeatable)"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.643.2",
3
+ "version": "0.643.4",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {