@kb-labs/devkit 1.0.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 (295) hide show
  1. package/.cursorrules +32 -0
  2. package/.github/CODEOWNERS +2 -0
  3. package/.github/actions/setup-node-pnpm/action.yml +47 -0
  4. package/.github/workflow-templates/ci.yml +13 -0
  5. package/.github/workflow-templates/drift-check.yml +10 -0
  6. package/.github/workflow-templates/profiles-validate.yml +16 -0
  7. package/.github/workflow-templates/release.yml +8 -0
  8. package/.github/workflows/ci-reusable.yml +131 -0
  9. package/.github/workflows/drift-check-reusable.yml +23 -0
  10. package/.github/workflows/fixtures.yml +74 -0
  11. package/.github/workflows/profiles-validate-reusable.yml +67 -0
  12. package/.github/workflows/release-reusable.yml +50 -0
  13. package/.vscode/settings.json +23 -0
  14. package/AGENTS.md +130 -0
  15. package/LICENSE +21 -0
  16. package/README.md +1542 -0
  17. package/agents/devkit-maintainer/context.globs +15 -0
  18. package/agents/devkit-maintainer/permissions.yml +17 -0
  19. package/agents/devkit-maintainer/prompt.md +28 -0
  20. package/agents/devkit-maintainer/runbook.md +31 -0
  21. package/agents/docs-crafter/prompt.md +24 -0
  22. package/agents/docs-crafter/runbook.md +18 -0
  23. package/agents/release-manager/context.globs +7 -0
  24. package/agents/release-manager/prompt.md +27 -0
  25. package/agents/release-manager/runbook.md +17 -0
  26. package/agents/test-generator/context.globs +7 -0
  27. package/agents/test-generator/prompt.md +27 -0
  28. package/agents/test-generator/runbook.md +18 -0
  29. package/bin/devkit-architecture.mjs +1225 -0
  30. package/bin/devkit-build-order.mjs +500 -0
  31. package/bin/devkit-check-build-readiness.mjs +222 -0
  32. package/bin/devkit-check-commands.mjs +394 -0
  33. package/bin/devkit-check-configs.mjs +461 -0
  34. package/bin/devkit-check-deprecated.mjs +532 -0
  35. package/bin/devkit-check-duplicates.mjs +431 -0
  36. package/bin/devkit-check-exports.mjs +561 -0
  37. package/bin/devkit-check-imports.mjs +712 -0
  38. package/bin/devkit-check-paths.mjs +670 -0
  39. package/bin/devkit-check-scripts.mjs +335 -0
  40. package/bin/devkit-check-structure.mjs +495 -0
  41. package/bin/devkit-check-types.mjs +450 -0
  42. package/bin/devkit-ci.mjs +261 -0
  43. package/bin/devkit-core-gate.mjs +225 -0
  44. package/bin/devkit-fix-deps.mjs +1169 -0
  45. package/bin/devkit-freshness.mjs +199 -0
  46. package/bin/devkit-health.mjs +489 -0
  47. package/bin/devkit-migrate-configs.mjs +370 -0
  48. package/bin/devkit-paths.mjs +192 -0
  49. package/bin/devkit-stats.mjs +453 -0
  50. package/bin/devkit-sync.mjs +12 -0
  51. package/bin/devkit-tsup-external.mjs +148 -0
  52. package/bin/devkit-types-audit.mjs +615 -0
  53. package/bin/devkit-types-order.mjs +637 -0
  54. package/bin/devkit-validate-naming.mjs +203 -0
  55. package/bin/devkit-visualize.mjs +452 -0
  56. package/bin/kb-devkit-qa-history.mjs +453 -0
  57. package/bin/kb-devkit-qa.mjs +915 -0
  58. package/eslint/node.js +134 -0
  59. package/eslint/react.js +260 -0
  60. package/package.json +186 -0
  61. package/prettier/index.json +10 -0
  62. package/sync/index.mjs +693 -0
  63. package/templates/configs/README.md +306 -0
  64. package/templates/configs/eslint.config.js +27 -0
  65. package/templates/configs/package.json.bin +25 -0
  66. package/templates/configs/package.json.lib +30 -0
  67. package/templates/configs/tsconfig.build.json +15 -0
  68. package/templates/configs/tsconfig.json +9 -0
  69. package/templates/configs/tsup.config.bin.ts +34 -0
  70. package/templates/configs/tsup.config.cli.ts +41 -0
  71. package/templates/configs/tsup.config.dual.ts +46 -0
  72. package/templates/configs/tsup.config.ts +36 -0
  73. package/templates/package-json/README.md +290 -0
  74. package/templates/package-json/package.json.bin.template +40 -0
  75. package/templates/package-json/package.json.template +45 -0
  76. package/tsconfig/base.json +21 -0
  77. package/tsconfig/cli.json +12 -0
  78. package/tsconfig/dist/__tests__/cache.spec.d.ts +6 -0
  79. package/tsconfig/dist/__tests__/cache.spec.d.ts.map +1 -0
  80. package/tsconfig/dist/__tests__/cache.spec.js +85 -0
  81. package/tsconfig/dist/__tests__/cache.spec.js.map +1 -0
  82. package/tsconfig/dist/__tests__/fs-atomic.spec.d.ts +6 -0
  83. package/tsconfig/dist/__tests__/fs-atomic.spec.d.ts.map +1 -0
  84. package/tsconfig/dist/__tests__/fs-atomic.spec.js +153 -0
  85. package/tsconfig/dist/__tests__/fs-atomic.spec.js.map +1 -0
  86. package/tsconfig/dist/__tests__/init-workspace.spec.d.ts +6 -0
  87. package/tsconfig/dist/__tests__/init-workspace.spec.d.ts.map +1 -0
  88. package/tsconfig/dist/__tests__/init-workspace.spec.js +99 -0
  89. package/tsconfig/dist/__tests__/init-workspace.spec.js.map +1 -0
  90. package/tsconfig/dist/__tests__/kb-error.spec.d.ts +6 -0
  91. package/tsconfig/dist/__tests__/kb-error.spec.d.ts.map +1 -0
  92. package/tsconfig/dist/__tests__/kb-error.spec.js +190 -0
  93. package/tsconfig/dist/__tests__/kb-error.spec.js.map +1 -0
  94. package/tsconfig/dist/__tests__/preset-lockfile.spec.d.ts +6 -0
  95. package/tsconfig/dist/__tests__/preset-lockfile.spec.d.ts.map +1 -0
  96. package/tsconfig/dist/__tests__/preset-lockfile.spec.js +142 -0
  97. package/tsconfig/dist/__tests__/preset-lockfile.spec.js.map +1 -0
  98. package/tsconfig/dist/__tests__/product-config-profiles.spec.d.ts +6 -0
  99. package/tsconfig/dist/__tests__/product-config-profiles.spec.d.ts.map +1 -0
  100. package/tsconfig/dist/__tests__/product-config-profiles.spec.js +100 -0
  101. package/tsconfig/dist/__tests__/product-config-profiles.spec.js.map +1 -0
  102. package/tsconfig/dist/__tests__/product-config.spec.d.ts +6 -0
  103. package/tsconfig/dist/__tests__/product-config.spec.d.ts.map +1 -0
  104. package/tsconfig/dist/__tests__/product-config.spec.js +298 -0
  105. package/tsconfig/dist/__tests__/product-config.spec.js.map +1 -0
  106. package/tsconfig/dist/__tests__/runtime.spec.d.ts +2 -0
  107. package/tsconfig/dist/__tests__/runtime.spec.d.ts.map +1 -0
  108. package/tsconfig/dist/__tests__/runtime.spec.js +127 -0
  109. package/tsconfig/dist/__tests__/runtime.spec.js.map +1 -0
  110. package/tsconfig/dist/__tests__/upsert-lockfile.spec.d.ts +6 -0
  111. package/tsconfig/dist/__tests__/upsert-lockfile.spec.d.ts.map +1 -0
  112. package/tsconfig/dist/__tests__/upsert-lockfile.spec.js +251 -0
  113. package/tsconfig/dist/__tests__/upsert-lockfile.spec.js.map +1 -0
  114. package/tsconfig/dist/__tests__/validate-config.spec.d.ts +2 -0
  115. package/tsconfig/dist/__tests__/validate-config.spec.d.ts.map +1 -0
  116. package/tsconfig/dist/__tests__/validate-config.spec.js +14 -0
  117. package/tsconfig/dist/__tests__/validate-config.spec.js.map +1 -0
  118. package/tsconfig/dist/api/init-workspace.d.ts +10 -0
  119. package/tsconfig/dist/api/init-workspace.d.ts.map +1 -0
  120. package/tsconfig/dist/api/init-workspace.js +191 -0
  121. package/tsconfig/dist/api/init-workspace.js.map +1 -0
  122. package/tsconfig/dist/api/product-config.d.ts +21 -0
  123. package/tsconfig/dist/api/product-config.d.ts.map +1 -0
  124. package/tsconfig/dist/api/product-config.js +192 -0
  125. package/tsconfig/dist/api/product-config.js.map +1 -0
  126. package/tsconfig/dist/api/read-config.d.ts +22 -0
  127. package/tsconfig/dist/api/read-config.d.ts.map +1 -0
  128. package/tsconfig/dist/api/read-config.js +105 -0
  129. package/tsconfig/dist/api/read-config.js.map +1 -0
  130. package/tsconfig/dist/api/upsert-lockfile.d.ts +10 -0
  131. package/tsconfig/dist/api/upsert-lockfile.d.ts.map +1 -0
  132. package/tsconfig/dist/api/upsert-lockfile.js +63 -0
  133. package/tsconfig/dist/api/upsert-lockfile.js.map +1 -0
  134. package/tsconfig/dist/cache/fs-cache.d.ts +38 -0
  135. package/tsconfig/dist/cache/fs-cache.d.ts.map +1 -0
  136. package/tsconfig/dist/cache/fs-cache.js +142 -0
  137. package/tsconfig/dist/cache/fs-cache.js.map +1 -0
  138. package/tsconfig/dist/errors/kb-error.d.ts +32 -0
  139. package/tsconfig/dist/errors/kb-error.d.ts.map +1 -0
  140. package/tsconfig/dist/errors/kb-error.js +54 -0
  141. package/tsconfig/dist/errors/kb-error.js.map +1 -0
  142. package/tsconfig/dist/fs/__tests__/fs.spec.d.ts +2 -0
  143. package/tsconfig/dist/fs/__tests__/fs.spec.d.ts.map +1 -0
  144. package/tsconfig/dist/fs/__tests__/fs.spec.js +22 -0
  145. package/tsconfig/dist/fs/__tests__/fs.spec.js.map +1 -0
  146. package/tsconfig/dist/fs/fs.d.ts +6 -0
  147. package/tsconfig/dist/fs/fs.d.ts.map +1 -0
  148. package/tsconfig/dist/fs/fs.js +12 -0
  149. package/tsconfig/dist/fs/fs.js.map +1 -0
  150. package/tsconfig/dist/fs/index.d.ts +2 -0
  151. package/tsconfig/dist/fs/index.d.ts.map +1 -0
  152. package/tsconfig/dist/fs/index.js +2 -0
  153. package/tsconfig/dist/fs/index.js.map +1 -0
  154. package/tsconfig/dist/hash/config-hash.d.ts +17 -0
  155. package/tsconfig/dist/hash/config-hash.d.ts.map +1 -0
  156. package/tsconfig/dist/hash/config-hash.js +55 -0
  157. package/tsconfig/dist/hash/config-hash.js.map +1 -0
  158. package/tsconfig/dist/index.d.ts +5 -0
  159. package/tsconfig/dist/index.d.ts.map +1 -0
  160. package/tsconfig/dist/index.js +5 -0
  161. package/tsconfig/dist/index.js.map +1 -0
  162. package/tsconfig/dist/lockfile/lockfile.d.ts +54 -0
  163. package/tsconfig/dist/lockfile/lockfile.d.ts.map +1 -0
  164. package/tsconfig/dist/lockfile/lockfile.js +141 -0
  165. package/tsconfig/dist/lockfile/lockfile.js.map +1 -0
  166. package/tsconfig/dist/logging/__tests__/logger.spec.d.ts +2 -0
  167. package/tsconfig/dist/logging/__tests__/logger.spec.d.ts.map +1 -0
  168. package/tsconfig/dist/logging/__tests__/logger.spec.js +65 -0
  169. package/tsconfig/dist/logging/__tests__/logger.spec.js.map +1 -0
  170. package/tsconfig/dist/logging/__tests__/redaction.spec.d.ts +2 -0
  171. package/tsconfig/dist/logging/__tests__/redaction.spec.d.ts.map +1 -0
  172. package/tsconfig/dist/logging/__tests__/redaction.spec.js +34 -0
  173. package/tsconfig/dist/logging/__tests__/redaction.spec.js.map +1 -0
  174. package/tsconfig/dist/logging/__tests__/sinks-and-env.spec.d.ts +2 -0
  175. package/tsconfig/dist/logging/__tests__/sinks-and-env.spec.d.ts.map +1 -0
  176. package/tsconfig/dist/logging/__tests__/sinks-and-env.spec.js +90 -0
  177. package/tsconfig/dist/logging/__tests__/sinks-and-env.spec.js.map +1 -0
  178. package/tsconfig/dist/logging/index.d.ts +6 -0
  179. package/tsconfig/dist/logging/index.d.ts.map +1 -0
  180. package/tsconfig/dist/logging/index.js +6 -0
  181. package/tsconfig/dist/logging/index.js.map +1 -0
  182. package/tsconfig/dist/logging/logger.d.ts +9 -0
  183. package/tsconfig/dist/logging/logger.d.ts.map +1 -0
  184. package/tsconfig/dist/logging/logger.js +101 -0
  185. package/tsconfig/dist/logging/logger.js.map +1 -0
  186. package/tsconfig/dist/logging/redaction.d.ts +7 -0
  187. package/tsconfig/dist/logging/redaction.d.ts.map +1 -0
  188. package/tsconfig/dist/logging/redaction.js +23 -0
  189. package/tsconfig/dist/logging/redaction.js.map +1 -0
  190. package/tsconfig/dist/logging/sinks/json.d.ts +4 -0
  191. package/tsconfig/dist/logging/sinks/json.d.ts.map +1 -0
  192. package/tsconfig/dist/logging/sinks/json.js +23 -0
  193. package/tsconfig/dist/logging/sinks/json.js.map +1 -0
  194. package/tsconfig/dist/logging/sinks/stdout.d.ts +3 -0
  195. package/tsconfig/dist/logging/sinks/stdout.d.ts.map +1 -0
  196. package/tsconfig/dist/logging/sinks/stdout.js +24 -0
  197. package/tsconfig/dist/logging/sinks/stdout.js.map +1 -0
  198. package/tsconfig/dist/logging/types/index.d.ts +2 -0
  199. package/tsconfig/dist/logging/types/index.d.ts.map +1 -0
  200. package/tsconfig/dist/logging/types/index.js +2 -0
  201. package/tsconfig/dist/logging/types/index.js.map +1 -0
  202. package/tsconfig/dist/logging/types/types.d.ts +37 -0
  203. package/tsconfig/dist/logging/types/types.d.ts.map +1 -0
  204. package/tsconfig/dist/logging/types/types.js +2 -0
  205. package/tsconfig/dist/logging/types/types.js.map +1 -0
  206. package/tsconfig/dist/merge/layered-merge.d.ts +16 -0
  207. package/tsconfig/dist/merge/layered-merge.d.ts.map +1 -0
  208. package/tsconfig/dist/merge/layered-merge.js +97 -0
  209. package/tsconfig/dist/merge/layered-merge.js.map +1 -0
  210. package/tsconfig/dist/preset/resolve-preset.d.ts +29 -0
  211. package/tsconfig/dist/preset/resolve-preset.d.ts.map +1 -0
  212. package/tsconfig/dist/preset/resolve-preset.js +104 -0
  213. package/tsconfig/dist/preset/resolve-preset.js.map +1 -0
  214. package/tsconfig/dist/repo/__tests__/repo.spec.d.ts +2 -0
  215. package/tsconfig/dist/repo/__tests__/repo.spec.d.ts.map +1 -0
  216. package/tsconfig/dist/repo/__tests__/repo.spec.js +25 -0
  217. package/tsconfig/dist/repo/__tests__/repo.spec.js.map +1 -0
  218. package/tsconfig/dist/repo/index.d.ts +2 -0
  219. package/tsconfig/dist/repo/index.d.ts.map +1 -0
  220. package/tsconfig/dist/repo/index.js +2 -0
  221. package/tsconfig/dist/repo/index.js.map +1 -0
  222. package/tsconfig/dist/repo/repo.d.ts +6 -0
  223. package/tsconfig/dist/repo/repo.d.ts.map +1 -0
  224. package/tsconfig/dist/repo/repo.js +25 -0
  225. package/tsconfig/dist/repo/repo.js.map +1 -0
  226. package/tsconfig/dist/runtime/index.d.ts +2 -0
  227. package/tsconfig/dist/runtime/index.d.ts.map +1 -0
  228. package/tsconfig/dist/runtime/index.js +2 -0
  229. package/tsconfig/dist/runtime/index.js.map +1 -0
  230. package/tsconfig/dist/runtime/runtime.d.ts +46 -0
  231. package/tsconfig/dist/runtime/runtime.d.ts.map +1 -0
  232. package/tsconfig/dist/runtime/runtime.js +126 -0
  233. package/tsconfig/dist/runtime/runtime.js.map +1 -0
  234. package/tsconfig/dist/tsconfig.tools.tsbuildinfo +1 -0
  235. package/tsconfig/dist/tsconfig.tsbuildinfo +1 -0
  236. package/tsconfig/dist/types/index.d.ts +2 -0
  237. package/tsconfig/dist/types/index.d.ts.map +1 -0
  238. package/tsconfig/dist/types/index.js +2 -0
  239. package/tsconfig/dist/types/index.js.map +1 -0
  240. package/tsconfig/dist/types/init.d.ts +34 -0
  241. package/tsconfig/dist/types/init.d.ts.map +1 -0
  242. package/tsconfig/dist/types/init.js +6 -0
  243. package/tsconfig/dist/types/init.js.map +1 -0
  244. package/tsconfig/dist/types/preset.d.ts +27 -0
  245. package/tsconfig/dist/types/preset.d.ts.map +1 -0
  246. package/tsconfig/dist/types/preset.js +6 -0
  247. package/tsconfig/dist/types/preset.js.map +1 -0
  248. package/tsconfig/dist/types/types.d.ts +6 -0
  249. package/tsconfig/dist/types/types.d.ts.map +1 -0
  250. package/tsconfig/dist/types/types.js +2 -0
  251. package/tsconfig/dist/types/types.js.map +1 -0
  252. package/tsconfig/dist/utils/__tests__/env.spec.d.ts +2 -0
  253. package/tsconfig/dist/utils/__tests__/env.spec.d.ts.map +1 -0
  254. package/tsconfig/dist/utils/__tests__/env.spec.js +33 -0
  255. package/tsconfig/dist/utils/__tests__/env.spec.js.map +1 -0
  256. package/tsconfig/dist/utils/env.d.ts +7 -0
  257. package/tsconfig/dist/utils/env.d.ts.map +1 -0
  258. package/tsconfig/dist/utils/env.js +25 -0
  259. package/tsconfig/dist/utils/env.js.map +1 -0
  260. package/tsconfig/dist/utils/fs-atomic.d.ts +15 -0
  261. package/tsconfig/dist/utils/fs-atomic.d.ts.map +1 -0
  262. package/tsconfig/dist/utils/fs-atomic.js +45 -0
  263. package/tsconfig/dist/utils/fs-atomic.js.map +1 -0
  264. package/tsconfig/dist/utils/index.d.ts +3 -0
  265. package/tsconfig/dist/utils/index.d.ts.map +1 -0
  266. package/tsconfig/dist/utils/index.js +3 -0
  267. package/tsconfig/dist/utils/index.js.map +1 -0
  268. package/tsconfig/dist/utils/paths.d.ts +21 -0
  269. package/tsconfig/dist/utils/paths.d.ts.map +1 -0
  270. package/tsconfig/dist/utils/paths.js +32 -0
  271. package/tsconfig/dist/utils/paths.js.map +1 -0
  272. package/tsconfig/dist/utils/product-normalize.d.ts +27 -0
  273. package/tsconfig/dist/utils/product-normalize.d.ts.map +1 -0
  274. package/tsconfig/dist/utils/product-normalize.js +45 -0
  275. package/tsconfig/dist/utils/product-normalize.js.map +1 -0
  276. package/tsconfig/dist/validation/validate-config.d.ts +7 -0
  277. package/tsconfig/dist/validation/validate-config.d.ts.map +1 -0
  278. package/tsconfig/dist/validation/validate-config.js +22 -0
  279. package/tsconfig/dist/validation/validate-config.js.map +1 -0
  280. package/tsconfig/lib.json +13 -0
  281. package/tsconfig/node.json +12 -0
  282. package/tsconfig/react-app.json +8 -0
  283. package/tsconfig/react-lib.json +8 -0
  284. package/tsconfig/test.json +15 -0
  285. package/tsup/bin.js +172 -0
  286. package/tsup/dual.js +155 -0
  287. package/tsup/external-sync.mjs +41 -0
  288. package/tsup/external.mjs +109 -0
  289. package/tsup/node.js +65 -0
  290. package/tsup/react-lib.js +18 -0
  291. package/tsup/sdk.js +118 -0
  292. package/vite/react-app.js +50 -0
  293. package/vitest/node.js +37 -0
  294. package/vitest/react.js +39 -0
  295. package/vitest/vitest-setup.ts +9 -0
@@ -0,0 +1,15 @@
1
+ src/**/*
2
+ packages/**/*
3
+ apps/**/*
4
+ docs/**/*
5
+ .eslintrc.*
6
+ eslint.config.*
7
+ vitest.config.*
8
+ tsconfig*.json
9
+ .prettierrc*
10
+ .editorconfig
11
+ package.json
12
+ .github/**/*
13
+ README.md
14
+ CONTRIBUTING.md
15
+ AGENTS.md
@@ -0,0 +1,17 @@
1
+ permissions:
2
+ file:
3
+ read: ["**/*"]
4
+ write:
5
+ - "eslint.config.js"
6
+ - "vitest.config.*"
7
+ - "tsconfig*.json"
8
+ - ".prettierrc*"
9
+ - ".editorconfig"
10
+ - "package.json"
11
+ - ".github/workflows/*.yml"
12
+ - "README.md"
13
+ - "CONTRIBUTING.md"
14
+ terminal:
15
+ allowed: ["pnpm *", "git *"]
16
+ git:
17
+ allowed: ["add", "commit", "restore", "checkout", "switch"]
@@ -0,0 +1,28 @@
1
+ # DevKit Maintainer (KB Labs)
2
+
3
+ You maintain adoption of the KB Labs DevKit across repositories.
4
+
5
+ **Goals**
6
+ - Enforce using `@kb-labs/devkit` for tsconfig, ESLint, Prettier, Vitest, and Tsup.
7
+ - Ensure CI uses reusable workflows from `kb-labs-devkit`.
8
+ - Keep local configs as thin wrappers that import/extend DevKit presets.
9
+ - Avoid breaking changes. Propose minimal diffs first.
10
+
11
+ **Process**
12
+ 1) Audit repository for drift:
13
+ - Duplicate configs instead of devkit presets.
14
+ - Outdated scripts not using devkit.
15
+ - CI not using reusable workflows.
16
+ 2) Propose a patch plan (list files and diffs).
17
+ 3) Apply safe changes incrementally.
18
+ 4) Verify with `pnpm lint && pnpm type-check && pnpm -r run test && pnpm -r run build`.
19
+
20
+ **Rules**
21
+ - Do not modify domain/business logic.
22
+ - Keep changes minimal and reversible.
23
+ - Prefer project-wide consistency over ad-hoc fixes.
24
+
25
+ **Outputs**
26
+ - Patch plan (bulleted).
27
+ - Diffs for files to change.
28
+ - A short validation checklist to run locally and in CI.
@@ -0,0 +1,31 @@
1
+ # Runbook — DevKit Maintainer
2
+
3
+ ## Audit
4
+ - Check for:
5
+ - Local ESLint/TS/Prettier/Vitest/Tsup configs not referencing devkit.
6
+ - package.json scripts that don't use devkit presets.
7
+ - CI not using `KirillBaranov/kb-labs-devkit/.github/workflows/ci.yml@v1` (or @main).
8
+ - Misaligned tsconfig (`inlineSources`, missing `resolveJsonModule`, etc.).
9
+
10
+ ## Patch Plan (example)
11
+ 1. Replace local `eslint.config.js` with:
12
+ ```js
13
+ import config from '@kb-labs/devkit/eslint/node.js'
14
+ export default config
15
+ ```
16
+
17
+ 2. Replace tsconfig.json to extend from project base, which extends devkit.
18
+ 3. Update scripts to use devkit presets:
19
+ - build/dev with tsup preset, or local tsup config if entry differs.
20
+ - vitest config centralized: vitest -c ../../vitest.config.ts for packages.
21
+ 4. CI: use reusable workflow from devkit.
22
+
23
+ ## Validate
24
+ - pnpm install
25
+ - pnpm lint && pnpm type-check
26
+ - pnpm -r run test
27
+ - pnpm -r run build
28
+
29
+ ## Notes
30
+ - Prefer root vitest config (avoid TS configs under pure ESM).
31
+ - Avoid deep imports; ensure "exports" are respected.
@@ -0,0 +1,24 @@
1
+ # Docs Drafter (KB Labs)
2
+
3
+ You draft and maintain developer-facing documentation.
4
+
5
+ **Goals**
6
+ - Generate or update: README.md, CONTRIBUTING.md, and ADRs in `docs/adr/`.
7
+ - Keep docs concise, actionable, and aligned with DevKit conventions.
8
+ - Link to ADRs from README when architectural decisions are relevant.
9
+
10
+ **Process**
11
+ 1) Inspect repo structure, scripts, and DevKit integration.
12
+ 2) Propose doc outline or diffs (show what will change).
13
+ 3) Write/update docs incrementally; keep tone consistent.
14
+ 4) Validate commands actually work (`pnpm` scripts).
15
+
16
+ **Rules**
17
+ - No boilerplate walls of text; focus on “how to run, build, test, release”.
18
+ - Use the ADR template when a decision affects architecture/tooling.
19
+ - Cross-link related docs (ADR <-> README <-> CONTRIBUTING).
20
+
21
+ **Outputs**
22
+ - Updated README.md with Quickstart and scripts.
23
+ - CONTRIBUTING.md with lint/test/build instructions, ADR policy.
24
+ - New ADRs using `docs/adr/0000-template.md`.
@@ -0,0 +1,18 @@
1
+ # Runbook — Docs Drafter
2
+
3
+ ## Minimum README sections
4
+ - What is this package/app.
5
+ - Quickstart: install, build, dev.
6
+ - Scripts (lint/test/type-check/build).
7
+ - DevKit integration and CI note.
8
+ - Links to ADRs.
9
+
10
+ ## CONTRIBUTING essentials
11
+ - Node/pnpm versions.
12
+ - Lint/test/build commands.
13
+ - ADR policy: when to add a new record; link to template.
14
+
15
+ ## ADR
16
+ - Use `docs/adr/0000-template.md`.
17
+ - Record decisions affecting architecture/tooling.
18
+ - Cross-link from README.
@@ -0,0 +1,7 @@
1
+ packages/**/*
2
+ apps/**/*
3
+ CHANGELOG.md
4
+ README.md
5
+ package.json
6
+ pnpm-lock.yaml
7
+ .github/workflows/*
@@ -0,0 +1,27 @@
1
+ # Release Manager (KB Labs)
2
+
3
+ You prepare safe releases.
4
+
5
+ **Goals**
6
+ - Draft a release plan: version bump, summary, and changelog.
7
+ - Verify build and tests before proposing a release.
8
+ - Use GitHub Releases; npm publish only when explicitly requested and configured.
9
+
10
+ **Process**
11
+ 1) Analyze commits and changes since last tag.
12
+ 2) Recommend semver bump (patch/minor/major).
13
+ 3) Run validation locally:
14
+ - `pnpm -r run build`
15
+ - `pnpm -r run test` (or `--if-present`)
16
+ 4) Prepare release notes (features/fixes/breaking).
17
+ 5) Output a checklist with exact commands/steps.
18
+
19
+ **Rules**
20
+ - Do not push tags or publish without confirmation.
21
+ - Respect monorepo workspaces; note any packages impacted.
22
+ - If publishing to npm, require `NPM_TOKEN` and proper access.
23
+
24
+ **Outputs**
25
+ - Release plan (version, notes, affected packages).
26
+ - GitHub Release draft text.
27
+ - Optional `changeset` if used (or plain changelog).
@@ -0,0 +1,17 @@
1
+ # Runbook — Release Manager
2
+
3
+ ## Preflight
4
+ - `pnpm install`
5
+ - `pnpm lint && pnpm type-check`
6
+ - `pnpm -r run test`
7
+ - `pnpm -r run build`
8
+
9
+ ## Plan
10
+ - Determine semver bump.
11
+ - Summarize changes by category.
12
+ - Identify impacted packages (monorepo).
13
+
14
+ ## Output
15
+ - GitHub Release draft (markdown).
16
+ - Optional: `pnpm -r publish` if configured (requires `NPM_TOKEN`).
17
+ - Do not push tags unless confirmed.
@@ -0,0 +1,7 @@
1
+ src/**/*
2
+ packages/**/*
3
+ apps/**/*
4
+ tsconfig*.json
5
+ vitest.config.*
6
+ package.json
7
+ README.md
@@ -0,0 +1,27 @@
1
+ # Test Generator (KB Labs)
2
+
3
+ You generate pragmatic unit tests and improve coverage without brittleness.
4
+
5
+ **Goals**
6
+ - Co-located tests: `__tests__/*.spec.ts` or `*.test.ts`.
7
+ - Use Vitest. Respect project’s exports (no deep imports).
8
+ - Aim for ≥95% coverage where meaningful; avoid flaky or snapshot-heavy tests.
9
+ - Cover branches, edge cases, and error paths.
10
+
11
+ **Process**
12
+ 1) Scan source files and existing tests.
13
+ 2) Propose a coverage plan (file-by-file).
14
+ 3) Implement tests incrementally; run locally:
15
+ - `pnpm -r run test` (or per package)
16
+ - `pnpm -r run test:coverage` if configured
17
+ 4) Refine to remove redundancy and flakiness.
18
+
19
+ **Rules**
20
+ - Keep tests deterministic and fast.
21
+ - Don’t introduce new runtime deps without confirmation.
22
+ - Prefer simple assertions, explicit inputs, and clear setup/teardown.
23
+
24
+ **Outputs**
25
+ - Coverage plan with target %.
26
+ - New/updated test files.
27
+ - Short notes on what is intentionally left untested (if any).
@@ -0,0 +1,18 @@
1
+ # Runbook — Test Generator
2
+
3
+ ## Steps
4
+ 1. Identify functions/methods with low/no coverage.
5
+ 2. For each function:
6
+ - Test main path, edge cases, and error handling.
7
+ - Avoid snapshots unless structure is stable and justified.
8
+ 3. Create tests in `__tests__/name.spec.ts` near the source file.
9
+ 4. Run tests and check coverage locally.
10
+
11
+ ## Commands
12
+ - `pnpm -r run test`
13
+ - `pnpm -r run test:coverage`
14
+ - `pnpm --filter <pkg> run test`
15
+
16
+ ## Tips
17
+ - Import from package public exports when possible to mirror user usage.
18
+ - If a package has no tests, add a `smoke.spec.ts`.