@tailor-platform/erp-kit 0.2.2 → 0.3.0

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 (45) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +158 -62
  3. package/dist/cli.mjs +344 -215
  4. package/package.json +3 -2
  5. package/skills/erp-kit-app-1-requirements/SKILL.md +19 -8
  6. package/skills/erp-kit-app-2-requirements-review/SKILL.md +5 -4
  7. package/skills/erp-kit-app-2-requirements-review/references/best-practices-check.md +6 -1
  8. package/skills/erp-kit-app-2-requirements-review/references/boundary-consistency-check.md +6 -1
  9. package/skills/erp-kit-app-3-plan/SKILL.md +4 -7
  10. package/skills/erp-kit-app-3-plan/references/resolver-extraction.md +1 -19
  11. package/skills/erp-kit-app-4-plan-review/SKILL.md +1 -10
  12. package/skills/erp-kit-app-5-impl-backend/SKILL.md +1 -8
  13. package/skills/erp-kit-app-shared/SKILL.md +15 -0
  14. package/skills/erp-kit-app-shared/references/link-format-reference.md +13 -0
  15. package/skills/erp-kit-app-shared/references/naming-conventions.md +21 -0
  16. package/skills/erp-kit-app-shared/references/resolver-classification.md +23 -0
  17. package/skills/erp-kit-app-shared/references/schema-constraints.md +25 -0
  18. package/skills/erp-kit-module-1-requirements/SKILL.md +1 -1
  19. package/skills/erp-kit-module-1-requirements/references/feature-doc.md +1 -1
  20. package/skills/erp-kit-module-3-plan/SKILL.md +5 -5
  21. package/skills/erp-kit-module-3-plan/references/naming.md +15 -1
  22. package/skills/erp-kit-module-5-impl/SKILL.md +12 -10
  23. package/skills/erp-kit-module-5-impl/references/generated-code.md +2 -2
  24. package/skills/erp-kit-module-6-impl-review/SKILL.md +1 -1
  25. package/skills/erp-kit-module-6-impl-review/references/error-implementation-parity.md +1 -1
  26. package/skills/erp-kit-module-6-impl-review/references/errors.md +1 -1
  27. package/skills/erp-kit-module-shared/references/errors.md +1 -1
  28. package/skills/erp-kit-module-shared/references/queries.md +1 -1
  29. package/skills/erp-kit-module-shared/references/structure.md +1 -1
  30. package/skills/erp-kit-update/SKILL.md +2 -2
  31. package/src/commands/app/index.ts +57 -24
  32. package/src/commands/generate-doc.test.ts +63 -0
  33. package/src/commands/generate-doc.ts +98 -0
  34. package/src/commands/init-module.test.ts +43 -0
  35. package/src/commands/init-module.ts +74 -0
  36. package/src/commands/module/generate.ts +33 -13
  37. package/src/commands/module/index.ts +18 -28
  38. package/src/{commands/scaffold.test.ts → generator/generate-code-boilerplate.test.ts} +19 -89
  39. package/src/generator/generate-code.test.ts +24 -0
  40. package/src/generator/generate-code.ts +101 -4
  41. package/src/integration.test.ts +2 -2
  42. package/templates/scaffold/app/backend/package.json +4 -4
  43. package/templates/scaffold/app/frontend/package.json +10 -10
  44. package/templates/workflows/erp-kit-check.yml +2 -2
  45. package/src/commands/scaffold.ts +0 -176
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @tailor-platform/erp-kit
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a8462ee: Reorganize scaffold into init/generate and update README
8
+
9
+ - Refactor: replace `module scaffold` and `app scaffold` with `init` + `generate doc` / `generate code` subcommands
10
+ - Feat: add `erp-kit-app-shared` skill consolidating duplicated references across app skills
11
+ - Feat: add db stub generation and `reset:module` script
12
+ - Refactor: run generate before impl agents in `erp-kit-module-5-impl`
13
+ - Docs: rewrite README to align with current CLI commands, flags, skills (17), and testing exports
14
+
3
15
  ## 0.2.2
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @tailor-platform/erp-kit
2
2
 
3
- CLI tool for validating, scaffolding, syncing module documentation, and managing mock API servers.
3
+ CLI tool for validating, generating, syncing module documentation, and managing mock API servers.
4
4
 
5
5
  ## Install
6
6
 
@@ -11,23 +11,29 @@ npm install @tailor-platform/erp-kit
11
11
  ## Quick Start
12
12
 
13
13
  ```bash
14
- # Set up your repo (agent skills)
14
+ # Set up your repo (agent skills, workflows, configs)
15
15
  erp-kit init
16
16
 
17
+ # Update framework resources
18
+ erp-kit update
19
+
17
20
  # List available modules
18
21
  erp-kit module list
19
22
 
20
23
  # Validate module docs against schemas
21
- erp-kit module check --root src/modules
24
+ erp-kit module check --path src/modules
22
25
 
23
26
  # Check source ↔ doc correspondence
24
- erp-kit module sync-check --root src/modules
27
+ erp-kit module sync-check --path src/modules
28
+
29
+ # Bootstrap a new module
30
+ erp-kit module init inventory src/modules
25
31
 
26
32
  # Generate a new module doc from template
27
- erp-kit module scaffold command inventory createOrder --root src/modules
33
+ erp-kit module generate doc --path src/modules/inventory command createOrder
28
34
 
29
35
  # Validate app docs
30
- erp-kit app check --root examples
36
+ erp-kit app check --path examples
31
37
 
32
38
  # Check dependency licenses
33
39
  erp-kit license check --config license.config.json
@@ -44,6 +50,38 @@ erp-kit mock validate
44
50
 
45
51
  ## Commands
46
52
 
53
+ ### `init`
54
+
55
+ First-time setup for consumer repos. Fails if already initialized — use `erp-kit update` to refresh resources.
56
+
57
+ ```bash
58
+ erp-kit init
59
+ ```
60
+
61
+ This will:
62
+
63
+ 1. Copy agent skills to `.agents/skills/`
64
+ 2. Create symlink `.claude/skills` → `.agents/skills/`
65
+ 3. Copy workflows to `.github/workflows/`
66
+ 4. Copy config files
67
+
68
+ ### `update`
69
+
70
+ Refresh framework resources. Removes stale skills and copies latest versions.
71
+
72
+ ```bash
73
+ # Update everything (skills + workflows)
74
+ erp-kit update
75
+
76
+ # Update specific resources
77
+ erp-kit update skills
78
+ erp-kit update workflows
79
+ ```
80
+
81
+ **Arguments:**
82
+
83
+ - `[resources...]` — (optional) Resources to update (`skills`, `workflows`). Defaults to all.
84
+
47
85
  ### `module`
48
86
 
49
87
  Module documentation management.
@@ -61,7 +99,7 @@ erp-kit module list
61
99
  Validates module markdown documentation against YAML schemas.
62
100
 
63
101
  ```bash
64
- erp-kit module check --root src/modules
102
+ erp-kit module check --path src/modules
65
103
  ```
66
104
 
67
105
  #### `module sync-check`
@@ -69,18 +107,45 @@ erp-kit module check --root src/modules
69
107
  Ensures every source file has a corresponding doc and vice versa.
70
108
 
71
109
  ```bash
72
- erp-kit module sync-check --root src/modules
110
+ erp-kit module sync-check --path src/modules
111
+ ```
112
+
113
+ #### `module init`
114
+
115
+ Bootstraps a new module with directory structure and README.
116
+
117
+ ```bash
118
+ erp-kit module init inventory src/modules
73
119
  ```
74
120
 
75
- #### `module scaffold`
121
+ **Arguments:**
122
+
123
+ - `<name>` — Module name
124
+ - `<dir>` — Parent directory where the module will be created
125
+
126
+ #### `module generate doc`
76
127
 
77
- Generates documentation files from schema templates.
128
+ Creates a documentation file from a schema template.
78
129
 
79
130
  ```bash
80
- erp-kit module scaffold module inventory --root src/modules
81
- erp-kit module scaffold feature inventory stock-tracking --root src/modules
82
- erp-kit module scaffold command inventory createOrder --root src/modules
83
- erp-kit module scaffold model inventory StockItem --root src/modules
131
+ erp-kit module generate doc --path src/modules/inventory feature stock-tracking
132
+ erp-kit module generate doc --path src/modules/inventory command createOrder
133
+ erp-kit module generate doc --path src/modules/inventory model StockItem
134
+ erp-kit module generate doc --path src/modules/inventory query getStockLevel
135
+ ```
136
+
137
+ **Arguments:**
138
+
139
+ - `--path, -p <path>` — Path to the module directory (required)
140
+ - `<type>` — Doc type (`feature`, `command`, `model`, `query`)
141
+ - `<name>` — Item name
142
+
143
+ #### `module generate code`
144
+
145
+ Generates boilerplate, implementation stubs, and generated code from docs.
146
+
147
+ ```bash
148
+ erp-kit module generate code --path src/modules/inventory
84
149
  ```
85
150
 
86
151
  ### `app`
@@ -92,7 +157,7 @@ App-compose documentation management.
92
157
  Validates app documentation against YAML schemas.
93
158
 
94
159
  ```bash
95
- erp-kit app check --root examples
160
+ erp-kit app check --path examples
96
161
  ```
97
162
 
98
163
  #### `app sync-check`
@@ -100,20 +165,46 @@ erp-kit app check --root examples
100
165
  Ensures every source file has a corresponding doc and vice versa.
101
166
 
102
167
  ```bash
103
- erp-kit app sync-check --root examples
168
+ erp-kit app sync-check --path examples
169
+ ```
170
+
171
+ #### `app init`
172
+
173
+ Bootstraps a new app with directory structure and README.
174
+
175
+ ```bash
176
+ erp-kit app init my-app examples
177
+ ```
178
+
179
+ **Arguments:**
180
+
181
+ - `<name>` — App name
182
+ - `<dir>` — Parent directory where the app will be created
183
+
184
+ #### `app generate doc`
185
+
186
+ Creates a documentation file from a schema template.
187
+
188
+ ```bash
189
+ erp-kit app generate doc --path examples/my-app actors admin
190
+ erp-kit app generate doc --path examples/my-app business-flow onboarding
191
+ erp-kit app generate doc --path examples/my-app story onboarding/admin--create-user
192
+ erp-kit app generate doc --path examples/my-app screen supplier-list
193
+ erp-kit app generate doc --path examples/my-app resolver create-supplier
104
194
  ```
105
195
 
106
- #### `app scaffold`
196
+ **Arguments:**
197
+
198
+ - `--path, -p <path>` — Path to the app-compose directory (required)
199
+ - `<type>` — Doc type (`actors`, `business-flow`, `story`, `screen`, `resolver`)
200
+ - `<name>` — Item name (for `story`, use `<flow>/<story>` format)
201
+
202
+ #### `app generate code`
107
203
 
108
- Generates documentation files from schema templates.
204
+ Generates boilerplate source files from docs.
109
205
 
110
206
  ```bash
111
- erp-kit app scaffold app my-app --root examples
112
- erp-kit app scaffold actors my-app admin --root examples
113
- erp-kit app scaffold business-flow my-app onboarding --root examples
114
- erp-kit app scaffold story my-app onboarding/admin--create-user --root examples
115
- erp-kit app scaffold screen my-app supplier-list --root examples
116
- erp-kit app scaffold resolver my-app create-supplier --root examples
207
+ erp-kit app generate code --path examples/my-app
117
208
  ```
118
209
 
119
210
  ### `mock start`
@@ -198,42 +289,25 @@ erp-kit license check --config license.config.json
198
289
  | `allow` | Additional individual licenses to allow |
199
290
  | `deny` | Licenses to exclude (applied after groups + allow) |
200
291
 
201
- ### `init`
202
-
203
- One-time setup for consumer repos. Idempotent — skips files that already exist.
204
-
205
- ```bash
206
- erp-kit init
207
-
208
- # Overwrite existing skills
209
- erp-kit init --force
210
- ```
211
-
212
- This will:
213
-
214
- 1. Copy 12 agent skills to `.agents/skills/`
215
- 2. Create symlink `.claude/skills` → `.agents/skills/`
216
-
217
292
  ## Options
218
293
 
219
- | Flag | Alias | Applies to | Description |
220
- | --------------------- | ----- | ------------------------------------------- | -------------------------------------------- |
221
- | `--root <path>` | `-r` | `module check/sync-check/scaffold`, `app *` | Path to modules or app-compose directory |
222
- | `--mocks-root <path>` | | `mock start`, `mock validate` | Path to mocks directory (default: `./mocks`) |
223
- | `--port <number>` | `-p` | `mock start` | Reverse proxy port (default: `3000`) |
224
- | `--config <path>` | `-c` | `license` | Path to license config JSON file |
225
- | `--force` | `-f` | `init` | Overwrite existing files (default: `false`) |
294
+ | Flag | Alias | Applies to | Description |
295
+ | --------------------- | ----- | -------------------------------------------------- | -------------------------------------------- |
296
+ | `--path <path>` | `-p` | `module check/sync-check/generate`, `app *` | Path to modules or app-compose directory |
297
+ | `--mocks-root <path>` | | `mock start`, `mock validate` | Path to mocks directory (default: `./mocks`) |
298
+ | `--port <number>` | `-p` | `mock start` | Reverse proxy port (default: `3000`) |
299
+ | `--config <path>` | `-c` | `license` | Path to license config JSON file |
226
300
 
227
301
  ## What's Bundled
228
302
 
229
303
  | Directory | Contents |
230
304
  | ---------- | -------------------------------------------------------------- |
231
305
  | `schemas/` | YAML schema definitions for all doc types |
232
- | `skills/` | 12 agent skills for documentation, implementation, and mocking |
306
+ | `skills/` | 17 agent skills for documentation, implementation, and mocking |
233
307
 
234
308
  ### Schemas
235
309
 
236
- **Module:** `module`, `feature`, `command`, `model`
310
+ **Module:** `module`, `feature`, `command`, `model`, `query`
237
311
 
238
312
  **App-compose:** `requirements`, `actors`, `business-flow`, `story`, `screen`, `resolver`
239
313
 
@@ -241,27 +315,33 @@ This will:
241
315
 
242
316
  Module workflow:
243
317
 
244
- 1. `erp-kit-module-1-docs` — Create module documentation
245
- 2. `erp-kit-module-2-feature-breakdown` — Break features into models and commands
246
- 3. `erp-kit-module-3-doc-review` — Review feature-to-doc parity
247
- 4. `erp-kit-module-4-tdd` — TDD implementation from docs
248
- 5. `erp-kit-module-5-impl-review` — Review implementation-to-doc parity
318
+ 1. `erp-kit-module-1-requirements` — Create module requirements and feature documentation
319
+ 2. `erp-kit-module-2-requirements-review` — Review requirements quality and module boundaries
320
+ 3. `erp-kit-module-3-plan` — Break down features into model, command, and query docs
321
+ 4. `erp-kit-module-4-plan-review` — Review feature-to-doc parity
322
+ 5. `erp-kit-module-5-impl` — TDD implementation from docs
323
+ 6. `erp-kit-module-6-impl-review` — Review implementation-to-doc parity
249
324
 
250
325
  App-compose workflow:
251
326
 
252
327
  1. `erp-kit-app-1-requirements` — Tier 1-2: requirements, actors, business flows
253
- 2. `erp-kit-app-2-breakdown` — Tier 3: stories and screens
254
- 3. `erp-kit-app-3-doc-review` — Review doc parity
255
- 4. `erp-kit-app-4-impl-spec` — Tier 4: resolver specs
256
- 5. `erp-kit-app-5-implementation` — Implement backend and frontend
328
+ 2. `erp-kit-app-2-requirements-review` — Review requirements quality and consistency
329
+ 3. `erp-kit-app-3-plan` — Tier 3-4: stories, screens, resolvers
330
+ 4. `erp-kit-app-4-plan-review` — Review plan-to-requirements parity
331
+ 5. `erp-kit-app-5-impl-backend` — Implement backend resolvers and module wiring
332
+ 6. `erp-kit-app-6-impl-frontend` — Implement frontend pages and components
333
+ 7. `erp-kit-app-7-impl-review` — Review implementation-to-doc parity
257
334
 
258
- Mock workflow:
335
+ Shared and utility:
259
336
 
260
- 1. `erp-kit-mock-scenario` — Scaffold a new Mockoon mock scenario with CRUD routes and error scenarios
337
+ - `erp-kit-module-shared` — Shared references for module skills
338
+ - `erp-kit-app-shared` — Shared references for app skills
339
+ - `erp-kit-update` — Route requirements changes to the correct skill
340
+ - `erp-kit-mock-scenario` — Scaffold a new Mockoon mock scenario
261
341
 
262
- ## Programmatic Mock Server
342
+ ## Programmatic Testing Helpers
263
343
 
264
- The `createMockServer` helper starts a Mockoon server from a `mock.json` file, useful for integration tests:
344
+ The `@tailor-platform/erp-kit/testing` export provides helpers for integration tests:
265
345
 
266
346
  ```ts
267
347
  import { createMockServer } from "@tailor-platform/erp-kit/testing";
@@ -277,6 +357,22 @@ const res = await fetch(`${server.url}/admin/api/2024-01/products`);
277
357
  await server.stop();
278
358
  ```
279
359
 
360
+ Additional testing utilities:
361
+
362
+ ```ts
363
+ import {
364
+ createMockDb,
365
+ testNotFound,
366
+ testPermissionDenied,
367
+ testIdempotent,
368
+ } from "@tailor-platform/erp-kit/testing";
369
+ ```
370
+
371
+ - `createMockDb()` — Creates a mock database for unit testing commands and queries
372
+ - `testNotFound()` — Helper to test "not found" error handling
373
+ - `testPermissionDenied()` — Helper to test permission denial behavior
374
+ - `testIdempotent()` — Helper to test idempotent command behavior
375
+
280
376
  ## Development
281
377
 
282
378
  ```bash