@dforge-core/dforge-mcp 0.1.0-rc.9 → 0.1.2

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 (53) hide show
  1. package/CHANGELOG.md +166 -0
  2. package/README.md +88 -29
  3. package/dist/server.js +2735 -351
  4. package/docs/creating-modules.md +15 -7
  5. package/package.json +11 -6
  6. package/resources/docs/conventions.md +22 -16
  7. package/resources/docs/dsl-reference.md +767 -0
  8. package/resources/schemas/entity.schema.json +8 -1
  9. package/resources/schemas/print-templates.schema.json +82 -0
  10. package/resources/schemas/reports.schema.json +4 -0
  11. package/resources/schemas/triggers.schema.json +59 -0
  12. package/skills/dforge-mcp-author/SKILL.md +284 -73
  13. package/skills/dforge-mcp-author/examples/matrix-budget/README.md +43 -0
  14. package/skills/dforge-mcp-author/examples/matrix-budget/entities/budget_category.json +24 -0
  15. package/skills/dforge-mcp-author/examples/matrix-budget/entities/budget_line.json +56 -0
  16. package/skills/dforge-mcp-author/examples/matrix-budget/manifest.json +30 -0
  17. package/skills/dforge-mcp-author/examples/matrix-budget/security/roles.json +9 -0
  18. package/skills/dforge-mcp-author/examples/matrix-budget/seed-data/01-categories.json +8 -0
  19. package/skills/dforge-mcp-author/examples/matrix-budget/ui/data_views.json +42 -0
  20. package/skills/dforge-mcp-author/examples/simple-todo/README.md +38 -0
  21. package/skills/dforge-mcp-author/examples/simple-todo/entities/todo_item.json +83 -0
  22. package/skills/dforge-mcp-author/examples/simple-todo/entities/todo_list.json +43 -0
  23. package/skills/dforge-mcp-author/examples/simple-todo/logic/actions/mark_done.dsl +6 -0
  24. package/skills/dforge-mcp-author/examples/simple-todo/manifest.json +32 -0
  25. package/skills/dforge-mcp-author/examples/simple-todo/security/roles.json +10 -0
  26. package/skills/dforge-mcp-author/examples/simple-todo/seed-data/01-lists.json +17 -0
  27. package/skills/dforge-mcp-author/examples/simple-todo/ui/actions.json +11 -0
  28. package/skills/dforge-mcp-author/examples/simple-todo/ui/data_views.json +35 -0
  29. package/skills/dforge-mcp-author/examples/simple-todo/ui/menus.json +28 -0
  30. package/skills/dforge-mcp-author/references/action-dsl.md +397 -0
  31. package/skills/dforge-mcp-author/references/column-types.md +168 -0
  32. package/skills/dforge-mcp-author/references/conventions.md +177 -0
  33. package/skills/dforge-mcp-author/references/data-migration.md +270 -0
  34. package/skills/dforge-mcp-author/references/data-views.md +245 -0
  35. package/skills/dforge-mcp-author/references/excel-import.md +61 -0
  36. package/skills/dforge-mcp-author/references/field-types.md +144 -0
  37. package/skills/dforge-mcp-author/references/filters.md +326 -0
  38. package/skills/dforge-mcp-author/references/flags.md +73 -0
  39. package/skills/dforge-mcp-author/references/formulas.md +206 -0
  40. package/skills/dforge-mcp-author/references/jobs.md +149 -0
  41. package/skills/dforge-mcp-author/references/manifest.md +123 -0
  42. package/skills/dforge-mcp-author/references/menus.md +164 -0
  43. package/skills/dforge-mcp-author/references/number-sequences.md +117 -0
  44. package/skills/dforge-mcp-author/references/print-templates.md +159 -0
  45. package/skills/dforge-mcp-author/references/queries.md +312 -0
  46. package/skills/dforge-mcp-author/references/reports.md +398 -0
  47. package/skills/dforge-mcp-author/references/schema-import.md +331 -0
  48. package/skills/dforge-mcp-author/references/security.md +244 -0
  49. package/skills/dforge-mcp-author/references/settings.md +120 -0
  50. package/skills/dforge-mcp-author/references/traits.md +153 -0
  51. package/skills/dforge-mcp-author/references/translations.md +158 -0
  52. package/skills/dforge-mcp-author/references/validation-checklist.md +184 -0
  53. package/skills/dforge-mcp-author/scripts/xlsx_to_model.py +198 -0
@@ -0,0 +1,43 @@
1
+ # matrix-budget — matrix (pivot) view example
2
+
3
+ A minimal module whose only job is to demonstrate the `matrix` data view. The
4
+ simple-todo example has no cross-tab domain, so the matrix shape lives here.
5
+
6
+ ## The shape
7
+
8
+ A matrix view is `rowAxis × colAxis` with a **cell** entity holding one record
9
+ per intersection. Here:
10
+
11
+ | Piece | Maps to |
12
+ |---|---|
13
+ | `rowAxis` | `budget_category` records (a **dataset** axis), labelled by `name`, sorted by `code` |
14
+ | `colAxis` | the `quarter` dropdown options Q1–Q4 (a **dropdown** axis: `"budget_line.quarter"`) |
15
+ | `cell` | a `budget_line` record per (category, quarter); the editable value is `amount` |
16
+
17
+ So the grid reads: budget categories down the side, quarters across the top,
18
+ an editable amount in each cell.
19
+
20
+ ## What it illustrates
21
+
22
+ - **Two axis kinds in one view** — a `dataset` row axis and a `dropdown` column
23
+ axis (the only worked example of the dropdown axis).
24
+ - **Editable cells** (`cell.editable: true`) — typing in an empty cell inserts a
25
+ `budget_line`; the matrix fills `rowKey` (`category_id`) and `colKey`
26
+ (`quarter`) automatically from the row/column it sits in.
27
+ - The **cell entity is the view's primary `dataSources` entity**, and
28
+ `cell.rowKey` / `cell.colKey` are real columns on it.
29
+
30
+ For a read-only `dataset × dataset` matrix (P&L: accounts × periods) plus the
31
+ `date` axis and the `lockedField` / `drill` / `seedFromRow` options, see the
32
+ §Matrix section of `dforge://reference/data-views`.
33
+
34
+ ## Files
35
+
36
+ ```
37
+ manifest.json
38
+ entities/budget_category.json row-axis (dataset) entity
39
+ entities/budget_line.json cell entity (FK+Reference + quarter dropdown + amount)
40
+ ui/data_views.json the matrix view (+ a categories grid)
41
+ security/roles.json S on the axis, SIUD on the editable cell
42
+ seed-data/01-categories.json three categories to populate the rows
43
+ ```
@@ -0,0 +1,24 @@
1
+ {
2
+ "description": "Budget categories — the row axis of the budget matrix",
3
+ "dbObject": "budget_category",
4
+ "toString": "{name}",
5
+ "traits": ["identity", "audit"],
6
+ "fields": {
7
+ "code": {
8
+ "dbDatatype": "varchar",
9
+ "fieldTypeCd": "text",
10
+ "flags": "VEM",
11
+ "maxLen": 20,
12
+ "orderNum": 10,
13
+ "description": "Code"
14
+ },
15
+ "name": {
16
+ "dbDatatype": "varchar",
17
+ "fieldTypeCd": "text",
18
+ "flags": "VEM",
19
+ "maxLen": 100,
20
+ "orderNum": 20,
21
+ "description": "Name"
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "description": "Budget lines — the value-source CELL entity. One row per (category, quarter); the matrix edits the amount in place.",
3
+ "dbObject": "budget_line",
4
+ "toString": "{category} {quarter}",
5
+ "traits": ["identity", "audit"],
6
+ "fields": {
7
+ "category_id": {
8
+ "dbDatatype": "cuid",
9
+ "flags": "EM",
10
+ "orderNum": 10,
11
+ "description": "Category ID"
12
+ },
13
+ "category": {
14
+ "columnType": "R",
15
+ "fieldTypeCd": "lookup",
16
+ "flags": "VEM",
17
+ "orderNum": 15,
18
+ "description": "Category",
19
+ "link": {
20
+ "entity": "budget_category",
21
+ "thisKey": "category_id",
22
+ "otherKey": "budget_category_id"
23
+ }
24
+ },
25
+ "quarter": {
26
+ "dbDatatype": "varchar",
27
+ "fieldTypeCd": "dropdown",
28
+ "flags": "VEM",
29
+ "maxLen": 2,
30
+ "orderNum": 20,
31
+ "description": "Quarter",
32
+ "params": {
33
+ "options": [
34
+ { "value": "Q1", "label": "Q1" },
35
+ { "value": "Q2", "label": "Q2" },
36
+ { "value": "Q3", "label": "Q3" },
37
+ { "value": "Q4", "label": "Q4" }
38
+ ]
39
+ }
40
+ },
41
+ "amount": {
42
+ "dbDatatype": "numeric",
43
+ "fieldTypeCd": "number",
44
+ "flags": "VEM",
45
+ "orderNum": 30,
46
+ "description": "Amount",
47
+ "params": { "min": 0 }
48
+ }
49
+ },
50
+ "references": {
51
+ "FK_BudgetLine_Category": {
52
+ "from": { "field": "category_id" },
53
+ "to": { "entity": "budget_category", "field": "budget_category_id" }
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "packageFormat": 1,
3
+ "moduleId": "20000000-0000-0000-0000-000000000002",
4
+ "code": "matrix_budget",
5
+ "version": "0.1.0",
6
+ "dbSchemaVersion": "0.0.1",
7
+ "displayName": "Matrix Budget",
8
+ "description": "Minimal example demonstrating a matrix (pivot) data view: dataset row axis × dropdown column axis with editable cells",
9
+ "author": { "name": "dForge Examples" },
10
+ "license": "MIT",
11
+ "category": "Examples",
12
+ "tags": ["example", "matrix", "budget"],
13
+ "icon": "bi-grid-3x3",
14
+ "dependencies": {
15
+ "admin": ">=0.0.1"
16
+ },
17
+ "created": "2026-06-25",
18
+ "updated": "2026-06-25",
19
+ "entities": {
20
+ "budget_category": "./entities/budget_category.json",
21
+ "budget_line": "./entities/budget_line.json"
22
+ },
23
+ "dataViews": "./ui/data_views.json",
24
+ "security": {
25
+ "roles": "./security/roles.json"
26
+ },
27
+ "seedData": [
28
+ "./seed-data/01-categories.json"
29
+ ]
30
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "matrix_budget.user": {
3
+ "description": "Can view categories and edit budget amounts in the matrix",
4
+ "rights": {
5
+ "budget_category": "S",
6
+ "budget_line": "SIUD"
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "entityCode": "budget_category",
3
+ "records": [
4
+ { "budget_category_id": 2001, "code": "REV", "name": "Revenue" },
5
+ { "budget_category_id": 2002, "code": "COGS", "name": "Cost of Goods Sold" },
6
+ { "budget_category_id": 2003, "code": "OPEX", "name": "Operating Expenses" }
7
+ ]
8
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "budget_matrix": {
3
+ "viewType": "matrix",
4
+ "label": "Budget (Category × Quarter)",
5
+ "description": "Editable budget: categories down the side, quarters across the top, the amount edited in each cell.",
6
+ "dataSources": [{
7
+ "entityCode": "budget_line",
8
+ "columns": ["category_id", "quarter", "amount"]
9
+ }],
10
+ "viewConfig": {
11
+ "rowAxis": {
12
+ "kind": "dataset",
13
+ "entity": "budget_category",
14
+ "labelField": "name",
15
+ "sort": [{ "col": "code", "dir": "asc" }]
16
+ },
17
+ "colAxis": {
18
+ "kind": "dropdown",
19
+ "column": "budget_line.quarter"
20
+ },
21
+ "cell": {
22
+ "entity": "budget_line",
23
+ "rowKey": "category_id",
24
+ "colKey": "quarter",
25
+ "fields": ["amount"],
26
+ "editable": true
27
+ }
28
+ }
29
+ },
30
+ "budget_categories_grid": {
31
+ "label": "Categories",
32
+ "icon": "bi-tags",
33
+ "dataSources": [{
34
+ "entityCode": "budget_category",
35
+ "columns": [
36
+ { "column_cd": "code", "width": 100 },
37
+ { "column_cd": "name", "width": 300 }
38
+ ],
39
+ "order": ["code"]
40
+ }]
41
+ }
42
+ }
@@ -0,0 +1,38 @@
1
+ # Simple Todo — Example Module
2
+
3
+ A minimal but complete dForge module. Use it as a reference for:
4
+
5
+ - Module package layout
6
+ - Entity definition with traits, columns, and a reference
7
+ - Data view with a grid
8
+ - Menu with a single leaf item
9
+ - Security role with full CRUD
10
+ - Seed data with numbered files
11
+ - A simple DSL action (mark as done)
12
+
13
+ **Not meant for production** — it's a teaching example.
14
+
15
+ ## What it contains
16
+
17
+ | File | Purpose |
18
+ |---|---|
19
+ | `manifest.json` | Module metadata and file listing |
20
+ | `entities/todo_list.json` | Lists that group todos |
21
+ | `entities/todo_item.json` | Individual todo items, with reference to list |
22
+ | `ui/data_views.json` | Two grid views — one for lists, one for items |
23
+ | `ui/menus.json` | Nested menu with "Lists" and "Items" |
24
+ | `ui/actions.json` | Registers the mark-done action |
25
+ | `logic/actions/mark_done.dsl` | The action DSL |
26
+ | `security/roles.json` | `todo_user` role with full CRUD |
27
+ | `seed-data/01-lists.json` | Two seed lists |
28
+
29
+ ## Key patterns demonstrated
30
+
31
+ 1. **FK+Reference pattern** — `todo_item` has `list_id` (hidden FK) + `list` (visible Reference)
32
+ 2. **Traits** — both entities use `["identity", "audit"]`
33
+ 3. **toString** — `todo_list` uses `{name}`, `todo_item` uses `{title}`
34
+ 4. **`dataSources` array** in data views (never root-level `entityCode`)
35
+ 5. **Nested dict menus** with `dataViewCode` on leaves
36
+ 6. **`rights` (not `entityRights`)** in roles
37
+ 7. **Numbered seed files** for FK ordering
38
+ 8. **DSL action** with `canExecute:` gating on `[done] == false`
@@ -0,0 +1,83 @@
1
+ {
2
+ "description": "Individual todo items",
3
+ "dbObject": "todo_item",
4
+ "toString": "{title}",
5
+ "traits": ["identity", "audit"],
6
+ "fields": {
7
+ "title": {
8
+ "dbDatatype": "varchar",
9
+ "fieldTypeCd": "text",
10
+ "flags": "VEM",
11
+ "maxLen": 200,
12
+ "orderNum": 10,
13
+ "description": "Title"
14
+ },
15
+ "description": {
16
+ "dbDatatype": "text",
17
+ "fieldTypeCd": "textarea",
18
+ "flags": "VE",
19
+ "orderNum": 20,
20
+ "description": "Description"
21
+ },
22
+ "priority": {
23
+ "dbDatatype": "varchar",
24
+ "fieldTypeCd": "dropdown",
25
+ "flags": "VEM",
26
+ "maxLen": 20,
27
+ "orderNum": 30,
28
+ "description": "Priority",
29
+ "params": {
30
+ "options": [
31
+ { "value": "low", "label": "Low", "color": "#6c757d" },
32
+ { "value": "medium", "label": "Medium", "color": "#ffc107" },
33
+ { "value": "high", "label": "High", "color": "#dc3545" }
34
+ ]
35
+ }
36
+ },
37
+ "done": {
38
+ "dbDatatype": "bool",
39
+ "fieldTypeCd": "checkbox",
40
+ "flags": "VEM",
41
+ "formula": "false",
42
+ "orderNum": 40,
43
+ "description": "Done"
44
+ },
45
+ "due_date": {
46
+ "dbDatatype": "date",
47
+ "fieldTypeCd": "date",
48
+ "flags": "VE",
49
+ "orderNum": 50,
50
+ "description": "Due Date"
51
+ },
52
+ "list_id": {
53
+ "dbDatatype": "cuid",
54
+ "flags": "EM",
55
+ "orderNum": 60,
56
+ "description": "List ID"
57
+ },
58
+ "list": {
59
+ "columnType": "R",
60
+ "fieldTypeCd": "lookup",
61
+ "flags": "VEM",
62
+ "orderNum": 65,
63
+ "description": "List",
64
+ "link": {
65
+ "entity": "todo_list",
66
+ "thisKey": "list_id",
67
+ "otherKey": "todo_list_id"
68
+ }
69
+ },
70
+ "owner_id": {
71
+ "fieldTypeCd": "user",
72
+ "flags": "VE",
73
+ "orderNum": 70,
74
+ "description": "Assigned To"
75
+ }
76
+ },
77
+ "references": {
78
+ "FK_TodoItem_List": {
79
+ "from": { "field": "list_id" },
80
+ "to": { "entity": "todo_list", "field": "todo_list_id" }
81
+ }
82
+ }
83
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "description": "Lists that group todo items",
3
+ "dbObject": "todo_list",
4
+ "toString": "{name}",
5
+ "traits": ["identity", "audit"],
6
+ "fields": {
7
+ "name": {
8
+ "dbDatatype": "varchar",
9
+ "fieldTypeCd": "text",
10
+ "flags": "VEM",
11
+ "maxLen": 100,
12
+ "orderNum": 10,
13
+ "description": "List Name"
14
+ },
15
+ "color": {
16
+ "dbDatatype": "varchar",
17
+ "fieldTypeCd": "color",
18
+ "flags": "VEM",
19
+ "maxLen": 20,
20
+ "orderNum": 20,
21
+ "description": "Color"
22
+ },
23
+ "description": {
24
+ "dbDatatype": "text",
25
+ "fieldTypeCd": "textarea",
26
+ "flags": "VE",
27
+ "orderNum": 30,
28
+ "description": "Notes"
29
+ },
30
+ "items": {
31
+ "columnType": "S",
32
+ "fieldTypeCd": "grid",
33
+ "flags": "VEM",
34
+ "orderNum": 100,
35
+ "description": "Items",
36
+ "link": {
37
+ "entity": "todo_item",
38
+ "thisKey": "todo_list_id",
39
+ "otherKey": "list_id"
40
+ }
41
+ }
42
+ }
43
+ }
@@ -0,0 +1,6 @@
1
+ canExecute:
2
+ [done] = false
3
+
4
+ execute:
5
+ [done] = true
6
+ info('Marked as done')
@@ -0,0 +1,32 @@
1
+ {
2
+ "packageFormat": 1,
3
+ "moduleId": "20000000-0000-0000-0000-000000000001",
4
+ "code": "simple_todo",
5
+ "version": "0.1.0",
6
+ "dbSchemaVersion": "0.0.1",
7
+ "displayName": "Simple Todo",
8
+ "description": "Minimal example module demonstrating the dForge package format",
9
+ "author": { "name": "dForge Examples" },
10
+ "license": "MIT",
11
+ "category": "Examples",
12
+ "tags": ["example", "todo"],
13
+ "icon": "bi-check-square",
14
+ "dependencies": {
15
+ "admin": ">=0.0.1"
16
+ },
17
+ "created": "2026-04-08",
18
+ "updated": "2026-04-08",
19
+ "entities": {
20
+ "todo_list": "./entities/todo_list.json",
21
+ "todo_item": "./entities/todo_item.json"
22
+ },
23
+ "dataViews": "./ui/data_views.json",
24
+ "menus": "./ui/menus.json",
25
+ "actions": "./ui/actions.json",
26
+ "security": {
27
+ "roles": "./security/roles.json"
28
+ },
29
+ "seedData": [
30
+ "./seed-data/01-lists.json"
31
+ ]
32
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "simple_todo.user": {
3
+ "description": "Can manage their own todo lists and items",
4
+ "rights": {
5
+ "todo_list": "SIUDC",
6
+ "todo_item": "SIUDC",
7
+ "action:mark_done": "E"
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "entityCode": "todo_list",
3
+ "records": [
4
+ {
5
+ "todo_list_id": 1001,
6
+ "name": "Personal",
7
+ "color": "#4dabf7",
8
+ "description": "Personal tasks and errands"
9
+ },
10
+ {
11
+ "todo_list_id": 1002,
12
+ "name": "Work",
13
+ "color": "#51cf66",
14
+ "description": "Work-related tasks"
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "mark_done": {
3
+ "label": "Mark Done",
4
+ "description": "Mark this todo item as completed",
5
+ "icon": "bi-check-circle",
6
+ "entityCode": "todo_item",
7
+ "executionMode": "each",
8
+ "script": "mark_done",
9
+ "isAsync": false
10
+ }
11
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "todo_list_grid": {
3
+ "label": "All Lists",
4
+ "description": "All todo lists",
5
+ "viewType": "grid",
6
+ "icon": "bi-list-ul",
7
+ "dataSources": [{
8
+ "entityCode": "todo_list",
9
+ "columns": [
10
+ { "column_cd": "name", "width": 200 },
11
+ { "column_cd": "color", "width": 80 },
12
+ { "column_cd": "description", "width": 400 }
13
+ ],
14
+ "order": ["name"]
15
+ }]
16
+ },
17
+ "todo_item_grid": {
18
+ "label": "All Items",
19
+ "description": "All todo items across all lists",
20
+ "viewType": "grid",
21
+ "icon": "bi-check-square",
22
+ "dataSources": [{
23
+ "entityCode": "todo_item",
24
+ "columns": [
25
+ { "column_cd": "title", "width": 300 },
26
+ { "column_cd": "list", "width": 150 },
27
+ { "column_cd": "priority", "width": 100 },
28
+ { "column_cd": "done", "width": 80 },
29
+ { "column_cd": "due_date", "width": 120 },
30
+ { "column_cd": "owner_id", "width": 150 }
31
+ ],
32
+ "order": ["due_date"]
33
+ }]
34
+ }
35
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "todo_menu": {
3
+ "label": "Todos",
4
+ "items": {
5
+ "lists": {
6
+ "orderNum": 1,
7
+ "label": "Lists & Items",
8
+ "icon": "check-square",
9
+ "children": {
10
+ "all_lists": {
11
+ "itemType": "V",
12
+ "label": "Lists",
13
+ "icon": "list-ul",
14
+ "dataViewCode": "todo_list_grid",
15
+ "orderNum": 1
16
+ },
17
+ "all_items": {
18
+ "itemType": "V",
19
+ "label": "All Items",
20
+ "icon": "check2-square",
21
+ "dataViewCode": "todo_item_grid",
22
+ "orderNum": 2
23
+ }
24
+ }
25
+ }
26
+ }
27
+ }
28
+ }