@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.
@@ -8,7 +8,7 @@ import {
8
8
  isFileIgnored,
9
9
  readConfig,
10
10
  updateCacheMeta
11
- } from "./chunk-UDT7TLSN.js";
11
+ } from "./chunk-XHYBVOXY.js";
12
12
 
13
13
  // src/commands/find.ts
14
14
  async function find(query, options = {}) {
@@ -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.getReturnType().getText());
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.getReturnType().getText());
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().getText())
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().getText());
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-M7JM3XRW.js";
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-UDT7TLSN.js";
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-VKLU25E2.js");
107
+ const { startMcpServer } = await import("./server-J2J5WZST.js");
108
108
  await startMcpServer();
109
109
  return;
110
110
  }
package/dist/index.js CHANGED
@@ -45,7 +45,7 @@ import {
45
45
  setFileDescription,
46
46
  suggest,
47
47
  writeConfig
48
- } from "./chunk-UDT7TLSN.js";
48
+ } from "./chunk-XHYBVOXY.js";
49
49
  export {
50
50
  AREA_DESCRIPTIONS,
51
51
  AREA_NAMES,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  find
3
- } from "./chunk-M7JM3XRW.js";
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-UDT7TLSN.js";
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justmpm/ai-tool",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Ferramenta de análise de dependências e impacto para projetos TypeScript/JavaScript. Usa Skott + Knip internamente.",
5
5
  "keywords": [
6
6
  "dependency-analysis",