@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.
- package/CHANGELOG.md +12 -0
- package/README.md +158 -62
- package/dist/cli.mjs +344 -215
- package/package.json +3 -2
- package/skills/erp-kit-app-1-requirements/SKILL.md +19 -8
- package/skills/erp-kit-app-2-requirements-review/SKILL.md +5 -4
- package/skills/erp-kit-app-2-requirements-review/references/best-practices-check.md +6 -1
- package/skills/erp-kit-app-2-requirements-review/references/boundary-consistency-check.md +6 -1
- package/skills/erp-kit-app-3-plan/SKILL.md +4 -7
- package/skills/erp-kit-app-3-plan/references/resolver-extraction.md +1 -19
- package/skills/erp-kit-app-4-plan-review/SKILL.md +1 -10
- package/skills/erp-kit-app-5-impl-backend/SKILL.md +1 -8
- package/skills/erp-kit-app-shared/SKILL.md +15 -0
- package/skills/erp-kit-app-shared/references/link-format-reference.md +13 -0
- package/skills/erp-kit-app-shared/references/naming-conventions.md +21 -0
- package/skills/erp-kit-app-shared/references/resolver-classification.md +23 -0
- package/skills/erp-kit-app-shared/references/schema-constraints.md +25 -0
- package/skills/erp-kit-module-1-requirements/SKILL.md +1 -1
- package/skills/erp-kit-module-1-requirements/references/feature-doc.md +1 -1
- package/skills/erp-kit-module-3-plan/SKILL.md +5 -5
- package/skills/erp-kit-module-3-plan/references/naming.md +15 -1
- package/skills/erp-kit-module-5-impl/SKILL.md +12 -10
- package/skills/erp-kit-module-5-impl/references/generated-code.md +2 -2
- package/skills/erp-kit-module-6-impl-review/SKILL.md +1 -1
- package/skills/erp-kit-module-6-impl-review/references/error-implementation-parity.md +1 -1
- package/skills/erp-kit-module-6-impl-review/references/errors.md +1 -1
- package/skills/erp-kit-module-shared/references/errors.md +1 -1
- package/skills/erp-kit-module-shared/references/queries.md +1 -1
- package/skills/erp-kit-module-shared/references/structure.md +1 -1
- package/skills/erp-kit-update/SKILL.md +2 -2
- package/src/commands/app/index.ts +57 -24
- package/src/commands/generate-doc.test.ts +63 -0
- package/src/commands/generate-doc.ts +98 -0
- package/src/commands/init-module.test.ts +43 -0
- package/src/commands/init-module.ts +74 -0
- package/src/commands/module/generate.ts +33 -13
- package/src/commands/module/index.ts +18 -28
- package/src/{commands/scaffold.test.ts → generator/generate-code-boilerplate.test.ts} +19 -89
- package/src/generator/generate-code.test.ts +24 -0
- package/src/generator/generate-code.ts +101 -4
- package/src/integration.test.ts +2 -2
- package/templates/scaffold/app/backend/package.json +4 -4
- package/templates/scaffold/app/frontend/package.json +10 -10
- package/templates/workflows/erp-kit-check.yml +2 -2
- package/src/commands/scaffold.ts +0 -176
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/erp-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Opinionated ERP toolkit for building business applications on Tailor Platform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"mock:start": "node dist/cli.mjs mock start",
|
|
69
69
|
"mock:validate": "node dist/cli.mjs mock validate",
|
|
70
70
|
"doc:gen": "POLITTY_DOCS_UPDATE=true vitest run src/cli.doc.test.ts",
|
|
71
|
-
"doc:check": "vitest run src/cli.doc.test.ts"
|
|
71
|
+
"doc:check": "vitest run src/cli.doc.test.ts",
|
|
72
|
+
"reset:module": "tsx scripts/reset-module.ts"
|
|
72
73
|
}
|
|
73
74
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: erp-kit-app-1-requirements
|
|
3
|
-
description: Create Tier 1-2 documentation (requirements, actors, business-flow) for
|
|
3
|
+
description: Create Tier 1-2 documentation (requirements, actors, business-flow) for an application. Use when starting a new application or documenting high-level requirements and workflows.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Application Requirement Analysis Workflow
|
|
@@ -40,23 +40,32 @@ Ask 3-4 questions at a time using multiSelect where appropriate.
|
|
|
40
40
|
|
|
41
41
|
### Phase 3: Create
|
|
42
42
|
|
|
43
|
-
Generate documentation using `erp-kit` CLI:
|
|
43
|
+
Generate documentation using `erp-kit` CLI. `{APP_ROOT}` is the parent directory where the app will live:
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
46
|
# Tier 1: Requirements + project structure
|
|
47
|
-
|
|
47
|
+
# Creates {APP_ROOT}/{APP_NAME}/README.md
|
|
48
|
+
erp-kit app init {APP_NAME} {APP_ROOT}
|
|
48
49
|
|
|
49
50
|
# Tier 2: Actors
|
|
50
|
-
erp-kit app
|
|
51
|
+
erp-kit app generate doc actors {ACTOR_NAME} -p {APP_ROOT}/{APP_NAME}
|
|
51
52
|
|
|
52
53
|
# Tier 2: Business Flows
|
|
53
|
-
erp-kit app
|
|
54
|
+
erp-kit app generate doc business-flow {FLOW_NAME} -p {APP_ROOT}/{APP_NAME}
|
|
54
55
|
```
|
|
55
56
|
|
|
56
|
-
**
|
|
57
|
+
**Directory structure after init + generate:**
|
|
57
58
|
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
```
|
|
60
|
+
{APP_ROOT}/
|
|
61
|
+
{APP_NAME}/
|
|
62
|
+
README.md ← Tier 1 (from app init)
|
|
63
|
+
docs/
|
|
64
|
+
actors/{actor-name}.md ← Tier 2 (from generate doc actors)
|
|
65
|
+
business-flow/{flow-name}/README.md ← Tier 2 (from generate doc business-flow)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Schema constraints:** See [erp-kit-app-shared/references/schema-constraints.md](../erp-kit-app-shared/references/schema-constraints.md) for H1 heading rules, naming conventions, and requirements structure.
|
|
60
69
|
|
|
61
70
|
**Business flow diagram:** Use `sequenceDiagram` with actors from "Actors Involved" as participants. Show who initiates each step and the system responses.
|
|
62
71
|
|
|
@@ -70,6 +79,8 @@ At Tier 2, story files do not exist yet. Use `- TBD` as a placeholder to avoid b
|
|
|
70
79
|
pnpm run app:doc:check
|
|
71
80
|
```
|
|
72
81
|
|
|
82
|
+
See [schema-constraints.md](../erp-kit-app-shared/references/schema-constraints.md) for notes on expected "No matching files found" output.
|
|
83
|
+
|
|
73
84
|
## Schema Reference
|
|
74
85
|
|
|
75
86
|
| Schema | Tier | Output Path |
|
|
@@ -17,7 +17,7 @@ Review **requirements quality** and **documentation consistency** for an app-com
|
|
|
17
17
|
|
|
18
18
|
Define shared context for all agents:
|
|
19
19
|
|
|
20
|
-
- `APP_ROOT`:
|
|
20
|
+
- `APP_ROOT`: the app directory (e.g., `{APP_ROOT}/{APP_NAME}`). Must contain `README.md` and a `docs/` directory.
|
|
21
21
|
- `APP_NAME`: basename of APP_ROOT
|
|
22
22
|
- `APP_README`: `<APP_ROOT>/README.md`
|
|
23
23
|
- `BUSINESS_FLOW_DOCS`: glob `<APP_ROOT>/docs/business-flow/*/README.md`
|
|
@@ -43,15 +43,16 @@ For each agent:
|
|
|
43
43
|
3. Replace `{{APP_README}}`, `{{ACTOR_DOCS}}`, `{{BUSINESS_FLOW_DOCS}}` with the actual file paths
|
|
44
44
|
4. Dispatch the agent with the filled prompt
|
|
45
45
|
|
|
46
|
-
## Step 3: Aggregate
|
|
46
|
+
## Step 3: Aggregate & Validate
|
|
47
47
|
|
|
48
48
|
After ALL agents return:
|
|
49
49
|
|
|
50
50
|
1. Collect the markdown results from each agent
|
|
51
51
|
2. Merge all `issues[]` arrays into a single list
|
|
52
52
|
3. Merge all `recommendations[]` arrays into a single list
|
|
53
|
-
4.
|
|
54
|
-
5.
|
|
53
|
+
4. **Filter out** any recommendation that would violate `erp-kit app check` schema constraints (e.g., title-casing business flow H1 headings)
|
|
54
|
+
5. Calculate totals across all summaries
|
|
55
|
+
6. Render the final report below
|
|
55
56
|
|
|
56
57
|
## Report Format
|
|
57
58
|
|
|
@@ -7,13 +7,18 @@ App README: {{APP_README}}
|
|
|
7
7
|
Actor docs: {{ACTOR_DOCS}}
|
|
8
8
|
Business flow docs: {{BUSINESS_FLOW_DOCS}}
|
|
9
9
|
|
|
10
|
+
## Schema Constraints
|
|
11
|
+
|
|
12
|
+
Read [erp-kit-app-shared/references/schema-constraints.md](../../erp-kit-app-shared/references/schema-constraints.md) before evaluating. **Never recommend changes that violate the schema.**
|
|
13
|
+
|
|
10
14
|
## Instructions
|
|
11
15
|
|
|
12
16
|
1. Read the application README at the path above
|
|
13
17
|
2. Read ALL actor docs and business flow docs at the paths above
|
|
14
18
|
3. **Web search** app-compose and ERP application best practices (actor modeling, business flow design, user journey patterns)
|
|
15
19
|
4. Evaluate whether the Tier 1-2 documentation follows best practices
|
|
16
|
-
5.
|
|
20
|
+
5. **Verify** that none of your recommendations would violate the schema constraints above
|
|
21
|
+
6. Return results as markdown per the Output Format section
|
|
17
22
|
|
|
18
23
|
## Application Design Checks
|
|
19
24
|
|
|
@@ -7,12 +7,17 @@ App README: {{APP_README}}
|
|
|
7
7
|
Actor docs: {{ACTOR_DOCS}}
|
|
8
8
|
Business flow docs: {{BUSINESS_FLOW_DOCS}}
|
|
9
9
|
|
|
10
|
+
## Schema Constraints
|
|
11
|
+
|
|
12
|
+
Read [erp-kit-app-shared/references/schema-constraints.md](../../erp-kit-app-shared/references/schema-constraints.md) before evaluating. When checking `naming_consistency`, validate that H1 headings follow the schema rules — different doc types have different heading formats.
|
|
13
|
+
|
|
10
14
|
## Instructions
|
|
11
15
|
|
|
12
16
|
1. Read the application README at the path above
|
|
13
17
|
2. Read ALL actor docs and business flow docs at the paths above
|
|
14
18
|
3. Cross-reference actors, flows, and requirements for internal consistency
|
|
15
|
-
4.
|
|
19
|
+
4. **Verify** that none of your recommendations would violate the schema constraints above
|
|
20
|
+
5. Return results as markdown per the Output Format section
|
|
16
21
|
|
|
17
22
|
## Consistency Checks
|
|
18
23
|
|
|
@@ -89,13 +89,13 @@ After approval, scaffold using `erp-kit` CLI:
|
|
|
89
89
|
|
|
90
90
|
```bash
|
|
91
91
|
# Tier 3: Stories
|
|
92
|
-
erp-kit app
|
|
92
|
+
erp-kit app generate doc story <flow>/<actor>--<story> -p {APP_ROOT}/{APP_NAME}
|
|
93
93
|
|
|
94
94
|
# Tier 3: Screens
|
|
95
|
-
erp-kit app
|
|
95
|
+
erp-kit app generate doc screen <screen-name> -p {APP_ROOT}/{APP_NAME}
|
|
96
96
|
|
|
97
97
|
# Tier 4: Resolvers
|
|
98
|
-
erp-kit
|
|
98
|
+
erp-kit app generate doc resolver <resolver-name> -p {APP_ROOT}/{APP_NAME}
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
Fill scaffolded docs with details from agent extraction results.
|
|
@@ -122,10 +122,7 @@ pnpm run app:doc:check
|
|
|
122
122
|
|
|
123
123
|
## Naming Conventions
|
|
124
124
|
|
|
125
|
-
|
|
126
|
-
- Story heading: Title Case of story name (after `--`)
|
|
127
|
-
- Screen filename: kebab-case, noun-focused (e.g., `supplier-list.md`)
|
|
128
|
-
- Resolver filename: camelCase action-verb (e.g., `createSupplierInvitation.md`)
|
|
125
|
+
See [erp-kit-app-shared/references/naming-conventions.md](../erp-kit-app-shared/references/naming-conventions.md).
|
|
129
126
|
|
|
130
127
|
## Schema Reference
|
|
131
128
|
|
|
@@ -26,25 +26,7 @@ For each business flow step that modifies data:
|
|
|
26
26
|
|
|
27
27
|
### Operation → Resolver Mapping
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
| -------------------- | ------------- | ---------------------- |
|
|
31
|
-
| Create/Add entity | Mutation | `create<Entity>` |
|
|
32
|
-
| Update/Modify entity | Mutation | `update<Entity>` |
|
|
33
|
-
| Delete/Remove entity | Mutation | `delete<Entity>` |
|
|
34
|
-
| Activate entity | Mutation | `activate<Entity>` |
|
|
35
|
-
| Deactivate entity | Mutation | `deactivate<Entity>` |
|
|
36
|
-
| Assign X to Y | Mutation | `assign<X>To<Y>` |
|
|
37
|
-
| Submit/Approve | Mutation | `submit<Entity>` etc. |
|
|
38
|
-
| View/List/Get | Query | Built-in (no resolver) |
|
|
39
|
-
|
|
40
|
-
### Built-in vs Custom
|
|
41
|
-
|
|
42
|
-
| Category | Description | Implementation |
|
|
43
|
-
| -------------------- | ---------------------------------------- | -------------------- |
|
|
44
|
-
| **Custom resolvers** | Mutations that call module commands | Write resolver files |
|
|
45
|
-
| **Built-in queries** | List and get operations for reading data | Automatic, no code |
|
|
46
|
-
|
|
47
|
-
Prefer built-in queries over custom resolvers for list/get operations.
|
|
29
|
+
See [erp-kit-app-shared/references/resolver-classification.md](../../erp-kit-app-shared/references/resolver-classification.md) for the full operation → resolver mapping table and custom vs built-in classification.
|
|
48
30
|
|
|
49
31
|
### Module Command Mapping
|
|
50
32
|
|
|
@@ -160,18 +160,9 @@ Numbered list of actionable fixes, grouped by priority:
|
|
|
160
160
|
2. Fix broken links
|
|
161
161
|
3. Remove or link orphans
|
|
162
162
|
|
|
163
|
-
## Link Format Reference
|
|
164
|
-
|
|
165
|
-
| From | To | Format |
|
|
166
|
-
| ------------- | ------------- | ----------------------------------- |
|
|
167
|
-
| Business Flow | Story | `./story/<actor>--<name>.md` |
|
|
168
|
-
| Business Flow | Actor | `../../actors/<actor>.md` |
|
|
169
|
-
| Actor | Business Flow | `../business-flow/<flow>/README.md` |
|
|
170
|
-
| Story | Screen | `../../../screen/<screen>.md` |
|
|
171
|
-
| Story | Resolver | `../../../resolver/<name>.md` |
|
|
172
|
-
|
|
173
163
|
## References
|
|
174
164
|
|
|
165
|
+
- [Link format reference](../erp-kit-app-shared/references/link-format-reference.md)
|
|
175
166
|
- [Parity report format](references/parity-report-format.md)
|
|
176
167
|
- For plan creation, see erp-kit-app-3-plan
|
|
177
168
|
- For implementation, see erp-kit-app-5-impl-backend
|
|
@@ -38,14 +38,7 @@ Read all resolver and screen specs to build a complete picture:
|
|
|
38
38
|
2. **Screen docs** (`docs/screen/*.md`) — Identify screen types (ListView, Form, DetailView) and their fields/columns/actions
|
|
39
39
|
3. **Command source types** — For each module command the resolver calls, read the input type at `node_modules/@tailor-platform/erp-kit/src/modules/<module>/command/<commandName>.ts`. Do not invent fields that don't exist in the command, and preserve the required/optional distinction.
|
|
40
40
|
|
|
41
|
-
Classify resolvers
|
|
42
|
-
|
|
43
|
-
| Category | Description | Implementation |
|
|
44
|
-
| -------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
45
|
-
| **Custom resolvers** | Mutations that call module commands (create, update, activate, deactivate, assign) | Write `createResolver()` files |
|
|
46
|
-
| **Built-in queries** | List and get operations for reading data | Handled automatically by `gqlOperations: "query"` in config — no code needed |
|
|
47
|
-
|
|
48
|
-
Prefer built-in queries over custom resolvers for list/get operations where possible.
|
|
41
|
+
Classify resolvers per [erp-kit-app-shared/references/resolver-classification.md](../erp-kit-app-shared/references/resolver-classification.md).
|
|
49
42
|
|
|
50
43
|
### Phase 2: Wire Modules (`src/modules.ts`)
|
|
51
44
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: erp-kit-app-shared
|
|
3
|
+
description: Shared references for erp-kit app skills. Not invoked directly — referenced by erp-kit-app-1 through erp-kit-app-7.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# erp-kit-app-shared
|
|
7
|
+
|
|
8
|
+
Canonical reference files shared across app skills. Individual skills reference these instead of maintaining their own copies.
|
|
9
|
+
|
|
10
|
+
## References
|
|
11
|
+
|
|
12
|
+
- [Schema constraints](references/schema-constraints.md) — H1 heading rules and validation constraints enforced by `erp-kit app check`
|
|
13
|
+
- [Naming conventions](references/naming-conventions.md) — File and heading naming patterns for all doc types
|
|
14
|
+
- [Link format reference](references/link-format-reference.md) — Canonical doc-to-doc link formats across tiers
|
|
15
|
+
- [Resolver classification](references/resolver-classification.md) — Custom vs built-in resolver decision table and operation mapping
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Link Format Reference
|
|
2
|
+
|
|
3
|
+
Canonical link formats used across all documentation tiers.
|
|
4
|
+
|
|
5
|
+
## Doc-to-Doc Links
|
|
6
|
+
|
|
7
|
+
| From | To | Format |
|
|
8
|
+
| ------------- | ------------- | ----------------------------------- |
|
|
9
|
+
| Business Flow | Story | `./story/<actor>--<name>.md` |
|
|
10
|
+
| Business Flow | Actor | `../../actors/<actor>.md` |
|
|
11
|
+
| Actor | Business Flow | `../business-flow/<flow>/README.md` |
|
|
12
|
+
| Story | Screen | `../../../screen/<screen>.md` |
|
|
13
|
+
| Story | Resolver | `../../../resolver/<name>.md` |
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Naming Conventions
|
|
2
|
+
|
|
3
|
+
## File Naming
|
|
4
|
+
|
|
5
|
+
| Doc Type | Pattern | Example |
|
|
6
|
+
| -------- | ------------------------------------ | -------------------------------- |
|
|
7
|
+
| Actor | kebab-case | `sales-representative.md` |
|
|
8
|
+
| Flow | kebab-case directory | `employee-onboarding/README.md` |
|
|
9
|
+
| Story | `<actor>--<story-name>.md` | `admin--create-user.md` |
|
|
10
|
+
| Screen | kebab-case, noun-focused | `supplier-list.md` |
|
|
11
|
+
| Resolver | camelCase action-verb | `createSupplierInvitation.md` |
|
|
12
|
+
|
|
13
|
+
## Heading Conventions
|
|
14
|
+
|
|
15
|
+
See [schema-constraints.md](schema-constraints.md) for H1 heading rules enforced by `erp-kit app check`.
|
|
16
|
+
|
|
17
|
+
Additional conventions:
|
|
18
|
+
|
|
19
|
+
- Story heading: Title Case of story name after `--` prefix (e.g., `admin--create-user.md` → `# Create User`)
|
|
20
|
+
- Screen heading: Title Case of filename slug
|
|
21
|
+
- Resolver heading: camelCase matching filename
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Resolver Classification
|
|
2
|
+
|
|
3
|
+
## Custom vs Built-in
|
|
4
|
+
|
|
5
|
+
| Category | Description | Implementation |
|
|
6
|
+
| -------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
7
|
+
| **Custom resolvers** | Mutations that call module commands (create, update, activate, deactivate, assign) | Write `createResolver()` files |
|
|
8
|
+
| **Built-in queries** | List and get operations for reading data | Handled automatically by `gqlOperations: "query"` in config — no code needed |
|
|
9
|
+
|
|
10
|
+
Prefer built-in queries over custom resolvers for list/get operations where possible.
|
|
11
|
+
|
|
12
|
+
## Operation → Resolver Mapping
|
|
13
|
+
|
|
14
|
+
| Flow Operation | Resolver Type | Naming Pattern |
|
|
15
|
+
| -------------------- | ------------- | ---------------------- |
|
|
16
|
+
| Create/Add entity | Mutation | `create<Entity>` |
|
|
17
|
+
| Update/Modify entity | Mutation | `update<Entity>` |
|
|
18
|
+
| Delete/Remove entity | Mutation | `delete<Entity>` |
|
|
19
|
+
| Activate entity | Mutation | `activate<Entity>` |
|
|
20
|
+
| Deactivate entity | Mutation | `deactivate<Entity>` |
|
|
21
|
+
| Assign X to Y | Mutation | `assign<X>To<Y>` |
|
|
22
|
+
| Submit/Approve | Mutation | `submit<Entity>` etc. |
|
|
23
|
+
| View/List/Get | Query | Built-in (no resolver) |
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Schema Constraints
|
|
2
|
+
|
|
3
|
+
Rules enforced by `erp-kit app check`. **Never recommend changes that violate them.**
|
|
4
|
+
|
|
5
|
+
## H1 Heading Rules
|
|
6
|
+
|
|
7
|
+
| Doc Type | H1 Rule | Example |
|
|
8
|
+
| ------------- | ---------------------------------------------------- | -------------------------------------------------------- |
|
|
9
|
+
| README.md | Must be `# README` (literal) | `# README` |
|
|
10
|
+
| Actor | Slug must match filename | `admin.md` → `# Admin`, `sales-rep.md` → `# Sales Rep` |
|
|
11
|
+
| Business Flow | Kebab-case matching folder name (`[a-zA-Z0-9_\-]+`) | `employee-onboarding/README.md` → `# employee-onboarding` |
|
|
12
|
+
| Story | Slug matches filename after actor prefix removal | `admin--create-user.md` → `# Create User` |
|
|
13
|
+
|
|
14
|
+
## Requirements Structure
|
|
15
|
+
|
|
16
|
+
The `## Industry Context` section contains `### Target Industry` and `### Domain Terminology` subsections. Requirements are bare list items under `### Domain Terminology` — do **not** add a separate `## Requirements` heading.
|
|
17
|
+
|
|
18
|
+
## Naming Conventions
|
|
19
|
+
|
|
20
|
+
- Files: kebab-case (e.g., `sales-representative.md`)
|
|
21
|
+
- Business flow H1 headings are kebab-case — do **not** flag them as inconsistent with title-case actor headings. They follow different schemas.
|
|
22
|
+
|
|
23
|
+
## Validation Notes
|
|
24
|
+
|
|
25
|
+
- `app check` outputs "No matching files found" for doc types that don't exist yet (e.g., stories at Tier 2, screens at Tier 3). This is expected.
|
|
@@ -72,7 +72,7 @@ The final feature set becomes the union of all `Include` features. Iterate until
|
|
|
72
72
|
First, scaffold the module if it doesn't exist:
|
|
73
73
|
|
|
74
74
|
```bash
|
|
75
|
-
erp-kit
|
|
75
|
+
erp-kit module init <module-name> <MODULES_ROOT>/<module-name>
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
Then, for each `Include` feature, launch an Agent:
|
|
@@ -14,7 +14,7 @@ Write a feature documentation file for the {{FEATURE_NAME}} feature.
|
|
|
14
14
|
1. Read existing feature docs in `{{MODULES_ROOT}}/{{MODULE_NAME}}/docs/features/` for style reference
|
|
15
15
|
2. Scaffold the file:
|
|
16
16
|
```bash
|
|
17
|
-
erp-kit
|
|
17
|
+
erp-kit module generate doc feature {{FEATURE_SLUG}} -p {{MODULES_ROOT}}/{{MODULE_NAME}}
|
|
18
18
|
```
|
|
19
19
|
3. Fill in the scaffolded file following the structure below
|
|
20
20
|
|
|
@@ -43,12 +43,12 @@ Wait for user approval.
|
|
|
43
43
|
|
|
44
44
|
## Step 3: Scaffold & Populate
|
|
45
45
|
|
|
46
|
-
After approval, scaffold using `erp-kit` CLI:
|
|
46
|
+
After approval, scaffold using `erp-kit` CLI. **Names must be PascalCase** (see [naming convention](references/naming.md)):
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
|
-
erp-kit
|
|
50
|
-
erp-kit
|
|
51
|
-
erp-kit
|
|
49
|
+
erp-kit module generate doc model ModelName -p <MODULES_ROOT>/<module-name>
|
|
50
|
+
erp-kit module generate doc command CommandName -p <MODULES_ROOT>/<module-name>
|
|
51
|
+
erp-kit module generate doc query QueryName -p <MODULES_ROOT>/<module-name>
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
Fill in the scaffolded docs with details from the extraction in Step 2.
|
|
@@ -103,5 +103,5 @@ pnpm run module:doc:check
|
|
|
103
103
|
|
|
104
104
|
## References
|
|
105
105
|
|
|
106
|
-
- [
|
|
106
|
+
- [Naming convention (PascalCase files + command verbs)](references/naming.md)
|
|
107
107
|
- [Module structure](../erp-kit-module-shared/references/structure.md)
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Naming Convention
|
|
2
|
+
|
|
3
|
+
## Doc File Names — PascalCase
|
|
4
|
+
|
|
5
|
+
Documentation files under `docs/models/`, `docs/commands/`, and `docs/queries/` **must** use PascalCase. The code generator derives the camelCase command/query name by lowercasing the first character of the file name.
|
|
6
|
+
|
|
7
|
+
| Doc type | File name format | Example file | Derived name |
|
|
8
|
+
| -------- | ----------------- | ------------------ | --------------- |
|
|
9
|
+
| Model | `{Entity}.md` | `Product.md` | — |
|
|
10
|
+
| Command | `{VerbEntity}.md` | `CreateProduct.md` | `createProduct` |
|
|
11
|
+
| Query | `{VerbEntity}.md` | `GetProduct.md` | `getProduct` |
|
|
12
|
+
|
|
13
|
+
**Never use kebab-case** (`create-product.md`) — the generator will produce a broken name (`create-product`).
|
|
14
|
+
|
|
15
|
+
## Command Naming Convention
|
|
2
16
|
|
|
3
17
|
Commands use imperative `{verb}{Entity}` format. Use this canonical verb vocabulary when scaffolding commands.
|
|
4
18
|
|
|
@@ -17,7 +17,7 @@ Implement features in modules using Test-Driven Development with per-item agent
|
|
|
17
17
|
## Workflow
|
|
18
18
|
|
|
19
19
|
```
|
|
20
|
-
SETUP → DB MODELS (agents) →
|
|
20
|
+
SETUP → GENERATE → DB MODELS (agents) → COMMANDS (agents) → QUERIES (agents) → EXPORT → VERIFY
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Step 1: Setup
|
|
@@ -32,7 +32,17 @@ Define shared context:
|
|
|
32
32
|
|
|
33
33
|
Verify at least one doc type exists. If none, stop with: "No docs found for module <MODULE_NAME>. Run steps 1-4 first."
|
|
34
34
|
|
|
35
|
-
## Step 2:
|
|
35
|
+
## Step 2: Generate Code from Docs
|
|
36
|
+
|
|
37
|
+
Run generation first to create `.generated.ts` files (error classes, permission definitions, command/query shells) before implementing any code:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
erp-kit module generate code -p <MODULES_ROOT>/<module>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Never edit these generated files.
|
|
44
|
+
|
|
45
|
+
## Step 3: DB Models — Agent per model
|
|
36
46
|
|
|
37
47
|
**Read [models rules](references/models.md) and [db-relations rules](references/db-relations.md) before dispatching.**
|
|
38
48
|
|
|
@@ -51,14 +61,6 @@ After all model agents complete, run:
|
|
|
51
61
|
pnpm generate
|
|
52
62
|
```
|
|
53
63
|
|
|
54
|
-
## Step 3: Generate Code from Docs
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
erp-kit module generate code --root <root> <module>
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Generated `.generated.ts` files provide: error classes, permission definitions, and command/query shells. Never edit these files.
|
|
61
|
-
|
|
62
64
|
## Step 4: Commands — Agent per command
|
|
63
65
|
|
|
64
66
|
**Read [commands rules](../erp-kit-module-shared/references/commands.md) and [testing rules](../erp-kit-module-shared/references/testing.md) before dispatching.**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
Run `erp-kit module generate code
|
|
5
|
+
Run `erp-kit module generate code -p <modules-dir>/<module-name>` to generate deterministic `.generated.ts` files from command and query documentation.
|
|
6
6
|
|
|
7
7
|
## What gets generated
|
|
8
8
|
|
|
@@ -21,7 +21,7 @@ Run `erp-kit module generate code --root <modules-dir> <module-name>` to generat
|
|
|
21
21
|
1. Write command/query docs (skills 1-3)
|
|
22
22
|
2. Write db models (skill 4, step 2)
|
|
23
23
|
3. Run `pnpm generate` for kysely types
|
|
24
|
-
4. Run `erp-kit module generate code
|
|
24
|
+
4. Run `erp-kit module generate code -p <root>/<module>`
|
|
25
25
|
5. Implement business logic in `.ts` files importing from `.generated.ts`
|
|
26
26
|
|
|
27
27
|
## What you still write by hand
|
|
@@ -175,7 +175,7 @@ Numbered list of actionable fixes, grouped by priority:
|
|
|
175
175
|
|
|
176
176
|
1. Add missing model fields/states (highest priority)
|
|
177
177
|
2. Implement missing business rules
|
|
178
|
-
3. Define missing error classes (re-run `erp-kit module generate code
|
|
178
|
+
3. Define missing error classes (re-run `erp-kit module generate code -p <path>`)
|
|
179
179
|
4. Add missing test cases
|
|
180
180
|
5. Fix inconsistencies
|
|
181
181
|
|
|
@@ -72,7 +72,7 @@ For each error scenario documented in command docs:
|
|
|
72
72
|
|
|
73
73
|
## Common Gap Patterns
|
|
74
74
|
|
|
75
|
-
- **Missing error class**: Error code in doc but no generated class (re-run `erp-kit module generate code
|
|
75
|
+
- **Missing error class**: Error code in doc but no generated class (re-run `erp-kit module generate code -p <path>`)
|
|
76
76
|
- **Error not returned**: Generated class exists but command code doesn't return it
|
|
77
77
|
- **Error not imported**: Command uses inline error instead of generated class
|
|
78
78
|
- **Missing error test**: Error is returned in code but no test asserts it
|
|
@@ -7,4 +7,4 @@ Errors are **generated** from command/query documentation into `lib/errors.gener
|
|
|
7
7
|
- Every error code in `docs/commands/*.md` has a corresponding class in `lib/errors.generated.ts`
|
|
8
8
|
- Command implementations import errors from `../lib/errors.generated`
|
|
9
9
|
- Generated error codes are prefixed with the module name (e.g., doc code `UNIT_NOT_FOUND` becomes `PRIMITIVES_UNIT_NOT_FOUND`)
|
|
10
|
-
- If errors are missing, re-run `erp-kit module generate code
|
|
10
|
+
- If errors are missing, re-run `erp-kit module generate code -p <path>`
|
|
@@ -5,7 +5,7 @@ Errors are **generated** from command/query documentation. Do not write `lib/err
|
|
|
5
5
|
## How it works
|
|
6
6
|
|
|
7
7
|
1. Write error scenarios in `docs/commands/*.md` as `CODE: Description` pairs
|
|
8
|
-
2. Run `erp-kit module generate code
|
|
8
|
+
2. Run `erp-kit module generate code -p <path>` to produce `lib/errors.generated.ts`
|
|
9
9
|
3. Import generated errors in your command implementations
|
|
10
10
|
|
|
11
11
|
## Naming convention (in docs)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Generated Query Shells
|
|
4
4
|
|
|
5
|
-
Run `erp-kit module generate code
|
|
5
|
+
Run `erp-kit module generate code -p <path>` to generate query shells from `docs/queries/*.md`. Each generated shell wraps your `run` function with `defineQuery`.
|
|
6
6
|
|
|
7
7
|
### Generated shell example
|
|
8
8
|
|
|
@@ -19,8 +19,8 @@ Ask the user:
|
|
|
19
19
|
|
|
20
20
|
1. **What changed?** (free-text description of the change)
|
|
21
21
|
2. **Where?** Determine domain from the target:
|
|
22
|
-
- `
|
|
23
|
-
- `
|
|
22
|
+
- App directory (e.g., `{APP_ROOT}/{APP_NAME}/`) → **App workflow** (skills matching `erp-kit-app-*`)
|
|
23
|
+
- Module directory (e.g., `{MODULE_ROOT}/{MODULE_NAME}/`) → **Module workflow** (skills matching `erp-kit-module-*`)
|
|
24
24
|
|
|
25
25
|
If the user names a specific app or module, confirm the path. If ambiguous, check both directories.
|
|
26
26
|
|