@justmpm/ai-tool 0.3.1 → 0.4.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/README.md +136 -79
- package/dist/{chunk-4HXWM7PK.js → chunk-33DHCY2H.js} +1416 -31
- package/dist/cli.js +42 -8
- package/dist/index.d.ts +249 -2
- package/dist/index.js +49 -3
- package/dist/{server-YV4BWISA.js → server-62WVGNJD.js} +246 -1
- package/package.json +2 -1
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
VERSION,
|
|
3
|
+
area,
|
|
4
|
+
areas,
|
|
5
|
+
areasInit,
|
|
3
6
|
context,
|
|
4
7
|
dead,
|
|
5
8
|
impact,
|
|
6
9
|
map,
|
|
7
10
|
suggest
|
|
8
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-33DHCY2H.js";
|
|
9
12
|
|
|
10
13
|
// src/mcp/server.ts
|
|
11
14
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -333,6 +336,248 @@ Eficiente: retorna apenas assinaturas, nao o codigo completo.`,
|
|
|
333
336
|
}
|
|
334
337
|
}
|
|
335
338
|
);
|
|
339
|
+
server.registerTool(
|
|
340
|
+
"aitool_list_areas",
|
|
341
|
+
{
|
|
342
|
+
title: "List Project Areas",
|
|
343
|
+
description: `Lista todas as areas/dominios funcionais do projeto.
|
|
344
|
+
|
|
345
|
+
IMPORTANTE - AREAS vs CATEGORIAS:
|
|
346
|
+
- CATEGORIA = tipo tecnico (hook, component, page, service...)
|
|
347
|
+
\u2192 Use aitool_project_map para ver categorias
|
|
348
|
+
- AREA = dominio funcional (auth, meus-pets, stripe, dashboard...)
|
|
349
|
+
\u2192 Use ESTA tool para ver areas
|
|
350
|
+
\u2192 Use aitool_area_detail para ver arquivos de uma area especifica
|
|
351
|
+
|
|
352
|
+
Um arquivo pode pertencer a MULTIPLAS areas!
|
|
353
|
+
|
|
354
|
+
FUNCIONALIDADES:
|
|
355
|
+
- Detecta areas automaticamente baseado em padroes de pasta e keywords
|
|
356
|
+
- Agrupa arquivos por dominio funcional
|
|
357
|
+
- Mostra distribuicao de categorias por area
|
|
358
|
+
- Identifica arquivos sem area definida
|
|
359
|
+
|
|
360
|
+
PARAMETROS:
|
|
361
|
+
- format: "text" (legivel) ou "json" (estruturado)
|
|
362
|
+
- cwd: Diretorio do projeto (default: diretorio atual)
|
|
363
|
+
|
|
364
|
+
RETORNA:
|
|
365
|
+
- Lista de areas com nome, descricao e contagem
|
|
366
|
+
- Distribuicao de categorias por area
|
|
367
|
+
- Lista de arquivos sem area (para configurar manualmente)
|
|
368
|
+
|
|
369
|
+
EXEMPLO DE USO:
|
|
370
|
+
Chamar no inicio da sessao para entender os dominios do projeto.
|
|
371
|
+
Usar antes de trabalhar em uma feature especifica.
|
|
372
|
+
|
|
373
|
+
CONFIGURACAO MANUAL:
|
|
374
|
+
Se houver arquivos sem area ou areas incorretas, use aitool_areas_init
|
|
375
|
+
para gerar .analyze/areas.config.json e edite manualmente.`,
|
|
376
|
+
inputSchema: {
|
|
377
|
+
format: z.enum(["text", "json"]).default("text").describe("Formato de saida: text (legivel) ou json (estruturado)"),
|
|
378
|
+
cwd: z.string().optional().describe("Diretorio do projeto a analisar")
|
|
379
|
+
},
|
|
380
|
+
annotations: {
|
|
381
|
+
title: "List Project Areas",
|
|
382
|
+
readOnlyHint: true,
|
|
383
|
+
destructiveHint: false,
|
|
384
|
+
idempotentHint: true,
|
|
385
|
+
openWorldHint: false
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
async (params) => {
|
|
389
|
+
try {
|
|
390
|
+
const result = await areas({
|
|
391
|
+
format: params.format,
|
|
392
|
+
cwd: params.cwd
|
|
393
|
+
});
|
|
394
|
+
return { content: [{ type: "text", text: result }] };
|
|
395
|
+
} catch (error) {
|
|
396
|
+
return {
|
|
397
|
+
content: [
|
|
398
|
+
{
|
|
399
|
+
type: "text",
|
|
400
|
+
text: `Erro ao executar areas: ${error instanceof Error ? error.message : String(error)}`
|
|
401
|
+
}
|
|
402
|
+
],
|
|
403
|
+
isError: true
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
);
|
|
408
|
+
server.registerTool(
|
|
409
|
+
"aitool_area_detail",
|
|
410
|
+
{
|
|
411
|
+
title: "Area Detail",
|
|
412
|
+
description: `Mostra todos os arquivos de uma area/dominio especifica.
|
|
413
|
+
|
|
414
|
+
USE ESTA TOOL QUANDO:
|
|
415
|
+
- Usuario pedir para trabalhar em uma feature (ex: "vou mexer em auth")
|
|
416
|
+
- Precisar listar todos os arquivos de um dominio
|
|
417
|
+
- Quiser ver apenas hooks, components, etc de uma area especifica
|
|
418
|
+
|
|
419
|
+
FUNCIONALIDADES:
|
|
420
|
+
- Lista arquivos agrupados por categoria (page, component, hook...)
|
|
421
|
+
- Mostra descricao de cada arquivo (inferida ou manual)
|
|
422
|
+
- Permite filtrar por categoria especifica (type="hook")
|
|
423
|
+
- Mostra resumo de distribuicao
|
|
424
|
+
|
|
425
|
+
PARAMETROS:
|
|
426
|
+
- target: Nome da area (OBRIGATORIO - ex: "meus-pets", "auth", "stripe")
|
|
427
|
+
- type: Filtrar por categoria (opcional - ex: "hook", "component")
|
|
428
|
+
- full: Mostrar todos os arquivos (default: false = resumido)
|
|
429
|
+
- cwd: Diretorio do projeto
|
|
430
|
+
|
|
431
|
+
RETORNA:
|
|
432
|
+
- Nome e descricao da area
|
|
433
|
+
- Lista de arquivos por categoria
|
|
434
|
+
- Descricao de cada arquivo
|
|
435
|
+
|
|
436
|
+
EXEMPLOS DE USO:
|
|
437
|
+
- Ver tudo de auth: target="auth"
|
|
438
|
+
- Ver apenas hooks de auth: target="auth", type="hook"
|
|
439
|
+
- Ver todos os arquivos de stripe: target="stripe", full=true
|
|
440
|
+
|
|
441
|
+
DICA: Use aitool_list_areas primeiro para ver quais areas existem.`,
|
|
442
|
+
inputSchema: {
|
|
443
|
+
target: z.string().min(1).describe("Nome da area: meus-pets, auth, stripe, etc"),
|
|
444
|
+
type: z.enum([
|
|
445
|
+
"page",
|
|
446
|
+
"layout",
|
|
447
|
+
"route",
|
|
448
|
+
"component",
|
|
449
|
+
"hook",
|
|
450
|
+
"service",
|
|
451
|
+
"store",
|
|
452
|
+
"util",
|
|
453
|
+
"type",
|
|
454
|
+
"config",
|
|
455
|
+
"test",
|
|
456
|
+
"other"
|
|
457
|
+
]).optional().describe("Filtrar por categoria especifica"),
|
|
458
|
+
full: z.boolean().default(false).describe("Mostrar todos os arquivos (default: resumido)"),
|
|
459
|
+
cwd: z.string().optional().describe("Diretorio do projeto a analisar")
|
|
460
|
+
},
|
|
461
|
+
annotations: {
|
|
462
|
+
title: "Area Detail",
|
|
463
|
+
readOnlyHint: true,
|
|
464
|
+
destructiveHint: false,
|
|
465
|
+
idempotentHint: true,
|
|
466
|
+
openWorldHint: false
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
async (params) => {
|
|
470
|
+
try {
|
|
471
|
+
const result = await area(params.target, {
|
|
472
|
+
type: params.type,
|
|
473
|
+
full: params.full,
|
|
474
|
+
cwd: params.cwd,
|
|
475
|
+
format: "text"
|
|
476
|
+
});
|
|
477
|
+
return { content: [{ type: "text", text: result }] };
|
|
478
|
+
} catch (error) {
|
|
479
|
+
return {
|
|
480
|
+
content: [
|
|
481
|
+
{
|
|
482
|
+
type: "text",
|
|
483
|
+
text: `Erro ao executar area: ${error instanceof Error ? error.message : String(error)}`
|
|
484
|
+
}
|
|
485
|
+
],
|
|
486
|
+
isError: true
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
);
|
|
491
|
+
server.registerTool(
|
|
492
|
+
"aitool_areas_init",
|
|
493
|
+
{
|
|
494
|
+
title: "Initialize Areas Config",
|
|
495
|
+
description: `Gera arquivo de configuracao de areas (.analyze/areas.config.json).
|
|
496
|
+
|
|
497
|
+
QUANDO USAR:
|
|
498
|
+
- Quando aitool_list_areas mostrar arquivos sem area definida
|
|
499
|
+
- Quando precisar personalizar deteccao de areas
|
|
500
|
+
- Quando quiser adicionar areas que nao sao detectadas automaticamente
|
|
501
|
+
|
|
502
|
+
O QUE FAZ:
|
|
503
|
+
- Escaneia o projeto e detecta areas automaticamente
|
|
504
|
+
- Infere patterns glob para cada area detectada
|
|
505
|
+
- Gera arquivo editavel em .analyze/areas.config.json
|
|
506
|
+
- NAO sobrescreve config existente (use force=true para sobrescrever)
|
|
507
|
+
|
|
508
|
+
PARAMETROS:
|
|
509
|
+
- force: Sobrescrever config existente (default: false)
|
|
510
|
+
- cwd: Diretorio do projeto (default: diretorio atual)
|
|
511
|
+
|
|
512
|
+
RETORNA:
|
|
513
|
+
- Confirmacao do arquivo criado
|
|
514
|
+
- Lista de areas detectadas com contagem
|
|
515
|
+
- Arquivos sem area (para configurar manualmente)
|
|
516
|
+
- Instrucoes de como editar o arquivo
|
|
517
|
+
|
|
518
|
+
ESTRUTURA DO ARQUIVO GERADO:
|
|
519
|
+
{
|
|
520
|
+
"areas": {
|
|
521
|
+
"auth": {
|
|
522
|
+
"name": "Autenticacao",
|
|
523
|
+
"description": "Sistema de login e sessao",
|
|
524
|
+
"patterns": ["components/auth/**", "hooks/useAuth.ts"],
|
|
525
|
+
"keywords": ["auth", "login", "session"]
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
"descriptions": {
|
|
529
|
+
"components/pets/PetForm.tsx": "Formulario multi-step de pets"
|
|
530
|
+
},
|
|
531
|
+
"settings": {
|
|
532
|
+
"autoDetect": true,
|
|
533
|
+
"inferDescriptions": true
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
COMO EDITAR MANUALMENTE:
|
|
538
|
+
1. Adicionar areas nao detectadas: adicione entrada em "areas"
|
|
539
|
+
2. Renomear areas: altere "name" da area
|
|
540
|
+
3. Ajustar deteccao: modifique "patterns" e "keywords"
|
|
541
|
+
4. Excluir arquivos: adicione "exclude" com patterns
|
|
542
|
+
5. Descrever arquivos: adicione entrada em "descriptions"
|
|
543
|
+
|
|
544
|
+
EXEMPLO DE USO:
|
|
545
|
+
1. Rode aitool_list_areas para ver areas atuais
|
|
546
|
+
2. Se houver arquivos sem area, rode aitool_areas_init
|
|
547
|
+
3. Edite .analyze/areas.config.json conforme necessario
|
|
548
|
+
4. Rode aitool_list_areas novamente para ver mudancas`,
|
|
549
|
+
inputSchema: {
|
|
550
|
+
force: z.boolean().default(false).describe("Sobrescrever config existente"),
|
|
551
|
+
cwd: z.string().optional().describe("Diretorio do projeto")
|
|
552
|
+
},
|
|
553
|
+
annotations: {
|
|
554
|
+
title: "Initialize Areas Config",
|
|
555
|
+
readOnlyHint: false,
|
|
556
|
+
destructiveHint: false,
|
|
557
|
+
idempotentHint: false,
|
|
558
|
+
openWorldHint: false
|
|
559
|
+
}
|
|
560
|
+
},
|
|
561
|
+
async (params) => {
|
|
562
|
+
try {
|
|
563
|
+
const result = await areasInit({
|
|
564
|
+
force: params.force,
|
|
565
|
+
cwd: params.cwd
|
|
566
|
+
});
|
|
567
|
+
return { content: [{ type: "text", text: result }] };
|
|
568
|
+
} catch (error) {
|
|
569
|
+
return {
|
|
570
|
+
content: [
|
|
571
|
+
{
|
|
572
|
+
type: "text",
|
|
573
|
+
text: `Erro ao executar areas init: ${error instanceof Error ? error.message : String(error)}`
|
|
574
|
+
}
|
|
575
|
+
],
|
|
576
|
+
isError: true
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
);
|
|
336
581
|
async function startMcpServer() {
|
|
337
582
|
const transport = new StdioServerTransport();
|
|
338
583
|
await server.connect(transport);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justmpm/ai-tool",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.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",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@modelcontextprotocol/sdk": "^1.25.3",
|
|
47
47
|
"knip": "^5.44.0",
|
|
48
|
+
"minimatch": "^10.0.1",
|
|
48
49
|
"skott": "^0.35.2",
|
|
49
50
|
"ts-morph": "^27.0.2",
|
|
50
51
|
"zod": "^3.25.76"
|