@justmpm/ai-tool 0.7.2 → 0.7.3

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.
@@ -3330,11 +3330,17 @@ import { join as join4, extname as extname2, resolve } from "path";
3330
3330
  import { Project as Project2, SyntaxKind as SyntaxKind2 } from "ts-morph";
3331
3331
  var CODE_EXTENSIONS2 = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"]);
3332
3332
  var DEBUG = process.env.DEBUG_ANALYZE === "true";
3333
+ var DEBUG_FUNCTIONS = process.env.DEBUG_FUNCTIONS === "true" || DEBUG;
3333
3334
  function debugLog(...args) {
3334
3335
  if (DEBUG) {
3335
3336
  console.error("[analyze:debug]", ...args);
3336
3337
  }
3337
3338
  }
3339
+ function debugFunctions(...args) {
3340
+ if (DEBUG_FUNCTIONS) {
3341
+ console.error("[functions:debug]", ...args);
3342
+ }
3343
+ }
3338
3344
  var IGNORED_DIRS = /* @__PURE__ */ new Set([
3339
3345
  "node_modules",
3340
3346
  "dist",
@@ -3419,6 +3425,8 @@ function indexProject(cwd) {
3419
3425
  const functionFiles = allFiles.filter((f) => f.includes("functions/src/"));
3420
3426
  if (functionFiles.length > 0) {
3421
3427
  debugLog(`Encontrados ${functionFiles.length} arquivos em functions/src/:`, functionFiles);
3428
+ debugFunctions(`Arquivos em functions/src/:`);
3429
+ functionFiles.forEach((f) => debugFunctions(` - ${f}`));
3422
3430
  }
3423
3431
  const project = createProject2(cwd);
3424
3432
  for (const file of allFiles) {
@@ -3521,11 +3529,14 @@ function indexProject(cwd) {
3521
3529
  }
3522
3530
  } else if (initKind === SyntaxKind2.CallExpression) {
3523
3531
  const triggerName = extractFirebaseTriggerName(init);
3524
- if (DEBUG && filePath.includes("functions/src/")) {
3525
- const initText = init.getText().slice(0, 50);
3526
- debugLog(`[CF] Analisando: ${name} = ${initText}...`);
3532
+ if (filePath.includes("functions/src/")) {
3533
+ const initText = init.getText().slice(0, 80).replace(/\s+/g, " ");
3534
+ debugFunctions(`Analisando: ${filePath}:${varDecl.getStartLineNumber()} - ${name} = ${initText}...`);
3527
3535
  if (triggerName) {
3528
- debugLog(`[CF] \u2713 Trigger detectado: ${triggerName}`);
3536
+ debugFunctions(` \u2713 Trigger detectado: ${triggerName}`);
3537
+ } else {
3538
+ const allText = init.getText().slice(0, 100);
3539
+ debugFunctions(` \u2717 N\xE3o \xE9 trigger. Texto: ${allText}...`);
3529
3540
  }
3530
3541
  }
3531
3542
  if (triggerName && FIREBASE_V2_TRIGGERS.has(triggerName)) {
@@ -4625,11 +4636,15 @@ async function functions(options = {}) {
4625
4636
  updateCacheMeta(cwd);
4626
4637
  }
4627
4638
  }
4639
+ const functionFiles = Object.values(index.files).filter((f) => f.path.includes("functions/src/"));
4628
4640
  const funcs = [];
4629
- for (const fileData of Object.values(index.files)) {
4630
- if (!fileData.path.includes("functions/src/")) continue;
4641
+ let totalSymbolsInFunctions = 0;
4642
+ let triggerSymbolsFound = 0;
4643
+ for (const fileData of functionFiles) {
4644
+ totalSymbolsInFunctions += fileData.symbols.length;
4631
4645
  for (const symbol of fileData.symbols) {
4632
4646
  if (symbol.kind === "trigger") {
4647
+ triggerSymbolsFound++;
4633
4648
  funcs.push({
4634
4649
  name: symbol.name,
4635
4650
  file: symbol.file,
@@ -4642,6 +4657,18 @@ async function functions(options = {}) {
4642
4657
  }
4643
4658
  }
4644
4659
  }
4660
+ if (funcs.length === 0 && (process.env.DEBUG_FUNCTIONS === "true" || process.env.DEBUG_ANALYZE === "true")) {
4661
+ console.error(`[functions:debug] Total de arquivos indexados: ${Object.keys(index.files).length}`);
4662
+ console.error(`[functions:debug] Arquivos em functions/src/: ${functionFiles.length}`);
4663
+ console.error(`[functions:debug] Total de s\xEDmbolos em functions/src/: ${totalSymbolsInFunctions}`);
4664
+ console.error(`[functions:debug] S\xEDmbolos do tipo 'trigger': ${triggerSymbolsFound}`);
4665
+ functionFiles.forEach((f) => {
4666
+ console.error(`[functions:debug] ${f.path}: ${f.symbols.length} s\xEDmbolos`);
4667
+ f.symbols.forEach((s) => {
4668
+ console.error(`[functions:debug] - ${s.name} (${s.kind})${s.isExported ? " [exported]" : ""}`);
4669
+ });
4670
+ });
4671
+ }
4645
4672
  const filtered = filterTrigger ? funcs.filter(
4646
4673
  (f) => f.triggerType.toLowerCase().includes(filterTrigger.toLowerCase())
4647
4674
  ) : funcs;
package/dist/cli.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  impact,
14
14
  map,
15
15
  suggest
16
- } from "./chunk-XEFS66GU.js";
16
+ } from "./chunk-GYLHEJ4E.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-XR6C3XM3.js");
111
+ const { startMcpServer } = await import("./server-R6ARDHBW.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-XEFS66GU.js";
50
+ } from "./chunk-GYLHEJ4E.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-XEFS66GU.js";
14
+ } from "./chunk-GYLHEJ4E.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.2",
3
+ "version": "0.7.3",
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",