@mrclrchtr/supi-code-intelligence 0.1.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 (146) hide show
  1. package/README.md +212 -0
  2. package/node_modules/@mrclrchtr/supi-core/README.md +90 -0
  3. package/node_modules/@mrclrchtr/supi-core/package.json +30 -0
  4. package/node_modules/@mrclrchtr/supi-core/src/config-settings.ts +76 -0
  5. package/node_modules/@mrclrchtr/supi-core/src/config.ts +186 -0
  6. package/node_modules/@mrclrchtr/supi-core/src/context-messages.ts +119 -0
  7. package/node_modules/@mrclrchtr/supi-core/src/context-provider-registry.ts +36 -0
  8. package/node_modules/@mrclrchtr/supi-core/src/context-tag.ts +31 -0
  9. package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +255 -0
  10. package/node_modules/@mrclrchtr/supi-core/src/index.ts +83 -0
  11. package/node_modules/@mrclrchtr/supi-core/src/project-roots.ts +170 -0
  12. package/node_modules/@mrclrchtr/supi-core/src/registry-utils.ts +54 -0
  13. package/node_modules/@mrclrchtr/supi-core/src/session-utils.ts +29 -0
  14. package/node_modules/@mrclrchtr/supi-core/src/settings-command.ts +15 -0
  15. package/node_modules/@mrclrchtr/supi-core/src/settings-registry.ts +41 -0
  16. package/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +226 -0
  17. package/node_modules/@mrclrchtr/supi-core/src/terminal.ts +60 -0
  18. package/node_modules/@mrclrchtr/supi-lsp/README.md +112 -0
  19. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/README.md +90 -0
  20. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +30 -0
  21. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config-settings.ts +76 -0
  22. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config.ts +186 -0
  23. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/context-messages.ts +119 -0
  24. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/context-provider-registry.ts +36 -0
  25. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/context-tag.ts +31 -0
  26. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +255 -0
  27. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/index.ts +83 -0
  28. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/project-roots.ts +170 -0
  29. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/registry-utils.ts +54 -0
  30. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session-utils.ts +29 -0
  31. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings-command.ts +15 -0
  32. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings-registry.ts +41 -0
  33. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +226 -0
  34. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/terminal.ts +60 -0
  35. package/node_modules/@mrclrchtr/supi-lsp/package.json +45 -0
  36. package/node_modules/@mrclrchtr/supi-lsp/src/capabilities.ts +62 -0
  37. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-refresh.ts +229 -0
  38. package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +545 -0
  39. package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +192 -0
  40. package/node_modules/@mrclrchtr/supi-lsp/src/config.ts +143 -0
  41. package/node_modules/@mrclrchtr/supi-lsp/src/defaults.json +82 -0
  42. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/diagnostic-augmentation.ts +82 -0
  43. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/diagnostic-display.ts +68 -0
  44. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/diagnostic-summary.ts +73 -0
  45. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/diagnostics.ts +98 -0
  46. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/stale-diagnostics.ts +47 -0
  47. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/suppression-diagnostics.ts +58 -0
  48. package/node_modules/@mrclrchtr/supi-lsp/src/format.ts +359 -0
  49. package/node_modules/@mrclrchtr/supi-lsp/src/guidance.ts +163 -0
  50. package/node_modules/@mrclrchtr/supi-lsp/src/index.ts +17 -0
  51. package/node_modules/@mrclrchtr/supi-lsp/src/lsp-state.ts +82 -0
  52. package/node_modules/@mrclrchtr/supi-lsp/src/lsp.ts +470 -0
  53. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-client-state.ts +34 -0
  54. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-diagnostics.ts +139 -0
  55. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-helpers.ts +39 -0
  56. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +46 -0
  57. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-types.ts +39 -0
  58. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-recovery.ts +83 -0
  59. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +18 -0
  60. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +550 -0
  61. package/node_modules/@mrclrchtr/supi-lsp/src/overrides.ts +173 -0
  62. package/node_modules/@mrclrchtr/supi-lsp/src/pattern-matcher.ts +197 -0
  63. package/node_modules/@mrclrchtr/supi-lsp/src/renderer.ts +120 -0
  64. package/node_modules/@mrclrchtr/supi-lsp/src/scanner.ts +153 -0
  65. package/node_modules/@mrclrchtr/supi-lsp/src/search-fallback.ts +98 -0
  66. package/node_modules/@mrclrchtr/supi-lsp/src/service-registry.ts +153 -0
  67. package/node_modules/@mrclrchtr/supi-lsp/src/settings-registration.ts +292 -0
  68. package/node_modules/@mrclrchtr/supi-lsp/src/summary.ts +153 -0
  69. package/node_modules/@mrclrchtr/supi-lsp/src/tool-actions.ts +430 -0
  70. package/node_modules/@mrclrchtr/supi-lsp/src/tree-persist.ts +48 -0
  71. package/node_modules/@mrclrchtr/supi-lsp/src/tsconfig-scope.ts +156 -0
  72. package/node_modules/@mrclrchtr/supi-lsp/src/types.ts +409 -0
  73. package/node_modules/@mrclrchtr/supi-lsp/src/ui.ts +358 -0
  74. package/node_modules/@mrclrchtr/supi-lsp/src/utils.ts +122 -0
  75. package/node_modules/@mrclrchtr/supi-lsp/src/workspace-sentinels.ts +114 -0
  76. package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +97 -0
  77. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +67 -0
  78. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/.gitkeep +0 -0
  79. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/bash/tree-sitter-bash.wasm +0 -0
  80. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/bash/tree-sitter-bash.wasm.json +7 -0
  81. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/c/tree-sitter-c.wasm +0 -0
  82. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/c/tree-sitter-c.wasm.json +7 -0
  83. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/cpp/tree-sitter-cpp.wasm +0 -0
  84. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/cpp/tree-sitter-cpp.wasm.json +7 -0
  85. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/go/tree-sitter-go.wasm +0 -0
  86. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/go/tree-sitter-go.wasm.json +7 -0
  87. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/html/tree-sitter-html.wasm +0 -0
  88. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/html/tree-sitter-html.wasm.json +7 -0
  89. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/java/tree-sitter-java.wasm +0 -0
  90. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/java/tree-sitter-java.wasm.json +7 -0
  91. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/javascript/tree-sitter-javascript.wasm +0 -0
  92. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/javascript/tree-sitter-javascript.wasm.json +7 -0
  93. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm +0 -0
  94. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm.json +12 -0
  95. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/python/tree-sitter-python.wasm +0 -0
  96. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/python/tree-sitter-python.wasm.json +7 -0
  97. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/r/tree-sitter-r.wasm +0 -0
  98. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/r/tree-sitter-r.wasm.json +7 -0
  99. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/ruby/tree-sitter-ruby.wasm +0 -0
  100. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/ruby/tree-sitter-ruby.wasm.json +7 -0
  101. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/rust/tree-sitter-rust.wasm +0 -0
  102. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/rust/tree-sitter-rust.wasm.json +7 -0
  103. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm +0 -0
  104. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json +19 -0
  105. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm +0 -0
  106. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm.json +7 -0
  107. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm +0 -0
  108. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm.json +7 -0
  109. package/node_modules/@mrclrchtr/supi-tree-sitter/scripts/generate-kotlin-wasm.mjs +126 -0
  110. package/node_modules/@mrclrchtr/supi-tree-sitter/scripts/generate-sql-wasm.mjs +144 -0
  111. package/node_modules/@mrclrchtr/supi-tree-sitter/scripts/vendor-wasm.mjs +151 -0
  112. package/node_modules/@mrclrchtr/supi-tree-sitter/src/callees.ts +343 -0
  113. package/node_modules/@mrclrchtr/supi-tree-sitter/src/coordinates.ts +108 -0
  114. package/node_modules/@mrclrchtr/supi-tree-sitter/src/exports.ts +315 -0
  115. package/node_modules/@mrclrchtr/supi-tree-sitter/src/formatting.ts +104 -0
  116. package/node_modules/@mrclrchtr/supi-tree-sitter/src/imports.ts +42 -0
  117. package/node_modules/@mrclrchtr/supi-tree-sitter/src/index.ts +16 -0
  118. package/node_modules/@mrclrchtr/supi-tree-sitter/src/language.ts +116 -0
  119. package/node_modules/@mrclrchtr/supi-tree-sitter/src/node-at.ts +96 -0
  120. package/node_modules/@mrclrchtr/supi-tree-sitter/src/outline.ts +287 -0
  121. package/node_modules/@mrclrchtr/supi-tree-sitter/src/runtime.ts +237 -0
  122. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session.ts +112 -0
  123. package/node_modules/@mrclrchtr/supi-tree-sitter/src/structure.ts +7 -0
  124. package/node_modules/@mrclrchtr/supi-tree-sitter/src/syntax-node.ts +13 -0
  125. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tree-sitter.ts +306 -0
  126. package/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +146 -0
  127. package/package.json +47 -0
  128. package/src/actions/affected-action.ts +310 -0
  129. package/src/actions/brief-action.ts +242 -0
  130. package/src/actions/callees-action.ts +134 -0
  131. package/src/actions/callers-action.ts +215 -0
  132. package/src/actions/implementations-action.ts +190 -0
  133. package/src/actions/index-action.ts +187 -0
  134. package/src/actions/pattern-action.ts +232 -0
  135. package/src/architecture.ts +367 -0
  136. package/src/brief-focused.ts +383 -0
  137. package/src/brief.ts +228 -0
  138. package/src/code-intelligence.ts +122 -0
  139. package/src/git-context.ts +65 -0
  140. package/src/guidance.ts +39 -0
  141. package/src/index.ts +28 -0
  142. package/src/resolve-target.ts +104 -0
  143. package/src/search-helpers.ts +283 -0
  144. package/src/target-resolution.ts +368 -0
  145. package/src/tool-actions.ts +109 -0
  146. package/src/types.ts +57 -0
@@ -0,0 +1,46 @@
1
+ import type { LspClient } from "../client/client.ts";
2
+ import { displayRelativeFilePath } from "../summary.ts";
3
+ import type { ProjectServerInfo } from "../types.ts";
4
+
5
+ interface ProjectServerInfoInput {
6
+ serverName: string;
7
+ root: string;
8
+ fileTypes: string[];
9
+ client: LspClient | undefined;
10
+ unavailable: boolean;
11
+ }
12
+
13
+ export function buildProjectServerInfo(
14
+ input: ProjectServerInfoInput,
15
+ cwd: string,
16
+ ): ProjectServerInfo {
17
+ const status = input.unavailable
18
+ ? "unavailable"
19
+ : input.client?.status === "running"
20
+ ? "running"
21
+ : input.client?.status === "error"
22
+ ? "error"
23
+ : "unavailable";
24
+
25
+ return {
26
+ name: input.serverName,
27
+ root: input.root,
28
+ fileTypes: input.fileTypes,
29
+ status,
30
+ supportedActions: getSupportedActions(input.client?.serverCapabilities),
31
+ openFiles: input.client?.openFiles.map((file) => displayRelativeFilePath(file, cwd)) ?? [],
32
+ };
33
+ }
34
+
35
+ function getSupportedActions(capabilities: LspClient["serverCapabilities"] | undefined): string[] {
36
+ if (!capabilities) return [];
37
+
38
+ const actions: string[] = ["diagnostics [optional file]"];
39
+ if (capabilities.hoverProvider) actions.push("hover(file,line,char)");
40
+ if (capabilities.definitionProvider) actions.push("definition(file,line,char)");
41
+ if (capabilities.referencesProvider) actions.push("references(file,line,char)");
42
+ if (capabilities.documentSymbolProvider) actions.push("symbols(file)");
43
+ if (capabilities.renameProvider) actions.push("rename(file,line,char,newName)");
44
+ if (capabilities.codeActionProvider) actions.push("code_actions(file,line,char)");
45
+ return actions;
46
+ }
@@ -0,0 +1,39 @@
1
+ // LSP manager types — shared summaries and status shapes used by UI/guidance.
2
+
3
+ export interface ServerStatus {
4
+ name: string;
5
+ status: "running" | "error" | "unavailable";
6
+ root: string;
7
+ openFiles: string[];
8
+ }
9
+
10
+ export interface DiagnosticSummary {
11
+ file: string;
12
+ errors: number;
13
+ warnings: number;
14
+ }
15
+
16
+ export interface CoverageSummaryEntry {
17
+ name: string;
18
+ fileTypes: string[];
19
+ active: boolean;
20
+ openFiles: number;
21
+ }
22
+
23
+ export interface ActiveCoverageSummaryEntry {
24
+ name: string;
25
+ openFiles: string[];
26
+ }
27
+
28
+ export interface OutstandingDiagnosticSummaryEntry {
29
+ file: string;
30
+ total: number;
31
+ errors: number;
32
+ warnings: number;
33
+ information: number;
34
+ hints: number;
35
+ }
36
+
37
+ export interface ManagerStatus {
38
+ servers: ServerStatus[];
39
+ }
@@ -0,0 +1,83 @@
1
+ import {
2
+ assessStaleDiagnostics,
3
+ type StaleDiagnosticAssessment,
4
+ } from "../diagnostics/stale-diagnostics.ts";
5
+ import type { Diagnostic, FileEvent } from "../types.ts";
6
+
7
+ export interface WorkspaceRecoveryResult {
8
+ refreshedClients: number;
9
+ restartedClients: number;
10
+ staleAssessment: StaleDiagnosticAssessment;
11
+ }
12
+
13
+ export interface WorkspaceRecoveryHost {
14
+ clearAllPullResultIds(): void;
15
+ notifyWorkspaceFileChanges(changes: FileEvent[]): void;
16
+ refreshOpenDiagnostics(options?: { maxWaitMs?: number; quietMs?: number }): Promise<void>;
17
+ getOutstandingDiagnostics(
18
+ maxSeverity?: number,
19
+ ): Array<{ file: string; diagnostics: Diagnostic[] }>;
20
+ getStatus(): { servers: Array<{ status: "running" | "error" | "unavailable" }> };
21
+ restartClientsForFiles(filePaths: string[]): Promise<string[]>;
22
+ }
23
+
24
+ /** Clear cached pull IDs and forward watched-file changes to active clients. */
25
+ export function softRecoverWorkspaceDiagnostics(
26
+ host: WorkspaceRecoveryHost,
27
+ changes: FileEvent[] = [],
28
+ ): number {
29
+ host.clearAllPullResultIds();
30
+ if (changes.length > 0) host.notifyWorkspaceFileChanges(changes);
31
+ return countRunningClients(host);
32
+ }
33
+
34
+ /** Run a recovery pass, refreshing diagnostics and escalating if stale state remains. */
35
+ export async function recoverWorkspaceDiagnostics(
36
+ host: WorkspaceRecoveryHost,
37
+ options: {
38
+ changes?: FileEvent[];
39
+ restartIfStillStale?: boolean;
40
+ maxWaitMs?: number;
41
+ quietMs?: number;
42
+ } = {},
43
+ ): Promise<WorkspaceRecoveryResult> {
44
+ const refreshedClients = softRecoverWorkspaceDiagnostics(host, options.changes ?? []);
45
+
46
+ try {
47
+ await host.refreshOpenDiagnostics({ maxWaitMs: options.maxWaitMs, quietMs: options.quietMs });
48
+ } catch {
49
+ // Recovery should be best-effort.
50
+ }
51
+
52
+ let staleAssessment = assessStaleDiagnostics(host.getOutstandingDiagnostics(1));
53
+ let restartedClients = 0;
54
+
55
+ if (options.restartIfStillStale && staleAssessment.suspected) {
56
+ const restarted = await host.restartClientsForFiles(
57
+ staleAssessment.matchedFiles.map((entry) => entry.file),
58
+ );
59
+ restartedClients = restarted.length;
60
+
61
+ if (restartedClients > 0) {
62
+ try {
63
+ await host.refreshOpenDiagnostics({
64
+ maxWaitMs: options.maxWaitMs,
65
+ quietMs: options.quietMs,
66
+ });
67
+ } catch {
68
+ // Keep the previous assessment if the follow-up refresh fails.
69
+ }
70
+ staleAssessment = assessStaleDiagnostics(host.getOutstandingDiagnostics(1));
71
+ }
72
+ }
73
+
74
+ return {
75
+ refreshedClients,
76
+ restartedClients,
77
+ staleAssessment,
78
+ };
79
+ }
80
+
81
+ function countRunningClients(host: WorkspaceRecoveryHost): number {
82
+ return host.getStatus().servers.filter((server) => server.status === "running").length;
83
+ }
@@ -0,0 +1,18 @@
1
+ import type { LspClient } from "../client/client.ts";
2
+ import type { SymbolInformation, WorkspaceSymbol } from "../types.ts";
3
+
4
+ export async function managerWorkspaceSymbol(
5
+ clients: Iterable<LspClient>,
6
+ query: string,
7
+ ): Promise<(SymbolInformation | WorkspaceSymbol)[] | null> {
8
+ const all: (SymbolInformation | WorkspaceSymbol)[] = [];
9
+ let hasSupport = false;
10
+ for (const client of clients) {
11
+ if (client.status !== "running") continue;
12
+ if (!client.serverCapabilities?.workspaceSymbolProvider) continue;
13
+ hasSupport = true;
14
+ const result = await client.workspaceSymbol(query);
15
+ if (result) all.push(...result);
16
+ }
17
+ return hasSupport ? all : null;
18
+ }