@justmpm/ai-tool 0.7.6 → 0.7.7
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.
|
@@ -3573,10 +3573,19 @@ function indexProject(cwd) {
|
|
|
3573
3573
|
}
|
|
3574
3574
|
} else if (initKind === SyntaxKind2.CallExpression) {
|
|
3575
3575
|
const importMap = buildImportMap(sourceFile);
|
|
3576
|
+
if (DEBUG_FUNCTIONS && filePath.includes("functions/src/")) {
|
|
3577
|
+
const initText = init.getText().slice(0, 100).replace(/\s+/g, " ");
|
|
3578
|
+
debugFunctions(`
|
|
3579
|
+
[CallExpression] ${filePath}:${varDecl.getStartLineNumber()}`);
|
|
3580
|
+
debugFunctions(` Vari\xE1vel: ${name}`);
|
|
3581
|
+
debugFunctions(` C\xF3digo: ${initText}...`);
|
|
3582
|
+
debugFunctions(` Imports encontrados: ${importMap.size}`);
|
|
3583
|
+
importMap.forEach((info, key) => {
|
|
3584
|
+
debugFunctions(` - ${key} -> ${info.name} from ${info.module}`);
|
|
3585
|
+
});
|
|
3586
|
+
}
|
|
3576
3587
|
const triggerName = extractFirebaseTriggerName(init, filePath, name, importMap);
|
|
3577
3588
|
if (DEBUG_FUNCTIONS && filePath.includes("functions/src/")) {
|
|
3578
|
-
const initText = init.getText().slice(0, 80).replace(/\s+/g, " ");
|
|
3579
|
-
debugFunctions(`Analisando: ${filePath}:${varDecl.getStartLineNumber()} - ${name} = ${initText}...`);
|
|
3580
3589
|
if (triggerName) {
|
|
3581
3590
|
debugFunctions(` \u2713\u2713\u2713 Trigger FINAL detectado: ${triggerName}`);
|
|
3582
3591
|
} else {
|
|
@@ -3789,35 +3798,62 @@ function inferSymbolKind(name, context2) {
|
|
|
3789
3798
|
function extractFirebaseTriggerName(init, filePath, varName, importMap) {
|
|
3790
3799
|
const text = init.getText().trim();
|
|
3791
3800
|
const shouldDebug = DEBUG_FUNCTIONS && filePath && filePath.includes("functions/src/");
|
|
3801
|
+
if (shouldDebug) {
|
|
3802
|
+
debugFunctions(`[extractFirebaseTriggerName] Iniciando an\xE1lise`);
|
|
3803
|
+
debugFunctions(` VarName: ${varName}`);
|
|
3804
|
+
debugFunctions(` Node Kind: ${init.getKindName()} (${init.getKind()})`);
|
|
3805
|
+
debugFunctions(` \xC9 CallExpression: ${Node2.isCallExpression(init)}`);
|
|
3806
|
+
debugFunctions(` ImportMap dispon\xEDvel: ${importMap ? "SIM" : "N\xC3O"}`);
|
|
3807
|
+
}
|
|
3792
3808
|
if (importMap && Node2.isCallExpression(init)) {
|
|
3793
3809
|
const expr = init.getExpression();
|
|
3810
|
+
if (shouldDebug) {
|
|
3811
|
+
debugFunctions(` Expression Kind: ${expr.getKindName()} (${expr.getKind()})`);
|
|
3812
|
+
debugFunctions(` \xC9 Identifier: ${Node2.isIdentifier(expr)}`);
|
|
3813
|
+
debugFunctions(` \xC9 PropertyAccess: ${Node2.isPropertyAccessExpression(expr)}`);
|
|
3814
|
+
}
|
|
3794
3815
|
if (Node2.isIdentifier(expr)) {
|
|
3795
3816
|
const name = expr.getText();
|
|
3796
3817
|
const importInfo = importMap.get(name);
|
|
3818
|
+
if (shouldDebug) {
|
|
3819
|
+
debugFunctions(` [Caso 1: Identifier] Nome: ${name}`);
|
|
3820
|
+
debugFunctions(` ImportInfo: ${importInfo ? JSON.stringify(importInfo) : "n\xE3o encontrado"}`);
|
|
3821
|
+
}
|
|
3797
3822
|
if (importInfo && importInfo.module.includes("firebase-functions")) {
|
|
3798
3823
|
if (FIREBASE_V2_TRIGGERS.has(importInfo.name)) {
|
|
3799
|
-
if (shouldDebug) debugFunctions(`
|
|
3824
|
+
if (shouldDebug) debugFunctions(` \u2713 Import detectado: ${name} -> ${importInfo.name} from ${importInfo.module}`);
|
|
3800
3825
|
return importInfo.name;
|
|
3801
3826
|
}
|
|
3802
3827
|
}
|
|
3803
3828
|
if (FIREBASE_V2_TRIGGERS.has(name)) {
|
|
3829
|
+
if (shouldDebug) debugFunctions(` \u2713 Trigger conhecido detectado: ${name}`);
|
|
3804
3830
|
return name;
|
|
3805
3831
|
}
|
|
3806
3832
|
} else if (Node2.isPropertyAccessExpression(expr)) {
|
|
3807
3833
|
const lastPart = expr.getName();
|
|
3834
|
+
if (shouldDebug) {
|
|
3835
|
+
debugFunctions(` [Caso 2: PropertyAccess] \xDAltima parte: ${lastPart}`);
|
|
3836
|
+
}
|
|
3808
3837
|
if (FIREBASE_V2_TRIGGERS.has(lastPart)) {
|
|
3809
3838
|
let root = expr.getExpression();
|
|
3810
|
-
|
|
3839
|
+
let depth = 0;
|
|
3840
|
+
while (Node2.isPropertyAccessExpression(root) && depth < 10) {
|
|
3811
3841
|
root = root.getExpression();
|
|
3842
|
+
depth++;
|
|
3812
3843
|
}
|
|
3813
3844
|
if (Node2.isIdentifier(root)) {
|
|
3814
3845
|
const rootName = root.getText();
|
|
3815
3846
|
const importInfo = importMap.get(rootName);
|
|
3847
|
+
if (shouldDebug) {
|
|
3848
|
+
debugFunctions(` Raiz: ${rootName} (profundidade: ${depth})`);
|
|
3849
|
+
debugFunctions(` ImportInfo da raiz: ${importInfo ? JSON.stringify(importInfo) : "n\xE3o encontrado"}`);
|
|
3850
|
+
}
|
|
3816
3851
|
if (importInfo && importInfo.module.includes("firebase-functions")) {
|
|
3817
|
-
if (shouldDebug) debugFunctions(`
|
|
3852
|
+
if (shouldDebug) debugFunctions(` \u2713 Chain detectada: ${rootName}...${lastPart} from ${importInfo.module}`);
|
|
3818
3853
|
return lastPart;
|
|
3819
3854
|
}
|
|
3820
3855
|
if (["v2", "functions", "firebase", "admin"].includes(rootName)) {
|
|
3856
|
+
if (shouldDebug) debugFunctions(` \u2713 Heur\xEDstica: raiz "${rootName}" \xE9 conhecida do Firebase`);
|
|
3821
3857
|
return lastPart;
|
|
3822
3858
|
}
|
|
3823
3859
|
}
|
|
@@ -4736,6 +4772,33 @@ async function functions(options = {}) {
|
|
|
4736
4772
|
}
|
|
4737
4773
|
}
|
|
4738
4774
|
const functionFiles = Object.values(index.files).filter((f) => f.path.includes("functions/src/"));
|
|
4775
|
+
if (process.env.DEBUG_FUNCTIONS === "true" || process.env.DEBUG_ANALYZE === "true") {
|
|
4776
|
+
console.error(`
|
|
4777
|
+
[functions:debug] \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`);
|
|
4778
|
+
console.error(`[functions:debug] ESTAT\xCDSTICAS DE INDEXA\xC7\xC3O`);
|
|
4779
|
+
console.error(`[functions:debug] \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`);
|
|
4780
|
+
console.error(`[functions:debug] Total de arquivos indexados: ${Object.keys(index.files).length}`);
|
|
4781
|
+
console.error(`[functions:debug] Arquivos em functions/src/: ${functionFiles.length}`);
|
|
4782
|
+
if (functionFiles.length === 0) {
|
|
4783
|
+
console.error(`[functions:debug] \u26A0\uFE0F NENHUM arquivo em functions/src/ encontrado!`);
|
|
4784
|
+
console.error(`[functions:debug] Listando todos os arquivos indexados:`);
|
|
4785
|
+
Object.keys(index.files).slice(0, 20).forEach((f) => {
|
|
4786
|
+
console.error(`[functions:debug] - ${f}`);
|
|
4787
|
+
});
|
|
4788
|
+
}
|
|
4789
|
+
functionFiles.forEach((f) => {
|
|
4790
|
+
console.error(`
|
|
4791
|
+
[functions:debug] \u{1F4C4} ${f.path}`);
|
|
4792
|
+
console.error(`[functions:debug] Categoria: ${f.category}`);
|
|
4793
|
+
console.error(`[functions:debug] S\xEDmbolos: ${f.symbols.length}`);
|
|
4794
|
+
f.symbols.forEach((s) => {
|
|
4795
|
+
console.error(`[functions:debug] - ${s.name} [${s.kind}]${s.isExported ? " \u2713" : " \u2717"} (linha ${s.line})`);
|
|
4796
|
+
});
|
|
4797
|
+
console.error(`[functions:debug] Exports: ${f.exports.join(", ") || "(nenhum)"}`);
|
|
4798
|
+
});
|
|
4799
|
+
console.error(`[functions:debug] \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
4800
|
+
`);
|
|
4801
|
+
}
|
|
4739
4802
|
const funcs = [];
|
|
4740
4803
|
let totalSymbolsInFunctions = 0;
|
|
4741
4804
|
let triggerSymbolsFound = 0;
|
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
impact,
|
|
14
14
|
map,
|
|
15
15
|
suggest
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-KAP6AXYR.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-
|
|
111
|
+
const { startMcpServer } = await import("./server-URBWKWHH.js");
|
|
112
112
|
await startMcpServer();
|
|
113
113
|
return;
|
|
114
114
|
}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED