@decohere/scaffold 0.0.1-dev.18 → 0.0.1-dev.20261105.54

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 (264) hide show
  1. package/LICENSE +15 -0
  2. package/commonjs/src/add-api.action.js +37 -0
  3. package/commonjs/src/add-api.command.js +39 -0
  4. package/commonjs/src/add.command.js +22 -0
  5. package/commonjs/src/add.module.js +24 -0
  6. package/commonjs/src/auth0-configure.action.js +28 -0
  7. package/commonjs/src/auth0-configure.command.js +24 -0
  8. package/commonjs/src/auth0-login.action.js +28 -0
  9. package/commonjs/src/auth0-login.command.js +23 -0
  10. package/commonjs/src/auth0.command.js +22 -0
  11. package/commonjs/src/auth0.module.js +28 -0
  12. package/commonjs/src/cli.js +8 -0
  13. package/commonjs/src/create.command.js +22 -0
  14. package/commonjs/src/create.module.js +24 -0
  15. package/commonjs/src/domain/prompt.js +62 -0
  16. package/commonjs/src/index.js +48 -0
  17. package/commonjs/src/models/compose.model.js +258 -0
  18. package/commonjs/src/models/config-yaml.model.js +86 -0
  19. package/commonjs/src/models/const.js +30 -0
  20. package/commonjs/src/models/dev-container.model.js +172 -0
  21. package/commonjs/src/models/docker-image.model.js +277 -0
  22. package/commonjs/src/models/env-file.model.js +48 -0
  23. package/commonjs/src/models/gitignore.model.js +48 -0
  24. package/commonjs/src/models/launch-json.model.js +70 -0
  25. package/commonjs/src/models/package-json.model.js +157 -0
  26. package/commonjs/src/models/project.model.js +132 -0
  27. package/commonjs/src/models/source-file.js +4 -0
  28. package/commonjs/src/models/tsconfig.model.js +32 -0
  29. package/commonjs/src/models/vitest-config.model.js +33 -0
  30. package/commonjs/src/models/vscode-settings.model.js +29 -0
  31. package/commonjs/src/program.js +64 -0
  32. package/commonjs/src/resolve-target-dir.js +17 -0
  33. package/commonjs/src/services/scaffold.service.js +60 -0
  34. package/commonjs/src/version.js +55 -0
  35. package/commonjs/src/webapi/api-name.js +93 -0
  36. package/commonjs/src/webapi/auth0-commands.js +250 -0
  37. package/commonjs/src/webapi/authorize-scopes.js +79 -0
  38. package/commonjs/src/webapi/cli-options.js +99 -0
  39. package/commonjs/src/webapi/const.js +54 -0
  40. package/commonjs/src/webapi/create-api.js +275 -0
  41. package/commonjs/src/webapi/devcontainer/codebase-rag-mcp.js +164 -0
  42. package/commonjs/src/webapi/devcontainer/codebase-rag-mcp.ts +182 -0
  43. package/commonjs/src/webapi/devcontainer/host-scripts.js +50 -0
  44. package/commonjs/src/webapi/devcontainer/templates/codebase-rag.env.example +3 -0
  45. package/commonjs/src/webapi/devcontainer/templates/initialize.sh +169 -0
  46. package/commonjs/src/webapi/devcontainer/templates/post-create.sh +35 -0
  47. package/commonjs/src/webapi/devcontainer/templates/post-start.sh +65 -0
  48. package/commonjs/src/webapi/devcontainer/templates/tty-prompt.sh +38 -0
  49. package/commonjs/src/webapi/features/auth.feature.js +408 -0
  50. package/commonjs/src/webapi/features/auth0-cli.js +472 -0
  51. package/commonjs/src/webapi/features/biome-format.js +47 -0
  52. package/commonjs/src/webapi/features/database.feature.js +433 -0
  53. package/commonjs/src/webapi/features/finalize.feature.js +93 -0
  54. package/commonjs/src/webapi/features/postman.feature.js +322 -0
  55. package/commonjs/src/webapi/models/api-package-json.model.js +58 -0
  56. package/commonjs/src/webapi/models/auth-config.model.js +24 -0
  57. package/commonjs/src/webapi/models/controller-source-file.model.js +190 -0
  58. package/commonjs/src/webapi/models/github-ci.model.js +193 -0
  59. package/commonjs/src/webapi/models/main-source-file.model.js +165 -0
  60. package/commonjs/src/webapi/models/production-dockerfile.model.js +75 -0
  61. package/commonjs/src/webapi/models/sample-files.model.js +58 -0
  62. package/commonjs/src/webapi/models/webapi-image.model.js +25 -0
  63. package/commonjs/src/webapi/postman/hello-openapi.js +173 -0
  64. package/commonjs/src/webapi/postman/local-view.js +182 -0
  65. package/commonjs/src/webapi/postman/openapi-to-postman.js +238 -0
  66. package/commonjs/src/webapi/workspace-readme.js +109 -0
  67. package/commonjs/src/webapi.action.js +28 -0
  68. package/commonjs/src/webapi.command.js +43 -0
  69. package/es6/src/add-api.action.js +27 -0
  70. package/es6/src/add-api.command.js +29 -0
  71. package/es6/src/add.command.js +12 -0
  72. package/es6/src/add.module.js +14 -0
  73. package/es6/src/auth0-configure.action.js +18 -0
  74. package/es6/src/auth0-configure.command.js +14 -0
  75. package/es6/src/auth0-login.action.js +18 -0
  76. package/es6/src/auth0-login.command.js +13 -0
  77. package/es6/src/auth0.command.js +12 -0
  78. package/es6/src/auth0.module.js +18 -0
  79. package/es6/src/cli.js +4 -0
  80. package/es6/src/create.command.js +12 -0
  81. package/es6/src/create.module.js +14 -0
  82. package/es6/src/domain/prompt.js +41 -0
  83. package/es6/src/index.js +9 -0
  84. package/es6/src/models/compose.model.js +254 -0
  85. package/es6/src/models/config-yaml.model.js +74 -0
  86. package/es6/src/models/const.js +20 -0
  87. package/es6/src/models/dev-container.model.js +162 -0
  88. package/es6/src/models/docker-image.model.js +235 -0
  89. package/es6/src/models/env-file.model.js +44 -0
  90. package/es6/src/models/gitignore.model.js +38 -0
  91. package/es6/src/models/launch-json.model.js +60 -0
  92. package/es6/src/models/package-json.model.js +142 -0
  93. package/es6/src/models/project.model.js +117 -0
  94. package/es6/src/models/source-file.js +1 -0
  95. package/es6/src/models/tsconfig.model.js +22 -0
  96. package/es6/src/models/vitest-config.model.js +23 -0
  97. package/es6/src/models/vscode-settings.model.js +19 -0
  98. package/es6/src/program.js +50 -0
  99. package/es6/src/resolve-target-dir.js +7 -0
  100. package/es6/src/services/scaffold.service.js +50 -0
  101. package/es6/src/version.js +34 -0
  102. package/es6/src/webapi/api-name.js +57 -0
  103. package/es6/src/webapi/auth0-commands.js +185 -0
  104. package/es6/src/webapi/authorize-scopes.js +55 -0
  105. package/es6/src/webapi/cli-options.js +34 -0
  106. package/es6/src/webapi/const.js +21 -0
  107. package/es6/src/webapi/create-api.js +255 -0
  108. package/es6/src/webapi/devcontainer/codebase-rag-mcp.js +154 -0
  109. package/es6/src/webapi/devcontainer/codebase-rag-mcp.ts +182 -0
  110. package/es6/src/webapi/devcontainer/host-scripts.js +29 -0
  111. package/es6/src/webapi/devcontainer/templates/codebase-rag.env.example +3 -0
  112. package/es6/src/webapi/devcontainer/templates/initialize.sh +169 -0
  113. package/es6/src/webapi/devcontainer/templates/post-create.sh +35 -0
  114. package/es6/src/webapi/devcontainer/templates/post-start.sh +65 -0
  115. package/es6/src/webapi/devcontainer/templates/tty-prompt.sh +38 -0
  116. package/es6/src/webapi/features/auth.feature.js +357 -0
  117. package/es6/src/webapi/features/auth0-cli.js +406 -0
  118. package/es6/src/webapi/features/biome-format.js +40 -0
  119. package/es6/src/webapi/features/database.feature.js +423 -0
  120. package/es6/src/webapi/features/finalize.feature.js +83 -0
  121. package/es6/src/webapi/features/postman.feature.js +256 -0
  122. package/es6/src/webapi/models/api-package-json.model.js +53 -0
  123. package/es6/src/webapi/models/auth-config.model.js +20 -0
  124. package/es6/src/webapi/models/controller-source-file.model.js +181 -0
  125. package/{src/webapi/models/github-ci.model.ts → es6/src/webapi/models/github-ci.model.js} +27 -29
  126. package/es6/src/webapi/models/main-source-file.model.js +161 -0
  127. package/es6/src/webapi/models/production-dockerfile.model.js +66 -0
  128. package/es6/src/webapi/models/sample-files.model.js +40 -0
  129. package/es6/src/webapi/models/webapi-image.model.js +18 -0
  130. package/es6/src/webapi/postman/hello-openapi.js +166 -0
  131. package/es6/src/webapi/postman/local-view.js +167 -0
  132. package/es6/src/webapi/postman/openapi-to-postman.js +179 -0
  133. package/es6/src/webapi/workspace-readme.js +88 -0
  134. package/es6/src/webapi.action.js +18 -0
  135. package/es6/src/webapi.command.js +33 -0
  136. package/package.json +19 -9
  137. package/types/src/add-api.action.d.ts +13 -0
  138. package/types/src/add-api.command.d.ts +7 -0
  139. package/types/src/add.command.d.ts +6 -0
  140. package/types/src/add.module.d.ts +14 -0
  141. package/types/src/auth0-configure.action.d.ts +7 -0
  142. package/types/src/auth0-configure.command.d.ts +6 -0
  143. package/types/src/auth0-login.action.d.ts +4 -0
  144. package/types/src/auth0-login.command.d.ts +6 -0
  145. package/types/src/auth0.command.d.ts +6 -0
  146. package/types/src/auth0.module.d.ts +18 -0
  147. package/types/src/cli.d.ts +2 -0
  148. package/types/src/create.command.d.ts +6 -0
  149. package/types/src/create.module.d.ts +14 -0
  150. package/types/src/domain/prompt.d.ts +4 -0
  151. package/{src/index.ts → types/src/index.d.ts} +4 -0
  152. package/types/src/models/compose.model.d.ts +73 -0
  153. package/types/src/models/config-yaml.model.d.ts +27 -0
  154. package/types/src/models/const.d.ts +20 -0
  155. package/types/src/models/dev-container.model.d.ts +49 -0
  156. package/types/src/models/docker-image.model.d.ts +90 -0
  157. package/types/src/models/env-file.model.d.ts +16 -0
  158. package/types/src/models/gitignore.model.d.ts +9 -0
  159. package/types/src/models/launch-json.model.d.ts +7 -0
  160. package/types/src/models/package-json.model.d.ts +36 -0
  161. package/types/src/models/project.model.d.ts +60 -0
  162. package/{src/models/source-file.ts → types/src/models/source-file.d.ts} +4 -6
  163. package/types/src/models/tsconfig.model.d.ts +5 -0
  164. package/types/src/models/vitest-config.model.d.ts +5 -0
  165. package/types/src/models/vscode-settings.model.d.ts +7 -0
  166. package/types/src/program.d.ts +8 -0
  167. package/{src/resolve-target-dir.ts → types/src/resolve-target-dir.d.ts} +1 -4
  168. package/types/src/services/scaffold.service.d.ts +22 -0
  169. package/types/src/version.d.ts +6 -0
  170. package/types/src/webapi/api-name.d.ts +14 -0
  171. package/types/src/webapi/auth0-commands.d.ts +11 -0
  172. package/types/src/webapi/authorize-scopes.d.ts +7 -0
  173. package/types/src/webapi/cli-options.d.ts +6 -0
  174. package/{src/webapi/const.ts → types/src/webapi/const.d.ts} +9 -21
  175. package/types/src/webapi/create-api.d.ts +15 -0
  176. package/types/src/webapi/devcontainer/codebase-rag-mcp.d.ts +32 -0
  177. package/types/src/webapi/devcontainer/codebase-rag-mcp.ts +182 -0
  178. package/types/src/webapi/devcontainer/host-scripts.d.ts +7 -0
  179. package/types/src/webapi/devcontainer/templates/codebase-rag.env.example +3 -0
  180. package/types/src/webapi/devcontainer/templates/initialize.sh +169 -0
  181. package/types/src/webapi/devcontainer/templates/post-create.sh +35 -0
  182. package/types/src/webapi/devcontainer/templates/post-start.sh +65 -0
  183. package/types/src/webapi/devcontainer/templates/tty-prompt.sh +38 -0
  184. package/types/src/webapi/features/auth.feature.d.ts +10 -0
  185. package/types/src/webapi/features/auth0-cli.d.ts +84 -0
  186. package/types/src/webapi/features/biome-format.d.ts +5 -0
  187. package/types/src/webapi/features/database.feature.d.ts +7 -0
  188. package/types/src/webapi/features/finalize.feature.d.ts +2 -0
  189. package/types/src/webapi/features/postman.feature.d.ts +16 -0
  190. package/types/src/webapi/models/api-package-json.model.d.ts +18 -0
  191. package/types/src/webapi/models/auth-config.model.d.ts +26 -0
  192. package/types/src/webapi/models/controller-source-file.model.d.ts +46 -0
  193. package/types/src/webapi/models/github-ci.model.d.ts +9 -0
  194. package/types/src/webapi/models/main-source-file.model.d.ts +54 -0
  195. package/types/src/webapi/models/production-dockerfile.model.d.ts +18 -0
  196. package/types/src/webapi/models/sample-files.model.d.ts +7 -0
  197. package/types/src/webapi/models/webapi-image.model.d.ts +12 -0
  198. package/types/src/webapi/postman/hello-openapi.d.ts +19 -0
  199. package/types/src/webapi/postman/local-view.d.ts +17 -0
  200. package/types/src/webapi/postman/openapi-to-postman.d.ts +62 -0
  201. package/types/src/webapi/workspace-readme.d.ts +18 -0
  202. package/types/src/webapi.action.d.ts +14 -0
  203. package/types/src/webapi.command.d.ts +11 -0
  204. package/src/add-api.action.ts +0 -25
  205. package/src/add-api.command.ts +0 -31
  206. package/src/add.command.ts +0 -20
  207. package/src/add.module.ts +0 -11
  208. package/src/cli.ts +0 -4
  209. package/src/create.command.ts +0 -20
  210. package/src/create.module.ts +0 -11
  211. package/src/domain/prompt.ts +0 -50
  212. package/src/models/compose.model.ts +0 -205
  213. package/src/models/config-yaml.model.ts +0 -83
  214. package/src/models/const.ts +0 -20
  215. package/src/models/dev-container.model.ts +0 -136
  216. package/src/models/docker-image.model.ts +0 -343
  217. package/src/models/env-file.model.ts +0 -45
  218. package/src/models/gitignore.model.ts +0 -35
  219. package/src/models/launch-json.model.ts +0 -60
  220. package/src/models/package-json.model.ts +0 -169
  221. package/src/models/project.model.ts +0 -141
  222. package/src/models/tsconfig.model.ts +0 -29
  223. package/src/models/vitest-config.model.ts +0 -26
  224. package/src/models/vscode-settings.model.ts +0 -24
  225. package/src/program.ts +0 -63
  226. package/src/services/scaffold.service.ts +0 -89
  227. package/src/version.ts +0 -56
  228. package/src/webapi/api-name.ts +0 -73
  229. package/src/webapi/cli-options.ts +0 -56
  230. package/src/webapi/create-api.ts +0 -275
  231. package/src/webapi/devcontainer/host-scripts.ts +0 -35
  232. package/src/webapi/features/auth.feature.ts +0 -454
  233. package/src/webapi/features/auth0-cli.ts +0 -421
  234. package/src/webapi/features/biome-format.ts +0 -34
  235. package/src/webapi/features/database.feature.ts +0 -522
  236. package/src/webapi/features/finalize.feature.ts +0 -112
  237. package/src/webapi/features/postman.feature.ts +0 -287
  238. package/src/webapi/models/api-package-json.model.ts +0 -60
  239. package/src/webapi/models/auth-config.model.ts +0 -36
  240. package/src/webapi/models/controller-source-file.model.ts +0 -232
  241. package/src/webapi/models/main-source-file.model.ts +0 -208
  242. package/src/webapi/models/production-dockerfile.model.ts +0 -162
  243. package/src/webapi/models/sample-files.model.ts +0 -45
  244. package/src/webapi/models/webapi-image.model.ts +0 -21
  245. package/src/webapi/postman/hello-openapi.ts +0 -92
  246. package/src/webapi/postman/local-view.ts +0 -195
  247. package/src/webapi/postman/openapi-to-postman.ts +0 -208
  248. package/src/webapi/workspace-readme.ts +0 -192
  249. package/src/webapi.action.ts +0 -22
  250. package/src/webapi.command.ts +0 -41
  251. package/tests/auth-postman.wiring.spec.ts +0 -263
  252. package/tests/auth0-cli.spec.ts +0 -232
  253. package/tests/biome-format.spec.ts +0 -49
  254. package/tests/cli.integration.spec.ts +0 -658
  255. package/tests/compose.model.spec.ts +0 -51
  256. package/tests/container-image.model.spec.ts +0 -162
  257. package/tests/dev-container.model.spec.ts +0 -29
  258. package/tests/devcontainer-base-image.spec.ts +0 -32
  259. package/tests/hello-di-inject.scaffold.spec.ts +0 -18
  260. package/tests/hello-route.contract.spec.ts +0 -94
  261. package/tests/package-json.order.spec.ts +0 -59
  262. package/tests/postman-from-openapi.spec.ts +0 -197
  263. package/tests/seed-devcontainer-templates.ts +0 -40
  264. package/tests/webapi/devcontainer/codebase-rag-mcp.spec.ts +0 -96
@@ -0,0 +1,46 @@
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 _extraDecorators;
11
+ private _body;
12
+ private _isAsync;
13
+ constructor(name: string, _httpDecorator: string, _params: string, isAsync: boolean, body: string[]);
14
+ addDecorator(decorator: string): this;
15
+ /** Replace the method body lines (used by features that extend generated behaviour). */
16
+ setBody(body: string[]): this;
17
+ setAsync(isAsync?: boolean): this;
18
+ render(): string[];
19
+ }
20
+ /**
21
+ * Model for `projects/api/src/controllers/hello.controller.ts`.
22
+ *
23
+ * Pre-initialised with all routes and their HTTP decorators. Features mutate
24
+ * the model via `getMethod(name).addDecorator(...)`, `addDecorator(...)` (class
25
+ * level), `addCortexImport(...)`, `addImport(...)`, and `addConstructorParam(...)`.
26
+ */
27
+ export declare class ControllerSourceFile implements KeyedModel {
28
+ readonly key: string;
29
+ private readonly _cortexImports;
30
+ private readonly _extraImportGroups;
31
+ private readonly _classDecorators;
32
+ /** Explicit @inject(SampleService): using the class as a value keeps its import, which SWC can drop when the class is only a type (design:paramtypes then collapses to Object). */
33
+ private readonly _ctorParams;
34
+ private readonly _methods;
35
+ /** Retrieve a method by name to mutate its decorators. */
36
+ getMethod(name: string): ControllerMethod;
37
+ /** Add a class-level decorator (e.g. `@Authorize`). */
38
+ addDecorator(decorator: string): this;
39
+ /** Add a named import from `@decohere/http`. */
40
+ addCortexImport(name: string, typeOnly?: boolean): this;
41
+ /** Add a named import from any other module. */
42
+ addImport(name: string, from: string, typeOnly?: boolean): this;
43
+ /** Add a constructor parameter (e.g. an injected dependency). */
44
+ addConstructorParam(param: string): this;
45
+ files(): SourceFile[];
46
+ }
@@ -0,0 +1,9 @@
1
+ import type { KeyedModel, SourceFile } from "../../models/source-file.js";
2
+ /**
3
+ * Minimal GitHub Actions for scaffolded apps: lint ∥ test, build gate on default branch,
4
+ * npm publish after CI (skips private packages). No default forge docker --push.
5
+ */
6
+ export declare class GithubCiWorkflows implements KeyedModel {
7
+ readonly key: string;
8
+ files(): SourceFile[];
9
+ }
@@ -0,0 +1,54 @@
1
+ import type { KeyedModel, SourceFile } from "../../models/source-file.js";
2
+ export type TypeOrmImport = {
3
+ className: string;
4
+ importPath: string;
5
+ };
6
+ export type ServiceImport = TypeOrmImport & {
7
+ scope?: "singleton" | "request";
8
+ };
9
+ /**
10
+ * Model for `projects/api/src/main.ts`.
11
+ *
12
+ * Starts with the minimal HTTP + YAML config setup. Features mutate the model
13
+ * by calling addSideEffectImport / addImport / addBuilderCall / addEntity /
14
+ * addRepository. files() renders whatever has been accumulated.
15
+ */
16
+ export declare class MainSourceFile implements KeyedModel {
17
+ private readonly appName;
18
+ readonly key: string;
19
+ private readonly _sideEffectImports;
20
+ private readonly _extraImports;
21
+ private readonly _builderCalls;
22
+ private readonly _entities;
23
+ private readonly _repositories;
24
+ private readonly _services;
25
+ private _dataSourceName;
26
+ private _typeOrmSeed;
27
+ constructor(appName: string);
28
+ /** Adds a bare side-effect import, e.g. `@decohere/http/auth`. */
29
+ addSideEffectImport(path: string): this;
30
+ /** Adds a named import, e.g. `import { Foo } from "bar"`. */
31
+ addImport(name: string, from: string, typeOnly?: boolean): this;
32
+ /**
33
+ * Adds a builder call inserted after `.withConfiguration()` and before
34
+ * `.withServices()`. Pass the call without leading dot, e.g. `.withAuth()`.
35
+ */
36
+ addBuilderCall(call: string): this;
37
+ /** Adds a TypeORM entity — import and entry in `withTypeOrm({ entities })`. */
38
+ addEntity(entity: TypeOrmImport): this;
39
+ /** Adds a TypeORM repository — import and entry in `withTypeOrm({ repositories })`. */
40
+ addRepository(repo: TypeOrmImport): this;
41
+ /** Adds a service registered in `.withServices()`. */
42
+ addService(service: ServiceImport): this;
43
+ /**
44
+ * Datasource name passed to `withTypeOrm({ name })`. Must match
45
+ * `database.dataSources[].name` in config.yaml.
46
+ */
47
+ setDataSourceName(name: string): this;
48
+ /**
49
+ * Inline seed callback body for `withTypeOrm({ seed })`.
50
+ * Receives `dataSource` in scope. Example: `await dataSource.getRepository(User).save(...)`.
51
+ */
52
+ setTypeOrmSeed(seedBody: string): this;
53
+ files(): SourceFile[];
54
+ }
@@ -0,0 +1,18 @@
1
+ import type { KeyedModel, SourceFile } from "../../models/source-file.js";
2
+ /**
3
+ * Production Dockerfile for each API, in the API's own folder: `projects/<name>/Dockerfile`.
4
+ * That is where `forge docker` and `forge package` look for a deployable, and the folder is
5
+ * the Docker build context.
6
+ *
7
+ * The image copies `.package/`, which `forge package` writes before Docker runs: the API's
8
+ * compiled code, the workspace libraries it imports, and a real (symlink-free) `node_modules`
9
+ * of the third-party packages it reaches. So the image build installs nothing, runs no
10
+ * workspace tooling, and needs no npm token.
11
+ */
12
+ export declare class WebapiProductionDockerfile implements KeyedModel {
13
+ private readonly apiNames;
14
+ readonly key: string;
15
+ constructor(apiNames?: readonly string[]);
16
+ files(): SourceFile[];
17
+ }
18
+ export declare function renderProductionDockerfile(apiName: string): string;
@@ -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,12 @@
1
+ import { DockerfileModel } from "../../models/docker-image.model.js";
2
+ /**
3
+ * Scaffolded app `.devcontainer/Dockerfile` — thin `FROM` the published base image.
4
+ * Optional feature layers (e.g. postgresql-client) append via `addLayer`.
5
+ */
6
+ export declare class WebapiDevContainer extends DockerfileModel {
7
+ constructor(baseImage?: string);
8
+ files(): {
9
+ filePath: string;
10
+ content: string;
11
+ }[];
12
+ }
@@ -0,0 +1,19 @@
1
+ /** Minimal OpenAPI 3 document shape used for Postman conversion. */
2
+ export type ScaffoldOpenApiDocument = {
3
+ openapi: "3.0.3";
4
+ info: {
5
+ title: string;
6
+ version: string;
7
+ description?: string;
8
+ };
9
+ servers?: Array<{
10
+ url: string;
11
+ description?: string;
12
+ }>;
13
+ paths: Record<string, Record<string, unknown>>;
14
+ };
15
+ /**
16
+ * Canonical Hello WebAPI OpenAPI document used to generate Postman requests.
17
+ * Keep paths aligned with scaffolded HelloController (`/hello`, `/hello/{id}`).
18
+ */
19
+ export declare function buildHelloOpenApiDocument(projectName: string): ScaffoldOpenApiDocument;
@@ -0,0 +1,17 @@
1
+ import { type Auth0Env, type PostmanCollection } from "./openapi-to-postman.js";
2
+ /** Local View / Native Git environment (YAML). */
3
+ export declare function buildEnvironmentYaml(name: string, auth: Auth0Env | undefined, options: {
4
+ callbacks: readonly string[];
5
+ scopes: string;
6
+ }): string;
7
+ /**
8
+ * Build Postman Local View multi-file YAML from a v2.1 collection (routes)
9
+ * plus hand-authored Auth0 overlay.
10
+ */
11
+ export declare function buildLocalViewFilesFromCollection(collection: PostmanCollection, projectName: string, auth: Auth0Env | undefined, options: {
12
+ callbacks: readonly string[];
13
+ scopes: string;
14
+ }): Array<{
15
+ filePath: string;
16
+ content: string;
17
+ }>;
@@ -0,0 +1,62 @@
1
+ import type { ScaffoldOpenApiDocument } from "./hello-openapi.js";
2
+ export type PostmanCollection = {
3
+ info: {
4
+ _postman_id?: string;
5
+ name: string;
6
+ schema: string;
7
+ description?: string;
8
+ };
9
+ auth?: unknown;
10
+ item?: PostmanItem[];
11
+ variable?: Array<{
12
+ key: string;
13
+ value: string;
14
+ }>;
15
+ [key: string]: unknown;
16
+ };
17
+ export type PostmanItem = {
18
+ name?: string;
19
+ item?: PostmanItem[];
20
+ request?: PostmanRequest;
21
+ [key: string]: unknown;
22
+ };
23
+ export type PostmanRequest = {
24
+ method?: string;
25
+ header?: Array<{
26
+ key: string;
27
+ value: string;
28
+ }>;
29
+ body?: {
30
+ mode?: string;
31
+ raw?: string;
32
+ };
33
+ url?: string | {
34
+ raw?: string;
35
+ host?: string[];
36
+ path?: string[];
37
+ variable?: unknown[];
38
+ };
39
+ auth?: {
40
+ type: string;
41
+ [key: string]: unknown;
42
+ };
43
+ [key: string]: unknown;
44
+ };
45
+ export type Auth0Env = {
46
+ auth0Domain?: string;
47
+ auth0Audience?: string;
48
+ auth0ClientId?: string;
49
+ };
50
+ /** Convert an OpenAPI document to a Postman Collection v2.1 via openapi-to-postmanv2. */
51
+ export declare function openApiToPostmanCollection(document: ScaffoldOpenApiDocument): Promise<PostmanCollection>;
52
+ /**
53
+ * Overlay Auth0 OAuth2 (PKCE) collection auth and fix Local View-friendly URLs.
54
+ * Route items come from OpenAPI; auth/env remain hand-authored.
55
+ */
56
+ export declare function applyPostmanAuthOverlay(collection: PostmanCollection, projectName: string, auth: Auth0Env | undefined, options: {
57
+ callbacks: readonly string[];
58
+ scopes: string;
59
+ description: string;
60
+ }): PostmanCollection;
61
+ /** OpenAPI `{id}` → Postman `:id`, without touching `{{variables}}`. */
62
+ export declare function openApiPathParamsToColon(url: string): string;
@@ -0,0 +1,18 @@
1
+ import type { WorkspaceScaffold } from "../models/project.model.js";
2
+ export type WorkspaceReadmeOptions = {
3
+ add?: boolean;
4
+ databaseProvider?: "none" | "postgres/typeorm";
5
+ authProvider?: "auth0" | "none";
6
+ postmanProvider?: "api" | "local" | "none";
7
+ };
8
+ export type WorkspaceReadmeInput = {
9
+ projectName: string;
10
+ apiNames: readonly string[];
11
+ hasPostgres: boolean;
12
+ hasAuth0: boolean;
13
+ hasPostman: boolean;
14
+ };
15
+ /** Pure renderer — keep feature sections short and copy-paste ready. */
16
+ export declare function renderWorkspaceReadme(input: WorkspaceReadmeInput): string;
17
+ export declare function resolveWorkspaceReadmeInput(workspace: WorkspaceScaffold, options: WorkspaceReadmeOptions): WorkspaceReadmeInput;
18
+ export declare function writeWorkspaceReadme(workspace: WorkspaceScaffold, options: WorkspaceReadmeOptions): void;
@@ -0,0 +1,14 @@
1
+ import { type Action, ActionResponse } from "@decohere/devkit/cli";
2
+ export type WebapiOptions = {
3
+ directory?: string;
4
+ d?: string;
5
+ name?: string | string[];
6
+ database?: string;
7
+ auth?: string;
8
+ postman?: string;
9
+ yes?: boolean;
10
+ install?: string;
11
+ };
12
+ export declare class WebapiAction implements Action<WebapiOptions> {
13
+ run(options: WebapiOptions): Promise<ActionResponse>;
14
+ }
@@ -0,0 +1,11 @@
1
+ import { DecohereCommand } from "@decohere/devkit/cli";
2
+ import { WebapiAction } from "./webapi.action.js";
3
+ export declare class WebapiCommand extends DecohereCommand {
4
+ get actions(): (typeof WebapiAction)[];
5
+ constructor(name: string);
6
+ /**
7
+ * Commander passes positional args before options when `[directory]` is declared.
8
+ * ModuleFactory expects `(opts, cmd)` — stash the directory on the command.
9
+ */
10
+ action(fn: (...args: unknown[]) => void | Promise<void>): this;
11
+ }
@@ -1,25 +0,0 @@
1
- import { injectable } from "@decohere/crucible/decorators";
2
- import { type Action, ActionResponse } from "@decohere/nexus/cli";
3
- import { runScaffoldApi, toApiOptions } from "./webapi/cli-options.js";
4
-
5
- export type AddApiOptions = {
6
- apiName?: string;
7
- d?: string;
8
- database?: string;
9
- auth?: string;
10
- postman?: string;
11
- yes?: boolean;
12
- install?: string;
13
- };
14
-
15
- @injectable()
16
- export class AddApiAction implements Action<AddApiOptions> {
17
- public async run(options: AddApiOptions): Promise<ActionResponse> {
18
- const name = options.apiName;
19
- if (name == null || name === "") {
20
- return ActionResponse.Error("api", "API name is required");
21
- }
22
- await runScaffoldApi(toApiOptions(undefined, options, { names: [name], add: true }));
23
- return ActionResponse.Success("api");
24
- }
25
- }
@@ -1,31 +0,0 @@
1
- import { DecohereCommand } from "@decohere/nexus/cli";
2
- import type { OptionValues } from "commander";
3
- import { AddApiAction } from "./add-api.action.js";
4
- import { addWebapiFeatureOptions } from "./webapi/cli-options.js";
5
-
6
- export class AddApiCommand extends DecohereCommand {
7
- public override get actions() {
8
- return [AddApiAction];
9
- }
10
-
11
- public constructor(name: string) {
12
- super(name);
13
- this.description("Add an API to an existing Decohere workspace");
14
- this.argument("<name>", "API name under projects/");
15
- this.option("-d <directory>", "Workspace directory (default: current directory)", ".");
16
- addWebapiFeatureOptions(this);
17
- }
18
-
19
- public override action(fn: (...args: unknown[]) => void | Promise<void>): this {
20
- return super.action((...args: unknown[]) => {
21
- const cmd = args.at(-1) as DecohereCommand;
22
- const first = args[0];
23
- const hasPositional = typeof first === "string" || first === undefined;
24
- const opts = hasPositional ? (args[1] as OptionValues) : (args[0] as OptionValues);
25
- if (typeof first === "string" && first !== "") {
26
- cmd.setOptionValue("apiName", first);
27
- }
28
- return fn(opts, cmd);
29
- });
30
- }
31
- }
@@ -1,20 +0,0 @@
1
- import type { Actions } from "@decohere/nexus/cli";
2
- import {
3
- type CommandHandler,
4
- type CommandResponse,
5
- type CommandType,
6
- DecohereCommand,
7
- } from "@decohere/nexus/cli";
8
-
9
- export class AddCommand extends DecohereCommand {
10
- public constructor(commands: Record<string, CommandType>, handler: CommandHandler) {
11
- super(AddCommand);
12
- this.description("Add to an existing Decohere workspace");
13
- this.exitOverride();
14
- this.registerSubcommand(commands, handler);
15
- }
16
-
17
- public run(_actions: Actions, _options: never): Promise<CommandResponse> {
18
- return this.help();
19
- }
20
- }
package/src/add.module.ts DELETED
@@ -1,11 +0,0 @@
1
- import { ModuleManifest } from "@decohere/nexus/cli";
2
- import { AddCommand } from "./add.command.js";
3
- import { AddApiAction } from "./add-api.action.js";
4
- import { AddApiCommand } from "./add-api.command.js";
5
-
6
- export class AddModule extends ModuleManifest {
7
- public readonly id = "add";
8
- public readonly command = AddCommand;
9
- public readonly commands = { api: AddApiCommand };
10
- public readonly actions = { api: AddApiAction };
11
- }
package/src/cli.ts DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import { runCli } from "./program.js";
3
-
4
- void runCli();
@@ -1,20 +0,0 @@
1
- import type { Actions } from "@decohere/nexus/cli";
2
- import {
3
- type CommandHandler,
4
- type CommandResponse,
5
- type CommandType,
6
- DecohereCommand,
7
- } from "@decohere/nexus/cli";
8
-
9
- export class CreateCommand extends DecohereCommand {
10
- public constructor(commands: Record<string, CommandType>, handler: CommandHandler) {
11
- super(CreateCommand);
12
- this.description("Create a new Decohere workspace");
13
- this.exitOverride();
14
- this.registerSubcommand(commands, handler);
15
- }
16
-
17
- public run(_actions: Actions, _options: never): Promise<CommandResponse> {
18
- return this.help();
19
- }
20
- }
@@ -1,11 +0,0 @@
1
- import { ModuleManifest } from "@decohere/nexus/cli";
2
- import { CreateCommand } from "./create.command.js";
3
- import { WebapiAction } from "./webapi.action.js";
4
- import { WebapiCommand } from "./webapi.command.js";
5
-
6
- export class CreateModule extends ModuleManifest {
7
- public readonly id = "create";
8
- public readonly command = CreateCommand;
9
- public readonly commands = { webapi: WebapiCommand };
10
- public readonly actions = { webapi: WebapiAction };
11
- }
@@ -1,50 +0,0 @@
1
- import { createInterface, type Interface } from "node:readline";
2
-
3
- // readline/promises rl.question() has a race condition with piped (non-TTY) stdin
4
- // in Node ≥ 22: after the first line is read, stdin emits 'end', readline closes,
5
- // and all subsequent question() calls resolve to "".
6
- // Fix: use the async-iterator API, which buffers all lines before the close event fires.
7
-
8
- let _rl: Interface | null = null;
9
- let _lines: AsyncIterator<string> | null = null;
10
-
11
- function getLines(): AsyncIterator<string> {
12
- if (_lines == null) {
13
- _rl = createInterface({ input: process.stdin, terminal: false });
14
- _lines = _rl[Symbol.asyncIterator]();
15
- }
16
- return _lines;
17
- }
18
-
19
- /** Release stdin so the process can exit after interactive prompts. */
20
- export function closePrompt(): void {
21
- _rl?.close();
22
- _rl = null;
23
- _lines = null;
24
- }
25
-
26
- async function readLine(prompt: string): Promise<string> {
27
- process.stdout.write(prompt);
28
- const { value, done } = await getLines().next();
29
- return done ? "" : value.trim();
30
- }
31
-
32
- export async function ask(question: string, fallback = ""): Promise<string> {
33
- const answer = await readLine(question);
34
- return answer || fallback;
35
- }
36
-
37
- export async function pick<T>(
38
- label: string,
39
- items: T[],
40
- display: (item: T) => string,
41
- ): Promise<T | null> {
42
- console.log(label.trimEnd());
43
- for (const [i, item] of items.entries()) {
44
- console.log(` ${i + 1}. ${display(item)}`);
45
- }
46
- const answer = await readLine(" > ");
47
- const idx = Number.parseInt(answer, 10);
48
- if (Number.isNaN(idx) || idx < 1 || idx > items.length) return null;
49
- return items[idx - 1];
50
- }