@justmpm/ai-tool 0.6.0 → 0.6.1
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.
|
@@ -3084,7 +3084,7 @@ function indexProject(cwd) {
|
|
|
3084
3084
|
if (!name) continue;
|
|
3085
3085
|
const isExported = func.isExported();
|
|
3086
3086
|
const params = func.getParameters().map((p) => p.getName());
|
|
3087
|
-
const returnType = simplifyType2(func
|
|
3087
|
+
const returnType = simplifyType2(safeGetReturnType(func));
|
|
3088
3088
|
const kind = inferSymbolKind(name, "function");
|
|
3089
3089
|
const symbol = {
|
|
3090
3090
|
name,
|
|
@@ -3116,7 +3116,7 @@ function indexProject(cwd) {
|
|
|
3116
3116
|
const funcLike = init.asKind(SyntaxKind2.ArrowFunction) || init.asKind(SyntaxKind2.FunctionExpression);
|
|
3117
3117
|
if (!funcLike) continue;
|
|
3118
3118
|
const params = funcLike.getParameters().map((p) => p.getName());
|
|
3119
|
-
const returnType = simplifyType2(funcLike
|
|
3119
|
+
const returnType = simplifyType2(safeGetReturnType(funcLike));
|
|
3120
3120
|
const kind = inferSymbolKind(name, "function");
|
|
3121
3121
|
const symbol = {
|
|
3122
3122
|
name,
|
|
@@ -3189,7 +3189,7 @@ function indexProject(cwd) {
|
|
|
3189
3189
|
kind: "type",
|
|
3190
3190
|
signature: `${isExported ? "export " : ""}type ${name}`,
|
|
3191
3191
|
isExported,
|
|
3192
|
-
definition: simplifyType2(typeAlias.getType()
|
|
3192
|
+
definition: simplifyType2(safeGetTypeText(() => typeAlias.getType()))
|
|
3193
3193
|
};
|
|
3194
3194
|
symbols.push(symbol);
|
|
3195
3195
|
if (!symbolsByName[name]) {
|
|
@@ -3291,12 +3291,31 @@ function inferSymbolKind(name, context2) {
|
|
|
3291
3291
|
return context2 === "function" ? "function" : "const";
|
|
3292
3292
|
}
|
|
3293
3293
|
function simplifyType2(typeText) {
|
|
3294
|
+
if (!typeText) return "unknown";
|
|
3294
3295
|
let simplified = typeText.replace(/import\([^)]+\)\./g, "");
|
|
3295
3296
|
if (simplified.length > 80) {
|
|
3296
3297
|
simplified = simplified.slice(0, 77) + "...";
|
|
3297
3298
|
}
|
|
3298
3299
|
return simplified;
|
|
3299
3300
|
}
|
|
3301
|
+
function safeGetTypeText(getTypeFn) {
|
|
3302
|
+
try {
|
|
3303
|
+
const type = getTypeFn();
|
|
3304
|
+
if (!type) return "unknown";
|
|
3305
|
+
return type.getText();
|
|
3306
|
+
} catch {
|
|
3307
|
+
return "unknown";
|
|
3308
|
+
}
|
|
3309
|
+
}
|
|
3310
|
+
function safeGetReturnType(node) {
|
|
3311
|
+
try {
|
|
3312
|
+
const returnType = node.getReturnType();
|
|
3313
|
+
if (!returnType) return "unknown";
|
|
3314
|
+
return returnType.getText();
|
|
3315
|
+
} catch {
|
|
3316
|
+
return "unknown";
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3300
3319
|
function truncateCode(code, maxLen) {
|
|
3301
3320
|
const oneLine = code.replace(/\s+/g, " ").trim();
|
|
3302
3321
|
if (oneLine.length <= maxLen) return oneLine;
|
|
@@ -3310,7 +3329,7 @@ function formatInterfaceDefinition2(iface) {
|
|
|
3310
3329
|
}
|
|
3311
3330
|
const props = iface.getProperties();
|
|
3312
3331
|
for (const prop of props.slice(0, 10)) {
|
|
3313
|
-
const propType = simplifyType2(prop.getType()
|
|
3332
|
+
const propType = simplifyType2(safeGetTypeText(() => prop.getType()));
|
|
3314
3333
|
parts.push(`${prop.getName()}: ${propType}`);
|
|
3315
3334
|
}
|
|
3316
3335
|
if (props.length > 10) {
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
find
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JTVYOIBK.js";
|
|
5
5
|
import {
|
|
6
6
|
VERSION,
|
|
7
7
|
area,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
impact,
|
|
15
15
|
map,
|
|
16
16
|
suggest
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-XHYBVOXY.js";
|
|
18
18
|
|
|
19
19
|
// src/cli.ts
|
|
20
20
|
var HELP = `
|
|
@@ -104,7 +104,7 @@ async function main() {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
if (flags.mcp) {
|
|
107
|
-
const { startMcpServer } = await import("./server-
|
|
107
|
+
const { startMcpServer } = await import("./server-J2J5WZST.js");
|
|
108
108
|
await startMcpServer();
|
|
109
109
|
return;
|
|
110
110
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
find
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JTVYOIBK.js";
|
|
4
4
|
import {
|
|
5
5
|
VERSION,
|
|
6
6
|
area,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
impact,
|
|
13
13
|
map,
|
|
14
14
|
suggest
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-XHYBVOXY.js";
|
|
16
16
|
|
|
17
17
|
// src/mcp/server.ts
|
|
18
18
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
package/package.json
CHANGED