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

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 +132 -0
  2. package/README.md +84 -27
  3. package/dist/server.js +2957 -616
  4. package/docs/creating-modules.md +11 -4
  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 +269 -69
  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 +243 -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 +183 -0
  53. package/skills/dforge-mcp-author/scripts/xlsx_to_model.py +198 -0
@@ -46,7 +46,10 @@
46
46
  },
47
47
  "fields": {
48
48
  "type": "object",
49
- "description": "Column definitions keyed by column code",
49
+ "description": "Column definitions keyed by column code. Column codes must start with a letter or underscore and contain only letters, digits, and underscores — a leading `-` is reserved for the sort descending prefix in `view_json.order`.",
50
+ "propertyNames": {
51
+ "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$"
52
+ },
50
53
  "additionalProperties": {
51
54
  "$ref": "#/$defs/field"
52
55
  }
@@ -196,6 +199,10 @@
196
199
  "$ref": "#/$defs/fieldLink",
197
200
  "description": "Relationship link for Reference (R) and Set (S) columns"
198
201
  },
202
+ "cyclic": {
203
+ "type": "boolean",
204
+ "description": "On a self-referencing reference column (R column whose link.entity is the owning entity), set true to ALLOW parent/child cycles. When absent the self-reference is treated as an acyclic hierarchy and DB-level guards reject loops. Ignored on non-self-referencing columns."
205
+ },
199
206
  "refFilter": {
200
207
  "description": "Filter criteria for reference lookups"
201
208
  }
@@ -0,0 +1,82 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "dForge Module Print Templates",
4
+ "description": "Print template declarations for a dForge module package (ui/print_templates.json). Each key is the template_cd; the value declares either a printable template (default) or a reusable snippet pulled into other templates via {% include 'module_cd.snippet_cd' %}.",
5
+ "type": "object",
6
+ "additionalProperties": {
7
+ "type": "object",
8
+ "properties": {
9
+ "type": {
10
+ "type": "string",
11
+ "enum": ["template", "snippet"],
12
+ "default": "template",
13
+ "description": "'template' (default) — a full printable form bound to an entity. 'snippet' — a reusable Liquid partial, module-scoped, no entity binding, included from other templates."
14
+ },
15
+ "entityCd": {
16
+ "type": "string",
17
+ "description": "Entity code this template renders. Required when type='template'; ignored when type='snippet'. Cross-module form 'module.entity' is supported (e.g. fin-ch ships a template for fin.invoice)."
18
+ },
19
+ "description": {
20
+ "type": "string",
21
+ "description": "Human-readable label shown in the print menu."
22
+ },
23
+ "template": {
24
+ "type": "string",
25
+ "description": "Inline Liquid HTML. Either 'template' or 'file' must be set; 'file' takes precedence when both are present."
26
+ },
27
+ "file": {
28
+ "type": "string",
29
+ "description": "Relative path under the module's print_templates/ directory (e.g. 'invoice.html'). Loaded at install time."
30
+ },
31
+ "css": {
32
+ "type": "string",
33
+ "description": "Inline CSS, or a filename ending in .css (resolved relative to print_templates/). Snippets typically inherit CSS from the host template and omit this."
34
+ },
35
+ "pageSettings": {
36
+ "type": "object",
37
+ "description": "Default page geometry applied when the user prints from the UI. Stored as jsonb on the row; the editor lets users tweak per-template.",
38
+ "properties": {
39
+ "size": {
40
+ "type": "string",
41
+ "enum": ["A4", "letter", "legal"],
42
+ "default": "A4"
43
+ },
44
+ "orientation": {
45
+ "type": "string",
46
+ "enum": ["portrait", "landscape"],
47
+ "default": "portrait"
48
+ },
49
+ "margins": {
50
+ "type": "object",
51
+ "properties": {
52
+ "top": { "type": "string", "description": "CSS length, e.g. '15mm'." },
53
+ "right": { "type": "string" },
54
+ "bottom": { "type": "string" },
55
+ "left": { "type": "string" }
56
+ },
57
+ "additionalProperties": false
58
+ }
59
+ },
60
+ "additionalProperties": false
61
+ }
62
+ },
63
+ "additionalProperties": false,
64
+ "allOf": [
65
+ {
66
+ "if": { "properties": { "type": { "const": "snippet" } }, "required": ["type"] },
67
+ "then": {
68
+ "description": "Snippets must not declare entityCd and their template_cd must not contain '.' (collides with {% include 'module_cd.snippet_cd' %})."
69
+ },
70
+ "else": {
71
+ "required": ["entityCd"]
72
+ }
73
+ },
74
+ {
75
+ "anyOf": [
76
+ { "required": ["file"] },
77
+ { "required": ["template"] }
78
+ ]
79
+ }
80
+ ]
81
+ }
82
+ }
@@ -159,6 +159,10 @@
159
159
  "description": "Field type code (see settings.schema.json for the common list)"
160
160
  },
161
161
  "label": { "type": "string" },
162
+ "orderNum": {
163
+ "type": "integer",
164
+ "description": "Display order of the parameter in the report's parameter form. Read by ReportRegistrar (paramDef.OrderNum); falls back to declaration order when omitted."
165
+ },
162
166
  "required": {
163
167
  "type": "boolean",
164
168
  "default": false,
@@ -0,0 +1,59 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://dforge.dev/schemas/triggers.schema.json",
4
+ "title": "dForge Module Triggers",
5
+ "description": "Trigger definitions for a dForge module (logic/triggers.json). A trigger watches an entity for an event (insert/update/delete/status_change/any), evaluates an optional formula condition using `[field]` syntax, and fires an action if true. Different from scheduled jobs (cron-driven) and webhooks (outbound HTTP) — triggers are intra-tenant DB-event-driven action invocations.",
6
+ "type": "object",
7
+ "required": ["triggers"],
8
+ "properties": {
9
+ "triggers": {
10
+ "type": "array",
11
+ "items": { "$ref": "#/$defs/trigger" }
12
+ }
13
+ },
14
+ "additionalProperties": false,
15
+ "$defs": {
16
+ "trigger": {
17
+ "type": "object",
18
+ "required": ["code", "entity", "event", "action"],
19
+ "properties": {
20
+ "code": {
21
+ "type": "string",
22
+ "pattern": "^[a-z][a-z0-9_]*$",
23
+ "description": "Trigger code, unique within the module."
24
+ },
25
+ "description": {
26
+ "type": "string",
27
+ "description": "Human-readable description of what the trigger does and when."
28
+ },
29
+ "entity": {
30
+ "type": "string",
31
+ "description": "Entity whose events this trigger watches. May be cross-module via dot notation (e.g. 'fin.invoice')."
32
+ },
33
+ "event": {
34
+ "type": "string",
35
+ "enum": ["insert", "update", "delete", "status_change", "any"],
36
+ "description": "DB event that fires this trigger. 'status_change' only fires when the entity's status field actually changes value. 'any' fires for all insert/update/delete."
37
+ },
38
+ "condition": {
39
+ "type": "string",
40
+ "description": "Optional formula expression — same shape as canExecute in action DSL. Uses `[field]` syntax to reference the affected record. Single-line, evaluates to boolean. If omitted, trigger fires for every matching event."
41
+ },
42
+ "action": {
43
+ "type": "string",
44
+ "description": "Action code to invoke. The action must NOT use record-context (`[field]`) syntax in a way that requires the original triggering record — the trigger passes the record id via params. Cross-module form 'module.action' is supported."
45
+ },
46
+ "params": {
47
+ "type": "object",
48
+ "description": "Optional static parameters passed to the action at invocation time. Merged with the runtime-injected `record_id` / `record_old` (if event uses old-record diff)."
49
+ },
50
+ "async": {
51
+ "type": "boolean",
52
+ "default": false,
53
+ "description": "When true, the action runs in the background — the triggering transaction commits before the action starts. Recommended for slow actions (emails, external API calls). When false, the action runs in the same transaction; failures roll back the original DB change."
54
+ }
55
+ },
56
+ "additionalProperties": false
57
+ }
58
+ }
59
+ }