@staff0rd/assist 0.812.0 → 0.813.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.812.0",
9
+ version: "0.813.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -3290,6 +3290,7 @@ function toPreviewDecision(msg) {
3290
3290
  announceAfter: msg.announceAfter === true,
3291
3291
  draft: typeof msg.draft === "boolean" ? msg.draft : void 0,
3292
3292
  autoMerge: msg.autoMerge === true,
3293
+ autostart: msg.autostart === true,
3293
3294
  selection: toSelection(msg.selection),
3294
3295
  checklist: toChecklist(msg.checklist)
3295
3296
  };
@@ -7133,27 +7134,101 @@ function renderProposedItem(item) {
7133
7134
  async function reviewProposal(item, sessionId, confirmed) {
7134
7135
  const body = renderProposedItem(item);
7135
7136
  if (sessionId) {
7136
- await awaitPreviewApproval("Backlog item preview", {
7137
+ const decision = await awaitPreviewApproval("Backlog item preview", {
7137
7138
  sessionId,
7138
7139
  requestId: randomUUID4(),
7139
7140
  title: item.name,
7140
7141
  body,
7141
7142
  prNumber: null,
7142
7143
  kind: "backlog-item",
7143
- itemType: item.type
7144
+ itemType: item.type,
7145
+ canStart: true
7144
7146
  });
7145
- return true;
7147
+ return { autostart: decision.autostart === true };
7146
7148
  }
7147
- if (isClaudeCode() && confirmed) return true;
7149
+ if (isClaudeCode() && confirmed) return { autostart: false };
7148
7150
  console.log(chalk53.bold(item.name));
7149
7151
  console.log(renderMarkdownTerminal(body));
7150
- if (!isClaudeCode()) return true;
7152
+ if (!isClaudeCode()) return { autostart: false };
7151
7153
  console.log(
7152
7154
  chalk53.yellow(
7153
7155
  "Draft only \u2014 nothing was written to the backlog. Show this draft in the chat, apply any changes the user asks for, then re-run 'assist backlog propose --json <file|->' with --confirmed to create the item."
7154
7156
  )
7155
7157
  );
7156
- return false;
7158
+ return null;
7159
+ }
7160
+
7161
+ // src/commands/review/startChainedSession.ts
7162
+ async function startChainedSession(label2, start2) {
7163
+ if (process.env.ASSIST_SESSION !== "1") return;
7164
+ try {
7165
+ await start2();
7166
+ console.log(`Started ${label2}.`);
7167
+ } catch (error) {
7168
+ console.error(
7169
+ `Warning: could not start ${label2}: ${error instanceof Error ? error.message : String(error)}`
7170
+ );
7171
+ }
7172
+ }
7173
+
7174
+ // src/commands/sessions/shared/requestSession.ts
7175
+ function parseIncoming(line, type) {
7176
+ try {
7177
+ const msg = JSON.parse(line);
7178
+ if (msg.type === "error" && (msg.message ?? "").includes(type))
7179
+ return { kind: "error", message: msg.message ?? `${type} failed` };
7180
+ if (msg.type !== "created" || !msg.sessionId) return null;
7181
+ return { kind: "created", sessionId: msg.sessionId };
7182
+ } catch {
7183
+ return null;
7184
+ }
7185
+ }
7186
+ function requestSession(message3) {
7187
+ return new Promise((resolve30, reject) => {
7188
+ connectToDaemon().then((socket) => {
7189
+ let settled = false;
7190
+ const finish2 = (error, sessionId) => {
7191
+ if (settled) return;
7192
+ settled = true;
7193
+ socket.destroy();
7194
+ if (error) reject(error);
7195
+ else resolve30(sessionId);
7196
+ };
7197
+ readSocketLines(socket, (line) => {
7198
+ const incoming = parseIncoming(line, message3.type);
7199
+ if (!incoming) return;
7200
+ if (incoming.kind === "error") finish2(new Error(incoming.message));
7201
+ else finish2(void 0, incoming.sessionId);
7202
+ });
7203
+ socket.on("error", (error) => finish2(error));
7204
+ socket.on(
7205
+ "close",
7206
+ () => finish2(new Error("daemon closed before the session was created"))
7207
+ );
7208
+ socket.write(`${JSON.stringify(message3)}
7209
+ `);
7210
+ }, reject);
7211
+ });
7212
+ }
7213
+
7214
+ // src/commands/sessions/shared/requestAssistSession.ts
7215
+ function requestAssistSession(assistArgs, cwd, options2) {
7216
+ return requestSession({
7217
+ type: "create-assist",
7218
+ assistArgs,
7219
+ cwd,
7220
+ inPlace: options2?.inPlace === true,
7221
+ launchedFrom: options2?.launchedFrom ?? process.env.ASSIST_SESSION_ID
7222
+ });
7223
+ }
7224
+
7225
+ // src/commands/backlog/propose/startProposedRun.ts
7226
+ function startProposedRun(id) {
7227
+ const itemId2 = formatItemId(id);
7228
+ return startChainedSession(
7229
+ `a backlog run session for ${itemId2}`,
7230
+ () => requestAssistSession(["backlog", "run", itemId2], process.cwd())
7231
+ );
7157
7232
  }
7158
7233
 
7159
7234
  // src/commands/backlog/propose.ts
@@ -7170,10 +7245,15 @@ async function propose(options2) {
7170
7245
  return;
7171
7246
  }
7172
7247
  const item = await readProposedItem(options2.json);
7173
- if (!await reviewProposal(item, sessionId, options2.confirmed === true))
7174
- return;
7248
+ const approval = await reviewProposal(
7249
+ item,
7250
+ sessionId,
7251
+ options2.confirmed === true
7252
+ );
7253
+ if (!approval) return;
7175
7254
  const id = await createItemWithDefaults(item);
7176
7255
  console.log(chalk54.green(`Added item ${formatItemId(id)}: ${item.name}`));
7256
+ if (approval.autostart) await startProposedRun(id);
7177
7257
  }
7178
7258
 
7179
7259
  // src/commands/backlog/propose/proposeHelpText.ts
@@ -25295,11 +25375,15 @@ function collectLabels(value, previous) {
25295
25375
 
25296
25376
  // src/commands/prs/renderScreenshotBlock.ts
25297
25377
  import { extname as extname3 } from "path";
25298
- var VIDEO_EXTENSIONS = /* @__PURE__ */ new Set([".mp4", ".webm", ".mov"]);
25299
- function reference({ path: path108, alt }) {
25378
+
25379
+ // src/commands/prs/screenshotReference.ts
25380
+ function screenshotReference({ path: path108, alt }) {
25300
25381
  const target = /\s/.test(path108) ? `<${path108}>` : path108;
25301
25382
  return `![${alt}](${target})`;
25302
25383
  }
25384
+
25385
+ // src/commands/prs/renderScreenshotBlock.ts
25386
+ var VIDEO_EXTENSIONS = /* @__PURE__ */ new Set([".mp4", ".webm", ".mov"]);
25303
25387
  function cell(text18) {
25304
25388
  return text18.replaceAll("|", String.raw`\|`);
25305
25389
  }
@@ -25312,7 +25396,9 @@ function imageTable(images) {
25312
25396
  for (let i = 0; i < images.length; i += 2) {
25313
25397
  const pair = images.slice(i, i + 2);
25314
25398
  const captions = [0, 1].map((j) => pair[j] ? cell(pair[j].alt) : "");
25315
- const refs = [0, 1].map((j) => pair[j] ? cell(reference(pair[j])) : "");
25399
+ const refs = [0, 1].map(
25400
+ (j) => pair[j] ? cell(screenshotReference(pair[j])) : ""
25401
+ );
25316
25402
  if (i === 0) lines2.push(row(captions), row(["---", "---"]));
25317
25403
  else lines2.push(row(captions.map((c) => c ? `**${c}**` : "")));
25318
25404
  lines2.push(row(refs));
@@ -25323,7 +25409,7 @@ function renderScreenshotBlock(attachments) {
25323
25409
  const isVideo = (a) => VIDEO_EXTENSIONS.has(extname3(a.path).toLowerCase());
25324
25410
  return [
25325
25411
  ...imageTable(attachments.filter((a) => !isVideo(a))),
25326
- ...attachments.filter(isVideo).map(reference)
25412
+ ...attachments.filter(isVideo).map(screenshotReference)
25327
25413
  ];
25328
25414
  }
25329
25415
 
@@ -25347,7 +25433,7 @@ function renderScreenshotsSection(attachments) {
25347
25433
  return [
25348
25434
  "## Screenshots",
25349
25435
  ...blocks,
25350
- ...renderScreenshotBlock(ungrouped)
25436
+ ...ungrouped.map(screenshotReference)
25351
25437
  ].join("\n\n");
25352
25438
  }
25353
25439
 
@@ -25637,11 +25723,11 @@ function resolveIssueRepoTarget(repo) {
25637
25723
 
25638
25724
  // src/commands/github/issue/resolveCreateIssueParent.ts
25639
25725
  function resolveCreateIssueParent(target, parent) {
25640
- const reference2 = resolveFixStructureTarget(
25726
+ const reference = resolveFixStructureTarget(
25641
25727
  parent,
25642
25728
  `${target.owner}/${target.repo}`
25643
25729
  );
25644
- return { ...reference2, id: fetchIssueNodeId(reference2) };
25730
+ return { ...reference, id: fetchIssueNodeId(reference) };
25645
25731
  }
25646
25732
 
25647
25733
  // src/commands/github/issue/resolveCreateIssueProject.ts
@@ -29995,7 +30081,7 @@ var screenshotGuidance = `Screenshots: pass --screenshot '[Group/]Caption=path'
29995
30081
  (png, jpg, jpeg, gif, webp, svg, mp4, webm, mov). gh ${minGhAttachVersion}+ uploads each
29996
30082
  file and the body gets a ## Screenshots section: one ### Group heading per group
29997
30083
  with its images in a 2-column captioned table (so light/dark pairs sit side by
29998
- side), then any ungrouped images. The spec splits on the first '=' (label vs
30084
+ side), then any ungrouped images as plain images. The spec splits on the first '=' (label vs
29999
30085
  path), then the label on the first '/' (group vs caption); a missing caption
30000
30086
  falls back to the file name. A missing file or unsupported extension fails the
30001
30087
  command before anything is previewed or sent. Never author ## Screenshots in a
@@ -30183,46 +30269,6 @@ async function placePr(prNumber, title, body, options2, attachments = []) {
30183
30269
  // src/commands/prs/previewAndPlace.ts
30184
30270
  import { randomUUID as randomUUID17 } from "crypto";
30185
30271
 
30186
- // src/commands/sessions/shared/requestSession.ts
30187
- function parseIncoming(line, type) {
30188
- try {
30189
- const msg = JSON.parse(line);
30190
- if (msg.type === "error" && (msg.message ?? "").includes(type))
30191
- return { kind: "error", message: msg.message ?? `${type} failed` };
30192
- if (msg.type !== "created" || !msg.sessionId) return null;
30193
- return { kind: "created", sessionId: msg.sessionId };
30194
- } catch {
30195
- return null;
30196
- }
30197
- }
30198
- function requestSession(message3) {
30199
- return new Promise((resolve30, reject) => {
30200
- connectToDaemon().then((socket) => {
30201
- let settled = false;
30202
- const finish2 = (error, sessionId) => {
30203
- if (settled) return;
30204
- settled = true;
30205
- socket.destroy();
30206
- if (error) reject(error);
30207
- else resolve30(sessionId);
30208
- };
30209
- readSocketLines(socket, (line) => {
30210
- const incoming = parseIncoming(line, message3.type);
30211
- if (!incoming) return;
30212
- if (incoming.kind === "error") finish2(new Error(incoming.message));
30213
- else finish2(void 0, incoming.sessionId);
30214
- });
30215
- socket.on("error", (error) => finish2(error));
30216
- socket.on(
30217
- "close",
30218
- () => finish2(new Error("daemon closed before the session was created"))
30219
- );
30220
- socket.write(`${JSON.stringify(message3)}
30221
- `);
30222
- }, reject);
30223
- });
30224
- }
30225
-
30226
30272
  // src/commands/sessions/shared/requestClaudeSession.ts
30227
30273
  function requestClaudeSession(prompt, cwd, options2) {
30228
30274
  return requestSession({
@@ -30234,19 +30280,6 @@ function requestClaudeSession(prompt, cwd, options2) {
30234
30280
  });
30235
30281
  }
30236
30282
 
30237
- // src/commands/review/startChainedSession.ts
30238
- async function startChainedSession(label2, start2) {
30239
- if (process.env.ASSIST_SESSION !== "1") return;
30240
- try {
30241
- await start2();
30242
- console.log(`Started ${label2}.`);
30243
- } catch (error) {
30244
- console.error(
30245
- `Warning: could not start ${label2}: ${error instanceof Error ? error.message : String(error)}`
30246
- );
30247
- }
30248
- }
30249
-
30250
30283
  // src/commands/review/announcePr.ts
30251
30284
  function announcePr(prNumber) {
30252
30285
  return startChainedSession(
@@ -30259,17 +30292,6 @@ function announcePr(prNumber) {
30259
30292
  );
30260
30293
  }
30261
30294
 
30262
- // src/commands/sessions/shared/requestAssistSession.ts
30263
- function requestAssistSession(assistArgs, cwd, options2) {
30264
- return requestSession({
30265
- type: "create-assist",
30266
- assistArgs,
30267
- cwd,
30268
- inPlace: options2?.inPlace === true,
30269
- launchedFrom: options2?.launchedFrom ?? process.env.ASSIST_SESSION_ID
30270
- });
30271
- }
30272
-
30273
30295
  // src/commands/prs/chainReviewAndPost.ts
30274
30296
  function chainReviewAndPost(prNumber, announce) {
30275
30297
  const args = [
@@ -31275,13 +31297,13 @@ ${errorText}`
31275
31297
  // src/commands/ravendb/resolveOpSecret.ts
31276
31298
  import { execSync as execSync51 } from "child_process";
31277
31299
  import chalk197 from "chalk";
31278
- function resolveOpSecret(reference2) {
31279
- if (!reference2.startsWith("op://")) {
31300
+ function resolveOpSecret(reference) {
31301
+ if (!reference.startsWith("op://")) {
31280
31302
  console.error(chalk197.red(`Invalid secret reference: must start with op://`));
31281
31303
  process.exit(1);
31282
31304
  }
31283
31305
  try {
31284
- return execSync51(`op read "${reference2}"`, {
31306
+ return execSync51(`op read "${reference}"`, {
31285
31307
  encoding: "utf8",
31286
31308
  stdio: ["pipe", "pipe", "pipe"]
31287
31309
  }).trim();
@@ -35281,13 +35303,13 @@ function firstMatch(body, pattern2) {
35281
35303
  return body.match(pattern2)?.[0] ?? null;
35282
35304
  }
35283
35305
  function checkDescriptionLinksIssue(body) {
35284
- const reference2 = firstMatch(body, ISSUE_URL_PATTERN) ?? firstMatch(body, CROSS_REPO_PATTERN) ?? firstMatch(body, SAME_REPO_PATTERN2);
35285
- if (!reference2)
35306
+ const reference = firstMatch(body, ISSUE_URL_PATTERN) ?? firstMatch(body, CROSS_REPO_PATTERN) ?? firstMatch(body, SAME_REPO_PATTERN2);
35307
+ if (!reference)
35286
35308
  return {
35287
35309
  status: "fail",
35288
35310
  reason: "no GitHub issue reference (`#123`, `owner/repo#123`, or an issue URL) in the description"
35289
35311
  };
35290
- return { status: "pass", reason: `links ${reference2}` };
35312
+ return { status: "pass", reason: `links ${reference}` };
35291
35313
  }
35292
35314
 
35293
35315
  // src/commands/review/highLevel/checkDescriptionSections.ts
@@ -44438,7 +44460,7 @@ function decidePrPreview(sessions, waiters, notify2, d) {
44438
44460
  const screenshotCount = Array.isArray(d.screenshots) ? d.screenshots.length : 0;
44439
44461
  const checklistCount = Array.isArray(d.checklist) ? d.checklist.length : 0;
44440
44462
  daemonLog(
44441
- `pr-decision received: id=${id} requestId=${requestId} decision=${d.decision} comments=${commentCount} screenshots=${screenshotCount} checklist=${checklistCount} reviewAfter=${d.reviewAfter === true} announceAfter=${d.announceAfter === true} draft=${d.draft} autoMerge=${d.autoMerge === true}`
44463
+ `pr-decision received: id=${id} requestId=${requestId} decision=${d.decision} comments=${commentCount} screenshots=${screenshotCount} checklist=${checklistCount} reviewAfter=${d.reviewAfter === true} announceAfter=${d.announceAfter === true} draft=${d.draft} autoMerge=${d.autoMerge === true} autostart=${d.autostart === true}`
44442
44464
  );
44443
44465
  const waiter = waiters.get(id);
44444
44466
  if (waiter)
@@ -44454,6 +44476,7 @@ function decidePrPreview(sessions, waiters, notify2, d) {
44454
44476
  announceAfter: d.announceAfter,
44455
44477
  draft: d.draft,
44456
44478
  autoMerge: d.autoMerge,
44479
+ autostart: d.autostart,
44457
44480
  checklist: d.checklist
44458
44481
  });
44459
44482
  waiters.delete(id);
@@ -44481,6 +44504,7 @@ function buildPrPreview(d, kind, prNumber) {
44481
44504
  prNumber,
44482
44505
  kind,
44483
44506
  itemType: kind === "backlog-item" ? d.itemType === "bug" ? "bug" : "story" : void 0,
44507
+ canStart: kind === "backlog-item" && d.canStart === true ? true : void 0,
44484
44508
  draft: kind === "pr" && prNumber === null ? draft : void 0,
44485
44509
  metadata: parsePreviewMetadata(d.metadata),
44486
44510
  screenshots: kind === "pr" ? toAttachments(d.screenshots) : void 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.812.0",
3
+ "version": "0.813.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {