@decohere/create 0.0.1-dev.17 → 0.0.1-dev.18

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 (186) hide show
  1. package/commonjs/src/cli.js +26 -5
  2. package/commonjs/src/models/compose.model.js +82 -0
  3. package/commonjs/src/models/config-yaml.model.js +34 -0
  4. package/commonjs/src/models/const.js +29 -0
  5. package/commonjs/src/models/container-image.model.js +88 -0
  6. package/commonjs/src/models/dev-container.model.js +73 -0
  7. package/commonjs/src/models/env-file.model.js +33 -0
  8. package/commonjs/src/models/gitignore.model.js +32 -0
  9. package/commonjs/src/models/launch-json.model.js +52 -0
  10. package/commonjs/src/models/package-json.model.js +64 -0
  11. package/commonjs/src/models/project.model.js +126 -0
  12. package/commonjs/src/models/source-file.js +6 -0
  13. package/commonjs/src/models/tsconfig.model.js +34 -0
  14. package/commonjs/src/models/vscode-settings.model.js +31 -0
  15. package/commonjs/src/services/scaffold.service.js +62 -0
  16. package/commonjs/src/webapi/create-api.js +169 -0
  17. package/commonjs/src/webapi/features/auth.feature.js +166 -0
  18. package/commonjs/src/webapi/features/auth0-cli.js +151 -0
  19. package/commonjs/src/webapi/features/database.feature.js +151 -0
  20. package/commonjs/src/webapi/features/finalize.feature.js +46 -0
  21. package/commonjs/src/webapi/features/postman.feature.js +309 -0
  22. package/commonjs/src/webapi/models/api-package-json.model.js +57 -0
  23. package/commonjs/src/webapi/models/auth-config.model.js +23 -0
  24. package/commonjs/src/webapi/models/controller-source-file.model.js +180 -0
  25. package/commonjs/src/webapi/models/main-source-file.model.js +132 -0
  26. package/commonjs/src/webapi/models/sample-files.model.js +60 -0
  27. package/commonjs/v1/cli.js +15 -0
  28. package/commonjs/v1/domain/class-model.js +106 -0
  29. package/commonjs/v1/domain/compose.model.js +74 -0
  30. package/commonjs/v1/domain/context.js +53 -0
  31. package/commonjs/v1/domain/devcontainer.model.js +116 -0
  32. package/commonjs/v1/domain/dockerfile.model.js +62 -0
  33. package/commonjs/v1/domain/feature.js +19 -0
  34. package/commonjs/v1/domain/import-map.js +74 -0
  35. package/commonjs/v1/domain/index.js +68 -0
  36. package/commonjs/v1/domain/prompt.js +45 -0
  37. package/commonjs/v1/domain/workflow.js +37 -0
  38. package/commonjs/v1/features/api-core/feature.js +103 -0
  39. package/commonjs/v1/features/api-core/hello-controller.model.js +100 -0
  40. package/commonjs/v1/features/api-core/main-ts.model.js +85 -0
  41. package/commonjs/v1/features/api-core/scaffold-files.template.js +158 -0
  42. package/commonjs/v1/features/auth0/auth0-cli.js +151 -0
  43. package/commonjs/v1/features/auth0/feature.js +187 -0
  44. package/commonjs/v1/features/auth0/models.js +14 -0
  45. package/commonjs/v1/features/auth0/prod-config.template.js +19 -0
  46. package/commonjs/v1/features/cli-core/feature.js +37 -0
  47. package/commonjs/v1/features/cli-core/scaffold-files.template.js +103 -0
  48. package/commonjs/v1/features/devcontainer/feature.js +38 -0
  49. package/commonjs/v1/features/finalize/feature.js +48 -0
  50. package/commonjs/v1/features/postgresql/feature.js +81 -0
  51. package/commonjs/v1/features/postgresql/models.js +14 -0
  52. package/commonjs/v1/features/postman/collection.template.js +80 -0
  53. package/commonjs/v1/features/postman/environment.template.js +24 -0
  54. package/commonjs/v1/features/postman/feature.js +192 -0
  55. package/commonjs/v1/features/typeorm/feature.js +66 -0
  56. package/commonjs/v1/features/typeorm/scaffold-files.template.js +80 -0
  57. package/commonjs/v1/scaffold.js +50 -0
  58. package/commonjs/v1/version.js +32 -0
  59. package/commonjs/v1/workflows/api.js +29 -0
  60. package/commonjs/v1/workflows/cli.js +19 -0
  61. package/es6/src/cli.js +26 -5
  62. package/es6/src/models/compose.model.js +77 -0
  63. package/es6/src/models/config-yaml.model.js +30 -0
  64. package/es6/src/models/const.js +19 -0
  65. package/es6/src/models/container-image.model.js +84 -0
  66. package/es6/src/models/dev-container.model.js +68 -0
  67. package/es6/src/models/env-file.model.js +29 -0
  68. package/es6/src/models/gitignore.model.js +22 -0
  69. package/es6/src/models/launch-json.model.js +42 -0
  70. package/es6/src/models/package-json.model.js +60 -0
  71. package/es6/src/models/project.model.js +111 -0
  72. package/es6/src/models/source-file.js +3 -0
  73. package/es6/src/models/tsconfig.model.js +24 -0
  74. package/es6/src/models/vscode-settings.model.js +21 -0
  75. package/es6/src/services/scaffold.service.js +52 -0
  76. package/es6/src/webapi/create-api.js +151 -0
  77. package/es6/src/webapi/features/auth.feature.js +115 -0
  78. package/es6/src/webapi/features/auth0-cli.js +116 -0
  79. package/es6/src/webapi/features/database.feature.js +141 -0
  80. package/es6/src/webapi/features/finalize.feature.js +36 -0
  81. package/es6/src/webapi/features/postman.feature.js +258 -0
  82. package/es6/src/webapi/models/api-package-json.model.js +52 -0
  83. package/es6/src/webapi/models/auth-config.model.js +19 -0
  84. package/es6/src/webapi/models/controller-source-file.model.js +171 -0
  85. package/es6/src/webapi/models/main-source-file.model.js +128 -0
  86. package/es6/src/webapi/models/sample-files.model.js +42 -0
  87. package/es6/v1/cli.js +11 -0
  88. package/es6/v1/domain/class-model.js +104 -0
  89. package/es6/v1/domain/compose.model.js +61 -0
  90. package/es6/v1/domain/context.js +37 -0
  91. package/es6/v1/domain/devcontainer.model.js +104 -0
  92. package/es6/v1/domain/dockerfile.model.js +52 -0
  93. package/es6/v1/domain/feature.js +9 -0
  94. package/es6/v1/domain/import-map.js +64 -0
  95. package/es6/v1/domain/index.js +11 -0
  96. package/es6/v1/domain/prompt.js +27 -0
  97. package/es6/v1/domain/workflow.js +24 -0
  98. package/es6/v1/features/api-core/feature.js +93 -0
  99. package/es6/v1/features/api-core/hello-controller.model.js +96 -0
  100. package/es6/v1/features/api-core/main-ts.model.js +74 -0
  101. package/es6/v1/features/api-core/scaffold-files.template.js +116 -0
  102. package/es6/v1/features/auth0/auth0-cli.js +116 -0
  103. package/es6/v1/features/auth0/feature.js +136 -0
  104. package/es6/v1/features/auth0/models.js +4 -0
  105. package/es6/v1/features/auth0/prod-config.template.js +9 -0
  106. package/es6/v1/features/cli-core/feature.js +27 -0
  107. package/es6/v1/features/cli-core/scaffold-files.template.js +73 -0
  108. package/es6/v1/features/devcontainer/feature.js +28 -0
  109. package/es6/v1/features/finalize/feature.js +38 -0
  110. package/es6/v1/features/postgresql/feature.js +71 -0
  111. package/es6/v1/features/postgresql/models.js +4 -0
  112. package/es6/v1/features/postman/collection.template.js +70 -0
  113. package/es6/v1/features/postman/environment.template.js +14 -0
  114. package/es6/v1/features/postman/feature.js +141 -0
  115. package/es6/v1/features/typeorm/feature.js +56 -0
  116. package/es6/v1/features/typeorm/scaffold-files.template.js +56 -0
  117. package/es6/v1/scaffold.js +40 -0
  118. package/es6/v1/version.js +22 -0
  119. package/es6/v1/workflows/api.js +25 -0
  120. package/es6/v1/workflows/cli.js +9 -0
  121. package/package.json +2 -2
  122. package/types/src/models/compose.model.d.ts +32 -0
  123. package/types/src/models/config-yaml.model.d.ts +16 -0
  124. package/types/src/models/const.d.ts +17 -0
  125. package/types/src/models/container-image.model.d.ts +15 -0
  126. package/types/src/models/dev-container.model.d.ts +21 -0
  127. package/types/src/models/env-file.model.d.ts +14 -0
  128. package/types/src/models/gitignore.model.d.ts +6 -0
  129. package/types/src/models/launch-json.model.d.ts +5 -0
  130. package/types/src/models/package-json.model.d.ts +18 -0
  131. package/types/src/models/project.model.d.ts +55 -0
  132. package/types/src/models/source-file.d.ts +11 -0
  133. package/types/src/models/tsconfig.model.d.ts +5 -0
  134. package/types/src/models/vscode-settings.model.d.ts +7 -0
  135. package/types/src/services/scaffold.service.d.ts +22 -0
  136. package/types/src/webapi/create-api.d.ts +7 -0
  137. package/types/src/webapi/features/auth.feature.d.ts +7 -0
  138. package/types/src/webapi/features/auth0-cli.d.ts +22 -0
  139. package/types/src/webapi/features/database.feature.d.ts +5 -0
  140. package/types/src/webapi/features/finalize.feature.d.ts +2 -0
  141. package/types/src/webapi/features/postman.feature.d.ts +7 -0
  142. package/types/src/webapi/models/api-package-json.model.d.ts +17 -0
  143. package/types/src/webapi/models/auth-config.model.d.ts +18 -0
  144. package/types/src/webapi/models/controller-source-file.model.d.ts +42 -0
  145. package/types/src/webapi/models/main-source-file.model.d.ts +36 -0
  146. package/types/src/webapi/models/sample-files.model.d.ts +7 -0
  147. package/types/v1/cli.d.ts +2 -0
  148. package/types/v1/domain/class-model.d.ts +70 -0
  149. package/types/v1/domain/compose.model.d.ts +25 -0
  150. package/types/v1/domain/context.d.ts +36 -0
  151. package/types/v1/domain/devcontainer.model.d.ts +35 -0
  152. package/types/v1/domain/dockerfile.model.d.ts +11 -0
  153. package/types/v1/domain/feature.d.ts +29 -0
  154. package/types/v1/domain/import-map.d.ts +24 -0
  155. package/types/v1/domain/index.d.ts +12 -0
  156. package/types/v1/domain/prompt.d.ts +2 -0
  157. package/types/v1/domain/workflow.d.ts +14 -0
  158. package/types/v1/features/api-core/feature.d.ts +2 -0
  159. package/types/v1/features/api-core/hello-controller.model.d.ts +9 -0
  160. package/types/v1/features/api-core/main-ts.model.d.ts +31 -0
  161. package/types/v1/features/api-core/scaffold-files.template.d.ts +10 -0
  162. package/types/v1/features/auth0/auth0-cli.d.ts +22 -0
  163. package/types/v1/features/auth0/feature.d.ts +2 -0
  164. package/types/v1/features/auth0/models.d.ts +5 -0
  165. package/types/v1/features/auth0/prod-config.template.d.ts +1 -0
  166. package/types/v1/features/cli-core/feature.d.ts +2 -0
  167. package/types/v1/features/cli-core/scaffold-files.template.d.ts +6 -0
  168. package/types/v1/features/devcontainer/feature.d.ts +2 -0
  169. package/types/v1/features/finalize/feature.d.ts +2 -0
  170. package/types/v1/features/postgresql/feature.d.ts +2 -0
  171. package/types/v1/features/postgresql/models.d.ts +6 -0
  172. package/types/v1/features/postman/collection.template.d.ts +1 -0
  173. package/types/v1/features/postman/environment.template.d.ts +6 -0
  174. package/types/v1/features/postman/feature.d.ts +2 -0
  175. package/types/v1/features/typeorm/feature.d.ts +2 -0
  176. package/types/v1/features/typeorm/scaffold-files.template.d.ts +9 -0
  177. package/types/v1/scaffold.d.ts +3 -0
  178. package/types/v1/version.d.ts +2 -0
  179. package/types/v1/workflows/api.d.ts +8 -0
  180. package/types/v1/workflows/cli.d.ts +1 -0
  181. package/commonjs/src/scaffold.js +0 -89
  182. package/commonjs/src/templates.js +0 -306
  183. package/es6/src/scaffold.js +0 -79
  184. package/es6/src/templates.js +0 -246
  185. package/types/src/scaffold.d.ts +0 -6
  186. package/types/src/templates.d.ts +0 -20
@@ -0,0 +1,25 @@
1
+ import { defineWorkflow } from "../domain/index.js";
2
+ import { apiCoreFeature } from "../features/api-core/feature.js";
3
+ import { auth0Feature } from "../features/auth0/feature.js";
4
+ import { devcontainerFeature } from "../features/devcontainer/feature.js";
5
+ import { finalizeFeature } from "../features/finalize/feature.js";
6
+ import { postgresqlFeature } from "../features/postgresql/feature.js";
7
+ import { postmanFeature } from "../features/postman/feature.js";
8
+ import { typeormFeature } from "../features/typeorm/feature.js";
9
+ /**
10
+ * Order matters within each phase:
11
+ * - apiCore must render before typeorm (typeorm reads the config.yaml that
12
+ * apiCore writes).
13
+ * - typeorm must render before auth0 (both append to config.prod.yaml; the
14
+ * existing behaviour writes the database section first, then auth).
15
+ */ export const apiWorkflow = defineWorkflow("api", [
16
+ apiCoreFeature,
17
+ typeormFeature,
18
+ postgresqlFeature,
19
+ auth0Feature,
20
+ postmanFeature,
21
+ devcontainerFeature,
22
+ finalizeFeature
23
+ ]);
24
+
25
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2RlY29oZXJlL2RlY29oZXJlL3Byb2plY3RzL2NyZWF0ZS92MS93b3JrZmxvd3MvYXBpLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGRlZmluZVdvcmtmbG93IH0gZnJvbSBcIi4uL2RvbWFpbi9pbmRleC5qc1wiO1xuaW1wb3J0IHsgYXBpQ29yZUZlYXR1cmUgfSBmcm9tIFwiLi4vZmVhdHVyZXMvYXBpLWNvcmUvZmVhdHVyZS5qc1wiO1xuaW1wb3J0IHsgYXV0aDBGZWF0dXJlIH0gZnJvbSBcIi4uL2ZlYXR1cmVzL2F1dGgwL2ZlYXR1cmUuanNcIjtcbmltcG9ydCB7IGRldmNvbnRhaW5lckZlYXR1cmUgfSBmcm9tIFwiLi4vZmVhdHVyZXMvZGV2Y29udGFpbmVyL2ZlYXR1cmUuanNcIjtcbmltcG9ydCB7IGZpbmFsaXplRmVhdHVyZSB9IGZyb20gXCIuLi9mZWF0dXJlcy9maW5hbGl6ZS9mZWF0dXJlLmpzXCI7XG5pbXBvcnQgeyBwb3N0Z3Jlc3FsRmVhdHVyZSB9IGZyb20gXCIuLi9mZWF0dXJlcy9wb3N0Z3Jlc3FsL2ZlYXR1cmUuanNcIjtcbmltcG9ydCB7IHBvc3RtYW5GZWF0dXJlIH0gZnJvbSBcIi4uL2ZlYXR1cmVzL3Bvc3RtYW4vZmVhdHVyZS5qc1wiO1xuaW1wb3J0IHsgdHlwZW9ybUZlYXR1cmUgfSBmcm9tIFwiLi4vZmVhdHVyZXMvdHlwZW9ybS9mZWF0dXJlLmpzXCI7XG5cbi8qKlxuICogT3JkZXIgbWF0dGVycyB3aXRoaW4gZWFjaCBwaGFzZTpcbiAqICAgLSBhcGlDb3JlIG11c3QgcmVuZGVyIGJlZm9yZSB0eXBlb3JtICh0eXBlb3JtIHJlYWRzIHRoZSBjb25maWcueWFtbCB0aGF0XG4gKiAgICAgYXBpQ29yZSB3cml0ZXMpLlxuICogICAtIHR5cGVvcm0gbXVzdCByZW5kZXIgYmVmb3JlIGF1dGgwIChib3RoIGFwcGVuZCB0byBjb25maWcucHJvZC55YW1sOyB0aGVcbiAqICAgICBleGlzdGluZyBiZWhhdmlvdXIgd3JpdGVzIHRoZSBkYXRhYmFzZSBzZWN0aW9uIGZpcnN0LCB0aGVuIGF1dGgpLlxuICovXG5leHBvcnQgY29uc3QgYXBpV29ya2Zsb3cgPSBkZWZpbmVXb3JrZmxvdyhcImFwaVwiLCBbXG5cdGFwaUNvcmVGZWF0dXJlLFxuXHR0eXBlb3JtRmVhdHVyZSxcblx0cG9zdGdyZXNxbEZlYXR1cmUsXG5cdGF1dGgwRmVhdHVyZSxcblx0cG9zdG1hbkZlYXR1cmUsXG5cdGRldmNvbnRhaW5lckZlYXR1cmUsXG5cdGZpbmFsaXplRmVhdHVyZSxcbl0pO1xuIl0sIm5hbWVzIjpbImRlZmluZVdvcmtmbG93IiwiYXBpQ29yZUZlYXR1cmUiLCJhdXRoMEZlYXR1cmUiLCJkZXZjb250YWluZXJGZWF0dXJlIiwiZmluYWxpemVGZWF0dXJlIiwicG9zdGdyZXNxbEZlYXR1cmUiLCJwb3N0bWFuRmVhdHVyZSIsInR5cGVvcm1GZWF0dXJlIiwiYXBpV29ya2Zsb3ciXSwibWFwcGluZ3MiOiJBQUFBLFNBQVNBLGNBQWMsUUFBUSxxQkFBcUI7QUFDcEQsU0FBU0MsY0FBYyxRQUFRLGtDQUFrQztBQUNqRSxTQUFTQyxZQUFZLFFBQVEsK0JBQStCO0FBQzVELFNBQVNDLG1CQUFtQixRQUFRLHNDQUFzQztBQUMxRSxTQUFTQyxlQUFlLFFBQVEsa0NBQWtDO0FBQ2xFLFNBQVNDLGlCQUFpQixRQUFRLG9DQUFvQztBQUN0RSxTQUFTQyxjQUFjLFFBQVEsaUNBQWlDO0FBQ2hFLFNBQVNDLGNBQWMsUUFBUSxpQ0FBaUM7QUFFaEU7Ozs7OztDQU1DLEdBQ0QsT0FBTyxNQUFNQyxjQUFjUixlQUFlLE9BQU87SUFDaERDO0lBQ0FNO0lBQ0FGO0lBQ0FIO0lBQ0FJO0lBQ0FIO0lBQ0FDO0NBQ0EsRUFBRSJ9
@@ -0,0 +1,9 @@
1
+ import { defineWorkflow } from "../domain/index.js";
2
+ import { cliCoreFeature } from "../features/cli-core/feature.js";
3
+ import { finalizeFeature } from "../features/finalize/feature.js";
4
+ export const cliWorkflow = defineWorkflow("cli", [
5
+ cliCoreFeature,
6
+ finalizeFeature
7
+ ]);
8
+
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2RlY29oZXJlL2RlY29oZXJlL3Byb2plY3RzL2NyZWF0ZS92MS93b3JrZmxvd3MvY2xpLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGRlZmluZVdvcmtmbG93IH0gZnJvbSBcIi4uL2RvbWFpbi9pbmRleC5qc1wiO1xuaW1wb3J0IHsgY2xpQ29yZUZlYXR1cmUgfSBmcm9tIFwiLi4vZmVhdHVyZXMvY2xpLWNvcmUvZmVhdHVyZS5qc1wiO1xuaW1wb3J0IHsgZmluYWxpemVGZWF0dXJlIH0gZnJvbSBcIi4uL2ZlYXR1cmVzL2ZpbmFsaXplL2ZlYXR1cmUuanNcIjtcblxuZXhwb3J0IGNvbnN0IGNsaVdvcmtmbG93ID0gZGVmaW5lV29ya2Zsb3coXCJjbGlcIiwgW2NsaUNvcmVGZWF0dXJlLCBmaW5hbGl6ZUZlYXR1cmVdKTtcbiJdLCJuYW1lcyI6WyJkZWZpbmVXb3JrZmxvdyIsImNsaUNvcmVGZWF0dXJlIiwiZmluYWxpemVGZWF0dXJlIiwiY2xpV29ya2Zsb3ciXSwibWFwcGluZ3MiOiJBQUFBLFNBQVNBLGNBQWMsUUFBUSxxQkFBcUI7QUFDcEQsU0FBU0MsY0FBYyxRQUFRLGtDQUFrQztBQUNqRSxTQUFTQyxlQUFlLFFBQVEsa0NBQWtDO0FBRWxFLE9BQU8sTUFBTUMsY0FBY0gsZUFBZSxPQUFPO0lBQUNDO0lBQWdCQztDQUFnQixFQUFFIn0=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decohere/create",
3
- "version": "0.0.1-dev.17",
3
+ "version": "0.0.1-dev.18",
4
4
  "description": "Scaffold a new Decohere project — build with Forge, serve with Flux",
5
5
  "keywords": [
6
6
  "decohere",
@@ -21,7 +21,7 @@
21
21
  "test": "echo \"Error: no test specified\" && exit 1"
22
22
  },
23
23
  "dependencies": {
24
- "@decohere/nexus": "0.0.1-dev.17",
24
+ "@decohere/nexus": "0.0.1-dev.18",
25
25
  "commander": "^13.1.0"
26
26
  },
27
27
  "devDependencies": {}
@@ -0,0 +1,32 @@
1
+ import type { KeyedModel } from "./source-file.js";
2
+ export interface ComposeService {
3
+ build?: string;
4
+ image?: string;
5
+ env_file?: string[];
6
+ environment?: Record<string, string>;
7
+ ports?: string[];
8
+ volumes?: string[];
9
+ command?: string;
10
+ restart?: string;
11
+ depends_on?: string[];
12
+ }
13
+ /**
14
+ * Live builder for `docker-compose.yml`.
15
+ *
16
+ * Features call `addService` / `addVolume` in their `configure` phases.
17
+ * The devcontainer `render` phase calls `render()` and writes the file.
18
+ */
19
+ export declare class DockerCompose implements KeyedModel {
20
+ readonly key: string;
21
+ private readonly _services;
22
+ private readonly _volumes;
23
+ addService(name: string, config: ComposeService): this;
24
+ files(): {
25
+ filePath: string;
26
+ content: string;
27
+ }[];
28
+ addVolume(name: string): this;
29
+ /** Append an env_file path to an existing service. */
30
+ addEnvFile(serviceName: string, filePath: string): this;
31
+ getContent(): string;
32
+ }
@@ -0,0 +1,16 @@
1
+ import type { KeyedModel, SourceFile } from "./source-file.js";
2
+ /**
3
+ * Builder for a YAML config file (e.g. config/config.yaml or config/config.dev.yaml).
4
+ *
5
+ * Starts with a base section passed to the constructor. Features call
6
+ * `addSection(yaml)` during their scaffold phase to append their own block.
7
+ * `files()` joins all sections with a blank line separator.
8
+ */
9
+ export declare class ConfigYaml implements KeyedModel {
10
+ readonly key: string;
11
+ private readonly filePath;
12
+ private readonly _sections;
13
+ constructor(key: string, filePath: string, baseContent: string);
14
+ addSection(yaml: string): this;
15
+ files(): SourceFile[];
16
+ }
@@ -0,0 +1,17 @@
1
+ export declare const WELL_KNOWN_FILES: {
2
+ VSCODE_SETTINGS: string;
3
+ LAUNCH_JSON: string;
4
+ DOCKER_COMPOSE: string;
5
+ DEVCONTAINER_JSON: string;
6
+ DOCKERFILE: string;
7
+ PACKAGE_JSON: string;
8
+ API_PACKAGE_JSON: string;
9
+ TSCONFIG: string;
10
+ MAIN_TS: string;
11
+ CONTROLLER_TS: string;
12
+ CONFIG_YAML: string;
13
+ CONFIG_DEV_YAML: string;
14
+ GITIGNORE: string;
15
+ AUTH_CONFIG: string;
16
+ ENV_FILE: string;
17
+ };
@@ -0,0 +1,15 @@
1
+ import type { KeyedModel, SourceFile } from "./source-file.js";
2
+ /**
3
+ * Builder for `.devcontainer/Dockerfile`.
4
+ *
5
+ * Features call `addRunStep(cmd)` during their scaffold phase to append
6
+ * additional `RUN` instructions before the final `USER` instruction.
7
+ * `files()` assembles the complete Dockerfile content at render time.
8
+ */
9
+ export declare class DockerfileModel implements KeyedModel {
10
+ readonly key: string;
11
+ private readonly _runSteps;
12
+ /** Append a RUN instruction (pass the command, not the RUN keyword). */
13
+ addRunStep(cmd: string): this;
14
+ files(): SourceFile[];
15
+ }
@@ -0,0 +1,21 @@
1
+ import type { KeyedModel, SourceFile } from "./source-file.js";
2
+ /**
3
+ * Model for `.devcontainer/devcontainer.json`.
4
+ *
5
+ * Features call builder methods (`addExtension`, `forwardPort`, etc.) during
6
+ * their configure phase. `MonoRepoScaffold` calls `files()` at render time.
7
+ */
8
+ export declare class DevContainer implements KeyedModel {
9
+ readonly key: string;
10
+ private readonly _extensions;
11
+ private readonly _ports;
12
+ private readonly _mounts;
13
+ private _postStartCommand?;
14
+ private _useCompose;
15
+ constructor();
16
+ addExtension(...ids: string[]): this;
17
+ forwardPort(...ports: number[]): this;
18
+ setPostStartCommand(cmd: string): this;
19
+ useCompose(): this;
20
+ files(): SourceFile[];
21
+ }
@@ -0,0 +1,14 @@
1
+ import type { KeyedModel, SourceFile } from "./source-file.js";
2
+ /**
3
+ * Accumulates key=value pairs and renders them as a `.env` file.
4
+ *
5
+ * Register once in the workspace; features call `addEntry` during their
6
+ * scaffold phase to contribute environment variables. The final file is
7
+ * written at render time when `workspace.scaffold()` is called.
8
+ */
9
+ export declare class EnvFile implements KeyedModel {
10
+ readonly key: string;
11
+ private readonly _entries;
12
+ addEntry(key: string, value: string): this;
13
+ files(): SourceFile[];
14
+ }
@@ -0,0 +1,6 @@
1
+ import type { KeyedModel, SourceFile } from "./source-file.js";
2
+ export declare class Gitignore implements KeyedModel {
3
+ readonly key: string;
4
+ private ignoreList;
5
+ files(): SourceFile[];
6
+ }
@@ -0,0 +1,5 @@
1
+ import type { KeyedModel, SourceFile } from "./source-file.js";
2
+ export declare class LaunchJson implements KeyedModel {
3
+ readonly key: string;
4
+ files(): SourceFile[];
5
+ }
@@ -0,0 +1,18 @@
1
+ import type { KeyedModel, SourceFile } from "./source-file.js";
2
+ /**
3
+ * Builder for the root `package.json`.
4
+ *
5
+ * Starts with the core API dependencies. Features call `addDependency` /
6
+ * `addDevDependency` during their scaffold phase to inject their own deps
7
+ * before `files()` is called at render time.
8
+ */
9
+ export declare class PackageJson implements KeyedModel {
10
+ private readonly name;
11
+ readonly key: string;
12
+ private readonly _dependencies;
13
+ private readonly _devDependencies;
14
+ constructor(name: string);
15
+ addDependency(name: string, version: string): this;
16
+ addDevDependency(name: string, version: string): this;
17
+ files(): SourceFile[];
18
+ }
@@ -0,0 +1,55 @@
1
+ import type { KeyedModel, SourceFile, SourceFileProvider } from "./source-file.js";
2
+ /**
3
+ * A sub-unit of the monorepo (e.g. `projects/api`).
4
+ *
5
+ * Models and files registered here produce paths relative to `dir`. The parent
6
+ * `MonoRepoScaffold` calls `files()` and prepends `dir/` to every path, so
7
+ * models remain unaware of where they live in the repo.
8
+ */
9
+ export declare class ProjectScaffold {
10
+ readonly dir: string;
11
+ private readonly _models;
12
+ private readonly _files;
13
+ constructor(dir: string);
14
+ addModel<T extends KeyedModel>(model: T): T;
15
+ addFile(provider: SourceFileProvider): this;
16
+ getModel<T extends SourceFileProvider>(key: string): T | undefined;
17
+ getModels<T extends SourceFileProvider>(ctor: new (...args: never[]) => T): T[];
18
+ /** Returns all files with `dir/` prepended to each path. */
19
+ files(): SourceFile[];
20
+ }
21
+ export declare abstract class WorkspaceScaffold {
22
+ readonly files: SourceFile[];
23
+ targetDir: string;
24
+ /** Derived from the basename of targetDir. */
25
+ get name(): string;
26
+ /** Add an ad-hoc file provider whose output is included at render time. */
27
+ addFile(provider: SourceFileProvider): this;
28
+ abstract addModel<T extends KeyedModel>(model: T): T;
29
+ abstract getModel<T extends SourceFileProvider>(key: string): T | undefined;
30
+ abstract getModels<T extends SourceFileProvider>(ctor: new (...args: never[]) => T): T[];
31
+ abstract getProject(dir: string): ProjectScaffold | undefined;
32
+ abstract scaffold(): Promise<void> | void;
33
+ }
34
+ export declare class MonoRepoScaffold extends WorkspaceScaffold {
35
+ private readonly _models;
36
+ private readonly _projects;
37
+ /** Register a named project. */
38
+ addProject(project: ProjectScaffold): ProjectScaffold;
39
+ /** Retrieve a previously-registered project by its directory path. */
40
+ getProject(dir: string): ProjectScaffold | undefined;
41
+ /** Register a named model at workspace level. */
42
+ addModel<T extends KeyedModel>(model: T): T;
43
+ /**
44
+ * Retrieve a model by key. Searches workspace models first, then all
45
+ * registered projects in order.
46
+ */
47
+ getModel<T extends SourceFileProvider>(key: string): T | undefined;
48
+ /**
49
+ * Retrieve all models of a given type. Searches workspace models and all
50
+ * projects, so features can discover controllers across multiple projects.
51
+ */
52
+ getModels<T extends SourceFileProvider>(ctor: new (...args: never[]) => T): T[];
53
+ /** Render all models and projects into files, then write everything to disk. */
54
+ scaffold(): Promise<void>;
55
+ }
@@ -0,0 +1,11 @@
1
+ export interface SourceFileProvider {
2
+ files(): SourceFile[];
3
+ }
4
+ /** A SourceFileProvider that knows its own registration key. */
5
+ export interface KeyedModel extends SourceFileProvider {
6
+ readonly key: string;
7
+ }
8
+ export type SourceFile = {
9
+ filePath: string;
10
+ content: string;
11
+ };
@@ -0,0 +1,5 @@
1
+ import type { KeyedModel, SourceFile } from "./source-file.js";
2
+ export declare class TsConfig implements KeyedModel {
3
+ readonly key: string;
4
+ files(): SourceFile[];
5
+ }
@@ -0,0 +1,7 @@
1
+ import type { KeyedModel, SourceFile } from "./source-file.js";
2
+ export declare class VSCodeSettings implements KeyedModel {
3
+ private readonly title;
4
+ readonly key: string;
5
+ constructor(title: string);
6
+ files(): SourceFile[];
7
+ }
@@ -0,0 +1,22 @@
1
+ import type { WorkspaceScaffold } from "../models/project.model.js";
2
+ /**
3
+ * A feature has three responsibilities:
4
+ * 1. `getOptions` — resolve provider selection and any follow-up questions.
5
+ * Receives the options collected so far; returns only the keys it owns.
6
+ * Short-circuits if the caller already supplied those keys via CLI flags.
7
+ * 2. `scaffold` — mutate the workspace models and/or write files using the
8
+ * fully-resolved options. Called after ALL features have gathered options
9
+ * but BEFORE files are written to disk.
10
+ * 3. `finalize` (optional) — run post-write actions (e.g. install dependencies).
11
+ * Called after workspace.scaffold() has flushed all files to disk.
12
+ */
13
+ export interface Feature<TOptions extends object = object> {
14
+ getOptions(workspace: WorkspaceScaffold, cliOptions: Partial<TOptions>): Promise<Partial<TOptions>>;
15
+ scaffold(workspace: WorkspaceScaffold, options: TOptions): Promise<void> | void;
16
+ finalize?(workspace: WorkspaceScaffold, options: TOptions): Promise<void> | void;
17
+ }
18
+ declare function scaffold(workspace: WorkspaceScaffold, cliOptions: object, features: Feature[]): Promise<void>;
19
+ export declare const ScaffoldService: {
20
+ scaffold: typeof scaffold;
21
+ };
22
+ export {};
@@ -0,0 +1,7 @@
1
+ export declare const WEBAPI_PROJECT_DIR = "projects/api";
2
+ export type ApiOptions = {
3
+ d?: string;
4
+ authProvider?: string;
5
+ databaseProvider?: "none" | "postgres/typeorm";
6
+ };
7
+ export declare function scaffoldApi(cliOptions: ApiOptions): Promise<void>;
@@ -0,0 +1,7 @@
1
+ import type { Feature } from "../../services/scaffold.service.js";
2
+ export type AuthOptions = {
3
+ authProvider?: "auth0" | "none";
4
+ issuerBaseUrl?: string;
5
+ audience?: string;
6
+ };
7
+ export declare const AuthFeature: Feature<AuthOptions>;
@@ -0,0 +1,22 @@
1
+ declare const REQUIRED_SCOPES = "create:clients";
2
+ export declare class Auth0AuthError extends Error {
3
+ constructor(message: string);
4
+ }
5
+ export interface Auth0Tenant {
6
+ name: string;
7
+ active?: boolean;
8
+ }
9
+ export declare function isInstalled(): boolean;
10
+ export declare function listTenants(): Auth0Tenant[];
11
+ export declare function login(): boolean;
12
+ export declare function listApis(): Array<{
13
+ identifier: string;
14
+ name: string;
15
+ }>;
16
+ export declare function createApi(name: string, identifier: string): {
17
+ identifier: string;
18
+ };
19
+ export declare function createSpaApp(name: string, callbackUrl: string): {
20
+ client_id: string;
21
+ };
22
+ export { REQUIRED_SCOPES };
@@ -0,0 +1,5 @@
1
+ import type { Feature } from "../../services/scaffold.service.js";
2
+ export type DatabaseOptions = {
3
+ databaseProvider?: "none" | "postgres/typeorm";
4
+ };
5
+ export declare const DatabaseFeature: Feature<DatabaseOptions>;
@@ -0,0 +1,2 @@
1
+ import type { Feature } from "../../services/scaffold.service.js";
2
+ export declare const FinalizeFeature: Feature;
@@ -0,0 +1,7 @@
1
+ import type { Feature } from "../../services/scaffold.service.js";
2
+ export type PostmanOptions = {
3
+ postmanProvider?: "api" | "local" | "none";
4
+ apiKey?: string;
5
+ workspaceId?: string;
6
+ };
7
+ export declare const PostmanFeature: Feature<PostmanOptions>;
@@ -0,0 +1,17 @@
1
+ import type { KeyedModel, SourceFile } from "../../models/source-file.js";
2
+ /**
3
+ * Builder for `projects/api/package.json`.
4
+ *
5
+ * Starts with the core cortex + crucible deps. Features can call
6
+ * `addDependency` / `addDevDependency` to extend.
7
+ */
8
+ export declare class ApiPackageJson implements KeyedModel {
9
+ private readonly projectName;
10
+ readonly key: string;
11
+ private readonly _dependencies;
12
+ private readonly _devDependencies;
13
+ constructor(projectName: string);
14
+ addDependency(name: string, version: string): this;
15
+ addDevDependency(name: string, version: string): this;
16
+ files(): SourceFile[];
17
+ }
@@ -0,0 +1,18 @@
1
+ import type { KeyedModel, SourceFile } from "../../models/source-file.js";
2
+ export type AuthConfig = {
3
+ issuerBaseUrl: string;
4
+ audience: string;
5
+ };
6
+ /**
7
+ * Data-carrier model for auth configuration.
8
+ *
9
+ * Registered by AuthFeature when auth0 is configured. Other features (e.g.
10
+ * PostmanFeature) retrieve it via workspace.getModel(WELL_KNOWN_FILES.AUTH_CONFIG).
11
+ * Produces no files — exists solely so features can communicate auth details.
12
+ */
13
+ export declare class AuthConfigModel implements KeyedModel {
14
+ readonly config: AuthConfig;
15
+ readonly key: string;
16
+ constructor(config: AuthConfig);
17
+ files(): SourceFile[];
18
+ }
@@ -0,0 +1,42 @@
1
+ import type { KeyedModel, SourceFile } from "../../models/source-file.js";
2
+ /**
3
+ * A controller method. Features call `addDecorator()` to prepend decorators
4
+ * before the HTTP verb decorator (e.g. `@AllowAnonymous` before `@Get()`).
5
+ */
6
+ export declare class ControllerMethod {
7
+ readonly name: string;
8
+ private readonly _httpDecorator;
9
+ private readonly _params;
10
+ private readonly _isAsync;
11
+ private readonly _body;
12
+ private readonly _extraDecorators;
13
+ constructor(name: string, _httpDecorator: string, _params: string, _isAsync: boolean, _body: string[]);
14
+ addDecorator(decorator: string): this;
15
+ render(): string[];
16
+ }
17
+ /**
18
+ * Model for `projects/api/src/controllers/hello.controller.ts`.
19
+ *
20
+ * Pre-initialised with all routes and their HTTP decorators. Features mutate
21
+ * the model via `getMethod(name).addDecorator(...)`, `addDecorator(...)` (class
22
+ * level), `addCortexImport(...)`, `addImport(...)`, and `addConstructorParam(...)`.
23
+ */
24
+ export declare class ControllerSourceFile implements KeyedModel {
25
+ readonly key: string;
26
+ private readonly _cortexImports;
27
+ private readonly _extraImportGroups;
28
+ private readonly _classDecorators;
29
+ private readonly _ctorParams;
30
+ private readonly _methods;
31
+ /** Retrieve a method by name to mutate its decorators. */
32
+ getMethod(name: string): ControllerMethod;
33
+ /** Add a class-level decorator (e.g. `@Authorize`). */
34
+ addDecorator(decorator: string): this;
35
+ /** Add a named import from `@decohere/cortex`. */
36
+ addCortexImport(name: string, typeOnly?: boolean): this;
37
+ /** Add a named import from any other module. */
38
+ addImport(name: string, from: string, typeOnly?: boolean): this;
39
+ /** Add a constructor parameter (e.g. an injected dependency). */
40
+ addConstructorParam(param: string): this;
41
+ files(): SourceFile[];
42
+ }
@@ -0,0 +1,36 @@
1
+ import type { KeyedModel, SourceFile } from "../../models/source-file.js";
2
+ export type TypeOrmImport = {
3
+ className: string;
4
+ importPath: string;
5
+ };
6
+ /**
7
+ * Model for `projects/api/src/main.ts`.
8
+ *
9
+ * Starts with the minimal HTTP + YAML config setup. Features mutate the model
10
+ * by calling addSideEffectImport / addImport / addBuilderCall / addEntity /
11
+ * addRepository. files() renders whatever has been accumulated.
12
+ */
13
+ export declare class MainSourceFile implements KeyedModel {
14
+ private readonly appName;
15
+ readonly key: string;
16
+ private readonly _sideEffectImports;
17
+ private readonly _extraImports;
18
+ private readonly _builderCalls;
19
+ private readonly _entities;
20
+ private readonly _repositories;
21
+ constructor(appName: string);
22
+ /** Adds a bare side-effect import, e.g. `@decohere/cortex/auth`. */
23
+ addSideEffectImport(path: string): this;
24
+ /** Adds a named import, e.g. `import { Foo } from "bar"`. */
25
+ addImport(name: string, from: string, typeOnly?: boolean): this;
26
+ /**
27
+ * Adds a builder call inserted after `.withConfiguration()` and before
28
+ * `.withServices()`. Pass the call without leading dot, e.g. `.withAuth()`.
29
+ */
30
+ addBuilderCall(call: string): this;
31
+ /** Adds a TypeORM entity — import and entry in `withTypeOrm({ entities })`. */
32
+ addEntity(entity: TypeOrmImport): this;
33
+ /** Adds a TypeORM repository — import and entry in `withTypeOrm({ repositories })`. */
34
+ addRepository(repo: TypeOrmImport): this;
35
+ files(): SourceFile[];
36
+ }
@@ -0,0 +1,7 @@
1
+ import type { SourceFile, SourceFileProvider } from "../../models/source-file.js";
2
+ export declare class SampleConfigModel implements SourceFileProvider {
3
+ files(): SourceFile[];
4
+ }
5
+ export declare class SampleServiceModel implements SourceFileProvider {
6
+ files(): SourceFile[];
7
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,70 @@
1
+ import { ImportMap } from "./import-map.js";
2
+ export interface ConstructorParam {
3
+ /** e.g. ["@inject(IPrincipalProviderToken)"] */
4
+ paramDecorators: string[];
5
+ name: string;
6
+ typeName: string;
7
+ isPrivate: boolean;
8
+ isReadonly: boolean;
9
+ }
10
+ export interface MethodParam {
11
+ /** e.g. `@Query("filter")` */
12
+ decorator?: string;
13
+ name: string;
14
+ typeName: string;
15
+ }
16
+ export interface MethodDef {
17
+ /** Base HTTP decorator(s), e.g. ["@Get()"]. Rendered bottom-most. */
18
+ decorators: string[];
19
+ name: string;
20
+ isAsync?: boolean;
21
+ params?: MethodParam[];
22
+ body: string;
23
+ }
24
+ export interface BodyClassField {
25
+ decorator: string;
26
+ name: string;
27
+ typeName: string;
28
+ }
29
+ export interface BodyClassDef {
30
+ name: string;
31
+ fields: BodyClassField[];
32
+ }
33
+ /**
34
+ * A live, mutable model of a generated TypeScript class.
35
+ *
36
+ * Features call the fluent API to contribute imports, decorators, constructor
37
+ * params, and method decorators. When all configure phases are done, `render()`
38
+ * produces the final TypeScript source.
39
+ *
40
+ * Subclass to model controllers, services, repositories, etc.
41
+ */
42
+ export declare class ClassModel {
43
+ readonly className: string;
44
+ readonly fileName: string;
45
+ protected readonly _imports: ImportMap;
46
+ private readonly _classDecorators;
47
+ private readonly _constructorParams;
48
+ private readonly _bodyClasses;
49
+ private readonly _methods;
50
+ constructor(className: string, fileName: string);
51
+ /**
52
+ * Add named value imports from `pkg`.
53
+ * Called with no names, registers a side-effect `import "pkg"`.
54
+ */
55
+ addImport(pkg: string, ...names: string[]): this;
56
+ /** Add named type-only imports from `pkg`. */
57
+ addTypeImport(pkg: string, ...names: string[]): this;
58
+ /** Prepend a class-level decorator (goes above any already-registered ones). */
59
+ decorateClass(decorator: string): this;
60
+ addBodyClass(def: BodyClassDef): this;
61
+ addConstructorParam(param: ConstructorParam): this;
62
+ defineMethod(def: MethodDef): this;
63
+ /**
64
+ * Prepend a decorator onto an existing method.
65
+ * Silently ignored if `methodName` is not found, so features are
66
+ * resilient to controllers that don't expose a particular method.
67
+ */
68
+ decorateMethod(methodName: string, ...decorators: string[]): this;
69
+ render(): string;
70
+ }
@@ -0,0 +1,25 @@
1
+ export declare const COMPOSE_KEY: import("./context.js").FeatureModelKey<ComposeModel>;
2
+ export interface ComposeService {
3
+ build?: string;
4
+ image?: string;
5
+ env_file?: string[];
6
+ environment?: Record<string, string>;
7
+ ports?: string[];
8
+ volumes?: string[];
9
+ command?: string;
10
+ restart?: string;
11
+ depends_on?: string[];
12
+ }
13
+ /**
14
+ * Live builder for `docker-compose.yml`.
15
+ *
16
+ * Features call `addService` / `addVolume` in their `configure` phases.
17
+ * The devcontainer `render` phase calls `render()` and writes the file.
18
+ */
19
+ export declare class ComposeModel {
20
+ private readonly _services;
21
+ private readonly _volumes;
22
+ addService(name: string, config: ComposeService): this;
23
+ addVolume(name: string): this;
24
+ render(): string;
25
+ }
@@ -0,0 +1,36 @@
1
+ import type { ClassModel } from "./class-model.js";
2
+ /** Type-safe key for a value in the FeatureModelStore. */
3
+ export interface FeatureModelKey<T> {
4
+ readonly _sym: symbol;
5
+ readonly _type?: T;
6
+ }
7
+ export declare function modelKey<T>(name?: string): FeatureModelKey<T>;
8
+ /**
9
+ * Immutable typed store of feature models. Each feature defines its own keys
10
+ * (typed via `modelKey<T>()`) and writes to / reads from the store during the
11
+ * `configure` and `render` phases. The store is the only mechanism by which
12
+ * features communicate.
13
+ */
14
+ export declare class FeatureModelStore {
15
+ private readonly _store;
16
+ constructor(store?: ReadonlyMap<symbol, unknown>);
17
+ get<T>(key: FeatureModelKey<T>): T | undefined;
18
+ set<T>(key: FeatureModelKey<T>, value: T): FeatureModelStore;
19
+ }
20
+ export interface ScaffoldOptions {
21
+ yes?: boolean;
22
+ template?: "api" | "cli";
23
+ database?: "typeorm";
24
+ idp?: "auth0";
25
+ postman?: boolean;
26
+ }
27
+ export interface ScaffoldContext {
28
+ projectName: string;
29
+ targetDir: string;
30
+ opts: ScaffoldOptions;
31
+ template: "api" | "cli";
32
+ models: FeatureModelStore;
33
+ /** Live controller models that features contribute to during configure. */
34
+ controllers: ClassModel[];
35
+ }
36
+ export declare function createContext(targetDir: string, opts: ScaffoldOptions, template?: "api" | "cli"): ScaffoldContext;