@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.
- package/CHANGELOG.md +166 -0
- package/README.md +88 -29
- package/dist/server.js +2735 -351
- package/docs/creating-modules.md +15 -7
- package/package.json +11 -6
- package/resources/docs/conventions.md +22 -16
- package/resources/docs/dsl-reference.md +767 -0
- package/resources/schemas/entity.schema.json +8 -1
- package/resources/schemas/print-templates.schema.json +82 -0
- package/resources/schemas/reports.schema.json +4 -0
- package/resources/schemas/triggers.schema.json +59 -0
- package/skills/dforge-mcp-author/SKILL.md +284 -73
- package/skills/dforge-mcp-author/examples/matrix-budget/README.md +43 -0
- package/skills/dforge-mcp-author/examples/matrix-budget/entities/budget_category.json +24 -0
- package/skills/dforge-mcp-author/examples/matrix-budget/entities/budget_line.json +56 -0
- package/skills/dforge-mcp-author/examples/matrix-budget/manifest.json +30 -0
- package/skills/dforge-mcp-author/examples/matrix-budget/security/roles.json +9 -0
- package/skills/dforge-mcp-author/examples/matrix-budget/seed-data/01-categories.json +8 -0
- package/skills/dforge-mcp-author/examples/matrix-budget/ui/data_views.json +42 -0
- package/skills/dforge-mcp-author/examples/simple-todo/README.md +38 -0
- package/skills/dforge-mcp-author/examples/simple-todo/entities/todo_item.json +83 -0
- package/skills/dforge-mcp-author/examples/simple-todo/entities/todo_list.json +43 -0
- package/skills/dforge-mcp-author/examples/simple-todo/logic/actions/mark_done.dsl +6 -0
- package/skills/dforge-mcp-author/examples/simple-todo/manifest.json +32 -0
- package/skills/dforge-mcp-author/examples/simple-todo/security/roles.json +10 -0
- package/skills/dforge-mcp-author/examples/simple-todo/seed-data/01-lists.json +17 -0
- package/skills/dforge-mcp-author/examples/simple-todo/ui/actions.json +11 -0
- package/skills/dforge-mcp-author/examples/simple-todo/ui/data_views.json +35 -0
- package/skills/dforge-mcp-author/examples/simple-todo/ui/menus.json +28 -0
- package/skills/dforge-mcp-author/references/action-dsl.md +397 -0
- package/skills/dforge-mcp-author/references/column-types.md +168 -0
- package/skills/dforge-mcp-author/references/conventions.md +177 -0
- package/skills/dforge-mcp-author/references/data-migration.md +270 -0
- package/skills/dforge-mcp-author/references/data-views.md +245 -0
- package/skills/dforge-mcp-author/references/excel-import.md +61 -0
- package/skills/dforge-mcp-author/references/field-types.md +144 -0
- package/skills/dforge-mcp-author/references/filters.md +326 -0
- package/skills/dforge-mcp-author/references/flags.md +73 -0
- package/skills/dforge-mcp-author/references/formulas.md +206 -0
- package/skills/dforge-mcp-author/references/jobs.md +149 -0
- package/skills/dforge-mcp-author/references/manifest.md +123 -0
- package/skills/dforge-mcp-author/references/menus.md +164 -0
- package/skills/dforge-mcp-author/references/number-sequences.md +117 -0
- package/skills/dforge-mcp-author/references/print-templates.md +159 -0
- package/skills/dforge-mcp-author/references/queries.md +312 -0
- package/skills/dforge-mcp-author/references/reports.md +398 -0
- package/skills/dforge-mcp-author/references/schema-import.md +331 -0
- package/skills/dforge-mcp-author/references/security.md +244 -0
- package/skills/dforge-mcp-author/references/settings.md +120 -0
- package/skills/dforge-mcp-author/references/traits.md +153 -0
- package/skills/dforge-mcp-author/references/translations.md +158 -0
- package/skills/dforge-mcp-author/references/validation-checklist.md +184 -0
- package/skills/dforge-mcp-author/scripts/xlsx_to_model.py +198 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@dforge-core/dforge-mcp`. This project uses semver-ish
|
|
4
|
+
`0.1.0-rc.N` pre-release tags; the published version is set at publish time via
|
|
5
|
+
the release workflow, so committed `package.json` versions are placeholders.
|
|
6
|
+
|
|
7
|
+
## 0.1.2
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- **Windows CLI resolution & argument quoting (`native-shell`).** The PATH
|
|
11
|
+
fallback now routes a bare command name through `cmd.exe` so `PATHEXT`
|
|
12
|
+
resolves the `dforge-cli.cmd` shim that `npm install -g` drops on PATH —
|
|
13
|
+
previously `spawnSync` without a shell matched only an exact file and
|
|
14
|
+
`ENOENT`'d. Arguments are now quoted before the shell sees them (`shell:true`
|
|
15
|
+
performs no escaping), so a path with spaces no longer splits into multiple
|
|
16
|
+
args and a metacharacter (`&`, `|`, `>`, …) can't inject a second command;
|
|
17
|
+
`quoteWinArg` follows the `CommandLineToArgvW` rules. Spawn logic is
|
|
18
|
+
centralized in a single `spawnCli` helper shared by `run()` and
|
|
19
|
+
`installModule()`, with coverage in `test/native-shell.test.ts`.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
- **`dforge_module_install` always returns raw CLI output.** The tool now
|
|
23
|
+
surfaces the raw CLI output, `exitCode`, and `command` on every call so the
|
|
24
|
+
agent can read a server-side validation failure and fix-and-retry instead of
|
|
25
|
+
getting a swallowed error.
|
|
26
|
+
- **`dforge_module_pack` description.** Clarified that it uses the bundled
|
|
27
|
+
`dforge-cli` package, then the PATH fallback, then the `DFORGE_CLI_BINARY`
|
|
28
|
+
override (was "Requires the dforge-cli native binary on PATH").
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
- **Matrix data-view support.** Data-view guidance and schemas document matrix
|
|
32
|
+
views with `rangeControl` and per-column select values, alongside the
|
|
33
|
+
register/budgeting examples.
|
|
34
|
+
|
|
35
|
+
### Skill
|
|
36
|
+
- `dforge-mcp-author`: reworked the Phase 6 flow into an explicit
|
|
37
|
+
**validate → pack → install → fix** retry loop (SKILL.md,
|
|
38
|
+
`validation-checklist.md`, `docs/creating-modules.md`), and refreshed the
|
|
39
|
+
module naming conventions in the manifest schema.
|
|
40
|
+
|
|
41
|
+
## 0.1.0-rc.13
|
|
42
|
+
|
|
43
|
+
Single source of truth: the authoring tools now validate against
|
|
44
|
+
`@dforge-core/metadata` — the same registry/schema package the dForge app, SDK,
|
|
45
|
+
and VS Code extension use.
|
|
46
|
+
|
|
47
|
+
### Added
|
|
48
|
+
- **`dforge_dbml_import` — DBML front-end (was a stub).** Parses the common DBML
|
|
49
|
+
subset (Table blocks, typed columns with `[settings]`, inline `[ref: > t.c]`
|
|
50
|
+
and top-level `Ref:` lines) into the table-spec and runs the import core. Drops
|
|
51
|
+
the source PK column (the identity trait provides `{entity}_id`) and remaps FK
|
|
52
|
+
targets to it. Both import tools accept a `module` identity for **greenfield**
|
|
53
|
+
imports (no manifest yet).
|
|
54
|
+
- **Spreadsheet (.xlsx) import.** A binary `.xlsx` can't be read directly, so the
|
|
55
|
+
package ships a **pure-stdlib Python extractor** (`dforge://script/xlsx-to-model`,
|
|
56
|
+
no `pip install`) that decodes sheets → headers + sample rows as JSON. The skill
|
|
57
|
+
(`dforge://reference/excel-import`, wired into the Phase 1 on-ramp) drives it:
|
|
58
|
+
run the extractor, build a table-spec from the model, call `dforge_module_import`.
|
|
59
|
+
`.csv` is read directly (plain text).
|
|
60
|
+
- **`dforge_module_import` — table-spec → entities (import core).** Takes a
|
|
61
|
+
normalized spec (tables → columns → relationships) and generates entities:
|
|
62
|
+
each column's `fieldTypeCd` is inferred from an explicit code, a source SQL
|
|
63
|
+
type, sample values, and name heuristics (email/phone/url/currency), validated
|
|
64
|
+
against the metadata registry with `dbDatatype` derived; every relationship
|
|
65
|
+
becomes the FK+Reference two-column pair. The shared transformer that DBML/SQL,
|
|
66
|
+
Excel/CSV, and hand-authored front-ends feed (Excel front-end is next). Output
|
|
67
|
+
passes `dforge_module_validate` clean.
|
|
68
|
+
- **`dforge_entity_rename` / `dforge_entity_delete` — refactor-safe entity ops.**
|
|
69
|
+
Rename cascades the identity PK (`{old}_id → {new}_id`) and repoints every
|
|
70
|
+
reference (other entities' `link.entity`/`references`, view `entityCode`, role
|
|
71
|
+
rights keys, action entity, folder bindings, seed `entityCode` + PK keys);
|
|
72
|
+
delete drops the entity + its seed + manifest entry + role key + folder
|
|
73
|
+
binding + view sources. Both move/remove files via a new `deletes[]` field on
|
|
74
|
+
the tool response (apply `files` AND `deletes`); surfaces unhandled surfaces
|
|
75
|
+
(reports, translations, menus, DSL, dangling cross-entity FKs) as warnings.
|
|
76
|
+
- **`dforge_entity_field_rename` — refactor-safe field rename.** Renames a field
|
|
77
|
+
and propagates the new name to everything that referenced it in one call: the
|
|
78
|
+
paired Reference column's `link.thisKey` + `references` block, same-entity
|
|
79
|
+
formula columns (`[old]` → `[new]`), data view columns and `order` arrays,
|
|
80
|
+
seed-data records, and OTHER entities' FKs targeting it (`link.otherKey` /
|
|
81
|
+
`references.to.field`). Wired into the backtrack protocol ("rename, don't
|
|
82
|
+
remove+add"); pair with `dforge_module_validate` to confirm nothing dangles.
|
|
83
|
+
- **`dforge_module_validate` — offline pre-flight cross-reference check.** Loads
|
|
84
|
+
the whole module and catches the errors that previously only surfaced at
|
|
85
|
+
pack/install: dangling FK/reference targets, a missing hidden-FK column, view
|
|
86
|
+
`dataSources`/columns and menu `dataViewCode`s and role rights pointing at
|
|
87
|
+
entities/fields/actions/reports that don't exist, and entities with no Select
|
|
88
|
+
grant. Returns errors + warnings in `_validate.json`. Wired into the skill as
|
|
89
|
+
the first Phase 6 gate (run it and fix every error before packing).
|
|
90
|
+
- **Field-type & column-type validation.** `dforge_entity_field_add` /
|
|
91
|
+
`dforge_entity_field_modify` and `dforge_setting_add` reject an unknown
|
|
92
|
+
`fieldTypeCd` (with a "did you mean" hint — e.g. `integer` → `number`,
|
|
93
|
+
`reference` → `lookup`) and an unknown `columnType`. Previously any string
|
|
94
|
+
passed.
|
|
95
|
+
- **`dbDatatype` auto-derivation.** When a field omits `dbDatatype`, it's
|
|
96
|
+
derived from `fieldTypeCd` (currency → `numeric(18,2)`, text → `varchar`;
|
|
97
|
+
reference/formula columns get none). An explicit value is never overridden.
|
|
98
|
+
- **Full entity trait set.** `dforge_entity_add` / `dforge_module_create`
|
|
99
|
+
accept the complete, metadata-validated trait list — identity, audit,
|
|
100
|
+
audit-full, soft-delete, sorting, postable, accumulation, ledger, period —
|
|
101
|
+
instead of only the two scaffolder presets. Codes expand server-side at
|
|
102
|
+
install.
|
|
103
|
+
- **Test harness.** Added `vitest` (`pnpm test`) with coverage for the new
|
|
104
|
+
validation, `dbDatatype` derivation, and the trait flow.
|
|
105
|
+
|
|
106
|
+
### Changed
|
|
107
|
+
- **`dforge_entity_field_remove` now cascade-cleans.** It removes the field and
|
|
108
|
+
the paired Reference (when you remove its hidden FK), the `references` entry,
|
|
109
|
+
view columns + `order`, and seed-data keys — and warns about formula /
|
|
110
|
+
cross-entity dependents instead of leaving them dangling. (Moved into
|
|
111
|
+
`src/tools/refactor.ts` alongside the rename ops.)
|
|
112
|
+
- **Schemas sourced from `@dforge-core/metadata`, cross-platform.** A new Node
|
|
113
|
+
script (`scripts/vendor-schemas.cjs`, runnable via `pnpm sync-schemas`) copies
|
|
114
|
+
the JSON schemas from the installed metadata package — works on Windows, and
|
|
115
|
+
runs automatically in `prepublishOnly` so every publish regenerates them from
|
|
116
|
+
the pinned metadata version (no silent drift). `vendor-resources.sh` is now a
|
|
117
|
+
Unix wrapper that delegates schemas to that script. The public
|
|
118
|
+
`resources/schemas/*` surface (MCP resources + jsdelivr) is unchanged.
|
|
119
|
+
- **`vendor-resources.sh` reference sync is opt-in.** The conventions doc and
|
|
120
|
+
skill reference pull from `dForge-core` now runs only with `VENDOR_REFS=1`;
|
|
121
|
+
the default run is schemas-only and needs no `dForge-core` checkout. This
|
|
122
|
+
prevents clobbering the in-repo skill references, which are ahead of core.
|
|
123
|
+
- **Dependencies.** Added `@dforge-core/metadata ^0.0.2` (bundled into the
|
|
124
|
+
single-file `dist/server.js` via tsup). Bumped `@dforge-core/dforge-cli`
|
|
125
|
+
`^0.1.2` → `^0.2.2` (builder API unchanged; `buildFolders` flat-root output
|
|
126
|
+
verified).
|
|
127
|
+
|
|
128
|
+
### Skill
|
|
129
|
+
- `dforge-mcp-author`: `field-types.md` + `SKILL.md` now tell the agent to
|
|
130
|
+
**omit `dbDatatype` on plain data columns** (it's derived), keeping the
|
|
131
|
+
explicit-value guidance only for FK columns (`cuid`) and size/precision
|
|
132
|
+
overrides — so the derivation is actually used, not bypassed.
|
|
133
|
+
|
|
134
|
+
### Fixed
|
|
135
|
+
- **Phase 0 scaffold gate no longer greps Markdown.** `dforge_module_plan`
|
|
136
|
+
validate now writes a machine-readable `docs/phase.json` marker, and the gate
|
|
137
|
+
(`dforge_module_create` + the plan `check`) **parse** it instead of searching
|
|
138
|
+
`VALIDATION.md` for a `readyToScaffold: true` substring — so reformatting /
|
|
139
|
+
casing / duplicate text in the human report can't fool the gate. Falls back to
|
|
140
|
+
the legacy substring for modules validated before the marker existed.
|
|
141
|
+
- **Field rename now updates *every* formula** that references the field, not
|
|
142
|
+
just the first — replaced a reused global `RegExp` (`.test()` carries
|
|
143
|
+
`lastIndex` across calls) with literal bracket-token string ops.
|
|
144
|
+
- **Validator no longer rubber-stamps cross-module typos.** A dotted entity ref
|
|
145
|
+
(`crm.product`) is validated against the manifest's declared `dependencies`
|
|
146
|
+
(or this module's own code); an undeclared/typo'd module is now an error
|
|
147
|
+
instead of being accepted. **Role-rights** entity keys use the same resolver,
|
|
148
|
+
so grants on a **system entity** (`user`, `document`, …) or a declared
|
|
149
|
+
cross-module entity no longer false-error, while unknown ones still do.
|
|
150
|
+
- **xlsx extractor ignores styled-but-empty rows when sampling.** A bordered/
|
|
151
|
+
formatted cell with no value no longer counts as data, so placeholder rows
|
|
152
|
+
can't exhaust the row sample before the real data is reached. Headers-only
|
|
153
|
+
(structure-only) sheets are supported too — they yield `rows: []`.
|
|
154
|
+
- **xlsx extractor is memory-bounded with no value loss.** Worksheets stream
|
|
155
|
+
(capped sample), and the shared-string table is read in a second pass that
|
|
156
|
+
loads **only the indices the sampled cells reference** — so a huge workbook
|
|
157
|
+
never loads the whole table, and there's no cap that could silently return a
|
|
158
|
+
raw index instead of the real string.
|
|
159
|
+
- **`module pack` tarball-path resolution is robust.** It collects every
|
|
160
|
+
`*.dforge` candidate from stdout (quoted/spaced paths and Windows separators
|
|
161
|
+
included), **normalizes wrapping punctuation** (quotes, parens, trailing
|
|
162
|
+
commas), and picks the one that **actually exists on disk** — pack just wrote
|
|
163
|
+
it — via a single `stat` per path instead of trusting a fragile regex token.
|
|
164
|
+
|
|
165
|
+
### Notes
|
|
166
|
+
- Earlier `0.1.0-rc.*` releases predate this changelog.
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @dforge-core/dforge-mcp
|
|
2
2
|
|
|
3
|
-
MCP server for dForge module authoring. Exposes
|
|
3
|
+
MCP server for dForge module authoring. Exposes 27 composable tools and the canonical schemas so AI agents (Claude Code, Cursor, Zed, etc.) can drive the full module lifecycle — scaffold → entities → actions → views → security → install — through structured tool calls instead of free-form JSON generation.
|
|
4
4
|
|
|
5
|
-
Ships with a wizard Skill (`skills/dforge-mcp-author
|
|
5
|
+
Ships with a wizard Skill (`skills/dforge-mcp-author/`) that walks the AI through six phases with explicit backtrack support when later phases expose earlier gaps. The skill bundle includes 23 detailed reference files (field types, flags, traits, formulas, DSL, security, etc.) and an annotated `simple-todo` example module.
|
|
6
6
|
|
|
7
7
|
**New here?** Start with **[docs/creating-modules.md](docs/creating-modules.md)** — three ways to scaffold a module (terminal CLI, VS Code sidebar, AI wizard) and when to pick each.
|
|
8
8
|
|
|
@@ -25,6 +25,8 @@ your AI editor (Claude Code / Cursor / Zed)
|
|
|
25
25
|
|
|
26
26
|
The native binary actually talks to your tenant. The npm-CLI wrapper is just a launcher that picks the right platform binary and exec's it. **You don't need to install dforge-cli separately** — it comes along when you install dforge-mcp (or when `npx -y @dforge-core/dforge-mcp` runs cold).
|
|
27
27
|
|
|
28
|
+
The server also bundles **`@dforge-core/metadata`** — the canonical, dependency-free registry of field types, traits, column types, and the JSON schemas (the same package the dForge app, SDK, and VS Code extension use). It's the source of truth for the authoring-time validation below (valid `fieldTypeCd` / `columnType` / trait codes, `dbDatatype` derivation) and for the vendored schemas. Bundled at build time, so there's nothing extra to install.
|
|
29
|
+
|
|
28
30
|
If you want to use a hand-built native binary instead of the npm-shipped one, point `DFORGE_CLI_BINARY` at the executable file's absolute path:
|
|
29
31
|
|
|
30
32
|
```bash
|
|
@@ -33,6 +35,8 @@ DFORGE_CLI_BINARY=/Users/me/projects/dForge-core/cli/bin/dForge.Cli
|
|
|
33
35
|
|
|
34
36
|
(macOS / Linux: no extension. Windows: `dForge.Cli.exe`.) If the path doesn't exist or isn't executable the server reports an error at the first pack/install call.
|
|
35
37
|
|
|
38
|
+
For AI-assisted module repair, Phase 6 is intentionally tool-driven: the skill runs `dforge_module_validate`, `dforge_module_pack`, and `dforge_module_install` itself. If install fails because the module is invalid, the install tool returns the raw CLI/server output plus `exitCode` and `command`; the AI reads that output, fixes the referenced module files, and repeats validate → pack → install. User action is needed only for environment failures such as missing CLI, missing/expired credentials, an unreachable tenant/API, permissions, or an invalid path.
|
|
39
|
+
|
|
36
40
|
## Install + wire into Claude Code
|
|
37
41
|
|
|
38
42
|
### Recommended — via `claude mcp add` (writes ~/.claude.json for you)
|
|
@@ -70,7 +74,7 @@ claude mcp list
|
|
|
70
74
|
# Should show: dforge — npx -y @dforge-core/dforge-mcp — connected
|
|
71
75
|
```
|
|
72
76
|
|
|
73
|
-
Or inside a Claude Code session, type `/mcp` to see all connected servers + their tools. The
|
|
77
|
+
Or inside a Claude Code session, type `/mcp` to see all connected servers + their tools. The 27 `dforge_*` tools should be listed.
|
|
74
78
|
|
|
75
79
|
### Cursor / Zed
|
|
76
80
|
|
|
@@ -78,30 +82,43 @@ Same `command + args` config shape; check their docs for the file location. Veri
|
|
|
78
82
|
|
|
79
83
|
## What it exposes
|
|
80
84
|
|
|
81
|
-
### Tools (
|
|
85
|
+
### Tools (27)
|
|
82
86
|
|
|
83
87
|
Grouped by typical phase in the wizard flow. All "return" tools emit `{ summary, files: { '<relPath>': '<contents>' } }`; the client decides whether to write — lets the AI preview diffs with the user before committing.
|
|
84
88
|
|
|
89
|
+
Phase 0 (identity → requirements → design → validation) is orchestrated by the **`dforge_module_plan`** tool together with the `dforge-mcp-author` skill: the tool tracks progress from the on-disk `docs/` artifacts and gates scaffolding, while the AI authors those artifacts under its direction.
|
|
90
|
+
|
|
85
91
|
**Module-level**
|
|
86
92
|
| Tool | Behavior |
|
|
87
93
|
|---|---|
|
|
88
|
-
| `
|
|
94
|
+
| `dforge_module_plan` | **Phase 0 orchestrator** — drives identity → requirements → design → validation, returning the next step each call; gates `dforge_module_create` until `readyToScaffold: true`. Call first in any session (`action: "check"`) |
|
|
95
|
+
| `dforge_module_create` | New module scaffold (blocked until Phase 0 passes) |
|
|
96
|
+
| `dforge_module_import` | Import a normalized **table-spec** (tables → columns → relationships) into an existing module as entities. Infers `fieldTypeCd` from SQL type / sample values / name (metadata-validated, `dbDatatype` derived) and builds the FK+Reference pair per relationship. Fed by DBML/SQL, Excel/CSV, or a hand-authored spec |
|
|
89
97
|
| `dforge_module_inspect` | Read current module state. Full structured data is in `files["_inspect.json"]`; `summary` is one-line stats |
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
98
|
+
| `dforge_module_validate` | Offline cross-reference check (run before pack): dangling FK targets, missing hidden-FK columns, view/menu/role refs to non-existent things, uncovered entities. Errors + warnings in `files["_validate.json"]` |
|
|
99
|
+
| `dforge_module_pack` | Shells to `dforge-cli module pack` via bundled CLI, PATH fallback, or `DFORGE_CLI_BINARY`. Returns tarball path + size |
|
|
100
|
+
| `dforge_module_install` | Shells to `dforge-cli module install`. Args: `pathOrTarball`, optional `tenantUrl` / `token` / `tenantCode` — fall back to `DFORGE_URL` / `DFORGE_TOKEN` env. Returns `ok`, `exitCode`, `command`, and raw CLI `output` so the AI can fix install-time module defects and retry |
|
|
92
101
|
|
|
93
102
|
**Entities (Phase 1)**
|
|
94
103
|
| Tool | Behavior |
|
|
95
104
|
|---|---|
|
|
96
|
-
| `dforge_entity_add` | Add an entity to an existing module |
|
|
105
|
+
| `dforge_entity_add` | Add an entity to an existing module. `traits` accepts the full platform set — identity, audit, audit-full, soft-delete, sorting, postable, accumulation, ledger, period |
|
|
106
|
+
| `dforge_entity_rename` | **Refactor-safe entity rename** — moves the file (see `deletes`), cascades the PK `{old}_id → {new}_id`, repoints link.entity / references / view entityCode / role keys / action entity / folder bindings / seed |
|
|
107
|
+
| `dforge_entity_delete` | **Refactor-safe entity delete** — drops the file + seed (see `deletes`), manifest entry, role key, folder binding, view sources; warns on dangling cross-entity FKs |
|
|
97
108
|
| `dforge_entity_field_add` | Patch a single field |
|
|
98
|
-
| `dforge_entity_field_modify` | Replace a field's spec |
|
|
99
|
-
| `
|
|
109
|
+
| `dforge_entity_field_modify` | Replace a field's spec (same name) |
|
|
110
|
+
| `dforge_entity_field_rename` | **Refactor-safe rename** — propagates the new name to the paired Reference, formulas, view columns + order, seed data, and other entities' FKs |
|
|
111
|
+
| `dforge_entity_field_remove` | **Refactor-safe remove** — cascade-cleans paired Reference, view columns + order, seed keys; warns on formula/cross-entity dependents |
|
|
112
|
+
|
|
113
|
+
The field/entity tools validate against the `@dforge-core/metadata` registry: an unknown `fieldTypeCd` (e.g. `integer`, `reference`), `columnType`, or trait code is rejected at authoring time with a "did you mean" hint, and `dbDatatype` is auto-derived from the field type (currency → `numeric(18,2)`, text → `varchar`; reference/formula columns get none) unless you set it explicitly.
|
|
100
114
|
|
|
101
115
|
**Behavior (Phase 2 — optional)**
|
|
102
116
|
| Tool | Behavior |
|
|
103
117
|
|---|---|
|
|
104
118
|
| `dforge_action_add` | DSL script + `ui/actions.json` entry |
|
|
119
|
+
| `dforge_trigger_add` | DB-event trigger in `logic/triggers.json` (entity event + optional condition → action) |
|
|
120
|
+
| `dforge_job_add` | Scheduled job in `logic/jobs.json` (5-field cron + timeout + action) |
|
|
121
|
+
| `dforge_webhook_add` | Outbound webhook in `logic/webhooks.json` (entity event → POST to endpoint) |
|
|
105
122
|
|
|
106
123
|
**Views + reports (Phase 3)**
|
|
107
124
|
| Tool | Behavior |
|
|
@@ -122,7 +139,7 @@ Grouped by typical phase in the wizard flow. All "return" tools emit `{ summary,
|
|
|
122
139
|
| Tool | Behavior |
|
|
123
140
|
|---|---|
|
|
124
141
|
| `dforge_dependency_add` | Add a dep on another dForge module |
|
|
125
|
-
| `dforge_dbml_import` |
|
|
142
|
+
| `dforge_dbml_import` | **DBML front-end** to `module_import` — parses DBML (Table blocks, typed columns, inline + top-level refs) into the table-spec, drops the source PK (identity provides `{entity}_id`), and imports. Pass `module` for a greenfield import |
|
|
126
143
|
|
|
127
144
|
### Resources (13)
|
|
128
145
|
|
|
@@ -152,27 +169,60 @@ https://cdn.jsdelivr.net/npm/@dforge-core/dforge-mcp@latest/resources/schemas/<n
|
|
|
152
169
|
|
|
153
170
|
## Claude Skill — the wizard
|
|
154
171
|
|
|
155
|
-
`skills/dforge-mcp-author
|
|
172
|
+
The skill bundle lives at `skills/dforge-mcp-author/` and contains:
|
|
156
173
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
174
|
+
| Path | Contents |
|
|
175
|
+
|---|---|
|
|
176
|
+
| `SKILL.md` | Six-phase co-pilot wizard |
|
|
177
|
+
| `references/*.md` | 23 detailed reference files (field types, flags, traits, formulas, DSL, security, views, menus, translations, …) |
|
|
178
|
+
| `examples/simple-todo/` | Annotated reference module showing all core patterns |
|
|
179
|
+
|
|
180
|
+
**It is NOT auto-installed by `npm install`** — the skill ships in the npm tarball but Claude Code looks for skills in `~/.claude/skills/`, not in `node_modules`. Sync the whole bundle manually:
|
|
162
181
|
|
|
163
|
-
|
|
182
|
+
```bash
|
|
183
|
+
# Resolve the actual latest published version from the npm registry,
|
|
184
|
+
# then pin the jsdelivr URL to it. We don't use jsdelivr's `@latest`
|
|
185
|
+
# alias directly — that CDN endpoint caches aggressively (6-12h lag
|
|
186
|
+
# after a new publish), which silently serves stale Skill content.
|
|
187
|
+
VERSION=$(npm view @dforge-core/dforge-mcp version)
|
|
188
|
+
BASE="https://cdn.jsdelivr.net/npm/@dforge-core/dforge-mcp@${VERSION}/skills/dforge-mcp-author"
|
|
189
|
+
|
|
190
|
+
# Wizard
|
|
164
191
|
mkdir -p ~/.claude/skills/dforge-mcp-author
|
|
165
|
-
curl -fsSL
|
|
166
|
-
|
|
192
|
+
curl -fsSL "$BASE/SKILL.md" -o ~/.claude/skills/dforge-mcp-author/SKILL.md
|
|
193
|
+
|
|
194
|
+
# Reference files (23 guides — load on demand per the table in SKILL.md)
|
|
195
|
+
mkdir -p ~/.claude/skills/dforge-mcp-author/references
|
|
196
|
+
for f in action-dsl column-types conventions data-migration data-views \
|
|
197
|
+
field-types filters flags formulas jobs manifest menus \
|
|
198
|
+
number-sequences print-templates queries reports schema-import \
|
|
199
|
+
security settings traits translations validation-checklist; do
|
|
200
|
+
curl -fsSL "$BASE/references/${f}.md" \
|
|
201
|
+
-o ~/.claude/skills/dforge-mcp-author/references/${f}.md
|
|
202
|
+
done
|
|
203
|
+
|
|
204
|
+
# simple-todo example
|
|
205
|
+
mkdir -p ~/.claude/skills/dforge-mcp-author/examples/simple-todo/{entities,logic/actions,ui,security,seed-data}
|
|
206
|
+
for f in README.md manifest.json; do
|
|
207
|
+
curl -fsSL "$BASE/examples/simple-todo/$f" \
|
|
208
|
+
-o ~/.claude/skills/dforge-mcp-author/examples/simple-todo/$f
|
|
209
|
+
done
|
|
210
|
+
# … entity, ui, security, seed-data files follow the same pattern
|
|
211
|
+
|
|
212
|
+
# Or, straight from GitHub main (always fresh, but pre-release content):
|
|
213
|
+
# curl -fsSL https://raw.githubusercontent.com/dforge-core/dforge-mcp/main/skills/dforge-mcp-author/SKILL.md \
|
|
214
|
+
# -o ~/.claude/skills/dforge-mcp-author/SKILL.md
|
|
167
215
|
```
|
|
168
216
|
|
|
169
|
-
|
|
217
|
+
> **Note on CLAUDE.md:** Every module gets a `CLAUDE.md` in its root, authored during Phase 0a by the `dforge-mcp-author` skill (the AI drafts it; you write it) and kept current as later phases complete. It tells Claude Code that the directory is a dForge module, instructs it to use the `dforge-mcp-author` skill, describes the module layout, and carries a live **Module status** tracker (which phase is done) so future sessions resume accurately.
|
|
218
|
+
|
|
219
|
+
Re-run after every dforge-mcp upgrade — the skill version isn't checked at runtime, so a stale skill against new tools will misroute calls.
|
|
170
220
|
|
|
171
221
|
The phases:
|
|
172
222
|
|
|
173
223
|
| Phase | Required? | Tools used |
|
|
174
224
|
|---|---|---|
|
|
175
|
-
| 0.
|
|
225
|
+
| 0. Identity / requirements / design / validation | yes | (docs authored directly) |
|
|
176
226
|
| 1. Domain | yes | `module_create`, `entity_add`, `entity_field_*` |
|
|
177
227
|
| 2. Actions | optional | `action_add` |
|
|
178
228
|
| 3. Views + Reports | views yes, reports optional | `view_*`, `report_add`, `setting_add` |
|
|
@@ -188,29 +238,37 @@ Key principles encoded in the Skill: inspect-before-patch, one-at-a-time, determ
|
|
|
188
238
|
|
|
189
239
|
```bash
|
|
190
240
|
pnpm install
|
|
191
|
-
pnpm build # tsup → dist/server.js (bundles SDK + zod + dforge-cli/templates)
|
|
241
|
+
pnpm build # tsup → dist/server.js (bundles SDK + zod + dforge-cli/templates + metadata)
|
|
192
242
|
pnpm typecheck # tsc --noEmit
|
|
243
|
+
pnpm test # vitest — validation + dbDatatype derivation + trait flow
|
|
193
244
|
node dist/server.js # stdio JSON-RPC — pipe a request to smoke-test
|
|
194
245
|
```
|
|
195
246
|
|
|
196
247
|
To iterate against an in-tree `dforge-cli`, temporarily pin the dep at the sibling path:
|
|
197
248
|
|
|
198
249
|
```bash
|
|
199
|
-
sed -i '' 's|"@dforge-core/dforge-cli": "\^0.
|
|
250
|
+
sed -i '' 's|"@dforge-core/dforge-cli": "\^0.2.[0-9.]*"|"@dforge-core/dforge-cli": "file:../dforge-cli"|' package.json
|
|
200
251
|
rm -rf node_modules pnpm-lock.yaml && pnpm install
|
|
201
252
|
# Flip back before publish — file: deps don't resolve for npm consumers.
|
|
202
253
|
```
|
|
203
254
|
|
|
204
255
|
### Refresh vendored resources
|
|
205
256
|
|
|
206
|
-
|
|
257
|
+
**Schemas** (`resources/schemas/`) are copied from the installed **`@dforge-core/metadata`** package — bumping that dep is how you pick up schema changes. They're served as MCP resources via `dforge://schema/*` and, in the published tarball, via jsdelivr.
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
pnpm sync-schemas # node script — cross-platform (Windows/macOS/Linux)
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
You rarely run this by hand: **`prepublishOnly` runs it automatically**, so every publish regenerates the schemas from the exact metadata version this package depends on — they can't silently drift. The schemas are committed, so consumers always have them regardless.
|
|
264
|
+
|
|
265
|
+
`scripts/vendor-resources.sh` is a Unix convenience wrapper around the same Node script, and it additionally can pull the **conventions doc + skill reference files** from `dForge-core` — but only when `VENDOR_REFS=1`:
|
|
207
266
|
|
|
208
267
|
```bash
|
|
209
|
-
scripts/vendor-resources.sh
|
|
210
|
-
DFORGE_CORE=/abs/path/to/dForge-core scripts/vendor-resources.sh
|
|
268
|
+
VENDOR_REFS=1 scripts/vendor-resources.sh # also pull conventions + skill refs from ../dForge-core
|
|
211
269
|
```
|
|
212
270
|
|
|
213
|
-
|
|
271
|
+
**That ref pull is off by default on purpose:** the per-topic references under `skills/dforge-mcp-author/references/` are authored in this repo and are ahead of `dForge-core/skills/dforge-module-author/`, so an unguarded pull would clobber them. Only set `VENDOR_REFS=1` once you've confirmed core is the source of truth for those files. (This part is bash-only; on Windows use WSL/Git Bash for the ref pull — schema refresh via `pnpm sync-schemas` is native.)
|
|
214
272
|
|
|
215
273
|
### Publishing
|
|
216
274
|
|
|
@@ -223,7 +281,8 @@ scripts/publish.sh 0.1.0-rc.N --tag latest --otp <code>
|
|
|
223
281
|
**Pre-publish checklist:**
|
|
224
282
|
- [ ] `@dforge-core/dforge-cli` dep is a real version (not `file:...`)
|
|
225
283
|
- [ ] `pnpm typecheck` passes
|
|
226
|
-
- [ ]
|
|
284
|
+
- [ ] `pnpm test` passes
|
|
285
|
+
- [ ] Smoke test stdio: `tools/list` returns 27 tools
|
|
227
286
|
- [ ] Skill updated for any new/changed tools (it's a SEPARATE artifact; users sync it manually after upgrades)
|
|
228
287
|
|
|
229
288
|
### Adding a new tool
|