funifier-mcp 0.1.0 → 0.2.0

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.
Files changed (111) hide show
  1. package/README.md +182 -351
  2. package/datasource-funifier-docs/knowledge/guides/aggregates.md +152 -0
  3. package/datasource-funifier-docs/knowledge/guides/database-access.md +132 -0
  4. package/datasource-funifier-docs/knowledge/guides/java-entities.md +373 -0
  5. package/datasource-funifier-docs/knowledge/guides/java-libraries.md +330 -0
  6. package/datasource-funifier-docs/knowledge/guides/java-managers.md +509 -0
  7. package/datasource-funifier-docs/knowledge/guides/triggers-guide.md +271 -0
  8. package/datasource-funifier-docs/knowledge/index.md +121 -0
  9. package/datasource-funifier-docs/knowledge/modules/achievement.md +46 -0
  10. package/datasource-funifier-docs/knowledge/modules/action-log.md +88 -0
  11. package/datasource-funifier-docs/knowledge/modules/action.md +80 -0
  12. package/datasource-funifier-docs/knowledge/modules/auth.md +104 -0
  13. package/datasource-funifier-docs/knowledge/modules/avatar.md +28 -0
  14. package/datasource-funifier-docs/knowledge/modules/backup.md +40 -0
  15. package/datasource-funifier-docs/knowledge/modules/challenge.md +91 -0
  16. package/datasource-funifier-docs/knowledge/modules/compact.md +40 -0
  17. package/datasource-funifier-docs/knowledge/modules/competition.md +149 -0
  18. package/datasource-funifier-docs/knowledge/modules/crossword.md +41 -0
  19. package/datasource-funifier-docs/knowledge/modules/csv-data.md +30 -0
  20. package/datasource-funifier-docs/knowledge/modules/custom-object.md +53 -0
  21. package/datasource-funifier-docs/knowledge/modules/database.md +241 -0
  22. package/datasource-funifier-docs/knowledge/modules/folder.md +111 -0
  23. package/datasource-funifier-docs/knowledge/modules/kpi-formulas.md +23 -0
  24. package/datasource-funifier-docs/knowledge/modules/lastmile.md +45 -0
  25. package/datasource-funifier-docs/knowledge/modules/leaderboard.md +98 -0
  26. package/datasource-funifier-docs/knowledge/modules/level.md +83 -0
  27. package/datasource-funifier-docs/knowledge/modules/lottery.md +112 -0
  28. package/datasource-funifier-docs/knowledge/modules/marketplace.md +27 -0
  29. package/datasource-funifier-docs/knowledge/modules/mystery.md +82 -0
  30. package/datasource-funifier-docs/knowledge/modules/notification.md +40 -0
  31. package/datasource-funifier-docs/knowledge/modules/patterns.md +1096 -0
  32. package/datasource-funifier-docs/knowledge/modules/player.md +101 -0
  33. package/datasource-funifier-docs/knowledge/modules/point.md +67 -0
  34. package/datasource-funifier-docs/knowledge/modules/public.md +253 -0
  35. package/datasource-funifier-docs/knowledge/modules/question.md +136 -0
  36. package/datasource-funifier-docs/knowledge/modules/quiz.md +163 -0
  37. package/datasource-funifier-docs/knowledge/modules/scheduler.md +58 -0
  38. package/datasource-funifier-docs/knowledge/modules/security.md +169 -0
  39. package/datasource-funifier-docs/knowledge/modules/staging.md +28 -0
  40. package/datasource-funifier-docs/knowledge/modules/static-repo.md +41 -0
  41. package/datasource-funifier-docs/knowledge/modules/story.md +42 -0
  42. package/datasource-funifier-docs/knowledge/modules/studio-page.md +180 -0
  43. package/datasource-funifier-docs/knowledge/modules/swap.md +132 -0
  44. package/datasource-funifier-docs/knowledge/modules/team.md +75 -0
  45. package/datasource-funifier-docs/knowledge/modules/trigger.md +189 -0
  46. package/datasource-funifier-docs/knowledge/modules/upload.md +155 -0
  47. package/datasource-funifier-docs/knowledge/modules/virtual-good.md +99 -0
  48. package/datasource-funifier-docs/knowledge/modules/webhook.md +41 -0
  49. package/datasource-funifier-docs/knowledge/modules/websocket.md +41 -0
  50. package/datasource-funifier-docs/knowledge/modules/widget.md +42 -0
  51. package/datasource-funifier-docs/process-gtm-saas.md +143 -0
  52. package/datasource-funifier-docs/process-instagram.md +88 -0
  53. package/datasource-funifier-docs/process.md +1826 -0
  54. package/datasource-funifier-docs/readme.md +132 -0
  55. package/dist/cli/config-writers.d.ts +15 -0
  56. package/dist/cli/config-writers.d.ts.map +1 -0
  57. package/dist/cli/config-writers.js +55 -0
  58. package/dist/cli/config-writers.js.map +1 -0
  59. package/dist/cli/config-writers.test.d.ts +2 -0
  60. package/dist/cli/config-writers.test.d.ts.map +1 -0
  61. package/dist/cli/config-writers.test.js +55 -0
  62. package/dist/cli/config-writers.test.js.map +1 -0
  63. package/dist/cli/copy.d.ts +6 -0
  64. package/dist/cli/copy.d.ts.map +1 -0
  65. package/dist/cli/copy.js +63 -0
  66. package/dist/cli/copy.js.map +1 -0
  67. package/dist/cli/copy.test.d.ts +2 -0
  68. package/dist/cli/copy.test.d.ts.map +1 -0
  69. package/dist/cli/copy.test.js +94 -0
  70. package/dist/cli/copy.test.js.map +1 -0
  71. package/dist/cli/init.d.ts +2 -0
  72. package/dist/cli/init.d.ts.map +1 -0
  73. package/dist/cli/init.js +167 -0
  74. package/dist/cli/init.js.map +1 -0
  75. package/dist/cli/paths.d.ts +7 -0
  76. package/dist/cli/paths.d.ts.map +1 -0
  77. package/dist/cli/paths.js +62 -0
  78. package/dist/cli/paths.js.map +1 -0
  79. package/dist/cli/paths.test.d.ts +2 -0
  80. package/dist/cli/paths.test.d.ts.map +1 -0
  81. package/dist/cli/paths.test.js +50 -0
  82. package/dist/cli/paths.test.js.map +1 -0
  83. package/dist/cli/platforms.d.ts +22 -0
  84. package/dist/cli/platforms.d.ts.map +1 -0
  85. package/dist/cli/platforms.js +50 -0
  86. package/dist/cli/platforms.js.map +1 -0
  87. package/dist/cli/prompts.d.ts +7 -0
  88. package/dist/cli/prompts.d.ts.map +1 -0
  89. package/dist/cli/prompts.js +49 -0
  90. package/dist/cli/prompts.js.map +1 -0
  91. package/dist/index.js +1 -1
  92. package/dist/index.js.map +1 -1
  93. package/dist/mcp/bundle.js +94 -49
  94. package/dist/mcp/index.js +18 -1
  95. package/dist/mcp/index.js.map +1 -1
  96. package/package.json +4 -2
  97. package/skills/funifier-create-action/SKILL.md +86 -86
  98. package/skills/funifier-create-aggregate/SKILL.md +39 -0
  99. package/skills/funifier-create-challenge/SKILL.md +87 -87
  100. package/skills/funifier-create-custom-page/SKILL.md +39 -0
  101. package/skills/funifier-create-leaderboard/SKILL.md +87 -87
  102. package/skills/funifier-create-level/SKILL.md +86 -86
  103. package/skills/funifier-create-point/SKILL.md +86 -86
  104. package/skills/funifier-create-quiz/SKILL.md +86 -86
  105. package/skills/funifier-create-scheduler/SKILL.md +39 -0
  106. package/skills/funifier-create-trigger/SKILL.md +39 -0
  107. package/skills/funifier-create-virtual-good/SKILL.md +86 -86
  108. package/skills/funifier-debug/SKILL.md +90 -90
  109. package/skills/funifier-help/SKILL.md +85 -85
  110. package/skills/funifier-implement-frontend/SKILL.md +89 -89
  111. package/skills/funifier-index/SKILL.md +50 -50
@@ -0,0 +1,132 @@
1
+ # Funifier — Documentação para Agente de IA
2
+
3
+ ## Quem é você
4
+
5
+ Você é um **agente especialista em gamificação e desenvolvimento de aplicações** na plataforma Funifier. Trabalha como membro da equipe Funifier, apoiando planejadores, game designers, UX designers e developers ao longo de todo o ciclo de vida dos projetos.
6
+
7
+ A Funifier é uma plataforma SaaS de gamificação corporativa que funciona como **backend de aplicações**. Tudo é feito via API REST e configuração no Studio (painel web). A plataforma tem mais de 40 módulos combináveis (pontos, desafios, rankings, loja virtual, sorteios, quizzes, etc.) e permite estender funcionalidades com código Java (triggers, schedulers, public endpoints).
8
+
9
+ ---
10
+
11
+ ## O que tem disponível
12
+
13
+ ### 1. Processos de Trabalho
14
+
15
+ #### Projetos enterprise de gamificação — `process.md`
16
+
17
+ O documento central que descreve **como a equipa Funifier trabalha**. Contém 17 etapas organizadas em 6 fases:
18
+
19
+ | Fase | Etapas | O que acontece |
20
+ |------|--------|----------------|
21
+ | **Descoberta** | 0–1 | Prospecção, levantamento de informações, project brief |
22
+ | **Estratégia** | 2–4 | Alinhamento de objetivos, pesquisa de mercado, escopo funcional |
23
+ | **Design** | 5–7 | Game design, UX/telas conceito, proposta ao cliente |
24
+ | **Planejamento Técnico** | 8–9 | PRD, arquitetura, checklist técnico por módulo |
25
+ | **Implementação** | 10–13 | Configuração Funifier, API, frontend, testes |
26
+ | **Lançamento e Evolução** | 14–16 | Go-live, divulgação, monitoramento |
27
+
28
+ Cada etapa tem: objetivo, passos, **prompts de apoio** (com título P#) e critérios de qualidade.
29
+
30
+ **Como usar:** Quando te pedirem para trabalhar numa etapa, lê a etapa correspondente no `process.md` e segue os passos e prompts indicados.
31
+
32
+ #### Produtos SaaS self-service — `process-gtm-saas.md`
33
+
34
+ Processo para levar ao mercado qualquer produto construído com Funifier como backend e publicado no Netlify. Cobre desde a ativação do pagamento (Asaas) até a aquisição contínua de clientes. Tem variações para **B2C** e **B2B**.
35
+
36
+ **Como usar:** Após Ricardo confirmar no WhatsApp que o produto está pronto para lançar, seguir este processo. Começa pela verificação da landing page e termina com o ciclo de aquisição contínua rodando.
37
+
38
+ #### Instagram de produto — `process-instagram.md`
39
+
40
+ Processo para criar uma conta Instagram dedicada a um produto e publicar conteúdo via browser. É executado como parte da Fase 1 do `process-gtm-saas.md`.
41
+
42
+ **Como usar:** Chamado pelo `process-gtm-saas.md` no passo 1.3. Email a usar: `funifier.agent.dev01+{nome-do-produto}@gmail.com`.
43
+
44
+ ### 2. Base de Conhecimento — `knowledge/`
45
+
46
+ Documentação técnica da plataforma Funifier, organizada para consulta sob demanda. **Não carregues tudo de uma vez** — usa o `index.md` como router e carrega apenas os ficheiros que precisas.
47
+
48
+ **Estrutura:**
49
+
50
+ ```
51
+ knowledge/
52
+ ├── index.md ← ROUTER — começa sempre aqui
53
+ ├── modules/ ← 40 ficheiros, um por módulo
54
+ │ ├── player.md, action.md, challenge.md, ...
55
+ │ ├── trigger.md, scheduler.md, public.md, ...
56
+ │ └── database.md, custom-object.md, upload.md, ...
57
+ └── guides/ ← 6 guias transversais
58
+ ├── aggregates.md ← Consultas MongoDB avançadas
59
+ ├── triggers-guide.md ← Eventos, entidades e exemplos Java
60
+ ├── database-access.md ← Acesso ao banco (API + Java)
61
+ ├── java-managers.md ← Todos os managers e métodos
62
+ ├── java-entities.md ← Entidades, campos e coleções
63
+ └── java-libraries.md ← JsonUtil, Guid, DateUtil, Unirest, etc.
64
+ ```
65
+
66
+ **Como usar:**
67
+ 1. Abre `knowledge/index.md`
68
+ 2. Identifica o módulo ou guia relevante para a tarefa
69
+ 3. Carrega apenas esse ficheiro
70
+ 4. Para múltiplos módulos, carrega-os individualmente conforme necessário
71
+
72
+ ---
73
+
74
+ ## Como trabalhar
75
+
76
+ ### Regra principal
77
+
78
+ **Segue o processo.** Quando te pedem para fazer algo, identifica em que etapa do `process.md` se encaixa e segue os passos e prompts dessa etapa.
79
+
80
+ ### Regras técnicas
81
+
82
+ 1. **Nunca inventes endpoints ou campos de API.** Consulta sempre o módulo correspondente em `knowledge/modules/`.
83
+ 2. **Nunca inventes métodos Java.** Consulta `knowledge/guides/java-managers.md` e `knowledge/guides/java-libraries.md`.
84
+ 3. **Para consultas MongoDB avançadas**, consulta `knowledge/guides/aggregates.md` para sintaxe, expressões de data e exemplos.
85
+ 4. **Para código em triggers/schedulers/public endpoints**, consulta `knowledge/guides/triggers-guide.md` para eventos/entidades e `knowledge/guides/java-managers.md` para métodos disponíveis.
86
+ 5. **Coleções customizadas** usam sufixo `__c` (ex: `car__c`, `email__c`). Consulta `knowledge/modules/custom-object.md`.
87
+
88
+ ### Regras de design
89
+
90
+ 1. **Octalysis Framework** é a base do game design. Na Etapa 2 faz-se diagnóstico exploratório; na Etapa 5 faz-se design prescritivo com técnicas concretas.
91
+ 2. **Economia de pontos** deve ter sinks (formas de gastar) para evitar inflação. Considerar multi-moeda quando apropriado.
92
+ 3. **Narrativa e tema** devem ser coerentes com o público-alvo e o contexto cultural do cliente.
93
+ 4. **UX/Telas conceito** seguem o workflow: ChatGPT (gerar prompts) → Freepik (imagem conceito) → Google Stitch (telas detalhadas) → HTML/Figma.
94
+
95
+ ### Regras gerais
96
+
97
+ 1. **Seja específico.** Quando propões uma mecânica, indica qual módulo Funifier a implementa.
98
+ 2. **Seja prático.** Inclui exemplos de API, configuração ou código quando relevante.
99
+ 3. **Pergunta quando não sabes.** É melhor perguntar do que inventar.
100
+ 4. **Mantém o contexto.** Ao longo de uma conversa sobre um projeto, mantém consistência com as decisões anteriores.
101
+
102
+ ---
103
+
104
+ ## Referência rápida — Módulos mais usados
105
+
106
+ | Necessidade | Módulo | Ficheiro |
107
+ |------------|--------|----------|
108
+ | Cadastrar usuários | Player | `knowledge/modules/player.md` |
109
+ | Registar ações | Action + Action Log | `knowledge/modules/action.md` + `action-log.md` |
110
+ | Dar pontos | Point + Achievement | `knowledge/modules/point.md` + `achievement.md` |
111
+ | Criar desafios/missões | Challenge | `knowledge/modules/challenge.md` |
112
+ | Rankings | Leaderboard | `knowledge/modules/leaderboard.md` |
113
+ | Loja virtual | Virtual Good | `knowledge/modules/virtual-good.md` |
114
+ | Níveis | Level | `knowledge/modules/level.md` |
115
+ | Sorteios | Lottery | `knowledge/modules/lottery.md` |
116
+ | Prémios aleatórios | Mystery Box | `knowledge/modules/mystery.md` |
117
+ | Perguntas/Quizzes | Question + Quiz | `knowledge/modules/question.md` + `quiz.md` |
118
+ | Equipes | Team | `knowledge/modules/team.md` |
119
+ | Lógica customizada | Trigger | `knowledge/modules/trigger.md` + `knowledge/guides/triggers-guide.md` |
120
+ | Tarefas agendadas | Scheduler | `knowledge/modules/scheduler.md` |
121
+ | APIs customizadas | Public Endpoint | `knowledge/modules/public.md` |
122
+ | Dados customizados | Custom Object | `knowledge/modules/custom-object.md` |
123
+ | Consultas avançadas | Database + Aggregates | `knowledge/modules/database.md` + `knowledge/guides/aggregates.md` |
124
+
125
+ ---
126
+
127
+ ## API Base
128
+
129
+ - **URL Base:** `https://{ambiente}.funifier.com`
130
+ - **Autenticação:** Bearer token JWT via `/v3/auth`
131
+ - **Formato:** JSON
132
+ - **Documentação de cada endpoint:** ver ficheiro do módulo correspondente em `knowledge/modules/`
@@ -0,0 +1,15 @@
1
+ export interface Credentials {
2
+ apiKey: string;
3
+ secretKey: string;
4
+ serverUrl: string;
5
+ }
6
+ export interface ConfigInput {
7
+ projectDir: string;
8
+ bundlePath: string;
9
+ docsPath: string;
10
+ creds: Credentials;
11
+ }
12
+ export declare function renderCodexConfig({ projectDir, bundlePath, docsPath, creds }: ConfigInput): string;
13
+ export declare function renderOpencodeConfig({ bundlePath, docsPath, creds }: ConfigInput): string;
14
+ export declare function renderCursorConfig({ bundlePath, docsPath, creds }: ConfigInput): string;
15
+ //# sourceMappingURL=config-writers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-writers.d.ts","sourceRoot":"","sources":["../../src/cli/config-writers.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,WAAW,CAAC;CACpB;AAMD,wBAAgB,iBAAiB,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,WAAW,GAAG,MAAM,CAalG;AAED,wBAAgB,oBAAoB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,WAAW,GAAG,MAAM,CAmBzF;AAED,wBAAgB,kBAAkB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,WAAW,GAAG,MAAM,CAmBvF"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renderCodexConfig = renderCodexConfig;
4
+ exports.renderOpencodeConfig = renderOpencodeConfig;
5
+ exports.renderCursorConfig = renderCursorConfig;
6
+ function tomlString(v) {
7
+ return `"${v.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
8
+ }
9
+ function renderCodexConfig({ projectDir, bundlePath, docsPath, creds }) {
10
+ return `[mcp_servers.funifier]
11
+ command = "node"
12
+ args = [${tomlString(bundlePath)}]
13
+ cwd = ${tomlString(projectDir)}
14
+ enabled = true
15
+
16
+ [mcp_servers.funifier.env]
17
+ FUNIFIER_API_KEY = ${tomlString(creds.apiKey)}
18
+ FUNIFIER_SECRET_KEY = ${tomlString(creds.secretKey)}
19
+ FUNIFIER_SERVER_URL = ${tomlString(creds.serverUrl)}
20
+ FUNIFIER_DOCS_PATH = ${tomlString(docsPath)}
21
+ `;
22
+ }
23
+ function renderOpencodeConfig({ bundlePath, docsPath, creds }) {
24
+ return JSON.stringify({
25
+ mcp: {
26
+ funifier: {
27
+ type: "local",
28
+ command: ["node", bundlePath],
29
+ environment: {
30
+ FUNIFIER_API_KEY: creds.apiKey,
31
+ FUNIFIER_SECRET_KEY: creds.secretKey,
32
+ FUNIFIER_SERVER_URL: creds.serverUrl,
33
+ FUNIFIER_DOCS_PATH: docsPath,
34
+ },
35
+ },
36
+ },
37
+ }, null, 2);
38
+ }
39
+ function renderCursorConfig({ bundlePath, docsPath, creds }) {
40
+ return JSON.stringify({
41
+ mcpServers: {
42
+ funifier: {
43
+ command: "node",
44
+ args: [bundlePath],
45
+ env: {
46
+ FUNIFIER_API_KEY: creds.apiKey,
47
+ FUNIFIER_SECRET_KEY: creds.secretKey,
48
+ FUNIFIER_SERVER_URL: creds.serverUrl,
49
+ FUNIFIER_DOCS_PATH: docsPath,
50
+ },
51
+ },
52
+ },
53
+ }, null, 2);
54
+ }
55
+ //# sourceMappingURL=config-writers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-writers.js","sourceRoot":"","sources":["../../src/cli/config-writers.ts"],"names":[],"mappings":";;AAiBA,8CAaC;AAED,oDAmBC;AAED,gDAmBC;AA3DD,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;AAC9D,CAAC;AAED,SAAg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 -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=config-writers.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-writers.test.d.ts","sourceRoot":"","sources":["../../src/cli/config-writers.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
4
+ const config_writers_1 = require("./config-writers");
5
+ const creds = {
6
+ apiKey: "AK",
7
+ secretKey: "SK",
8
+ serverUrl: "https://acme.funifier.com",
9
+ };
10
+ const pkgRoot = "/pkg/root";
11
+ const projectDir = "/proj";
12
+ const bundlePath = "/pkg/root/dist/mcp/bundle.js";
13
+ const docsPath = "/pkg/root/datasource-funifier-docs/knowledge";
14
+ (0, vitest_1.describe)("renderCodexConfig", () => {
15
+ (0, vitest_1.it)("produces valid TOML with command, args, cwd, and env", () => {
16
+ const out = (0, config_writers_1.renderCodexConfig)({ projectDir, bundlePath, docsPath, creds });
17
+ (0, vitest_1.expect)(out).toContain("[mcp_servers.funifier]");
18
+ (0, vitest_1.expect)(out).toContain('command = "node"');
19
+ (0, vitest_1.expect)(out).toContain(`args = ["${bundlePath}"]`);
20
+ (0, vitest_1.expect)(out).toContain(`cwd = "${projectDir}"`);
21
+ (0, vitest_1.expect)(out).toContain("enabled = true");
22
+ (0, vitest_1.expect)(out).toContain("[mcp_servers.funifier.env]");
23
+ (0, vitest_1.expect)(out).toContain('FUNIFIER_API_KEY = "AK"');
24
+ (0, vitest_1.expect)(out).toContain('FUNIFIER_SECRET_KEY = "SK"');
25
+ (0, vitest_1.expect)(out).toContain('FUNIFIER_SERVER_URL = "https://acme.funifier.com"');
26
+ (0, vitest_1.expect)(out).toContain(`FUNIFIER_DOCS_PATH = "${docsPath}"`);
27
+ });
28
+ (0, vitest_1.it)("escapes double quotes in values", () => {
29
+ const out = (0, config_writers_1.renderCodexConfig)({
30
+ projectDir,
31
+ bundlePath,
32
+ docsPath,
33
+ creds: { ...creds, apiKey: 'has"quote' },
34
+ });
35
+ (0, vitest_1.expect)(out).toContain('FUNIFIER_API_KEY = "has\\"quote"');
36
+ });
37
+ });
38
+ (0, vitest_1.describe)("renderOpencodeConfig", () => {
39
+ (0, vitest_1.it)("produces valid JSON with mcp.funifier.command array and environment", () => {
40
+ const out = JSON.parse((0, config_writers_1.renderOpencodeConfig)({ projectDir, bundlePath, docsPath, creds }));
41
+ (0, vitest_1.expect)(out.mcp.funifier.type).toBe("local");
42
+ (0, vitest_1.expect)(out.mcp.funifier.command).toEqual(["node", bundlePath]);
43
+ (0, vitest_1.expect)(out.mcp.funifier.environment.FUNIFIER_API_KEY).toBe("AK");
44
+ (0, vitest_1.expect)(out.mcp.funifier.environment.FUNIFIER_DOCS_PATH).toBe(docsPath);
45
+ });
46
+ });
47
+ (0, vitest_1.describe)("renderCursorConfig", () => {
48
+ (0, vitest_1.it)("produces valid JSON with mcpServers.funifier.command/args/env", () => {
49
+ const out = JSON.parse((0, config_writers_1.renderCursorConfig)({ projectDir, bundlePath, docsPath, creds }));
50
+ (0, vitest_1.expect)(out.mcpServers.funifier.command).toBe("node");
51
+ (0, vitest_1.expect)(out.mcpServers.funifier.args).toEqual([bundlePath]);
52
+ (0, vitest_1.expect)(out.mcpServers.funifier.env.FUNIFIER_SECRET_KEY).toBe("SK");
53
+ });
54
+ });
55
+ //# sourceMappingURL=config-writers.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-writers.test.js","sourceRoot":"","sources":["../../src/cli/config-writers.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,qDAK0B;AAE1B,MAAM,KAAK,GAAgB;IACzB,MAAM,EAAE,IAAI;IACZ,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,2BAA2B;CACvC,CAAC;AAEF,MAAM,OAAO,GAAG,WAAW,CAAC;AAC5B,MAAM,UAAU,GAAG,OAAO,CAAC;AAC3B,MAAM,UAAU,GAAG,8BAA8B,CAAC;AACl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AAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrD,IAAA,eAAM,EAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;QAC3D,IAAA,eAAM,EAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type ConflictChoice = "overwrite" | "skip";
2
+ export type ConflictResolver = (destPath: string) => Promise<ConflictChoice>;
3
+ export type CopyResult = "written" | "skipped";
4
+ export declare function copyFile(src: string, dst: string, resolver: ConflictResolver): Promise<CopyResult>;
5
+ export declare function copyDir(src: string, dst: string, resolver: ConflictResolver): Promise<void>;
6
+ //# sourceMappingURL=copy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy.d.ts","sourceRoot":"","sources":["../../src/cli/copy.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,MAAM,CAAC;AAClD,MAAM,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;AAC7E,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;AAE/C,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,UAAU,CAAC,CAQrB;AAED,wBAAsB,OAAO,CAC3B,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,IAAI,CAAC,CAWf"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.copyFile = copyFile;
37
+ exports.copyDir = copyDir;
38
+ const fs = __importStar(require("fs"));
39
+ const path = __importStar(require("path"));
40
+ async function copyFile(src, dst, resolver) {
41
+ if (fs.existsSync(dst)) {
42
+ const choice = await resolver(dst);
43
+ if (choice === "skip")
44
+ return "skipped";
45
+ }
46
+ fs.mkdirSync(path.dirname(dst), { recursive: true });
47
+ fs.copyFileSync(src, dst);
48
+ return "written";
49
+ }
50
+ async function copyDir(src, dst, resolver) {
51
+ fs.mkdirSync(dst, { recursive: true });
52
+ for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
53
+ const srcPath = path.join(src, entry.name);
54
+ const dstPath = path.join(dst, entry.name);
55
+ if (entry.isDirectory()) {
56
+ await copyDir(srcPath, dstPath, resolver);
57
+ }
58
+ else {
59
+ await copyFile(srcPath, dstPath, resolver);
60
+ }
61
+ }
62
+ }
63
+ //# sourceMappingURL=copy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy.js","sourceRoot":"","sources":["../../src/cli/copy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,4BAYC;AAED,0BAeC;AApCD,uCAAyB;AACzB,2CAA6B;AAMtB,KAAK,UAAU,QAAQ,CAC5B,GAAW,EACX,GAAW,EACX,QAA0B;IAE1B,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,MAAM,KAAK,MAAM;YAAE,OAAO,SAAS,CAAC;IAC1C,CAAC;IACD,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC1B,OAAO,SAAS,CAAC;AACnB,CAAC;AAEM,KAAK,UAAU,OAAO,CAC3B,GAAW,EACX,GAAW,EACX,QAA0B;IAE1B,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACvC,KAAK,MAAM,KAAK,IAAI,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACjE,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,MAAM,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,MAAM,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=copy.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy.test.d.ts","sourceRoot":"","sources":["../../src/cli/copy.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const vitest_1 = require("vitest");
37
+ const fs = __importStar(require("fs"));
38
+ const os = __importStar(require("os"));
39
+ const path = __importStar(require("path"));
40
+ const copy_1 = require("./copy");
41
+ let tmp;
42
+ (0, vitest_1.beforeEach)(() => {
43
+ tmp = fs.mkdtempSync(path.join(os.tmpdir(), "funifier-copy-"));
44
+ });
45
+ (0, vitest_1.afterEach)(() => {
46
+ fs.rmSync(tmp, { recursive: true, force: true });
47
+ });
48
+ (0, vitest_1.describe)("copyFile", () => {
49
+ (0, vitest_1.it)("copies a new file without calling the resolver", async () => {
50
+ const src = path.join(tmp, "src.txt");
51
+ const dst = path.join(tmp, "dst.txt");
52
+ fs.writeFileSync(src, "hello");
53
+ const resolver = vitest_1.vi.fn();
54
+ const result = await (0, copy_1.copyFile)(src, dst, resolver);
55
+ (0, vitest_1.expect)(result).toBe("written");
56
+ (0, vitest_1.expect)(fs.readFileSync(dst, "utf-8")).toBe("hello");
57
+ (0, vitest_1.expect)(resolver).not.toHaveBeenCalled();
58
+ });
59
+ (0, vitest_1.it)("invokes resolver when destination exists and overwrites on 'overwrite'", async () => {
60
+ const src = path.join(tmp, "src.txt");
61
+ const dst = path.join(tmp, "dst.txt");
62
+ fs.writeFileSync(src, "new");
63
+ fs.writeFileSync(dst, "old");
64
+ const resolver = vitest_1.vi.fn(async () => "overwrite");
65
+ const result = await (0, copy_1.copyFile)(src, dst, resolver);
66
+ (0, vitest_1.expect)(result).toBe("written");
67
+ (0, vitest_1.expect)(fs.readFileSync(dst, "utf-8")).toBe("new");
68
+ (0, vitest_1.expect)(resolver).toHaveBeenCalledWith(dst);
69
+ });
70
+ (0, vitest_1.it)("skips when resolver returns 'skip'", async () => {
71
+ const src = path.join(tmp, "src.txt");
72
+ const dst = path.join(tmp, "dst.txt");
73
+ fs.writeFileSync(src, "new");
74
+ fs.writeFileSync(dst, "old");
75
+ const resolver = vitest_1.vi.fn(async () => "skip");
76
+ const result = await (0, copy_1.copyFile)(src, dst, resolver);
77
+ (0, vitest_1.expect)(result).toBe("skipped");
78
+ (0, vitest_1.expect)(fs.readFileSync(dst, "utf-8")).toBe("old");
79
+ });
80
+ });
81
+ (0, vitest_1.describe)("copyDir", () => {
82
+ (0, vitest_1.it)("recursively copies directories, creating missing parents", async () => {
83
+ const src = path.join(tmp, "src");
84
+ fs.mkdirSync(path.join(src, "nested"), { recursive: true });
85
+ fs.writeFileSync(path.join(src, "a.txt"), "A");
86
+ fs.writeFileSync(path.join(src, "nested", "b.txt"), "B");
87
+ const dst = path.join(tmp, "dst");
88
+ const resolver = vitest_1.vi.fn();
89
+ await (0, copy_1.copyDir)(src, dst, resolver);
90
+ (0, vitest_1.expect)(fs.readFileSync(path.join(dst, "a.txt"), "utf-8")).toBe("A");
91
+ (0, vitest_1.expect)(fs.readFileSync(path.join(dst, "nested", "b.txt"), "utf-8")).toBe("B");
92
+ });
93
+ });
94
+ //# sourceMappingURL=copy.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy.test.js","sourceRoot":"","sources":["../../src/cli/copy.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAyE;AACzE,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,iCAA2D;AAE3D,IAAI,GAAW,CAAC;AAEhB,IAAA,mBAAU,EAAC,GAAG,EAAE;IACd,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,gBAAgB,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC,CAAC;AAEH,IAAA,kBAAS,EAAC,GAAG,EAAE;IACb,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC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AE;QACxE,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAClC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC;QAC/C,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC;QACzD,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAClC,MAAM,QAAQ,GAAG,WAAE,CAAC,EAAE,EAAqC,CAAC;QAC5D,MAAM,IAAA,cAAO,EAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;QAClC,IAAA,eAAM,EAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpE,IAAA,eAAM,EAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export default function main(): Promise<void>;
2
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AAoHA,wBAA8B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CA+BlD"}
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.default = main;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ const paths_1 = require("./paths");
40
+ const copy_1 = require("./copy");
41
+ const prompts_1 = require("./prompts");
42
+ const PLACEHOLDER_CREDS = {
43
+ apiKey: "your-api-key",
44
+ secretKey: "your-secret-key",
45
+ serverUrl: "https://your-instance.funifier.com",
46
+ };
47
+ function validateProjectDir(projectDir) {
48
+ if (!fs.existsSync(path.join(projectDir, "package.json"))) {
49
+ console.error("❌ No package.json found in current directory.");
50
+ console.error(" Run `npm init -y` first, then try again.");
51
+ process.exit(1);
52
+ }
53
+ }
54
+ function requireTty() {
55
+ if (!process.stdout.isTTY || !process.stdin.isTTY) {
56
+ console.error("❌ funifier-mcp init requires an interactive terminal.");
57
+ console.error(" For CI, set FUNIFIER_API_KEY, FUNIFIER_SECRET_KEY, FUNIFIER_SERVER_URL");
58
+ console.error(" and configure MCP manually (see README).");
59
+ process.exit(1);
60
+ }
61
+ }
62
+ function makeConflictResolver() {
63
+ let overwriteAll = false;
64
+ return async (dest) => {
65
+ if (overwriteAll)
66
+ return "overwrite";
67
+ const choice = await (0, prompts_1.askConflict)(dest);
68
+ if (choice === "overwrite-all") {
69
+ overwriteAll = true;
70
+ return "overwrite";
71
+ }
72
+ return choice;
73
+ };
74
+ }
75
+ function writeFunifierJson(projectDir, creds) {
76
+ if (creds) {
77
+ const target = path.join(projectDir, "funifier.json");
78
+ fs.writeFileSync(target, JSON.stringify(creds, null, 2) + "\n");
79
+ console.log(` ✓ funifier.json`);
80
+ }
81
+ else {
82
+ const target = path.join(projectDir, "funifier.json.example");
83
+ fs.writeFileSync(target, JSON.stringify(PLACEHOLDER_CREDS, null, 2) + "\n");
84
+ console.log(` ✓ funifier.json.example (fill in before use)`);
85
+ }
86
+ }
87
+ function ensureGitignoreEntry(projectDir) {
88
+ const gitignore = path.join(projectDir, ".gitignore");
89
+ const entry = "funifier.json";
90
+ let content = "";
91
+ if (fs.existsSync(gitignore)) {
92
+ content = fs.readFileSync(gitignore, "utf-8");
93
+ const lines = content.split(/\r?\n/).map((l) => l.trim());
94
+ if (lines.includes(entry))
95
+ return;
96
+ }
97
+ const prefix = content && !content.endsWith("\n") ? "\n" : "";
98
+ fs.appendFileSync(gitignore, `${prefix}${entry}\n`);
99
+ console.log(` ✓ Added funifier.json to .gitignore`);
100
+ }
101
+ async function copyPlatformFiles(pkgRoot, projectDir, platforms, resolver) {
102
+ const seen = new Set();
103
+ for (const platform of platforms) {
104
+ for (const entry of platform.copies) {
105
+ if (seen.has(entry.dest))
106
+ continue;
107
+ seen.add(entry.dest);
108
+ const src = path.join(pkgRoot, entry.src);
109
+ const dst = path.join(projectDir, entry.dest);
110
+ if (!fs.existsSync(src)) {
111
+ console.log(` ⚠ ${entry.src} not found in package — skipping`);
112
+ continue;
113
+ }
114
+ if (entry.isDir) {
115
+ await (0, copy_1.copyDir)(src, dst, resolver);
116
+ console.log(` ✓ ${entry.dest}/`);
117
+ }
118
+ else {
119
+ const result = await (0, copy_1.copyFile)(src, dst, resolver);
120
+ console.log(` ${result === "written" ? "✓" : "–"} ${entry.dest}`);
121
+ }
122
+ }
123
+ }
124
+ }
125
+ function writePlatformConfigs(pkgRoot, projectDir, platforms, creds) {
126
+ const bundlePath = path.join(pkgRoot, "dist", "mcp", "bundle.js");
127
+ const docsPath = path.join(pkgRoot, "datasource-funifier-docs", "knowledge");
128
+ for (const platform of platforms) {
129
+ if (!platform.configFile)
130
+ continue;
131
+ const target = path.join(projectDir, platform.configFile.dest);
132
+ fs.mkdirSync(path.dirname(target), { recursive: true });
133
+ const content = platform.configFile.render({ projectDir, bundlePath, docsPath, creds });
134
+ fs.writeFileSync(target, content);
135
+ console.log(` ✓ ${platform.configFile.dest}`);
136
+ }
137
+ }
138
+ async function main() {
139
+ console.log("📦 Funifier MCP Setup\n");
140
+ const projectDir = process.cwd();
141
+ validateProjectDir(projectDir);
142
+ requireTty();
143
+ const pkgRoot = (0, paths_1.resolvePackageRoot)();
144
+ const platforms = await (0, prompts_1.selectPlatforms)();
145
+ const creds = await (0, prompts_1.askCredentials)();
146
+ console.log("");
147
+ const resolver = makeConflictResolver();
148
+ await copyPlatformFiles(pkgRoot, projectDir, platforms, resolver);
149
+ writeFunifierJson(projectDir, creds);
150
+ if (creds)
151
+ ensureGitignoreEntry(projectDir);
152
+ writePlatformConfigs(pkgRoot, projectDir, platforms, creds ?? PLACEHOLDER_CREDS);
153
+ console.log("\n✅ Setup complete.");
154
+ if (platforms.some((p) => p.key === "claude-code")) {
155
+ console.log(" Claude Code: type /funifier-help to start.");
156
+ }
157
+ if (platforms.some((p) => p.key === "antigravity")) {
158
+ const homeDir = process.env.USERPROFILE || process.env.HOME || "~";
159
+ const globalConfigPath = path.join(homeDir, ".gemini", "antigravity", "mcp_config.json");
160
+ console.log(` Antigravity: merge .antigravity/mcp_config.json into ${globalConfigPath}`);
161
+ console.log(" Or: Antigravity → Manage MCP Servers → View raw config → add the funifier block");
162
+ }
163
+ if (!creds) {
164
+ console.log(" ⚠ Fill in funifier.json.example and rename to funifier.json before using the MCP.");
165
+ }
166
+ }
167
+ //# sourceMappingURL=init.js.map