@justmpm/ai-tool 0.5.4 → 0.6.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/dist/cli.js CHANGED
@@ -1,7 +1,11 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ find
4
+ } from "./chunk-M7JM3XRW.js";
2
5
  import {
3
6
  VERSION,
4
7
  area,
8
+ areaContext,
5
9
  areas,
6
10
  areasInit,
7
11
  context,
@@ -10,7 +14,7 @@ import {
10
14
  impact,
11
15
  map,
12
16
  suggest
13
- } from "./chunk-PHTWZ2JT.js";
17
+ } from "./chunk-UDT7TLSN.js";
14
18
 
15
19
  // src/cli.ts
16
20
  var HELP = `
@@ -24,6 +28,8 @@ COMANDOS:
24
28
  impact <arquivo> Analise de impacto antes de modificar
25
29
  suggest <arquivo> Sugere arquivos para ler antes de modificar
26
30
  context <arquivo> Extrai assinaturas de um arquivo (funcoes, tipos)
31
+ context --area=<nome> Contexto consolidado de toda uma area
32
+ find <termo> Busca simbolos no codigo (funcoes, tipos, etc)
27
33
 
28
34
  AREAS:
29
35
  areas Lista todas as areas/dominios do projeto
@@ -33,6 +39,13 @@ AREAS:
33
39
  area <nome> --type=hook Filtra por categoria
34
40
  area <nome> --full Mostra todos os arquivos
35
41
 
42
+ BUSCA (find):
43
+ find <termo> Busca definicao + usos de um simbolo
44
+ find <termo> --type=function|type|const|component|hook
45
+ find <termo> --area=auth Busca apenas em uma area
46
+ find <termo> --def Mostra apenas definicoes
47
+ find <termo> --refs Mostra apenas referencias/usos
48
+
36
49
  MODOS:
37
50
  --mcp Inicia servidor MCP para integracao com Claude Desktop
38
51
 
@@ -41,8 +54,11 @@ OPCOES:
41
54
  --cwd=<path> Diretorio do projeto (default: cwd)
42
55
  --no-cache Ignora cache e forca regeneracao
43
56
  --limit=<n> Limite de sugestoes (default: 10, apenas suggest)
44
- --type=<categoria> Filtra por categoria (apenas area)
57
+ --type=<categoria> Filtra por categoria (area) ou tipo de simbolo (find)
45
58
  --full Lista completa (map: lista arquivos, area: todos arquivos)
59
+ --area=<nome> Filtra por area (find, context)
60
+ --def Apenas definicoes (find)
61
+ --refs Apenas referencias (find)
46
62
  --help, -h Mostra esta ajuda
47
63
  --version, -v Mostra versao
48
64
 
@@ -54,17 +70,18 @@ CACHE:
54
70
  EXEMPLOS:
55
71
  ai-tool map # Resumo compacto
56
72
  ai-tool map --full # Lista completa de arquivos
57
- ai-tool map --format=json
58
73
  ai-tool dead
59
74
  ai-tool dead --fix
60
75
  ai-tool impact Button
61
76
  ai-tool suggest Button --limit=5
62
77
  ai-tool context Button
78
+ ai-tool context --area=auth # Contexto de toda a area auth
79
+ ai-tool find useAuth # Busca definicao e usos
80
+ ai-tool find User --type=type # Busca apenas tipos
81
+ ai-tool find login --area=auth # Busca na area auth
63
82
  ai-tool areas
64
- ai-tool areas init
65
83
  ai-tool area auth
66
84
  ai-tool area auth --type=hook
67
- ai-tool area dashboard --full
68
85
  ai-tool --mcp
69
86
 
70
87
  SOBRE:
@@ -87,7 +104,7 @@ async function main() {
87
104
  }
88
105
  }
89
106
  if (flags.mcp) {
90
- const { startMcpServer } = await import("./server-NIEAOPLJ.js");
107
+ const { startMcpServer } = await import("./server-VKLU25E2.js");
91
108
  await startMcpServer();
92
109
  return;
93
110
  }
@@ -141,14 +158,37 @@ async function main() {
141
158
  });
142
159
  break;
143
160
  case "context":
161
+ if (flags.area) {
162
+ result = await areaContext(flags.area, { format, cwd, cache });
163
+ break;
164
+ }
144
165
  if (!target) {
145
166
  console.error("\u274C Erro: arquivo alvo \xE9 obrigat\xF3rio para o comando context");
146
167
  console.error(" Exemplo: ai-tool context src/components/Button.tsx");
147
168
  console.error(" Exemplo: ai-tool context Button");
169
+ console.error(" Exemplo: ai-tool context --area=auth");
148
170
  process.exit(1);
149
171
  }
150
172
  result = await context(target, { format, cwd });
151
173
  break;
174
+ case "find":
175
+ if (!target) {
176
+ console.error("\u274C Erro: termo de busca \xE9 obrigat\xF3rio para o comando find");
177
+ console.error(" Exemplo: ai-tool find useAuth");
178
+ console.error(" Exemplo: ai-tool find User --type=type");
179
+ console.error(" Exemplo: ai-tool find login --area=auth");
180
+ process.exit(1);
181
+ }
182
+ result = await find(target, {
183
+ format,
184
+ cwd,
185
+ cache,
186
+ type: flags.type,
187
+ area: flags.area,
188
+ def: !!flags.def,
189
+ refs: !!flags.refs
190
+ });
191
+ break;
152
192
  case "areas":
153
193
  if (target === "init") {
154
194
  result = await areasInit({ cwd, force: !!flags.force });
package/dist/index.d.ts CHANGED
@@ -264,6 +264,7 @@ declare function suggest(target: string, options?: SuggestOptions): Promise<stri
264
264
 
265
265
  /**
266
266
  * Comando CONTEXT - Extrai assinaturas de funcoes e tipos de um arquivo
267
+ * Também suporta --area para contexto consolidado de toda uma área
267
268
  */
268
269
 
269
270
  /**
package/dist/index.js CHANGED
@@ -45,7 +45,7 @@ import {
45
45
  setFileDescription,
46
46
  suggest,
47
47
  writeConfig
48
- } from "./chunk-PHTWZ2JT.js";
48
+ } from "./chunk-UDT7TLSN.js";
49
49
  export {
50
50
  AREA_DESCRIPTIONS,
51
51
  AREA_NAMES,
@@ -1,6 +1,10 @@
1
+ import {
2
+ find
3
+ } from "./chunk-M7JM3XRW.js";
1
4
  import {
2
5
  VERSION,
3
6
  area,
7
+ areaContext,
4
8
  areas,
5
9
  areasInit,
6
10
  context,
@@ -8,7 +12,7 @@ import {
8
12
  impact,
9
13
  map,
10
14
  suggest
11
- } from "./chunk-PHTWZ2JT.js";
15
+ } from "./chunk-UDT7TLSN.js";
12
16
 
13
17
  // src/mcp/server.ts
14
18
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -349,6 +353,90 @@ Use quando houver arquivos sem area ou precisar ajustar deteccao.`,
349
353
  }
350
354
  }
351
355
  );
356
+ server.registerTool(
357
+ "aitool_find",
358
+ {
359
+ title: "Find Symbol",
360
+ description: `Busca simbolos no codigo: funcoes, tipos, componentes, hooks, constantes.
361
+ Retorna definicao + referencias/usos. Diferente de grep, entende o AST do TypeScript.`,
362
+ inputSchema: {
363
+ query: z.string().min(1).describe("Termo a buscar (nome de funcao, tipo, componente, etc)"),
364
+ type: z.enum(["function", "type", "const", "component", "hook", "all"]).default("all").describe("Filtrar por tipo de simbolo"),
365
+ area: z.string().optional().describe("Filtrar busca por area especifica"),
366
+ def: z.boolean().default(false).describe("Mostrar apenas definicoes (onde e declarado)"),
367
+ refs: z.boolean().default(false).describe("Mostrar apenas referencias (onde e usado)"),
368
+ cwd: z.string().optional().describe("Diretorio do projeto a analisar")
369
+ },
370
+ annotations: {
371
+ title: "Find Symbol",
372
+ readOnlyHint: true,
373
+ destructiveHint: false,
374
+ idempotentHint: true,
375
+ openWorldHint: false
376
+ }
377
+ },
378
+ async (params) => {
379
+ try {
380
+ const result = await find(params.query, {
381
+ type: params.type,
382
+ area: params.area,
383
+ def: params.def,
384
+ refs: params.refs,
385
+ cwd: params.cwd,
386
+ format: "text"
387
+ });
388
+ return { content: [{ type: "text", text: result }] };
389
+ } catch (error) {
390
+ return {
391
+ content: [
392
+ {
393
+ type: "text",
394
+ text: `Erro ao executar find: ${error instanceof Error ? error.message : String(error)}`
395
+ }
396
+ ],
397
+ isError: true
398
+ };
399
+ }
400
+ }
401
+ );
402
+ server.registerTool(
403
+ "aitool_area_context",
404
+ {
405
+ title: "Area Context",
406
+ description: `Contexto consolidado de toda uma area: tipos, hooks, funcoes, componentes, services, stores.
407
+ Uma chamada = entender toda a feature. Muito mais eficiente que chamar context em cada arquivo.`,
408
+ inputSchema: {
409
+ area: z.string().min(1).describe("Nome da area: auth, dashboard, payments, etc"),
410
+ cwd: z.string().optional().describe("Diretorio do projeto a analisar")
411
+ },
412
+ annotations: {
413
+ title: "Area Context",
414
+ readOnlyHint: true,
415
+ destructiveHint: false,
416
+ idempotentHint: true,
417
+ openWorldHint: false
418
+ }
419
+ },
420
+ async (params) => {
421
+ try {
422
+ const result = await areaContext(params.area, {
423
+ cwd: params.cwd,
424
+ format: "text"
425
+ });
426
+ return { content: [{ type: "text", text: result }] };
427
+ } catch (error) {
428
+ return {
429
+ content: [
430
+ {
431
+ type: "text",
432
+ text: `Erro ao executar area context: ${error instanceof Error ? error.message : String(error)}`
433
+ }
434
+ ],
435
+ isError: true
436
+ };
437
+ }
438
+ }
439
+ );
352
440
  async function startMcpServer() {
353
441
  const transport = new StdioServerTransport();
354
442
  await server.connect(transport);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justmpm/ai-tool",
3
- "version": "0.5.4",
3
+ "version": "0.6.0",
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",