hunter-harness 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (566) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +11 -0
  3. package/dist/bin.js +955 -318
  4. package/package.json +1 -1
  5. package/resources/harness/bundles/general/claude-code/.harness-build.json +6 -0
  6. package/resources/harness/{general → bundles/general/claude-code}/agents/harness-reviewer.md +2 -2
  7. package/resources/harness/{general → bundles/general/claude-code}/harness-archive/SKILL.md +1 -1
  8. package/resources/harness/{java → bundles/general/claude-code}/harness-codebase-map/SKILL.md +1 -1
  9. package/resources/harness/{java → bundles/general/claude-code}/harness-knowledge-ingest/SKILL.md +1 -1
  10. package/resources/harness/{general → bundles/general/claude-code}/harness-knowledge-ingest/reference.md +1 -1
  11. package/resources/harness/{general → bundles/general/claude-code}/harness-knowledge-query/SKILL.md +1 -1
  12. package/resources/harness/{general → bundles/general/claude-code}/harness-plan/SKILL.md +1 -1
  13. package/resources/harness/{java → bundles/general/claude-code}/harness-review/SKILL.md +8 -4
  14. package/resources/harness/{general → bundles/general/claude-code}/harness-review/checklist.md +3 -3
  15. package/resources/harness/{general → bundles/general/claude-code}/harness-run/SKILL.md +1 -1
  16. package/resources/harness/{general → bundles/general/claude-code}/harness-run/checklist.md +1 -1
  17. package/resources/harness/{general → bundles/general/claude-code}/harness-run/reference.md +2 -2
  18. package/resources/harness/{general → bundles/general/claude-code}/harness-submit/SKILL.md +1 -1
  19. package/resources/harness/{java → bundles/general/claude-code}/harness-sync/SKILL.md +2 -2
  20. package/resources/harness/{general → bundles/general/claude-code}/harness-sync/reference.md +7 -7
  21. package/resources/harness/{general → bundles/general/claude-code}/harness-test/SKILL.md +1 -1
  22. package/resources/harness/{general → bundles/general/claude-code}/harness-test/checklist.md +1 -1
  23. package/resources/harness/{java → bundles/general/claude-code}/scripts/harness_archive.py +2300 -2300
  24. package/resources/harness/{general → bundles/general/claude-code}/scripts/harness_deploy.py +74 -13
  25. package/resources/harness/{general → bundles/general/claude-code}/scripts/harness_events.py +680 -680
  26. package/resources/harness/{general → bundles/general/claude-code}/scripts/harness_ledger.py +660 -660
  27. package/resources/harness/{java → bundles/general/claude-code}/scripts/harness_preflight.py +765 -765
  28. package/resources/harness/{general → bundles/general/claude-code}/scripts/harness_service.py +1331 -1331
  29. package/resources/harness/bundles/general/codebuddy/.harness-build.json +6 -0
  30. package/resources/harness/bundles/general/codebuddy/agents/harness-evaluator.md +94 -0
  31. package/resources/harness/bundles/general/codebuddy/agents/harness-explorer.md +53 -0
  32. package/resources/harness/bundles/general/codebuddy/agents/harness-reviewer.md +52 -0
  33. package/resources/harness/bundles/general/codebuddy/harness-archive/SKILL.md +198 -0
  34. package/resources/harness/bundles/general/codebuddy/harness-codebase-map/SKILL.md +95 -0
  35. package/resources/harness/bundles/general/codebuddy/harness-knowledge-ingest/SKILL.md +229 -0
  36. package/resources/harness/{java → bundles/general/codebuddy}/harness-knowledge-ingest/reference.md +1 -1
  37. package/resources/harness/bundles/general/codebuddy/harness-knowledge-query/SKILL.md +147 -0
  38. package/resources/harness/bundles/general/codebuddy/harness-plan/SKILL.md +109 -0
  39. package/resources/harness/bundles/general/codebuddy/harness-review/SKILL.md +142 -0
  40. package/resources/harness/{java → bundles/general/codebuddy}/harness-review/checklist.md +3 -3
  41. package/resources/harness/bundles/general/codebuddy/harness-run/SKILL.md +113 -0
  42. package/resources/harness/bundles/general/codebuddy/harness-run/checklist.md +259 -0
  43. package/resources/harness/bundles/general/codebuddy/harness-run/reference.md +834 -0
  44. package/resources/harness/bundles/general/codebuddy/harness-submit/SKILL.md +142 -0
  45. package/resources/harness/bundles/general/codebuddy/harness-sync/SKILL.md +65 -0
  46. package/resources/harness/{java → bundles/general/codebuddy}/harness-sync/reference.md +7 -7
  47. package/resources/harness/bundles/general/codebuddy/harness-test/SKILL.md +160 -0
  48. package/resources/harness/bundles/general/codebuddy/harness-test/checklist.md +319 -0
  49. package/resources/harness/bundles/general/codebuddy/harness-test/reference.md +791 -0
  50. package/resources/harness/{general → bundles/general/codebuddy}/scripts/harness_archive.py +2300 -2300
  51. package/resources/harness/{java → bundles/general/codebuddy}/scripts/harness_deploy.py +74 -13
  52. package/resources/harness/{java → bundles/general/codebuddy}/scripts/harness_events.py +680 -680
  53. package/resources/harness/{java → bundles/general/codebuddy}/scripts/harness_ledger.py +660 -660
  54. package/resources/harness/{general → bundles/general/codebuddy}/scripts/harness_preflight.py +765 -765
  55. package/resources/harness/{java → bundles/general/codebuddy}/scripts/harness_service.py +1331 -1331
  56. package/resources/harness/bundles/general/codex/.harness-build.json +6 -0
  57. package/resources/harness/bundles/general/codex/CONTEXT.md +65 -0
  58. package/resources/harness/bundles/general/codex/README.md +478 -0
  59. package/resources/harness/bundles/general/codex/harness-archive/SKILL.md +198 -0
  60. package/resources/harness/bundles/general/codex/harness-archive/checklist.md +52 -0
  61. package/resources/harness/bundles/general/codex/harness-archive/reference.md +103 -0
  62. package/resources/harness/bundles/general/codex/harness-archive/scripts/gen-manifest.ps1 +31 -0
  63. package/resources/harness/bundles/general/codex/harness-archive/templates/render-summary.mjs +171 -0
  64. package/resources/harness/bundles/general/codex/harness-archive/templates/summary-data-template.json +128 -0
  65. package/resources/harness/bundles/general/codex/harness-codebase-map/SKILL.md +95 -0
  66. package/resources/harness/bundles/general/codex/harness-codebase-map/checklist.md +126 -0
  67. package/resources/harness/bundles/general/codex/harness-codebase-map/reference.md +364 -0
  68. package/resources/harness/bundles/general/codex/harness-codebase-map/templates/ARCHITECTURE.md +57 -0
  69. package/resources/harness/bundles/general/codex/harness-codebase-map/templates/CONCERNS.md +49 -0
  70. package/resources/harness/bundles/general/codex/harness-codebase-map/templates/CONVENTIONS.md +57 -0
  71. package/resources/harness/bundles/general/codex/harness-codebase-map/templates/INTEGRATIONS.md +52 -0
  72. package/resources/harness/bundles/general/codex/harness-codebase-map/templates/STACK.md +55 -0
  73. package/resources/harness/bundles/general/codex/harness-codebase-map/templates/STRUCTURE.md +69 -0
  74. package/resources/harness/bundles/general/codex/harness-codebase-map/templates/TESTING.md +64 -0
  75. package/resources/harness/bundles/general/codex/harness-codebase-map/templates/map-manifest.schema.json +73 -0
  76. package/resources/harness/bundles/general/codex/harness-codebase-map/templates/map-summary.md +64 -0
  77. package/resources/harness/bundles/general/codex/harness-knowledge-ingest/SKILL.md +229 -0
  78. package/resources/harness/bundles/general/codex/harness-knowledge-ingest/design.md +842 -0
  79. package/resources/harness/bundles/general/codex/harness-knowledge-ingest/evaluations/harness_knowledge_evaluation.xml +42 -0
  80. package/resources/harness/bundles/general/codex/harness-knowledge-ingest/mcp-config.example.json +10 -0
  81. package/resources/harness/bundles/general/codex/harness-knowledge-ingest/reference.md +309 -0
  82. package/resources/harness/bundles/general/codex/harness-knowledge-ingest/scripts/harness_knowledge.py +4082 -0
  83. package/resources/harness/bundles/general/codex/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +273 -0
  84. package/resources/harness/bundles/general/codex/harness-knowledge-query/SKILL.md +147 -0
  85. package/resources/harness/bundles/general/codex/harness-plan/SKILL.md +109 -0
  86. package/resources/harness/bundles/general/codex/harness-plan/checklist.md +243 -0
  87. package/resources/harness/bundles/general/codex/harness-plan/protocols.md +124 -0
  88. package/resources/harness/bundles/general/codex/harness-plan/reference.md +376 -0
  89. package/resources/harness/bundles/general/codex/harness-review/SKILL.md +137 -0
  90. package/resources/harness/bundles/general/codex/harness-review/checklist.md +124 -0
  91. package/resources/harness/bundles/general/codex/harness-review/protocols.md +68 -0
  92. package/resources/harness/bundles/general/codex/harness-review/reference.md +86 -0
  93. package/resources/harness/bundles/general/codex/harness-run/SKILL.md +113 -0
  94. package/resources/harness/bundles/general/codex/harness-run/checklist.md +259 -0
  95. package/resources/harness/bundles/general/codex/harness-run/protocols.md +78 -0
  96. package/resources/harness/bundles/general/codex/harness-run/reference.md +834 -0
  97. package/resources/harness/bundles/general/codex/harness-submit/SKILL.md +142 -0
  98. package/resources/harness/bundles/general/codex/harness-submit/checklist.md +407 -0
  99. package/resources/harness/bundles/general/codex/harness-submit/reference.md +152 -0
  100. package/resources/harness/bundles/general/codex/harness-sync/SKILL.md +65 -0
  101. package/resources/harness/bundles/general/codex/harness-sync/reference.md +153 -0
  102. package/resources/harness/bundles/general/codex/harness-test/SKILL.md +160 -0
  103. package/resources/harness/bundles/general/codex/harness-test/checklist.md +319 -0
  104. package/resources/harness/bundles/general/codex/harness-test/pitfalls.md +260 -0
  105. package/resources/harness/bundles/general/codex/harness-test/reference.md +791 -0
  106. package/resources/harness/bundles/general/codex/protocols/archive-report-protocol.md +175 -0
  107. package/resources/harness/bundles/general/codex/protocols/evidence-based-reporting-protocol.md +134 -0
  108. package/resources/harness/bundles/general/codex/protocols/ledger-protocol.md +270 -0
  109. package/resources/harness/bundles/general/codex/protocols/powershell-protocol.md +181 -0
  110. package/resources/harness/bundles/general/codex/protocols/report-pipeline-protocol.md +150 -0
  111. package/resources/harness/bundles/general/codex/protocols/sensitive-info-protocol.md +92 -0
  112. package/resources/harness/bundles/general/codex/protocols/state-layout-protocol.md +131 -0
  113. package/resources/harness/bundles/general/codex/protocols/submit-protocol.md +78 -0
  114. package/resources/harness/bundles/general/codex/scripts/harness_archive.py +2319 -0
  115. package/resources/harness/bundles/general/codex/scripts/harness_deploy.py +674 -0
  116. package/resources/harness/bundles/general/codex/scripts/harness_events.py +680 -0
  117. package/resources/harness/bundles/general/codex/scripts/harness_ledger.py +671 -0
  118. package/resources/harness/bundles/general/codex/scripts/harness_preflight.py +780 -0
  119. package/resources/harness/bundles/general/codex/scripts/harness_service.py +1331 -0
  120. package/resources/harness/bundles/general/cursor/.harness-build.json +6 -0
  121. package/resources/harness/bundles/general/cursor/CONTEXT.md +65 -0
  122. package/resources/harness/bundles/general/cursor/README.md +478 -0
  123. package/resources/harness/bundles/general/cursor/harness-archive/SKILL.md +198 -0
  124. package/resources/harness/bundles/general/cursor/harness-archive/checklist.md +52 -0
  125. package/resources/harness/bundles/general/cursor/harness-archive/reference.md +103 -0
  126. package/resources/harness/bundles/general/cursor/harness-archive/scripts/gen-manifest.ps1 +31 -0
  127. package/resources/harness/bundles/general/cursor/harness-archive/templates/render-summary.mjs +171 -0
  128. package/resources/harness/bundles/general/cursor/harness-archive/templates/summary-data-template.json +128 -0
  129. package/resources/harness/bundles/general/cursor/harness-codebase-map/SKILL.md +95 -0
  130. package/resources/harness/bundles/general/cursor/harness-codebase-map/checklist.md +126 -0
  131. package/resources/harness/bundles/general/cursor/harness-codebase-map/reference.md +364 -0
  132. package/resources/harness/bundles/general/cursor/harness-codebase-map/templates/ARCHITECTURE.md +57 -0
  133. package/resources/harness/bundles/general/cursor/harness-codebase-map/templates/CONCERNS.md +49 -0
  134. package/resources/harness/bundles/general/cursor/harness-codebase-map/templates/CONVENTIONS.md +57 -0
  135. package/resources/harness/bundles/general/cursor/harness-codebase-map/templates/INTEGRATIONS.md +52 -0
  136. package/resources/harness/bundles/general/cursor/harness-codebase-map/templates/STACK.md +55 -0
  137. package/resources/harness/bundles/general/cursor/harness-codebase-map/templates/STRUCTURE.md +69 -0
  138. package/resources/harness/bundles/general/cursor/harness-codebase-map/templates/TESTING.md +64 -0
  139. package/resources/harness/bundles/general/cursor/harness-codebase-map/templates/map-manifest.schema.json +73 -0
  140. package/resources/harness/bundles/general/cursor/harness-codebase-map/templates/map-summary.md +64 -0
  141. package/resources/harness/bundles/general/cursor/harness-knowledge-ingest/SKILL.md +229 -0
  142. package/resources/harness/bundles/general/cursor/harness-knowledge-ingest/design.md +842 -0
  143. package/resources/harness/bundles/general/cursor/harness-knowledge-ingest/evaluations/harness_knowledge_evaluation.xml +42 -0
  144. package/resources/harness/bundles/general/cursor/harness-knowledge-ingest/mcp-config.example.json +10 -0
  145. package/resources/harness/bundles/general/cursor/harness-knowledge-ingest/reference.md +309 -0
  146. package/resources/harness/bundles/general/cursor/harness-knowledge-ingest/scripts/harness_knowledge.py +4082 -0
  147. package/resources/harness/bundles/general/cursor/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +273 -0
  148. package/resources/harness/bundles/general/cursor/harness-knowledge-query/SKILL.md +147 -0
  149. package/resources/harness/bundles/general/cursor/harness-plan/SKILL.md +109 -0
  150. package/resources/harness/bundles/general/cursor/harness-plan/checklist.md +243 -0
  151. package/resources/harness/bundles/general/cursor/harness-plan/protocols.md +124 -0
  152. package/resources/harness/bundles/general/cursor/harness-plan/reference.md +376 -0
  153. package/resources/harness/bundles/general/cursor/harness-review/SKILL.md +137 -0
  154. package/resources/harness/bundles/general/cursor/harness-review/checklist.md +124 -0
  155. package/resources/harness/bundles/general/cursor/harness-review/protocols.md +68 -0
  156. package/resources/harness/bundles/general/cursor/harness-review/reference.md +86 -0
  157. package/resources/harness/bundles/general/cursor/harness-run/SKILL.md +113 -0
  158. package/resources/harness/bundles/general/cursor/harness-run/checklist.md +259 -0
  159. package/resources/harness/bundles/general/cursor/harness-run/protocols.md +78 -0
  160. package/resources/harness/bundles/general/cursor/harness-run/reference.md +834 -0
  161. package/resources/harness/bundles/general/cursor/harness-submit/SKILL.md +142 -0
  162. package/resources/harness/bundles/general/cursor/harness-submit/checklist.md +407 -0
  163. package/resources/harness/bundles/general/cursor/harness-submit/reference.md +152 -0
  164. package/resources/harness/bundles/general/cursor/harness-sync/SKILL.md +65 -0
  165. package/resources/harness/bundles/general/cursor/harness-sync/reference.md +153 -0
  166. package/resources/harness/bundles/general/cursor/harness-test/SKILL.md +160 -0
  167. package/resources/harness/bundles/general/cursor/harness-test/checklist.md +319 -0
  168. package/resources/harness/bundles/general/cursor/harness-test/pitfalls.md +260 -0
  169. package/resources/harness/bundles/general/cursor/harness-test/reference.md +791 -0
  170. package/resources/harness/bundles/general/cursor/protocols/archive-report-protocol.md +175 -0
  171. package/resources/harness/bundles/general/cursor/protocols/evidence-based-reporting-protocol.md +134 -0
  172. package/resources/harness/bundles/general/cursor/protocols/ledger-protocol.md +270 -0
  173. package/resources/harness/bundles/general/cursor/protocols/powershell-protocol.md +181 -0
  174. package/resources/harness/bundles/general/cursor/protocols/report-pipeline-protocol.md +150 -0
  175. package/resources/harness/bundles/general/cursor/protocols/sensitive-info-protocol.md +92 -0
  176. package/resources/harness/bundles/general/cursor/protocols/state-layout-protocol.md +131 -0
  177. package/resources/harness/bundles/general/cursor/protocols/submit-protocol.md +78 -0
  178. package/resources/harness/bundles/general/cursor/scripts/harness_archive.py +2319 -0
  179. package/resources/harness/bundles/general/cursor/scripts/harness_deploy.py +674 -0
  180. package/resources/harness/bundles/general/cursor/scripts/harness_events.py +680 -0
  181. package/resources/harness/bundles/general/cursor/scripts/harness_ledger.py +671 -0
  182. package/resources/harness/bundles/general/cursor/scripts/harness_preflight.py +780 -0
  183. package/resources/harness/bundles/general/cursor/scripts/harness_service.py +1331 -0
  184. package/resources/harness/bundles/java/claude-code/.harness-build.json +6 -0
  185. package/resources/harness/bundles/java/claude-code/CONTEXT.md +65 -0
  186. package/resources/harness/bundles/java/claude-code/README.md +478 -0
  187. package/resources/harness/{java → bundles/java/claude-code}/agents/harness-reviewer.md +2 -2
  188. package/resources/harness/{java → bundles/java/claude-code}/harness-apidoc/SKILL.md +1 -1
  189. package/resources/harness/{java → bundles/java/claude-code}/harness-archive/SKILL.md +1 -1
  190. package/resources/harness/bundles/java/claude-code/harness-archive/checklist.md +52 -0
  191. package/resources/harness/bundles/java/claude-code/harness-archive/reference.md +103 -0
  192. package/resources/harness/bundles/java/claude-code/harness-archive/scripts/gen-manifest.ps1 +31 -0
  193. package/resources/harness/bundles/java/claude-code/harness-archive/templates/render-summary.mjs +171 -0
  194. package/resources/harness/bundles/java/claude-code/harness-archive/templates/summary-data-template.json +128 -0
  195. package/resources/harness/{general → bundles/java/claude-code}/harness-codebase-map/SKILL.md +1 -1
  196. package/resources/harness/bundles/java/claude-code/harness-codebase-map/checklist.md +126 -0
  197. package/resources/harness/bundles/java/claude-code/harness-codebase-map/reference.md +364 -0
  198. package/resources/harness/bundles/java/claude-code/harness-codebase-map/templates/ARCHITECTURE.md +57 -0
  199. package/resources/harness/bundles/java/claude-code/harness-codebase-map/templates/CONCERNS.md +49 -0
  200. package/resources/harness/bundles/java/claude-code/harness-codebase-map/templates/CONVENTIONS.md +57 -0
  201. package/resources/harness/bundles/java/claude-code/harness-codebase-map/templates/INTEGRATIONS.md +52 -0
  202. package/resources/harness/bundles/java/claude-code/harness-codebase-map/templates/STACK.md +55 -0
  203. package/resources/harness/bundles/java/claude-code/harness-codebase-map/templates/STRUCTURE.md +69 -0
  204. package/resources/harness/bundles/java/claude-code/harness-codebase-map/templates/TESTING.md +64 -0
  205. package/resources/harness/bundles/java/claude-code/harness-codebase-map/templates/map-manifest.schema.json +73 -0
  206. package/resources/harness/bundles/java/claude-code/harness-codebase-map/templates/map-summary.md +64 -0
  207. package/resources/harness/{general → bundles/java/claude-code}/harness-knowledge-ingest/SKILL.md +1 -1
  208. package/resources/harness/bundles/java/claude-code/harness-knowledge-ingest/design.md +842 -0
  209. package/resources/harness/bundles/java/claude-code/harness-knowledge-ingest/evaluations/harness_knowledge_evaluation.xml +42 -0
  210. package/resources/harness/bundles/java/claude-code/harness-knowledge-ingest/mcp-config.example.json +10 -0
  211. package/resources/harness/bundles/java/claude-code/harness-knowledge-ingest/reference.md +309 -0
  212. package/resources/harness/bundles/java/claude-code/harness-knowledge-ingest/scripts/harness_knowledge.py +4082 -0
  213. package/resources/harness/bundles/java/claude-code/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +273 -0
  214. package/resources/harness/{java → bundles/java/claude-code}/harness-knowledge-query/SKILL.md +1 -1
  215. package/resources/harness/{java → bundles/java/claude-code}/harness-package/SKILL.md +1 -1
  216. package/resources/harness/{java → bundles/java/claude-code}/harness-package/reference.md +1 -1
  217. package/resources/harness/{java → bundles/java/claude-code}/harness-plan/SKILL.md +1 -1
  218. package/resources/harness/bundles/java/claude-code/harness-plan/checklist.md +243 -0
  219. package/resources/harness/bundles/java/claude-code/harness-plan/protocols.md +124 -0
  220. package/resources/harness/bundles/java/claude-code/harness-plan/reference.md +376 -0
  221. package/resources/harness/{general → bundles/java/claude-code}/harness-review/SKILL.md +8 -4
  222. package/resources/harness/bundles/java/claude-code/harness-review/checklist.md +124 -0
  223. package/resources/harness/bundles/java/claude-code/harness-review/protocols.md +68 -0
  224. package/resources/harness/bundles/java/claude-code/harness-review/reference.md +86 -0
  225. package/resources/harness/{java → bundles/java/claude-code}/harness-run/SKILL.md +1 -1
  226. package/resources/harness/{java → bundles/java/claude-code}/harness-run/checklist.md +1 -1
  227. package/resources/harness/bundles/java/claude-code/harness-run/protocols.md +78 -0
  228. package/resources/harness/{java → bundles/java/claude-code}/harness-run/reference.md +2 -2
  229. package/resources/harness/{java → bundles/java/claude-code}/harness-submit/SKILL.md +1 -1
  230. package/resources/harness/bundles/java/claude-code/harness-submit/checklist.md +407 -0
  231. package/resources/harness/bundles/java/claude-code/harness-submit/reference.md +152 -0
  232. package/resources/harness/{general → bundles/java/claude-code}/harness-sync/SKILL.md +2 -2
  233. package/resources/harness/bundles/java/claude-code/harness-sync/reference.md +153 -0
  234. package/resources/harness/{java → bundles/java/claude-code}/harness-test/SKILL.md +1 -1
  235. package/resources/harness/{java → bundles/java/claude-code}/harness-test/checklist.md +316 -316
  236. package/resources/harness/bundles/java/claude-code/harness-test/pitfalls.md +260 -0
  237. package/resources/harness/{java → bundles/java/claude-code}/harness-test/reference.md +788 -788
  238. package/resources/harness/bundles/java/claude-code/protocols/archive-report-protocol.md +175 -0
  239. package/resources/harness/bundles/java/claude-code/protocols/evidence-based-reporting-protocol.md +134 -0
  240. package/resources/harness/bundles/java/claude-code/protocols/ledger-protocol.md +270 -0
  241. package/resources/harness/bundles/java/claude-code/protocols/powershell-protocol.md +181 -0
  242. package/resources/harness/bundles/java/claude-code/protocols/report-pipeline-protocol.md +150 -0
  243. package/resources/harness/bundles/java/claude-code/protocols/sensitive-info-protocol.md +92 -0
  244. package/resources/harness/bundles/java/claude-code/protocols/state-layout-protocol.md +131 -0
  245. package/resources/harness/bundles/java/claude-code/protocols/submit-protocol.md +78 -0
  246. package/resources/harness/bundles/java/claude-code/scripts/harness_archive.py +2319 -0
  247. package/resources/harness/bundles/java/claude-code/scripts/harness_deploy.py +674 -0
  248. package/resources/harness/bundles/java/claude-code/scripts/harness_events.py +680 -0
  249. package/resources/harness/bundles/java/claude-code/scripts/harness_ledger.py +671 -0
  250. package/resources/harness/bundles/java/claude-code/scripts/harness_preflight.py +780 -0
  251. package/resources/harness/bundles/java/claude-code/scripts/harness_service.py +1331 -0
  252. package/resources/harness/bundles/java/codebuddy/.harness-build.json +6 -0
  253. package/resources/harness/bundles/java/codebuddy/CONTEXT.md +65 -0
  254. package/resources/harness/bundles/java/codebuddy/README.md +478 -0
  255. package/resources/harness/bundles/java/codebuddy/agents/harness-evaluator.md +94 -0
  256. package/resources/harness/bundles/java/codebuddy/agents/harness-explorer.md +53 -0
  257. package/resources/harness/bundles/java/codebuddy/agents/harness-reviewer.md +52 -0
  258. package/resources/harness/bundles/java/codebuddy/harness-apidoc/SKILL.md +68 -0
  259. package/resources/harness/bundles/java/codebuddy/harness-apidoc/checklist.md +142 -0
  260. package/resources/harness/bundles/java/codebuddy/harness-apidoc/reference.md +233 -0
  261. package/resources/harness/bundles/java/codebuddy/harness-archive/SKILL.md +198 -0
  262. package/resources/harness/bundles/java/codebuddy/harness-archive/checklist.md +52 -0
  263. package/resources/harness/bundles/java/codebuddy/harness-archive/reference.md +103 -0
  264. package/resources/harness/bundles/java/codebuddy/harness-archive/scripts/gen-manifest.ps1 +31 -0
  265. package/resources/harness/bundles/java/codebuddy/harness-archive/templates/render-summary.mjs +171 -0
  266. package/resources/harness/bundles/java/codebuddy/harness-archive/templates/summary-data-template.json +128 -0
  267. package/resources/harness/bundles/java/codebuddy/harness-codebase-map/SKILL.md +95 -0
  268. package/resources/harness/bundles/java/codebuddy/harness-codebase-map/checklist.md +126 -0
  269. package/resources/harness/bundles/java/codebuddy/harness-codebase-map/reference.md +364 -0
  270. package/resources/harness/bundles/java/codebuddy/harness-codebase-map/templates/ARCHITECTURE.md +57 -0
  271. package/resources/harness/bundles/java/codebuddy/harness-codebase-map/templates/CONCERNS.md +49 -0
  272. package/resources/harness/bundles/java/codebuddy/harness-codebase-map/templates/CONVENTIONS.md +57 -0
  273. package/resources/harness/bundles/java/codebuddy/harness-codebase-map/templates/INTEGRATIONS.md +52 -0
  274. package/resources/harness/bundles/java/codebuddy/harness-codebase-map/templates/STACK.md +55 -0
  275. package/resources/harness/bundles/java/codebuddy/harness-codebase-map/templates/STRUCTURE.md +69 -0
  276. package/resources/harness/bundles/java/codebuddy/harness-codebase-map/templates/TESTING.md +64 -0
  277. package/resources/harness/bundles/java/codebuddy/harness-codebase-map/templates/map-manifest.schema.json +73 -0
  278. package/resources/harness/bundles/java/codebuddy/harness-codebase-map/templates/map-summary.md +64 -0
  279. package/resources/harness/bundles/java/codebuddy/harness-knowledge-ingest/SKILL.md +229 -0
  280. package/resources/harness/bundles/java/codebuddy/harness-knowledge-ingest/design.md +842 -0
  281. package/resources/harness/bundles/java/codebuddy/harness-knowledge-ingest/evaluations/harness_knowledge_evaluation.xml +42 -0
  282. package/resources/harness/bundles/java/codebuddy/harness-knowledge-ingest/mcp-config.example.json +10 -0
  283. package/resources/harness/bundles/java/codebuddy/harness-knowledge-ingest/reference.md +309 -0
  284. package/resources/harness/bundles/java/codebuddy/harness-knowledge-ingest/scripts/harness_knowledge.py +4082 -0
  285. package/resources/harness/bundles/java/codebuddy/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +273 -0
  286. package/resources/harness/bundles/java/codebuddy/harness-knowledge-query/SKILL.md +147 -0
  287. package/resources/harness/bundles/java/codebuddy/harness-package/SKILL.md +69 -0
  288. package/resources/harness/bundles/java/codebuddy/harness-package/checklist.md +322 -0
  289. package/resources/harness/bundles/java/codebuddy/harness-package/reference.md +210 -0
  290. package/resources/harness/bundles/java/codebuddy/harness-plan/SKILL.md +109 -0
  291. package/resources/harness/bundles/java/codebuddy/harness-plan/checklist.md +243 -0
  292. package/resources/harness/bundles/java/codebuddy/harness-plan/protocols.md +124 -0
  293. package/resources/harness/bundles/java/codebuddy/harness-plan/reference.md +376 -0
  294. package/resources/harness/bundles/java/codebuddy/harness-review/SKILL.md +142 -0
  295. package/resources/harness/bundles/java/codebuddy/harness-review/checklist.md +124 -0
  296. package/resources/harness/bundles/java/codebuddy/harness-review/protocols.md +68 -0
  297. package/resources/harness/bundles/java/codebuddy/harness-review/reference.md +86 -0
  298. package/resources/harness/bundles/java/codebuddy/harness-run/SKILL.md +129 -0
  299. package/resources/harness/bundles/java/codebuddy/harness-run/checklist.md +250 -0
  300. package/resources/harness/bundles/java/codebuddy/harness-run/protocols.md +78 -0
  301. package/resources/harness/bundles/java/codebuddy/harness-run/reference.md +814 -0
  302. package/resources/harness/bundles/java/codebuddy/harness-submit/SKILL.md +149 -0
  303. package/resources/harness/bundles/java/codebuddy/harness-submit/checklist.md +407 -0
  304. package/resources/harness/bundles/java/codebuddy/harness-submit/reference.md +152 -0
  305. package/resources/harness/bundles/java/codebuddy/harness-sync/SKILL.md +65 -0
  306. package/resources/harness/bundles/java/codebuddy/harness-sync/reference.md +153 -0
  307. package/resources/harness/bundles/java/codebuddy/harness-test/SKILL.md +172 -0
  308. package/resources/harness/bundles/java/codebuddy/harness-test/checklist.md +317 -0
  309. package/resources/harness/bundles/java/codebuddy/harness-test/pitfalls-java.md +16 -0
  310. package/resources/harness/bundles/java/codebuddy/harness-test/pitfalls.md +260 -0
  311. package/resources/harness/bundles/java/codebuddy/harness-test/reference.md +788 -0
  312. package/resources/harness/bundles/java/codebuddy/protocols/archive-report-protocol.md +175 -0
  313. package/resources/harness/bundles/java/codebuddy/protocols/evidence-based-reporting-protocol.md +134 -0
  314. package/resources/harness/bundles/java/codebuddy/protocols/ledger-protocol.md +270 -0
  315. package/resources/harness/bundles/java/codebuddy/protocols/powershell-protocol.md +181 -0
  316. package/resources/harness/bundles/java/codebuddy/protocols/report-pipeline-protocol.md +150 -0
  317. package/resources/harness/bundles/java/codebuddy/protocols/sensitive-info-protocol.md +92 -0
  318. package/resources/harness/bundles/java/codebuddy/protocols/state-layout-protocol.md +131 -0
  319. package/resources/harness/bundles/java/codebuddy/protocols/submit-protocol.md +78 -0
  320. package/resources/harness/bundles/java/codebuddy/scripts/harness_archive.py +2319 -0
  321. package/resources/harness/bundles/java/codebuddy/scripts/harness_deploy.py +674 -0
  322. package/resources/harness/bundles/java/codebuddy/scripts/harness_events.py +680 -0
  323. package/resources/harness/bundles/java/codebuddy/scripts/harness_ledger.py +671 -0
  324. package/resources/harness/bundles/java/codebuddy/scripts/harness_preflight.py +780 -0
  325. package/resources/harness/bundles/java/codebuddy/scripts/harness_service.py +1331 -0
  326. package/resources/harness/bundles/java/codex/.harness-build.json +6 -0
  327. package/resources/harness/bundles/java/codex/CONTEXT.md +65 -0
  328. package/resources/harness/bundles/java/codex/README.md +478 -0
  329. package/resources/harness/bundles/java/codex/harness-apidoc/SKILL.md +68 -0
  330. package/resources/harness/bundles/java/codex/harness-apidoc/checklist.md +142 -0
  331. package/resources/harness/bundles/java/codex/harness-apidoc/reference.md +233 -0
  332. package/resources/harness/bundles/java/codex/harness-archive/SKILL.md +198 -0
  333. package/resources/harness/bundles/java/codex/harness-archive/checklist.md +52 -0
  334. package/resources/harness/bundles/java/codex/harness-archive/reference.md +103 -0
  335. package/resources/harness/bundles/java/codex/harness-archive/scripts/gen-manifest.ps1 +31 -0
  336. package/resources/harness/bundles/java/codex/harness-archive/templates/render-summary.mjs +171 -0
  337. package/resources/harness/bundles/java/codex/harness-archive/templates/summary-data-template.json +128 -0
  338. package/resources/harness/bundles/java/codex/harness-codebase-map/SKILL.md +95 -0
  339. package/resources/harness/bundles/java/codex/harness-codebase-map/checklist.md +126 -0
  340. package/resources/harness/bundles/java/codex/harness-codebase-map/reference.md +364 -0
  341. package/resources/harness/bundles/java/codex/harness-codebase-map/templates/ARCHITECTURE.md +57 -0
  342. package/resources/harness/bundles/java/codex/harness-codebase-map/templates/CONCERNS.md +49 -0
  343. package/resources/harness/bundles/java/codex/harness-codebase-map/templates/CONVENTIONS.md +57 -0
  344. package/resources/harness/bundles/java/codex/harness-codebase-map/templates/INTEGRATIONS.md +52 -0
  345. package/resources/harness/bundles/java/codex/harness-codebase-map/templates/STACK.md +55 -0
  346. package/resources/harness/bundles/java/codex/harness-codebase-map/templates/STRUCTURE.md +69 -0
  347. package/resources/harness/bundles/java/codex/harness-codebase-map/templates/TESTING.md +64 -0
  348. package/resources/harness/bundles/java/codex/harness-codebase-map/templates/map-manifest.schema.json +73 -0
  349. package/resources/harness/bundles/java/codex/harness-codebase-map/templates/map-summary.md +64 -0
  350. package/resources/harness/bundles/java/codex/harness-knowledge-ingest/SKILL.md +229 -0
  351. package/resources/harness/bundles/java/codex/harness-knowledge-ingest/design.md +842 -0
  352. package/resources/harness/bundles/java/codex/harness-knowledge-ingest/evaluations/harness_knowledge_evaluation.xml +42 -0
  353. package/resources/harness/bundles/java/codex/harness-knowledge-ingest/mcp-config.example.json +10 -0
  354. package/resources/harness/bundles/java/codex/harness-knowledge-ingest/reference.md +309 -0
  355. package/resources/harness/bundles/java/codex/harness-knowledge-ingest/scripts/harness_knowledge.py +4082 -0
  356. package/resources/harness/bundles/java/codex/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +273 -0
  357. package/resources/harness/bundles/java/codex/harness-knowledge-query/SKILL.md +147 -0
  358. package/resources/harness/bundles/java/codex/harness-package/SKILL.md +69 -0
  359. package/resources/harness/bundles/java/codex/harness-package/checklist.md +322 -0
  360. package/resources/harness/bundles/java/codex/harness-package/reference.md +210 -0
  361. package/resources/harness/bundles/java/codex/harness-plan/SKILL.md +109 -0
  362. package/resources/harness/bundles/java/codex/harness-plan/checklist.md +243 -0
  363. package/resources/harness/bundles/java/codex/harness-plan/protocols.md +124 -0
  364. package/resources/harness/bundles/java/codex/harness-plan/reference.md +376 -0
  365. package/resources/harness/bundles/java/codex/harness-review/SKILL.md +137 -0
  366. package/resources/harness/bundles/java/codex/harness-review/checklist.md +124 -0
  367. package/resources/harness/bundles/java/codex/harness-review/protocols.md +68 -0
  368. package/resources/harness/bundles/java/codex/harness-review/reference.md +86 -0
  369. package/resources/harness/bundles/java/codex/harness-run/SKILL.md +129 -0
  370. package/resources/harness/bundles/java/codex/harness-run/checklist.md +250 -0
  371. package/resources/harness/bundles/java/codex/harness-run/protocols.md +78 -0
  372. package/resources/harness/bundles/java/codex/harness-run/reference.md +814 -0
  373. package/resources/harness/bundles/java/codex/harness-submit/SKILL.md +149 -0
  374. package/resources/harness/bundles/java/codex/harness-submit/checklist.md +407 -0
  375. package/resources/harness/bundles/java/codex/harness-submit/reference.md +152 -0
  376. package/resources/harness/bundles/java/codex/harness-sync/SKILL.md +65 -0
  377. package/resources/harness/bundles/java/codex/harness-sync/reference.md +153 -0
  378. package/resources/harness/bundles/java/codex/harness-test/SKILL.md +172 -0
  379. package/resources/harness/bundles/java/codex/harness-test/checklist.md +317 -0
  380. package/resources/harness/bundles/java/codex/harness-test/pitfalls-java.md +16 -0
  381. package/resources/harness/bundles/java/codex/harness-test/pitfalls.md +260 -0
  382. package/resources/harness/bundles/java/codex/harness-test/reference.md +788 -0
  383. package/resources/harness/bundles/java/codex/protocols/archive-report-protocol.md +175 -0
  384. package/resources/harness/bundles/java/codex/protocols/evidence-based-reporting-protocol.md +134 -0
  385. package/resources/harness/bundles/java/codex/protocols/ledger-protocol.md +270 -0
  386. package/resources/harness/bundles/java/codex/protocols/powershell-protocol.md +181 -0
  387. package/resources/harness/bundles/java/codex/protocols/report-pipeline-protocol.md +150 -0
  388. package/resources/harness/bundles/java/codex/protocols/sensitive-info-protocol.md +92 -0
  389. package/resources/harness/bundles/java/codex/protocols/state-layout-protocol.md +131 -0
  390. package/resources/harness/bundles/java/codex/protocols/submit-protocol.md +78 -0
  391. package/resources/harness/bundles/java/codex/scripts/harness_archive.py +2319 -0
  392. package/resources/harness/bundles/java/codex/scripts/harness_deploy.py +674 -0
  393. package/resources/harness/bundles/java/codex/scripts/harness_events.py +680 -0
  394. package/resources/harness/bundles/java/codex/scripts/harness_ledger.py +671 -0
  395. package/resources/harness/bundles/java/codex/scripts/harness_preflight.py +780 -0
  396. package/resources/harness/bundles/java/codex/scripts/harness_service.py +1331 -0
  397. package/resources/harness/bundles/java/cursor/.harness-build.json +6 -0
  398. package/resources/harness/bundles/java/cursor/CONTEXT.md +65 -0
  399. package/resources/harness/bundles/java/cursor/README.md +478 -0
  400. package/resources/harness/bundles/java/cursor/harness-apidoc/SKILL.md +68 -0
  401. package/resources/harness/bundles/java/cursor/harness-apidoc/checklist.md +142 -0
  402. package/resources/harness/bundles/java/cursor/harness-apidoc/reference.md +233 -0
  403. package/resources/harness/bundles/java/cursor/harness-archive/SKILL.md +198 -0
  404. package/resources/harness/bundles/java/cursor/harness-archive/checklist.md +52 -0
  405. package/resources/harness/bundles/java/cursor/harness-archive/reference.md +103 -0
  406. package/resources/harness/bundles/java/cursor/harness-archive/scripts/gen-manifest.ps1 +31 -0
  407. package/resources/harness/bundles/java/cursor/harness-archive/templates/render-summary.mjs +171 -0
  408. package/resources/harness/bundles/java/cursor/harness-archive/templates/summary-data-template.json +128 -0
  409. package/resources/harness/bundles/java/cursor/harness-codebase-map/SKILL.md +95 -0
  410. package/resources/harness/bundles/java/cursor/harness-codebase-map/checklist.md +126 -0
  411. package/resources/harness/bundles/java/cursor/harness-codebase-map/reference.md +364 -0
  412. package/resources/harness/bundles/java/cursor/harness-codebase-map/templates/ARCHITECTURE.md +57 -0
  413. package/resources/harness/bundles/java/cursor/harness-codebase-map/templates/CONCERNS.md +49 -0
  414. package/resources/harness/bundles/java/cursor/harness-codebase-map/templates/CONVENTIONS.md +57 -0
  415. package/resources/harness/bundles/java/cursor/harness-codebase-map/templates/INTEGRATIONS.md +52 -0
  416. package/resources/harness/bundles/java/cursor/harness-codebase-map/templates/STACK.md +55 -0
  417. package/resources/harness/bundles/java/cursor/harness-codebase-map/templates/STRUCTURE.md +69 -0
  418. package/resources/harness/bundles/java/cursor/harness-codebase-map/templates/TESTING.md +64 -0
  419. package/resources/harness/bundles/java/cursor/harness-codebase-map/templates/map-manifest.schema.json +73 -0
  420. package/resources/harness/bundles/java/cursor/harness-codebase-map/templates/map-summary.md +64 -0
  421. package/resources/harness/bundles/java/cursor/harness-knowledge-ingest/SKILL.md +229 -0
  422. package/resources/harness/bundles/java/cursor/harness-knowledge-ingest/design.md +842 -0
  423. package/resources/harness/bundles/java/cursor/harness-knowledge-ingest/evaluations/harness_knowledge_evaluation.xml +42 -0
  424. package/resources/harness/bundles/java/cursor/harness-knowledge-ingest/mcp-config.example.json +10 -0
  425. package/resources/harness/bundles/java/cursor/harness-knowledge-ingest/reference.md +309 -0
  426. package/resources/harness/bundles/java/cursor/harness-knowledge-ingest/scripts/harness_knowledge.py +4082 -0
  427. package/resources/harness/bundles/java/cursor/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +273 -0
  428. package/resources/harness/bundles/java/cursor/harness-knowledge-query/SKILL.md +147 -0
  429. package/resources/harness/bundles/java/cursor/harness-package/SKILL.md +69 -0
  430. package/resources/harness/bundles/java/cursor/harness-package/checklist.md +322 -0
  431. package/resources/harness/bundles/java/cursor/harness-package/reference.md +210 -0
  432. package/resources/harness/bundles/java/cursor/harness-plan/SKILL.md +109 -0
  433. package/resources/harness/bundles/java/cursor/harness-plan/checklist.md +243 -0
  434. package/resources/harness/bundles/java/cursor/harness-plan/protocols.md +124 -0
  435. package/resources/harness/bundles/java/cursor/harness-plan/reference.md +376 -0
  436. package/resources/harness/bundles/java/cursor/harness-review/SKILL.md +137 -0
  437. package/resources/harness/bundles/java/cursor/harness-review/checklist.md +124 -0
  438. package/resources/harness/bundles/java/cursor/harness-review/protocols.md +68 -0
  439. package/resources/harness/bundles/java/cursor/harness-review/reference.md +86 -0
  440. package/resources/harness/bundles/java/cursor/harness-run/SKILL.md +129 -0
  441. package/resources/harness/bundles/java/cursor/harness-run/checklist.md +250 -0
  442. package/resources/harness/bundles/java/cursor/harness-run/protocols.md +78 -0
  443. package/resources/harness/bundles/java/cursor/harness-run/reference.md +814 -0
  444. package/resources/harness/bundles/java/cursor/harness-submit/SKILL.md +149 -0
  445. package/resources/harness/bundles/java/cursor/harness-submit/checklist.md +407 -0
  446. package/resources/harness/bundles/java/cursor/harness-submit/reference.md +152 -0
  447. package/resources/harness/bundles/java/cursor/harness-sync/SKILL.md +65 -0
  448. package/resources/harness/bundles/java/cursor/harness-sync/reference.md +153 -0
  449. package/resources/harness/bundles/java/cursor/harness-test/SKILL.md +172 -0
  450. package/resources/harness/bundles/java/cursor/harness-test/checklist.md +317 -0
  451. package/resources/harness/bundles/java/cursor/harness-test/pitfalls-java.md +16 -0
  452. package/resources/harness/bundles/java/cursor/harness-test/pitfalls.md +260 -0
  453. package/resources/harness/bundles/java/cursor/harness-test/reference.md +788 -0
  454. package/resources/harness/bundles/java/cursor/protocols/archive-report-protocol.md +175 -0
  455. package/resources/harness/bundles/java/cursor/protocols/evidence-based-reporting-protocol.md +134 -0
  456. package/resources/harness/bundles/java/cursor/protocols/ledger-protocol.md +270 -0
  457. package/resources/harness/bundles/java/cursor/protocols/powershell-protocol.md +181 -0
  458. package/resources/harness/bundles/java/cursor/protocols/report-pipeline-protocol.md +150 -0
  459. package/resources/harness/bundles/java/cursor/protocols/sensitive-info-protocol.md +92 -0
  460. package/resources/harness/bundles/java/cursor/protocols/state-layout-protocol.md +131 -0
  461. package/resources/harness/bundles/java/cursor/protocols/submit-protocol.md +78 -0
  462. package/resources/harness/bundles/java/cursor/scripts/harness_archive.py +2319 -0
  463. package/resources/harness/bundles/java/cursor/scripts/harness_deploy.py +674 -0
  464. package/resources/harness/bundles/java/cursor/scripts/harness_events.py +680 -0
  465. package/resources/harness/bundles/java/cursor/scripts/harness_ledger.py +671 -0
  466. package/resources/harness/bundles/java/cursor/scripts/harness_preflight.py +780 -0
  467. package/resources/harness/bundles/java/cursor/scripts/harness_service.py +1331 -0
  468. package/resources/harness/manifests/{general.json → general/claude-code.json} +27 -26
  469. package/resources/harness/manifests/general/codebuddy.json +277 -0
  470. package/resources/harness/manifests/general/codex.json +265 -0
  471. package/resources/harness/manifests/general/cursor.json +265 -0
  472. package/resources/harness/manifests/{java.json → java/claude-code.json} +31 -30
  473. package/resources/harness/manifests/java/codebuddy.json +305 -0
  474. package/resources/harness/manifests/java/codex.json +293 -0
  475. package/resources/harness/manifests/java/cursor.json +293 -0
  476. package/resources/harness/general/.harness-build.json +0 -5
  477. package/resources/harness/java/.harness-build.json +0 -5
  478. /package/resources/harness/{general → bundles/general/claude-code}/CONTEXT.md +0 -0
  479. /package/resources/harness/{general → bundles/general/claude-code}/README.md +0 -0
  480. /package/resources/harness/{general → bundles/general/claude-code}/agents/harness-evaluator.md +0 -0
  481. /package/resources/harness/{general → bundles/general/claude-code}/agents/harness-explorer.md +0 -0
  482. /package/resources/harness/{general → bundles/general/claude-code}/harness-archive/checklist.md +0 -0
  483. /package/resources/harness/{general → bundles/general/claude-code}/harness-archive/reference.md +0 -0
  484. /package/resources/harness/{general → bundles/general/claude-code}/harness-archive/scripts/gen-manifest.ps1 +0 -0
  485. /package/resources/harness/{general → bundles/general/claude-code}/harness-archive/templates/render-summary.mjs +0 -0
  486. /package/resources/harness/{general → bundles/general/claude-code}/harness-archive/templates/summary-data-template.json +0 -0
  487. /package/resources/harness/{general → bundles/general/claude-code}/harness-codebase-map/checklist.md +0 -0
  488. /package/resources/harness/{general → bundles/general/claude-code}/harness-codebase-map/reference.md +0 -0
  489. /package/resources/harness/{general → bundles/general/claude-code}/harness-codebase-map/templates/ARCHITECTURE.md +0 -0
  490. /package/resources/harness/{general → bundles/general/claude-code}/harness-codebase-map/templates/CONCERNS.md +0 -0
  491. /package/resources/harness/{general → bundles/general/claude-code}/harness-codebase-map/templates/CONVENTIONS.md +0 -0
  492. /package/resources/harness/{general → bundles/general/claude-code}/harness-codebase-map/templates/INTEGRATIONS.md +0 -0
  493. /package/resources/harness/{general → bundles/general/claude-code}/harness-codebase-map/templates/STACK.md +0 -0
  494. /package/resources/harness/{general → bundles/general/claude-code}/harness-codebase-map/templates/STRUCTURE.md +0 -0
  495. /package/resources/harness/{general → bundles/general/claude-code}/harness-codebase-map/templates/TESTING.md +0 -0
  496. /package/resources/harness/{general → bundles/general/claude-code}/harness-codebase-map/templates/map-manifest.schema.json +0 -0
  497. /package/resources/harness/{general → bundles/general/claude-code}/harness-codebase-map/templates/map-summary.md +0 -0
  498. /package/resources/harness/{general → bundles/general/claude-code}/harness-knowledge-ingest/design.md +0 -0
  499. /package/resources/harness/{general → bundles/general/claude-code}/harness-knowledge-ingest/evaluations/harness_knowledge_evaluation.xml +0 -0
  500. /package/resources/harness/{general → bundles/general/claude-code}/harness-knowledge-ingest/mcp-config.example.json +0 -0
  501. /package/resources/harness/{general → bundles/general/claude-code}/harness-knowledge-ingest/scripts/harness_knowledge.py +0 -0
  502. /package/resources/harness/{general → bundles/general/claude-code}/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +0 -0
  503. /package/resources/harness/{general → bundles/general/claude-code}/harness-plan/checklist.md +0 -0
  504. /package/resources/harness/{general → bundles/general/claude-code}/harness-plan/protocols.md +0 -0
  505. /package/resources/harness/{general → bundles/general/claude-code}/harness-plan/reference.md +0 -0
  506. /package/resources/harness/{general → bundles/general/claude-code}/harness-review/protocols.md +0 -0
  507. /package/resources/harness/{general → bundles/general/claude-code}/harness-review/reference.md +0 -0
  508. /package/resources/harness/{general → bundles/general/claude-code}/harness-run/protocols.md +0 -0
  509. /package/resources/harness/{general → bundles/general/claude-code}/harness-submit/checklist.md +0 -0
  510. /package/resources/harness/{general → bundles/general/claude-code}/harness-submit/reference.md +0 -0
  511. /package/resources/harness/{general → bundles/general/claude-code}/harness-test/pitfalls.md +0 -0
  512. /package/resources/harness/{general → bundles/general/claude-code}/harness-test/reference.md +0 -0
  513. /package/resources/harness/{general → bundles/general/claude-code}/protocols/archive-report-protocol.md +0 -0
  514. /package/resources/harness/{general → bundles/general/claude-code}/protocols/evidence-based-reporting-protocol.md +0 -0
  515. /package/resources/harness/{general → bundles/general/claude-code}/protocols/ledger-protocol.md +0 -0
  516. /package/resources/harness/{general → bundles/general/claude-code}/protocols/powershell-protocol.md +0 -0
  517. /package/resources/harness/{general → bundles/general/claude-code}/protocols/report-pipeline-protocol.md +0 -0
  518. /package/resources/harness/{general → bundles/general/claude-code}/protocols/sensitive-info-protocol.md +0 -0
  519. /package/resources/harness/{general → bundles/general/claude-code}/protocols/state-layout-protocol.md +0 -0
  520. /package/resources/harness/{general → bundles/general/claude-code}/protocols/submit-protocol.md +0 -0
  521. /package/resources/harness/{java → bundles/general/codebuddy}/CONTEXT.md +0 -0
  522. /package/resources/harness/{java → bundles/general/codebuddy}/README.md +0 -0
  523. /package/resources/harness/{java → bundles/general/codebuddy}/harness-archive/checklist.md +0 -0
  524. /package/resources/harness/{java → bundles/general/codebuddy}/harness-archive/reference.md +0 -0
  525. /package/resources/harness/{java → bundles/general/codebuddy}/harness-archive/scripts/gen-manifest.ps1 +0 -0
  526. /package/resources/harness/{java → bundles/general/codebuddy}/harness-archive/templates/render-summary.mjs +0 -0
  527. /package/resources/harness/{java → bundles/general/codebuddy}/harness-archive/templates/summary-data-template.json +0 -0
  528. /package/resources/harness/{java → bundles/general/codebuddy}/harness-codebase-map/checklist.md +0 -0
  529. /package/resources/harness/{java → bundles/general/codebuddy}/harness-codebase-map/reference.md +0 -0
  530. /package/resources/harness/{java → bundles/general/codebuddy}/harness-codebase-map/templates/ARCHITECTURE.md +0 -0
  531. /package/resources/harness/{java → bundles/general/codebuddy}/harness-codebase-map/templates/CONCERNS.md +0 -0
  532. /package/resources/harness/{java → bundles/general/codebuddy}/harness-codebase-map/templates/CONVENTIONS.md +0 -0
  533. /package/resources/harness/{java → bundles/general/codebuddy}/harness-codebase-map/templates/INTEGRATIONS.md +0 -0
  534. /package/resources/harness/{java → bundles/general/codebuddy}/harness-codebase-map/templates/STACK.md +0 -0
  535. /package/resources/harness/{java → bundles/general/codebuddy}/harness-codebase-map/templates/STRUCTURE.md +0 -0
  536. /package/resources/harness/{java → bundles/general/codebuddy}/harness-codebase-map/templates/TESTING.md +0 -0
  537. /package/resources/harness/{java → bundles/general/codebuddy}/harness-codebase-map/templates/map-manifest.schema.json +0 -0
  538. /package/resources/harness/{java → bundles/general/codebuddy}/harness-codebase-map/templates/map-summary.md +0 -0
  539. /package/resources/harness/{java → bundles/general/codebuddy}/harness-knowledge-ingest/design.md +0 -0
  540. /package/resources/harness/{java → bundles/general/codebuddy}/harness-knowledge-ingest/evaluations/harness_knowledge_evaluation.xml +0 -0
  541. /package/resources/harness/{java → bundles/general/codebuddy}/harness-knowledge-ingest/mcp-config.example.json +0 -0
  542. /package/resources/harness/{java → bundles/general/codebuddy}/harness-knowledge-ingest/scripts/harness_knowledge.py +0 -0
  543. /package/resources/harness/{java → bundles/general/codebuddy}/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +0 -0
  544. /package/resources/harness/{java → bundles/general/codebuddy}/harness-plan/checklist.md +0 -0
  545. /package/resources/harness/{java → bundles/general/codebuddy}/harness-plan/protocols.md +0 -0
  546. /package/resources/harness/{java → bundles/general/codebuddy}/harness-plan/reference.md +0 -0
  547. /package/resources/harness/{java → bundles/general/codebuddy}/harness-review/protocols.md +0 -0
  548. /package/resources/harness/{java → bundles/general/codebuddy}/harness-review/reference.md +0 -0
  549. /package/resources/harness/{java → bundles/general/codebuddy}/harness-run/protocols.md +0 -0
  550. /package/resources/harness/{java → bundles/general/codebuddy}/harness-submit/checklist.md +0 -0
  551. /package/resources/harness/{java → bundles/general/codebuddy}/harness-submit/reference.md +0 -0
  552. /package/resources/harness/{java → bundles/general/codebuddy}/harness-test/pitfalls.md +0 -0
  553. /package/resources/harness/{java → bundles/general/codebuddy}/protocols/archive-report-protocol.md +0 -0
  554. /package/resources/harness/{java → bundles/general/codebuddy}/protocols/evidence-based-reporting-protocol.md +0 -0
  555. /package/resources/harness/{java → bundles/general/codebuddy}/protocols/ledger-protocol.md +0 -0
  556. /package/resources/harness/{java → bundles/general/codebuddy}/protocols/powershell-protocol.md +0 -0
  557. /package/resources/harness/{java → bundles/general/codebuddy}/protocols/report-pipeline-protocol.md +0 -0
  558. /package/resources/harness/{java → bundles/general/codebuddy}/protocols/sensitive-info-protocol.md +0 -0
  559. /package/resources/harness/{java → bundles/general/codebuddy}/protocols/state-layout-protocol.md +0 -0
  560. /package/resources/harness/{java → bundles/general/codebuddy}/protocols/submit-protocol.md +0 -0
  561. /package/resources/harness/{java → bundles/java/claude-code}/agents/harness-evaluator.md +0 -0
  562. /package/resources/harness/{java → bundles/java/claude-code}/agents/harness-explorer.md +0 -0
  563. /package/resources/harness/{java → bundles/java/claude-code}/harness-apidoc/checklist.md +0 -0
  564. /package/resources/harness/{java → bundles/java/claude-code}/harness-apidoc/reference.md +0 -0
  565. /package/resources/harness/{java → bundles/java/claude-code}/harness-package/checklist.md +0 -0
  566. /package/resources/harness/{java → bundles/java/claude-code}/harness-test/pitfalls-java.md +0 -0
@@ -0,0 +1,780 @@
1
+ #!/usr/bin/env python3
2
+ """Harness preflight: build-profile detect/check + quirk recording + agent precheck.
3
+
4
+ Implements DESIGN.md D5 (build-profile) and D8 (subagent precheck).
5
+ Python 3.10+ stdlib only. UTF-8 without BOM. Windows path friendly.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import argparse
11
+ import datetime as dt
12
+ import hashlib
13
+ import json
14
+ import os
15
+ import re
16
+ import shutil
17
+ import subprocess
18
+ import sys
19
+ from pathlib import Path
20
+ from typing import Any
21
+
22
+
23
+ if hasattr(sys.stdout, "reconfigure"):
24
+ sys.stdout.reconfigure(encoding="utf-8")
25
+ if hasattr(sys.stderr, "reconfigure"):
26
+ sys.stderr.reconfigure(encoding="utf-8")
27
+
28
+
29
+ SCHEMA_VERSION = 1
30
+ PROFILE_REL = Path(".harness") / "config" / "build-profile.json"
31
+ PITFALLS_REL = Path(".harness") / "pitfalls.md"
32
+ PITFALLS_APPENDIX_HEADER = "## Preflight 附录(自动追加)"
33
+
34
+ DEFAULT_BUILD_COMMANDS: dict[str, str] = {
35
+ "compile": "",
36
+ "unitTest": "",
37
+ "unitTestFull": "",
38
+ "install": "",
39
+ "package": "",
40
+ }
41
+
42
+ VALID_QUIRK_ACTIONS = {"skip-not-block", "fix-command"}
43
+
44
+
45
+ def now_iso() -> str:
46
+ return dt.datetime.now().astimezone().isoformat(timespec="seconds")
47
+
48
+
49
+ def emit_json(payload: dict[str, Any], *, ok: bool = True) -> int:
50
+ print(json.dumps(payload, ensure_ascii=False, indent=2))
51
+ return 0 if ok else 1
52
+
53
+
54
+ def read_json(path: Path) -> Any:
55
+ return json.loads(path.read_text(encoding="utf-8"))
56
+
57
+
58
+ def write_json(path: Path, data: Any) -> None:
59
+ path.parent.mkdir(parents=True, exist_ok=True)
60
+ text = json.dumps(data, ensure_ascii=False, indent=2) + "\n"
61
+ path.write_text(text, encoding="utf-8")
62
+
63
+
64
+ def sha256_file(path: Path) -> str | None:
65
+ if not path.is_file():
66
+ return None
67
+ h = hashlib.sha256()
68
+ with path.open("rb") as fh:
69
+ for chunk in iter(lambda: fh.read(65536), b""):
70
+ h.update(chunk)
71
+ return h.hexdigest()
72
+
73
+
74
+ def find_root_pom(project: Path) -> Path | None:
75
+ candidates = [project / "pom.xml", project / "pom.xml.example"]
76
+ for c in candidates:
77
+ if c.is_file():
78
+ return c
79
+ return None
80
+
81
+
82
+ def which_tool(name: str) -> str | None:
83
+ found = shutil.which(name)
84
+ if found:
85
+ return str(Path(found).resolve())
86
+ # Windows: try .cmd / .bat / .exe explicitly
87
+ if os.name == "nt":
88
+ for ext in (".cmd", ".bat", ".exe"):
89
+ found = shutil.which(name + ext)
90
+ if found:
91
+ return str(Path(found).resolve())
92
+ return None
93
+
94
+
95
+ def run_version(tool_path: str | None, args: list[str], timeout: float = 8.0) -> str:
96
+ """Best-effort version probe. Empty string if unavailable."""
97
+ if not tool_path:
98
+ return ""
99
+ try:
100
+ completed = subprocess.run(
101
+ [tool_path, *args],
102
+ capture_output=True,
103
+ text=True,
104
+ encoding="utf-8",
105
+ errors="replace",
106
+ timeout=timeout,
107
+ check=False,
108
+ )
109
+ except (OSError, subprocess.TimeoutExpired):
110
+ return ""
111
+ text = (completed.stdout or "") + "\n" + (completed.stderr or "")
112
+ return _extract_version(text)
113
+
114
+
115
+ def _extract_version(text: str) -> str:
116
+ # node: v20.11.0 / Apache Maven 3.9.6
117
+ m = re.search(r"\bv?(\d+\.\d+\.\d+(?:[-+][\w.]+)?)\b", text)
118
+ if m:
119
+ return m.group(1)
120
+ m = re.search(r"version\s+([^\s,]+)", text, re.IGNORECASE)
121
+ if m:
122
+ return m.group(1).strip()
123
+ line = next((ln.strip() for ln in text.splitlines() if ln.strip()), "")
124
+ return line[:120]
125
+
126
+
127
+ def is_executable_path(path_str: str | None) -> bool:
128
+ if not path_str:
129
+ return False
130
+ p = Path(path_str)
131
+ if not p.exists():
132
+ return False
133
+ if p.is_file():
134
+ if os.name == "nt":
135
+ return True
136
+ return os.access(p, os.X_OK)
137
+ # On Windows, shutil.which may return .cmd wrappers that exist
138
+ return p.exists()
139
+
140
+
141
+ def load_existing_profile(project: Path) -> dict[str, Any] | None:
142
+ path = project / PROFILE_REL
143
+ if not path.is_file():
144
+ return None
145
+ try:
146
+ data = read_json(path)
147
+ except (OSError, json.JSONDecodeError):
148
+ return None
149
+ return data if isinstance(data, dict) else None
150
+
151
+
152
+ def parse_claude_hints(project: Path) -> dict[str, str]:
153
+ """Extract optional build command hints from CLAUDE.md / AGENTS.md."""
154
+ hints: dict[str, str] = {}
155
+ for name in ("CLAUDE.md", "AGENTS.md", ".claude/CLAUDE.md"):
156
+ path = project / name
157
+ if not path.is_file():
158
+ continue
159
+ try:
160
+ text = path.read_text(encoding="utf-8")
161
+ except OSError:
162
+ continue
163
+ # Look for fenced or inline mvn/npm command examples
164
+ for key, pattern in (
165
+ ("compile", r"(?:compile|编译)[^\n`]*`([^`]+)`"),
166
+ ("unitTest", r"(?:unit.?test|单元测试)[^\n`]*`([^`]+)`"),
167
+ ("package", r"(?:package|打包)[^\n`]*`([^`]+)`"),
168
+ ("install", r"(?:install|安装依赖)[^\n`]*`([^`]+)`"),
169
+ ):
170
+ m = re.search(pattern, text, re.IGNORECASE)
171
+ if m and key not in hints:
172
+ hints[key] = m.group(1).strip()
173
+ # Direct mvn lines
174
+ for m in re.finditer(r"`(mvn[^`]+)`", text):
175
+ cmd = m.group(1).strip()
176
+ if "compile" in cmd and "compile" not in hints:
177
+ hints["compile"] = cmd
178
+ elif re.search(r"\btest\b", cmd) and "unitTest" not in hints:
179
+ hints["unitTest"] = cmd
180
+ elif "package" in cmd and "package" not in hints:
181
+ hints["package"] = cmd
182
+ elif "install" in cmd and "install" not in hints:
183
+ hints["install"] = cmd
184
+ return hints
185
+
186
+
187
+ def empty_profile_skeleton() -> dict[str, Any]:
188
+ return {
189
+ "schemaVersion": SCHEMA_VERSION,
190
+ "detectedAt": "",
191
+ "toolPaths": {"node": "", "mvn": ""},
192
+ "buildCommands": dict(DEFAULT_BUILD_COMMANDS),
193
+ "verificationInputs": {},
194
+ "serviceStart": {
195
+ "command": "",
196
+ "healthUrl": "",
197
+ "startTimeoutSec": 120,
198
+ "inputFiles": [],
199
+ "profile": "",
200
+ "overlayPath": "",
201
+ },
202
+ "knownPreexistingErrors": [],
203
+ "shellQuirks": [],
204
+ "fingerprint": {"mvnVersion": "", "nodeVersion": "", "pomHash": ""},
205
+ }
206
+
207
+
208
+ def merge_preserve_quirks(
209
+ base: dict[str, Any],
210
+ existing: dict[str, Any] | None,
211
+ ) -> dict[str, Any]:
212
+ """Keep human-curated quirks/errors/commands when re-detecting."""
213
+ if not existing:
214
+ return base
215
+ # Preserve knownPreexistingErrors / shellQuirks / filled buildCommands / serviceStart
216
+ if isinstance(existing.get("knownPreexistingErrors"), list):
217
+ base["knownPreexistingErrors"] = list(existing["knownPreexistingErrors"])
218
+ if isinstance(existing.get("shellQuirks"), list):
219
+ base["shellQuirks"] = list(existing["shellQuirks"])
220
+ existing_cmds = existing.get("buildCommands")
221
+ if isinstance(existing_cmds, dict):
222
+ for k, v in existing_cmds.items():
223
+ if isinstance(v, str) and v.strip():
224
+ base["buildCommands"][k] = v
225
+ existing_svc = existing.get("serviceStart")
226
+ if isinstance(existing_svc, dict):
227
+ merged_svc = dict(base.get("serviceStart") or {})
228
+ for k, v in existing_svc.items():
229
+ if v not in (None, ""):
230
+ merged_svc[k] = v
231
+ base["serviceStart"] = merged_svc
232
+ # 保留用户已配置的 verificationInputs(可能含 module 专属 glob),不覆盖。
233
+ if isinstance(existing.get("verificationInputs"), dict):
234
+ base["verificationInputs"] = dict(existing["verificationInputs"])
235
+ return base
236
+
237
+
238
+ def build_fingerprint(project: Path, node_path: str | None, mvn_path: str | None) -> dict[str, str]:
239
+ pom = find_root_pom(project)
240
+ pom_hash = sha256_file(pom) if pom else ""
241
+ return {
242
+ "mvnVersion": run_version(mvn_path, ["--version"]) if mvn_path else "",
243
+ "nodeVersion": run_version(node_path, ["--version"]) if node_path else "",
244
+ "pomHash": pom_hash or "",
245
+ }
246
+
247
+
248
+ def current_pom_hash(project: Path) -> str:
249
+ pom = find_root_pom(project)
250
+ return (sha256_file(pom) if pom else "") or ""
251
+
252
+
253
+ def cmd_detect(project: Path) -> dict[str, Any]:
254
+ project = project.resolve()
255
+ existing = load_existing_profile(project)
256
+ profile = empty_profile_skeleton()
257
+
258
+ node_path = which_tool("node")
259
+ mvn_path = which_tool("mvn")
260
+ profile["toolPaths"] = {
261
+ "node": node_path or "",
262
+ "mvn": mvn_path or "",
263
+ }
264
+ profile["fingerprint"] = build_fingerprint(project, node_path, mvn_path)
265
+ profile["detectedAt"] = now_iso()
266
+
267
+ hints = parse_claude_hints(project)
268
+ cmds = dict(DEFAULT_BUILD_COMMANDS)
269
+ cmds.update({k: v for k, v in hints.items() if k in cmds})
270
+ # Sensible Java placeholders when pom exists but no hints
271
+ if find_root_pom(project) and not any(cmds.values()):
272
+ cmds["compile"] = "mvn -f pom.xml compile -o -q"
273
+ cmds["unitTest"] = "mvn -f pom.xml test -Dtest={testClasses} -o"
274
+ cmds["unitTestFull"] = "mvn -f pom.xml test -o"
275
+ cmds["install"] = "mvn install -pl {modules} -am -DskipTests -nsu"
276
+ cmds["package"] = "mvn -f pom.xml package '-Dmaven.test.skip=true'"
277
+ profile["buildCommands"] = cmds
278
+
279
+ # Java 项目给 verificationInputs.unitTestFull 一个根级默认闭包
280
+ # (多 module 项目用户可改为 module/pom.xml + module/src/**)。通用/无 pom
281
+ # 项目保持空 {} —— can-reuse --profile-input unitTestFull 会返回
282
+ # insufficient-evidence,执行全量测试但不允许缓存复用,直到 profile 配置好。
283
+ if find_root_pom(project):
284
+ # A reactor-level Maven test can run every module, so its reuse
285
+ # fingerprint must include every module's pom and source roots.
286
+ module_poms = sorted(
287
+ pom.relative_to(project).as_posix()
288
+ for pom in project.rglob("pom.xml")
289
+ if pom.is_file() and ".harness" not in pom.parts and ".git" not in pom.parts
290
+ )
291
+ full_inputs: list[str] = []
292
+ for pom in module_poms:
293
+ full_inputs.append(pom)
294
+ parent = Path(pom).parent
295
+ prefix = "" if str(parent) == "." else f"{parent.as_posix()}/"
296
+ full_inputs.extend([f"{prefix}src/main/**", f"{prefix}src/test/**"])
297
+ profile["verificationInputs"] = {"unitTestFull": full_inputs}
298
+
299
+ profile = merge_preserve_quirks(profile, existing)
300
+
301
+ # Idempotent fingerprint/toolPaths overwrite from fresh detect;
302
+ # detectedAt updates each run (tests compare ignoring it).
303
+ out_path = project / PROFILE_REL
304
+ write_json(out_path, profile)
305
+
306
+ return {
307
+ "ok": True,
308
+ "action": "detect",
309
+ "project": str(project),
310
+ "profilePath": str(out_path),
311
+ "profile": profile,
312
+ "created": existing is None,
313
+ "updated": True,
314
+ }
315
+
316
+
317
+ def cmd_check(project: Path) -> dict[str, Any]:
318
+ """Second-run fast check: existence + executability + fingerprint compare.
319
+
320
+ Does NOT run mvn/node full version probes (≤5s target).
321
+ """
322
+ project = project.resolve()
323
+ profile_path = project / PROFILE_REL
324
+ issues: list[str] = []
325
+ stale = False
326
+
327
+ if not profile_path.is_file():
328
+ return {
329
+ "ok": False,
330
+ "hardFailure": True,
331
+ "action": "check",
332
+ "project": str(project),
333
+ "stale": True,
334
+ "issues": ["build-profile.json missing; run detect"],
335
+ "hint": "python harness_preflight.py detect --project <root> --json",
336
+ }
337
+
338
+ try:
339
+ profile = read_json(profile_path)
340
+ except (OSError, json.JSONDecodeError) as exc:
341
+ return {
342
+ "ok": False,
343
+ "hardFailure": True,
344
+ "action": "check",
345
+ "project": str(project),
346
+ "stale": True,
347
+ "issues": [f"build-profile.json unreadable: {exc}"],
348
+ "hint": "python harness_preflight.py detect --project <root> --json",
349
+ }
350
+
351
+ if not isinstance(profile, dict):
352
+ return {
353
+ "ok": False,
354
+ "hardFailure": True,
355
+ "action": "check",
356
+ "project": str(project),
357
+ "stale": True,
358
+ "issues": ["build-profile.json is not an object"],
359
+ "hint": "python harness_preflight.py detect --project <root> --json",
360
+ }
361
+
362
+ tool_paths = profile.get("toolPaths") or {}
363
+ if not isinstance(tool_paths, dict):
364
+ tool_paths = {}
365
+
366
+ for tool_name in ("node", "mvn"):
367
+ path_str = tool_paths.get(tool_name) or ""
368
+ if not path_str:
369
+ # Empty is allowed (tool not present at detect time)
370
+ continue
371
+ if not is_executable_path(path_str):
372
+ stale = True
373
+ issues.append(f"toolPaths.{tool_name} missing or not executable: {path_str}")
374
+
375
+ fp = profile.get("fingerprint") or {}
376
+ if not isinstance(fp, dict):
377
+ fp = {}
378
+ stored_pom = fp.get("pomHash") or ""
379
+ current_pom = current_pom_hash(project)
380
+ if stored_pom != current_pom:
381
+ stale = True
382
+ issues.append(
383
+ f"fingerprint.pomHash changed: stored={stored_pom or '(empty)'} "
384
+ f"current={current_pom or '(empty)'}"
385
+ )
386
+
387
+ # If profile recorded a tool version but path is now gone → already covered.
388
+ # If pom appeared/disappeared relative to empty hash → covered above.
389
+
390
+ result = {
391
+ "ok": not stale,
392
+ "action": "check",
393
+ "project": str(project),
394
+ "stale": stale,
395
+ "issues": issues,
396
+ "fingerprint": {
397
+ "stored": {"pomHash": stored_pom, "mvnVersion": fp.get("mvnVersion", ""), "nodeVersion": fp.get("nodeVersion", "")},
398
+ "current": {"pomHash": current_pom},
399
+ },
400
+ }
401
+ if stale:
402
+ result["hint"] = "python harness_preflight.py detect --project <root> --json"
403
+ return result
404
+
405
+
406
+ def ensure_pitfalls_appendix(project: Path) -> Path:
407
+ path = project / PITFALLS_REL
408
+ path.parent.mkdir(parents=True, exist_ok=True)
409
+ if not path.exists():
410
+ content = (
411
+ "# 项目避坑记录\n\n"
412
+ "> 由 harness_preflight.py record-quirk 自动维护附录。\n\n"
413
+ f"{PITFALLS_APPENDIX_HEADER}\n\n"
414
+ )
415
+ path.write_text(content, encoding="utf-8")
416
+ return path
417
+ text = path.read_text(encoding="utf-8")
418
+ if PITFALLS_APPENDIX_HEADER not in text:
419
+ if not text.endswith("\n"):
420
+ text += "\n"
421
+ text += f"\n{PITFALLS_APPENDIX_HEADER}\n\n"
422
+ path.write_text(text, encoding="utf-8")
423
+ return path
424
+
425
+
426
+ def append_pitfalls_line(project: Path, line: str) -> Path:
427
+ path = ensure_pitfalls_appendix(project)
428
+ text = path.read_text(encoding="utf-8")
429
+ if not text.endswith("\n"):
430
+ text += "\n"
431
+ # Append after appendix header block (end of file is fine for append-only)
432
+ text += line.rstrip() + "\n"
433
+ path.write_text(text, encoding="utf-8")
434
+ return path
435
+
436
+
437
+ def cmd_record_quirk(
438
+ project: Path,
439
+ pattern: str,
440
+ reason: str,
441
+ action: str,
442
+ fixed_command: str | None = None,
443
+ ) -> dict[str, Any]:
444
+ project = project.resolve()
445
+ if action not in VALID_QUIRK_ACTIONS:
446
+ return {
447
+ "ok": False,
448
+ "action": "record-quirk",
449
+ "issues": [f"invalid action: {action}; expected one of {sorted(VALID_QUIRK_ACTIONS)}"],
450
+ }
451
+
452
+ profile_path = project / PROFILE_REL
453
+ if profile_path.is_file():
454
+ try:
455
+ profile = read_json(profile_path)
456
+ if not isinstance(profile, dict):
457
+ profile = empty_profile_skeleton()
458
+ except (OSError, json.JSONDecodeError):
459
+ profile = empty_profile_skeleton()
460
+ else:
461
+ profile = empty_profile_skeleton()
462
+ profile["detectedAt"] = now_iso()
463
+
464
+ profile.setdefault("knownPreexistingErrors", [])
465
+ profile.setdefault("shellQuirks", [])
466
+ profile.setdefault("buildCommands", dict(DEFAULT_BUILD_COMMANDS))
467
+
468
+ if not isinstance(profile["knownPreexistingErrors"], list):
469
+ profile["knownPreexistingErrors"] = []
470
+ if not isinstance(profile["shellQuirks"], list):
471
+ profile["shellQuirks"] = []
472
+ if not isinstance(profile["buildCommands"], dict):
473
+ profile["buildCommands"] = dict(DEFAULT_BUILD_COMMANDS)
474
+
475
+ changed: list[str] = []
476
+
477
+ if action == "skip-not-block":
478
+ entry = {"pattern": pattern, "reason": reason, "action": "skip-not-block"}
479
+ existing_patterns = {
480
+ e.get("pattern")
481
+ for e in profile["knownPreexistingErrors"]
482
+ if isinstance(e, dict)
483
+ }
484
+ if pattern not in existing_patterns:
485
+ profile["knownPreexistingErrors"].append(entry)
486
+ changed.append("knownPreexistingErrors")
487
+ else:
488
+ # Append-only: do not overwrite existing entry; still sync pitfalls
489
+ changed.append("knownPreexistingErrors(already-present)")
490
+ else: # fix-command
491
+ if pattern not in profile["shellQuirks"]:
492
+ profile["shellQuirks"].append(pattern)
493
+ changed.append("shellQuirks")
494
+ else:
495
+ changed.append("shellQuirks(already-present)")
496
+ if fixed_command:
497
+ # Known buildCommands key → update it; otherwise store under a
498
+ # namespaced custom key to avoid polluting the standard key space.
499
+ if pattern in DEFAULT_BUILD_COMMANDS:
500
+ key = pattern
501
+ else:
502
+ key = f"custom:{pattern}"
503
+ profile["buildCommands"][key] = fixed_command
504
+ changed.append(f"buildCommands.{key}")
505
+
506
+ write_json(profile_path, profile)
507
+
508
+ date_str = dt.date.today().isoformat()
509
+ pitfalls_line = f"- {date_str}: `{pattern}` — {reason} (action={action}"
510
+ if fixed_command:
511
+ pitfalls_line += f"; fixed-command=`{fixed_command}`"
512
+ pitfalls_line += ")"
513
+ pitfalls_path = append_pitfalls_line(project, pitfalls_line)
514
+
515
+ return {
516
+ "ok": True,
517
+ "action": "record-quirk",
518
+ "project": str(project),
519
+ "pattern": pattern,
520
+ "reason": reason,
521
+ "quirkAction": action,
522
+ "fixedCommand": fixed_command,
523
+ "changed": changed,
524
+ "profilePath": str(profile_path),
525
+ "pitfallsPath": str(pitfalls_path),
526
+ "pitfallsLine": pitfalls_line,
527
+ "profile": profile,
528
+ }
529
+
530
+
531
+ def parse_frontmatter(text: str) -> tuple[dict[str, Any] | None, str | None]:
532
+ """Parse YAML-ish frontmatter between leading --- fences.
533
+
534
+ Returns (meta, error_reason). Supports simple scalars, lists, and
535
+ nested list items used by harness agent definitions.
536
+ """
537
+ if not text.startswith("---"):
538
+ return None, "missing frontmatter start ---"
539
+ lines = text.splitlines()
540
+ if not lines or lines[0].strip() != "---":
541
+ return None, "missing frontmatter start ---"
542
+ end_idx = None
543
+ for i in range(1, len(lines)):
544
+ if lines[i].strip() == "---":
545
+ end_idx = i
546
+ break
547
+ if end_idx is None:
548
+ return None, "missing frontmatter end ---"
549
+
550
+ body = "\n".join(lines[1:end_idx])
551
+ meta: dict[str, Any] = {}
552
+ current_list_key: str | None = None
553
+
554
+ for raw in body.splitlines():
555
+ if not raw.strip():
556
+ continue
557
+ # list item under previous key
558
+ list_item = re.match(r"^-\s+(.*)$", raw)
559
+ if list_item and current_list_key:
560
+ meta.setdefault(current_list_key, [])
561
+ if not isinstance(meta[current_list_key], list):
562
+ meta[current_list_key] = []
563
+ meta[current_list_key].append(_parse_scalar(list_item.group(1).strip()))
564
+ continue
565
+
566
+ m = re.match(r"^([A-Za-z0-9_]+):\s*(.*)$", raw)
567
+ if not m:
568
+ current_list_key = None
569
+ continue
570
+ key, val = m.group(1), m.group(2).strip()
571
+ if val == "":
572
+ current_list_key = key
573
+ meta[key] = []
574
+ continue
575
+ current_list_key = None
576
+ if val.startswith("[") and val.endswith("]"):
577
+ inner = val[1:-1].strip()
578
+ if not inner:
579
+ meta[key] = []
580
+ else:
581
+ parts = _split_flow_list(inner)
582
+ meta[key] = [_parse_scalar(p.strip()) for p in parts]
583
+ else:
584
+ meta[key] = _parse_scalar(val)
585
+ return meta, None
586
+
587
+
588
+ def _split_flow_list(inner: str) -> list[str]:
589
+ """Split YAML flow list respecting nested brackets like Bash(powershell.exe:*)."""
590
+ parts: list[str] = []
591
+ buf: list[str] = []
592
+ depth = 0
593
+ for ch in inner:
594
+ if ch == "[":
595
+ depth += 1
596
+ buf.append(ch)
597
+ elif ch == "]":
598
+ depth = max(0, depth - 1)
599
+ buf.append(ch)
600
+ elif ch == "(":
601
+ depth += 1
602
+ buf.append(ch)
603
+ elif ch == ")":
604
+ depth = max(0, depth - 1)
605
+ buf.append(ch)
606
+ elif ch == "," and depth == 0:
607
+ parts.append("".join(buf))
608
+ buf = []
609
+ else:
610
+ buf.append(ch)
611
+ if buf:
612
+ parts.append("".join(buf))
613
+ return parts
614
+
615
+
616
+ def _parse_scalar(val: str) -> Any:
617
+ if (val.startswith('"') and val.endswith('"')) or (val.startswith("'") and val.endswith("'")):
618
+ return val[1:-1]
619
+ if val.lower() in ("true", "false"):
620
+ return val.lower() == "true"
621
+ if re.fullmatch(r"-?\d+", val):
622
+ return int(val)
623
+ return val
624
+
625
+
626
+ def cmd_check_agents(skills_root: Path, agent: str) -> dict[str, Any]:
627
+ skills_root = skills_root.resolve()
628
+ agent_name = agent.strip()
629
+ if not agent_name:
630
+ return {
631
+ "ok": False,
632
+ "action": "check-agents",
633
+ "agent": agent,
634
+ "usable": False,
635
+ "reason": "agent name is empty",
636
+ }
637
+
638
+ # Accept bare name or with .md
639
+ filename = agent_name if agent_name.endswith(".md") else f"{agent_name}.md"
640
+ agent_path = skills_root / "agents" / filename
641
+
642
+ if not agent_path.is_file():
643
+ return {
644
+ "ok": False,
645
+ "action": "check-agents",
646
+ "agent": agent_name,
647
+ "path": str(agent_path),
648
+ "usable": False,
649
+ "reason": f"agent file not found: {agent_path}",
650
+ }
651
+
652
+ try:
653
+ text = agent_path.read_text(encoding="utf-8")
654
+ except OSError as exc:
655
+ return {
656
+ "ok": False,
657
+ "action": "check-agents",
658
+ "agent": agent_name,
659
+ "path": str(agent_path),
660
+ "usable": False,
661
+ "reason": f"cannot read agent file: {exc}",
662
+ }
663
+
664
+ meta, err = parse_frontmatter(text)
665
+ if err or meta is None:
666
+ return {
667
+ "ok": False,
668
+ "action": "check-agents",
669
+ "agent": agent_name,
670
+ "path": str(agent_path),
671
+ "usable": False,
672
+ "reason": f"frontmatter parse failed: {err or 'unknown'}",
673
+ }
674
+
675
+ tools = meta.get("tools")
676
+ if tools is None:
677
+ return {
678
+ "ok": False,
679
+ "action": "check-agents",
680
+ "agent": agent_name,
681
+ "path": str(agent_path),
682
+ "usable": False,
683
+ "reason": "tools declaration missing",
684
+ "frontmatter": meta,
685
+ }
686
+ if not isinstance(tools, list) or len(tools) == 0:
687
+ return {
688
+ "ok": False,
689
+ "action": "check-agents",
690
+ "agent": agent_name,
691
+ "path": str(agent_path),
692
+ "usable": False,
693
+ "reason": "tools declaration empty or invalid",
694
+ "frontmatter": meta,
695
+ }
696
+
697
+ name_field = meta.get("name")
698
+ return {
699
+ "ok": True,
700
+ "action": "check-agents",
701
+ "agent": agent_name,
702
+ "path": str(agent_path),
703
+ "usable": True,
704
+ "reason": "agent file exists; frontmatter parsed; tools declared",
705
+ "name": name_field,
706
+ "tools": tools,
707
+ "frontmatterKeys": sorted(meta.keys()),
708
+ }
709
+
710
+
711
+ def build_parser() -> argparse.ArgumentParser:
712
+ parser = argparse.ArgumentParser(
713
+ description="Harness preflight: build-profile + agent availability checks.",
714
+ )
715
+ parser.add_argument(
716
+ "--json",
717
+ action="store_true",
718
+ help="Emit machine-readable JSON (always on for subcommands; kept for contract).",
719
+ )
720
+ sub = parser.add_subparsers(dest="command", required=True)
721
+
722
+ p_detect = sub.add_parser("detect", help="Full probe and write build-profile.json")
723
+ p_detect.add_argument("--project", required=True, type=Path)
724
+ p_detect.add_argument("--json", action="store_true")
725
+
726
+ p_check = sub.add_parser("check", help="Fast stale check of build-profile")
727
+ p_check.add_argument("--project", required=True, type=Path)
728
+ p_check.add_argument("--json", action="store_true")
729
+
730
+ p_quirk = sub.add_parser("record-quirk", help="Append quirk without overwriting peers")
731
+ p_quirk.add_argument("--project", required=True, type=Path)
732
+ p_quirk.add_argument("--pattern", required=True)
733
+ p_quirk.add_argument("--reason", required=True)
734
+ p_quirk.add_argument(
735
+ "--action",
736
+ required=True,
737
+ choices=sorted(VALID_QUIRK_ACTIONS),
738
+ )
739
+ p_quirk.add_argument("--fixed-command", default=None)
740
+ p_quirk.add_argument("--json", action="store_true")
741
+
742
+ p_agents = sub.add_parser("check-agents", help="Validate agent definition usability")
743
+ p_agents.add_argument("--skills-root", required=True, type=Path)
744
+ p_agents.add_argument("--agent", required=True)
745
+ p_agents.add_argument("--json", action="store_true")
746
+
747
+ return parser
748
+
749
+
750
+ def main(argv: list[str] | None = None) -> int:
751
+ parser = build_parser()
752
+ args = parser.parse_args(argv)
753
+
754
+ if args.command == "detect":
755
+ result = cmd_detect(args.project)
756
+ return emit_json(result, ok=bool(result.get("ok", True)))
757
+ if args.command == "check":
758
+ result = cmd_check(args.project)
759
+ # stale=true with a readable profile still exits 0 (callers branch on JSON);
760
+ # hard failures (profile missing / unreadable / not an object) exit 1.
761
+ return emit_json(result, ok=not result.get("hardFailure", False))
762
+ if args.command == "record-quirk":
763
+ result = cmd_record_quirk(
764
+ args.project,
765
+ pattern=args.pattern,
766
+ reason=args.reason,
767
+ action=args.action,
768
+ fixed_command=args.fixed_command,
769
+ )
770
+ return emit_json(result, ok=bool(result.get("ok", False)))
771
+ if args.command == "check-agents":
772
+ result = cmd_check_agents(args.skills_root, args.agent)
773
+ return emit_json(result, ok=True)
774
+
775
+ parser.error(f"unknown command: {args.command}")
776
+ return 2
777
+
778
+
779
+ if __name__ == "__main__":
780
+ raise SystemExit(main())