pi-lens 3.6.3 → 3.6.4

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 (206) hide show
  1. package/package.json +3 -3
  2. package/tsconfig.json +1 -1
  3. package/clients/__tests__/file-time.test.js +0 -216
  4. package/clients/__tests__/file-time.test.ts +0 -276
  5. package/clients/__tests__/format-service.test.js +0 -245
  6. package/clients/__tests__/format-service.test.ts +0 -339
  7. package/clients/__tests__/formatters.test.js +0 -271
  8. package/clients/__tests__/formatters.test.ts +0 -401
  9. package/clients/agent-behavior-client.js +0 -110
  10. package/clients/agent-behavior-client.test.js +0 -94
  11. package/clients/agent-behavior-client.test.ts +0 -116
  12. package/clients/amain-types.js +0 -164
  13. package/clients/architect-client.js +0 -291
  14. package/clients/ast-grep-client.js +0 -253
  15. package/clients/ast-grep-parser.js +0 -84
  16. package/clients/ast-grep-rule-manager.js +0 -89
  17. package/clients/ast-grep-types.js +0 -9
  18. package/clients/auto-loop.js +0 -131
  19. package/clients/biome-client.js +0 -420
  20. package/clients/biome-client.test.js +0 -144
  21. package/clients/biome-client.test.ts +0 -163
  22. package/clients/cache/rule-cache.js +0 -72
  23. package/clients/cache-manager.js +0 -245
  24. package/clients/cache-manager.test.js +0 -197
  25. package/clients/cache-manager.test.ts +0 -299
  26. package/clients/complexity-client.js +0 -675
  27. package/clients/complexity-client.test.js +0 -234
  28. package/clients/complexity-client.test.ts +0 -255
  29. package/clients/config-validator.js +0 -465
  30. package/clients/dependency-checker.js +0 -325
  31. package/clients/dependency-checker.test.js +0 -60
  32. package/clients/dependency-checker.test.ts +0 -71
  33. package/clients/dispatch/__tests__/autofix-integration.test.js +0 -245
  34. package/clients/dispatch/__tests__/autofix-integration.test.ts +0 -300
  35. package/clients/dispatch/__tests__/runner-registration.test.js +0 -234
  36. package/clients/dispatch/__tests__/runner-registration.test.ts +0 -286
  37. package/clients/dispatch/debug.log +0 -1
  38. package/clients/dispatch/dispatcher.edge.test.js +0 -82
  39. package/clients/dispatch/dispatcher.edge.test.ts +0 -100
  40. package/clients/dispatch/dispatcher.format.test.js +0 -46
  41. package/clients/dispatch/dispatcher.format.test.ts +0 -58
  42. package/clients/dispatch/dispatcher.inline.test.js +0 -74
  43. package/clients/dispatch/dispatcher.inline.test.ts +0 -93
  44. package/clients/dispatch/dispatcher.js +0 -381
  45. package/clients/dispatch/dispatcher.test.js +0 -116
  46. package/clients/dispatch/dispatcher.test.ts +0 -149
  47. package/clients/dispatch/integration.js +0 -108
  48. package/clients/dispatch/plan.js +0 -183
  49. package/clients/dispatch/runners/architect.js +0 -83
  50. package/clients/dispatch/runners/architect.test.js +0 -138
  51. package/clients/dispatch/runners/architect.test.ts +0 -162
  52. package/clients/dispatch/runners/ast-grep-napi.js +0 -405
  53. package/clients/dispatch/runners/ast-grep-napi.test.js +0 -107
  54. package/clients/dispatch/runners/ast-grep-napi.test.ts +0 -129
  55. package/clients/dispatch/runners/ast-grep.js +0 -157
  56. package/clients/dispatch/runners/biome.js +0 -55
  57. package/clients/dispatch/runners/config-validation.js +0 -67
  58. package/clients/dispatch/runners/go-vet.js +0 -48
  59. package/clients/dispatch/runners/index.js +0 -47
  60. package/clients/dispatch/runners/lsp.js +0 -102
  61. package/clients/dispatch/runners/oxlint.js +0 -67
  62. package/clients/dispatch/runners/oxlint.test.js +0 -230
  63. package/clients/dispatch/runners/oxlint.test.ts +0 -303
  64. package/clients/dispatch/runners/pyright.js +0 -100
  65. package/clients/dispatch/runners/pyright.test.js +0 -98
  66. package/clients/dispatch/runners/pyright.test.ts +0 -121
  67. package/clients/dispatch/runners/python-slop.js +0 -97
  68. package/clients/dispatch/runners/python-slop.test.js +0 -203
  69. package/clients/dispatch/runners/python-slop.test.ts +0 -298
  70. package/clients/dispatch/runners/ruff.js +0 -48
  71. package/clients/dispatch/runners/rust-clippy.js +0 -102
  72. package/clients/dispatch/runners/scan_codebase.test.js +0 -89
  73. package/clients/dispatch/runners/scan_codebase.test.ts +0 -105
  74. package/clients/dispatch/runners/shellcheck.js +0 -147
  75. package/clients/dispatch/runners/shellcheck.test.js +0 -98
  76. package/clients/dispatch/runners/shellcheck.test.ts +0 -129
  77. package/clients/dispatch/runners/similarity.js +0 -230
  78. package/clients/dispatch/runners/spellcheck.js +0 -106
  79. package/clients/dispatch/runners/spellcheck.test.js +0 -158
  80. package/clients/dispatch/runners/spellcheck.test.ts +0 -214
  81. package/clients/dispatch/runners/tree-sitter.js +0 -246
  82. package/clients/dispatch/runners/ts-lsp.js +0 -125
  83. package/clients/dispatch/runners/ts-slop.js +0 -113
  84. package/clients/dispatch/runners/type-safety.js +0 -142
  85. package/clients/dispatch/runners/utils/diagnostic-parsers.js +0 -134
  86. package/clients/dispatch/runners/utils/runner-helpers.js +0 -115
  87. package/clients/dispatch/runners/utils.js +0 -51
  88. package/clients/dispatch/runners/yaml-rule-parser.js +0 -360
  89. package/clients/dispatch/types.js +0 -16
  90. package/clients/dispatch/utils/format-utils.js +0 -44
  91. package/clients/dogfood.test.js +0 -201
  92. package/clients/dogfood.test.ts +0 -269
  93. package/clients/file-kinds.js +0 -177
  94. package/clients/file-kinds.test.js +0 -169
  95. package/clients/file-kinds.test.ts +0 -210
  96. package/clients/file-time.js +0 -152
  97. package/clients/file-utils.js +0 -40
  98. package/clients/fix-scanners.js +0 -204
  99. package/clients/format-service.js +0 -184
  100. package/clients/formatters.js +0 -488
  101. package/clients/go-client.js +0 -203
  102. package/clients/go-client.test.js +0 -127
  103. package/clients/go-client.test.ts +0 -143
  104. package/clients/installer/index.js +0 -403
  105. package/clients/interviewer-templates.js +0 -75
  106. package/clients/interviewer.js +0 -173
  107. package/clients/jscpd-client.js +0 -196
  108. package/clients/jscpd-client.test.js +0 -127
  109. package/clients/jscpd-client.test.ts +0 -145
  110. package/clients/knip-client.js +0 -239
  111. package/clients/knip-client.test.js +0 -112
  112. package/clients/knip-client.test.ts +0 -128
  113. package/clients/latency-logger.js +0 -40
  114. package/clients/lsp/__tests__/client.test.js +0 -310
  115. package/clients/lsp/__tests__/client.test.ts +0 -412
  116. package/clients/lsp/__tests__/config.test.js +0 -167
  117. package/clients/lsp/__tests__/config.test.ts +0 -217
  118. package/clients/lsp/__tests__/error-recovery.test.js +0 -213
  119. package/clients/lsp/__tests__/error-recovery.test.ts +0 -279
  120. package/clients/lsp/__tests__/integration.test.js +0 -127
  121. package/clients/lsp/__tests__/integration.test.ts +0 -160
  122. package/clients/lsp/__tests__/launch.test.js +0 -313
  123. package/clients/lsp/__tests__/launch.test.ts +0 -394
  124. package/clients/lsp/__tests__/server.test.js +0 -259
  125. package/clients/lsp/__tests__/server.test.ts +0 -332
  126. package/clients/lsp/__tests__/service.test.js +0 -438
  127. package/clients/lsp/__tests__/service.test.ts +0 -530
  128. package/clients/lsp/client.js +0 -350
  129. package/clients/lsp/config.js +0 -112
  130. package/clients/lsp/index.js +0 -318
  131. package/clients/lsp/installer/index.js +0 -391
  132. package/clients/lsp/interactive-install.js +0 -221
  133. package/clients/lsp/language.js +0 -170
  134. package/clients/lsp/launch.js +0 -329
  135. package/clients/lsp/lsp/launch.js +0 -116
  136. package/clients/lsp/lsp/server.js +0 -532
  137. package/clients/lsp/lsp-index.js +0 -10
  138. package/clients/lsp/path-utils.js +0 -5
  139. package/clients/lsp/server.js +0 -725
  140. package/clients/lsp/test-py-spawn/requirements.txt +0 -1
  141. package/clients/lsp/test-py-spawn/test.py +0 -3
  142. package/clients/lsp/test-py-svc/requirements.txt +0 -1
  143. package/clients/lsp/test-py-svc/test.py +0 -3
  144. package/clients/lsp/test-python-project/requirements.txt +0 -1
  145. package/clients/lsp/test-python-project/test.py +0 -5
  146. package/clients/metrics-client.js +0 -107
  147. package/clients/metrics-client.test.js +0 -128
  148. package/clients/metrics-client.test.ts +0 -163
  149. package/clients/metrics-history.js +0 -367
  150. package/clients/path-utils.js +0 -142
  151. package/clients/pipeline.js +0 -272
  152. package/clients/production-readiness.js +0 -522
  153. package/clients/project-index.js +0 -255
  154. package/clients/project-metadata.js +0 -531
  155. package/clients/ruff-client.js +0 -325
  156. package/clients/ruff-client.test.js +0 -132
  157. package/clients/ruff-client.test.ts +0 -153
  158. package/clients/rules-scanner.js +0 -97
  159. package/clients/runner-tracker.js +0 -152
  160. package/clients/rust-client.js +0 -205
  161. package/clients/rust-client.test.js +0 -108
  162. package/clients/rust-client.test.ts +0 -130
  163. package/clients/safe-spawn-async.js +0 -163
  164. package/clients/safe-spawn.js +0 -241
  165. package/clients/sanitize.js +0 -291
  166. package/clients/sanitize.test.js +0 -177
  167. package/clients/sanitize.test.ts +0 -223
  168. package/clients/scan-architectural-debt.js +0 -167
  169. package/clients/scan-utils.js +0 -83
  170. package/clients/secrets-scanner.js +0 -119
  171. package/clients/secrets-scanner.test.js +0 -100
  172. package/clients/secrets-scanner.test.ts +0 -113
  173. package/clients/sg-runner.js +0 -292
  174. package/clients/state-matrix.js +0 -160
  175. package/clients/subprocess-client.js +0 -65
  176. package/clients/symbol-types.js +0 -5
  177. package/clients/test-runner-client.js +0 -523
  178. package/clients/test-runner-client.test.js +0 -192
  179. package/clients/test-runner-client.test.ts +0 -253
  180. package/clients/test-utils.js +0 -27
  181. package/clients/test-utils.ts +0 -36
  182. package/clients/todo-scanner.js +0 -200
  183. package/clients/todo-scanner.test.js +0 -301
  184. package/clients/todo-scanner.test.ts +0 -352
  185. package/clients/tool-availability.js +0 -207
  186. package/clients/tree-sitter-client.js +0 -601
  187. package/clients/tree-sitter-query-loader.js +0 -355
  188. package/clients/tree-sitter-symbol-extractor.js +0 -289
  189. package/clients/ts-service.js +0 -129
  190. package/clients/type-coverage-client.js +0 -127
  191. package/clients/type-coverage-client.test.js +0 -105
  192. package/clients/type-coverage-client.test.ts +0 -125
  193. package/clients/type-safety-client.js +0 -138
  194. package/clients/types.js +0 -11
  195. package/clients/typescript-client.codefix.test.js +0 -157
  196. package/clients/typescript-client.codefix.test.ts +0 -186
  197. package/clients/typescript-client.js +0 -509
  198. package/clients/typescript-client.test.js +0 -105
  199. package/clients/typescript-client.test.ts +0 -126
  200. package/commands/booboo.js +0 -1007
  201. package/commands/fix-from-booboo.js +0 -398
  202. package/commands/fix-simplified.js +0 -618
  203. package/commands/rate.js +0 -281
  204. package/commands/rate.test.js +0 -119
  205. package/commands/rate.test.ts +0 -131
  206. package/commands/refactor.js +0 -130
@@ -1,234 +0,0 @@
1
- /**
2
- * Runner Registration Verification Tests
3
- *
4
- * Ensures all runners are properly registered and unique.
5
- * Catches issues like missing runner imports.
6
- */
7
- import { beforeAll, describe, expect, it } from "vitest";
8
- import { clearRunnerRegistry, getRunner, getRunnersForKind, listRunners, } from "../dispatcher.js";
9
- describe("Runner Registration", () => {
10
- let allRunners;
11
- beforeAll(async () => {
12
- // Clear any existing registrations for clean slate
13
- clearRunnerRegistry();
14
- // Import runners to trigger registration
15
- // This is the critical import that ensures runners are registered before dispatch
16
- await import("../runners/index.js");
17
- // Get all registered runners
18
- allRunners = listRunners();
19
- });
20
- describe("Basic Registration", () => {
21
- it("should have runners registered", () => {
22
- expect(allRunners.length).toBeGreaterThan(0);
23
- });
24
- it("should have unique runner IDs", () => {
25
- const ids = allRunners.map((r) => r.id);
26
- const uniqueIds = new Set(ids);
27
- // All IDs should be unique
28
- expect(uniqueIds.size).toBe(ids.length);
29
- });
30
- it("should be able to retrieve any registered runner by ID", () => {
31
- for (const runner of allRunners) {
32
- // Skip disabled runners (those with no appliesTo)
33
- if (!(runner.appliesTo?.length ?? 0))
34
- continue;
35
- const retrieved = getRunner(runner.id);
36
- expect(retrieved).toBeDefined();
37
- expect(retrieved?.id).toBe(runner.id);
38
- }
39
- });
40
- it("should return undefined for unknown runner IDs", () => {
41
- const unknown = getRunner("definitely-not-a-real-runner-id");
42
- expect(unknown).toBeUndefined();
43
- });
44
- });
45
- describe("Runner Properties", () => {
46
- it("should have valid appliesTo for all runners", () => {
47
- const validKinds = [
48
- "jsts",
49
- "python",
50
- "rust",
51
- "go",
52
- "shell",
53
- "json",
54
- "markdown",
55
- "cmake",
56
- "cxx",
57
- ];
58
- for (const runner of allRunners) {
59
- // Skip disabled runners (those with no appliesTo)
60
- if (!(runner.appliesTo?.length ?? 0))
61
- continue;
62
- // Each runner should have at least one appliesTo
63
- if (!(runner.appliesTo?.length ?? 0)) {
64
- console.error(`Runner ${runner.id} has no appliesTo`);
65
- }
66
- expect(runner.appliesTo?.length ?? 0, `Runner ${runner.id} should have appliesTo`).toBeGreaterThan(0);
67
- // All appliesTo should be valid kinds
68
- for (const kind of runner.appliesTo) {
69
- expect(validKinds).toContain(kind);
70
- }
71
- }
72
- });
73
- it("should have priority defined", () => {
74
- for (const runner of allRunners) {
75
- // Skip disabled runners (those with no appliesTo)
76
- if (!(runner.appliesTo?.length ?? 0))
77
- continue;
78
- // Priority should be a number (or undefined, which defaults to 100)
79
- if (runner.priority !== undefined) {
80
- expect(typeof runner.priority).toBe("number");
81
- expect(runner.priority).toBeGreaterThanOrEqual(0);
82
- }
83
- }
84
- });
85
- it("should have enabledByDefault boolean", () => {
86
- for (const runner of allRunners) {
87
- // Skip disabled runners (those with no appliesTo)
88
- if (!(runner.appliesTo?.length ?? 0))
89
- continue;
90
- expect(typeof runner.enabledByDefault).toBe("boolean");
91
- }
92
- });
93
- it("should have a run function", () => {
94
- for (const runner of allRunners) {
95
- // Skip disabled runners (those with no appliesTo)
96
- if (!(runner.appliesTo?.length ?? 0))
97
- continue;
98
- expect(typeof runner.run).toBe("function");
99
- }
100
- });
101
- });
102
- describe("Expected Runners", () => {
103
- const expectedRunners = [
104
- "ts-lsp",
105
- "ts-slop",
106
- "pyright",
107
- "python-slop",
108
- "biome-lint",
109
- "oxlint",
110
- "ruff-lint",
111
- "shellcheck",
112
- "spellcheck",
113
- "ast-grep-napi",
114
- "architect",
115
- "config-validation",
116
- ];
117
- it("should have all expected critical runners", () => {
118
- const registeredIds = allRunners.map((r) => r.id);
119
- for (const expectedId of expectedRunners) {
120
- expect(registeredIds).toContain(expectedId);
121
- }
122
- });
123
- it("should have TypeScript-related runners", () => {
124
- const tsRunners = getRunnersForKind("jsts");
125
- const tsIds = tsRunners.map((r) => r.id);
126
- // Should have at least ts-lsp
127
- expect(tsIds).toContain("ts-lsp");
128
- // Should have ts-slop
129
- expect(tsIds).toContain("ts-slop");
130
- });
131
- it("should have Python-related runners", () => {
132
- const pyRunners = getRunnersForKind("python");
133
- const pyIds = pyRunners.map((r) => r.id);
134
- // Should have pyright
135
- expect(pyIds).toContain("pyright");
136
- // Should have python-slop
137
- expect(pyIds).toContain("python-slop");
138
- });
139
- it("should have lint runners", () => {
140
- const jstsRunners = getRunnersForKind("jsts");
141
- const lintIds = ["biome-lint", "oxlint", "ts-slop"];
142
- for (const lintId of lintIds) {
143
- // At least one should be present
144
- const hasLintRunner = jstsRunners.some((r) => r.id === lintId);
145
- if (hasLintRunner) {
146
- // Found at least one
147
- expect(hasLintRunner).toBe(true);
148
- break;
149
- }
150
- }
151
- });
152
- it("should have format runners", () => {
153
- const jstsRunners = getRunnersForKind("jsts");
154
- const formatIds = ["biome-lint"];
155
- for (const formatId of formatIds) {
156
- const hasFormatRunner = jstsRunners.some((r) => r.id === formatId);
157
- if (hasFormatRunner) {
158
- expect(hasFormatRunner).toBe(true);
159
- break;
160
- }
161
- }
162
- });
163
- });
164
- describe("Runner Import Verification", () => {
165
- it("should load runner index without errors", async () => {
166
- // This catches the bug where runners weren't imported
167
- // in the dispatch system
168
- expect(async () => {
169
- await import("../runners/index.js");
170
- }).not.toThrow();
171
- });
172
- it("should have runners available after import", async () => {
173
- // Clear and re-import to verify fresh load
174
- const initialCount = listRunners().length;
175
- // Import again - should not duplicate due to id check
176
- await import("../runners/index.js");
177
- const finalCount = listRunners().length;
178
- // Should be same count (no duplicates)
179
- expect(finalCount).toBe(initialCount);
180
- });
181
- });
182
- describe("Runner Condition Functions", () => {
183
- it("should handle runners with when conditions", () => {
184
- const runnersWithWhen = allRunners.filter((r) => r.when !== undefined);
185
- for (const runner of runnersWithWhen) {
186
- // when should be a function
187
- expect(typeof runner.when).toBe("function");
188
- }
189
- });
190
- it("should evaluate when conditions correctly", async () => {
191
- // Find a runner with a when condition (e.g., autofix runners)
192
- const conditionalRunner = allRunners.find((r) => r.when !== undefined);
193
- if (conditionalRunner) {
194
- // Create mock contexts
195
- const ctxWithAutofix = {
196
- autofix: true,
197
- filePath: "test.ts",
198
- cwd: "/test",
199
- kind: "jsts",
200
- pi: { getFlag: () => false },
201
- deltaMode: false,
202
- baselines: new Map(),
203
- hasTool: async () => false,
204
- log: () => { },
205
- };
206
- const ctxWithoutAutofix = {
207
- ...ctxWithAutofix,
208
- autofix: false,
209
- };
210
- // Evaluate condition
211
- const shouldRunWith = await conditionalRunner.when?.(ctxWithAutofix);
212
- const shouldRunWithout = await conditionalRunner.when?.(ctxWithoutAutofix);
213
- // Results should be boolean
214
- expect(typeof shouldRunWith).toBe("boolean");
215
- expect(typeof shouldRunWithout).toBe("boolean");
216
- }
217
- });
218
- });
219
- describe("Priority Ordering", () => {
220
- it("should return runners sorted by priority", () => {
221
- const kinds = ["jsts", "python", "rust", "go"];
222
- for (const kind of kinds) {
223
- const runners = getRunnersForKind(kind);
224
- if (runners.length > 1) {
225
- const priorities = runners.map((r) => r.priority ?? 100);
226
- // Should be sorted ascending
227
- for (let i = 1; i < priorities.length; i++) {
228
- expect(priorities[i - 1]).toBeLessThanOrEqual(priorities[i]);
229
- }
230
- }
231
- }
232
- });
233
- });
234
- });
@@ -1,286 +0,0 @@
1
- /**
2
- * Runner Registration Verification Tests
3
- *
4
- * Ensures all runners are properly registered and unique.
5
- * Catches issues like missing runner imports.
6
- */
7
-
8
- import { beforeAll, describe, expect, it } from "vitest";
9
- import type { FileKind } from "../../file-kinds.js";
10
- import {
11
- clearRunnerRegistry,
12
- getRunner,
13
- getRunnersForKind,
14
- listRunners,
15
- } from "../dispatcher.js";
16
- import type { RunnerDefinition } from "../types.js";
17
-
18
- describe("Runner Registration", () => {
19
- let allRunners: RunnerDefinition[];
20
-
21
- beforeAll(async () => {
22
- // Clear any existing registrations for clean slate
23
- clearRunnerRegistry();
24
-
25
- // Import runners to trigger registration
26
- // This is the critical import that ensures runners are registered before dispatch
27
- await import("../runners/index.js");
28
-
29
- // Get all registered runners
30
- allRunners = listRunners();
31
- });
32
-
33
- describe("Basic Registration", () => {
34
- it("should have runners registered", () => {
35
- expect(allRunners.length).toBeGreaterThan(0);
36
- });
37
-
38
- it("should have unique runner IDs", () => {
39
- const ids = allRunners.map((r) => r.id);
40
- const uniqueIds = new Set(ids);
41
-
42
- // All IDs should be unique
43
- expect(uniqueIds.size).toBe(ids.length);
44
- });
45
-
46
- it("should be able to retrieve any registered runner by ID", () => {
47
- for (const runner of allRunners) {
48
- // Skip disabled runners (those with no appliesTo)
49
- if (!(runner.appliesTo?.length ?? 0)) continue;
50
- const retrieved = getRunner(runner.id);
51
- expect(retrieved).toBeDefined();
52
- expect(retrieved?.id).toBe(runner.id);
53
- }
54
- });
55
-
56
- it("should return undefined for unknown runner IDs", () => {
57
- const unknown = getRunner("definitely-not-a-real-runner-id");
58
- expect(unknown).toBeUndefined();
59
- });
60
- });
61
-
62
- describe("Runner Properties", () => {
63
- it("should have valid appliesTo for all runners", () => {
64
- const validKinds: FileKind[] = [
65
- "jsts",
66
- "python",
67
- "rust",
68
- "go",
69
- "shell",
70
- "json",
71
- "markdown",
72
- "cmake",
73
- "cxx",
74
- ];
75
-
76
- for (const runner of allRunners) {
77
- // Skip disabled runners (those with no appliesTo)
78
- if (!(runner.appliesTo?.length ?? 0)) continue;
79
- // Each runner should have at least one appliesTo
80
- if (!(runner.appliesTo?.length ?? 0)) {
81
- console.error(`Runner ${runner.id} has no appliesTo`);
82
- }
83
- expect(
84
- runner.appliesTo?.length ?? 0,
85
- `Runner ${runner.id} should have appliesTo`,
86
- ).toBeGreaterThan(0);
87
-
88
- // All appliesTo should be valid kinds
89
- for (const kind of runner.appliesTo) {
90
- expect(validKinds).toContain(kind);
91
- }
92
- }
93
- });
94
-
95
- it("should have priority defined", () => {
96
- for (const runner of allRunners) {
97
- // Skip disabled runners (those with no appliesTo)
98
- if (!(runner.appliesTo?.length ?? 0)) continue;
99
- // Priority should be a number (or undefined, which defaults to 100)
100
- if (runner.priority !== undefined) {
101
- expect(typeof runner.priority).toBe("number");
102
- expect(runner.priority).toBeGreaterThanOrEqual(0);
103
- }
104
- }
105
- });
106
-
107
- it("should have enabledByDefault boolean", () => {
108
- for (const runner of allRunners) {
109
- // Skip disabled runners (those with no appliesTo)
110
- if (!(runner.appliesTo?.length ?? 0)) continue;
111
- expect(typeof runner.enabledByDefault).toBe("boolean");
112
- }
113
- });
114
-
115
- it("should have a run function", () => {
116
- for (const runner of allRunners) {
117
- // Skip disabled runners (those with no appliesTo)
118
- if (!(runner.appliesTo?.length ?? 0)) continue;
119
- expect(typeof runner.run).toBe("function");
120
- }
121
- });
122
- });
123
-
124
- describe("Expected Runners", () => {
125
- const expectedRunners = [
126
- "ts-lsp",
127
- "ts-slop",
128
- "pyright",
129
- "python-slop",
130
- "biome-lint",
131
-
132
- "oxlint",
133
- "ruff-lint",
134
- "shellcheck",
135
- "spellcheck",
136
- "ast-grep-napi",
137
- "architect",
138
- "config-validation",
139
- ];
140
-
141
- it("should have all expected critical runners", () => {
142
- const registeredIds = allRunners.map((r) => r.id);
143
-
144
- for (const expectedId of expectedRunners) {
145
- expect(registeredIds).toContain(expectedId);
146
- }
147
- });
148
-
149
- it("should have TypeScript-related runners", () => {
150
- const tsRunners = getRunnersForKind("jsts");
151
- const tsIds = tsRunners.map((r) => r.id);
152
-
153
- // Should have at least ts-lsp
154
- expect(tsIds).toContain("ts-lsp");
155
-
156
- // Should have ts-slop
157
- expect(tsIds).toContain("ts-slop");
158
- });
159
-
160
- it("should have Python-related runners", () => {
161
- const pyRunners = getRunnersForKind("python");
162
- const pyIds = pyRunners.map((r) => r.id);
163
-
164
- // Should have pyright
165
- expect(pyIds).toContain("pyright");
166
-
167
- // Should have python-slop
168
- expect(pyIds).toContain("python-slop");
169
- });
170
-
171
- it("should have lint runners", () => {
172
- const jstsRunners = getRunnersForKind("jsts");
173
- const lintIds = ["biome-lint", "oxlint", "ts-slop"];
174
-
175
- for (const lintId of lintIds) {
176
- // At least one should be present
177
- const hasLintRunner = jstsRunners.some((r) => r.id === lintId);
178
- if (hasLintRunner) {
179
- // Found at least one
180
- expect(hasLintRunner).toBe(true);
181
- break;
182
- }
183
- }
184
- });
185
-
186
- it("should have format runners", () => {
187
- const jstsRunners = getRunnersForKind("jsts");
188
- const formatIds = ["biome-lint"];
189
-
190
- for (const formatId of formatIds) {
191
- const hasFormatRunner = jstsRunners.some((r) => r.id === formatId);
192
- if (hasFormatRunner) {
193
- expect(hasFormatRunner).toBe(true);
194
- break;
195
- }
196
- }
197
- });
198
- });
199
-
200
- describe("Runner Import Verification", () => {
201
- it("should load runner index without errors", async () => {
202
- // This catches the bug where runners weren't imported
203
- // in the dispatch system
204
- expect(async () => {
205
- await import("../runners/index.js");
206
- }).not.toThrow();
207
- });
208
-
209
- it("should have runners available after import", async () => {
210
- // Clear and re-import to verify fresh load
211
- const initialCount = listRunners().length;
212
-
213
- // Import again - should not duplicate due to id check
214
- await import("../runners/index.js");
215
-
216
- const finalCount = listRunners().length;
217
-
218
- // Should be same count (no duplicates)
219
- expect(finalCount).toBe(initialCount);
220
- });
221
- });
222
-
223
- describe("Runner Condition Functions", () => {
224
- it("should handle runners with when conditions", () => {
225
- const runnersWithWhen = allRunners.filter((r) => r.when !== undefined);
226
-
227
- for (const runner of runnersWithWhen) {
228
- // when should be a function
229
- expect(typeof runner.when).toBe("function");
230
- }
231
- });
232
-
233
- it("should evaluate when conditions correctly", async () => {
234
- // Find a runner with a when condition (e.g., autofix runners)
235
- const conditionalRunner = allRunners.find((r) => r.when !== undefined);
236
-
237
- if (conditionalRunner) {
238
- // Create mock contexts
239
- const ctxWithAutofix = {
240
- autofix: true,
241
- filePath: "test.ts",
242
- cwd: "/test",
243
- kind: "jsts" as FileKind,
244
- pi: { getFlag: () => false },
245
- deltaMode: false,
246
- baselines: new Map(),
247
- hasTool: async () => false,
248
- log: () => {},
249
- };
250
-
251
- const ctxWithoutAutofix = {
252
- ...ctxWithAutofix,
253
- autofix: false,
254
- };
255
-
256
- // Evaluate condition
257
- const shouldRunWith = await conditionalRunner.when?.(ctxWithAutofix);
258
- const shouldRunWithout =
259
- await conditionalRunner.when?.(ctxWithoutAutofix);
260
-
261
- // Results should be boolean
262
- expect(typeof shouldRunWith).toBe("boolean");
263
- expect(typeof shouldRunWithout).toBe("boolean");
264
- }
265
- });
266
- });
267
-
268
- describe("Priority Ordering", () => {
269
- it("should return runners sorted by priority", () => {
270
- const kinds: FileKind[] = ["jsts", "python", "rust", "go"];
271
-
272
- for (const kind of kinds) {
273
- const runners = getRunnersForKind(kind);
274
-
275
- if (runners.length > 1) {
276
- const priorities = runners.map((r) => r.priority ?? 100);
277
-
278
- // Should be sorted ascending
279
- for (let i = 1; i < priorities.length; i++) {
280
- expect(priorities[i - 1]).toBeLessThanOrEqual(priorities[i]);
281
- }
282
- }
283
- }
284
- });
285
- });
286
- });
@@ -1 +0,0 @@
1
- DEBUG LOG CREATED
@@ -1,82 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { formatDiagnostic } from "./utils/format-utils.js";
3
- describe("formatDiagnostic edge cases", () => {
4
- it("should handle messages with colons correctly", () => {
5
- // This tests the actual format of inline code fix messages
6
- const diagnostic = {
7
- id: "architect-1",
8
- // This is the format of architect warnings - starts with "No "
9
- message: "No absolute Windows paths — breaks CI and cross-platform builds.",
10
- filePath: "/test.ts",
11
- line: 10,
12
- severity: "warning",
13
- semantic: "warning",
14
- tool: "architect",
15
- rule: "no-absolute-paths",
16
- };
17
- const formatted = formatDiagnostic(diagnostic);
18
- // Should show the complete message, not cut off at "No "
19
- expect(formatted).toContain("No absolute Windows paths");
20
- expect(formatted).toContain("breaks CI and cross-platform builds");
21
- expect(formatted).not.toBe(" L10: No "); // Should NOT be truncated
22
- });
23
- it("should handle code fix messages with newlines", () => {
24
- const diagnostic = {
25
- id: "ts-12-2345",
26
- // This is the actual format from ts-lsp runner
27
- message: "Property 'debug' is missing in type 'Config'\nšŸ’” Quick fix: Add missing property 'debug'",
28
- filePath: "/test.ts",
29
- line: 12,
30
- severity: "error",
31
- semantic: "blocking",
32
- tool: "ts-lsp",
33
- rule: "TS2345",
34
- };
35
- const formatted = formatDiagnostic(diagnostic);
36
- // Should have both lines properly indented
37
- expect(formatted).toBe(" L12: Property 'debug' is missing in type 'Config'\n šŸ’” Quick fix: Add missing property 'debug'");
38
- });
39
- it("should handle messages with em-dashes (—)", () => {
40
- const diagnostic = {
41
- id: "architect-2",
42
- message: "No hardcoded secrets — use environment variables or a secrets manager.",
43
- filePath: "/test.ts",
44
- line: 5,
45
- severity: "warning",
46
- semantic: "warning",
47
- tool: "architect",
48
- rule: "no-secrets",
49
- };
50
- const formatted = formatDiagnostic(diagnostic);
51
- // Should preserve the full message with em-dash
52
- expect(formatted).toContain("No hardcoded secrets");
53
- expect(formatted).toContain("use environment variables");
54
- });
55
- it("should not truncate architect 'No ' messages", () => {
56
- // Testing all the "No " patterns from default-architect.yaml
57
- const testMessages = [
58
- "No absolute Windows paths — breaks CI and cross-platform builds.",
59
- "No hardcoded localhost URLs — use environment variables or a config service.",
60
- "No empty catch/except blocks. Swallowing errors makes debugging impossible — at least log the error.",
61
- "No hardcoded secrets — use environment variables or a secrets manager.",
62
- "No 'any' types — use 'unknown' or define a proper interface to maintain type safety.",
63
- ];
64
- for (const message of testMessages) {
65
- const diagnostic = {
66
- id: "test-1",
67
- message,
68
- filePath: "/test.ts",
69
- line: 1,
70
- severity: "warning",
71
- semantic: "warning",
72
- tool: "architect",
73
- rule: "test",
74
- };
75
- const formatted = formatDiagnostic(diagnostic);
76
- // Each formatted message should be more than just " L1: No "
77
- expect(formatted.length).toBeGreaterThan(10);
78
- expect(formatted).toContain("No ");
79
- expect(formatted).toContain("—"); // Should have the em-dash
80
- }
81
- });
82
- });