code-auditor-mcp 3.4.1 → 3.4.2

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 (70) hide show
  1. package/CHANGELOG.md +137 -0
  2. package/dist/analyzers/crossDomain/CrossDomainAnalyzer.js +1 -1
  3. package/dist/analyzers/crossDomain/CrossDomainAnalyzer.js.map +1 -1
  4. package/dist/analyzers/orm/drizzleAdapter.d.ts +15 -0
  5. package/dist/analyzers/orm/drizzleAdapter.d.ts.map +1 -1
  6. package/dist/analyzers/orm/drizzleAdapter.js +35 -2
  7. package/dist/analyzers/orm/drizzleAdapter.js.map +1 -1
  8. package/dist/analyzers/universal/UniversalConventionsAnalyzer.d.ts.map +1 -1
  9. package/dist/analyzers/universal/UniversalConventionsAnalyzer.js +27 -8
  10. package/dist/analyzers/universal/UniversalConventionsAnalyzer.js.map +1 -1
  11. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts +12 -0
  12. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.d.ts.map +1 -1
  13. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js +18 -1
  14. package/dist/analyzers/universal/UniversalDataAccessAnalyzer.js.map +1 -1
  15. package/dist/analyzers/universal/UniversalSchemaAnalyzer.d.ts +9 -0
  16. package/dist/analyzers/universal/UniversalSchemaAnalyzer.d.ts.map +1 -1
  17. package/dist/analyzers/universal/UniversalSchemaAnalyzer.js +39 -0
  18. package/dist/analyzers/universal/UniversalSchemaAnalyzer.js.map +1 -1
  19. package/dist/analyzers/universal/UniversalStylesAnalyzer.d.ts +17 -0
  20. package/dist/analyzers/universal/UniversalStylesAnalyzer.d.ts.map +1 -1
  21. package/dist/analyzers/universal/UniversalStylesAnalyzer.js +98 -33
  22. package/dist/analyzers/universal/UniversalStylesAnalyzer.js.map +1 -1
  23. package/dist/auditRunner.d.ts.map +1 -1
  24. package/dist/auditRunner.js +23 -14
  25. package/dist/auditRunner.js.map +1 -1
  26. package/dist/codeIndexDB.d.ts +1 -0
  27. package/dist/codeIndexDB.d.ts.map +1 -1
  28. package/dist/codeIndexDB.js +18 -4
  29. package/dist/codeIndexDB.js.map +1 -1
  30. package/dist/componentScanner.d.ts.map +1 -1
  31. package/dist/componentScanner.js +4 -3
  32. package/dist/componentScanner.js.map +1 -1
  33. package/dist/config/defaults.d.ts +1 -0
  34. package/dist/config/defaults.d.ts.map +1 -1
  35. package/dist/config/defaults.js +9 -2
  36. package/dist/config/defaults.js.map +1 -1
  37. package/dist/conventions/conventionMiner.d.ts.map +1 -1
  38. package/dist/conventions/conventionMiner.js +144 -47
  39. package/dist/conventions/conventionMiner.js.map +1 -1
  40. package/dist/languages/UniversalAnalyzer.d.ts.map +1 -1
  41. package/dist/languages/UniversalAnalyzer.js +2 -0
  42. package/dist/languages/UniversalAnalyzer.js.map +1 -1
  43. package/dist/languages/adapterBridge.d.ts +7 -0
  44. package/dist/languages/adapterBridge.d.ts.map +1 -1
  45. package/dist/languages/adapterBridge.js +9 -2
  46. package/dist/languages/adapterBridge.js.map +1 -1
  47. package/dist/languages/tree-sitter/converter.d.ts +9 -1
  48. package/dist/languages/tree-sitter/converter.d.ts.map +1 -1
  49. package/dist/languages/tree-sitter/converter.js +13 -6
  50. package/dist/languages/tree-sitter/converter.js.map +1 -1
  51. package/dist/scripts/runBench.d.ts.map +1 -1
  52. package/dist/scripts/runBench.js +16 -4
  53. package/dist/scripts/runBench.js.map +1 -1
  54. package/dist/styles/styleIndexer.js +9 -3
  55. package/dist/styles/styleIndexer.js.map +1 -1
  56. package/dist/styles/tailwindUtilityExpander.d.ts +116 -0
  57. package/dist/styles/tailwindUtilityExpander.d.ts.map +1 -0
  58. package/dist/styles/tailwindUtilityExpander.js +880 -0
  59. package/dist/styles/tailwindUtilityExpander.js.map +1 -0
  60. package/dist/types.d.ts +4 -0
  61. package/dist/types.d.ts.map +1 -1
  62. package/dist/types.js.map +1 -1
  63. package/dist/utils/astParser.d.ts.map +1 -1
  64. package/dist/utils/astParser.js +3 -2
  65. package/dist/utils/astParser.js.map +1 -1
  66. package/dist/utils/dependencyExtractor.d.ts.map +1 -1
  67. package/dist/utils/dependencyExtractor.js +5 -3
  68. package/dist/utils/dependencyExtractor.js.map +1 -1
  69. package/package.json +1 -1
  70. package/plugin/scripts/hook-audit.sh +2 -2
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Tailwind Utility Class Expander — Spec 22 R1
3
+ *
4
+ * Generates the full set of valid Tailwind utility classes from default theme
5
+ * scales plus arbitrary-value grammar, variant prefix stripping, and project
6
+ * config resolution. Replaces the hand-curated ~30-class Set previously in
7
+ * UniversalStylesAnalyzer.detectUndefinedClasses.
8
+ *
9
+ * Fail-open rule (per Spec 22 R1.3): if project Tailwind config resolution
10
+ * fails, the undefined-class detector disables for that project with one
11
+ * visible warning naming the failure. A claim that a class "does not exist"
12
+ * may not ship on a known-incomplete dictionary.
13
+ */
14
+ /**
15
+ * Get the full set of bundled Tailwind utility classes.
16
+ * Generated from the default theme scales plus static utilities.
17
+ * Cached after first call — callers get the same Set instance.
18
+ */
19
+ export declare function getBundledUtilityClasses(): Set<string>;
20
+ /**
21
+ * Result of resolving a Tailwind utility class against the full expansion path.
22
+ */
23
+ export interface UtilityClassResolution {
24
+ /** Is this a known/valid utility class? */
25
+ valid: boolean;
26
+ /**
27
+ * Which tier resolved it: 'bundled' (default theme), 'project-config' (project
28
+ * config resolution), 'arbitrary-value' (matches `prefix-[...]` grammar), or
29
+ * 'none' (no match).
30
+ */
31
+ tier: 'bundled' | 'project-config' | 'arbitrary-value' | 'none';
32
+ }
33
+ /**
34
+ * Configuration for the Tailwind utility class expansion.
35
+ */
36
+ export interface TailwindExpanderConfig {
37
+ /** Project root for loading Tailwind config. */
38
+ projectRoot?: string;
39
+ /** If true, load and include project Tailwind config custom classes. */
40
+ useProjectConfig?: boolean;
41
+ /** User-supplied class names from project config (use when useProjectConfig
42
+ * would fail — the caller pre-resolves and passes them). */
43
+ customClasses?: Set<string>;
44
+ }
45
+ /**
46
+ * Tailwind utility class expander.
47
+ *
48
+ * Validates a class name against the full expansion path:
49
+ * 1. Bundled default theme dictionary
50
+ * 2. Project config custom classes (if resolved)
51
+ * 3. Arbitrary-value grammar (`prefix-[...]`)
52
+ * 4. Variant prefix stripping + retry against all of the above
53
+ *
54
+ * Fail-open: if project config resolution is requested but fails, the
55
+ * expander enters fail-open mode where project-config tier is silently
56
+ * empty. The CALLER is responsible for emitting the visible warning and
57
+ * potentially disabling the undefined-class detector.
58
+ */
59
+ export declare class TailwindUtilityExpander {
60
+ private bundled;
61
+ private projectClasses;
62
+ private _configFailed;
63
+ private _configFailureReason;
64
+ /**
65
+ * Initialize the expander with optional project config.
66
+ * Call once at the start of a project audit.
67
+ */
68
+ init(config?: TailwindExpanderConfig): void;
69
+ /** Did the project config resolution fail? */
70
+ get configFailed(): boolean;
71
+ /** Why did project config resolution fail? */
72
+ get configFailureReason(): string | null;
73
+ /**
74
+ * Resolve a single class name against the expansion path.
75
+ * Returns the highest-priority matching tier, or 'none'.
76
+ */
77
+ resolve(className: string): UtilityClassResolution;
78
+ /**
79
+ * Check whether a class matches the arbitrary-value grammar:
80
+ * `{known-prefix}-[...]`
81
+ */
82
+ private matchesArbitraryValue;
83
+ /**
84
+ * Check the opacity-modifier syntax: `{utility}/{opacity}`.
85
+ * e.g., `bg-red-500/50` → `bg-red-500` must be a valid utility AND
86
+ * `50` must be a valid opacity value.
87
+ *
88
+ * We split on the LAST `/` to avoid confusing fractional widths
89
+ * (e.g. `w-1/2`) — those are in the dictionary directly and won't
90
+ * reach this check.
91
+ */
92
+ private checkOpacityModifier;
93
+ /**
94
+ * Check a negative utility: `-{prefix}-{value}`.
95
+ * e.g., `-mt-1`, `-top-2`, `-translate-x-1/2`, `-z-10`.
96
+ *
97
+ * Strips the leading `-` and checks whether the remainder is a valid
98
+ * utility whose prefix is in the negative-allowed set.
99
+ */
100
+ private checkNegativeUtility;
101
+ /**
102
+ * Strip a Tailwind variant prefix from a class name.
103
+ * E.g., "hover:bg-blue-500" → "bg-blue-500"
104
+ * Returns the original if no variant prefix is matched.
105
+ */
106
+ stripVariantPrefix(className: string): string;
107
+ /**
108
+ * Check if a class has a variant prefix at all.
109
+ */
110
+ hasVariantPrefix(className: string): boolean;
111
+ /** Reset state (useful for testing). */
112
+ reset(): void;
113
+ }
114
+ export declare function getTailwindExpander(): TailwindUtilityExpander;
115
+ export declare function resetTailwindExpander(): void;
116
+ //# sourceMappingURL=tailwindUtilityExpander.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tailwindUtilityExpander.d.ts","sourceRoot":"","sources":["../../src/styles/tailwindUtilityExpander.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAspBH;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,GAAG,CAAC,MAAM,CAAC,CAgBtD;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,2CAA2C;IAC3C,KAAK,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,IAAI,EAAE,SAAS,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,MAAM,CAAC;CACjE;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;iEAC6D;IAC7D,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,cAAc,CAA4B;IAClD,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,oBAAoB,CAAuB;IAEnD;;;OAGG;IACH,IAAI,CAAC,MAAM,GAAE,sBAA2B,GAAG,IAAI,CA6C9C;IAED,8CAA8C;IAC9C,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED,8CAA8C;IAC9C,IAAI,mBAAmB,IAAI,MAAM,GAAG,IAAI,CAEvC;IAED;;;OAGG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,sBAAsB,CAmCjD;IAED;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAe7B;;;;;;;;OAQG;IACH,OAAO,CAAC,oBAAoB;IAuB5B;;;;;;OAMG;IACH,OAAO,CAAC,oBAAoB;IAuB5B;;;;OAIG;IACH,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAO5C;IAED;;OAEG;IACH,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE3C;IAED,wCAAwC;IACxC,KAAK,IAAI,IAAI,CAKZ;CACF;AAKD,wBAAgB,mBAAmB,IAAI,uBAAuB,CAK7D;AAED,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C"}