@dforge-core/dforge-mcp 0.1.0-rc.8 → 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.
- package/CHANGELOG.md +132 -0
- package/README.md +84 -27
- package/dist/server.js +2957 -616
- package/docs/creating-modules.md +11 -4
- 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 +269 -69
- 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 +243 -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 +183 -0
- package/skills/dforge-mcp-author/scripts/xlsx_to_model.py +198 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
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.0-rc.13
|
|
8
|
+
|
|
9
|
+
Single source of truth: the authoring tools now validate against
|
|
10
|
+
`@dforge-core/metadata` — the same registry/schema package the dForge app, SDK,
|
|
11
|
+
and VS Code extension use.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- **`dforge_dbml_import` — DBML front-end (was a stub).** Parses the common DBML
|
|
15
|
+
subset (Table blocks, typed columns with `[settings]`, inline `[ref: > t.c]`
|
|
16
|
+
and top-level `Ref:` lines) into the table-spec and runs the import core. Drops
|
|
17
|
+
the source PK column (the identity trait provides `{entity}_id`) and remaps FK
|
|
18
|
+
targets to it. Both import tools accept a `module` identity for **greenfield**
|
|
19
|
+
imports (no manifest yet).
|
|
20
|
+
- **Spreadsheet (.xlsx) import.** A binary `.xlsx` can't be read directly, so the
|
|
21
|
+
package ships a **pure-stdlib Python extractor** (`dforge://script/xlsx-to-model`,
|
|
22
|
+
no `pip install`) that decodes sheets → headers + sample rows as JSON. The skill
|
|
23
|
+
(`dforge://reference/excel-import`, wired into the Phase 1 on-ramp) drives it:
|
|
24
|
+
run the extractor, build a table-spec from the model, call `dforge_module_import`.
|
|
25
|
+
`.csv` is read directly (plain text).
|
|
26
|
+
- **`dforge_module_import` — table-spec → entities (import core).** Takes a
|
|
27
|
+
normalized spec (tables → columns → relationships) and generates entities:
|
|
28
|
+
each column's `fieldTypeCd` is inferred from an explicit code, a source SQL
|
|
29
|
+
type, sample values, and name heuristics (email/phone/url/currency), validated
|
|
30
|
+
against the metadata registry with `dbDatatype` derived; every relationship
|
|
31
|
+
becomes the FK+Reference two-column pair. The shared transformer that DBML/SQL,
|
|
32
|
+
Excel/CSV, and hand-authored front-ends feed (Excel front-end is next). Output
|
|
33
|
+
passes `dforge_module_validate` clean.
|
|
34
|
+
- **`dforge_entity_rename` / `dforge_entity_delete` — refactor-safe entity ops.**
|
|
35
|
+
Rename cascades the identity PK (`{old}_id → {new}_id`) and repoints every
|
|
36
|
+
reference (other entities' `link.entity`/`references`, view `entityCode`, role
|
|
37
|
+
rights keys, action entity, folder bindings, seed `entityCode` + PK keys);
|
|
38
|
+
delete drops the entity + its seed + manifest entry + role key + folder
|
|
39
|
+
binding + view sources. Both move/remove files via a new `deletes[]` field on
|
|
40
|
+
the tool response (apply `files` AND `deletes`); surfaces unhandled surfaces
|
|
41
|
+
(reports, translations, menus, DSL, dangling cross-entity FKs) as warnings.
|
|
42
|
+
- **`dforge_entity_field_rename` — refactor-safe field rename.** Renames a field
|
|
43
|
+
and propagates the new name to everything that referenced it in one call: the
|
|
44
|
+
paired Reference column's `link.thisKey` + `references` block, same-entity
|
|
45
|
+
formula columns (`[old]` → `[new]`), data view columns and `order` arrays,
|
|
46
|
+
seed-data records, and OTHER entities' FKs targeting it (`link.otherKey` /
|
|
47
|
+
`references.to.field`). Wired into the backtrack protocol ("rename, don't
|
|
48
|
+
remove+add"); pair with `dforge_module_validate` to confirm nothing dangles.
|
|
49
|
+
- **`dforge_module_validate` — offline pre-flight cross-reference check.** Loads
|
|
50
|
+
the whole module and catches the errors that previously only surfaced at
|
|
51
|
+
pack/install: dangling FK/reference targets, a missing hidden-FK column, view
|
|
52
|
+
`dataSources`/columns and menu `dataViewCode`s and role rights pointing at
|
|
53
|
+
entities/fields/actions/reports that don't exist, and entities with no Select
|
|
54
|
+
grant. Returns errors + warnings in `_validate.json`. Wired into the skill as
|
|
55
|
+
the first Phase 6 gate (run it and fix every error before packing).
|
|
56
|
+
- **Field-type & column-type validation.** `dforge_entity_field_add` /
|
|
57
|
+
`dforge_entity_field_modify` and `dforge_setting_add` reject an unknown
|
|
58
|
+
`fieldTypeCd` (with a "did you mean" hint — e.g. `integer` → `number`,
|
|
59
|
+
`reference` → `lookup`) and an unknown `columnType`. Previously any string
|
|
60
|
+
passed.
|
|
61
|
+
- **`dbDatatype` auto-derivation.** When a field omits `dbDatatype`, it's
|
|
62
|
+
derived from `fieldTypeCd` (currency → `numeric(18,2)`, text → `varchar`;
|
|
63
|
+
reference/formula columns get none). An explicit value is never overridden.
|
|
64
|
+
- **Full entity trait set.** `dforge_entity_add` / `dforge_module_create`
|
|
65
|
+
accept the complete, metadata-validated trait list — identity, audit,
|
|
66
|
+
audit-full, soft-delete, sorting, postable, accumulation, ledger, period —
|
|
67
|
+
instead of only the two scaffolder presets. Codes expand server-side at
|
|
68
|
+
install.
|
|
69
|
+
- **Test harness.** Added `vitest` (`pnpm test`) with coverage for the new
|
|
70
|
+
validation, `dbDatatype` derivation, and the trait flow.
|
|
71
|
+
|
|
72
|
+
### Changed
|
|
73
|
+
- **`dforge_entity_field_remove` now cascade-cleans.** It removes the field and
|
|
74
|
+
the paired Reference (when you remove its hidden FK), the `references` entry,
|
|
75
|
+
view columns + `order`, and seed-data keys — and warns about formula /
|
|
76
|
+
cross-entity dependents instead of leaving them dangling. (Moved into
|
|
77
|
+
`src/tools/refactor.ts` alongside the rename ops.)
|
|
78
|
+
- **Schemas sourced from `@dforge-core/metadata`, cross-platform.** A new Node
|
|
79
|
+
script (`scripts/vendor-schemas.cjs`, runnable via `pnpm sync-schemas`) copies
|
|
80
|
+
the JSON schemas from the installed metadata package — works on Windows, and
|
|
81
|
+
runs automatically in `prepublishOnly` so every publish regenerates them from
|
|
82
|
+
the pinned metadata version (no silent drift). `vendor-resources.sh` is now a
|
|
83
|
+
Unix wrapper that delegates schemas to that script. The public
|
|
84
|
+
`resources/schemas/*` surface (MCP resources + jsdelivr) is unchanged.
|
|
85
|
+
- **`vendor-resources.sh` reference sync is opt-in.** The conventions doc and
|
|
86
|
+
skill reference pull from `dForge-core` now runs only with `VENDOR_REFS=1`;
|
|
87
|
+
the default run is schemas-only and needs no `dForge-core` checkout. This
|
|
88
|
+
prevents clobbering the in-repo skill references, which are ahead of core.
|
|
89
|
+
- **Dependencies.** Added `@dforge-core/metadata ^0.0.2` (bundled into the
|
|
90
|
+
single-file `dist/server.js` via tsup). Bumped `@dforge-core/dforge-cli`
|
|
91
|
+
`^0.1.2` → `^0.2.2` (builder API unchanged; `buildFolders` flat-root output
|
|
92
|
+
verified).
|
|
93
|
+
|
|
94
|
+
### Skill
|
|
95
|
+
- `dforge-mcp-author`: `field-types.md` + `SKILL.md` now tell the agent to
|
|
96
|
+
**omit `dbDatatype` on plain data columns** (it's derived), keeping the
|
|
97
|
+
explicit-value guidance only for FK columns (`cuid`) and size/precision
|
|
98
|
+
overrides — so the derivation is actually used, not bypassed.
|
|
99
|
+
|
|
100
|
+
### Fixed
|
|
101
|
+
- **Phase 0 scaffold gate no longer greps Markdown.** `dforge_module_plan`
|
|
102
|
+
validate now writes a machine-readable `docs/phase.json` marker, and the gate
|
|
103
|
+
(`dforge_module_create` + the plan `check`) **parse** it instead of searching
|
|
104
|
+
`VALIDATION.md` for a `readyToScaffold: true` substring — so reformatting /
|
|
105
|
+
casing / duplicate text in the human report can't fool the gate. Falls back to
|
|
106
|
+
the legacy substring for modules validated before the marker existed.
|
|
107
|
+
- **Field rename now updates *every* formula** that references the field, not
|
|
108
|
+
just the first — replaced a reused global `RegExp` (`.test()` carries
|
|
109
|
+
`lastIndex` across calls) with literal bracket-token string ops.
|
|
110
|
+
- **Validator no longer rubber-stamps cross-module typos.** A dotted entity ref
|
|
111
|
+
(`crm.product`) is validated against the manifest's declared `dependencies`
|
|
112
|
+
(or this module's own code); an undeclared/typo'd module is now an error
|
|
113
|
+
instead of being accepted. **Role-rights** entity keys use the same resolver,
|
|
114
|
+
so grants on a **system entity** (`user`, `document`, …) or a declared
|
|
115
|
+
cross-module entity no longer false-error, while unknown ones still do.
|
|
116
|
+
- **xlsx extractor ignores styled-but-empty rows when sampling.** A bordered/
|
|
117
|
+
formatted cell with no value no longer counts as data, so placeholder rows
|
|
118
|
+
can't exhaust the row sample before the real data is reached. Headers-only
|
|
119
|
+
(structure-only) sheets are supported too — they yield `rows: []`.
|
|
120
|
+
- **xlsx extractor is memory-bounded with no value loss.** Worksheets stream
|
|
121
|
+
(capped sample), and the shared-string table is read in a second pass that
|
|
122
|
+
loads **only the indices the sampled cells reference** — so a huge workbook
|
|
123
|
+
never loads the whole table, and there's no cap that could silently return a
|
|
124
|
+
raw index instead of the real string.
|
|
125
|
+
- **`module pack` tarball-path resolution is robust.** It collects every
|
|
126
|
+
`*.dforge` candidate from stdout (quoted/spaced paths and Windows separators
|
|
127
|
+
included), **normalizes wrapping punctuation** (quotes, parens, trailing
|
|
128
|
+
commas), and picks the one that **actually exists on disk** — pack just wrote
|
|
129
|
+
it — via a single `stat` per path instead of trusting a fragile regex token.
|
|
130
|
+
|
|
131
|
+
### Notes
|
|
132
|
+
- 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
|
|
@@ -70,7 +72,7 @@ claude mcp list
|
|
|
70
72
|
# Should show: dforge — npx -y @dforge-core/dforge-mcp — connected
|
|
71
73
|
```
|
|
72
74
|
|
|
73
|
-
Or inside a Claude Code session, type `/mcp` to see all connected servers + their tools. The
|
|
75
|
+
Or inside a Claude Code session, type `/mcp` to see all connected servers + their tools. The 27 `dforge_*` tools should be listed.
|
|
74
76
|
|
|
75
77
|
### Cursor / Zed
|
|
76
78
|
|
|
@@ -78,30 +80,43 @@ Same `command + args` config shape; check their docs for the file location. Veri
|
|
|
78
80
|
|
|
79
81
|
## What it exposes
|
|
80
82
|
|
|
81
|
-
### Tools (
|
|
83
|
+
### Tools (27)
|
|
82
84
|
|
|
83
85
|
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
86
|
|
|
87
|
+
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.
|
|
88
|
+
|
|
85
89
|
**Module-level**
|
|
86
90
|
| Tool | Behavior |
|
|
87
91
|
|---|---|
|
|
88
|
-
| `
|
|
92
|
+
| `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"`) |
|
|
93
|
+
| `dforge_module_create` | New module scaffold (blocked until Phase 0 passes) |
|
|
94
|
+
| `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
95
|
| `dforge_module_inspect` | Read current module state. Full structured data is in `files["_inspect.json"]`; `summary` is one-line stats |
|
|
96
|
+
| `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"]` |
|
|
90
97
|
| `dforge_module_pack` | Shells to `dforge-cli module pack`. Returns tarball path + size |
|
|
91
98
|
| `dforge_module_install` | Shells to `dforge-cli module install`. Args: `pathOrTarball`, optional `tenantUrl` / `token` / `tenantCode` — fall back to `DFORGE_URL` / `DFORGE_TOKEN` env. `tenantCode` is an optional `--code` sanity check the server cross-references against the JWT |
|
|
92
99
|
|
|
93
100
|
**Entities (Phase 1)**
|
|
94
101
|
| Tool | Behavior |
|
|
95
102
|
|---|---|
|
|
96
|
-
| `dforge_entity_add` | Add an entity to an existing module |
|
|
103
|
+
| `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 |
|
|
104
|
+
| `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 |
|
|
105
|
+
| `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
106
|
| `dforge_entity_field_add` | Patch a single field |
|
|
98
|
-
| `dforge_entity_field_modify` | Replace a field's spec |
|
|
99
|
-
| `
|
|
107
|
+
| `dforge_entity_field_modify` | Replace a field's spec (same name) |
|
|
108
|
+
| `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 |
|
|
109
|
+
| `dforge_entity_field_remove` | **Refactor-safe remove** — cascade-cleans paired Reference, view columns + order, seed keys; warns on formula/cross-entity dependents |
|
|
110
|
+
|
|
111
|
+
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
112
|
|
|
101
113
|
**Behavior (Phase 2 — optional)**
|
|
102
114
|
| Tool | Behavior |
|
|
103
115
|
|---|---|
|
|
104
116
|
| `dforge_action_add` | DSL script + `ui/actions.json` entry |
|
|
117
|
+
| `dforge_trigger_add` | DB-event trigger in `logic/triggers.json` (entity event + optional condition → action) |
|
|
118
|
+
| `dforge_job_add` | Scheduled job in `logic/jobs.json` (5-field cron + timeout + action) |
|
|
119
|
+
| `dforge_webhook_add` | Outbound webhook in `logic/webhooks.json` (entity event → POST to endpoint) |
|
|
105
120
|
|
|
106
121
|
**Views + reports (Phase 3)**
|
|
107
122
|
| Tool | Behavior |
|
|
@@ -122,7 +137,7 @@ Grouped by typical phase in the wizard flow. All "return" tools emit `{ summary,
|
|
|
122
137
|
| Tool | Behavior |
|
|
123
138
|
|---|---|
|
|
124
139
|
| `dforge_dependency_add` | Add a dep on another dForge module |
|
|
125
|
-
| `dforge_dbml_import` |
|
|
140
|
+
| `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
141
|
|
|
127
142
|
### Resources (13)
|
|
128
143
|
|
|
@@ -152,27 +167,60 @@ https://cdn.jsdelivr.net/npm/@dforge-core/dforge-mcp@latest/resources/schemas/<n
|
|
|
152
167
|
|
|
153
168
|
## Claude Skill — the wizard
|
|
154
169
|
|
|
155
|
-
`skills/dforge-mcp-author
|
|
170
|
+
The skill bundle lives at `skills/dforge-mcp-author/` and contains:
|
|
156
171
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
172
|
+
| Path | Contents |
|
|
173
|
+
|---|---|
|
|
174
|
+
| `SKILL.md` | Six-phase co-pilot wizard |
|
|
175
|
+
| `references/*.md` | 23 detailed reference files (field types, flags, traits, formulas, DSL, security, views, menus, translations, …) |
|
|
176
|
+
| `examples/simple-todo/` | Annotated reference module showing all core patterns |
|
|
177
|
+
|
|
178
|
+
**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
179
|
|
|
163
|
-
|
|
180
|
+
```bash
|
|
181
|
+
# Resolve the actual latest published version from the npm registry,
|
|
182
|
+
# then pin the jsdelivr URL to it. We don't use jsdelivr's `@latest`
|
|
183
|
+
# alias directly — that CDN endpoint caches aggressively (6-12h lag
|
|
184
|
+
# after a new publish), which silently serves stale Skill content.
|
|
185
|
+
VERSION=$(npm view @dforge-core/dforge-mcp version)
|
|
186
|
+
BASE="https://cdn.jsdelivr.net/npm/@dforge-core/dforge-mcp@${VERSION}/skills/dforge-mcp-author"
|
|
187
|
+
|
|
188
|
+
# Wizard
|
|
164
189
|
mkdir -p ~/.claude/skills/dforge-mcp-author
|
|
165
|
-
curl -fsSL
|
|
166
|
-
|
|
190
|
+
curl -fsSL "$BASE/SKILL.md" -o ~/.claude/skills/dforge-mcp-author/SKILL.md
|
|
191
|
+
|
|
192
|
+
# Reference files (23 guides — load on demand per the table in SKILL.md)
|
|
193
|
+
mkdir -p ~/.claude/skills/dforge-mcp-author/references
|
|
194
|
+
for f in action-dsl column-types conventions data-migration data-views \
|
|
195
|
+
field-types filters flags formulas jobs manifest menus \
|
|
196
|
+
number-sequences print-templates queries reports schema-import \
|
|
197
|
+
security settings traits translations validation-checklist; do
|
|
198
|
+
curl -fsSL "$BASE/references/${f}.md" \
|
|
199
|
+
-o ~/.claude/skills/dforge-mcp-author/references/${f}.md
|
|
200
|
+
done
|
|
201
|
+
|
|
202
|
+
# simple-todo example
|
|
203
|
+
mkdir -p ~/.claude/skills/dforge-mcp-author/examples/simple-todo/{entities,logic/actions,ui,security,seed-data}
|
|
204
|
+
for f in README.md manifest.json; do
|
|
205
|
+
curl -fsSL "$BASE/examples/simple-todo/$f" \
|
|
206
|
+
-o ~/.claude/skills/dforge-mcp-author/examples/simple-todo/$f
|
|
207
|
+
done
|
|
208
|
+
# … entity, ui, security, seed-data files follow the same pattern
|
|
209
|
+
|
|
210
|
+
# Or, straight from GitHub main (always fresh, but pre-release content):
|
|
211
|
+
# curl -fsSL https://raw.githubusercontent.com/dforge-core/dforge-mcp/main/skills/dforge-mcp-author/SKILL.md \
|
|
212
|
+
# -o ~/.claude/skills/dforge-mcp-author/SKILL.md
|
|
167
213
|
```
|
|
168
214
|
|
|
169
|
-
|
|
215
|
+
> **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.
|
|
216
|
+
|
|
217
|
+
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
218
|
|
|
171
219
|
The phases:
|
|
172
220
|
|
|
173
221
|
| Phase | Required? | Tools used |
|
|
174
222
|
|---|---|---|
|
|
175
|
-
| 0.
|
|
223
|
+
| 0. Identity / requirements / design / validation | yes | (docs authored directly) |
|
|
176
224
|
| 1. Domain | yes | `module_create`, `entity_add`, `entity_field_*` |
|
|
177
225
|
| 2. Actions | optional | `action_add` |
|
|
178
226
|
| 3. Views + Reports | views yes, reports optional | `view_*`, `report_add`, `setting_add` |
|
|
@@ -188,29 +236,37 @@ Key principles encoded in the Skill: inspect-before-patch, one-at-a-time, determ
|
|
|
188
236
|
|
|
189
237
|
```bash
|
|
190
238
|
pnpm install
|
|
191
|
-
pnpm build # tsup → dist/server.js (bundles SDK + zod + dforge-cli/templates)
|
|
239
|
+
pnpm build # tsup → dist/server.js (bundles SDK + zod + dforge-cli/templates + metadata)
|
|
192
240
|
pnpm typecheck # tsc --noEmit
|
|
241
|
+
pnpm test # vitest — validation + dbDatatype derivation + trait flow
|
|
193
242
|
node dist/server.js # stdio JSON-RPC — pipe a request to smoke-test
|
|
194
243
|
```
|
|
195
244
|
|
|
196
245
|
To iterate against an in-tree `dforge-cli`, temporarily pin the dep at the sibling path:
|
|
197
246
|
|
|
198
247
|
```bash
|
|
199
|
-
sed -i '' 's|"@dforge-core/dforge-cli": "\^0.
|
|
248
|
+
sed -i '' 's|"@dforge-core/dforge-cli": "\^0.2.[0-9.]*"|"@dforge-core/dforge-cli": "file:../dforge-cli"|' package.json
|
|
200
249
|
rm -rf node_modules pnpm-lock.yaml && pnpm install
|
|
201
250
|
# Flip back before publish — file: deps don't resolve for npm consumers.
|
|
202
251
|
```
|
|
203
252
|
|
|
204
253
|
### Refresh vendored resources
|
|
205
254
|
|
|
206
|
-
|
|
255
|
+
**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.
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
pnpm sync-schemas # node script — cross-platform (Windows/macOS/Linux)
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
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.
|
|
262
|
+
|
|
263
|
+
`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
264
|
|
|
208
265
|
```bash
|
|
209
|
-
scripts/vendor-resources.sh
|
|
210
|
-
DFORGE_CORE=/abs/path/to/dForge-core scripts/vendor-resources.sh
|
|
266
|
+
VENDOR_REFS=1 scripts/vendor-resources.sh # also pull conventions + skill refs from ../dForge-core
|
|
211
267
|
```
|
|
212
268
|
|
|
213
|
-
|
|
269
|
+
**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
270
|
|
|
215
271
|
### Publishing
|
|
216
272
|
|
|
@@ -223,7 +279,8 @@ scripts/publish.sh 0.1.0-rc.N --tag latest --otp <code>
|
|
|
223
279
|
**Pre-publish checklist:**
|
|
224
280
|
- [ ] `@dforge-core/dforge-cli` dep is a real version (not `file:...`)
|
|
225
281
|
- [ ] `pnpm typecheck` passes
|
|
226
|
-
- [ ]
|
|
282
|
+
- [ ] `pnpm test` passes
|
|
283
|
+
- [ ] Smoke test stdio: `tools/list` returns 27 tools
|
|
227
284
|
- [ ] Skill updated for any new/changed tools (it's a SEPARATE artifact; users sync it manually after upgrades)
|
|
228
285
|
|
|
229
286
|
### Adding a new tool
|