@dforge-core/dforge-mcp 0.1.0-rc.5 → 0.1.0-rc.7

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.
@@ -0,0 +1,145 @@
1
+ # Creating a dForge module — three paths
2
+
3
+ dForge gives you three ways to scaffold and author a module. They all produce the same canonical file structure; pick by how much hand-holding you want.
4
+
5
+ | Path | Driver | Best for |
6
+ |---|---|---|
7
+ | [1. Terminal CLI](#path-1--terminal-manual-dforge-cli-init-module) | you, typing | you know what you're building, just want the skeleton |
8
+ | [2. VS Code sidebar](#path-2--vs-code-sidebar-manual) | you, clicking | same as #1 but launched from a button |
9
+ | [3. AI co-pilot wizard](#path-3--ai-co-pilot-wizard-driven) | Claude Code / Cursor / Zed via `dforge-mcp` | you want help designing entities + security |
10
+
11
+ ## Path 1 — Terminal, manual (`dforge-cli init module`)
12
+
13
+ Pure CLI. Prompts for the basics, writes a minimal scaffold, leaves you to fill in fields / views / roles in your editor.
14
+
15
+ ```bash
16
+ npx -y @dforge-core/dforge-cli init module ./my-module
17
+ ```
18
+
19
+ You'll be asked for:
20
+ - module `code` (lowercase, hyphen/underscore, e.g. `feedback`)
21
+ - display name
22
+ - description, author, license, version, db schema version
23
+ - dependencies (defaults to `admin` + `metadata`)
24
+ - preset (Minimal / Minimal + add more entities interactively / Full template)
25
+ - first entity name + label + traits (identity vs identity+audit)
26
+
27
+ Output: ~10 files including `manifest.json`, `entities/<name>.json` (stub), `ui/{data_views,folders,menus,actions}.json`, `security/roles.json`, `.gitignore`, plus `.vscode/settings.json` + `.zed/settings.json` that bind the JSON schemas for inline validation.
28
+
29
+ After scaffolding, open the directory in VS Code (with [the dForge extension](https://github.com/dforge-core/dforge-editor-support) installed) and start adding fields — schemas validate in real time.
30
+
31
+ ## Path 2 — VS Code sidebar, manual
32
+
33
+ Same scaffold as Path 1, just launched from a button instead of the terminal.
34
+
35
+ 1. Click the dForge `d` icon in the activity bar.
36
+ 2. Click the `+` button next to "Modules" view title.
37
+ 3. Pick a parent folder + module name in the prompts.
38
+ 4. The extension shells out to `npx -y @dforge-core/dforge-cli init module …` in the dForge terminal — same questions as Path 1.
39
+ 5. Module appears in the sidebar tree once written; click any file to open it.
40
+
41
+ Sidebar also gives you right-click commands: **Pack Module**, **Install Module to Tenant**, **Validate Module (schemas)** — all wrappers around `dforge-cli`.
42
+
43
+ ## Path 3 — AI co-pilot, wizard-driven
44
+
45
+ Claude Code (or Cursor / Zed) with `dforge-mcp` connected. You describe what you want; the AI walks you through six phases via MCP tool calls, pausing at each gate for your approval.
46
+
47
+ Setup once:
48
+
49
+ ```bash
50
+ claude mcp add dforge --scope user -- npx -y @dforge-core/dforge-mcp
51
+ mkdir -p ~/.claude/skills/dforge-mcp-author
52
+ curl -fsSL https://cdn.jsdelivr.net/npm/@dforge-core/dforge-mcp@latest/skills/dforge-mcp-author/SKILL.md \
53
+ -o ~/.claude/skills/dforge-mcp-author/SKILL.md
54
+ ```
55
+
56
+ Restart Claude Code, approve the MCP server on first prompt, then in a new conversation:
57
+
58
+ ```
59
+ You: "I want a module to collect end-user feedback on app pages."
60
+ ```
61
+
62
+ The wizard runs:
63
+
64
+ ### Phase 0 — Intake (required, ~1 turn)
65
+
66
+ Four questions in one message: purpose / users / dependencies / language scope.
67
+ You can accept defaults to move fast. Writes `_brief/00-intake.md`.
68
+
69
+ ### Phase 1 — Domain (required, looping)
70
+
71
+ 1. Proposes an entity inventory (list of names + one-liners). Get user sign-off.
72
+ 2. Calls `dforge_module_create` → previews the file map → you approve → AI writes files.
73
+ 3. Per-entity loop: proposes fields, calls `dforge_entity_field_add` per field. Batches obvious scalar fields; one-at-a-time for refs/formulas/nullable-ambiguous.
74
+ 4. Extension entities last (those with `extends: "module.entity"`).
75
+
76
+ ### Phase 2 — Actions (optional)
77
+
78
+ Asks if any business-logic operations need a DSL script. Skipped for pure CRUD modules. When needed: `dforge_action_add` per action, full DSL body composed by the AI.
79
+
80
+ ### Phase 3 — Views (required) + Reports (optional)
81
+
82
+ - **3a (first):** ensures every entity has a default grid via `dforge_view_add` / `view_modify`.
83
+ - **3b (only after 3a):** proposes specialized views (kanban / calendar / list / tree-grid / master-detail) **only when an objective trigger fires** — user explicitly asked, or status field has 3+ values, or required date field for scheduling, etc.
84
+ - **3c (optional):** reports for aggregation/grouping the views don't cover.
85
+
86
+ ### Phase 4 — Polish (mostly optional)
87
+
88
+ Settings (`dforge_setting_add`), translations, seed data — only if intake declared a need.
89
+
90
+ ### Phase 5 — Security
91
+
92
+ - **5a (required):** inspects scaffolded `<code>.admin` role; adds extra roles via `dforge_role_add` for each additional user group from intake; amends admin via `dforge_role_right_set` for action/report grants.
93
+ - **5b (optional):** security folders with row-level filters via `dforge_folder_add` — only when intake says data must be partitioned per folder.
94
+
95
+ ### Phase 6 — Verify (required, non-skippable)
96
+
97
+ 1. `dforge_module_pack` → `.dforge` tarball.
98
+ 2. `dforge_module_install` against your tenant (uses `DFORGE_URL` / `DFORGE_TOKEN` env or arg fallbacks). Runs the full server-side validator — the only real validator.
99
+ 3. On failure, the AI follows the **backtrack protocol**: stops, names the issue, identifies the earliest broken phase, asks for sign-off, patches with the smallest tool that fits, re-inspects, resumes.
100
+
101
+ ---
102
+
103
+ ## Behind the scenes (same for all three paths)
104
+
105
+ All three paths produce the same canonical structure:
106
+
107
+ ```
108
+ my-module/
109
+ ├── manifest.json # module metadata
110
+ ├── entities/<entity>.json # one file per entity
111
+ ├── ui/
112
+ │ ├── data_views.json # grids, kanbans, calendars, etc.
113
+ │ ├── folders.json # navigation + security boundaries
114
+ │ ├── menus.json # left-side nav
115
+ │ ├── actions.json # action registry (DSL files live in logic/actions/)
116
+ │ └── reports.json # report definitions (only if you have any)
117
+ ├── security/
118
+ │ └── roles.json # role → rights matrix
119
+ ├── logic/
120
+ │ ├── actions/<name>.dsl # one DSL file per action
121
+ │ └── jobs.json # scheduled jobs (only if you have any)
122
+ ├── settings.json # module-level settings (folder-scoped at runtime)
123
+ ├── seed-data/ # rows inserted at install time (optional)
124
+ ├── translations/<locale>.json # i18n (only if non-English locales declared)
125
+ ├── .vscode/settings.json # auto-binds JSON schemas → red squigglies on bad JSON
126
+ └── .zed/settings.json # same for Zed
127
+ ```
128
+
129
+ VS Code with the [dForge extension](https://github.com/dforge-core/dforge-editor-support) installed validates every JSON file against its schema as you edit, regardless of which path created the files. Pack and install commands work the same way from any path.
130
+
131
+ ## Quick decision tree
132
+
133
+ | Goal | Path |
134
+ |---|---|
135
+ | "I know what I want, give me the skeleton" | **Path 1 or 2** |
136
+ | "I want help designing entities + the security model" | **Path 3** — the wizard |
137
+ | "I want to extend an EXISTING module" | **Path 3** — the wizard's patch tools (`entity_field_add`, `role_right_set`, etc.) plus the backtrack protocol shine here |
138
+ | "I'm in a terminal-only environment (SSH, remote box)" | **Path 1** |
139
+ | "I want zero typing" | **Path 2** or **Path 3** |
140
+
141
+ ## Going further
142
+
143
+ - [SKILL.md](../skills/dforge-mcp-author/SKILL.md) — the full wizard spec the AI follows, including the deterministic backtrack protocol, multi-trigger priority rule, tool-failure protocol, and resume-from-partial-state support
144
+ - [README.md](../README.md) — full tool reference (18 tools, 13 resources) + maintainer docs
145
+ - [iash44/dForge-core](https://github.com/iash44/dForge-core) — the platform itself: source of truth for the schemas + DSL conventions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dforge-core/dforge-mcp",
3
- "version": "0.1.0-rc.5",
3
+ "version": "0.1.0-rc.7",
4
4
  "description": "MCP server for dForge module authoring. Exposes scaffold/pack/install tools and schema resources so AI agents (Claude Code, Cursor, Zed) can create and ship dForge modules.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/iash44/dForge-core",
@@ -13,6 +13,7 @@
13
13
  },
14
14
  "files": [
15
15
  "dist/",
16
+ "docs/",
16
17
  "resources/",
17
18
  "skills/",
18
19
  "README.md"