@justmpm/ai-tool 0.7.3 → 0.7.4

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.
@@ -3503,6 +3503,10 @@ function indexProject(cwd) {
3503
3503
  const init = varDecl.getInitializer();
3504
3504
  if (!init) continue;
3505
3505
  const initKind = init.getKind();
3506
+ const initKindName = init.getKindName();
3507
+ if (DEBUG_FUNCTIONS && filePath.includes("functions/src/")) {
3508
+ debugFunctions(`[kind] ${name}: ${initKindName} (kind=${initKind})`);
3509
+ }
3506
3510
  if (initKind === SyntaxKind2.ArrowFunction || initKind === SyntaxKind2.FunctionExpression) {
3507
3511
  const funcLike = init.asKind(SyntaxKind2.ArrowFunction) || init.asKind(SyntaxKind2.FunctionExpression);
3508
3512
  if (!funcLike) continue;
@@ -3528,15 +3532,14 @@ function indexProject(cwd) {
3528
3532
  exports.push(name);
3529
3533
  }
3530
3534
  } else if (initKind === SyntaxKind2.CallExpression) {
3531
- const triggerName = extractFirebaseTriggerName(init);
3532
- if (filePath.includes("functions/src/")) {
3535
+ const triggerName = extractFirebaseTriggerName(init, filePath, name);
3536
+ if (DEBUG_FUNCTIONS && filePath.includes("functions/src/")) {
3533
3537
  const initText = init.getText().slice(0, 80).replace(/\s+/g, " ");
3534
3538
  debugFunctions(`Analisando: ${filePath}:${varDecl.getStartLineNumber()} - ${name} = ${initText}...`);
3535
3539
  if (triggerName) {
3536
- debugFunctions(` \u2713 Trigger detectado: ${triggerName}`);
3540
+ debugFunctions(` \u2713\u2713\u2713 Trigger FINAL detectado: ${triggerName}`);
3537
3541
  } else {
3538
- const allText = init.getText().slice(0, 100);
3539
- debugFunctions(` \u2717 N\xE3o \xE9 trigger. Texto: ${allText}...`);
3542
+ debugFunctions(` \u2717\u2717\u2717 Nenhum trigger detectado para: ${name}`);
3540
3543
  }
3541
3544
  }
3542
3545
  if (triggerName && FIREBASE_V2_TRIGGERS.has(triggerName)) {
@@ -3733,11 +3736,22 @@ function inferSymbolKind(name, context2) {
3733
3736
  }
3734
3737
  return context2 === "function" ? "function" : "const";
3735
3738
  }
3736
- function extractFirebaseTriggerName(init) {
3737
- const text = init.getText();
3739
+ function extractFirebaseTriggerName(init, filePath, varName) {
3740
+ const text = init.getText().trim();
3741
+ const shouldDebug = DEBUG_FUNCTIONS && filePath && filePath.includes("functions/src/");
3742
+ if (shouldDebug && varName) {
3743
+ debugFunctions(` [regex] Analisando texto: "${text.slice(0, 60)}..."`);
3744
+ }
3738
3745
  for (const trigger of FIREBASE_V2_TRIGGERS) {
3739
- const pattern = new RegExp(`(?:^|\\.|\\s)${trigger}(?:<[^>]*>)?\\s*\\(`);
3746
+ const pattern = new RegExp(`(?:^|\\.|\\s|\\()${trigger}(?:<[\\s\\S]*?>)?\\s*\\(`);
3747
+ if (shouldDebug && varName) {
3748
+ const testResult = pattern.test(text);
3749
+ debugFunctions(` [regex] Testando ${trigger}: ${testResult ? "\u2713 MATCH" : "\u2717 no match"}`);
3750
+ }
3740
3751
  if (pattern.test(text)) {
3752
+ if (shouldDebug && varName) {
3753
+ debugFunctions(` [regex] \u2713\u2713\u2713 TRIGGER ENCONTRADO: ${trigger}`);
3754
+ }
3741
3755
  return trigger;
3742
3756
  }
3743
3757
  }
package/dist/cli.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  impact,
14
14
  map,
15
15
  suggest
16
- } from "./chunk-GYLHEJ4E.js";
16
+ } from "./chunk-JUKU4SGB.js";
17
17
 
18
18
  // src/cli.ts
19
19
  import { resolve } from "path";
@@ -108,7 +108,7 @@ async function main() {
108
108
  }
109
109
  }
110
110
  if (flags.mcp) {
111
- const { startMcpServer } = await import("./server-R6ARDHBW.js");
111
+ const { startMcpServer } = await import("./server-52VHXRUA.js");
112
112
  await startMcpServer();
113
113
  return;
114
114
  }
package/dist/index.js CHANGED
@@ -47,7 +47,7 @@ import {
47
47
  setFileDescription,
48
48
  suggest,
49
49
  writeConfig
50
- } from "./chunk-GYLHEJ4E.js";
50
+ } from "./chunk-JUKU4SGB.js";
51
51
  export {
52
52
  AREA_DESCRIPTIONS,
53
53
  AREA_NAMES,
@@ -11,7 +11,7 @@ import {
11
11
  impact,
12
12
  map,
13
13
  suggest
14
- } from "./chunk-GYLHEJ4E.js";
14
+ } from "./chunk-JUKU4SGB.js";
15
15
 
16
16
  // src/mcp/server.ts
17
17
  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.7.3",
3
+ "version": "0.7.4",
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",