@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
package/.cursorrules ADDED
@@ -0,0 +1,32 @@
1
+ # Global Cursor rules for KB Labs projects
2
+ allow:
3
+ - read: "src/**/*"
4
+ - read: "packages/**/*"
5
+ - read: "apps/**/*"
6
+ - read: "docs/**/*"
7
+ - read: "README.md"
8
+ - read: "package.json"
9
+ - read: "tsconfig*.json"
10
+ - read: ".github/**/*"
11
+ - read: ".cursorrules"
12
+ - read: "agents/**/*"
13
+ - write: "src/**/*"
14
+ - write: "packages/**/*"
15
+ - write: "apps/**/*"
16
+ - write: "docs/**/*"
17
+ - write: "README.md"
18
+ - write: "CONTRIBUTING.md"
19
+ - write: "AGENTS.md"
20
+ - write: "docs/adr/**/*"
21
+ - run: "pnpm *"
22
+ - run: "git *"
23
+ deny:
24
+ - write: "node_modules/**/*"
25
+ - write: "dist/**/*"
26
+ - write: "coverage/**/*"
27
+ - write: ".yalc/**/*"
28
+ - run: "rm -rf *"
29
+ notes:
30
+ - Always prefer presets from @kb-labs/devkit (tsconfig/eslint/prettier/vitest/tsup).
31
+ - Keep local configs as thin wrappers (import/extends from devkit).
32
+ - Respect package.json "exports" (no deep imports).
@@ -0,0 +1,2 @@
1
+ # Default owner for everything — change if/when you add collaborators
2
+ * @KirillBaranov
@@ -0,0 +1,47 @@
1
+ name: Setup Node & pnpm
2
+ description: Install Node and pnpm with cache
3
+
4
+ inputs:
5
+ node-version:
6
+ default: '20'
7
+ package-json-path:
8
+ default: 'package.json'
9
+ fallback-pnpm-version:
10
+ default: '9.15.0'
11
+
12
+ runs:
13
+ using: composite
14
+ steps:
15
+ - uses: actions/setup-node@v4
16
+ with:
17
+ node-version: ${{ inputs.node-version }}
18
+ # cache: pnpm ← УДАЛИТЬ
19
+
20
+ - name: Enable Corepack
21
+ shell: bash
22
+ run: |
23
+ corepack enable
24
+ echo "$HOME/.local/share/pnpm" >> "$GITHUB_PATH"
25
+ echo "$HOME/.local/share/node" >> "$GITHUB_PATH"
26
+
27
+ - name: Resolve PNPM version & activate via Corepack
28
+ shell: bash
29
+ run: |
30
+ set -euo pipefail
31
+ FILE="${{ inputs.package-json-path }}"
32
+ VER=$(node -e "try{const pm=require('${FILE}').packageManager||''; const v=(pm.split('@')[1]||'').split('+')[0]; process.stdout.write(v);}catch(e){process.stdout.write('');}")
33
+ [ -z "$VER" ] && VER="${{ inputs.fallback-pnpm-version }}"
34
+ echo "Using pnpm@$VER"
35
+ corepack prepare "pnpm@$VER" --activate
36
+ pnpm -v
37
+
38
+ - name: (opt) Cache pnpm store
39
+ uses: actions/cache@v4
40
+ with:
41
+ path: ~/.pnpm-store
42
+ key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
43
+ restore-keys: |
44
+ ${{ runner.os }}-pnpm-
45
+ - name: (opt) Configure pnpm store
46
+ shell: bash
47
+ run: pnpm config set store-dir ~/.pnpm-store
@@ -0,0 +1,13 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ pull_request:
6
+ workflow_dispatch: {}
7
+
8
+ jobs:
9
+ call:
10
+ uses: KirillBaranov/kb-labs-devkit/.github/workflows/ci-reusable.yml@main
11
+ with:
12
+ node-version: '20'
13
+ run-coverage: true
@@ -0,0 +1,10 @@
1
+ name: Drift Check
2
+ on:
3
+ workflow_dispatch: {}
4
+ schedule:
5
+ - cron: '0 3 * * *' # nightly
6
+ jobs:
7
+ drift:
8
+ uses: KirillBaranov/kb-labs-devkit/.github/workflows/drift-check-reusable.yml@main
9
+ with:
10
+ node-version: '20'
@@ -0,0 +1,16 @@
1
+ name: Profiles Validate
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ pull_request:
6
+ workflow_dispatch: {}
7
+
8
+ jobs:
9
+ call:
10
+ uses: KirillBaranov/kb-labs-devkit/.github/workflows/profiles-validate-reusable.yml@main
11
+ with:
12
+ node_version: '20'
13
+ soft_fail: true
14
+ working_directory: '.'
15
+ fixtures_dir: ''
16
+ log_level: 'info'
@@ -0,0 +1,8 @@
1
+ name: Release
2
+ on:
3
+ push:
4
+ tags: ['v*']
5
+ workflow_dispatch: {}
6
+ jobs:
7
+ call:
8
+ uses: KirillBaranov/kb-labs-devkit/.github/workflows/release-reusable.yml@main
@@ -0,0 +1,131 @@
1
+ name: reusable-ci
2
+
3
+ on:
4
+ workflow_call:
5
+ inputs:
6
+ node-version:
7
+ description: Node.js version
8
+ required: false
9
+ default: '20'
10
+ type: string
11
+ run-coverage:
12
+ description: Run coverage step
13
+ required: false
14
+ default: true
15
+ type: boolean
16
+ enable-drift-check:
17
+ description: Run DevKit drift check (fails on drift)
18
+ required: false
19
+ default: true
20
+ type: boolean
21
+
22
+ jobs:
23
+ drift:
24
+ if: ${{ inputs.enable-drift-check == true }}
25
+ runs-on: ubuntu-latest
26
+ permissions:
27
+ contents: read
28
+ concurrency:
29
+ group: ${{ github.workflow }}-${{ github.ref }}-drift
30
+ cancel-in-progress: true
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+ - uses: KirillBaranov/kb-labs-devkit/.github/actions/setup-node-pnpm@main
34
+ with:
35
+ node-version: ${{ inputs['node-version'] }}
36
+ - name: Install deps
37
+ run: pnpm i --frozen-lockfile
38
+ - name: DevKit drift check
39
+ # Repos are expected to ship a script `devkit:check` that runs the sync tool in check mode
40
+ run: pnpm -s devkit:check
41
+
42
+ validate:
43
+ runs-on: ubuntu-latest
44
+ permissions:
45
+ contents: read
46
+ concurrency:
47
+ group: ${{ github.workflow }}-${{ github.ref }}-validate
48
+ cancel-in-progress: true
49
+ steps:
50
+ - uses: actions/checkout@v4
51
+ - uses: KirillBaranov/kb-labs-devkit/.github/actions/setup-node-pnpm@main
52
+ with:
53
+ node-version: ${{ inputs['node-version'] }}
54
+ - name: Install deps
55
+ run: pnpm i --frozen-lockfile
56
+ - name: Lint
57
+ run: pnpm lint
58
+ - name: Type check
59
+ run: pnpm type-check || true
60
+
61
+ build:
62
+ runs-on: ubuntu-latest
63
+ needs: validate
64
+ permissions:
65
+ contents: read
66
+ steps:
67
+ - uses: actions/checkout@v4
68
+ - uses: KirillBaranov/kb-labs-devkit/.github/actions/setup-node-pnpm@main
69
+ with:
70
+ node-version: ${{ inputs['node-version'] }}
71
+ - name: Install deps
72
+ run: pnpm i --frozen-lockfile
73
+ - name: Build (workspace)
74
+ run: pnpm -r run build || true
75
+ - name: Upload build outputs
76
+ uses: actions/upload-artifact@v4
77
+ with:
78
+ name: build-dist
79
+ path: |
80
+ packages/**/dist/
81
+ dist/
82
+ if-no-files-found: ignore
83
+
84
+ test:
85
+ runs-on: ubuntu-latest
86
+ needs: build
87
+ permissions:
88
+ contents: read
89
+ steps:
90
+ - uses: actions/checkout@v4
91
+ - uses: KirillBaranov/kb-labs-devkit/.github/actions/setup-node-pnpm@main
92
+ with:
93
+ node-version: ${{ inputs['node-version'] }}
94
+ - name: Install deps
95
+ run: pnpm i --frozen-lockfile
96
+ - name: Download build outputs
97
+ uses: actions/download-artifact@v4
98
+ with:
99
+ name: build-dist
100
+ path: .
101
+ - name: Test (no watch)
102
+ run: pnpm test -- --run
103
+
104
+ coverage:
105
+ if: ${{ inputs['run-coverage'] == true }}
106
+ runs-on: ubuntu-latest
107
+ needs: build
108
+ permissions:
109
+ contents: read
110
+ steps:
111
+ - uses: actions/checkout@v4
112
+ - uses: KirillBaranov/kb-labs-devkit/.github/actions/setup-node-pnpm@main
113
+ with:
114
+ node-version: ${{ inputs['node-version'] }}
115
+ - name: Install deps
116
+ run: pnpm i --frozen-lockfile
117
+ - name: Download build outputs
118
+ uses: actions/download-artifact@v4
119
+ with:
120
+ name: build-dist
121
+ path: .
122
+ - name: Coverage
123
+ run: pnpm test:coverage
124
+ - name: Upload coverage (if any)
125
+ uses: actions/upload-artifact@v4
126
+ with:
127
+ name: coverage-html
128
+ path: |
129
+ coverage/
130
+ **/coverage/
131
+ if-no-files-found: ignore
@@ -0,0 +1,23 @@
1
+ name: reusable-drift-check
2
+
3
+ on:
4
+ workflow_call:
5
+ inputs:
6
+ node-version:
7
+ default: '20'
8
+ type: string
9
+
10
+ jobs:
11
+ drift:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: KirillBaranov/kb-labs-devkit/.github/actions/setup-node-pnpm@main
16
+ with:
17
+ node-version: ${{ inputs.node-version }}
18
+ - run: pnpm i --frozen-lockfile
19
+ - name: DevKit drift check
20
+ run: |
21
+ pnpm -s devkit:check || \
22
+ node scripts/devkit-sync.mjs --check || \
23
+ ./node_modules/.bin/kb-devkit-sync --check
@@ -0,0 +1,74 @@
1
+ name: DevKit Fixtures
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ paths-ignore:
7
+ - '**/*.md'
8
+ - '**/.vscode/**'
9
+ - '**/.idea/**'
10
+ pull_request:
11
+ types: [opened, synchronize, reopened]
12
+ workflow_dispatch: {}
13
+ schedule:
14
+ - cron: '0 3 * * 1' # weekly canary (Mon 03:00 UTC)
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ concurrency:
20
+ group: devkit-fixtures-${{ github.event.pull_request.number || github.sha }}
21
+ cancel-in-progress: true
22
+
23
+ jobs:
24
+ fixtures:
25
+ name: Run fixtures (all)
26
+ runs-on: ubuntu-latest
27
+ env:
28
+ CI: true
29
+
30
+ steps:
31
+ - uses: actions/checkout@v4
32
+ with: { fetch-depth: 0 }
33
+
34
+ - uses: KirillBaranov/kb-labs-devkit/.github/actions/setup-node-pnpm@main
35
+ with:
36
+ node-version: '20'
37
+
38
+ - name: Cache pnpm store
39
+ uses: actions/cache@v4
40
+ with:
41
+ path: ~/.pnpm-store
42
+ key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
43
+ restore-keys: |
44
+ ${{ runner.os }}-pnpm-store-
45
+
46
+ - name: Install DevKit deps
47
+ run: pnpm i --frozen-lockfile
48
+
49
+ - name: Clean fixtures
50
+ run: pnpm fixtures:clean || true
51
+
52
+ - name: Bootstrap fixtures
53
+ run: pnpm fixtures:bootstrap
54
+
55
+ - name: Run fixtures (smart check)
56
+ shell: bash
57
+ run: |
58
+ if [ "${{ github.event_name }}" = "pull_request" ] && [ -n "${{ github.base_ref }}" ]; then
59
+ echo "Running differential fixtures check since origin/${{ github.base_ref }}"
60
+ pnpm fixtures -- --action=check --since=origin/${{ github.base_ref }}
61
+ else
62
+ echo "Running full fixtures check"
63
+ pnpm fixtures:check
64
+ fi
65
+
66
+ - name: Upload artifacts (optional)
67
+ if: always()
68
+ uses: actions/upload-artifact@v4
69
+ with:
70
+ name: fixtures-artifacts
71
+ path: |
72
+ fixtures/**/coverage/**
73
+ fixtures/**/dist/**
74
+ if-no-files-found: ignore
@@ -0,0 +1,67 @@
1
+ name: profiles-validate
2
+
3
+ on:
4
+ workflow_call:
5
+ inputs:
6
+ node_version:
7
+ type: string
8
+ default: '20'
9
+ soft_fail:
10
+ type: boolean
11
+ default: true # don't fail, while profiles are in development
12
+ working_directory:
13
+ type: string
14
+ default: '.' # for monorepo — can specify the package path
15
+ log_level:
16
+ type: string
17
+ default: 'info' # debug|info|warn|error
18
+ fixtures_dir:
19
+ type: string
20
+ default: '' # optional, if there are presets/fixtures
21
+
22
+ jobs:
23
+ validate:
24
+ runs-on: ubuntu-latest
25
+
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+
29
+ - name: Detect .kb/profiles
30
+ id: detect
31
+ shell: bash
32
+ run: |
33
+ ROOT="${{ inputs.working_directory }}"
34
+ if [ -d "$ROOT/.kb/profiles" ]; then
35
+ echo "found=true" >> "$GITHUB_OUTPUT"
36
+ echo "[profiles] found at $ROOT/.kb/profiles"
37
+ else
38
+ echo "found=false" >> "$GITHUB_OUTPUT"
39
+ echo "[profiles] not found, skip"
40
+ fi
41
+
42
+ - name: Setup Node & pnpm
43
+ if: steps.detect.outputs.found == 'true'
44
+ uses: KirillBaranov/kb-labs-devkit/.github/actions/setup-node-pnpm@main
45
+ with:
46
+ node-version: ${{ inputs.node_version }}
47
+
48
+ - name: Install deps
49
+ if: steps.detect.outputs.found == 'true'
50
+ run: pnpm i --frozen-lockfile
51
+ working-directory: ${{ inputs.working_directory }}
52
+
53
+ - name: Validate profiles
54
+ if: steps.detect.outputs.found == 'true'
55
+ continue-on-error: ${{ inputs.soft_fail }}
56
+ env:
57
+ LOG_LEVEL: ${{ inputs.log_level }}
58
+ KB_PROFILES_FIXTURES: ${{ inputs.fixtures_dir }}
59
+ shell: bash
60
+ run: |
61
+ # if kb-CLI is available, use it, otherwise use the package schemas
62
+ if pnpm -s kb --help >/dev/null 2>&1; then
63
+ pnpm -s kb profiles validate
64
+ else
65
+ pnpm -F @kb-labs/profile-schemas -s run schemas:check
66
+ fi
67
+ working-directory: ${{ inputs.working_directory }}
@@ -0,0 +1,50 @@
1
+ name: reusable-release
2
+
3
+ on:
4
+ workflow_call:
5
+ inputs:
6
+ publish:
7
+ description: Publish to npm
8
+ required: false
9
+ default: false
10
+ type: boolean
11
+ node-version:
12
+ default: '20'
13
+ type: string
14
+ secrets:
15
+ NPM_TOKEN:
16
+ required: false
17
+
18
+ jobs:
19
+ release:
20
+ runs-on: ubuntu-latest
21
+ permissions:
22
+ contents: write
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+
26
+ # Composite action: pnpm + Node + cache
27
+ - uses: KirillBaranov/kb-labs-devkit/.github/actions/setup-node-pnpm@main
28
+ with:
29
+ node-version: ${{ inputs['node-version'] }}
30
+
31
+ # Add registry for npm publish (separate step — так надёжнее)
32
+ - uses: actions/setup-node@v4
33
+ with:
34
+ node-version: ${{ inputs['node-version'] }}
35
+ cache: pnpm
36
+ registry-url: 'https://registry.npmjs.org'
37
+
38
+ - run: pnpm i --frozen-lockfile
39
+ - run: pnpm build || true
40
+
41
+ - name: Create GitHub Release
42
+ uses: softprops/action-gh-release@v2
43
+ with:
44
+ generate_release_notes: true
45
+
46
+ - name: Publish to npm
47
+ if: ${{ inputs.publish == true }}
48
+ env:
49
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
50
+ run: pnpm -r publish --access public --no-git-checks
@@ -0,0 +1,23 @@
1
+ {
2
+ "editor.tabSize": 2,
3
+ "editor.insertSpaces": true,
4
+ "editor.formatOnSave": true,
5
+ "files.eol": "\n",
6
+ // ESLint (flat config)
7
+ "eslint.useFlatConfig": true,
8
+ "eslint.experimental.useFlatConfig": true,
9
+ "eslint.validate": [
10
+ "javascript",
11
+ "javascriptreact",
12
+ "typescript",
13
+ "typescriptreact",
14
+ "vue"
15
+ ],
16
+ // Prettier
17
+ "prettier.requireConfig": true,
18
+ // TypeScript: использовать локальную версию в репозитории
19
+ "typescript.tsdk": "node_modules/typescript/lib",
20
+ // Vitest
21
+ "vitest.enable": true,
22
+ "vitest.disableWorkspaceWarning": true
23
+ }
package/AGENTS.md ADDED
@@ -0,0 +1,130 @@
1
+ # KB Labs Agents
2
+
3
+ The following agents are standardized across KB Labs projects. They live in this DevKit and can be synced into any repo.
4
+
5
+ | Agent | Folder | Purpose |
6
+ |--------------------|--------------------------------|----------------------------------------------------------------|
7
+ | DevKit Maintainer | `agents/devkit-maintainer` | Enforce unified tooling (tsconfig, eslint, prettier, vitest, tsup, CI). |
8
+ | Test Generator | `agents/test-generator` | Generate and maintain pragmatic unit tests. |
9
+ | Docs Drafter | `agents/docs-drafter` | Draft and update README/CONTRIBUTING/ADR docs. |
10
+ | Release Manager | `agents/release-manager` | Prepare release plans, changelog, and GitHub releases. |
11
+
12
+ > These are **descriptions and prompts** to bootstrap Cursor Agents quickly.
13
+ > Use the `agents:sync` command in product repos to copy the latest agent definitions from this DevKit.
14
+
15
+ ## Agent Structure
16
+
17
+ Each agent includes:
18
+
19
+ - **`prompt.md`** — AI instructions and context for the agent
20
+ - **`runbook.md`** — Step-by-step procedures and workflows
21
+ - **`context.globs`** — File patterns for context (optional)
22
+ - **`permissions.yml`** — Access permissions and restrictions (optional)
23
+
24
+ ## Usage
25
+
26
+ ### Syncing Agents
27
+
28
+ To sync agents into your project:
29
+
30
+ ```bash
31
+ # Copy all agent definitions from DevKit
32
+ pnpm agents:sync
33
+
34
+ # Or use the sync tool directly
35
+ npx kb-devkit-sync agents
36
+ ```
37
+
38
+ Agents are synced to `.kb/devkit/agents/` in your project.
39
+
40
+ > **Note:** `.kb` is the common ecosystem folder. `devkit` is the product namespace. Each product decides what to store in their namespace. Product-specific agents can be added to `.kb/<product>/agents/` if needed.
41
+
42
+ ### Agent Configuration
43
+
44
+ Agents are designed for Cursor AI but can be adapted for other IDE assistants:
45
+
46
+ - **Cursor**: Place in `.cursor/agents/` directory
47
+ - **GitHub Copilot Chat**: Adapt prompts for chat interface
48
+ - **Other IDEs**: Modify prompts as needed for your environment
49
+
50
+ ### Customization
51
+
52
+ You can customize agents by:
53
+
54
+ 1. **Extending prompts**: Add project-specific context to `prompt.md`
55
+ 2. **Modifying runbooks**: Update procedures in `runbook.md` for your workflow
56
+ 3. **Adjusting context**: Modify `context.globs` to include relevant files
57
+ 4. **Setting permissions**: Configure `permissions.yml` for security
58
+
59
+ ## Agent Details
60
+
61
+ ### DevKit Maintainer
62
+
63
+ **Purpose**: Enforce unified tooling across KB Labs projects
64
+
65
+ **Key Responsibilities**:
66
+ - Ensure consistent tsconfig, eslint, prettier, vitest, tsup configurations
67
+ - Validate CI/CD workflows and drift checks
68
+ - Maintain DevKit synchronization
69
+ - Enforce coding standards and best practices
70
+
71
+ **Context**: Configuration files, CI workflows, package.json, DevKit sync files
72
+
73
+ ### Test Generator
74
+
75
+ **Purpose**: Generate and maintain pragmatic unit tests
76
+
77
+ **Key Responsibilities**:
78
+ - Create comprehensive test suites for new features
79
+ - Maintain existing tests and update when code changes
80
+ - Ensure good test coverage and quality
81
+ - Follow testing best practices and patterns
82
+
83
+ **Context**: Source code files, existing tests, test configuration
84
+
85
+ ### Docs Drafter
86
+
87
+ **Purpose**: Draft and update documentation
88
+
89
+ **Key Responsibilities**:
90
+ - Create and maintain README files
91
+ - Update CONTRIBUTING guidelines
92
+ - Draft Architecture Decision Records (ADRs)
93
+ - Ensure documentation is clear and up-to-date
94
+
95
+ **Context**: Project files, existing documentation, code structure
96
+
97
+ ### Release Manager
98
+
99
+ **Purpose**: Prepare release plans, changelog, and GitHub releases
100
+
101
+ **Key Responsibilities**:
102
+ - Create release plans and versioning strategies
103
+ - Generate changelogs from commit history
104
+ - Prepare GitHub releases with proper tagging
105
+ - Coordinate release processes across teams
106
+
107
+ **Context**: Git history, package.json, release notes, version tags
108
+
109
+ ## Best Practices
110
+
111
+ 1. **Keep agents focused**: Each agent should have a clear, specific purpose
112
+ 2. **Update regularly**: Sync agents frequently to get latest improvements
113
+ 3. **Customize thoughtfully**: Adapt agents for your project while maintaining consistency
114
+ 4. **Test thoroughly**: Validate agent behavior before deploying to team
115
+ 5. **Document changes**: Keep track of customizations and their rationale
116
+
117
+ ## Troubleshooting
118
+
119
+ ### Common Issues
120
+
121
+ - **Agent not responding**: Check that agent files are properly synced and accessible
122
+ - **Incorrect context**: Verify `context.globs` patterns match your project structure
123
+ - **Permission errors**: Review `permissions.yml` settings
124
+ - **Outdated agents**: Run `pnpm agents:sync` to get latest versions
125
+
126
+ ### Getting Help
127
+
128
+ - Check agent runbooks for detailed procedures
129
+ - Review DevKit documentation for sync and configuration options
130
+ - Open issues for agent-specific problems or suggestions
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) KB Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.