debtlens 0.1.0 → 0.2.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 (40) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +24 -8
  3. package/dist/cli/index.js +85 -4
  4. package/dist/cli/index.js.map +1 -1
  5. package/dist/config/defaults.js +3 -0
  6. package/dist/config/defaults.js.map +1 -1
  7. package/dist/config/mergeConfig.js +5 -0
  8. package/dist/config/mergeConfig.js.map +1 -1
  9. package/dist/config/schema.js +12 -0
  10. package/dist/config/schema.js.map +1 -1
  11. package/dist/core/scan.js +33 -18
  12. package/dist/core/scan.js.map +1 -1
  13. package/dist/core/types.d.ts +11 -0
  14. package/dist/detectors/duplicateLogic.js +3 -0
  15. package/dist/detectors/duplicateLogic.js.map +1 -1
  16. package/dist/detectors/effectComplexity.js +4 -3
  17. package/dist/detectors/effectComplexity.js.map +1 -1
  18. package/dist/detectors/propDrilling.js +2 -1
  19. package/dist/detectors/propDrilling.js.map +1 -1
  20. package/dist/reporters/index.d.ts +1 -0
  21. package/dist/reporters/index.js +1 -1
  22. package/dist/reporters/index.js.map +1 -1
  23. package/dist/reporters/sarifReporter.js +2 -2
  24. package/dist/reporters/sarifReporter.js.map +1 -1
  25. package/dist/reporters/terminalReporter.d.ts +1 -0
  26. package/dist/reporters/terminalReporter.js +3 -0
  27. package/dist/reporters/terminalReporter.js.map +1 -1
  28. package/dist/utils/git.d.ts +6 -0
  29. package/dist/utils/git.js +39 -1
  30. package/dist/utils/git.js.map +1 -1
  31. package/dist/utils/hostComponents.d.ts +4 -1
  32. package/dist/utils/hostComponents.js +8 -2
  33. package/dist/utils/hostComponents.js.map +1 -1
  34. package/dist/utils/packageInfo.d.ts +1 -0
  35. package/dist/utils/packageInfo.js +22 -0
  36. package/dist/utils/packageInfo.js.map +1 -0
  37. package/docs/good-first-issues.md +127 -16
  38. package/docs/rules.md +43 -1
  39. package/package.json +1 -1
  40. package/schema/debtlens.config.schema.json +14 -0
@@ -12,6 +12,7 @@ export const propDrillingDetector = {
12
12
  detect(context) {
13
13
  const issues = [];
14
14
  const maxForwardedProps = context.getThreshold("prop-drilling.maxForwardedProps", 4);
15
+ const customIgnoreComponents = context.options.propDrillingIgnoreComponents;
15
16
  for (const file of context.files) {
16
17
  for (const fn of collectFunctionLikes(file)) {
17
18
  if (fn.classification !== "component")
@@ -29,7 +30,7 @@ export const propDrillingDetector = {
29
30
  const tagName = jsx.getTagNameNode().getText();
30
31
  // Skip host elements (lowercase DOM tags) and UI primitives (RN/icon
31
32
  // components are PascalCase but aren't user-defined children).
32
- if (/^[a-z]/.test(tagName) || isHostComponent(tagName))
33
+ if (/^[a-z]/.test(tagName) || isHostComponent(tagName, customIgnoreComponents))
33
34
  continue;
34
35
  const childForwarded = new Set();
35
36
  for (const attribute of jsx.getAttributes()) {
@@ -1 +1 @@
1
- {"version":3,"file":"propDrilling.js","sourceRoot":"","sources":["../../src/detectors/propDrilling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,CAAC,MAAM,oBAAoB,GAAa;IAC5C,EAAE,EAAE,eAAe;IACnB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,iEAAiE;IAC9E,eAAe,EAAE,QAAQ;IACzB,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,kBAAkB,CAAC;IAC5C,MAAM,CAAC,OAAwB;QAC7B,MAAM,MAAM,GAAgB,EAAE,CAAC;QAC/B,MAAM,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,i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,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACrB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { OutputFormat, ScanResult } from "../core/types.js";
2
2
  export declare function renderReport(result: ScanResult, format: OutputFormat, options?: {
3
3
  color?: boolean;
4
+ quiet?: boolean;
4
5
  }): string;
@@ -9,6 +9,6 @@ export function renderReport(result, format, options = {}) {
9
9
  return renderMarkdown(result);
10
10
  if (format === "sarif")
11
11
  return renderSarif(result);
12
- return renderTerminal(result, { color: options.color ?? true });
12
+ return renderTerminal(result, { color: options.color ?? true, quiet: options.quiet });
13
13
  }
14
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reporters/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,UAAU,YAAY,CAAC,MAAkB,EAAE,MAAoB,EAAE,UAA+B,EAAE;IACtG,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;IACjD,IAAI,MAAM,KAAK,UAAU;QAAE,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;IACzD,IAAI,MAAM,KAAK,OAAO;QAAE,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC;IACnD,OAAO,cAAc,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC,CAAC;AAClE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reporters/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,UAAU,YAAY,CAAC,MAAkB,EAAE,MAAoB,EAAE,UAAgD,EAAE;IACvH,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;IACjD,IAAI,MAAM,KAAK,UAAU;QAAE,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;IACzD,IAAI,MAAM,KAAK,OAAO;QAAE,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC;IACnD,OAAO,cAAc,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;AACxF,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { allDetectors } from "../detectors/index.js";
2
- const TOOL_VERSION = "0.1.0";
2
+ import { packageVersion } from "../utils/packageInfo.js";
3
3
  const INFORMATION_URI = "https://github.com/ColumbusLabs/debtlens";
4
4
  function toSarifLevel(severity) {
5
5
  switch (severity) {
@@ -64,7 +64,7 @@ export function renderSarif(result) {
64
64
  driver: {
65
65
  name: "DebtLens",
66
66
  informationUri: INFORMATION_URI,
67
- version: TOOL_VERSION,
67
+ version: packageVersion,
68
68
  rules,
69
69
  },
70
70
  },
@@ -1 +1 @@
1
- {"version":3,"file":"sarifReporter.js","sourceRoot":"","sources":["../../src/reporters/sarifReporter.ts"],"names":[],"mappings":"AACA,OAAO,EAA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AAO,EAAE,+CAA+C;QACxD,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE;YACJ;gBACE,IAAI,EAAE;oBACJ,MAAM,EAAE;wBACN,IAAI,EAAE,UAAU;wBAChB,cAAc,EAAE,eAAe;wBAC/B,OAAO,EAAE,cAAc;wBACvB,KAAK;qBACN;iBACF;gBACD,OAAO;aACR;SACF;KACF,CAAC;IAEF,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;AAC/C,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { ScanResult } from "../core/types.js";
2
2
  export declare function renderTerminal(result: ScanResult, options?: {
3
3
  color: boolean;
4
+ quiet?: boolean;
4
5
  }): string;
@@ -6,6 +6,9 @@ export function renderTerminal(result, options = { color: true }) {
6
6
  lines.push(color.bold("DebtLens Report"));
7
7
  lines.push(`Scanned ${result.summary.filesScanned} files with ${result.summary.rulesRun} rules in ${result.summary.elapsedMs}ms.`);
8
8
  lines.push(`Issues: ${result.summary.totalIssues} | high ${result.summary.bySeverity.high} | medium ${result.summary.bySeverity.medium} | low ${result.summary.bySeverity.low} | info ${result.summary.bySeverity.info}`);
9
+ if (options.quiet) {
10
+ return `${lines.join("\n")}\n`;
11
+ }
9
12
  if (result.issues.length === 0) {
10
13
  lines.push("");
11
14
  lines.push("No maintainability debt found at the configured severity level.");
@@ -1 +1 @@
1
- {"version":3,"file":"terminalReporter.js","sourceRoot":"","sources":["../../src/reporters/terminalReporter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,aAAa,GAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAEpE,MAAM,UAAU,cAAc,CAAC,MAAkB,EAAE,UAA8B,EAAE,KAAK,EAAE,IAAI,EAAE;IAC9F,MAAM,KAAK,GAAG,eAAe,CAAC,OAAO,CAAC,KAAK,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AAK,MAAM,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;oBAClD,KAAK,CAAC,IAAI,CAAC,OAAO,QAAQ,EAAE,CAAC,CAAC;gBAChC,CAAC;YACH,CAAC;YACD,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;gBACrB,KAAK,CAAC,IAAI,CAAC,iBAAiB,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;YAClD,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;IAED,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC"}
@@ -2,6 +2,7 @@ export declare function isGitRepo(cwd: string): boolean;
2
2
  export interface ChangedFiles {
3
3
  root: string;
4
4
  files: string[];
5
+ contents?: Record<string, string>;
5
6
  }
6
7
  /**
7
8
  * Collect changed files as absolute paths. Returns `null` when `cwd` is not inside a
@@ -13,3 +14,8 @@ export interface ChangedFiles {
13
14
  * - Deletions are excluded (`--diff-filter=d`) since deleted files cannot be scanned.
14
15
  */
15
16
  export declare function getChangedFiles(cwd: string, base?: string): ChangedFiles | null;
17
+ /**
18
+ * Collect staged files as absolute paths for pre-commit scans. Returns `null` when
19
+ * `cwd` is not inside a git work tree, matching `getChangedFiles` graceful behavior.
20
+ */
21
+ export declare function getStagedFiles(cwd: string): ChangedFiles | null;
package/dist/utils/git.js CHANGED
@@ -1,11 +1,15 @@
1
1
  import { execFileSync } from "node:child_process";
2
+ import { realpathSync } from "node:fs";
2
3
  import { resolve } from "node:path";
3
4
  function git(cwd, args) {
5
+ return gitRaw(cwd, args).trim();
6
+ }
7
+ function gitRaw(cwd, args) {
4
8
  return execFileSync("git", args, {
5
9
  cwd,
6
10
  encoding: "utf8",
7
11
  stdio: ["ignore", "pipe", "ignore"],
8
- }).trim();
12
+ });
9
13
  }
10
14
  function gitSafe(cwd, args) {
11
15
  try {
@@ -65,4 +69,38 @@ export function getChangedFiles(cwd, base) {
65
69
  add(gitSafe(cwd, ["ls-files", "--others", "--exclude-standard"]));
66
70
  return { root, files: [...relative].map((path) => resolve(root, path)) };
67
71
  }
72
+ /**
73
+ * Collect staged files as absolute paths for pre-commit scans. Returns `null` when
74
+ * `cwd` is not inside a git work tree, matching `getChangedFiles` graceful behavior.
75
+ */
76
+ export function getStagedFiles(cwd) {
77
+ if (!isGitRepo(cwd))
78
+ return null;
79
+ let root;
80
+ try {
81
+ root = git(cwd, ["rev-parse", "--show-toplevel"]);
82
+ }
83
+ catch {
84
+ return null;
85
+ }
86
+ const output = git(cwd, ["diff", "--cached", "--name-only", "--diff-filter=d"]);
87
+ const relativePaths = output
88
+ .split("\n")
89
+ .map((line) => line.trim())
90
+ .filter(Boolean);
91
+ const files = relativePaths.map((path) => resolve(root, path));
92
+ const contents = Object.fromEntries(relativePaths.map((path) => {
93
+ const absolutePath = resolve(root, path);
94
+ return [canonicalize(absolutePath), gitRaw(cwd, ["show", `:${path}`])];
95
+ }));
96
+ return { root, files, contents };
97
+ }
98
+ function canonicalize(path) {
99
+ try {
100
+ return realpathSync.native(path);
101
+ }
102
+ catch {
103
+ return path;
104
+ }
105
+ }
68
106
  //# sourceMappingURL=git.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,SAAS,GAAG,CAAC,GAAW,EAAE,IAAc;IACtC,OAAO,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE;QAC/B,GAAG;QACH,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;KACpC,CAAC,CAAC,IAAI,EAAE,CAAC;AACZ,CAAC;AAED,SAA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AC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC1B,MAAM,CAAC,OAAO,CAAC,CAAC;IACnB,MAAM,KAAK,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAC/D,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC7D,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACzC,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC,CAAC;IAEJ,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACnC,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -8,5 +8,8 @@ export declare const HOST_COMPONENTS: Set<string>;
8
8
  /**
9
9
  * Returns true if a JSX tag name refers to a host primitive (so it should be ignored
10
10
  * as a "child component"). Handles namespaced tags like `Animated.View`.
11
+ *
12
+ * @param tagName - The JSX tag name to check
13
+ * @param customIgnoreComponents - Optional array of additional component names to treat as host primitives
11
14
  */
12
- export declare function isHostComponent(tagName: string): boolean;
15
+ export declare function isHostComponent(tagName: string, customIgnoreComponents?: string[]): boolean;
@@ -49,9 +49,15 @@ export const HOST_COMPONENTS = new Set([
49
49
  /**
50
50
  * Returns true if a JSX tag name refers to a host primitive (so it should be ignored
51
51
  * as a "child component"). Handles namespaced tags like `Animated.View`.
52
+ *
53
+ * @param tagName - The JSX tag name to check
54
+ * @param customIgnoreComponents - Optional array of additional component names to treat as host primitives
52
55
  */
53
- export function isHostComponent(tagName) {
56
+ export function isHostComponent(tagName, customIgnoreComponents) {
54
57
  const base = tagName.split(".").pop() ?? tagName;
55
- return HOST_COMPONENTS.has(base) || HOST_COMPONENTS.has(tagName);
58
+ const allComponents = customIgnoreComponents
59
+ ? new Set([...HOST_COMPONENTS, ...customIgnoreComponents])
60
+ : HOST_COMPONENTS;
61
+ return allComponents.has(base) || allComponents.has(tagName);
56
62
  }
57
63
  //# sourceMappingURL=hostComponents.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hostComponents.js","sourceRoot":"","sources":["../../src/utils/hostComponents.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAS;IAC7C,oBAAoB;IACpB,MAAM;IACN,MAAM;IACN,OAAO;IACP,iBAAiB;IACjB,YAAY;IACZ,UAAU;IACV,aAAa;IACb,iBAAiB;IACjB,WAAW;IACX,kBAAkB;IAClB,oBAAoB;IACpB,0BAA0B;IAC1B,yBAAyB;IACzB,WAAW;IACX,QAAQ;IACR,OAAO;IACP,mBAAmB;IACnB,QAAQ;IACR,gBAAgB;IAChB,WAAW;IACX,cAAc;IACd,sBAAsB;IACtB,UAAU;IACV,6BAA6B;IAC7B,gBAAgB;IAChB,UAAU;IACV,eAAe;IACf,wBAAwB;IACxB,UAAU;IACV,SAAS;IACT,aAAa;IACb,cAAc;IACd,WAAW;IACX,QAAQ;IACR,UAAU;IACV,iBAAiB;IACjB,UAAU;IACV,YAAY;IACZ,QAAQ;CACT,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,OAAO,CAAC;IACjD,OAAO,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACnE,CAAC"}
1
+ {"version":3,"file":"hostComponents.js","sourceRoot":"","sources":["../../src/utils/hostComponents.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAS;IAC7C,oBAAoB;IACpB,MAAM;IACN,MAAM;IACN,OAAO;IACP,iBAAiB;IACjB,YAAY;IACZ,UAAU;IACV,aAAa;IACb,iBAAiB;IACjB,WAAW;IACX,kBAAkB;IAClB,oBAAoB;IACpB,0BAA0B;IAC1B,yBAAyB;IACzB,WAAW;IACX,QAAQ;IACR,OAAO;IACP,mBAAmB;IACnB,QAAQ;IACR,gBAAgB;IAChB,WAAW;IACX,cAAc;IACd,sBAAsB;IACtB,UAAU;IACV,6BAA6B;IAC7B,gBAAgB;IAChB,UAAU;IACV,eAAe;IACf,wBAAwB;IACxB,UAAU;IACV,SAAS;IACT,aAAa;IACb,cAAc;IACd,WAAW;IACX,QAAQ;IACR,UAAU;IACV,iBAAiB;IACjB,UAAU;IACV,YAAY;IACZ,QAAQ;CACT,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe,EAAE,sBAAiC;IAChF,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,OAAO,CAAC;IACjD,MAAM,aAAa,GAAG,sBAAsB;QAC1C,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,eAAe,EAAE,GAAG,sBAAsB,CAAC,CAAC;QAC1D,CAAC,CAAC,eAAe,CAAC;IACpB,OAAO,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC/D,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const packageVersion: string;
@@ -0,0 +1,22 @@
1
+ import { readFileSync } from "node:fs";
2
+ export const packageVersion = readPackageVersion();
3
+ function readPackageVersion() {
4
+ const candidates = [
5
+ new URL("../package.json", import.meta.url),
6
+ new URL("../../package.json", import.meta.url),
7
+ ];
8
+ let lastError;
9
+ for (const candidate of candidates) {
10
+ try {
11
+ const parsed = JSON.parse(readFileSync(candidate, "utf8"));
12
+ if (parsed.version)
13
+ return parsed.version;
14
+ }
15
+ catch (error) {
16
+ lastError = error;
17
+ }
18
+ }
19
+ const message = lastError instanceof Error ? lastError.message : String(lastError);
20
+ throw new Error(`Could not read package.json version: ${message}`);
21
+ }
22
+ //# sourceMappingURL=packageInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageInfo.js","sourceRoot":"","sources":["../../src/utils/packageInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAMvC,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,EAAE,CAAC;AAEnD,SAAS,kBAAkB;IACzB,MAAM,UAAU,GAAG;QACjB,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;QAC3C,IAAI,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;KAC/C,CAAC;IACF,IAAI,SAAkB,CAAC;IAEvB,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAgB,CAAC;YAC1E,IAAI,MAAM,CAAC,OAAO;gBAAE,OAAO,MAAM,CAAC,OAAO,CAAC;QAC5C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,SAAS,GAAG,KAAK,CAAC;QACpB,CAAC;IACH,CAAC;IAED,MAAM,OAAO,GAAG,SAAS,YAAY,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACnF,MAAM,IAAI,KAAK,CAAC,wCAAwC,OAAO,EAAE,CAAC,CAAC;AACrE,CAAC"}
@@ -1,63 +1,174 @@
1
1
  # Good first issues
2
2
 
3
- Scoped, self-contained tasks for new contributors. Each lists where to start and how to
4
- verify. Open these as GitHub issues (label `good-first-rule` / `good-first-issue`) once
5
- the repo is public. See [`CONTRIBUTING.md`](../CONTRIBUTING.md) for setup.
3
+ Scoped, self-contained tasks for new contributors. Each entry links to a tracked GitHub
4
+ issue with acceptance criteria. See [`CONTRIBUTING.md`](../CONTRIBUTING.md) for setup.
5
+
6
+ **Labels:** `good first issue` (general) · `good-first-rule` (detector/rule work)
7
+
8
+ Statuses reflect the current repository surface. **Done** means the GitHub issue is closed.
6
9
 
7
10
  ## Rules
8
11
 
9
- ### 1. Make the `prop-drilling` host-component list configurable
12
+ | # | Task | Issue | Status |
13
+ | --- | --- | --- | --- |
14
+ | 1 | Make the `prop-drilling` host-component list configurable | [#1](https://github.com/ColumbusLabs/DebtLens/issues/1) | Open |
15
+ | 2 | Teach `large-component` to recognize `memo`, `forwardRef`, and class components | [#2](https://github.com/ColumbusLabs/DebtLens/issues/2) | Open |
16
+ | 3 | Reduce `naming-drift` false positives on domain-rich apps | [#3](https://github.com/ColumbusLabs/DebtLens/issues/3) | Open |
17
+ | 4 | Configurable markers for `todo-comment` | [#4](https://github.com/ColumbusLabs/DebtLens/issues/4) | Open |
18
+ | 15 | Extend `effect-complexity` to `useLayoutEffect` / `useInsertionEffect` | [#15](https://github.com/ColumbusLabs/DebtLens/issues/15) | **Done** |
19
+ | 27 | Warn when `duplicate-logic` hits `maxSnippets` cap | [#27](https://github.com/ColumbusLabs/DebtLens/issues/27) | **Done** |
20
+
21
+ ### 1. Make the `prop-drilling` host-component list configurable — [#1](https://github.com/ColumbusLabs/DebtLens/issues/1)
22
+
10
23
  The ignore list of UI primitives lives in [`src/utils/hostComponents.ts`](../src/utils/hostComponents.ts).
11
24
  Add an optional config key (e.g. `propDrilling.ignoreComponents`) that extends it, so
12
25
  teams can register their own design-system primitives.
26
+
13
27
  - Touch: `src/core/types.ts`, `src/config/*`, `src/detectors/propDrilling.ts`, schema.
14
28
  - Verify: a test where a custom-ignored component is not counted.
15
29
 
16
- ### 2. Teach `large-component` to recognize more component forms
30
+ ### 2. Teach `large-component` to recognize more component forms — [#2](https://github.com/ColumbusLabs/DebtLens/issues/2)
31
+
17
32
  Today it only classifies PascalCase function/arrow components
18
33
  ([`src/utils/ast.ts`](../src/utils/ast.ts) `collectFunctionLikes`). It misses
19
34
  `memo(function X(){})`, `forwardRef(...)`, and class components.
35
+
20
36
  - Verify: fixtures for each form in `tests/detectors/largeComponent.test.ts`.
21
37
 
22
- ### 3. Reduce `naming-drift` false positives on domain-rich apps
38
+ ### 3. Reduce `naming-drift` false positives on domain-rich apps — [#3](https://github.com/ColumbusLabs/DebtLens/issues/3)
39
+
23
40
  The built-in media vocabulary treats distinct domain entities (e.g. `movie` vs `show`)
24
41
  as "competing names." Options: raise the default `minVariants`, add a config switch to
25
42
  disable the built-in pack, or require co-occurrence in the same identifier.
43
+
26
44
  - Touch: [`src/detectors/namingDrift.ts`](../src/detectors/namingDrift.ts).
27
45
  - Verify: a media-style fixture that should NOT fire by default.
28
46
 
29
- ### 4. Configurable markers for `todo-comment`
47
+ ### 4. Configurable markers for `todo-comment` — [#4](https://github.com/ColumbusLabs/DebtLens/issues/4)
48
+
30
49
  Allow projects to add/replace the marker patterns
31
50
  ([`src/detectors/todoComment.ts`](../src/detectors/todoComment.ts)) via config.
51
+
32
52
  - Verify: a custom marker fires; a removed default does not.
33
53
 
54
+ ### 15. Extend `effect-complexity` to layout/insertion effects — [#15](https://github.com/ColumbusLabs/DebtLens/issues/15) (closed)
55
+
56
+ - Touch: `src/detectors/effectComplexity.ts`, `tests/detectors/effectComplexity.test.ts`.
57
+ - Verify: long `useLayoutEffect` fires; small `useInsertionEffect` does not.
58
+
59
+ ### 27. Warn when `duplicate-logic` truncates comparisons — [#27](https://github.com/ColumbusLabs/DebtLens/issues/27) (closed)
60
+
61
+ - Touch: `src/detectors/duplicateLogic.ts`.
62
+ - Verify: exceeding `maxSnippets` emits a single clear warning.
63
+
34
64
  ## Reporters & integrations
35
65
 
36
- ### 5. Add `helpUri` to SARIF rules
66
+ | # | Task | Issue | Status |
67
+ | --- | --- | --- | --- |
68
+ | 5 | Add `helpUri` to SARIF rules | [#5](https://github.com/ColumbusLabs/DebtLens/issues/5) | Open |
69
+ | 6 | Snapshot test for the Markdown reporter | [#6](https://github.com/ColumbusLabs/DebtLens/issues/6) | Open |
70
+ | 7 | Publish the config JSON schema to a stable URL | [#7](https://github.com/ColumbusLabs/DebtLens/issues/7) | Open |
71
+ | 16 | JSON reporter contract test | [#16](https://github.com/ColumbusLabs/DebtLens/issues/16) | **Done** |
72
+ | 22 | PR comment reporter for Markdown findings | [#22](https://github.com/ColumbusLabs/DebtLens/issues/22) | Open |
73
+
74
+ ### 5. Add `helpUri` to SARIF rules — [#5](https://github.com/ColumbusLabs/DebtLens/issues/5)
75
+
37
76
  In [`src/reporters/sarifReporter.ts`](../src/reporters/sarifReporter.ts), point each
38
77
  rule's `helpUri` at its section in `docs/rules.md` so code-scanning links to docs.
78
+
39
79
  - Verify: extend `tests/reporters/sarifReporter.test.ts`.
40
80
 
41
- ### 6. Snapshot test for the Markdown reporter
81
+ ### 6. Snapshot test for the Markdown reporter — [#6](https://github.com/ColumbusLabs/DebtLens/issues/6)
82
+
42
83
  Add a fixture-based test that scans `examples/react` and asserts the Markdown matches a
43
84
  committed snapshot (normalizing the elapsed-ms line), guarding `docs/example-report.md`.
44
85
 
45
- ### 7. Publish the config JSON schema to a stable URL
86
+ ### 7. Publish the config JSON schema to a stable URL — [#7](https://github.com/ColumbusLabs/DebtLens/issues/7)
87
+
46
88
  The schema is generated to `schema/debtlens.config.schema.json`
47
89
  ([`src/config/schema.ts`](../src/config/schema.ts)). Wire up hosting (e.g. GitHub Pages
48
90
  or SchemaStore) and confirm the `$schema` URL in the `init` template resolves.
49
91
 
92
+ ### 16. JSON reporter contract test — [#16](https://github.com/ColumbusLabs/DebtLens/issues/16) (closed)
93
+
94
+ - Touch: `src/reporters/jsonReporter.ts`, new `tests/reporters/jsonReporter.test.ts`.
95
+ - Verify: parsed output includes stable `issues`, `summary`, `options` keys.
96
+
97
+ ### 22. PR comment reporter — [#22](https://github.com/ColumbusLabs/DebtLens/issues/22)
98
+
99
+ Format scan results for GitHub PR comments (roadmap v0.3). Larger than a single rule tweak.
100
+
50
101
  ## CLI / DX
51
102
 
52
- ### 8. Add a summary-only / `--quiet` output mode
53
- Print just the counts line and exit code, useful for CI logs.
54
- - Touch: `src/cli/index.ts`, `src/reporters/terminalReporter.ts`.
103
+ | # | Task | Issue | Status |
104
+ | --- | --- | --- | --- |
105
+ | 8 | Summary-only `--quiet` output mode | [#8](https://github.com/ColumbusLabs/DebtLens/issues/8) | **Done** |
106
+ | 9 | Respect `.gitignore` when resolving files | [#9](https://github.com/ColumbusLabs/DebtLens/issues/9) | Open |
107
+ | 10 | False-positive guidance per rule in docs | [#10](https://github.com/ColumbusLabs/DebtLens/issues/10) | **Done** |
108
+ | 14 | Document `--quiet` in README and Action | [#14](https://github.com/ColumbusLabs/DebtLens/issues/14) | **Done** |
109
+ | 17 | Integration test for `scan()` on `examples/react` | [#17](https://github.com/ColumbusLabs/DebtLens/issues/17) | **Done** |
110
+ | 18 | Read CLI/SARIF version from `package.json` | [#18](https://github.com/ColumbusLabs/DebtLens/issues/18) | **Done** |
111
+ | 19 | `debtlens rules` command | [#19](https://github.com/ColumbusLabs/DebtLens/issues/19) | **Done** |
112
+ | 20 | Warn when scan resolves zero files | [#20](https://github.com/ColumbusLabs/DebtLens/issues/20) | **Done** |
113
+ | 21 | `--staged` mode for pre-commit scans | [#21](https://github.com/ColumbusLabs/DebtLens/issues/21) | **Done** |
114
+ | 24 | Action: `write-baseline`, `thresholds`, `max-files` | [#24](https://github.com/ColumbusLabs/DebtLens/issues/24) | **Done** |
115
+ | 28 | CI smoke scan for RN and Next examples | [#28](https://github.com/ColumbusLabs/DebtLens/issues/28) | **Done** |
116
+
117
+ ### 8. Add a summary-only / `--quiet` output mode — [#8](https://github.com/ColumbusLabs/DebtLens/issues/8) (closed)
118
+
119
+ Merged in PR #12. Terminal-only; prints header + summary, suppresses findings.
120
+
121
+ ### 9. Respect `.gitignore` when resolving files — [#9](https://github.com/ColumbusLabs/DebtLens/issues/9)
55
122
 
56
- ### 9. Respect `.gitignore` when resolving files
57
123
  Optionally skip files ignored by git during a scan, in addition to the configured
58
124
  `exclude` globs.
59
- - Touch: `src/core/scan.ts` (file resolution).
60
125
 
61
- ### 10. Document each rule's false-positive guidance
126
+ - Touch: `src/core/scan.ts`, `src/utils/git.ts`.
127
+
128
+ ### 10. Document each rule's false-positive guidance — [#10](https://github.com/ColumbusLabs/DebtLens/issues/10) (closed)
129
+
62
130
  Expand [`docs/rules.md`](./rules.md) with a "When this is a false positive" note per
63
131
  rule, mirroring the guards in the detector tests.
132
+
133
+ ### 14. Document `--quiet` in README and GitHub Action — [#14](https://github.com/ColumbusLabs/DebtLens/issues/14) (closed)
134
+
135
+ - Touch: `README.md`, `action.yml`.
136
+
137
+ ### 17. Integration test for `scan()` — [#17](https://github.com/ColumbusLabs/DebtLens/issues/17) (closed)
138
+
139
+ - Touch: `tests/core/scan.test.ts`, `examples/react/`.
140
+
141
+ ### 18. Single source of truth for version — [#18](https://github.com/ColumbusLabs/DebtLens/issues/18) (closed)
142
+
143
+ - Touch: `src/cli/index.ts`, `src/reporters/sarifReporter.ts`, `package.json`.
144
+
145
+ ### 19. `debtlens rules` command — [#19](https://github.com/ColumbusLabs/DebtLens/issues/19) (closed)
146
+
147
+ List rule ids, names, default severities, and descriptions.
148
+
149
+ ### 20. Warn on zero files scanned — [#20](https://github.com/ColumbusLabs/DebtLens/issues/20) (closed)
150
+
151
+ - Touch: `src/core/scan.ts`, `src/cli/index.ts`.
152
+
153
+ ### 21. `--staged` git mode — [#21](https://github.com/ColumbusLabs/DebtLens/issues/21) (closed)
154
+
155
+ - Touch: `src/utils/git.ts`, `src/cli/index.ts`.
156
+
157
+ ### 24. GitHub Action input gaps — [#24](https://github.com/ColumbusLabs/DebtLens/issues/24) (closed)
158
+
159
+ Expose `write-baseline`, `thresholds`, and `max-files` in `action.yml`.
160
+
161
+ ### 28. CI example coverage — [#28](https://github.com/ColumbusLabs/DebtLens/issues/28) (closed)
162
+
163
+ Scan `examples/react-native` and `examples/next` in `.github/workflows/ci.yml`.
164
+
165
+ ## Roadmap / larger work
166
+
167
+ | # | Task | Issue |
168
+ | --- | --- | --- |
169
+ | 23 | Monorepo and package-aware scanning | [#23](https://github.com/ColumbusLabs/DebtLens/issues/23) |
170
+ | 25 | Rule packs (`react`, `react-native`, `next`) | [#25](https://github.com/ColumbusLabs/DebtLens/issues/25) |
171
+ | 26 | Plugin API for third-party rules | [#26](https://github.com/ColumbusLabs/DebtLens/issues/26) |
172
+
173
+ These are multi-PR efforts; read the issue body before starting and comment if you plan
174
+ to own one.
package/docs/rules.md CHANGED
@@ -21,6 +21,11 @@ Good fixes:
21
21
  - move imperative workflows to named hooks
22
22
  - split independent features behind composition boundaries
23
23
 
24
+ When this is a false positive:
25
+
26
+ - the file is not actually a React-style component
27
+ - the component stays within the configured line, hook, and branch budgets
28
+
24
29
  ## `state-sprawl`
25
30
 
26
31
  Flags components/hooks with many calls to local stateful hooks such as `useState`, `useReducer`, and `useRef`.
@@ -38,9 +43,14 @@ Good fixes:
38
43
  - move server/cache state into the data layer
39
44
  - delete unused state before adding new state
40
45
 
46
+ When this is a false positive:
47
+
48
+ - the function is not classified as a component or hook
49
+ - the file stays at or below the configured stateful-hook threshold
50
+
41
51
  ## `effect-complexity`
42
52
 
43
- Flags long, branchy, or overloaded `useEffect` calls.
53
+ Flags long, branchy, or overloaded `useEffect`, `useLayoutEffect`, and `useInsertionEffect` calls.
44
54
 
45
55
  Default thresholds:
46
56
 
@@ -56,6 +66,11 @@ Good fixes:
56
66
  - move async workflows into named functions
57
67
  - use framework data loading where appropriate
58
68
 
69
+ When this is a false positive:
70
+
71
+ - the callback is small and focused
72
+ - the array literal belongs to another API instead of a React effect hook
73
+
59
74
  ## `duplicate-logic`
60
75
 
61
76
  Finds structurally similar functions/components after comments, identifiers, strings, and numeric literals are normalized.
@@ -66,6 +81,8 @@ Default thresholds:
66
81
  - `duplicate-logic.minLines`: 8
67
82
  - `duplicate-logic.maxSnippets`: 450
68
83
 
84
+ When more eligible snippets are found than `duplicate-logic.maxSnippets`, DebtLens caps pairwise comparisons and emits an advisory warning instead of silently truncating the search space.
85
+
69
86
  Why it matters: AI assistants can produce plausible variants of the same logic in multiple files. Duplicate implementations make bug fixes and behavior changes harder.
70
87
 
71
88
  Good fixes:
@@ -75,6 +92,11 @@ Good fixes:
75
92
  - delete the weaker duplicate if it was accidental
76
93
  - keep duplication only when coupling would be worse than repetition
77
94
 
95
+ When this is a false positive:
96
+
97
+ - the compared snippets do materially different work after normalization
98
+ - the shared shape is too short to clear the minimum line-count threshold
99
+
78
100
  ## `dead-abstraction`
79
101
 
80
102
  Flags short wrappers that delegate to one call, return one value, or render one JSX element without meaningful behavior.
@@ -91,6 +113,11 @@ Good fixes:
91
113
  - keep it only if it is a stable domain boundary
92
114
  - add the missing behavior that justifies the abstraction
93
115
 
116
+ When this is a false positive:
117
+
118
+ - the wrapper adds meaningful behavior beyond a single pass-through statement
119
+ - the file is a route module or a hook wrapper that is intentionally thin by convention
120
+
94
121
  ## `prop-drilling`
95
122
 
96
123
  Flags components that forward many props to child components.
@@ -108,6 +135,11 @@ Good fixes:
108
135
  - extract a stable context for cross-cutting values
109
136
  - reduce prop surface area
110
137
 
138
+ When this is a false positive:
139
+
140
+ - the component forwards only a small number of props
141
+ - the props are passed only to host primitives instead of user-defined child components
142
+
111
143
  ## `todo-comment`
112
144
 
113
145
  Flags debt markers in comments, including TODO, FIXME, HACK, temporary, placeholder, and assistant-generation markers.
@@ -121,6 +153,11 @@ Good fixes:
121
153
  - fix the debt before more code depends on it
122
154
  - delete stale comments that no longer describe reality
123
155
 
156
+ When this is a false positive:
157
+
158
+ - the word appears in executable code or identifiers instead of a comment
159
+ - the comment is already paired with explicit tracking and removal criteria
160
+
124
161
  ## `naming-drift`
125
162
 
126
163
  Flags files where related domain concepts are represented by many competing names.
@@ -137,3 +174,8 @@ Good fixes:
137
174
  - rename adapters at system boundaries
138
175
  - document vocabulary in a module README
139
176
  - add typed domain models where possible
177
+
178
+ When this is a false positive:
179
+
180
+ - the file uses fewer distinct variants than the configured threshold
181
+ - the competing names belong to separate concepts rather than one overloaded domain term
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "debtlens",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Find maintainability debt common in fast-moving AI-assisted TypeScript, React, React Native, Expo, and Next.js codebases.",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/ColumbusLabs/DebtLens#readme",
@@ -111,6 +111,20 @@
111
111
  "type": "string"
112
112
  }
113
113
  }
114
+ },
115
+ "propDrilling": {
116
+ "type": "object",
117
+ "description": "Prop-drilling rule configuration.",
118
+ "properties": {
119
+ "ignoreComponents": {
120
+ "type": "array",
121
+ "items": {
122
+ "type": "string"
123
+ },
124
+ "description": "Additional UI primitive component names to ignore (extends built-in host components)."
125
+ }
126
+ },
127
+ "additionalProperties": false
114
128
  }
115
129
  }
116
130
  }