@kb-labs/devkit 1.4.0 → 2.9.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 (231) hide show
  1. package/assets/claude/CLAUDE.md.snippet +30 -0
  2. package/assets/claude/manifest.json +47 -0
  3. package/assets/claude/skills/kb-labs-create-plugin/SKILL.md +144 -0
  4. package/assets/claude/skills/kb-labs-create-product/SKILL.md +144 -0
  5. package/assets/claude/skills/kb-labs-explore/SKILL.md +119 -0
  6. package/assets/claude/skills/kb-labs-quickstart/SKILL.md +72 -0
  7. package/assets/claude/skills/kb-labs-troubleshoot/SKILL.md +150 -0
  8. package/assets/claude/skills/kb-labs-update/SKILL.md +89 -0
  9. package/package.json +29 -29
  10. package/tsconfig/spa.json +7 -0
  11. package/vitest/node.js +8 -2
  12. package/vitest/react.js +8 -2
  13. package/.cursorrules +0 -32
  14. package/.github/CODEOWNERS +0 -2
  15. package/.github/actions/setup-node-pnpm/action.yml +0 -47
  16. package/.github/workflow-templates/ci.yml +0 -13
  17. package/.github/workflow-templates/deploy.yml +0 -28
  18. package/.github/workflow-templates/docker-build.yml +0 -25
  19. package/.github/workflow-templates/drift-check.yml +0 -10
  20. package/.github/workflow-templates/profiles-validate.yml +0 -16
  21. package/.github/workflow-templates/release.yml +0 -8
  22. package/.github/workflows/ci-reusable.yml +0 -131
  23. package/.github/workflows/deploy-reusable.yml +0 -110
  24. package/.github/workflows/docker-build-reusable.yml +0 -110
  25. package/.github/workflows/drift-check-reusable.yml +0 -23
  26. package/.github/workflows/fixtures.yml +0 -74
  27. package/.github/workflows/profiles-validate-reusable.yml +0 -67
  28. package/.github/workflows/release-reusable.yml +0 -50
  29. package/.vscode/settings.json +0 -23
  30. package/tsconfig/dist/__tests__/cache.spec.d.ts +0 -6
  31. package/tsconfig/dist/__tests__/cache.spec.d.ts.map +0 -1
  32. package/tsconfig/dist/__tests__/cache.spec.js +0 -85
  33. package/tsconfig/dist/__tests__/cache.spec.js.map +0 -1
  34. package/tsconfig/dist/__tests__/fs-atomic.spec.d.ts +0 -6
  35. package/tsconfig/dist/__tests__/fs-atomic.spec.d.ts.map +0 -1
  36. package/tsconfig/dist/__tests__/fs-atomic.spec.js +0 -153
  37. package/tsconfig/dist/__tests__/fs-atomic.spec.js.map +0 -1
  38. package/tsconfig/dist/__tests__/init-workspace.spec.d.ts +0 -6
  39. package/tsconfig/dist/__tests__/init-workspace.spec.d.ts.map +0 -1
  40. package/tsconfig/dist/__tests__/init-workspace.spec.js +0 -99
  41. package/tsconfig/dist/__tests__/init-workspace.spec.js.map +0 -1
  42. package/tsconfig/dist/__tests__/kb-error.spec.d.ts +0 -6
  43. package/tsconfig/dist/__tests__/kb-error.spec.d.ts.map +0 -1
  44. package/tsconfig/dist/__tests__/kb-error.spec.js +0 -190
  45. package/tsconfig/dist/__tests__/kb-error.spec.js.map +0 -1
  46. package/tsconfig/dist/__tests__/preset-lockfile.spec.d.ts +0 -6
  47. package/tsconfig/dist/__tests__/preset-lockfile.spec.d.ts.map +0 -1
  48. package/tsconfig/dist/__tests__/preset-lockfile.spec.js +0 -142
  49. package/tsconfig/dist/__tests__/preset-lockfile.spec.js.map +0 -1
  50. package/tsconfig/dist/__tests__/product-config-profiles.spec.d.ts +0 -6
  51. package/tsconfig/dist/__tests__/product-config-profiles.spec.d.ts.map +0 -1
  52. package/tsconfig/dist/__tests__/product-config-profiles.spec.js +0 -100
  53. package/tsconfig/dist/__tests__/product-config-profiles.spec.js.map +0 -1
  54. package/tsconfig/dist/__tests__/product-config.spec.d.ts +0 -6
  55. package/tsconfig/dist/__tests__/product-config.spec.d.ts.map +0 -1
  56. package/tsconfig/dist/__tests__/product-config.spec.js +0 -298
  57. package/tsconfig/dist/__tests__/product-config.spec.js.map +0 -1
  58. package/tsconfig/dist/__tests__/runtime.spec.d.ts +0 -2
  59. package/tsconfig/dist/__tests__/runtime.spec.d.ts.map +0 -1
  60. package/tsconfig/dist/__tests__/runtime.spec.js +0 -127
  61. package/tsconfig/dist/__tests__/runtime.spec.js.map +0 -1
  62. package/tsconfig/dist/__tests__/upsert-lockfile.spec.d.ts +0 -6
  63. package/tsconfig/dist/__tests__/upsert-lockfile.spec.d.ts.map +0 -1
  64. package/tsconfig/dist/__tests__/upsert-lockfile.spec.js +0 -251
  65. package/tsconfig/dist/__tests__/upsert-lockfile.spec.js.map +0 -1
  66. package/tsconfig/dist/__tests__/validate-config.spec.d.ts +0 -2
  67. package/tsconfig/dist/__tests__/validate-config.spec.d.ts.map +0 -1
  68. package/tsconfig/dist/__tests__/validate-config.spec.js +0 -14
  69. package/tsconfig/dist/__tests__/validate-config.spec.js.map +0 -1
  70. package/tsconfig/dist/api/init-workspace.d.ts +0 -10
  71. package/tsconfig/dist/api/init-workspace.d.ts.map +0 -1
  72. package/tsconfig/dist/api/init-workspace.js +0 -191
  73. package/tsconfig/dist/api/init-workspace.js.map +0 -1
  74. package/tsconfig/dist/api/product-config.d.ts +0 -21
  75. package/tsconfig/dist/api/product-config.d.ts.map +0 -1
  76. package/tsconfig/dist/api/product-config.js +0 -192
  77. package/tsconfig/dist/api/product-config.js.map +0 -1
  78. package/tsconfig/dist/api/read-config.d.ts +0 -22
  79. package/tsconfig/dist/api/read-config.d.ts.map +0 -1
  80. package/tsconfig/dist/api/read-config.js +0 -105
  81. package/tsconfig/dist/api/read-config.js.map +0 -1
  82. package/tsconfig/dist/api/upsert-lockfile.d.ts +0 -10
  83. package/tsconfig/dist/api/upsert-lockfile.d.ts.map +0 -1
  84. package/tsconfig/dist/api/upsert-lockfile.js +0 -63
  85. package/tsconfig/dist/api/upsert-lockfile.js.map +0 -1
  86. package/tsconfig/dist/cache/fs-cache.d.ts +0 -38
  87. package/tsconfig/dist/cache/fs-cache.d.ts.map +0 -1
  88. package/tsconfig/dist/cache/fs-cache.js +0 -142
  89. package/tsconfig/dist/cache/fs-cache.js.map +0 -1
  90. package/tsconfig/dist/errors/kb-error.d.ts +0 -32
  91. package/tsconfig/dist/errors/kb-error.d.ts.map +0 -1
  92. package/tsconfig/dist/errors/kb-error.js +0 -54
  93. package/tsconfig/dist/errors/kb-error.js.map +0 -1
  94. package/tsconfig/dist/fs/__tests__/fs.spec.d.ts +0 -2
  95. package/tsconfig/dist/fs/__tests__/fs.spec.d.ts.map +0 -1
  96. package/tsconfig/dist/fs/__tests__/fs.spec.js +0 -22
  97. package/tsconfig/dist/fs/__tests__/fs.spec.js.map +0 -1
  98. package/tsconfig/dist/fs/fs.d.ts +0 -6
  99. package/tsconfig/dist/fs/fs.d.ts.map +0 -1
  100. package/tsconfig/dist/fs/fs.js +0 -12
  101. package/tsconfig/dist/fs/fs.js.map +0 -1
  102. package/tsconfig/dist/fs/index.d.ts +0 -2
  103. package/tsconfig/dist/fs/index.d.ts.map +0 -1
  104. package/tsconfig/dist/fs/index.js +0 -2
  105. package/tsconfig/dist/fs/index.js.map +0 -1
  106. package/tsconfig/dist/hash/config-hash.d.ts +0 -17
  107. package/tsconfig/dist/hash/config-hash.d.ts.map +0 -1
  108. package/tsconfig/dist/hash/config-hash.js +0 -55
  109. package/tsconfig/dist/hash/config-hash.js.map +0 -1
  110. package/tsconfig/dist/index.d.ts +0 -5
  111. package/tsconfig/dist/index.d.ts.map +0 -1
  112. package/tsconfig/dist/index.js +0 -5
  113. package/tsconfig/dist/index.js.map +0 -1
  114. package/tsconfig/dist/lockfile/lockfile.d.ts +0 -54
  115. package/tsconfig/dist/lockfile/lockfile.d.ts.map +0 -1
  116. package/tsconfig/dist/lockfile/lockfile.js +0 -141
  117. package/tsconfig/dist/lockfile/lockfile.js.map +0 -1
  118. package/tsconfig/dist/logging/__tests__/logger.spec.d.ts +0 -2
  119. package/tsconfig/dist/logging/__tests__/logger.spec.d.ts.map +0 -1
  120. package/tsconfig/dist/logging/__tests__/logger.spec.js +0 -65
  121. package/tsconfig/dist/logging/__tests__/logger.spec.js.map +0 -1
  122. package/tsconfig/dist/logging/__tests__/redaction.spec.d.ts +0 -2
  123. package/tsconfig/dist/logging/__tests__/redaction.spec.d.ts.map +0 -1
  124. package/tsconfig/dist/logging/__tests__/redaction.spec.js +0 -34
  125. package/tsconfig/dist/logging/__tests__/redaction.spec.js.map +0 -1
  126. package/tsconfig/dist/logging/__tests__/sinks-and-env.spec.d.ts +0 -2
  127. package/tsconfig/dist/logging/__tests__/sinks-and-env.spec.d.ts.map +0 -1
  128. package/tsconfig/dist/logging/__tests__/sinks-and-env.spec.js +0 -90
  129. package/tsconfig/dist/logging/__tests__/sinks-and-env.spec.js.map +0 -1
  130. package/tsconfig/dist/logging/index.d.ts +0 -6
  131. package/tsconfig/dist/logging/index.d.ts.map +0 -1
  132. package/tsconfig/dist/logging/index.js +0 -6
  133. package/tsconfig/dist/logging/index.js.map +0 -1
  134. package/tsconfig/dist/logging/logger.d.ts +0 -9
  135. package/tsconfig/dist/logging/logger.d.ts.map +0 -1
  136. package/tsconfig/dist/logging/logger.js +0 -101
  137. package/tsconfig/dist/logging/logger.js.map +0 -1
  138. package/tsconfig/dist/logging/redaction.d.ts +0 -7
  139. package/tsconfig/dist/logging/redaction.d.ts.map +0 -1
  140. package/tsconfig/dist/logging/redaction.js +0 -23
  141. package/tsconfig/dist/logging/redaction.js.map +0 -1
  142. package/tsconfig/dist/logging/sinks/json.d.ts +0 -4
  143. package/tsconfig/dist/logging/sinks/json.d.ts.map +0 -1
  144. package/tsconfig/dist/logging/sinks/json.js +0 -23
  145. package/tsconfig/dist/logging/sinks/json.js.map +0 -1
  146. package/tsconfig/dist/logging/sinks/stdout.d.ts +0 -3
  147. package/tsconfig/dist/logging/sinks/stdout.d.ts.map +0 -1
  148. package/tsconfig/dist/logging/sinks/stdout.js +0 -24
  149. package/tsconfig/dist/logging/sinks/stdout.js.map +0 -1
  150. package/tsconfig/dist/logging/types/index.d.ts +0 -2
  151. package/tsconfig/dist/logging/types/index.d.ts.map +0 -1
  152. package/tsconfig/dist/logging/types/index.js +0 -2
  153. package/tsconfig/dist/logging/types/index.js.map +0 -1
  154. package/tsconfig/dist/logging/types/types.d.ts +0 -37
  155. package/tsconfig/dist/logging/types/types.d.ts.map +0 -1
  156. package/tsconfig/dist/logging/types/types.js +0 -2
  157. package/tsconfig/dist/logging/types/types.js.map +0 -1
  158. package/tsconfig/dist/merge/layered-merge.d.ts +0 -16
  159. package/tsconfig/dist/merge/layered-merge.d.ts.map +0 -1
  160. package/tsconfig/dist/merge/layered-merge.js +0 -97
  161. package/tsconfig/dist/merge/layered-merge.js.map +0 -1
  162. package/tsconfig/dist/preset/resolve-preset.d.ts +0 -29
  163. package/tsconfig/dist/preset/resolve-preset.d.ts.map +0 -1
  164. package/tsconfig/dist/preset/resolve-preset.js +0 -104
  165. package/tsconfig/dist/preset/resolve-preset.js.map +0 -1
  166. package/tsconfig/dist/repo/__tests__/repo.spec.d.ts +0 -2
  167. package/tsconfig/dist/repo/__tests__/repo.spec.d.ts.map +0 -1
  168. package/tsconfig/dist/repo/__tests__/repo.spec.js +0 -25
  169. package/tsconfig/dist/repo/__tests__/repo.spec.js.map +0 -1
  170. package/tsconfig/dist/repo/index.d.ts +0 -2
  171. package/tsconfig/dist/repo/index.d.ts.map +0 -1
  172. package/tsconfig/dist/repo/index.js +0 -2
  173. package/tsconfig/dist/repo/index.js.map +0 -1
  174. package/tsconfig/dist/repo/repo.d.ts +0 -6
  175. package/tsconfig/dist/repo/repo.d.ts.map +0 -1
  176. package/tsconfig/dist/repo/repo.js +0 -25
  177. package/tsconfig/dist/repo/repo.js.map +0 -1
  178. package/tsconfig/dist/runtime/index.d.ts +0 -2
  179. package/tsconfig/dist/runtime/index.d.ts.map +0 -1
  180. package/tsconfig/dist/runtime/index.js +0 -2
  181. package/tsconfig/dist/runtime/index.js.map +0 -1
  182. package/tsconfig/dist/runtime/runtime.d.ts +0 -46
  183. package/tsconfig/dist/runtime/runtime.d.ts.map +0 -1
  184. package/tsconfig/dist/runtime/runtime.js +0 -126
  185. package/tsconfig/dist/runtime/runtime.js.map +0 -1
  186. package/tsconfig/dist/tsconfig.tools.tsbuildinfo +0 -1
  187. package/tsconfig/dist/tsconfig.tsbuildinfo +0 -1
  188. package/tsconfig/dist/types/index.d.ts +0 -2
  189. package/tsconfig/dist/types/index.d.ts.map +0 -1
  190. package/tsconfig/dist/types/index.js +0 -2
  191. package/tsconfig/dist/types/index.js.map +0 -1
  192. package/tsconfig/dist/types/init.d.ts +0 -34
  193. package/tsconfig/dist/types/init.d.ts.map +0 -1
  194. package/tsconfig/dist/types/init.js +0 -6
  195. package/tsconfig/dist/types/init.js.map +0 -1
  196. package/tsconfig/dist/types/preset.d.ts +0 -27
  197. package/tsconfig/dist/types/preset.d.ts.map +0 -1
  198. package/tsconfig/dist/types/preset.js +0 -6
  199. package/tsconfig/dist/types/preset.js.map +0 -1
  200. package/tsconfig/dist/types/types.d.ts +0 -6
  201. package/tsconfig/dist/types/types.d.ts.map +0 -1
  202. package/tsconfig/dist/types/types.js +0 -2
  203. package/tsconfig/dist/types/types.js.map +0 -1
  204. package/tsconfig/dist/utils/__tests__/env.spec.d.ts +0 -2
  205. package/tsconfig/dist/utils/__tests__/env.spec.d.ts.map +0 -1
  206. package/tsconfig/dist/utils/__tests__/env.spec.js +0 -33
  207. package/tsconfig/dist/utils/__tests__/env.spec.js.map +0 -1
  208. package/tsconfig/dist/utils/env.d.ts +0 -7
  209. package/tsconfig/dist/utils/env.d.ts.map +0 -1
  210. package/tsconfig/dist/utils/env.js +0 -25
  211. package/tsconfig/dist/utils/env.js.map +0 -1
  212. package/tsconfig/dist/utils/fs-atomic.d.ts +0 -15
  213. package/tsconfig/dist/utils/fs-atomic.d.ts.map +0 -1
  214. package/tsconfig/dist/utils/fs-atomic.js +0 -45
  215. package/tsconfig/dist/utils/fs-atomic.js.map +0 -1
  216. package/tsconfig/dist/utils/index.d.ts +0 -3
  217. package/tsconfig/dist/utils/index.d.ts.map +0 -1
  218. package/tsconfig/dist/utils/index.js +0 -3
  219. package/tsconfig/dist/utils/index.js.map +0 -1
  220. package/tsconfig/dist/utils/paths.d.ts +0 -21
  221. package/tsconfig/dist/utils/paths.d.ts.map +0 -1
  222. package/tsconfig/dist/utils/paths.js +0 -32
  223. package/tsconfig/dist/utils/paths.js.map +0 -1
  224. package/tsconfig/dist/utils/product-normalize.d.ts +0 -27
  225. package/tsconfig/dist/utils/product-normalize.d.ts.map +0 -1
  226. package/tsconfig/dist/utils/product-normalize.js +0 -45
  227. package/tsconfig/dist/utils/product-normalize.js.map +0 -1
  228. package/tsconfig/dist/validation/validate-config.d.ts +0 -7
  229. package/tsconfig/dist/validation/validate-config.d.ts.map +0 -1
  230. package/tsconfig/dist/validation/validate-config.js +0 -22
  231. package/tsconfig/dist/validation/validate-config.js.map +0 -1
@@ -0,0 +1,30 @@
1
+ ## KB Labs Platform
2
+
3
+ This project uses the [KB Labs](https://github.com/KirillBaranov/kb-labs) platform.
4
+ A set of Claude Code skills is installed under `.claude/skills/kb-labs-*` to help
5
+ you work with the platform efficiently.
6
+
7
+ ### Common tasks (just ask)
8
+
9
+ - **Create a plugin** — "create a kb-labs plugin called my-plugin"
10
+ - **Create a service** — "create a kb-labs service called my-service"
11
+ - **Troubleshoot** — "kb-labs is not starting" / "kb-dev shows failed"
12
+ - **Explore the project** — "what kb-labs services and plugins are installed here?"
13
+ - **Update the platform** — "update kb-labs to the latest version"
14
+
15
+ ### Manual reference
16
+
17
+ - `pnpm kb --help` — list all platform commands
18
+ - `pnpm kb-dev status` — service status
19
+ - `pnpm kb-dev doctor` — environment diagnostics
20
+ - `pnpm kb plugins list` — installed plugins
21
+ - `kb-create update` — update the platform
22
+ - `kb-create doctor` — verify the installation
23
+
24
+ ### Where things live
25
+
26
+ - `.kb/kb.config.jsonc` — project configuration (safe to edit)
27
+ - `.kb/` — platform runtime state (do not edit by hand)
28
+ - `.claude/skills/kb-labs-*` — managed skills (reinstalled by `kb-create update`)
29
+
30
+ For full platform documentation see https://github.com/KirillBaranov/kb-labs.
@@ -0,0 +1,47 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "devkitVersion": "1.5.0",
4
+ "platformCompat": ">=0.10.0 <2.0.0",
5
+ "claudeMd": {
6
+ "snippetPath": "CLAUDE.md.snippet",
7
+ "markerId": "kb-labs"
8
+ },
9
+ "skills": [
10
+ {
11
+ "id": "kb-labs-quickstart",
12
+ "path": "skills/kb-labs-quickstart/SKILL.md",
13
+ "version": "1.0.0",
14
+ "description": "Quickstart for the KB Labs platform: verify install, locate state, find common commands"
15
+ },
16
+ {
17
+ "id": "kb-labs-create-plugin",
18
+ "path": "skills/kb-labs-create-plugin/SKILL.md",
19
+ "version": "1.0.0",
20
+ "description": "Scaffold a new KB Labs plugin (cli/core/contracts packages) following the platform-standard layout"
21
+ },
22
+ {
23
+ "id": "kb-labs-create-product",
24
+ "path": "skills/kb-labs-create-product/SKILL.md",
25
+ "version": "1.0.0",
26
+ "description": "Create a new KB Labs product/service with canonical bootstrap, health, observability, and tests"
27
+ },
28
+ {
29
+ "id": "kb-labs-troubleshoot",
30
+ "path": "skills/kb-labs-troubleshoot/SKILL.md",
31
+ "version": "1.0.0",
32
+ "description": "Diagnose KB Labs platform issues: stuck services, dirty submodules, port conflicts, broken builds"
33
+ },
34
+ {
35
+ "id": "kb-labs-explore",
36
+ "path": "skills/kb-labs-explore/SKILL.md",
37
+ "version": "1.0.0",
38
+ "description": "Discover what is installed in a KB Labs project: services, plugins, configuration, and entry points"
39
+ },
40
+ {
41
+ "id": "kb-labs-update",
42
+ "path": "skills/kb-labs-update/SKILL.md",
43
+ "version": "1.0.0",
44
+ "description": "Safely update the installed KB Labs platform via kb-create update, including diff review"
45
+ }
46
+ ]
47
+ }
@@ -0,0 +1,144 @@
1
+ ---
2
+ name: kb-labs-create-plugin
3
+ description: Use when the user wants to create a new KB Labs plugin, asks how to scaffold a plugin, extend KB Labs with new commands, or add a marketplace entity. Do not use for creating services (use kb-labs-create-product) or for adding new packages to an existing plugin.
4
+ user-invocable: true
5
+ argument-hint: [plugin-name]
6
+ ---
7
+
8
+ # Create a KB Labs Plugin
9
+
10
+ Help the user scaffold a new KB Labs plugin following the platform-standard
11
+ three-package layout (`cli` / `core` / `contracts`).
12
+
13
+ ## Step 1: Clarify the plugin intent
14
+
15
+ Before scaffolding, make sure you know:
16
+
17
+ - **Plugin name** — kebab-case, without the `kb-labs-` prefix (e.g. `audit`, `deploy`).
18
+ The scaffolded repo will be named `kb-labs-<name>`.
19
+ - **What it does** — one sentence. This goes into the plugin manifest `description`.
20
+ - **Does it add CLI commands?** — almost always yes.
21
+ - **Does it need LLM access / cache / state?** — informs which platform composables
22
+ the plugin will use (`useLLM`, `useCache`, `useState`).
23
+
24
+ If the user did not provide these, ask concise questions before generating files.
25
+
26
+ ## Step 2: Create the plugin from the template
27
+
28
+ KB Labs ships a plugin template and a launcher command:
29
+
30
+ ```bash
31
+ kb-create plugin --name=$ARGUMENTS
32
+ ```
33
+
34
+ If that command is not yet available in the user's kb-create version, fall back to
35
+ copying `templates/kb-labs-plugin-template` manually and replacing the package names.
36
+
37
+ ## Step 3: Required package layout
38
+
39
+ A compliant plugin must have three packages:
40
+
41
+ ```
42
+ kb-labs-<name>/
43
+ ├── packages/
44
+ │ ├── <name>-contracts/ # types, interfaces, zod schemas — no runtime deps
45
+ │ ├── <name>-core/ # business logic, imports contracts
46
+ │ └── <name>-cli/ # command handlers, plugin manifest, imports core
47
+ ├── package.json # workspace root
48
+ └── pnpm-workspace.yaml
49
+ ```
50
+
51
+ Rules:
52
+ - `contracts` has zero runtime dependencies beyond `zod`.
53
+ - `core` depends on `contracts`.
54
+ - `cli` depends on `core` and registers commands via the plugin manifest.
55
+ - Do not merge these into a single package — the separation is load-bearing
56
+ for types, tree-shaking, and marketplace distribution.
57
+
58
+ ## Step 4: Plugin manifest
59
+
60
+ The CLI package must ship `kb.manifest.json` (discovered automatically by the
61
+ platform). Minimal shape:
62
+
63
+ ```json
64
+ {
65
+ "name": "@kb-labs/<name>",
66
+ "version": "0.1.0",
67
+ "kind": "plugin",
68
+ "commands": [
69
+ {
70
+ "id": "<name>:hello",
71
+ "summary": "Example command",
72
+ "handler": "./dist/handlers/hello.js"
73
+ }
74
+ ]
75
+ }
76
+ ```
77
+
78
+ ## Step 5: Use platform composables, not direct imports
79
+
80
+ Inside command handlers, read platform capabilities via composables from
81
+ `@kb-labs/sdk`:
82
+
83
+ ```ts
84
+ import { useLLM, useCache, useState, useLogger } from '@kb-labs/sdk';
85
+
86
+ export async function handler(ctx, argv, flags) {
87
+ const log = useLogger();
88
+ const cache = useCache();
89
+ // ...
90
+ }
91
+ ```
92
+
93
+ Do **not** reach into `ctx.platform.*` directly — that path loses prototype
94
+ information and breaks wrapper layers (analytics, queuing, proxying).
95
+
96
+ ## Step 6: Build the plugin
97
+
98
+ ```bash
99
+ pnpm install
100
+ pnpm --filter "@kb-labs/<name>-contracts" build
101
+ pnpm --filter "@kb-labs/<name>-core" build
102
+ pnpm --filter "@kb-labs/<name>-cli" build
103
+ ```
104
+
105
+ Build order matters: contracts → core → cli. If in doubt, use the devkit
106
+ build-order tool when it is available in the user's environment.
107
+
108
+ ## Step 7: Clear the plugin cache and verify
109
+
110
+ The CLI caches plugin manifests. After building a new plugin, always clear the
111
+ cache — otherwise the new commands will not be discovered.
112
+
113
+ ```bash
114
+ pnpm kb marketplace clear-cache
115
+ pnpm kb <name>:hello --help
116
+ ```
117
+
118
+ If the command is not found, clear the cache deeply and retry:
119
+
120
+ ```bash
121
+ pnpm kb marketplace clear-cache --deep
122
+ ```
123
+
124
+ ## Step 8: Register in the workspace (only if needed)
125
+
126
+ If the user is adding the plugin to an existing multi-repo workspace, add it to
127
+ `pnpm-workspace.yaml` and to the launcher's project config at
128
+ `.kb/kb.config.jsonc`. If the plugin is a standalone repo consumed by a different
129
+ project, this step is handled by `kb-create` on the consuming side.
130
+
131
+ ## Definition of done
132
+
133
+ - Three packages exist and build cleanly
134
+ - `kb.manifest.json` is valid
135
+ - `pnpm kb <name>:hello --help` works
136
+ - Handlers use composables from `@kb-labs/sdk`
137
+ - No direct imports of platform internals
138
+
139
+ ## Do not
140
+
141
+ - Do not create single-package plugins
142
+ - Do not edit files under `.kb/` as part of plugin development
143
+ - Do not forget to clear the marketplace cache after building
144
+ - Do not invent a custom command discovery format — use `kb.manifest.json`
@@ -0,0 +1,144 @@
1
+ ---
2
+ name: kb-labs-create-product
3
+ description: Use when the user wants to create a new KB Labs product or service (HTTP API, daemon, background worker) that runs under kb-dev. Do not use for creating plugins (use kb-labs-create-plugin) or for adding routes to an existing service.
4
+ user-invocable: true
5
+ argument-hint: [service-name]
6
+ ---
7
+
8
+ # Create a KB Labs Product / Service
9
+
10
+ Help the user create a new platform service that follows the canonical bootstrap,
11
+ health/readiness, observability, and logging conventions.
12
+
13
+ ## Step 1: Clarify the service intent
14
+
15
+ Before scaffolding, confirm:
16
+
17
+ - **Service name** — kebab-case (e.g. `audit`, `notifier`).
18
+ - **Kind** — HTTP API (Fastify), background daemon, or worker.
19
+ - **Port** — must not collide with existing services in `.kb/devservices.yaml`.
20
+ - **Dependencies** — does it need Redis, qdrant, state-daemon, gateway?
21
+
22
+ ## Step 2: Pick the closest reference service
23
+
24
+ Do not invent a layout. Copy the structure of the closest reference:
25
+
26
+ - HTTP API → look at how `marketplace-api` or `workflow-daemon` is organised
27
+ - bootstrap-style platform service → look at `rest-api`
28
+ - router/proxy style → look at `gateway`
29
+ - small daemon with HTTP surface → look at `core-state-daemon`
30
+
31
+ These services live under the `platform/` and `infra/` directories of a kb-labs
32
+ workspace. If the user is in a downstream consumer project (not the platform
33
+ monorepo), copy from `templates/kb-labs-product-template` instead.
34
+
35
+ ## Step 3: Required outcomes
36
+
37
+ A compliant service must expose:
38
+
39
+ - `/health` — cheap health snapshot
40
+ - `/ready` — readiness for orchestration
41
+ - `/observability/describe` — versioned identity and capabilities
42
+ - `/observability/health` — structured runtime diagnostics
43
+ - `/metrics` — canonical Prometheus output
44
+
45
+ It must use:
46
+
47
+ - `@kb-labs/core-platform` types (`ILogger`, `ICache`, etc.) — never local copies
48
+ - `@kb-labs/shared-http` for `registerOpenAPI()` and HTTP helpers
49
+ - `HttpObservabilityCollector` from shared-http for metrics and operations
50
+ - structured log correlation fields (`serviceId`, `instanceId`, `requestId`,
51
+ `traceId`, `operation`, normalized `route`)
52
+
53
+ ## Step 4: Wire bootstrap
54
+
55
+ ```ts
56
+ import Fastify from 'fastify';
57
+ import { registerOpenAPI } from '@kb-labs/shared-http';
58
+ import { initPlatform } from '@kb-labs/core-runtime';
59
+
60
+ const platform = await initPlatform();
61
+ const server = Fastify({ logger: platform.logger });
62
+
63
+ await registerOpenAPI(server, {
64
+ title: 'My Service',
65
+ version: '0.1.0',
66
+ servers: [{ url: 'http://localhost:5099', description: 'Local dev' }],
67
+ ui: process.env.NODE_ENV !== 'production',
68
+ });
69
+
70
+ // ...register routes...
71
+
72
+ await server.listen({ port: 5099, host: '0.0.0.0' });
73
+ ```
74
+
75
+ Routes that should appear in OpenAPI need a `tags:` entry on their schema.
76
+ Routes without `tags:` are hidden — this is the visibility model.
77
+
78
+ ## Step 5: Register the service with kb-dev
79
+
80
+ Add an entry to `.kb/devservices.yaml` so the service can be started/stopped/
81
+ restarted via the unified manager:
82
+
83
+ ```json
84
+ {
85
+ "services": {
86
+ "my-service": {
87
+ "group": "backend",
88
+ "port": 5099,
89
+ "command": "node ./apps/my-service/dist/index.js",
90
+ "healthUrl": "http://localhost:5099/health",
91
+ "dependsOn": ["state-daemon"]
92
+ }
93
+ }
94
+ }
95
+ ```
96
+
97
+ Then:
98
+
99
+ ```bash
100
+ pnpm kb-dev start my-service
101
+ pnpm kb-dev status
102
+ ```
103
+
104
+ ## Step 6: Tests
105
+
106
+ At minimum, add tests that verify:
107
+
108
+ - `/health` returns OK
109
+ - `/ready` returns ready
110
+ - `/observability/describe` validates against the canonical contract
111
+ - `/observability/health` validates against the canonical contract
112
+ - `/metrics` includes the canonical metric families
113
+
114
+ Use validators from `@kb-labs/core-contracts` if available:
115
+
116
+ - `validateServiceObservabilityDescribe(...)`
117
+ - `validateServiceObservabilityHealth(...)`
118
+ - `checkCanonicalObservabilityMetrics(...)`
119
+
120
+ ## Step 7: Compliance check
121
+
122
+ ```bash
123
+ pnpm --filter <service-package> build
124
+ pnpm --filter <service-package> test
125
+ pnpm kb-dev restart my-service
126
+ pnpm kb-dev ready my-service --timeout 60s
127
+ pnpm kb-dev health
128
+ ```
129
+
130
+ ## Definition of done
131
+
132
+ - Service starts and stops cleanly via `kb-dev`
133
+ - Canonical endpoints respond with valid payloads
134
+ - Metrics include the canonical families
135
+ - Logs carry correlation fields
136
+ - Tests pass
137
+ - No legacy observability surface left behind
138
+
139
+ ## Do not
140
+
141
+ - Do not invent a per-service observability format
142
+ - Do not duplicate platform types — always import from `@kb-labs/core-*`
143
+ - Do not run the service via raw `node` or `pnpm *:dev` — always go through `kb-dev`
144
+ - Do not commit secrets or hard-coded ports outside `.kb/devservices.yaml`
@@ -0,0 +1,119 @@
1
+ ---
2
+ name: kb-labs-explore
3
+ description: Use when the user wants to know what is installed in their KB Labs project — which services, plugins, commands are available, what is configured, where things live. Do not use for general code search (use Grep) or for finding file paths the user already knows.
4
+ user-invocable: true
5
+ ---
6
+
7
+ # Explore a KB Labs Installation
8
+
9
+ Help the user discover what is installed and configured in their KB Labs project.
10
+
11
+ ## Step 1: Show install status
12
+
13
+ ```bash
14
+ kb-create status
15
+ ```
16
+
17
+ This prints the platform version, the bound project directory, and the selected
18
+ services and plugins.
19
+
20
+ ## Step 2: Show project configuration
21
+
22
+ The user-editable project config lives at `.kb/kb.config.jsonc`. Read it and
23
+ summarise:
24
+
25
+ - Which services are enabled
26
+ - Which plugins are enabled
27
+ - Any custom adapter or LLM settings
28
+
29
+ Do not parse `.kb/kb.config.json` (the platform-internal one) — that is
30
+ auto-generated runtime state and may change format.
31
+
32
+ ## Step 3: Discover available commands
33
+
34
+ ```bash
35
+ pnpm kb --help
36
+ ```
37
+
38
+ This lists all command groups (e.g. `mind`, `qa`, `marketplace`, `workflow`,
39
+ `commit`, `agent`). For details on a group:
40
+
41
+ ```bash
42
+ pnpm kb <group> --help
43
+ ```
44
+
45
+ For a single command:
46
+
47
+ ```bash
48
+ pnpm kb <group>:<command> --help
49
+ ```
50
+
51
+ ## Step 4: Discover services
52
+
53
+ ```bash
54
+ pnpm kb-dev status
55
+ ```
56
+
57
+ Service states: `alive` / `starting` / `failed` / `stopping` / `dead`.
58
+
59
+ For machine-readable output (when piping into other tools):
60
+
61
+ ```bash
62
+ pnpm kb-dev status --json
63
+ ```
64
+
65
+ To see the service registry (definitions, ports, dependencies), look at
66
+ `.kb/devservices.yaml`. Do not edit this file unless the user explicitly asks —
67
+ it is the source of truth for the dev environment.
68
+
69
+ ## Step 5: Discover installed plugins
70
+
71
+ ```bash
72
+ pnpm kb plugins list
73
+ ```
74
+
75
+ To see which entities the marketplace knows about (plugins, adapters, etc.):
76
+
77
+ ```bash
78
+ pnpm kb marketplace list
79
+ ```
80
+
81
+ The marketplace lock file at `.kb/marketplace.lock` records explicitly installed
82
+ entities (it is never auto-populated).
83
+
84
+ ## Step 6: Discover routes (HTTP services only)
85
+
86
+ If a REST/Workflow/Gateway service is running:
87
+
88
+ ```bash
89
+ curl http://localhost:5050/api/v1/routes # rest-api
90
+ curl http://localhost:7778/openapi.json # workflow-daemon
91
+ curl http://localhost:4000/openapi-merged.json # gateway aggregated
92
+ ```
93
+
94
+ Or open `/docs` on each port for a Swagger UI.
95
+
96
+ ## Step 7: Where things live
97
+
98
+ A standard KB Labs project has:
99
+
100
+ | Path | Purpose |
101
+ |---|---|
102
+ | `.kb/kb.config.jsonc` | User-editable project config |
103
+ | `.kb/devservices.yaml` | Service definitions for kb-dev |
104
+ | `.kb/logs/tmp/<service>.log` | Service logs |
105
+ | `.kb/tmp/<service>.pid` | Service PIDs (managed by kb-dev) |
106
+ | `.kb/marketplace.lock` | Installed marketplace entities |
107
+ | `.claude/skills/kb-labs-*` | Managed Claude Code skills |
108
+
109
+ Do not list or read files under `node_modules/@kb-labs/` unless the user
110
+ specifically asks — they are implementation details of the installed platform.
111
+
112
+ ## Important rules
113
+
114
+ - The user-facing config is `.kb/kb.config.jsonc` (with comments). The other
115
+ file `.kb/kb.config.json` is internal — read it only if you have a reason.
116
+ - Services should always be inspected via `kb-dev`, not via raw `ps` / `lsof`.
117
+ - For semantic code search of the user's own code, use Grep — Mind RAG is a
118
+ platform-internal tool that is only available inside the kb-labs monorepo
119
+ itself.
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: kb-labs-quickstart
3
+ description: Use when the user has just installed KB Labs and wants to verify the install, see what is available, or asks "what is kb-labs" / "how do I get started" / "is kb-labs working".
4
+ user-invocable: true
5
+ ---
6
+
7
+ # KB Labs Quickstart
8
+
9
+ Help the user verify their KB Labs installation and discover what is available.
10
+
11
+ ## Step 1: Verify the install
12
+
13
+ Run the doctor command — it checks node, pnpm, the platform directory, and the
14
+ installed manifest.
15
+
16
+ ```bash
17
+ kb-create doctor
18
+ ```
19
+
20
+ If this fails, switch to the `kb-labs-troubleshoot` skill.
21
+
22
+ ## Step 2: Show platform status
23
+
24
+ ```bash
25
+ kb-create status
26
+ ```
27
+
28
+ This prints the installed platform version, the bound project directory, and the
29
+ selected services/plugins.
30
+
31
+ ## Step 3: Show what platform commands are available
32
+
33
+ ```bash
34
+ pnpm kb --help
35
+ ```
36
+
37
+ The output groups commands by product (mind, qa, marketplace, workflow, etc).
38
+ For details on a group:
39
+
40
+ ```bash
41
+ pnpm kb <group> --help
42
+ ```
43
+
44
+ ## Step 4: Check services (only if the user has services installed)
45
+
46
+ KB Labs ships an internal service manager called `kb-dev`. Check whether anything
47
+ is running:
48
+
49
+ ```bash
50
+ pnpm kb-dev status
51
+ ```
52
+
53
+ States: `alive` / `starting` / `failed` / `stopping` / `dead`. If the user has
54
+ no services installed yet, this is empty and that is fine.
55
+
56
+ ## Step 5: Point the user at the right next skill
57
+
58
+ Based on what the user wants to do:
59
+
60
+ - Wants to build a plugin → suggest `kb-labs-create-plugin`
61
+ - Wants to build a service → suggest `kb-labs-create-product`
62
+ - Something is broken → suggest `kb-labs-troubleshoot`
63
+ - Wants to see what is installed → suggest `kb-labs-explore`
64
+ - Wants to upgrade the platform → suggest `kb-labs-update`
65
+
66
+ ## Important rules
67
+
68
+ - Never edit files inside `.kb/` directly — it is platform runtime state.
69
+ - The user's project config lives at `.kb/kb.config.jsonc` (with comments) and
70
+ is safe to edit.
71
+ - If `kb-create` is not on PATH, the user can also call `npx kb-create ...` from
72
+ the project root.