@staff0rd/assist 0.238.0 → 0.239.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/README.md CHANGED
@@ -86,6 +86,7 @@ After installation, the `assist` command will be available globally. You can als
86
86
  - `assist commit <message>` - Commit staged changes with validation
87
87
  - `assist commit <message> [files...]` - Stage files and create a git commit with validation
88
88
  - `assist prs` - List pull requests for the current repository
89
+ - `assist prs create --title <title> --body <body>` - Create a pull request via `gh pr create`
89
90
  - `assist prs list-comments` - List all comments on the current branch's pull request
90
91
  - `assist prs fixed <comment-id> <sha>` - Reply with commit link and resolve thread
91
92
  - `assist prs wontfix <comment-id> <reason>` - Reply with reason and resolve thread
@@ -161,7 +162,7 @@ The first backlog command in a repository that still has a local `.assist/backlo
161
162
  - `assist devlog repos` - Show which github.com/staff0rd repos are missing devlog entries
162
163
  - `assist devlog skip <date>` - Add a date to the skip list
163
164
  - `assist devlog version` - Show current repo name and version info
164
- - `assist cli-hook` - PreToolUse hook for auto-approving CLI commands (reads from `allowed.cli-reads` and `allowed.cli-writes`, also auto-approves read-only `gh api` calls). Supports compound commands (`|`, `&&`, `||`, `;`) by checking each sub-command independently
165
+ - `assist cli-hook` - PreToolUse hook for auto-approving CLI commands (reads from `allowed.cli-reads` and `allowed.cli-writes`, also auto-approves read-only `gh api` calls). Supports compound commands (`|`, `&&`, `||`, `;`) by checking each sub-command independently.
165
166
  - `assist cli-hook add <cli>` - Discover a CLI's commands and auto-permit read-only ones
166
167
  - `assist cli-hook check <command> [--tool <tool>]` - Check whether a command would be auto-approved by `cli-hook` (tool defaults to `Bash`)
167
168
  - `assist cli-hook deny` - List all deny rules
@@ -4,6 +4,8 @@ description: Raise a PR with a concise description
4
4
 
5
5
  Raise a pull request for the current branch. Use a concise description with no headers. Do not reference Claude or any AI assistance in the title or body.
6
6
 
7
- Use `gh pr create` to create the PR. Keep the title short and the body to a brief plain-text summary of the changes. Wrap symbols, file paths, function names, class names, variable names, config keys, CLI commands, and flag names in backticks.
7
+ Use `assist prs create --title <title> --body <body>` to create the PR — do not use `gh pr create` directly. Keep the title short and the body to a brief plain-text summary of the changes. Wrap symbols, file paths, function names, class names, variable names, config keys, CLI commands, and flag names in backticks.
8
8
 
9
9
  Write the description in terms of behaviour and user-facing impact: what the change does, what's different for someone using it, and why. Keep technical detail to a minimum — do not walk through the implementation approach step by step, and do not restate what is already obvious from the diff or changelog (which files changed, which functions were added). The reviewer can read the code; the description should tell them what to expect from the change, not narrate how it was built.
10
+
11
+ Before creating the PR, the user must see the full proposed title and body — do not assume they can see your reasoning or earlier tool output. Write the complete title and body verbatim in your visible reply, then use the AskUserQuestion tool to ask whether to create the PR, putting the full title and body in the approve option's `preview` field so the dialog itself displays them. This confirmation is mandatory in every permission mode, including auto-accept and bypass-permissions — never run `assist prs create` until the user has explicitly approved the title and body through AskUserQuestion. If the user requests changes, revise and confirm again before creating.
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.238.0",
9
+ version: "0.239.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -6806,6 +6806,27 @@ function matchesConfigDeny(command) {
6806
6806
  );
6807
6807
  }
6808
6808
 
6809
+ // src/commands/cliHook/findBuiltinDeny.ts
6810
+ var BUILTIN_DENIES = [
6811
+ {
6812
+ pattern: "gh pr create",
6813
+ message: "Do not run 'gh pr create' directly. Use 'assist prs create --title <title> --body <body>' instead \u2014 it validates the title and body before delegating to gh pr create. Before running it, get explicit approval via the AskUserQuestion tool, regardless of permission mode, with the full proposed title and body in the approve option's preview field so the user actually sees them."
6814
+ }
6815
+ ];
6816
+ function matchesBuiltinDeny(part) {
6817
+ return BUILTIN_DENIES.find(
6818
+ (rule) => part === rule.pattern || part.startsWith(`${rule.pattern} `)
6819
+ );
6820
+ }
6821
+ function findBuiltinDeny(parts) {
6822
+ const rule = parts.map(matchesBuiltinDeny).find(Boolean);
6823
+ if (!rule) return void 0;
6824
+ return {
6825
+ permissionDecision: "deny",
6826
+ permissionDecisionReason: rule.message
6827
+ };
6828
+ }
6829
+
6809
6830
  // src/commands/cliHook/resolvePermission.ts
6810
6831
  var SUBCOMMAND_READS = [
6811
6832
  {
@@ -6832,6 +6853,8 @@ function findSubcommandAdvice(parts) {
6832
6853
  return void 0;
6833
6854
  }
6834
6855
  function findDeny(toolName, parts) {
6856
+ const builtinDeny = findBuiltinDeny(parts);
6857
+ if (builtinDeny) return builtinDeny;
6835
6858
  for (const part of parts) {
6836
6859
  const configDeny = matchesConfigDeny(part);
6837
6860
  if (configDeny) {
@@ -6914,23 +6937,24 @@ async function cliHook() {
6914
6937
  }
6915
6938
 
6916
6939
  // src/commands/cliHook/cliHookCheck.ts
6940
+ function reportDeny(toolName, parts) {
6941
+ const denied = findDeny(toolName, parts);
6942
+ if (!denied) return false;
6943
+ console.log(`denied: ${denied.permissionDecisionReason}`);
6944
+ process.exitCode = 1;
6945
+ return true;
6946
+ }
6917
6947
  function cliHookCheck(command, toolName = "Bash") {
6918
6948
  const trimmed = command.trim();
6919
6949
  const result = splitCompound(trimmed);
6920
6950
  if (!result.ok) {
6951
+ if (reportDeny(toolName, [trimmed])) return;
6921
6952
  console.log(`not approved (${result.error})`);
6922
6953
  process.exitCode = 1;
6923
6954
  return;
6924
6955
  }
6925
6956
  const parts = result.parts;
6926
- for (const part of parts) {
6927
- const configDeny = matchesConfigDeny(part);
6928
- if (configDeny) {
6929
- console.log(`denied: ${configDeny.message}`);
6930
- process.exitCode = 1;
6931
- return;
6932
- }
6933
- }
6957
+ if (reportDeny(toolName, parts)) return;
6934
6958
  const reasons = [];
6935
6959
  for (const part of parts) {
6936
6960
  const reason = isApprovedRead(part, toolName);
@@ -10285,11 +10309,73 @@ function comment2(path52, line, body, startLine) {
10285
10309
  }
10286
10310
  }
10287
10311
 
10312
+ // src/commands/prs/create.ts
10313
+ import { execSync as execSync30 } from "child_process";
10314
+
10315
+ // src/commands/prs/buildCreateArgs.ts
10316
+ function buildCreateArgs(title, body, options2) {
10317
+ const args = [
10318
+ "gh pr create",
10319
+ `--title ${shellQuote(title)}`,
10320
+ `--body ${shellQuote(body)}`
10321
+ ];
10322
+ const valueFlags = [
10323
+ ["--base", options2.base],
10324
+ ["--head", options2.head],
10325
+ ["--milestone", options2.milestone]
10326
+ ];
10327
+ for (const [flag, value] of valueFlags) {
10328
+ if (value) args.push(`${flag} ${shellQuote(value)}`);
10329
+ }
10330
+ if (options2.draft) args.push("--draft");
10331
+ if (options2.web) args.push("--web");
10332
+ const repeatableFlags = [
10333
+ ["--label", options2.label],
10334
+ ["--assignee", options2.assignee],
10335
+ ["--reviewer", options2.reviewer]
10336
+ ];
10337
+ for (const [flag, values] of repeatableFlags) {
10338
+ for (const value of values ?? []) {
10339
+ args.push(`${flag} ${shellQuote(value)}`);
10340
+ }
10341
+ }
10342
+ return args;
10343
+ }
10344
+
10345
+ // src/commands/prs/validatePrContent.ts
10346
+ function validatePrContent(title, body) {
10347
+ if (title.toLowerCase().includes("claude")) {
10348
+ console.error("Error: PR title must not reference Claude");
10349
+ process.exit(1);
10350
+ }
10351
+ if (body.toLowerCase().includes("claude")) {
10352
+ console.error("Error: PR body must not reference Claude");
10353
+ process.exit(1);
10354
+ }
10355
+ }
10356
+
10357
+ // src/commands/prs/create.ts
10358
+ function create(options2) {
10359
+ if (!options2.title || !options2.body) {
10360
+ console.error(
10361
+ "Usage: assist prs create --title <title> --body <body> [--base <branch>] [--head <branch>] [--draft] [--web] [--label <label>] [--assignee <login>] [--reviewer <handle>] [--milestone <name>]"
10362
+ );
10363
+ process.exit(1);
10364
+ }
10365
+ validatePrContent(options2.title, options2.body);
10366
+ const args = buildCreateArgs(options2.title, options2.body, options2);
10367
+ try {
10368
+ execSync30(args.join(" "), { stdio: "inherit" });
10369
+ } catch (_error) {
10370
+ process.exit(1);
10371
+ }
10372
+ }
10373
+
10288
10374
  // src/commands/prs/fixed.ts
10289
- import { execSync as execSync31 } from "child_process";
10375
+ import { execSync as execSync32 } from "child_process";
10290
10376
 
10291
10377
  // src/commands/prs/resolveCommentWithReply.ts
10292
- import { execSync as execSync30 } from "child_process";
10378
+ import { execSync as execSync31 } from "child_process";
10293
10379
  import { unlinkSync as unlinkSync8, writeFileSync as writeFileSync21 } from "fs";
10294
10380
  import { tmpdir as tmpdir5 } from "os";
10295
10381
  import { join as join32 } from "path";
@@ -10319,7 +10405,7 @@ function deleteCommentsCache(prNumber) {
10319
10405
 
10320
10406
  // src/commands/prs/resolveCommentWithReply.ts
10321
10407
  function replyToComment(org, repo, prNumber, commentId, message) {
10322
- execSync30(
10408
+ execSync31(
10323
10409
  `gh api repos/${org}/${repo}/pulls/${prNumber}/comments -f body="${message.replace(/"/g, '\\"')}" -F in_reply_to=${commentId}`,
10324
10410
  { stdio: ["inherit", "pipe", "inherit"] }
10325
10411
  );
@@ -10329,7 +10415,7 @@ function resolveThread(threadId) {
10329
10415
  const queryFile = join32(tmpdir5(), `gh-mutation-${Date.now()}.graphql`);
10330
10416
  writeFileSync21(queryFile, mutation);
10331
10417
  try {
10332
- execSync30(
10418
+ execSync31(
10333
10419
  `gh api graphql -F query=@${queryFile} -f threadId="${threadId}"`,
10334
10420
  { stdio: ["inherit", "pipe", "inherit"] }
10335
10421
  );
@@ -10381,7 +10467,7 @@ function resolveCommentWithReply(commentId, message) {
10381
10467
  // src/commands/prs/fixed.ts
10382
10468
  function verifySha(sha) {
10383
10469
  try {
10384
- return execSync31(`git rev-parse --verify ${sha}`, {
10470
+ return execSync32(`git rev-parse --verify ${sha}`, {
10385
10471
  encoding: "utf-8"
10386
10472
  }).trim();
10387
10473
  } catch {
@@ -10395,7 +10481,7 @@ function fixed(commentId, sha) {
10395
10481
  const { org, repo } = getRepoInfo();
10396
10482
  const repoUrl = `https://github.com/${org}/${repo}`;
10397
10483
  const message = `Fixed in [${fullSha}](${repoUrl}/commit/${fullSha})`;
10398
- execSync31("git push", { stdio: "inherit" });
10484
+ execSync32("git push", { stdio: "inherit" });
10399
10485
  resolveCommentWithReply(commentId, message);
10400
10486
  } catch (error) {
10401
10487
  if (isGhNotInstalled(error)) {
@@ -10413,7 +10499,7 @@ import { join as join34 } from "path";
10413
10499
  import { stringify } from "yaml";
10414
10500
 
10415
10501
  // src/commands/prs/fetchThreadIds.ts
10416
- import { execSync as execSync32 } from "child_process";
10502
+ import { execSync as execSync33 } from "child_process";
10417
10503
  import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync22 } from "fs";
10418
10504
  import { tmpdir as tmpdir6 } from "os";
10419
10505
  import { join as join33 } from "path";
@@ -10422,7 +10508,7 @@ function fetchThreadIds(org, repo, prNumber) {
10422
10508
  const queryFile = join33(tmpdir6(), `gh-query-${Date.now()}.graphql`);
10423
10509
  writeFileSync22(queryFile, THREAD_QUERY);
10424
10510
  try {
10425
- const result = execSync32(
10511
+ const result = execSync33(
10426
10512
  `gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
10427
10513
  { encoding: "utf-8" }
10428
10514
  );
@@ -10444,9 +10530,9 @@ function fetchThreadIds(org, repo, prNumber) {
10444
10530
  }
10445
10531
 
10446
10532
  // src/commands/prs/listComments/fetchReviewComments.ts
10447
- import { execSync as execSync33 } from "child_process";
10533
+ import { execSync as execSync34 } from "child_process";
10448
10534
  function fetchJson(endpoint) {
10449
- const result = execSync33(`gh api --paginate ${endpoint}`, {
10535
+ const result = execSync34(`gh api --paginate ${endpoint}`, {
10450
10536
  encoding: "utf-8"
10451
10537
  });
10452
10538
  if (!result.trim()) return [];
@@ -10585,7 +10671,7 @@ async function listComments() {
10585
10671
  }
10586
10672
 
10587
10673
  // src/commands/prs/prs/index.ts
10588
- import { execSync as execSync34 } from "child_process";
10674
+ import { execSync as execSync35 } from "child_process";
10589
10675
 
10590
10676
  // src/commands/prs/prs/displayPaginated/index.ts
10591
10677
  import enquirer9 from "enquirer";
@@ -10692,7 +10778,7 @@ async function prs(options2) {
10692
10778
  const state = options2.open ? "open" : options2.closed ? "closed" : "all";
10693
10779
  try {
10694
10780
  const { org, repo } = getRepoInfo();
10695
- const result = execSync34(
10781
+ const result = execSync35(
10696
10782
  `gh pr list --state ${state} --json number,title,url,author,createdAt,mergedAt,closedAt,state,changedFiles --limit 100 -R ${org}/${repo}`,
10697
10783
  { encoding: "utf-8" }
10698
10784
  );
@@ -10715,7 +10801,7 @@ async function prs(options2) {
10715
10801
  }
10716
10802
 
10717
10803
  // src/commands/prs/wontfix.ts
10718
- import { execSync as execSync35 } from "child_process";
10804
+ import { execSync as execSync36 } from "child_process";
10719
10805
  function validateReason(reason) {
10720
10806
  const lowerReason = reason.toLowerCase();
10721
10807
  if (lowerReason.includes("claude") || lowerReason.includes("opus")) {
@@ -10732,7 +10818,7 @@ function validateShaReferences(reason) {
10732
10818
  const invalidShas = [];
10733
10819
  for (const sha of shas) {
10734
10820
  try {
10735
- execSync35(`git cat-file -t ${sha}`, { stdio: "pipe" });
10821
+ execSync36(`git cat-file -t ${sha}`, { stdio: "pipe" });
10736
10822
  } catch {
10737
10823
  invalidShas.push(sha);
10738
10824
  }
@@ -10759,9 +10845,30 @@ function wontfix(commentId, reason) {
10759
10845
  }
10760
10846
  }
10761
10847
 
10848
+ // src/commands/registerPrsCreate.ts
10849
+ function collect2(value, previous) {
10850
+ return previous.concat([value]);
10851
+ }
10852
+ function registerPrsCreate(prsCommand) {
10853
+ prsCommand.command("create").description(
10854
+ "Create a pull request via gh pr create, validating the title and body first"
10855
+ ).option("-t, --title <title>", "Title for the pull request").option("-b, --body <body>", "Body for the pull request").option("-B, --base <branch>", "Branch into which the pull request merges").option("-H, --head <branch>", "Branch that contains the commits").option("-d, --draft", "Mark the pull request as a draft").option("-w, --web", "Open the browser to create the pull request").option("-l, --label <label>", "Add a label (repeatable)", collect2, []).option(
10856
+ "-a, --assignee <login>",
10857
+ "Assign a person by login (repeatable)",
10858
+ collect2,
10859
+ []
10860
+ ).option(
10861
+ "-r, --reviewer <handle>",
10862
+ "Request a review (repeatable)",
10863
+ collect2,
10864
+ []
10865
+ ).option("-m, --milestone <name>", "Add the pull request to a milestone").action(create);
10866
+ }
10867
+
10762
10868
  // src/commands/registerPrs.ts
10763
10869
  function registerPrs(program2) {
10764
10870
  const prsCommand = program2.command("prs").description("Pull request utilities").option("--open", "List only open pull requests").option("--closed", "List only closed pull requests").action(prs);
10871
+ registerPrsCreate(prsCommand);
10765
10872
  prsCommand.command("list-comments").description("List all comments on the current branch's pull request").action(() => {
10766
10873
  listComments().then(printComments2);
10767
10874
  });
@@ -10846,10 +10953,10 @@ import chalk119 from "chalk";
10846
10953
  import Enquirer2 from "enquirer";
10847
10954
 
10848
10955
  // src/commands/ravendb/searchItems.ts
10849
- import { execSync as execSync36 } from "child_process";
10956
+ import { execSync as execSync37 } from "child_process";
10850
10957
  import chalk118 from "chalk";
10851
10958
  function opExec(args) {
10852
- return execSync36(`op ${args}`, {
10959
+ return execSync37(`op ${args}`, {
10853
10960
  encoding: "utf-8",
10854
10961
  stdio: ["pipe", "pipe", "pipe"]
10855
10962
  }).trim();
@@ -11001,7 +11108,7 @@ ${errorText}`
11001
11108
  }
11002
11109
 
11003
11110
  // src/commands/ravendb/resolveOpSecret.ts
11004
- import { execSync as execSync37 } from "child_process";
11111
+ import { execSync as execSync38 } from "child_process";
11005
11112
  import chalk123 from "chalk";
11006
11113
  function resolveOpSecret(reference) {
11007
11114
  if (!reference.startsWith("op://")) {
@@ -11009,7 +11116,7 @@ function resolveOpSecret(reference) {
11009
11116
  process.exit(1);
11010
11117
  }
11011
11118
  try {
11012
- return execSync37(`op read "${reference}"`, {
11119
+ return execSync38(`op read "${reference}"`, {
11013
11120
  encoding: "utf-8",
11014
11121
  stdio: ["pipe", "pipe", "pipe"]
11015
11122
  }).trim();
@@ -11258,7 +11365,7 @@ Refactor check failed:
11258
11365
  }
11259
11366
 
11260
11367
  // src/commands/refactor/check/getViolations/index.ts
11261
- import { execSync as execSync38 } from "child_process";
11368
+ import { execSync as execSync39 } from "child_process";
11262
11369
  import fs19 from "fs";
11263
11370
  import { minimatch as minimatch4 } from "minimatch";
11264
11371
 
@@ -11308,7 +11415,7 @@ function getGitFiles(options2) {
11308
11415
  }
11309
11416
  const files = /* @__PURE__ */ new Set();
11310
11417
  if (options2.staged || options2.modified) {
11311
- const staged = execSync38("git diff --cached --name-only", {
11418
+ const staged = execSync39("git diff --cached --name-only", {
11312
11419
  encoding: "utf-8"
11313
11420
  });
11314
11421
  for (const file of staged.trim().split("\n").filter(Boolean)) {
@@ -11316,7 +11423,7 @@ function getGitFiles(options2) {
11316
11423
  }
11317
11424
  }
11318
11425
  if (options2.unstaged || options2.modified) {
11319
- const unstaged = execSync38("git diff --name-only", { encoding: "utf-8" });
11426
+ const unstaged = execSync39("git diff --name-only", { encoding: "utf-8" });
11320
11427
  for (const file of unstaged.trim().split("\n").filter(Boolean)) {
11321
11428
  files.add(file);
11322
11429
  }
@@ -11407,14 +11514,42 @@ import path36 from "path";
11407
11514
  import chalk132 from "chalk";
11408
11515
 
11409
11516
  // src/commands/refactor/extract/applyExtraction.ts
11410
- import { SyntaxKind as SyntaxKind3 } from "ts-morph";
11517
+ import { SyntaxKind as SyntaxKind4 } from "ts-morph";
11518
+
11519
+ // src/commands/refactor/extract/addImportPreservingSuppressions.ts
11520
+ import {
11521
+ SyntaxKind as SyntaxKind2
11522
+ } from "ts-morph";
11523
+ var suppressionPattern = /^\s*(\/\/|\/\*)\s*biome-ignore(-all)?\b/;
11524
+ function countLeadingSuppressions(sourceFile) {
11525
+ let count6 = 0;
11526
+ for (const stmt of sourceFile.getStatementsWithComments()) {
11527
+ const kind = stmt.getKind();
11528
+ if ((kind === SyntaxKind2.SingleLineCommentTrivia || kind === SyntaxKind2.MultiLineCommentTrivia) && suppressionPattern.test(stmt.getText())) {
11529
+ count6++;
11530
+ } else {
11531
+ break;
11532
+ }
11533
+ }
11534
+ return count6;
11535
+ }
11536
+ function addImportPreservingSuppressions(sourceFile, structure) {
11537
+ if (sourceFile.getImportDeclarations().length > 0) {
11538
+ sourceFile.addImportDeclaration(structure);
11539
+ return;
11540
+ }
11541
+ sourceFile.insertImportDeclaration(
11542
+ countLeadingSuppressions(sourceFile),
11543
+ structure
11544
+ );
11545
+ }
11411
11546
 
11412
11547
  // src/commands/refactor/extract/removeStaleImports.ts
11413
- import { SyntaxKind as SyntaxKind2 } from "ts-morph";
11548
+ import { SyntaxKind as SyntaxKind3 } from "ts-morph";
11414
11549
  function collectReferencedNames(sourceFile) {
11415
11550
  const names = /* @__PURE__ */ new Set();
11416
- for (const id of sourceFile.getDescendantsOfKind(SyntaxKind2.Identifier)) {
11417
- if (id.getFirstAncestorByKind(SyntaxKind2.ImportDeclaration)) continue;
11551
+ for (const id of sourceFile.getDescendantsOfKind(SyntaxKind3.Identifier)) {
11552
+ if (id.getFirstAncestorByKind(SyntaxKind3.ImportDeclaration)) continue;
11418
11553
  names.add(id.getText());
11419
11554
  }
11420
11555
  return names;
@@ -11457,7 +11592,7 @@ function updateImporters(functionName, sourceFile, importers) {
11457
11592
  importDecl.remove();
11458
11593
  }
11459
11594
  }
11460
- importerFile.addImportDeclaration({
11595
+ addImportPreservingSuppressions(importerFile, {
11461
11596
  moduleSpecifier: relPath2,
11462
11597
  namedImports: [alias ? { name: functionName, alias } : functionName]
11463
11598
  });
@@ -11466,7 +11601,7 @@ function updateImporters(functionName, sourceFile, importers) {
11466
11601
 
11467
11602
  // src/commands/refactor/extract/applyExtraction.ts
11468
11603
  function isNameReferencedInSource(sourceFile, name) {
11469
- return sourceFile.getDescendantsOfKind(SyntaxKind3.Identifier).some((id) => id.getText() === name);
11604
+ return sourceFile.getDescendantsOfKind(SyntaxKind4.Identifier).some((id) => id.getText() === name);
11470
11605
  }
11471
11606
  async function applyExtraction(functionName, sourceFile, destPath, plan2, project) {
11472
11607
  project.createSourceFile(destPath, plan2.destContent, { overwrite: false });
@@ -11478,7 +11613,7 @@ async function applyExtraction(functionName, sourceFile, destPath, plan2, projec
11478
11613
  }
11479
11614
  removeStaleImports(sourceFile);
11480
11615
  if (isNameReferencedInSource(sourceFile, functionName)) {
11481
- sourceFile.addImportDeclaration({
11616
+ addImportPreservingSuppressions(sourceFile, {
11482
11617
  moduleSpecifier: plan2.destRelPath,
11483
11618
  namedImports: [functionName]
11484
11619
  });
@@ -11507,19 +11642,19 @@ async function applyExtraction(functionName, sourceFile, destPath, plan2, projec
11507
11642
 
11508
11643
  // src/commands/refactor/extract/collectDependencies.ts
11509
11644
  import {
11510
- SyntaxKind as SyntaxKind7
11645
+ SyntaxKind as SyntaxKind8
11511
11646
  } from "ts-morph";
11512
11647
 
11513
11648
  // src/commands/refactor/extract/collectPrivateFunctions.ts
11514
- import { SyntaxKind as SyntaxKind4 } from "ts-morph";
11649
+ import { SyntaxKind as SyntaxKind5 } from "ts-morph";
11515
11650
  function isPrivate(fn) {
11516
11651
  return !fn.isExported() && !fn.isDefaultExport();
11517
11652
  }
11518
11653
  function getCalledFunctionNames(fn) {
11519
11654
  const names = /* @__PURE__ */ new Set();
11520
- for (const call of fn.getDescendantsOfKind(SyntaxKind4.CallExpression)) {
11655
+ for (const call of fn.getDescendantsOfKind(SyntaxKind5.CallExpression)) {
11521
11656
  const expr = call.getExpression();
11522
- if (expr.getKind() === SyntaxKind4.Identifier) {
11657
+ if (expr.getKind() === SyntaxKind5.Identifier) {
11523
11658
  names.add(expr.getText());
11524
11659
  }
11525
11660
  }
@@ -11547,10 +11682,10 @@ function collectPrivateFunctions(target, fnMap) {
11547
11682
  }
11548
11683
 
11549
11684
  // src/commands/refactor/extract/collectPrivateStatements.ts
11550
- import { SyntaxKind as SyntaxKind5 } from "ts-morph";
11685
+ import { SyntaxKind as SyntaxKind6 } from "ts-morph";
11551
11686
  function getReferencedIdentifiers(fn) {
11552
11687
  const names = /* @__PURE__ */ new Set();
11553
- for (const id of fn.getDescendantsOfKind(SyntaxKind5.Identifier)) {
11688
+ for (const id of fn.getDescendantsOfKind(SyntaxKind6.Identifier)) {
11554
11689
  names.add(id.getText());
11555
11690
  }
11556
11691
  return names;
@@ -11568,12 +11703,12 @@ function collectPrivateStatements(functions, stmtMap) {
11568
11703
 
11569
11704
  // src/commands/refactor/extract/getFunctionMap.ts
11570
11705
  import {
11571
- SyntaxKind as SyntaxKind6
11706
+ SyntaxKind as SyntaxKind7
11572
11707
  } from "ts-morph";
11573
11708
  function getFunctionMap(sourceFile) {
11574
11709
  const map = /* @__PURE__ */ new Map();
11575
11710
  for (const fn of sourceFile.getDescendantsOfKind(
11576
- SyntaxKind6.FunctionDeclaration
11711
+ SyntaxKind7.FunctionDeclaration
11577
11712
  )) {
11578
11713
  const name = fn.getName();
11579
11714
  if (name) map.set(name, fn);
@@ -11599,7 +11734,7 @@ function getPrivateStatementMap(sourceFile) {
11599
11734
 
11600
11735
  // src/commands/refactor/extract/collectDependencies.ts
11601
11736
  function getRemainingFunctions(sourceFile, extracted) {
11602
- return sourceFile.getDescendantsOfKind(SyntaxKind7.FunctionDeclaration).filter((fn) => !extracted.has(fn));
11737
+ return sourceFile.getDescendantsOfKind(SyntaxKind8.FunctionDeclaration).filter((fn) => !extracted.has(fn));
11603
11738
  }
11604
11739
  function collectFnsUsedByRemaining(remaining, fnMap) {
11605
11740
  const used = /* @__PURE__ */ new Set();
@@ -11634,25 +11769,25 @@ function collectDependencies(target, sourceFile) {
11634
11769
 
11635
11770
  // src/commands/refactor/extract/findFunction.ts
11636
11771
  import {
11637
- SyntaxKind as SyntaxKind8
11772
+ SyntaxKind as SyntaxKind9
11638
11773
  } from "ts-morph";
11639
11774
  function findFunction(sourceFile, functionName) {
11640
- return sourceFile.getDescendantsOfKind(SyntaxKind8.FunctionDeclaration).find((fn) => fn.getName() === functionName);
11775
+ return sourceFile.getDescendantsOfKind(SyntaxKind9.FunctionDeclaration).find((fn) => fn.getName() === functionName);
11641
11776
  }
11642
11777
 
11643
11778
  // src/commands/refactor/extract/getExportedDependencyNames.ts
11644
- import { SyntaxKind as SyntaxKind9 } from "ts-morph";
11779
+ import { SyntaxKind as SyntaxKind10 } from "ts-morph";
11645
11780
  function getExportedDependencyNames(target, sourceFile) {
11646
11781
  const calledNames = /* @__PURE__ */ new Set();
11647
- for (const call of target.getDescendantsOfKind(SyntaxKind9.CallExpression)) {
11782
+ for (const call of target.getDescendantsOfKind(SyntaxKind10.CallExpression)) {
11648
11783
  const expr = call.getExpression();
11649
- if (expr.getKind() === SyntaxKind9.Identifier) {
11784
+ if (expr.getKind() === SyntaxKind10.Identifier) {
11650
11785
  calledNames.add(expr.getText());
11651
11786
  }
11652
11787
  }
11653
11788
  const exported = [];
11654
11789
  for (const fn of sourceFile.getDescendantsOfKind(
11655
- SyntaxKind9.FunctionDeclaration
11790
+ SyntaxKind10.FunctionDeclaration
11656
11791
  )) {
11657
11792
  const name = fn.getName();
11658
11793
  if (name && calledNames.has(name) && fn.isExported()) {
@@ -11663,9 +11798,9 @@ function getExportedDependencyNames(target, sourceFile) {
11663
11798
  }
11664
11799
 
11665
11800
  // src/commands/refactor/extract/getStatementNames.ts
11666
- import { SyntaxKind as SyntaxKind10 } from "ts-morph";
11801
+ import { SyntaxKind as SyntaxKind11 } from "ts-morph";
11667
11802
  function getStatementNames(node) {
11668
- if (node.getKind() === SyntaxKind10.VariableStatement) {
11803
+ if (node.getKind() === SyntaxKind11.VariableStatement) {
11669
11804
  const stmt = node;
11670
11805
  return stmt.getDeclarations().map((d) => d.getName());
11671
11806
  }
@@ -11675,7 +11810,7 @@ function getStatementNames(node) {
11675
11810
 
11676
11811
  // src/commands/refactor/extract/resolveImports.ts
11677
11812
  import {
11678
- SyntaxKind as SyntaxKind11
11813
+ SyntaxKind as SyntaxKind12
11679
11814
  } from "ts-morph";
11680
11815
 
11681
11816
  // src/commands/refactor/extract/matchImport.ts
@@ -11719,7 +11854,7 @@ function matchImport(importDecl, neededNames) {
11719
11854
  function getReferencedNames(nodes) {
11720
11855
  const names = /* @__PURE__ */ new Set();
11721
11856
  for (const node of nodes) {
11722
- for (const id of node.getDescendantsOfKind(SyntaxKind11.Identifier)) {
11857
+ for (const id of node.getDescendantsOfKind(SyntaxKind12.Identifier)) {
11723
11858
  names.add(id.getText());
11724
11859
  }
11725
11860
  }
@@ -11734,7 +11869,7 @@ function getLocallyDeclaredNames(functions) {
11734
11869
  names.add(param.getName());
11735
11870
  }
11736
11871
  for (const varDecl of fn.getDescendantsOfKind(
11737
- SyntaxKind11.VariableDeclaration
11872
+ SyntaxKind12.VariableDeclaration
11738
11873
  )) {
11739
11874
  names.add(varDecl.getName());
11740
11875
  }
@@ -11889,16 +12024,16 @@ function rewriteImportPaths(imports, sourcePath, destPath) {
11889
12024
  }
11890
12025
 
11891
12026
  // src/commands/refactor/extract/sourceReferencesName.ts
11892
- import { SyntaxKind as SyntaxKind12 } from "ts-morph";
12027
+ import { SyntaxKind as SyntaxKind13 } from "ts-morph";
11893
12028
  var DECLARATION_KINDS = /* @__PURE__ */ new Set([
11894
- SyntaxKind12.FunctionDeclaration,
11895
- SyntaxKind12.ImportSpecifier,
11896
- SyntaxKind12.ExportSpecifier
12029
+ SyntaxKind13.FunctionDeclaration,
12030
+ SyntaxKind13.ImportSpecifier,
12031
+ SyntaxKind13.ExportSpecifier
11897
12032
  ]);
11898
12033
  function isInsideExtractedFunction(node, extracted) {
11899
12034
  let current = node;
11900
12035
  while (current) {
11901
- if (current.getKind() !== SyntaxKind12.FunctionDeclaration) {
12036
+ if (current.getKind() !== SyntaxKind13.FunctionDeclaration) {
11902
12037
  current = current.getParent();
11903
12038
  continue;
11904
12039
  }
@@ -11910,7 +12045,7 @@ function isInsideExtractedFunction(node, extracted) {
11910
12045
  }
11911
12046
  function sourceReferencesName(sourceFile, functionName, extractedNames) {
11912
12047
  const extracted = new Set(extractedNames);
11913
- for (const id of sourceFile.getDescendantsOfKind(SyntaxKind12.Identifier)) {
12048
+ for (const id of sourceFile.getDescendantsOfKind(SyntaxKind13.Identifier)) {
11914
12049
  if (id.getText() !== functionName) continue;
11915
12050
  const parent = id.getParent();
11916
12051
  if (!parent || DECLARATION_KINDS.has(parent.getKind())) continue;
@@ -12141,24 +12276,24 @@ async function rename(source, destination, options2 = {}) {
12141
12276
  import chalk135 from "chalk";
12142
12277
 
12143
12278
  // src/commands/refactor/renameSymbol/findSymbol.ts
12144
- import { SyntaxKind as SyntaxKind13 } from "ts-morph";
12279
+ import { SyntaxKind as SyntaxKind14 } from "ts-morph";
12145
12280
  var declarationKinds = [
12146
- SyntaxKind13.VariableDeclaration,
12147
- SyntaxKind13.FunctionDeclaration,
12148
- SyntaxKind13.ClassDeclaration,
12149
- SyntaxKind13.InterfaceDeclaration,
12150
- SyntaxKind13.TypeAliasDeclaration,
12151
- SyntaxKind13.EnumDeclaration,
12152
- SyntaxKind13.PropertyDeclaration,
12153
- SyntaxKind13.MethodDeclaration,
12154
- SyntaxKind13.Parameter
12281
+ SyntaxKind14.VariableDeclaration,
12282
+ SyntaxKind14.FunctionDeclaration,
12283
+ SyntaxKind14.ClassDeclaration,
12284
+ SyntaxKind14.InterfaceDeclaration,
12285
+ SyntaxKind14.TypeAliasDeclaration,
12286
+ SyntaxKind14.EnumDeclaration,
12287
+ SyntaxKind14.PropertyDeclaration,
12288
+ SyntaxKind14.MethodDeclaration,
12289
+ SyntaxKind14.Parameter
12155
12290
  ];
12156
12291
  function isDeclaration(identifier) {
12157
12292
  const parent = identifier.getParent();
12158
12293
  return parent !== void 0 && declarationKinds.includes(parent.getKind());
12159
12294
  }
12160
12295
  function findSymbol(sourceFile, symbolName) {
12161
- for (const id of sourceFile.getDescendantsOfKind(SyntaxKind13.Identifier)) {
12296
+ for (const id of sourceFile.getDescendantsOfKind(SyntaxKind14.Identifier)) {
12162
12297
  if (id.getText() === symbolName && isDeclaration(id)) return id;
12163
12298
  }
12164
12299
  return void 0;
@@ -12838,9 +12973,9 @@ function buildReviewPaths(repoRoot, key) {
12838
12973
  }
12839
12974
 
12840
12975
  // src/commands/review/fetchExistingComments.ts
12841
- import { execSync as execSync39 } from "child_process";
12976
+ import { execSync as execSync40 } from "child_process";
12842
12977
  function fetchRawComments(org, repo, prNumber) {
12843
- const out = execSync39(
12978
+ const out = execSync40(
12844
12979
  `gh api --paginate repos/${org}/${repo}/pulls/${prNumber}/comments`,
12845
12980
  { encoding: "utf-8", maxBuffer: 64 * 1024 * 1024 }
12846
12981
  );
@@ -12871,12 +13006,12 @@ function fetchExistingComments() {
12871
13006
  }
12872
13007
 
12873
13008
  // src/commands/review/gatherContext.ts
12874
- import { execSync as execSync41 } from "child_process";
13009
+ import { execSync as execSync42 } from "child_process";
12875
13010
 
12876
13011
  // src/commands/review/fetchPrDiffInfo.ts
12877
- import { execSync as execSync40 } from "child_process";
13012
+ import { execSync as execSync41 } from "child_process";
12878
13013
  function getCurrentBranch2() {
12879
- return execSync40("git rev-parse --abbrev-ref HEAD", {
13014
+ return execSync41("git rev-parse --abbrev-ref HEAD", {
12880
13015
  encoding: "utf-8"
12881
13016
  }).trim();
12882
13017
  }
@@ -12886,7 +13021,7 @@ function fetchPrDiffInfo() {
12886
13021
  const fields = "number,baseRefName,baseRefOid,headRefName,headRefOid";
12887
13022
  let raw;
12888
13023
  try {
12889
- raw = execSync40(`gh pr view ${branch} --json ${fields} -R ${org}/${repo}`, {
13024
+ raw = execSync41(`gh pr view ${branch} --json ${fields} -R ${org}/${repo}`, {
12890
13025
  encoding: "utf-8",
12891
13026
  stdio: ["ignore", "pipe", "pipe"]
12892
13027
  });
@@ -12910,7 +13045,7 @@ function fetchPrDiffInfo() {
12910
13045
  }
12911
13046
  function fetchPrChangedFiles(prNumber) {
12912
13047
  const { org, repo } = getRepoInfo();
12913
- const out = execSync40(`gh pr diff ${prNumber} --name-only -R ${org}/${repo}`, {
13048
+ const out = execSync41(`gh pr diff ${prNumber} --name-only -R ${org}/${repo}`, {
12914
13049
  encoding: "utf-8",
12915
13050
  maxBuffer: 64 * 1024 * 1024
12916
13051
  });
@@ -12918,7 +13053,7 @@ function fetchPrChangedFiles(prNumber) {
12918
13053
  }
12919
13054
  function fetchPrDiff(prNumber) {
12920
13055
  const { org, repo } = getRepoInfo();
12921
- return execSync40(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
13056
+ return execSync41(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
12922
13057
  encoding: "utf-8",
12923
13058
  maxBuffer: 256 * 1024 * 1024
12924
13059
  });
@@ -12926,11 +13061,11 @@ function fetchPrDiff(prNumber) {
12926
13061
 
12927
13062
  // src/commands/review/gatherContext.ts
12928
13063
  function gatherContext() {
12929
- const branch = execSync41("git rev-parse --abbrev-ref HEAD", {
13064
+ const branch = execSync42("git rev-parse --abbrev-ref HEAD", {
12930
13065
  encoding: "utf-8"
12931
13066
  }).trim();
12932
- const sha = execSync41("git rev-parse HEAD", { encoding: "utf-8" }).trim();
12933
- const shortSha = execSync41("git rev-parse --short=7 HEAD", {
13067
+ const sha = execSync42("git rev-parse HEAD", { encoding: "utf-8" }).trim();
13068
+ const shortSha = execSync42("git rev-parse --short=7 HEAD", {
12934
13069
  encoding: "utf-8"
12935
13070
  }).trim();
12936
13071
  const prInfo = fetchPrDiffInfo();
@@ -14242,11 +14377,11 @@ async function reviewPr(repoRoot, options2) {
14242
14377
  }
14243
14378
 
14244
14379
  // src/commands/review/gatherShaContext.ts
14245
- import { execSync as execSync42 } from "child_process";
14380
+ import { execSync as execSync43 } from "child_process";
14246
14381
  function resolveSha(ref, format2) {
14247
14382
  const flag = format2 === "short" ? "--short=7 " : "";
14248
14383
  try {
14249
- return execSync42(`git rev-parse --verify ${flag}${ref}^{commit}`, {
14384
+ return execSync43(`git rev-parse --verify ${flag}${ref}^{commit}`, {
14250
14385
  encoding: "utf-8",
14251
14386
  stdio: ["ignore", "pipe", "pipe"]
14252
14387
  }).trim();
@@ -14260,11 +14395,11 @@ function gatherShaContext(ref) {
14260
14395
  const shortSha = resolveSha(sha, "short");
14261
14396
  const parentSha = resolveSha(`${sha}^`, "long");
14262
14397
  const range = `${parentSha}..${sha}`;
14263
- const changedFiles = execSync42(`git diff --name-only ${range}`, {
14398
+ const changedFiles = execSync43(`git diff --name-only ${range}`, {
14264
14399
  encoding: "utf-8",
14265
14400
  maxBuffer: 64 * 1024 * 1024
14266
14401
  }).trim().split("\n").filter(Boolean);
14267
- const diff2 = execSync42(`git diff ${range}`, {
14402
+ const diff2 = execSync43(`git diff ${range}`, {
14268
14403
  encoding: "utf-8",
14269
14404
  maxBuffer: 256 * 1024 * 1024
14270
14405
  });
@@ -15699,7 +15834,7 @@ import { mkdirSync as mkdirSync14 } from "fs";
15699
15834
  import { join as join45 } from "path";
15700
15835
 
15701
15836
  // src/commands/voice/checkLockFile.ts
15702
- import { execSync as execSync43 } from "child_process";
15837
+ import { execSync as execSync44 } from "child_process";
15703
15838
  import { existsSync as existsSync44, mkdirSync as mkdirSync13, readFileSync as readFileSync34, writeFileSync as writeFileSync27 } from "fs";
15704
15839
  import { join as join44 } from "path";
15705
15840
  function isProcessAlive2(pid) {
@@ -15728,7 +15863,7 @@ function bootstrapVenv() {
15728
15863
  if (existsSync44(getVenvPython())) return;
15729
15864
  console.log("Setting up Python environment...");
15730
15865
  const pythonDir = getPythonDir();
15731
- execSync43(
15866
+ execSync44(
15732
15867
  `uv sync --project "${pythonDir}" --extra runtime --no-install-project`,
15733
15868
  {
15734
15869
  stdio: "inherit",
@@ -15895,11 +16030,11 @@ import { randomBytes } from "crypto";
15895
16030
  import chalk153 from "chalk";
15896
16031
 
15897
16032
  // src/lib/openBrowser.ts
15898
- import { execSync as execSync44 } from "child_process";
16033
+ import { execSync as execSync45 } from "child_process";
15899
16034
  function tryExec(commands) {
15900
16035
  for (const cmd of commands) {
15901
16036
  try {
15902
- execSync44(cmd);
16037
+ execSync45(cmd);
15903
16038
  return true;
15904
16039
  } catch {
15905
16040
  }
@@ -16241,11 +16376,11 @@ function resolveParams(params, cliArgs) {
16241
16376
  }
16242
16377
 
16243
16378
  // src/commands/run/runPreCommands.ts
16244
- import { execSync as execSync45 } from "child_process";
16379
+ import { execSync as execSync46 } from "child_process";
16245
16380
  function runPreCommands(pre, cwd) {
16246
16381
  for (const cmd of pre) {
16247
16382
  try {
16248
- execSync45(cmd, { stdio: "inherit", cwd });
16383
+ execSync46(cmd, { stdio: "inherit", cwd });
16249
16384
  } catch (err) {
16250
16385
  const code = err && typeof err === "object" && "status" in err ? err.status : 1;
16251
16386
  process.exit(code);
@@ -16508,7 +16643,7 @@ function registerRun(program2) {
16508
16643
  }
16509
16644
 
16510
16645
  // src/commands/screenshot/index.ts
16511
- import { execSync as execSync46 } from "child_process";
16646
+ import { execSync as execSync47 } from "child_process";
16512
16647
  import { existsSync as existsSync49, mkdirSync as mkdirSync17, unlinkSync as unlinkSync15, writeFileSync as writeFileSync30 } from "fs";
16513
16648
  import { tmpdir as tmpdir7 } from "os";
16514
16649
  import { join as join51, resolve as resolve13 } from "path";
@@ -16651,7 +16786,7 @@ function runPowerShellScript(processName, outputPath) {
16651
16786
  const scriptPath = join51(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
16652
16787
  writeFileSync30(scriptPath, captureWindowPs1, "utf-8");
16653
16788
  try {
16654
- execSync46(
16789
+ execSync47(
16655
16790
  `powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
16656
16791
  { stdio: ["ignore", "pipe", "pipe"], encoding: "utf-8" }
16657
16792
  );
@@ -17039,7 +17174,7 @@ function syncCommands(claudeDir, targetBase) {
17039
17174
  }
17040
17175
 
17041
17176
  // src/commands/update.ts
17042
- import { execSync as execSync47 } from "child_process";
17177
+ import { execSync as execSync48 } from "child_process";
17043
17178
  import * as path51 from "path";
17044
17179
  function isGlobalNpmInstall(dir) {
17045
17180
  try {
@@ -17047,7 +17182,7 @@ function isGlobalNpmInstall(dir) {
17047
17182
  if (resolved.split(path51.sep).includes("node_modules")) {
17048
17183
  return true;
17049
17184
  }
17050
- const globalPrefix = execSync47("npm prefix -g", { stdio: "pipe" }).toString().trim();
17185
+ const globalPrefix = execSync48("npm prefix -g", { stdio: "pipe" }).toString().trim();
17051
17186
  return resolved.toLowerCase().startsWith(path51.resolve(globalPrefix).toLowerCase());
17052
17187
  } catch {
17053
17188
  return false;
@@ -17058,18 +17193,18 @@ async function update2() {
17058
17193
  console.log(`Assist is installed at: ${installDir}`);
17059
17194
  if (isGitRepo(installDir)) {
17060
17195
  console.log("Detected git repo installation, pulling latest...");
17061
- execSync47("git pull", { cwd: installDir, stdio: "inherit" });
17196
+ execSync48("git pull", { cwd: installDir, stdio: "inherit" });
17062
17197
  console.log("Installing dependencies...");
17063
- execSync47("npm i", { cwd: installDir, stdio: "inherit" });
17198
+ execSync48("npm i", { cwd: installDir, stdio: "inherit" });
17064
17199
  console.log("Building...");
17065
- execSync47("npm run build", { cwd: installDir, stdio: "inherit" });
17200
+ execSync48("npm run build", { cwd: installDir, stdio: "inherit" });
17066
17201
  console.log("Syncing commands...");
17067
- execSync47("assist sync", { stdio: "inherit" });
17202
+ execSync48("assist sync", { stdio: "inherit" });
17068
17203
  } else if (isGlobalNpmInstall(installDir)) {
17069
17204
  console.log("Detected global npm installation, updating...");
17070
- execSync47("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
17205
+ execSync48("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
17071
17206
  console.log("Syncing commands...");
17072
- execSync47("assist sync", { stdio: "inherit" });
17207
+ execSync48("assist sync", { stdio: "inherit" });
17073
17208
  } else {
17074
17209
  console.error(
17075
17210
  "Could not determine installation method. Expected a git repo or global npm install."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.238.0",
3
+ "version": "0.239.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {