funifier-mcp 0.2.26 → 0.2.28

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 (181) hide show
  1. package/.cursor/rules/funifier.mdc +38 -41
  2. package/.github/copilot-instructions.md +38 -41
  3. package/AGENTS.md +56 -49
  4. package/README.md +40 -22
  5. package/datasource-funifier-docs/.coverage.json +326 -0
  6. package/datasource-funifier-docs/.validation.json +593 -0
  7. package/datasource-funifier-docs/knowledge/guides/aggregates.md +182 -70
  8. package/datasource-funifier-docs/knowledge/guides/database-access.md +174 -88
  9. package/datasource-funifier-docs/knowledge/guides/java-entities.md +294 -204
  10. package/datasource-funifier-docs/knowledge/guides/java-libraries.md +202 -226
  11. package/datasource-funifier-docs/knowledge/guides/java-managers.md +343 -265
  12. package/datasource-funifier-docs/knowledge/guides/trigger-examples.md +180 -236
  13. package/datasource-funifier-docs/knowledge/guides/triggers-guide.md +273 -191
  14. package/datasource-funifier-docs/knowledge/index.md +4 -1
  15. package/datasource-funifier-docs/knowledge/modules/achievement.md +1126 -28
  16. package/datasource-funifier-docs/knowledge/modules/action-log.md +469 -62
  17. package/datasource-funifier-docs/knowledge/modules/action.md +522 -70
  18. package/datasource-funifier-docs/knowledge/modules/auth.md +718 -69
  19. package/datasource-funifier-docs/knowledge/modules/avatar.md +483 -18
  20. package/datasource-funifier-docs/knowledge/modules/backup.md +603 -25
  21. package/datasource-funifier-docs/knowledge/modules/challenge.md +1048 -220
  22. package/datasource-funifier-docs/knowledge/modules/compact.md +469 -26
  23. package/datasource-funifier-docs/knowledge/modules/competition.md +811 -109
  24. package/datasource-funifier-docs/knowledge/modules/crossword.md +504 -28
  25. package/datasource-funifier-docs/knowledge/modules/csv-data.md +645 -20
  26. package/datasource-funifier-docs/knowledge/modules/custom-object.md +701 -36
  27. package/datasource-funifier-docs/knowledge/modules/database.md +730 -164
  28. package/datasource-funifier-docs/knowledge/modules/folder.md +935 -280
  29. package/datasource-funifier-docs/knowledge/modules/kpi-formulas.md +410 -15
  30. package/datasource-funifier-docs/knowledge/modules/lastmile.md +568 -29
  31. package/datasource-funifier-docs/knowledge/modules/leaderboard.md +595 -126
  32. package/datasource-funifier-docs/knowledge/modules/level.md +536 -54
  33. package/datasource-funifier-docs/knowledge/modules/lottery.md +809 -76
  34. package/datasource-funifier-docs/knowledge/modules/marketplace.md +688 -17
  35. package/datasource-funifier-docs/knowledge/modules/mystery.md +662 -52
  36. package/datasource-funifier-docs/knowledge/modules/notification.md +564 -26
  37. package/datasource-funifier-docs/knowledge/modules/patterns.md +519 -814
  38. package/datasource-funifier-docs/knowledge/modules/player.md +773 -73
  39. package/datasource-funifier-docs/knowledge/modules/point.md +380 -83
  40. package/datasource-funifier-docs/knowledge/modules/public.md +508 -178
  41. package/datasource-funifier-docs/knowledge/modules/question.md +619 -99
  42. package/datasource-funifier-docs/knowledge/modules/quiz.md +565 -120
  43. package/datasource-funifier-docs/knowledge/modules/scheduler.md +1092 -39
  44. package/datasource-funifier-docs/knowledge/modules/security.md +674 -112
  45. package/datasource-funifier-docs/knowledge/modules/staging.md +742 -19
  46. package/datasource-funifier-docs/knowledge/modules/story.md +565 -29
  47. package/datasource-funifier-docs/knowledge/modules/studio-page.md +470 -144
  48. package/datasource-funifier-docs/knowledge/modules/swap.md +552 -84
  49. package/datasource-funifier-docs/knowledge/modules/team.md +563 -45
  50. package/datasource-funifier-docs/knowledge/modules/trigger.md +876 -134
  51. package/datasource-funifier-docs/knowledge/modules/upload.md +468 -95
  52. package/datasource-funifier-docs/knowledge/modules/virtual-good.md +510 -63
  53. package/datasource-funifier-docs/knowledge/modules/webhook.md +375 -28
  54. package/datasource-funifier-docs/knowledge/modules/websocket.md +459 -26
  55. package/datasource-funifier-docs/knowledge/modules/widget.md +613 -27
  56. package/dist/cli/init.d.ts.map +1 -1
  57. package/dist/cli/init.js +42 -1
  58. package/dist/cli/init.js.map +1 -1
  59. package/dist/cli/init.test.js +74 -3
  60. package/dist/cli/init.test.js.map +1 -1
  61. package/dist/cli/persona.d.ts +3 -0
  62. package/dist/cli/persona.d.ts.map +1 -0
  63. package/dist/cli/persona.js +25 -0
  64. package/dist/cli/persona.js.map +1 -0
  65. package/dist/mcp/bundle.js +119 -93
  66. package/dist/mcp/check-update.d.ts +5 -0
  67. package/dist/mcp/check-update.d.ts.map +1 -1
  68. package/dist/mcp/check-update.js +21 -10
  69. package/dist/mcp/check-update.js.map +1 -1
  70. package/dist/mcp/check-update.test.d.ts +2 -0
  71. package/dist/mcp/check-update.test.d.ts.map +1 -0
  72. package/dist/mcp/check-update.test.js +33 -0
  73. package/dist/mcp/check-update.test.js.map +1 -0
  74. package/dist/mcp/index.js +2 -2
  75. package/dist/mcp/index.js.map +1 -1
  76. package/dist/mcp/prompts/templates.d.ts.map +1 -1
  77. package/dist/mcp/prompts/templates.js +35 -0
  78. package/dist/mcp/prompts/templates.js.map +1 -1
  79. package/dist/mcp/resources/documentation.d.ts +1 -1
  80. package/dist/mcp/resources/documentation.d.ts.map +1 -1
  81. package/dist/mcp/resources/documentation.js +39 -3
  82. package/dist/mcp/resources/documentation.js.map +1 -1
  83. package/dist/mcp/tools/connect.d.ts.map +1 -1
  84. package/dist/mcp/tools/connect.js +18 -8
  85. package/dist/mcp/tools/connect.js.map +1 -1
  86. package/dist/mcp/tools/database.d.ts.map +1 -1
  87. package/dist/mcp/tools/database.js +59 -47
  88. package/dist/mcp/tools/database.js.map +1 -1
  89. package/dist/mcp/tools/database.test.js +2 -2
  90. package/dist/mcp/tools/database.test.js.map +1 -1
  91. package/dist/mcp/tools/delete.d.ts.map +1 -1
  92. package/dist/mcp/tools/delete.js +13 -3
  93. package/dist/mcp/tools/delete.js.map +1 -1
  94. package/dist/mcp/tools/execute.d.ts.map +1 -1
  95. package/dist/mcp/tools/execute.js +20 -9
  96. package/dist/mcp/tools/execute.js.map +1 -1
  97. package/dist/mcp/tools/folder.d.ts.map +1 -1
  98. package/dist/mcp/tools/folder.js +22 -12
  99. package/dist/mcp/tools/folder.js.map +1 -1
  100. package/dist/mcp/tools/get.d.ts.map +1 -1
  101. package/dist/mcp/tools/get.js +16 -6
  102. package/dist/mcp/tools/get.js.map +1 -1
  103. package/dist/mcp/tools/index.d.ts +1 -1
  104. package/dist/mcp/tools/index.d.ts.map +1 -1
  105. package/dist/mcp/tools/index.js +28 -1
  106. package/dist/mcp/tools/index.js.map +1 -1
  107. package/dist/mcp/tools/list.d.ts.map +1 -1
  108. package/dist/mcp/tools/list.js +38 -14
  109. package/dist/mcp/tools/list.js.map +1 -1
  110. package/dist/mcp/tools/logs.d.ts.map +1 -1
  111. package/dist/mcp/tools/logs.js +15 -5
  112. package/dist/mcp/tools/logs.js.map +1 -1
  113. package/dist/mcp/tools/save.d.ts.map +1 -1
  114. package/dist/mcp/tools/save.js +14 -4
  115. package/dist/mcp/tools/save.js.map +1 -1
  116. package/dist/mcp/tools/save.test.js +3 -3
  117. package/dist/mcp/tools/save.test.js.map +1 -1
  118. package/dist/mcp/tools/search-docs.d.ts +3 -0
  119. package/dist/mcp/tools/search-docs.d.ts.map +1 -0
  120. package/dist/mcp/tools/search-docs.js +102 -0
  121. package/dist/mcp/tools/search-docs.js.map +1 -0
  122. package/package.json +6 -2
  123. package/skills/acquire-funifier-knowledge/SKILL.md +155 -0
  124. package/skills/acquire-funifier-knowledge/assets/templates/CONCERNS.md +25 -0
  125. package/skills/acquire-funifier-knowledge/assets/templates/CUSTOM_ENDPOINTS.md +24 -0
  126. package/skills/acquire-funifier-knowledge/assets/templates/CUSTOM_PAGES.md +24 -0
  127. package/skills/acquire-funifier-knowledge/assets/templates/GAME_MECHANICS.md +35 -0
  128. package/skills/acquire-funifier-knowledge/assets/templates/INTEGRATIONS.md +35 -0
  129. package/skills/acquire-funifier-knowledge/assets/templates/LEADERBOARDS.md +24 -0
  130. package/skills/acquire-funifier-knowledge/assets/templates/OVERVIEW.md +86 -0
  131. package/skills/acquire-funifier-knowledge/assets/templates/PLAYER_MODEL.md +31 -0
  132. package/skills/acquire-funifier-knowledge/assets/templates/SCHEDULERS.md +25 -0
  133. package/skills/acquire-funifier-knowledge/assets/templates/TECHNIQUES_AND_PATTERNS.md +26 -0
  134. package/skills/acquire-funifier-knowledge/assets/templates/TRIGGERS.md +27 -0
  135. package/skills/acquire-funifier-knowledge/references/funifier-inventory-checklist.md +81 -0
  136. package/skills/acquire-funifier-knowledge/references/game-techniques-taxonomy.md +62 -0
  137. package/skills/acquire-funifier-knowledge/references/mcp-call-patterns.md +118 -0
  138. package/skills/funifier/SKILL.md +88 -0
  139. package/skills/funifier/references/configure-security.md +96 -0
  140. package/skills/{funifier-create-action/SKILL.md → funifier/references/create-action.md} +0 -33
  141. package/skills/funifier/references/create-aggregate.md +144 -0
  142. package/skills/funifier/references/create-challenge.md +116 -0
  143. package/skills/funifier/references/create-competition.md +98 -0
  144. package/skills/funifier/references/create-crossword.md +574 -0
  145. package/skills/funifier/references/create-custom-object.md +91 -0
  146. package/skills/funifier/references/create-custom-page.md +135 -0
  147. package/skills/funifier/references/create-folder.md +104 -0
  148. package/skills/funifier/references/create-lastmile.md +643 -0
  149. package/skills/{funifier-create-leaderboard/SKILL.md → funifier/references/create-leaderboard.md} +0 -33
  150. package/skills/funifier/references/create-level.md +94 -0
  151. package/skills/funifier/references/create-lottery.md +913 -0
  152. package/skills/funifier/references/create-mystery.md +769 -0
  153. package/skills/funifier/references/create-notification.md +75 -0
  154. package/skills/{funifier-create-point/SKILL.md → funifier/references/create-point.md} +0 -33
  155. package/skills/funifier/references/create-quiz.md +98 -0
  156. package/skills/funifier/references/create-scheduler.md +141 -0
  157. package/skills/funifier/references/create-story.md +636 -0
  158. package/skills/funifier/references/create-swap.md +95 -0
  159. package/skills/{funifier-create-trigger/SKILL.md → funifier/references/create-trigger.md} +0 -33
  160. package/skills/funifier/references/create-virtual-good.md +96 -0
  161. package/skills/funifier/references/create-webhook.md +72 -0
  162. package/skills/funifier/references/create-websocket.md +71 -0
  163. package/skills/funifier/references/create-widget.md +76 -0
  164. package/skills/funifier/references/debug.md +87 -0
  165. package/skills/funifier/references/help.md +81 -0
  166. package/skills/funifier/references/implement-frontend.md +106 -0
  167. package/skills/funifier/references/import-csv.md +75 -0
  168. package/skills/funifier/references/manage-player.md +82 -0
  169. package/skills/funifier/references/manage-team.md +76 -0
  170. package/skills/funifier/references/upload-file.md +91 -0
  171. package/skills/funifier-create-aggregate/SKILL.md +0 -127
  172. package/skills/funifier-create-challenge/SKILL.md +0 -88
  173. package/skills/funifier-create-custom-page/SKILL.md +0 -127
  174. package/skills/funifier-create-level/SKILL.md +0 -87
  175. package/skills/funifier-create-quiz/SKILL.md +0 -87
  176. package/skills/funifier-create-scheduler/SKILL.md +0 -127
  177. package/skills/funifier-create-virtual-good/SKILL.md +0 -87
  178. package/skills/funifier-debug/SKILL.md +0 -92
  179. package/skills/funifier-help/SKILL.md +0 -86
  180. package/skills/funifier-implement-frontend/SKILL.md +0 -90
  181. package/skills/funifier-index/SKILL.md +0 -58
@@ -0,0 +1,86 @@
1
+ # Funifier — Overview da Instância
2
+
3
+ > Snapshot gerado pela skill `acquire-funifier-knowledge`. Substitua todos os `{{...}}`. Não deixe seções vazias — use `[TODO]`/`[ASK USER]`.
4
+
5
+ ## Core (Obrigatório)
6
+
7
+ ### Identificação
8
+ - **Instância:** {{nome/serverUrl}}
9
+ - **Data do snapshot:** {{YYYY-MM-DD}}
10
+ - **Escopo do mapeamento:** {{completo | foco em <área>}}
11
+
12
+ ### Contagens agregadas
13
+ Contagem por tipo listável (preencha 0 quando não houver — não omita):
14
+
15
+ | Tipo | Qtde |
16
+ |------|------|
17
+ | trigger | {{n}} |
18
+ | scheduler | {{n}} |
19
+ | action | {{n}} |
20
+ | challenge | {{n}} |
21
+ | point | {{n}} |
22
+ | level | {{n}} |
23
+ | leaderboard | {{n}} |
24
+ | quiz | {{n}} |
25
+ | virtual-good-catalog | {{n}} |
26
+ | virtual-good-item | {{n}} |
27
+ | public-endpoint | {{n}} |
28
+ | custom-page | {{n}} |
29
+ | widget | {{n}} |
30
+ | websocket | {{n}} |
31
+ | aggregate | {{n}} |
32
+ | challenge-aggregate | {{n}} |
33
+ | auth-module | {{n}} |
34
+ | ai-knowledge | {{n}} |
35
+
36
+ ### Elementos fora do enum (via coleções)
37
+ | Elemento | Coleção | Qtde aprox. |
38
+ |----------|---------|-------------|
39
+ | {{webhook/notification/competition/...}} | {{collection}} | {{n}} |
40
+
41
+ ### Mapa de Arquitetura
42
+
43
+ Visão macro de "o que dispara/premia/alimenta/chama o quê". **Regras:** toda aresta vem de um campo real (trigger `entity`/`event`, recompensa de challenge, métrica de leaderboard, preço de virtual-good...) e o mesmo fato aparece no doc da categoria; relação incerta = `-.->` `[ASK USER]`; categoria com >8 objetos = um único nó com a contagem (`challenges["challenges (×24)"]`). Verbos permitidos: `dispara`, `premia`, `alimenta`, `exige`, `lê`, `chama`. Substitua os `{{...}}` por IDs de nó saneados (`[A-Za-z0-9_]`) e remova as arestas sem relação comprovada.
44
+
45
+ ```mermaid
46
+ flowchart LR
47
+ subgraph Acoes["Ações & Eventos"]
48
+ {{act_id}}["{{nome}} · action"]
49
+ end
50
+ subgraph Automacao["Automação"]
51
+ {{trigger_id}}["{{nome}} · trigger"]
52
+ {{scheduler_id}}["{{nome}} · scheduler"]
53
+ end
54
+ subgraph Mecanicas["Mecânicas"]
55
+ {{challenge_id}}["{{nome}} · challenge"]
56
+ {{level_id}}["{{nome}} · level"]
57
+ end
58
+ subgraph Recompensas["Recompensas"]
59
+ {{point_id}}["{{nome}} · point"]
60
+ {{vg_id}}["{{nome}} · virtual-good"]
61
+ end
62
+ subgraph Visualizacao["Visualização"]
63
+ {{leaderboard_id}}["{{nome}} · leaderboard"]
64
+ {{aggregate_id}}["{{nome}} · aggregate"]
65
+ end
66
+ subgraph Integracoes["Integrações"]
67
+ {{endpoint_id}}["{{nome}} · public-endpoint"]
68
+ end
69
+
70
+ {{act_id}} -->|alimenta| {{challenge_id}}
71
+ {{trigger_id}} -->|premia| {{point_id}}
72
+ {{challenge_id}} -->|premia| {{vg_id}}
73
+ {{point_id}} -->|alimenta| {{leaderboard_id}}
74
+ {{level_id}} -->|exige| {{point_id}}
75
+ {{aggregate_id}} -->|lê| {{point_id}}
76
+ {{scheduler_id}} -.->|chama [ASK USER]| {{endpoint_id}}
77
+ ```
78
+
79
+ ## Extended (Opcional)
80
+ - Versão/plano da instância, se conhecido.
81
+ - Principais áreas funcionais identificadas (resumo de 2-3 linhas).
82
+
83
+ ## Evidence
84
+ - `funifier_list type=<cada um dos 18 tipos>`
85
+ - `funifier_database action=collections`
86
+ - Mapa de arquitetura: cada aresta é evidenciada pelo objeto/campo que a sustenta, documentado no doc da categoria correspondente ({{ex.: TRIGGERS.md #id, GAME_MECHANICS.md #id}}).
@@ -0,0 +1,31 @@
1
+ # Funifier — Modelo de Player
2
+
3
+ > Derivado de amostragem das coleções `player`/`team` (read-only) e dos auth modules. Não invente atributos — liste só os que aparecem nos documentos amostrados. Intenção de negócio → `[ASK USER]`.
4
+
5
+ ## Core (Obrigatório)
6
+
7
+ ### Atributos custom de player
8
+ Campos além dos padrão observados na amostra de `collection=player`:
9
+
10
+ | Campo | Tipo observado | Exemplo (anonimizado) | Propósito inferido |
11
+ |-------|----------------|-----------------------|--------------------|
12
+ | {{campo}} | {{string/number/bool/...}} | {{ex}} | {{para quê | [ASK USER]}} |
13
+
14
+ ### Segmentações / Teams
15
+ | Segmentação | Fonte (campo/coleção) | Valores observados |
16
+ |-------------|-----------------------|--------------------|
17
+ | {{team/hierarquia/extra}} | {{collection.field}} | {{valores}} |
18
+
19
+ ### Auth modules
20
+ | _id | title | Propósito | Status |
21
+ |-----|-------|-----------|--------|
22
+ | {{id}} | {{título}} | {{login/SSO/...}} | {{ativo?}} |
23
+
24
+ ## Extended (Opcional)
25
+ - Volume aproximado de players (via `funifier_database`).
26
+ - Propriedades estendidas usadas por challenges/leaderboards como filtro.
27
+
28
+ ## Evidence
29
+ - `funifier_database action=query collection=player limit=3`
30
+ - `funifier_database action=query collection=team limit=5`
31
+ - `funifier_list type=auth-module`
@@ -0,0 +1,25 @@
1
+ # Funifier — Schedulers
2
+
3
+ > Tarefas agendadas (cron, Groovy). Scheduler `active: false` que parece importante → `CONCERNS.md` + `[ASK USER]`.
4
+
5
+ ## Core (Obrigatório)
6
+
7
+ | _id | name | cron | Ação executada | Última execução | Status |
8
+ |-----|------|------|----------------|-----------------|--------|
9
+ | {{id}} | {{nome}} | {{expr cron}} | {{o que faz}} | {{via funifier_logs | [TODO]}} | {{active?}} |
10
+
11
+ ### Detalhe por scheduler (quando relevante)
12
+ **{{name}}** (`{{_id}}`)
13
+ - Cron: `{{expressão}}` ({{interpretação em linguagem natural}})
14
+ - O que faz: {{resumo do script}}
15
+ - Chama endpoint/coleção: {{refs, se houver}}
16
+ - Saúde: {{logs recentes? erros? | [TODO]}}
17
+
18
+ ## Extended (Opcional)
19
+ - Próxima execução estimada (se derivável do cron).
20
+ - Schedulers que dependem de dados produzidos por triggers/aggregates.
21
+
22
+ ## Evidence
23
+ - `funifier_list type=scheduler`
24
+ - `funifier_get mode=read type=scheduler id=<...>`
25
+ - `funifier_logs type=scheduler id=<...>`
@@ -0,0 +1,26 @@
1
+ # Funifier — Técnicas e Padrões de Jogo
2
+
3
+ > Inferência cruzada — NÃO introduz dados novos. Cada técnica afirmada DEVE listar os IDs que a implementam. Sem objeto que a sustente, a técnica está ausente. Use a taxonomia em `references/game-techniques-taxonomy.md`.
4
+
5
+ ## Core (Obrigatório)
6
+
7
+ Para cada técnica presente, use este formato:
8
+
9
+ ### {{Nome da técnica}}
10
+ {{Presente | Parcial | Ausente}}. {{Como é implementada nesta instância}}
11
+ - {{Objeto e ID que implementa}}
12
+ - {{Objeto e ID que implementa}}
13
+
14
+ (Repita para cada técnica observada: loops de feedback, progressão, competição, colaboração, recompensas/economia, conquistas/status, escassez/urgência, surpresa/sorte, narrativa, onboarding.)
15
+
16
+ ### Técnicas ausentes (notáveis)
17
+ Liste técnicas comuns que NÃO foram encontradas, se relevante para o diagnóstico — ex.: "Colaboração: ausente — nenhum team ou challenge coletivo configurado."
18
+
19
+ ## Extended (Opcional)
20
+ - Padrões de design observados (ex.: signup flow, daily streak) com os triggers/schedulers que os compõem.
21
+ - Lacunas: técnicas iniciadas mas incompletas (ex.: points sem leaderboard que os exiba).
22
+
23
+ ## Evidence
24
+ Liste, por técnica, as chamadas/IDs que sustentam a inferência. Ex.:
25
+ - Progressão → `funifier_list type=level`; `funifier_get type=point id=<...>`
26
+ - Competição → `funifier_list type=leaderboard`
@@ -0,0 +1,27 @@
1
+ # Funifier — Triggers
2
+
3
+ > Eventos que disparam ações server-side (Groovy). Não escreva "provavelmente dispara X" — cite `entity`/`event` exatos. Trigger ativo sem logs → mova para `CONCERNS.md`.
4
+
5
+ ## Core (Obrigatório)
6
+
7
+ | _id | name | entity | event | Condições | Ações executadas | Status |
8
+ |-----|------|--------|-------|-----------|------------------|--------|
9
+ | {{id}} | {{nome}} | {{entity}} | {{event}} | {{condições do script}} | {{o que faz}} | {{ativo/inativo}} |
10
+
11
+ ### Detalhe por trigger (quando relevante)
12
+ Para triggers com lógica não-trivial, documente o resumo do script:
13
+
14
+ **{{name}}** (`{{_id}}`)
15
+ - Origem: `{{entity}}` / `{{event}}`
16
+ - O que faz: {{resumo do comportamento, baseado no script Groovy}}
17
+ - Objetos afetados: {{point/challenge/coleção que ele toca}}
18
+ - Última execução conhecida: {{timestamp via funifier_logs | [TODO]}}
19
+
20
+ ## Extended (Opcional)
21
+ - Triggers agrupados por evento de origem.
22
+ - Dependências entre triggers (um cria um log que outro consome).
23
+
24
+ ## Evidence
25
+ - `funifier_list type=trigger`
26
+ - `funifier_get mode=read type=trigger id=<...>`
27
+ - `funifier_logs type=trigger id=<...>`
@@ -0,0 +1,81 @@
1
+ # Checklist de inventário Funifier
2
+
3
+ Use na Fase 2 para garantir cobertura. Para cada categoria, faça a chamada MCP indicada e responda as perguntas. Marque `[TODO]` se a chamada falhar e `[ASK USER]` se a resposta depender de intenção de negócio. Cada categoria indica em qual documento o resultado entra.
4
+
5
+ ## Mecânicas de jogo → `GAME_MECHANICS.md`
6
+
7
+ **Pontos** (`funifier_list type=point`)
8
+ - Quantas categorias de ponto existem? Quais `category` e `shortName`?
9
+ - Cada categoria é XP, moeda resgatável, ou métrica interna?
10
+
11
+ **Níveis** (`funifier_list type=level`)
12
+ - Quantos níveis? Qual `minPoints` e `position` de cada um?
13
+ - A qual categoria de ponto a progressão está atrelada?
14
+
15
+ **Challenges / achievements** (`funifier_list type=challenge` → `funifier_get mode=read`)
16
+ - Quantos challenges? Quais regras (`rules`) e recompensas (`points`) de cada um?
17
+ - Algum é inatingível (regra impossível, ação inexistente)? → `CONCERNS.md`
18
+ - Há cadeias que representam "missions"? → marque `[ASK USER]`
19
+
20
+ **Actions** (`funifier_list type=action`)
21
+ - Quais comportamentos rastreáveis existem? Quais `attributes`?
22
+ - Alguma action está definida mas não é referenciada por nenhum challenge/trigger? → `CONCERNS.md`
23
+
24
+ **Quizzes** (`funifier_list type=quiz`)
25
+ - Quantos quizzes? Qual o critério de aprovação (`grade`)?
26
+
27
+ **Virtual goods** (`funifier_list type=virtual-good-catalog` e `type=virtual-good-item`)
28
+ - Quais catálogos e itens? Itens `active`? Preço (`amount`) e categoria de ponto usada?
29
+ - Algum item funciona como badge (recompensa simbólica)?
30
+
31
+ **Aggregates** (`funifier_list type=aggregate`, `type=challenge-aggregate`)
32
+ - Quais pipelines alimentam dashboards/relatórios? Sobre qual `collection`?
33
+
34
+ ## Triggers → `TRIGGERS.md`
35
+
36
+ `funifier_list type=trigger` → `funifier_get mode=read` nos relevantes → `funifier_logs type=trigger`
37
+ - Para cada trigger: `name`, `_id`, `entity`, `event`, `status`.
38
+ - Quais condições e quais ações executa (resumo do script Groovy)?
39
+ - Está ativo? Tem logs de execução recentes? → silêncio = `CONCERNS.md`
40
+
41
+ ## Schedulers → `SCHEDULERS.md`
42
+
43
+ `funifier_list type=scheduler` → `funifier_get mode=read` → `funifier_logs type=scheduler`
44
+ - Para cada scheduler: `name`, `_id`, expressão `cron`, `active`/`status`.
45
+ - Qual ação executa? Última execução conhecida (via logs)?
46
+ - Está `active: false` mas parece importante? → `CONCERNS.md` + `[ASK USER]`
47
+
48
+ ## Custom endpoints → `CUSTOM_ENDPOINTS.md`
49
+
50
+ `funifier_list type=public-endpoint` → `funifier_get mode=read`
51
+ - Para cada endpoint: rota, método, parâmetros esperados, descrição, status.
52
+ - Algum endpoint não é chamado por nenhum scheduler/trigger/página? → `CONCERNS.md`
53
+
54
+ ## Custom pages e widgets → `CUSTOM_PAGES.md`
55
+
56
+ `funifier_list type=custom-page` e `type=widget`
57
+ - Para cada um: `title`, rota, propósito, integrações (quais endpoints/aggregates consome).
58
+
59
+ ## Leaderboards → `LEADERBOARDS.md`
60
+
61
+ `funifier_list type=leaderboard` → `funifier_get mode=read`
62
+ - Para cada ranking: nome, métrica base (qual `point`/action/atributo), escopo (global/segmentado), período, regra de empate.
63
+
64
+ ## Modelo de player → `PLAYER_MODEL.md`
65
+
66
+ `funifier_database action=query collection=player limit=3` (amostra) + `funifier_list type=auth-module`
67
+ - Quais atributos custom aparecem nos documentos de player (campos além dos padrão)?
68
+ - Há segmentações (`team`, hierarquia, extras)? Amostre `collection=team`.
69
+ - Quais auth modules estão configurados?
70
+
71
+ ## Integrações → `INTEGRATIONS.md`
72
+
73
+ `funifier_list type=websocket`, `type=ai-knowledge` + `funifier_database action=collections`
74
+ - Há websockets configurados? Para quê?
75
+ - Existe coleção de webhook/notification? Quais destinos externos?
76
+ - Há triggers cujo script chama URLs externas? (descoberto no detalhamento)
77
+ - Auth/integração externa configurada? → muitos itens aqui serão `[TODO]`/`[ASK USER]`.
78
+
79
+ ## Cobertura final
80
+
81
+ Antes de sair da Fase 2, confirme que rodou `funifier_list` para **todos os 18 tipos** e `funifier_database action=collections` ao menos uma vez. Qualquer tipo com zero resultados deve ser registrado no `OVERVIEW.md` como contagem 0 (não omitido).
@@ -0,0 +1,62 @@
1
+ # Taxonomia de técnicas de jogos
2
+
3
+ Use na Fase 5 para classificar as técnicas observadas com vocabulário consistente. **Regra de ouro:** uma técnica só pode ser afirmada se houver um ou mais objetos Funifier concretos que a implementem. Para cada técnica que você reportar em `TECHNIQUES_AND_PATTERNS.md`, liste os IDs que a sustentam. Se não há objeto, a técnica não está presente — não a invente.
4
+
5
+ ## Como classificar
6
+
7
+ Para cada técnica abaixo, pergunte: "Quais objetos mapeados (com ID) implementam isto?" Se a resposta for vazia, marque a técnica como **ausente** (ou omita). Se houver evidência parcial, marque `[ASK USER]` para confirmar a intenção.
8
+
9
+ ## Catálogo de técnicas
10
+
11
+ ### Loops de feedback (feedback loops)
12
+ Resposta imediata a uma ação do jogador.
13
+ - **Evidência típica:** `trigger` que credita `point` ao registrar uma `action`; notificações `on_win`; widgets de status que atualizam.
14
+ - **Sinal de ausência:** actions registradas sem nenhum trigger/point reagindo.
15
+
16
+ ### Progressão (progression)
17
+ Senso de avanço ao longo do tempo.
18
+ - **Evidência típica:** `level` com `minPoints` crescentes; learning trail (folder) com desbloqueio condicional; cadeias de `challenge`.
19
+
20
+ ### Competição (competition)
21
+ Comparação de desempenho entre jogadores.
22
+ - **Evidência típica:** `leaderboard` (global ou segmentado); competições com prêmio por posição; ranking por `team`.
23
+
24
+ ### Colaboração (collaboration)
25
+ Objetivos coletivos.
26
+ - **Evidência típica:** `team`/grupos no modelo de player; challenges com `limitPerType=team`; leaderboards de time.
27
+
28
+ ### Recompensas e economia (rewards & economy)
29
+ Incentivos tangíveis e moeda interna.
30
+ - **Evidência típica:** `point` resgatável; `virtual-good-catalog`/`virtual-good-item`; mecânicas de troca/loja.
31
+
32
+ ### Conquistas e status (achievement & status)
33
+ Marcos simbólicos.
34
+ - **Evidência típica:** `challenge` de conclusão única; itens-badge no catálogo; títulos por nível.
35
+
36
+ ### Escassez e urgência (scarcity & urgency)
37
+ Tempo ou quantidade limitados.
38
+ - **Evidência típica:** challenges com janela de tempo (`limitTimeScale`); competições com data de fim; `scheduler` que abre/fecha temporadas.
39
+
40
+ ### Surpresa e sorte (surprise & chance)
41
+ Recompensa aleatória.
42
+ - **Evidência típica:** mystery box / sorteios (descobertos via `funifier_database`, fora do enum de `funifier_list`).
43
+
44
+ ### Narrativa (narrative)
45
+ Contexto de história que dá sentido às ações.
46
+ - **Evidência típica:** interactive story; nomenclatura temática de challenges/folders; conteúdo de páginas custom.
47
+
48
+ ### Onboarding e tutorial
49
+ Condução dos primeiros passos.
50
+ - **Evidência típica:** trigger no evento de cadastro/primeiro login; primeira etapa de uma learning trail; challenge introdutório.
51
+
52
+ ## Bloco de evidência por técnica
53
+
54
+ Em `TECHNIQUES_AND_PATTERNS.md`, formate cada técnica assim:
55
+
56
+ ```
57
+ ### Progressão
58
+ Presente. Implementada por:
59
+ - Níveis L1–L5 (level _id: lvl_01..lvl_05), atrelados à categoria de ponto "xp" (point _id: pts_xp).
60
+ - Trilha "Onboarding" (folder root: fld_onboarding) com desbloqueio sequencial.
61
+ Evidence: funifier_list type=level; funifier_get type=point id=pts_xp; funifier_folder operation=inside folder=fld_onboarding
62
+ ```
@@ -0,0 +1,118 @@
1
+ # Padrões de chamada MCP (auditoria read-only)
2
+
3
+ Padrões recomendados para varrer uma instância Funifier sem modificá-la. Leia na Fase 2–4. Toda chamada aqui é segura (somente leitura). As ferramentas de escrita (`funifier_save`, `funifier_delete`, `funifier_execute`, e `funifier_database` com `insert`/`update`/`delete`/`bulk`, e `funifier_folder operation=progress`) são **proibidas** nesta skill.
4
+
5
+ ## Ferramentas disponíveis
6
+
7
+ | Ferramenta | Uso na auditoria | Read-only? |
8
+ |-----------|------------------|-----------|
9
+ | `funifier_connect` | Conectar/trocar de instância (só se não houver `funifier.json`/env vars) | escrita de sessão, sem efeito no servidor |
10
+ | `funifier_list` | Inventário: lista resumida (sem scripts) de um dos 18 tipos | sim |
11
+ | `funifier_get` | Detalhe completo de um objeto — use `mode=read` | sim (em `mode=read`) |
12
+ | `funifier_logs` | Saúde de execução de `trigger`/`scheduler` | sim |
13
+ | `funifier_database` | `query`/`aggregate`/`collections` para coleções e modelo de player | sim (só nessas 3 actions) |
14
+ | `funifier_folder` | `inside`/`breadcrumb` para learning trails | sim (NÃO use `progress`) |
15
+ | `funifier_search_docs` | Buscar a semântica de um campo na base de docs | sim |
16
+
17
+ ## Os 18 tipos listáveis
18
+
19
+ `funifier_list` e `funifier_get` aceitam exatamente estes valores no parâmetro `type`:
20
+
21
+ ```
22
+ trigger, scheduler, aggregate, websocket, widget, custom-page,
23
+ public-endpoint, challenge-aggregate, auth-module, ai-knowledge,
24
+ action, challenge, point, level, leaderboard, quiz,
25
+ virtual-good-catalog, virtual-good-item
26
+ ```
27
+
28
+ Qualquer coisa fora desta lista (webhooks, notifications, competitions, lotteries, mystery boxes, stories, crosswords, swaps, teams, players, custom objects `__c`, folders/trilhas) **não é listável** por `funifier_list` — descubra via `funifier_database action=collections` ou `funifier_folder`.
29
+
30
+ ## Fase 1 — validar conexão
31
+
32
+ ```
33
+ funifier_database action=collections
34
+ ```
35
+
36
+ Se retornar a lista de coleções, o MCP está conectado. (Alternativa leve: `funifier_list type=trigger limit=1`.) Registre o serverUrl/nome da conexão e a data de hoje como data do snapshot.
37
+
38
+ ## Fase 2 — inventário bruto
39
+
40
+ Para cada um dos 18 tipos, liste e registre IDs + nomes:
41
+
42
+ ```
43
+ funifier_list type=trigger
44
+ funifier_list type=scheduler
45
+ funifier_list type=challenge
46
+ ... (repita para os 18 tipos)
47
+ ```
48
+
49
+ Dicas:
50
+ - O retorno é um **resumo** (sem scripts/código) — ideal para inventário barato.
51
+ - Use `search` para filtrar por nome/entidade/evento/coleção (OR com vírgula): `funifier_list type=trigger search="login, video"`.
52
+ - Use `limit`/`offset` para paginar instâncias grandes; o cabeçalho indica `offset` da próxima página.
53
+
54
+ Descubra elementos fora do enum:
55
+
56
+ ```
57
+ funifier_database action=collections
58
+ ```
59
+
60
+ Procure coleções como `webhook`, `notification`, `competition`, `player`, `team`, e custom objects (sufixo `__c`). Cada uma vira fonte de um documento (player/team → `PLAYER_MODEL.md`; webhook/notification → `INTEGRATIONS.md`).
61
+
62
+ ## Fase 3 — detalhamento
63
+
64
+ Detalhe completo de um objeto (inclui scripts/regras), sem criar arquivos temporários:
65
+
66
+ ```
67
+ funifier_get type=trigger id="<id ou nome>" mode=read
68
+ funifier_get type=challenge id="<id>" mode=read
69
+ ```
70
+
71
+ - `mode=read` retorna JSON inline (até ~50k chars). Acima disso, ele salva num arquivo temp e avisa o caminho — use `Read` para inspecionar. **Não** use `mode=edit` (cria arquivos companion para edição, que não é o objetivo).
72
+ - Para limitar o tamanho, peça só os campos necessários: `funifier_get type=trigger id="x" mode=read fields=["name","entity","event","status"]`.
73
+
74
+ Amostre o modelo de player/team (poucos documentos, só para entender o schema):
75
+
76
+ ```
77
+ funifier_database action=query collection=player limit=3
78
+ funifier_database action=query collection=team limit=5
79
+ ```
80
+
81
+ Para filtros com operadores MongoDB, use `aggregate`:
82
+
83
+ ```
84
+ funifier_database action=aggregate collection=player \
85
+ pipeline=[{"$match": {"active": true}}, {"$limit": 3}]
86
+ ```
87
+
88
+ ## Saúde de execução (Fases 3–4)
89
+
90
+ Logs de um trigger ou scheduler (coletados no detalhamento da Fase 3; alimentam a análise cruzada da Fase 4, `CONCERNS.md` e `SCHEDULERS.md`):
91
+
92
+ ```
93
+ funifier_logs type=trigger id="<id>"
94
+ funifier_logs type=scheduler id="<id>"
95
+ ```
96
+
97
+ Sinais para `CONCERNS.md`: scheduler `active` mas sem logs recentes; trigger ativo que nunca executou; erros recorrentes nos logs.
98
+
99
+ ## Learning trails (folders)
100
+
101
+ Não há `funifier_list type=folder`. A partir de um id raiz conhecido (descoberto numa coleção ou citado pelo usuário):
102
+
103
+ ```
104
+ funifier_folder operation=inside payload={"folder": "<rootId>"}
105
+ funifier_folder operation=breadcrumb payload={"folder": "<nodeId>"}
106
+ ```
107
+
108
+ NUNCA use `operation=progress` — ele dispara o trigger `folder_progress` e contamina os dados da instância.
109
+
110
+ ## Consultar a semântica de um campo
111
+
112
+ Quando não souber o que um campo significa (ex.: `range`, `operator`, `limitPerType` num challenge), busque nos docs em vez de adivinhar:
113
+
114
+ ```
115
+ funifier_search_docs "challenge range operator"
116
+ ```
117
+
118
+ A skill `funifier` (`skills/funifier/references/`) é a autoridade sobre semântica — prefira-a a inferir do objeto vivo.
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: funifier
3
+ description: >
4
+ Routes to the correct workflow for any Funifier task — creating or managing actions,
5
+ challenges, points, leaderboards, triggers, schedulers, aggregates, quizzes, virtual goods,
6
+ custom pages, and frontend implementation. Check this skill first before using any funifier_* MCP tool.
7
+ ---
8
+
9
+ # Funifier
10
+
11
+ ## ⚠ Rule
12
+
13
+ **Before using any `funifier_*` MCP tool or starting any Funifier task**, find the matching row in the routing table below and **read the referenced file before acting**. Reference files contain the correct field values, enum tables, and examples that prevent common errors.
14
+
15
+ Only proceed directly with MCP tools when no row matches.
16
+
17
+ ## Usage
18
+
19
+ 1. Identify what the user wants to do
20
+ 2. Find the matching row in the routing table below
21
+ 3. Read the file listed in the Reference column
22
+ 4. Follow the workflow in that file
23
+
24
+ For general questions with no matching task, run lexical search:
25
+
26
+ ```bash
27
+ npx funifier-mcp search "<user question>"
28
+ ```
29
+
30
+ ## Routing Table
31
+
32
+ | When to use | Reference |
33
+ |-------------|-----------|
34
+ | Create a Funifier trigger — guided workflow from entity/event selection to Groovy code generation | `references/create-trigger.md` |
35
+ | Create a Funifier scheduler — guided workflow from naming and cron expression to Groovy code generation | `references/create-scheduler.md` |
36
+ | Create a Funifier prepared aggregate — guided workflow for building MongoDB aggregate pipelines for reports and dashboards | `references/create-aggregate.md` |
37
+ | Create a Funifier challenge — missions with action rules and point rewards | `references/create-challenge.md` |
38
+ | Create a Funifier action — define trackable player behaviors with attributes | `references/create-action.md` |
39
+ | Create a Funifier point category — XP, coins, or custom metrics | `references/create-point.md` |
40
+ | Create Funifier levels — progression system based on accumulated points | `references/create-level.md` |
41
+ | Create a Funifier leaderboard — rankings by points, actions, or attributes | `references/create-leaderboard.md` |
42
+ | Create a Funifier quiz — questionnaires with multiple-choice questions | `references/create-quiz.md` |
43
+ | Create a Funifier virtual good — catalog items players can purchase with points | `references/create-virtual-good.md` |
44
+ | Create a Funifier Studio custom page — guided workflow for building admin dashboards, CRUDs, reports, and KPI pages using AngularJS + Bootstrap | `references/create-custom-page.md` |
45
+ | Implement frontend code that consumes the Funifier API — authentication, data fetching, aggregate consumption, and static hosting on Funifier subdomain | `references/implement-frontend.md` |
46
+ | Debug a Funifier resource — systematic diagnosis of triggers, schedulers, aggregates, and other Funifier components | `references/debug.md` |
47
+ | Get help with Funifier — routes to the right documentation or skill based on your question | `references/help.md` |
48
+ | Register and manage Funifier players — CRUD workflow for participant onboarding, team assignment, extra-field management, and status queries; use at the start of every project to set up participants | `references/manage-player.md` |
49
+ | Create and manage Funifier teams — group players for collective challenges, team rankings, and collaborative goals; use when organizing players into competing or collaborating groups, not when only individual player setup is needed | `references/manage-team.md` |
50
+ | Create a Funifier competition — timed ranking contests with player enrollment, position-based rewards, and execution; use when you need player sign-up, prizes by finish position, or a scheduled end date, not when an always-on leaderboard is enough | `references/create-competition.md` |
51
+ | Create a Funifier learning trail (folder) — hierarchical courses with content types, progress tracking, conditional unlock policies, and trigger events; use when structuring sequenced training journeys, not when standalone challenges are enough | `references/create-folder.md` |
52
+ | Create a Funifier lottery — ticket-based prize draws with configurable draw dates, max winners, and rewards; use when running promotional prize drawings where players earn tickets, not when probability-based instant games are needed (use mystery box) | `references/create-lottery.md` |
53
+ | Create a Funifier mystery box — probability-based instant games (spin wheel, scratch card, coin flip) with configurable odds and rewards; use for random reward mechanics, not for ticket-based draws with scheduled dates (use lottery) | `references/create-mystery.md` |
54
+ | Create a Funifier interactive story — branching narratives with player choices, scenes, and media for training or campaigns; use when building choose-your-own-adventure experiences, not when a linear quiz or folder trail is sufficient | `references/create-story.md` |
55
+ | Create a Funifier crossword puzzle game — themed word games with custom clues and grid positions for educational onboarding or marketing; use when building interactive word-based games, not when a multiple-choice quiz is enough | `references/create-crossword.md` |
56
+ | 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 | `references/create-notification.md` |
57
+ | Create a Funifier last-mile notification — motivational messages triggered when a player reaches a configured progress threshold near a challenge goal; use to boost completion rates, not as a general notification system | `references/create-lastmile.md` |
58
+ | Create a Funifier webhook — push real-time event payloads to external endpoints (BI, CRM, Slack, Teams); use when external systems need event-driven data from Funifier, not when in-app live updates are needed (use websocket) | `references/create-webhook.md` |
59
+ | Create a Funifier websocket configuration — real-time bidirectional communication for live competitions, instant player feedback, and chat; use for in-app live updates, not for pushing to external systems (use webhook) | `references/create-websocket.md` |
60
+ | Create a Funifier widget — embeddable visual components (rankings, challenge lists, player status, virtual stores) for integrating gamification displays into existing web systems like intranets, CRMs, or LMS platforms | `references/create-widget.md` |
61
+ | Create a Funifier swap — player-to-player trade offers for items or points with counter-proposal support; use when enabling peer trading or social exchange mechanics, not when a standard virtual good store purchase is sufficient | `references/create-swap.md` |
62
+ | Create and manage Funifier custom objects — domain-specific collections with the __c suffix for storing business entities (products, venues, categories) that do not fit standard modules; accessible via API, triggers, and schedulers | `references/create-custom-object.md` |
63
+ | Configure Funifier security settings — roles, scopes, app tokens, and auth parameters; use when setting up access control, fixing missing database scope errors, or configuring token expiry; not for writing frontend login code (use funifier-implement-frontend) | `references/configure-security.md` |
64
+ | Import or export Funifier platform data via CSV — bulk player import, performance export, and cross-system data migration; use when loading or extracting large datasets, not for individual record CRUD or media file uploads (use funifier-upload-file) | `references/import-csv.md` |
65
+ | Upload files to Funifier — images and documents for player avatars, challenge resources, and visual assets; use when adding media to the platform, not for CSV data import (use funifier-import-csv) or static frontend hosting (use funifier-implement-frontend) | `references/upload-file.md` |
66
+
67
+ ## Documented Modules
68
+
69
+ | Module | Description |
70
+ |--------|-------------|
71
+ | Auth | Login de jogadores, geração de tokens JWT, autenticação via API |
72
+ | Security | Configuração do documento de segurança — apps com app_secret, roles de jogador, escopos, pipeline de autorização e emissão de tokens Bearer |
73
+ | Player | Cadastro e gestão de utilizadores da aplicação |
74
+ | Database | CRUD em qualquer coleção, queries MongoDB, aggregates |
75
+ | Custom Object | Criar tabelas/coleções próprias (sufixo ) para dados de negócio |
76
+ | Upload | Upload de imagens e ficheiros (avatar, documentos, etc.) |
77
+ | Trigger | Escrever funções Java que executam no servidor quando eventos acontecem |
78
+ | Scheduler | Agendar tarefas automáticas (cron jobs, rotinas periódicas) |
79
+ | Public Endpoint | Criar APIs REST customizadas acessíveis sem autenticação |
80
+ | Webhook | Enviar dados para sistemas externos quando eventos acontecem |
81
+ | Patterns | Design patterns de implementação (signup, etc.) baseados em experiência real |
82
+
83
+ ## MCP
84
+
85
+ If Funifier MCP tools are available (`funifier_list`, `funifier_save`, `funifier_get`, `funifier_logs`):
86
+ - Use MCP for live server data
87
+ - Use docs for correct patterns and syntax
88
+ - Never learn patterns from existing live resources — docs are authoritative
@@ -0,0 +1,96 @@
1
+ # funifier-configure-security
2
+
3
+ Configure Funifier security settings — roles, scopes, app tokens, and auth parameters; use when setting up access control, fixing missing database scope errors, or configuring token expiry; not for writing frontend login code (use funifier-implement-frontend)
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 "security role scope token auth app permission basic bearer access-control" --skill funifier-configure-security
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/security.md`
22
+
23
+ ## Steps
24
+
25
+ ### Regras críticas
26
+
27
+ - **`timeout: ""` (string vazia) causa NPE** no auth — omita o campo ou use `"7d"`, nunca string vazia
28
+ - **Scope `database` é palavra-chave obrigatória** para `/v3/database` — `write_all` sozinho não basta
29
+ - **PUT é upsert total** — sempre inclua roles E apps existentes, senão serão perdidos
30
+ - **Token Basic da gamificação (público):** `base64(API_KEY + ":")` (dois-pontos no final, sem secret)
31
+ - **Token Basic do app (server-side):** `base64(API_KEY + ":" + APP_SECRET)`
32
+
33
+ ### Scopes importantes
34
+
35
+ | Scope | Descrição |
36
+ |---|---|
37
+ | `read_all` | Leitura em todas as coleções |
38
+ | `write_all` | Escrita em todos os endpoints |
39
+ | `delete_all` | Exclusão em todos os endpoints |
40
+ | `database` | **Obrigatório** para `/v3/database` (sem ele, escrita silencia sem erro) |
41
+ | `write_database_<coll>` | Escrita em coleção específica |
42
+
43
+ ---
44
+
45
+ ## Steps
46
+
47
+ ### 1. Obter configuração atual de segurança
48
+
49
+ ```
50
+ GET /v3/database/security/<API_KEY>?strict=true
51
+ Authorization: Bearer <studio_token>
52
+ ```
53
+
54
+ ### 2. Ler a documentação do módulo
55
+
56
+ ```
57
+ datasource-funifier-docs/knowledge/modules/security.md
58
+ ```
59
+
60
+ ### 3. Definir roles e apps
61
+
62
+ Configuração padrão para projetos com frontend:
63
+ ```json
64
+ {
65
+ "_id": "API_KEY",
66
+ "roles": [
67
+ { "name": "public", "scope": "read_all" },
68
+ { "name": "player", "scope": "read_all, write_all, delete_all, database", "timeout": "7d" }
69
+ ],
70
+ "apps": [
71
+ { "name": "Backend App", "app_secret": "<GUID>", "scope": "read_all, write_all, delete_all, database" }
72
+ ]
73
+ }
74
+ ```
75
+
76
+ ### 4. Gerar GUID para app secret (se necessário)
77
+
78
+ ```
79
+ GET /v3/util/guid/new
80
+ Authorization: Bearer <studio_token>
81
+ ```
82
+
83
+ ### 5. Salvar via PUT (não POST)
84
+
85
+ ```
86
+ PUT /v3/database/security <payload acima>
87
+ Authorization: Bearer <studio_token>
88
+ ```
89
+
90
+ ### 6. Verificar
91
+
92
+ ```
93
+ GET /v3/database/security/<API_KEY>?strict=true
94
+ ```
95
+
96
+ Teste login de jogador e confirme que o token retornado tem os scopes corretos.