@staff0rd/assist 0.121.0 → 0.123.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 (3) hide show
  1. package/README.md +1 -0
  2. package/dist/index.js +53 -38
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -112,6 +112,7 @@ After installation, the `assist` command will be available globally. You can als
112
112
  - `assist status-line` - Format Claude Code status line from JSON stdin
113
113
  - `assist dotnet inspect [sln]` - Run JetBrains inspections on changed .cs files to find dead code
114
114
  - `assist dotnet inspect [sln] --ref <ref>` - Inspect .cs files changed in a specific commit (default: HEAD)
115
+ - `assist dotnet inspect [sln] --base <ref>` - Inspect all .cs files changed since diverging from a base ref (e.g. `--base main` for a full PR)
115
116
  - `assist dotnet inspect [sln] --swea` - Enable solution-wide error analysis (slower but more thorough)
116
117
  - `assist dotnet check-locks` - Check if build output files are locked by a debugger
117
118
  - `assist dotnet deps <csproj>` - Show .csproj project dependency tree and solution membership
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.121.0",
9
+ version: "0.123.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -163,6 +163,11 @@ var assistConfigSchema = z.strictObject({
163
163
  news: z.strictObject({
164
164
  feeds: z.array(z.string()).default([])
165
165
  }).default({ feeds: [] }),
166
+ dotnet: z.strictObject({
167
+ inspect: z.strictObject({
168
+ suppress: z.array(z.string()).default([])
169
+ }).default({ suppress: [] })
170
+ }).optional(),
166
171
  ravendb: z.strictObject({
167
172
  connections: z.array(
168
173
  z.strictObject({
@@ -4718,27 +4723,6 @@ function formatElapsed(ms) {
4718
4723
  return `${mins}m ${remainSecs.toFixed(1)}s`;
4719
4724
  }
4720
4725
 
4721
- // src/commands/dotnet/deadCodeRules.ts
4722
- var deadCodeRules = /* @__PURE__ */ new Set([
4723
- "UnusedMember.Global",
4724
- "UnusedMember.Local",
4725
- "UnusedType.Global",
4726
- "UnusedType.Local",
4727
- "UnusedParameter.Global",
4728
- "UnusedParameter.Local",
4729
- "NotAccessedField.Global",
4730
- "NotAccessedField.Local",
4731
- "NotAccessedVariable.Local",
4732
- "UnusedAutoPropertyAccessor.Global",
4733
- "UnusedAutoPropertyAccessor.Local",
4734
- "ClassNeverInstantiated.Global",
4735
- "ClassNeverInstantiated.Local",
4736
- "UnusedMethodReturnValue.Global",
4737
- "UnusedMethodReturnValue.Local",
4738
- "UnusedVariable.Compiler",
4739
- "RedundantUsingDirective"
4740
- ]);
4741
-
4742
4726
  // src/commands/dotnet/displayIssues.ts
4743
4727
  import chalk52 from "chalk";
4744
4728
  var SEVERITY_COLOR = {
@@ -4773,6 +4757,33 @@ function displayIssues(issues) {
4773
4757
  ${issues.length} issue(s) found`));
4774
4758
  }
4775
4759
 
4760
+ // src/commands/dotnet/deadCodeRules.ts
4761
+ var deadCodeRules = /* @__PURE__ */ new Set([
4762
+ "UnusedMember.Local",
4763
+ "UnusedType.Local",
4764
+ "UnusedParameter.Global",
4765
+ "UnusedParameter.Local",
4766
+ "NotAccessedField.Global",
4767
+ "NotAccessedField.Local",
4768
+ "NotAccessedVariable.Local",
4769
+ "UnusedAutoPropertyAccessor.Global",
4770
+ "UnusedAutoPropertyAccessor.Local",
4771
+ "ClassNeverInstantiated.Global",
4772
+ "ClassNeverInstantiated.Local",
4773
+ "UnusedMethodReturnValue.Global",
4774
+ "UnusedMethodReturnValue.Local",
4775
+ "UnusedVariable.Compiler",
4776
+ "RedundantUsingDirective"
4777
+ ]);
4778
+
4779
+ // src/commands/dotnet/filterIssues.ts
4780
+ function filterIssues(issues, all) {
4781
+ const suppress = new Set(loadConfig().dotnet?.inspect.suppress ?? []);
4782
+ return issues.filter(
4783
+ (i) => (all || deadCodeRules.has(i.typeId)) && !suppress.has(i.typeId)
4784
+ );
4785
+ }
4786
+
4776
4787
  // src/commands/dotnet/findSolution.ts
4777
4788
  import { readdirSync as readdirSync4 } from "fs";
4778
4789
  import { dirname as dirname16, join as join17 } from "path";
@@ -4808,8 +4819,15 @@ function findSolution() {
4808
4819
 
4809
4820
  // src/commands/dotnet/getChangedCsFiles.ts
4810
4821
  import { execSync as execSync20 } from "child_process";
4811
- function getChangedCsFiles(ref) {
4812
- const cmd = ref ? `git diff --name-only ${ref}~1 ${ref}` : "git diff --name-only HEAD";
4822
+ function getChangedCsFiles(ref, base) {
4823
+ let cmd;
4824
+ if (base) {
4825
+ cmd = `git diff --name-only ${base}...HEAD`;
4826
+ } else if (ref) {
4827
+ cmd = `git diff --name-only ${ref}~1 ${ref}`;
4828
+ } else {
4829
+ cmd = "git diff --name-only HEAD";
4830
+ }
4813
4831
  const output = execSync20(cmd, { encoding: "utf-8" }).trim();
4814
4832
  if (output === "") return [];
4815
4833
  return output.split("\n").filter((f) => f.toLowerCase().endsWith(".cs"));
@@ -4887,14 +4905,6 @@ function resolveSolution(sln) {
4887
4905
  }
4888
4906
  return findSolution();
4889
4907
  }
4890
- function runAndParse(resolved, changedFiles, all, swea) {
4891
- const start3 = Date.now();
4892
- const report = runInspectCode(resolved, changedFiles.join(";"), swea);
4893
- const elapsed = Date.now() - start3;
4894
- const allIssues = parseInspectReport(report);
4895
- const issues = all ? allIssues : allIssues.filter((i) => deadCodeRules.has(i.typeId));
4896
- return { issues, elapsed };
4897
- }
4898
4908
  function reportResults(issues, elapsed) {
4899
4909
  if (issues.length > 0) displayIssues(issues);
4900
4910
  else console.log(chalk55.green("No issues found"));
@@ -4905,7 +4915,7 @@ async function inspect(sln, options2) {
4905
4915
  const resolved = resolveSolution(sln);
4906
4916
  checkBuildLocks();
4907
4917
  assertJbInstalled();
4908
- const changedFiles = getChangedCsFiles(options2.ref);
4918
+ const changedFiles = getChangedCsFiles(options2.ref, options2.base);
4909
4919
  if (changedFiles.length === 0) {
4910
4920
  console.log(chalk55.green("No changed .cs files found"));
4911
4921
  return;
@@ -4913,13 +4923,15 @@ async function inspect(sln, options2) {
4913
4923
  console.log(
4914
4924
  chalk55.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
4915
4925
  );
4916
- const result = runAndParse(
4926
+ const start3 = Date.now();
4927
+ const report = runInspectCode(
4917
4928
  resolved,
4918
- changedFiles,
4919
- !!options2.all,
4929
+ changedFiles.join(";"),
4920
4930
  !!options2.swea
4921
4931
  );
4922
- reportResults(result.issues, result.elapsed);
4932
+ const elapsed = Date.now() - start3;
4933
+ const issues = filterIssues(parseInspectReport(report), !!options2.all);
4934
+ reportResults(issues, elapsed);
4923
4935
  }
4924
4936
 
4925
4937
  // src/commands/registerDotnet.ts
@@ -4927,7 +4939,10 @@ function registerDotnet(program2) {
4927
4939
  const cmd = program2.command("dotnet").description(".NET project utilities");
4928
4940
  cmd.command("inspect").description(
4929
4941
  "Run JetBrains inspections on changed .cs files to find dead code"
4930
- ).argument("[sln]", "Path to a .sln file (auto-detected if omitted)").option("--ref <ref>", "Git commit to inspect (default: working copy)").option("--all", "Show all issues, not just dead code").option("--swea", "Enable solution-wide error analysis").action(inspect);
4942
+ ).argument("[sln]", "Path to a .sln file (auto-detected if omitted)").option("--ref <ref>", "Git commit to inspect (default: working copy)").option(
4943
+ "--base <ref>",
4944
+ "Compare against a base ref using merge-base (e.g. main); inspects all PR changes"
4945
+ ).option("--all", "Show all issues, not just dead code").option("--swea", "Enable solution-wide error analysis").action(inspect);
4931
4946
  cmd.command("check-locks").description("Check if build output files are locked by a debugger").action(checkBuildLocksCommand);
4932
4947
  cmd.command("deps").description("Show .csproj project dependency tree and solution membership").argument("<csproj>", "Path to a .csproj file").option("--json", "Output as JSON").action(deps);
4933
4948
  cmd.command("in-sln").description("Check whether a .csproj is referenced by any .sln file").argument("<csproj>", "Path to a .csproj file").action(inSln);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.121.0",
3
+ "version": "0.123.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {