@staff0rd/assist 0.193.0 → 0.194.0

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.193.0",
9
+ version: "0.194.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -792,6 +792,7 @@ function buildAuthoredPhasePrompt(item, phaseNumber, phase) {
792
792
  ...buildContextLines(item, phaseNumber, phase),
793
793
  "",
794
794
  "Focus ONLY on this phase. Do not work on other phases.",
795
+ "If you need to modify backlog items, run `assist backlog --help` to discover available commands.",
795
796
  "When you have completed all tasks for this phase, run /verify to check your work.",
796
797
  ...buildManualCheckLines(manualChecks),
797
798
  "",
@@ -842,12 +843,14 @@ function buildReviewPrompt(item, phaseNumber) {
842
843
  item.description ? `Description: ${item.description}` : "",
843
844
  "",
844
845
  "This is the auto-generated review phase. Verify each acceptance criterion against the current implementation.",
846
+ "If you need to modify backlog items, run `assist backlog --help` to discover available commands.",
845
847
  "For each criterion, inspect the code and report PASS or FAIL with a brief explanation:",
846
848
  "",
847
849
  acLines,
848
850
  ...buildCommentLines(item.comments),
849
851
  "",
850
- "If any criterion fails, fix the issue and re-verify before proceeding.",
852
+ "If any criterion fails, fix the issue and re-verify.",
853
+ `If a criterion still fails after fixing, use \`assist backlog rewind ${item.id} <phase> --reason "<reason>"\` to return to the appropriate phase instead of using phase-done.`,
851
854
  "",
852
855
  `Post concise comments for any notable findings or changes using \`assist backlog comment ${item.id} "<text>"\`.`,
853
856
  "",
@@ -12443,6 +12446,45 @@ var routes3 = {
12443
12446
  var handleRequest3 = createFallbackHandler(routes3, htmlHandler2);
12444
12447
 
12445
12448
  // src/commands/sessions/web/handleSocket.ts
12449
+ function dispatch(ws, manager, data) {
12450
+ switch (data.type) {
12451
+ case "create": {
12452
+ const id = manager.spawn(
12453
+ data.prompt,
12454
+ data.cwd
12455
+ );
12456
+ ws.send(JSON.stringify({ type: "created", sessionId: id }));
12457
+ break;
12458
+ }
12459
+ case "input":
12460
+ manager.writeToSession(data.sessionId, data.data);
12461
+ break;
12462
+ case "resize":
12463
+ manager.resizeSession(
12464
+ data.sessionId,
12465
+ data.cols,
12466
+ data.rows
12467
+ );
12468
+ break;
12469
+ case "resume": {
12470
+ const id = manager.resume(
12471
+ data.sessionId,
12472
+ data.cwd,
12473
+ data.name
12474
+ );
12475
+ ws.send(JSON.stringify({ type: "created", sessionId: id }));
12476
+ break;
12477
+ }
12478
+ case "dismiss":
12479
+ manager.dismissSession(data.sessionId);
12480
+ break;
12481
+ case "history":
12482
+ manager.getHistory().then((history) => {
12483
+ ws.send(JSON.stringify({ type: "history", sessions: history }));
12484
+ });
12485
+ break;
12486
+ }
12487
+ }
12446
12488
  function handleSocket(ws, manager) {
12447
12489
  manager.addClient(ws);
12448
12490
  ws.on("message", (msg) => {
@@ -12452,40 +12494,7 @@ function handleSocket(ws, manager) {
12452
12494
  } catch {
12453
12495
  return;
12454
12496
  }
12455
- switch (data.type) {
12456
- case "create": {
12457
- const id = manager.spawn(data.prompt);
12458
- ws.send(JSON.stringify({ type: "created", sessionId: id }));
12459
- break;
12460
- }
12461
- case "input":
12462
- manager.writeToSession(data.sessionId, data.data);
12463
- break;
12464
- case "resize":
12465
- manager.resizeSession(
12466
- data.sessionId,
12467
- data.cols,
12468
- data.rows
12469
- );
12470
- break;
12471
- case "resume": {
12472
- const id = manager.resume(
12473
- data.sessionId,
12474
- data.cwd,
12475
- data.name
12476
- );
12477
- ws.send(JSON.stringify({ type: "created", sessionId: id }));
12478
- break;
12479
- }
12480
- case "dismiss":
12481
- manager.dismissSession(data.sessionId);
12482
- break;
12483
- case "history":
12484
- manager.getHistory().then((history) => {
12485
- ws.send(JSON.stringify({ type: "history", sessions: history }));
12486
- });
12487
- break;
12488
- }
12497
+ dispatch(ws, manager, data);
12489
12498
  });
12490
12499
  ws.on("close", () => {
12491
12500
  manager.removeClient(ws);
@@ -12517,13 +12526,13 @@ function shellEscape(s) {
12517
12526
  }
12518
12527
 
12519
12528
  // src/commands/sessions/web/createSession.ts
12520
- function createSession(id, prompt) {
12529
+ function createSession(id, prompt, cwd) {
12521
12530
  return {
12522
12531
  id,
12523
12532
  name: prompt?.slice(0, 40) || `Session ${id}`,
12524
12533
  status: "running",
12525
12534
  startedAt: Date.now(),
12526
- pty: spawnClaude2({ prompt }),
12535
+ pty: spawnClaude2({ prompt, cwd }),
12527
12536
  scrollback: "",
12528
12537
  idleTimer: null,
12529
12538
  lastResizeAt: 0
@@ -12699,14 +12708,47 @@ function wirePtyEvents(session, clients, onStatusChange) {
12699
12708
  });
12700
12709
  }
12701
12710
 
12711
+ // src/commands/sessions/web/writeToSession.ts
12712
+ function writeToSession(sessions, id, data) {
12713
+ const s = sessions.get(id);
12714
+ if (s && s.status !== "done") s.pty.write(data);
12715
+ }
12716
+ function resizeSession(sessions, id, cols, rows) {
12717
+ const s = sessions.get(id);
12718
+ if (s && s.status !== "done") {
12719
+ s.lastResizeAt = Date.now();
12720
+ s.pty.resize(cols, rows);
12721
+ }
12722
+ }
12723
+ function dismissSession(sessions, id) {
12724
+ const s = sessions.get(id);
12725
+ if (!s) return false;
12726
+ if (s.status !== "done") s.pty.kill();
12727
+ clearIdle(s);
12728
+ sessions.delete(id);
12729
+ return true;
12730
+ }
12731
+
12702
12732
  // src/commands/sessions/web/SessionManager.ts
12703
12733
  var SessionManager = class {
12704
12734
  sessions = /* @__PURE__ */ new Map();
12705
12735
  clients = /* @__PURE__ */ new Set();
12706
12736
  nextId = 1;
12737
+ repoCwd;
12738
+ constructor() {
12739
+ const cwd = process.cwd();
12740
+ this.repoCwd = isGitRepo(cwd) ? cwd : void 0;
12741
+ }
12707
12742
  addClient(ws) {
12708
12743
  this.clients.add(ws);
12709
- wsSend(ws, { type: "sessions", sessions: this.listSessions() });
12744
+ wsSend(ws, {
12745
+ type: "sessions",
12746
+ cwd: this.repoCwd,
12747
+ sessions: this.listSessions()
12748
+ });
12749
+ this.replayScrollback(ws);
12750
+ }
12751
+ replayScrollback(ws) {
12710
12752
  for (const s of this.sessions.values()) {
12711
12753
  if (s.scrollback)
12712
12754
  wsSend(ws, { type: "output", sessionId: s.id, data: s.scrollback });
@@ -12715,9 +12757,9 @@ var SessionManager = class {
12715
12757
  removeClient(ws) {
12716
12758
  this.clients.delete(ws);
12717
12759
  }
12718
- spawn(prompt) {
12760
+ spawn(prompt, cwd) {
12719
12761
  const id = String(this.nextId++);
12720
- const session = createSession(id, prompt);
12762
+ const session = createSession(id, prompt, cwd);
12721
12763
  this.wire(session);
12722
12764
  return id;
12723
12765
  }
@@ -12740,23 +12782,13 @@ var SessionManager = class {
12740
12782
  this.notify();
12741
12783
  }
12742
12784
  writeToSession(id, data) {
12743
- const s = this.sessions.get(id);
12744
- if (s && s.status !== "done") s.pty.write(data);
12785
+ writeToSession(this.sessions, id, data);
12745
12786
  }
12746
12787
  resizeSession(id, cols, rows) {
12747
- const s = this.sessions.get(id);
12748
- if (s && s.status !== "done") {
12749
- s.lastResizeAt = Date.now();
12750
- s.pty.resize(cols, rows);
12751
- }
12788
+ resizeSession(this.sessions, id, cols, rows);
12752
12789
  }
12753
12790
  dismissSession(id) {
12754
- const s = this.sessions.get(id);
12755
- if (!s) return;
12756
- if (s.status !== "done") s.pty.kill();
12757
- clearIdle(s);
12758
- this.sessions.delete(id);
12759
- this.notify();
12791
+ if (dismissSession(this.sessions, id)) this.notify();
12760
12792
  }
12761
12793
  listSessions() {
12762
12794
  return [...this.sessions.values()].map(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.193.0",
3
+ "version": "0.194.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {