@justmpm/firebase-audit 0.4.1 → 0.4.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.
- package/dist/{chunk-GOLWQBD5.js → chunk-IXMAWDJH.js} +49 -4
- package/dist/index.js +1 -1
- package/dist/mcp-cli.js +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +1 -1
- package/package.json +1 -1
|
@@ -13,15 +13,60 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
13
13
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
14
14
|
import { z } from "zod";
|
|
15
15
|
import { createRequire } from "module";
|
|
16
|
+
import { readFileSync, existsSync } from "fs";
|
|
17
|
+
import { dirname, join } from "path";
|
|
18
|
+
import { fileURLToPath } from "url";
|
|
16
19
|
var require2 = createRequire(import.meta.url);
|
|
17
20
|
var pkg = require2("../package.json");
|
|
21
|
+
var pkgDir = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
22
|
+
function readPkgText(rel) {
|
|
23
|
+
try {
|
|
24
|
+
const p = join(pkgDir, rel);
|
|
25
|
+
if (!existsSync(p)) return null;
|
|
26
|
+
return readFileSync(p, "utf-8");
|
|
27
|
+
} catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
var FALLBACK_SKILL = [
|
|
32
|
+
"# firebase-audit-skill (fallback)",
|
|
33
|
+
"",
|
|
34
|
+
"1. Descobrir projeto (firebase.json, firestore.rules, firestore.indexes.json).",
|
|
35
|
+
"2. Executar scan (strict no CI). Sem adapter resolvido \u2192 UNKNOWN, nunca adivinhar.",
|
|
36
|
+
"3. CONFIRMED corrige agora; PROBABLE investiga; NOT_OBSERVED/UNKNOWN n\xE3o afirma.",
|
|
37
|
+
"4. Corrigir c\xF3digo, nunca o contrato para esconder finding."
|
|
38
|
+
].join("\n");
|
|
18
39
|
function createMcpServer() {
|
|
19
40
|
const server = new McpServer({
|
|
20
41
|
name: "firebase-audit-mcp-server",
|
|
21
42
|
version: pkg.version
|
|
22
43
|
});
|
|
23
44
|
server.registerTool(
|
|
24
|
-
"
|
|
45
|
+
"skill",
|
|
46
|
+
{
|
|
47
|
+
title: "Firebase Audit Skill (guia do agente)",
|
|
48
|
+
description: "LEIA ANTES de auditar: sequ\xEAncia obrigat\xF3ria, travas (nunca mude o contrato para esconder finding, nunca afirme sem evid\xEAncia, nunca diga 'unused') e Emulador. Retorna o guia oficial da vers\xE3o instalada + modelo de contrato. Sempre sincronizado \u2014 dispensa skill copiada.",
|
|
49
|
+
inputSchema: {}
|
|
50
|
+
},
|
|
51
|
+
async () => {
|
|
52
|
+
const skill = readPkgText(join("skill", "SKILL.md")) ?? FALLBACK_SKILL;
|
|
53
|
+
const template = readPkgText(join("templates", "firebase-audit.yaml")) ?? "";
|
|
54
|
+
const text = [
|
|
55
|
+
`# firebase-audit v${pkg.version} \u2014 guia do agente`,
|
|
56
|
+
"",
|
|
57
|
+
skill,
|
|
58
|
+
"",
|
|
59
|
+
"## Modelo de contrato (templates/firebase-audit.yaml)",
|
|
60
|
+
"",
|
|
61
|
+
"```yaml",
|
|
62
|
+
template,
|
|
63
|
+
"```"
|
|
64
|
+
].join("\n");
|
|
65
|
+
return { content: [{ type: "text", text }] };
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
server.registerTool(
|
|
69
|
+
"scan",
|
|
25
70
|
{
|
|
26
71
|
title: "Firebase Audit Scan",
|
|
27
72
|
description: "Audita projeto Firebase (c\xF3digo + firestore.rules + \xEDndices + contrato). Static-first, nunca inventa certeza (CONFIRMED/PROBABLE/NOT_OBSERVED/UNKNOWN). Use para descobrir regras p\xFAblicas, Admin em cliente, permiss\xF5es sem contrato.",
|
|
@@ -51,7 +96,7 @@ function createMcpServer() {
|
|
|
51
96
|
}
|
|
52
97
|
);
|
|
53
98
|
server.registerTool(
|
|
54
|
-
"
|
|
99
|
+
"check",
|
|
55
100
|
{
|
|
56
101
|
title: "Firebase Audit Check (strict)",
|
|
57
102
|
description: "Alias de scan --strict: exige contrato e falha (exit 2 no CLI) se houver ERROR. Use no CI.",
|
|
@@ -80,7 +125,7 @@ function createMcpServer() {
|
|
|
80
125
|
}
|
|
81
126
|
);
|
|
82
127
|
server.registerTool(
|
|
83
|
-
"
|
|
128
|
+
"verify",
|
|
84
129
|
{
|
|
85
130
|
title: "Firebase Audit Verify (Emulator)",
|
|
86
131
|
description: "Gera matriz role\xD7opera\xE7\xE3o\xD7path e avalia coverage do :ruleCoverage. Requer Emulator (firebase emulators:exec). Nunca afirma cobertura sem teste real.",
|
|
@@ -115,7 +160,7 @@ function createMcpServer() {
|
|
|
115
160
|
}
|
|
116
161
|
);
|
|
117
162
|
server.registerTool(
|
|
118
|
-
"
|
|
163
|
+
"drift",
|
|
119
164
|
{
|
|
120
165
|
title: "Firebase Audit Drift (\xEDndices)",
|
|
121
166
|
description: "Compara \xEDndices locais vs implantados. Retorna MATCHED/LOCAL_ONLY/REMOTE_ONLY. Nunca diz 'unused', apenas NOT_OBSERVED.",
|
package/dist/index.js
CHANGED
package/dist/mcp-cli.js
CHANGED
package/dist/mcp.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* MCP Server do firebase-audit.
|
|
5
5
|
*
|
|
6
|
-
* Expõe scan/check/verify/drift via protocolo MCP (stdio).
|
|
6
|
+
* Expõe skill + scan/check/verify/drift via protocolo MCP (stdio).
|
|
7
7
|
* Mesma lógica da biblioteca — sem duplicação (chama scan/verify/drift direto).
|
|
8
8
|
*
|
|
9
9
|
* Uso:
|
package/dist/mcp.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justmpm/firebase-audit",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Auditor de consistência e segurança para projetos Firebase: código + Rules + índices + contrato vs comportamento. Static-first, nunca inventa certeza.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"firebase",
|