pi-lens 3.1.2 → 3.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 (154) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +16 -12
  3. package/clients/ast-grep-client.js +8 -1
  4. package/clients/ast-grep-client.ts +9 -1
  5. package/clients/biome-client.js +51 -38
  6. package/clients/biome-client.ts +60 -58
  7. package/clients/dependency-checker.js +30 -1
  8. package/clients/dependency-checker.ts +35 -1
  9. package/clients/dispatch/__tests__/runner-registration.test.ts +286 -282
  10. package/clients/dispatch/bus-dispatcher.js +15 -14
  11. package/clients/dispatch/bus-dispatcher.ts +32 -25
  12. package/clients/dispatch/dispatcher.js +18 -25
  13. package/clients/dispatch/dispatcher.test.ts +2 -1
  14. package/clients/dispatch/dispatcher.ts +17 -28
  15. package/clients/dispatch/plan.js +77 -32
  16. package/clients/dispatch/plan.ts +78 -32
  17. package/clients/dispatch/runners/ast-grep-napi.js +36 -376
  18. package/clients/dispatch/runners/ast-grep-napi.ts +60 -433
  19. package/clients/dispatch/runners/index.js +8 -4
  20. package/clients/dispatch/runners/index.ts +8 -4
  21. package/clients/dispatch/runners/lsp.js +65 -0
  22. package/clients/dispatch/runners/lsp.ts +125 -0
  23. package/clients/dispatch/runners/oxlint.js +2 -2
  24. package/clients/dispatch/runners/oxlint.ts +2 -2
  25. package/clients/dispatch/runners/pyright.js +24 -8
  26. package/clients/dispatch/runners/pyright.ts +28 -14
  27. package/clients/dispatch/runners/rust-clippy.js +2 -2
  28. package/clients/dispatch/runners/rust-clippy.ts +2 -4
  29. package/clients/dispatch/runners/tree-sitter.js +14 -2
  30. package/clients/dispatch/runners/tree-sitter.ts +15 -2
  31. package/clients/dispatch/runners/ts-lsp.js +3 -3
  32. package/clients/dispatch/runners/ts-lsp.ts +8 -5
  33. package/clients/dispatch/runners/yaml-rule-parser.js +292 -0
  34. package/clients/dispatch/runners/yaml-rule-parser.ts +338 -0
  35. package/clients/dispatch/types.js +3 -0
  36. package/clients/dispatch/types.ts +3 -0
  37. package/clients/formatters.js +67 -14
  38. package/clients/formatters.ts +68 -15
  39. package/clients/installer/index.js +78 -10
  40. package/clients/installer/index.ts +519 -426
  41. package/clients/jscpd-client.js +28 -0
  42. package/clients/jscpd-client.ts +41 -3
  43. package/clients/knip-client.js +30 -1
  44. package/clients/knip-client.ts +34 -2
  45. package/clients/lsp/__tests__/client.test.ts +64 -41
  46. package/clients/lsp/__tests__/config.test.ts +25 -17
  47. package/clients/lsp/__tests__/launch.test.ts +108 -43
  48. package/clients/lsp/__tests__/service.test.ts +76 -48
  49. package/clients/lsp/client.js +87 -2
  50. package/clients/lsp/client.ts +150 -6
  51. package/clients/lsp/config.js +8 -11
  52. package/clients/lsp/config.ts +24 -21
  53. package/clients/lsp/index.js +69 -0
  54. package/clients/lsp/index.ts +82 -0
  55. package/clients/lsp/interactive-install.js +19 -8
  56. package/clients/lsp/interactive-install.ts +52 -27
  57. package/clients/lsp/launch.js +182 -32
  58. package/clients/lsp/launch.ts +241 -38
  59. package/clients/lsp/path-utils.js +3 -46
  60. package/clients/lsp/path-utils.ts +11 -51
  61. package/clients/lsp/server.js +93 -71
  62. package/clients/lsp/server.ts +173 -131
  63. package/clients/path-utils.js +142 -0
  64. package/clients/path-utils.ts +153 -0
  65. package/clients/ruff-client.js +33 -4
  66. package/clients/ruff-client.ts +44 -13
  67. package/clients/safe-spawn.js +3 -1
  68. package/clients/safe-spawn.ts +3 -1
  69. package/clients/services/effect-integration.js +11 -7
  70. package/clients/services/effect-integration.ts +34 -26
  71. package/clients/sg-runner.js +51 -9
  72. package/clients/sg-runner.ts +58 -15
  73. package/clients/tree-sitter-client.js +12 -0
  74. package/clients/tree-sitter-client.ts +12 -0
  75. package/clients/typescript-client.js +6 -2
  76. package/clients/typescript-client.ts +9 -2
  77. package/commands/booboo.js +2 -4
  78. package/commands/booboo.ts +2 -4
  79. package/index.ts +377 -93
  80. package/package.json +2 -1
  81. package/rules/tree-sitter-queries/tsx/no-nested-links.yml +45 -0
  82. package/rules/tree-sitter-queries/typescript/constructor-super.yml +55 -0
  83. package/rules/tree-sitter-queries/typescript/debugger.yml +1 -1
  84. package/rules/tree-sitter-queries/typescript/no-dupe-class-members.yml +47 -0
  85. package/tsconfig.json +1 -1
  86. package/clients/__tests__/file-time.test.js +0 -216
  87. package/clients/__tests__/format-service.test.js +0 -245
  88. package/clients/__tests__/formatters.test.js +0 -271
  89. package/clients/agent-behavior-client.test.js +0 -94
  90. package/clients/ast-grep-client.test.js +0 -129
  91. package/clients/ast-grep-client.test.ts +0 -155
  92. package/clients/biome-client.test.js +0 -144
  93. package/clients/cache-manager.test.js +0 -197
  94. package/clients/complexity-client.test.js +0 -234
  95. package/clients/dependency-checker.test.js +0 -60
  96. package/clients/dispatch/__tests__/autofix-integration.test.js +0 -245
  97. package/clients/dispatch/__tests__/runner-registration.test.js +0 -236
  98. package/clients/dispatch/dispatcher.edge.test.js +0 -82
  99. package/clients/dispatch/dispatcher.format.test.js +0 -46
  100. package/clients/dispatch/dispatcher.inline.test.js +0 -74
  101. package/clients/dispatch/dispatcher.test.js +0 -115
  102. package/clients/dispatch/runners/architect.test.js +0 -138
  103. package/clients/dispatch/runners/ast-grep-napi.test.js +0 -106
  104. package/clients/dispatch/runners/oxlint.test.js +0 -230
  105. package/clients/dispatch/runners/pyright.test.js +0 -98
  106. package/clients/dispatch/runners/python-slop.test.js +0 -203
  107. package/clients/dispatch/runners/scan_codebase.test.js +0 -89
  108. package/clients/dispatch/runners/shellcheck.test.js +0 -98
  109. package/clients/dispatch/runners/spellcheck.test.js +0 -158
  110. package/clients/dispatch/runners/ts-slop.test.js +0 -180
  111. package/clients/dispatch/runners/ts-slop.test.ts +0 -230
  112. package/clients/dogfood.test.js +0 -201
  113. package/clients/file-kinds.test.js +0 -169
  114. package/clients/go-client.test.js +0 -127
  115. package/clients/jscpd-client.test.js +0 -127
  116. package/clients/knip-client.test.js +0 -112
  117. package/clients/lsp/__tests__/client.test.js +0 -325
  118. package/clients/lsp/__tests__/config.test.js +0 -166
  119. package/clients/lsp/__tests__/error-recovery.test.js +0 -213
  120. package/clients/lsp/__tests__/integration.test.js +0 -127
  121. package/clients/lsp/__tests__/launch.test.js +0 -260
  122. package/clients/lsp/__tests__/server.test.js +0 -259
  123. package/clients/lsp/__tests__/service.test.js +0 -417
  124. package/clients/metrics-client.test.js +0 -141
  125. package/clients/ruff-client.test.js +0 -132
  126. package/clients/rust-client.test.js +0 -108
  127. package/clients/sanitize.test.js +0 -177
  128. package/clients/secrets-scanner.test.js +0 -100
  129. package/clients/services/__tests__/effect-integration.test.js +0 -86
  130. package/clients/test-runner-client.test.js +0 -192
  131. package/clients/todo-scanner.test.js +0 -301
  132. package/clients/type-coverage-client.test.js +0 -105
  133. package/clients/typescript-client.codefix.test.js +0 -157
  134. package/clients/typescript-client.test.js +0 -105
  135. package/commands/clients/ast-grep-client.js +0 -250
  136. package/commands/clients/ast-grep-parser.js +0 -86
  137. package/commands/clients/ast-grep-rule-manager.js +0 -91
  138. package/commands/clients/ast-grep-types.js +0 -9
  139. package/commands/clients/biome-client.js +0 -380
  140. package/commands/clients/complexity-client.js +0 -667
  141. package/commands/clients/file-kinds.js +0 -177
  142. package/commands/clients/file-utils.js +0 -40
  143. package/commands/clients/jscpd-client.js +0 -169
  144. package/commands/clients/knip-client.js +0 -211
  145. package/commands/clients/ruff-client.js +0 -297
  146. package/commands/clients/safe-spawn.js +0 -88
  147. package/commands/clients/scan-utils.js +0 -83
  148. package/commands/clients/sg-runner.js +0 -190
  149. package/commands/clients/types.js +0 -11
  150. package/commands/clients/typescript-client.js +0 -505
  151. package/commands/rate.test.js +0 -119
  152. package/rules/ast-grep-rules/rules/no-dangerously-set-inner-html.yml +0 -13
  153. package/rules/ast-grep-rules/rules/no-debugger.yml +0 -12
  154. package/rules/ast-grep-rules/rules/no-eval.yml +0 -13
@@ -15,6 +15,13 @@ import type { ToolPlan } from "./types.js";
15
15
 
16
16
  /**
17
17
  * Tool plans organized by purpose
18
+ *
19
+ * CORE PRINCIPLE: File write only runs BLOCKING tools
20
+ * - Type checking (LSP) - blocking errors
21
+ * - Security/correctness lint - blocking errors
22
+ * - Auto-format/auto-fix handled by direct calls in index.ts (not here)
23
+ *
24
+ * Warning-only tools run on /lens-booboo command only
18
25
  */
19
26
  export const TOOL_PLANS: Record<string, ToolPlan> = {
20
27
  /**
@@ -23,17 +30,18 @@ export const TOOL_PLANS: Record<string, ToolPlan> = {
23
30
  jsts: {
24
31
  name: "JavaScript/TypeScript Linting",
25
32
  groups: [
26
- // TypeScript LSP always runs first - blocks on errors
27
- { mode: "all", runnerIds: ["ts-lsp"], filterKinds: ["jsts"] },
28
- // Then biome or oxlint for fast linting (user preference)
29
- { mode: "fallback", runnerIds: ["biome-lint", "oxlint"] },
30
- // Fast structural analysis via NAPI (replaces CLI - 100x faster)
31
- { mode: "all", runnerIds: ["ast-grep-napi"] },
32
- // Type safety checks
33
- { mode: "fallback", runnerIds: ["type-safety"] },
33
+ // LSP type checking (unified for all languages) - priority 4, blocking errors
34
+ { mode: "all", runnerIds: ["lsp"], filterKinds: ["jsts"] },
35
+ // Tree-sitter native structural analysis (blocking rules: constructor-super, dangerouslySetInnerHTML, etc.)
36
+ { mode: "all", runnerIds: ["tree-sitter"], filterKinds: ["jsts"] },
37
+ // AST structural analysis (blocking: no-dupe-keys, no-hardcoded-secrets, jwt-no-verify, etc.)
38
+ // DISABLED in post-write - ast-grep-napi can crash. Runs via /lens-booboo only.
39
+ // { mode: "all", runnerIds: ["ast-grep-napi"], filterKinds: ["jsts"] },
40
+ // Type safety checks (has some blocking errors)
41
+ { mode: "fallback", runnerIds: ["type-safety"], filterKinds: ["jsts"] },
34
42
  // Note: ast-grep CLI kept for ast_grep_search/ast_grep_replace tools only
35
- // Architectural rules
36
- { mode: "fallback", runnerIds: ["architect"] },
43
+ // Note: biome, oxlint handled by direct auto-fix calls in index.ts (not in dispatch)
44
+ // Architectural rules (guidance only, not blocking) - runs via /lens-booboo only
37
45
  ],
38
46
  },
39
47
 
@@ -43,10 +51,13 @@ export const TOOL_PLANS: Record<string, ToolPlan> = {
43
51
  python: {
44
52
  name: "Python Linting",
45
53
  groups: [
46
- // Ruff handles both formatting and linting
47
- { mode: "fallback", runnerIds: ["ruff-lint"] },
48
- // Architectural rules
49
- { mode: "fallback", runnerIds: ["architect"] },
54
+ // Pyright type checking (standard mode - no LSP flag needed)
55
+ // Provides Python type errors in standard pi mode
56
+ { mode: "all", runnerIds: ["pyright"], filterKinds: ["python"] },
57
+ // LSP type checking (unified) - when --lens-lsp enabled
58
+ { mode: "all", runnerIds: ["lsp"], filterKinds: ["python"] },
59
+ // Note: ruff handled by direct auto-fix calls in index.ts (not in dispatch)
60
+ // Architectural rules (guidance only, not blocking) - runs via /lens-booboo only
50
61
  ],
51
62
  },
52
63
 
@@ -56,10 +67,11 @@ export const TOOL_PLANS: Record<string, ToolPlan> = {
56
67
  go: {
57
68
  name: "Go Linting",
58
69
  groups: [
59
- // Go vet
60
- { mode: "fallback", runnerIds: ["go-vet"] },
61
- // Architectural rules
62
- { mode: "fallback", runnerIds: ["architect"] },
70
+ // LSP type checking (gopls)
71
+ { mode: "all", runnerIds: ["lsp"], filterKinds: ["go"] },
72
+ // Go vet for additional checks (warning only, but low cost)
73
+ { mode: "fallback", runnerIds: ["go-vet"], filterKinds: ["go"] },
74
+ // Architectural rules (guidance only, not blocking) - runs via /lens-booboo only
63
75
  ],
64
76
  },
65
77
 
@@ -69,10 +81,11 @@ export const TOOL_PLANS: Record<string, ToolPlan> = {
69
81
  rust: {
70
82
  name: "Rust Linting",
71
83
  groups: [
72
- // Cargo clippy
73
- { mode: "fallback", runnerIds: ["rust-clippy"] },
74
- // Architectural rules
75
- { mode: "fallback", runnerIds: ["architect"] },
84
+ // LSP type checking (rust-analyzer)
85
+ { mode: "all", runnerIds: ["lsp"], filterKinds: ["rust"] },
86
+ // Cargo clippy for additional checks
87
+ { mode: "fallback", runnerIds: ["rust-clippy"], filterKinds: ["rust"] },
88
+ // Architectural rules (guidance only, not blocking) - runs via /lens-booboo only
76
89
  ],
77
90
  },
78
91
 
@@ -82,8 +95,7 @@ export const TOOL_PLANS: Record<string, ToolPlan> = {
82
95
  cxx: {
83
96
  name: "C/C++ Linting",
84
97
  groups: [
85
- // Architectural rules
86
- { mode: "fallback", runnerIds: ["architect"] },
98
+ // Architectural rules (guidance only, not blocking) - runs via /lens-booboo only
87
99
  ],
88
100
  },
89
101
 
@@ -93,8 +105,8 @@ export const TOOL_PLANS: Record<string, ToolPlan> = {
93
105
  json: {
94
106
  name: "JSON Processing",
95
107
  groups: [
96
- // Biome handles JSON well
97
- { mode: "fallback", runnerIds: ["biome-lint"] },
108
+ // Note: Biome handles JSON formatting via direct call in index.ts
109
+ // No additional linting needed for JSON
98
110
  ],
99
111
  },
100
112
 
@@ -104,7 +116,7 @@ export const TOOL_PLANS: Record<string, ToolPlan> = {
104
116
  markdown: {
105
117
  name: "Markdown Processing",
106
118
  groups: [
107
- // Spellcheck for typos
119
+ // Spellcheck for typos (warning only, but useful)
108
120
  { mode: "fallback", runnerIds: ["spellcheck"] },
109
121
  ],
110
122
  },
@@ -115,10 +127,9 @@ export const TOOL_PLANS: Record<string, ToolPlan> = {
115
127
  shell: {
116
128
  name: "Shell Script Linting",
117
129
  groups: [
118
- // Shellcheck for bash/sh/zsh linting
130
+ // Shellcheck for bash/sh/zsh linting (has blocking errors for syntax)
119
131
  { mode: "fallback", runnerIds: ["shellcheck"] },
120
- // Architectural rules
121
- { mode: "fallback", runnerIds: ["architect"] },
132
+ // Architectural rules (guidance only, not blocking) - runs via /lens-booboo only
122
133
  ],
123
134
  },
124
135
 
@@ -128,8 +139,7 @@ export const TOOL_PLANS: Record<string, ToolPlan> = {
128
139
  cmake: {
129
140
  name: "CMake Processing",
130
141
  groups: [
131
- // Architectural rules
132
- { mode: "fallback", runnerIds: ["architect"] },
142
+ // Architectural rules (guidance only, not blocking) - runs via /lens-booboo only
133
143
  ],
134
144
  },
135
145
  };
@@ -147,3 +157,39 @@ export function getToolPlan(kind: FileKind): ToolPlan | undefined {
147
157
  export function getAllToolPlans(): Record<string, ToolPlan> {
148
158
  return TOOL_PLANS;
149
159
  }
160
+
161
+ /**
162
+ * Full lint plan for /lens-booboo command (includes warning-only tools)
163
+ * This includes ALL runners for comprehensive analysis
164
+ */
165
+ export const FULL_LINT_PLANS: Record<string, ToolPlan> = {
166
+ ...TOOL_PLANS,
167
+ // Override jsts to include warning-only tools
168
+ jsts: {
169
+ name: "JavaScript/TypeScript Full Lint",
170
+ groups: [
171
+ { mode: "all", runnerIds: ["lsp"], filterKinds: ["jsts"] },
172
+ { mode: "all", runnerIds: ["tree-sitter"], filterKinds: ["jsts"] },
173
+ { mode: "all", runnerIds: ["ast-grep-napi"], filterKinds: ["jsts"] },
174
+ // Warning-only tools (for full lint, not file write)
175
+ {
176
+ mode: "fallback",
177
+ runnerIds: ["biome-lint", "oxlint"],
178
+ filterKinds: ["jsts"],
179
+ },
180
+ { mode: "fallback", runnerIds: ["type-safety"], filterKinds: ["jsts"] },
181
+ { mode: "fallback", runnerIds: ["architect"], filterKinds: ["jsts"] },
182
+ ],
183
+ },
184
+ // Override python to include warning-only tools
185
+ python: {
186
+ name: "Python Full Lint",
187
+ groups: [
188
+ { mode: "all", runnerIds: ["lsp"], filterKinds: ["python"] },
189
+ // Warning-only tools
190
+ { mode: "fallback", runnerIds: ["ruff-lint"], filterKinds: ["python"] },
191
+ { mode: "fallback", runnerIds: ["python-slop"], filterKinds: ["python"] },
192
+ { mode: "fallback", runnerIds: ["architect"], filterKinds: ["python"] },
193
+ ],
194
+ },
195
+ };