@tailor-platform/erp-kit 0.0.1 → 0.1.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 (213) hide show
  1. package/README.md +196 -28
  2. package/dist/cli.js +894 -0
  3. package/package.json +65 -8
  4. package/rules/app-compose/backend/auth.md +78 -0
  5. package/rules/app-compose/frontend/auth.md +55 -0
  6. package/rules/app-compose/frontend/component.md +55 -0
  7. package/rules/app-compose/frontend/page.md +86 -0
  8. package/rules/app-compose/frontend/screen-detailview.md +112 -0
  9. package/rules/app-compose/frontend/screen-form.md +145 -0
  10. package/rules/app-compose/frontend/screen-listview.md +159 -0
  11. package/rules/app-compose/structure.md +32 -0
  12. package/rules/module-development/commands.md +54 -0
  13. package/rules/module-development/cross-module-type-injection.md +28 -0
  14. package/rules/module-development/dependency-modules.md +24 -0
  15. package/rules/module-development/errors.md +12 -0
  16. package/rules/module-development/executors.md +67 -0
  17. package/rules/module-development/exports.md +13 -0
  18. package/rules/module-development/models.md +34 -0
  19. package/rules/module-development/structure.md +27 -0
  20. package/rules/module-development/sync-vs-async-operations.md +83 -0
  21. package/rules/module-development/testing.md +43 -0
  22. package/rules/sdk-best-practices/db-relations.md +74 -0
  23. package/rules/sdk-best-practices/sdk-docs.md +14 -0
  24. package/schemas/app-compose/actors.yml +34 -0
  25. package/schemas/app-compose/business-flow.yml +50 -0
  26. package/schemas/app-compose/requirements.yml +33 -0
  27. package/schemas/app-compose/resolver.yml +47 -0
  28. package/schemas/app-compose/screen.yml +81 -0
  29. package/schemas/app-compose/story.yml +67 -0
  30. package/schemas/module/command.yml +52 -0
  31. package/schemas/module/feature.yml +58 -0
  32. package/schemas/module/model.yml +70 -0
  33. package/schemas/module/module.yml +50 -0
  34. package/skills/1-module-docs/SKILL.md +107 -0
  35. package/skills/2-module-feature-breakdown/SKILL.md +66 -0
  36. package/skills/3-module-doc-review/SKILL.md +230 -0
  37. package/skills/4-module-tdd-implementation/SKILL.md +56 -0
  38. package/skills/5-module-implementation-review/SKILL.md +400 -0
  39. package/skills/app-compose-1-requirement-analysis/SKILL.md +85 -0
  40. package/skills/app-compose-2-requirements-breakdown/SKILL.md +88 -0
  41. package/skills/app-compose-3-doc-review/SKILL.md +112 -0
  42. package/skills/app-compose-4-design-mock/SKILL.md +248 -0
  43. package/skills/app-compose-5-design-mock-review/SKILL.md +283 -0
  44. package/skills/app-compose-6-implementation-spec/SKILL.md +122 -0
  45. package/skills/mock-scenario/SKILL.md +118 -0
  46. package/src/app.ts +1 -0
  47. package/src/cli.ts +120 -0
  48. package/src/commands/check.test.ts +30 -0
  49. package/src/commands/check.ts +66 -0
  50. package/src/commands/init.test.ts +77 -0
  51. package/src/commands/init.ts +87 -0
  52. package/src/commands/mock/index.ts +53 -0
  53. package/src/commands/mock/start.ts +179 -0
  54. package/src/commands/mock/validate.test.ts +185 -0
  55. package/src/commands/mock/validate.ts +198 -0
  56. package/src/commands/scaffold.test.ts +76 -0
  57. package/src/commands/scaffold.ts +119 -0
  58. package/src/commands/sync-check.test.ts +125 -0
  59. package/src/commands/sync-check.ts +182 -0
  60. package/src/integration.test.ts +63 -0
  61. package/src/mdschema.ts +48 -0
  62. package/src/mockServer.ts +55 -0
  63. package/src/module.ts +86 -0
  64. package/src/modules/accounting/.gitkeep +0 -0
  65. package/src/modules/coa-management/.gitkeep +0 -0
  66. package/src/modules/inventory/.gitkeep +0 -0
  67. package/src/modules/manufacturing/.gitkeep +0 -0
  68. package/src/modules/primitives/README.md +39 -0
  69. package/src/modules/primitives/command/activateCategory.test.ts +75 -0
  70. package/src/modules/primitives/command/activateCategory.ts +50 -0
  71. package/src/modules/primitives/command/activateCurrency.test.ts +70 -0
  72. package/src/modules/primitives/command/activateCurrency.ts +50 -0
  73. package/src/modules/primitives/command/activateUnit.test.ts +53 -0
  74. package/src/modules/primitives/command/activateUnit.ts +50 -0
  75. package/src/modules/primitives/command/convertAmount.test.ts +275 -0
  76. package/src/modules/primitives/command/convertAmount.ts +126 -0
  77. package/src/modules/primitives/command/convertQuantity.test.ts +219 -0
  78. package/src/modules/primitives/command/convertQuantity.ts +73 -0
  79. package/src/modules/primitives/command/createCategory.test.ts +126 -0
  80. package/src/modules/primitives/command/createCategory.ts +89 -0
  81. package/src/modules/primitives/command/createCurrency.test.ts +191 -0
  82. package/src/modules/primitives/command/createCurrency.ts +77 -0
  83. package/src/modules/primitives/command/createExchangeRate.test.ts +216 -0
  84. package/src/modules/primitives/command/createExchangeRate.ts +91 -0
  85. package/src/modules/primitives/command/createUnit.test.ts +214 -0
  86. package/src/modules/primitives/command/createUnit.ts +88 -0
  87. package/src/modules/primitives/command/deactivateCategory.test.ts +97 -0
  88. package/src/modules/primitives/command/deactivateCategory.ts +62 -0
  89. package/src/modules/primitives/command/deactivateCurrency.test.ts +85 -0
  90. package/src/modules/primitives/command/deactivateCurrency.ts +55 -0
  91. package/src/modules/primitives/command/deactivateUnit.test.ts +78 -0
  92. package/src/modules/primitives/command/deactivateUnit.ts +62 -0
  93. package/src/modules/primitives/command/setBaseCurrency.test.ts +98 -0
  94. package/src/modules/primitives/command/setBaseCurrency.ts +74 -0
  95. package/src/modules/primitives/command/setReferenceUnit.test.ts +108 -0
  96. package/src/modules/primitives/command/setReferenceUnit.ts +84 -0
  97. package/src/modules/primitives/db/currency.ts +30 -0
  98. package/src/modules/primitives/db/exchangeRate.ts +28 -0
  99. package/src/modules/primitives/db/unit.ts +32 -0
  100. package/src/modules/primitives/db/uomCategory.ts +32 -0
  101. package/src/modules/primitives/docs/commands/ActivateCategory.md +34 -0
  102. package/src/modules/primitives/docs/commands/ActivateCurrency.md +33 -0
  103. package/src/modules/primitives/docs/commands/ActivateUnit.md +34 -0
  104. package/src/modules/primitives/docs/commands/ConvertAmount.md +50 -0
  105. package/src/modules/primitives/docs/commands/ConvertQuantity.md +43 -0
  106. package/src/modules/primitives/docs/commands/CreateCategory.md +44 -0
  107. package/src/modules/primitives/docs/commands/CreateCurrency.md +47 -0
  108. package/src/modules/primitives/docs/commands/CreateExchangeRate.md +48 -0
  109. package/src/modules/primitives/docs/commands/CreateUnit.md +48 -0
  110. package/src/modules/primitives/docs/commands/DeactivateCategory.md +38 -0
  111. package/src/modules/primitives/docs/commands/DeactivateCurrency.md +38 -0
  112. package/src/modules/primitives/docs/commands/DeactivateUnit.md +38 -0
  113. package/src/modules/primitives/docs/commands/SetBaseCurrency.md +39 -0
  114. package/src/modules/primitives/docs/commands/SetReferenceUnit.md +43 -0
  115. package/src/modules/primitives/docs/features/currency-definitions.md +55 -0
  116. package/src/modules/primitives/docs/features/exchange-rates.md +61 -0
  117. package/src/modules/primitives/docs/features/unit-conversion.md +66 -0
  118. package/src/modules/primitives/docs/features/uom-categories.md +52 -0
  119. package/src/modules/primitives/docs/models/Currency.md +45 -0
  120. package/src/modules/primitives/docs/models/ExchangeRate.md +33 -0
  121. package/src/modules/primitives/docs/models/Unit.md +46 -0
  122. package/src/modules/primitives/docs/models/UoMCategory.md +44 -0
  123. package/src/modules/primitives/generated/kysely-tailordb.ts +95 -0
  124. package/src/modules/primitives/index.ts +40 -0
  125. package/src/modules/primitives/lib/errors.ts +138 -0
  126. package/src/modules/primitives/lib/types.ts +20 -0
  127. package/src/modules/primitives/module.ts +66 -0
  128. package/src/modules/primitives/permissions.ts +18 -0
  129. package/src/modules/primitives/tailor.config.ts +11 -0
  130. package/src/modules/primitives/testing/fixtures.ts +161 -0
  131. package/src/modules/product-management/.gitkeep +0 -0
  132. package/src/modules/purchase/.gitkeep +0 -0
  133. package/src/modules/sales/.gitkeep +0 -0
  134. package/src/modules/shared/createContext.test.ts +39 -0
  135. package/src/modules/shared/createContext.ts +15 -0
  136. package/src/modules/shared/defineCommand.test.ts +42 -0
  137. package/src/modules/shared/defineCommand.ts +19 -0
  138. package/src/modules/shared/definePermissions.test.ts +146 -0
  139. package/src/modules/shared/definePermissions.ts +94 -0
  140. package/src/modules/shared/entityTypes.ts +15 -0
  141. package/src/modules/shared/errors.ts +22 -0
  142. package/src/modules/shared/index.ts +1 -0
  143. package/src/modules/shared/internal.ts +13 -0
  144. package/src/modules/shared/requirePermission.test.ts +47 -0
  145. package/src/modules/shared/requirePermission.ts +8 -0
  146. package/src/modules/shared/types.ts +4 -0
  147. package/src/modules/supplier-management/.gitkeep +0 -0
  148. package/src/modules/supplier-portal/.gitkeep +0 -0
  149. package/src/modules/testing/index.ts +120 -0
  150. package/src/modules/user-management/README.md +38 -0
  151. package/src/modules/user-management/command/activateUser.test.ts +112 -0
  152. package/src/modules/user-management/command/activateUser.ts +67 -0
  153. package/src/modules/user-management/command/assignPermissionToRole.test.ts +119 -0
  154. package/src/modules/user-management/command/assignPermissionToRole.ts +87 -0
  155. package/src/modules/user-management/command/assignRoleToUser.test.ts +162 -0
  156. package/src/modules/user-management/command/assignRoleToUser.ts +93 -0
  157. package/src/modules/user-management/command/createPermission.test.ts +143 -0
  158. package/src/modules/user-management/command/createPermission.ts +66 -0
  159. package/src/modules/user-management/command/createRole.test.ts +115 -0
  160. package/src/modules/user-management/command/createRole.ts +52 -0
  161. package/src/modules/user-management/command/createUser.test.ts +198 -0
  162. package/src/modules/user-management/command/createUser.ts +85 -0
  163. package/src/modules/user-management/command/deactivateUser.test.ts +112 -0
  164. package/src/modules/user-management/command/deactivateUser.ts +67 -0
  165. package/src/modules/user-management/command/logAuditEvent.test.ts +179 -0
  166. package/src/modules/user-management/command/logAuditEvent.ts +59 -0
  167. package/src/modules/user-management/command/reactivateUser.test.ts +115 -0
  168. package/src/modules/user-management/command/reactivateUser.ts +67 -0
  169. package/src/modules/user-management/command/revokePermissionFromRole.test.ts +112 -0
  170. package/src/modules/user-management/command/revokePermissionFromRole.ts +81 -0
  171. package/src/modules/user-management/command/revokeRoleFromUser.test.ts +112 -0
  172. package/src/modules/user-management/command/revokeRoleFromUser.ts +81 -0
  173. package/src/modules/user-management/db/auditEvent.ts +47 -0
  174. package/src/modules/user-management/db/permission.ts +31 -0
  175. package/src/modules/user-management/db/role.ts +28 -0
  176. package/src/modules/user-management/db/rolePermission.ts +44 -0
  177. package/src/modules/user-management/db/user.ts +38 -0
  178. package/src/modules/user-management/db/userRole.ts +44 -0
  179. package/src/modules/user-management/docs/commands/ActivateUser.md +36 -0
  180. package/src/modules/user-management/docs/commands/AssignPermissionToRole.md +39 -0
  181. package/src/modules/user-management/docs/commands/AssignRoleToUser.md +43 -0
  182. package/src/modules/user-management/docs/commands/CreatePermission.md +35 -0
  183. package/src/modules/user-management/docs/commands/CreateRole.md +35 -0
  184. package/src/modules/user-management/docs/commands/CreateUser.md +41 -0
  185. package/src/modules/user-management/docs/commands/DeactivateUser.md +38 -0
  186. package/src/modules/user-management/docs/commands/LogAuditEvent.md +37 -0
  187. package/src/modules/user-management/docs/commands/ReactivateUser.md +37 -0
  188. package/src/modules/user-management/docs/commands/RevokePermissionFromRole.md +40 -0
  189. package/src/modules/user-management/docs/commands/RevokeRoleFromUser.md +40 -0
  190. package/src/modules/user-management/docs/features/audit-trail.md +80 -0
  191. package/src/modules/user-management/docs/features/role-based-access-control.md +76 -0
  192. package/src/modules/user-management/docs/features/user-account-management.md +64 -0
  193. package/src/modules/user-management/docs/models/AuditEvent.md +34 -0
  194. package/src/modules/user-management/docs/models/Permission.md +31 -0
  195. package/src/modules/user-management/docs/models/Role.md +31 -0
  196. package/src/modules/user-management/docs/models/RolePermission.md +33 -0
  197. package/src/modules/user-management/docs/models/User.md +47 -0
  198. package/src/modules/user-management/docs/models/UserRole.md +34 -0
  199. package/src/modules/user-management/docs/plans/2026-01-30-flattened-permissions-design.md +52 -0
  200. package/src/modules/user-management/executor/recomputeOnRolePermissionChange.ts +61 -0
  201. package/src/modules/user-management/generated/enums.ts +24 -0
  202. package/src/modules/user-management/generated/kysely-tailordb.ts +112 -0
  203. package/src/modules/user-management/index.ts +32 -0
  204. package/src/modules/user-management/lib/errors.ts +81 -0
  205. package/src/modules/user-management/lib/recomputeUserPermissions.ts +53 -0
  206. package/src/modules/user-management/lib/types.ts +31 -0
  207. package/src/modules/user-management/module.ts +77 -0
  208. package/src/modules/user-management/permissions.ts +15 -0
  209. package/src/modules/user-management/tailor.config.ts +11 -0
  210. package/src/modules/user-management/testing/fixtures.ts +98 -0
  211. package/src/schemas.ts +25 -0
  212. package/src/testing.ts +10 -0
  213. package/src/util.ts +3 -0
@@ -0,0 +1,34 @@
1
+ # yaml-language-server: $schema=https://raw.githubusercontent.com/jackchuka/mdschema/main/schema.json
2
+
3
+ structure:
4
+ - heading:
5
+ expr: "slug(filename) == slug(heading)"
6
+ children:
7
+ # Brief context for authorization decisions - REQUIRED
8
+ - heading: "## Overview"
9
+ description: |
10
+ 1-2 sentences: who this actor is and their authority level.
11
+ Not a job description — context for authorization decisions.
12
+
13
+ # What flows this actor participates in - REQUIRED
14
+ - heading: "## Authorized Business Flows"
15
+ description: |
16
+ Business flows this actor participates in.
17
+ Format: [Flow Name](../business-flow/<flow>/README.md) — role
18
+ Roles: initiator, approver, viewer
19
+ Add conditions inline when needed, e.g. (< $1000)
20
+ lists:
21
+ - min: 1
22
+ type: unordered
23
+ min_items: 1
24
+
25
+ # Link validation
26
+ links:
27
+ validate_internal: true
28
+ validate_files: true
29
+
30
+ # Heading rules
31
+ heading_rules:
32
+ no_skip_levels: true
33
+ unique: true
34
+ max_depth: 2
@@ -0,0 +1,50 @@
1
+ # yaml-language-server: $schema=https://raw.githubusercontent.com/jackchuka/mdschema/main/schema.json
2
+
3
+ # SPEC TIER 3 (primary navigation structure)
4
+ # Business flow file: business-flow/<flow-name>/README.md
5
+ # Stories are nested: business-flow/<flow-name>/story/<actor>--<story-name>.md
6
+ # Defines end-to-end business processes
7
+
8
+ structure:
9
+ - heading:
10
+ pattern: "# [a-zA-Z0-9_\\-]+"
11
+ children:
12
+ # Brief description of this business flow - REQUIRED
13
+ - heading: "## Overview"
14
+
15
+ # Who initiates and participates in this flow - REQUIRED
16
+ - heading: "## Actors Involved"
17
+ description: |
18
+ List actors that participate in this business flow.
19
+ Link to actor docs. ie. ../../actors/<actor-name>.md
20
+ lists:
21
+ - min: 1
22
+ type: unordered
23
+ min_items: 1
24
+
25
+ # Diagram representing this flow - REQUIRED
26
+ - heading: "## Flow Diagram"
27
+ code_blocks:
28
+ - min: 1
29
+ lang: mermaid
30
+
31
+ # Links to user stories nested under this flow - REQUIRED
32
+ - heading: "## Stories"
33
+ description: |
34
+ Link to story docs in ./story/ folder that comprise this business flow.
35
+ Format: ./story/<actor>--<story-name>.md
36
+ lists:
37
+ - min: 1
38
+ type: unordered
39
+ min_items: 1
40
+
41
+ # Link validation
42
+ links:
43
+ validate_internal: true
44
+ validate_files: true
45
+
46
+ # Heading rules
47
+ heading_rules:
48
+ no_skip_levels: true
49
+ unique: true
50
+ max_depth: 3
@@ -0,0 +1,33 @@
1
+ # yaml-language-server: $schema=https://raw.githubusercontent.com/jackchuka/mdschema/main/schema.json
2
+
3
+ structure:
4
+ - heading: "# README"
5
+ children:
6
+ # What this application does - REQUIRED
7
+ - heading: "## Overview"
8
+
9
+ # Target industry and domain knowledge - REQUIRED
10
+ - heading: "## Industry Context"
11
+ children:
12
+ - heading: "### Target Industry"
13
+ description: |
14
+ The industry sector this application serves
15
+ (e.g., Manufacturing, Retail, Healthcare, Finance, Logistics)
16
+
17
+ - heading: "### Domain Terminology"
18
+ description: |
19
+ Key terms and concepts specific to this domain
20
+ lists:
21
+ - min: 0
22
+ type: unordered
23
+
24
+ # Link validation
25
+ links:
26
+ validate_internal: true
27
+ validate_files: true
28
+
29
+ # Heading rules
30
+ heading_rules:
31
+ no_skip_levels: true
32
+ unique: true
33
+ max_depth: 3
@@ -0,0 +1,47 @@
1
+ # yaml-language-server: $schema=https://raw.githubusercontent.com/jackchuka/mdschema/main/schema.json
2
+
3
+ # IMPLEMENTATION TIER
4
+ # Resolver file: resolver/<resolverName>.md
5
+ # Documents GraphQL operations (queries, mutations, subscriptions)
6
+
7
+ # TODO: check against resolver implementations via CI/CD pipeline
8
+
9
+ structure:
10
+ - heading:
11
+ expr: "filename == heading"
12
+ description: |
13
+ Document the GraphQL operation - mainly mutations.
14
+ children:
15
+ # What this Resolver does - REQUIRED
16
+ - heading: "## Overview"
17
+
18
+ # Which modules and what parts are used - REQUIRED
19
+ - heading: "## Modules Commands Used"
20
+ description: |
21
+ List modules and specific features/commands used from each.
22
+ lists:
23
+ - min: 1
24
+ type: unordered
25
+ min_items: 1
26
+
27
+ # Error Handling
28
+ - heading: "## Exception Handling"
29
+ optional: true
30
+ description: |
31
+ Document possible errors returned by this operation.
32
+ tables:
33
+ - min: 1
34
+ required_headers:
35
+ - Error Code
36
+ - Description
37
+
38
+ # Link validation
39
+ links:
40
+ validate_internal: true
41
+ validate_files: true
42
+
43
+ # Heading rules
44
+ heading_rules:
45
+ no_skip_levels: true
46
+ unique: true
47
+ max_depth: 3
@@ -0,0 +1,81 @@
1
+ # yaml-language-server: $schema=https://raw.githubusercontent.com/jackchuka/mdschema/main/schema.json
2
+
3
+ # IMPLEMENTATION TIER
4
+ # Screen file: screen/<screenName>.md
5
+ # TODO: should check existance of screens via CI/CD pipeline
6
+
7
+ structure:
8
+ - heading:
9
+ expr: "filename == heading"
10
+ children:
11
+ # What this screen does - REQUIRED
12
+ - heading: "## Overview"
13
+
14
+ # Screen Type
15
+ - heading: "## Screen Type"
16
+ description: |
17
+ Specify the type of screen (e.g., Form, ListView, DetailView).
18
+ required_text:
19
+ - pattern: "(Form|ListView|DetailView)"
20
+ regex: true
21
+ children:
22
+ - heading: "### Form Details"
23
+ description: |
24
+ If the screen is a Form provide details about the form fields.
25
+ optional: true
26
+ children:
27
+ - heading: "#### Input Fields"
28
+ tables:
29
+ - min: 1
30
+ required_headers:
31
+ - Field Name
32
+ - Field Type
33
+ - Required (Yes/No)
34
+ - heading: "### ListView Details"
35
+ description: |
36
+ If the screen is a ListView provide details about the table displayed.
37
+ optional: true
38
+ children:
39
+ - heading: "#### Required Columns"
40
+ tables:
41
+ - min: 1
42
+ required_headers:
43
+ - Column Name
44
+ - Hideable (Yes/No)
45
+ - Sort-able (Yes/No)
46
+ - Filter-able (Yes/No)
47
+ - Searchable (Yes/No)
48
+ - heading: "### DetailView Details"
49
+ description: |
50
+ If the screen is a DetailView provide actions available on this screen.
51
+ optional: true
52
+ children:
53
+ - heading: "#### Displayed Fields"
54
+ lists:
55
+ - min: 1
56
+ type: unordered
57
+ min_items: 1
58
+ - heading: "#### Available Actions"
59
+ lists:
60
+ - min: 1
61
+ type: unordered
62
+ min_items: 1
63
+
64
+ - heading: "## Access Control"
65
+ description: |
66
+ Specify the actors that have access to this screen.
67
+ Use links to actor documents (e.g., [buyer-administrator](../actors/buyer-administrator.md)).
68
+ lists:
69
+ - min: 1
70
+ type: unordered
71
+
72
+ # Link validation
73
+ links:
74
+ validate_internal: true
75
+ validate_files: true
76
+
77
+ # Heading rules
78
+ heading_rules:
79
+ no_skip_levels: true
80
+ unique: true
81
+ max_depth: 4
@@ -0,0 +1,67 @@
1
+ # yaml-language-server: $schema=https://raw.githubusercontent.com/jackchuka/mdschema/main/schema.json
2
+
3
+ # SPEC TIER 3 (nested under business-flow)
4
+ # Story filename format: <actor>--<story-name>.md
5
+ # Example: sales-manager--create-sales-order.md
6
+ # Heading must match story name (after --): # Create Sales Order
7
+ # Defines WHAT users accomplish (the requirement)
8
+
9
+ structure:
10
+ - heading:
11
+ # Validates: slug of text after "--" matches heading
12
+ # trimPrefix removes "actor--" prefix, leaving story name
13
+ # e.g., "sales-manager--create-sales-order" -> "create-sales-order" -> matches "# Create Sales Order"
14
+ expr: 'slug(trimPrefix(filename, "^[a-z-]+--")) == slug(heading)'
15
+ description: |
16
+ User story defining a specific requirement within a business flow.
17
+ The name of the story should start with the actor followed by `--` and the story name.
18
+ children:
19
+ - heading: "## User Story"
20
+ description: |
21
+ Define the user story in the format:
22
+ As a [role], I want [goal], so that [benefit].
23
+
24
+ # Diagram representing this story - REQUIRED
25
+ - heading: "## Story Diagram"
26
+ description: |
27
+ Mermaid sequence diagram showing user interactions with screens.
28
+ Focus on actors, UI screens, and business outcomes.
29
+ Avoid technical details (APIs, databases, endpoints).
30
+ code_blocks:
31
+ - min: 1
32
+ lang: mermaid
33
+
34
+ # Scenario Patterns, including edge cases - REQUIRED
35
+ - heading: "## Scenario Patterns"
36
+ lists:
37
+ - min: 1
38
+ type: unordered
39
+ min_items: 1
40
+
41
+ # Test cases must be covered - REQUIRED
42
+ - heading: "## Test Cases"
43
+ lists:
44
+ - min: 0
45
+ type: unordered
46
+ min_items: 1
47
+
48
+ # Screens that implement this story - REQUIRED
49
+ # Enables M:N relationship between stories and screens
50
+ - heading: "## Screens"
51
+ description: |
52
+ Link to screen docs that implement this story's UI.
53
+ lists:
54
+ - min: 1
55
+ type: unordered
56
+ min_items: 1
57
+
58
+ # Link validation
59
+ links:
60
+ validate_internal: true
61
+ validate_files: true
62
+
63
+ # Heading rules
64
+ heading_rules:
65
+ no_skip_levels: true
66
+ unique: true
67
+ max_depth: 3
@@ -0,0 +1,52 @@
1
+ # yaml-language-server: $schema=https://raw.githubusercontent.com/jackchuka/mdschema/main/schema.json
2
+
3
+ structure:
4
+ - heading:
5
+ expr: "filename == heading"
6
+ children:
7
+ # What this command does - REQUIRED
8
+ - heading: "## Overview"
9
+
10
+ # Business rules - REQUIRED
11
+ # Rules, constraints, and validation logic
12
+ - heading: "## Business Rules"
13
+ allow_additional: true
14
+ lists:
15
+ - min: 0
16
+ type: unordered
17
+ min_items: 1
18
+
19
+ # How it works - REQUIRED
20
+ # Step-by-step flow or workflow
21
+ - heading: "## Process Flow"
22
+ code_blocks:
23
+ - lang: mermaid
24
+ min: 1
25
+
26
+ # External dependencies - OPTIONAL
27
+ # Commands from other modules that this command depends on
28
+ - heading: "## External Dependencies"
29
+ description: "e.g. `- [inventory::adjustStock](../../inventory/commands/adjustStock.md) - Adjust stock quantity`"
30
+ lists:
31
+ - min: 0
32
+ type: unordered
33
+ min_items: 1
34
+
35
+ # Error handling - REQUIRED
36
+ # How errors are handled
37
+ - heading: "## Error Scenarios"
38
+ lists:
39
+ - min: 0
40
+ type: unordered
41
+ min_items: 1
42
+
43
+ # Link validation
44
+ links:
45
+ validate_internal: true
46
+ validate_files: true
47
+
48
+ # Heading rules
49
+ heading_rules:
50
+ no_skip_levels: true
51
+ unique: true
52
+ max_depth: 4
@@ -0,0 +1,58 @@
1
+ # yaml-language-server: $schema=https://raw.githubusercontent.com/jackchuka/mdschema/main/schema.json
2
+
3
+ structure:
4
+ - heading:
5
+ expr: "slug(filename) == slug(heading)"
6
+ children:
7
+ # ===================
8
+ # REQUIRED SECTIONS
9
+ # ===================
10
+
11
+ # What this feature does - REQUIRED
12
+ - heading: "## Overview"
13
+
14
+ # Business context - REQUIRED
15
+ # Why this feature exists and what problem it solves
16
+ - heading: "## Business Purpose"
17
+
18
+ # How it works - REQUIRED
19
+ # Process flow
20
+ - heading: "## Process Flow"
21
+ description: |
22
+ Describe the end-to-end process flow of this feature.
23
+ If multiple flows exist, split them into different diagrams and explain each.
24
+ code_blocks:
25
+ - lang: mermaid
26
+ min: 1
27
+
28
+ # Scenario Patterns, including edge cases - REQUIRED
29
+ - heading: "## Scenario Patterns"
30
+ lists:
31
+ - min: 1
32
+ type: unordered
33
+ min_items: 1
34
+
35
+ # Test cases must be covered - REQUIRED
36
+ - heading: "## Test Cases"
37
+ lists:
38
+ - min: 0
39
+ type: unordered
40
+ min_items: 1
41
+
42
+ # Links to any related references - REQUIRED
43
+ - heading: "## Reference Links"
44
+ lists:
45
+ - min: 0
46
+ type: unordered
47
+ min_items: 1
48
+
49
+ # Link validation
50
+ links:
51
+ validate_internal: true
52
+ validate_files: true
53
+
54
+ # Heading rules
55
+ heading_rules:
56
+ no_skip_levels: true
57
+ unique: true
58
+ max_depth: 4
@@ -0,0 +1,70 @@
1
+ # yaml-language-server: $schema=https://raw.githubusercontent.com/jackchuka/mdschema/main/schema.json
2
+ structure:
3
+ - heading:
4
+ expr: "filename == heading"
5
+ children:
6
+ - heading: "## Description"
7
+ - heading: "## Domain Model Definitions"
8
+ children:
9
+ - heading: "### Model type"
10
+ description: |
11
+ Model type must be one of Standard, AppendOnly, or Stateful
12
+ - AppendOnly: AppendOnly model where records can be added but not modified or deleted
13
+ - Stateful: Stateful model with state transitions
14
+ required_text:
15
+ - pattern: "(Standard|AppendOnly|Stateful)"
16
+ regex: true
17
+ children:
18
+ - heading: "#### State Transitions"
19
+ description: |
20
+ Define the state transitions for Stateful models.
21
+ Commands should correspond to those defined in the "### Command Definitions" section.
22
+ optional: true
23
+ code_blocks:
24
+ - lang: mermaid
25
+ min: 1
26
+
27
+ - heading: "### Command Definitions"
28
+ description: |
29
+ Definitions of commands this domain model supports.
30
+ Should match with the commands defined in modules/**/docs/commands/*.md and link to them.
31
+ Commands heavily influenced by Model type:
32
+ - Standard: Create, Update, Delete (Some model may choose to not implement Delete)
33
+ - AppendOnly: Create
34
+ - Stateful: Create, State Transition Commands
35
+ lists:
36
+ - min: 0
37
+ type: unordered
38
+ min_items: 0
39
+
40
+ - heading: "### Models"
41
+ description: |
42
+ Actual database models necessary for the domain model.
43
+ lists:
44
+ - min: 1
45
+ type: unordered
46
+ min_items: 1
47
+
48
+ - heading: "### Invariants"
49
+ description: |
50
+ Invariants that must always hold true for this domain model.
51
+ - Assume the model boundary (the unit within which consistency is guaranteed) is already defined, and list what must always be true within that boundary.
52
+ - Express each invariant as part of the concept’s definition (what makes the concept valid), not as an implementation detail (no DB constraints, computed columns, etc.).
53
+ - If a constraint depends on lifecycle state, write it explicitly as a state-scoped invariant (state x condition that must always hold).
54
+
55
+ lists:
56
+ - min: 0
57
+ type: unordered
58
+ min_items: 0
59
+
60
+ - heading: "### Relationships"
61
+
62
+ # Global link validation settings
63
+ links:
64
+ validate_internal: true # check anchor links (#section-name)
65
+ validate_files: true # check relative file links (./other.md)
66
+ # Global heading validation rules
67
+ heading_rules:
68
+ no_skip_levels: true # disallow skipping levels (e.g., h1 -> h3)
69
+ unique: true # all headings must be unique
70
+ max_depth: 4 # maximum heading depth (1-6)
@@ -0,0 +1,50 @@
1
+ # yaml-language-server: $schema=https://raw.githubusercontent.com/jackchuka/mdschema/main/schema.json
2
+
3
+ structure:
4
+ - heading: "# README"
5
+ children:
6
+ # ===================
7
+ # REQUIRED SECTIONS
8
+ # ===================
9
+
10
+ # What this module does - REQUIRED
11
+ - heading: "## Overview"
12
+
13
+ # Main capabilities - REQUIRED
14
+ - heading: "## Key Features"
15
+ lists:
16
+ - min: 1
17
+ type: unordered
18
+ min_items: 1
19
+
20
+ # Module scope - REQUIRED
21
+ - heading: "## Module Scope"
22
+ children:
23
+ - heading: "### In Scope"
24
+ lists:
25
+ - min: 1
26
+ type: unordered
27
+ min_items: 1
28
+ - heading: "### Out of Scope"
29
+ lists:
30
+ - min: 1
31
+ type: unordered
32
+ min_items: 1
33
+
34
+ # Module dependencies - REQUIRED
35
+ - heading: "## Module Dependencies"
36
+ lists:
37
+ - min: 0
38
+ type: unordered
39
+ min_items: 1
40
+
41
+ # Link validation
42
+ links:
43
+ validate_internal: true
44
+ validate_files: true
45
+
46
+ # Heading rules
47
+ heading_rules:
48
+ no_skip_levels: true
49
+ unique: true
50
+ max_depth: 3
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: 1-module-docs
3
+ description: Create ERP module documentation following framework schemas. Use when starting a new module, documenting an existing module, or when user asks to create module docs, feature docs, or design module features. Guides collaborative research, scoping, and iterative feature breakdown.
4
+ ---
5
+
6
+ # Module Documentation Workflow
7
+
8
+ Collaborative workflow for creating ERP module documentation. Human and AI work together through research, scoping, design validation, and iterative refinement.
9
+
10
+ ## Workflow Phases
11
+
12
+ ```
13
+ RESEARCH → SCOPE → DESIGN → CREATE → REVIEW
14
+ ```
15
+
16
+ ### Phase 1: Research
17
+
18
+ Study established ERP solutions for the module domain:
19
+
20
+ 1. **Web search** Odoo, Oracle ERP Cloud, SAP for the domain (e.g., "Odoo inventory management features")
21
+ 2. **Fetch documentation** from official sources when available
22
+ 3. **Identify** common features, models, workflows, compliance requirements
23
+ 4. **Summarize** findings before proceeding
24
+
25
+ Key ERP references:
26
+
27
+ - Odoo: https://www.odoo.com/documentation/19.0/applications.html
28
+ - Oracle: https://docs.oracle.com/en/cloud/saas/index.html
29
+ - SAP: Search SAP Docs
30
+
31
+ ### Phase 2: Scope
32
+
33
+ Present scope options to user. Use AskUserQuestion:
34
+
35
+ | Option | Description |
36
+ | ---------------------- | ----------------------------------------------------------------------- |
37
+ | **Minimal** | Core entities only, basic CRUD, no workflows |
38
+ | **Core (Recommended)** | Essential features for production use, foundational for other modules |
39
+ | **Comprehensive** | Full feature set including advanced workflows, compliance, integrations |
40
+
41
+ Wait for user selection before proceeding.
42
+
43
+ ### Phase 3: Design
44
+
45
+ Present features incrementally for validation:
46
+
47
+ 1. **List proposed features** as a table (feature name, purpose)
48
+ 2. **Wait for user approval** of feature list
49
+ 3. For each feature, briefly describe:
50
+ - What it does
51
+ - Key scenarios
52
+ 4. **Ask**: "Does this feature breakdown look right?"
53
+
54
+ Keep descriptions concise (~100-200 words per section). Do not present all details at once.
55
+
56
+ ### Phase 4: Create
57
+
58
+ Generate documentation following framework schemas.
59
+
60
+ **File structure:**
61
+
62
+ ```
63
+ modules/<module-name>/
64
+ ├── README.md # module.yml schema
65
+ └── docs/
66
+ └── features/
67
+ └── <feature-name>.md # feature.yml schema
68
+ ```
69
+
70
+ **Naming conventions:**
71
+
72
+ - Feature files: kebab-case (e.g., `role-based-access-control.md`)
73
+ - Headings: Title Case
74
+
75
+ Create with `erp-kit` CLI:
76
+
77
+ ```bash
78
+ erp-kit scaffold --modules-root modules module <module-name>
79
+ erp-kit scaffold --modules-root modules feature <module-name> <feature-name>
80
+ ```
81
+
82
+ ### Phase 5: Review
83
+
84
+ After creating docs, user reviews and may request changes:
85
+
86
+ **Split detection**: If a feature covers multiple distinct workflows, split into separate feature files.
87
+
88
+ **Iteration pattern:**
89
+
90
+ 1. User identifies issue (e.g., "X is too broad, split it")
91
+ 2. Create new feature file for split-out content
92
+ 3. Remove split content from original file
93
+ 4. Update README.md feature list if needed
94
+
95
+ Continue iterating until user approves.
96
+
97
+ # Framework Schemas Reference
98
+
99
+ Schemas are bundled in `@tailor-platform/erp-kit`.
100
+
101
+ ## Validation
102
+
103
+ Always run before completing:
104
+
105
+ ```bash
106
+ pnpm run module:doc:check
107
+ ```