@trieungoctam/vibekit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (352) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +85 -0
  3. package/agents/debugger.md +158 -0
  4. package/agents/docs-manager.md +220 -0
  5. package/agents/planner.md +129 -0
  6. package/agents/researcher.md +58 -0
  7. package/agents/reviewer.md +152 -0
  8. package/agents/tester.md +126 -0
  9. package/bin/vibekit.js +18 -0
  10. package/hooks/lib/ck-config-utils.cjs +831 -0
  11. package/hooks/lib/colors.cjs +95 -0
  12. package/hooks/lib/config-counter.cjs +103 -0
  13. package/hooks/lib/context-builder.cjs +616 -0
  14. package/hooks/lib/git-info-cache.cjs +143 -0
  15. package/hooks/lib/hook-logger.cjs +92 -0
  16. package/hooks/lib/privacy-checker.cjs +297 -0
  17. package/hooks/lib/project-detector.cjs +474 -0
  18. package/hooks/lib/scout-checker.cjs +263 -0
  19. package/hooks/lib/transcript-parser.cjs +181 -0
  20. package/hooks/post-edit-simplify-reminder.cjs +156 -0
  21. package/hooks/privacy-block.cjs +166 -0
  22. package/hooks/scout-block.cjs +147 -0
  23. package/hooks/session-init.cjs +360 -0
  24. package/package.json +41 -0
  25. package/rules/development-rules.md +52 -0
  26. package/rules/documentation-management.md +121 -0
  27. package/rules/orchestration-protocol.md +43 -0
  28. package/rules/primary-workflow.md +57 -0
  29. package/rules/team-coordination-rules.md +90 -0
  30. package/skills/ai/agent-browser/SKILL.md +294 -0
  31. package/skills/ai/agent-browser/references/.gitkeep +0 -0
  32. package/skills/ai/agent-browser/references/agent-browser-vs-chrome-devtools.md +112 -0
  33. package/skills/ai/agent-browser/references/browserbase-cloud-setup.md +161 -0
  34. package/skills/ai/ai-artist/SKILL.md +122 -0
  35. package/skills/ai/ai-artist/data/awesome-prompts.csv +3592 -0
  36. package/skills/ai/ai-artist/data/lighting.csv +19 -0
  37. package/skills/ai/ai-artist/data/nano-banana-templates.csv +17 -0
  38. package/skills/ai/ai-artist/data/platforms.csv +11 -0
  39. package/skills/ai/ai-artist/data/styles.csv +26 -0
  40. package/skills/ai/ai-artist/data/techniques.csv +19 -0
  41. package/skills/ai/ai-artist/data/use-cases.csv +16 -0
  42. package/skills/ai/ai-artist/references/advanced-techniques.md +184 -0
  43. package/skills/ai/ai-artist/references/awesome-nano-banana-pro-prompts.md +8575 -0
  44. package/skills/ai/ai-artist/references/domain-code.md +66 -0
  45. package/skills/ai/ai-artist/references/domain-data.md +72 -0
  46. package/skills/ai/ai-artist/references/domain-marketing.md +66 -0
  47. package/skills/ai/ai-artist/references/domain-patterns.md +33 -0
  48. package/skills/ai/ai-artist/references/domain-writing.md +68 -0
  49. package/skills/ai/ai-artist/references/image-prompting.md +141 -0
  50. package/skills/ai/ai-artist/references/llm-prompting.md +165 -0
  51. package/skills/ai/ai-artist/references/nano-banana.md +136 -0
  52. package/skills/ai/ai-artist/references/reasoning-techniques.md +201 -0
  53. package/skills/ai/ai-artist/references/validation-workflow.md +117 -0
  54. package/skills/ai/ai-artist/scripts/core.py +197 -0
  55. package/skills/ai/ai-artist/scripts/extract_prompts.py +102 -0
  56. package/skills/ai/ai-artist/scripts/generate.py +370 -0
  57. package/skills/ai/ai-artist/scripts/search.py +147 -0
  58. package/skills/ai/ai-multimodal/.env.example +204 -0
  59. package/skills/ai/ai-multimodal/SKILL.md +110 -0
  60. package/skills/ai/ai-multimodal/references/audio-processing.md +387 -0
  61. package/skills/ai/ai-multimodal/references/image-generation.md +939 -0
  62. package/skills/ai/ai-multimodal/references/music-generation.md +311 -0
  63. package/skills/ai/ai-multimodal/references/video-analysis.md +515 -0
  64. package/skills/ai/ai-multimodal/references/video-generation.md +457 -0
  65. package/skills/ai/ai-multimodal/references/vision-understanding.md +492 -0
  66. package/skills/ai/ai-multimodal/scripts/.coverage +0 -0
  67. package/skills/ai/ai-multimodal/scripts/check_setup.py +315 -0
  68. package/skills/ai/ai-multimodal/scripts/document_converter.py +395 -0
  69. package/skills/ai/ai-multimodal/scripts/gemini_batch_process.py +1185 -0
  70. package/skills/ai/ai-multimodal/scripts/media_optimizer.py +506 -0
  71. package/skills/ai/ai-multimodal/scripts/requirements.txt +26 -0
  72. package/skills/ai/ai-multimodal/scripts/tests/.coverage +0 -0
  73. package/skills/ai/ai-multimodal/scripts/tests/requirements.txt +20 -0
  74. package/skills/ai/ai-multimodal/scripts/tests/test_document_converter.py +74 -0
  75. package/skills/ai/ai-multimodal/scripts/tests/test_gemini_batch_process.py +362 -0
  76. package/skills/ai/ai-multimodal/scripts/tests/test_media_optimizer.py +373 -0
  77. package/skills/ai/mcp-management/README.md +219 -0
  78. package/skills/ai/mcp-management/SKILL.md +210 -0
  79. package/skills/ai/mcp-management/assets/tools.json +3146 -0
  80. package/skills/ai/mcp-management/references/configuration.md +114 -0
  81. package/skills/ai/mcp-management/references/gemini-cli-integration.md +221 -0
  82. package/skills/ai/mcp-management/references/mcp-protocol.md +116 -0
  83. package/skills/ai/mcp-management/scripts/.env.example +10 -0
  84. package/skills/ai/mcp-management/scripts/cli.ts +195 -0
  85. package/skills/ai/mcp-management/scripts/dist/analyze-tools.js +70 -0
  86. package/skills/ai/mcp-management/scripts/dist/cli.js +160 -0
  87. package/skills/ai/mcp-management/scripts/dist/mcp-client.js +183 -0
  88. package/skills/ai/mcp-management/scripts/mcp-client.ts +230 -0
  89. package/skills/ai/mcp-management/scripts/package.json +20 -0
  90. package/skills/ai/mcp-management/scripts/tsconfig.json +15 -0
  91. package/skills/core/brainstorm/SKILL.md +164 -0
  92. package/skills/core/brainstorm/scripts/frame-template.html +214 -0
  93. package/skills/core/brainstorm/scripts/helper.js +88 -0
  94. package/skills/core/brainstorm/scripts/server.cjs +338 -0
  95. package/skills/core/brainstorm/scripts/start-server.sh +153 -0
  96. package/skills/core/brainstorm/scripts/stop-server.sh +55 -0
  97. package/skills/core/brainstorm/spec-document-reviewer-prompt.md +49 -0
  98. package/skills/core/brainstorm/visual-companion.md +286 -0
  99. package/skills/core/code-review/SKILL.md +147 -0
  100. package/skills/core/code-review/references/code-review-reception.md +113 -0
  101. package/skills/core/code-review/references/codebase-scan-workflow.md +29 -0
  102. package/skills/core/code-review/references/edge-case-scouting.md +119 -0
  103. package/skills/core/code-review/references/parallel-review-workflow.md +69 -0
  104. package/skills/core/code-review/references/requesting-code-review.md +116 -0
  105. package/skills/core/code-review/references/task-management-reviews.md +140 -0
  106. package/skills/core/code-review/references/verification-before-completion.md +139 -0
  107. package/skills/core/cook/README.md +86 -0
  108. package/skills/core/cook/SKILL.md +113 -0
  109. package/skills/core/cook/references/intent-detection.md +101 -0
  110. package/skills/core/cook/references/review-cycle.md +75 -0
  111. package/skills/core/cook/references/subagent-patterns.md +75 -0
  112. package/skills/core/cook/references/workflow-steps.md +172 -0
  113. package/skills/core/debug/SKILL.md +121 -0
  114. package/skills/core/debug/references/defense-in-depth.md +124 -0
  115. package/skills/core/debug/references/frontend-verification.md +103 -0
  116. package/skills/core/debug/references/investigation-methodology.md +101 -0
  117. package/skills/core/debug/references/log-and-ci-analysis.md +97 -0
  118. package/skills/core/debug/references/performance-diagnostics.md +113 -0
  119. package/skills/core/debug/references/reporting-standards.md +122 -0
  120. package/skills/core/debug/references/root-cause-tracing.md +122 -0
  121. package/skills/core/debug/references/systematic-debugging.md +102 -0
  122. package/skills/core/debug/references/task-management-debugging.md +155 -0
  123. package/skills/core/debug/references/verification.md +123 -0
  124. package/skills/core/debug/scripts/find-polluter.sh +63 -0
  125. package/skills/core/debug/scripts/find-polluter.test.md +102 -0
  126. package/skills/core/execute/SKILL.md +70 -0
  127. package/skills/core/fix/SKILL.md +111 -0
  128. package/skills/core/fix/references/complexity-assessment.md +72 -0
  129. package/skills/core/fix/references/mode-selection.md +46 -0
  130. package/skills/core/fix/references/parallel-exploration.md +100 -0
  131. package/skills/core/fix/references/review-cycle.md +77 -0
  132. package/skills/core/fix/references/skill-activation-matrix.md +78 -0
  133. package/skills/core/fix/references/task-orchestration.md +103 -0
  134. package/skills/core/fix/references/workflow-ci.md +28 -0
  135. package/skills/core/fix/references/workflow-deep.md +122 -0
  136. package/skills/core/fix/references/workflow-logs.md +72 -0
  137. package/skills/core/fix/references/workflow-quick.md +59 -0
  138. package/skills/core/fix/references/workflow-standard.md +111 -0
  139. package/skills/core/fix/references/workflow-test.md +75 -0
  140. package/skills/core/fix/references/workflow-types.md +33 -0
  141. package/skills/core/fix/references/workflow-ui.md +75 -0
  142. package/skills/core/plan/SKILL.md +145 -0
  143. package/skills/core/plan/plan-document-reviewer-prompt.md +49 -0
  144. package/skills/core/subagent-dev/SKILL.md +277 -0
  145. package/skills/core/subagent-dev/code-quality-reviewer-prompt.md +26 -0
  146. package/skills/core/subagent-dev/implementer-prompt.md +113 -0
  147. package/skills/core/subagent-dev/spec-reviewer-prompt.md +61 -0
  148. package/skills/core/tdd/SKILL.md +371 -0
  149. package/skills/core/tdd/testing-anti-patterns.md +299 -0
  150. package/skills/core/test/SKILL.md +109 -0
  151. package/skills/core/test/references/report-format.md +58 -0
  152. package/skills/core/test/references/test-execution-workflow.md +103 -0
  153. package/skills/core/test/references/ui-testing-workflow.md +65 -0
  154. package/skills/core/verify/SKILL.md +139 -0
  155. package/skills/dev/backend-dev/SKILL.md +96 -0
  156. package/skills/dev/backend-dev/references/backend-api-design.md +495 -0
  157. package/skills/dev/backend-dev/references/backend-architecture.md +454 -0
  158. package/skills/dev/backend-dev/references/backend-authentication.md +338 -0
  159. package/skills/dev/backend-dev/references/backend-code-quality.md +659 -0
  160. package/skills/dev/backend-dev/references/backend-debugging.md +904 -0
  161. package/skills/dev/backend-dev/references/backend-devops.md +494 -0
  162. package/skills/dev/backend-dev/references/backend-mindset.md +387 -0
  163. package/skills/dev/backend-dev/references/backend-performance.md +397 -0
  164. package/skills/dev/backend-dev/references/backend-security.md +290 -0
  165. package/skills/dev/backend-dev/references/backend-technologies.md +256 -0
  166. package/skills/dev/backend-dev/references/backend-testing.md +429 -0
  167. package/skills/dev/context-engineering/SKILL.md +108 -0
  168. package/skills/dev/context-engineering/references/context-compression.md +84 -0
  169. package/skills/dev/context-engineering/references/context-degradation.md +93 -0
  170. package/skills/dev/context-engineering/references/context-fundamentals.md +75 -0
  171. package/skills/dev/context-engineering/references/context-optimization.md +82 -0
  172. package/skills/dev/context-engineering/references/evaluation.md +89 -0
  173. package/skills/dev/context-engineering/references/memory-systems.md +88 -0
  174. package/skills/dev/context-engineering/references/multi-agent-patterns.md +90 -0
  175. package/skills/dev/context-engineering/references/project-development.md +97 -0
  176. package/skills/dev/context-engineering/references/runtime-awareness.md +202 -0
  177. package/skills/dev/context-engineering/references/tool-design.md +86 -0
  178. package/skills/dev/context-engineering/scripts/compression_evaluator.py +349 -0
  179. package/skills/dev/context-engineering/scripts/context_analyzer.py +317 -0
  180. package/skills/dev/context-engineering/scripts/tests/test_edge_cases.py +246 -0
  181. package/skills/dev/databases/SKILL.md +84 -0
  182. package/skills/dev/databases/analytics.md +198 -0
  183. package/skills/dev/databases/db-design.md +188 -0
  184. package/skills/dev/databases/incremental-etl.md +213 -0
  185. package/skills/dev/databases/references/mongodb-aggregation.md +447 -0
  186. package/skills/dev/databases/references/mongodb-atlas.md +465 -0
  187. package/skills/dev/databases/references/mongodb-crud.md +408 -0
  188. package/skills/dev/databases/references/mongodb-indexing.md +442 -0
  189. package/skills/dev/databases/references/postgresql-administration.md +594 -0
  190. package/skills/dev/databases/references/postgresql-performance.md +527 -0
  191. package/skills/dev/databases/references/postgresql-psql-cli.md +467 -0
  192. package/skills/dev/databases/references/postgresql-queries.md +475 -0
  193. package/skills/dev/databases/scripts/.coverage +0 -0
  194. package/skills/dev/databases/scripts/db_backup.py +502 -0
  195. package/skills/dev/databases/scripts/db_migrate.py +426 -0
  196. package/skills/dev/databases/scripts/db_performance_check.py +457 -0
  197. package/skills/dev/databases/scripts/requirements.txt +20 -0
  198. package/skills/dev/databases/scripts/tests/coverage-db.json +1 -0
  199. package/skills/dev/databases/scripts/tests/requirements.txt +4 -0
  200. package/skills/dev/databases/scripts/tests/test_db_backup.py +340 -0
  201. package/skills/dev/databases/scripts/tests/test_db_migrate.py +277 -0
  202. package/skills/dev/databases/scripts/tests/test_db_performance_check.py +370 -0
  203. package/skills/dev/databases/stacks/bigquery.md +231 -0
  204. package/skills/dev/databases/stacks/d1_cloudflare.md +137 -0
  205. package/skills/dev/databases/stacks/mysql.md +216 -0
  206. package/skills/dev/databases/stacks/postgres.md +235 -0
  207. package/skills/dev/databases/stacks/sqlite.md +244 -0
  208. package/skills/dev/databases/transactional.md +176 -0
  209. package/skills/dev/devops/.env.example +76 -0
  210. package/skills/dev/devops/SKILL.md +97 -0
  211. package/skills/dev/devops/references/browser-rendering.md +305 -0
  212. package/skills/dev/devops/references/cloudflare-d1-kv.md +123 -0
  213. package/skills/dev/devops/references/cloudflare-platform.md +271 -0
  214. package/skills/dev/devops/references/cloudflare-r2-storage.md +280 -0
  215. package/skills/dev/devops/references/cloudflare-workers-advanced.md +312 -0
  216. package/skills/dev/devops/references/cloudflare-workers-apis.md +309 -0
  217. package/skills/dev/devops/references/cloudflare-workers-basics.md +418 -0
  218. package/skills/dev/devops/references/docker-basics.md +297 -0
  219. package/skills/dev/devops/references/docker-compose.md +292 -0
  220. package/skills/dev/devops/references/gcloud-platform.md +297 -0
  221. package/skills/dev/devops/references/gcloud-services.md +304 -0
  222. package/skills/dev/devops/references/kubernetes-basics.md +99 -0
  223. package/skills/dev/devops/references/kubernetes-helm-advanced.md +75 -0
  224. package/skills/dev/devops/references/kubernetes-helm.md +81 -0
  225. package/skills/dev/devops/references/kubernetes-kubectl.md +74 -0
  226. package/skills/dev/devops/references/kubernetes-security-advanced.md +98 -0
  227. package/skills/dev/devops/references/kubernetes-security.md +95 -0
  228. package/skills/dev/devops/references/kubernetes-troubleshooting-advanced.md +74 -0
  229. package/skills/dev/devops/references/kubernetes-troubleshooting.md +49 -0
  230. package/skills/dev/devops/references/kubernetes-workflows-advanced.md +75 -0
  231. package/skills/dev/devops/references/kubernetes-workflows.md +78 -0
  232. package/skills/dev/devops/scripts/cloudflare_deploy.py +269 -0
  233. package/skills/dev/devops/scripts/docker_optimize.py +332 -0
  234. package/skills/dev/devops/scripts/requirements.txt +20 -0
  235. package/skills/dev/devops/scripts/tests/requirements.txt +3 -0
  236. package/skills/dev/devops/scripts/tests/test_cloudflare_deploy.py +285 -0
  237. package/skills/dev/devops/scripts/tests/test_docker_optimize.py +436 -0
  238. package/skills/dev/frontend-design/SKILL.md +78 -0
  239. package/skills/dev/frontend-design/references/ai-multimodal-overview.md +165 -0
  240. package/skills/dev/frontend-design/references/analysis-best-practices.md +80 -0
  241. package/skills/dev/frontend-design/references/analysis-prompts.md +141 -0
  242. package/skills/dev/frontend-design/references/analysis-techniques.md +118 -0
  243. package/skills/dev/frontend-design/references/animejs.md +396 -0
  244. package/skills/dev/frontend-design/references/asset-generation.md +337 -0
  245. package/skills/dev/frontend-design/references/design-extraction-overview.md +71 -0
  246. package/skills/dev/frontend-design/references/extraction-best-practices.md +141 -0
  247. package/skills/dev/frontend-design/references/extraction-output-templates.md +162 -0
  248. package/skills/dev/frontend-design/references/extraction-prompts.md +127 -0
  249. package/skills/dev/frontend-design/references/technical-accessibility.md +119 -0
  250. package/skills/dev/frontend-design/references/technical-best-practices.md +97 -0
  251. package/skills/dev/frontend-design/references/technical-optimization.md +44 -0
  252. package/skills/dev/frontend-design/references/technical-overview.md +90 -0
  253. package/skills/dev/frontend-design/references/technical-workflows.md +150 -0
  254. package/skills/dev/frontend-design/references/visual-analysis-overview.md +95 -0
  255. package/skills/dev/frontend-design/references/workflow-3d.md +102 -0
  256. package/skills/dev/frontend-design/references/workflow-describe.md +87 -0
  257. package/skills/dev/frontend-design/references/workflow-immersive.md +87 -0
  258. package/skills/dev/frontend-design/references/workflow-quick.md +57 -0
  259. package/skills/dev/frontend-design/references/workflow-screenshot.md +63 -0
  260. package/skills/dev/frontend-design/references/workflow-video.md +74 -0
  261. package/skills/dev/frontend-dev/SKILL.md +400 -0
  262. package/skills/dev/frontend-dev/resources/common-patterns.md +331 -0
  263. package/skills/dev/frontend-dev/resources/complete-examples.md +872 -0
  264. package/skills/dev/frontend-dev/resources/component-patterns.md +502 -0
  265. package/skills/dev/frontend-dev/resources/data-fetching.md +767 -0
  266. package/skills/dev/frontend-dev/resources/file-organization.md +502 -0
  267. package/skills/dev/frontend-dev/resources/loading-and-error-states.md +501 -0
  268. package/skills/dev/frontend-dev/resources/performance.md +406 -0
  269. package/skills/dev/frontend-dev/resources/routing-guide.md +364 -0
  270. package/skills/dev/frontend-dev/resources/styling-guide.md +428 -0
  271. package/skills/dev/frontend-dev/resources/typescript-standards.md +418 -0
  272. package/skills/dev/git/SKILL.md +114 -0
  273. package/skills/dev/git/references/branch-management.md +88 -0
  274. package/skills/dev/git/references/commit-standards.md +46 -0
  275. package/skills/dev/git/references/gh-cli-guide.md +109 -0
  276. package/skills/dev/git/references/safety-protocols.md +69 -0
  277. package/skills/dev/git/references/workflow-commit.md +58 -0
  278. package/skills/dev/git/references/workflow-merge.md +48 -0
  279. package/skills/dev/git/references/workflow-pr.md +58 -0
  280. package/skills/dev/git/references/workflow-push.md +52 -0
  281. package/skills/dev/git-worktree/SKILL.md +218 -0
  282. package/skills/utils/ask/SKILL.md +58 -0
  283. package/skills/utils/bootstrap/SKILL.md +101 -0
  284. package/skills/utils/bootstrap/references/shared-phases.md +59 -0
  285. package/skills/utils/bootstrap/references/workflow-auto.md +52 -0
  286. package/skills/utils/bootstrap/references/workflow-fast.md +50 -0
  287. package/skills/utils/bootstrap/references/workflow-full.md +60 -0
  288. package/skills/utils/bootstrap/references/workflow-parallel.md +59 -0
  289. package/skills/utils/ck-help/SKILL.md +102 -0
  290. package/skills/utils/ck-help/scripts/ck-help.py +1321 -0
  291. package/skills/utils/ck-help/scripts/commands_data.yaml +3 -0
  292. package/skills/utils/ck-help/scripts/skills_data.yaml +593 -0
  293. package/skills/utils/copywriting/SKILL.md +94 -0
  294. package/skills/utils/copywriting/references/copy-formulas.md +150 -0
  295. package/skills/utils/copywriting/references/cta-patterns.md +168 -0
  296. package/skills/utils/copywriting/references/email-copy.md +193 -0
  297. package/skills/utils/copywriting/references/headline-templates.md +140 -0
  298. package/skills/utils/copywriting/references/landing-page-copy.md +175 -0
  299. package/skills/utils/copywriting/references/power-words.md +189 -0
  300. package/skills/utils/copywriting/references/social-media-copy.md +222 -0
  301. package/skills/utils/copywriting/references/workflow-cro.md +83 -0
  302. package/skills/utils/copywriting/references/workflow-enhance.md +32 -0
  303. package/skills/utils/copywriting/references/workflow-fast.md +29 -0
  304. package/skills/utils/copywriting/references/workflow-good.md +39 -0
  305. package/skills/utils/copywriting/references/writing-styles.md +247 -0
  306. package/skills/utils/copywriting/scripts/extract-writing-styles.py +308 -0
  307. package/skills/utils/copywriting/templates/copy-brief.md +49 -0
  308. package/skills/utils/docs/SKILL.md +55 -0
  309. package/skills/utils/docs/references/init-workflow.md +32 -0
  310. package/skills/utils/docs/references/summarize-workflow.md +18 -0
  311. package/skills/utils/docs/references/update-workflow.md +59 -0
  312. package/skills/utils/journal/SKILL.md +11 -0
  313. package/skills/utils/kanban/SKILL.md +99 -0
  314. package/skills/utils/preview/SKILL.md +75 -0
  315. package/skills/utils/preview/references/generation-modes.md +95 -0
  316. package/skills/utils/preview/references/view-mode.md +42 -0
  317. package/skills/utils/repomix/SKILL.md +248 -0
  318. package/skills/utils/repomix/references/configuration.md +211 -0
  319. package/skills/utils/repomix/references/usage-patterns.md +232 -0
  320. package/skills/utils/repomix/scripts/.coverage +0 -0
  321. package/skills/utils/repomix/scripts/README.md +179 -0
  322. package/skills/utils/repomix/scripts/repomix_batch.py +455 -0
  323. package/skills/utils/repomix/scripts/repos.example.json +15 -0
  324. package/skills/utils/repomix/scripts/requirements.txt +15 -0
  325. package/skills/utils/repomix/scripts/tests/test_repomix_batch.py +531 -0
  326. package/skills/utils/research/SKILL.md +171 -0
  327. package/skills/utils/scout/SKILL.md +89 -0
  328. package/skills/utils/scout/references/external-scouting.md +140 -0
  329. package/skills/utils/scout/references/internal-scouting.md +119 -0
  330. package/skills/utils/scout/references/task-management-scouting.md +125 -0
  331. package/skills/utils/sequential-thinking/.env.example +8 -0
  332. package/skills/utils/sequential-thinking/README.md +183 -0
  333. package/skills/utils/sequential-thinking/SKILL.md +95 -0
  334. package/skills/utils/sequential-thinking/package.json +31 -0
  335. package/skills/utils/sequential-thinking/references/advanced-strategies.md +79 -0
  336. package/skills/utils/sequential-thinking/references/advanced-techniques.md +76 -0
  337. package/skills/utils/sequential-thinking/references/core-patterns.md +95 -0
  338. package/skills/utils/sequential-thinking/references/examples-api.md +88 -0
  339. package/skills/utils/sequential-thinking/references/examples-architecture.md +94 -0
  340. package/skills/utils/sequential-thinking/references/examples-debug.md +90 -0
  341. package/skills/utils/sequential-thinking/scripts/format-thought.js +159 -0
  342. package/skills/utils/sequential-thinking/scripts/process-thought.js +236 -0
  343. package/skills/utils/sequential-thinking/tests/format-thought.test.js +133 -0
  344. package/skills/utils/sequential-thinking/tests/process-thought.test.js +215 -0
  345. package/skills/utils/write-skill/SKILL.md +655 -0
  346. package/skills/utils/write-skill/anthropic-best-practices.md +1150 -0
  347. package/skills/utils/write-skill/examples/CLAUDE_MD_TESTING.md +189 -0
  348. package/skills/utils/write-skill/graphviz-conventions.dot +172 -0
  349. package/skills/utils/write-skill/persuasion-principles.md +187 -0
  350. package/skills/utils/write-skill/render-graphs.js +168 -0
  351. package/skills/utils/write-skill/testing-skills-with-subagents.md +384 -0
  352. package/src/commands/init.js +238 -0
@@ -0,0 +1,616 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * context-builder.cjs - Context/reminder building for session injection
4
+ *
5
+ * Extracted from dev-rules-reminder.cjs for reuse in both Claude hooks and OpenCode plugins.
6
+ * Builds session context, rules, paths, and plan information.
7
+ *
8
+ * @module context-builder
9
+ */
10
+
11
+ const fs = require('fs');
12
+ const os = require('os');
13
+ const path = require('path');
14
+ const { execSync } = require('child_process');
15
+
16
+ // Usage cache file path (written by usage-context-awareness.cjs hook)
17
+ const USAGE_CACHE_FILE = path.join(os.tmpdir(), 'ck-usage-limits-cache.json');
18
+ const WARN_THRESHOLD = 70;
19
+ const CRITICAL_THRESHOLD = 90;
20
+ const {
21
+ loadConfig,
22
+ resolvePlanPath,
23
+ getReportsPath,
24
+ resolveNamingPattern,
25
+ normalizePath
26
+ } = require('./ck-config-utils.cjs');
27
+
28
+ // ═══════════════════════════════════════════════════════════════════════════
29
+ // HELPER FUNCTIONS
30
+ // ═══════════════════════════════════════════════════════════════════════════
31
+
32
+ /**
33
+ * Safely execute a command with timeout
34
+ * @param {string} cmd - Command to execute
35
+ * @returns {string|null} Output or null on error
36
+ */
37
+ function execSafe(cmd) {
38
+ try {
39
+ return execSync(cmd, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
40
+ } catch (e) {
41
+ return null;
42
+ }
43
+ }
44
+
45
+ /**
46
+ * Resolve rules file path (local or global) with backward compat
47
+ * @param {string} filename - Rules filename
48
+ * @param {string} [configDirName='.claude'] - Config directory name
49
+ * @returns {string|null} Resolved path or null
50
+ */
51
+ function resolveRulesPath(filename, configDirName = '.claude') {
52
+ // Try rules/ first (new location)
53
+ const localRulesPath = path.join(process.cwd(), configDirName, 'rules', filename);
54
+ const globalRulesPath = path.join(os.homedir(), '.claude', 'rules', filename);
55
+
56
+ if (fs.existsSync(localRulesPath)) return `${configDirName}/rules/${filename}`;
57
+ if (fs.existsSync(globalRulesPath)) return `~/.claude/rules/${filename}`;
58
+
59
+ // Backward compat: try workflows/ (legacy location)
60
+ const localWorkflowsPath = path.join(process.cwd(), configDirName, 'workflows', filename);
61
+ const globalWorkflowsPath = path.join(os.homedir(), '.claude', 'workflows', filename);
62
+
63
+ if (fs.existsSync(localWorkflowsPath)) return `${configDirName}/workflows/${filename}`;
64
+ if (fs.existsSync(globalWorkflowsPath)) return `~/.claude/workflows/${filename}`;
65
+
66
+ return null;
67
+ }
68
+
69
+ /**
70
+ * Resolve script file path (local or global)
71
+ * @param {string} filename - Script filename
72
+ * @param {string} [configDirName='.claude'] - Config directory name
73
+ * @returns {string|null} Resolved path or null
74
+ */
75
+ function resolveScriptPath(filename, configDirName = '.claude') {
76
+ const localPath = path.join(process.cwd(), configDirName, 'scripts', filename);
77
+ const globalPath = path.join(os.homedir(), '.claude', 'scripts', filename);
78
+ if (fs.existsSync(localPath)) return `${configDirName}/scripts/${filename}`;
79
+ if (fs.existsSync(globalPath)) return `~/.claude/scripts/${filename}`;
80
+ return null;
81
+ }
82
+
83
+ /**
84
+ * Resolve skills venv Python path (local or global)
85
+ * @param {string} [configDirName='.claude'] - Config directory name
86
+ * @returns {string|null} Resolved venv Python path or null
87
+ */
88
+ function resolveSkillsVenv(configDirName = '.claude') {
89
+ const isWindows = process.platform === 'win32';
90
+ const venvBin = isWindows ? 'Scripts' : 'bin';
91
+ const pythonExe = isWindows ? 'python.exe' : 'python3';
92
+
93
+ const localVenv = path.join(process.cwd(), configDirName, 'skills', '.venv', venvBin, pythonExe);
94
+ const globalVenv = path.join(os.homedir(), '.claude', 'skills', '.venv', venvBin, pythonExe);
95
+
96
+ if (fs.existsSync(localVenv)) {
97
+ return isWindows
98
+ ? `${configDirName}\\skills\\.venv\\Scripts\\python.exe`
99
+ : `${configDirName}/skills/.venv/bin/python3`;
100
+ }
101
+ if (fs.existsSync(globalVenv)) {
102
+ return isWindows
103
+ ? '~\\.claude\\skills\\.venv\\Scripts\\python.exe'
104
+ : '~/.claude/skills/.venv/bin/python3';
105
+ }
106
+ return null;
107
+ }
108
+
109
+ /**
110
+ * Build plan context from config and git info
111
+ * @param {string|null} sessionId - Session ID
112
+ * @param {Object} config - Loaded config
113
+ * @returns {Object} Plan context object
114
+ */
115
+ function buildPlanContext(sessionId, config) {
116
+ const { plan, paths } = config;
117
+ const gitBranch = execSafe('git branch --show-current');
118
+ const resolved = resolvePlanPath(sessionId, config);
119
+ const reportsPath = getReportsPath(resolved.path, resolved.resolvedBy, plan, paths);
120
+
121
+ // Compute naming pattern directly for reliable injection
122
+ const namePattern = resolveNamingPattern(plan, gitBranch);
123
+
124
+ const planLine = resolved.resolvedBy === 'session'
125
+ ? `- Plan: ${resolved.path}`
126
+ : resolved.resolvedBy === 'branch'
127
+ ? `- Plan: none | Suggested: ${resolved.path}`
128
+ : `- Plan: none`;
129
+
130
+ // Validation config (injected so LLM can reference it)
131
+ const validation = plan.validation || {};
132
+ const validationMode = validation.mode || 'prompt';
133
+ const validationMin = validation.minQuestions || 3;
134
+ const validationMax = validation.maxQuestions || 8;
135
+
136
+ return { reportsPath, gitBranch, planLine, namePattern, validationMode, validationMin, validationMax };
137
+ }
138
+
139
+ /**
140
+ * Check if context was recently injected (prevent duplicate injection)
141
+ * @param {string} transcriptPath - Path to transcript file
142
+ * @returns {boolean} true if recently injected
143
+ */
144
+ function wasRecentlyInjected(transcriptPath) {
145
+ try {
146
+ if (!transcriptPath || !fs.existsSync(transcriptPath)) return false;
147
+ const transcript = fs.readFileSync(transcriptPath, 'utf-8');
148
+ // Check last 150 lines (hook output is ~30 lines, so this covers ~5 user prompts)
149
+ return transcript.split('\n').slice(-150).some(line => line.includes('[IMPORTANT] Consider Modularization'));
150
+ } catch (e) {
151
+ return false;
152
+ }
153
+ }
154
+
155
+ // ═══════════════════════════════════════════════════════════════════════════
156
+ // SECTION BUILDERS
157
+ // ═══════════════════════════════════════════════════════════════════════════
158
+
159
+ /**
160
+ * Build language section
161
+ * @param {Object} params
162
+ * @param {string} [params.thinkingLanguage] - Language for thinking
163
+ * @param {string} [params.responseLanguage] - Language for response
164
+ * @returns {string[]} Lines for language section
165
+ */
166
+ function buildLanguageSection({ thinkingLanguage, responseLanguage }) {
167
+ // Auto-default thinkingLanguage to 'en' when only responseLanguage is set
168
+ const effectiveThinking = thinkingLanguage || (responseLanguage ? 'en' : null);
169
+ const hasThinking = effectiveThinking && effectiveThinking !== responseLanguage;
170
+ const hasResponse = responseLanguage;
171
+ const lines = [];
172
+
173
+ if (hasThinking || hasResponse) {
174
+ lines.push(`## Language`);
175
+ if (hasThinking) {
176
+ lines.push(`- Thinking: Use ${effectiveThinking} for reasoning (logic, precision).`);
177
+ }
178
+ if (hasResponse) {
179
+ lines.push(`- Response: Respond in ${responseLanguage} (natural, fluent).`);
180
+ }
181
+ lines.push(``);
182
+ }
183
+
184
+ return lines;
185
+ }
186
+
187
+ /**
188
+ * Build session section
189
+ * @param {Object} [staticEnv] - Pre-computed static environment info
190
+ * @returns {string[]} Lines for session section
191
+ */
192
+ function buildSessionSection(staticEnv = {}) {
193
+ const memUsed = Math.round(process.memoryUsage().heapUsed / 1024 / 1024);
194
+ const memTotal = Math.round(os.totalmem() / 1024 / 1024);
195
+ const memPercent = Math.round((memUsed / memTotal) * 100);
196
+ const cpuUsage = Math.round((process.cpuUsage().user / 1000000) * 100);
197
+ const cpuSystem = Math.round((process.cpuUsage().system / 1000000) * 100);
198
+
199
+ return [
200
+ `## Session`,
201
+ `- DateTime: ${new Date().toLocaleString()}`,
202
+ `- CWD: ${staticEnv.cwd || process.cwd()}`,
203
+ `- Timezone: ${staticEnv.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone}`,
204
+ `- Working directory: ${staticEnv.cwd || process.cwd()}`,
205
+ `- OS: ${staticEnv.osPlatform || process.platform}`,
206
+ `- User: ${staticEnv.user || process.env.USERNAME || process.env.USER}`,
207
+ `- Locale: ${staticEnv.locale || process.env.LANG || ''}`,
208
+ `- Memory usage: ${memUsed}MB/${memTotal}MB (${memPercent}%)`,
209
+ `- CPU usage: ${cpuUsage}% user / ${cpuSystem}% system`,
210
+ `- Spawning multiple subagents can cause performance issues, spawn and delegate tasks intelligently based on the available system resources.`,
211
+ `- Remember that each subagent only has 200K tokens in context window, spawn and delegate tasks intelligently to make sure their context windows don't get bloated.`,
212
+ `- IMPORTANT: Include these environment information when prompting subagents to perform tasks.`,
213
+ ``
214
+ ];
215
+ }
216
+
217
+ /**
218
+ * Read usage limits from cache file (written by usage-context-awareness.cjs)
219
+ * @returns {Object|null} Usage data or null if unavailable
220
+ */
221
+ function readUsageCache() {
222
+ try {
223
+ if (fs.existsSync(USAGE_CACHE_FILE)) {
224
+ const cache = JSON.parse(fs.readFileSync(USAGE_CACHE_FILE, 'utf-8'));
225
+ // Cache is valid for 5 minutes for injection purposes
226
+ if (Date.now() - cache.timestamp < 300000 && cache.data) {
227
+ return cache.data;
228
+ }
229
+ }
230
+ } catch { }
231
+ return null;
232
+ }
233
+
234
+ /**
235
+ * Format time until reset
236
+ * @param {string} resetAt - ISO timestamp
237
+ * @returns {string|null} Formatted time or null
238
+ */
239
+ function formatTimeUntilReset(resetAt) {
240
+ if (!resetAt) return null;
241
+ const resetTime = new Date(resetAt);
242
+ const remaining = Math.floor(resetTime.getTime() / 1000) - Math.floor(Date.now() / 1000);
243
+ if (remaining <= 0 || remaining > 18000) return null; // Only show if < 5 hours
244
+ const hours = Math.floor(remaining / 3600);
245
+ const mins = Math.floor((remaining % 3600) / 60);
246
+ return `${hours}h ${mins}m`;
247
+ }
248
+
249
+ /**
250
+ * Format percentage with warning level
251
+ * @param {number} value - Percentage value
252
+ * @param {string} label - Label prefix
253
+ * @returns {string} Formatted string with warning if applicable
254
+ */
255
+ function formatUsagePercent(value, label) {
256
+ const pct = Math.round(value);
257
+ if (pct >= CRITICAL_THRESHOLD) return `${label}: ${pct}% [CRITICAL]`;
258
+ if (pct >= WARN_THRESHOLD) return `${label}: ${pct}% [WARNING]`;
259
+ return `${label}: ${pct}%`;
260
+ }
261
+
262
+ /**
263
+ * Build context window section from statusline cache
264
+ * @param {string} sessionId - Session ID
265
+ * @returns {string[]} Lines for context section
266
+ */
267
+ function buildContextSection(sessionId) {
268
+ if (!sessionId) return [];
269
+
270
+ try {
271
+ const contextPath = path.join(os.tmpdir(), `ck-context-${sessionId}.json`);
272
+ if (!fs.existsSync(contextPath)) return [];
273
+
274
+ const data = JSON.parse(fs.readFileSync(contextPath, 'utf-8'));
275
+ // Only use fresh data (< 5 min old - statusline updates every 300ms when active)
276
+ if (Date.now() - data.timestamp > 300000) return [];
277
+
278
+ const lines = [`## Current Session's Context`];
279
+
280
+ // Format: 48% used (96K/200K tokens)
281
+ const usedK = Math.round(data.tokens / 1000);
282
+ const sizeK = Math.round(data.size / 1000);
283
+ lines.push(`- Context: ${data.percent}% used (${usedK}K/${sizeK}K tokens)`);
284
+ lines.push(`- **NOTE:** Optimize the workflow for token efficiency`);
285
+
286
+ // Warning if high usage
287
+ if (data.percent >= CRITICAL_THRESHOLD) {
288
+ lines.push(`- **CRITICAL:** Context nearly full - consider compaction or being concise, update current phase's status before the compaction.`);
289
+ } else if (data.percent >= WARN_THRESHOLD) {
290
+ lines.push(`- **WARNING:** Context usage moderate - being concise and optimize token efficiency.`);
291
+ }
292
+
293
+ lines.push(``);
294
+ return lines;
295
+ } catch {
296
+ return [];
297
+ }
298
+ }
299
+
300
+ /**
301
+ * Build usage section from cache
302
+ * @returns {string[]} Lines for usage section
303
+ */
304
+ function buildUsageSection() {
305
+ const usage = readUsageCache();
306
+ if (!usage) return [];
307
+
308
+ const lines = [];
309
+ const parts = [];
310
+
311
+ // 5-hour limit
312
+ if (usage.five_hour) {
313
+ const util = usage.five_hour.utilization;
314
+ if (typeof util === 'number') {
315
+ parts.push(formatUsagePercent(util, '5h'));
316
+ }
317
+ const timeLeft = formatTimeUntilReset(usage.five_hour.resets_at);
318
+ if (timeLeft) {
319
+ parts.push(`resets in ${timeLeft}`);
320
+ }
321
+ }
322
+
323
+ // 7-day limit
324
+ if (usage.seven_day?.utilization != null) {
325
+ parts.push(formatUsagePercent(usage.seven_day.utilization, '7d'));
326
+ }
327
+
328
+ if (parts.length > 0) {
329
+ lines.push(`## Usage Limits`);
330
+ lines.push(`- ${parts.join(' | ')}`);
331
+ lines.push(``);
332
+ }
333
+
334
+ return lines;
335
+ }
336
+
337
+ /**
338
+ * Build rules section
339
+ * @param {Object} params
340
+ * @param {string} [params.devRulesPath] - Path to dev rules
341
+ * @param {string} [params.catalogScript] - Path to catalog script
342
+ * @param {string} [params.skillsVenv] - Path to skills venv
343
+ * @param {string} [params.plansPath] - Absolute plans path (Issue #476: prevents wrong subdirectory creation)
344
+ * @param {string} [params.docsPath] - Absolute docs path
345
+ * @returns {string[]} Lines for rules section
346
+ */
347
+ function buildRulesSection({ devRulesPath, catalogScript, skillsVenv, plansPath, docsPath }) {
348
+ const lines = [`## Rules`];
349
+
350
+ if (devRulesPath) {
351
+ lines.push(`- Read and follow development rules: "${devRulesPath}"`);
352
+ }
353
+
354
+ // Issue #476: Use absolute paths to prevent LLM confusion in multi-CLAUDE.md projects
355
+ const plansRef = plansPath || 'plans';
356
+ const docsRef = docsPath || 'docs';
357
+ lines.push(`- Markdown files are organized in: Plans → "${plansRef}" directory, Docs → "${docsRef}" directory`);
358
+ lines.push(`- **IMPORTANT:** DO NOT create markdown files outside of "${plansRef}" or "${docsRef}" UNLESS the user explicitly requests it.`);
359
+
360
+ if (catalogScript) {
361
+ lines.push(`- Activate skills: Run \`python ${catalogScript} --skills\` to generate a skills catalog and analyze it, then activate the relevant skills that are needed for the task during the process.`);
362
+ }
363
+
364
+ if (skillsVenv) {
365
+ lines.push(`- Python scripts in .claude/skills/: Use \`${skillsVenv}\``);
366
+ }
367
+
368
+ lines.push(`- When skills' scripts are failed to execute, always fix them and run again, repeat until success.`);
369
+ lines.push(`- Follow **YAGNI (You Aren't Gonna Need It) - KISS (Keep It Simple, Stupid) - DRY (Don't Repeat Yourself)** principles`);
370
+ lines.push(`- Sacrifice grammar for the sake of concision when writing reports.`);
371
+ lines.push(`- In reports, list any unresolved questions at the end, if any.`);
372
+ lines.push(`- IMPORTANT: Ensure token consumption efficiency while maintaining high quality.`);
373
+ lines.push(``);
374
+
375
+ return lines;
376
+ }
377
+
378
+ /**
379
+ * Build modularization section
380
+ * @returns {string[]} Lines for modularization section
381
+ */
382
+ function buildModularizationSection() {
383
+ return [
384
+ `## **[IMPORTANT] Consider Modularization:**`,
385
+ `- Check existing modules before creating new`,
386
+ `- Analyze logical separation boundaries (functions, classes, concerns)`,
387
+ `- Prefer kebab-case for JS/TS/Python/shell; respect language conventions (C#/Java use PascalCase, Go/Rust use snake_case)`,
388
+ `- Write descriptive code comments`,
389
+ `- After modularization, continue with main task`,
390
+ `- When not to modularize: Markdown files, plain text files, bash scripts, configuration files, environment variables files, etc.`,
391
+ ``
392
+ ];
393
+ }
394
+
395
+ /**
396
+ * Build paths section
397
+ * @param {Object} params
398
+ * @param {string} params.reportsPath - Reports path
399
+ * @param {string} params.plansPath - Plans path
400
+ * @param {string} params.docsPath - Docs path
401
+ * @param {number} [params.docsMaxLoc=800] - Max lines of code for docs
402
+ * @returns {string[]} Lines for paths section
403
+ */
404
+ function buildPathsSection({ reportsPath, plansPath, docsPath, docsMaxLoc = 800 }) {
405
+ return [
406
+ `## Paths`,
407
+ `Reports: ${reportsPath} | Plans: ${plansPath}/ | Docs: ${docsPath}/ | docs.maxLoc: ${docsMaxLoc}`,
408
+ ``
409
+ ];
410
+ }
411
+
412
+ /**
413
+ * Build plan context section
414
+ * @param {Object} params
415
+ * @param {string} params.planLine - Plan status line
416
+ * @param {string} params.reportsPath - Reports path
417
+ * @param {string} [params.gitBranch] - Git branch
418
+ * @param {string} params.validationMode - Validation mode
419
+ * @param {number} params.validationMin - Min questions
420
+ * @param {number} params.validationMax - Max questions
421
+ * @returns {string[]} Lines for plan context section
422
+ */
423
+ function buildPlanContextSection({ planLine, reportsPath, gitBranch, validationMode, validationMin, validationMax }) {
424
+ const lines = [
425
+ `## Plan Context`,
426
+ planLine,
427
+ `- Reports: ${reportsPath}`
428
+ ];
429
+
430
+ if (gitBranch) {
431
+ lines.push(`- Branch: ${gitBranch}`);
432
+ }
433
+
434
+ lines.push(`- Validation: mode=${validationMode}, questions=${validationMin}-${validationMax}`);
435
+ lines.push(``);
436
+
437
+ return lines;
438
+ }
439
+
440
+ /**
441
+ * Build naming section
442
+ * @param {Object} params
443
+ * @param {string} params.reportsPath - Reports path
444
+ * @param {string} params.plansPath - Plans path
445
+ * @param {string} params.namePattern - Naming pattern
446
+ * @returns {string[]} Lines for naming section
447
+ */
448
+ function buildNamingSection({ reportsPath, plansPath, namePattern }) {
449
+ return [
450
+ `## Naming`,
451
+ `- Report: \`${reportsPath}{type}-${namePattern}.md\``,
452
+ `- Plan dir: \`${plansPath}/${namePattern}/\``,
453
+ `- Replace \`{type}\` with: agent name, report type, or context`,
454
+ `- Replace \`{slug}\` in pattern with: descriptive-kebab-slug`
455
+ ];
456
+ }
457
+
458
+ // ═══════════════════════════════════════════════════════════════════════════
459
+ // MAIN ENTRY POINTS
460
+ // ═══════════════════════════════════════════════════════════════════════════
461
+
462
+ /**
463
+ * Build full reminder content from all sections
464
+ * @param {Object} params - All parameters for building reminder
465
+ * @returns {string[]} Array of lines
466
+ */
467
+ function buildReminder(params) {
468
+ const {
469
+ sessionId,
470
+ thinkingLanguage,
471
+ responseLanguage,
472
+ devRulesPath,
473
+ catalogScript,
474
+ skillsVenv,
475
+ reportsPath,
476
+ plansPath,
477
+ docsPath,
478
+ docsMaxLoc,
479
+ planLine,
480
+ gitBranch,
481
+ namePattern,
482
+ validationMode,
483
+ validationMin,
484
+ validationMax,
485
+ staticEnv,
486
+ hooks
487
+ } = params;
488
+
489
+ // Respect hooks config — skip sections when their corresponding hook is disabled
490
+ const hooksConfig = hooks || {};
491
+ const contextEnabled = hooksConfig['context-tracking'] !== false;
492
+ const usageEnabled = hooksConfig['usage-context-awareness'] !== false;
493
+
494
+ return [
495
+ ...buildLanguageSection({ thinkingLanguage, responseLanguage }),
496
+ ...buildSessionSection(staticEnv),
497
+ ...(contextEnabled ? buildContextSection(sessionId) : []),
498
+ ...(usageEnabled ? buildUsageSection() : []),
499
+ ...buildRulesSection({ devRulesPath, catalogScript, skillsVenv, plansPath, docsPath }),
500
+ ...buildModularizationSection(),
501
+ ...buildPathsSection({ reportsPath, plansPath, docsPath, docsMaxLoc }),
502
+ ...buildPlanContextSection({ planLine, reportsPath, gitBranch, validationMode, validationMin, validationMax }),
503
+ ...buildNamingSection({ reportsPath, plansPath, namePattern })
504
+ ];
505
+ }
506
+
507
+ /**
508
+ * Build complete reminder context (unified entry point for plugins)
509
+ *
510
+ * @param {Object} [params]
511
+ * @param {string} [params.sessionId] - Session ID
512
+ * @param {Object} [params.config] - CK config (auto-loaded if not provided)
513
+ * @param {Object} [params.staticEnv] - Pre-computed static environment info
514
+ * @param {string} [params.configDirName='.claude'] - Config directory name
515
+ * @param {string} [params.baseDir] - Base directory for absolute path resolution (Issue #327)
516
+ * @returns {{
517
+ * content: string,
518
+ * lines: string[],
519
+ * sections: Object
520
+ * }}
521
+ */
522
+ function buildReminderContext({ sessionId, config, staticEnv, configDirName = '.claude', baseDir } = {}) {
523
+ // Load config if not provided
524
+ const cfg = config || loadConfig({ includeProject: false, includeAssertions: false });
525
+
526
+ // Resolve paths
527
+ const devRulesPath = resolveRulesPath('development-rules.md', configDirName);
528
+ const catalogScript = resolveScriptPath('generate_catalogs.py', configDirName);
529
+ const skillsVenv = resolveSkillsVenv(configDirName);
530
+
531
+ // Build plan context
532
+ const planCtx = buildPlanContext(sessionId, cfg);
533
+
534
+ // Issue #327: Use baseDir for absolute path resolution (subdirectory workflow support)
535
+ // If baseDir provided, resolve paths as absolute; otherwise use relative paths
536
+ const effectiveBaseDir = baseDir || null;
537
+ const plansPathRel = normalizePath(cfg.paths?.plans) || 'plans';
538
+ const docsPathRel = normalizePath(cfg.paths?.docs) || 'docs';
539
+
540
+ // Build all parameters with absolute paths if baseDir provided
541
+ const params = {
542
+ sessionId,
543
+ thinkingLanguage: cfg.locale?.thinkingLanguage,
544
+ responseLanguage: cfg.locale?.responseLanguage,
545
+ devRulesPath,
546
+ catalogScript,
547
+ skillsVenv,
548
+ reportsPath: effectiveBaseDir ? path.join(effectiveBaseDir, planCtx.reportsPath) : planCtx.reportsPath,
549
+ plansPath: effectiveBaseDir ? path.join(effectiveBaseDir, plansPathRel) : plansPathRel,
550
+ docsPath: effectiveBaseDir ? path.join(effectiveBaseDir, docsPathRel) : docsPathRel,
551
+ docsMaxLoc: Math.max(1, parseInt(cfg.docs?.maxLoc, 10) || 800),
552
+ planLine: planCtx.planLine,
553
+ gitBranch: planCtx.gitBranch,
554
+ namePattern: planCtx.namePattern,
555
+ validationMode: planCtx.validationMode,
556
+ validationMin: planCtx.validationMin,
557
+ validationMax: planCtx.validationMax,
558
+ staticEnv,
559
+ hooks: cfg.hooks
560
+ };
561
+
562
+ const lines = buildReminder(params);
563
+
564
+ // Respect hooks config for sections object too
565
+ const hooksConfig = cfg.hooks || {};
566
+ const contextEnabled = hooksConfig['context-tracking'] !== false;
567
+ const usageEnabled = hooksConfig['usage-context-awareness'] !== false;
568
+
569
+ return {
570
+ content: lines.join('\n'),
571
+ lines,
572
+ sections: {
573
+ language: buildLanguageSection({ thinkingLanguage: params.thinkingLanguage, responseLanguage: params.responseLanguage }),
574
+ session: buildSessionSection(staticEnv),
575
+ context: contextEnabled ? buildContextSection(sessionId) : [],
576
+ usage: usageEnabled ? buildUsageSection() : [],
577
+ rules: buildRulesSection({ devRulesPath, catalogScript, skillsVenv, plansPath: params.plansPath, docsPath: params.docsPath }),
578
+ modularization: buildModularizationSection(),
579
+ paths: buildPathsSection({ reportsPath: params.reportsPath, plansPath: params.plansPath, docsPath: params.docsPath, docsMaxLoc: params.docsMaxLoc }),
580
+ planContext: buildPlanContextSection(planCtx),
581
+ naming: buildNamingSection({ reportsPath: params.reportsPath, plansPath: params.plansPath, namePattern: params.namePattern })
582
+ }
583
+ };
584
+ }
585
+
586
+ // ═══════════════════════════════════════════════════════════════════════════
587
+ // EXPORTS
588
+ // ═══════════════════════════════════════════════════════════════════════════
589
+
590
+ module.exports = {
591
+ // Main entry points
592
+ buildReminderContext,
593
+ buildReminder,
594
+
595
+ // Section builders
596
+ buildLanguageSection,
597
+ buildSessionSection,
598
+ buildContextSection,
599
+ buildUsageSection,
600
+ buildRulesSection,
601
+ buildModularizationSection,
602
+ buildPathsSection,
603
+ buildPlanContextSection,
604
+ buildNamingSection,
605
+
606
+ // Helpers
607
+ execSafe,
608
+ resolveRulesPath,
609
+ resolveScriptPath,
610
+ resolveSkillsVenv,
611
+ buildPlanContext,
612
+ wasRecentlyInjected,
613
+
614
+ // Backward compat alias
615
+ resolveWorkflowPath: resolveRulesPath
616
+ };