@dforge-core/dforge-cli 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.
package/README.md CHANGED
@@ -91,6 +91,42 @@ dforge-cli module install --path . --code <tenant> # full validation + install
91
91
 
92
92
  The first install runs the full server-side validator (manifest, FK targets, package-filter SQL, migration safety) — fix anything it flags, then re-run.
93
93
 
94
+ ### Programmatic use (subpath export)
95
+
96
+ The pure-TS builders behind `init module` are also exposed as a library entry, so downstream packages can compose module file maps without shelling to the CLI. Used by [`@dforge-core/dforge-mcp`](https://www.npmjs.com/package/@dforge-core/dforge-mcp) to drive AI-authored modules.
97
+
98
+ ```ts
99
+ import {
100
+ buildManifest,
101
+ buildEntity,
102
+ buildDataViews,
103
+ buildFolders,
104
+ buildMenus,
105
+ buildRoles,
106
+ } from "@dforge-core/dforge-cli/templates";
107
+ import type { ScaffoldOpts, EntitySpec } from "@dforge-core/dforge-cli/templates";
108
+ import { randomUUID } from "node:crypto";
109
+
110
+ const opts: ScaffoldOpts = {
111
+ path: "",
112
+ code: "smoke",
113
+ displayName: "Smoke",
114
+ description: "",
115
+ author: "",
116
+ license: "MIT",
117
+ version: "0.1.0",
118
+ dbSchemaVersion: "0.0.1",
119
+ dependencies: ["admin", "metadata"],
120
+ preset: "minimal",
121
+ entities: [{ name: "thing", label: "Thing", traits: "identity+audit" }],
122
+ };
123
+
124
+ const manifest = buildManifest(opts, randomUUID());
125
+ // → plain JS object, ready for JSON.stringify
126
+ ```
127
+
128
+ All builders are pure functions returning plain JS objects (no I/O). The subpath ships dual CJS + ESM + `.d.ts` types.
129
+
94
130
  ## Auth
95
131
 
96
132
  The remote `module install --url` and `marketplace publish` flows need a JWT
package/dist/cli.js CHANGED
@@ -1009,9 +1009,41 @@ function buildGitignore() {
1009
1009
  ""
1010
1010
  ].join("\n");
1011
1011
  }
1012
+ function buildVscodeSettings() {
1013
+ return {
1014
+ "json.schemas": SCHEMA_BINDINGS.map((b3) => ({
1015
+ fileMatch: b3.fileMatch,
1016
+ url: `${SCHEMA_BASE}/${b3.schema}.schema.json`
1017
+ }))
1018
+ };
1019
+ }
1020
+ function buildZedSettings() {
1021
+ return {
1022
+ languages: {
1023
+ JSON: {
1024
+ "json.schemas": SCHEMA_BINDINGS.map((b3) => ({
1025
+ fileMatch: b3.fileMatch,
1026
+ url: `${SCHEMA_BASE}/${b3.schema}.schema.json`
1027
+ }))
1028
+ }
1029
+ }
1030
+ };
1031
+ }
1032
+ var SCHEMA_BASE, SCHEMA_BINDINGS;
1012
1033
  var init_templates = __esm({
1013
1034
  "src/init/templates.ts"() {
1014
1035
  "use strict";
1036
+ SCHEMA_BASE = "https://cdn.jsdelivr.net/npm/@dforge-core/dforge-mcp@latest/resources/schemas";
1037
+ SCHEMA_BINDINGS = [
1038
+ { fileMatch: ["manifest.json"], schema: "manifest" },
1039
+ { fileMatch: ["entities/*.json"], schema: "entity" },
1040
+ { fileMatch: ["ui/data_views.json"], schema: "data-views" },
1041
+ { fileMatch: ["ui/folders.json"], schema: "folders" },
1042
+ { fileMatch: ["ui/menus.json"], schema: "menus" },
1043
+ { fileMatch: ["security/roles.json"], schema: "roles" },
1044
+ { fileMatch: ["logic/jobs.json"], schema: "jobs" },
1045
+ { fileMatch: ["seed-data/*.json"], schema: "seed-data" }
1046
+ ];
1015
1047
  }
1016
1048
  });
1017
1049
 
@@ -1208,6 +1240,8 @@ function writeAll(opts) {
1208
1240
  writeJson(path2.join(root, "ui", "actions.json"), buildActions());
1209
1241
  writeJson(path2.join(root, "security", "roles.json"), buildRoles(opts));
1210
1242
  writeText(path2.join(root, ".gitignore"), buildGitignore());
1243
+ writeJson(path2.join(root, ".vscode", "settings.json"), buildVscodeSettings());
1244
+ writeJson(path2.join(root, ".zed", "settings.json"), buildZedSettings());
1211
1245
  if (opts.preset === "full") {
1212
1246
  writeJson(path2.join(root, "settings.json"), buildSettings());
1213
1247
  writeJson(path2.join(root, "translations", "en-US.json"), buildTranslations(opts));
package/dist/lib.d.mts CHANGED
@@ -62,5 +62,7 @@ declare function buildSettings(): Record<string, unknown>;
62
62
  declare function buildTranslations(opts: ScaffoldOpts): Record<string, string>;
63
63
  declare function buildSeedData(): unknown[];
64
64
  declare function buildGitignore(): string;
65
+ declare function buildVscodeSettings(): Record<string, unknown>;
66
+ declare function buildZedSettings(): Record<string, unknown>;
65
67
 
66
- export { type DataView, type Entity, type EntitySpec, type Manifest, type Preset, type ScaffoldOpts, type Traits, buildActions, buildDataViews, buildEntity, buildFolders, buildGitignore, buildManifest, buildMenus, buildRoles, buildSeedData, buildSettings, buildTranslations };
68
+ export { type DataView, type Entity, type EntitySpec, type Manifest, type Preset, type ScaffoldOpts, type Traits, buildActions, buildDataViews, buildEntity, buildFolders, buildGitignore, buildManifest, buildMenus, buildRoles, buildSeedData, buildSettings, buildTranslations, buildVscodeSettings, buildZedSettings };
package/dist/lib.d.ts CHANGED
@@ -62,5 +62,7 @@ declare function buildSettings(): Record<string, unknown>;
62
62
  declare function buildTranslations(opts: ScaffoldOpts): Record<string, string>;
63
63
  declare function buildSeedData(): unknown[];
64
64
  declare function buildGitignore(): string;
65
+ declare function buildVscodeSettings(): Record<string, unknown>;
66
+ declare function buildZedSettings(): Record<string, unknown>;
65
67
 
66
- export { type DataView, type Entity, type EntitySpec, type Manifest, type Preset, type ScaffoldOpts, type Traits, buildActions, buildDataViews, buildEntity, buildFolders, buildGitignore, buildManifest, buildMenus, buildRoles, buildSeedData, buildSettings, buildTranslations };
68
+ export { type DataView, type Entity, type EntitySpec, type Manifest, type Preset, type ScaffoldOpts, type Traits, buildActions, buildDataViews, buildEntity, buildFolders, buildGitignore, buildManifest, buildMenus, buildRoles, buildSeedData, buildSettings, buildTranslations, buildVscodeSettings, buildZedSettings };
package/dist/lib.js CHANGED
@@ -30,7 +30,9 @@ __export(lib_exports, {
30
30
  buildRoles: () => buildRoles,
31
31
  buildSeedData: () => buildSeedData,
32
32
  buildSettings: () => buildSettings,
33
- buildTranslations: () => buildTranslations
33
+ buildTranslations: () => buildTranslations,
34
+ buildVscodeSettings: () => buildVscodeSettings,
35
+ buildZedSettings: () => buildZedSettings
34
36
  });
35
37
  module.exports = __toCommonJS(lib_exports);
36
38
 
@@ -162,6 +164,37 @@ function buildGitignore() {
162
164
  ""
163
165
  ].join("\n");
164
166
  }
167
+ var SCHEMA_BASE = "https://cdn.jsdelivr.net/npm/@dforge-core/dforge-mcp@latest/resources/schemas";
168
+ var SCHEMA_BINDINGS = [
169
+ { fileMatch: ["manifest.json"], schema: "manifest" },
170
+ { fileMatch: ["entities/*.json"], schema: "entity" },
171
+ { fileMatch: ["ui/data_views.json"], schema: "data-views" },
172
+ { fileMatch: ["ui/folders.json"], schema: "folders" },
173
+ { fileMatch: ["ui/menus.json"], schema: "menus" },
174
+ { fileMatch: ["security/roles.json"], schema: "roles" },
175
+ { fileMatch: ["logic/jobs.json"], schema: "jobs" },
176
+ { fileMatch: ["seed-data/*.json"], schema: "seed-data" }
177
+ ];
178
+ function buildVscodeSettings() {
179
+ return {
180
+ "json.schemas": SCHEMA_BINDINGS.map((b) => ({
181
+ fileMatch: b.fileMatch,
182
+ url: `${SCHEMA_BASE}/${b.schema}.schema.json`
183
+ }))
184
+ };
185
+ }
186
+ function buildZedSettings() {
187
+ return {
188
+ languages: {
189
+ JSON: {
190
+ "json.schemas": SCHEMA_BINDINGS.map((b) => ({
191
+ fileMatch: b.fileMatch,
192
+ url: `${SCHEMA_BASE}/${b.schema}.schema.json`
193
+ }))
194
+ }
195
+ }
196
+ };
197
+ }
165
198
  // Annotate the CommonJS export names for ESM import in node:
166
199
  0 && (module.exports = {
167
200
  buildActions,
@@ -174,5 +207,7 @@ function buildGitignore() {
174
207
  buildRoles,
175
208
  buildSeedData,
176
209
  buildSettings,
177
- buildTranslations
210
+ buildTranslations,
211
+ buildVscodeSettings,
212
+ buildZedSettings
178
213
  });
package/dist/lib.mjs CHANGED
@@ -126,6 +126,37 @@ function buildGitignore() {
126
126
  ""
127
127
  ].join("\n");
128
128
  }
129
+ var SCHEMA_BASE = "https://cdn.jsdelivr.net/npm/@dforge-core/dforge-mcp@latest/resources/schemas";
130
+ var SCHEMA_BINDINGS = [
131
+ { fileMatch: ["manifest.json"], schema: "manifest" },
132
+ { fileMatch: ["entities/*.json"], schema: "entity" },
133
+ { fileMatch: ["ui/data_views.json"], schema: "data-views" },
134
+ { fileMatch: ["ui/folders.json"], schema: "folders" },
135
+ { fileMatch: ["ui/menus.json"], schema: "menus" },
136
+ { fileMatch: ["security/roles.json"], schema: "roles" },
137
+ { fileMatch: ["logic/jobs.json"], schema: "jobs" },
138
+ { fileMatch: ["seed-data/*.json"], schema: "seed-data" }
139
+ ];
140
+ function buildVscodeSettings() {
141
+ return {
142
+ "json.schemas": SCHEMA_BINDINGS.map((b) => ({
143
+ fileMatch: b.fileMatch,
144
+ url: `${SCHEMA_BASE}/${b.schema}.schema.json`
145
+ }))
146
+ };
147
+ }
148
+ function buildZedSettings() {
149
+ return {
150
+ languages: {
151
+ JSON: {
152
+ "json.schemas": SCHEMA_BINDINGS.map((b) => ({
153
+ fileMatch: b.fileMatch,
154
+ url: `${SCHEMA_BASE}/${b.schema}.schema.json`
155
+ }))
156
+ }
157
+ }
158
+ };
159
+ }
129
160
  export {
130
161
  buildActions,
131
162
  buildDataViews,
@@ -137,5 +168,7 @@ export {
137
168
  buildRoles,
138
169
  buildSeedData,
139
170
  buildSettings,
140
- buildTranslations
171
+ buildTranslations,
172
+ buildVscodeSettings,
173
+ buildZedSettings
141
174
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dforge-core/dforge-cli",
3
- "version": "0.1.0-rc.5",
3
+ "version": "0.1.0-rc.7",
4
4
  "description": "dForge CLI - validate, pack, publish, and install dForge modules. Distributes a single-file native binary per platform via optionalDependencies (esbuild-style).",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/iash44/dForge-core",