@mrclrchtr/supi-code-intelligence 6.2.0 → 6.4.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 (68) hide show
  1. package/README.md +2 -0
  2. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  3. package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  4. package/node_modules/@mrclrchtr/supi-lsp/README.md +2 -0
  5. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  6. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  7. package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/README.md +52 -0
  8. package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/index.js +785 -129
  9. package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/legacy.js +660 -98
  10. package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/package.json +10 -4
  11. package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
  12. package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +16 -2
  13. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/workspace-sentinels.ts +4 -32
  14. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/workspace-sources.ts +108 -0
  15. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-process-crash-report.ts +106 -0
  16. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-recovery.ts +4 -4
  17. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +513 -113
  18. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +43 -15
  19. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +40 -33
  20. package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +36 -6
  21. package/node_modules/@mrclrchtr/supi-lsp/src/summary.ts +1 -1
  22. package/node_modules/@mrclrchtr/supi-lsp/src/workspace-path-policy.ts +18 -9
  23. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  24. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  25. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/README.md +29 -1
  26. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +99 -19
  27. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +4 -4
  28. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +94 -18
  29. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +4 -4
  30. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
  31. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +14 -14
  32. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +13 -8
  33. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +97 -19
  34. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +4 -4
  35. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +28 -8
  36. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +1 -1
  37. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +28 -8
  38. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +1 -1
  39. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +92 -18
  40. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +4 -4
  41. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
  42. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +17 -17
  43. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +7 -4
  44. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm +0 -0
  45. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm.json +2 -2
  46. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm +0 -0
  47. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json +2 -2
  48. package/package.json +5 -5
  49. package/src/session/health-refresh.ts +19 -12
  50. package/src/session/health-types.ts +8 -3
  51. package/src/session/health-workflow.ts +7 -3
  52. package/src/session/session.ts +12 -5
  53. package/src/substrate/lsp/maintenance.ts +53 -47
  54. package/src/substrate/lsp/settings.ts +2 -1
  55. package/src/substrate/lsp/source-tracking.ts +247 -0
  56. package/src/tool/code_find/guidance.ts +3 -3
  57. package/src/tool/code_graph/guidance.ts +2 -2
  58. package/src/tool/code_health/guidance.ts +3 -3
  59. package/src/tool/code_health/markdown.ts +21 -5
  60. package/src/tool/code_health/refresh-outcome.ts +48 -7
  61. package/src/tool/code_health/refresh-status.ts +83 -16
  62. package/src/tool/code_health/tui.ts +4 -0
  63. package/src/tool/code_inspect/guidance.ts +5 -3
  64. package/src/tool/code_orientation/guidance.ts +3 -4
  65. package/src/tool/code_refactor_apply/guidance.ts +1 -1
  66. package/src/tool/code_refactor_plan/guidance.ts +3 -5
  67. package/src/tool/code_resolve/guidance.ts +3 -3
  68. package/src/tool/guidance.ts +11 -9
@@ -45,26 +45,54 @@ export interface OutstandingDiagnosticSummaryEntry {
45
45
  hints: number;
46
46
  }
47
47
 
48
- /**
49
- * Outcome of explicit process-crash recovery demand in one diagnostic pass.
50
- *
51
- * Routes are counted rather than client generations because process-crash
52
- * recovery owns one budget per LSP route. `attemptedRoutes` is the number of
53
- * crashed routes selected by the demand; a route can be failed already or
54
- * have a shared replacement in progress when the demand observes it.
55
- */
56
- export interface ProcessCrashRecoverySummary {
57
- attemptedRoutes: number;
58
- recoveredRoutes: number;
59
- failedRoutes: number;
48
+ /** Stable outcome for one route in an explicit process-crash report. */
49
+ export type ProcessCrashRecoveryOutcome =
50
+ | "recovered"
51
+ | "skipped-no-retained-file"
52
+ | "recovery-failed"
53
+ | "recovery-exhausted";
54
+
55
+ /** Typed next action for a non-recovered process-crash route. */
56
+ export type ProcessCrashRecoveryNextAction = "use-exact-file" | "reload-workspace";
57
+
58
+ /** One bounded route entry in a process-crash recovery report. */
59
+ export interface ProcessCrashRecoveryEntry {
60
+ /** Configured server name. */
61
+ readonly name: string;
62
+ /** Workspace-relative route root. */
63
+ readonly root: string;
64
+ readonly outcome: ProcessCrashRecoveryOutcome;
65
+ /** Available action when the route was not recovered. */
66
+ readonly nextAction?: ProcessCrashRecoveryNextAction;
67
+ /** Bounded caught Error.message for a failed recovery, when available. */
68
+ readonly failureMessage?: string;
69
+ }
70
+
71
+ /** Maximum number of route entries retained in a process-crash report. */
72
+ export const MAX_PROCESS_CRASH_RECOVERY_ENTRIES = 16;
73
+
74
+ /** Bounded, route-specific result of one explicit process-crash demand. */
75
+ export interface ProcessCrashRecoveryReport {
76
+ /** Exact counts include entries omitted from the visible route list. */
77
+ readonly recoveredRoutes: number;
78
+ readonly skippedRoutes: number;
79
+ readonly failedRoutes: number;
80
+ readonly exhaustedRoutes: number;
81
+ /** At most 16 entries, ordered by action priority, root, and server name. */
82
+ readonly entries: readonly ProcessCrashRecoveryEntry[];
83
+ /** Exact number of route entries not included in {@link entries}. */
84
+ readonly omittedEntries: number;
60
85
  }
61
86
 
62
87
  /** Create the empty outcome for a pass with no process-crash demand. */
63
- export function emptyProcessCrashRecoverySummary(): ProcessCrashRecoverySummary {
88
+ export function emptyProcessCrashRecoveryReport(): ProcessCrashRecoveryReport {
64
89
  return {
65
- attemptedRoutes: 0,
66
90
  recoveredRoutes: 0,
91
+ skippedRoutes: 0,
67
92
  failedRoutes: 0,
93
+ exhaustedRoutes: 0,
94
+ entries: [],
95
+ omittedEntries: 0,
68
96
  };
69
97
  }
70
98
 
@@ -75,7 +103,7 @@ export interface RecoverDiagnosticsResult {
75
103
  /** Clients restarted by stale-diagnostic recovery, not process-crash recovery. */
76
104
  restartedClients: number;
77
105
  /** Separate outcome for process-crash route recovery selected by this pass. */
78
- processCrashRecovery: ProcessCrashRecoverySummary;
106
+ processCrashRecovery: ProcessCrashRecoveryReport;
79
107
  /** Evidence collected by the refresh and recovery operations. */
80
108
  diagnosticEvidence: DiagnosticEvidenceSummary;
81
109
  /** Final diagnostic report captured after all refresh and recovery work. */
@@ -39,10 +39,11 @@ import type { LspManager } from "../manager/manager.ts";
39
39
  import { raceReadinessValue } from "./readiness.ts";
40
40
  import type {
41
41
  DiagnosticEvidenceSummary,
42
- ProcessCrashRecoverySummary,
42
+ ProcessCrashRecoveryReport,
43
43
  RecoverDiagnosticsResult,
44
44
  } from "./runtime-diagnostics.ts";
45
45
  import type {
46
+ BulkTrackFilesResult,
46
47
  RoutedMutationResponse,
47
48
  SemanticReadinessResult,
48
49
  WorkspaceLspRuntime,
@@ -57,15 +58,21 @@ export {
57
58
  type DiagnosticEvidenceDocument,
58
59
  type DiagnosticEvidenceStatus,
59
60
  type DiagnosticEvidenceSummary,
60
- emptyProcessCrashRecoverySummary,
61
+ emptyProcessCrashRecoveryReport,
62
+ MAX_PROCESS_CRASH_RECOVERY_ENTRIES,
61
63
  type OutstandingDiagnosticSummaryEntry,
62
- type ProcessCrashRecoverySummary,
64
+ type ProcessCrashRecoveryEntry,
65
+ type ProcessCrashRecoveryNextAction,
66
+ type ProcessCrashRecoveryOutcome,
67
+ type ProcessCrashRecoveryReport,
63
68
  type RecoverDiagnosticsResult,
64
69
  type WorkspaceDiagnosticReport,
65
70
  type WorkspaceDiagnosticSnapshot,
66
71
  type WorkspaceDiagnosticSummaryEntry,
67
72
  } from "./runtime-diagnostics.ts";
68
73
  export type {
74
+ BulkTrackFileOutcome,
75
+ BulkTrackFilesResult,
69
76
  RoutedMutationResponse,
70
77
  SemanticReadinessResult,
71
78
  WorkspaceLspRuntime,
@@ -80,27 +87,13 @@ function unavailableFileQuery<T>(operation: string, file: string): CodeQueryResu
80
87
  return unavailableCodeQuery(`No routed LSP client could complete ${operation} for ${file}.`);
81
88
  }
82
89
 
83
- function hasProcessCrashRecovery(summary: ProcessCrashRecoverySummary): boolean {
84
- return summary.attemptedRoutes > 0 || summary.recoveredRoutes > 0 || summary.failedRoutes > 0;
85
- }
86
-
87
- /**
88
- * Combine the eager and current state for one readiness wait.
89
- * A current failure replaces the older pending view; max avoids double-counting
90
- * one route when both views describe the same recovery attempt.
91
- */
92
- function mergeProcessCrashRecoverySummaries(
93
- eager: ProcessCrashRecoverySummary | undefined,
94
- current: ProcessCrashRecoverySummary | null,
95
- ): ProcessCrashRecoverySummary | undefined {
96
- if (!eager) return current ?? undefined;
97
- if (!current) return eager;
98
- if (current.failedRoutes > 0) return current;
99
- return {
100
- attemptedRoutes: Math.max(eager.attemptedRoutes, current.attemptedRoutes),
101
- recoveredRoutes: Math.max(eager.recoveredRoutes, current.recoveredRoutes),
102
- failedRoutes: Math.max(eager.failedRoutes, current.failedRoutes),
103
- };
90
+ function hasProcessCrashRecovery(report: ProcessCrashRecoveryReport): boolean {
91
+ return (
92
+ report.recoveredRoutes > 0 ||
93
+ report.skippedRoutes > 0 ||
94
+ report.failedRoutes > 0 ||
95
+ report.exhaustedRoutes > 0
96
+ );
104
97
  }
105
98
 
106
99
  /** Emit one aggregate tsconfig scope-decision event after a recovery pass. */
@@ -282,7 +275,7 @@ class DefaultWorkspaceLspRuntime implements WorkspaceLspRuntime {
282
275
  ): Promise<SemanticReadinessResult> {
283
276
  const resolvedPath = this.resolveFilePath(filePath);
284
277
  if (!this.manager.canServeFile(resolvedPath)) {
285
- const processCrashRecovery = this.manager.getProcessCrashRecoverySummaryForFile(resolvedPath);
278
+ const processCrashRecovery = this.manager.getProcessCrashRecoveryReportForFile(resolvedPath);
286
279
  return {
287
280
  kind: "unavailable",
288
281
  reason: "No LSP client can serve this file",
@@ -290,19 +283,20 @@ class DefaultWorkspaceLspRuntime implements WorkspaceLspRuntime {
290
283
  };
291
284
  }
292
285
 
293
- let eagerProcessCrashRecovery: ProcessCrashRecoverySummary | undefined;
286
+ let eagerProcessCrashRecovery: ProcessCrashRecoveryReport | undefined;
294
287
  const readiness = await raceReadinessValue(
295
- this.manager.waitUntilFileReady(resolvedPath, control, (summary) => {
296
- eagerProcessCrashRecovery = summary;
288
+ this.manager.waitUntilFileReady(resolvedPath, control, (report) => {
289
+ eagerProcessCrashRecovery = report;
297
290
  }),
298
291
  options.timeoutMs,
299
292
  control,
300
293
  );
301
294
  if (readiness.kind !== "resolved") {
302
- const processCrashRecovery = mergeProcessCrashRecoverySummaries(
303
- eagerProcessCrashRecovery,
304
- this.manager.getProcessCrashRecoverySummaryForFile(resolvedPath),
305
- );
295
+ // A timeout can happen before shared recovery settles. Do not create a
296
+ // route outcome for work that has no final result yet.
297
+ const currentProcessCrashRecovery =
298
+ this.manager.getProcessCrashRecoveryReportForFile(resolvedPath);
299
+ const processCrashRecovery = currentProcessCrashRecovery ?? eagerProcessCrashRecovery;
306
300
  return processCrashRecovery ? { ...readiness, processCrashRecovery } : readiness;
307
301
  }
308
302
  const { client, processCrashRecovery } = readiness.value;
@@ -354,7 +348,12 @@ class DefaultWorkspaceLspRuntime implements WorkspaceLspRuntime {
354
348
  return this.manager.scanWorkspaceSentinels(options);
355
349
  }
356
350
 
357
- /** Refresh the automatic workspace sentinel and source inventory. */
351
+ /** Scan configured source extensions under the automatic path policy. */
352
+ scanWorkspaceSources(control?: CodeRequestControl) {
353
+ return this.manager.scanWorkspaceSources(control);
354
+ }
355
+
356
+ /** Refresh the automatic workspace sentinel. */
358
357
  syncWorkspaceSentinelSnapshot(
359
358
  previous: Map<string, number>,
360
359
  options: WorkspaceSentinelScanOptions = {},
@@ -362,6 +361,14 @@ class DefaultWorkspaceLspRuntime implements WorkspaceLspRuntime {
362
361
  return this.manager.syncWorkspaceSentinelSnapshot(previous, options);
363
362
  }
364
363
 
364
+ /** Track a bounded set of source files without exposing clients. */
365
+ bulkTrackFiles(
366
+ filePaths: readonly string[],
367
+ control?: CodeRequestControl,
368
+ ): Promise<BulkTrackFilesResult> {
369
+ return this.manager.bulkTrackFiles(filePaths, control);
370
+ }
371
+
365
372
  /** Track a file in its routed client without exposing that client. */
366
373
  async trackFile(filePath: string): Promise<boolean> {
367
374
  const resolvedPath = this.resolveFilePath(filePath);
@@ -17,8 +17,12 @@ import type {
17
17
  WorkspaceSentinelScanOptions,
18
18
  WorkspaceSentinelSyncResult,
19
19
  } from "../diagnostics/workspace-sentinels.ts";
20
+ import type { WorkspaceSourceInventory } from "../diagnostics/workspace-sources.ts";
20
21
  import type { WorkspaceLspDiagnosticSurface } from "./runtime-diagnostic-surface.ts";
21
- import type { ProcessCrashRecoverySummary } from "./runtime-diagnostics.ts";
22
+ import type { ProcessCrashRecoveryReport } from "./runtime-diagnostics.ts";
23
+
24
+ /** Maximum number of files processed by one automatic bulk-tracking call. */
25
+ export const MAX_BULK_TRACK_FILES = 256;
22
26
 
23
27
  export type WorkspaceLspRuntimeState =
24
28
  | { kind: "ready"; runtime: WorkspaceLspRuntime }
@@ -31,18 +35,18 @@ export type SemanticReadinessResult =
31
35
  | {
32
36
  kind: "ready";
33
37
  /** Process-crash route recovery observed while establishing file readiness. */
34
- processCrashRecovery?: ProcessCrashRecoverySummary;
38
+ processCrashRecovery?: ProcessCrashRecoveryReport;
35
39
  }
36
40
  | {
37
41
  kind: "timeout";
38
42
  /** Process-crash route recovery observed before the readiness timeout. */
39
- processCrashRecovery?: ProcessCrashRecoverySummary;
43
+ processCrashRecovery?: ProcessCrashRecoveryReport;
40
44
  }
41
45
  | {
42
46
  kind: "unavailable";
43
47
  reason: string;
44
48
  /** Process-crash route recovery observed before readiness became unavailable. */
45
- processCrashRecovery?: ProcessCrashRecoverySummary;
49
+ processCrashRecovery?: ProcessCrashRecoveryReport;
46
50
  };
47
51
 
48
52
  /** One mutation response and the exact provider roots from its semantic route. */
@@ -53,6 +57,22 @@ export interface RoutedMutationResponse<T> {
53
57
  readonly authorizedMutationRoots: readonly string[];
54
58
  }
55
59
 
60
+ /** Outcome for one path selected by a bounded automatic tracking batch. */
61
+ export type BulkTrackFileOutcome =
62
+ | { readonly file: string; readonly kind: "tracked" }
63
+ | { readonly file: string; readonly kind: "already-tracked" }
64
+ | {
65
+ readonly file: string;
66
+ readonly kind: "unsupported";
67
+ readonly reason: "missing" | "not-automatic-source";
68
+ }
69
+ | { readonly file: string; readonly kind: "unavailable"; readonly reason: string };
70
+
71
+ /** Result of one bounded automatic tracking batch. */
72
+ export interface BulkTrackFilesResult {
73
+ readonly outcomes: readonly BulkTrackFileOutcome[];
74
+ }
75
+
56
76
  /**
57
77
  * Workspace-scoped LSP interface that owns routing, readiness, semantic operations,
58
78
  * diagnostics, and recovery without exposing clients or the mutable manager.
@@ -116,13 +136,23 @@ export interface WorkspaceLspRuntime extends WorkspaceLspDiagnosticSurface {
116
136
  getProjectServers(): ProjectServerInfo[];
117
137
  /** Check whether automatic LSP work can use and serve the source file. */
118
138
  isSupportedSourceFile(filePath: string): boolean;
119
- /** Inventory policy-eligible workspace sentinels and optional source files. */
139
+ /** Inventory policy-eligible workspace sentinels. */
120
140
  scanWorkspaceSentinels(options?: WorkspaceSentinelScanOptions): Map<string, number>;
121
- /** Refresh one policy-eligible workspace sentinel and source inventory. */
141
+ /** Scan configured source extensions under the automatic path policy. */
142
+ scanWorkspaceSources(control?: CodeRequestControl): Promise<WorkspaceSourceInventory>;
143
+ /** Refresh one policy-eligible workspace sentinel. */
122
144
  syncWorkspaceSentinelSnapshot(
123
145
  previous: Map<string, number>,
124
146
  options?: WorkspaceSentinelScanOptions,
125
147
  ): WorkspaceSentinelSyncResult;
148
+ /**
149
+ * Track a bounded, deduplicated set of automatic source files. Inputs after
150
+ * the first 256 unique paths are ignored; callers must retain those paths.
151
+ */
152
+ bulkTrackFiles(
153
+ filePaths: readonly string[],
154
+ control?: CodeRequestControl,
155
+ ): Promise<BulkTrackFilesResult>;
126
156
  trackFile(filePath: string): Promise<boolean>;
127
157
  closeFile(filePath: string): void;
128
158
  pruneMissingFiles(): readonly string[];
@@ -94,7 +94,7 @@ import { isFileExcludedByTsconfig } from "./config/tsconfig-scope.ts";
94
94
 
95
95
  /** Check whether the supplied automatic path policy allows a file path. */
96
96
  export function isInProjectTree(filePath: string, policy: AutomaticLspPathPolicy): boolean {
97
- return policy.isEligible(filePath);
97
+ return policy.isEligible(filePath, "file");
98
98
  }
99
99
 
100
100
  /** Check automatic and tsconfig diagnostic scope for one file path. */
@@ -26,7 +26,10 @@ const BUILT_IN_EXCLUSIONS = new Set(AUTOMATIC_LSP_EXCLUDED_DIRECTORIES);
26
26
  export interface AutomaticLspPathPolicy {
27
27
  /** Canonical absolute workspace root used for all matching. */
28
28
  readonly workspaceRoot: string;
29
- /** True when automatic LSP work can use the path. */
29
+ /**
30
+ * True when automatic LSP work can use the path.
31
+ * The policy reads the path kind when the caller does not supply it.
32
+ */
30
33
  isEligible(candidate: string, kind?: "file" | "directory"): boolean;
31
34
  }
32
35
 
@@ -40,17 +43,14 @@ export function createAutomaticLspPathPolicy(
40
43
  const repositoryRules = compileRepositoryRules(canonicalRoot, configuredExclusions);
41
44
  return Object.freeze({
42
45
  workspaceRoot: canonicalRoot,
43
- isEligible(candidate: string, kind: "file" | "directory" = "file"): boolean {
46
+ isEligible(candidate: string, kind?: "file" | "directory"): boolean {
44
47
  const relativePath = normalizeCandidate(canonicalRoot, workspaceRoot, candidate);
45
- if (
46
- relativePath === null ||
47
- !isAutomaticCandidateAllowed(workspaceRoot, relativePath, kind)
48
- ) {
49
- return false;
50
- }
48
+ if (relativePath === null) return false;
49
+ const candidateKind = kind ?? readCandidateKind(canonicalRoot, relativePath);
50
+ if (!isAutomaticCandidateAllowed(workspaceRoot, relativePath, candidateKind)) return false;
51
51
  return isEligibleRelativePath(
52
52
  relativePath,
53
- kind === "directory",
53
+ candidateKind === "directory",
54
54
  configuredExclusions,
55
55
  repositoryRules,
56
56
  );
@@ -78,6 +78,7 @@ export function walkAutomaticLspTree(
78
78
  depth: number,
79
79
  onDirectory: (directory: string, entries: readonly Dirent[]) => boolean | undefined,
80
80
  ): void {
81
+ if (!policy.isEligible(directory, "directory")) return;
81
82
  walkDirectoryTree({
82
83
  directory,
83
84
  depth,
@@ -220,6 +221,14 @@ function relativeToRuleBase(base: string, relativePath: string): string | null {
220
221
  return relativePath.startsWith(`${base}/`) ? relativePath.slice(base.length + 1) : null;
221
222
  }
222
223
 
224
+ function readCandidateKind(canonicalRoot: string, relativePath: string): "file" | "directory" {
225
+ try {
226
+ return statSync(path.resolve(canonicalRoot, relativePath)).isDirectory() ? "directory" : "file";
227
+ } catch {
228
+ return "file";
229
+ }
230
+ }
231
+
223
232
  function isAutomaticCandidateAllowed(
224
233
  suppliedRoot: string,
225
234
  relativePath: string,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-code-runtime",
3
- "version": "6.2.0",
3
+ "version": "6.4.0",
4
4
  "description": "Shared workspace context and capability contracts for code intelligence",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-core",
3
- "version": "6.2.0",
3
+ "version": "6.4.0",
4
4
  "description": "Shared settings, configuration, reporting, and session infrastructure",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -174,7 +174,9 @@ For example, you can download the JavaScript `.wasm` file from the tree-sitter-j
174
174
  You can also generate the `.wasm` file for your desired grammar. Shown below is an example of how to generate the `.wasm`
175
175
  file for the JavaScript grammar.
176
176
 
177
- **IMPORTANT**: [Emscripten][emscripten], [Docker][docker], or [Podman][podman] need to be installed.
177
+ > [!NOTE]
178
+ > Since v0.26.1, `tree-sitter build --wasm` uses [wasi-sdk][] and will automatically download it on first use.
179
+ > No additional tools need to be installed.
178
180
 
179
181
  First install `tree-sitter-cli`, and the tree-sitter language for which to generate `.wasm`
180
182
  (`tree-sitter-javascript` in this example):
@@ -191,6 +193,19 @@ npx tree-sitter build --wasm node_modules/tree-sitter-javascript
191
193
 
192
194
  If everything is fine, file `tree-sitter-javascript.wasm` should be generated in current directory.
193
195
 
196
+ ### Wasm compatibility
197
+
198
+ `web-tree-sitter` supports the same parser ABI versions as the corresponding tree-sitter library:
199
+
200
+ | web-tree-sitter version | Min parser ABI version | Max parser ABI version |
201
+ |-------------------------|------------------------|------------------------|
202
+ | 0.24.x | 13 | 14 |
203
+ | >= 0.25.0 | 13 | 15 |
204
+
205
+ > [!WARNING]
206
+ > Some prebuilt `.wasm` files use an older dynamic-linking format that newer versions of `web-tree-sitter` cannot
207
+ > load, even if their parser ABI is supported. Rebuild these files using a current tree-sitter CLI.
208
+
194
209
  ### Running .wasm in Node.js
195
210
 
196
211
  Notice that executing `.wasm` files in Node.js is considerably slower than running [Node.js bindings][node bindings].
@@ -209,6 +224,18 @@ const Parser = require('web-tree-sitter');
209
224
  })();
210
225
  ```
211
226
 
227
+ ### Loading a pre-compiled WebAssembly module
228
+
229
+ Some environments, such as Cloudflare Workers and Vercel Edge Functions, import
230
+ `.wasm` files as `WebAssembly.Module` objects. You can pass those modules to `Language.loadSync`:
231
+
232
+ ```javascript
233
+ import treeSitterJavaScript from 'tree-sitter-javascript.wasm';
234
+ // treeSitterJavaScript is of type `WebAssembly.Module`
235
+ const JavaScript = Language.loadSync(treeSitterJavaScript);
236
+ parser.setLanguage(JavaScript);
237
+ ```
238
+
212
239
  ### Running .wasm in browser
213
240
 
214
241
  `web-tree-sitter` can run in the browser, but there are some common pitfalls.
@@ -263,3 +290,4 @@ following to your webpack config:
263
290
  [node bindings]: https://github.com/tree-sitter/node-tree-sitter
264
291
  [npm module]: https://www.npmjs.com/package/web-tree-sitter
265
292
  [podman]: https://podman.io
293
+ [wasi-sdk]: https://github.com/WebAssembly/wasi-sdk