@staff0rd/assist 0.32.5 → 0.33.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.
Files changed (2) hide show
  1. package/dist/index.js +33 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import { execSync as execSync16 } from "child_process";
4
+ import { execSync as execSync17 } from "child_process";
5
5
  import { Command } from "commander";
6
6
 
7
7
  // src/commands/commit.ts
@@ -2291,9 +2291,7 @@ async function listComments() {
2291
2291
  const lineComments = JSON.parse(lineResult);
2292
2292
  for (const comment of lineComments) {
2293
2293
  const threadId = threadMap.get(comment.id) ?? "";
2294
- if (resolvedThreadIds.has(threadId)) {
2295
- continue;
2296
- }
2294
+ const resolved = resolvedThreadIds.has(threadId);
2297
2295
  allComments.push({
2298
2296
  type: "line",
2299
2297
  id: comment.id,
@@ -2303,7 +2301,8 @@ async function listComments() {
2303
2301
  line: comment.line,
2304
2302
  body: comment.body,
2305
2303
  diff_hunk: comment.diff_hunk,
2306
- html_url: comment.html_url
2304
+ html_url: comment.html_url,
2305
+ resolved
2307
2306
  });
2308
2307
  }
2309
2308
  }
@@ -2419,6 +2418,7 @@ Page ${page + 1} of ${totalPages} (${pullRequests.length} total)
2419
2418
  }
2420
2419
 
2421
2420
  // src/commands/prs/wontfix.ts
2421
+ import { execSync as execSync14 } from "child_process";
2422
2422
  function validateReason(reason) {
2423
2423
  const lowerReason = reason.toLowerCase();
2424
2424
  if (lowerReason.includes("claude") || lowerReason.includes("opus")) {
@@ -2426,8 +2426,30 @@ function validateReason(reason) {
2426
2426
  process.exit(1);
2427
2427
  }
2428
2428
  }
2429
+ function validateShaReferences(reason) {
2430
+ const commitLinkPattern = /\[[0-9a-f]{7}\]\(https:\/\/github\.com\/[^/]+\/[^/]+\/commit\/([0-9a-f]{40})\)/gi;
2431
+ const shas = Array.from(reason.matchAll(commitLinkPattern), (m) => m[1]);
2432
+ if (shas.length === 0) {
2433
+ return;
2434
+ }
2435
+ const invalidShas = [];
2436
+ for (const sha of shas) {
2437
+ try {
2438
+ execSync14(`git cat-file -t ${sha}`, { stdio: "pipe" });
2439
+ } catch {
2440
+ invalidShas.push(sha);
2441
+ }
2442
+ }
2443
+ if (invalidShas.length > 0) {
2444
+ console.error(
2445
+ `Error: The following SHA references do not exist in git: ${invalidShas.join(", ")}`
2446
+ );
2447
+ process.exit(1);
2448
+ }
2449
+ }
2429
2450
  function wontfix(commentId, reason) {
2430
2451
  validateReason(reason);
2452
+ validateShaReferences(reason);
2431
2453
  try {
2432
2454
  const prNumber = getCurrentPrNumber();
2433
2455
  const { org, repo } = getRepoInfo();
@@ -2476,7 +2498,7 @@ import { spawn as spawn2 } from "child_process";
2476
2498
  import * as path14 from "path";
2477
2499
 
2478
2500
  // src/commands/refactor/getViolations.ts
2479
- import { execSync as execSync14 } from "child_process";
2501
+ import { execSync as execSync15 } from "child_process";
2480
2502
  import fs14 from "fs";
2481
2503
  import { minimatch as minimatch2 } from "minimatch";
2482
2504
 
@@ -2581,7 +2603,7 @@ function getGitFiles(options) {
2581
2603
  }
2582
2604
  const files = /* @__PURE__ */ new Set();
2583
2605
  if (options.staged || options.modified) {
2584
- const staged = execSync14("git diff --cached --name-only", {
2606
+ const staged = execSync15("git diff --cached --name-only", {
2585
2607
  encoding: "utf-8"
2586
2608
  });
2587
2609
  for (const file of staged.trim().split("\n").filter(Boolean)) {
@@ -2589,7 +2611,7 @@ function getGitFiles(options) {
2589
2611
  }
2590
2612
  }
2591
2613
  if (options.unstaged || options.modified) {
2592
- const unstaged = execSync14("git diff --name-only", { encoding: "utf-8" });
2614
+ const unstaged = execSync15("git diff --name-only", { encoding: "utf-8" });
2593
2615
  for (const file of unstaged.trim().split("\n").filter(Boolean)) {
2594
2616
  files.add(file);
2595
2617
  }
@@ -3401,11 +3423,11 @@ function summarise() {
3401
3423
  }
3402
3424
 
3403
3425
  // src/commands/verify/hardcodedColors.ts
3404
- import { execSync as execSync15 } from "child_process";
3426
+ import { execSync as execSync16 } from "child_process";
3405
3427
  var pattern = "0x[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,6}";
3406
3428
  function hardcodedColors() {
3407
3429
  try {
3408
- const output = execSync15(`grep -rEnH '${pattern}' src/`, {
3430
+ const output = execSync16(`grep -rEnH '${pattern}' src/`, {
3409
3431
  encoding: "utf-8"
3410
3432
  });
3411
3433
  const lines = output.trim().split("\n");
@@ -3515,7 +3537,7 @@ program.command("init").description("Initialize VS Code and verify configuration
3515
3537
  program.command("commit <message>").description("Create a git commit with validation").action(commit);
3516
3538
  program.command("update").description("Update claude-code to the latest version").action(() => {
3517
3539
  console.log("Updating claude-code...");
3518
- execSync16("npm install -g @anthropic-ai/claude-code", { stdio: "inherit" });
3540
+ execSync17("npm install -g @anthropic-ai/claude-code", { stdio: "inherit" });
3519
3541
  });
3520
3542
  var prsCommand = program.command("prs").description("Pull request utilities").option("--open", "List only open pull requests").option("--closed", "List only closed pull requests").action(prs);
3521
3543
  prsCommand.command("list-comments").description("List all comments on the current branch's pull request").action(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.32.5",
3
+ "version": "0.33.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {