@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
@@ -0,0 +1,184 @@
1
+ <!-- AZURE_BLOB:START -->
2
+ # Azure Blob Storage Instructions
3
+
4
+ **CRITICAL**: Use Azure Blob Storage for object storage, file uploads, static assets, and backup storage in Azure cloud.
5
+
6
+ ## Core Features
7
+
8
+ ### Connection
9
+ ```typescript
10
+ // Using @azure/storage-blob
11
+ import { BlobServiceClient, StorageSharedKeyCredential } from '@azure/storage-blob'
12
+
13
+ const accountName = process.env.AZURE_STORAGE_ACCOUNT_NAME || ''
14
+ const accountKey = process.env.AZURE_STORAGE_ACCOUNT_KEY || ''
15
+
16
+ const sharedKeyCredential = new StorageSharedKeyCredential(accountName, accountKey)
17
+ const blobServiceClient = new BlobServiceClient(
18
+ `https://${accountName}.blob.core.windows.net`,
19
+ sharedKeyCredential
20
+ )
21
+
22
+ const containerClient = blobServiceClient.getContainerClient(
23
+ process.env.AZURE_CONTAINER_NAME || 'mycontainer'
24
+ )
25
+ ```
26
+
27
+ ### Basic Operations
28
+ ```typescript
29
+ // Create container
30
+ await containerClient.createIfNotExists({
31
+ access: 'blob', // 'blob', 'container', or 'private'
32
+ })
33
+
34
+ // Upload blob
35
+ const blockBlobClient = containerClient.getBlockBlobClient('path/to/file.jpg')
36
+ await blockBlobClient.upload(fileBuffer, fileBuffer.length, {
37
+ blobHTTPHeaders: {
38
+ blobContentType: 'image/jpeg',
39
+ },
40
+ metadata: {
41
+ userId: '123',
42
+ originalName: 'photo.jpg',
43
+ },
44
+ })
45
+
46
+ // Download blob
47
+ const downloadResponse = await blockBlobClient.download()
48
+ const fileContent = await streamToBuffer(downloadResponse.readableStreamBody)
49
+
50
+ // Delete blob
51
+ await blockBlobClient.delete()
52
+
53
+ // List blobs
54
+ for await (const blob of containerClient.listBlobsFlat()) {
55
+ console.log(blob.name, blob.properties.contentLength)
56
+ }
57
+ ```
58
+
59
+ ### Advanced Features
60
+ ```typescript
61
+ // Generate SAS URL
62
+ import { generateBlobSASQueryParameters, BlobSASPermissions, StorageSharedKeyCredential } from '@azure/storage-blob'
63
+
64
+ const sasToken = generateBlobSASQueryParameters(
65
+ {
66
+ containerName: 'mycontainer',
67
+ blobName: 'path/to/file.jpg',
68
+ permissions: BlobSASPermissions.parse('r'), // read
69
+ startsOn: new Date(),
70
+ expiresOn: new Date(new Date().valueOf() + 3600 * 1000), // 1 hour
71
+ },
72
+ sharedKeyCredential
73
+ ).toString()
74
+
75
+ const sasUrl = `https://${accountName}.blob.core.windows.net/mycontainer/path/to/file.jpg?${sasToken}`
76
+
77
+ // Copy blob
78
+ const sourceBlobClient = containerClient.getBlockBlobClient('source/file.jpg')
79
+ const destBlobClient = containerClient.getBlockBlobClient('dest/file.jpg')
80
+ await destBlobClient.beginCopyFromURL(sourceBlobClient.url)
81
+
82
+ // Set blob metadata
83
+ await blockBlobClient.setMetadata({
84
+ category: 'profile',
85
+ uploadedBy: 'user-123',
86
+ })
87
+
88
+ // Get blob properties
89
+ const properties = await blockBlobClient.getProperties()
90
+ console.log(properties.contentType, properties.contentLength, properties.metadata)
91
+ ```
92
+
93
+ ## Common Patterns
94
+
95
+ ### File Upload Handler
96
+ ```typescript
97
+ async function uploadFile(file: Buffer, filename: string, userId: string) {
98
+ const blobName = `users/${userId}/${Date.now()}-${filename}`
99
+ const blobClient = containerClient.getBlockBlobClient(blobName)
100
+
101
+ await blobClient.upload(file, file.length, {
102
+ blobHTTPHeaders: {
103
+ blobContentType: getContentType(filename),
104
+ },
105
+ metadata: {
106
+ userId,
107
+ originalName: filename,
108
+ uploadedAt: new Date().toISOString(),
109
+ },
110
+ })
111
+
112
+ return {
113
+ blobName,
114
+ url: blobClient.url,
115
+ }
116
+ }
117
+ ```
118
+
119
+ ### Temporary Access URL
120
+ ```typescript
121
+ async function generateTemporaryUrl(blobName: string, expiresInMinutes: number = 60) {
122
+ const blobClient = containerClient.getBlockBlobClient(blobName)
123
+ const sasToken = generateBlobSASQueryParameters(
124
+ {
125
+ containerName: containerClient.containerName,
126
+ blobName,
127
+ permissions: BlobSASPermissions.parse('r'),
128
+ expiresOn: new Date(Date.now() + expiresInMinutes * 60 * 1000),
129
+ },
130
+ sharedKeyCredential
131
+ ).toString()
132
+
133
+ return `${blobClient.url}?${sasToken}`
134
+ }
135
+ ```
136
+
137
+ ## Best Practices
138
+
139
+ ✅ **DO:**
140
+ - Use appropriate access tiers (Hot, Cool, Archive)
141
+ - Set blob metadata for organization
142
+ - Use SAS tokens for temporary access
143
+ - Implement proper error handling
144
+ - Use appropriate content types
145
+ - Enable soft delete for important data
146
+ - Monitor storage usage and costs
147
+ - Use lifecycle management policies
148
+ - Implement retry logic
149
+ - Use connection strings or managed identity
150
+
151
+ ❌ **DON'T:**
152
+ - Store sensitive data without encryption
153
+ - Use public access unnecessarily
154
+ - Hardcode credentials
155
+ - Ignore error handling
156
+ - Skip content-type validation
157
+ - Ignore lifecycle policies
158
+ - Skip access logging
159
+ - Use default access levels
160
+ - Ignore cost optimization
161
+ - Store large files without chunking
162
+
163
+ ## Configuration
164
+
165
+ ### Environment Variables
166
+ ```bash
167
+ AZURE_STORAGE_ACCOUNT_NAME=myaccount
168
+ AZURE_STORAGE_ACCOUNT_KEY=your-account-key
169
+ AZURE_CONTAINER_NAME=mycontainer
170
+ AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=https;AccountName=...
171
+ ```
172
+
173
+ ### Managed Identity (Recommended)
174
+ ```typescript
175
+ import { DefaultAzureCredential } from '@azure/identity'
176
+
177
+ const blobServiceClient = new BlobServiceClient(
178
+ `https://${accountName}.blob.core.windows.net`,
179
+ new DefaultAzureCredential()
180
+ )
181
+ ```
182
+
183
+ <!-- AZURE_BLOB:END -->
184
+
@@ -0,0 +1,239 @@
1
+ <!-- CASSANDRA:START -->
2
+ # Apache Cassandra Database Instructions
3
+
4
+ **CRITICAL**: Use Cassandra for distributed NoSQL database with high availability, linear scalability, and eventual consistency.
5
+
6
+ ## Core Features
7
+
8
+ ### Connection
9
+ ```typescript
10
+ // Using cassandra-driver
11
+ import { Client } from 'cassandra-driver'
12
+
13
+ const client = new Client({
14
+ contactPoints: (process.env.CASSANDRA_HOSTS || 'localhost').split(','),
15
+ localDataCenter: process.env.CASSANDRA_DATACENTER || 'datacenter1',
16
+ keyspace: process.env.CASSANDRA_KEYSPACE || 'myapp',
17
+ credentials: {
18
+ username: process.env.CASSANDRA_USER || 'cassandra',
19
+ password: process.env.CASSANDRA_PASSWORD || 'cassandra',
20
+ },
21
+ queryOptions: {
22
+ consistency: 1, // ONE, QUORUM, ALL
23
+ prepare: true,
24
+ },
25
+ })
26
+ ```
27
+
28
+ ### Basic Operations
29
+ ```typescript
30
+ // Create keyspace
31
+ await client.execute(`
32
+ CREATE KEYSPACE IF NOT EXISTS myapp
33
+ WITH REPLICATION = {
34
+ 'class': 'SimpleStrategy',
35
+ 'replication_factor': 1
36
+ }
37
+ `)
38
+
39
+ // Use keyspace
40
+ await client.execute('USE myapp')
41
+
42
+ // Create table
43
+ await client.execute(`
44
+ CREATE TABLE IF NOT EXISTS users (
45
+ id UUID PRIMARY KEY,
46
+ email TEXT,
47
+ name TEXT,
48
+ created_at TIMESTAMP
49
+ )
50
+ `)
51
+
52
+ // Create index
53
+ await client.execute('CREATE INDEX IF NOT EXISTS ON users (email)')
54
+
55
+ // Insert
56
+ await client.execute(
57
+ 'INSERT INTO users (id, email, name, created_at) VALUES (?, ?, ?, ?)',
58
+ [cassandra.types.Uuid.random(), 'john@example.com', 'John Doe', new Date()],
59
+ { prepare: true }
60
+ )
61
+
62
+ // Select
63
+ const result = await client.execute(
64
+ 'SELECT * FROM users WHERE id = ?',
65
+ [userId],
66
+ { prepare: true }
67
+ )
68
+ const user = result.first()
69
+
70
+ // Update
71
+ await client.execute(
72
+ 'UPDATE users SET name = ? WHERE id = ?',
73
+ ['Jane Doe', userId],
74
+ { prepare: true }
75
+ )
76
+
77
+ // Delete
78
+ await client.execute(
79
+ 'DELETE FROM users WHERE id = ?',
80
+ [userId],
81
+ { prepare: true }
82
+ )
83
+ ```
84
+
85
+ ### Advanced Features
86
+ ```typescript
87
+ // Batch operations
88
+ const queries = [
89
+ {
90
+ query: 'INSERT INTO users (id, email, name) VALUES (?, ?, ?)',
91
+ params: [id1, 'user1@example.com', 'User 1'],
92
+ },
93
+ {
94
+ query: 'INSERT INTO users (id, email, name) VALUES (?, ?, ?)',
95
+ params: [id2, 'user2@example.com', 'User 2'],
96
+ },
97
+ ]
98
+
99
+ await client.batch(queries, { prepare: true })
100
+
101
+ // Collections
102
+ await client.execute(`
103
+ CREATE TABLE IF NOT EXISTS products (
104
+ id UUID PRIMARY KEY,
105
+ name TEXT,
106
+ tags SET<TEXT>,
107
+ metadata MAP<TEXT, TEXT>
108
+ )
109
+ `)
110
+
111
+ await client.execute(
112
+ 'UPDATE products SET tags = tags + ? WHERE id = ?',
113
+ [['electronics', 'gadgets'], productId],
114
+ { prepare: true }
115
+ )
116
+
117
+ // Time-to-Live (TTL)
118
+ await client.execute(
119
+ 'INSERT INTO sessions (id, data) VALUES (?, ?) USING TTL 3600',
120
+ [sessionId, sessionData],
121
+ { prepare: true }
122
+ )
123
+ ```
124
+
125
+ ## Common Patterns
126
+
127
+ ### Data Modeling
128
+ ```typescript
129
+ // Design tables for query patterns
130
+ // Query: Get users by email
131
+ await client.execute(`
132
+ CREATE TABLE users_by_email (
133
+ email TEXT PRIMARY KEY,
134
+ id UUID,
135
+ name TEXT,
136
+ created_at TIMESTAMP
137
+ )
138
+ `)
139
+
140
+ // Query: Get posts by user and date
141
+ await client.execute(`
142
+ CREATE TABLE posts_by_user (
143
+ user_id UUID,
144
+ created_at TIMESTAMP,
145
+ post_id UUID,
146
+ title TEXT,
147
+ content TEXT,
148
+ PRIMARY KEY (user_id, created_at, post_id)
149
+ ) WITH CLUSTERING ORDER BY (created_at DESC)
150
+ `)
151
+ ```
152
+
153
+ ### Consistency Levels
154
+ ```typescript
155
+ // Read with QUORUM consistency
156
+ const result = await client.execute(
157
+ 'SELECT * FROM users WHERE id = ?',
158
+ [userId],
159
+ {
160
+ consistency: 2, // QUORUM
161
+ prepare: true,
162
+ }
163
+ )
164
+
165
+ // Write with ALL consistency (strongest)
166
+ await client.execute(
167
+ 'INSERT INTO users (id, email, name) VALUES (?, ?, ?)',
168
+ [id, email, name],
169
+ {
170
+ consistency: 3, // ALL
171
+ prepare: true,
172
+ }
173
+ )
174
+ ```
175
+
176
+ ## Best Practices
177
+
178
+ ✅ **DO:**
179
+ - Design tables for query patterns (denormalize)
180
+ - Use appropriate partition keys
181
+ - Use clustering keys for sorting
182
+ - Create secondary indexes sparingly
183
+ - Use prepared statements
184
+ - Set appropriate consistency levels
185
+ - Use TTL for time-based data
186
+ - Monitor cluster health
187
+ - Use batch operations carefully
188
+ - Implement retry logic
189
+
190
+ ❌ **DON'T:**
191
+ - Use secondary indexes on high-cardinality columns
192
+ - Create too many secondary indexes
193
+ - Use ALL consistency for all operations
194
+ - Store large values (> 1MB)
195
+ - Skip error handling
196
+ - Ignore cluster topology
197
+ - Hardcode contact points
198
+ - Use SELECT * in production
199
+ - Ignore data modeling best practices
200
+ - Skip monitoring
201
+
202
+ ## Configuration
203
+
204
+ ### Environment Variables
205
+ ```bash
206
+ CASSANDRA_HOSTS=localhost
207
+ CASSANDRA_HOSTS=node1:9042,node2:9042,node3:9042
208
+ CASSANDRA_DATACENTER=datacenter1
209
+ CASSANDRA_KEYSPACE=myapp
210
+ CASSANDRA_USER=cassandra
211
+ CASSANDRA_PASSWORD=securepassword
212
+ ```
213
+
214
+ ### Docker Compose
215
+ ```yaml
216
+ services:
217
+ cassandra:
218
+ image: cassandra:4
219
+ ports:
220
+ - "9042:9042"
221
+ environment:
222
+ CASSANDRA_CLUSTER_NAME: my-cluster
223
+ CASSANDRA_DC: datacenter1
224
+ CASSANDRA_RACK: rack1
225
+ CASSANDRA_ENDPOINT_SNITCH: GossipingPropertyFileSnitch
226
+ volumes:
227
+ - cassandra_data:/var/lib/cassandra
228
+ healthcheck:
229
+ test: ["CMD-SHELL", "nodetool status | grep -E '^UN' || exit 1"]
230
+ interval: 30s
231
+ timeout: 10s
232
+ retries: 5
233
+
234
+ volumes:
235
+ cassandra_data:
236
+ ```
237
+
238
+ <!-- CASSANDRA:END -->
239
+
@@ -0,0 +1,308 @@
1
+ <!-- DYNAMODB:START -->
2
+ # AWS DynamoDB Instructions
3
+
4
+ **CRITICAL**: Use DynamoDB for serverless NoSQL database with automatic scaling, high performance, and pay-per-use pricing.
5
+
6
+ ## Core Features
7
+
8
+ ### Connection
9
+ ```typescript
10
+ // Using @aws-sdk/client-dynamodb
11
+ import { DynamoDBClient } from '@aws-sdk/client-dynamodb'
12
+ import { DynamoDBDocumentClient, PutCommand, GetCommand, QueryCommand, ScanCommand } from '@aws-sdk/lib-dynamodb'
13
+
14
+ const client = new DynamoDBClient({
15
+ region: process.env.AWS_REGION || 'us-east-1',
16
+ credentials: {
17
+ accessKeyId: process.env.AWS_ACCESS_KEY_ID || '',
18
+ secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || '',
19
+ },
20
+ })
21
+
22
+ const docClient = DynamoDBDocumentClient.from(client)
23
+
24
+ // Using AWS SDK v2
25
+ import AWS from 'aws-sdk'
26
+
27
+ const dynamodb = new AWS.DynamoDB.DocumentClient({
28
+ region: process.env.AWS_REGION || 'us-east-1',
29
+ accessKeyId: process.env.AWS_ACCESS_KEY_ID,
30
+ secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
31
+ })
32
+ ```
33
+
34
+ ### Basic Operations
35
+ ```typescript
36
+ // Put item
37
+ await docClient.send(new PutCommand({
38
+ TableName: 'Users',
39
+ Item: {
40
+ id: 'user-1',
41
+ email: 'john@example.com',
42
+ name: 'John Doe',
43
+ createdAt: new Date().toISOString(),
44
+ },
45
+ }))
46
+
47
+ // Get item
48
+ const result = await docClient.send(new GetCommand({
49
+ TableName: 'Users',
50
+ Key: {
51
+ id: 'user-1',
52
+ },
53
+ }))
54
+ const user = result.Item
55
+
56
+ // Update item
57
+ await docClient.send(new UpdateCommand({
58
+ TableName: 'Users',
59
+ Key: { id: 'user-1' },
60
+ UpdateExpression: 'SET #name = :name, updatedAt = :updatedAt',
61
+ ExpressionAttributeNames: {
62
+ '#name': 'name',
63
+ },
64
+ ExpressionAttributeValues: {
65
+ ':name': 'Jane Doe',
66
+ ':updatedAt': new Date().toISOString(),
67
+ },
68
+ }))
69
+
70
+ // Delete item
71
+ await docClient.send(new DeleteCommand({
72
+ TableName: 'Users',
73
+ Key: { id: 'user-1' },
74
+ }))
75
+ ```
76
+
77
+ ### Query Operations
78
+ ```typescript
79
+ // Query by partition key
80
+ const result = await docClient.send(new QueryCommand({
81
+ TableName: 'Posts',
82
+ KeyConditionExpression: 'userId = :userId',
83
+ ExpressionAttributeValues: {
84
+ ':userId': 'user-1',
85
+ },
86
+ ScanIndexForward: false, // Sort descending
87
+ Limit: 10,
88
+ }))
89
+
90
+ // Query with GSI (Global Secondary Index)
91
+ const result = await docClient.send(new QueryCommand({
92
+ TableName: 'Users',
93
+ IndexName: 'EmailIndex',
94
+ KeyConditionExpression: 'email = :email',
95
+ ExpressionAttributeValues: {
96
+ ':email': 'john@example.com',
97
+ },
98
+ }))
99
+
100
+ // Scan (use sparingly)
101
+ const result = await docClient.send(new ScanCommand({
102
+ TableName: 'Users',
103
+ FilterExpression: '#status = :status',
104
+ ExpressionAttributeNames: {
105
+ '#status': 'status',
106
+ },
107
+ ExpressionAttributeValues: {
108
+ ':status': 'active',
109
+ },
110
+ Limit: 100,
111
+ }))
112
+ ```
113
+
114
+ ### Advanced Features
115
+ ```typescript
116
+ // Batch operations
117
+ import { BatchWriteCommand } from '@aws-sdk/lib-dynamodb'
118
+
119
+ await docClient.send(new BatchWriteCommand({
120
+ RequestItems: {
121
+ Users: [
122
+ {
123
+ PutRequest: {
124
+ Item: { id: 'user-1', name: 'User 1' },
125
+ },
126
+ },
127
+ {
128
+ PutRequest: {
129
+ Item: { id: 'user-2', name: 'User 2' },
130
+ },
131
+ },
132
+ ],
133
+ },
134
+ }))
135
+
136
+ // Transactions
137
+ import { TransactWriteCommand } from '@aws-sdk/lib-dynamodb'
138
+
139
+ await docClient.send(new TransactWriteCommand({
140
+ TransactItems: [
141
+ {
142
+ Put: {
143
+ TableName: 'Accounts',
144
+ Item: { userId: 'user-1', balance: 1000 },
145
+ },
146
+ },
147
+ {
148
+ Put: {
149
+ TableName: 'Transactions',
150
+ Item: { id: 'tx-1', userId: 'user-1', amount: 1000 },
151
+ },
152
+ },
153
+ ],
154
+ }))
155
+
156
+ // Conditional writes
157
+ await docClient.send(new PutCommand({
158
+ TableName: 'Users',
159
+ Item: { id: 'user-1', email: 'john@example.com' },
160
+ ConditionExpression: 'attribute_not_exists(id)',
161
+ }))
162
+ ```
163
+
164
+ ## Common Patterns
165
+
166
+ ### Single Table Design
167
+ ```typescript
168
+ // Store different entity types in one table
169
+ await docClient.send(new PutCommand({
170
+ TableName: 'AppData',
171
+ Item: {
172
+ PK: 'USER#user-1',
173
+ SK: 'METADATA',
174
+ EntityType: 'User',
175
+ email: 'john@example.com',
176
+ name: 'John Doe',
177
+ },
178
+ }))
179
+
180
+ await docClient.send(new PutCommand({
181
+ TableName: 'AppData',
182
+ Item: {
183
+ PK: 'USER#user-1',
184
+ SK: 'POST#post-1',
185
+ EntityType: 'Post',
186
+ title: 'My Post',
187
+ content: 'Content here',
188
+ },
189
+ }))
190
+
191
+ // Query all posts for a user
192
+ const result = await docClient.send(new QueryCommand({
193
+ TableName: 'AppData',
194
+ KeyConditionExpression: 'PK = :pk AND begins_with(SK, :sk)',
195
+ ExpressionAttributeValues: {
196
+ ':pk': 'USER#user-1',
197
+ ':sk': 'POST#',
198
+ },
199
+ }))
200
+ ```
201
+
202
+ ### Time-to-Live (TTL)
203
+ ```typescript
204
+ // Items automatically deleted after TTL
205
+ await docClient.send(new PutCommand({
206
+ TableName: 'Sessions',
207
+ Item: {
208
+ sessionId: 'session-1',
209
+ userId: 'user-1',
210
+ ttl: Math.floor(Date.now() / 1000) + 3600, // 1 hour from now
211
+ },
212
+ }))
213
+ ```
214
+
215
+ ## Best Practices
216
+
217
+ ✅ **DO:**
218
+ - Design for access patterns
219
+ - Use appropriate partition keys
220
+ - Create GSIs for alternative access patterns
221
+ - Use batch operations when possible
222
+ - Implement exponential backoff for throttling
223
+ - Use TTL for temporary data
224
+ - Monitor provisioned capacity
225
+ - Use transactions for atomic operations
226
+ - Implement proper error handling
227
+ - Use single table design when appropriate
228
+
229
+ ❌ **DON'T:**
230
+ - Use Scan for frequent queries
231
+ - Create too many GSIs (affects write performance)
232
+ - Store large items (> 400KB)
233
+ - Ignore throttling errors
234
+ - Hardcode table names
235
+ - Skip error handling
236
+ - Use eventually consistent reads when strong consistency needed
237
+ - Ignore capacity planning
238
+ - Store sensitive data without encryption
239
+ - Skip monitoring
240
+
241
+ ## Configuration
242
+
243
+ ### Environment Variables
244
+ ```bash
245
+ AWS_REGION=us-east-1
246
+ AWS_ACCESS_KEY_ID=your-access-key
247
+ AWS_SECRET_ACCESS_KEY=your-secret-key
248
+ DYNAMODB_TABLE_PREFIX=myapp_
249
+ ```
250
+
251
+ ### IAM Policy
252
+ ```json
253
+ {
254
+ "Version": "2012-10-17",
255
+ "Statement": [
256
+ {
257
+ "Effect": "Allow",
258
+ "Action": [
259
+ "dynamodb:PutItem",
260
+ "dynamodb:GetItem",
261
+ "dynamodb:UpdateItem",
262
+ "dynamodb:DeleteItem",
263
+ "dynamodb:Query",
264
+ "dynamodb:Scan"
265
+ ],
266
+ "Resource": "arn:aws:dynamodb:*:*:table/myapp-*"
267
+ }
268
+ ]
269
+ }
270
+ ```
271
+
272
+ ## Integration with Development
273
+
274
+ ### Testing
275
+ ```typescript
276
+ // Use DynamoDB Local
277
+ const localClient = new DynamoDBClient({
278
+ endpoint: 'http://localhost:8000',
279
+ region: 'local',
280
+ credentials: {
281
+ accessKeyId: 'local',
282
+ secretAccessKey: 'local',
283
+ },
284
+ })
285
+
286
+ // Clean up after tests
287
+ afterEach(async () => {
288
+ // Delete test items or use separate test table
289
+ })
290
+ ```
291
+
292
+ ### Health Checks
293
+ ```typescript
294
+ async function checkDynamoDBHealth(): Promise<boolean> {
295
+ try {
296
+ await docClient.send(new GetCommand({
297
+ TableName: 'HealthCheck',
298
+ Key: { id: 'health' },
299
+ }))
300
+ return true
301
+ } catch {
302
+ return false
303
+ }
304
+ }
305
+ ```
306
+
307
+ <!-- DYNAMODB:END -->
308
+