@staff0rd/assist 0.667.0 → 0.669.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.667.0",
9
+ version: "0.669.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -651,7 +651,7 @@ var DEFAULT_BACKUP_DIR = "~/.assist/backups";
651
651
  var DEFAULT_CLONE_DIR = "~/git";
652
652
  var assistConfigShape = {
653
653
  advice: z3.strictObject({
654
- fragments: z3.partialRecord(z3.enum(adviceFragmentNames), z3.boolean()).default({}),
654
+ sections: z3.partialRecord(z3.enum(adviceFragmentNames), z3.boolean()).default({}),
655
655
  extra: z3.string().optional(),
656
656
  verify: z3.string().optional()
657
657
  }).optional(),
@@ -2869,7 +2869,7 @@ function configHelp(command, entries, preamble) {
2869
2869
 
2870
2870
  // src/shared/configEnumDescriptions.ts
2871
2871
  var byKey = {
2872
- "advice.fragments": adviceFragmentTitles
2872
+ "advice.sections": adviceFragmentTitles
2873
2873
  };
2874
2874
  function configEnumDescriptions(key) {
2875
2875
  return byKey[key];
@@ -3112,9 +3112,9 @@ function enumerateConfigLeafKeys(schema2) {
3112
3112
  // src/commands/advise/adviceConfigHelp.ts
3113
3113
  var adviceConfigHelp = [
3114
3114
  {
3115
- key: "advice.fragments",
3116
- setter: "assist config set advice.fragments.verify false",
3117
- note: "force a fragment on (true) or off (false) whatever its condition says; 'assist advise --explain' lists every name"
3115
+ key: "advice.sections",
3116
+ setter: "assist config set advice.sections.verify false",
3117
+ note: "force a section on (true) or off (false) whatever its condition says; 'assist advise --explain' lists every name"
3118
3118
  },
3119
3119
  {
3120
3120
  key: "advice.extra",
@@ -5375,13 +5375,13 @@ var adviceConditions = {
5375
5375
 
5376
5376
  // src/commands/advise/selectAdvice.ts
5377
5377
  function decide(fragment, context) {
5378
- const fragments = context.config.advice?.fragments ?? {};
5379
- const override = fragments[fragment.name];
5378
+ const sections = context.config.advice?.sections ?? {};
5379
+ const override = sections[fragment.name];
5380
5380
  if (override !== void 0)
5381
5381
  return {
5382
5382
  fragment,
5383
5383
  included: override,
5384
- reason: `advice.fragments.${fragment.name} is ${override}`
5384
+ reason: `advice.sections.${fragment.name} is ${override}`
5385
5385
  };
5386
5386
  const condition = adviceConditions[fragment.when];
5387
5387
  if (!condition)
@@ -23654,6 +23654,148 @@ function registerEditIssueComment(issueCommand) {
23654
23654
  );
23655
23655
  }
23656
23656
 
23657
+ // src/commands/github/issue/assignIssueToSelf.ts
23658
+ import { execFileSync as execFileSync12 } from "child_process";
23659
+ function assignIssueToSelf(number, repo) {
23660
+ const args = [
23661
+ "issue",
23662
+ "edit",
23663
+ String(number),
23664
+ "--repo",
23665
+ repo,
23666
+ "--add-assignee",
23667
+ "@me"
23668
+ ];
23669
+ try {
23670
+ execFileSync12("gh", args, { stdio: ["ignore", "ignore", "inherit"] });
23671
+ } catch {
23672
+ process.exit(1);
23673
+ }
23674
+ }
23675
+
23676
+ // src/commands/github/issue/toIssueProjectItem.ts
23677
+ function toIssueProjectItem(node) {
23678
+ const project = node?.project;
23679
+ if (!node?.id || !project?.id) return void 0;
23680
+ return {
23681
+ itemId: node.id,
23682
+ projectId: project.id,
23683
+ projectNumber: project.number ?? 0,
23684
+ projectTitle: project.title ?? String(project.number ?? ""),
23685
+ statusField: project.field?.id ? { id: project.field.id, options: project.field.options ?? [] } : void 0
23686
+ };
23687
+ }
23688
+
23689
+ // src/commands/github/issue/parseIssueProjectItems.ts
23690
+ function parseIssueProjectItems(raw, label2) {
23691
+ const issue = JSON.parse(raw).data?.repository?.issue;
23692
+ if (!issue?.id) throw new Error(`No issue ${label2} could be read`);
23693
+ const items2 = (issue.projectItems?.nodes ?? []).map(toIssueProjectItem).filter((item) => item !== void 0);
23694
+ return { issueId: issue.id, items: items2 };
23695
+ }
23696
+
23697
+ // src/commands/github/issue/fetchIssueProjectItems.ts
23698
+ var QUERY6 = `query($owner: String!, $repo: String!, $number: Int!) {
23699
+ repository(owner: $owner, name: $repo) {
23700
+ issue(number: $number) {
23701
+ id
23702
+ projectItems(first: 20) {
23703
+ nodes {
23704
+ id
23705
+ project {
23706
+ id
23707
+ number
23708
+ title
23709
+ field(name: "Status") {
23710
+ ... on ProjectV2SingleSelectField { id options { id name } }
23711
+ }
23712
+ }
23713
+ }
23714
+ }
23715
+ }
23716
+ }
23717
+ }`;
23718
+ function fetchIssueProjectItems(target) {
23719
+ return parseIssueProjectItems(
23720
+ runGhGraphqlJson(QUERY6, target),
23721
+ `${target.owner}/${target.repo}#${target.number}`
23722
+ );
23723
+ }
23724
+
23725
+ // src/commands/github/issue/moveIssueToInProgress.ts
23726
+ var IN_PROGRESS = "in progress";
23727
+ function boardName(item) {
23728
+ return `project ${item.projectNumber} (${item.projectTitle})`;
23729
+ }
23730
+ function moveItem(item) {
23731
+ const statusField = item.statusField;
23732
+ if (!statusField) {
23733
+ console.log(`${boardName(item)} has no Status field, so it was not moved`);
23734
+ return;
23735
+ }
23736
+ const option = statusField.options.find(
23737
+ (candidate) => candidate.name.toLowerCase() === IN_PROGRESS
23738
+ );
23739
+ if (!option) {
23740
+ const names = statusField.options.map((candidate) => candidate.name);
23741
+ console.log(
23742
+ `The Status field on ${boardName(item)} has no In Progress option, so it was not moved. It offers ${names.join(", ") || "no options"}`
23743
+ );
23744
+ return;
23745
+ }
23746
+ setProjectItemStatus({
23747
+ projectId: item.projectId,
23748
+ itemId: item.itemId,
23749
+ fieldId: statusField.id,
23750
+ optionId: option.id
23751
+ });
23752
+ console.log(`Set ${boardName(item)} to ${option.name}`);
23753
+ }
23754
+ function moveIssueToInProgress(target) {
23755
+ try {
23756
+ assertProjectScope();
23757
+ } catch (error) {
23758
+ console.log(error instanceof Error ? error.message : String(error));
23759
+ return;
23760
+ }
23761
+ const { items: items2 } = fetchIssueProjectItems(target);
23762
+ if (items2.length === 0) {
23763
+ console.log(
23764
+ `${target.owner}/${target.repo}#${target.number} is on no project board, so there was nothing to move`
23765
+ );
23766
+ return;
23767
+ }
23768
+ for (const item of items2) moveItem(item);
23769
+ }
23770
+
23771
+ // src/commands/github/issue/startIssue.ts
23772
+ var USAGE5 = "Usage: assist github issue started <number> [-R <owner>/<repo>]";
23773
+ function startIssue(numberArg, options2) {
23774
+ const number = Number.parseInt(numberArg, 10);
23775
+ if (!Number.isInteger(number) || number <= 0) {
23776
+ console.error(USAGE5);
23777
+ process.exit(1);
23778
+ }
23779
+ const { owner, repo } = resolveIssueRepoTarget(options2.repo);
23780
+ const slug2 = `${owner}/${repo}`;
23781
+ assignIssueToSelf(number, slug2);
23782
+ console.log(`Assigned ${slug2}#${number} to you`);
23783
+ moveIssueToInProgress({ owner, repo, number });
23784
+ }
23785
+
23786
+ // src/commands/github/issue/registerStartIssue.ts
23787
+ function registerStartIssue(issueCommand) {
23788
+ issueCommand.command("started <number>").description(
23789
+ "Assign a GitHub issue to yourself and move its project boards to In Progress"
23790
+ ).option(
23791
+ "-R, --repo <owner/repo>",
23792
+ "Target repository (defaults to the current repo)"
23793
+ ).addHelpText(
23794
+ "after",
23795
+ "\nThe boards are discovered from the issue itself: every ProjectV2 item the issue sits on whose Status field offers an In Progress option (matched case-insensitively) is moved.\nThe assignment is applied first and is never blocked by the board work \u2014 an issue on no board, a Status field with no In Progress option, and a gh token without the project scope are each reported and exit 0.\nThe project scope is needed to read or move a board: gh auth refresh -h github.com -s project"
23796
+ ).action(startIssue);
23797
+ }
23798
+
23657
23799
  // src/commands/registerGithubIssue.ts
23658
23800
  function registerGithubIssue(githubCommand) {
23659
23801
  const issueCommand = githubCommand.command("issue").description("GitHub issue utilities");
@@ -23661,6 +23803,7 @@ function registerGithubIssue(githubCommand) {
23661
23803
  registerEditIssue(issueCommand);
23662
23804
  registerCommentIssue(issueCommand);
23663
23805
  registerEditIssueComment(issueCommand);
23806
+ registerStartIssue(issueCommand);
23664
23807
  registerFixStructure(issueCommand);
23665
23808
  }
23666
23809
 
@@ -24089,7 +24232,7 @@ function registerRefineLaunch(program2, resumeFlag) {
24089
24232
  import { randomUUID as randomUUID10 } from "crypto";
24090
24233
 
24091
24234
  // src/commands/review/checkoutPr.ts
24092
- import { execFileSync as execFileSync13 } from "child_process";
24235
+ import { execFileSync as execFileSync14 } from "child_process";
24093
24236
  import chalk171 from "chalk";
24094
24237
 
24095
24238
  // src/commands/sessions/daemon/daemonLog.ts
@@ -24651,10 +24794,10 @@ async function moveToPrCheckoutTree() {
24651
24794
  }
24652
24795
 
24653
24796
  // src/commands/review/prHeadBranch.ts
24654
- import { execFileSync as execFileSync12 } from "child_process";
24797
+ import { execFileSync as execFileSync13 } from "child_process";
24655
24798
  function prHeadBranch(number) {
24656
24799
  try {
24657
- const out = execFileSync12(
24800
+ const out = execFileSync13(
24658
24801
  "gh",
24659
24802
  ["pr", "view", number, "--json", "headRefName", "-q", ".headRefName"],
24660
24803
  { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }
@@ -24702,7 +24845,7 @@ async function checkoutPr(number) {
24702
24845
  if (headRef && moveToExistingCheckout(number, headRef)) return;
24703
24846
  await moveToPrCheckoutTree();
24704
24847
  try {
24705
- execFileSync13("gh", ["pr", "checkout", number], { stdio: "inherit" });
24848
+ execFileSync14("gh", ["pr", "checkout", number], { stdio: "inherit" });
24706
24849
  } catch {
24707
24850
  console.error(chalk171.red(`gh pr checkout ${number} failed; aborting.`));
24708
24851
  process.exit(1);
@@ -26442,13 +26585,13 @@ async function comment2(path91, line, body, options2 = {}) {
26442
26585
  import { randomUUID as randomUUID14 } from "crypto";
26443
26586
 
26444
26587
  // src/commands/prs/applyEdit.ts
26445
- import { execFileSync as execFileSync14 } from "child_process";
26588
+ import { execFileSync as execFileSync15 } from "child_process";
26446
26589
  function applyEdit(number, title, body) {
26447
26590
  const args = ["pr", "edit", String(number)];
26448
26591
  if (title) args.push("--title", title);
26449
26592
  args.push("--body", body);
26450
26593
  try {
26451
- execFileSync14("gh", args, { stdio: "inherit" });
26594
+ execFileSync15("gh", args, { stdio: "inherit" });
26452
26595
  } catch {
26453
26596
  process.exit(1);
26454
26597
  }
@@ -27252,7 +27395,7 @@ function buildValidatedBody(options2, usage) {
27252
27395
  }
27253
27396
 
27254
27397
  // src/commands/prs/placePr.ts
27255
- import { execFileSync as execFileSync15 } from "child_process";
27398
+ import { execFileSync as execFileSync16 } from "child_process";
27256
27399
 
27257
27400
  // src/commands/prs/buildCreateArgs.ts
27258
27401
  function buildEditArgs(number, title, body) {
@@ -27319,7 +27462,7 @@ async function recordPrActivity() {
27319
27462
  // src/commands/prs/placePr.ts
27320
27463
  function hasUpstream2() {
27321
27464
  try {
27322
- execFileSync15(
27465
+ execFileSync16(
27323
27466
  "git",
27324
27467
  ["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
27325
27468
  { stdio: "pipe" }
@@ -27331,13 +27474,13 @@ function hasUpstream2() {
27331
27474
  }
27332
27475
  function ensureBranchPushed() {
27333
27476
  const args = hasUpstream2() ? ["push"] : ["push", "--set-upstream", "origin", "HEAD"];
27334
- execFileSync15("git", args, { stdio: "inherit" });
27477
+ execFileSync16("git", args, { stdio: "inherit" });
27335
27478
  }
27336
27479
  async function placePr(prNumber, title, body, options2) {
27337
27480
  const args = prNumber !== null ? buildEditArgs(prNumber, title, body) : buildCreateArgs(title, body, options2);
27338
27481
  try {
27339
27482
  if (prNumber === null && !options2.head) ensureBranchPushed();
27340
- execFileSync15("gh", args, { stdio: "inherit" });
27483
+ execFileSync16("gh", args, { stdio: "inherit" });
27341
27484
  } catch {
27342
27485
  process.exit(1);
27343
27486
  }
@@ -27477,10 +27620,10 @@ function warn(reason4) {
27477
27620
  }
27478
27621
 
27479
27622
  // src/commands/prs/enableAutoMerge.ts
27480
- import { execFileSync as execFileSync16 } from "child_process";
27623
+ import { execFileSync as execFileSync17 } from "child_process";
27481
27624
  function enableAutoMerge() {
27482
27625
  try {
27483
- execFileSync16(
27626
+ execFileSync17(
27484
27627
  "gh",
27485
27628
  ["pr", "merge", getCurrentBranch2(), "--auto", "--squash"],
27486
27629
  { stdio: "inherit" }
@@ -27517,9 +27660,9 @@ function resolveDraftState(options2, command) {
27517
27660
  }
27518
27661
 
27519
27662
  // src/commands/prs/raise.ts
27520
- var USAGE5 = "Usage: assist prs raise --title <title> --what <what> --why <why> [--how <how>] [--resolves <key>] [--force]";
27663
+ var USAGE6 = "Usage: assist prs raise --title <title> --what <what> --why <why> [--how <how>] [--resolves <key>] [--force]";
27521
27664
  async function raise(options2, command) {
27522
- const { title, body } = buildValidatedBody(options2, USAGE5);
27665
+ const { title, body } = buildValidatedBody(options2, USAGE6);
27523
27666
  const resolved = { ...options2, draft: resolveDraftState(options2, command) };
27524
27667
  const existing = findCurrentPrNumber();
27525
27668
  const sessionId = process.env.ASSIST_SESSION_ID;
@@ -33501,7 +33644,7 @@ function slackWorkingFile(channel) {
33501
33644
  }
33502
33645
 
33503
33646
  // src/commands/slack/postSlackMessage.ts
33504
- var USAGE6 = "Usage: assist slack post [channel] --body <body|->";
33647
+ var USAGE7 = "Usage: assist slack post [channel] --body <body|->";
33505
33648
  async function postSlackMessage(channelArg, options2) {
33506
33649
  const channel = (channelArg ?? loadConfig().slack?.channel ?? "").trim();
33507
33650
  const body = options2.body?.trim();
@@ -33509,11 +33652,11 @@ async function postSlackMessage(channelArg, options2) {
33509
33652
  console.error(
33510
33653
  'No channel given and slack.channel is not set. Pass one, or set a default with: assist config set slack.channel "#general"'
33511
33654
  );
33512
- console.error(USAGE6);
33655
+ console.error(USAGE7);
33513
33656
  process.exit(1);
33514
33657
  }
33515
33658
  if (!body) {
33516
- console.error(USAGE6);
33659
+ console.error(USAGE7);
33517
33660
  process.exit(1);
33518
33661
  }
33519
33662
  const threadTs = options2.thread;
@@ -35223,9 +35366,9 @@ function registerVoice(program2) {
35223
35366
  }
35224
35367
 
35225
35368
  // src/commands/watch/resolveUpstream.ts
35226
- import { execFileSync as execFileSync17 } from "child_process";
35369
+ import { execFileSync as execFileSync18 } from "child_process";
35227
35370
  function runGit3(args, cwd) {
35228
- return execFileSync17("git", args, {
35371
+ return execFileSync18("git", args, {
35229
35372
  encoding: "utf8",
35230
35373
  stdio: ["pipe", "pipe", "pipe"],
35231
35374
  cwd
@@ -35627,13 +35770,13 @@ import { spawn as spawn9 } from "child_process";
35627
35770
  import { existsSync as existsSync83 } from "fs";
35628
35771
 
35629
35772
  // src/commands/run/resolveCommand.ts
35630
- import { execFileSync as execFileSync18 } from "child_process";
35773
+ import { execFileSync as execFileSync19 } from "child_process";
35631
35774
  import { existsSync as existsSync82 } from "fs";
35632
35775
  import { dirname as dirname39, join as join97, resolve as resolve20 } from "path";
35633
35776
  function resolveCommand2(command) {
35634
35777
  if (process.platform !== "win32" || command !== "bash") return command;
35635
35778
  try {
35636
- const gitPath = execFileSync18("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
35779
+ const gitPath = execFileSync19("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
35637
35780
  const gitRoot = resolve20(dirname39(gitPath), "..");
35638
35781
  const gitBash = join97(gitRoot, "bin", "bash.exe");
35639
35782
  if (existsSync82(gitBash)) return gitBash;
@@ -35755,11 +35898,11 @@ async function reportSyncOrExit() {
35755
35898
  }
35756
35899
 
35757
35900
  // src/commands/watch/fetchQuietly.ts
35758
- import { execFileSync as execFileSync19 } from "child_process";
35901
+ import { execFileSync as execFileSync20 } from "child_process";
35759
35902
  var MIN_FETCH_TIMEOUT_MS = 6e4;
35760
35903
  function fetchQuietly(cwd, intervalMs) {
35761
35904
  try {
35762
- execFileSync19("git", ["fetch", "--quiet"], {
35905
+ execFileSync20("git", ["fetch", "--quiet"], {
35763
35906
  stdio: ["pipe", "pipe", "pipe"],
35764
35907
  cwd,
35765
35908
  timeout: Math.max(intervalMs, MIN_FETCH_TIMEOUT_MS)
@@ -36061,7 +36204,7 @@ async function auth() {
36061
36204
  }
36062
36205
 
36063
36206
  // src/commands/roam/postRoamActivity.ts
36064
- import { execFileSync as execFileSync20 } from "child_process";
36207
+ import { execFileSync as execFileSync21 } from "child_process";
36065
36208
  import { readdirSync as readdirSync22, readFileSync as readFileSync61, statSync as statSync12 } from "fs";
36066
36209
  import { join as join98 } from "path";
36067
36210
  function findPortFile(roamDir) {
@@ -36100,7 +36243,7 @@ function postRoamActivity(app, event) {
36100
36243
  const pid = PID_BY_APP[app] ?? 99999;
36101
36244
  const url = `http://127.0.0.1:${port}/api/v1/activity/${app}/${event}?pid=${pid}`;
36102
36245
  try {
36103
- execFileSync20("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
36246
+ execFileSync21("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
36104
36247
  stdio: "ignore"
36105
36248
  });
36106
36249
  } catch {
@@ -36578,11 +36721,11 @@ function screenshot(processName) {
36578
36721
  }
36579
36722
 
36580
36723
  // src/commands/sessions/daemon/listDaemonPids.ts
36581
- import { execFileSync as execFileSync21 } from "child_process";
36724
+ import { execFileSync as execFileSync22 } from "child_process";
36582
36725
  function listDaemonPids() {
36583
36726
  if (process.platform === "win32") return [];
36584
36727
  try {
36585
- const out = execFileSync21("ps", ["-eo", "pid=,args="], {
36728
+ const out = execFileSync22("ps", ["-eo", "pid=,args="], {
36586
36729
  encoding: "utf8"
36587
36730
  });
36588
36731
  return out.split("\n").filter((line) => line.includes("assist") && / daemon run\b/.test(line)).map((line) => Number.parseInt(line.trim(), 10)).filter((pid) => Number.isInteger(pid));
@@ -42305,7 +42448,7 @@ function cleanupOwnedFiles() {
42305
42448
  import * as net3 from "net";
42306
42449
 
42307
42450
  // src/commands/sessions/daemon/findPortHolderPid.ts
42308
- import { execFileSync as execFileSync22 } from "child_process";
42451
+ import { execFileSync as execFileSync23 } from "child_process";
42309
42452
  var PROBE_TIMEOUT_MS = 3e3;
42310
42453
  function findPortHolderPid(port) {
42311
42454
  try {
@@ -42315,7 +42458,7 @@ function findPortHolderPid(port) {
42315
42458
  }
42316
42459
  }
42317
42460
  function probe(command, args) {
42318
- return execFileSync22(command, args, {
42461
+ return execFileSync23(command, args, {
42319
42462
  encoding: "utf8",
42320
42463
  timeout: PROBE_TIMEOUT_MS,
42321
42464
  stdio: ["ignore", "pipe", "ignore"]
@@ -42554,7 +42697,7 @@ function summaryPathFor(jsonlPath2) {
42554
42697
  }
42555
42698
 
42556
42699
  // src/commands/sessions/summarise/summariseSession.ts
42557
- import { execFileSync as execFileSync23 } from "child_process";
42700
+ import { execFileSync as execFileSync24 } from "child_process";
42558
42701
  function summariseSession(jsonlPath2) {
42559
42702
  const firstMessage = extractFirstUserMessage(jsonlPath2);
42560
42703
  const backlogIds = scanSessionBacklogRefs(jsonlPath2);
@@ -42563,7 +42706,7 @@ function summariseSession(jsonlPath2) {
42563
42706
  }
42564
42707
  const prompt = buildPrompt6(firstMessage, backlogIds);
42565
42708
  try {
42566
- const output = execFileSync23("claude", ["-p", "--model", "haiku", prompt], {
42709
+ const output = execFileSync24("claude", ["-p", "--model", "haiku", prompt], {
42567
42710
  encoding: "utf8",
42568
42711
  timeout: 3e4,
42569
42712
  stdio: ["ignore", "pipe", "ignore"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.667.0",
3
+ "version": "0.669.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {