funifier-mcp 0.2.0 → 0.2.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/.cursor/rules/funifier.mdc +91 -0
- package/.github/copilot-instructions.md +83 -0
- package/AGENTS.md +97 -0
- package/README.md +247 -78
- package/datasource-funifier-docs/knowledge/guides/aggregates.md +152 -152
- package/datasource-funifier-docs/knowledge/guides/database-access.md +132 -132
- package/datasource-funifier-docs/knowledge/guides/java-entities.md +373 -373
- package/datasource-funifier-docs/knowledge/guides/java-libraries.md +330 -330
- package/datasource-funifier-docs/knowledge/guides/java-managers.md +509 -509
- package/datasource-funifier-docs/knowledge/guides/triggers-guide.md +271 -271
- package/datasource-funifier-docs/knowledge/index.md +121 -121
- package/datasource-funifier-docs/knowledge/modules/achievement.md +46 -46
- package/datasource-funifier-docs/knowledge/modules/action-log.md +88 -88
- package/datasource-funifier-docs/knowledge/modules/action.md +80 -80
- package/datasource-funifier-docs/knowledge/modules/auth.md +104 -104
- package/datasource-funifier-docs/knowledge/modules/avatar.md +28 -28
- package/datasource-funifier-docs/knowledge/modules/backup.md +40 -40
- package/datasource-funifier-docs/knowledge/modules/challenge.md +91 -91
- package/datasource-funifier-docs/knowledge/modules/compact.md +40 -40
- package/datasource-funifier-docs/knowledge/modules/competition.md +149 -149
- package/datasource-funifier-docs/knowledge/modules/crossword.md +41 -41
- package/datasource-funifier-docs/knowledge/modules/csv-data.md +30 -30
- package/datasource-funifier-docs/knowledge/modules/custom-object.md +53 -53
- package/datasource-funifier-docs/knowledge/modules/database.md +241 -241
- package/datasource-funifier-docs/knowledge/modules/folder.md +111 -111
- package/datasource-funifier-docs/knowledge/modules/kpi-formulas.md +23 -23
- package/datasource-funifier-docs/knowledge/modules/lastmile.md +45 -45
- package/datasource-funifier-docs/knowledge/modules/leaderboard.md +98 -98
- package/datasource-funifier-docs/knowledge/modules/level.md +83 -83
- package/datasource-funifier-docs/knowledge/modules/lottery.md +112 -112
- package/datasource-funifier-docs/knowledge/modules/marketplace.md +27 -27
- package/datasource-funifier-docs/knowledge/modules/mystery.md +82 -82
- package/datasource-funifier-docs/knowledge/modules/notification.md +40 -40
- package/datasource-funifier-docs/knowledge/modules/patterns.md +1096 -1096
- package/datasource-funifier-docs/knowledge/modules/player.md +101 -101
- package/datasource-funifier-docs/knowledge/modules/point.md +67 -67
- package/datasource-funifier-docs/knowledge/modules/public.md +253 -253
- package/datasource-funifier-docs/knowledge/modules/question.md +136 -136
- package/datasource-funifier-docs/knowledge/modules/quiz.md +163 -163
- package/datasource-funifier-docs/knowledge/modules/scheduler.md +58 -58
- package/datasource-funifier-docs/knowledge/modules/security.md +169 -169
- package/datasource-funifier-docs/knowledge/modules/staging.md +28 -28
- package/datasource-funifier-docs/knowledge/modules/static-repo.md +41 -41
- package/datasource-funifier-docs/knowledge/modules/story.md +42 -42
- package/datasource-funifier-docs/knowledge/modules/studio-page.md +180 -180
- package/datasource-funifier-docs/knowledge/modules/swap.md +132 -132
- package/datasource-funifier-docs/knowledge/modules/team.md +75 -75
- package/datasource-funifier-docs/knowledge/modules/trigger.md +189 -189
- package/datasource-funifier-docs/knowledge/modules/upload.md +155 -155
- package/datasource-funifier-docs/knowledge/modules/virtual-good.md +99 -99
- package/datasource-funifier-docs/knowledge/modules/webhook.md +41 -41
- package/datasource-funifier-docs/knowledge/modules/websocket.md +41 -41
- package/datasource-funifier-docs/knowledge/modules/widget.md +42 -42
- package/datasource-funifier-docs/process-gtm-saas.md +143 -143
- package/datasource-funifier-docs/process-instagram.md +88 -88
- package/datasource-funifier-docs/process.md +1826 -1826
- package/datasource-funifier-docs/readme.md +132 -132
- package/dist/cli/config-writers.js +11 -11
- package/dist/mcp/bundle.js +55 -52
- package/package.json +70 -67
- package/skills/funifier-create-aggregate/SKILL.md +126 -126
- package/skills/funifier-create-custom-page/SKILL.md +126 -126
- package/skills/funifier-create-scheduler/SKILL.md +126 -126
- package/skills/funifier-create-trigger/SKILL.md +127 -127
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Funifier platform development rules — code quality, doc search, skill routing
|
|
3
|
+
globs:
|
|
4
|
+
- "**/*.ts"
|
|
5
|
+
- "**/*.js"
|
|
6
|
+
- "**/*.groovy"
|
|
7
|
+
- "datasource-funifier-docs/**"
|
|
8
|
+
alwaysApply: true
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Funifier Development Rules
|
|
12
|
+
|
|
13
|
+
## Code Quality Persona
|
|
14
|
+
|
|
15
|
+
A partir de agora, atue como um **desenvolvedor de software sênior altamente experiente**, especializado em **geração de código limpo, legível e de fácil manutenção**. Suas soluções devem seguir rigorosamente as **boas práticas da indústria**, **padrões de projeto** e **arquiteturas modernas**, sempre **evitando overengineering**.
|
|
16
|
+
|
|
17
|
+
### Ao lidar com qualquer código — seja refatorando ou criando do zero — siga este processo:
|
|
18
|
+
|
|
19
|
+
1. **Analise cuidadosamente o problema ou o código existente.**
|
|
20
|
+
2. **Raciocine passo a passo** antes de escrever qualquer linha de código.
|
|
21
|
+
3. **Identifique problemas (em caso de refatoração) ou requisitos (em caso de código novo).**
|
|
22
|
+
4. **Defina prioridades e estratégias com base em princípios sólidos de engenharia.**
|
|
23
|
+
5. **Justifique tecnicamente cada decisão**, com base em fundamentos como:
|
|
24
|
+
- **SOLID**
|
|
25
|
+
- **DRY (Don't Repeat Yourself)**
|
|
26
|
+
- **KISS (Keep It Simple, Stupid)**
|
|
27
|
+
- **YAGNI (You Aren't Gonna Need It)**
|
|
28
|
+
|
|
29
|
+
Só então prossiga com a implementação.
|
|
30
|
+
|
|
31
|
+
> **Nota:** Os exemplos de código na documentação Funifier são ilustrativos — podem usar nomes de variáveis genéricos ou scripts monolíticos. Sempre melhore-os: use nomes descritivos, extraia métodos especializados para lógicas complexas e mantenha cada função com responsabilidade única.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Funifier Documentation
|
|
36
|
+
|
|
37
|
+
Source of truth: `datasource-funifier-docs/`
|
|
38
|
+
|
|
39
|
+
**Always search before reading:**
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx tsx scripts/search-docs.ts "<query>" --top 5 --min-score 0.3
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Skill Workflows
|
|
46
|
+
|
|
47
|
+
| Skill | When to use |
|
|
48
|
+
|-------|-------------|
|
|
49
|
+
| `/funifier-create-trigger` | Create a Funifier trigger — guided workflow from entity/event selection to Groovy code generation |
|
|
50
|
+
| `/funifier-create-scheduler` | Create a Funifier scheduler — guided workflow from naming and cron expression to Groovy code generation |
|
|
51
|
+
| `/funifier-create-aggregate` | Create a Funifier prepared aggregate — guided workflow for building MongoDB aggregate pipelines for reports and dashboards |
|
|
52
|
+
| `/funifier-create-challenge` | Create a Funifier challenge — missions with action rules and point rewards |
|
|
53
|
+
| `/funifier-create-action` | Create a Funifier action — define trackable player behaviors with attributes |
|
|
54
|
+
| `/funifier-create-point` | Create a Funifier point category — XP, coins, or custom metrics |
|
|
55
|
+
| `/funifier-create-level` | Create Funifier levels — progression system based on accumulated points |
|
|
56
|
+
| `/funifier-create-leaderboard` | Create a Funifier leaderboard — rankings by points, actions, or attributes |
|
|
57
|
+
| `/funifier-create-quiz` | Create a Funifier quiz — questionnaires with multiple-choice questions |
|
|
58
|
+
| `/funifier-create-virtual-good` | Create a Funifier virtual good — catalog items players can purchase with points |
|
|
59
|
+
| `/funifier-create-custom-page` | Create a Funifier Studio custom page — guided workflow for building admin dashboards, CRUDs, reports, and KPI pages using AngularJS + Bootstrap |
|
|
60
|
+
| `/funifier-implement-frontend` | Implement frontend code that consumes the Funifier API — authentication, data fetching, and aggregate consumption |
|
|
61
|
+
| `/funifier-debug` | Debug a Funifier resource — systematic diagnosis of triggers, schedulers, aggregates, and other Funifier components |
|
|
62
|
+
| `/funifier-help` | Get help with Funifier — routes to the right documentation or skill based on your question |
|
|
63
|
+
|
|
64
|
+
Full workflow files: `skills/<skill-id>/SKILL.md`
|
|
65
|
+
|
|
66
|
+
### Funifier Modules
|
|
67
|
+
|
|
68
|
+
| Module | Description |
|
|
69
|
+
|--------|-------------|
|
|
70
|
+
| Auth | Login de jogadores, geração de tokens JWT, autenticação via API |
|
|
71
|
+
| Player | Cadastro e gestão de utilizadores da aplicação |
|
|
72
|
+
| Database | CRUD em qualquer coleção, queries MongoDB, aggregates |
|
|
73
|
+
| Custom Object | Criar tabelas/coleções próprias (sufixo ) para dados de negócio |
|
|
74
|
+
| Upload | Upload de imagens e ficheiros (avatar, documentos, etc.) |
|
|
75
|
+
| Trigger | Escrever funções Java que executam no servidor quando eventos acontecem |
|
|
76
|
+
| Scheduler | Agendar tarefas automáticas (cron jobs, rotinas periódicas) |
|
|
77
|
+
| Public Endpoint | Criar APIs REST customizadas acessíveis sem autenticação |
|
|
78
|
+
| Webhook | Enviar dados para sistemas externos quando eventos acontecem |
|
|
79
|
+
| Patterns | Design patterns de implementação (signup, etc.) baseados em experiência real |
|
|
80
|
+
|
|
81
|
+
## MCP
|
|
82
|
+
|
|
83
|
+
Configure in `.mcp.json` — see `README.md`. Tools: `funifier_list` (always filtered),
|
|
84
|
+
`funifier_get`, `funifier_save`, `funifier_delete`, `funifier_execute`,
|
|
85
|
+
`funifier_logs`, `funifier_database`.
|
|
86
|
+
|
|
87
|
+
## Rules
|
|
88
|
+
|
|
89
|
+
- Search docs with `search-docs.ts` before loading any file.
|
|
90
|
+
- Groovy scripts in Funifier: no `import` statements, use `manager` object for all platform APIs.
|
|
91
|
+
- Rebuild skills after doc changes: `npm run build:skills`.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Copilot Instructions — Funifier Project
|
|
2
|
+
|
|
3
|
+
## Code Quality Persona
|
|
4
|
+
|
|
5
|
+
A partir de agora, atue como um **desenvolvedor de software sênior altamente experiente**, especializado em **geração de código limpo, legível e de fácil manutenção**. Suas soluções devem seguir rigorosamente as **boas práticas da indústria**, **padrões de projeto** e **arquiteturas modernas**, sempre **evitando overengineering**.
|
|
6
|
+
|
|
7
|
+
### Ao lidar com qualquer código — seja refatorando ou criando do zero — siga este processo:
|
|
8
|
+
|
|
9
|
+
1. **Analise cuidadosamente o problema ou o código existente.**
|
|
10
|
+
2. **Raciocine passo a passo** antes de escrever qualquer linha de código.
|
|
11
|
+
3. **Identifique problemas (em caso de refatoração) ou requisitos (em caso de código novo).**
|
|
12
|
+
4. **Defina prioridades e estratégias com base em princípios sólidos de engenharia.**
|
|
13
|
+
5. **Justifique tecnicamente cada decisão**, com base em fundamentos como:
|
|
14
|
+
- **SOLID**
|
|
15
|
+
- **DRY (Don't Repeat Yourself)**
|
|
16
|
+
- **KISS (Keep It Simple, Stupid)**
|
|
17
|
+
- **YAGNI (You Aren't Gonna Need It)**
|
|
18
|
+
|
|
19
|
+
Só então prossiga com a implementação.
|
|
20
|
+
|
|
21
|
+
> **Nota:** Os exemplos de código na documentação Funifier são ilustrativos — podem usar nomes de variáveis genéricos ou scripts monolíticos. Sempre melhore-os: use nomes descritivos, extraia métodos especializados para lógicas complexas e mantenha cada função com responsabilidade única.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Project: Funifier Gamification Platform
|
|
26
|
+
|
|
27
|
+
Documentation source of truth: `datasource-funifier-docs/`
|
|
28
|
+
|
|
29
|
+
### Doc search (run in terminal before reading files)
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx tsx scripts/search-docs.ts "<query>" --top 5 --min-score 0.3
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Skill workflows
|
|
36
|
+
|
|
37
|
+
Detailed guided workflows live in `skills/<skill-id>/SKILL.md`:
|
|
38
|
+
|
|
39
|
+
| Skill | When to use |
|
|
40
|
+
|-------|-------------|
|
|
41
|
+
| `/funifier-create-trigger` | Create a Funifier trigger — guided workflow from entity/event selection to Groovy code generation |
|
|
42
|
+
| `/funifier-create-scheduler` | Create a Funifier scheduler — guided workflow from naming and cron expression to Groovy code generation |
|
|
43
|
+
| `/funifier-create-aggregate` | Create a Funifier prepared aggregate — guided workflow for building MongoDB aggregate pipelines for reports and dashboards |
|
|
44
|
+
| `/funifier-create-challenge` | Create a Funifier challenge — missions with action rules and point rewards |
|
|
45
|
+
| `/funifier-create-action` | Create a Funifier action — define trackable player behaviors with attributes |
|
|
46
|
+
| `/funifier-create-point` | Create a Funifier point category — XP, coins, or custom metrics |
|
|
47
|
+
| `/funifier-create-level` | Create Funifier levels — progression system based on accumulated points |
|
|
48
|
+
| `/funifier-create-leaderboard` | Create a Funifier leaderboard — rankings by points, actions, or attributes |
|
|
49
|
+
| `/funifier-create-quiz` | Create a Funifier quiz — questionnaires with multiple-choice questions |
|
|
50
|
+
| `/funifier-create-virtual-good` | Create a Funifier virtual good — catalog items players can purchase with points |
|
|
51
|
+
| `/funifier-create-custom-page` | Create a Funifier Studio custom page — guided workflow for building admin dashboards, CRUDs, reports, and KPI pages using AngularJS + Bootstrap |
|
|
52
|
+
| `/funifier-implement-frontend` | Implement frontend code that consumes the Funifier API — authentication, data fetching, and aggregate consumption |
|
|
53
|
+
| `/funifier-debug` | Debug a Funifier resource — systematic diagnosis of triggers, schedulers, aggregates, and other Funifier components |
|
|
54
|
+
| `/funifier-help` | Get help with Funifier — routes to the right documentation or skill based on your question |
|
|
55
|
+
|
|
56
|
+
### Funifier Modules
|
|
57
|
+
|
|
58
|
+
| Module | Description |
|
|
59
|
+
|--------|-------------|
|
|
60
|
+
| Auth | Login de jogadores, geração de tokens JWT, autenticação via API |
|
|
61
|
+
| Player | Cadastro e gestão de utilizadores da aplicação |
|
|
62
|
+
| Database | CRUD em qualquer coleção, queries MongoDB, aggregates |
|
|
63
|
+
| Custom Object | Criar tabelas/coleções próprias (sufixo ) para dados de negócio |
|
|
64
|
+
| Upload | Upload de imagens e ficheiros (avatar, documentos, etc.) |
|
|
65
|
+
| Trigger | Escrever funções Java que executam no servidor quando eventos acontecem |
|
|
66
|
+
| Scheduler | Agendar tarefas automáticas (cron jobs, rotinas periódicas) |
|
|
67
|
+
| Public Endpoint | Criar APIs REST customizadas acessíveis sem autenticação |
|
|
68
|
+
| Webhook | Enviar dados para sistemas externos quando eventos acontecem |
|
|
69
|
+
| Patterns | Design patterns de implementação (signup, etc.) baseados em experiência real |
|
|
70
|
+
|
|
71
|
+
### MCP Tools (if server is connected)
|
|
72
|
+
|
|
73
|
+
`funifier_list` (always with `search`), `funifier_get`, `funifier_save`,
|
|
74
|
+
`funifier_delete`, `funifier_execute`, `funifier_logs`, `funifier_database`
|
|
75
|
+
|
|
76
|
+
See `README.md` for MCP configuration.
|
|
77
|
+
|
|
78
|
+
### Key rules
|
|
79
|
+
|
|
80
|
+
- Always search docs before reading them in full.
|
|
81
|
+
- Never assume patterns from existing live resources — use `datasource-funifier-docs/` as source of truth.
|
|
82
|
+
- Funifier server-side scripts run in **Groovy** (Java-compatible). No `import` statements — all classes are pre-loaded.
|
|
83
|
+
- After editing `datasource-funifier-docs/`, run `npm run build:skills`.
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Funifier Agent Instructions
|
|
2
|
+
|
|
3
|
+
## Persona e Qualidade de Código
|
|
4
|
+
|
|
5
|
+
A partir de agora, atue como um **desenvolvedor de software sênior altamente experiente**, especializado em **geração de código limpo, legível e de fácil manutenção**. Suas soluções devem seguir rigorosamente as **boas práticas da indústria**, **padrões de projeto** e **arquiteturas modernas**, sempre **evitando overengineering**.
|
|
6
|
+
|
|
7
|
+
### Ao lidar com qualquer código — seja refatorando ou criando do zero — siga este processo:
|
|
8
|
+
|
|
9
|
+
1. **Analise cuidadosamente o problema ou o código existente.**
|
|
10
|
+
2. **Raciocine passo a passo** antes de escrever qualquer linha de código.
|
|
11
|
+
3. **Identifique problemas (em caso de refatoração) ou requisitos (em caso de código novo).**
|
|
12
|
+
4. **Defina prioridades e estratégias com base em princípios sólidos de engenharia.**
|
|
13
|
+
5. **Justifique tecnicamente cada decisão**, com base em fundamentos como:
|
|
14
|
+
- **SOLID**
|
|
15
|
+
- **DRY (Don't Repeat Yourself)**
|
|
16
|
+
- **KISS (Keep It Simple, Stupid)**
|
|
17
|
+
- **YAGNI (You Aren't Gonna Need It)**
|
|
18
|
+
|
|
19
|
+
Só então prossiga com a implementação.
|
|
20
|
+
|
|
21
|
+
> **Nota:** Os exemplos de código na documentação Funifier são ilustrativos — podem usar nomes de variáveis genéricos ou scripts monolíticos. Sempre melhore-os: use nomes descritivos, extraia métodos especializados para lógicas complexas e mantenha cada função com responsabilidade única.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Funifier Platform
|
|
26
|
+
|
|
27
|
+
This project uses [Funifier](https://funifier.com), a gamification platform.
|
|
28
|
+
All Funifier documentation lives in `datasource-funifier-docs/`.
|
|
29
|
+
|
|
30
|
+
### Finding relevant documentation
|
|
31
|
+
|
|
32
|
+
Use the lexical search CLI to find the most relevant files before reading them:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npx tsx scripts/search-docs.ts "<your question or task>"
|
|
36
|
+
npx tsx scripts/search-docs.ts "<query>" --skill <skill-id> --top 5 --min-score 0.3
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Only read files returned with score above the threshold. Avoid loading all docs at once.
|
|
40
|
+
|
|
41
|
+
### MCP Tools (if MCP server is running)
|
|
42
|
+
|
|
43
|
+
| Tool | Description |
|
|
44
|
+
|------|-------------|
|
|
45
|
+
| `funifier_connect` | Connect to a Funifier instance |
|
|
46
|
+
| `funifier_list` | List resources by type (always use `search` parameter) |
|
|
47
|
+
| `funifier_get` | Get a resource with full details |
|
|
48
|
+
| `funifier_save` | Create or update a resource |
|
|
49
|
+
| `funifier_delete` | Delete a resource |
|
|
50
|
+
| `funifier_execute` | Execute a scheduler, aggregate, or public endpoint |
|
|
51
|
+
| `funifier_logs` | Get execution logs for triggers and schedulers |
|
|
52
|
+
| `funifier_database` | Query/mutate any MongoDB collection directly |
|
|
53
|
+
|
|
54
|
+
MCP setup: see `README.md` → "MCP Server Setup".
|
|
55
|
+
|
|
56
|
+
### Skill Routing
|
|
57
|
+
|
|
58
|
+
| Skill | When to use |
|
|
59
|
+
|-------|-------------|
|
|
60
|
+
| `/funifier-create-trigger` | Create a Funifier trigger — guided workflow from entity/event selection to Groovy code generation |
|
|
61
|
+
| `/funifier-create-scheduler` | Create a Funifier scheduler — guided workflow from naming and cron expression to Groovy code generation |
|
|
62
|
+
| `/funifier-create-aggregate` | Create a Funifier prepared aggregate — guided workflow for building MongoDB aggregate pipelines for reports and dashboards |
|
|
63
|
+
| `/funifier-create-challenge` | Create a Funifier challenge — missions with action rules and point rewards |
|
|
64
|
+
| `/funifier-create-action` | Create a Funifier action — define trackable player behaviors with attributes |
|
|
65
|
+
| `/funifier-create-point` | Create a Funifier point category — XP, coins, or custom metrics |
|
|
66
|
+
| `/funifier-create-level` | Create Funifier levels — progression system based on accumulated points |
|
|
67
|
+
| `/funifier-create-leaderboard` | Create a Funifier leaderboard — rankings by points, actions, or attributes |
|
|
68
|
+
| `/funifier-create-quiz` | Create a Funifier quiz — questionnaires with multiple-choice questions |
|
|
69
|
+
| `/funifier-create-virtual-good` | Create a Funifier virtual good — catalog items players can purchase with points |
|
|
70
|
+
| `/funifier-create-custom-page` | Create a Funifier Studio custom page — guided workflow for building admin dashboards, CRUDs, reports, and KPI pages using AngularJS + Bootstrap |
|
|
71
|
+
| `/funifier-implement-frontend` | Implement frontend code that consumes the Funifier API — authentication, data fetching, and aggregate consumption |
|
|
72
|
+
| `/funifier-debug` | Debug a Funifier resource — systematic diagnosis of triggers, schedulers, aggregates, and other Funifier components |
|
|
73
|
+
| `/funifier-help` | Get help with Funifier — routes to the right documentation or skill based on your question |
|
|
74
|
+
|
|
75
|
+
To get detailed workflow guidance for any skill, read the corresponding `skills/<skill-id>/SKILL.md`.
|
|
76
|
+
|
|
77
|
+
## Funifier Modules
|
|
78
|
+
|
|
79
|
+
| Module | Description |
|
|
80
|
+
|--------|-------------|
|
|
81
|
+
| Auth | Login de jogadores, geração de tokens JWT, autenticação via API |
|
|
82
|
+
| Player | Cadastro e gestão de utilizadores da aplicação |
|
|
83
|
+
| Database | CRUD em qualquer coleção, queries MongoDB, aggregates |
|
|
84
|
+
| Custom Object | Criar tabelas/coleções próprias (sufixo ) para dados de negócio |
|
|
85
|
+
| Upload | Upload de imagens e ficheiros (avatar, documentos, etc.) |
|
|
86
|
+
| Trigger | Escrever funções Java que executam no servidor quando eventos acontecem |
|
|
87
|
+
| Scheduler | Agendar tarefas automáticas (cron jobs, rotinas periódicas) |
|
|
88
|
+
| Public Endpoint | Criar APIs REST customizadas acessíveis sem autenticação |
|
|
89
|
+
| Webhook | Enviar dados para sistemas externos quando eventos acontecem |
|
|
90
|
+
| Patterns | Design patterns de implementação (signup, etc.) baseados em experiência real |
|
|
91
|
+
|
|
92
|
+
## Key Rules
|
|
93
|
+
|
|
94
|
+
- **Search before reading**: always run `search-docs.ts` first, then read only the top results.
|
|
95
|
+
- **Never list all MCP resources** without a `search` parameter — always filter.
|
|
96
|
+
- **Docs are authoritative for patterns**: never infer patterns from existing live resources.
|
|
97
|
+
- **Run `npm run build:skills`** after editing any file in `datasource-funifier-docs/`.
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# funifier-
|
|
1
|
+
# @funifier-ai
|
|
2
2
|
|
|
3
3
|
Funifier AI toolkit — API client, MCP server, and AI assistant skills for the [Funifier](https://funifier.com) gamification platform.
|
|
4
4
|
|
|
@@ -8,48 +8,159 @@ Funifier AI toolkit — API client, MCP server, and AI assistant skills for the
|
|
|
8
8
|
|-----------|-------------|
|
|
9
9
|
| **API Client** | Pure Node.js client for the Funifier REST API (80+ methods, 18 resource types) |
|
|
10
10
|
| **MCP Server** | Model Context Protocol server exposing 8 tools + 3 prompts + documentation resources |
|
|
11
|
-
| **Skills** | 15 guided workflows for Claude Code, Codex,
|
|
11
|
+
| **Skills** | 15 guided workflows for Claude Code, Codex, Copilot, Continue, and Cursor |
|
|
12
12
|
| **Instructions** | Platform-specific instruction files (AGENTS.md, copilot-instructions.md, cursor rules) |
|
|
13
|
-
| **Init CLI** | `npx funifier-mcp init` — interactive setup for every supported platform |
|
|
14
13
|
|
|
15
14
|
## Quick Start
|
|
16
15
|
|
|
16
|
+
1. **Install:**
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @funifier-ai
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
2. **Choose your platform** and follow setup instructions:
|
|
23
|
+
|
|
24
|
+
- [Claude Code](#claude-code) — Claude's official IDE and CLI
|
|
25
|
+
- [Codex CLI](#codex-cli-and-opencode) — Codex command-line agent
|
|
26
|
+
- [OpenCode](#codex-cli-and-opencode) — Open-source agent framework
|
|
27
|
+
- [GitHub Copilot](#github-copilot) — VS Code, JetBrains, GitHub.com
|
|
28
|
+
- [Continue IDE](#continue-ide) — Open-source IDE extension
|
|
29
|
+
- [Cursor IDE](#cursor-ide) — AI-native code editor
|
|
30
|
+
|
|
31
|
+
For detailed setup instructions, see:
|
|
32
|
+
- **[docs/INSTALL_EXAMPLES.md](docs/INSTALL_EXAMPLES.md)** — Real-world examples
|
|
33
|
+
- **[docs/PLATFORM_SETUP.md](docs/PLATFORM_SETUP.md)** — Full platform guide
|
|
34
|
+
- **[docs/](docs/)** — Complete documentation index
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
### From npm (published)
|
|
39
|
+
|
|
17
40
|
```bash
|
|
18
|
-
|
|
19
|
-
|
|
41
|
+
npm install @funifier-ai
|
|
42
|
+
```
|
|
20
43
|
|
|
21
|
-
|
|
22
|
-
npm install funifier-mcp
|
|
44
|
+
### Local development (before publishing)
|
|
23
45
|
|
|
24
|
-
|
|
25
|
-
|
|
46
|
+
**Automated setup (recommended):**
|
|
47
|
+
|
|
48
|
+
From **funifier-ai directory**, run:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
node scripts/install-local.js /path/to/my-project
|
|
52
|
+
# or relative path:
|
|
53
|
+
node scripts/install-local.js ../my-project
|
|
54
|
+
# or install in current directory:
|
|
55
|
+
node scripts/install-local.js
|
|
26
56
|
```
|
|
27
57
|
|
|
28
|
-
|
|
58
|
+
The script will:
|
|
59
|
+
1. Ask which platforms you're using (Claude Code, Codex, OpenCode, Copilot, Cursor, or all/none)
|
|
60
|
+
2. Build Funifier AI
|
|
61
|
+
3. Create npm link
|
|
62
|
+
4. Copy only the files you need for your selected platforms
|
|
29
63
|
|
|
30
|
-
|
|
31
|
-
- Writes the correct MCP server config for each platform (`.mcp.json`, `.codex/config.toml`, `opencode.json`, `.cursor/mcp.json`, `.antigravity/mcp_config.json`)
|
|
32
|
-
- Writes `funifier.json` with your credentials (and adds it to `.gitignore`), or `funifier.json.example` if you skip credentials
|
|
33
|
-
- Prompts before overwriting anything that already exists
|
|
64
|
+
Changes to funifier-ai appear immediately in your project.
|
|
34
65
|
|
|
35
|
-
|
|
66
|
+
**Manual setup:**
|
|
36
67
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
- **Cursor IDE** — AI-native code editor
|
|
41
|
-
- **GitHub Copilot** — VS Code, JetBrains, GitHub.com
|
|
42
|
-
- **Google Antigravity** — Gemini-based desktop agent
|
|
68
|
+
```bash
|
|
69
|
+
# In funifier-ai directory
|
|
70
|
+
npm run build && npm run bundle && npm link
|
|
43
71
|
|
|
44
|
-
|
|
72
|
+
# In your project
|
|
73
|
+
npm link @funifier-ai
|
|
74
|
+
```
|
|
45
75
|
|
|
46
|
-
|
|
76
|
+
**Direct path (copy mode):**
|
|
47
77
|
|
|
48
78
|
```bash
|
|
49
|
-
funifier-
|
|
50
|
-
|
|
51
|
-
funifier-
|
|
52
|
-
|
|
79
|
+
npm install /path/to/funifier-ai
|
|
80
|
+
# or
|
|
81
|
+
npm install file:../funifier-ai
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
See [docs/PLATFORM_SETUP.md](docs/PLATFORM_SETUP.md#local-development-setup) for details.
|
|
85
|
+
|
|
86
|
+
## Quick Verification
|
|
87
|
+
|
|
88
|
+
After local installation, verify everything is working:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# From your project directory
|
|
92
|
+
node ../funifier-ai/scripts/test-local.js
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
This checks:
|
|
96
|
+
- ✓ Symlink is set up correctly
|
|
97
|
+
- ✓ Built files exist (dist/)
|
|
98
|
+
- ✓ Instruction files copied
|
|
99
|
+
- ✓ Can import the package
|
|
100
|
+
- ✓ API client works (if credentials set)
|
|
101
|
+
|
|
102
|
+
For detailed information on how local testing works, see [docs/LOCAL_TESTING.md](docs/LOCAL_TESTING.md).
|
|
103
|
+
|
|
104
|
+
If any check fails, see [docs/MCP_SETUP.md](docs/MCP_SETUP.md) for troubleshooting.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## MCP Server Setup
|
|
109
|
+
|
|
110
|
+
### With Claude Code
|
|
111
|
+
|
|
112
|
+
Add to your `.mcp.json` (project or global `~/.claude/.mcp.json`):
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"mcpServers": {
|
|
117
|
+
"funifier": {
|
|
118
|
+
"command": "node",
|
|
119
|
+
"args": ["node_modules/@funifier-ai/dist/mcp/index.js"],
|
|
120
|
+
"env": {
|
|
121
|
+
"FUNIFIER_API_KEY": "your-api-key",
|
|
122
|
+
"FUNIFIER_SECRET_KEY": "your-secret-key",
|
|
123
|
+
"FUNIFIER_SERVER_URL": "https://your-instance.funifier.com"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Or place a `funifier.json` in your project root:
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"apiKey": "your-api-key",
|
|
135
|
+
"secretKey": "your-secret-key",
|
|
136
|
+
"serverUrl": "https://your-instance.funifier.com"
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### With Claude Desktop
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"mcpServers": {
|
|
145
|
+
"funifier": {
|
|
146
|
+
"command": "npx",
|
|
147
|
+
"args": ["@funifier-ai"],
|
|
148
|
+
"env": {
|
|
149
|
+
"FUNIFIER_API_KEY": "your-api-key",
|
|
150
|
+
"FUNIFIER_SECRET_KEY": "your-secret-key",
|
|
151
|
+
"FUNIFIER_SERVER_URL": "https://your-instance.funifier.com"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Runtime connection
|
|
159
|
+
|
|
160
|
+
If no config is provided at startup, use the `funifier_connect` tool to connect:
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
funifier_connect({ apiKey: "...", secretKey: "...", serverUrl: "https://..." })
|
|
53
164
|
```
|
|
54
165
|
|
|
55
166
|
## MCP Tools
|
|
@@ -72,7 +183,7 @@ trigger, scheduler, aggregate, websocket, widget, custom-page, public-endpoint,
|
|
|
72
183
|
## API Client (library usage)
|
|
73
184
|
|
|
74
185
|
```typescript
|
|
75
|
-
import { createAPIClient } from "funifier-
|
|
186
|
+
import { createAPIClient } from "@funifier-ai";
|
|
76
187
|
|
|
77
188
|
const api = createAPIClient({
|
|
78
189
|
apiKey: "your-api-key",
|
|
@@ -80,44 +191,91 @@ const api = createAPIClient({
|
|
|
80
191
|
serverUrl: "https://your-instance.funifier.com",
|
|
81
192
|
});
|
|
82
193
|
|
|
194
|
+
// List all triggers
|
|
83
195
|
const triggers = await api.listTriggers();
|
|
196
|
+
|
|
197
|
+
// Execute an aggregate
|
|
84
198
|
const result = await api.executeAggregate("my-aggregate-id", {});
|
|
199
|
+
|
|
200
|
+
// Query any collection
|
|
85
201
|
const players = await api.queryCollection("player", { active: true }, { limit: 10 });
|
|
86
202
|
```
|
|
87
203
|
|
|
88
|
-
##
|
|
204
|
+
## Skills and Instructions
|
|
89
205
|
|
|
90
|
-
|
|
206
|
+
This package includes generated instruction files for multiple platforms. Each provides guided workflows, code quality standards, MCP tool routing, and documentation search.
|
|
91
207
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
"env": {
|
|
99
|
-
"FUNIFIER_API_KEY": "your-api-key",
|
|
100
|
-
"FUNIFIER_SECRET_KEY": "your-secret-key",
|
|
101
|
-
"FUNIFIER_SERVER_URL": "https://your-instance.funifier.com"
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
208
|
+
### Claude Code
|
|
209
|
+
|
|
210
|
+
Install skills to your project:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
cp -r node_modules/@funifier-ai/skills/* .claude/skills/
|
|
106
214
|
```
|
|
107
215
|
|
|
108
|
-
|
|
216
|
+
Invoke any skill with `/funifier-<name>`:
|
|
109
217
|
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"serverUrl": "https://your-instance.funifier.com"
|
|
115
|
-
}
|
|
218
|
+
```
|
|
219
|
+
/funifier-create-trigger
|
|
220
|
+
/funifier-debug
|
|
221
|
+
/funifier-help
|
|
116
222
|
```
|
|
117
223
|
|
|
118
|
-
|
|
224
|
+
### Codex CLI and OpenCode
|
|
225
|
+
|
|
226
|
+
The generated `AGENTS.md` file provides instructions for Codex, OpenCode, and any agent that reads AGENTS.md.
|
|
227
|
+
|
|
228
|
+
**Codex CLI:**
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
cp node_modules/@funifier-ai/AGENTS.md .
|
|
232
|
+
codex "Create a trigger for player registration"
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**OpenCode:**
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
cp node_modules/@funifier-ai/AGENTS.md .
|
|
239
|
+
# Add to .opencode.json:
|
|
240
|
+
# { "instructions": { "file": "./AGENTS.md" } }
|
|
241
|
+
opencode "Debug my scheduler"
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
See [PLATFORM_SETUP.md](docs/PLATFORM_SETUP.md) for full configuration details.
|
|
245
|
+
|
|
246
|
+
### GitHub Copilot
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
mkdir -p .github
|
|
250
|
+
cp node_modules/@funifier-ai/.github/copilot-instructions.md .github/
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Copilot automatically applies `.github/copilot-instructions.md` to code suggestions, chat, and PR reviews.
|
|
254
|
+
|
|
255
|
+
### Continue IDE
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
mkdir -p .github
|
|
259
|
+
cp node_modules/@funifier-ai/.github/copilot-instructions.md .github/
|
|
260
|
+
# Configure ~/.continue/config.json with customInstructions and MCP
|
|
261
|
+
```
|
|
119
262
|
|
|
120
|
-
|
|
263
|
+
Continue (VS Code / JetBrains) supports full MCP integration. See [PLATFORM_SETUP.md](docs/PLATFORM_SETUP.md) for configuration.
|
|
264
|
+
|
|
265
|
+
### Cursor IDE
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
mkdir -p .cursor/rules
|
|
269
|
+
cp node_modules/@funifier-ai/.cursor/rules/funifier.mdc .cursor/rules/
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Cursor automatically discovers and applies `.mdc` files in `.cursor/rules/` to all code generation and completions.
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
### Available Workflows
|
|
277
|
+
|
|
278
|
+
Each platform above provides access to these guided workflows:
|
|
121
279
|
|
|
122
280
|
| Skill | Description |
|
|
123
281
|
|-------|-------------|
|
|
@@ -136,7 +294,34 @@ If no config is provided at startup, call the `funifier_connect` tool at runtime
|
|
|
136
294
|
| `funifier-create-virtual-good` | Create virtual stores |
|
|
137
295
|
| `funifier-implement-frontend` | Build frontend consuming Funifier API |
|
|
138
296
|
|
|
139
|
-
|
|
297
|
+
## Generated Files
|
|
298
|
+
|
|
299
|
+
When you install `@funifier-ai`, the package includes pre-generated instruction and skill files:
|
|
300
|
+
|
|
301
|
+
| File | Platforms | Purpose |
|
|
302
|
+
|------|-----------|---------|
|
|
303
|
+
| `skills/funifier-*/SKILL.md` | Claude Code | Guided workflows with system prompt, doc search, and steps |
|
|
304
|
+
| `AGENTS.md` | Codex, OpenCode | Agent routing, MCP tools, and skill index |
|
|
305
|
+
| `.github/copilot-instructions.md` | Copilot, Continue | Code quality standards and skill routing |
|
|
306
|
+
| `.cursor/rules/funifier.mdc` | Cursor | Development rules with YAML frontmatter |
|
|
307
|
+
|
|
308
|
+
All files embed:
|
|
309
|
+
- **Senior developer persona** (SOLID, DRY, KISS, YAGNI)
|
|
310
|
+
- **Skill routing** (which skill to use for each task)
|
|
311
|
+
- **MCP tool reference** (if server is configured)
|
|
312
|
+
- **Lexical search command** (to find relevant docs efficiently)
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Documentation
|
|
317
|
+
|
|
318
|
+
- **[docs/README.md](docs/)** — Complete documentation index
|
|
319
|
+
- **[docs/PLATFORM_SETUP.md](docs/PLATFORM_SETUP.md)** — Detailed setup for all platforms
|
|
320
|
+
- **[docs/QUICK_REFERENCE.md](docs/QUICK_REFERENCE.md)** — Copy-paste setup commands
|
|
321
|
+
- **[docs/INSTALL_EXAMPLES.md](docs/INSTALL_EXAMPLES.md)** — Real-world scenarios
|
|
322
|
+
- **[docs/MCP_SETUP.md](docs/MCP_SETUP.md)** — MCP configuration and troubleshooting
|
|
323
|
+
|
|
324
|
+
---
|
|
140
325
|
|
|
141
326
|
## Configuration
|
|
142
327
|
|
|
@@ -149,34 +334,18 @@ In Claude Code, invoke any skill with `/funifier-<name>` (e.g. `/funifier-help`)
|
|
|
149
334
|
| `FUNIFIER_SERVER_URL` | Base URL of your Funifier instance |
|
|
150
335
|
| `FUNIFIER_DOCS_PATH` | Path to documentation files (optional) |
|
|
151
336
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
## Local development
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
git clone https://github.com/funifierinc/funifier-mcp.git
|
|
158
|
-
cd funifier-mcp
|
|
159
|
-
npm install
|
|
160
|
-
npm run build # tsc → dist/
|
|
161
|
-
npm run bundle # build + esbuild single-file bundle
|
|
162
|
-
npm test # vitest
|
|
163
|
-
```
|
|
337
|
+
### funifier.json
|
|
164
338
|
|
|
165
|
-
|
|
339
|
+
Place in your project root for automatic configuration:
|
|
166
340
|
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
341
|
+
```json
|
|
342
|
+
{
|
|
343
|
+
"apiKey": "your-api-key",
|
|
344
|
+
"secretKey": "your-secret-key",
|
|
345
|
+
"serverUrl": "https://your-instance.funifier.com"
|
|
346
|
+
}
|
|
171
347
|
```
|
|
172
348
|
|
|
173
|
-
## Documentation
|
|
174
|
-
|
|
175
|
-
- **[docs/PLATFORM_SETUP.md](docs/PLATFORM_SETUP.md)** — Detailed setup for all platforms
|
|
176
|
-
- **[docs/QUICK_REFERENCE.md](docs/QUICK_REFERENCE.md)** — Copy-paste setup commands
|
|
177
|
-
- **[docs/INSTALL_EXAMPLES.md](docs/INSTALL_EXAMPLES.md)** — Real-world scenarios
|
|
178
|
-
- **[docs/MCP_SETUP.md](docs/MCP_SETUP.md)** — MCP configuration and troubleshooting
|
|
179
|
-
|
|
180
349
|
## License
|
|
181
350
|
|
|
182
351
|
MIT
|