@staff0rd/assist 0.1142.0 → 0.1143.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
@@ -10,6 +10,6 @@ if (isStatusLineInvocation(process.argv)) {
10
10
  const { runStatusLine } = await import("./runStatusLine-6VBMFNUZ.js");
11
11
  await runStatusLine();
12
12
  } else {
13
- const { runCli } = await import("./runCli-AJWCPYHW.js");
13
+ const { runCli } = await import("./runCli-3UAJHEBP.js");
14
14
  await runCli();
15
15
  }
@@ -16,7 +16,7 @@ import { Command } from "commander";
16
16
  // package.json
17
17
  var package_default = {
18
18
  name: "@staff0rd/assist",
19
- version: "0.1142.0",
19
+ version: "0.1143.0",
20
20
  type: "module",
21
21
  main: "dist/index.js",
22
22
  bin: {
@@ -10122,6 +10122,15 @@ function azureDevopsRepoUrl({ org, project, repo }) {
10122
10122
  return `https://dev.azure.com/${encodeURIComponent(org)}/${encodeURIComponent(project)}/_git/${encodeURIComponent(repo)}`;
10123
10123
  }
10124
10124
 
10125
+ // src/commands/sessions/web/fromGithub/azureDevopsNotCloned.ts
10126
+ function azureDevopsNotCloned(repo, baseDir) {
10127
+ return {
10128
+ ok: false,
10129
+ status: 404,
10130
+ error: `${repo.org}/${repo.project}/${repo.repo} is not cloned under ${baseDir}; clone ${azureDevopsRepoUrl(repo)} there and retry`
10131
+ };
10132
+ }
10133
+
10125
10134
  // src/commands/sessions/web/fromGithub/findAzureDevopsClone.ts
10126
10135
  import { existsSync as existsSync23, readdirSync as readdirSync8 } from "fs";
10127
10136
  import { join as join29 } from "path";
@@ -10166,12 +10175,7 @@ function planAzureDevopsReview(pr, args, baseDir) {
10166
10175
  error: "Unsupported assist args for an Azure DevOps PR"
10167
10176
  };
10168
10177
  const cwd = findAzureDevopsClone(pr, baseDir);
10169
- if (!cwd)
10170
- return {
10171
- ok: false,
10172
- status: 404,
10173
- error: `${pr.org}/${pr.project}/${pr.repo} is not cloned under ${baseDir}; clone ${azureDevopsRepoUrl(pr)} there and retry`
10174
- };
10178
+ if (!cwd) return azureDevopsNotCloned(pr, baseDir);
10175
10179
  return { ok: true, cwd, assistArgs: [...args, pr.id] };
10176
10180
  }
10177
10181
 
@@ -10381,26 +10385,44 @@ function reviewFromGithub(req, res) {
10381
10385
  );
10382
10386
  }
10383
10387
 
10384
- // src/commands/sessions/web/fromGithub/linkPrompt.ts
10388
+ // src/commands/sessions/web/fromGithub/remotePrGuidance.ts
10385
10389
  var githubPrUrl = /^https?:\/\/github\.com\/[^/]+\/[^/]+\/pull\/\d+/;
10386
- function remotePrGuidance(prUrl) {
10387
- return `This is a pull request. Read it remotely with \`gh pr view ${prUrl} --comments\` and \`gh pr diff ${prUrl}\`; do not check out its branch.`;
10390
+ function remotePrGuidance(url) {
10391
+ const githubPr = url.match(githubPrUrl)?.[0];
10392
+ if (githubPr)
10393
+ return `This is a pull request. Read it remotely with \`gh pr view ${githubPr} --comments\` and \`gh pr diff ${githubPr}\`; do not check out its branch.`;
10394
+ const pr = parseAzureDevopsPrUrl(url);
10395
+ if (!pr) return void 0;
10396
+ const org = `https://dev.azure.com/${encodeURIComponent(pr.org)}`;
10397
+ return `This is an Azure DevOps pull request. Read it remotely with \`az repos pr show --id ${pr.id} --org ${org}\` and its comment threads with \`az devops invoke --area git --resource pullRequestThreads --route-parameters "project=${pr.project}" "repositoryId=${pr.repo}" pullRequestId=${pr.id} --org ${org}\`; diff it with \`git fetch origin refs/pull/${pr.id}/merge\` then \`git diff FETCH_HEAD^1 FETCH_HEAD\`. Do not check out its branch.`;
10388
10398
  }
10399
+
10400
+ // src/commands/sessions/web/fromGithub/linkPrompt.ts
10389
10401
  function linkPrompt(url, instructions) {
10390
10402
  const extra = typeof instructions === "string" ? instructions.trim() : "";
10391
- const prUrl = url.match(githubPrUrl)?.[0];
10403
+ const guidance = remotePrGuidance(url);
10392
10404
  const parts2 = [url];
10393
- if (prUrl) parts2.push(remotePrGuidance(prUrl));
10405
+ if (guidance) parts2.push(guidance);
10394
10406
  if (extra) parts2.push(extra);
10395
10407
  return parts2.join("\n\n");
10396
10408
  }
10397
10409
 
10410
+ // src/commands/sessions/web/fromGithub/resolveSessionClone.ts
10411
+ function resolveSessionClone(url, baseDir, redirects) {
10412
+ const trimmed = typeof url === "string" ? url.trim() : "";
10413
+ const azurePr = parseAzureDevopsPrUrl(trimmed);
10414
+ if (!azurePr) return resolveGithubClone(url, baseDir, redirects);
10415
+ const cwd = findAzureDevopsClone(azurePr, baseDir);
10416
+ if (!cwd) return azureDevopsNotCloned(azurePr, baseDir);
10417
+ return { ok: true, url: trimmed, cwd };
10418
+ }
10419
+
10398
10420
  // src/commands/sessions/web/fromGithub/planGithubSession.ts
10399
10421
  function planGithubSession(body, baseDir, redirects) {
10400
10422
  const { url, instructions, mode } = body ?? {};
10401
10423
  if (mode !== void 0 && !isGithubAssistMode(mode))
10402
10424
  return { ok: false, status: 400, error: `Unknown mode: ${mode}` };
10403
- const clone = resolveGithubClone(url, baseDir, redirects);
10425
+ const clone = resolveSessionClone(url, baseDir, redirects);
10404
10426
  if (!clone.ok) return clone;
10405
10427
  const prompt = linkPrompt(clone.url, instructions);
10406
10428
  return { ok: true, cwd: clone.cwd, prompt, ...mode && { mode } };
@@ -24316,6 +24338,7 @@ import chalk64 from "chalk";
24316
24338
 
24317
24339
  // src/commands/backlog/propose/proposedItemSchema.ts
24318
24340
  import { z as z18 } from "zod";
24341
+ var PHASE_DEFINITION = /^\W*phase\s+\d+\s*[:.)\-–—]/i;
24319
24342
  var proposedPhaseSchema = z18.strictObject({
24320
24343
  name: z18.string().trim().min(1, "phase name is required").refine(
24321
24344
  (name2) => name2.toLowerCase() !== REVIEW_PHASE_NAME.toLowerCase(),
@@ -24328,7 +24351,12 @@ var proposedItemSchema = z18.strictObject({
24328
24351
  name: z18.string().trim().min(1, "name is required"),
24329
24352
  type: z18.enum(["story", "bug"]),
24330
24353
  description: z18.string().optional(),
24331
- acceptanceCriteria: z18.array(z18.string().trim().min(1)).default([]),
24354
+ acceptanceCriteria: z18.array(
24355
+ z18.string().trim().min(1).refine(
24356
+ (criterion) => !PHASE_DEFINITION.test(criterion),
24357
+ "reads as a phase definition \u2014 move it to `phases` as { name, tasks } and keep acceptance criteria to conditions that confirm the item is done"
24358
+ )
24359
+ ).default([]),
24332
24360
  phases: z18.array(proposedPhaseSchema).default([])
24333
24361
  });
24334
24362
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.1142.0",
3
+ "version": "0.1143.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {