@hivehub/rulebook 1.2.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 (379) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +539 -0
  3. package/dist/agents/claude-code.d.ts +69 -0
  4. package/dist/agents/claude-code.d.ts.map +1 -0
  5. package/dist/agents/claude-code.js +180 -0
  6. package/dist/agents/claude-code.js.map +1 -0
  7. package/dist/agents/cursor-agent.d.ts +184 -0
  8. package/dist/agents/cursor-agent.d.ts.map +1 -0
  9. package/dist/agents/cursor-agent.js +299 -0
  10. package/dist/agents/cursor-agent.js.map +1 -0
  11. package/dist/agents/gemini-cli.d.ts +69 -0
  12. package/dist/agents/gemini-cli.d.ts.map +1 -0
  13. package/dist/agents/gemini-cli.js +180 -0
  14. package/dist/agents/gemini-cli.js.map +1 -0
  15. package/dist/cli/commands.d.ts +57 -0
  16. package/dist/cli/commands.d.ts.map +1 -0
  17. package/dist/cli/commands.js +1370 -0
  18. package/dist/cli/commands.js.map +1 -0
  19. package/dist/cli/docs-prompts.d.ts +3 -0
  20. package/dist/cli/docs-prompts.d.ts.map +1 -0
  21. package/dist/cli/docs-prompts.js +45 -0
  22. package/dist/cli/docs-prompts.js.map +1 -0
  23. package/dist/cli/prompts.d.ts +6 -0
  24. package/dist/cli/prompts.d.ts.map +1 -0
  25. package/dist/cli/prompts.js +376 -0
  26. package/dist/cli/prompts.js.map +1 -0
  27. package/dist/core/agent-manager.d.ts +89 -0
  28. package/dist/core/agent-manager.d.ts.map +1 -0
  29. package/dist/core/agent-manager.js +546 -0
  30. package/dist/core/agent-manager.js.map +1 -0
  31. package/dist/core/auto-fixer.d.ts +14 -0
  32. package/dist/core/auto-fixer.d.ts.map +1 -0
  33. package/dist/core/auto-fixer.js +207 -0
  34. package/dist/core/auto-fixer.js.map +1 -0
  35. package/dist/core/changelog-generator.d.ts +44 -0
  36. package/dist/core/changelog-generator.d.ts.map +1 -0
  37. package/dist/core/changelog-generator.js +222 -0
  38. package/dist/core/changelog-generator.js.map +1 -0
  39. package/dist/core/cli-bridge.d.ts +113 -0
  40. package/dist/core/cli-bridge.d.ts.map +1 -0
  41. package/dist/core/cli-bridge.js +1094 -0
  42. package/dist/core/cli-bridge.js.map +1 -0
  43. package/dist/core/config-manager.d.ts +65 -0
  44. package/dist/core/config-manager.d.ts.map +1 -0
  45. package/dist/core/config-manager.js +266 -0
  46. package/dist/core/config-manager.js.map +1 -0
  47. package/dist/core/coverage-checker.d.ts +14 -0
  48. package/dist/core/coverage-checker.d.ts.map +1 -0
  49. package/dist/core/coverage-checker.js +176 -0
  50. package/dist/core/coverage-checker.js.map +1 -0
  51. package/dist/core/custom-templates.d.ts +27 -0
  52. package/dist/core/custom-templates.d.ts.map +1 -0
  53. package/dist/core/custom-templates.js +122 -0
  54. package/dist/core/custom-templates.js.map +1 -0
  55. package/dist/core/dependency-checker.d.ts +21 -0
  56. package/dist/core/dependency-checker.d.ts.map +1 -0
  57. package/dist/core/dependency-checker.js +247 -0
  58. package/dist/core/dependency-checker.js.map +1 -0
  59. package/dist/core/detector.d.ts +3 -0
  60. package/dist/core/detector.d.ts.map +1 -0
  61. package/dist/core/detector.js +1443 -0
  62. package/dist/core/detector.js.map +1 -0
  63. package/dist/core/docs-generator.d.ts +9 -0
  64. package/dist/core/docs-generator.d.ts.map +1 -0
  65. package/dist/core/docs-generator.js +531 -0
  66. package/dist/core/docs-generator.js.map +1 -0
  67. package/dist/core/generator.d.ts +16 -0
  68. package/dist/core/generator.d.ts.map +1 -0
  69. package/dist/core/generator.js +561 -0
  70. package/dist/core/generator.js.map +1 -0
  71. package/dist/core/gitignore-generator.d.ts +13 -0
  72. package/dist/core/gitignore-generator.d.ts.map +1 -0
  73. package/dist/core/gitignore-generator.js +307 -0
  74. package/dist/core/gitignore-generator.js.map +1 -0
  75. package/dist/core/health-scorer.d.ts +22 -0
  76. package/dist/core/health-scorer.d.ts.map +1 -0
  77. package/dist/core/health-scorer.js +395 -0
  78. package/dist/core/health-scorer.js.map +1 -0
  79. package/dist/core/logger.d.ts +116 -0
  80. package/dist/core/logger.d.ts.map +1 -0
  81. package/dist/core/logger.js +289 -0
  82. package/dist/core/logger.js.map +1 -0
  83. package/dist/core/merger.d.ts +6 -0
  84. package/dist/core/merger.d.ts.map +1 -0
  85. package/dist/core/merger.js +131 -0
  86. package/dist/core/merger.js.map +1 -0
  87. package/dist/core/migrator.d.ts +19 -0
  88. package/dist/core/migrator.d.ts.map +1 -0
  89. package/dist/core/migrator.js +102 -0
  90. package/dist/core/migrator.js.map +1 -0
  91. package/dist/core/minimal-scaffolder.d.ts +8 -0
  92. package/dist/core/minimal-scaffolder.d.ts.map +1 -0
  93. package/dist/core/minimal-scaffolder.js +51 -0
  94. package/dist/core/minimal-scaffolder.js.map +1 -0
  95. package/dist/core/modern-console-new.d.ts +81 -0
  96. package/dist/core/modern-console-new.d.ts.map +1 -0
  97. package/dist/core/modern-console-new.js +340 -0
  98. package/dist/core/modern-console-new.js.map +1 -0
  99. package/dist/core/modern-console.d.ts +99 -0
  100. package/dist/core/modern-console.d.ts.map +1 -0
  101. package/dist/core/modern-console.js +568 -0
  102. package/dist/core/modern-console.js.map +1 -0
  103. package/dist/core/openspec-manager.d.ts +133 -0
  104. package/dist/core/openspec-manager.d.ts.map +1 -0
  105. package/dist/core/openspec-manager.js +605 -0
  106. package/dist/core/openspec-manager.js.map +1 -0
  107. package/dist/core/openspec-migrator.d.ts +27 -0
  108. package/dist/core/openspec-migrator.d.ts.map +1 -0
  109. package/dist/core/openspec-migrator.js +255 -0
  110. package/dist/core/openspec-migrator.js.map +1 -0
  111. package/dist/core/task-manager.d.ts +65 -0
  112. package/dist/core/task-manager.d.ts.map +1 -0
  113. package/dist/core/task-manager.js +318 -0
  114. package/dist/core/task-manager.js.map +1 -0
  115. package/dist/core/test-task-manager.d.ts +49 -0
  116. package/dist/core/test-task-manager.d.ts.map +1 -0
  117. package/dist/core/test-task-manager.js +121 -0
  118. package/dist/core/test-task-manager.js.map +1 -0
  119. package/dist/core/validator.d.ts +21 -0
  120. package/dist/core/validator.d.ts.map +1 -0
  121. package/dist/core/validator.js +177 -0
  122. package/dist/core/validator.js.map +1 -0
  123. package/dist/core/version-bumper.d.ts +19 -0
  124. package/dist/core/version-bumper.d.ts.map +1 -0
  125. package/dist/core/version-bumper.js +180 -0
  126. package/dist/core/version-bumper.js.map +1 -0
  127. package/dist/core/watcher.d.ts +9 -0
  128. package/dist/core/watcher.d.ts.map +1 -0
  129. package/dist/core/watcher.js +22 -0
  130. package/dist/core/watcher.js.map +1 -0
  131. package/dist/core/workflow-generator.d.ts +10 -0
  132. package/dist/core/workflow-generator.d.ts.map +1 -0
  133. package/dist/core/workflow-generator.js +279 -0
  134. package/dist/core/workflow-generator.js.map +1 -0
  135. package/dist/index.d.ts +3 -0
  136. package/dist/index.d.ts.map +1 -0
  137. package/dist/index.js +159 -0
  138. package/dist/index.js.map +1 -0
  139. package/dist/mcp/handlers/archive-task.d.ts +17 -0
  140. package/dist/mcp/handlers/archive-task.d.ts.map +1 -0
  141. package/dist/mcp/handlers/archive-task.js +36 -0
  142. package/dist/mcp/handlers/archive-task.js.map +1 -0
  143. package/dist/mcp/handlers/create-task.d.ts +17 -0
  144. package/dist/mcp/handlers/create-task.d.ts.map +1 -0
  145. package/dist/mcp/handlers/create-task.js +56 -0
  146. package/dist/mcp/handlers/create-task.js.map +1 -0
  147. package/dist/mcp/handlers/list-tasks.d.ts +22 -0
  148. package/dist/mcp/handlers/list-tasks.d.ts.map +1 -0
  149. package/dist/mcp/handlers/list-tasks.js +42 -0
  150. package/dist/mcp/handlers/list-tasks.js.map +1 -0
  151. package/dist/mcp/handlers/show-task.d.ts +25 -0
  152. package/dist/mcp/handlers/show-task.d.ts.map +1 -0
  153. package/dist/mcp/handlers/show-task.js +43 -0
  154. package/dist/mcp/handlers/show-task.js.map +1 -0
  155. package/dist/mcp/handlers/update-task.d.ts +17 -0
  156. package/dist/mcp/handlers/update-task.d.ts.map +1 -0
  157. package/dist/mcp/handlers/update-task.js +35 -0
  158. package/dist/mcp/handlers/update-task.js.map +1 -0
  159. package/dist/mcp/handlers/validate-task.d.ts +15 -0
  160. package/dist/mcp/handlers/validate-task.d.ts.map +1 -0
  161. package/dist/mcp/handlers/validate-task.js +27 -0
  162. package/dist/mcp/handlers/validate-task.js.map +1 -0
  163. package/dist/mcp/rulebook-config.d.ts +22 -0
  164. package/dist/mcp/rulebook-config.d.ts.map +1 -0
  165. package/dist/mcp/rulebook-config.js +65 -0
  166. package/dist/mcp/rulebook-config.js.map +1 -0
  167. package/dist/mcp/rulebook-server.d.ts +4 -0
  168. package/dist/mcp/rulebook-server.d.ts.map +1 -0
  169. package/dist/mcp/rulebook-server.js +246 -0
  170. package/dist/mcp/rulebook-server.js.map +1 -0
  171. package/dist/types.d.ts +190 -0
  172. package/dist/types.d.ts.map +1 -0
  173. package/dist/types.js +2 -0
  174. package/dist/types.js.map +1 -0
  175. package/dist/utils/file-system.d.ts +9 -0
  176. package/dist/utils/file-system.d.ts.map +1 -0
  177. package/dist/utils/file-system.js +51 -0
  178. package/dist/utils/file-system.js.map +1 -0
  179. package/dist/utils/git-hooks.d.ts +8 -0
  180. package/dist/utils/git-hooks.d.ts.map +1 -0
  181. package/dist/utils/git-hooks.js +440 -0
  182. package/dist/utils/git-hooks.js.map +1 -0
  183. package/dist/utils/rulesignore.d.ts +9 -0
  184. package/dist/utils/rulesignore.d.ts.map +1 -0
  185. package/dist/utils/rulesignore.js +42 -0
  186. package/dist/utils/rulesignore.js.map +1 -0
  187. package/package.json +106 -0
  188. package/templates/cli/AIDER.md +49 -0
  189. package/templates/cli/AMAZON_Q.md +25 -0
  190. package/templates/cli/AUGGIE.md +32 -0
  191. package/templates/cli/CLAUDE.md +32 -0
  192. package/templates/cli/CLAUDE_CODE.md +35 -0
  193. package/templates/cli/CLINE.md +32 -0
  194. package/templates/cli/CODEBUDDY.md +20 -0
  195. package/templates/cli/CODEIUM.md +20 -0
  196. package/templates/cli/CODEX.md +21 -0
  197. package/templates/cli/CONTINUE.md +34 -0
  198. package/templates/cli/CURSOR_CLI.md +28 -0
  199. package/templates/cli/FACTORY.md +18 -0
  200. package/templates/cli/GEMINI.md +35 -0
  201. package/templates/cli/KILOCODE.md +18 -0
  202. package/templates/cli/OPENCODE.md +18 -0
  203. package/templates/cli/_GENERIC_TEMPLATE.md +29 -0
  204. package/templates/commands/rulebook-task-apply.md +67 -0
  205. package/templates/commands/rulebook-task-archive.md +70 -0
  206. package/templates/commands/rulebook-task-create.md +93 -0
  207. package/templates/commands/rulebook-task-list.md +42 -0
  208. package/templates/commands/rulebook-task-show.md +52 -0
  209. package/templates/commands/rulebook-task-validate.md +53 -0
  210. package/templates/core/AGENT_AUTOMATION.md +184 -0
  211. package/templates/core/DAG.md +304 -0
  212. package/templates/core/DOCUMENTATION_RULES.md +37 -0
  213. package/templates/core/QUALITY_ENFORCEMENT.md +68 -0
  214. package/templates/core/RULEBOOK.md +1874 -0
  215. package/templates/frameworks/ANGULAR.md +36 -0
  216. package/templates/frameworks/DJANGO.md +83 -0
  217. package/templates/frameworks/ELECTRON.md +147 -0
  218. package/templates/frameworks/FLASK.md +38 -0
  219. package/templates/frameworks/FLUTTER.md +55 -0
  220. package/templates/frameworks/JQUERY.md +32 -0
  221. package/templates/frameworks/LARAVEL.md +38 -0
  222. package/templates/frameworks/NESTJS.md +43 -0
  223. package/templates/frameworks/NEXTJS.md +127 -0
  224. package/templates/frameworks/NUXT.md +40 -0
  225. package/templates/frameworks/RAILS.md +66 -0
  226. package/templates/frameworks/REACT.md +38 -0
  227. package/templates/frameworks/REACT_NATIVE.md +47 -0
  228. package/templates/frameworks/SPRING.md +39 -0
  229. package/templates/frameworks/SYMFONY.md +36 -0
  230. package/templates/frameworks/VUE.md +36 -0
  231. package/templates/frameworks/ZEND.md +35 -0
  232. package/templates/git/CI_CD_PATTERNS.md +661 -0
  233. package/templates/git/GITHUB_ACTIONS.md +728 -0
  234. package/templates/git/GITLAB_CI.md +730 -0
  235. package/templates/git/GIT_WORKFLOW.md +1157 -0
  236. package/templates/git/SECRETS_MANAGEMENT.md +585 -0
  237. package/templates/hooks/COMMIT_MSG.md +530 -0
  238. package/templates/hooks/POST_CHECKOUT.md +546 -0
  239. package/templates/hooks/PREPARE_COMMIT_MSG.md +619 -0
  240. package/templates/hooks/PRE_COMMIT.md +414 -0
  241. package/templates/hooks/PRE_PUSH.md +601 -0
  242. package/templates/hooks/csharp-pre-commit.sh +23 -0
  243. package/templates/hooks/csharp-pre-push.sh +23 -0
  244. package/templates/hooks/dart-pre-commit.sh +30 -0
  245. package/templates/hooks/dart-pre-push.sh +25 -0
  246. package/templates/hooks/elixir-pre-commit.sh +32 -0
  247. package/templates/hooks/elixir-pre-push.sh +31 -0
  248. package/templates/hooks/erlang-pre-commit.sh +30 -0
  249. package/templates/hooks/erlang-pre-push.sh +37 -0
  250. package/templates/hooks/go-pre-commit.sh +40 -0
  251. package/templates/hooks/go-pre-push.sh +31 -0
  252. package/templates/hooks/haskell-pre-commit.sh +41 -0
  253. package/templates/hooks/haskell-pre-push.sh +37 -0
  254. package/templates/hooks/java-pre-commit.sh +34 -0
  255. package/templates/hooks/java-pre-push.sh +24 -0
  256. package/templates/hooks/kotlin-pre-commit.sh +32 -0
  257. package/templates/hooks/kotlin-pre-push.sh +16 -0
  258. package/templates/hooks/php-pre-commit.sh +36 -0
  259. package/templates/hooks/php-pre-push.sh +26 -0
  260. package/templates/hooks/python-pre-commit.sh +51 -0
  261. package/templates/hooks/python-pre-push.sh +25 -0
  262. package/templates/hooks/ruby-pre-commit.sh +33 -0
  263. package/templates/hooks/ruby-pre-push.sh +32 -0
  264. package/templates/hooks/rust-pre-commit.sh +30 -0
  265. package/templates/hooks/rust-pre-push.sh +30 -0
  266. package/templates/hooks/scala-pre-commit.sh +32 -0
  267. package/templates/hooks/scala-pre-push.sh +24 -0
  268. package/templates/hooks/swift-pre-commit.sh +25 -0
  269. package/templates/hooks/swift-pre-push.sh +23 -0
  270. package/templates/hooks/typescript-pre-commit.sh +37 -0
  271. package/templates/hooks/typescript-pre-push.sh +36 -0
  272. package/templates/ides/COPILOT.md +37 -0
  273. package/templates/ides/CURSOR.md +43 -0
  274. package/templates/ides/JETBRAINS_AI.md +35 -0
  275. package/templates/ides/REPLIT.md +36 -0
  276. package/templates/ides/TABNINE.md +29 -0
  277. package/templates/ides/VSCODE.md +40 -0
  278. package/templates/ides/WINDSURF.md +36 -0
  279. package/templates/ides/ZED.md +32 -0
  280. package/templates/languages/ADA.md +58 -0
  281. package/templates/languages/C.md +333 -0
  282. package/templates/languages/CPP.md +743 -0
  283. package/templates/languages/CSHARP.md +417 -0
  284. package/templates/languages/DART.md +332 -0
  285. package/templates/languages/ELIXIR.md +454 -0
  286. package/templates/languages/ERLANG.md +361 -0
  287. package/templates/languages/GO.md +645 -0
  288. package/templates/languages/HASKELL.md +177 -0
  289. package/templates/languages/JAVA.md +607 -0
  290. package/templates/languages/JAVASCRIPT.md +631 -0
  291. package/templates/languages/JULIA.md +97 -0
  292. package/templates/languages/KOTLIN.md +511 -0
  293. package/templates/languages/LISP.md +100 -0
  294. package/templates/languages/LUA.md +74 -0
  295. package/templates/languages/OBJECTIVEC.md +90 -0
  296. package/templates/languages/PHP.md +416 -0
  297. package/templates/languages/PYTHON.md +682 -0
  298. package/templates/languages/R.md +350 -0
  299. package/templates/languages/RUBY.md +421 -0
  300. package/templates/languages/RUST.md +477 -0
  301. package/templates/languages/SAS.md +73 -0
  302. package/templates/languages/SCALA.md +348 -0
  303. package/templates/languages/SOLIDITY.md +580 -0
  304. package/templates/languages/SQL.md +137 -0
  305. package/templates/languages/SWIFT.md +466 -0
  306. package/templates/languages/TYPESCRIPT.md +591 -0
  307. package/templates/languages/ZIG.md +265 -0
  308. package/templates/modules/ATLASSIAN.md +255 -0
  309. package/templates/modules/CONTEXT7.md +54 -0
  310. package/templates/modules/FIGMA.md +267 -0
  311. package/templates/modules/GITHUB_MCP.md +64 -0
  312. package/templates/modules/GRAFANA.md +328 -0
  313. package/templates/modules/NOTION.md +247 -0
  314. package/templates/modules/PLAYWRIGHT.md +90 -0
  315. package/templates/modules/RULEBOOK_MCP.md +156 -0
  316. package/templates/modules/SERENA.md +337 -0
  317. package/templates/modules/SUPABASE.md +223 -0
  318. package/templates/modules/SYNAP.md +69 -0
  319. package/templates/modules/VECTORIZER.md +63 -0
  320. package/templates/services/AZURE_BLOB.md +184 -0
  321. package/templates/services/CASSANDRA.md +239 -0
  322. package/templates/services/DYNAMODB.md +308 -0
  323. package/templates/services/ELASTICSEARCH.md +347 -0
  324. package/templates/services/GCS.md +178 -0
  325. package/templates/services/INFLUXDB.md +265 -0
  326. package/templates/services/KAFKA.md +341 -0
  327. package/templates/services/MARIADB.md +183 -0
  328. package/templates/services/MEMCACHED.md +242 -0
  329. package/templates/services/MINIO.md +201 -0
  330. package/templates/services/MONGODB.md +268 -0
  331. package/templates/services/MYSQL.md +358 -0
  332. package/templates/services/NEO4J.md +247 -0
  333. package/templates/services/ORACLE.md +290 -0
  334. package/templates/services/POSTGRESQL.md +326 -0
  335. package/templates/services/RABBITMQ.md +286 -0
  336. package/templates/services/REDIS.md +292 -0
  337. package/templates/services/S3.md +298 -0
  338. package/templates/services/SQLITE.md +294 -0
  339. package/templates/services/SQLSERVER.md +294 -0
  340. package/templates/workflows/codespell.yml +31 -0
  341. package/templates/workflows/cpp-lint.yml +47 -0
  342. package/templates/workflows/cpp-publish.yml +119 -0
  343. package/templates/workflows/cpp-test.yml +77 -0
  344. package/templates/workflows/dotnet-lint.yml +29 -0
  345. package/templates/workflows/dotnet-publish.yml +40 -0
  346. package/templates/workflows/dotnet-test.yml +41 -0
  347. package/templates/workflows/elixir-lint.yml +45 -0
  348. package/templates/workflows/elixir-publish.yml +49 -0
  349. package/templates/workflows/elixir-test.yml +54 -0
  350. package/templates/workflows/erlang-lint.yml +47 -0
  351. package/templates/workflows/erlang-test.yml +62 -0
  352. package/templates/workflows/go-lint.yml +39 -0
  353. package/templates/workflows/go-publish.yml +95 -0
  354. package/templates/workflows/go-test.yml +59 -0
  355. package/templates/workflows/java-lint.yml +60 -0
  356. package/templates/workflows/java-publish.yml +120 -0
  357. package/templates/workflows/java-test.yml +85 -0
  358. package/templates/workflows/kotlin-lint.yml +34 -0
  359. package/templates/workflows/kotlin-publish.yml +56 -0
  360. package/templates/workflows/kotlin-test.yml +48 -0
  361. package/templates/workflows/php-lint.yml +39 -0
  362. package/templates/workflows/php-publish.yml +50 -0
  363. package/templates/workflows/php-test.yml +54 -0
  364. package/templates/workflows/python-lint.yml +47 -0
  365. package/templates/workflows/python-publish.yml +91 -0
  366. package/templates/workflows/python-test.yml +59 -0
  367. package/templates/workflows/rust-lint.yml +54 -0
  368. package/templates/workflows/rust-publish.yml +66 -0
  369. package/templates/workflows/rust-test.yml +75 -0
  370. package/templates/workflows/solidity-lint.yml +41 -0
  371. package/templates/workflows/solidity-test.yml +47 -0
  372. package/templates/workflows/swift-lint.yml +32 -0
  373. package/templates/workflows/swift-publish.yml +58 -0
  374. package/templates/workflows/swift-test.yml +44 -0
  375. package/templates/workflows/typescript-lint.yml +61 -0
  376. package/templates/workflows/typescript-publish.yml +60 -0
  377. package/templates/workflows/typescript-test.yml +73 -0
  378. package/templates/workflows/zig-lint.yml +27 -0
  379. package/templates/workflows/zig-test.yml +40 -0
package/README.md ADDED
@@ -0,0 +1,539 @@
1
+ # @hivehub/rulebook
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@hivehub/rulebook?logo=npm&logoColor=white)](https://www.npmjs.com/package/@hivehub/rulebook)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@hivehub/rulebook?logo=npm&logoColor=white)](https://www.npmjs.com/package/@hivehub/rulebook)
5
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
6
+ [![Node.js](https://img.shields.io/badge/Node.js-20+-339933?logo=nodedotjs&logoColor=white)](https://nodejs.org/)
7
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
8
+
9
+ [![Tests](https://img.shields.io/github/actions/workflow/status/hivellm/rulebook/test.yml?label=tests&logo=github)](https://github.com/hivellm/rulebook/actions/workflows/test.yml)
10
+ [![Coverage](https://img.shields.io/codecov/c/github/hivellm/rulebook?logo=codecov&logoColor=white)](https://codecov.io/gh/hivellm/rulebook)
11
+ [![Build](https://img.shields.io/github/actions/workflow/status/hivellm/rulebook/build.yml?label=build&logo=github)](https://github.com/hivellm/rulebook/actions/workflows/build.yml)
12
+ [![Lint](https://img.shields.io/github/actions/workflow/status/hivellm/rulebook/lint.yml?label=lint&logo=github)](https://github.com/hivellm/rulebook/actions/workflows/lint.yml)
13
+
14
+ > Standardize AI-generated projects with automated templates, quality gates, and framework detection for 28 languages, 17 frameworks, 12 MCP modules, and 20 services.
15
+
16
+ ---
17
+
18
+ ## Why Rulebook?
19
+
20
+ Large Language Models (LLMs) for software development need **clear directives** to generate high-quality code consistently. Without standardized guidelines, AI-generated code can be inconsistent, error-prone, and difficult to maintain.
21
+
22
+ **Rulebook solves this by providing:**
23
+
24
+ - 📋 **Comprehensive Rule Sets**: Language-specific guidelines (TypeScript, Rust, Python, etc.), framework conventions (NestJS, Django, React), testing standards, linting rules, spell-checking, CI/CD pipelines, Git hooks, and version control best practices
25
+ - 🎯 **Normalized Deliverables**: Ensures consistent code quality across all AI-generated outputs
26
+ - 🛡️ **Error Reduction**: Catches issues early through automated quality gates and pre-commit/pre-push hooks
27
+ - ⚙️ **Process Automation**: Automates repetitive tasks like formatting, testing, and deployment
28
+ - 🔌 **MCP Integration**: Supports multiple Model Context Protocol (MCP) modules for enhanced AI capabilities
29
+ - 📊 **Task Management**: Built-in task management system (OpenSpec-compatible format) for structured development
30
+
31
+ By giving LLMs a clear "rulebook" to follow, you ensure that every piece of generated code meets your project's standards—**automatically**.
32
+
33
+ ## Quick Start
34
+
35
+ ```bash
36
+ # New project (interactive)
37
+ npx @hivehub/rulebook@latest init
38
+
39
+ # Minimal setup (essentials only)
40
+ npx @hivehub/rulebook@latest init --minimal
41
+
42
+ # Light mode (prototypes without strict rules)
43
+ npx @hivehub/rulebook@latest init --light
44
+
45
+ # Update existing project
46
+ npx @hivehub/rulebook@latest update
47
+ ```
48
+
49
+ ## What's New
50
+
51
+ ### v1.1.5 (Latest)
52
+
53
+ - 🗄️ **Service Integration Templates**: Added comprehensive service integration templates
54
+ - 20 service templates: PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLite, MongoDB, Cassandra, DynamoDB, Redis, Memcached, Elasticsearch, Neo4j, InfluxDB, RabbitMQ, Kafka, S3, Azure Blob, GCS, MinIO
55
+ - Automatic service detection from `package.json`, `.env`, and `docker-compose.yml`
56
+ - Service-specific integration instructions with connection setup, operations, best practices, and configuration
57
+ - Templates generated in `/rulebook/[SERVICE].md` with references in `AGENTS.md`
58
+ - Interactive CLI prompt to select which services to include templates for
59
+
60
+ ### v1.1.4
61
+
62
+ - 🔧 **Cross-platform Git Hooks**: Git hooks now work on both Windows and Linux
63
+ - Hooks are now generated as Node.js scripts with shell wrappers
64
+ - Shell wrapper detects Node.js in common locations (Windows and Linux)
65
+ - Node.js scripts use native `child_process.spawn` for cross-platform command execution
66
+ - Pre-commit and pre-push hooks now function correctly on Windows (Git Bash) and Linux
67
+ - 🔄 **Git Hooks Architecture**: Refactored hook generation system
68
+ - Hooks are now generated as two files: shell wrapper + Node.js script
69
+ - Shell templates (`.sh`) are automatically converted to Node.js scripts
70
+ - Improved command parsing from shell templates to Node.js
71
+ - Better error handling and cross-platform compatibility
72
+
73
+ ### v1.1.3
74
+
75
+ - 🗑️ **MCP Tool: `rulebook_task_delete`**: Delete tasks permanently
76
+ - New tool to permanently delete tasks from the filesystem
77
+ - Removes task directory recursively
78
+ - Useful for cleaning up test tasks or removing unwanted tasks
79
+ - Total of 7 MCP functions now available
80
+
81
+ ### v1.1.2
82
+
83
+ - 🔧 **ESLint v9 Migration**: Updated to ESLint flat config format
84
+ - Migrated from `.eslintrc.json` to `eslint.config.js`
85
+ - Updated to ESLint 9.37.0 with TypeScript ESLint 8.47.0
86
+ - Added proper Node.js global type definitions
87
+ - Linting now shows only errors (warnings suppressed with `--quiet`)
88
+
89
+ ### v1.0.3
90
+
91
+ - 🔧 **Zod v3 Compatibility**: Using Zod v3.25.76 for full MCP SDK compatibility
92
+ - MCP SDK v1.22.0 requires Zod v3 (see [Issue #1429](https://github.com/modelcontextprotocol/modelcontextprotocol/issues/1429))
93
+ - Will upgrade to Zod v4 when MCP SDK officially supports it
94
+ - 🔄 **Dependency Updates**: All dependencies updated to latest versions
95
+ - TypeScript tooling (ESLint 8.47.0, Vitest 4.0.13)
96
+ - Node.js types updated to support Node.js 24.x
97
+ - CLI tools and build utilities updated
98
+ - 🐛 **Windows CI Fix**: Fixed PowerShell compatibility in GitHub Actions workflows
99
+ - Removed bash-specific syntax from Windows runners
100
+ - Cross-platform compatibility improved
101
+
102
+ ### v1.0.2
103
+
104
+ - 🔌 **MCP Server for Task Management**: New MCP server enables AI models to manage tasks programmatically
105
+ - 7 MCP functions: create, list, show, update, validate, archive, delete tasks
106
+ - Available via `npx @hivellm/rulebook@latest mcp-server` or `npx rulebook-mcp`
107
+ - Better integration with MCP-compatible AI assistants
108
+ - ⚡ **Faster Pre-commit Hooks**: Tests removed from pre-commit for faster backup commits
109
+ - Pre-commit now runs only: format check, lint, type-check
110
+ - Tests moved to pre-push hook for comprehensive validation
111
+ - 🏗️ **Build Verification**: Build check now mandatory before push (runs first)
112
+ - 📦 **pnpm Recommendation**: Added pnpm as preferred package manager with `.npmrc` configuration
113
+ - 🚀 **Rust Build Optimization**: Comprehensive guide for faster Rust builds
114
+ - sccache configuration, incremental compilation, lld linker
115
+ - Anti-pattern documentation for `pub use big_crate::*;`
116
+ - 📋 **Enhanced Task Management**: Strengthened OpenSpec format compliance and archiving rules
117
+ - 📁 **Strict Markdown Organization**: UPPERCASE naming and `/docs` directory requirements
118
+
119
+ ### v1.0.0
120
+
121
+ - 🎉 **First Stable Release**: Production-ready with comprehensive features
122
+ - 🔒 **Apache 2.0 License**: Changed from MIT to Apache License 2.0 for better compatibility
123
+ - 🛡️ **Git Hooks Enforcement**: Pre-commit and pre-push hooks now block commits with lint/test errors
124
+ - 📋 **Task File Structure Rules**: Enhanced directives in AGENTS.md about correct task structure
125
+ - 🎯 **Built-in Task Management**: OpenSpec deprecated and integrated into Rulebook's native task system
126
+ - 📋 **RULEBOOK.md Template**: Core template with task management directives and Context7 MCP requirements
127
+ - 🚫 **Automatic .gitignore**: `npx @hivellm/rulebook@latest init` now creates/updates `.gitignore` automatically for 28 languages
128
+ - 🔄 **Migration Support**: Existing OpenSpec tasks automatically migrated to `/rulebook/tasks/` format
129
+
130
+ > **Breaking Change**: OpenSpec module removed. Use `npx @hivellm/rulebook@latest task` commands instead. See [Migration Guide](docs/guides/OPENSPEC_MIGRATION.md).
131
+
132
+ ## Key Features
133
+
134
+ - 🔍 **Auto-Detection**: Detects languages, frameworks (NestJS, React, Spring, etc.), MCP modules, and services (databases, caches, message queues, etc.)
135
+ - 📁 **Modular Architecture**: Templates stored in `/rulebook/` directory for better organization
136
+ - Smaller AGENTS.md files (prevents 100k+ character limits)
137
+ - QUALITY_ENFORCEMENT and Git rules moved to `/rulebook/` for cleaner structure
138
+ - On-demand loading for better AI performance
139
+ - Easier maintenance and updates
140
+ - 📋 **Simplified AGENTS.md**: Clean, focused structure with only core rules and references
141
+ - Proper hierarchy with `##` and `###` subsections
142
+ - All modules grouped logically
143
+ - Better readability and navigation
144
+ - 🔗 **Git Hook Automation**: Optional pre-commit/pre-push hooks with language-aware quality checks
145
+ - 🚫 **Automatic .gitignore**: Creates/updates `.gitignore` automatically for 28 languages on `npx @hivellm/rulebook@latest init`
146
+ - 🎯 **Minimal Mode**: Quick setup with just README, LICENSE, tests/, and basic CI
147
+ - 📝 **106+ Templates**: Languages, frameworks, IDEs, workflows, and services pre-configured
148
+ - 🤖 **AI-Optimized**: Works with 23 AI assistants (Cursor, Claude, Gemini, etc.)
149
+ - 📦 **Publication Ready**: CI/CD pipelines for npm, crates.io, PyPI, Maven Central, and more
150
+ - 🔄 **Automatic Migration**: Existing projects automatically migrated to modular structure and OpenSpec tasks
151
+
152
+ ## What It Does
153
+
154
+ **For New Projects:**
155
+ 1. Detects your language(s), frameworks, MCP modules, and services
156
+ 2. Asks setup questions (or use `--minimal` for defaults)
157
+ 3. Generates AGENTS.md with AI assistant rules (modular structure)
158
+ 4. Creates `/rulebook/` directory with language/framework/module/service templates
159
+ 5. Creates/updates `.gitignore` automatically for detected languages
160
+ 6. Optionally installs Git hooks (pre-commit/pre-push)
161
+ 7. Creates GitHub Actions workflows
162
+ 8. Scaffolds README, LICENSE, /docs, and /tests
163
+
164
+ **For Existing Projects:**
165
+ ```bash
166
+ npx @hivehub/rulebook update
167
+ ```
168
+ - Automatically migrates embedded templates to modular `/rulebook/` structure
169
+ - Automatically migrates OpenSpec tasks to Rulebook format (if OpenSpec exists)
170
+ - Merges latest templates while preserving your customizations
171
+ - Updates AGENTS.md with references to modular files
172
+ - Updates `.gitignore` with missing patterns for detected languages
173
+
174
+ ## Commands
175
+
176
+ ### Core Commands
177
+
178
+ ```bash
179
+ # Project Initialization & Updates
180
+ npx @hivehub/rulebook@latest init # Initialize new project (interactive)
181
+ npx @hivehub/rulebook@latest init --minimal # Minimal setup (essentials only)
182
+ npx @hivehub/rulebook@latest init --light # Light mode (no quality enforcement)
183
+ npx @hivehub/rulebook@latest init --yes # Skip prompts, use defaults
184
+ npx @hivehub/rulebook@latest update # Update AGENTS.md to latest version
185
+ npx @hivehub/rulebook@latest update --yes # Update without confirmation
186
+ npx @hivehub/rulebook@latest update --light # Update in light mode
187
+
188
+ # Workflow & CI/CD
189
+ npx @hivehub/rulebook@latest workflows # Generate GitHub Actions workflows
190
+
191
+ # Validation & Health
192
+ npx @hivehub/rulebook@latest validate # Check project standards
193
+ npx @hivehub/rulebook@latest health # Project health score (0-100)
194
+ npx @hivehub/rulebook@latest fix # Auto-fix common issues
195
+
196
+ # Documentation
197
+ npx @hivehub/rulebook@latest generate-docs # Create /docs structure
198
+ npx @hivehub/rulebook@latest generate-docs --yes # Skip prompts, use defaults
199
+
200
+ # Dependencies & Coverage
201
+ npx @hivehub/rulebook@latest check-deps # Check outdated/vulnerable dependencies
202
+ npx @hivehub/rulebook@latest check-coverage # Check test coverage (default: 95%)
203
+ npx @hivehub/rulebook@latest check-coverage -t 80 # Custom threshold
204
+
205
+ # Versioning
206
+ npx @hivehub/rulebook@latest version <type> # Bump version (major|minor|patch)
207
+ npx @hivehub/rulebook@latest changelog # Generate changelog from git commits
208
+ npx @hivehub/rulebook@latest changelog -v 1.0.0 # Specify version
209
+ ```
210
+
211
+ > **Note**: If installed globally (`npm install -g @hivehub/rulebook`), you can use `rulebook` directly instead of `npx @hivehub/rulebook@latest`.
212
+
213
+ ### Advanced Commands (Beta)
214
+
215
+ ```bash
216
+ # Real-time Monitoring
217
+ npx @hivehub/rulebook@latest watcher # Full-screen task monitoring UI
218
+ # - Live task progress tracking
219
+ # - Activity log with timestamps
220
+ # - System status monitoring
221
+ # - Auto-refresh every 2 seconds
222
+
223
+ # Autonomous Agent
224
+ npx @hivehub/rulebook@latest agent # Start AI CLI workflow automation
225
+ npx @hivehub/rulebook@latest agent --dry-run # Simulate without changes
226
+ npx @hivehub/rulebook@latest agent --tool cursor-agent # Specify CLI tool
227
+ npx @hivehub/rulebook@latest agent --iterations 10 # Max iterations
228
+ npx @hivehub/rulebook@latest agent --watch # Enable watcher mode
229
+
230
+ # Task Management
231
+ npx @hivehub/rulebook@latest task create <task-id> # Create new task
232
+ npx @hivehub/rulebook@latest task list # List all tasks
233
+ npx @hivehub/rulebook@latest task list --archived # List including archived tasks
234
+ npx @hivehub/rulebook@latest task show <task-id> # Show task details
235
+ npx @hivehub/rulebook@latest task validate <task-id> # Validate task format
236
+ npx @hivehub/rulebook@latest task archive <task-id> # Archive completed task
237
+ npx @hivehub/rulebook@latest task archive --skip-validation <task-id> # Archive without validation
238
+ npx @hivehub/rulebook@latest tasks [options] # Legacy command (DEPRECATED - use 'task' commands)
239
+
240
+ # Configuration
241
+ npx @hivehub/rulebook@latest config --show # Show current config
242
+ npx @hivehub/rulebook@latest config --set key=value # Set config value
243
+ npx @hivehub/rulebook@latest config --feature watcher --enable # Enable feature
244
+ npx @hivehub/rulebook@latest config --feature agent --disable # Disable feature
245
+ ```
246
+
247
+ ## Setup Modes
248
+
249
+ ### Full Mode (Default)
250
+ Complete setup with all features: Task management, Watcher, MCP modules, comprehensive workflows.
251
+
252
+ ### Minimal Mode
253
+ ```bash
254
+ npx @hivehub/rulebook@latest init --minimal
255
+ ```
256
+ Essentials only: README, LICENSE, tests/, basic CI. Perfect for small teams or initial adoption.
257
+
258
+ ### Light Mode
259
+ ```bash
260
+ npx @hivehub/rulebook@latest init --light
261
+ ```
262
+ Bare minimum rules: no quality enforcement, no testing requirements, no linting. Use for quick prototypes or non-production projects.
263
+
264
+ ## Supported Languages & Frameworks
265
+
266
+ **28 Languages**: TypeScript, JavaScript, Python, Rust, Go, Java, Kotlin, C, C++, C#, PHP, Ruby, Swift, Elixir, Dart, Scala, Haskell, Julia, R, Lua, Solidity, Zig, Erlang, Ada, SAS, Lisp, Objective-C, SQL
267
+
268
+ **17 Frameworks** (auto-detected):
269
+ - Backend: NestJS, Spring Boot, Laravel, Django, Flask, Ruby on Rails, Symfony, Zend
270
+ - Frontend: Angular, React, Vue, Nuxt, Next.js, jQuery
271
+ - Mobile: React Native, Flutter
272
+ - Desktop: Electron
273
+
274
+ ## MCP Modules (12)
275
+
276
+ **Core**: Vectorizer • Synap • Context7 • GitHub MCP • Playwright
277
+
278
+ **Services**: Supabase • Notion • Atlassian • Serena • Figma • Grafana
279
+
280
+ ### MCP Server for Task Management
281
+
282
+ Rulebook provides an MCP (Model Context Protocol) server that exposes task management functions, allowing AI models to manage tasks programmatically through MCP instead of executing terminal commands.
283
+
284
+ **Benefits:**
285
+ - ✅ Direct MCP integration - no shell command execution needed
286
+ - ✅ Structured error handling with proper error codes and messages
287
+ - ✅ Consistent interface with other MCP operations
288
+ - ✅ Better automation capabilities for AI agents
289
+ - ✅ Improved reliability compared to terminal command execution
290
+ - ✅ Automatic project detection - finds `.rulebook` by walking up directories (like git)
291
+ - ✅ Zero configuration - works out of the box after `rulebook mcp init`
292
+
293
+ **Quick Setup:**
294
+
295
+ ```bash
296
+ # Initialize MCP configuration in your project (one-time setup)
297
+ npx @hivehub/rulebook@latest mcp init
298
+ ```
299
+
300
+ This command:
301
+ - Adds `mcp` block to your `.rulebook` file
302
+ - Creates/updates `.cursor/mcp.json` automatically
303
+ - Server uses stdio transport (MCP standard)
304
+
305
+ **Available MCP Functions:**
306
+
307
+ - `rulebook_task_create` - Create a new task with OpenSpec-compatible format
308
+ - Input: `taskId` (string), optional `proposal` object
309
+ - Output: Task creation confirmation with path
310
+ - `rulebook_task_list` - List all tasks with optional filters
311
+ - Input: `includeArchived` (boolean), `status` (enum)
312
+ - Output: Array of tasks with metadata
313
+ - `rulebook_task_show` - Show detailed task information
314
+ - Input: `taskId` (string)
315
+ - Output: Complete task details including proposal, tasks, specs
316
+ - `rulebook_task_update` - Update task status or progress
317
+ - Input: `taskId` (string), optional `status`, `progress`
318
+ - Output: Update confirmation
319
+ - `rulebook_task_validate` - Validate task format against OpenSpec requirements
320
+ - Input: `taskId` (string)
321
+ - Output: Validation results with errors and warnings
322
+ - `rulebook_task_archive` - Archive completed task and apply spec deltas
323
+ - Input: `taskId` (string), optional `skipValidation`
324
+ - Output: Archive confirmation with archive path
325
+ - `rulebook_task_delete` - Delete a task permanently
326
+ - Input: `taskId` (string)
327
+ - Output: Deletion confirmation
328
+
329
+ **Total: 7 MCP functions** for complete task lifecycle management.
330
+
331
+ ## Service Integration Templates (20)
332
+
333
+ Rulebook provides comprehensive integration templates for popular backend services, including databases, caches, message queues, and object storage.
334
+
335
+ **Relational Databases**: PostgreSQL • MySQL • MariaDB • SQL Server • Oracle • SQLite
336
+
337
+ **NoSQL Databases**: MongoDB • Cassandra • DynamoDB
338
+
339
+ **Caches**: Redis • Memcached
340
+
341
+ **Search & Analytics**: Elasticsearch
342
+
343
+ **Graph Databases**: Neo4j
344
+
345
+ **Time-Series Databases**: InfluxDB
346
+
347
+ **Message Queues**: RabbitMQ • Kafka
348
+
349
+ **Object Storage**: AWS S3 • Azure Blob Storage • Google Cloud Storage • MinIO
350
+
351
+ ### Automatic Service Detection
352
+
353
+ The CLI automatically detects services in your project by analyzing:
354
+ - **`package.json`**: Database drivers and client libraries (e.g., `pg`, `mongoose`, `redis`, `ioredis`)
355
+ - **`.env` files**: Connection strings and environment variables (e.g., `POSTGRES_*`, `REDIS_*`, `MONGODB_*`)
356
+ - **`docker-compose.yml`**: Service definitions in Docker Compose files
357
+
358
+ ### Service Templates Include
359
+
360
+ Each service template provides:
361
+ - Connection setup and configuration
362
+ - Basic CRUD operations (where applicable)
363
+ - Advanced patterns and best practices
364
+ - Docker Compose examples
365
+ - Environment variable configuration
366
+ - Development and testing integration
367
+ - Common pitfalls and solutions
368
+
369
+ Templates are generated in `/rulebook/[SERVICE].md` and referenced in `AGENTS.md` for easy access during development.
370
+
371
+ **Server Details:**
372
+ - **Transport**: stdio only - stdout contains ONLY JSON-RPC 2.0 messages
373
+ - **Configuration**: Loaded from `.rulebook` file automatically
374
+ - **Project Detection**: Finds `.rulebook` by walking up directories (like git)
375
+ - **Protocol**: MCP over stdio (MCP-compliant, no stdout pollution)
376
+
377
+ **Configuration:**
378
+
379
+ The MCP server configuration lives in your `.rulebook` file:
380
+
381
+ ```json
382
+ {
383
+ "mcp": {
384
+ "enabled": true,
385
+ "tasksDir": "rulebook/tasks",
386
+ "archiveDir": "rulebook/archive"
387
+ }
388
+ }
389
+ ```
390
+
391
+ **Note:** The server uses stdio transport only (no configuration needed).
392
+
393
+ **Cursor Configuration (`.cursor/mcp.json`):**
394
+
395
+ After running `rulebook mcp init`, your `.cursor/mcp.json` will be automatically configured:
396
+
397
+ ```json
398
+ {
399
+ "mcpServers": {
400
+ "rulebook": {
401
+ "command": "npx",
402
+ "args": ["-y", "@hivehub/rulebook@latest", "mcp-server"]
403
+ }
404
+ }
405
+ }
406
+ ```
407
+
408
+ That's it! No need for `--project-root`, `--port`, or environment variables. The server automatically:
409
+ - Finds your `.rulebook` file by walking up directories
410
+ - Uses the `mcp` configuration from `.rulebook`
411
+ - Works from any subdirectory in your project
412
+
413
+ **Manual Override (if needed):**
414
+
415
+ If you need to override the `.rulebook` location:
416
+
417
+ ```json
418
+ {
419
+ "mcpServers": {
420
+ "rulebook": {
421
+ "command": "npx",
422
+ "args": ["-y", "@hivehub/rulebook@latest", "mcp-server"],
423
+ "env": {
424
+ "RULEBOOK_CONFIG": "/path/to/.rulebook"
425
+ }
426
+ }
427
+ }
428
+ }
429
+ ```
430
+
431
+ **Note:** After running `rulebook mcp init` or updating `.cursor/mcp.json`, restart Cursor for the changes to take effect.
432
+
433
+ **Troubleshooting:**
434
+
435
+ ### Server Not Starting
436
+
437
+ If the MCP server fails to start:
438
+
439
+ 1. **Verify `.rulebook` exists**: Run `rulebook mcp init` in your project root
440
+ 2. **Check Node.js version**: Requires Node.js 20+ (`node --version`)
441
+ 3. **Verify MCP configuration**: Check that `.cursor/mcp.json` exists and is valid JSON
442
+ 4. **Debug mode**: Set `RULEBOOK_MCP_DEBUG=1` to see debug logs in stderr:
443
+ ```bash
444
+ RULEBOOK_MCP_DEBUG=1 npx @hivehub/rulebook@latest mcp-server
445
+ ```
446
+
447
+ ### Empty Schemas or Missing Parameters
448
+
449
+ If tools don't show descriptions or parameters:
450
+
451
+ 1. **Clear npm cache**:
452
+ ```bash
453
+ # Clear npm cache
454
+ npm cache clean --force
455
+
456
+ # Or clear npx cache specifically
457
+ rm -rf ~/.npm/_npx
458
+ ```
459
+
460
+ 2. **Rebuild the project**:
461
+ ```bash
462
+ npm run build
463
+ ```
464
+
465
+ 3. Restart your MCP client and try again.
466
+
467
+ ### "Unexpected token" or "Invalid JSON" Errors
468
+
469
+ These errors occur when the server outputs non-JSON to stdout. This is fixed in v1.0.9+:
470
+ - Ensure you're using `@hivehub/rulebook@latest` (v1.0.9 or newer)
471
+ - stdout now contains ONLY JSON-RPC 2.0 messages
472
+ - All logs go to stderr (use `RULEBOOK_MCP_DEBUG=1` to see them)
473
+
474
+ ### ".rulebook not found" Error
475
+
476
+ If you see this error:
477
+ 1. Run `rulebook mcp init` in your project root
478
+ 2. Or manually create `.rulebook` file with `mcp` block
479
+ 3. Or set `RULEBOOK_CONFIG` environment variable to point to your `.rulebook` file
480
+
481
+ ### "Received a response for an unknown message ID" Warning
482
+
483
+ If you see this warning in Cursor logs:
484
+ - **This is a cosmetic warning** - it does NOT affect functionality
485
+ - All tools work correctly despite this warning
486
+ - The server is responding correctly with valid JSON-RPC 2.0 messages
487
+ - This is a known issue with Cursor's MCP client ID tracking
488
+ - The warning can be safely ignored - all MCP tools function normally
489
+
490
+ ### "Received a response for an unknown message ID" Warning
491
+
492
+ If you see this warning in the logs:
493
+ - This is usually harmless - the server is working correctly
494
+ - The warning appears during the initial handshake but doesn't affect functionality
495
+ - If you see "Successfully connected to stdio server" after the warning, everything is fine
496
+ - This is a known behavior with some MCP clients and can be safely ignored
497
+
498
+ **Automated Setup:**
499
+
500
+ ```bash
501
+ # Initialize MCP in your project (recommended)
502
+ npx @hivehub/rulebook@latest mcp init
503
+
504
+ # Or use the setup script (for CI/CD)
505
+ npm run setup:mcp
506
+ ```
507
+
508
+ ## AI Tools Supported (23)
509
+
510
+ **IDEs**: Cursor, Windsurf, VS Code, GitHub Copilot, Tabnine, Replit, JetBrains AI, Zed
511
+
512
+ **CLI Agents**: Aider, Continue, Claude, Claude Code, Gemini, Cline, Amazon Q, Auggie, CodeBuddy, Factory, OpenCode, Kilo, Codex, Codeium, Cursor CLI
513
+
514
+ ## Documentation
515
+
516
+ Full documentation available in `/docs`:
517
+ - [Getting Started](docs/guides/GETTING_STARTED.md)
518
+ - [Best Practices](docs/guides/BEST_PRACTICES.md)
519
+ - [CLI Agents](docs/CLI_AGENTS.md)
520
+ - [Roadmap](docs/ROADMAP.md)
521
+ - [Framework Templates](templates/frameworks/)
522
+
523
+ ## Contributing
524
+
525
+ Contributions welcome! Node.js 18+ required.
526
+
527
+ ```bash
528
+ npm install
529
+ npm test
530
+ npm run build
531
+ ```
532
+
533
+ ## License
534
+
535
+ Apache License 2.0 © HiveLLM Team
536
+
537
+ ---
538
+
539
+ **Links**: [Issues](https://github.com/hivellm/rulebook/issues) • [Discussions](https://github.com/hivellm/rulebook/discussions)
@@ -0,0 +1,69 @@
1
+ /**
2
+ * claude-code Stream Parser
3
+ *
4
+ * Parses output from claude-code CLI
5
+ * Command: claude --headless "PROMPT"
6
+ * Output: Stream of text with progress indicators
7
+ */
8
+ export interface ClaudeCodeEvent {
9
+ type: 'progress' | 'text' | 'tool_call' | 'completion' | 'error';
10
+ content: string;
11
+ timestamp: number;
12
+ }
13
+ export interface ParsedResult {
14
+ success: boolean;
15
+ text: string;
16
+ toolCalls: Array<{
17
+ type: 'read' | 'write' | 'bash';
18
+ details: string;
19
+ result?: string;
20
+ }>;
21
+ duration: number;
22
+ sessionId: string;
23
+ }
24
+ /**
25
+ * Parse a single line from claude-code output
26
+ */
27
+ export declare function parseClaudeCodeLine(line: string): ClaudeCodeEvent | null;
28
+ /**
29
+ * Process claude-code stream output with real-time progress
30
+ */
31
+ export declare class ClaudeCodeStreamParser {
32
+ private accumulatedText;
33
+ private toolCalls;
34
+ private sessionId;
35
+ private startTime;
36
+ private toolCount;
37
+ private completed;
38
+ private completionCallback?;
39
+ /**
40
+ * Set callback to be called when completion is detected
41
+ */
42
+ onComplete(callback: () => void): void;
43
+ /**
44
+ * Check if parsing is completed
45
+ */
46
+ isCompleted(): boolean;
47
+ /**
48
+ * Process a single event from the stream
49
+ */
50
+ processEvent(event: ClaudeCodeEvent): void;
51
+ /**
52
+ * Process multiple lines of stream output
53
+ */
54
+ processLines(output: string): void;
55
+ /**
56
+ * Get the final parsed result
57
+ */
58
+ getResult(): ParsedResult;
59
+ private handleProgressEvent;
60
+ private handleTextEvent;
61
+ private handleToolCallEvent;
62
+ private handleCompletionEvent;
63
+ private handleErrorEvent;
64
+ }
65
+ /**
66
+ * Parse complete claude-code output
67
+ */
68
+ export declare function parseClaudeCodeOutput(output: string): ParsedResult;
69
+ //# sourceMappingURL=claude-code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../src/agents/claude-code.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,WAAW,GAAG,YAAY,GAAG,OAAO,CAAC;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,KAAK,CAAC;QACf,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;QAChC,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAmDxE;AAED;;GAEG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,eAAe,CAAM;IAC7B,OAAO,CAAC,SAAS,CAAiC;IAClD,OAAO,CAAC,SAAS,CAA0B;IAC3C,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,kBAAkB,CAAC,CAAa;IAExC;;OAEG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAItC;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;IAoB1C;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAUlC;;OAEG;IACH,SAAS,IAAI,YAAY;IAUzB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,mBAAmB;IAoB3B,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,gBAAgB;CAQzB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAIlE"}