dk-harness 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +267 -0
  3. package/bin/dk-harness +206 -0
  4. package/package.json +36 -0
  5. package/templates/next-axum-monorepo/.eslintrc.js +13 -0
  6. package/templates/next-axum-monorepo/.github/workflows/ci.yml +92 -0
  7. package/templates/next-axum-monorepo/.gitleaks.toml +5 -0
  8. package/templates/next-axum-monorepo/.prettierignore +7 -0
  9. package/templates/next-axum-monorepo/.prettierrc +11 -0
  10. package/templates/next-axum-monorepo/AGENTS.md +35 -0
  11. package/templates/next-axum-monorepo/ARCHITECTURE.md +58 -0
  12. package/templates/next-axum-monorepo/README.md +45 -0
  13. package/templates/next-axum-monorepo/apps/axum/Cargo.lock +1041 -0
  14. package/templates/next-axum-monorepo/apps/axum/Cargo.toml +12 -0
  15. package/templates/next-axum-monorepo/apps/axum/deny.toml +13 -0
  16. package/templates/next-axum-monorepo/apps/axum/src/api/mod.rs +1 -0
  17. package/templates/next-axum-monorepo/apps/axum/src/api/router.rs +53 -0
  18. package/templates/next-axum-monorepo/apps/axum/src/core/config.rs +17 -0
  19. package/templates/next-axum-monorepo/apps/axum/src/core/mod.rs +1 -0
  20. package/templates/next-axum-monorepo/apps/axum/src/domain/health.rs +22 -0
  21. package/templates/next-axum-monorepo/apps/axum/src/domain/mod.rs +1 -0
  22. package/templates/next-axum-monorepo/apps/axum/src/lib.rs +6 -0
  23. package/templates/next-axum-monorepo/apps/axum/src/main.rs +15 -0
  24. package/templates/next-axum-monorepo/apps/web/app/favicon.ico +0 -0
  25. package/templates/next-axum-monorepo/apps/web/app/layout.tsx +43 -0
  26. package/templates/next-axum-monorepo/apps/web/app/page.tsx +19 -0
  27. package/templates/next-axum-monorepo/apps/web/biome.json +16 -0
  28. package/templates/next-axum-monorepo/apps/web/components/.gitkeep +0 -0
  29. package/templates/next-axum-monorepo/apps/web/components/theme-provider.tsx +71 -0
  30. package/templates/next-axum-monorepo/apps/web/components.json +23 -0
  31. package/templates/next-axum-monorepo/apps/web/dependency-cruiser.cjs +66 -0
  32. package/templates/next-axum-monorepo/apps/web/eslint.config.js +4 -0
  33. package/templates/next-axum-monorepo/apps/web/hooks/.gitkeep +0 -0
  34. package/templates/next-axum-monorepo/apps/web/knip.json +17 -0
  35. package/templates/next-axum-monorepo/apps/web/lib/.gitkeep +0 -0
  36. package/templates/next-axum-monorepo/apps/web/lighthouserc.json +23 -0
  37. package/templates/next-axum-monorepo/apps/web/next-env.d.ts +6 -0
  38. package/templates/next-axum-monorepo/apps/web/next.config.mjs +6 -0
  39. package/templates/next-axum-monorepo/apps/web/package.json +46 -0
  40. package/templates/next-axum-monorepo/apps/web/playwright.config.ts +18 -0
  41. package/templates/next-axum-monorepo/apps/web/postcss.config.mjs +1 -0
  42. package/templates/next-axum-monorepo/apps/web/skills-lock.json +15 -0
  43. package/templates/next-axum-monorepo/apps/web/tests/e2e/smoke.spec.ts +13 -0
  44. package/templates/next-axum-monorepo/apps/web/tests/unit/page.test.tsx +16 -0
  45. package/templates/next-axum-monorepo/apps/web/tsconfig.json +23 -0
  46. package/templates/next-axum-monorepo/apps/web/vitest.config.ts +13 -0
  47. package/templates/next-axum-monorepo/apps/web/vitest.setup.ts +1 -0
  48. package/templates/next-axum-monorepo/docs/DESIGN.md +10 -0
  49. package/templates/next-axum-monorepo/docs/FRONTEND.md +26 -0
  50. package/templates/next-axum-monorepo/docs/PLANS.md +25 -0
  51. package/templates/next-axum-monorepo/docs/PRODUCT_SENSE.md +11 -0
  52. package/templates/next-axum-monorepo/docs/QUALITY_SCORE.md +16 -0
  53. package/templates/next-axum-monorepo/docs/RELIABILITY.md +39 -0
  54. package/templates/next-axum-monorepo/docs/SECURITY.md +16 -0
  55. package/templates/next-axum-monorepo/docs/design-docs/core-beliefs.md +6 -0
  56. package/templates/next-axum-monorepo/docs/design-docs/included-skills.md +16 -0
  57. package/templates/next-axum-monorepo/docs/design-docs/index.md +6 -0
  58. package/templates/next-axum-monorepo/docs/exec-plans/active/.gitkeep +1 -0
  59. package/templates/next-axum-monorepo/docs/exec-plans/completed/.gitkeep +1 -0
  60. package/templates/next-axum-monorepo/docs/exec-plans/repeated-work.md +15 -0
  61. package/templates/next-axum-monorepo/docs/exec-plans/tech-debt-tracker.md +3 -0
  62. package/templates/next-axum-monorepo/docs/generated/db-schema.md +3 -0
  63. package/templates/next-axum-monorepo/docs/product-specs/index.md +5 -0
  64. package/templates/next-axum-monorepo/docs/product-specs/new-user-onboarding.md +12 -0
  65. package/templates/next-axum-monorepo/docs/references/design-system-reference-llms.txt +13 -0
  66. package/templates/next-axum-monorepo/justfile +36 -0
  67. package/templates/next-axum-monorepo/lefthook.yml +8 -0
  68. package/templates/next-axum-monorepo/mise.toml +5 -0
  69. package/templates/next-axum-monorepo/package.json +41 -0
  70. package/templates/next-axum-monorepo/packages/eslint-config/README.md +3 -0
  71. package/templates/next-axum-monorepo/packages/eslint-config/base.js +32 -0
  72. package/templates/next-axum-monorepo/packages/eslint-config/next.js +51 -0
  73. package/templates/next-axum-monorepo/packages/eslint-config/package.json +26 -0
  74. package/templates/next-axum-monorepo/packages/eslint-config/react-internal.js +41 -0
  75. package/templates/next-axum-monorepo/packages/typescript-config/README.md +3 -0
  76. package/templates/next-axum-monorepo/packages/typescript-config/base.json +20 -0
  77. package/templates/next-axum-monorepo/packages/typescript-config/nextjs.json +13 -0
  78. package/templates/next-axum-monorepo/packages/typescript-config/package.json +9 -0
  79. package/templates/next-axum-monorepo/packages/typescript-config/react-library.json +8 -0
  80. package/templates/next-axum-monorepo/packages/ui/components.json +23 -0
  81. package/templates/next-axum-monorepo/packages/ui/dependency-cruiser.cjs +100 -0
  82. package/templates/next-axum-monorepo/packages/ui/eslint.config.js +4 -0
  83. package/templates/next-axum-monorepo/packages/ui/package.json +49 -0
  84. package/templates/next-axum-monorepo/packages/ui/postcss.config.mjs +6 -0
  85. package/templates/next-axum-monorepo/packages/ui/src/config/.gitkeep +1 -0
  86. package/templates/next-axum-monorepo/packages/ui/src/providers/.gitkeep +1 -0
  87. package/templates/next-axum-monorepo/packages/ui/src/repo/.gitkeep +1 -0
  88. package/templates/next-axum-monorepo/packages/ui/src/runtime/hooks/.gitkeep +1 -0
  89. package/templates/next-axum-monorepo/packages/ui/src/runtime/utils.ts +6 -0
  90. package/templates/next-axum-monorepo/packages/ui/src/service/.gitkeep +1 -0
  91. package/templates/next-axum-monorepo/packages/ui/src/styles/globals.css +129 -0
  92. package/templates/next-axum-monorepo/packages/ui/src/types/.gitkeep +1 -0
  93. package/templates/next-axum-monorepo/packages/ui/src/ui/button.tsx +65 -0
  94. package/templates/next-axum-monorepo/packages/ui/src/utils/.gitkeep +1 -0
  95. package/templates/next-axum-monorepo/packages/ui/tsconfig.json +10 -0
  96. package/templates/next-axum-monorepo/packages/ui/tsconfig.lint.json +8 -0
  97. package/templates/next-axum-monorepo/pnpm-lock.yaml +12402 -0
  98. package/templates/next-axum-monorepo/pnpm-workspace.yaml +3 -0
  99. package/templates/next-axum-monorepo/renovate.json +6 -0
  100. package/templates/next-axum-monorepo/scripts/check-rust-layers.mjs +149 -0
  101. package/templates/next-axum-monorepo/skills-lock.json +30 -0
  102. package/templates/next-axum-monorepo/tsconfig.json +4 -0
  103. package/templates/next-axum-monorepo/turbo.json +27 -0
  104. package/templates/next-fastapi-monorepo/.eslintrc.js +13 -0
  105. package/templates/next-fastapi-monorepo/.github/workflows/ci.yml +92 -0
  106. package/templates/next-fastapi-monorepo/.gitleaks.toml +5 -0
  107. package/templates/next-fastapi-monorepo/.prettierignore +7 -0
  108. package/templates/next-fastapi-monorepo/.prettierrc +11 -0
  109. package/templates/next-fastapi-monorepo/AGENTS.md +35 -0
  110. package/templates/next-fastapi-monorepo/ARCHITECTURE.md +55 -0
  111. package/templates/next-fastapi-monorepo/README.md +65 -0
  112. package/templates/next-fastapi-monorepo/apps/api/.python-version +1 -0
  113. package/templates/next-fastapi-monorepo/apps/api/README.md +17 -0
  114. package/templates/next-fastapi-monorepo/apps/api/app/__init__.py +1 -0
  115. package/templates/next-fastapi-monorepo/apps/api/app/api/__init__.py +2 -0
  116. package/templates/next-fastapi-monorepo/apps/api/app/api/routes.py +16 -0
  117. package/templates/next-fastapi-monorepo/apps/api/app/core/__init__.py +2 -0
  118. package/templates/next-fastapi-monorepo/apps/api/app/core/config.py +11 -0
  119. package/templates/next-fastapi-monorepo/apps/api/app/domain/__init__.py +2 -0
  120. package/templates/next-fastapi-monorepo/apps/api/app/domain/health.py +7 -0
  121. package/templates/next-fastapi-monorepo/apps/api/app/main.py +8 -0
  122. package/templates/next-fastapi-monorepo/apps/api/package.json +14 -0
  123. package/templates/next-fastapi-monorepo/apps/api/pyproject.toml +54 -0
  124. package/templates/next-fastapi-monorepo/apps/api/tests/test_main.py +27 -0
  125. package/templates/next-fastapi-monorepo/apps/api/uv.lock +1797 -0
  126. package/templates/next-fastapi-monorepo/apps/web/app/favicon.ico +0 -0
  127. package/templates/next-fastapi-monorepo/apps/web/app/layout.tsx +43 -0
  128. package/templates/next-fastapi-monorepo/apps/web/app/page.tsx +19 -0
  129. package/templates/next-fastapi-monorepo/apps/web/biome.json +16 -0
  130. package/templates/next-fastapi-monorepo/apps/web/components/.gitkeep +0 -0
  131. package/templates/next-fastapi-monorepo/apps/web/components/theme-provider.tsx +71 -0
  132. package/templates/next-fastapi-monorepo/apps/web/components.json +23 -0
  133. package/templates/next-fastapi-monorepo/apps/web/dependency-cruiser.cjs +66 -0
  134. package/templates/next-fastapi-monorepo/apps/web/eslint.config.js +4 -0
  135. package/templates/next-fastapi-monorepo/apps/web/hooks/.gitkeep +0 -0
  136. package/templates/next-fastapi-monorepo/apps/web/knip.json +17 -0
  137. package/templates/next-fastapi-monorepo/apps/web/lib/.gitkeep +0 -0
  138. package/templates/next-fastapi-monorepo/apps/web/lighthouserc.json +23 -0
  139. package/templates/next-fastapi-monorepo/apps/web/next-env.d.ts +6 -0
  140. package/templates/next-fastapi-monorepo/apps/web/next.config.mjs +6 -0
  141. package/templates/next-fastapi-monorepo/apps/web/package.json +46 -0
  142. package/templates/next-fastapi-monorepo/apps/web/playwright.config.ts +18 -0
  143. package/templates/next-fastapi-monorepo/apps/web/postcss.config.mjs +1 -0
  144. package/templates/next-fastapi-monorepo/apps/web/skills-lock.json +40 -0
  145. package/templates/next-fastapi-monorepo/apps/web/tests/e2e/smoke.spec.ts +13 -0
  146. package/templates/next-fastapi-monorepo/apps/web/tests/unit/page.test.tsx +16 -0
  147. package/templates/next-fastapi-monorepo/apps/web/tsconfig.json +23 -0
  148. package/templates/next-fastapi-monorepo/apps/web/vitest.config.ts +13 -0
  149. package/templates/next-fastapi-monorepo/apps/web/vitest.setup.ts +1 -0
  150. package/templates/next-fastapi-monorepo/docs/DESIGN.md +10 -0
  151. package/templates/next-fastapi-monorepo/docs/FRONTEND.md +26 -0
  152. package/templates/next-fastapi-monorepo/docs/PLANS.md +25 -0
  153. package/templates/next-fastapi-monorepo/docs/PRODUCT_SENSE.md +11 -0
  154. package/templates/next-fastapi-monorepo/docs/QUALITY_SCORE.md +16 -0
  155. package/templates/next-fastapi-monorepo/docs/RELIABILITY.md +38 -0
  156. package/templates/next-fastapi-monorepo/docs/SECURITY.md +15 -0
  157. package/templates/next-fastapi-monorepo/docs/design-docs/core-beliefs.md +6 -0
  158. package/templates/next-fastapi-monorepo/docs/design-docs/included-skills.md +13 -0
  159. package/templates/next-fastapi-monorepo/docs/design-docs/index.md +6 -0
  160. package/templates/next-fastapi-monorepo/docs/exec-plans/active/.gitkeep +1 -0
  161. package/templates/next-fastapi-monorepo/docs/exec-plans/completed/.gitkeep +1 -0
  162. package/templates/next-fastapi-monorepo/docs/exec-plans/repeated-work.md +15 -0
  163. package/templates/next-fastapi-monorepo/docs/exec-plans/tech-debt-tracker.md +3 -0
  164. package/templates/next-fastapi-monorepo/docs/generated/db-schema.md +3 -0
  165. package/templates/next-fastapi-monorepo/docs/product-specs/index.md +5 -0
  166. package/templates/next-fastapi-monorepo/docs/product-specs/new-user-onboarding.md +12 -0
  167. package/templates/next-fastapi-monorepo/docs/references/design-system-reference-llms.txt +13 -0
  168. package/templates/next-fastapi-monorepo/docs/references/uv-llms.txt +7 -0
  169. package/templates/next-fastapi-monorepo/justfile +31 -0
  170. package/templates/next-fastapi-monorepo/lefthook.yml +8 -0
  171. package/templates/next-fastapi-monorepo/mise.toml +6 -0
  172. package/templates/next-fastapi-monorepo/package.json +41 -0
  173. package/templates/next-fastapi-monorepo/packages/eslint-config/README.md +3 -0
  174. package/templates/next-fastapi-monorepo/packages/eslint-config/base.js +32 -0
  175. package/templates/next-fastapi-monorepo/packages/eslint-config/next.js +51 -0
  176. package/templates/next-fastapi-monorepo/packages/eslint-config/package.json +26 -0
  177. package/templates/next-fastapi-monorepo/packages/eslint-config/react-internal.js +41 -0
  178. package/templates/next-fastapi-monorepo/packages/typescript-config/README.md +3 -0
  179. package/templates/next-fastapi-monorepo/packages/typescript-config/base.json +20 -0
  180. package/templates/next-fastapi-monorepo/packages/typescript-config/nextjs.json +13 -0
  181. package/templates/next-fastapi-monorepo/packages/typescript-config/package.json +9 -0
  182. package/templates/next-fastapi-monorepo/packages/typescript-config/react-library.json +8 -0
  183. package/templates/next-fastapi-monorepo/packages/ui/components.json +23 -0
  184. package/templates/next-fastapi-monorepo/packages/ui/dependency-cruiser.cjs +100 -0
  185. package/templates/next-fastapi-monorepo/packages/ui/eslint.config.js +4 -0
  186. package/templates/next-fastapi-monorepo/packages/ui/package.json +49 -0
  187. package/templates/next-fastapi-monorepo/packages/ui/postcss.config.mjs +6 -0
  188. package/templates/next-fastapi-monorepo/packages/ui/src/config/.gitkeep +1 -0
  189. package/templates/next-fastapi-monorepo/packages/ui/src/providers/.gitkeep +1 -0
  190. package/templates/next-fastapi-monorepo/packages/ui/src/repo/.gitkeep +1 -0
  191. package/templates/next-fastapi-monorepo/packages/ui/src/runtime/hooks/.gitkeep +1 -0
  192. package/templates/next-fastapi-monorepo/packages/ui/src/runtime/utils.ts +6 -0
  193. package/templates/next-fastapi-monorepo/packages/ui/src/service/.gitkeep +1 -0
  194. package/templates/next-fastapi-monorepo/packages/ui/src/styles/globals.css +129 -0
  195. package/templates/next-fastapi-monorepo/packages/ui/src/types/.gitkeep +1 -0
  196. package/templates/next-fastapi-monorepo/packages/ui/src/ui/button.tsx +65 -0
  197. package/templates/next-fastapi-monorepo/packages/ui/src/utils/.gitkeep +1 -0
  198. package/templates/next-fastapi-monorepo/packages/ui/tsconfig.json +10 -0
  199. package/templates/next-fastapi-monorepo/packages/ui/tsconfig.lint.json +8 -0
  200. package/templates/next-fastapi-monorepo/pnpm-lock.yaml +12404 -0
  201. package/templates/next-fastapi-monorepo/pnpm-workspace.yaml +3 -0
  202. package/templates/next-fastapi-monorepo/renovate.json +6 -0
  203. package/templates/next-fastapi-monorepo/tsconfig.json +4 -0
  204. package/templates/next-fastapi-monorepo/turbo.json +27 -0
  205. package/templates/next-monorepo/.eslintrc.js +13 -0
  206. package/templates/next-monorepo/.github/workflows/ci.yml +76 -0
  207. package/templates/next-monorepo/.gitleaks.toml +5 -0
  208. package/templates/next-monorepo/.prettierignore +7 -0
  209. package/templates/next-monorepo/.prettierrc +11 -0
  210. package/templates/next-monorepo/AGENTS.md +35 -0
  211. package/templates/next-monorepo/ARCHITECTURE.md +67 -0
  212. package/templates/next-monorepo/README.md +45 -0
  213. package/templates/next-monorepo/apps/web/app/favicon.ico +0 -0
  214. package/templates/next-monorepo/apps/web/app/layout.tsx +43 -0
  215. package/templates/next-monorepo/apps/web/app/page.tsx +19 -0
  216. package/templates/next-monorepo/apps/web/biome.json +16 -0
  217. package/templates/next-monorepo/apps/web/components/.gitkeep +0 -0
  218. package/templates/next-monorepo/apps/web/components/theme-provider.tsx +71 -0
  219. package/templates/next-monorepo/apps/web/components.json +23 -0
  220. package/templates/next-monorepo/apps/web/dependency-cruiser.cjs +66 -0
  221. package/templates/next-monorepo/apps/web/eslint.config.js +4 -0
  222. package/templates/next-monorepo/apps/web/hooks/.gitkeep +0 -0
  223. package/templates/next-monorepo/apps/web/knip.json +17 -0
  224. package/templates/next-monorepo/apps/web/lib/.gitkeep +0 -0
  225. package/templates/next-monorepo/apps/web/lighthouserc.json +23 -0
  226. package/templates/next-monorepo/apps/web/next-env.d.ts +6 -0
  227. package/templates/next-monorepo/apps/web/next.config.mjs +6 -0
  228. package/templates/next-monorepo/apps/web/package.json +46 -0
  229. package/templates/next-monorepo/apps/web/playwright.config.ts +18 -0
  230. package/templates/next-monorepo/apps/web/postcss.config.mjs +1 -0
  231. package/templates/next-monorepo/apps/web/skills-lock.json +40 -0
  232. package/templates/next-monorepo/apps/web/tests/e2e/smoke.spec.ts +13 -0
  233. package/templates/next-monorepo/apps/web/tests/unit/page.test.tsx +16 -0
  234. package/templates/next-monorepo/apps/web/tsconfig.json +23 -0
  235. package/templates/next-monorepo/apps/web/vitest.config.ts +13 -0
  236. package/templates/next-monorepo/apps/web/vitest.setup.ts +1 -0
  237. package/templates/next-monorepo/docs/DESIGN.md +11 -0
  238. package/templates/next-monorepo/docs/FRONTEND.md +32 -0
  239. package/templates/next-monorepo/docs/PLANS.md +25 -0
  240. package/templates/next-monorepo/docs/PRODUCT_SENSE.md +11 -0
  241. package/templates/next-monorepo/docs/QUALITY_SCORE.md +18 -0
  242. package/templates/next-monorepo/docs/RELIABILITY.md +37 -0
  243. package/templates/next-monorepo/docs/SECURITY.md +14 -0
  244. package/templates/next-monorepo/docs/design-docs/core-beliefs.md +6 -0
  245. package/templates/next-monorepo/docs/design-docs/included-skills.md +13 -0
  246. package/templates/next-monorepo/docs/design-docs/index.md +6 -0
  247. package/templates/next-monorepo/docs/exec-plans/active/.gitkeep +1 -0
  248. package/templates/next-monorepo/docs/exec-plans/completed/.gitkeep +1 -0
  249. package/templates/next-monorepo/docs/exec-plans/repeated-work.md +15 -0
  250. package/templates/next-monorepo/docs/exec-plans/tech-debt-tracker.md +3 -0
  251. package/templates/next-monorepo/docs/generated/db-schema.md +3 -0
  252. package/templates/next-monorepo/docs/product-specs/index.md +5 -0
  253. package/templates/next-monorepo/docs/product-specs/new-user-onboarding.md +12 -0
  254. package/templates/next-monorepo/docs/references/design-system-reference-llms.txt +13 -0
  255. package/templates/next-monorepo/justfile +26 -0
  256. package/templates/next-monorepo/lefthook.yml +8 -0
  257. package/templates/next-monorepo/mise.toml +4 -0
  258. package/templates/next-monorepo/package.json +41 -0
  259. package/templates/next-monorepo/packages/eslint-config/README.md +3 -0
  260. package/templates/next-monorepo/packages/eslint-config/base.js +32 -0
  261. package/templates/next-monorepo/packages/eslint-config/next.js +51 -0
  262. package/templates/next-monorepo/packages/eslint-config/package.json +26 -0
  263. package/templates/next-monorepo/packages/eslint-config/react-internal.js +41 -0
  264. package/templates/next-monorepo/packages/typescript-config/README.md +3 -0
  265. package/templates/next-monorepo/packages/typescript-config/base.json +20 -0
  266. package/templates/next-monorepo/packages/typescript-config/nextjs.json +13 -0
  267. package/templates/next-monorepo/packages/typescript-config/package.json +9 -0
  268. package/templates/next-monorepo/packages/typescript-config/react-library.json +8 -0
  269. package/templates/next-monorepo/packages/ui/components.json +23 -0
  270. package/templates/next-monorepo/packages/ui/dependency-cruiser.cjs +100 -0
  271. package/templates/next-monorepo/packages/ui/eslint.config.js +4 -0
  272. package/templates/next-monorepo/packages/ui/package.json +49 -0
  273. package/templates/next-monorepo/packages/ui/postcss.config.mjs +6 -0
  274. package/templates/next-monorepo/packages/ui/src/config/.gitkeep +1 -0
  275. package/templates/next-monorepo/packages/ui/src/providers/.gitkeep +1 -0
  276. package/templates/next-monorepo/packages/ui/src/repo/.gitkeep +1 -0
  277. package/templates/next-monorepo/packages/ui/src/runtime/hooks/.gitkeep +1 -0
  278. package/templates/next-monorepo/packages/ui/src/runtime/utils.ts +6 -0
  279. package/templates/next-monorepo/packages/ui/src/service/.gitkeep +1 -0
  280. package/templates/next-monorepo/packages/ui/src/styles/globals.css +129 -0
  281. package/templates/next-monorepo/packages/ui/src/types/.gitkeep +1 -0
  282. package/templates/next-monorepo/packages/ui/src/ui/button.tsx +65 -0
  283. package/templates/next-monorepo/packages/ui/src/utils/.gitkeep +1 -0
  284. package/templates/next-monorepo/packages/ui/tsconfig.json +10 -0
  285. package/templates/next-monorepo/packages/ui/tsconfig.lint.json +8 -0
  286. package/templates/next-monorepo/pnpm-lock.yaml +12402 -0
  287. package/templates/next-monorepo/pnpm-workspace.yaml +3 -0
  288. package/templates/next-monorepo/renovate.json +6 -0
  289. package/templates/next-monorepo/tsconfig.json +4 -0
  290. package/templates/next-monorepo/turbo.json +27 -0
  291. package/templates/registry.json +22 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,267 @@
1
+ # dk-harness
2
+
3
+ Harness for agentic development.
4
+
5
+ This harness was created following OpenAI's Harness Engineering article:
6
+ https://openai.com/ko-KR/index/harness-engineering/
7
+
8
+ The goal is not only to test correctness, but to create an environment where an AI agent is pushed toward good behavior by default:
9
+
10
+ - fast feedback
11
+ - deterministic tooling
12
+ - hard architectural boundaries
13
+ - tests for real user behavior
14
+ - checks that catch dependency, security, and maintenance anti-patterns early
15
+
16
+ This repo should optimize for three stacks only:
17
+
18
+ - `Next.js`
19
+ - `Python`
20
+ - `Rust`
21
+
22
+ ## Principles
23
+
24
+ - Prefer tools that are fast enough to run locally on every change.
25
+ - Enforce boundaries automatically instead of relying on code review.
26
+ - Test user-visible behavior, not just implementation details.
27
+ - Keep CI layered: fast checks first, slower UX checks after.
28
+ - Make the same commands work locally and in CI.
29
+
30
+ ## Shared Foundation
31
+
32
+ These are worth using no matter which stack a project uses.
33
+
34
+ | Role | Recommended tools | Why |
35
+ | --- | --- | --- |
36
+ | Toolchain pinning | `mise` | Pin Node, Python, and Rust versions so agents and humans run the same toolchain. |
37
+ | Task runner | `just` | Gives the agent a small, predictable command surface such as `just lint` and `just test`. |
38
+ | Git hooks | `lefthook` or `pre-commit` | Run fast checks before bad changes spread. |
39
+ | CI | `GitHub Actions` | Standardize the same harness in automation. |
40
+ | Dependency updates | `Renovate` | Keeps dependencies current without relying on memory. |
41
+ | Secrets scanning | `gitleaks` | Prevents obvious security mistakes from landing. |
42
+ | Repo-wide vuln scanning | `osv-scanner` | One simple cross-ecosystem supply-chain check. |
43
+
44
+ ## By Role
45
+
46
+ These are the categories the harness should cover across all stacks.
47
+
48
+ | Role | What to enforce |
49
+ | --- | --- |
50
+ | Formatter / linter | Style, common mistakes, import hygiene, obvious bad patterns |
51
+ | Type / static analysis | Type soundness, invalid assumptions, weak interfaces |
52
+ | Dependency detection | Unused deps, missing deps, forbidden imports, circular dependencies |
53
+ | Architecture boundaries | Rules like `ui -> app -> domain -> infra`, never the reverse |
54
+ | Unit / integration tests | Behavioral correctness at module and service level |
55
+ | End-to-end tests | Real user flows, cross-boundary regressions |
56
+ | Accessibility / UX checks | Keyboard nav, labels, contrast, layout breakage, performance regressions |
57
+ | Security / supply chain | Vulnerabilities, licenses, secrets, dependency policy |
58
+ | Reproducibility | Same commands, same versions, same fixtures locally and in CI |
59
+
60
+ ## Next.js
61
+
62
+ `Next.js` is where most user-experience anti-patterns show up, so this stack needs the strongest UX harness.
63
+
64
+ | Role | Recommended tools | Notes |
65
+ | --- | --- | --- |
66
+ | Formatter / linter | `biome` | Good fast default for formatting and linting. |
67
+ | Type checking | `tsc --noEmit` | Must run in CI even if the app builds. |
68
+ | Dependency boundaries | `dependency-cruiser` | Enforce layer rules and catch circular imports. |
69
+ | Unused files / exports / deps | `knip` | Very useful for agent-generated dead code. |
70
+ | Unit / component tests | `vitest` + `@testing-library/react` | Fast feedback for UI logic and state transitions. |
71
+ | API / network mocking | `msw` | Keeps tests deterministic and avoids flaky network coupling. |
72
+ | Browser E2E | `playwright` | Test real flows, routing, auth, forms, and edge states. |
73
+ | Accessibility | `@axe-core/playwright` | Catch common a11y regressions inside E2E tests. |
74
+ | Visual regression | `playwright` screenshot assertions or `Chromatic` | Useful for catching broken layouts and style drift. |
75
+ | Performance / UX budgets | `Lighthouse CI` | Catch slow pages, layout shift, and basic UX regressions. |
76
+ | Component review | `Storybook` | Helpful when you want isolated state coverage and reviewable UI fixtures. |
77
+
78
+ Recommended baseline for `Next.js`:
79
+
80
+ - `biome`
81
+ - `tsc --noEmit`
82
+ - `dependency-cruiser`
83
+ - `knip`
84
+ - `vitest`
85
+ - `playwright`
86
+ - `@axe-core/playwright`
87
+ - `Lighthouse CI`
88
+
89
+ ## Python
90
+
91
+ Use Python for automation, agents, orchestration, APIs, and evaluation tools. The harness should favor speed and strictness.
92
+
93
+ | Role | Recommended tools | Notes |
94
+ | --- | --- | --- |
95
+ | Package / env management | `uv` | Fast and reproducible Python environment management. |
96
+ | Formatter / linter | `ruff` | Replaces several slower tools with one fast tool. |
97
+ | Type checking | `basedpyright` or `pyright` | Strong static analysis for agent-written Python. |
98
+ | Dependency detection | `deptry` | Finds undeclared and unused dependencies. |
99
+ | Architecture boundaries | `import-linter` | Enforce import contracts between layers or packages. |
100
+ | Unit / integration tests | `pytest` | The default testing backbone. |
101
+ | Parallel test execution | `pytest-xdist` | Speeds up larger test suites. |
102
+ | Property-based tests | `hypothesis` | Very good for catching edge cases agents often miss. |
103
+ | Security scanning | `pip-audit` | Checks installed Python dependencies for known vulns. |
104
+ | Security linting | `bandit` | Optional, but helpful for scripts that touch files, shells, or secrets. |
105
+
106
+ Recommended baseline for `Python`:
107
+
108
+ - `uv`
109
+ - `ruff`
110
+ - `basedpyright`
111
+ - `deptry`
112
+ - `import-linter`
113
+ - `pytest`
114
+ - `hypothesis`
115
+ - `pip-audit`
116
+
117
+ ## Rust
118
+
119
+ Use Rust when correctness, performance, and strong interfaces matter. The harness should lean into strict compiler- and lint-driven workflows.
120
+
121
+ | Role | Recommended tools | Notes |
122
+ | --- | --- | --- |
123
+ | Formatter | `rustfmt` | Keep formatting non-negotiable. |
124
+ | Linting | `clippy` | Strong default lint layer for correctness and idioms. |
125
+ | Test runner | `cargo nextest` | Faster and better-scaled test execution than plain `cargo test`. |
126
+ | Built-in tests | `cargo test` | Still the standard compatibility baseline. |
127
+ | Unused dependency detection | `cargo-udeps` | Excellent at finding leftover crate deps. |
128
+ | Dependency / license policy | `cargo-deny` | Good for security, sources, and license enforcement. |
129
+ | Vulnerability scanning | `cargo-audit` | Checks crates against known advisories. |
130
+ | Property-based tests | `proptest` | Useful for parser, protocol, and state-machine logic. |
131
+ | Fuzzing | `cargo-fuzz` | Worth using for parsers, protocol handlers, and unsafe boundaries. |
132
+ | Benchmarks | `criterion` | Helpful when performance regressions matter. |
133
+
134
+ Recommended baseline for `Rust`:
135
+
136
+ - `rustfmt`
137
+ - `clippy`
138
+ - `cargo nextest`
139
+ - `cargo-udeps`
140
+ - `cargo-deny`
141
+ - `cargo-audit`
142
+ - `proptest`
143
+
144
+ ## Suggested CI Lanes
145
+
146
+ Do not run everything in one giant job. Split the harness by speed and purpose.
147
+
148
+ 1. `fast`: formatting, linting, type checks, dependency checks, architecture checks
149
+ 2. `test`: unit and integration tests
150
+ 3. `ux`: Playwright, accessibility, visual regression, Lighthouse
151
+ 4. `supply-chain`: vulnerability, license, and secret scanning
152
+
153
+ ## Minimal Opinionated Starter Set
154
+
155
+ If I wanted a strong default harness for agentic development without making it too heavy, I would start with:
156
+
157
+ - Shared: `mise`, `just`, `GitHub Actions`, `Renovate`, `gitleaks`, `osv-scanner`
158
+ - `Next.js`: `biome`, `tsc --noEmit`, `dependency-cruiser`, `knip`, `vitest`, `playwright`, `@axe-core/playwright`, `Lighthouse CI`
159
+ - `Python`: `uv`, `ruff`, `basedpyright`, `deptry`, `import-linter`, `pytest`, `hypothesis`, `pip-audit`
160
+ - `Rust`: `rustfmt`, `clippy`, `cargo nextest`, `cargo-udeps`, `cargo-deny`, `cargo-audit`, `proptest`
161
+
162
+ ## What This Harness Should Catch
163
+
164
+ The important thing is not just having tools, but making them block the kinds of failures agents are prone to produce:
165
+
166
+ - dead code and unused dependencies
167
+ - circular imports and broken architecture boundaries
168
+ - passing builds with broken types
169
+ - brittle tests that mock too much and verify too little
170
+ - inaccessible UI and broken keyboard flows
171
+ - layout regressions that still look fine in code review
172
+ - slow pages and poor Core Web Vitals
173
+ - dependency vulnerabilities and leaked secrets
174
+ - environment drift between local runs and CI
175
+
176
+ ## Templates
177
+
178
+ This repo can also act as a local template catalog.
179
+
180
+ - `templates/next-monorepo`
181
+ - `templates/next-axum-monorepo`
182
+ - `templates/next-fastapi-monorepo`
183
+
184
+ The source of truth for template discovery lives in [templates/registry.json](/home/kimdongkudavid/develop/personal/dk-harness/templates/registry.json).
185
+
186
+ ## CLI
187
+
188
+ Use [bin/dk-harness](/home/kimdongkudavid/develop/personal/dk-harness/bin/dk-harness) to scaffold from the local catalog:
189
+
190
+ ```bash
191
+ ./bin/dk-harness list
192
+ ./bin/dk-harness next-monorepo my-app
193
+ ./bin/dk-harness new next-axum-monorepo my-service --init-git
194
+ ```
195
+
196
+ The CLI copies from the local `templates/` directory, so edits made here immediately affect future scaffolds from this repo.
197
+
198
+ You can also expose the same CLI through npm because the repo now defines a package binary in [package.json](/home/kimdongkudavid/develop/personal/dk-harness/package.json).
199
+
200
+ Local repo usage with npm:
201
+
202
+ ```bash
203
+ npm exec --package . -- dk-harness list
204
+ npm exec --package . -- dk-harness next-monorepo my-app
205
+ ```
206
+
207
+ If you publish the package to npm, consumers can run it without cloning the repo:
208
+
209
+ ```bash
210
+ npx dk-harness@latest list
211
+ npx dk-harness@latest next-monorepo my-app
212
+ ```
213
+
214
+ The current CLI is a Python entrypoint, so machines using the npm binary still need `python3` available.
215
+
216
+ ## npm Publishing
217
+
218
+ The package should publish as `dk-harness`.
219
+
220
+ - It keeps the npm package name aligned with the installed binary name.
221
+ - It matches the intended `npm exec` and `npx` workflows from issue `#3`.
222
+ - We can add a separate `create-dk-harness` package later if we want an opinionated `npm create` onboarding flow.
223
+
224
+ Release prerequisites:
225
+
226
+ - `python3` must be on `PATH` because the published binary is a Python script.
227
+ - Node.js and npm must be available to run `npm exec`, `npx`, `npm pack`, and `npm publish`.
228
+
229
+ Release gate:
230
+
231
+ ```bash
232
+ npm run release:check
233
+ ```
234
+
235
+ That command verifies all of the following against the packed tarball, not the working tree:
236
+
237
+ - `bin/dk-harness`, `templates/`, `README.md`, and `LICENSE` are included
238
+ - the packaged CLI can run `dk-harness list`
239
+ - scaffolding from the packaged CLI copies `.github/workflows/ci.yml`
240
+
241
+ Suggested publish flow:
242
+
243
+ ```bash
244
+ npm version <patch|minor|major>
245
+ npm run release:check
246
+ npm publish
247
+ npm exec --yes --package dk-harness -- dk-harness list
248
+ npx dk-harness@latest list
249
+ ```
250
+
251
+ ## Skills In Templates
252
+
253
+ Skill-related project files follow the template if they are committed into the template directory.
254
+
255
+ - Keep project-level files such as `skills-lock.json` if you want every generated project to inherit them.
256
+ - Leave out machine-local folders such as `.agents/`, `.claude/`, `node_modules/`, and build output.
257
+
258
+ ## Standalone Template Repos
259
+
260
+ If you also want each starter to live as its own GitHub repo, export from this repo and push from there:
261
+
262
+ ```bash
263
+ ./bin/dk-harness export next-monorepo ../dk-harness-next-monorepo --force
264
+ ./bin/dk-harness export next-axum-monorepo ../dk-harness-next-axum-monorepo --force
265
+ ```
266
+
267
+ That keeps `dk-harness` as the source of truth locally while giving you separate repos to publish as template repositories on GitHub.
package/bin/dk-harness ADDED
@@ -0,0 +1,206 @@
1
+ #!/usr/bin/env python3
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import json
7
+ import shutil
8
+ import subprocess
9
+ import sys
10
+ from pathlib import Path
11
+
12
+
13
+ IGNORE_NAMES = {
14
+ ".DS_Store",
15
+ ".agents",
16
+ ".claude",
17
+ ".git",
18
+ ".next",
19
+ ".venv",
20
+ ".turbo",
21
+ "__pycache__",
22
+ "build",
23
+ "dist",
24
+ "node_modules",
25
+ "target",
26
+ }
27
+
28
+ REPO_ROOT = Path(__file__).resolve().parent.parent
29
+ REGISTRY_PATH = REPO_ROOT / "templates" / "registry.json"
30
+
31
+
32
+ def load_registry() -> dict[str, dict[str, str]]:
33
+ data = json.loads(REGISTRY_PATH.read_text())
34
+ return {entry["name"]: entry for entry in data["templates"]}
35
+
36
+
37
+ def ignore_filter(_: str, names: list[str]) -> set[str]:
38
+ return {name for name in names if name in IGNORE_NAMES}
39
+
40
+
41
+ def ensure_destination(path: Path, force: bool) -> None:
42
+ if not path.exists():
43
+ path.parent.mkdir(parents=True, exist_ok=True)
44
+ return
45
+
46
+ if not path.is_dir():
47
+ raise SystemExit(f"Destination exists and is not a directory: {path}")
48
+
49
+ if any(path.iterdir()):
50
+ if not force:
51
+ raise SystemExit(
52
+ f"Destination is not empty: {path}\n"
53
+ "Re-run with --force to replace it."
54
+ )
55
+ shutil.rmtree(path)
56
+ path.parent.mkdir(parents=True, exist_ok=True)
57
+
58
+
59
+ def copy_template(template: dict[str, str], destination: Path, force: bool) -> None:
60
+ source = REPO_ROOT / template["path"]
61
+ if not source.exists():
62
+ raise SystemExit(f"Template path does not exist: {source}")
63
+
64
+ ensure_destination(destination, force)
65
+ shutil.copytree(source, destination, ignore=ignore_filter, dirs_exist_ok=True)
66
+
67
+
68
+ def init_git_repo(destination: Path) -> None:
69
+ subprocess.run(
70
+ ["git", "init", "-b", "main"],
71
+ check=True,
72
+ cwd=destination,
73
+ stdout=subprocess.DEVNULL,
74
+ stderr=subprocess.DEVNULL,
75
+ )
76
+
77
+
78
+ def print_template_list(registry: dict[str, dict[str, str]]) -> None:
79
+ print("Available templates:")
80
+ for name in sorted(registry):
81
+ entry = registry[name]
82
+ print(f"- {name}: {entry['description']}")
83
+ print(f" local: {entry['path']}")
84
+ print(f" repo: {entry['repo']}")
85
+
86
+
87
+ def resolve_template(registry: dict[str, dict[str, str]], template_name: str) -> dict[str, str]:
88
+ try:
89
+ return registry[template_name]
90
+ except KeyError as exc:
91
+ known = ", ".join(sorted(registry))
92
+ raise SystemExit(
93
+ f"Unknown template: {template_name}\nKnown templates: {known}"
94
+ ) from exc
95
+
96
+
97
+ def build_parser() -> argparse.ArgumentParser:
98
+ parser = argparse.ArgumentParser(
99
+ prog="dk-harness",
100
+ description="Scaffold projects from the local harness template registry.",
101
+ )
102
+ subparsers = parser.add_subparsers(dest="command")
103
+
104
+ subparsers.add_parser("list", help="List available templates.")
105
+
106
+ new_parser = subparsers.add_parser("new", help="Create a new project from a template.")
107
+ new_parser.add_argument("template")
108
+ new_parser.add_argument("destination", nargs="?")
109
+ new_parser.add_argument("--force", action="store_true")
110
+ new_parser.add_argument("--init-git", action="store_true")
111
+
112
+ export_parser = subparsers.add_parser(
113
+ "export",
114
+ help="Copy a template to another directory, useful for syncing standalone template repos.",
115
+ )
116
+ export_parser.add_argument("template")
117
+ export_parser.add_argument("destination")
118
+ export_parser.add_argument("--force", action="store_true")
119
+
120
+ return parser
121
+
122
+
123
+ def run_new(
124
+ registry: dict[str, dict[str, str]],
125
+ template_name: str,
126
+ destination: str | None,
127
+ *,
128
+ force: bool,
129
+ init_git: bool,
130
+ ) -> int:
131
+ template = resolve_template(registry, template_name)
132
+ target = Path(destination or template_name).resolve()
133
+ copy_template(template, target, force=force)
134
+
135
+ if init_git:
136
+ init_git_repo(target)
137
+
138
+ print(f"Created {target} from template '{template_name}'.")
139
+ if init_git:
140
+ print("Initialized a new git repository.")
141
+ return 0
142
+
143
+
144
+ def run_export(
145
+ registry: dict[str, dict[str, str]],
146
+ template_name: str,
147
+ destination: str,
148
+ *,
149
+ force: bool,
150
+ ) -> int:
151
+ template = resolve_template(registry, template_name)
152
+ target = Path(destination).resolve()
153
+ copy_template(template, target, force=force)
154
+ print(f"Exported '{template_name}' to {target}.")
155
+ print(f"Configured standalone repo: {template['repo']}")
156
+ return 0
157
+
158
+
159
+ def main(argv: list[str]) -> int:
160
+ registry = load_registry()
161
+ parser = build_parser()
162
+
163
+ if len(argv) > 1 and argv[1] not in {"list", "new", "export", "-h", "--help"}:
164
+ shorthand_parser = argparse.ArgumentParser(add_help=False)
165
+ shorthand_parser.add_argument("template")
166
+ shorthand_parser.add_argument("destination", nargs="?")
167
+ shorthand_parser.add_argument("--force", action="store_true")
168
+ shorthand_parser.add_argument("--init-git", action="store_true")
169
+ shorthand_args = shorthand_parser.parse_args(argv[1:])
170
+ return run_new(
171
+ registry,
172
+ shorthand_args.template,
173
+ shorthand_args.destination,
174
+ force=shorthand_args.force,
175
+ init_git=shorthand_args.init_git,
176
+ )
177
+
178
+ args = parser.parse_args(argv[1:])
179
+
180
+ if args.command == "list":
181
+ print_template_list(registry)
182
+ return 0
183
+
184
+ if args.command == "new":
185
+ return run_new(
186
+ registry,
187
+ args.template,
188
+ args.destination,
189
+ force=args.force,
190
+ init_git=args.init_git,
191
+ )
192
+
193
+ if args.command == "export":
194
+ return run_export(
195
+ registry,
196
+ args.template,
197
+ args.destination,
198
+ force=args.force,
199
+ )
200
+
201
+ parser.print_help()
202
+ return 0
203
+
204
+
205
+ if __name__ == "__main__":
206
+ sys.exit(main(sys.argv))