@justmpm/ai-tool 0.5.1 → 0.5.2

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 CHANGED
@@ -155,6 +155,46 @@ Cria `.analyze/areas.config.json` com:
155
155
  - Patterns glob para cada area
156
156
  - Keywords de deteccao
157
157
  - Descricoes manuais de arquivos
158
+ - Padroes de ignore global
159
+
160
+ ### Configuracao de Areas
161
+
162
+ O arquivo `.analyze/areas.config.json` suporta:
163
+
164
+ ```json
165
+ {
166
+ "$schema": "./areas.schema.json",
167
+ "version": "1.0.0",
168
+ "ignore": [
169
+ "docs/brainstorming/**",
170
+ "functions/lib/**",
171
+ "**/*.test.ts"
172
+ ],
173
+ "areas": {
174
+ "auth": {
175
+ "name": "Autenticacao",
176
+ "description": "Sistema de login e sessao",
177
+ "patterns": ["**/auth/**", "**/login/**"],
178
+ "keywords": ["auth", "login", "session"]
179
+ }
180
+ },
181
+ "descriptions": {
182
+ "src/hooks/useAuth.ts": "Hook principal de autenticacao"
183
+ },
184
+ "settings": {
185
+ "autoDetect": true,
186
+ "inferDescriptions": true
187
+ }
188
+ }
189
+ ```
190
+
191
+ | Campo | Descricao |
192
+ |-------|-----------|
193
+ | `ignore` | Padroes glob para ignorar arquivos/pastas globalmente |
194
+ | `areas` | Definicao manual de areas com patterns e keywords |
195
+ | `descriptions` | Descricoes manuais para arquivos especificos |
196
+ | `settings.autoDetect` | Se `false`, usa apenas areas definidas manualmente |
197
+ | `settings.inferDescriptions` | Infere descricoes automaticamente baseado no nome |
158
198
 
159
199
  ## Servidor MCP
160
200
 
@@ -1079,6 +1079,7 @@ var CONFIG_FILE = "areas.config.json";
1079
1079
  var DEFAULT_CONFIG = {
1080
1080
  $schema: "./areas.schema.json",
1081
1081
  version: "1.0.0",
1082
+ ignore: [],
1082
1083
  areas: {},
1083
1084
  descriptions: {},
1084
1085
  settings: {
@@ -1475,6 +1476,17 @@ var AREA_DESCRIPTIONS = {
1475
1476
  };
1476
1477
 
1477
1478
  // src/areas/detector.ts
1479
+ function isFileIgnored(filePath, config) {
1480
+ const ignorePatterns = config.ignore || [];
1481
+ if (ignorePatterns.length === 0) return false;
1482
+ const normalizedPath = filePath.replace(/\\/g, "/");
1483
+ for (const pattern of ignorePatterns) {
1484
+ if (minimatch(normalizedPath, pattern, { dot: true })) {
1485
+ return true;
1486
+ }
1487
+ }
1488
+ return false;
1489
+ }
1478
1490
  function detectFileAreas(filePath, config) {
1479
1491
  const normalizedPath = filePath.replace(/\\/g, "/");
1480
1492
  const matches = [];
@@ -1722,6 +1734,9 @@ function detectAreasInfo(cwd, filePaths) {
1722
1734
  const areaSet = /* @__PURE__ */ new Set();
1723
1735
  let unmappedCount = 0;
1724
1736
  for (const filePath of filePaths) {
1737
+ if (isFileIgnored(filePath, config)) {
1738
+ continue;
1739
+ }
1725
1740
  const areas2 = detectFileAreas(filePath, config);
1726
1741
  if (areas2.length === 0) {
1727
1742
  unmappedCount++;
@@ -2804,9 +2819,10 @@ async function areas(options = {}) {
2804
2819
  try {
2805
2820
  const config = readConfig(cwd);
2806
2821
  const allFiles = getAllCodeFiles2(cwd);
2822
+ const filteredFiles = allFiles.filter((filePath) => !isFileIgnored(filePath, config));
2807
2823
  const areaMap = /* @__PURE__ */ new Map();
2808
2824
  const unmapped = [];
2809
- for (const filePath of allFiles) {
2825
+ for (const filePath of filteredFiles) {
2810
2826
  const category = detectCategory(filePath);
2811
2827
  const areas2 = detectFileAreas(filePath, config);
2812
2828
  let description = getFileDescription(cwd, filePath);
@@ -2854,7 +2870,7 @@ async function areas(options = {}) {
2854
2870
  unmapped,
2855
2871
  summary: {
2856
2872
  totalAreas: detectedAreas.length,
2857
- totalFiles: allFiles.length,
2873
+ totalFiles: filteredFiles.length,
2858
2874
  unmappedCount: unmapped.length
2859
2875
  }
2860
2876
  };
@@ -2921,9 +2937,10 @@ async function area(target, options = {}) {
2921
2937
  try {
2922
2938
  const config = readConfig(cwd);
2923
2939
  const allFiles = getAllCodeFiles3(cwd);
2940
+ const filteredFiles = allFiles.filter((filePath) => !isFileIgnored(filePath, config));
2924
2941
  const areaFiles = [];
2925
2942
  const targetLower = target.toLowerCase();
2926
- for (const filePath of allFiles) {
2943
+ for (const filePath of filteredFiles) {
2927
2944
  const fileAreas = detectFileAreas(filePath, config);
2928
2945
  const belongsToArea = fileAreas.some(
2929
2946
  (a) => a.toLowerCase() === targetLower || a.toLowerCase().includes(targetLower)
@@ -2945,7 +2962,7 @@ async function area(target, options = {}) {
2945
2962
  }
2946
2963
  }
2947
2964
  if (areaFiles.length === 0) {
2948
- const availableAreas = getAvailableAreas(allFiles, config);
2965
+ const availableAreas = getAvailableAreas(filteredFiles, config);
2949
2966
  return formatAreaNotFound(target, availableAreas);
2950
2967
  }
2951
2968
  const byCategory = {};
@@ -2960,7 +2977,7 @@ async function area(target, options = {}) {
2960
2977
  for (const cat of Object.keys(byCategory)) {
2961
2978
  byCategory[cat].sort((a, b) => a.path.localeCompare(b.path));
2962
2979
  }
2963
- const realAreaId = findRealAreaId(target, allFiles, config);
2980
+ const realAreaId = findRealAreaId(target, filteredFiles, config);
2964
2981
  const detectedArea = {
2965
2982
  id: realAreaId || target,
2966
2983
  name: getAreaName(realAreaId || target, config),
package/dist/cli.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  impact,
11
11
  map,
12
12
  suggest
13
- } from "./chunk-A3QVUKVA.js";
13
+ } from "./chunk-QPC6XJKI.js";
14
14
 
15
15
  // src/cli.ts
16
16
  var HELP = `
@@ -87,7 +87,7 @@ async function main() {
87
87
  }
88
88
  }
89
89
  if (flags.mcp) {
90
- const { startMcpServer } = await import("./server-DMLKPY45.js");
90
+ const { startMcpServer } = await import("./server-BD4ZIFRC.js");
91
91
  await startMcpServer();
92
92
  return;
93
93
  }
package/dist/index.d.ts CHANGED
@@ -169,6 +169,7 @@ interface AreaConfig {
169
169
  interface AreasConfigFile {
170
170
  $schema?: string;
171
171
  version: string;
172
+ ignore?: string[];
172
173
  areas: Record<string, AreaConfig>;
173
174
  descriptions?: Record<string, string>;
174
175
  settings?: {
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  setFileDescription,
37
37
  suggest,
38
38
  writeConfig
39
- } from "./chunk-A3QVUKVA.js";
39
+ } from "./chunk-QPC6XJKI.js";
40
40
  export {
41
41
  AREA_DESCRIPTIONS,
42
42
  AREA_NAMES,
@@ -8,7 +8,7 @@ import {
8
8
  impact,
9
9
  map,
10
10
  suggest
11
- } from "./chunk-A3QVUKVA.js";
11
+ } from "./chunk-QPC6XJKI.js";
12
12
 
13
13
  // src/mcp/server.ts
14
14
  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.5.1",
3
+ "version": "0.5.2",
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",