@staff0rd/assist 0.452.0 → 0.453.1

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.452.0",
9
+ version: "0.453.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -7178,7 +7178,8 @@ var KNOWN = [
7178
7178
  "bug",
7179
7179
  "refine",
7180
7180
  "review",
7181
- "run"
7181
+ "run",
7182
+ "update"
7182
7183
  ];
7183
7184
  function deriveHistoryFields(commandName, commandArgs, name) {
7184
7185
  const fields = {};
@@ -11323,6 +11324,11 @@ function registerImportCommand(cmd) {
11323
11324
  // src/commands/backlog/add/index.ts
11324
11325
  import chalk74 from "chalk";
11325
11326
 
11327
+ // src/lib/isClaudeCode.ts
11328
+ function isClaudeCode() {
11329
+ return process.env.CLAUDECODE !== void 0;
11330
+ }
11331
+
11326
11332
  // src/commands/backlog/insertPhaseAt.ts
11327
11333
  import { eq as eq23 } from "drizzle-orm";
11328
11334
 
@@ -11489,6 +11495,15 @@ async function promptAcceptanceCriteria() {
11489
11495
 
11490
11496
  // src/commands/backlog/add/index.ts
11491
11497
  async function add(options2) {
11498
+ if (isClaudeCode()) {
11499
+ console.error(
11500
+ chalk74.red(
11501
+ "Error: 'assist backlog add' is for human use. Compose the whole item \u2014 name, type, description, acceptance criteria and every phase \u2014 and run 'assist backlog propose --json <file|->' so it is previewed and approved before anything is written."
11502
+ )
11503
+ );
11504
+ process.exitCode = 1;
11505
+ return;
11506
+ }
11492
11507
  if (!ensureRemoteOrigin()) return;
11493
11508
  const type = options2.type ?? await promptType();
11494
11509
  const name = options2.name ?? await promptName();
@@ -11503,7 +11518,7 @@ async function add(options2) {
11503
11518
  console.log(chalk74.green(`Added item ${formatItemId(id)}: ${name}`));
11504
11519
  }
11505
11520
 
11506
- // src/commands/backlog/addPhase.ts
11521
+ // src/commands/backlog/addPhase/index.ts
11507
11522
  import chalk76 from "chalk";
11508
11523
 
11509
11524
  // src/commands/backlog/resolveInsertPosition.ts
@@ -11526,76 +11541,8 @@ async function resolveInsertPosition(orm, itemId2, position) {
11526
11541
  return pos - 1;
11527
11542
  }
11528
11543
 
11529
- // src/commands/backlog/addPhase.ts
11530
- async function addPhase(id, name, options2) {
11531
- if (!ensureRemoteOrigin()) return;
11532
- const found = await findOneItem(id);
11533
- if (!found) return;
11534
- const tasks = options2.task ?? [];
11535
- if (tasks.length === 0) {
11536
- console.log(chalk76.red("At least one --task is required."));
11537
- process.exitCode = 1;
11538
- return;
11539
- }
11540
- const { orm } = found;
11541
- const itemId2 = found.item.id;
11542
- const phaseIdx = await resolveInsertPosition(orm, itemId2, options2.position);
11543
- if (phaseIdx === void 0) return;
11544
- await insertPhaseAt(
11545
- orm,
11546
- itemId2,
11547
- phaseIdx,
11548
- name,
11549
- tasks,
11550
- serializeManualChecks(options2.manualCheck),
11551
- found.item.currentPhase
11552
- );
11553
- const verb = options2.position !== void 0 ? "Inserted" : "Added";
11554
- console.log(
11555
- chalk76.green(
11556
- `${verb} phase ${phaseIdx + 1} "${name}" to item ${formatItemId(itemId2)} with ${tasks.length} task(s).`
11557
- )
11558
- );
11559
- }
11560
-
11561
- // src/commands/backlog/list/index.ts
11562
- import chalk77 from "chalk";
11563
- function filterItems(items2, options2) {
11564
- if (options2.status) return items2.filter((i) => i.status === options2.status);
11565
- if (!options2.all)
11566
- return items2.filter((i) => i.status !== "done" && i.status !== "wontdo");
11567
- return items2;
11568
- }
11569
- function repoPrefixer(items2, allRepos) {
11570
- if (!allRepos) return () => "";
11571
- const labels = originDisplayLabels(
11572
- items2.flatMap((i) => i.origin ? [i.origin] : [])
11573
- );
11574
- const repoNameOf = (item) => item.origin ? labels.get(item.origin) ?? "" : "";
11575
- const width = Math.max(0, ...items2.map((i) => repoNameOf(i).length));
11576
- return (item) => `${chalk77.dim(repoNameOf(item).padEnd(width))} `;
11577
- }
11578
- async function list2(options2) {
11579
- const allItems = await loadBacklog(options2.allRepos);
11580
- const items2 = filterItems(allItems, options2);
11581
- if (items2.length === 0) {
11582
- console.log(chalk77.dim("Backlog is empty."));
11583
- return;
11584
- }
11585
- const prefixOf = repoPrefixer(items2, !!options2.allRepos);
11586
- for (const item of items2) {
11587
- console.log(
11588
- `${prefixOf(item)}${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk77.dim(formatItemId(item.id))} ${starMarker(item)}${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
11589
- );
11590
- if (options2.verbose) {
11591
- printVerboseDetails(item);
11592
- }
11593
- }
11594
- }
11595
-
11596
- // src/commands/backlog/propose/index.ts
11544
+ // src/commands/backlog/addPhase/reviewProposedPhase.ts
11597
11545
  import { randomUUID as randomUUID2 } from "crypto";
11598
- import chalk79 from "chalk";
11599
11546
 
11600
11547
  // src/commands/sessions/shared/reportPreviewRejection.ts
11601
11548
  function reportPreviewRejection(subject, decision) {
@@ -11687,6 +11634,113 @@ async function awaitPreviewApproval(subject, request) {
11687
11634
  return decision;
11688
11635
  }
11689
11636
 
11637
+ // src/commands/backlog/renderPhaseSection.ts
11638
+ function renderPhaseSection(phase, idx) {
11639
+ const parts = [
11640
+ `### Phase ${idx + 1}: ${phase.name}`,
11641
+ phase.tasks.map((task) => `- ${task}`).join("\n")
11642
+ ];
11643
+ const manualChecks = phase.manualChecks ?? [];
11644
+ if (manualChecks.length > 0)
11645
+ parts.push(
11646
+ "**Manual checks:**",
11647
+ manualChecks.map((check2) => `- ${check2}`).join("\n")
11648
+ );
11649
+ return parts.join("\n\n");
11650
+ }
11651
+
11652
+ // src/commands/backlog/addPhase/reviewProposedPhase.ts
11653
+ async function reviewProposedPhase(item, phaseIdx, phase) {
11654
+ const sessionId = process.env.ASSIST_SESSION_ID;
11655
+ if (!isClaudeCode() || process.env.ASSIST_SESSION !== "1" || !sessionId)
11656
+ return;
11657
+ await awaitPreviewApproval("Backlog phase preview", {
11658
+ sessionId,
11659
+ requestId: randomUUID2(),
11660
+ title: `Add a phase to ${formatItemId(item.id)}: ${item.name}`,
11661
+ body: renderPhaseSection(phase, phaseIdx),
11662
+ prNumber: null,
11663
+ kind: "backlog-item",
11664
+ itemType: item.type
11665
+ });
11666
+ }
11667
+
11668
+ // src/commands/backlog/addPhase/index.ts
11669
+ async function addPhase(id, name, options2) {
11670
+ if (!ensureRemoteOrigin()) return;
11671
+ const found = await findOneItem(id);
11672
+ if (!found) return;
11673
+ const tasks = options2.task ?? [];
11674
+ if (tasks.length === 0) {
11675
+ console.log(chalk76.red("At least one --task is required."));
11676
+ process.exitCode = 1;
11677
+ return;
11678
+ }
11679
+ const { orm } = found;
11680
+ const itemId2 = found.item.id;
11681
+ const phaseIdx = await resolveInsertPosition(orm, itemId2, options2.position);
11682
+ if (phaseIdx === void 0) return;
11683
+ await reviewProposedPhase(found.item, phaseIdx, {
11684
+ name,
11685
+ tasks,
11686
+ manualChecks: options2.manualCheck
11687
+ });
11688
+ await insertPhaseAt(
11689
+ orm,
11690
+ itemId2,
11691
+ phaseIdx,
11692
+ name,
11693
+ tasks,
11694
+ serializeManualChecks(options2.manualCheck),
11695
+ found.item.currentPhase
11696
+ );
11697
+ const verb = options2.position !== void 0 ? "Inserted" : "Added";
11698
+ console.log(
11699
+ chalk76.green(
11700
+ `${verb} phase ${phaseIdx + 1} "${name}" to item ${formatItemId(itemId2)} with ${tasks.length} task(s).`
11701
+ )
11702
+ );
11703
+ }
11704
+
11705
+ // src/commands/backlog/list/index.ts
11706
+ import chalk77 from "chalk";
11707
+ function filterItems(items2, options2) {
11708
+ if (options2.status) return items2.filter((i) => i.status === options2.status);
11709
+ if (!options2.all)
11710
+ return items2.filter((i) => i.status !== "done" && i.status !== "wontdo");
11711
+ return items2;
11712
+ }
11713
+ function repoPrefixer(items2, allRepos) {
11714
+ if (!allRepos) return () => "";
11715
+ const labels = originDisplayLabels(
11716
+ items2.flatMap((i) => i.origin ? [i.origin] : [])
11717
+ );
11718
+ const repoNameOf = (item) => item.origin ? labels.get(item.origin) ?? "" : "";
11719
+ const width = Math.max(0, ...items2.map((i) => repoNameOf(i).length));
11720
+ return (item) => `${chalk77.dim(repoNameOf(item).padEnd(width))} `;
11721
+ }
11722
+ async function list2(options2) {
11723
+ const allItems = await loadBacklog(options2.allRepos);
11724
+ const items2 = filterItems(allItems, options2);
11725
+ if (items2.length === 0) {
11726
+ console.log(chalk77.dim("Backlog is empty."));
11727
+ return;
11728
+ }
11729
+ const prefixOf = repoPrefixer(items2, !!options2.allRepos);
11730
+ for (const item of items2) {
11731
+ console.log(
11732
+ `${prefixOf(item)}${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk77.dim(formatItemId(item.id))} ${starMarker(item)}${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
11733
+ );
11734
+ if (options2.verbose) {
11735
+ printVerboseDetails(item);
11736
+ }
11737
+ }
11738
+ }
11739
+
11740
+ // src/commands/backlog/propose/index.ts
11741
+ import { randomUUID as randomUUID3 } from "crypto";
11742
+ import chalk79 from "chalk";
11743
+
11690
11744
  // src/commands/backlog/propose/readProposedItem.ts
11691
11745
  import { readFileSync as readFileSync23 } from "fs";
11692
11746
  import chalk78 from "chalk";
@@ -11742,18 +11796,6 @@ ${issues}`);
11742
11796
  }
11743
11797
 
11744
11798
  // src/commands/backlog/propose/renderProposedItem.ts
11745
- function renderPhase(phase, i) {
11746
- const parts = [
11747
- `### Phase ${i + 1}: ${phase.name}`,
11748
- phase.tasks.map((task) => `- ${task}`).join("\n")
11749
- ];
11750
- if (phase.manualChecks.length > 0)
11751
- parts.push(
11752
- "**Manual checks:**",
11753
- phase.manualChecks.map((check2) => `- ${check2}`).join("\n")
11754
- );
11755
- return parts.join("\n\n");
11756
- }
11757
11799
  function renderProposedItem(item) {
11758
11800
  const sections = [`**Type:** ${item.type}`];
11759
11801
  if (item.description) sections.push("## Description", item.description);
@@ -11763,7 +11805,7 @@ function renderProposedItem(item) {
11763
11805
  item.acceptanceCriteria.map((ac, i) => `${i + 1}. ${ac}`).join("\n")
11764
11806
  );
11765
11807
  if (item.phases.length > 0)
11766
- sections.push("## Plan", ...item.phases.map(renderPhase));
11808
+ sections.push("## Plan", ...item.phases.map(renderPhaseSection));
11767
11809
  return sections.join("\n\n");
11768
11810
  }
11769
11811
 
@@ -11774,7 +11816,7 @@ async function reviewProposal(item) {
11774
11816
  if (process.env.ASSIST_SESSION === "1" && sessionId) {
11775
11817
  await awaitPreviewApproval("Backlog item preview", {
11776
11818
  sessionId,
11777
- requestId: randomUUID2(),
11819
+ requestId: randomUUID3(),
11778
11820
  title: item.name,
11779
11821
  body,
11780
11822
  prNumber: null,
@@ -12047,7 +12089,7 @@ import chalk87 from "chalk";
12047
12089
  import enquirer7 from "enquirer";
12048
12090
 
12049
12091
  // src/commands/backlog/launchMode.ts
12050
- import { randomUUID as randomUUID3 } from "crypto";
12092
+ import { randomUUID as randomUUID4 } from "crypto";
12051
12093
 
12052
12094
  // src/shared/spawnCodex.ts
12053
12095
  function spawnCodex(prompt, options2 = {}) {
@@ -12168,7 +12210,7 @@ async function launchMode(slashCommand, options2) {
12168
12210
  const resumeSessionId = options2?.resumeSessionId;
12169
12211
  if (!resumeSessionId) pullIfConfigured();
12170
12212
  process.env.ASSIST_SESSION_ID ??= String(process.pid);
12171
- const claudeSessionId = resumeSessionId ?? randomUUID3();
12213
+ const claudeSessionId = resumeSessionId ?? randomUUID4();
12172
12214
  emitActivity({
12173
12215
  kind: "command",
12174
12216
  name: slashCommand,
@@ -13950,11 +13992,6 @@ function colorize(plainOutput) {
13950
13992
  }).join("\n");
13951
13993
  }
13952
13994
 
13953
- // src/lib/isClaudeCode.ts
13954
- function isClaudeCode() {
13955
- return process.env.CLAUDECODE !== void 0;
13956
- }
13957
-
13958
13995
  // src/commands/permitCliReads/mapAsync.ts
13959
13996
  async function mapAsync(items2, concurrency, fn) {
13960
13997
  const results = Array.from({ length: items2.length });
@@ -17641,7 +17678,7 @@ function registerRefineLaunch(program2, resumeFlag) {
17641
17678
  }
17642
17679
 
17643
17680
  // src/commands/reviewPrComments.ts
17644
- import { randomUUID as randomUUID4 } from "crypto";
17681
+ import { randomUUID as randomUUID5 } from "crypto";
17645
17682
 
17646
17683
  // src/commands/review/checkoutPr.ts
17647
17684
  import { execFileSync as execFileSync6 } from "child_process";
@@ -18029,7 +18066,7 @@ async function checkoutPr(number) {
18029
18066
  // src/commands/reviewPrComments.ts
18030
18067
  async function reviewPrComments(number) {
18031
18068
  if (number) await checkoutPr(number);
18032
- const claudeSessionId = randomUUID4();
18069
+ const claudeSessionId = randomUUID5();
18033
18070
  emitActivity({
18034
18071
  kind: "command",
18035
18072
  name: "review-pr-comments",
@@ -19885,7 +19922,7 @@ async function placePr(prNumber, title, body, options2) {
19885
19922
  }
19886
19923
 
19887
19924
  // src/commands/prs/previewAndPlace.ts
19888
- import { randomUUID as randomUUID5 } from "crypto";
19925
+ import { randomUUID as randomUUID6 } from "crypto";
19889
19926
 
19890
19927
  // src/commands/prs/appendScreenshots.ts
19891
19928
  function appendScreenshots(body, screenshots) {
@@ -19901,7 +19938,7 @@ ${screenshots.join("\n\n")}`;
19901
19938
  async function previewAndPlace(args) {
19902
19939
  const decision = await awaitPreviewApproval("PR preview", {
19903
19940
  sessionId: args.sessionId,
19904
- requestId: randomUUID5(),
19941
+ requestId: randomUUID6(),
19905
19942
  title: args.title,
19906
19943
  body: args.body,
19907
19944
  prNumber: args.prNumber
@@ -26730,7 +26767,7 @@ var ClientHub = class extends Set {
26730
26767
  };
26731
26768
 
26732
26769
  // src/commands/sessions/daemon/createSession.ts
26733
- import { randomUUID as randomUUID6 } from "crypto";
26770
+ import { randomUUID as randomUUID7 } from "crypto";
26734
26771
 
26735
26772
  // src/commands/sessions/daemon/resolveRunConfig.ts
26736
26773
  function resolveRunConfig(name, cwd) {
@@ -26869,7 +26906,7 @@ function sessionBase(id, status3) {
26869
26906
  // src/commands/sessions/daemon/createSession.ts
26870
26907
  function createSession(id, prompt, cwd, design, harness, holdPty) {
26871
26908
  if (harness === "pi") return createPiSession(id, prompt, cwd, holdPty);
26872
- const claudeSessionId = randomUUID6();
26909
+ const claudeSessionId = randomUUID7();
26873
26910
  return {
26874
26911
  ...sessionBase(id, prompt ? "running" : "waiting"),
26875
26912
  name: prompt?.slice(0, 40) || `Session ${id}`,
@@ -28185,7 +28222,7 @@ function respawnSession(session, respawn, status3, clients, onStatusChange) {
28185
28222
  }
28186
28223
 
28187
28224
  // src/commands/sessions/daemon/respawnPlan.ts
28188
- import { randomUUID as randomUUID7 } from "crypto";
28225
+ import { randomUUID as randomUUID8 } from "crypto";
28189
28226
 
28190
28227
  // src/commands/sessions/daemon/assistResumeArgs.ts
28191
28228
  function assistResumeArgs(session) {
@@ -28226,7 +28263,7 @@ function respawnPlan(session) {
28226
28263
  return null;
28227
28264
  }
28228
28265
  function freshClaudePlan(session, prompt, cwd) {
28229
- const claudeSessionId = randomUUID7();
28266
+ const claudeSessionId = randomUUID8();
28230
28267
  return {
28231
28268
  spawn: () => {
28232
28269
  session.claudeSessionId = claudeSessionId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.452.0",
3
+ "version": "0.453.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {