@tdk-landscape/tdk-cli-core 1.3.48 → 1.3.50

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 (309) hide show
  1. package/.claude/skills/layer-autoresearch/SKILL.md +48 -0
  2. package/.claude/skills/tdk-troubleshoot/SKILL.md +222 -0
  3. package/.github/ISSUE_TEMPLATE/bug_report.yml +40 -0
  4. package/.github/ISSUE_TEMPLATE/config.yml +8 -0
  5. package/.github/ISSUE_TEMPLATE/feature_request.yml +18 -0
  6. package/.github/dependabot.yml +33 -0
  7. package/.github/pull_request_template.md +5 -0
  8. package/.github/workflows/ci.yml +187 -0
  9. package/.github/workflows/release-binaries.yml +19 -9
  10. package/.github/zizmor.yml +9 -0
  11. package/CODE_OF_CONDUCT.md +9 -0
  12. package/CONTRIBUTING.md +42 -0
  13. package/LICENSE +21 -0
  14. package/README.md +149 -0
  15. package/SECURITY.md +17 -0
  16. package/benchmarks/results/container-scale-2026-09-25T20-54-49-736Z.json +45 -0
  17. package/benchmarks/results/container-scale-2026-09-25T21-01-20-540Z.json +150 -0
  18. package/benchmarks/results/container-scale-2026-09-25T21-15-01-441Z.json +73 -0
  19. package/benchmarks/results/container-scale-2026-09-25T22-09-01-630Z.json +77 -0
  20. package/benchmarks/results/container-scale-2026-09-25T22-18-28-371Z.json +202 -0
  21. package/cli/README.md +25 -0
  22. package/cli/biome.json +1 -1
  23. package/cli/dist/cli.d.ts +3 -0
  24. package/cli/dist/cli.d.ts.map +1 -0
  25. package/cli/dist/cli.js +64 -0
  26. package/cli/dist/cli.js.map +1 -0
  27. package/cli/dist/commands/completion.d.ts +3 -0
  28. package/cli/dist/commands/completion.d.ts.map +1 -0
  29. package/cli/dist/commands/completion.js +294 -0
  30. package/cli/dist/commands/completion.js.map +1 -0
  31. package/cli/dist/commands/config.d.ts +3 -0
  32. package/cli/dist/commands/config.d.ts.map +1 -0
  33. package/cli/dist/commands/config.js +231 -0
  34. package/cli/dist/commands/config.js.map +1 -0
  35. package/cli/dist/commands/doctor.d.ts +19 -0
  36. package/cli/dist/commands/doctor.d.ts.map +1 -0
  37. package/cli/dist/commands/doctor.js +745 -0
  38. package/cli/dist/commands/doctor.js.map +1 -0
  39. package/cli/dist/commands/down.d.ts +3 -0
  40. package/cli/dist/commands/down.d.ts.map +1 -0
  41. package/cli/dist/commands/down.js +32 -0
  42. package/cli/dist/commands/down.js.map +1 -0
  43. package/cli/dist/commands/help.d.ts +2 -0
  44. package/cli/dist/commands/help.d.ts.map +1 -0
  45. package/cli/dist/commands/help.js +138 -0
  46. package/cli/dist/commands/help.js.map +1 -0
  47. package/cli/dist/commands/networks.d.ts +3 -0
  48. package/cli/dist/commands/networks.d.ts.map +1 -0
  49. package/cli/dist/commands/networks.js +260 -0
  50. package/cli/dist/commands/networks.js.map +1 -0
  51. package/cli/dist/commands/project.d.ts +3 -0
  52. package/cli/dist/commands/project.d.ts.map +1 -0
  53. package/cli/dist/commands/project.js +370 -0
  54. package/cli/dist/commands/project.js.map +1 -0
  55. package/cli/dist/commands/projects.d.ts +3 -0
  56. package/cli/dist/commands/projects.d.ts.map +1 -0
  57. package/cli/dist/commands/projects.js +71 -0
  58. package/cli/dist/commands/projects.js.map +1 -0
  59. package/cli/dist/commands/resource.d.ts +69 -0
  60. package/cli/dist/commands/resource.d.ts.map +1 -0
  61. package/cli/dist/commands/resource.js +579 -0
  62. package/cli/dist/commands/resource.js.map +1 -0
  63. package/cli/dist/commands/resources.d.ts +3 -0
  64. package/cli/dist/commands/resources.d.ts.map +1 -0
  65. package/cli/dist/commands/resources.js +73 -0
  66. package/cli/dist/commands/resources.js.map +1 -0
  67. package/cli/dist/commands/stack.d.ts +3 -0
  68. package/cli/dist/commands/stack.d.ts.map +1 -0
  69. package/cli/dist/commands/stack.js +97 -0
  70. package/cli/dist/commands/stack.js.map +1 -0
  71. package/cli/dist/commands/stacks.d.ts +3 -0
  72. package/cli/dist/commands/stacks.d.ts.map +1 -0
  73. package/cli/dist/commands/stacks.js +43 -0
  74. package/cli/dist/commands/stacks.js.map +1 -0
  75. package/cli/dist/commands/status.d.ts +3 -0
  76. package/cli/dist/commands/status.d.ts.map +1 -0
  77. package/cli/dist/commands/status.js +71 -0
  78. package/cli/dist/commands/status.js.map +1 -0
  79. package/cli/dist/commands/ui.d.ts +3 -0
  80. package/cli/dist/commands/ui.d.ts.map +1 -0
  81. package/cli/dist/commands/ui.js +445 -0
  82. package/cli/dist/commands/ui.js.map +1 -0
  83. package/cli/dist/commands/up.d.ts +3 -0
  84. package/cli/dist/commands/up.d.ts.map +1 -0
  85. package/cli/dist/commands/up.js +124 -0
  86. package/cli/dist/commands/up.js.map +1 -0
  87. package/cli/dist/commands/upgrade.d.ts +11 -0
  88. package/cli/dist/commands/upgrade.d.ts.map +1 -0
  89. package/cli/dist/commands/upgrade.js +496 -0
  90. package/cli/dist/commands/upgrade.js.map +1 -0
  91. package/cli/dist/commands/version.d.ts +3 -0
  92. package/cli/dist/commands/version.d.ts.map +1 -0
  93. package/cli/dist/commands/version.js +9 -0
  94. package/cli/dist/commands/version.js.map +1 -0
  95. package/cli/dist/components/Accessible.d.ts +8 -0
  96. package/cli/dist/components/Accessible.d.ts.map +1 -0
  97. package/cli/dist/components/Accessible.js +10 -0
  98. package/cli/dist/components/Accessible.js.map +1 -0
  99. package/cli/dist/components/BaseTooltip.d.ts +4 -0
  100. package/cli/dist/components/BaseTooltip.d.ts.map +1 -0
  101. package/cli/dist/components/BaseTooltip.js +28 -0
  102. package/cli/dist/components/BaseTooltip.js.map +1 -0
  103. package/cli/dist/components/DetailPanel.d.ts +4 -0
  104. package/cli/dist/components/DetailPanel.d.ts.map +1 -0
  105. package/cli/dist/components/DetailPanel.js +18 -0
  106. package/cli/dist/components/DetailPanel.js.map +1 -0
  107. package/cli/dist/components/FileTree.d.ts +4 -0
  108. package/cli/dist/components/FileTree.d.ts.map +1 -0
  109. package/cli/dist/components/FileTree.js +47 -0
  110. package/cli/dist/components/FileTree.js.map +1 -0
  111. package/cli/dist/components/ResourceSelectInput.d.ts +4 -0
  112. package/cli/dist/components/ResourceSelectInput.d.ts.map +1 -0
  113. package/cli/dist/components/ResourceSelectInput.js +7 -0
  114. package/cli/dist/components/ResourceSelectInput.js.map +1 -0
  115. package/cli/dist/components/ResourceTable.d.ts +4 -0
  116. package/cli/dist/components/ResourceTable.d.ts.map +1 -0
  117. package/cli/dist/components/ResourceTable.js +18 -0
  118. package/cli/dist/components/ResourceTable.js.map +1 -0
  119. package/cli/dist/components/TabBar.d.ts +4 -0
  120. package/cli/dist/components/TabBar.d.ts.map +1 -0
  121. package/cli/dist/components/TabBar.js +17 -0
  122. package/cli/dist/components/TabBar.js.map +1 -0
  123. package/cli/dist/components/Tooltip.d.ts +12 -0
  124. package/cli/dist/components/Tooltip.d.ts.map +1 -0
  125. package/cli/dist/components/Tooltip.js +12 -0
  126. package/cli/dist/components/Tooltip.js.map +1 -0
  127. package/cli/dist/components/index.d.ts +8 -0
  128. package/cli/dist/components/index.d.ts.map +1 -0
  129. package/cli/dist/components/index.js +8 -0
  130. package/cli/dist/components/index.js.map +1 -0
  131. package/cli/dist/config/platform-standards.d.ts +159 -0
  132. package/cli/dist/config/platform-standards.d.ts.map +1 -0
  133. package/cli/dist/config/platform-standards.js +181 -0
  134. package/cli/dist/config/platform-standards.js.map +1 -0
  135. package/cli/dist/generator/extension-fetch.d.ts +25 -0
  136. package/cli/dist/generator/extension-fetch.d.ts.map +1 -0
  137. package/cli/dist/generator/extension-fetch.js +259 -0
  138. package/cli/dist/generator/extension-fetch.js.map +1 -0
  139. package/cli/dist/generator/template-engine.d.ts +62 -0
  140. package/cli/dist/generator/template-engine.d.ts.map +1 -0
  141. package/cli/dist/generator/template-engine.js +623 -0
  142. package/cli/dist/generator/template-engine.js.map +1 -0
  143. package/cli/dist/index.d.ts +11 -0
  144. package/cli/dist/index.d.ts.map +1 -0
  145. package/cli/dist/index.js +11 -0
  146. package/cli/dist/index.js.map +1 -0
  147. package/cli/dist/types/index.d.ts +257 -0
  148. package/cli/dist/types/index.d.ts.map +1 -0
  149. package/cli/dist/types/index.js +17 -0
  150. package/cli/dist/types/index.js.map +1 -0
  151. package/cli/dist/utils/cache.d.ts +19 -0
  152. package/cli/dist/utils/cache.d.ts.map +1 -0
  153. package/cli/dist/utils/cache.js +64 -0
  154. package/cli/dist/utils/cache.js.map +1 -0
  155. package/cli/dist/utils/command-helpers.d.ts +17 -0
  156. package/cli/dist/utils/command-helpers.d.ts.map +1 -0
  157. package/cli/dist/utils/command-helpers.js +41 -0
  158. package/cli/dist/utils/command-helpers.js.map +1 -0
  159. package/cli/dist/utils/constants.d.ts +53 -0
  160. package/cli/dist/utils/constants.d.ts.map +1 -0
  161. package/cli/dist/utils/constants.js +115 -0
  162. package/cli/dist/utils/constants.js.map +1 -0
  163. package/cli/dist/utils/discovery-context.d.ts +4 -0
  164. package/cli/dist/utils/discovery-context.d.ts.map +1 -0
  165. package/cli/dist/utils/discovery-context.js +39 -0
  166. package/cli/dist/utils/discovery-context.js.map +1 -0
  167. package/cli/dist/utils/docker.d.ts +4 -0
  168. package/cli/dist/utils/docker.d.ts.map +1 -0
  169. package/cli/dist/utils/docker.js +19 -0
  170. package/cli/dist/utils/docker.js.map +1 -0
  171. package/cli/dist/utils/doctor-runtime.d.ts +81 -0
  172. package/cli/dist/utils/doctor-runtime.d.ts.map +1 -0
  173. package/cli/dist/utils/doctor-runtime.js +498 -0
  174. package/cli/dist/utils/doctor-runtime.js.map +1 -0
  175. package/cli/dist/utils/env-validator.d.ts +15 -0
  176. package/cli/dist/utils/env-validator.d.ts.map +1 -0
  177. package/cli/dist/utils/env-validator.js +109 -0
  178. package/cli/dist/utils/env-validator.js.map +1 -0
  179. package/cli/dist/utils/errors.d.ts +31 -0
  180. package/cli/dist/utils/errors.d.ts.map +1 -0
  181. package/cli/dist/utils/errors.js +140 -0
  182. package/cli/dist/utils/errors.js.map +1 -0
  183. package/cli/dist/utils/file-helpers.d.ts +14 -0
  184. package/cli/dist/utils/file-helpers.d.ts.map +1 -0
  185. package/cli/dist/utils/file-helpers.js +45 -0
  186. package/cli/dist/utils/file-helpers.js.map +1 -0
  187. package/cli/dist/utils/formatting.d.ts +30 -0
  188. package/cli/dist/utils/formatting.d.ts.map +1 -0
  189. package/cli/dist/utils/formatting.js +164 -0
  190. package/cli/dist/utils/formatting.js.map +1 -0
  191. package/cli/dist/utils/paths.d.ts +3 -0
  192. package/cli/dist/utils/paths.d.ts.map +1 -0
  193. package/cli/dist/utils/paths.js +41 -0
  194. package/cli/dist/utils/paths.js.map +1 -0
  195. package/cli/dist/utils/port-assignment.d.ts +6 -0
  196. package/cli/dist/utils/port-assignment.d.ts.map +1 -0
  197. package/cli/dist/utils/port-assignment.js +81 -0
  198. package/cli/dist/utils/port-assignment.js.map +1 -0
  199. package/cli/dist/utils/project-features.d.ts +23 -0
  200. package/cli/dist/utils/project-features.d.ts.map +1 -0
  201. package/cli/dist/utils/project-features.js +98 -0
  202. package/cli/dist/utils/project-features.js.map +1 -0
  203. package/cli/dist/utils/project-templates.d.ts +7 -0
  204. package/cli/dist/utils/project-templates.d.ts.map +1 -0
  205. package/cli/dist/utils/project-templates.js +24 -0
  206. package/cli/dist/utils/project-templates.js.map +1 -0
  207. package/cli/dist/utils/prompt.d.ts +28 -0
  208. package/cli/dist/utils/prompt.d.ts.map +1 -0
  209. package/cli/dist/utils/prompt.js +79 -0
  210. package/cli/dist/utils/prompt.js.map +1 -0
  211. package/cli/dist/utils/resource-features.d.ts +29 -0
  212. package/cli/dist/utils/resource-features.d.ts.map +1 -0
  213. package/cli/dist/utils/resource-features.js +175 -0
  214. package/cli/dist/utils/resource-features.js.map +1 -0
  215. package/cli/dist/utils/service-urls.d.ts +30 -0
  216. package/cli/dist/utils/service-urls.d.ts.map +1 -0
  217. package/cli/dist/utils/service-urls.js +93 -0
  218. package/cli/dist/utils/service-urls.js.map +1 -0
  219. package/cli/dist/utils/services.d.ts +18 -0
  220. package/cli/dist/utils/services.d.ts.map +1 -0
  221. package/cli/dist/utils/services.js +292 -0
  222. package/cli/dist/utils/services.js.map +1 -0
  223. package/cli/dist/utils/stack-features.d.ts +22 -0
  224. package/cli/dist/utils/stack-features.d.ts.map +1 -0
  225. package/cli/dist/utils/stack-features.js +13 -0
  226. package/cli/dist/utils/stack-features.js.map +1 -0
  227. package/cli/dist/utils/tar.d.ts +7 -0
  228. package/cli/dist/utils/tar.d.ts.map +1 -0
  229. package/cli/dist/utils/tar.js +21 -0
  230. package/cli/dist/utils/tar.js.map +1 -0
  231. package/cli/dist/utils/tilt.d.ts +20 -0
  232. package/cli/dist/utils/tilt.d.ts.map +1 -0
  233. package/cli/dist/utils/tilt.js +95 -0
  234. package/cli/dist/utils/tilt.js.map +1 -0
  235. package/cli/dist/utils/validation.d.ts +16 -0
  236. package/cli/dist/utils/validation.d.ts.map +1 -0
  237. package/cli/dist/utils/validation.js +58 -0
  238. package/cli/dist/utils/validation.js.map +1 -0
  239. package/cli/package.json +11 -12
  240. package/cli/src/commands/__tests__/always-enabled-infra.test.ts +2 -8
  241. package/cli/src/commands/__tests__/doctor.test.ts +181 -8
  242. package/cli/src/commands/__tests__/phases-model.test.ts +2 -4
  243. package/cli/src/commands/__tests__/project-resource-features-e2e.test.ts +4 -24
  244. package/cli/src/commands/__tests__/saas-starter-integration.test.ts +8 -10
  245. package/cli/src/commands/__tests__/stack-features-e2e.test.ts +10 -4
  246. package/cli/src/commands/__tests__/upgrade.test.ts +23 -13
  247. package/cli/src/commands/doctor.ts +136 -0
  248. package/cli/src/commands/help.ts +13 -3
  249. package/cli/src/commands/project.ts +11 -14
  250. package/cli/src/commands/projects.ts +2 -2
  251. package/cli/src/commands/up.ts +13 -4
  252. package/cli/src/commands/upgrade.ts +11 -4
  253. package/cli/src/config/platform-standards.test.ts +6 -6
  254. package/cli/src/generator/__tests__/extension-fetch.test.ts +36 -14
  255. package/cli/src/generator/extension-fetch.ts +12 -5
  256. package/cli/src/generator/template-engine.ts +19 -21
  257. package/cli/src/types/index.ts +2 -0
  258. package/cli/src/utils/__tests__/tilt.test.ts +29 -0
  259. package/cli/src/utils/constants.ts +4 -0
  260. package/cli/src/utils/doctor-runtime.ts +67 -27
  261. package/cli/src/utils/env-validator.ts +2 -2
  262. package/cli/src/utils/project-templates.ts +2 -1
  263. package/cli/src/utils/prompt.ts +2 -4
  264. package/cli/src/utils/resource-features.ts +10 -4
  265. package/cli/src/utils/services.ts +2 -1
  266. package/cli/src/utils/tilt.ts +20 -0
  267. package/engine/assets/docker/wake-gateway/Dockerfile +26 -0
  268. package/engine/assets/docker/wake-gateway/decide.test.ts +87 -0
  269. package/engine/assets/docker/wake-gateway/decide.ts +75 -0
  270. package/engine/assets/docker/wake-gateway/server.ts +220 -0
  271. package/engine/topologies/platform/docker/build/golden_image_dockerfile.star +13 -23
  272. package/engine/topologies/platform/docker/compose/compose.star +7 -14
  273. package/engine/topologies/platform/docker/compose/compose_helpers.star +1 -1
  274. package/engine/topologies/platform/docker/compose/traefik_standalone.star +44 -6
  275. package/engine/topologies/platform/docker/config/healthcheck.star +56 -0
  276. package/engine/topologies/platform/docker/constants.star +10 -0
  277. package/engine/topologies/platform/docker/layers/l1_base_layers.star +1 -1
  278. package/engine/topologies/platform/docker/layers/l4_runtime_layers.star +55 -20
  279. package/engine/topologies/platform/docker/networking/traefik_static_routes.star +107 -0
  280. package/engine/topologies/tilt/generators/typescript/backend_tsconfig.star +2 -2
  281. package/engine/topologies/tilt/generators/typescript/frontend_tsconfig.star +1 -1
  282. package/engine/topologies/tilt/manifest/schema.star +6 -0
  283. package/engine/topologies/tilt/manifest/validator.star +16 -0
  284. package/engine/topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star +107 -8
  285. package/engine/topologies/tilt/resources/orchestrator/builders/typescript.star +12 -6
  286. package/engine/topologies/tilt/resources/orchestrator/generators/manifest_resource.star +2 -1
  287. package/knip.json +1 -1
  288. package/openspec/changes/optimize-runtime-docker-layers/.openspec.yaml +3 -0
  289. package/openspec/changes/optimize-runtime-docker-layers/design.md +81 -0
  290. package/openspec/changes/optimize-runtime-docker-layers/proposal.md +44 -0
  291. package/openspec/changes/optimize-runtime-docker-layers/specs/runtime-container-footprint/spec.md +79 -0
  292. package/openspec/changes/optimize-runtime-docker-layers/tasks.md +36 -0
  293. package/openspec/changes/prioritized-cold-start/.openspec.yaml +4 -0
  294. package/openspec/changes/prioritized-cold-start/design.md +113 -0
  295. package/openspec/changes/prioritized-cold-start/proposal.md +40 -0
  296. package/openspec/changes/prioritized-cold-start/specs/on-demand-resource-startup/spec.md +92 -0
  297. package/openspec/changes/prioritized-cold-start/tasks.md +46 -0
  298. package/openspec/config.yaml +1 -0
  299. package/package.json +35 -5
  300. package/scripts/autoresearch/layer-eval.sh +65 -0
  301. package/scripts/benchmark/README.md +25 -0
  302. package/scripts/benchmark/container-scale.ts +503 -0
  303. package/scripts/benchmark/pre-release-gate.sh +9 -0
  304. package/scripts/measure-idle-footprint.sh +58 -0
  305. package/tests/tilt-engine/test_runtime_container_footprint.py +162 -0
  306. package/tests/tilt-engine/test_sablier_defer_start.py +196 -0
  307. package/tests/tilt-engine/test_standalone_traefik.py +38 -0
  308. package/tests/tilt-engine/test_traefik_static_wake_route.py +119 -0
  309. package/bun.lock +0 -538
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: layer-autoresearch
3
+ description: Autonomous keep/discard experiment loop (after karpathy/autoresearch) that optimises TDK's L1-L4 Docker layers toward the north star of 100 services on a 16 GB machine. Use when asked to run autoresearch on the Docker layers or to optimise the golden/runtime layers experimentally.
4
+ ---
5
+
6
+ # Layer autoresearch
7
+
8
+ Adapted from karpathy/autoresearch `program.md`. You are an autonomous researcher making the TDK runtime layers cheaper **without removing features**.
9
+
10
+ ## Setup (with the user, once)
11
+
12
+ 1. Agree a run tag (e.g. `sep25`). Create `git checkout -b autoresearch/<tag>` from `main`. The branch must be new.
13
+ 2. Warn the user: this workspace has an external tool that auto-commits and pushes working-tree edits. Ask them to pause it for the run, because experiment resets must not reach `origin/main`.
14
+ 3. Read the in-scope files in full:
15
+ - Editable: `engine/topologies/platform/docker/layers/*.star`, `engine/topologies/platform/docker/layers/prisma/*.star`, `engine/topologies/platform/docker/build/golden_image_dockerfile.star`, `engine/topologies/platform/docker/config/healthcheck.star`.
16
+ - Read-only ground truth: `scripts/autoresearch/layer-eval.sh`, `scripts/benchmark/container-scale.ts`, `tests/tilt-engine/test_runtime_container_footprint.py`, and the spec `openspec/specs/runtime-container-footprint` (or its change under `openspec/changes/`).
17
+ 4. Check that `../tdk-erp-system` exists with built images (`docker images | grep finance_`). If not, ask the human to run `tdk up` there once.
18
+ 5. Create an untracked `autoresearch-results.tsv` with the header `commit mem_mib image_mib status description`.
19
+ 6. Confirm with the user, then start.
20
+
21
+ ## Experiment
22
+
23
+ Run `scripts/autoresearch/layer-eval.sh > run.log 2>&1` (about 5-10 minutes). Read the results with `grep -A20 '^---' run.log`.
24
+
25
+ - **Primary metric: `mem_per_service_mib`, lower is better.** This is idle memory per real ERP service, and it is what limits 100 services on 16 GB.
26
+ - **Tie-breaker:** if memory is within 0.5 MiB of the best, a lower `unique_per_service_mib` or `service_image_mib` wins, then simpler code.
27
+ - **Hard constraints.** `status: ok` requires all 20 services healthy, zero crashes, and passing feature tests. Anything else is a discard, or a crash if it didn't run.
28
+ - **Never** edit the eval harness, benchmark, tests or spec. Never remove a user-facing feature: Prisma, Infisical entrypoint, hugo-as-feature, healthchecks, signal handling. Don't add dependencies.
29
+
30
+ Candidate ideas, from real measurements on 2026-09-25:
31
+ - Duplicate `node_modules` copy in the L4 backend runtime (4.2 MB twice per service).
32
+ - L1 installs `file`, `bash` and `openssl` into every runtime image (30 MB apk layer). Check what actually needs them first.
33
+ - Bun runtime memory flags (e.g. `--smol`) in the resolved `CMD`.
34
+ - Distroless or slimmer Bun base for L4.
35
+ - Per-service unique layer size.
36
+
37
+ ## Loop (never stop until the human interrupts)
38
+
39
+ 1. Note the current commit.
40
+ 2. Change the editable files with one idea.
41
+ 3. `git commit -m "<idea>"`.
42
+ 4. Run the eval, redirected to `run.log` (don't flood context).
43
+ 5. If there's no `---` block, `tail -n 50 run.log`. Fix trivial mistakes, otherwise log `crash`.
44
+ 6. Append a row to `autoresearch-results.tsv` (untracked).
45
+ 7. If the metric improved and `status: ok`, keep the commit. Otherwise `git reset --hard HEAD~1`.
46
+ 8. An eval that runs longer than 20 minutes counts as a failure.
47
+
48
+ The first run is always the unmodified baseline.
@@ -0,0 +1,222 @@
1
+ ---
2
+ name: tdk-troubleshoot
3
+ description: Diagnose and fix TDK (tdk-cli-core) local-dev problems with verified commands. Covers `tdk doctor`, `tdk up` or `tdk down` failing or hanging, "Docker daemon is not responding", red Tilt resources (pull access denied for golden images, missing shared-platform-engineering files, TS2688 bun types, run-only "No such image"), Postgres crash loops, services never reaching healthy, a machine overloaded by many services, Docker image size vs memory questions, and benchmarking how many services fit on a laptop. Use this whenever someone works in tdk-cli-core or a TDK project (tdk-erp-system, tdk-saas-starter, tdk-restaurant-example, auth-user) and anything about tdk, Tilt, or Docker is broken, slow, or being measured, even if they never say "troubleshoot".
4
+ ---
5
+
6
+ # TDK troubleshooting
7
+
8
+ This skill comes from a long session on 2026-09-25. It brought `tdk-erp-system` (107 services) up, measured it, and wasted a lot of the user's time along the way. Everything below marked **measured** or **verified** was run on the user's 16 GB MacBook Air (Docker VM: 8 CPUs, 7,934 MiB). Anything else is labelled as unknown.
9
+
10
+ ## How to work (the expensive lessons)
11
+
12
+ - **Say what you measured, what you estimated, and what you don't know, in that order.** Most of the frustration came from confident claims that a later measurement contradicted, such as "memory is ~16 MiB/container" (`docker stats`, which undercounts) and "112 s boot" (actually the launcher script). "I don't know yet, here is how I'd find out" is a good answer.
13
+ - **Check machine load before blaming Docker, Tilt or the code.** An overloaded Mac makes every tool look broken.
14
+ - **Before anything that runs longer than about 5 minutes or starts dozens of containers, say so and give an estimate.** A full ERP `tdk up` froze this machine once. Ask first.
15
+ - **Give short status lines while waiting.** Silence during long builds reads as "nothing works".
16
+ - **Don't polish a proxy metric.** Shrinking images didn't touch the real bottleneck. Ask what actually hurts (time, CPU, a freeze) and measure that.
17
+
18
+ ## First 60 seconds: triage
19
+
20
+ ```bash
21
+ sysctl -n vm.loadavg; top -l 1 -n 0 | grep -E "CPU usage|PhysMem"
22
+ time docker ps -q | wc -l
23
+ pgrep -fl "tilt up"
24
+ docker info --format 'CPUs={{.NCPU}} MemTotal={{.MemTotal}}'
25
+ ```
26
+
27
+ - **`docker ps` taking more than about 5 s means overload, not breakage.** Measured: 6–13 s with 110 ERP containers plus Tilt running, load average 28–43, 99 MB free RAM. `tdk doctor` and `tdk down` both fail their own 10 s Docker check in that state.
28
+ - **A `tilt up` process still running recreates any container you `docker stop`** within seconds. Stop Tilt first.
29
+ - **Other TDK projects share the `*-autogenerated-*` container naming** (for example kitchen, guest, operations and auth from the restaurant and auth projects). Filter by stack name before stopping anything.
30
+
31
+ ## Symptoms, causes and fixes (verified)
32
+
33
+ ### "Docker daemon is not responding (`docker ps` hung for 10s)"
34
+
35
+ **Cause:** overload, as above. `tdk down` is blocked by the same check.
36
+
37
+ **Fix:** stop Tilt, then stop the project's containers directly.
38
+
39
+ ```bash
40
+ pkill -TERM -f "tilt up -f $PWD/.tdk/.tdk-out/Tiltfile"
41
+ docker ps --format '{{.Names}}' | grep -E '^(finance|hr|sales|inventory|manufacturing|supply_chain|analytics)-autogenerated-' | xargs docker stop
42
+ ```
43
+
44
+ ### Postgres restarting with "Database is uninitialized and superuser password is not specified"
45
+
46
+ **Cause:** the container was created while `DB_PASSWORD` was empty. Environment variables are fixed when a container is created, so fixing `.env` later doesn't help.
47
+
48
+ **Check:**
49
+
50
+ ```bash
51
+ docker inspect <project>_postgres --format '{{range .Config.Env}}{{println .}}{{end}}' | grep POSTGRES_PASSWORD
52
+ ```
53
+
54
+ **Fix:** recreate the container (Tilt or compose `up` recreates it). The data volume survives.
55
+
56
+ ### Tilt build error `pull access denied ... docker.io/library/<project>-l4-backend:latest`
57
+
58
+ **Cause:** the golden layers aren't built yet (the `golden-layers-build` resource is still running).
59
+
60
+ **Fix:** wait for it to finish. Tilt does **not** retry resources that failed before it finished, so trigger every errored resource yourself.
61
+
62
+ ```bash
63
+ tilt get uiresources -o json | python3 -c 'import json,sys; [print(i["metadata"]["name"]) for i in json.load(sys.stdin)["items"] if i.get("status",{}).get("updateStatus")=="error"]' | xargs -n1 tilt trigger
64
+ ```
65
+
66
+ ### `*-run-only` resources fail with `No such image: <stack>_<svc>:dev`
67
+
68
+ **Cause:** they ran `docker compose up --no-build` before the image existed.
69
+
70
+ **Fix:** once the image builds, `tilt trigger` them.
71
+
72
+ ### Missing generated files in the build context
73
+
74
+ The build fails with `"/shared-platform-engineering/docker-templates/<x>.sh": not found` or `"/package.json": not found`.
75
+
76
+ **Cause:** the project is missing its generated runtime assets.
77
+
78
+ **Fix:**
79
+ - `tdk project --yes` copies `shared-platform-engineering/docker-templates` (verified).
80
+ - If the root `package.json` is still missing, add a Bun workspace manifest. This is what fixed ERP:
81
+
82
+ ```json
83
+ { "name": "<project>", "private": true, "type": "module", "workspaces": ["services/*/*"] }
84
+ ```
85
+
86
+ - `tdk doctor` now reports both (`checkGeneratedProjectRuntimeAssets`).
87
+
88
+ ### `bun run build` fails with `TS2688: Cannot find type definition file for 'bun'`
89
+
90
+ **Cause:** the generated tsconfig sets `"types": ["bun"]`, but the service's `package.json` has no `@types/bun`.
91
+
92
+ **Fix:** add `"@types/bun": "^1.4.2"` to `devDependencies`. `tdk doctor` now reports this (`checkTypeScriptTypeDependencies`).
93
+
94
+ ### `tdk up <stack>` queues every stack
95
+
96
+ **Observed, not root-caused:** `tdk up finance` left 129 resources pending across all stacks.
97
+
98
+ **Protect the machine:** check the counts, then disable the other stacks.
99
+
100
+ ```bash
101
+ tilt get uiresources -o json | python3 -c 'import json,sys,collections; print(collections.Counter(i.get("status",{}).get("updateStatus") for i in json.load(sys.stdin)["items"]))'
102
+ tilt disable <other-stack-resource> <...>
103
+ ```
104
+
105
+ ### Engine edits have no effect
106
+
107
+ **Cause:** projects run a vendored copy of the engine at `.tdk/.tdk-out/tdk-cli-ext/`. The installed `/usr/local/bin/tdk` vendors **its own bundled engine**, so it can silently overwrite your local one.
108
+
109
+ **Fix:** re-vendor from your local checkout, then check the copy matches.
110
+
111
+ ```bash
112
+ (cd <core>/cli && bun run build)
113
+ TDK_EXTENSION_SOURCE=<core> node <core>/cli/bin/tdk.js project --yes
114
+ diff -rq <core>/engine/topologies/platform/docker .tdk/.tdk-out/tdk-cli-ext/engine/topologies/platform/docker
115
+ ```
116
+
117
+ ### Reading Tilt state
118
+
119
+ - Use the CLI. The HTTP API (`localhost:10350/api/view`) returns 403 "missing session token".
120
+ - `tilt get uiresources <name> -o json` shows a resource's state. **`buildHistory[0]` is the newest build**; reading `[-1]` shows a stale error and misleads you.
121
+ - `tilt logs <resource>` gives the full build log.
122
+
123
+ ## ERP project layout
124
+
125
+ | Thing | Value |
126
+ |---|---|
127
+ | Service manifests | `services/<stack>/<svc>/service.json` |
128
+ | Image names | `<stack>_<svc>:dev` |
129
+ | Compose project | `<stack>-autogenerated` |
130
+ | Compose file | `services/<stack>/.autogenerated/docker-compose.app.autogenerated.yml` |
131
+ | Postgres | `services/platform/database-management/docker-compose.yml` |
132
+ | Traefik | `.tdk/.tdk-out/docker-compose.traefik.yml` |
133
+ | Databases | `<project>_<stack>`, created with `createdb` |
134
+ | Golden images | `<project>-l1`, `-l2`, `-l3-*`, `-l4-*` |
135
+
136
+ ## Measuring without fooling yourself
137
+
138
+ ### Image size is disk, not RAM
139
+
140
+ - `docker images` counts shared layers once per image. Real disk use is `docker system df`. The 107 ERP images add up to 26 GB listed, but all 151 images on the machine together use 6 GB on disk.
141
+ - See what fills an image, layer by layer:
142
+
143
+ ```bash
144
+ docker history <img> --format '{{.Size}}\t{{.CreatedBy}}'
145
+ ```
146
+
147
+ - **Measured:** ERP backends are 176–276 MB each, but only 4.5–8.8 MB is service-specific. The rest is shared: Bun binary 93 MB, Alpine 9 MB, L1 packages 30 MB.
148
+ - **Measured:** `auth_auth-api-backend:dev` is 826 MB on disk, yet uses 33 MiB of RAM when running. Of the 826 MB, two copies of `node_modules` take 199 MB each, and hugo takes 57 MB. The duplicate-copy fix is only on branch `autoresearch/sep25`. The hugo removal is on `main`. Both need a rebuild to take effect.
149
+
150
+ ### RAM: `docker stats` undercounts
151
+
152
+ It leaves out Docker's per-container overhead in the VM (containerd shims and the init process). Use the change in the Docker VM's own memory instead:
153
+
154
+ ```bash
155
+ docker run --rm alpine awk '/MemTotal/{t=$2}/MemAvailable/{a=$2}END{printf "%d MiB used\n",(t-a)/1024}' /proc/meminfo
156
+ ```
157
+
158
+ - **Measured:** 100 idle ERP containers cost **2,076 MiB real (about 21 MiB each)**. `docker stats` reported 1,693 MiB for the same containers.
159
+ - The VM measurement is noisy for small counts: the same 20-container setup read 442 MiB one time and 214 MiB the next. Use 100 containers, or repeat the run and report the range.
160
+
161
+ ### Time: start containers in parallel, as Tilt does
162
+
163
+ A serial `docker run` loop measures the launcher, not the services. For parallel starts on macOS:
164
+
165
+ ```bash
166
+ tr '\n' '\0' < cmds.txt | xargs -0 -n1 -P8 sh -c
167
+ ```
168
+
169
+ - **Measured:** 100 ERP containers were all healthy in **31.7 s** starting 8 at a time, with 0 crashes. Starting the containers took 26.6 s of that.
170
+ - The website claims "full boot in under 5 seconds". Measured, that only holds for about 5 services (4.5 s).
171
+
172
+ ### North-star math: 100 services in 16 GB
173
+
174
+ (Docker VM MemTotal − 512 MiB for infrastructure) ÷ 100 = the per-service budget. On this Mac that's (7,934 − 512) ÷ 100 ≈ **74 MiB per service**. The measured 21 MiB fits, but only for idle containers answering `/health`. It hasn't been measured under real load.
175
+
176
+ ## Tools in this repo and how far to trust them
177
+
178
+ | Tool | Status |
179
+ |---|---|
180
+ | `bun scripts/benchmark/container-scale.ts --synthetic` | **Verified** for 5 to 100 containers. Starts containers serially, so "all healthy" is about the launch time. |
181
+ | `container-scale.ts` default (compose) mode | **Verified at tier 5** (2026-09-26): real generated compose files, real Postgres, real Traefik, 5/5 requests through Traefik returned 200, all healthy in 4.9s. Not yet run at 100 — that's the one that answers the north star. Its first run hung indefinitely (`Bun.spawn()` + a `Bun.sleepSync()` poll on `exitCode` never observes the exit, because `sleepSync` blocks the event loop Bun needs to record it) — fixed by launching with `spawnSync` instead. If you see a `container-scale.ts` run sit for minutes with 0% CPU while its containers are already healthy, this bug is back; check for `Bun.spawn` + `sleepSync` polling anywhere in the file. |
182
+ | `scripts/autoresearch/layer-eval.sh` with the `layer-autoresearch` skill | **Verified** (4 runs). Run it from a worktree outside `~/Developer/Codex`. |
183
+ | `scripts/measure-idle-footprint.sh <container>` | Written but **never run**. |
184
+ | `tilt alpha tiltfile-result -f <Tiltfile>` | Runs Starlark without starting anything. `print` output is swallowed, so return data with `fail('RESULT' + encode_json(r))`. `load()` needs a literal path. |
185
+ | `tests/tilt-engine/test_runtime_container_footprint.py` | Runs the real generators through Tilt. |
186
+
187
+ ## Environment traps
188
+
189
+ - **`.tdk/.project-id` is not gitignored by default and is easy to accidentally stage.** It's created the first time anything checks a Premium license (`getOrCreateProjectId` in `cli/src/generator/extension-fetch.ts`) - a random UUID sent alongside `TDK_LICENSE_KEY` to the license server for per-project tracking, not itself a secret credential, but it's local machine state that has no business in a shared repo. Found staged (`git status`, not yet committed - caught before it reached `origin/main`) in `tdk-erp-system` on 2026-09-26; `tdk-saas-starter` and `tdk-restaurant-example` had the same `.gitignore` gap with no file yet; `tdk-user-management` has **no `.gitignore` at all** (currently harmless - only 35 minimal tracked files, nothing sensitive - but unprotected the moment real development starts there). The CLI has no `.gitignore` template of its own to fix at the source (`tdk project` doesn't generate one; each starter repo ships its own) - check every project's `.gitignore` for `.tdk/.project-id` individually, and `git status`/`git log --all -- .tdk/.project-id` before assuming it's fine.
190
+
191
+ - **Auto-commit tool.** Something outside Claude commits and pushes edits in `~/Developer/Codex/*` repos to `origin/main` within about a minute, with messages like "skill" or "specs". Do experiments in a worktree outside that folder:
192
+
193
+ ```bash
194
+ git worktree add ~/Developer/<name> <branch>
195
+ ```
196
+
197
+ - **macOS shell:**
198
+ - There's no `timeout` command.
199
+ - `xargs -I` has a 255-character limit, so use the `-0` form above.
200
+ - System `python3` is 3.9: add `from __future__ import annotations` before using `X | None` types.
201
+ - Bash is version 3.2.
202
+ - **Lint only the files you touched:**
203
+
204
+ ```bash
205
+ cd cli && ./node_modules/.bin/biome check <files>
206
+ ```
207
+
208
+ `bun run lint -- <files>` still lints the whole repo, which has many pre-existing errors.
209
+ - **Failures that aren't yours:**
210
+ - pytest `test_docker_generator_bugs.py::test_expose_line_must_be_numeric_port` and `test_health_endpoints.py::test_overall_health_endpoint_structure` also fail on the unmodified code.
211
+ - vitest `saas-starter-integration` and `stack-features-e2e` time out when Docker is busy.
212
+
213
+ ## Resolved since the first version of this skill
214
+
215
+ - **`tdk up <stack>` queuing every stack — fixed and verified (2026-09-26).** `tdk up finance` computed the right 16-service list but passed it to Tilt as bare positional args. The generated Tiltfile's focus filter (`Config.apply_focus` / `apply_focus_filter` in `profiles.star`) only reads the `--focus` flag - the positional-args catch-all it also defines (`cfg['args']`) is never read anywhere. So every stack-scoped `tdk up` silently fell back to Tilt's default "pre-alpha" phase and enabled every stack in it (verified: 247 enabled resources instead of 16-40). Fix: `buildTiltUpArgs` (`cli/src/utils/tilt.ts`) now passes `--focus=<stackName>`, reusing the Tiltfile's own dependency-aware domain expansion. **Argument order matters**: `--focus=...` must come after a `--` separator (`tilt up -f <path> -- --focus=finance <names>`) - `tilt up` rejects `--focus` as an unrecognized top-level flag otherwise (`tilt up --help` lists its real flags; custom Tiltfile config flags only reach `config.parse()` via `--`). Verified end-to-end: `tilt get uiresources` showed 402 Disabled / 24 Enabled for `tdk up finance` after the fix, and the 24 enabled were exactly finance's services plus required infra.
216
+
217
+ - **What actually overloads a real full `tdk up` at 100+ services — tested and it held (2026-09-26).** Ran a real, uncapped `tdk up` (no stack filter, all 107 services, Tilt doing real builds and reconciliation - not the synthetic/capped benchmark) with a self-killing watchdog sampling load/free-memory/`docker ps` latency every 5s. Result: **110/110 containers reached healthy, zero crashes, zero danger-threshold strikes**, over an 18-minute run. Load peaked around 20 during the busiest build phase (~20-30 containers starting at once) and then *settled back down* to 11-16 as more services came online, finishing at 11.45 with all 110 up. `docker ps` occasionally spiked to 2-6s under load but never approached the 10s `tdk doctor` timeout for long. This is the same scenario that froze the machine on 2026-09-25 (load 28-43, 99 MB free, `docker ps` 6-13s) - it did not recur. Caveat: this is one run on one machine state, and it isn't certain which fix (or whether the host simply had less competing load this time) made the difference; the single-process-CMD image rebuild only covered a minority of services (finance + a couple of supply_chain ones) at the time of this run, so a full image rebuild wasn't a factor. Re-run with the watchdog pattern above (`sysctl -n vm.loadavg`, `vm_stat` free pages, timed `docker ps`) before trusting a "it's fine now" claim on a different machine or after further engine changes.
218
+
219
+ ## Still unknown
220
+
221
+ - **Whether Bun `--smol` (`BUN_OPTIONS=--smol`) saves memory.** Bun does read the variable, but the A/B test was inconclusive.
222
+ - **Why auth's production `node_modules` is 199 MB.**
@@ -0,0 +1,40 @@
1
+ name: Bug report
2
+ description: Something in tdk does not work as expected
3
+ labels: [bug]
4
+ body:
5
+ - type: textarea
6
+ id: what-happened
7
+ attributes:
8
+ label: What happened?
9
+ description: What did you run, what did you expect, and what happened instead?
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: repro
14
+ attributes:
15
+ label: Steps to reproduce
16
+ placeholder: |
17
+ 1. tdk project --yes
18
+ 2. tdk up api
19
+ 3. ...
20
+ validations:
21
+ required: true
22
+ - type: textarea
23
+ id: doctor
24
+ attributes:
25
+ label: Output of `tdk doctor`
26
+ render: shell
27
+ - type: input
28
+ id: version
29
+ attributes:
30
+ label: TDK version
31
+ description: Output of `tdk --version`
32
+ validations:
33
+ required: true
34
+ - type: dropdown
35
+ id: os
36
+ attributes:
37
+ label: Operating system
38
+ options: [macOS (Apple Silicon), macOS (Intel), Linux, Windows (WSL), Other]
39
+ validations:
40
+ required: true
@@ -0,0 +1,8 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: Documentation
4
+ url: https://tdk-landscape.github.io/tdk-website
5
+ about: Guides, quickstart, and examples
6
+ - name: Report a security vulnerability
7
+ url: https://github.com/tdk-landscape/tdk-cli-core/security/advisories/new
8
+ about: Please report security issues privately
@@ -0,0 +1,18 @@
1
+ name: Feature request
2
+ description: Suggest an idea or improvement for TDK
3
+ labels: [enhancement]
4
+ body:
5
+ - type: textarea
6
+ id: problem
7
+ attributes:
8
+ label: What problem are you trying to solve?
9
+ validations:
10
+ required: true
11
+ - type: textarea
12
+ id: solution
13
+ attributes:
14
+ label: What would you like TDK to do?
15
+ - type: textarea
16
+ id: alternatives
17
+ attributes:
18
+ label: What do you do today instead?
@@ -0,0 +1,33 @@
1
+ # Weekly dependency updates, grouped so minor and patch bumps arrive as one PR.
2
+ version: 2
3
+ updates:
4
+ - package-ecosystem: bun
5
+ directory: /
6
+ schedule:
7
+ interval: weekly
8
+ day: friday
9
+ open-pull-requests-limit: 5
10
+ labels:
11
+ - dependencies
12
+ commit-message:
13
+ prefix: "⬆️ "
14
+ include: scope
15
+ groups:
16
+ minor-and-patch:
17
+ update-types:
18
+ - minor
19
+ - patch
20
+
21
+ - package-ecosystem: github-actions
22
+ directory: /
23
+ schedule:
24
+ interval: monthly
25
+ labels:
26
+ - dependencies
27
+ commit-message:
28
+ prefix: "⬆️ "
29
+ include: scope
30
+ groups:
31
+ github-actions:
32
+ patterns:
33
+ - "*"
@@ -0,0 +1,5 @@
1
+ ## What changed and why
2
+
3
+ ## How it was tested
4
+
5
+ - [ ] `npm run typecheck`, `npm run lint`, and `npm test` pass in `cli/`
@@ -0,0 +1,187 @@
1
+ # Checks for every PR and push to main. Run manually from the Actions tab too.
2
+ name: 🚦 CI
3
+
4
+ on:
5
+ push:
6
+ branches: [main]
7
+ pull_request:
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ concurrency:
14
+ group: ${{ github.workflow }}-${{ github.ref }}
15
+ cancel-in-progress: true
16
+
17
+ jobs:
18
+ changes:
19
+ name: 🔎 Detect Changes
20
+ runs-on: ubuntu-latest
21
+ outputs:
22
+ lockfile: ${{ steps.filter.outputs.lockfile }}
23
+ workflows: ${{ steps.filter.outputs.workflows }}
24
+ steps:
25
+ - uses: actions/checkout@v7
26
+ with:
27
+ persist-credentials: false
28
+
29
+ - uses: dorny/paths-filter@v4
30
+ id: filter
31
+ with:
32
+ filters: |
33
+ lockfile:
34
+ - 'bun.lock'
35
+ - 'package.json'
36
+ - 'cli/package.json'
37
+ workflows:
38
+ - '.github/workflows/**'
39
+
40
+ lint:
41
+ name: 🛡️ Lint
42
+ runs-on: ubuntu-latest
43
+ defaults:
44
+ run:
45
+ working-directory: cli
46
+ steps:
47
+ - uses: actions/checkout@v7
48
+ with:
49
+ persist-credentials: false
50
+ - uses: oven-sh/setup-bun@v2
51
+ - run: bun install --frozen-lockfile
52
+ - run: bun run lint
53
+
54
+ typecheck:
55
+ name: 🦴 Typecheck
56
+ runs-on: ubuntu-latest
57
+ defaults:
58
+ run:
59
+ working-directory: cli
60
+ steps:
61
+ - uses: actions/checkout@v7
62
+ with:
63
+ persist-credentials: false
64
+ - uses: oven-sh/setup-bun@v2
65
+ - run: bun install --frozen-lockfile
66
+ - run: bun run typecheck
67
+
68
+ test:
69
+ name: 🧪 Test
70
+ runs-on: ubuntu-latest
71
+ defaults:
72
+ run:
73
+ working-directory: cli
74
+ steps:
75
+ - uses: actions/checkout@v7
76
+ with:
77
+ persist-credentials: false
78
+ - uses: oven-sh/setup-bun@v2
79
+ - uses: actions/setup-node@v7
80
+ with:
81
+ node-version: 22
82
+ - run: bun install --frozen-lockfile
83
+ - run: npm test
84
+
85
+ # Installs the npm package the way users do (npm install -g) and runs it,
86
+ # so a release can't ship without the compiled CLI or its dependencies.
87
+ package-smoke:
88
+ name: 📦 Package Smoke Test
89
+ runs-on: ubuntu-latest
90
+ steps:
91
+ - uses: actions/checkout@v7
92
+ with:
93
+ persist-credentials: false
94
+ - uses: oven-sh/setup-bun@v2
95
+ - uses: actions/setup-node@v7
96
+ with:
97
+ node-version: 22
98
+
99
+ - name: Build
100
+ run: |
101
+ bun install --frozen-lockfile
102
+ npm run build
103
+
104
+ - name: Pack and install globally
105
+ run: | # zizmor: ignore[adhoc-packages] installs our own freshly packed tarball
106
+ npm pack --pack-destination "$RUNNER_TEMP"
107
+ npm install -g "$RUNNER_TEMP"/tdk-landscape-tdk-cli-core-*.tgz
108
+
109
+ - name: Run the installed CLI
110
+ working-directory: ${{ runner.temp }}
111
+ run: |
112
+ tdk --version
113
+ mkdir smoke-project && cd smoke-project
114
+ tdk project --yes
115
+ printf 'y\n' | tdk resource orders-api --type backend --stack shop
116
+ test -f services/shop/orders-api/service.json
117
+ echo "✅ Installed package scaffolds a project and a resource"
118
+
119
+ secret-scan:
120
+ name: 🔑 Secret Scan
121
+ runs-on: ubuntu-latest
122
+ if: github.event_name == 'pull_request'
123
+ steps:
124
+ - uses: actions/checkout@v7
125
+ with:
126
+ fetch-depth: 0
127
+ persist-credentials: false
128
+ - uses: trufflesecurity/trufflehog@v3.97.9
129
+ with:
130
+ base: ${{ github.event.pull_request.base.sha }}
131
+ head: ${{ github.event.pull_request.head.sha }}
132
+ extra_args: --only-verified
133
+
134
+ # Needs "Dependency graph" turned on in Settings > Code security, then the
135
+ # repository variable DEPENDENCY_REVIEW set to true (Settings > Variables).
136
+ dependency-review:
137
+ name: 🔒 Dependency Audit
138
+ runs-on: ubuntu-latest
139
+ needs: changes
140
+ if: vars.DEPENDENCY_REVIEW == 'true' && needs.changes.outputs.lockfile == 'true' && github.event_name == 'pull_request'
141
+ steps:
142
+ - uses: actions/checkout@v7
143
+ with:
144
+ persist-credentials: false
145
+ - uses: actions/dependency-review-action@v5
146
+ with:
147
+ fail-on-severity: high
148
+
149
+ workflow-audit:
150
+ name: 🛠️ Workflow Audit
151
+ runs-on: ubuntu-latest
152
+ needs: changes
153
+ if: needs.changes.outputs.workflows == 'true' || github.event_name == 'workflow_dispatch'
154
+ steps:
155
+ - uses: actions/checkout@v7
156
+ with:
157
+ persist-credentials: false
158
+ - uses: raven-actions/actionlint@v2
159
+ with:
160
+ fail-on-error: true
161
+ - uses: zizmorcore/zizmor-action@v0.6.4
162
+ with:
163
+ inputs: .github/workflows/
164
+ advanced-security: false
165
+ annotations: true
166
+
167
+ summary:
168
+ name: 📋 Summary
169
+ runs-on: ubuntu-latest
170
+ if: always()
171
+ needs: [lint, typecheck, test, package-smoke, secret-scan, dependency-review, workflow-audit]
172
+ steps:
173
+ - name: Render summary
174
+ env:
175
+ NEEDS: ${{ toJSON(needs) }}
176
+ run: |
177
+ {
178
+ echo "## CI Summary"
179
+ echo ""
180
+ echo "| Check | Result |"
181
+ echo "|---|---|"
182
+ echo "$NEEDS" | jq -r 'to_entries[] | "| \(.key) | \(
183
+ if .value.result == "success" then "✅ Passed"
184
+ elif .value.result == "skipped" then "⏭️ Skipped"
185
+ elif .value.result == "cancelled" then "🚫 Cancelled"
186
+ else "❌ Failed" end) |"'
187
+ } >> "$GITHUB_STEP_SUMMARY"
@@ -1,48 +1,58 @@
1
1
  name: Release binaries and npm package
2
2
 
3
3
  on:
4
+ workflow_dispatch:
4
5
  push:
5
6
  branches: [main]
6
7
  paths:
8
+ - "package.json"
7
9
  - "cli/package.json"
8
10
 
9
11
  permissions:
10
12
  contents: read
11
13
  id-token: write
12
14
 
15
+ # Queue releases instead of running them side by side: two runs for the same
16
+ # version upload the same assets and one fails with "already exists".
17
+ concurrency:
18
+ group: release
19
+ cancel-in-progress: false
20
+
13
21
  jobs:
14
22
  release:
15
23
  runs-on: ubuntu-latest
16
24
  steps:
17
- - uses: actions/checkout@v4
25
+ - uses: actions/checkout@v7
26
+ with:
27
+ persist-credentials: false
18
28
 
19
29
  - uses: oven-sh/setup-bun@v2
20
30
  with:
21
31
  bun-version: latest
22
32
 
23
- - uses: actions/setup-node@v6
33
+ - uses: actions/setup-node@v7
24
34
  with:
25
35
  node-version: 24.15.0
26
36
  registry-url: "https://registry.npmjs.org"
27
37
  package-manager-cache: false
28
38
 
29
39
  - name: Update npm for trusted publishing
30
- run: npm install -g npm@latest
40
+ run: npm install -g npm@latest # zizmor: ignore[adhoc-packages] trusted publishing needs a current npm
31
41
 
32
42
  - run: bun install --frozen-lockfile
33
43
  working-directory: cli
34
44
 
45
+ # cli/bin/tdk.js loads cli/dist/cli.js, so the npm package is broken
46
+ # unless the CLI is compiled before `npm publish`.
47
+ - run: npm run build
48
+
35
49
  - run: scripts/release-binaries.sh --publish
36
50
  env:
37
51
  GH_TOKEN: ${{ secrets.BINARY_RELEASE_TOKEN }}
38
52
 
39
- # cli/package.json's prepack script (scripts/stage-npm-engine.sh) copies
40
- # Tiltfile/engine/discovery/specs/ext into cli/ before packing, so the
41
- # published tarball is self-contained the same way the binary release
42
- # is. npm can't overwrite an already-published version, so skip instead
43
- # of failing when this run didn't bump the version.
53
+ # The root package is the public package. It owns the tdk bin entry and
54
+ # already contains the compiled CLI plus the bundled engine assets.
44
55
  - name: Publish to npm
45
- working-directory: cli
46
56
  env:
47
57
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
48
58
  run: |
@@ -0,0 +1,9 @@
1
+ # Config for zizmor, the GitHub Actions security linter run by ci.yml's
2
+ # Workflow Audit job whenever a workflow changes. Run locally with:
3
+ # zizmor .github/workflows/
4
+ #
5
+ # unpinned-uses is off: we only use official or widely used actions by
6
+ # major version tag, and hash pins would need updating for every release.
7
+ rules:
8
+ unpinned-uses:
9
+ disable: true
@@ -0,0 +1,9 @@
1
+ # Code of Conduct
2
+
3
+ This project follows the [Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
4
+
5
+ In short: be respectful, assume good intent, and keep discussion about the work. Harassment, personal attacks, and discriminatory language are not accepted in issues, pull requests, or any other project space.
6
+
7
+ ## Reporting
8
+
9
+ To report unacceptable behavior, open a [private security advisory](https://github.com/tdk-landscape/tdk-cli-core/security/advisories/new) or contact the maintainers through the [TDK Landscape organization](https://github.com/tdk-landscape). Reports are reviewed promptly and kept confidential.