funifier-mcp 0.2.26 → 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 +4 -1
- 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 +935 -280
- 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/mcp/bundle.js +119 -93
- package/dist/mcp/index.js +2 -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/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 +13 -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.map +1 -1
- package/dist/mcp/tools/folder.js +22 -12
- package/dist/mcp/tools/folder.js.map +1 -1
- 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 +3 -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 +14 -4
- package/dist/mcp/tools/save.js.map +1 -1
- package/dist/mcp/tools/save.test.js +3 -3
- 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/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,91 @@
|
|
|
1
|
+
# funifier-create-custom-object
|
|
2
|
+
|
|
3
|
+
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
|
|
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 "custom object collection database crud __c domain entity business" --skill funifier-create-custom-object
|
|
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/custom-object.md`
|
|
22
|
+
- `datasource-funifier-docs/knowledge/modules/database.md`
|
|
23
|
+
|
|
24
|
+
## Steps
|
|
25
|
+
|
|
26
|
+
### Rules — follow exactly, no exceptions
|
|
27
|
+
|
|
28
|
+
**Sempre use sufixo `__c`** no nome da coleção: `car__c`, `product__c`, `venue__c`.
|
|
29
|
+
**`_id` único** por documento — defina explicitamente para controle ou deixe o Funifier gerar.
|
|
30
|
+
**Scope `database` obrigatório** na role do token para acessar `/v3/database`.
|
|
31
|
+
Triggers podem referenciar a coleção pelo nome `car__c` no campo `entity`.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Steps
|
|
36
|
+
|
|
37
|
+
### 1. Verificar se a coleção já existe
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
GET /v3/database/collections
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 2. Criar documentos (auto-cria a coleção)
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"_id": "car001",
|
|
48
|
+
"name": "Civic",
|
|
49
|
+
"brand": "Honda",
|
|
50
|
+
"price": 50000,
|
|
51
|
+
"active": true
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
POST /v3/database/car__c
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Ou via MCP (se disponível):
|
|
60
|
+
```
|
|
61
|
+
funifier_save type=custom payload=<json> collection=car__c
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 3. Listar documentos
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
GET /v3/database/car__c
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 4. Buscar por filtro
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
GET /v3/database/car__c?q=brand:'Honda'
|
|
74
|
+
GET /v3/database/car__c?strict=true&q=_id:'car001'
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 5. Atualizar
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
PUT /v3/database/car__c { "_id": "car001", "name": "Civic", "price": 52000 }
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 6. Deletar
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
DELETE /v3/database/car__c?q=_id:'car001'
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 7. Usar em triggers
|
|
90
|
+
|
|
91
|
+
Para executar trigger em eventos da coleção, use `entity: "car__c"` no payload do trigger.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# funifier-create-custom-page
|
|
2
|
+
|
|
3
|
+
Create a Funifier Studio custom page — guided workflow for building admin dashboards, CRUDs, reports, and KPI pages using AngularJS + Bootstrap
|
|
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 "custom page studio dashboard angularjs bootstrap admin crud kpi" --skill funifier-create-custom-page
|
|
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/studio-page.md`
|
|
61
|
+
- `datasource-funifier-docs/knowledge/guides/aggregates.md`
|
|
62
|
+
- `datasource-funifier-docs/knowledge/modules/auth.md`
|
|
63
|
+
|
|
64
|
+
## Steps
|
|
65
|
+
|
|
66
|
+
### Regras críticas
|
|
67
|
+
|
|
68
|
+
- **Collection é `studio_page`** — não `page`. Salvar via `PUT /v3/database/studio_page`
|
|
69
|
+
- **`html` e `script` são strings JSON-escapadas** — nunca cole código multilinha cru no JSON
|
|
70
|
+
- Contexto JS: `$scope`, `$http`, `$location`, `$routeParams`, `Marketplace`
|
|
71
|
+
- Para autenticação: `Marketplace.auth.getAuthorization()` e `Marketplace.auth.getService()`
|
|
72
|
+
- `?strict=true` em GETs para preservar tipos BSON (evita conversão de datas/IDs)
|
|
73
|
+
|
|
74
|
+
### Variáveis de contexto
|
|
75
|
+
|
|
76
|
+
| Variável | Uso |
|
|
77
|
+
|---|---|
|
|
78
|
+
| `Marketplace.auth.getService()` | URL da API (ex: https://service2.funifier.com) |
|
|
79
|
+
| `Marketplace.auth.getAuthorization()` | Bearer token do Studio |
|
|
80
|
+
| `Marketplace.range.parse(content_range)` | Parseia header de paginação |
|
|
81
|
+
| `Marketplace.range.paginate(page, range)` | Gera header Range para paginação |
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Steps
|
|
86
|
+
|
|
87
|
+
### 1. Definir o objetivo da página
|
|
88
|
+
|
|
89
|
+
- Dashboard? Lista? CRUD? Relatório com gráfico?
|
|
90
|
+
- Precisa de parâmetros na URL? (ex: `:id` no slug para edição)
|
|
91
|
+
|
|
92
|
+
### 2. Verificar se já existe
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
GET /v3/database/studio_page
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 3. Escrever html + script
|
|
99
|
+
|
|
100
|
+
Hello World:
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"_id": "hello1",
|
|
104
|
+
"display": true,
|
|
105
|
+
"title": "Hello World!",
|
|
106
|
+
"slug": "studio/custom/hello",
|
|
107
|
+
"html": "<button ng-click=\"hello()\" class=\"btn btn-warning\">Hello</button>",
|
|
108
|
+
"script": "$scope.hello = function(){ alert('Hello World!'); };"
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Lista simples:
|
|
113
|
+
```javascript
|
|
114
|
+
// script para listar jogadores
|
|
115
|
+
$scope.all = [];
|
|
116
|
+
$scope.list = function () {
|
|
117
|
+
$http({
|
|
118
|
+
method: 'GET',
|
|
119
|
+
url: Marketplace.auth.getService() + '/v3/database/player',
|
|
120
|
+
headers: { "Authorization": Marketplace.auth.getAuthorization(), "content-type": "application/json" }
|
|
121
|
+
}).then(function(data) { $scope.all = data.data; });
|
|
122
|
+
};
|
|
123
|
+
$scope.list();
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 4. Salvar a página
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
PUT /v3/database/studio_page { "_id": "...", "display": true, "title": "...", "slug": "studio/custom/...", "html": "...", "script": "..." }
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 5. Validar no Studio
|
|
133
|
+
|
|
134
|
+
Acesse `/studio/custom/<slug>` no browser para testar.
|
|
135
|
+
Para CRUD completo: crie página de lista (`display: true`) + formulário (`display: false`, slug com `/:id`).
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# funifier-create-folder
|
|
2
|
+
|
|
3
|
+
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
|
|
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 "folder trail course learning progress content hierarchy unlock training lms" --skill funifier-create-folder
|
|
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/folder.md`
|
|
22
|
+
|
|
23
|
+
## Steps
|
|
24
|
+
|
|
25
|
+
### Regras críticas
|
|
26
|
+
|
|
27
|
+
- **`DELETE /v3/folder/:id` é cascata e irreversível** — deleta sub-pastas, conteúdos, logs e dados de formulário
|
|
28
|
+
- **Sempre use `/v3/folder/log`** para registrar progresso — nunca insira direto na collection `folder_log`
|
|
29
|
+
- **`insertLog` é idempotente** — atualiza log existente por `(player, item)` sem duplicar
|
|
30
|
+
- **`status: "done"`** → `percent = 100` (automático); `percent >= 100` → `status = "done"` (automático)
|
|
31
|
+
- Herança de `unlock_policy`: pastas sem policy própria herdam do pai
|
|
32
|
+
|
|
33
|
+
### MCP tools para folder
|
|
34
|
+
|
|
35
|
+
| Operação | Tool | Parâmetro |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| Criar/atualizar pasta | `funifier_save` | `type: "folder"` |
|
|
38
|
+
| Adicionar conteúdo | `funifier_save` | `type: "folder-content"` |
|
|
39
|
+
| Definir tipo de conteúdo | `funifier_save` | `type: "folder-content-type"` |
|
|
40
|
+
| Registrar progresso | `funifier_save` | `type: "folder-log"` |
|
|
41
|
+
| Ver árvore completa | `funifier_folder` | `operation: "inside"` |
|
|
42
|
+
| Ver progresso do jogador | `funifier_folder` | `operation: "progress"` |
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Steps
|
|
47
|
+
|
|
48
|
+
### 1. Criar estrutura de pastas
|
|
49
|
+
|
|
50
|
+
Raiz da trilha:
|
|
51
|
+
```json
|
|
52
|
+
{ "title": "Sales Trail" }
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Módulo com unlock sequencial (requer 80% do anterior):
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"title": "Module 2 — Closing",
|
|
59
|
+
"parent": "<root_id>",
|
|
60
|
+
"position": 1,
|
|
61
|
+
"unlock_policy": { "type": "progress", "folder_ref": "prev", "min_percent": 80 }
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
funifier_save type=folder payload=<json>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 2. Definir tipos de conteúdo (se necessário)
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{ "_id": "video", "entity": "video__c", "input": "repository", "title": "Video" }
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
funifier_save type=folder-content-type payload=<json>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 3. Adicionar conteúdo às pastas
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{ "type": "video", "content": "<video_id>", "parent": "<module_id>", "position": 0 }
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
funifier_save type=folder-content payload=<json>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 4. Registrar progresso do jogador
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{ "item": "<content_id>", "player": "player123", "status": "done" }
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
funifier_save type=folder-log payload=<json>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 5. Verificar progresso
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
funifier_folder operation=progress { "folder": "<root_id>", "player": "player123" }
|
|
103
|
+
funifier_folder operation=inside { "folder": "<root_id>" }
|
|
104
|
+
```
|