knodin 0.7.4 → 0.7.6

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 (104) hide show
  1. package/README.md +4 -1
  2. package/dist/bin/cli.js +108 -1859
  3. package/dist/bin/launcher.js +3 -10
  4. package/dist/chunks/chunk-DMQAGX77.js +654 -0
  5. package/dist/chunks/chunk-F4Z3Z766.js +4 -0
  6. package/dist/chunks/chunk-SIJAQVSX.js +3 -0
  7. package/dist/chunks/chunk-X6M4HUUE.js +2 -0
  8. package/dist/chunks/chunk-YPRMY2LP.js +8 -0
  9. package/dist/chunks/pure-compression-cli-4TA2TQD5.js +5 -0
  10. package/dist/chunks/server-7EDF4CBY.js +14 -0
  11. package/dist/chunks/structural-fast-path-KD5KQSPX.js +4 -0
  12. package/dist/src/init-progress-worker.js +2 -106
  13. package/dist/src/repair-progress-worker.js +2 -120
  14. package/docs/INSTALLATION.md +17 -1
  15. package/docs/releases/0.7.6.md +25 -0
  16. package/package.json +1 -110
  17. package/dist/src/agent-integration.js +0 -238
  18. package/dist/src/artifact-refresh.js +0 -81
  19. package/dist/src/cli-args.js +0 -274
  20. package/dist/src/cli-model.js +0 -358
  21. package/dist/src/codeflow-replay.js +0 -80
  22. package/dist/src/compact-structural.js +0 -96
  23. package/dist/src/competitive-cold-mcp.js +0 -40
  24. package/dist/src/competitive-constraints.js +0 -20
  25. package/dist/src/competitive-manifest.js +0 -411
  26. package/dist/src/competitive-measurement.js +0 -183
  27. package/dist/src/competitive-runner.js +0 -487
  28. package/dist/src/competitive-sandbox.js +0 -108
  29. package/dist/src/context-export.js +0 -422
  30. package/dist/src/context.js +0 -102
  31. package/dist/src/diagnostics.js +0 -449
  32. package/dist/src/docs-sections.js +0 -141
  33. package/dist/src/doctor.js +0 -380
  34. package/dist/src/engine/ann-hnsw.js +0 -271
  35. package/dist/src/engine/embeddings.js +0 -193
  36. package/dist/src/engine/file-walker.js +0 -43
  37. package/dist/src/engine/git-history.js +0 -289
  38. package/dist/src/engine/index.js +0 -13377
  39. package/dist/src/engine/perf.js +0 -115
  40. package/dist/src/engine/prune.js +0 -112
  41. package/dist/src/engine/scip-import.js +0 -408
  42. package/dist/src/engine/source-policy.js +0 -69
  43. package/dist/src/engine/sqlite.js +0 -71
  44. package/dist/src/engine/symbol-delete.js +0 -58
  45. package/dist/src/execution-profile.js +0 -203
  46. package/dist/src/failure-diagnosis.js +0 -649
  47. package/dist/src/fleet.js +0 -7
  48. package/dist/src/git-executable.js +0 -31
  49. package/dist/src/graph-query-health.js +0 -115
  50. package/dist/src/hook-manager-integration.js +0 -156
  51. package/dist/src/index-activity.js +0 -125
  52. package/dist/src/init-progress.js +0 -155
  53. package/dist/src/init.js +0 -1254
  54. package/dist/src/lifecycle-health.js +0 -250
  55. package/dist/src/lsp-readonly.js +0 -217
  56. package/dist/src/output-compression.js +0 -629
  57. package/dist/src/output-telemetry.js +0 -363
  58. package/dist/src/pr-triage.js +0 -638
  59. package/dist/src/progressive-evidence.js +0 -473
  60. package/dist/src/pure-compression-cli.js +0 -101
  61. package/dist/src/relationship-adapters.js +0 -370
  62. package/dist/src/release-attestation.js +0 -533
  63. package/dist/src/release-preflight.js +0 -510
  64. package/dist/src/repair-progress.js +0 -262
  65. package/dist/src/repository-init-process.js +0 -173
  66. package/dist/src/repository-management.js +0 -1231
  67. package/dist/src/response-budget.js +0 -194
  68. package/dist/src/server.js +0 -73
  69. package/dist/src/structural-fast-path.js +0 -338
  70. package/dist/src/structural-snapshot.js +0 -33
  71. package/dist/src/system-config.js +0 -615
  72. package/dist/src/terminal-help.js +0 -83
  73. package/dist/src/tools/knodin-tools.js +0 -1529
  74. package/dist/src/update-ceremony.js +0 -158
  75. package/dist/src/update-policy.js +0 -944
  76. package/dist/src/update-trust.js +0 -503
  77. package/dist/src/version.js +0 -13
  78. package/dist/src/visualization.js +0 -162
  79. package/dist/src/wait-for-fresh.js +0 -98
  80. package/dist/src/worktree-lifecycle.js +0 -231
  81. package/docs/CONTAINED-EXECUTION.md +0 -77
  82. package/docs/DIAGNOSTICS.md +0 -45
  83. package/docs/GIT-HISTORY-REVIEW.md +0 -39
  84. package/docs/PROGRESSIVE-EVIDENCE.md +0 -37
  85. package/docs/PT-ACCESS-RECOMMENDATION.md +0 -91
  86. package/docs/RELEASE-0.3-EVIDENCE.md +0 -73
  87. package/docs/SCIP-IMPORT.md +0 -57
  88. package/docs/SIGNED-UPDATES.md +0 -151
  89. package/docs/TELEMETRY.md +0 -46
  90. package/docs/assets/knodin-favicon.svg +0 -4
  91. package/docs/releases/0.3.0.md +0 -46
  92. package/docs/releases/0.4.0.md +0 -68
  93. package/docs/releases/0.4.1.md +0 -28
  94. package/docs/releases/0.4.2.md +0 -27
  95. package/docs/releases/0.4.3.md +0 -23
  96. package/docs/releases/0.5.0.md +0 -29
  97. package/docs/releases/0.5.1.md +0 -17
  98. package/docs/releases/0.6.0.md +0 -18
  99. package/docs/releases/0.7.0.md +0 -24
  100. package/docs/releases/0.7.1.md +0 -21
  101. package/docs/releases/0.7.2.md +0 -21
  102. package/docs/releases/0.7.3.md +0 -23
  103. package/docs/releases/0.7.4.md +0 -17
  104. package/schemas/release-attestation-v1.schema.json +0 -210
@@ -1,250 +0,0 @@
1
- import childProcess from "node:child_process";
2
- import fs from "node:fs";
3
- import path from "node:path";
4
- import { inspectLefthookIntegration, isActiveLefthookHook } from "./hook-manager-integration.js";
5
- const MANAGED_MARKER = "KNODIN MANAGED HOOK";
6
- const HOOK_NAMES = ["post-commit", "post-checkout", "post-merge", "post-rewrite"];
7
- const HOOK_FAILURE_FILE = "last-refresh-failure";
8
- function readEvent(target) {
9
- try {
10
- const [kind = "", legacyBefore = "", legacyAfter = "", ...rest] = fs
11
- .readFileSync(target, "utf-8")
12
- .split(/\r?\n/);
13
- if (!kind)
14
- return null;
15
- const metadata = new Map([legacyBefore, legacyAfter, ...rest]
16
- .map((line) => {
17
- const separator = line.indexOf("=");
18
- return separator < 0 ? null : [line.slice(0, separator), line.slice(separator + 1)];
19
- })
20
- .filter((entry) => entry !== null));
21
- return {
22
- sequence: metadata.get("sequence") || null,
23
- kind,
24
- before: metadata.get("before") ||
25
- (kind === "commit" || kind === "checkout" || kind === "merge" ? legacyBefore : "") ||
26
- null,
27
- after: metadata.get("after") ||
28
- (kind === "commit" || kind === "checkout" || kind === "merge" ? legacyAfter : "") ||
29
- null,
30
- worktree: metadata.get("worktree") || null,
31
- at: metadata.get("at") || fs.statSync(target).mtime.toISOString(),
32
- };
33
- }
34
- catch {
35
- return null;
36
- }
37
- }
38
- function readLastEvent(repo) {
39
- return readEvent(path.join(repo, ".knodin", "hooks", "last-refresh-event"));
40
- }
41
- function readPendingEvent(repo) {
42
- try {
43
- const directory = path.join(repo, ".knodin", "hooks", "events");
44
- const next = fs
45
- .readdirSync(directory)
46
- .filter((entry) => entry.endsWith(".event"))
47
- .sort((left, right) => left.localeCompare(right))[0];
48
- return next ? readEvent(path.join(directory, next)) : null;
49
- }
50
- catch {
51
- return null;
52
- }
53
- }
54
- function processorState(repo) {
55
- const pidPath = path.join(repo, ".knodin", "hooks", "refresh.lock", "pid");
56
- if (!fs.existsSync(path.dirname(pidPath)))
57
- return { state: "idle", pid: null };
58
- let pid = null;
59
- try {
60
- const candidate = Number(fs.readFileSync(pidPath, "utf-8"));
61
- if (Number.isInteger(candidate) && candidate > 0)
62
- pid = candidate;
63
- }
64
- catch {
65
- return { state: "stale-lock", pid: null };
66
- }
67
- if (pid === null)
68
- return { state: "stale-lock", pid: null };
69
- try {
70
- process.kill(pid, 0);
71
- return { state: "running", pid };
72
- }
73
- catch (error) {
74
- if (error.code === "EPERM")
75
- return { state: "running", pid };
76
- return { state: "stale-lock", pid };
77
- }
78
- }
79
- function queuedEventCount(repo) {
80
- try {
81
- return fs
82
- .readdirSync(path.join(repo, ".knodin", "hooks", "events"))
83
- .filter((entry) => entry.endsWith(".event")).length;
84
- }
85
- catch {
86
- return 0;
87
- }
88
- }
89
- function activeHooksDirectory(repo) {
90
- const output = childProcess.execFileSync("git", ["rev-parse", "--path-format=absolute", "--git-path", "hooks"], { cwd: repo, encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] });
91
- return output.trim();
92
- }
93
- function inspectManagedHooks(repo, hooksDirectory) {
94
- const activeHooks = [];
95
- const missingHooks = [];
96
- let wrappers = 0;
97
- let managerNative = 0;
98
- const lefthook = inspectLefthookIntegration(repo);
99
- for (const hookName of HOOK_NAMES) {
100
- try {
101
- const hookPath = path.join(hooksDirectory, hookName);
102
- const content = fs.readFileSync(hookPath, "utf-8");
103
- const mode = fs.statSync(hookPath).mode;
104
- const wrapper = content.startsWith(`#!/bin/sh\n# ${MANAGED_MARKER}: ${hookName}\n`);
105
- const native = lefthook.configured && isActiveLefthookHook(content);
106
- const active = (mode & 0o111) !== 0 && (wrapper || native);
107
- if (active && wrapper)
108
- wrappers++;
109
- else if (active && native)
110
- managerNative++;
111
- (active ? activeHooks : missingHooks).push(hookName);
112
- }
113
- catch {
114
- missingHooks.push(hookName);
115
- }
116
- }
117
- return {
118
- activeHooks,
119
- missingHooks,
120
- hookManager: lefthook.configured ? "lefthook" : null,
121
- routing: wrappers > 0 && managerNative > 0
122
- ? "mixed"
123
- : wrappers > 0
124
- ? "managed-wrapper"
125
- : managerNative > 0
126
- ? "manager-native"
127
- : "unavailable",
128
- };
129
- }
130
- function readRefreshFailure(repo) {
131
- const failurePath = path.join(repo, ".knodin", "hooks", HOOK_FAILURE_FILE);
132
- if (!fs.existsSync(failurePath))
133
- return null;
134
- try {
135
- return (fs.readFileSync(failurePath, "utf-8").split(/\r?\n/, 1)[0]?.trim() ||
136
- "last background refresh failed");
137
- }
138
- catch {
139
- return "last background refresh failed";
140
- }
141
- }
142
- /** Read-only proof that committed Git activity can still reach knodin's indexer. */
143
- export function inspectLifecycleHealth(repoPath) {
144
- const repo = path.resolve(repoPath);
145
- if (!fs.existsSync(path.join(repo, ".knodin", "db.sqlite"))) {
146
- return {
147
- status: "unconfigured",
148
- refreshCapable: false,
149
- hooksDirectory: null,
150
- activeHooks: [],
151
- missingHooks: [...HOOK_NAMES],
152
- issues: ["local graph database is not initialized"],
153
- queuedEvents: 0,
154
- processor: { state: "idle", pid: null },
155
- pendingEvent: null,
156
- lastEvent: null,
157
- lastError: null,
158
- hookManager: null,
159
- routing: "unavailable",
160
- };
161
- }
162
- let hooksDirectory;
163
- try {
164
- hooksDirectory = activeHooksDirectory(repo);
165
- }
166
- catch {
167
- return {
168
- status: "degraded",
169
- refreshCapable: false,
170
- hooksDirectory: null,
171
- activeHooks: [],
172
- missingHooks: [...HOOK_NAMES],
173
- issues: ["active Git hooks directory could not be resolved"],
174
- queuedEvents: queuedEventCount(repo),
175
- processor: processorState(repo),
176
- pendingEvent: readPendingEvent(repo),
177
- lastEvent: readLastEvent(repo),
178
- lastError: null,
179
- hookManager: null,
180
- routing: "unavailable",
181
- };
182
- }
183
- const { activeHooks, missingHooks, hookManager, routing } = inspectManagedHooks(repo, hooksDirectory);
184
- const background = path.join(repo, ".knodin", "hooks", "background-index.sh");
185
- const backgroundReady = fs.existsSync(background) && (fs.statSync(background).mode & 0o111) !== 0;
186
- const issues = missingHooks.map((hook) => `${hook} no longer routes through knodin's active Git hook path`);
187
- if (!backgroundReady)
188
- issues.push("background indexer is missing or not executable");
189
- const lastError = readRefreshFailure(repo);
190
- if (lastError)
191
- issues.push(`${lastError} See .knodin/indexer.log for details`);
192
- const refreshCapable = missingHooks.length === 0 && backgroundReady && issues.length === 0;
193
- return {
194
- status: refreshCapable ? "healthy" : "degraded",
195
- refreshCapable,
196
- hooksDirectory,
197
- activeHooks,
198
- missingHooks,
199
- issues,
200
- queuedEvents: queuedEventCount(repo),
201
- processor: processorState(repo),
202
- pendingEvent: readPendingEvent(repo),
203
- lastEvent: readLastEvent(repo),
204
- lastError,
205
- hookManager,
206
- routing,
207
- };
208
- }
209
- /** Merge graph and refresh-path health without reporting absent evidence as healthy. */
210
- export function attachLifecycleHealth(repo, graph) {
211
- const lifecycle = inspectLifecycleHealth(repo);
212
- if (lifecycle.queuedEvents > 0 &&
213
- graph.status !== "repair-needed" &&
214
- graph.status !== "indexing" &&
215
- graph.freshness) {
216
- return {
217
- ...graph,
218
- status: "stale",
219
- freshness: { ...graph.freshness, state: "queued" },
220
- lifecycle,
221
- };
222
- }
223
- if (graph.status !== "healthy" || lifecycle.status !== "degraded")
224
- return { ...graph, lifecycle };
225
- return {
226
- ...graph,
227
- status: "repair-needed",
228
- missing: {
229
- files: [...graph.missing.files],
230
- records: [...graph.missing.records, ...lifecycle.issues],
231
- },
232
- repairSteps: [
233
- ...graph.repairSteps,
234
- "Run `knodin init` to restore managed lifecycle hooks.",
235
- "Run `knodin status` again to verify graph and refresh-path health.",
236
- ],
237
- lifecycle,
238
- };
239
- }
240
- /** Keep graph-repair success distinct from lifecycle integration health. */
241
- export function attachRepairLifecycle(repo, result) {
242
- const lifecycle = inspectLifecycleHealth(repo);
243
- return {
244
- ...result,
245
- lifecycle,
246
- nextSteps: lifecycle.status === "degraded"
247
- ? ["Run `knodin init` to restore lifecycle routing, then `knodin status`."]
248
- : [],
249
- };
250
- }
@@ -1,217 +0,0 @@
1
- /**
2
- * Read-only local language-service adapters.
3
- *
4
- * This deliberately embeds no daemon and never invokes workspace commands. The
5
- * first adapter is TypeScript's compiler language service, which implements the
6
- * same source-position operations exposed by an LSP server. Other languages are
7
- * explicitly unavailable until a similarly local, read-only adapter is added.
8
- */
9
- import fs from "node:fs";
10
- import path from "node:path";
11
- const TYPESCRIPT_EXTENSIONS = new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".cts"]);
12
- function unavailable(pattern, target, reason) {
13
- return {
14
- pattern,
15
- target,
16
- count: 0,
17
- results: [],
18
- adapter: "none",
19
- available: false,
20
- readOnly: true,
21
- reason,
22
- };
23
- }
24
- function parseTarget(repoPath, target) {
25
- const match = target.match(/^(.*?)(?::(\d+):(\d+))?$/);
26
- if (!match?.[1])
27
- return undefined;
28
- const file = match[1].replaceAll("\\", "/");
29
- const absoluteFile = path.resolve(repoPath, file);
30
- const relative = path.relative(repoPath, absoluteFile);
31
- if (relative.startsWith("..") || path.isAbsolute(relative))
32
- return undefined;
33
- if ((match[2] === undefined) !== (match[3] === undefined))
34
- return undefined;
35
- return {
36
- file: relative.replaceAll(path.sep, "/"),
37
- absoluteFile,
38
- ...(match[2] ? { line: Number(match[2]), column: Number(match[3]) } : {}),
39
- };
40
- }
41
- function filesForService(repoPath, ts) {
42
- const isInsideRepo = (file) => {
43
- try {
44
- const relativePath = path.relative(repoPath, fs.realpathSync(file));
45
- return !relativePath.startsWith("..") && !path.isAbsolute(relativePath);
46
- }
47
- catch {
48
- return false;
49
- }
50
- };
51
- const config = ts.findConfigFile(repoPath, ts.sys.fileExists, "tsconfig.json");
52
- if (config) {
53
- const loaded = ts.readConfigFile(config, ts.sys.readFile);
54
- if (!loaded.error) {
55
- const parsed = ts.parseJsonConfigFileContent(loaded.config, ts.sys, path.dirname(config));
56
- return parsed.fileNames.filter((file) => TYPESCRIPT_EXTENSIONS.has(path.extname(file)) && isInsideRepo(file));
57
- }
58
- }
59
- const files = [];
60
- const visit = (directory) => {
61
- for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
62
- if (entry.name === "node_modules" || entry.name === ".git" || entry.name === ".knodin")
63
- continue;
64
- const candidate = path.join(directory, entry.name);
65
- if (entry.isDirectory())
66
- visit(candidate);
67
- else if (entry.isFile() && TYPESCRIPT_EXTENSIONS.has(path.extname(entry.name)))
68
- files.push(candidate);
69
- }
70
- };
71
- visit(repoPath);
72
- return files;
73
- }
74
- function createService(repoPath, files, ts) {
75
- const versions = new Map(files.map((file) => [file, "0"]));
76
- const options = {
77
- target: ts.ScriptTarget.ES2022,
78
- module: ts.ModuleKind.NodeNext,
79
- moduleResolution: ts.ModuleResolutionKind.NodeNext,
80
- strict: true,
81
- skipLibCheck: true,
82
- };
83
- return ts.createLanguageService({
84
- getCompilationSettings: () => options,
85
- getScriptFileNames: () => files,
86
- getScriptVersion: (file) => versions.get(file) ?? "0",
87
- getScriptSnapshot: (file) => {
88
- try {
89
- return ts.ScriptSnapshot.fromString(fs.readFileSync(file, "utf-8"));
90
- }
91
- catch {
92
- return undefined;
93
- }
94
- },
95
- getCurrentDirectory: () => repoPath,
96
- getDefaultLibFileName: (settings) => ts.getDefaultLibFilePath(settings),
97
- fileExists: ts.sys.fileExists,
98
- readFile: ts.sys.readFile,
99
- readDirectory: ts.sys.readDirectory,
100
- directoryExists: ts.sys.directoryExists,
101
- getDirectories: ts.sys.getDirectories,
102
- });
103
- }
104
- function relative(repoPath, file) {
105
- return path.relative(repoPath, file).replaceAll(path.sep, "/");
106
- }
107
- function positionFor(source, line, column) {
108
- if (!Number.isInteger(line) || !Number.isInteger(column) || line < 1 || column < 1)
109
- return undefined;
110
- const lines = source.split("\n");
111
- if (line > lines.length || column > lines[line - 1].length + 1)
112
- return undefined;
113
- return (lines.slice(0, line - 1).reduce((offset, current) => offset + current.length + 1, 0) +
114
- column -
115
- 1);
116
- }
117
- function diagnosticRow(repoPath, diagnostic, ts) {
118
- const file = diagnostic.file;
119
- const location = file && diagnostic.start !== undefined
120
- ? file.getLineAndCharacterOfPosition(diagnostic.start)
121
- : undefined;
122
- return {
123
- file: file ? relative(repoPath, file.fileName) : undefined,
124
- line: location ? location.line + 1 : undefined,
125
- column: location ? location.character + 1 : undefined,
126
- kind: ts.DiagnosticCategory[diagnostic.category].toLowerCase(),
127
- message: ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"),
128
- code: diagnostic.code,
129
- };
130
- }
131
- function navigationRows(repoPath, entries, ts) {
132
- return (entries ?? []).map((entry) => {
133
- const source = fs.readFileSync(entry.fileName, "utf-8");
134
- const location = ts
135
- .createSourceFile(entry.fileName, source, ts.ScriptTarget.Latest)
136
- .getLineAndCharacterOfPosition(entry.textSpan.start);
137
- return {
138
- file: relative(repoPath, entry.fileName),
139
- line: location.line + 1,
140
- column: location.character + 1,
141
- kind: entry.kind,
142
- symbol: "name" in entry ? entry.name : undefined,
143
- };
144
- });
145
- }
146
- /** Executes a bounded, local compiler-language-service query without writes. */
147
- export async function runReadOnlyLspQuery(pattern, target, repoPath) {
148
- let ts;
149
- try {
150
- ts = await import("typescript");
151
- }
152
- catch {
153
- return unavailable(pattern, target, "No local TypeScript language-service adapter is installed; install TypeScript to enable this read-only query.");
154
- }
155
- let canonicalRepoPath;
156
- try {
157
- canonicalRepoPath = fs.realpathSync(repoPath);
158
- }
159
- catch {
160
- return unavailable(pattern, target, "Repository path must be an accessible directory.");
161
- }
162
- const parsed = parseTarget(repoPath, target);
163
- if (!parsed || !fs.existsSync(parsed.absoluteFile))
164
- return unavailable(pattern, target, "Target must be an existing repo-relative file, optionally with :line:column.");
165
- if (!TYPESCRIPT_EXTENSIONS.has(path.extname(parsed.absoluteFile)))
166
- return unavailable(pattern, target, `No local LSP adapter is installed for ${path.extname(parsed.absoluteFile) || "this file type"}.`);
167
- let realTarget;
168
- try {
169
- realTarget = fs.realpathSync(parsed.absoluteFile);
170
- const relativeTarget = path.relative(canonicalRepoPath, realTarget);
171
- if (relativeTarget.startsWith("..") || path.isAbsolute(relativeTarget))
172
- return unavailable(pattern, target, "Target must resolve inside the repository.");
173
- }
174
- catch {
175
- return unavailable(pattern, target, "Target must be a readable regular file.");
176
- }
177
- if (pattern !== "lsp_diagnostics" && (parsed.line === undefined || parsed.column === undefined))
178
- return unavailable(pattern, target, "Navigation queries require target syntax file:line:column.");
179
- const files = filesForService(canonicalRepoPath, ts);
180
- if (!files.includes(realTarget))
181
- files.push(realTarget);
182
- const service = createService(canonicalRepoPath, files, ts);
183
- try {
184
- let rows;
185
- if (pattern === "lsp_diagnostics") {
186
- rows = [
187
- ...service.getSyntacticDiagnostics(realTarget),
188
- ...service.getSemanticDiagnostics(realTarget),
189
- ].map((diagnostic) => diagnosticRow(canonicalRepoPath, diagnostic, ts));
190
- }
191
- else {
192
- const line = parsed.line;
193
- const column = parsed.column;
194
- if (line === undefined || column === undefined)
195
- return unavailable(pattern, target, "Navigation queries require target syntax file:line:column.");
196
- const position = positionFor(fs.readFileSync(realTarget, "utf-8"), line, column);
197
- if (position === undefined)
198
- return unavailable(pattern, target, "Target line and column must identify a position inside the source file.");
199
- rows = navigationRows(canonicalRepoPath, pattern === "lsp_implementations"
200
- ? service.getImplementationAtPosition(realTarget, position)
201
- : service.getDefinitionAtPosition(realTarget, position), ts);
202
- }
203
- return {
204
- pattern,
205
- target,
206
- count: rows.length,
207
- results: rows.slice(0, 100),
208
- hasMore: rows.length > 100 || undefined,
209
- adapter: "typescript-language-service",
210
- available: true,
211
- readOnly: true,
212
- };
213
- }
214
- finally {
215
- service.dispose();
216
- }
217
- }