funifier-mcp 0.2.25 → 0.2.27
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 +38 -41
- package/.github/copilot-instructions.md +38 -41
- package/AGENTS.md +56 -49
- package/README.md +40 -22
- package/datasource-funifier-docs/.coverage.json +326 -0
- package/datasource-funifier-docs/.validation.json +593 -0
- package/datasource-funifier-docs/knowledge/guides/aggregates.md +182 -70
- package/datasource-funifier-docs/knowledge/guides/database-access.md +174 -88
- package/datasource-funifier-docs/knowledge/guides/java-entities.md +294 -204
- package/datasource-funifier-docs/knowledge/guides/java-libraries.md +202 -226
- package/datasource-funifier-docs/knowledge/guides/java-managers.md +343 -265
- package/datasource-funifier-docs/knowledge/guides/trigger-examples.md +180 -236
- package/datasource-funifier-docs/knowledge/guides/triggers-guide.md +273 -191
- package/datasource-funifier-docs/knowledge/index.md +5 -2
- package/datasource-funifier-docs/knowledge/modules/achievement.md +1126 -28
- package/datasource-funifier-docs/knowledge/modules/action-log.md +469 -62
- package/datasource-funifier-docs/knowledge/modules/action.md +522 -70
- package/datasource-funifier-docs/knowledge/modules/auth.md +718 -69
- package/datasource-funifier-docs/knowledge/modules/avatar.md +483 -18
- package/datasource-funifier-docs/knowledge/modules/backup.md +603 -25
- package/datasource-funifier-docs/knowledge/modules/challenge.md +1048 -220
- package/datasource-funifier-docs/knowledge/modules/compact.md +469 -26
- package/datasource-funifier-docs/knowledge/modules/competition.md +811 -109
- package/datasource-funifier-docs/knowledge/modules/crossword.md +504 -28
- package/datasource-funifier-docs/knowledge/modules/csv-data.md +645 -20
- package/datasource-funifier-docs/knowledge/modules/custom-object.md +701 -36
- package/datasource-funifier-docs/knowledge/modules/database.md +730 -164
- package/datasource-funifier-docs/knowledge/modules/folder.md +1011 -77
- package/datasource-funifier-docs/knowledge/modules/kpi-formulas.md +410 -15
- package/datasource-funifier-docs/knowledge/modules/lastmile.md +568 -29
- package/datasource-funifier-docs/knowledge/modules/leaderboard.md +595 -126
- package/datasource-funifier-docs/knowledge/modules/level.md +536 -54
- package/datasource-funifier-docs/knowledge/modules/lottery.md +809 -76
- package/datasource-funifier-docs/knowledge/modules/marketplace.md +688 -17
- package/datasource-funifier-docs/knowledge/modules/mystery.md +662 -52
- package/datasource-funifier-docs/knowledge/modules/notification.md +564 -26
- package/datasource-funifier-docs/knowledge/modules/patterns.md +519 -814
- package/datasource-funifier-docs/knowledge/modules/player.md +773 -73
- package/datasource-funifier-docs/knowledge/modules/point.md +380 -83
- package/datasource-funifier-docs/knowledge/modules/public.md +508 -178
- package/datasource-funifier-docs/knowledge/modules/question.md +619 -99
- package/datasource-funifier-docs/knowledge/modules/quiz.md +565 -120
- package/datasource-funifier-docs/knowledge/modules/scheduler.md +1092 -39
- package/datasource-funifier-docs/knowledge/modules/security.md +674 -112
- package/datasource-funifier-docs/knowledge/modules/staging.md +742 -19
- package/datasource-funifier-docs/knowledge/modules/story.md +565 -29
- package/datasource-funifier-docs/knowledge/modules/studio-page.md +470 -144
- package/datasource-funifier-docs/knowledge/modules/swap.md +552 -84
- package/datasource-funifier-docs/knowledge/modules/team.md +563 -45
- package/datasource-funifier-docs/knowledge/modules/trigger.md +876 -134
- package/datasource-funifier-docs/knowledge/modules/upload.md +468 -95
- package/datasource-funifier-docs/knowledge/modules/virtual-good.md +510 -63
- package/datasource-funifier-docs/knowledge/modules/webhook.md +375 -28
- package/datasource-funifier-docs/knowledge/modules/websocket.md +459 -26
- package/datasource-funifier-docs/knowledge/modules/widget.md +613 -27
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +42 -1
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/init.test.js +74 -3
- package/dist/cli/init.test.js.map +1 -1
- package/dist/cli/persona.d.ts +3 -0
- package/dist/cli/persona.d.ts.map +1 -0
- package/dist/cli/persona.js +25 -0
- package/dist/cli/persona.js.map +1 -0
- package/dist/core/api-client.d.ts +21 -1
- package/dist/core/api-client.d.ts.map +1 -1
- package/dist/core/api-client.js +154 -1
- package/dist/core/api-client.js.map +1 -1
- package/dist/core/constants.d.ts +14 -0
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +14 -0
- package/dist/core/constants.js.map +1 -1
- package/dist/core/types/Folder.d.ts +16 -0
- package/dist/core/types/Folder.d.ts.map +1 -0
- package/dist/core/types/Folder.js +3 -0
- package/dist/core/types/Folder.js.map +1 -0
- package/dist/core/types/FolderContent.d.ts +10 -0
- package/dist/core/types/FolderContent.d.ts.map +1 -0
- package/dist/core/types/FolderContent.js +3 -0
- package/dist/core/types/FolderContent.js.map +1 -0
- package/dist/core/types/FolderContentType.d.ts +10 -0
- package/dist/core/types/FolderContentType.d.ts.map +1 -0
- package/dist/core/types/FolderContentType.js +3 -0
- package/dist/core/types/FolderContentType.js.map +1 -0
- package/dist/core/types/FolderLog.d.ts +11 -0
- package/dist/core/types/FolderLog.d.ts.map +1 -0
- package/dist/core/types/FolderLog.js +3 -0
- package/dist/core/types/FolderLog.js.map +1 -0
- package/dist/core/types/index.d.ts +4 -0
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/core/types/index.js +4 -0
- package/dist/core/types/index.js.map +1 -1
- package/dist/mcp/bundle.js +121 -87
- package/dist/mcp/check-update.d.ts +2 -0
- package/dist/mcp/check-update.d.ts.map +1 -0
- package/dist/mcp/check-update.js +44 -0
- package/dist/mcp/check-update.js.map +1 -0
- package/dist/mcp/index.js +5 -2
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/resources/documentation.d.ts +1 -1
- package/dist/mcp/resources/documentation.d.ts.map +1 -1
- package/dist/mcp/resources/documentation.js +39 -3
- package/dist/mcp/resources/documentation.js.map +1 -1
- package/dist/mcp/tools/_char-guard.js +1 -1
- package/dist/mcp/tools/_char-guard.js.map +1 -1
- package/dist/mcp/tools/_fetch-current.d.ts +1 -1
- package/dist/mcp/tools/_fetch-current.d.ts.map +1 -1
- package/dist/mcp/tools/_fetch-current.js +12 -0
- package/dist/mcp/tools/_fetch-current.js.map +1 -1
- package/dist/mcp/tools/connect.d.ts.map +1 -1
- package/dist/mcp/tools/connect.js +18 -8
- package/dist/mcp/tools/connect.js.map +1 -1
- package/dist/mcp/tools/database.d.ts.map +1 -1
- package/dist/mcp/tools/database.js +59 -47
- package/dist/mcp/tools/database.js.map +1 -1
- package/dist/mcp/tools/database.test.js +2 -2
- package/dist/mcp/tools/database.test.js.map +1 -1
- package/dist/mcp/tools/delete.d.ts.map +1 -1
- package/dist/mcp/tools/delete.js +33 -3
- package/dist/mcp/tools/delete.js.map +1 -1
- package/dist/mcp/tools/execute.d.ts.map +1 -1
- package/dist/mcp/tools/execute.js +20 -9
- package/dist/mcp/tools/execute.js.map +1 -1
- package/dist/mcp/tools/folder.d.ts +4 -0
- package/dist/mcp/tools/folder.d.ts.map +1 -0
- package/dist/mcp/tools/folder.js +68 -0
- package/dist/mcp/tools/folder.js.map +1 -0
- package/dist/mcp/tools/get.d.ts.map +1 -1
- package/dist/mcp/tools/get.js +16 -6
- package/dist/mcp/tools/get.js.map +1 -1
- package/dist/mcp/tools/index.d.ts +1 -1
- package/dist/mcp/tools/index.d.ts.map +1 -1
- package/dist/mcp/tools/index.js +5 -1
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/list.d.ts.map +1 -1
- package/dist/mcp/tools/list.js +38 -14
- package/dist/mcp/tools/list.js.map +1 -1
- package/dist/mcp/tools/logs.d.ts.map +1 -1
- package/dist/mcp/tools/logs.js +15 -5
- package/dist/mcp/tools/logs.js.map +1 -1
- package/dist/mcp/tools/save.d.ts.map +1 -1
- package/dist/mcp/tools/save.js +26 -4
- package/dist/mcp/tools/save.js.map +1 -1
- package/dist/mcp/tools/save.test.js +192 -1
- package/dist/mcp/tools/save.test.js.map +1 -1
- package/dist/mcp/tools/search-docs.d.ts +3 -0
- package/dist/mcp/tools/search-docs.d.ts.map +1 -0
- package/dist/mcp/tools/search-docs.js +102 -0
- package/dist/mcp/tools/search-docs.js.map +1 -0
- package/package.json +6 -2
- package/skills/acquire-funifier-knowledge/SKILL.md +132 -0
- package/skills/acquire-funifier-knowledge/assets/templates/CONCERNS.md +25 -0
- package/skills/acquire-funifier-knowledge/assets/templates/CUSTOM_ENDPOINTS.md +24 -0
- package/skills/acquire-funifier-knowledge/assets/templates/CUSTOM_PAGES.md +24 -0
- package/skills/acquire-funifier-knowledge/assets/templates/GAME_MECHANICS.md +35 -0
- package/skills/acquire-funifier-knowledge/assets/templates/INTEGRATIONS.md +35 -0
- package/skills/acquire-funifier-knowledge/assets/templates/LEADERBOARDS.md +24 -0
- package/skills/acquire-funifier-knowledge/assets/templates/OVERVIEW.md +47 -0
- package/skills/acquire-funifier-knowledge/assets/templates/PLAYER_MODEL.md +31 -0
- package/skills/acquire-funifier-knowledge/assets/templates/SCHEDULERS.md +25 -0
- package/skills/acquire-funifier-knowledge/assets/templates/TECHNIQUES_AND_PATTERNS.md +26 -0
- package/skills/acquire-funifier-knowledge/assets/templates/TRIGGERS.md +27 -0
- package/skills/acquire-funifier-knowledge/references/funifier-inventory-checklist.md +81 -0
- package/skills/acquire-funifier-knowledge/references/game-techniques-taxonomy.md +62 -0
- package/skills/acquire-funifier-knowledge/references/mcp-call-patterns.md +118 -0
- package/skills/funifier/SKILL.md +88 -0
- package/skills/funifier/references/configure-security.md +96 -0
- package/skills/{funifier-create-action/SKILL.md → funifier/references/create-action.md} +0 -33
- package/skills/funifier/references/create-aggregate.md +144 -0
- package/skills/funifier/references/create-challenge.md +116 -0
- package/skills/funifier/references/create-competition.md +98 -0
- package/skills/funifier/references/create-crossword.md +574 -0
- package/skills/funifier/references/create-custom-object.md +91 -0
- package/skills/funifier/references/create-custom-page.md +135 -0
- package/skills/funifier/references/create-folder.md +104 -0
- package/skills/funifier/references/create-lastmile.md +643 -0
- package/skills/{funifier-create-leaderboard/SKILL.md → funifier/references/create-leaderboard.md} +0 -33
- package/skills/funifier/references/create-level.md +94 -0
- package/skills/funifier/references/create-lottery.md +913 -0
- package/skills/funifier/references/create-mystery.md +769 -0
- package/skills/funifier/references/create-notification.md +75 -0
- package/skills/{funifier-create-point/SKILL.md → funifier/references/create-point.md} +0 -33
- package/skills/funifier/references/create-quiz.md +98 -0
- package/skills/funifier/references/create-scheduler.md +141 -0
- package/skills/funifier/references/create-story.md +636 -0
- package/skills/funifier/references/create-swap.md +95 -0
- package/skills/{funifier-create-trigger/SKILL.md → funifier/references/create-trigger.md} +0 -33
- package/skills/funifier/references/create-virtual-good.md +96 -0
- package/skills/funifier/references/create-webhook.md +72 -0
- package/skills/funifier/references/create-websocket.md +71 -0
- package/skills/funifier/references/create-widget.md +76 -0
- package/skills/funifier/references/debug.md +87 -0
- package/skills/funifier/references/help.md +81 -0
- package/skills/funifier/references/implement-frontend.md +106 -0
- package/skills/funifier/references/import-csv.md +75 -0
- package/skills/funifier/references/manage-player.md +82 -0
- package/skills/funifier/references/manage-team.md +76 -0
- package/skills/funifier/references/upload-file.md +91 -0
- package/datasource-funifier-docs/.search-index.json +0 -17318
- package/datasource-funifier-docs/.skills-map.json +0 -73
- package/skills/funifier-create-aggregate/SKILL.md +0 -127
- package/skills/funifier-create-challenge/SKILL.md +0 -88
- package/skills/funifier-create-custom-page/SKILL.md +0 -127
- package/skills/funifier-create-level/SKILL.md +0 -87
- package/skills/funifier-create-quiz/SKILL.md +0 -87
- package/skills/funifier-create-scheduler/SKILL.md +0 -127
- package/skills/funifier-create-virtual-good/SKILL.md +0 -87
- package/skills/funifier-debug/SKILL.md +0 -92
- package/skills/funifier-help/SKILL.md +0 -86
- package/skills/funifier-implement-frontend/SKILL.md +0 -90
- package/skills/funifier-index/SKILL.md +0 -58
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# funifier-create-notification
|
|
2
|
+
|
|
3
|
+
Create a Funifier notification — standalone automated player feedback messages for game events; use when managing notification records directly via API, not when configuring notifications inline within challenge or competition payloads
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Before starting — find relevant docs
|
|
8
|
+
|
|
9
|
+
Run lexical search to load only what you need:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx funifier-mcp search "notification message push feedback alert player event" --skill funifier-create-notification
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Read only files returned with score > 0.5 (this threshold is printed in the search output).
|
|
16
|
+
|
|
17
|
+
## Primary docs for this skill
|
|
18
|
+
|
|
19
|
+
If search returns insufficient results, read directly:
|
|
20
|
+
|
|
21
|
+
- `datasource-funifier-docs/knowledge/modules/notification.md`
|
|
22
|
+
|
|
23
|
+
## Steps
|
|
24
|
+
|
|
25
|
+
### Sobre Notifications
|
|
26
|
+
|
|
27
|
+
Notificações em Funifier são geralmente configuradas **inline** nos módulos que as disparam (challenge `notifications[]`, competition `notifications[]`). A skill `funifier-create-notification` é para gerenciar registros standalone de notificação via API.
|
|
28
|
+
|
|
29
|
+
**Campos principais:**
|
|
30
|
+
- `event`: `0`=On Win, `1`=On Create, `2`=On Change
|
|
31
|
+
- `scope`: `0`=Private (jogador), `1`=Newsfeed, `99`=Custom
|
|
32
|
+
- `content`: template com variáveis (ex: `"{{player.name}} completed {{item.name}}"`)
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Steps
|
|
37
|
+
|
|
38
|
+
### 1. Verificar se já existe
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
funifier_list type=notification search=<descricao>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 2. Ler a documentação do módulo
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
datasource-funifier-docs/knowledge/modules/notification.md
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 3. Criar a notificação
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"event": 0,
|
|
55
|
+
"type": 0,
|
|
56
|
+
"scope": 0,
|
|
57
|
+
"content": "{{player.name}} earned {{item.name}}!"
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
funifier_save type=notification payload=<json>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 4. Associar ao módulo correto
|
|
66
|
+
|
|
67
|
+
Notificações standalone geralmente são referenciadas em challenges, competitions ou outros módulos via o campo `notifications`. Verifique o payload do módulo destino.
|
|
68
|
+
|
|
69
|
+
### 5. Validar
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
funifier_list type=notification
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Dispare o evento correspondente e verifique se a notificação é entregue.
|
|
@@ -1,32 +1,7 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: funifier-create-point
|
|
3
|
-
description: Create a Funifier point category — XP, coins, or custom metrics
|
|
4
|
-
---
|
|
5
|
-
|
|
6
1
|
# funifier-create-point
|
|
7
2
|
|
|
8
3
|
Create a Funifier point category — XP, coins, or custom metrics
|
|
9
4
|
|
|
10
|
-
## Persona e Qualidade de Código
|
|
11
|
-
|
|
12
|
-
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**.
|
|
13
|
-
|
|
14
|
-
### Ao lidar com qualquer código — seja refatorando ou criando do zero — siga este processo:
|
|
15
|
-
|
|
16
|
-
1. **Analise cuidadosamente o problema ou o código existente.**
|
|
17
|
-
2. **Raciocine passo a passo** antes de escrever qualquer linha de código.
|
|
18
|
-
3. **Identifique problemas (em caso de refatoração) ou requisitos (em caso de código novo).**
|
|
19
|
-
4. **Defina prioridades e estratégias com base em princípios sólidos de engenharia.**
|
|
20
|
-
5. **Justifique tecnicamente cada decisão**, com base em fundamentos como:
|
|
21
|
-
- **SOLID**
|
|
22
|
-
- **DRY (Don't Repeat Yourself)**
|
|
23
|
-
- **KISS (Keep It Simple, Stupid)**
|
|
24
|
-
- **YAGNI (You Aren't Gonna Need It)**
|
|
25
|
-
|
|
26
|
-
Só então prossiga com a implementação.
|
|
27
|
-
|
|
28
|
-
> **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.
|
|
29
|
-
|
|
30
5
|
---
|
|
31
6
|
|
|
32
7
|
## Before starting — find relevant docs
|
|
@@ -118,11 +93,3 @@ funifier_list type=point search=<_id>
|
|
|
118
93
|
```
|
|
119
94
|
|
|
120
95
|
Do NOT use `funifier_logs` — that is only for triggers and schedulers.
|
|
121
|
-
|
|
122
|
-
## MCP
|
|
123
|
-
|
|
124
|
-
If Funifier MCP tools are available (`funifier_list`, `funifier_save`, `funifier_get`, `funifier_logs`):
|
|
125
|
-
- Use MCP for live server data
|
|
126
|
-
- Use docs for correct patterns and syntax
|
|
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
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# funifier-create-quiz
|
|
2
|
+
|
|
3
|
+
Create a Funifier quiz — questionnaires with multiple-choice questions
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Before starting — find relevant docs
|
|
8
|
+
|
|
9
|
+
Run lexical search to load only what you need:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx funifier-mcp search "quiz question answer questionnaire multiple choice survey" --skill funifier-create-quiz
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Read only files returned with score > 0.5 (this threshold is printed in the search output).
|
|
16
|
+
|
|
17
|
+
## Primary docs for this skill
|
|
18
|
+
|
|
19
|
+
If search returns insufficient results, read directly:
|
|
20
|
+
|
|
21
|
+
- `datasource-funifier-docs/knowledge/modules/quiz.md`
|
|
22
|
+
- `datasource-funifier-docs/knowledge/modules/question.md`
|
|
23
|
+
|
|
24
|
+
## Steps
|
|
25
|
+
|
|
26
|
+
### Quiz flow — two-stage creation + five-stage player flow
|
|
27
|
+
|
|
28
|
+
**Admin creates:** Quiz → Questions
|
|
29
|
+
**Player flow:** Start → Answer → Finish (grade calculated on finish)
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Steps
|
|
34
|
+
|
|
35
|
+
### 1. Verificar se já existe
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
funifier_list type=quiz search=<titulo>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 2. Criar o Quiz
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"title": "Product Knowledge Test",
|
|
46
|
+
"description": "Test your knowledge about our products.",
|
|
47
|
+
"grade": 10,
|
|
48
|
+
"shuffle": false,
|
|
49
|
+
"showGradeBeforeFinish": false,
|
|
50
|
+
"questionNumbering": "uppercase_letters"
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
funifier_save type=quiz payload=<json>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Guarde o `_id` retornado — necessário para associar perguntas.
|
|
59
|
+
|
|
60
|
+
### 3. Criar as perguntas (associadas ao quiz)
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"quiz": "<quiz_id>",
|
|
65
|
+
"type": "MULTIPLE_CHOICE",
|
|
66
|
+
"title": "Best Platform",
|
|
67
|
+
"question": "What is the best gamification platform?",
|
|
68
|
+
"grade": 1,
|
|
69
|
+
"select": "one_answer",
|
|
70
|
+
"shuffle": false,
|
|
71
|
+
"choices": [
|
|
72
|
+
{ "answer": "1", "label": "Funifier", "grade": 1, "gradePercent": 100, "gradeCheck": true, "extra": {} },
|
|
73
|
+
{ "answer": "2", "label": "Other A", "grade": 0, "gradePercent": 0, "extra": {} },
|
|
74
|
+
{ "answer": "3", "label": "Other B", "grade": 0, "gradePercent": 0, "extra": {} }
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
funifier_save type=question payload=<json>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Repita para cada pergunta.
|
|
84
|
+
|
|
85
|
+
### 4. Validar criação
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
funifier_list type=quiz search=<titulo>
|
|
89
|
+
GET /v3/quiz/<quiz_id>/question
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 5. Testar fluxo do jogador (opcional)
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
POST /v3/quiz/start { "quiz": "<id>", "player": "<player_id>" }
|
|
96
|
+
POST /v3/question/log/bulk [{ "quiz": "<id>", "quiz_log": "<log_id>", "question": "<q_id>", "answer": ["1"], "player": "<player_id>" }]
|
|
97
|
+
POST /v3/quiz/finish { "quiz_log": "<log_id>" }
|
|
98
|
+
```
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# funifier-create-scheduler
|
|
2
|
+
|
|
3
|
+
Create a Funifier scheduler — guided workflow from naming and cron expression to Groovy code generation
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Formato do payload (obrigatório)
|
|
8
|
+
|
|
9
|
+
Funifier armazena código como **strings JSON escapadas**. Ao montar o payload do `funifier_save`:
|
|
10
|
+
|
|
11
|
+
- **Quebra de linha** → `\n` (nunca newline literal dentro da string)
|
|
12
|
+
- **Aspas duplas** dentro do código → `\"`
|
|
13
|
+
- **Backslash** → `\\` (regex `\b` vira `\\b`; dentro de Groovy com string-building pode exigir `\\\\b`)
|
|
14
|
+
- **Tab** → `\t` (se usar)
|
|
15
|
+
- **Pipelines de aggregate** vão como **string JSON** (não objeto aninhado) — serialize o array inteiro
|
|
16
|
+
|
|
17
|
+
A regra prática: monte o objeto em JavaScript normalmente e passe por `JSON.stringify` — o MCP faz isso automaticamente quando você entrega o payload como JSON. **Nunca** cole código multilinha cru no meio do JSON.
|
|
18
|
+
|
|
19
|
+
### Exemplo 1 — custom-page (html + angularjs script)
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"title": "Ciclos",
|
|
24
|
+
"slug": "studio/custom/ciclos",
|
|
25
|
+
"html": "<div class=\"row\">\n <div class=\"col-md-12\">\n <h2>Ciclos</h2>\n </div>\n</div>\n",
|
|
26
|
+
"script": "$scope.all = [];\n$scope.loading = false;\n\n$scope.list = function () {\n $scope.loading = true;\n};\n$scope.list();\n"
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Exemplo 2 — aggregate preparado (pipeline JSON + script Groovy)
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"_id": "extrato",
|
|
35
|
+
"title": "Extrato de Pontos",
|
|
36
|
+
"collection": "extrato",
|
|
37
|
+
"aggregate": "[\n {\n \"$match\": { \"player\": \"$param:player\" }\n },\n {\n \"$sort\": { \"time\": -1 }\n }\n]",
|
|
38
|
+
"script": "void prepare(aggregations, params) {\n if (context.get(\"player\") != null) {\n params.put(\"player\", context.get(\"player\"));\n } else {\n params.put(\"player\", \"NAO_EXISTE\");\n }\n}\n"
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Note que `aggregate` é uma **string** contendo JSON serializado (com `\n` e `\"` escapados), **não** um array nativo. Mesma regra vale para `script` em triggers/schedulers/aggregates e `html`/`script` em custom-pages.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Before starting — find relevant docs
|
|
47
|
+
|
|
48
|
+
Run lexical search to load only what you need:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npx funifier-mcp search "scheduler cron groovy java scheduled job periodic" --skill funifier-create-scheduler
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Read only files returned with score > 0.5 (this threshold is printed in the search output).
|
|
55
|
+
|
|
56
|
+
## Primary docs for this skill
|
|
57
|
+
|
|
58
|
+
If search returns insufficient results, read directly:
|
|
59
|
+
|
|
60
|
+
- `datasource-funifier-docs/knowledge/modules/scheduler.md`
|
|
61
|
+
- `datasource-funifier-docs/knowledge/guides/java-managers.md`
|
|
62
|
+
- `datasource-funifier-docs/knowledge/guides/java-libraries.md`
|
|
63
|
+
|
|
64
|
+
## Steps
|
|
65
|
+
|
|
66
|
+
### Regras críticas
|
|
67
|
+
|
|
68
|
+
- Método principal: `void execute()` — sem parâmetros, sem return
|
|
69
|
+
- **Não use `import`** — toda a biblioteca já está no wrapper (Unirest, Groovy JSON, Apache HTTP, etc.)
|
|
70
|
+
- **`manager`** (ManagerFactory) disponível como campo da classe — acesse DatabaseManager, PlayerManager, etc.
|
|
71
|
+
- **Timeout padrão: 10s** — use `"timeout": N` (segundos) no payload para scripts mais longos
|
|
72
|
+
|
|
73
|
+
### CRON Expression
|
|
74
|
+
|
|
75
|
+
| Expressão | Significado |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `0 0 8 * * ?` | Todo dia às 8:00 |
|
|
78
|
+
| `0 0/30 * * * ?` | A cada 30 minutos |
|
|
79
|
+
| `0 0 9 ? * 2` | Toda segunda-feira às 9:00 |
|
|
80
|
+
| `0 0 10 ? * 5L` | Última sexta do mês às 10:00 |
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Steps
|
|
85
|
+
|
|
86
|
+
### 1. Entender o requisito
|
|
87
|
+
|
|
88
|
+
- O que deve acontecer? (ex: debitar pontos, enviar lembrete, processar inativos)
|
|
89
|
+
- Com que frequência? → define a expressão CRON
|
|
90
|
+
- Requer dados externos? (jogadores, pontos, coleções customizadas)
|
|
91
|
+
|
|
92
|
+
### 2. Verificar se já existe
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
funifier_list type=scheduler search=<nome>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 3. Escrever o script
|
|
99
|
+
|
|
100
|
+
```java
|
|
101
|
+
void execute() {
|
|
102
|
+
// Exemplo: processar jogadores com poucas ações
|
|
103
|
+
def logs = manager.getJongoConnection()
|
|
104
|
+
.getCollection("action_log")
|
|
105
|
+
.find()
|
|
106
|
+
.limit(100)
|
|
107
|
+
.as(HashMap.class)
|
|
108
|
+
logs.each { log ->
|
|
109
|
+
println("Processing: " + log.userId)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
> Leituras obrigatórias para Groovy avançado:
|
|
115
|
+
> - `datasource-funifier-docs/knowledge/guides/java-managers.md`
|
|
116
|
+
> - `datasource-funifier-docs/knowledge/guides/java-libraries.md`
|
|
117
|
+
|
|
118
|
+
### 4. Montar e salvar o payload
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"name": "Weekly Report",
|
|
123
|
+
"description": "Gera relatório toda sexta às 10h",
|
|
124
|
+
"active": true,
|
|
125
|
+
"expression": "0 0 10 ? * 5L",
|
|
126
|
+
"timeout": 30,
|
|
127
|
+
"script": "void execute() {\n println('Running');\n}\n"
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
funifier_save type=scheduler payload=<json>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 5. Validar via logs
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
funifier_logs type=scheduler id=<_id>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Confirme que não há erros de compilação ou execução no stack trace.
|