@decohere/scaffold 0.0.1-dev.125 → 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 (264) hide show
  1. package/package.json +9 -19
  2. package/src/add-api.action.ts +25 -0
  3. package/src/add-api.command.ts +31 -0
  4. package/src/add.command.ts +20 -0
  5. package/src/add.module.ts +11 -0
  6. package/src/cli.ts +4 -0
  7. package/src/create.command.ts +20 -0
  8. package/src/create.module.ts +11 -0
  9. package/src/domain/prompt.ts +50 -0
  10. package/{types/src/index.d.ts → src/index.ts} +0 -4
  11. package/src/models/compose.model.ts +205 -0
  12. package/src/models/config-yaml.model.ts +83 -0
  13. package/src/models/const.ts +20 -0
  14. package/src/models/dev-container.model.ts +136 -0
  15. package/src/models/docker-image.model.ts +343 -0
  16. package/src/models/env-file.model.ts +45 -0
  17. package/src/models/gitignore.model.ts +35 -0
  18. package/src/models/launch-json.model.ts +60 -0
  19. package/src/models/package-json.model.ts +169 -0
  20. package/src/models/project.model.ts +141 -0
  21. package/{types/src/models/source-file.d.ts → src/models/source-file.ts} +6 -4
  22. package/src/models/tsconfig.model.ts +29 -0
  23. package/src/models/vitest-config.model.ts +26 -0
  24. package/src/models/vscode-settings.model.ts +24 -0
  25. package/src/program.ts +63 -0
  26. package/{types/src/resolve-target-dir.d.ts → src/resolve-target-dir.ts} +4 -1
  27. package/src/services/scaffold.service.ts +89 -0
  28. package/src/version.ts +56 -0
  29. package/src/webapi/api-name.ts +73 -0
  30. package/src/webapi/cli-options.ts +56 -0
  31. package/{types/src/webapi/const.d.ts → src/webapi/const.ts} +21 -9
  32. package/src/webapi/create-api.ts +275 -0
  33. package/src/webapi/devcontainer/host-scripts.ts +35 -0
  34. package/src/webapi/features/auth.feature.ts +454 -0
  35. package/src/webapi/features/auth0-cli.ts +421 -0
  36. package/src/webapi/features/biome-format.ts +34 -0
  37. package/src/webapi/features/database.feature.ts +522 -0
  38. package/src/webapi/features/finalize.feature.ts +112 -0
  39. package/src/webapi/features/postman.feature.ts +287 -0
  40. package/src/webapi/models/api-package-json.model.ts +60 -0
  41. package/src/webapi/models/auth-config.model.ts +36 -0
  42. package/src/webapi/models/controller-source-file.model.ts +232 -0
  43. package/{es6/src/webapi/models/github-ci.model.js → src/webapi/models/github-ci.model.ts} +29 -27
  44. package/src/webapi/models/main-source-file.model.ts +208 -0
  45. package/src/webapi/models/production-dockerfile.model.ts +162 -0
  46. package/src/webapi/models/sample-files.model.ts +45 -0
  47. package/src/webapi/models/webapi-image.model.ts +21 -0
  48. package/src/webapi/postman/hello-openapi.ts +92 -0
  49. package/src/webapi/postman/local-view.ts +195 -0
  50. package/src/webapi/postman/openapi-to-postman.ts +208 -0
  51. package/src/webapi/workspace-readme.ts +192 -0
  52. package/src/webapi.action.ts +22 -0
  53. package/src/webapi.command.ts +41 -0
  54. package/tests/auth-postman.wiring.spec.ts +263 -0
  55. package/tests/auth0-cli.spec.ts +232 -0
  56. package/tests/biome-format.spec.ts +49 -0
  57. package/tests/cli.integration.spec.ts +658 -0
  58. package/tests/compose.model.spec.ts +51 -0
  59. package/tests/container-image.model.spec.ts +162 -0
  60. package/tests/dev-container.model.spec.ts +29 -0
  61. package/tests/devcontainer-base-image.spec.ts +32 -0
  62. package/tests/hello-di-inject.scaffold.spec.ts +18 -0
  63. package/tests/hello-route.contract.spec.ts +94 -0
  64. package/tests/package-json.order.spec.ts +59 -0
  65. package/tests/postman-from-openapi.spec.ts +197 -0
  66. package/tests/seed-devcontainer-templates.ts +40 -0
  67. package/tests/webapi/devcontainer/codebase-rag-mcp.spec.ts +96 -0
  68. package/LICENSE +0 -15
  69. package/commonjs/src/add-api.action.js +0 -37
  70. package/commonjs/src/add-api.command.js +0 -39
  71. package/commonjs/src/add.command.js +0 -22
  72. package/commonjs/src/add.module.js +0 -24
  73. package/commonjs/src/auth0-configure.action.js +0 -28
  74. package/commonjs/src/auth0-configure.command.js +0 -24
  75. package/commonjs/src/auth0-login.action.js +0 -28
  76. package/commonjs/src/auth0-login.command.js +0 -23
  77. package/commonjs/src/auth0.command.js +0 -22
  78. package/commonjs/src/auth0.module.js +0 -28
  79. package/commonjs/src/cli.js +0 -8
  80. package/commonjs/src/create.command.js +0 -22
  81. package/commonjs/src/create.module.js +0 -24
  82. package/commonjs/src/domain/prompt.js +0 -62
  83. package/commonjs/src/index.js +0 -48
  84. package/commonjs/src/models/compose.model.js +0 -258
  85. package/commonjs/src/models/config-yaml.model.js +0 -86
  86. package/commonjs/src/models/const.js +0 -30
  87. package/commonjs/src/models/dev-container.model.js +0 -172
  88. package/commonjs/src/models/docker-image.model.js +0 -277
  89. package/commonjs/src/models/env-file.model.js +0 -48
  90. package/commonjs/src/models/gitignore.model.js +0 -48
  91. package/commonjs/src/models/launch-json.model.js +0 -70
  92. package/commonjs/src/models/package-json.model.js +0 -156
  93. package/commonjs/src/models/project.model.js +0 -132
  94. package/commonjs/src/models/source-file.js +0 -4
  95. package/commonjs/src/models/tsconfig.model.js +0 -32
  96. package/commonjs/src/models/vitest-config.model.js +0 -33
  97. package/commonjs/src/models/vscode-settings.model.js +0 -29
  98. package/commonjs/src/program.js +0 -64
  99. package/commonjs/src/resolve-target-dir.js +0 -17
  100. package/commonjs/src/services/scaffold.service.js +0 -60
  101. package/commonjs/src/version.js +0 -55
  102. package/commonjs/src/webapi/api-name.js +0 -93
  103. package/commonjs/src/webapi/auth0-commands.js +0 -250
  104. package/commonjs/src/webapi/authorize-scopes.js +0 -79
  105. package/commonjs/src/webapi/cli-options.js +0 -99
  106. package/commonjs/src/webapi/const.js +0 -54
  107. package/commonjs/src/webapi/create-api.js +0 -265
  108. package/commonjs/src/webapi/devcontainer/codebase-rag-mcp.js +0 -164
  109. package/commonjs/src/webapi/devcontainer/codebase-rag-mcp.ts +0 -182
  110. package/commonjs/src/webapi/devcontainer/host-scripts.js +0 -50
  111. package/commonjs/src/webapi/devcontainer/templates/codebase-rag.env.example +0 -3
  112. package/commonjs/src/webapi/devcontainer/templates/initialize.sh +0 -169
  113. package/commonjs/src/webapi/devcontainer/templates/post-create.sh +0 -35
  114. package/commonjs/src/webapi/devcontainer/templates/post-start.sh +0 -65
  115. package/commonjs/src/webapi/devcontainer/templates/tty-prompt.sh +0 -38
  116. package/commonjs/src/webapi/features/auth.feature.js +0 -408
  117. package/commonjs/src/webapi/features/auth0-cli.js +0 -472
  118. package/commonjs/src/webapi/features/biome-format.js +0 -47
  119. package/commonjs/src/webapi/features/database.feature.js +0 -433
  120. package/commonjs/src/webapi/features/finalize.feature.js +0 -93
  121. package/commonjs/src/webapi/features/postman.feature.js +0 -322
  122. package/commonjs/src/webapi/models/api-package-json.model.js +0 -58
  123. package/commonjs/src/webapi/models/auth-config.model.js +0 -24
  124. package/commonjs/src/webapi/models/controller-source-file.model.js +0 -190
  125. package/commonjs/src/webapi/models/github-ci.model.js +0 -193
  126. package/commonjs/src/webapi/models/main-source-file.model.js +0 -165
  127. package/commonjs/src/webapi/models/production-dockerfile.model.js +0 -75
  128. package/commonjs/src/webapi/models/sample-files.model.js +0 -58
  129. package/commonjs/src/webapi/models/webapi-image.model.js +0 -25
  130. package/commonjs/src/webapi/postman/hello-openapi.js +0 -173
  131. package/commonjs/src/webapi/postman/local-view.js +0 -182
  132. package/commonjs/src/webapi/postman/openapi-to-postman.js +0 -238
  133. package/commonjs/src/webapi/workspace-readme.js +0 -109
  134. package/commonjs/src/webapi.action.js +0 -28
  135. package/commonjs/src/webapi.command.js +0 -43
  136. package/es6/src/add-api.action.js +0 -27
  137. package/es6/src/add-api.command.js +0 -29
  138. package/es6/src/add.command.js +0 -12
  139. package/es6/src/add.module.js +0 -14
  140. package/es6/src/auth0-configure.action.js +0 -18
  141. package/es6/src/auth0-configure.command.js +0 -14
  142. package/es6/src/auth0-login.action.js +0 -18
  143. package/es6/src/auth0-login.command.js +0 -13
  144. package/es6/src/auth0.command.js +0 -12
  145. package/es6/src/auth0.module.js +0 -18
  146. package/es6/src/cli.js +0 -4
  147. package/es6/src/create.command.js +0 -12
  148. package/es6/src/create.module.js +0 -14
  149. package/es6/src/domain/prompt.js +0 -41
  150. package/es6/src/index.js +0 -9
  151. package/es6/src/models/compose.model.js +0 -254
  152. package/es6/src/models/config-yaml.model.js +0 -74
  153. package/es6/src/models/const.js +0 -20
  154. package/es6/src/models/dev-container.model.js +0 -162
  155. package/es6/src/models/docker-image.model.js +0 -235
  156. package/es6/src/models/env-file.model.js +0 -44
  157. package/es6/src/models/gitignore.model.js +0 -38
  158. package/es6/src/models/launch-json.model.js +0 -60
  159. package/es6/src/models/package-json.model.js +0 -141
  160. package/es6/src/models/project.model.js +0 -117
  161. package/es6/src/models/source-file.js +0 -1
  162. package/es6/src/models/tsconfig.model.js +0 -22
  163. package/es6/src/models/vitest-config.model.js +0 -23
  164. package/es6/src/models/vscode-settings.model.js +0 -19
  165. package/es6/src/program.js +0 -50
  166. package/es6/src/resolve-target-dir.js +0 -7
  167. package/es6/src/services/scaffold.service.js +0 -50
  168. package/es6/src/version.js +0 -34
  169. package/es6/src/webapi/api-name.js +0 -57
  170. package/es6/src/webapi/auth0-commands.js +0 -185
  171. package/es6/src/webapi/authorize-scopes.js +0 -55
  172. package/es6/src/webapi/cli-options.js +0 -34
  173. package/es6/src/webapi/const.js +0 -21
  174. package/es6/src/webapi/create-api.js +0 -245
  175. package/es6/src/webapi/devcontainer/codebase-rag-mcp.js +0 -154
  176. package/es6/src/webapi/devcontainer/codebase-rag-mcp.ts +0 -182
  177. package/es6/src/webapi/devcontainer/host-scripts.js +0 -29
  178. package/es6/src/webapi/devcontainer/templates/codebase-rag.env.example +0 -3
  179. package/es6/src/webapi/devcontainer/templates/initialize.sh +0 -169
  180. package/es6/src/webapi/devcontainer/templates/post-create.sh +0 -35
  181. package/es6/src/webapi/devcontainer/templates/post-start.sh +0 -65
  182. package/es6/src/webapi/devcontainer/templates/tty-prompt.sh +0 -38
  183. package/es6/src/webapi/features/auth.feature.js +0 -357
  184. package/es6/src/webapi/features/auth0-cli.js +0 -406
  185. package/es6/src/webapi/features/biome-format.js +0 -40
  186. package/es6/src/webapi/features/database.feature.js +0 -423
  187. package/es6/src/webapi/features/finalize.feature.js +0 -83
  188. package/es6/src/webapi/features/postman.feature.js +0 -256
  189. package/es6/src/webapi/models/api-package-json.model.js +0 -53
  190. package/es6/src/webapi/models/auth-config.model.js +0 -20
  191. package/es6/src/webapi/models/controller-source-file.model.js +0 -181
  192. package/es6/src/webapi/models/main-source-file.model.js +0 -161
  193. package/es6/src/webapi/models/production-dockerfile.model.js +0 -66
  194. package/es6/src/webapi/models/sample-files.model.js +0 -40
  195. package/es6/src/webapi/models/webapi-image.model.js +0 -18
  196. package/es6/src/webapi/postman/hello-openapi.js +0 -166
  197. package/es6/src/webapi/postman/local-view.js +0 -167
  198. package/es6/src/webapi/postman/openapi-to-postman.js +0 -179
  199. package/es6/src/webapi/workspace-readme.js +0 -88
  200. package/es6/src/webapi.action.js +0 -18
  201. package/es6/src/webapi.command.js +0 -33
  202. package/types/src/add-api.action.d.ts +0 -13
  203. package/types/src/add-api.command.d.ts +0 -7
  204. package/types/src/add.command.d.ts +0 -6
  205. package/types/src/add.module.d.ts +0 -14
  206. package/types/src/auth0-configure.action.d.ts +0 -7
  207. package/types/src/auth0-configure.command.d.ts +0 -6
  208. package/types/src/auth0-login.action.d.ts +0 -4
  209. package/types/src/auth0-login.command.d.ts +0 -6
  210. package/types/src/auth0.command.d.ts +0 -6
  211. package/types/src/auth0.module.d.ts +0 -18
  212. package/types/src/cli.d.ts +0 -2
  213. package/types/src/create.command.d.ts +0 -6
  214. package/types/src/create.module.d.ts +0 -14
  215. package/types/src/domain/prompt.d.ts +0 -4
  216. package/types/src/models/compose.model.d.ts +0 -73
  217. package/types/src/models/config-yaml.model.d.ts +0 -27
  218. package/types/src/models/const.d.ts +0 -20
  219. package/types/src/models/dev-container.model.d.ts +0 -49
  220. package/types/src/models/docker-image.model.d.ts +0 -90
  221. package/types/src/models/env-file.model.d.ts +0 -16
  222. package/types/src/models/gitignore.model.d.ts +0 -9
  223. package/types/src/models/launch-json.model.d.ts +0 -7
  224. package/types/src/models/package-json.model.d.ts +0 -36
  225. package/types/src/models/project.model.d.ts +0 -60
  226. package/types/src/models/tsconfig.model.d.ts +0 -5
  227. package/types/src/models/vitest-config.model.d.ts +0 -5
  228. package/types/src/models/vscode-settings.model.d.ts +0 -7
  229. package/types/src/program.d.ts +0 -8
  230. package/types/src/services/scaffold.service.d.ts +0 -22
  231. package/types/src/version.d.ts +0 -6
  232. package/types/src/webapi/api-name.d.ts +0 -14
  233. package/types/src/webapi/auth0-commands.d.ts +0 -11
  234. package/types/src/webapi/authorize-scopes.d.ts +0 -7
  235. package/types/src/webapi/cli-options.d.ts +0 -6
  236. package/types/src/webapi/create-api.d.ts +0 -15
  237. package/types/src/webapi/devcontainer/codebase-rag-mcp.d.ts +0 -32
  238. package/types/src/webapi/devcontainer/codebase-rag-mcp.ts +0 -182
  239. package/types/src/webapi/devcontainer/host-scripts.d.ts +0 -7
  240. package/types/src/webapi/devcontainer/templates/codebase-rag.env.example +0 -3
  241. package/types/src/webapi/devcontainer/templates/initialize.sh +0 -169
  242. package/types/src/webapi/devcontainer/templates/post-create.sh +0 -35
  243. package/types/src/webapi/devcontainer/templates/post-start.sh +0 -65
  244. package/types/src/webapi/devcontainer/templates/tty-prompt.sh +0 -38
  245. package/types/src/webapi/features/auth.feature.d.ts +0 -10
  246. package/types/src/webapi/features/auth0-cli.d.ts +0 -84
  247. package/types/src/webapi/features/biome-format.d.ts +0 -5
  248. package/types/src/webapi/features/database.feature.d.ts +0 -7
  249. package/types/src/webapi/features/finalize.feature.d.ts +0 -2
  250. package/types/src/webapi/features/postman.feature.d.ts +0 -16
  251. package/types/src/webapi/models/api-package-json.model.d.ts +0 -18
  252. package/types/src/webapi/models/auth-config.model.d.ts +0 -26
  253. package/types/src/webapi/models/controller-source-file.model.d.ts +0 -46
  254. package/types/src/webapi/models/github-ci.model.d.ts +0 -9
  255. package/types/src/webapi/models/main-source-file.model.d.ts +0 -54
  256. package/types/src/webapi/models/production-dockerfile.model.d.ts +0 -18
  257. package/types/src/webapi/models/sample-files.model.d.ts +0 -7
  258. package/types/src/webapi/models/webapi-image.model.d.ts +0 -12
  259. package/types/src/webapi/postman/hello-openapi.d.ts +0 -19
  260. package/types/src/webapi/postman/local-view.d.ts +0 -17
  261. package/types/src/webapi/postman/openapi-to-postman.d.ts +0 -62
  262. package/types/src/webapi/workspace-readme.d.ts +0 -18
  263. package/types/src/webapi.action.d.ts +0 -14
  264. package/types/src/webapi.command.d.ts +0 -11
@@ -1,88 +0,0 @@
1
- import { existsSync } from "node:fs";
2
- import { join } from "node:path";
3
- import { WELL_KNOWN_FILES } from "../models/const.js";
4
- import { apiNameFromProjectDir, listExistingApiNames } from "./api-name.js";
5
- /** Pure renderer — keep feature sections short and copy-paste ready. */ export function renderWorkspaceReadme(input) {
6
- const { projectName, apiNames, hasPostgres, hasAuth0, hasPostman } = input;
7
- const apis = apiNames.length > 0 ? apiNames : [
8
- "api"
9
- ];
10
- const lines = [
11
- `# ${projectName}`,
12
- "",
13
- "Decohere web API workspace. Scaffolded with [`@decohere/create`](https://www.npmjs.com/package/@decohere/create).",
14
- "",
15
- "## Get started",
16
- "",
17
- "1. Open this folder in VS Code / Cursor.",
18
- "2. **Reopen in Container** (or rebuild the Dev Container).",
19
- " Host `initialize.sh` and container `post-start.sh` ask y/N (TTY only) before npm auth or codebase RAG MCP.",
20
- " Skip or decline; missing TTY skips. RAG credentials land in `.cursor/` (gitignored).",
21
- "3. Install dependencies if needed:",
22
- "",
23
- "```bash",
24
- "pnpm install",
25
- "```",
26
- "",
27
- "## Develop",
28
- "",
29
- "```bash",
30
- "pnpm dev # Flux HMR (first API)",
31
- "pnpm start # run the compiled first API",
32
- "pnpm run build # forge release build",
33
- "pnpm run package # release build + .package/ for each API (what Docker copies)"
34
- ];
35
- for (const name of apis){
36
- lines.push(`pnpm run dev:${name} # HMR for ${name}`);
37
- lines.push(`pnpm run start:${name} # production entry for ${name}`);
38
- }
39
- lines.push("```", "");
40
- lines.push("## Logging", "", "In development, Scribe uses pino-pretty and rolling files under `logs/` (gitignored).", "When `NODE_ENV=production`, the process writes structured JSON to stdout and does not rotate files.", "Ship and retain those streams outside the app (platform logs, a sidecar, or a log agent) so shipping can change without rebuilding.", "", "Override roll path and rotation without changing app code:", "`SCRIBE_LOG_FILE`, `SCRIBE_LOG_SIZE`, `SCRIBE_LOG_FREQUENCY`, `SCRIBE_LOG_KEEP`.", "", 'Opt into in-process pretty or roll in production only with `{ when: "always" }` on `scribe.withPinoPretty` / `scribe.withPinoRoll`.', "");
41
- if (hasPostgres) {
42
- lines.push("## Database", "", "Postgres runs via Dev Container Compose:", "", "```bash", "pnpm db:up", "pnpm db:down", "pnpm db:reset", "```", "");
43
- }
44
- lines.push("## Deploy", "", "Each API has its own `projects/<name>/Dockerfile`. It copies `.package/`, which `forge package`", "writes before Docker runs: the API's compiled code, the workspace libraries it imports, and", "a plain `node_modules` of the third-party packages it uses (no symlinks). The image build", "installs nothing and needs no npm token.", "", "```bash", "pnpm run package # release build, then .package/ in every API", `docker build -t ${projectName} projects/api`, "```", "", "One API: `pnpm run package:<name>`, then `docker build projects/<name>`.", "A host that builds from a git clone does not have `.package/`; build and push the image", "from CI instead (`forge docker` after `pnpm run package`).", "");
45
- lines.push("## Add another API", "", "```bash", "decohere add api <name>", "```", "", "Example: `decohere add api billing`", "");
46
- if (hasAuth0) {
47
- lines.push("## Auth0", "", "JWT auth is wired from `.env` (`AUTH0_ISSUER_BASE_URL`, `AUTH0_AUDIENCE`).", 'After you add a controller, `@Authorize("read", "Invoice")` becomes the Auth0 permission `read:Invoice`.', "Sync the Auth0 API, admin grants, and Postman token scopes without re-scaffolding:", "", "```bash", "npx @decohere/create auth0 login # once / when the CLI token expires", "npx @decohere/create auth0 configure # after new @Authorize decorators", "```", "");
48
- }
49
- if (hasPostman) {
50
- lines.push("## Postman", "", "Open this **project root** in Postman Local View (Files → Open folder), not the `postman/` subfolder.", "Select the Local environment, then Authorization → Get New Access Token when Auth0 is enabled.", "");
51
- }
52
- lines.push("## More", "", "- Package docs: https://www.npmjs.com/package/@decohere/create", "- After `decohere add api`, this README is refreshed so scripts and APIs stay accurate.", "");
53
- return `${lines.join("\n")}`;
54
- }
55
- export function resolveWorkspaceReadmeInput(workspace, options) {
56
- const newNames = workspace.getProjects().map((project)=>apiNameFromProjectDir(project.dir));
57
- const apiNames = options.add ? mergeApiNames(listExistingApiNames(workspace.targetDir), newNames) : newNames;
58
- const pkg = workspace.getModel(WELL_KNOWN_FILES.PACKAGE_JSON);
59
- const env = workspace.getModel(WELL_KNOWN_FILES.ENV_FILE);
60
- const hasPostgres = options.databaseProvider === "postgres/typeorm" || Boolean(pkg?.hasScript("db:up"));
61
- const hasAuth0 = options.authProvider === "auth0" || Boolean(env?.hasEntry("AUTH0_ISSUER_BASE_URL"));
62
- const hasPostman = options.postmanProvider === "local" || options.postmanProvider === "api" || existsSync(join(workspace.targetDir, "postman")) || existsSync(join(workspace.targetDir, ".postman"));
63
- return {
64
- projectName: workspace.name,
65
- apiNames,
66
- hasPostgres,
67
- hasAuth0,
68
- hasPostman
69
- };
70
- }
71
- export function writeWorkspaceReadme(workspace, options) {
72
- const content = renderWorkspaceReadme(resolveWorkspaceReadmeInput(workspace, options));
73
- workspace.addFile({
74
- files: ()=>[
75
- {
76
- filePath: "README.md",
77
- content
78
- }
79
- ]
80
- });
81
- }
82
- function mergeApiNames(existing, added) {
83
- const seen = new Set(existing);
84
- return [
85
- ...existing,
86
- ...added.filter((name)=>!seen.has(name))
87
- ];
88
- }
@@ -1,18 +0,0 @@
1
- function _ts_decorate(decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- }
7
- import { injectable } from "@decohere/crucible/decorators";
8
- import { ActionResponse } from "@decohere/devkit/cli";
9
- import { runScaffoldApi, toApiOptions } from "./webapi/cli-options.js";
10
- export class WebapiAction {
11
- async run(options) {
12
- await runScaffoldApi(toApiOptions(options.directory, options));
13
- return ActionResponse.Success("webapi");
14
- }
15
- }
16
- WebapiAction = _ts_decorate([
17
- injectable()
18
- ], WebapiAction);
@@ -1,33 +0,0 @@
1
- import { DecohereCommand } from "@decohere/devkit/cli";
2
- import { addWebapiFeatureOptions, collectName } from "./webapi/cli-options.js";
3
- import { WebapiAction } from "./webapi.action.js";
4
- export class WebapiCommand extends DecohereCommand {
5
- get actions() {
6
- return [
7
- WebapiAction
8
- ];
9
- }
10
- constructor(name){
11
- super(name);
12
- this.description("Scaffold a web API workspace");
13
- this.argument("[directory]", "Target directory (default: -d or current directory)");
14
- this.option("-d <directory>", "Target directory (default: current directory)", ".");
15
- this.option("--name <slug>", "API name under projects/ (repeatable; default: api)", collectName, []);
16
- addWebapiFeatureOptions(this);
17
- }
18
- /**
19
- * Commander passes positional args before options when `[directory]` is declared.
20
- * ModuleFactory expects `(opts, cmd)` — stash the directory on the command.
21
- */ action(fn) {
22
- return super.action((...args)=>{
23
- const cmd = args.at(-1);
24
- const first = args[0];
25
- const hasPositional = typeof first === "string" || first === undefined;
26
- const opts = hasPositional ? args[1] : args[0];
27
- if (typeof first === "string" && first !== "") {
28
- cmd.setOptionValue("directory", first);
29
- }
30
- return fn(opts, cmd);
31
- });
32
- }
33
- }
@@ -1,13 +0,0 @@
1
- import { type Action, ActionResponse } from "@decohere/devkit/cli";
2
- export type AddApiOptions = {
3
- apiName?: string;
4
- d?: string;
5
- database?: string;
6
- auth?: string;
7
- postman?: string;
8
- yes?: boolean;
9
- install?: string;
10
- };
11
- export declare class AddApiAction implements Action<AddApiOptions> {
12
- run(options: AddApiOptions): Promise<ActionResponse>;
13
- }
@@ -1,7 +0,0 @@
1
- import { DecohereCommand } from "@decohere/devkit/cli";
2
- import { AddApiAction } from "./add-api.action.js";
3
- export declare class AddApiCommand extends DecohereCommand {
4
- get actions(): (typeof AddApiAction)[];
5
- constructor(name: string);
6
- action(fn: (...args: unknown[]) => void | Promise<void>): this;
7
- }
@@ -1,6 +0,0 @@
1
- import type { Actions } from "@decohere/devkit/cli";
2
- import { type CommandHandler, type CommandResponse, type CommandType, DecohereCommand } from "@decohere/devkit/cli";
3
- export declare class AddCommand extends DecohereCommand {
4
- constructor(commands: Record<string, CommandType>, handler: CommandHandler);
5
- run(_actions: Actions, _options: never): Promise<CommandResponse>;
6
- }
@@ -1,14 +0,0 @@
1
- import { ModuleManifest } from "@decohere/devkit/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
- export declare class AddModule extends ModuleManifest {
6
- readonly id = "add";
7
- readonly command: typeof AddCommand;
8
- readonly commands: {
9
- api: typeof AddApiCommand;
10
- };
11
- readonly actions: {
12
- api: typeof AddApiAction;
13
- };
14
- }
@@ -1,7 +0,0 @@
1
- import { type Action, ActionResponse } from "@decohere/devkit/cli";
2
- export type Auth0ConfigureOptions = {
3
- d?: string;
4
- };
5
- export declare class Auth0ConfigureAction implements Action<Auth0ConfigureOptions> {
6
- run(options: Auth0ConfigureOptions): Promise<ActionResponse>;
7
- }
@@ -1,6 +0,0 @@
1
- import { DecohereCommand } from "@decohere/devkit/cli";
2
- import { Auth0ConfigureAction } from "./auth0-configure.action.js";
3
- export declare class Auth0ConfigureCommand extends DecohereCommand {
4
- get actions(): (typeof Auth0ConfigureAction)[];
5
- constructor(name: string);
6
- }
@@ -1,4 +0,0 @@
1
- import { type Action, ActionResponse } from "@decohere/devkit/cli";
2
- export declare class Auth0LoginAction implements Action {
3
- run(): Promise<ActionResponse>;
4
- }
@@ -1,6 +0,0 @@
1
- import { DecohereCommand } from "@decohere/devkit/cli";
2
- import { Auth0LoginAction } from "./auth0-login.action.js";
3
- export declare class Auth0LoginCommand extends DecohereCommand {
4
- get actions(): (typeof Auth0LoginAction)[];
5
- constructor(name: string);
6
- }
@@ -1,6 +0,0 @@
1
- import type { Actions } from "@decohere/devkit/cli";
2
- import { type CommandHandler, type CommandResponse, type CommandType, DecohereCommand } from "@decohere/devkit/cli";
3
- export declare class Auth0Command extends DecohereCommand {
4
- constructor(commands: Record<string, CommandType>, handler: CommandHandler);
5
- run(_actions: Actions, _options: never): Promise<CommandResponse>;
6
- }
@@ -1,18 +0,0 @@
1
- import { ModuleManifest } from "@decohere/devkit/cli";
2
- import { Auth0Command } from "./auth0.command.js";
3
- import { Auth0ConfigureAction } from "./auth0-configure.action.js";
4
- import { Auth0ConfigureCommand } from "./auth0-configure.command.js";
5
- import { Auth0LoginAction } from "./auth0-login.action.js";
6
- import { Auth0LoginCommand } from "./auth0-login.command.js";
7
- export declare class Auth0Module extends ModuleManifest {
8
- readonly id = "auth0";
9
- readonly command: typeof Auth0Command;
10
- readonly commands: {
11
- login: typeof Auth0LoginCommand;
12
- configure: typeof Auth0ConfigureCommand;
13
- };
14
- readonly actions: {
15
- login: typeof Auth0LoginAction;
16
- configure: typeof Auth0ConfigureAction;
17
- };
18
- }
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,6 +0,0 @@
1
- import type { Actions } from "@decohere/devkit/cli";
2
- import { type CommandHandler, type CommandResponse, type CommandType, DecohereCommand } from "@decohere/devkit/cli";
3
- export declare class CreateCommand extends DecohereCommand {
4
- constructor(commands: Record<string, CommandType>, handler: CommandHandler);
5
- run(_actions: Actions, _options: never): Promise<CommandResponse>;
6
- }
@@ -1,14 +0,0 @@
1
- import { ModuleManifest } from "@decohere/devkit/cli";
2
- import { CreateCommand } from "./create.command.js";
3
- import { WebapiAction } from "./webapi.action.js";
4
- import { WebapiCommand } from "./webapi.command.js";
5
- export declare class CreateModule extends ModuleManifest {
6
- readonly id = "create";
7
- readonly command: typeof CreateCommand;
8
- readonly commands: {
9
- webapi: typeof WebapiCommand;
10
- };
11
- readonly actions: {
12
- webapi: typeof WebapiAction;
13
- };
14
- }
@@ -1,4 +0,0 @@
1
- /** Release stdin so the process can exit after interactive prompts. */
2
- export declare function closePrompt(): void;
3
- export declare function ask(question: string, fallback?: string): Promise<string>;
4
- export declare function pick<T>(label: string, items: T[], display: (item: T) => string): Promise<T | null>;
@@ -1,73 +0,0 @@
1
- import type { KeyedModel } from "./source-file.js";
2
- export type ComposeNetworkRef = string | {
3
- /** Network key under `networks:` on this service */
4
- [networkKey: string]: {
5
- aliases?: string[];
6
- };
7
- };
8
- export interface ComposeHealthcheck {
9
- test: string[];
10
- interval?: string;
11
- timeout?: string;
12
- retries?: number;
13
- }
14
- export interface ComposeService {
15
- build?: string;
16
- image?: string;
17
- container_name?: string;
18
- /** Quoted in YAML (`0:0` must not parse as a number). */
19
- user?: string;
20
- env_file?: string[];
21
- environment?: Record<string, string>;
22
- ports?: string[];
23
- volumes?: string[];
24
- command?: string;
25
- restart?: string;
26
- depends_on?: string[];
27
- /** Compose profiles (service only starts when profile is enabled). */
28
- profiles?: string[];
29
- /** Attach to compose networks (string name or map with aliases). */
30
- networks?: ComposeNetworkRef[];
31
- healthcheck?: ComposeHealthcheck;
32
- }
33
- export type ComposeNetwork = {
34
- /** Fixed Docker network name (shareable across compose projects). */
35
- name: string;
36
- external?: boolean;
37
- };
38
- /**
39
- * Live builder for `docker-compose.yml`.
40
- *
41
- * Features call `addService` / `addVolume` / `addNetwork` in their scaffold phases.
42
- * Loaded with `fromFile` (`decohere add api`), additions merge into the existing file:
43
- * services, networks and volumes already there are left untouched, comments kept.
44
- */
45
- export declare class DockerCompose implements KeyedModel {
46
- readonly key: string;
47
- private _projectName;
48
- private readonly _headerComments;
49
- private readonly _services;
50
- private readonly _volumes;
51
- private readonly _networks;
52
- private readonly _envFiles;
53
- private _existing;
54
- /** Load an existing compose file so `decohere add api` can merge into it. */
55
- static fromFile(absolutePath: string): DockerCompose;
56
- /** True when the service is defined (in the loaded file or added since). */
57
- hasService(name: string): boolean;
58
- /** Compose project name (`name:` top-level) — isolates containers/volumes. */
59
- setProjectName(name: string): this;
60
- /** File-level `#` comments rendered above `name:` / `services:`. */
61
- addHeaderComment(...lines: string[]): this;
62
- addService(name: string, config: ComposeService): this;
63
- files(): {
64
- filePath: string;
65
- content: string;
66
- }[];
67
- addVolume(name: string): this;
68
- addNetwork(key: string, network: ComposeNetwork): this;
69
- /** Append an env_file path to an existing service. */
70
- addEnvFile(serviceName: string, filePath: string): this;
71
- getContent(): string;
72
- private mergeIntoExisting;
73
- }
@@ -1,27 +0,0 @@
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
- /** True when a datasource with this `name:` already appears in the file. */
16
- hasDataSource(name: string): boolean;
17
- hasDataSources(): boolean;
18
- /**
19
- * Insert a `dataSources` list item. Used by `webapi add` so we do not write a
20
- * second top-level `database:` key (YAML last-key-wins).
21
- */
22
- appendDataSource(item: string): this;
23
- static fromFile(key: string, relativePath: string, absolutePath: string): ConfigYaml;
24
- files(): SourceFile[];
25
- }
26
- /** Insert a YAML list item under `dataSources:`; append a new `database:` block if missing. */
27
- export declare function injectYamlDataSource(yaml: string, item: string): string;
@@ -1,20 +0,0 @@
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
- PRODUCTION_DOCKERFILE: string;
8
- GITHUB_CI: string;
9
- PACKAGE_JSON: string;
10
- API_PACKAGE_JSON: string;
11
- TSCONFIG: string;
12
- VITEST_CONFIG: string;
13
- MAIN_TS: string;
14
- CONTROLLER_TS: string;
15
- CONFIG_YAML: string;
16
- CONFIG_DEV_YAML: string;
17
- GITIGNORE: string;
18
- AUTH_CONFIG: string;
19
- ENV_FILE: string;
20
- };
@@ -1,49 +0,0 @@
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 type PortAttributes = {
9
- label?: string;
10
- /** When true, host port must match the container port (no random remap). */
11
- requireLocalPort?: boolean;
12
- onAutoForward?: "notify" | "openBrowser" | "openPreview" | "silent" | "ignore";
13
- };
14
- export declare class DevContainer implements KeyedModel {
15
- readonly key: string;
16
- private readonly _extensions;
17
- private readonly _ports;
18
- private readonly _portAttributes;
19
- private _mounts;
20
- private _workspaceFolder;
21
- private _postCreateCommand?;
22
- private _updateContentCommand?;
23
- private _postStartCommand?;
24
- private _initializeCommand?;
25
- private _remoteUser;
26
- private _useCompose;
27
- private _existing;
28
- /**
29
- * Load an existing devcontainer.json so `decohere add api` can merge into it.
30
- * Only extensions, forwarded ports and port attributes are merged; everything else is kept.
31
- */
32
- static fromFile(absolutePath: string): DevContainer;
33
- constructor();
34
- /** In-container path Cursor/VS Code opens (Agents window uses the basename). */
35
- setWorkspaceFolder(folder: string): this;
36
- private bindMount;
37
- addExtension(...ids: string[]): this;
38
- forwardPort(...ports: number[]): this;
39
- setPortAttributes(port: number, attrs: PortAttributes): this;
40
- setPostCreateCommand(cmd: string): this;
41
- setUpdateContentCommand(cmd: string): this;
42
- setPostStartCommand(cmd: string): this;
43
- setInitializeCommand(cmd: string): this;
44
- setRemoteUser(user: string): this;
45
- useCompose(): this;
46
- files(): SourceFile[];
47
- private mergeIntoExisting;
48
- private build;
49
- }
@@ -1,90 +0,0 @@
1
- import type { KeyedModel, SourceFile } from "./source-file.js";
2
- export type LayerWriter = (dockerfile: DockerfileModel) => void;
3
- export declare class DockerStep {
4
- readonly key: string;
5
- readonly content: string;
6
- readonly order: number;
7
- constructor(key: string, content: string, order?: number);
8
- static run(key: string, command: string, order?: number): DockerStep;
9
- static raw(key: string, content: string, order?: number): DockerStep;
10
- static entrypoint(key: string, value: string | readonly string[], order?: number): DockerStep;
11
- }
12
- /** Named volume + paths for interactive bash history in app Dev Containers. */
13
- export declare const commandHistory: {
14
- readonly volumeName: "bashhistory";
15
- readonly dir: "/commandhistory";
16
- readonly fileName: ".bash_history";
17
- readonly histFile: "/commandhistory/.bash_history";
18
- };
19
- export declare function withCommandHistory(options?: {
20
- historyDir?: string;
21
- historyFileName?: string;
22
- username?: string;
23
- order?: number;
24
- }): LayerWriter;
25
- export declare function withNodeUser(options?: {
26
- username?: string;
27
- includeUserInstruction?: boolean;
28
- order?: number;
29
- }): LayerWriter;
30
- export declare function withPnpm(options?: {
31
- version?: string;
32
- usernameExpr?: string;
33
- order?: number;
34
- }): LayerWriter;
35
- /**
36
- * Client-only (`psql`, etc.). Escalates to root so this also works when layered on
37
- * a published base image that already switched to `USER node`.
38
- */
39
- export declare function withPostgresqlClient(options?: {
40
- order?: number;
41
- username?: string;
42
- }): LayerWriter;
43
- /** GitHub CLI — install before USER switches away from root. */
44
- export declare function withGithubCli(options?: {
45
- order?: number;
46
- }): LayerWriter;
47
- export declare function withWorkspaceNodeModulesOwnership(options?: {
48
- workspaceDir?: string;
49
- usernameExpr?: string;
50
- order?: number;
51
- }): LayerWriter;
52
- export declare function withVsCodeJsDebugBootloaderFix(options?: {
53
- bashrcPath?: string;
54
- order?: number;
55
- }): LayerWriter;
56
- export declare class DockerfileModel implements KeyedModel {
57
- readonly key: string;
58
- private readonly _steps;
59
- private readonly _layerWriters;
60
- private _fromImage;
61
- private _layerCounter;
62
- private _existing;
63
- constructor(baseImage: string);
64
- /**
65
- * Load an existing Dockerfile so `decohere add api` can append feature layers.
66
- * The new steps are appended as one block, unless the file already contains it.
67
- */
68
- static fromFile(absolutePath: string, filePath: string): DockerfileModel;
69
- from(baseImage: string): this;
70
- addLayer(layer: LayerWriter | string, order?: 5000): this;
71
- addStep(step: DockerStep): this;
72
- removeStep(key: string): this;
73
- entrypoint(value: string | readonly string[], order?: 10000): this;
74
- addRunStep(cmd: string): this;
75
- build(): string;
76
- protected registerBaseLayers(): void;
77
- files(): SourceFile[];
78
- }
79
- /**
80
- * Shared layers for the published `ghcr.io/typesmiths/decohere/devcontainer` image.
81
- * Checked in at `projects/devcontainer/Dockerfile` — keep in sync via the unit test.
82
- */
83
- export declare class AppDevContainerBaseImage extends DockerfileModel {
84
- protected registerBaseLayers(): void;
85
- }
86
- /** Generic Dev Container image helpers (history + bootloader) without webapi defaults. */
87
- export declare class DevContainerImageModel extends DockerfileModel {
88
- protected registerBaseLayers(): void;
89
- files(): SourceFile[];
90
- }
@@ -1,16 +0,0 @@
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
- hasEntry(key: string): boolean;
14
- static fromFile(absolutePath: string): EnvFile;
15
- files(): SourceFile[];
16
- }
@@ -1,9 +0,0 @@
1
- import type { KeyedModel, SourceFile } from "./source-file.js";
2
- export declare class Gitignore implements KeyedModel {
3
- readonly key: string;
4
- private ignoreList;
5
- /** Load an existing .gitignore so `decohere add api` appends instead of replacing. */
6
- static fromFile(absolutePath: string): Gitignore;
7
- add(...patterns: string[]): this;
8
- files(): SourceFile[];
9
- }
@@ -1,7 +0,0 @@
1
- import type { KeyedModel, SourceFile } from "./source-file.js";
2
- export declare class LaunchJson implements KeyedModel {
3
- private readonly apiNames;
4
- readonly key: string;
5
- constructor(apiNames?: readonly string[]);
6
- files(): SourceFile[];
7
- }
@@ -1,36 +0,0 @@
1
- import type { KeyedModel, SourceFile } from "./source-file.js";
2
- export type PackageJsonOptions = {
3
- startEntry?: string;
4
- /** API slugs in this workspace. Drives `start:<name>` / `dev:<name>`. */
5
- apiNames?: readonly string[];
6
- /** Host workspace name used in `@<workspace>/<api>` for flux `--project`. */
7
- workspaceName?: string;
8
- };
9
- /**
10
- * Builder for the root `package.json`.
11
- *
12
- * Starts with the core API dependencies. Features call `addDependency` /
13
- * `addDevDependency` during their scaffold phase to inject their own deps
14
- * before `files()` is called at render time.
15
- */
16
- export declare class PackageJson implements KeyedModel {
17
- private readonly name;
18
- readonly key: string;
19
- private _dependencies;
20
- private _devDependencies;
21
- private _scripts;
22
- private _version;
23
- private _type;
24
- private _rest;
25
- constructor(name: string, options?: PackageJsonOptions);
26
- /** Load an existing root package.json so `webapi add` can merge scripts/deps. */
27
- static fromFile(filePath: string): PackageJson;
28
- addDependency(name: string, version: string): this;
29
- addDevDependency(name: string, version: string): this;
30
- addScript(name: string, command: string): this;
31
- hasScript(name: string): boolean;
32
- files(): SourceFile[];
33
- }
34
- /** Stable A→Z key order for package.json dependency maps. */
35
- export declare function sortStringMap(map: Record<string, string>): Record<string, string>;
36
- export declare function packageScript(workspaceName: string, apiName: string): string;