funifier-mcp 0.2.24 → 0.2.25
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 +1 -0
- package/.github/copilot-instructions.md +1 -0
- package/AGENTS.md +1 -0
- package/datasource-funifier-docs/.search-index.json +5588 -4475
- package/datasource-funifier-docs/.skills-map.json +3 -1
- package/datasource-funifier-docs/knowledge/guides/trigger-examples.md +511 -0
- package/datasource-funifier-docs/knowledge/guides/triggers-guide.md +1 -1
- package/datasource-funifier-docs/knowledge/modules/action.md +96 -39
- package/datasource-funifier-docs/knowledge/modules/challenge.md +285 -48
- package/datasource-funifier-docs/knowledge/modules/leaderboard.md +173 -71
- package/datasource-funifier-docs/knowledge/modules/point.md +108 -37
- package/datasource-funifier-docs/knowledge/modules/trigger.md +1 -1
- package/dist/cli/init.d.ts +1 -1
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +11 -4
- package/dist/cli/init.js.map +1 -1
- package/dist/core/api-client.d.ts.map +1 -1
- package/dist/core/api-client.js +1 -1
- package/dist/core/api-client.js.map +1 -1
- package/dist/core/constants.d.ts +1 -0
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +1 -0
- package/dist/core/constants.js.map +1 -1
- package/dist/mcp/bundle.js +68 -67
- package/dist/mcp/index.js +2 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/tools/get.d.ts.map +1 -1
- package/dist/mcp/tools/get.js +22 -8
- package/dist/mcp/tools/get.js.map +1 -1
- package/dist/mcp/tools/list.d.ts.map +1 -1
- package/dist/mcp/tools/list.js +9 -2
- package/dist/mcp/tools/list.js.map +1 -1
- package/dist/mcp/tools/save.d.ts.map +1 -1
- package/dist/mcp/tools/save.js +88 -7
- package/dist/mcp/tools/save.js.map +1 -1
- package/package.json +3 -2
- package/skills/funifier-create-action/SKILL.md +58 -18
- package/skills/funifier-create-aggregate/SKILL.md +1 -0
- package/skills/funifier-create-challenge/SKILL.md +1 -0
- package/skills/funifier-create-custom-page/SKILL.md +1 -0
- package/skills/funifier-create-leaderboard/SKILL.md +90 -18
- package/skills/funifier-create-level/SKILL.md +1 -0
- package/skills/funifier-create-point/SKILL.md +60 -18
- package/skills/funifier-create-quiz/SKILL.md +1 -0
- package/skills/funifier-create-scheduler/SKILL.md +1 -0
- package/skills/funifier-create-trigger/SKILL.md +110 -19
- package/skills/funifier-create-virtual-good/SKILL.md +1 -0
- package/skills/funifier-debug/SKILL.md +2 -0
- package/skills/funifier-help/SKILL.md +1 -0
- package/skills/funifier-implement-frontend/SKILL.md +1 -0
- package/skills/funifier-index/SKILL.md +9 -1
|
@@ -48,35 +48,76 @@ If search returns insufficient results, read directly:
|
|
|
48
48
|
|
|
49
49
|
## Steps
|
|
50
50
|
|
|
51
|
-
###
|
|
51
|
+
### Rules — follow exactly, no exceptions
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
- The name/title
|
|
55
|
-
- The purpose and behavior
|
|
56
|
-
- Any specific configuration or constraints
|
|
53
|
+
**The single most important decision: which technique?**
|
|
57
54
|
|
|
58
|
-
|
|
55
|
+
| Point type | `techniques` | When to use |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| Normal (XP, score, karma) | `["GT01"]` | Progresso/ranking — jogador acumula, não transfere |
|
|
58
|
+
| Trocável entre jogadores | `["GT75"]` | Jogadores podem transferir/enviar este ponto uns para os outros |
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
Se jogadores podem trocar ou enviar este ponto entre si → **GT75**.
|
|
61
|
+
Tudo o mais → **GT01**.
|
|
62
|
+
Qualquer tipo de ponto pode ser usado na loja virtual — isso não influencia a escolha da técnica.
|
|
61
63
|
|
|
62
|
-
|
|
64
|
+
**_id format:** lowercase, no spaces (`xp`, `coin`, `karma`) — never `"Experience Points"` or `"XP Points"`.
|
|
63
65
|
|
|
64
|
-
|
|
65
|
-
if a similar resource already exists. Never list all resources without a search term.
|
|
66
|
+
**Upsert:** POST with existing `_id` updates the point — never errors on duplicate.
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
**Create points BEFORE challenges and leaderboards that reference them.**
|
|
68
69
|
|
|
69
|
-
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
### 1. Determine the type
|
|
73
|
+
|
|
74
|
+
Ask (or infer from context): is this point spendable in a store?
|
|
75
|
+
- Yes → `GT75`
|
|
76
|
+
- No → `GT01`
|
|
77
|
+
|
|
78
|
+
### 2. Check if it already exists
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
funifier_list type=point search=<name or _id>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
If it exists and has the correct technique, stop.
|
|
85
|
+
|
|
86
|
+
### 3. Build the payload
|
|
70
87
|
|
|
71
|
-
|
|
88
|
+
Normal point (GT01):
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"_id": "xp",
|
|
92
|
+
"category": "Experience Points",
|
|
93
|
+
"shortName": "XP",
|
|
94
|
+
"techniques": ["GT01"]
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Exchangeable point (GT75):
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"_id": "coin",
|
|
102
|
+
"category": "Coins",
|
|
103
|
+
"shortName": "Coins",
|
|
104
|
+
"techniques": ["GT75"]
|
|
105
|
+
}
|
|
106
|
+
```
|
|
72
107
|
|
|
73
|
-
|
|
74
|
-
update the resource. If MCP is unavailable, show the complete JSON for manual use.
|
|
108
|
+
### 4. Save
|
|
75
109
|
|
|
76
|
-
|
|
110
|
+
```
|
|
111
|
+
funifier_save type=point payload=<json>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 5. Validate
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
funifier_list type=point search=<_id>
|
|
118
|
+
```
|
|
77
119
|
|
|
78
|
-
|
|
79
|
-
the resource was saved correctly and executed without errors.
|
|
120
|
+
Do NOT use `funifier_logs` — that is only for triggers and schedulers.
|
|
80
121
|
|
|
81
122
|
## MCP
|
|
82
123
|
|
|
@@ -84,3 +125,4 @@ If Funifier MCP tools are available (`funifier_list`, `funifier_save`, `funifier
|
|
|
84
125
|
- Use MCP for live server data
|
|
85
126
|
- Use docs for correct patterns and syntax
|
|
86
127
|
- Never learn patterns from existing live resources — docs are authoritative
|
|
128
|
+
- **For any new Funifier task, check `/funifier-index` first** — there may be a skill with the correct enums, examples, and workflow already defined
|
|
@@ -84,3 +84,4 @@ If Funifier MCP tools are available (`funifier_list`, `funifier_save`, `funifier
|
|
|
84
84
|
- Use MCP for live server data
|
|
85
85
|
- Use docs for correct patterns and syntax
|
|
86
86
|
- Never learn patterns from existing live resources — docs are authoritative
|
|
87
|
+
- **For any new Funifier task, check `/funifier-index` first** — there may be a skill with the correct enums, examples, and workflow already defined
|
|
@@ -124,3 +124,4 @@ If Funifier MCP tools are available (`funifier_list`, `funifier_save`, `funifier
|
|
|
124
124
|
- Use MCP for live server data
|
|
125
125
|
- Use docs for correct patterns and syntax
|
|
126
126
|
- Never learn patterns from existing live resources — docs are authoritative
|
|
127
|
+
- **For any new Funifier task, check `/funifier-index` first** — there may be a skill with the correct enums, examples, and workflow already defined
|
|
@@ -73,7 +73,7 @@ Note que `aggregate` é uma **string** contendo JSON serializado (com `\n` e `\"
|
|
|
73
73
|
Run lexical search to load only what you need:
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
-
npx funifier-mcp search "trigger event groovy java before_create after_win entity script" --skill funifier-create-trigger
|
|
76
|
+
npx funifier-mcp search "trigger event groovy java before_create after_win entity script achievement_type context_extra bulk csv after_bulk before_bulk" --skill funifier-create-trigger
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
Read only files returned with score > 0.5 (this threshold is printed in the search output).
|
|
@@ -86,38 +86,128 @@ If search returns insufficient results, read directly:
|
|
|
86
86
|
- `datasource-funifier-docs/knowledge/guides/triggers-guide.md`
|
|
87
87
|
- `datasource-funifier-docs/knowledge/guides/java-entities.md`
|
|
88
88
|
- `datasource-funifier-docs/knowledge/guides/java-managers.md`
|
|
89
|
+
- `datasource-funifier-docs/knowledge/guides/trigger-examples.md`
|
|
89
90
|
|
|
90
91
|
## Steps
|
|
91
92
|
|
|
92
|
-
|
|
93
|
+
## ⚠ Regra crítica: triggers não impedem persistência via throw
|
|
93
94
|
|
|
94
|
-
|
|
95
|
-
- The name/title
|
|
96
|
-
- The purpose and behavior
|
|
97
|
-
- Any specific configuration or constraints
|
|
95
|
+
O Funifier **sempre salva o documento** antes de executar o trigger.
|
|
98
96
|
|
|
99
|
-
|
|
97
|
+
- `before_create` → enriquecimento apenas (normalizar, preencher defaults)
|
|
98
|
+
- Rejeitar criação → usar `after_create`: validar → se inválido:
|
|
99
|
+
```java
|
|
100
|
+
database.delete(entity._id, "collection__c");
|
|
101
|
+
entity.clear();
|
|
102
|
+
entity.put("message", "motivo");
|
|
103
|
+
return;
|
|
104
|
+
```
|
|
105
|
+
- Para lógica complexa, use `BusinessException` interna (capturada dentro do trigger, não propaga para a plataforma).
|
|
100
106
|
|
|
101
|
-
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Referência rápida — constantes e campos
|
|
110
|
+
|
|
111
|
+
| Constante | Valor | Uso |
|
|
112
|
+
|-----------|-------|-----|
|
|
113
|
+
| `Achievement.TYPE_POINT` | `0` | Ponto acumulado |
|
|
114
|
+
| `Achievement.TYPE_CHALLENGE` | `1` | Desafio completado |
|
|
115
|
+
| `Achievement.TYPE_VIRTUAL_GOOD` | `2` | Item de catálogo |
|
|
116
|
+
| `Achievement.TYPE_LEVEL` | `3` | Nível alcançado |
|
|
117
|
+
|
|
118
|
+
**ActionLog** (entity em triggers de `action`):
|
|
119
|
+
`entity.actionId`, `entity.userId`, `entity.attributes` (Map), `entity.time`, `entity.id`
|
|
120
|
+
|
|
121
|
+
**Player** (entity em triggers de `player`):
|
|
122
|
+
`entity._id`, `entity.name`, `entity.email`, `entity.extra` (Map), `entity.teams`
|
|
102
123
|
|
|
103
|
-
|
|
124
|
+
**context.extra** (disponível em `before_win` / `before_create` / `after_create`):
|
|
125
|
+
- `context.extra.parentAchievement.id` / `.type` / `.item` / `.player`
|
|
126
|
+
- `context.extra.parentActionLog.id` / `.actionId` / `.userId` / `.attributes`
|
|
127
|
+
- `context.extra.originActionLog` — action log raiz da cadeia
|
|
104
128
|
|
|
105
|
-
|
|
106
|
-
if a similar resource already exists. Never list all resources without a search term.
|
|
129
|
+
---
|
|
107
130
|
|
|
108
|
-
|
|
131
|
+
## Leituras obrigatórias (não condicionais — leia antes de escrever qualquer Groovy)
|
|
109
132
|
|
|
110
|
-
|
|
133
|
+
- `datasource-funifier-docs/knowledge/guides/java-entities.md`
|
|
134
|
+
- `datasource-funifier-docs/knowledge/guides/java-managers.md`
|
|
135
|
+
- `datasource-funifier-docs/knowledge/guides/trigger-examples.md`
|
|
136
|
+
|
|
137
|
+
---
|
|
111
138
|
|
|
112
|
-
|
|
139
|
+
## Steps
|
|
140
|
+
|
|
141
|
+
### 1. Entender o requisito
|
|
142
|
+
|
|
143
|
+
Perguntar (ou inferir do contexto):
|
|
144
|
+
- Nome/descrição da trigger
|
|
145
|
+
- Qual entidade e evento? (ver tabela abaixo)
|
|
146
|
+
- Qual comportamento esperado?
|
|
147
|
+
|
|
148
|
+
**Combinações mais comuns:**
|
|
149
|
+
|
|
150
|
+
| entity | event | Quando usar |
|
|
151
|
+
|--------|-------|-------------|
|
|
152
|
+
| `action` | `before_win` | Reagir a uma ação antes de registrar a conquista |
|
|
153
|
+
| `action` | `after_win` | Efeito colateral após ação (ex: creditar pontos para outro jogador) |
|
|
154
|
+
| `achievement` | `before_create` | Enriquecer conquista com dados de origem (`context.extra`) |
|
|
155
|
+
| `player` | `after_create` | Inicializar campos customizados ao criar jogador |
|
|
156
|
+
| `player` | `before_update` | Normalizar campos antes de salvar atualização |
|
|
157
|
+
| `custom__c` | `before_create` | Normalizar/enriquecer documento customizado |
|
|
158
|
+
| `custom__c` | `after_create` | Validar e rejeitar se inválido (delete + message) |
|
|
159
|
+
| `custom__c` | `after_bulk` | Processar import em lote (entity é uma List) |
|
|
160
|
+
|
|
161
|
+
### 2. Verificar se já existe
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
funifier_list type=trigger search=<nome>
|
|
165
|
+
```
|
|
113
166
|
|
|
114
|
-
|
|
115
|
-
update the resource. If MCP is unavailable, show the complete JSON for manual use.
|
|
167
|
+
Se existir e estiver correto, parar — não recriar.
|
|
116
168
|
|
|
117
|
-
###
|
|
169
|
+
### 3. Ler documentação obrigatória
|
|
170
|
+
|
|
171
|
+
Leia os três arquivos listados acima antes de escrever qualquer código.
|
|
172
|
+
Use também `datasource-funifier-docs/knowledge/guides/trigger-examples.md` para encontrar o padrão mais próximo do requisito.
|
|
173
|
+
|
|
174
|
+
### 4. Escrever o script Groovy
|
|
175
|
+
|
|
176
|
+
- Use os exemplos de `trigger-examples.md` como base
|
|
177
|
+
- Prefira funções auxiliares para lógica reutilizável
|
|
178
|
+
- Use `println` para debug (aparece nos logs)
|
|
179
|
+
- Sempre verifique nulos antes de acessar campos
|
|
180
|
+
|
|
181
|
+
### 5. Montar e salvar o payload
|
|
182
|
+
|
|
183
|
+
O campo `script` deve ser uma string JSON escapada. Exemplo completo:
|
|
184
|
+
|
|
185
|
+
```json
|
|
186
|
+
{
|
|
187
|
+
"name": "Update Task Status",
|
|
188
|
+
"entity": "action",
|
|
189
|
+
"event": "before_win",
|
|
190
|
+
"active": true,
|
|
191
|
+
"script": "void trigger(event, entity, player, database) {\n String taskId = entity.attributes.get(\"taskId\");\n if (taskId != null) {\n HashMap<String, Object> task = manager.getJongoConnection().getCollection(\"task__c\").findOne(\"{_id:#}\", taskId).as(HashMap.class);\n if (task != null) {\n task.put(\"status\", \"done\");\n manager.getJongoConnection().getCollection(\"task__c\").save(task);\n }\n }\n}\n"
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Regras de escape no campo `script`:
|
|
196
|
+
- Quebra de linha → `\n`
|
|
197
|
+
- Aspas duplas → `\"`
|
|
198
|
+
- Nunca cole código multilinha cru no JSON
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
funifier_save type=trigger payload=<json>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### 6. Validar via logs
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
funifier_logs type=trigger id=<_id>
|
|
208
|
+
```
|
|
118
209
|
|
|
119
|
-
|
|
120
|
-
the resource was saved correctly and executed without errors.
|
|
210
|
+
Confirme que não há erros de compilação ou execução. Se houver, leia o stack trace e corrija o script.
|
|
121
211
|
|
|
122
212
|
## MCP
|
|
123
213
|
|
|
@@ -125,3 +215,4 @@ If Funifier MCP tools are available (`funifier_list`, `funifier_save`, `funifier
|
|
|
125
215
|
- Use MCP for live server data
|
|
126
216
|
- Use docs for correct patterns and syntax
|
|
127
217
|
- Never learn patterns from existing live resources — docs are authoritative
|
|
218
|
+
- **For any new Funifier task, check `/funifier-index` first** — there may be a skill with the correct enums, examples, and workflow already defined
|
|
@@ -84,3 +84,4 @@ If Funifier MCP tools are available (`funifier_list`, `funifier_save`, `funifier
|
|
|
84
84
|
- Use MCP for live server data
|
|
85
85
|
- Use docs for correct patterns and syntax
|
|
86
86
|
- Never learn patterns from existing live resources — docs are authoritative
|
|
87
|
+
- **For any new Funifier task, check `/funifier-index` first** — there may be a skill with the correct enums, examples, and workflow already defined
|
|
@@ -46,6 +46,7 @@ If search returns insufficient results, read directly:
|
|
|
46
46
|
- `datasource-funifier-docs/knowledge/guides/java-libraries.md`
|
|
47
47
|
- `datasource-funifier-docs/knowledge/modules/trigger.md`
|
|
48
48
|
- `datasource-funifier-docs/knowledge/guides/triggers-guide.md`
|
|
49
|
+
- `datasource-funifier-docs/knowledge/guides/trigger-examples.md`
|
|
49
50
|
- `datasource-funifier-docs/knowledge/modules/scheduler.md`
|
|
50
51
|
- `datasource-funifier-docs/knowledge/guides/aggregates.md`
|
|
51
52
|
- `datasource-funifier-docs/knowledge/modules/public.md`
|
|
@@ -88,3 +89,4 @@ If Funifier MCP tools are available (`funifier_list`, `funifier_save`, `funifier
|
|
|
88
89
|
- Use MCP for live server data
|
|
89
90
|
- Use docs for correct patterns and syntax
|
|
90
91
|
- Never learn patterns from existing live resources — docs are authoritative
|
|
92
|
+
- **For any new Funifier task, check `/funifier-index` first** — there may be a skill with the correct enums, examples, and workflow already defined
|
|
@@ -83,3 +83,4 @@ If Funifier MCP tools are available (`funifier_list`, `funifier_save`, `funifier
|
|
|
83
83
|
- Use MCP for live server data
|
|
84
84
|
- Use docs for correct patterns and syntax
|
|
85
85
|
- Never learn patterns from existing live resources — docs are authoritative
|
|
86
|
+
- **For any new Funifier task, check `/funifier-index` first** — there may be a skill with the correct enums, examples, and workflow already defined
|
|
@@ -87,3 +87,4 @@ If Funifier MCP tools are available (`funifier_list`, `funifier_save`, `funifier
|
|
|
87
87
|
- Use MCP for live server data
|
|
88
88
|
- Use docs for correct patterns and syntax
|
|
89
89
|
- Never learn patterns from existing live resources — docs are authoritative
|
|
90
|
+
- **For any new Funifier task, check `/funifier-index` first** — there may be a skill with the correct enums, examples, and workflow already defined
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: funifier-index
|
|
3
|
-
description:
|
|
3
|
+
description: >
|
|
4
|
+
REQUIRED before any funifier_* MCP tool call — check this index first to find the matching skill.
|
|
5
|
+
Routes to the right skill for creating actions, challenges, points, leaderboards, triggers, schedulers, aggregates, quizzes, virtual goods, custom pages, and frontend implementation.
|
|
4
6
|
---
|
|
5
7
|
|
|
6
8
|
# Funifier Index
|
|
7
9
|
|
|
10
|
+
## ⚠ Rule
|
|
11
|
+
|
|
12
|
+
**Before using any `funifier_*` MCP tool, check this list first.**
|
|
13
|
+
If a skill matches the task, invoke it — skills contain the correct field values, enum tables, and examples that prevent common errors.
|
|
14
|
+
Only proceed directly with MCP tools when no skill matches.
|
|
15
|
+
|
|
8
16
|
## Usage
|
|
9
17
|
|
|
10
18
|
1. Identify what the user wants to do
|