xtrm-tools 0.5.25 → 0.5.26

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 (252) hide show
  1. package/.claude-plugin/marketplace.json +19 -0
  2. package/.claude-plugin/plugin.json +9 -0
  3. package/cli/dist/index.cjs +59 -52
  4. package/cli/dist/index.cjs.map +1 -1
  5. package/cli/package.json +1 -1
  6. package/hooks/beads-claim-sync.mjs +1 -3
  7. package/package.json +5 -1
  8. package/plugins/xtrm-tools/.claude-plugin/plugin.json +9 -0
  9. package/plugins/xtrm-tools/.mcp.json +18 -0
  10. package/plugins/xtrm-tools/hooks/README.md +61 -0
  11. package/plugins/xtrm-tools/hooks/beads-claim-sync.mjs +223 -0
  12. package/plugins/xtrm-tools/hooks/beads-commit-gate.mjs +70 -0
  13. package/plugins/xtrm-tools/hooks/beads-compact-restore.mjs +69 -0
  14. package/plugins/xtrm-tools/hooks/beads-compact-save.mjs +51 -0
  15. package/plugins/xtrm-tools/hooks/beads-edit-gate.mjs +85 -0
  16. package/plugins/xtrm-tools/hooks/beads-gate-core.mjs +236 -0
  17. package/plugins/xtrm-tools/hooks/beads-gate-messages.mjs +68 -0
  18. package/plugins/xtrm-tools/hooks/beads-gate-utils.mjs +194 -0
  19. package/plugins/xtrm-tools/hooks/beads-memory-gate.mjs +81 -0
  20. package/plugins/xtrm-tools/hooks/beads-stop-gate.mjs +53 -0
  21. package/plugins/xtrm-tools/hooks/gitnexus/gitnexus-hook.cjs +222 -0
  22. package/plugins/xtrm-tools/hooks/hooks.json +115 -0
  23. package/plugins/xtrm-tools/hooks/quality-check-env.mjs +79 -0
  24. package/plugins/xtrm-tools/hooks/quality-check.cjs +1286 -0
  25. package/plugins/xtrm-tools/hooks/quality-check.py +345 -0
  26. package/plugins/xtrm-tools/hooks/statusline.mjs +145 -0
  27. package/plugins/xtrm-tools/hooks/using-xtrm-reminder.mjs +35 -0
  28. package/plugins/xtrm-tools/hooks/worktree-boundary.mjs +33 -0
  29. package/plugins/xtrm-tools/hooks/xtrm-logger.mjs +123 -0
  30. package/plugins/xtrm-tools/hooks/xtrm-session-logger.mjs +27 -0
  31. package/plugins/xtrm-tools/hooks/xtrm-tool-logger.mjs +53 -0
  32. package/plugins/xtrm-tools/skills/README.txt +31 -0
  33. package/plugins/xtrm-tools/skills/clean-code/SKILL.md +201 -0
  34. package/plugins/xtrm-tools/skills/creating-service-skills/SKILL.md +433 -0
  35. package/plugins/xtrm-tools/skills/creating-service-skills/references/script_quality_standards.md +425 -0
  36. package/plugins/xtrm-tools/skills/creating-service-skills/references/service_skill_system_guide.md +278 -0
  37. package/plugins/xtrm-tools/skills/creating-service-skills/scripts/bootstrap.py +326 -0
  38. package/plugins/xtrm-tools/skills/creating-service-skills/scripts/deep_dive.py +304 -0
  39. package/plugins/xtrm-tools/skills/creating-service-skills/scripts/scaffolder.py +482 -0
  40. package/plugins/xtrm-tools/skills/delegating/SKILL.md +196 -0
  41. package/plugins/xtrm-tools/skills/delegating/config.yaml +210 -0
  42. package/plugins/xtrm-tools/skills/delegating/references/orchestration-protocols.md +41 -0
  43. package/plugins/xtrm-tools/skills/docker-expert/SKILL.md +409 -0
  44. package/plugins/xtrm-tools/skills/documenting/CHANGELOG.md +23 -0
  45. package/plugins/xtrm-tools/skills/documenting/README.md +148 -0
  46. package/plugins/xtrm-tools/skills/documenting/SKILL.md +113 -0
  47. package/plugins/xtrm-tools/skills/documenting/examples/example_pattern.md +70 -0
  48. package/plugins/xtrm-tools/skills/documenting/examples/example_reference.md +70 -0
  49. package/plugins/xtrm-tools/skills/documenting/examples/example_ssot_analytics.md +64 -0
  50. package/plugins/xtrm-tools/skills/documenting/examples/example_workflow.md +141 -0
  51. package/plugins/xtrm-tools/skills/documenting/references/changelog-format.md +97 -0
  52. package/plugins/xtrm-tools/skills/documenting/references/metadata-schema.md +136 -0
  53. package/plugins/xtrm-tools/skills/documenting/references/taxonomy.md +81 -0
  54. package/plugins/xtrm-tools/skills/documenting/references/versioning-rules.md +78 -0
  55. package/plugins/xtrm-tools/skills/documenting/scripts/bump_version.sh +60 -0
  56. package/plugins/xtrm-tools/skills/documenting/scripts/changelog/__init__.py +0 -0
  57. package/plugins/xtrm-tools/skills/documenting/scripts/changelog/add_entry.py +216 -0
  58. package/plugins/xtrm-tools/skills/documenting/scripts/changelog/bump_release.py +117 -0
  59. package/plugins/xtrm-tools/skills/documenting/scripts/changelog/init_changelog.py +54 -0
  60. package/plugins/xtrm-tools/skills/documenting/scripts/changelog/validate_changelog.py +128 -0
  61. package/plugins/xtrm-tools/skills/documenting/scripts/drift_detector.py +266 -0
  62. package/plugins/xtrm-tools/skills/documenting/scripts/generate_template.py +311 -0
  63. package/plugins/xtrm-tools/skills/documenting/scripts/list_by_category.sh +84 -0
  64. package/plugins/xtrm-tools/skills/documenting/scripts/orchestrator.py +255 -0
  65. package/plugins/xtrm-tools/skills/documenting/scripts/validate_metadata.py +242 -0
  66. package/plugins/xtrm-tools/skills/documenting/templates/CHANGELOG.md.template +13 -0
  67. package/plugins/xtrm-tools/skills/documenting/tests/integration_test.sh +70 -0
  68. package/plugins/xtrm-tools/skills/documenting/tests/test_changelog.py +201 -0
  69. package/plugins/xtrm-tools/skills/documenting/tests/test_drift_detector.py +80 -0
  70. package/plugins/xtrm-tools/skills/documenting/tests/test_orchestrator.py +52 -0
  71. package/plugins/xtrm-tools/skills/documenting/tests/test_validate_metadata.py +64 -0
  72. package/plugins/xtrm-tools/skills/find-skills/SKILL.md +133 -0
  73. package/plugins/xtrm-tools/skills/gitnexus-debugging/SKILL.md +85 -0
  74. package/plugins/xtrm-tools/skills/gitnexus-exploring/SKILL.md +75 -0
  75. package/plugins/xtrm-tools/skills/gitnexus-impact-analysis/SKILL.md +94 -0
  76. package/plugins/xtrm-tools/skills/gitnexus-refactoring/SKILL.md +113 -0
  77. package/plugins/xtrm-tools/skills/hook-development/SKILL.md +797 -0
  78. package/plugins/xtrm-tools/skills/hook-development/examples/load-context.sh +55 -0
  79. package/plugins/xtrm-tools/skills/hook-development/examples/quality-check.js +1168 -0
  80. package/plugins/xtrm-tools/skills/hook-development/examples/validate-bash.sh +43 -0
  81. package/plugins/xtrm-tools/skills/hook-development/examples/validate-write.sh +38 -0
  82. package/plugins/xtrm-tools/skills/hook-development/references/advanced.md +527 -0
  83. package/plugins/xtrm-tools/skills/hook-development/references/migration.md +369 -0
  84. package/plugins/xtrm-tools/skills/hook-development/references/patterns.md +412 -0
  85. package/plugins/xtrm-tools/skills/hook-development/scripts/README.md +164 -0
  86. package/plugins/xtrm-tools/skills/hook-development/scripts/hook-linter.sh +153 -0
  87. package/plugins/xtrm-tools/skills/hook-development/scripts/test-hook.sh +252 -0
  88. package/plugins/xtrm-tools/skills/hook-development/scripts/validate-hook-schema.sh +159 -0
  89. package/plugins/xtrm-tools/skills/obsidian-cli/SKILL.md +106 -0
  90. package/plugins/xtrm-tools/skills/orchestrating-agents/SKILL.md +135 -0
  91. package/plugins/xtrm-tools/skills/orchestrating-agents/config.yaml +45 -0
  92. package/plugins/xtrm-tools/skills/orchestrating-agents/references/agent-context-integration.md +37 -0
  93. package/plugins/xtrm-tools/skills/orchestrating-agents/references/examples.md +45 -0
  94. package/plugins/xtrm-tools/skills/orchestrating-agents/references/handover-protocol.md +31 -0
  95. package/plugins/xtrm-tools/skills/orchestrating-agents/references/workflows.md +42 -0
  96. package/plugins/xtrm-tools/skills/orchestrating-agents/scripts/detect_neighbors.py +23 -0
  97. package/plugins/xtrm-tools/skills/prompt-improving/README.md +162 -0
  98. package/plugins/xtrm-tools/skills/prompt-improving/SKILL.md +74 -0
  99. package/plugins/xtrm-tools/skills/prompt-improving/references/analysis_commands.md +24 -0
  100. package/plugins/xtrm-tools/skills/prompt-improving/references/chain_of_thought.md +24 -0
  101. package/plugins/xtrm-tools/skills/prompt-improving/references/mcp_definitions.md +20 -0
  102. package/plugins/xtrm-tools/skills/prompt-improving/references/multishot.md +23 -0
  103. package/plugins/xtrm-tools/skills/prompt-improving/references/xml_core.md +60 -0
  104. package/plugins/xtrm-tools/skills/python-testing/SKILL.md +815 -0
  105. package/plugins/xtrm-tools/skills/scoping-service-skills/SKILL.md +231 -0
  106. package/plugins/xtrm-tools/skills/scoping-service-skills/scripts/scope.py +74 -0
  107. package/plugins/xtrm-tools/skills/senior-backend/SKILL.md +209 -0
  108. package/plugins/xtrm-tools/skills/senior-backend/references/api_design_patterns.md +103 -0
  109. package/plugins/xtrm-tools/skills/senior-backend/references/backend_security_practices.md +103 -0
  110. package/plugins/xtrm-tools/skills/senior-backend/references/database_optimization_guide.md +103 -0
  111. package/plugins/xtrm-tools/skills/senior-backend/scripts/api_load_tester.py +114 -0
  112. package/plugins/xtrm-tools/skills/senior-backend/scripts/api_scaffolder.py +114 -0
  113. package/plugins/xtrm-tools/skills/senior-backend/scripts/database_migration_tool.py +114 -0
  114. package/plugins/xtrm-tools/skills/senior-data-scientist/SKILL.md +226 -0
  115. package/plugins/xtrm-tools/skills/senior-data-scientist/references/experiment_design_frameworks.md +80 -0
  116. package/plugins/xtrm-tools/skills/senior-data-scientist/references/feature_engineering_patterns.md +80 -0
  117. package/plugins/xtrm-tools/skills/senior-data-scientist/references/statistical_methods_advanced.md +80 -0
  118. package/plugins/xtrm-tools/skills/senior-data-scientist/scripts/experiment_designer.py +100 -0
  119. package/plugins/xtrm-tools/skills/senior-data-scientist/scripts/feature_engineering_pipeline.py +100 -0
  120. package/plugins/xtrm-tools/skills/senior-data-scientist/scripts/model_evaluation_suite.py +100 -0
  121. package/plugins/xtrm-tools/skills/senior-devops/SKILL.md +209 -0
  122. package/plugins/xtrm-tools/skills/senior-devops/references/cicd_pipeline_guide.md +103 -0
  123. package/plugins/xtrm-tools/skills/senior-devops/references/deployment_strategies.md +103 -0
  124. package/plugins/xtrm-tools/skills/senior-devops/references/infrastructure_as_code.md +103 -0
  125. package/plugins/xtrm-tools/skills/senior-devops/scripts/deployment_manager.py +114 -0
  126. package/plugins/xtrm-tools/skills/senior-devops/scripts/pipeline_generator.py +114 -0
  127. package/plugins/xtrm-tools/skills/senior-devops/scripts/terraform_scaffolder.py +114 -0
  128. package/plugins/xtrm-tools/skills/senior-security/SKILL.md +209 -0
  129. package/plugins/xtrm-tools/skills/senior-security/references/cryptography_implementation.md +103 -0
  130. package/plugins/xtrm-tools/skills/senior-security/references/penetration_testing_guide.md +103 -0
  131. package/plugins/xtrm-tools/skills/senior-security/references/security_architecture_patterns.md +103 -0
  132. package/plugins/xtrm-tools/skills/senior-security/scripts/pentest_automator.py +114 -0
  133. package/plugins/xtrm-tools/skills/senior-security/scripts/security_auditor.py +114 -0
  134. package/plugins/xtrm-tools/skills/senior-security/scripts/threat_modeler.py +114 -0
  135. package/plugins/xtrm-tools/skills/skill-creator/LICENSE.txt +202 -0
  136. package/plugins/xtrm-tools/skills/skill-creator/SKILL.md +479 -0
  137. package/plugins/xtrm-tools/skills/skill-creator/agents/analyzer.md +274 -0
  138. package/plugins/xtrm-tools/skills/skill-creator/agents/comparator.md +202 -0
  139. package/plugins/xtrm-tools/skills/skill-creator/agents/grader.md +223 -0
  140. package/plugins/xtrm-tools/skills/skill-creator/assets/eval_review.html +146 -0
  141. package/plugins/xtrm-tools/skills/skill-creator/eval-viewer/generate_review.py +471 -0
  142. package/plugins/xtrm-tools/skills/skill-creator/eval-viewer/viewer.html +1325 -0
  143. package/plugins/xtrm-tools/skills/skill-creator/references/schemas.md +430 -0
  144. package/plugins/xtrm-tools/skills/skill-creator/scripts/__init__.py +0 -0
  145. package/plugins/xtrm-tools/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
  146. package/plugins/xtrm-tools/skills/skill-creator/scripts/generate_report.py +326 -0
  147. package/plugins/xtrm-tools/skills/skill-creator/scripts/improve_description.py +248 -0
  148. package/plugins/xtrm-tools/skills/skill-creator/scripts/package_skill.py +136 -0
  149. package/plugins/xtrm-tools/skills/skill-creator/scripts/quick_validate.py +103 -0
  150. package/plugins/xtrm-tools/skills/skill-creator/scripts/run_eval.py +310 -0
  151. package/plugins/xtrm-tools/skills/skill-creator/scripts/run_loop.py +332 -0
  152. package/plugins/xtrm-tools/skills/skill-creator/scripts/utils.py +47 -0
  153. package/plugins/xtrm-tools/skills/sync-docs/SKILL.md +155 -0
  154. package/plugins/xtrm-tools/skills/sync-docs/evals/evals.json +89 -0
  155. package/plugins/xtrm-tools/skills/sync-docs/references/doc-structure.md +99 -0
  156. package/plugins/xtrm-tools/skills/sync-docs/references/schema.md +103 -0
  157. package/plugins/xtrm-tools/skills/sync-docs/scripts/changelog/add_entry.py +216 -0
  158. package/plugins/xtrm-tools/skills/sync-docs/scripts/context_gatherer.py +240 -0
  159. package/plugins/xtrm-tools/skills/sync-docs/scripts/doc_structure_analyzer.py +495 -0
  160. package/plugins/xtrm-tools/skills/sync-docs/scripts/drift_detector.py +563 -0
  161. package/plugins/xtrm-tools/skills/sync-docs/scripts/validate_doc.py +365 -0
  162. package/plugins/xtrm-tools/skills/sync-docs/scripts/validate_metadata.py +185 -0
  163. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/benchmark.json +293 -0
  164. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/benchmark.md +13 -0
  165. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-doc-audit/eval_metadata.json +27 -0
  166. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-doc-audit/with_skill/outputs/result.md +210 -0
  167. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-doc-audit/with_skill/run-1/grading.json +28 -0
  168. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-doc-audit/with_skill/run-1/timing.json +1 -0
  169. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-doc-audit/without_skill/outputs/result.md +101 -0
  170. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-doc-audit/without_skill/run-1/grading.json +28 -0
  171. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-doc-audit/without_skill/run-1/timing.json +5 -0
  172. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-doc-audit/without_skill/timing.json +5 -0
  173. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-fix-mode/eval_metadata.json +27 -0
  174. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-fix-mode/with_skill/outputs/result.md +198 -0
  175. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-fix-mode/with_skill/run-1/grading.json +28 -0
  176. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-fix-mode/with_skill/run-1/timing.json +1 -0
  177. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-fix-mode/without_skill/outputs/result.md +94 -0
  178. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-fix-mode/without_skill/run-1/grading.json +28 -0
  179. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-fix-mode/without_skill/run-1/timing.json +1 -0
  180. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-sprint-closeout/eval_metadata.json +27 -0
  181. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-sprint-closeout/with_skill/outputs/result.md +237 -0
  182. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-sprint-closeout/with_skill/run-1/grading.json +28 -0
  183. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-sprint-closeout/with_skill/run-1/timing.json +1 -0
  184. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-sprint-closeout/without_skill/outputs/result.md +134 -0
  185. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-sprint-closeout/without_skill/run-1/grading.json +28 -0
  186. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-1/eval-sprint-closeout/without_skill/run-1/timing.json +1 -0
  187. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/benchmark.json +297 -0
  188. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/benchmark.md +13 -0
  189. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-doc-audit/eval_metadata.json +27 -0
  190. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-doc-audit/with_skill/outputs/result.md +137 -0
  191. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-doc-audit/with_skill/run-1/grading.json +92 -0
  192. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-doc-audit/with_skill/run-1/timing.json +1 -0
  193. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-doc-audit/without_skill/outputs/result.md +134 -0
  194. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-doc-audit/without_skill/run-1/grading.json +86 -0
  195. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-doc-audit/without_skill/run-1/timing.json +1 -0
  196. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-fix-mode/eval_metadata.json +27 -0
  197. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-fix-mode/with_skill/outputs/result.md +193 -0
  198. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-fix-mode/with_skill/run-1/grading.json +72 -0
  199. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-fix-mode/with_skill/run-1/timing.json +1 -0
  200. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-fix-mode/without_skill/outputs/result.md +211 -0
  201. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-fix-mode/without_skill/run-1/grading.json +91 -0
  202. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-fix-mode/without_skill/run-1/timing.json +5 -0
  203. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-sprint-closeout/eval_metadata.json +27 -0
  204. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-sprint-closeout/with_skill/outputs/result.md +182 -0
  205. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-sprint-closeout/with_skill/run-1/grading.json +95 -0
  206. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-sprint-closeout/with_skill/run-1/timing.json +1 -0
  207. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-sprint-closeout/without_skill/outputs/result.md +222 -0
  208. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-sprint-closeout/without_skill/run-1/grading.json +88 -0
  209. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-2/eval-sprint-closeout/without_skill/run-1/timing.json +5 -0
  210. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/benchmark.json +298 -0
  211. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/benchmark.md +13 -0
  212. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-doc-audit/eval_metadata.json +27 -0
  213. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-doc-audit/with_skill/outputs/result.md +125 -0
  214. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-doc-audit/with_skill/run-1/grading.json +97 -0
  215. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-doc-audit/with_skill/run-1/timing.json +5 -0
  216. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-doc-audit/without_skill/outputs/result.md +144 -0
  217. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-doc-audit/without_skill/run-1/grading.json +78 -0
  218. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-doc-audit/without_skill/run-1/timing.json +5 -0
  219. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-fix-mode/eval_metadata.json +27 -0
  220. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-fix-mode/with_skill/outputs/result.md +104 -0
  221. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-fix-mode/with_skill/run-1/grading.json +91 -0
  222. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-fix-mode/with_skill/run-1/timing.json +5 -0
  223. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-fix-mode/without_skill/outputs/result.md +79 -0
  224. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-fix-mode/without_skill/run-1/grading.json +82 -0
  225. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-fix-mode/without_skill/run-1/timing.json +5 -0
  226. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-sprint-closeout/eval_metadata.json +27 -0
  227. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase1_context.json +302 -0
  228. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase2_drift.txt +33 -0
  229. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase3_analysis.json +114 -0
  230. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase4_fix.txt +118 -0
  231. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/phase5_validate.txt +38 -0
  232. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/outputs/result.md +158 -0
  233. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/run-1/grading.json +95 -0
  234. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-sprint-closeout/with_skill/run-1/timing.json +5 -0
  235. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-sprint-closeout/without_skill/outputs/result.md +71 -0
  236. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-sprint-closeout/without_skill/run-1/grading.json +90 -0
  237. package/plugins/xtrm-tools/skills/sync-docs-workspace/iteration-3/eval-sprint-closeout/without_skill/run-1/timing.json +5 -0
  238. package/plugins/xtrm-tools/skills/test-planning/SKILL.md +208 -0
  239. package/plugins/xtrm-tools/skills/test-planning/evals/evals.json +23 -0
  240. package/plugins/xtrm-tools/skills/updating-service-skills/SKILL.md +136 -0
  241. package/plugins/xtrm-tools/skills/updating-service-skills/scripts/drift_detector.py +222 -0
  242. package/plugins/xtrm-tools/skills/using-TDD/SKILL.md +410 -0
  243. package/plugins/xtrm-tools/skills/using-quality-gates/SKILL.md +254 -0
  244. package/plugins/xtrm-tools/skills/using-serena-lsp/README.md +8 -0
  245. package/plugins/xtrm-tools/skills/using-serena-lsp/REFERENCE.md +194 -0
  246. package/plugins/xtrm-tools/skills/using-serena-lsp/SKILL.md +82 -0
  247. package/plugins/xtrm-tools/skills/using-service-skills/SKILL.md +108 -0
  248. package/plugins/xtrm-tools/skills/using-service-skills/scripts/cataloger.py +74 -0
  249. package/plugins/xtrm-tools/skills/using-service-skills/scripts/skill_activator.py +152 -0
  250. package/plugins/xtrm-tools/skills/using-service-skills/scripts/test_skill_activator.py +58 -0
  251. package/plugins/xtrm-tools/skills/using-xtrm/SKILL.md +124 -0
  252. package/plugins/xtrm-tools/skills/xt-end/SKILL.md +128 -0
@@ -0,0 +1,345 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Python Quality Gate - PostToolUse hook for Claude Code.
4
+ Runs ruff (linting/formatting) and mypy (type checking) on edited Python files.
5
+
6
+ Exit codes:
7
+ 0 - All checks passed
8
+ 1 - Fatal error
9
+ 2 - Blocking errors found (Claude must fix)
10
+ """
11
+
12
+ import json
13
+ import os
14
+ import sys
15
+ import subprocess
16
+ import shutil
17
+ from pathlib import Path
18
+
19
+ # Colors for output
20
+ class Colors:
21
+ RED = '\x1b[0;31m'
22
+ GREEN = '\x1b[0;32m'
23
+ YELLOW = '\x1b[0;33m'
24
+ BLUE = '\x1b[0;34m'
25
+ CYAN = '\x1b[0;36m'
26
+ RESET = '\x1b[0m'
27
+
28
+ def log_info(msg: str):
29
+ print(f"{Colors.BLUE}[INFO]{Colors.RESET} {msg}")
30
+
31
+ def log_error(msg: str):
32
+ print(f"{Colors.RED}[ERROR]{Colors.RESET} {msg}")
33
+
34
+ def log_success(msg: str):
35
+ print(f"{Colors.GREEN}[OK]{Colors.RESET} {msg}")
36
+
37
+ def log_warning(msg: str):
38
+ print(f"{Colors.YELLOW}[WARN]{Colors.RESET} {msg}")
39
+
40
+ def log_debug(msg: str):
41
+ if os.environ.get('CLAUDE_HOOKS_DEBUG', 'false').lower() == 'true':
42
+ print(f"{Colors.CYAN}[DEBUG]{Colors.RESET} {msg}")
43
+
44
+ def find_project_root(file_path: str) -> str:
45
+ """Find project root by looking for pyproject.toml, setup.py, or .git"""
46
+ path = Path(file_path).parent
47
+ while path != path.parent:
48
+ if (path / 'pyproject.toml').exists() or \
49
+ (path / 'setup.py').exists() or \
50
+ (path / '.git').exists():
51
+ return str(path)
52
+ path = path.parent
53
+ return str(path)
54
+
55
+ def is_python_file(file_path: str) -> bool:
56
+ """Check if file is a Python source file"""
57
+ return file_path.endswith('.py') and not file_path.endswith('__init__.py')
58
+
59
+
60
+ def has_python_project_config(project_root: str) -> bool:
61
+ """Return True when Python quality checks are configured for this project."""
62
+ root = Path(project_root)
63
+ return (root / 'pyproject.toml').exists() or (root / '.python-version').exists()
64
+
65
+ def check_ruff(file_path: str, project_root: str, autofix: bool = False) -> tuple[bool, list[str], list[str]]:
66
+ """
67
+ Run ruff linting and formatting checks.
68
+ Returns: (passed, errors, autofixes)
69
+ """
70
+ errors = []
71
+ autofixes = []
72
+
73
+ # Check if ruff is available
74
+ ruff_path = shutil.which('ruff')
75
+ if not ruff_path:
76
+ log_debug('Ruff not found in PATH - skipping ruff checks')
77
+ return True, errors, autofixes
78
+
79
+ log_info('Running Ruff linting...')
80
+
81
+ # Run ruff check
82
+ cmd = ['ruff', 'check', '--output-format=full', file_path]
83
+ try:
84
+ result = subprocess.run(cmd, capture_output=True, text=True, cwd=project_root)
85
+
86
+ if result.returncode != 0:
87
+ if autofix:
88
+ log_warning('Ruff issues found, attempting auto-fix...')
89
+ fix_cmd = ['ruff', 'check', '--fix', file_path]
90
+ fix_result = subprocess.run(fix_cmd, capture_output=True, text=True, cwd=project_root)
91
+
92
+ if fix_result.returncode == 0:
93
+ log_success('Ruff auto-fixed all issues!')
94
+ autofixes.append('Ruff auto-fixed linting issues')
95
+ else:
96
+ errors.append(f'Ruff found issues that could not be auto-fixed')
97
+ errors.extend(result.stdout.strip().split('\n'))
98
+ else:
99
+ errors.append(f'Ruff found linting issues in {os.path.basename(file_path)}')
100
+ errors.extend(result.stdout.strip().split('\n'))
101
+ else:
102
+ log_success('Ruff linting passed')
103
+
104
+ except Exception as e:
105
+ log_debug(f'Ruff check error: {e}')
106
+
107
+ # Run ruff format check
108
+ log_info('Running Ruff format check...')
109
+ format_cmd = ['ruff', 'format', '--check', file_path]
110
+ try:
111
+ result = subprocess.run(format_cmd, capture_output=True, text=True, cwd=project_root)
112
+
113
+ if result.returncode != 0:
114
+ if autofix:
115
+ log_warning('Ruff format issues found, auto-formatting...')
116
+ format_fix_cmd = ['ruff', 'format', file_path]
117
+ format_fix_result = subprocess.run(format_fix_cmd, capture_output=True, text=True, cwd=project_root)
118
+
119
+ if format_fix_result.returncode == 0:
120
+ log_success('Ruff auto-formatted the file!')
121
+ autofixes.append('Ruff auto-formatted the file')
122
+ else:
123
+ errors.append(f'Ruff formatting issues in {os.path.basename(file_path)}')
124
+ else:
125
+ errors.append(f'Ruff formatting issues in {os.path.basename(file_path)}')
126
+ else:
127
+ log_success('Ruff formatting correct')
128
+
129
+ except Exception as e:
130
+ log_debug(f'Ruff format error: {e}')
131
+
132
+ return len(errors) == 0, errors, autofixes
133
+
134
+ def check_mypy(file_path: str, project_root: str) -> tuple[bool, list[str]]:
135
+ """
136
+ Run mypy type checking.
137
+ Returns: (passed, errors)
138
+ """
139
+ errors = []
140
+
141
+ # Check if mypy is available
142
+ mypy_path = shutil.which('mypy')
143
+ if not mypy_path:
144
+ log_debug('Mypy not found in PATH - skipping type checking')
145
+ return True, errors
146
+
147
+ log_info('Running Mypy type checking...')
148
+
149
+ # Build mypy command with strictness flags
150
+ # Default: --disallow-untyped-defs catches untyped function parameters
151
+ # Opt-in: CLAUDE_HOOKS_MYPY_STRICT=true enables full --strict mode
152
+ mypy_strict = os.environ.get('CLAUDE_HOOKS_MYPY_STRICT', 'false').lower() == 'true'
153
+
154
+ if mypy_strict:
155
+ cmd = ['mypy', '--strict', '--pretty', file_path]
156
+ log_debug('Running mypy with --strict (full strictness)')
157
+ else:
158
+ cmd = ['mypy', '--disallow-untyped-defs', '--pretty', file_path]
159
+ log_debug('Running mypy with --disallow-untyped-defs (baseline strictness)')
160
+ try:
161
+ result = subprocess.run(cmd, capture_output=True, text=True, cwd=project_root)
162
+
163
+ if result.returncode != 0:
164
+ errors.append(f'Mypy found type errors in {os.path.basename(file_path)}')
165
+ if result.stdout:
166
+ errors.extend(result.stdout.strip().split('\n'))
167
+ if result.stderr:
168
+ errors.extend(result.stderr.strip().split('\n'))
169
+ else:
170
+ log_success('Mypy type checking passed')
171
+
172
+ except Exception as e:
173
+ log_debug(f'Mypy error: {e}')
174
+
175
+ return len(errors) == 0, errors
176
+
177
+ def check_pytest_suggestions(file_path: str, project_root: str):
178
+ """Suggest running tests if test file exists"""
179
+ base_name = file_path.replace('.py', '')
180
+ test_paths = [
181
+ f'{base_name}_test.py',
182
+ f'{base_name}_tests.py',
183
+ f'test_{Path(file_path).name}',
184
+ ]
185
+
186
+ # Check same directory
187
+ for test_path in test_paths:
188
+ if Path(test_path).exists():
189
+ log_warning(f'💡 Related test found: {os.path.basename(test_path)}')
190
+ log_warning(' Consider running: pytest')
191
+ return
192
+
193
+ # Check __tests__ directory
194
+ tests_dir = Path(file_path).parent / '__tests__'
195
+ if tests_dir.exists():
196
+ for test_path in tests_dir.glob(f'test_{Path(file_path).name}'):
197
+ log_warning(f'💡 Related test found: __tests__/{test_path.name}')
198
+ log_warning(' Consider running: pytest')
199
+ return
200
+
201
+ log_warning(f'💡 No test file found for {os.path.basename(file_path)}')
202
+
203
+ def print_summary(errors: list[str], autofixes: list[str]):
204
+ """Print summary of errors and autofixes"""
205
+ if autofixes:
206
+ print(f'\n{Colors.BLUE}═══ Auto-fixes Applied ═══{Colors.RESET}')
207
+ for fix in autofixes:
208
+ print(f'{Colors.GREEN}✨{Colors.RESET} {fix}')
209
+ print(f'{Colors.GREEN}Automatically fixed {len(autofixes)} issue(s)!{Colors.RESET}')
210
+
211
+ if errors:
212
+ print(f'\n{Colors.BLUE}═══ Quality Check Summary ═══{Colors.RESET}')
213
+ for error in errors:
214
+ print(f'{Colors.RED}❌{Colors.RESET} {error}')
215
+ print(f'\n{Colors.RED}Found {len(errors)} issue(s) that MUST be fixed!{Colors.RESET}')
216
+ print(f'{Colors.RED}══════════════════════════════════════{Colors.RESET}')
217
+ print(f'{Colors.RED}❌ ALL ISSUES ARE BLOCKING ❌{Colors.RESET}')
218
+ print(f'{Colors.RED}══════════════════════════════════════{Colors.RESET}')
219
+ print(f'{Colors.RED}Fix EVERYTHING above until all checks are ✅ GREEN{Colors.RESET}')
220
+
221
+ def parse_json_input() -> dict:
222
+ """Parse JSON input from stdin"""
223
+ input_data = sys.stdin.read().strip()
224
+
225
+ if not input_data:
226
+ log_warning('No JSON input provided.')
227
+ print(f'\n{Colors.YELLOW}👉 Hook executed but no input to process.{Colors.RESET}')
228
+ sys.exit(0)
229
+
230
+ try:
231
+ return json.loads(input_data)
232
+ except json.JSONDecodeError as e:
233
+ log_error(f'Failed to parse JSON: {e}')
234
+ sys.exit(1)
235
+
236
+ def extract_file_path(input_data: dict) -> str | None:
237
+ """Extract file path from tool input, including Serena relative_path."""
238
+ tool_input = input_data.get('tool_input', {})
239
+ file_path = (
240
+ tool_input.get('file_path')
241
+ or tool_input.get('path')
242
+ or tool_input.get('relative_path')
243
+ )
244
+ if not file_path:
245
+ return None
246
+
247
+ # Serena tools pass relative_path relative to the project root.
248
+ if not os.path.isabs(file_path):
249
+ project_root = os.environ.get('CLAUDE_PROJECT_DIR') or os.getcwd()
250
+ return str(Path(project_root) / file_path)
251
+
252
+ return file_path
253
+
254
+ def main():
255
+ """Main entry point"""
256
+ print('')
257
+ print(f'📦 Python Quality Check - Starting...')
258
+ print('─────────────────────────────────────')
259
+
260
+ # Parse input
261
+ input_data = parse_json_input()
262
+ file_path = extract_file_path(input_data)
263
+
264
+ if not file_path:
265
+ log_warning('No file path found in JSON input.')
266
+ print(f'\n{Colors.YELLOW}👉 No file to check - tool may not be file-related.{Colors.RESET}')
267
+ sys.exit(0)
268
+
269
+ # Check if file exists
270
+ if not Path(file_path).exists():
271
+ log_info(f'File does not exist: {file_path}')
272
+ print(f'\n{Colors.YELLOW}👉 File skipped - doesn\'t exist.{Colors.RESET}')
273
+ sys.exit(0)
274
+
275
+ # Skip non-Python files
276
+ if not is_python_file(file_path):
277
+ log_info(f'Skipping non-Python file: {file_path}')
278
+ print(f'\n{Colors.GREEN}✅ No checks needed for {os.path.basename(file_path)}{Colors.RESET}')
279
+ sys.exit(0)
280
+
281
+ # Update header
282
+ print('')
283
+ print(f'🔍 Validating: {os.path.basename(file_path)}')
284
+ print('─────────────────────────────────────')
285
+ log_info(f'Checking: {file_path}')
286
+
287
+ # Find project root
288
+ project_root = find_project_root(file_path)
289
+ log_debug(f'Project root: {project_root}')
290
+
291
+ if not has_python_project_config(project_root):
292
+ log_info('No pyproject.toml or .python-version found - skipping Python quality checks')
293
+ print(f'\n{Colors.GREEN}✅ No Python project config detected; skipping checks for {os.path.basename(file_path)}{Colors.RESET}')
294
+ sys.exit(0)
295
+
296
+ # Get config from environment
297
+ autofix = os.environ.get('CLAUDE_HOOKS_AUTOFIX', 'true').lower() == 'true'
298
+ ruff_enabled = os.environ.get('CLAUDE_HOOKS_RUFF_ENABLED', 'true').lower() != 'false'
299
+ mypy_enabled = os.environ.get('CLAUDE_HOOKS_MYPY_ENABLED', 'true').lower() != 'false'
300
+
301
+ all_errors = []
302
+ all_autofixes = []
303
+
304
+ # Run ruff checks
305
+ if ruff_enabled:
306
+ ruff_passed, ruff_errors, ruff_autofixes = check_ruff(file_path, project_root, autofix)
307
+ all_errors.extend(ruff_errors)
308
+ all_autofixes.extend(ruff_autofixes)
309
+
310
+ # Run mypy checks
311
+ if mypy_enabled:
312
+ mypy_passed, mypy_errors = check_mypy(file_path, project_root)
313
+ all_errors.extend(mypy_errors)
314
+
315
+ # Print summary
316
+ print_summary(all_errors, all_autofixes)
317
+
318
+ # Exit with appropriate code
319
+ if all_errors:
320
+ print(f'\n{Colors.RED}🛑 FAILED - Fix issues in your edited file! 🛑{Colors.RESET}')
321
+ print(f'{Colors.CYAN}💡 CLAUDE.md CHECK:{Colors.RESET}')
322
+ print(f'{Colors.CYAN} → What CLAUDE.md pattern would have prevented this?{Colors.RESET}')
323
+ print(f'{Colors.YELLOW}📋 NEXT STEPS:{Colors.RESET}')
324
+ print(f'{Colors.YELLOW} 1. Fix the issues listed above{Colors.RESET}')
325
+ print(f'{Colors.YELLOW} 2. The hook will run again automatically{Colors.RESET}')
326
+ print(f'{Colors.YELLOW} 3. Continue once all checks pass{Colors.RESET}')
327
+ sys.exit(2)
328
+ else:
329
+ print(f'\n{Colors.GREEN}✅ Quality check passed for {os.path.basename(file_path)}{Colors.RESET}')
330
+ if all_autofixes:
331
+ print(f'\n{Colors.YELLOW}👉 File quality verified. Auto-fixes applied. Continue with your task.{Colors.RESET}')
332
+ else:
333
+ print(f'\n{Colors.YELLOW}👉 File quality verified. Continue with your task.{Colors.RESET}')
334
+
335
+ # Suggest tests
336
+ check_pytest_suggestions(file_path, project_root)
337
+
338
+ sys.exit(0)
339
+
340
+ if __name__ == '__main__':
341
+ try:
342
+ main()
343
+ except Exception as e:
344
+ log_error(f'Fatal error: {e}')
345
+ sys.exit(1)
@@ -0,0 +1,145 @@
1
+ #!/usr/bin/env node
2
+ // statusline.mjs — Claude Code statusLine for xt claude sessions
3
+ // Line 1: XTRM dim(model [xx%]) hostname bold(dir) dim(branch (status)) dim((venv))
4
+ // Line 2: ◐ italic(claim title) OR ○ bold(N) open — no background
5
+ //
6
+ // Colors: bold/dim/italic only — no explicit fg/bg, adapts to dark & light themes.
7
+ // State: .xtrm/statusline-claim (written by beads-claim-sync.mjs)
8
+ // Cache: /tmp per cwd, 5s TTL
9
+
10
+ import { execSync } from 'node:child_process';
11
+ import { readFileSync, writeFileSync, existsSync } from 'node:fs';
12
+ import { join, basename, relative } from 'node:path';
13
+ import { tmpdir, hostname } from 'node:os';
14
+ import { createHash } from 'node:crypto';
15
+
16
+ // Claude Code passes statusline context as JSON on stdin
17
+ let ctx = {};
18
+ try { ctx = JSON.parse(readFileSync(0, 'utf8')); } catch {}
19
+
20
+ const cwd = ctx?.workspace?.current_dir ?? process.cwd();
21
+ const cacheKey = createHash('md5').update(cwd).digest('hex').slice(0, 8);
22
+ const CACHE_FILE = join(tmpdir(), `xtrm-sl-${cacheKey}.json`);
23
+ const CACHE_TTL = 5000;
24
+
25
+ function run(cmd) {
26
+ try {
27
+ return execSync(cmd, { encoding: 'utf8', cwd, stdio: ['pipe', 'pipe', 'pipe'], timeout: 2000 }).trim();
28
+ } catch { return null; }
29
+ }
30
+
31
+ function getCached() {
32
+ try {
33
+ const c = JSON.parse(readFileSync(CACHE_FILE, 'utf8'));
34
+ if (Date.now() - c.ts < CACHE_TTL) return c.data;
35
+ } catch {}
36
+ return null;
37
+ }
38
+
39
+ function setCache(data) {
40
+ try { writeFileSync(CACHE_FILE, JSON.stringify({ ts: Date.now(), data })); } catch {}
41
+ }
42
+
43
+ // ANSI — bold/dim/italic only; no explicit fg/bg colors
44
+ const R = '\x1b[0m';
45
+ const B = '\x1b[1m'; // bold on
46
+ const B_ = '\x1b[22m'; // bold off (normal intensity)
47
+ const D = '\x1b[2m'; // dim on
48
+ const I = '\x1b[3m'; // italic on
49
+ const I_ = '\x1b[23m'; // italic off
50
+
51
+ let data = getCached();
52
+ if (!data) {
53
+ // Model + token %
54
+ const modelId = ctx?.model?.display_name ?? ctx?.model?.id ?? null;
55
+ const pct = ctx?.context_window?.used_percentage;
56
+ const modelStr = modelId ? `${modelId}${pct != null ? ` [${Math.round(pct)}%]` : ''}` : null;
57
+
58
+ // Short hostname
59
+ const host = hostname().split('.')[0];
60
+
61
+ // Directory — repo-relative like the global script
62
+ const repoRoot = run('git rev-parse --show-toplevel');
63
+ let displayDir;
64
+ if (repoRoot) {
65
+ const rel = relative(repoRoot, cwd) || '.';
66
+ displayDir = rel === '.' ? basename(repoRoot) : `${basename(repoRoot)}/${rel}`;
67
+ } else {
68
+ displayDir = cwd.replace(process.env.HOME ?? '', '~');
69
+ }
70
+
71
+ // Branch + git status indicators
72
+ let branch = null;
73
+ let gitStatus = '';
74
+ if (repoRoot) {
75
+ branch = run('git -c core.useBuiltinFSMonitor=false branch --show-current') || run('git rev-parse --short HEAD');
76
+ const porcelain = run('git -c core.useBuiltinFSMonitor=false --no-optional-locks status --porcelain') ?? '';
77
+ let modified = false, staged = false, deleted = false;
78
+ for (const l of porcelain.split('\n').filter(Boolean)) {
79
+ if (/^ M|^AM|^MM/.test(l)) modified = true;
80
+ if (/^A |^M /.test(l)) staged = true;
81
+ if (/^ D|^D /.test(l)) deleted = true;
82
+ }
83
+ let st = (modified ? '*' : '') + (staged ? '+' : '') + (deleted ? '-' : '');
84
+ const ab = run('git -c core.useBuiltinFSMonitor=false --no-optional-locks rev-list --left-right --count @{upstream}...HEAD');
85
+ if (ab) {
86
+ const [behind, ahead] = ab.split(/\s+/).map(Number);
87
+ if (ahead > 0 && behind > 0) st += '↕';
88
+ else if (ahead > 0) st += '↑';
89
+ else if (behind > 0) st += '↓';
90
+ }
91
+ if (st) gitStatus = `(${st})`;
92
+ }
93
+
94
+ // Python venv
95
+ const venv = process.env.VIRTUAL_ENV ? `(${basename(process.env.VIRTUAL_ENV)})` : null;
96
+
97
+ // Beads
98
+ let claimId = null;
99
+ let claimTitle = null;
100
+ let openCount = 0;
101
+ if (existsSync(join(cwd, '.beads'))) {
102
+ const claimFile = join(cwd, '.xtrm', 'statusline-claim');
103
+ claimId = existsSync(claimFile) ? (readFileSync(claimFile, 'utf8').trim() || null) : null;
104
+ if (claimId) {
105
+ try {
106
+ const raw = run(`bd show ${claimId} --json`);
107
+ claimTitle = raw ? (JSON.parse(raw)?.[0]?.title ?? null) : null;
108
+ } catch {}
109
+ }
110
+ if (!claimTitle) {
111
+ const m = run('bd list')?.match(/\((\d+)\s+open/);
112
+ if (m) openCount = parseInt(m[1], 10);
113
+ }
114
+ }
115
+
116
+ data = { modelStr, host, displayDir, branch, gitStatus, venv, claimId, claimTitle, openCount };
117
+ setCache(data);
118
+ }
119
+
120
+ const { modelStr, host, displayDir, branch, gitStatus, venv, claimId, claimTitle, openCount } = data;
121
+
122
+ // Line 1 — matches global format, XTRM prepended
123
+ const parts = [`${B}XTRM${B_}`];
124
+ if (modelStr) parts.push(`${D}${modelStr}${R}`);
125
+ parts.push(host);
126
+ if (displayDir) parts.push(`${B}${displayDir}${B_}`);
127
+ if (branch) parts.push(`${D}${[branch, gitStatus].filter(Boolean).join(' ')}${R}`);
128
+ if (venv) parts.push(`${D}${venv}${R}`);
129
+ const line1 = parts.join(' ');
130
+
131
+ // Line 2 — no background; open count bold
132
+ let line2;
133
+ if (claimTitle) {
134
+ const cols = process.stdout.columns || 80;
135
+ const prefix = ` ◐ ${claimId} `;
136
+ const prefixLen = prefix.replace(/\x1b\[[0-9;]*m/g, '').length;
137
+ const maxLen = cols - prefixLen - 1;
138
+ const t = claimTitle.length > maxLen ? claimTitle.slice(0, maxLen - 1) + '…' : claimTitle;
139
+ line2 = `${prefix}${I}${t}${I_}`;
140
+ } else {
141
+ line2 = ` ○ ${openCount > 0 ? `${B}${openCount}${B_} open` : 'no open issues'}`;
142
+ }
143
+
144
+ process.stdout.write(line1 + '\n' + line2 + '\n');
145
+ process.exit(0);
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+ // using-xtrm-reminder.mjs — Claude Code SessionStart hook
3
+ // Reads skills/using-xtrm/SKILL.md and injects it as additionalSystemPrompt
4
+ // so the agent starts every session already oriented on the xtrm workflow.
5
+ // Exit 0 in all paths (fail open).
6
+
7
+ import { readFileSync } from 'node:fs';
8
+ import { join } from 'node:path';
9
+
10
+ let input;
11
+ try { input = JSON.parse(readFileSync(0, 'utf8')); } catch { process.exit(0); }
12
+
13
+ const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT;
14
+ if (!pluginRoot) process.exit(0);
15
+
16
+ const skillPath = join(pluginRoot, 'skills', 'using-xtrm', 'SKILL.md');
17
+ let content;
18
+ try {
19
+ content = readFileSync(skillPath, 'utf8');
20
+ } catch {
21
+ process.exit(0);
22
+ }
23
+
24
+ // Strip YAML frontmatter (--- ... ---\n)
25
+ content = content.replace(/^---[\s\S]*?---\n/, '').trim();
26
+
27
+ process.stdout.write(
28
+ JSON.stringify({
29
+ hookSpecificOutput: {
30
+ hookEventName: 'SessionStart',
31
+ additionalSystemPrompt: content,
32
+ },
33
+ }) + '\n',
34
+ );
35
+ process.exit(0);
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ // worktree-boundary.mjs — Claude Code PreToolUse hook
3
+ // Blocks Write/Edit when the target file is outside the active worktree root.
4
+ // Only active when session cwd is inside .xtrm/worktrees/<name>.
5
+ // Fail-open: any unexpected error allows the edit through.
6
+ //
7
+ // Installed by: xtrm install
8
+
9
+ import { readFileSync } from 'node:fs';
10
+ import { resolve } from 'node:path';
11
+
12
+ let input = {};
13
+ try { input = JSON.parse(readFileSync(0, 'utf8')); } catch { process.exit(0); }
14
+
15
+ const cwd = input.cwd ?? process.env.CLAUDE_PROJECT_DIR ?? process.cwd();
16
+ const filePath = input?.tool_input?.file_path;
17
+ if (!filePath) process.exit(0);
18
+
19
+ // Detect worktree root from cwd
20
+ const m = cwd.match(/^(.+\/\.xtrm\/worktrees\/[^/]+)/);
21
+ if (!m) process.exit(0); // not in a worktree — no constraint
22
+
23
+ const worktreeRoot = m[1];
24
+ const abs = resolve(cwd, filePath);
25
+
26
+ if (abs === worktreeRoot || abs.startsWith(worktreeRoot + '/')) process.exit(0);
27
+
28
+ process.stdout.write(JSON.stringify({
29
+ decision: 'block',
30
+ reason: `🚫 Edit outside worktree boundary.\n File: ${abs}\n Allowed: ${worktreeRoot}\n\n All edits must stay within the active worktree.`,
31
+ }));
32
+ process.stdout.write('\n');
33
+ process.exit(0);
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env node
2
+ // xtrm-logger.mjs — shared event logger for xtrm hooks
3
+ //
4
+ // Writes to .xtrm/debug.db (SQLite WAL) in the project root.
5
+ // Self-initializing: creates the DB and table on first write.
6
+ // Fails completely silently — logging NEVER affects hook behavior.
7
+ //
8
+ // Usage (from any hook):
9
+ // import { logEvent } from './xtrm-logger.mjs';
10
+ // logEvent({ cwd, sessionId, kind: 'gate.edit.allow', outcome: 'allow', toolName, issueId });
11
+
12
+ import { spawnSync } from 'node:child_process';
13
+ import { existsSync, mkdirSync } from 'node:fs';
14
+ import { join, dirname } from 'node:path';
15
+
16
+ // ── Schema ────────────────────────────────────────────────────────────────────
17
+
18
+ const INIT_SQL = `
19
+ PRAGMA journal_mode=WAL;
20
+ PRAGMA busy_timeout=5000;
21
+ CREATE TABLE IF NOT EXISTS events (
22
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
23
+ ts INTEGER NOT NULL,
24
+ session_id TEXT NOT NULL,
25
+ runtime TEXT NOT NULL,
26
+ worktree TEXT,
27
+ kind TEXT NOT NULL,
28
+ tool_name TEXT,
29
+ outcome TEXT,
30
+ issue_id TEXT,
31
+ duration_ms INTEGER,
32
+ data TEXT
33
+ );
34
+ CREATE INDEX IF NOT EXISTS idx_ts ON events(ts);
35
+ CREATE INDEX IF NOT EXISTS idx_session ON events(session_id);
36
+ CREATE INDEX IF NOT EXISTS idx_kind ON events(kind);
37
+ `;
38
+
39
+ // ── Helpers ───────────────────────────────────────────────────────────────────
40
+
41
+ function findDbPath(cwd) {
42
+ let dir = cwd;
43
+ for (let i = 0; i < 10; i++) {
44
+ if (existsSync(join(dir, '.beads'))) {
45
+ return join(dir, '.xtrm', 'debug.db');
46
+ }
47
+ const parent = join(dir, '..');
48
+ if (parent === dir) break;
49
+ dir = parent;
50
+ }
51
+ return null; // No beads project found — silently skip logging
52
+ }
53
+
54
+ function sqlExec(dbPath, sql) {
55
+ return spawnSync('sqlite3', [dbPath, sql], {
56
+ stdio: ['pipe', 'pipe', 'pipe'],
57
+ encoding: 'utf8',
58
+ timeout: 3000,
59
+ });
60
+ }
61
+
62
+ function ensureDb(dbPath) {
63
+ mkdirSync(dirname(dbPath), { recursive: true });
64
+ sqlExec(dbPath, INIT_SQL);
65
+ }
66
+
67
+ function sqlEsc(val) {
68
+ if (val === null || val === undefined) return 'NULL';
69
+ return `'${String(val).replace(/'/g, "''")}'`;
70
+ }
71
+
72
+ // ── Public API ────────────────────────────────────────────────────────────────
73
+
74
+ /**
75
+ * Log an xtrm event to .xtrm/debug.db.
76
+ *
77
+ * @param {object} params
78
+ * @param {string} params.cwd Project working directory (required)
79
+ * @param {string} params.sessionId Session UUID or Pi PID string (required)
80
+ * @param {string} params.kind Dot-separated kind: 'gate.edit.allow', 'tool.call', 'bd.claimed', etc. (required)
81
+ * @param {string} [params.runtime] 'claude' | 'pi' (default: 'claude')
82
+ * @param {string} [params.outcome] 'allow' | 'block' | 'ok' | 'error'
83
+ * @param {string} [params.toolName] Tool name for gate / tool.call events
84
+ * @param {string} [params.issueId] Linked beads issue ID
85
+ * @param {number} [params.durationMs] Tool call duration
86
+ * @param {object} [params.data] Structured context (file, cmd, reason, etc.)
87
+ * @param {string} [params.message] Legacy: message string (merged into data.msg)
88
+ * @param {object} [params.extra] Legacy: extra object (merged into data)
89
+ */
90
+ export function logEvent(params) {
91
+ try {
92
+ const { cwd, sessionId, kind } = params;
93
+ if (!cwd || !sessionId || !kind) return;
94
+
95
+ const { runtime = 'claude', outcome, toolName, issueId, durationMs, message, extra, data } = params;
96
+
97
+ const dbPath = findDbPath(cwd);
98
+ if (!dbPath) return;
99
+
100
+ const worktreeMatch = cwd.match(/\.xtrm\/worktrees\/([^/]+)/);
101
+ const worktree = worktreeMatch ? worktreeMatch[1] : null;
102
+
103
+ // Merge message/extra/data into a single JSON string
104
+ let dataStr = null;
105
+ if (data !== null && data !== undefined) {
106
+ dataStr = typeof data === 'string' ? data : JSON.stringify(data);
107
+ } else if (message || extra) {
108
+ const merged = { ...(message ? { msg: message } : {}), ...(extra || {}) };
109
+ if (Object.keys(merged).length > 0) dataStr = JSON.stringify(merged);
110
+ }
111
+
112
+ const ts = Date.now();
113
+ const sql = `INSERT INTO events (ts,session_id,runtime,worktree,kind,tool_name,outcome,issue_id,duration_ms,data) VALUES (${ts},${sqlEsc(sessionId)},${sqlEsc(runtime)},${sqlEsc(worktree)},${sqlEsc(kind)},${sqlEsc(toolName ?? null)},${sqlEsc(outcome ?? null)},${sqlEsc(issueId ?? null)},${durationMs ?? 'NULL'},${sqlEsc(dataStr)})`;
114
+
115
+ let result = sqlExec(dbPath, sql);
116
+ if (result.status !== 0) {
117
+ ensureDb(dbPath);
118
+ result = sqlExec(dbPath, sql);
119
+ }
120
+ } catch {
121
+ // Silently swallow all errors — logging never affects hook behavior
122
+ }
123
+ }