tidewave 0.6.0 → 0.7.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.
- package/CHANGELOG.md +6 -0
- package/README.md +23 -5
- package/dist/cli/index.js +231 -39
- package/dist/core.d.ts +15 -6
- package/dist/http/handlers/config.d.ts +3 -2
- package/dist/http/index.d.ts +7 -3
- package/dist/http/security.d.ts +0 -8
- package/dist/next-js/handler.d.ts +1 -0
- package/dist/next-js/handler.js +298 -188
- package/dist/next-js/instrumentation.js +20 -2
- package/dist/resolution/formatters.d.ts +2 -2
- package/dist/resolution/index.d.ts +1 -2
- package/dist/resolution/symbol-finder.d.ts +2 -2
- package/dist/resolution/utils.d.ts +1 -0
- package/dist/tanstack.js +20 -2
- package/dist/vite-plugin.js +287 -195
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.7.0] - 2026-06-14
|
|
4
|
+
|
|
5
|
+
* Support namespaces/files in `get_docs` tool and make it return a list of exports
|
|
6
|
+
* Support re-exports in `get_docs` lookups
|
|
7
|
+
* Improve out-of-the-box experience for remote access (which remains opt-in)
|
|
8
|
+
|
|
3
9
|
## [0.6.0] - 2025-12-31
|
|
4
10
|
|
|
5
11
|
* Tanstack support
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ This project supports:
|
|
|
9
9
|
|
|
10
10
|
- Next.js 15/16
|
|
11
11
|
- TanStack Start with React
|
|
12
|
-
- Vite with React/Vue
|
|
12
|
+
- Vite with React/Vue (which includes Astro, VitePress, etc)
|
|
13
13
|
|
|
14
14
|
If you are using React/Vue with Django, FastAPI, Flask, Phoenix, or Rails,
|
|
15
15
|
[follow the steps here instead](http://hexdocs.pm/tidewave/frontend.html).
|
|
@@ -37,7 +37,7 @@ And you are almost there! Now make sure
|
|
|
37
37
|
[Tidewave is installed](https://hexdocs.pm/tidewave/installation.html) and you
|
|
38
38
|
are ready to connect Tidewave to your app.
|
|
39
39
|
|
|
40
|
-
In case the command
|
|
40
|
+
In case the command above do not work, you can toggle the manual installation
|
|
41
41
|
instructions below
|
|
42
42
|
|
|
43
43
|
<details>
|
|
@@ -258,11 +258,28 @@ features.
|
|
|
258
258
|
Next.js' `tidewaveHandler` and Vite's `tidewave` accept the configuration
|
|
259
259
|
options below:
|
|
260
260
|
|
|
261
|
-
- `allow_remote_access:`
|
|
262
|
-
|
|
263
|
-
|
|
261
|
+
- `allow_remote_access:` Tidewave only allows requests from localhost by
|
|
262
|
+
default, even if your server listens on other interfaces, for security
|
|
263
|
+
purposes. Read
|
|
264
|
+
[our security guidelines for more information and when to allow remote access](https://hexdocs.pm/tidewave/security.html)
|
|
265
|
+
(if you know what you are doing)
|
|
264
266
|
- `team`: enable Tidewave Web for teams
|
|
265
267
|
|
|
268
|
+
## Available tools
|
|
269
|
+
|
|
270
|
+
- `get_docs` - get the documentation for a given module/namespace or a
|
|
271
|
+
class/interface/enum/type in that namespace. It consults the exact versions
|
|
272
|
+
used by the project, ensuring you always get correct information
|
|
273
|
+
|
|
274
|
+
- `get_source_location` - get the source location for a given module/namespace
|
|
275
|
+
or a class/interface/enum/type in that namespace, so an agent can directly
|
|
276
|
+
read the source skipping search
|
|
277
|
+
|
|
278
|
+
- `get_logs` - reads console log written by the server
|
|
279
|
+
|
|
280
|
+
- `project_eval` - evaluates code within the runtime itself, giving the agent
|
|
281
|
+
access to dependencies, server code, and all in-memory data
|
|
282
|
+
|
|
266
283
|
## CLI
|
|
267
284
|
|
|
268
285
|
Tidewave.js also comes with a CLI for developers who want to use it as a
|
|
@@ -302,6 +319,7 @@ Here are some examples:
|
|
|
302
319
|
|
|
303
320
|
```bash
|
|
304
321
|
# Local TypeScript/JavaScript files
|
|
322
|
+
npx tidewave docs ./src/utils
|
|
305
323
|
npx tidewave docs ./src/utils:formatDate
|
|
306
324
|
npx tidewave docs ./components:Button#onClick
|
|
307
325
|
|
package/dist/cli/index.js
CHANGED
|
@@ -5,25 +5,43 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
function __accessProp(key) {
|
|
9
|
+
return this[key];
|
|
10
|
+
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
8
13
|
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
9
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
22
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
23
|
for (let key of __getOwnPropNames(mod))
|
|
12
24
|
if (!__hasOwnProp.call(to, key))
|
|
13
25
|
__defProp(to, key, {
|
|
14
|
-
get: (
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
15
27
|
enumerable: true
|
|
16
28
|
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
17
31
|
return to;
|
|
18
32
|
};
|
|
19
33
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
34
|
+
var __returnValue = (v) => v;
|
|
35
|
+
function __exportSetter(name, newValue) {
|
|
36
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
37
|
+
}
|
|
20
38
|
var __export = (target, all) => {
|
|
21
39
|
for (var name in all)
|
|
22
40
|
__defProp(target, name, {
|
|
23
41
|
get: all[name],
|
|
24
42
|
enumerable: true,
|
|
25
43
|
configurable: true,
|
|
26
|
-
set: (
|
|
44
|
+
set: __exportSetter.bind(all, name)
|
|
27
45
|
});
|
|
28
46
|
};
|
|
29
47
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -5835,9 +5853,10 @@ var init_zod = __esm(() => {
|
|
|
5835
5853
|
});
|
|
5836
5854
|
|
|
5837
5855
|
// src/tools.ts
|
|
5838
|
-
var projectEvalDescription, projectEvalInputSchema, referenceDescription = `Module path in format 'module:symbol[#method|.method]'. Supports local files, dependencies, and Node.js builtins.
|
|
5856
|
+
var projectEvalDescription, projectEvalInputSchema, referenceDescription = `Module/file path, optionally with symbol in format 'module[:symbol[#method|.method]]'. Supports local files, dependencies, and Node.js builtins.
|
|
5839
5857
|
|
|
5840
5858
|
Module reference format:
|
|
5859
|
+
- module - List all symbols in the module (file-level documentation)
|
|
5841
5860
|
- module:symbol - Extract a top-level symbol
|
|
5842
5861
|
- module:Class#method - Extract an instance method
|
|
5843
5862
|
- module:Class.method - Extract a static method
|
|
@@ -5845,6 +5864,8 @@ Module reference format:
|
|
|
5845
5864
|
- node:Class.method - Extract a global/builtin static method
|
|
5846
5865
|
|
|
5847
5866
|
Examples:
|
|
5867
|
+
- src/types.ts (list all symbols in file)
|
|
5868
|
+
- lodash (list all symbols in dependency)
|
|
5848
5869
|
- src/types.ts:SymbolInfo (local file symbol)
|
|
5849
5870
|
- lodash:isEmpty (dependency function)
|
|
5850
5871
|
- react:Component#render (instance method)
|
|
@@ -5852,7 +5873,8 @@ Examples:
|
|
|
5852
5873
|
var init_tools = __esm(() => {
|
|
5853
5874
|
init_zod();
|
|
5854
5875
|
projectEvalDescription = `
|
|
5855
|
-
Evaluates JavaScript/TypeScript code
|
|
5876
|
+
Evaluates JavaScript/TypeScript code within your project's build tool
|
|
5877
|
+
(or server for full-stack applications).
|
|
5856
5878
|
|
|
5857
5879
|
The current NodeJS version is: ${process.version}
|
|
5858
5880
|
|
|
@@ -5861,7 +5883,7 @@ including to test the behaviour of a function or to debug
|
|
|
5861
5883
|
something. The tool also returns anything written to standard
|
|
5862
5884
|
output. DO NOT use shell tools to evaluate JavaScript/TypeScript code.
|
|
5863
5885
|
|
|
5864
|
-
Imports are allowed only as the form of dynamic imports with async/await
|
|
5886
|
+
Imports are allowed only as the form of dynamic imports with async/await:
|
|
5865
5887
|
const path = await import('node:path');
|
|
5866
5888
|
`;
|
|
5867
5889
|
projectEvalInputSchema = exports_external.object({
|
|
@@ -5887,7 +5909,26 @@ Defaults to 30000 (30 seconds).`),
|
|
|
5887
5909
|
docs: {
|
|
5888
5910
|
mcp: {
|
|
5889
5911
|
name: "get_docs",
|
|
5890
|
-
description:
|
|
5912
|
+
description: `Extract TypeScript/JavaScript documentation and type information. Works for modules in the current project, dependencies, and builtin node modules.
|
|
5913
|
+
|
|
5914
|
+
Reference format determines what is returned:
|
|
5915
|
+
|
|
5916
|
+
• "module" - Returns file overview and lists all exported symbols with their kinds, line numbers, and brief documentation. Use this to discover what's available in a module.
|
|
5917
|
+
|
|
5918
|
+
• "module:symbol" - Returns detailed documentation for a specific top-level symbol including its type signature, full documentation, JSDoc tags, and source location.
|
|
5919
|
+
|
|
5920
|
+
• "module:Class.staticMethod" - Returns detailed documentation for a static method or property of a class or object.
|
|
5921
|
+
|
|
5922
|
+
• "module:Class#instanceMethod" - Returns detailed documentation for an instance method or property of a class.
|
|
5923
|
+
|
|
5924
|
+
Examples:
|
|
5925
|
+
- "src/types.ts" → Lists all exported symbols in the file
|
|
5926
|
+
- "lodash" → Lists all symbols exported from lodash
|
|
5927
|
+
- "src/types.ts:SymbolInfo" → Full docs for SymbolInfo interface
|
|
5928
|
+
- "react:Component#render" → Docs for React Component's render method
|
|
5929
|
+
- "node:Math.max" → Docs for Math.max static method
|
|
5930
|
+
|
|
5931
|
+
Start with module-only references to explore, then drill into specific symbols for detailed information.`,
|
|
5891
5932
|
inputSchema: docsInputSchema
|
|
5892
5933
|
},
|
|
5893
5934
|
cli: {
|
|
@@ -5936,7 +5977,7 @@ Defaults to 30000 (30 seconds).`),
|
|
|
5936
5977
|
logs: {
|
|
5937
5978
|
mcp: {
|
|
5938
5979
|
name: "get_logs",
|
|
5939
|
-
description: "Retrieve application logs
|
|
5980
|
+
description: "Retrieve application logs within your project's build tool (or server for full-stack applications). Supports filtering by level, time, and pattern matching.",
|
|
5940
5981
|
inputSchema: getLogsInputSchema
|
|
5941
5982
|
}
|
|
5942
5983
|
}
|
|
@@ -5952,6 +5993,9 @@ function isResolveError(result) {
|
|
|
5952
5993
|
function isExtractError(result) {
|
|
5953
5994
|
return result != null && "error" in result;
|
|
5954
5995
|
}
|
|
5996
|
+
function isFileInfo(result) {
|
|
5997
|
+
return result != null && "exports" in result && Array.isArray(result.exports);
|
|
5998
|
+
}
|
|
5955
5999
|
function resolveError(specifier, source) {
|
|
5956
6000
|
return {
|
|
5957
6001
|
success: false,
|
|
@@ -6150,6 +6194,8 @@ function getSymbolKind(symbol) {
|
|
|
6150
6194
|
return "property";
|
|
6151
6195
|
if (flags & ts2.SymbolFlags.Method)
|
|
6152
6196
|
return "method";
|
|
6197
|
+
if (flags & ts2.SymbolFlags.EnumMember)
|
|
6198
|
+
return "enum member";
|
|
6153
6199
|
if (flags & ts2.SymbolFlags.Enum)
|
|
6154
6200
|
return "enum";
|
|
6155
6201
|
if (flags & ts2.SymbolFlags.Module)
|
|
@@ -6170,6 +6216,27 @@ function getSymbolKind(symbol) {
|
|
|
6170
6216
|
}
|
|
6171
6217
|
return "unknown";
|
|
6172
6218
|
}
|
|
6219
|
+
function getFileOverview(sourceFile) {
|
|
6220
|
+
const leadingComments = ts2.getLeadingCommentRanges(sourceFile.text, 0);
|
|
6221
|
+
if (!leadingComments || leadingComments.length === 0) {
|
|
6222
|
+
return;
|
|
6223
|
+
}
|
|
6224
|
+
for (const comment of leadingComments) {
|
|
6225
|
+
const commentText = sourceFile.text.slice(comment.pos, comment.end);
|
|
6226
|
+
const fileoverviewMatch = commentText.match(/@fileoverview\s+([\s\S]*?)(?=@\w+|$)/);
|
|
6227
|
+
const fileMatch = commentText.match(/@file\s+([\s\S]*?)(?=@\w+|$)/);
|
|
6228
|
+
const match = fileoverviewMatch || fileMatch;
|
|
6229
|
+
if (match && match[1]) {
|
|
6230
|
+
const overviewText = match[1].split(`
|
|
6231
|
+
`).map((line) => line.replace(/^\s*\*\s?/, "").trim()).filter((line) => line.length > 0).join(`
|
|
6232
|
+
`).trim();
|
|
6233
|
+
if (overviewText) {
|
|
6234
|
+
return overviewText;
|
|
6235
|
+
}
|
|
6236
|
+
}
|
|
6237
|
+
}
|
|
6238
|
+
return;
|
|
6239
|
+
}
|
|
6173
6240
|
var init_utils = () => {};
|
|
6174
6241
|
|
|
6175
6242
|
// src/resolution/formatters.ts
|
|
@@ -6266,7 +6333,7 @@ function getTypeString(checker, symbol, type) {
|
|
|
6266
6333
|
}
|
|
6267
6334
|
return defaultTypeString;
|
|
6268
6335
|
}
|
|
6269
|
-
function
|
|
6336
|
+
function formatSymbolInfo(info) {
|
|
6270
6337
|
const output = [];
|
|
6271
6338
|
output.push(`
|
|
6272
6339
|
${info.name}`);
|
|
@@ -6293,7 +6360,36 @@ ${info.name}`);
|
|
|
6293
6360
|
return output.join(`
|
|
6294
6361
|
`);
|
|
6295
6362
|
}
|
|
6296
|
-
|
|
6363
|
+
function formatFileInfo(info) {
|
|
6364
|
+
const output = [];
|
|
6365
|
+
output.push(`
|
|
6366
|
+
File: ${info.path}`);
|
|
6367
|
+
output.push("");
|
|
6368
|
+
if (info.overview) {
|
|
6369
|
+
output.push("Overview:");
|
|
6370
|
+
output.push(info.overview);
|
|
6371
|
+
output.push("");
|
|
6372
|
+
}
|
|
6373
|
+
output.push(`Symbols (${info.exportCount} total):`);
|
|
6374
|
+
output.push("");
|
|
6375
|
+
for (const exp of info.exports) {
|
|
6376
|
+
output.push(`${exp.name} (${exp.kind}) - line ${exp.line}`);
|
|
6377
|
+
if (exp.documentation) {
|
|
6378
|
+
output.push(exp.documentation);
|
|
6379
|
+
}
|
|
6380
|
+
}
|
|
6381
|
+
return output.join(`
|
|
6382
|
+
`);
|
|
6383
|
+
}
|
|
6384
|
+
function formatOutput(info) {
|
|
6385
|
+
if (isFileInfo(info)) {
|
|
6386
|
+
return formatFileInfo(info);
|
|
6387
|
+
}
|
|
6388
|
+
return formatSymbolInfo(info);
|
|
6389
|
+
}
|
|
6390
|
+
var init_formatters = __esm(() => {
|
|
6391
|
+
init_core();
|
|
6392
|
+
});
|
|
6297
6393
|
|
|
6298
6394
|
// src/resolution/symbol-finder.ts
|
|
6299
6395
|
import ts4 from "typescript";
|
|
@@ -6370,7 +6466,12 @@ function getSymbolInfo(checker, symbol, member, isStatic) {
|
|
|
6370
6466
|
return createExtractError("TYPE_ERROR", `Symbol '${symbol.getName()}' has no declarations`);
|
|
6371
6467
|
}
|
|
6372
6468
|
const targetDeclaration = declaration || symbol.declarations[0];
|
|
6373
|
-
|
|
6469
|
+
let type;
|
|
6470
|
+
if (symbol.flags & (ts4.SymbolFlags.Interface | ts4.SymbolFlags.TypeAlias)) {
|
|
6471
|
+
type = checker.getDeclaredTypeOfSymbol(symbol);
|
|
6472
|
+
} else {
|
|
6473
|
+
type = checker.getTypeOfSymbolAtLocation(symbol, targetDeclaration);
|
|
6474
|
+
}
|
|
6374
6475
|
const symbolName = symbol.getName();
|
|
6375
6476
|
let targetSymbol = symbol;
|
|
6376
6477
|
let targetType = type;
|
|
@@ -6384,11 +6485,27 @@ function getSymbolInfo(checker, symbol, member, isStatic) {
|
|
|
6384
6485
|
targetType = checker.getTypeOfSymbolAtLocation(staticMember, staticMember.valueDeclaration);
|
|
6385
6486
|
name = `${symbolName}.${member}`;
|
|
6386
6487
|
} else {
|
|
6387
|
-
return createExtractError("MEMBER_NOT_FOUND", `Static member '${member}' not found on '${symbolName}'`);
|
|
6488
|
+
return createExtractError("MEMBER_NOT_FOUND", `Static member '${member}' not found on '${symbolName}'. Available: ${staticMembers.map((m) => m.getName()).join(", ")}`);
|
|
6388
6489
|
}
|
|
6389
6490
|
} else {
|
|
6390
6491
|
let instanceType;
|
|
6391
|
-
if (symbol.flags & ts4.SymbolFlags.
|
|
6492
|
+
if (symbol.flags & ts4.SymbolFlags.Interface) {
|
|
6493
|
+
instanceType = type;
|
|
6494
|
+
const instanceMembers = checker.getPropertiesOfType(instanceType);
|
|
6495
|
+
const instanceMember = instanceMembers.find((s) => s.getName() === member);
|
|
6496
|
+
if (instanceMember) {
|
|
6497
|
+
targetSymbol = instanceMember;
|
|
6498
|
+
const memberDecl = instanceMember.valueDeclaration || instanceMember.declarations?.[0];
|
|
6499
|
+
if (memberDecl) {
|
|
6500
|
+
targetType = checker.getTypeOfSymbolAtLocation(instanceMember, memberDecl);
|
|
6501
|
+
} else {
|
|
6502
|
+
targetType = checker.getTypeOfSymbol(instanceMember);
|
|
6503
|
+
}
|
|
6504
|
+
name = `${symbolName}#${member}`;
|
|
6505
|
+
} else {
|
|
6506
|
+
return createExtractError("MEMBER_NOT_FOUND", `Instance member '${member}' not found on interface '${symbolName}'. Available: ${instanceMembers.map((m) => m.getName()).join(", ")}`);
|
|
6507
|
+
}
|
|
6508
|
+
} else if (symbol.flags & ts4.SymbolFlags.Class) {
|
|
6392
6509
|
instanceType = checker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration);
|
|
6393
6510
|
const constructSignatures = instanceType.getConstructSignatures();
|
|
6394
6511
|
if (constructSignatures.length > 0) {
|
|
@@ -6472,6 +6589,9 @@ var init_symbol_finder = __esm(() => {
|
|
|
6472
6589
|
import ts5 from "typescript";
|
|
6473
6590
|
import path4 from "node:path";
|
|
6474
6591
|
function parseModulePath(modulePath) {
|
|
6592
|
+
if (!modulePath || modulePath.trim() === "") {
|
|
6593
|
+
return createExtractError("INVALID_REQUEST", "Module path is required");
|
|
6594
|
+
}
|
|
6475
6595
|
let module;
|
|
6476
6596
|
let symbolPath;
|
|
6477
6597
|
if (modulePath.startsWith("node:")) {
|
|
@@ -6480,12 +6600,22 @@ function parseModulePath(modulePath) {
|
|
|
6480
6600
|
module = `node:${baseSymbol}`;
|
|
6481
6601
|
symbolPath = nodeSymbol;
|
|
6482
6602
|
} else {
|
|
6483
|
-
const
|
|
6484
|
-
if (
|
|
6485
|
-
|
|
6603
|
+
const colonIndex = modulePath.indexOf(":");
|
|
6604
|
+
if (colonIndex === -1) {
|
|
6605
|
+
module = modulePath;
|
|
6606
|
+
symbolPath = undefined;
|
|
6607
|
+
} else if (colonIndex === 0) {
|
|
6608
|
+
return createExtractError("INVALID_REQUEST", 'Module path is required before ":"');
|
|
6609
|
+
} else {
|
|
6610
|
+
module = modulePath.substring(0, colonIndex);
|
|
6611
|
+
symbolPath = modulePath.substring(colonIndex + 1);
|
|
6612
|
+
if (!symbolPath || symbolPath.trim() === "") {
|
|
6613
|
+
return createExtractError("INVALID_REQUEST", 'Symbol name is required after ":"');
|
|
6614
|
+
}
|
|
6486
6615
|
}
|
|
6487
|
-
|
|
6488
|
-
|
|
6616
|
+
}
|
|
6617
|
+
if (!symbolPath) {
|
|
6618
|
+
return { module, symbol: undefined, member: undefined, isStatic: false };
|
|
6489
6619
|
}
|
|
6490
6620
|
if (symbolPath.includes("#")) {
|
|
6491
6621
|
const [symbol, member] = symbolPath.split("#");
|
|
@@ -6503,6 +6633,37 @@ function parseModulePath(modulePath) {
|
|
|
6503
6633
|
}
|
|
6504
6634
|
return { module, symbol: symbolPath, member: undefined, isStatic: false };
|
|
6505
6635
|
}
|
|
6636
|
+
function getExportSummaries(moduleSymbol, sourceFile, checker) {
|
|
6637
|
+
if (!moduleSymbol) {
|
|
6638
|
+
return [];
|
|
6639
|
+
}
|
|
6640
|
+
try {
|
|
6641
|
+
const exports = checker.getExportsOfModule(moduleSymbol);
|
|
6642
|
+
const summaries = [];
|
|
6643
|
+
for (const exp of exports) {
|
|
6644
|
+
const name = exp.getName();
|
|
6645
|
+
const kind = getSymbolKind(exp);
|
|
6646
|
+
const decl = exp.valueDeclaration ?? exp.declarations?.[0];
|
|
6647
|
+
let line = 0;
|
|
6648
|
+
if (decl) {
|
|
6649
|
+
const pos = sourceFile.getLineAndCharacterOfPosition(decl.getStart());
|
|
6650
|
+
line = pos.line + 1;
|
|
6651
|
+
}
|
|
6652
|
+
const fullDoc = ts5.displayPartsToString(exp.getDocumentationComment(checker));
|
|
6653
|
+
const briefDoc = fullDoc.split(`
|
|
6654
|
+
`)[0]?.trim();
|
|
6655
|
+
summaries.push({
|
|
6656
|
+
name,
|
|
6657
|
+
kind,
|
|
6658
|
+
line,
|
|
6659
|
+
documentation: briefDoc || undefined
|
|
6660
|
+
});
|
|
6661
|
+
}
|
|
6662
|
+
return summaries.sort((a, b) => a.line - b.line);
|
|
6663
|
+
} catch {
|
|
6664
|
+
return [];
|
|
6665
|
+
}
|
|
6666
|
+
}
|
|
6506
6667
|
async function extractDocs(modulePath) {
|
|
6507
6668
|
const options = { prefix: process.cwd() };
|
|
6508
6669
|
const parseResult = parseModulePath(modulePath);
|
|
@@ -6525,6 +6686,22 @@ async function extractDocs(modulePath) {
|
|
|
6525
6686
|
}
|
|
6526
6687
|
const { sourceFile, program: program2 } = resolvedModule;
|
|
6527
6688
|
const checker = program2.getTypeChecker();
|
|
6689
|
+
if (symbol === undefined) {
|
|
6690
|
+
const overview = getFileOverview(sourceFile);
|
|
6691
|
+
const moduleSymbol = checker.getSymbolAtLocation(sourceFile);
|
|
6692
|
+
const exports = getExportSummaries(moduleSymbol, sourceFile, checker);
|
|
6693
|
+
let relativePath = sourceFile.fileName;
|
|
6694
|
+
const cwd = process.cwd();
|
|
6695
|
+
if (relativePath.startsWith(cwd)) {
|
|
6696
|
+
relativePath = path4.relative(cwd, relativePath);
|
|
6697
|
+
}
|
|
6698
|
+
return {
|
|
6699
|
+
path: relativePath,
|
|
6700
|
+
overview,
|
|
6701
|
+
exportCount: exports.length,
|
|
6702
|
+
exports
|
|
6703
|
+
};
|
|
6704
|
+
}
|
|
6528
6705
|
let targetSymbol;
|
|
6529
6706
|
if (isGlobalModule) {
|
|
6530
6707
|
const actualSymbolName = module.startsWith("node:") ? module.slice(5) : module;
|
|
@@ -6545,9 +6722,11 @@ async function extractDocs(modulePath) {
|
|
|
6545
6722
|
const exports = checker.getExportsOfModule(moduleSymbol);
|
|
6546
6723
|
const exportSymbol = exports.find((exp) => exp.getName() === symbol);
|
|
6547
6724
|
if (exportSymbol) {
|
|
6548
|
-
if (exportSymbol.
|
|
6725
|
+
if (exportSymbol.flags & ts5.SymbolFlags.Alias) {
|
|
6726
|
+
targetSymbol = checker.getAliasedSymbol(exportSymbol);
|
|
6727
|
+
} else if (exportSymbol.valueDeclaration && (ts5.isFunctionDeclaration(exportSymbol.valueDeclaration) || ts5.isClassDeclaration(exportSymbol.valueDeclaration) || ts5.isVariableDeclaration(exportSymbol.valueDeclaration) || ts5.isEnumDeclaration(exportSymbol.valueDeclaration))) {
|
|
6549
6728
|
targetSymbol = exportSymbol;
|
|
6550
|
-
} else if (exportSymbol.flags & (ts5.SymbolFlags.Interface | ts5.SymbolFlags.TypeAlias)) {
|
|
6729
|
+
} else if (exportSymbol.flags & (ts5.SymbolFlags.Interface | ts5.SymbolFlags.TypeAlias | ts5.SymbolFlags.Enum)) {
|
|
6551
6730
|
targetSymbol = exportSymbol;
|
|
6552
6731
|
} else {
|
|
6553
6732
|
targetSymbol = findSymbolInJavaScriptFile(sourceFile, checker, symbol);
|
|
@@ -6588,6 +6767,15 @@ async function getSourceLocation(reference) {
|
|
|
6588
6767
|
};
|
|
6589
6768
|
}
|
|
6590
6769
|
const { module, symbol, member, isStatic } = parseResult;
|
|
6770
|
+
if (!symbol) {
|
|
6771
|
+
return {
|
|
6772
|
+
success: false,
|
|
6773
|
+
error: {
|
|
6774
|
+
code: "INVALID_SPECIFIER",
|
|
6775
|
+
message: "Symbol reference required for source location lookup"
|
|
6776
|
+
}
|
|
6777
|
+
};
|
|
6778
|
+
}
|
|
6591
6779
|
const config2 = loadTsConfig(options.prefix);
|
|
6592
6780
|
let resolvedModule = resolveModule(module, config2.options);
|
|
6593
6781
|
let isGlobalModule = false;
|
|
@@ -6708,6 +6896,7 @@ var init_resolution = __esm(() => {
|
|
|
6708
6896
|
init_core();
|
|
6709
6897
|
init_module_resolver();
|
|
6710
6898
|
init_symbol_finder();
|
|
6899
|
+
init_utils();
|
|
6711
6900
|
init_formatters();
|
|
6712
6901
|
});
|
|
6713
6902
|
|
|
@@ -6787,7 +6976,7 @@ var init_src = __esm(() => {
|
|
|
6787
6976
|
});
|
|
6788
6977
|
|
|
6789
6978
|
// package.json
|
|
6790
|
-
var name = "tidewave", version = "0.
|
|
6979
|
+
var name = "tidewave", version = "0.7.0", package_default;
|
|
6791
6980
|
var init_package = __esm(() => {
|
|
6792
6981
|
package_default = {
|
|
6793
6982
|
name,
|
|
@@ -6798,7 +6987,10 @@ var init_package = __esm(() => {
|
|
|
6798
6987
|
"documentation",
|
|
6799
6988
|
"mcp",
|
|
6800
6989
|
"cli",
|
|
6801
|
-
"tidewave"
|
|
6990
|
+
"tidewave",
|
|
6991
|
+
"next",
|
|
6992
|
+
"vite",
|
|
6993
|
+
"tanstack"
|
|
6802
6994
|
],
|
|
6803
6995
|
homepage: "https://tidewave.ai",
|
|
6804
6996
|
repository: {
|
|
@@ -6889,7 +7081,7 @@ var init_package = __esm(() => {
|
|
|
6889
7081
|
next: "^15.5.3",
|
|
6890
7082
|
prettier: "^3.4.2",
|
|
6891
7083
|
vite: "^7.1.5",
|
|
6892
|
-
vitest: "^
|
|
7084
|
+
vitest: "^4.1.8"
|
|
6893
7085
|
},
|
|
6894
7086
|
peerDependencies: {
|
|
6895
7087
|
typescript: "^5"
|
|
@@ -7962,10 +8154,10 @@ var require_uri_all = __commonJS((exports, module) => {
|
|
|
7962
8154
|
}
|
|
7963
8155
|
return output;
|
|
7964
8156
|
}
|
|
7965
|
-
var ucs2encode = function
|
|
8157
|
+
var ucs2encode = function ucs2encode2(array) {
|
|
7966
8158
|
return String.fromCodePoint.apply(String, toConsumableArray(array));
|
|
7967
8159
|
};
|
|
7968
|
-
var basicToDigit = function
|
|
8160
|
+
var basicToDigit = function basicToDigit2(codePoint) {
|
|
7969
8161
|
if (codePoint - 48 < 10) {
|
|
7970
8162
|
return codePoint - 22;
|
|
7971
8163
|
}
|
|
@@ -7977,10 +8169,10 @@ var require_uri_all = __commonJS((exports, module) => {
|
|
|
7977
8169
|
}
|
|
7978
8170
|
return base;
|
|
7979
8171
|
};
|
|
7980
|
-
var digitToBasic = function
|
|
8172
|
+
var digitToBasic = function digitToBasic2(digit, flag) {
|
|
7981
8173
|
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
|
7982
8174
|
};
|
|
7983
|
-
var adapt = function
|
|
8175
|
+
var adapt = function adapt2(delta, numPoints, firstTime) {
|
|
7984
8176
|
var k = 0;
|
|
7985
8177
|
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
|
7986
8178
|
delta += floor(delta / numPoints);
|
|
@@ -7989,7 +8181,7 @@ var require_uri_all = __commonJS((exports, module) => {
|
|
|
7989
8181
|
}
|
|
7990
8182
|
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
|
7991
8183
|
};
|
|
7992
|
-
var decode = function
|
|
8184
|
+
var decode = function decode2(input) {
|
|
7993
8185
|
var output = [];
|
|
7994
8186
|
var inputLength = input.length;
|
|
7995
8187
|
var i = 0;
|
|
@@ -8037,7 +8229,7 @@ var require_uri_all = __commonJS((exports, module) => {
|
|
|
8037
8229
|
}
|
|
8038
8230
|
return String.fromCodePoint.apply(String, output);
|
|
8039
8231
|
};
|
|
8040
|
-
var encode = function
|
|
8232
|
+
var encode = function encode2(input) {
|
|
8041
8233
|
var output = [];
|
|
8042
8234
|
input = ucs2decode(input);
|
|
8043
8235
|
var inputLength = input.length;
|
|
@@ -8151,12 +8343,12 @@ var require_uri_all = __commonJS((exports, module) => {
|
|
|
8151
8343
|
}
|
|
8152
8344
|
return output.join("");
|
|
8153
8345
|
};
|
|
8154
|
-
var toUnicode = function
|
|
8346
|
+
var toUnicode = function toUnicode2(input) {
|
|
8155
8347
|
return mapDomain(input, function(string) {
|
|
8156
8348
|
return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
|
|
8157
8349
|
});
|
|
8158
8350
|
};
|
|
8159
|
-
var toASCII = function
|
|
8351
|
+
var toASCII = function toASCII2(input) {
|
|
8160
8352
|
return mapDomain(input, function(string) {
|
|
8161
8353
|
return regexNonASCII.test(string) ? "xn--" + encode(string) : string;
|
|
8162
8354
|
});
|
|
@@ -8553,13 +8745,13 @@ var require_uri_all = __commonJS((exports, module) => {
|
|
|
8553
8745
|
var handler = {
|
|
8554
8746
|
scheme: "http",
|
|
8555
8747
|
domainHost: true,
|
|
8556
|
-
parse: function
|
|
8748
|
+
parse: function parse2(components, options) {
|
|
8557
8749
|
if (!components.host) {
|
|
8558
8750
|
components.error = components.error || "HTTP URIs must have a host.";
|
|
8559
8751
|
}
|
|
8560
8752
|
return components;
|
|
8561
8753
|
},
|
|
8562
|
-
serialize: function
|
|
8754
|
+
serialize: function serialize2(components, options) {
|
|
8563
8755
|
var secure = String(components.scheme).toLowerCase() === "https";
|
|
8564
8756
|
if (components.port === (secure ? 443 : 80) || components.port === "") {
|
|
8565
8757
|
components.port = undefined;
|
|
@@ -8582,7 +8774,7 @@ var require_uri_all = __commonJS((exports, module) => {
|
|
|
8582
8774
|
var handler$2 = {
|
|
8583
8775
|
scheme: "ws",
|
|
8584
8776
|
domainHost: true,
|
|
8585
|
-
parse: function
|
|
8777
|
+
parse: function parse2(components, options) {
|
|
8586
8778
|
var wsComponents = components;
|
|
8587
8779
|
wsComponents.secure = isSecure(wsComponents);
|
|
8588
8780
|
wsComponents.resourceName = (wsComponents.path || "/") + (wsComponents.query ? "?" + wsComponents.query : "");
|
|
@@ -8590,7 +8782,7 @@ var require_uri_all = __commonJS((exports, module) => {
|
|
|
8590
8782
|
wsComponents.query = undefined;
|
|
8591
8783
|
return wsComponents;
|
|
8592
8784
|
},
|
|
8593
|
-
serialize: function
|
|
8785
|
+
serialize: function serialize2(wsComponents, options) {
|
|
8594
8786
|
if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
|
|
8595
8787
|
wsComponents.port = undefined;
|
|
8596
8788
|
}
|
|
@@ -8758,7 +8950,7 @@ var require_uri_all = __commonJS((exports, module) => {
|
|
|
8758
8950
|
var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
|
|
8759
8951
|
var handler$6 = {
|
|
8760
8952
|
scheme: "urn:uuid",
|
|
8761
|
-
parse: function
|
|
8953
|
+
parse: function parse2(urnComponents, options) {
|
|
8762
8954
|
var uuidComponents = urnComponents;
|
|
8763
8955
|
uuidComponents.uuid = uuidComponents.nss;
|
|
8764
8956
|
uuidComponents.nss = undefined;
|
|
@@ -8767,7 +8959,7 @@ var require_uri_all = __commonJS((exports, module) => {
|
|
|
8767
8959
|
}
|
|
8768
8960
|
return uuidComponents;
|
|
8769
8961
|
},
|
|
8770
|
-
serialize: function
|
|
8962
|
+
serialize: function serialize2(uuidComponents, options) {
|
|
8771
8963
|
var urnComponents = uuidComponents;
|
|
8772
8964
|
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
|
|
8773
8965
|
return urnComponents;
|
|
@@ -10213,7 +10405,7 @@ var require_compile = __commonJS((exports, module) => {
|
|
|
10213
10405
|
|
|
10214
10406
|
// node_modules/ajv/lib/cache.js
|
|
10215
10407
|
var require_cache = __commonJS((exports, module) => {
|
|
10216
|
-
var Cache = module.exports = function
|
|
10408
|
+
var Cache = module.exports = function Cache2() {
|
|
10217
10409
|
this._cache = {};
|
|
10218
10410
|
};
|
|
10219
10411
|
Cache.prototype.put = function Cache_put(key, value) {
|
|
@@ -15508,6 +15700,7 @@ var init_zodToJsonSchema = __esm(() => {
|
|
|
15508
15700
|
|
|
15509
15701
|
// node_modules/zod-to-json-schema/dist/esm/index.js
|
|
15510
15702
|
var init_esm = __esm(() => {
|
|
15703
|
+
init_zodToJsonSchema();
|
|
15511
15704
|
init_Options();
|
|
15512
15705
|
init_Refs();
|
|
15513
15706
|
init_parseDef();
|
|
@@ -15539,7 +15732,6 @@ var init_esm = __esm(() => {
|
|
|
15539
15732
|
init_unknown();
|
|
15540
15733
|
init_selectParser();
|
|
15541
15734
|
init_zodToJsonSchema();
|
|
15542
|
-
init_zodToJsonSchema();
|
|
15543
15735
|
});
|
|
15544
15736
|
|
|
15545
15737
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
|
|
@@ -16285,7 +16477,7 @@ async function handleGetDocs({ reference }) {
|
|
|
16285
16477
|
isError: true
|
|
16286
16478
|
};
|
|
16287
16479
|
}
|
|
16288
|
-
if (!docs.documentation) {
|
|
16480
|
+
if ("documentation" in docs && !docs.documentation) {
|
|
16289
16481
|
return {
|
|
16290
16482
|
content: [
|
|
16291
16483
|
{
|
package/dist/core.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface InternalResolvedModule {
|
|
|
19
19
|
}
|
|
20
20
|
export interface ExtractionRequest {
|
|
21
21
|
readonly module: string;
|
|
22
|
-
readonly symbol
|
|
22
|
+
readonly symbol?: string;
|
|
23
23
|
readonly member?: string;
|
|
24
24
|
readonly isStatic?: boolean;
|
|
25
25
|
}
|
|
@@ -32,6 +32,18 @@ export interface SymbolInfo {
|
|
|
32
32
|
readonly location: string;
|
|
33
33
|
readonly jsDoc?: string;
|
|
34
34
|
}
|
|
35
|
+
export interface ExportSummary {
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly kind: string;
|
|
38
|
+
readonly line: number;
|
|
39
|
+
readonly documentation?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface FileInfo {
|
|
42
|
+
readonly path: string;
|
|
43
|
+
readonly overview?: string;
|
|
44
|
+
readonly exportCount: number;
|
|
45
|
+
readonly exports: ExportSummary[];
|
|
46
|
+
}
|
|
35
47
|
export interface ExtractorOptions {
|
|
36
48
|
readonly prefix?: string;
|
|
37
49
|
}
|
|
@@ -62,19 +74,16 @@ export interface EvaluatedModuleResult {
|
|
|
62
74
|
stderr: string;
|
|
63
75
|
}
|
|
64
76
|
export type ResolveResult = ResolvedModule | ResolveError;
|
|
65
|
-
export type ExtractResult = SymbolInfo | ExtractError;
|
|
77
|
+
export type ExtractResult = SymbolInfo | FileInfo | ExtractError;
|
|
66
78
|
export type InternalResolveResult = InternalResolvedModule | ResolveError;
|
|
67
|
-
export declare function isError(result: ResolveResult | ExtractResult): boolean;
|
|
68
79
|
export declare function isResolveError(result: ResolveResult | InternalResolveResult): result is ResolveError;
|
|
69
80
|
export declare function isExtractError(result: ExtractResult): result is ExtractError;
|
|
81
|
+
export declare function isFileInfo(result: ExtractResult): result is FileInfo;
|
|
70
82
|
export declare function resolveError(specifier: ModuleRequest['specifier'], source: ModuleRequest['source']): ResolveError;
|
|
71
83
|
export declare function createExtractError(code: ExtractError['error']['code'], message: string, details?: unknown): ExtractError;
|
|
72
84
|
export interface TidewaveConfig {
|
|
73
|
-
port?: number;
|
|
74
|
-
host?: string;
|
|
75
85
|
clientUrl?: string;
|
|
76
86
|
allowRemoteAccess?: boolean;
|
|
77
|
-
allowedOrigins?: string[];
|
|
78
87
|
projectName?: string;
|
|
79
88
|
framework?: string;
|
|
80
89
|
team?: {
|