zob-harness 0.1.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 (356) hide show
  1. package/.pi/adapters/registry.json +103 -0
  2. package/.pi/agents/architecture-cartographer.md +53 -0
  3. package/.pi/agents/chief-vision.md +39 -0
  4. package/.pi/agents/clarifier.md +58 -0
  5. package/.pi/agents/context-steward.md +52 -0
  6. package/.pi/agents/doc-steward.md +34 -0
  7. package/.pi/agents/explore.md +49 -0
  8. package/.pi/agents/factory.md +41 -0
  9. package/.pi/agents/implementer.md +44 -0
  10. package/.pi/agents/librarian.md +32 -0
  11. package/.pi/agents/oracle-merge.md +50 -0
  12. package/.pi/agents/oracle.md +55 -0
  13. package/.pi/agents/pattern-miner.md +53 -0
  14. package/.pi/agents/planner.md +39 -0
  15. package/.pi/agents/project-dna-golden-evaluator.md +32 -0
  16. package/.pi/agents/project-dna-ontology-steward.md +30 -0
  17. package/.pi/agents/project-dna-oracle.md +56 -0
  18. package/.pi/agents/project-dna-orchestrator.md +60 -0
  19. package/.pi/agents/project-dna-query-steward.md +38 -0
  20. package/.pi/agents/project-dna-safety-preflight.md +54 -0
  21. package/.pi/agents/project-dna-test-linker.md +27 -0
  22. package/.pi/agents/qa.md +38 -0
  23. package/.pi/agents/refactor-cartographer.md +28 -0
  24. package/.pi/agents/refactor-mover.md +31 -0
  25. package/.pi/agents/refactor-oracle.md +49 -0
  26. package/.pi/agents/repo-scout.md +60 -0
  27. package/.pi/agents/sample-architect.md +48 -0
  28. package/.pi/agents/specifier.md +57 -0
  29. package/.pi/agents/symbol-range-curator.md +41 -0
  30. package/.pi/agents/synthesis.md +52 -0
  31. package/.pi/agents/temp-agent-creator.md +35 -0
  32. package/.pi/autonomy-policy.json +67 -0
  33. package/.pi/budget-policy.json +54 -0
  34. package/.pi/capabilities/zob-public-runtime-capabilities.json +1700 -0
  35. package/.pi/chains/explore-plan-oracle.json +78 -0
  36. package/.pi/chains/explore-spec-clarify-plan-oracle.json +64 -0
  37. package/.pi/chains/explore-spec-plan-oracle.json +53 -0
  38. package/.pi/chains/spec-clarify-plan-oracle.json +53 -0
  39. package/.pi/chains/spec-factory-oracle.json +42 -0
  40. package/.pi/chains/spec-plan-oracle.json +42 -0
  41. package/.pi/compute-profiles/defaults.json +19 -0
  42. package/.pi/compute-profiles/overrides.json +13 -0
  43. package/.pi/compute-profiles/risk-rules.json +16 -0
  44. package/.pi/daemon-policy.json +80 -0
  45. package/.pi/damage-control-rules.json +45 -0
  46. package/.pi/extensions/zob-child-safety/index.ts +212 -0
  47. package/.pi/extensions/zob-harness/AGENTS.md +28 -0
  48. package/.pi/extensions/zob-harness/index.ts +391 -0
  49. package/.pi/extensions/zob-harness/src/AGENTS.md +25 -0
  50. package/.pi/extensions/zob-harness/src/agents.ts +82 -0
  51. package/.pi/extensions/zob-harness/src/autonomous-runtime.ts +2912 -0
  52. package/.pi/extensions/zob-harness/src/autonomy-readiness.ts +778 -0
  53. package/.pi/extensions/zob-harness/src/budget-policy.ts +308 -0
  54. package/.pi/extensions/zob-harness/src/capabilities.ts +249 -0
  55. package/.pi/extensions/zob-harness/src/child-runner.ts +249 -0
  56. package/.pi/extensions/zob-harness/src/chronicle.ts +262 -0
  57. package/.pi/extensions/zob-harness/src/compute-profile.ts +602 -0
  58. package/.pi/extensions/zob-harness/src/compute-workflow-shape.ts +168 -0
  59. package/.pi/extensions/zob-harness/src/coms-v2/AGENTS.md +16 -0
  60. package/.pi/extensions/zob-harness/src/coms-v2/envelope.ts +121 -0
  61. package/.pi/extensions/zob-harness/src/coms-v2/identity.ts +53 -0
  62. package/.pi/extensions/zob-harness/src/coms-v2/ledger-bridge.ts +67 -0
  63. package/.pi/extensions/zob-harness/src/coms-v2/local-transport.ts +147 -0
  64. package/.pi/extensions/zob-harness/src/coms-v2/pending-replies.ts +80 -0
  65. package/.pi/extensions/zob-harness/src/coms-v2/policy.ts +125 -0
  66. package/.pi/extensions/zob-harness/src/coms-v2/presence.ts +55 -0
  67. package/.pi/extensions/zob-harness/src/coms-v2/registry.ts +113 -0
  68. package/.pi/extensions/zob-harness/src/coms-v2/response-capture.ts +50 -0
  69. package/.pi/extensions/zob-harness/src/coms-v2/transcript-capture.ts +164 -0
  70. package/.pi/extensions/zob-harness/src/coms-v2/types.ts +149 -0
  71. package/.pi/extensions/zob-harness/src/coms-v2/zpeer-profile.ts +140 -0
  72. package/.pi/extensions/zob-harness/src/coms-v2/zpeer.ts +452 -0
  73. package/.pi/extensions/zob-harness/src/constants.ts +108 -0
  74. package/.pi/extensions/zob-harness/src/context-gbrain.ts +465 -0
  75. package/.pi/extensions/zob-harness/src/daemon-policy.ts +223 -0
  76. package/.pi/extensions/zob-harness/src/daemon-readiness.ts +134 -0
  77. package/.pi/extensions/zob-harness/src/daemon-runtime.ts +393 -0
  78. package/.pi/extensions/zob-harness/src/factory/AGENTS.md +24 -0
  79. package/.pi/extensions/zob-harness/src/factory/agentic-plan.ts +65 -0
  80. package/.pi/extensions/zob-harness/src/factory/quarantine.ts +319 -0
  81. package/.pi/extensions/zob-harness/src/factory/run.ts +520 -0
  82. package/.pi/extensions/zob-harness/src/factory/validation.ts +454 -0
  83. package/.pi/extensions/zob-harness/src/factory-selector.ts +318 -0
  84. package/.pi/extensions/zob-harness/src/full-autonomy-test.ts +226 -0
  85. package/.pi/extensions/zob-harness/src/git-ops.ts +868 -0
  86. package/.pi/extensions/zob-harness/src/goal-room.ts +178 -0
  87. package/.pi/extensions/zob-harness/src/goal-runtime.ts +1569 -0
  88. package/.pi/extensions/zob-harness/src/goal-todo-imports.ts +111 -0
  89. package/.pi/extensions/zob-harness/src/goal-todo-types.ts +231 -0
  90. package/.pi/extensions/zob-harness/src/goal-todos.ts +1410 -0
  91. package/.pi/extensions/zob-harness/src/goal.ts +152 -0
  92. package/.pi/extensions/zob-harness/src/governed-requests.ts +436 -0
  93. package/.pi/extensions/zob-harness/src/interactive-autonomy.ts +595 -0
  94. package/.pi/extensions/zob-harness/src/launch-apply.ts +313 -0
  95. package/.pi/extensions/zob-harness/src/merge-queue.ts +290 -0
  96. package/.pi/extensions/zob-harness/src/mission-control.ts +573 -0
  97. package/.pi/extensions/zob-harness/src/model-availability.ts +52 -0
  98. package/.pi/extensions/zob-harness/src/model-routing.ts +429 -0
  99. package/.pi/extensions/zob-harness/src/orchestration/AGENTS.md +23 -0
  100. package/.pi/extensions/zob-harness/src/orchestration/adaptive-delegation.ts +547 -0
  101. package/.pi/extensions/zob-harness/src/orchestration/adaptive-workflow.ts +585 -0
  102. package/.pi/extensions/zob-harness/src/orchestration/lead-plan.ts +192 -0
  103. package/.pi/extensions/zob-harness/src/orchestration/plan.ts +168 -0
  104. package/.pi/extensions/zob-harness/src/orchestration/room.ts +346 -0
  105. package/.pi/extensions/zob-harness/src/orchestration/run.ts +134 -0
  106. package/.pi/extensions/zob-harness/src/orchestration/supervised-readonly.ts +1147 -0
  107. package/.pi/extensions/zob-harness/src/orchestration/widget-readers.ts +132 -0
  108. package/.pi/extensions/zob-harness/src/output-contracts.ts +656 -0
  109. package/.pi/extensions/zob-harness/src/project-dna.ts +533 -0
  110. package/.pi/extensions/zob-harness/src/promotion/AGENTS.md +24 -0
  111. package/.pi/extensions/zob-harness/src/promotion/candidate.ts +336 -0
  112. package/.pi/extensions/zob-harness/src/promotion/coms.ts +127 -0
  113. package/.pi/extensions/zob-harness/src/promotion/documentation.ts +142 -0
  114. package/.pi/extensions/zob-harness/src/promotion/factory.ts +107 -0
  115. package/.pi/extensions/zob-harness/src/promotion/ledger.ts +2 -0
  116. package/.pi/extensions/zob-harness/src/promotion/temp-agent.ts +151 -0
  117. package/.pi/extensions/zob-harness/src/promotion/types.ts +149 -0
  118. package/.pi/extensions/zob-harness/src/promotion/validate.ts +6 -0
  119. package/.pi/extensions/zob-harness/src/promotion/write-lane.ts +162 -0
  120. package/.pi/extensions/zob-harness/src/prompt-packs.ts +239 -0
  121. package/.pi/extensions/zob-harness/src/queue.ts +386 -0
  122. package/.pi/extensions/zob-harness/src/rules.ts +225 -0
  123. package/.pi/extensions/zob-harness/src/runtime/AGENTS.md +26 -0
  124. package/.pi/extensions/zob-harness/src/runtime/adaptive-zmode.ts +116 -0
  125. package/.pi/extensions/zob-harness/src/runtime/auto-compaction.ts +715 -0
  126. package/.pi/extensions/zob-harness/src/runtime/commands.ts +1315 -0
  127. package/.pi/extensions/zob-harness/src/runtime/compaction-policy.ts +516 -0
  128. package/.pi/extensions/zob-harness/src/runtime/delegation-click-markers.ts +141 -0
  129. package/.pi/extensions/zob-harness/src/runtime/delegation-feed.ts +415 -0
  130. package/.pi/extensions/zob-harness/src/runtime/delegation-markdown.ts +97 -0
  131. package/.pi/extensions/zob-harness/src/runtime/delegation-monitor.ts +553 -0
  132. package/.pi/extensions/zob-harness/src/runtime/delegation-mouse.ts +205 -0
  133. package/.pi/extensions/zob-harness/src/runtime/delegation-overlay.ts +434 -0
  134. package/.pi/extensions/zob-harness/src/runtime/events.ts +736 -0
  135. package/.pi/extensions/zob-harness/src/runtime/goal-todo-overlay.ts +214 -0
  136. package/.pi/extensions/zob-harness/src/runtime/mode-intent.ts +144 -0
  137. package/.pi/extensions/zob-harness/src/runtime/plan-capture.ts +270 -0
  138. package/.pi/extensions/zob-harness/src/runtime/state.ts +403 -0
  139. package/.pi/extensions/zob-harness/src/runtime/tools-autonomous.ts +117 -0
  140. package/.pi/extensions/zob-harness/src/runtime/tools-compute.ts +136 -0
  141. package/.pi/extensions/zob-harness/src/runtime/tools-coms.ts +365 -0
  142. package/.pi/extensions/zob-harness/src/runtime/tools-context.ts +70 -0
  143. package/.pi/extensions/zob-harness/src/runtime/tools-delegation.ts +1854 -0
  144. package/.pi/extensions/zob-harness/src/runtime/tools-factory.ts +810 -0
  145. package/.pi/extensions/zob-harness/src/runtime/tools-goal-room.ts +46 -0
  146. package/.pi/extensions/zob-harness/src/runtime/tools-governed-requests.ts +38 -0
  147. package/.pi/extensions/zob-harness/src/runtime/tools-merge-queue.ts +61 -0
  148. package/.pi/extensions/zob-harness/src/runtime/tools-mission-control.ts +77 -0
  149. package/.pi/extensions/zob-harness/src/runtime/tools-orchestration.ts +106 -0
  150. package/.pi/extensions/zob-harness/src/runtime/tools-project-dna.ts +123 -0
  151. package/.pi/extensions/zob-harness/src/runtime/tools-worker-pool.ts +93 -0
  152. package/.pi/extensions/zob-harness/src/runtime/tools-workspace-claims.ts +62 -0
  153. package/.pi/extensions/zob-harness/src/runtime/tools-zcommit.ts +147 -0
  154. package/.pi/extensions/zob-harness/src/runtime/widget.ts +353 -0
  155. package/.pi/extensions/zob-harness/src/runtime/zobHarness.ts +60 -0
  156. package/.pi/extensions/zob-harness/src/safety.ts +338 -0
  157. package/.pi/extensions/zob-harness/src/sandbox.ts +1508 -0
  158. package/.pi/extensions/zob-harness/src/schemas-project-dna.ts +47 -0
  159. package/.pi/extensions/zob-harness/src/schemas.ts +695 -0
  160. package/.pi/extensions/zob-harness/src/telemetry.ts +373 -0
  161. package/.pi/extensions/zob-harness/src/topology/AGENTS.md +22 -0
  162. package/.pi/extensions/zob-harness/src/topology/chains.ts +236 -0
  163. package/.pi/extensions/zob-harness/src/topology/coms.ts +211 -0
  164. package/.pi/extensions/zob-harness/src/topology/orchestration-profiles.ts +204 -0
  165. package/.pi/extensions/zob-harness/src/topology/teams.ts +113 -0
  166. package/.pi/extensions/zob-harness/src/types/core.ts +47 -0
  167. package/.pi/extensions/zob-harness/src/types.ts +939 -0
  168. package/.pi/extensions/zob-harness/src/utils/AGENTS.md +22 -0
  169. package/.pi/extensions/zob-harness/src/utils/formatting.ts +34 -0
  170. package/.pi/extensions/zob-harness/src/utils/hashing.ts +11 -0
  171. package/.pi/extensions/zob-harness/src/utils/json.ts +28 -0
  172. package/.pi/extensions/zob-harness/src/utils/paths.ts +54 -0
  173. package/.pi/extensions/zob-harness/src/utils/records.ts +25 -0
  174. package/.pi/extensions/zob-harness/src/utils/resources.ts +38 -0
  175. package/.pi/extensions/zob-harness/src/worker-pool.ts +672 -0
  176. package/.pi/extensions/zob-harness/src/workspace-claims.ts +297 -0
  177. package/.pi/extensions/zob-switch/index.ts +180 -0
  178. package/.pi/factories/budget-preflight-dry-run/batch-manifest.json +59 -0
  179. package/.pi/factories/budget-preflight-dry-run/factory.json +94 -0
  180. package/.pi/factories/budget-preflight-dry-run/pilot-manifest.json +50 -0
  181. package/.pi/factories/budget-preflight-dry-run/smoke-manifest.json +43 -0
  182. package/.pi/factories/code-review-matrix/batch-manifest.json +61 -0
  183. package/.pi/factories/code-review-matrix/factory.json +163 -0
  184. package/.pi/factories/code-review-matrix/pilot-manifest.json +41 -0
  185. package/.pi/factories/code-review-matrix/smoke-manifest.json +35 -0
  186. package/.pi/factories/factory-forge/batch-manifest.json +56 -0
  187. package/.pi/factories/factory-forge/factory.json +84 -0
  188. package/.pi/factories/factory-forge/pilot-manifest.json +32 -0
  189. package/.pi/factories/factory-forge/smoke-manifest.json +19 -0
  190. package/.pi/factories/opencode-pattern-canonizer/batch-manifest.json +54 -0
  191. package/.pi/factories/opencode-pattern-canonizer/factory.json +86 -0
  192. package/.pi/factories/opencode-pattern-canonizer/pilot-manifest.json +39 -0
  193. package/.pi/factories/opencode-pattern-canonizer/smoke-manifest.json +26 -0
  194. package/.pi/factories/project-dna/README.md +182 -0
  195. package/.pi/factories/project-dna/batch-manifest.json +37 -0
  196. package/.pi/factories/project-dna/example-project-dna-manifest-v2.json +80 -0
  197. package/.pi/factories/project-dna/example-project-dna-manifest.json +58 -0
  198. package/.pi/factories/project-dna/factory.json +131 -0
  199. package/.pi/factories/project-dna/golden-cases-smoke.json +62 -0
  200. package/.pi/factories/project-dna/pi-agentic-ontology.json +88 -0
  201. package/.pi/factories/project-dna/pilot-manifest.json +32 -0
  202. package/.pi/factories/project-dna/schemas/benchmark-suite.schema.json +27 -0
  203. package/.pi/factories/project-dna/schemas/code-knowledge-graph.schema.json +97 -0
  204. package/.pi/factories/project-dna/schemas/context-pack.schema.json +43 -0
  205. package/.pi/factories/project-dna/schemas/golden-case.schema.json +36 -0
  206. package/.pi/factories/project-dna/schemas/manifest-v2.schema.json +128 -0
  207. package/.pi/factories/project-dna/schemas/manifest.schema.json +77 -0
  208. package/.pi/factories/project-dna/schemas/ontology.schema.json +45 -0
  209. package/.pi/factories/project-dna/schemas/project-fingerprint.schema.json +28 -0
  210. package/.pi/factories/project-dna/schemas/query-steward-report.schema.json +52 -0
  211. package/.pi/factories/project-dna/smoke-manifest.json +27 -0
  212. package/.pi/factories/roadmap-smoke-lots/batch-manifest.json +49 -0
  213. package/.pi/factories/roadmap-smoke-lots/factory.json +89 -0
  214. package/.pi/factories/roadmap-smoke-lots/pilot-manifest.json +50 -0
  215. package/.pi/factories/roadmap-smoke-lots/smoke-manifest.json +35 -0
  216. package/.pi/git-policy.json +120 -0
  217. package/.pi/mission-control/zob_coms_transport.json +64 -0
  218. package/.pi/model-catalog.example.json +345 -0
  219. package/.pi/model-economy.example.json +196 -0
  220. package/.pi/model-routing.json +86 -0
  221. package/.pi/orchestrations/adaptive-chief-vision.json +193 -0
  222. package/.pi/orchestrations/ceo-feature-build.json +182 -0
  223. package/.pi/orchestrations/readonly-dynamic-smoke.json +75 -0
  224. package/.pi/output-contracts/agent-event.v1.json +19 -0
  225. package/.pi/output-contracts/base.v1.json +24 -0
  226. package/.pi/output-contracts/brain-lookup.v1.json +21 -0
  227. package/.pi/output-contracts/clarification.v1.json +21 -0
  228. package/.pi/output-contracts/context-pack.v1.json +20 -0
  229. package/.pi/output-contracts/context-request.v1.json +21 -0
  230. package/.pi/output-contracts/context-steward.v1.json +19 -0
  231. package/.pi/output-contracts/context-writeback-proposal.v1.json +18 -0
  232. package/.pi/output-contracts/delegation-request.v1.json +21 -0
  233. package/.pi/output-contracts/explore.v1.json +52 -0
  234. package/.pi/output-contracts/factory.v1.json +48 -0
  235. package/.pi/output-contracts/guidance-steward.v1.json +18 -0
  236. package/.pi/output-contracts/implement.v1.json +40 -0
  237. package/.pi/output-contracts/launch-authorization.v1.json +21 -0
  238. package/.pi/output-contracts/lead-plan.v1.json +22 -0
  239. package/.pi/output-contracts/mission-readiness.v1.json +20 -0
  240. package/.pi/output-contracts/oracle-merge.v1.json +44 -0
  241. package/.pi/output-contracts/oracle-request.v1.json +20 -0
  242. package/.pi/output-contracts/oracle.v1.json +44 -0
  243. package/.pi/output-contracts/orchestration-profile.v1.json +22 -0
  244. package/.pi/output-contracts/plan.v1.json +48 -0
  245. package/.pi/output-contracts/prompt-pack.v1.json +20 -0
  246. package/.pi/output-contracts/qa.v1.json +40 -0
  247. package/.pi/output-contracts/research.v1.json +36 -0
  248. package/.pi/output-contracts/spec.v1.json +22 -0
  249. package/.pi/output-contracts/synthesis.v1.json +44 -0
  250. package/.pi/output-contracts/temp-agent-card.v1.json +23 -0
  251. package/.pi/output-contracts/todo-child-result.v1.json +20 -0
  252. package/.pi/output-contracts/todo-child-result.v2.json +22 -0
  253. package/.pi/output-contracts/todo-claim-validation.v1.json +22 -0
  254. package/.pi/output-contracts/todo-split-request.v1.json +20 -0
  255. package/.pi/prompts/adaptive-workflow.md +63 -0
  256. package/.pi/prompts/autonomous-runtime.md +15 -0
  257. package/.pi/prompts/benchmark-contender.md +15 -0
  258. package/.pi/prompts/benchmark-judge.md +19 -0
  259. package/.pi/prompts/clarify-spec.md +20 -0
  260. package/.pi/prompts/compute-plan.md +36 -0
  261. package/.pi/prompts/compute-preview.md +42 -0
  262. package/.pi/prompts/contract.md +29 -0
  263. package/.pi/prompts/explore.md +13 -0
  264. package/.pi/prompts/factory-run.md +36 -0
  265. package/.pi/prompts/factory.md +20 -0
  266. package/.pi/prompts/implement.md +27 -0
  267. package/.pi/prompts/model-catalog.md +68 -0
  268. package/.pi/prompts/model-economy.md +64 -0
  269. package/.pi/prompts/oracle-merge.md +18 -0
  270. package/.pi/prompts/oracle.md +13 -0
  271. package/.pi/prompts/orchestrator.md +48 -0
  272. package/.pi/prompts/parallel-review.md +21 -0
  273. package/.pi/prompts/plan.md +21 -0
  274. package/.pi/prompts/project-dna.md +90 -0
  275. package/.pi/prompts/refactor-oracle.md +23 -0
  276. package/.pi/prompts/refactor-slice.md +24 -0
  277. package/.pi/prompts/research.md +20 -0
  278. package/.pi/prompts/spec.md +19 -0
  279. package/.pi/prompts/synthesis.md +18 -0
  280. package/.pi/rules/always.md +38 -0
  281. package/.pi/rules/docs.md +32 -0
  282. package/.pi/rules/factory.md +44 -0
  283. package/.pi/rules/oracle.md +34 -0
  284. package/.pi/rules/orchestration.md +44 -0
  285. package/.pi/rules/project.md +34 -0
  286. package/.pi/rules/prompts.md +43 -0
  287. package/.pi/rules/runtime.md +43 -0
  288. package/.pi/rules/sandbox.md +43 -0
  289. package/.pi/settings.json +28 -0
  290. package/.pi/skills/zob-agentic-access/SKILL.md +20 -0
  291. package/.pi/skills/zob-autonomous-runtime/SKILL.md +41 -0
  292. package/.pi/skills/zob-commit/SKILL.md +79 -0
  293. package/.pi/skills/zob-compaction-policy/SKILL.md +92 -0
  294. package/.pi/skills/zob-compute-profile/SKILL.md +108 -0
  295. package/.pi/skills/zob-coms-safety/SKILL.md +54 -0
  296. package/.pi/skills/zob-coms-v2-live/SKILL.md +47 -0
  297. package/.pi/skills/zob-delegation-routing/SKILL.md +82 -0
  298. package/.pi/skills/zob-factory/SKILL.md +28 -0
  299. package/.pi/skills/zob-goal-todo-tree/SKILL.md +279 -0
  300. package/.pi/skills/zob-harness/SKILL.md +68 -0
  301. package/.pi/skills/zob-mission-control-coms/SKILL.md +39 -0
  302. package/.pi/skills/zob-oracle/SKILL.md +21 -0
  303. package/.pi/skills/zob-owner-pool-drill-writer/SKILL.md +244 -0
  304. package/.pi/skills/zob-owner-pool-launcher/SKILL.md +261 -0
  305. package/.pi/skills/zob-project-dna/SKILL.md +275 -0
  306. package/.pi/skills/zob-sandbox/SKILL.md +29 -0
  307. package/.pi/skills/zob-spec/SKILL.md +25 -0
  308. package/.pi/skills/zob-split-refactor/SKILL.md +39 -0
  309. package/.pi/skills/zob-tool-router/SKILL.md +104 -0
  310. package/.pi/teams/zob-core.json +122 -0
  311. package/AGENTS.md +89 -0
  312. package/CONTRIBUTING.md +56 -0
  313. package/LICENSE +21 -0
  314. package/README.md +360 -0
  315. package/SECURITY.md +35 -0
  316. package/SOURCE_INDEX.md +46 -0
  317. package/package.json +135 -0
  318. package/scripts/README.md +57 -0
  319. package/scripts/autonomy/mission-readiness-secret-smoke.mjs +90 -0
  320. package/scripts/compute-profile/plan-workflow.mjs +85 -0
  321. package/scripts/compute-profile/preview.mjs +242 -0
  322. package/scripts/compute-profile/regression-smoke.mjs +38 -0
  323. package/scripts/compute-profile/summarize.mjs +72 -0
  324. package/scripts/compute-profile/validate-policy.mjs +50 -0
  325. package/scripts/compute-profile/validate-preview.mjs +95 -0
  326. package/scripts/compute-profile/validate-workflow.mjs +58 -0
  327. package/scripts/git-ops/commit-policy-smoke.mjs +221 -0
  328. package/scripts/goal-todo/child-goal-ref-smoke.mjs +252 -0
  329. package/scripts/harness-switch/static-smoke.mjs +43 -0
  330. package/scripts/model-catalog/validate-economy.mjs +223 -0
  331. package/scripts/model-catalog/validate.mjs +199 -0
  332. package/scripts/package-surface/validate-script-refs.mjs +190 -0
  333. package/scripts/path-policy/validate-smoke.mjs +103 -0
  334. package/scripts/project-dna/bench-smoke.mjs +217 -0
  335. package/scripts/project-dna/build-capsules.mjs +207 -0
  336. package/scripts/project-dna/build-sample-spec.mjs +140 -0
  337. package/scripts/project-dna/emit-golden-cases.mjs +75 -0
  338. package/scripts/project-dna/emit-ontology.mjs +75 -0
  339. package/scripts/project-dna/generate-sample.mjs +302 -0
  340. package/scripts/project-dna/oracle-review-smoke.mjs +157 -0
  341. package/scripts/project-dna/plan-workflow.mjs +289 -0
  342. package/scripts/project-dna/query-context.mjs +276 -0
  343. package/scripts/project-dna/query-steward.mjs +149 -0
  344. package/scripts/project-dna/scan.mjs +553 -0
  345. package/scripts/project-dna/validate-5of5.mjs +159 -0
  346. package/scripts/project-dna/validate-golden-cases.mjs +78 -0
  347. package/scripts/project-dna/validate-ontology.mjs +97 -0
  348. package/scripts/project-dna/validate-sample-project.mjs +105 -0
  349. package/scripts/project-dna/validate-scaffold.mjs +383 -0
  350. package/scripts/project-dna/validate-scan-artifacts.mjs +187 -0
  351. package/scripts/project-dna/validate-workflow.mjs +166 -0
  352. package/scripts/start-pi.sh +4 -0
  353. package/scripts/worker-pool/static-smoke.mjs +54 -0
  354. package/scripts/zpeer-local-e2e-smoke.mjs +395 -0
  355. package/scripts/zpeer-static-smoke.mjs +129 -0
  356. package/tsconfig.json +12 -0
@@ -0,0 +1,159 @@
1
+ #!/usr/bin/env node
2
+ import { execFileSync } from "node:child_process";
3
+ import { existsSync, readFileSync } from "node:fs";
4
+ import { isAbsolute, join, relative, resolve, sep } from "node:path";
5
+
6
+ const repoRoot = process.cwd();
7
+
8
+ function usage() {
9
+ console.error(`Usage:
10
+ node scripts/project-dna/validate-5of5.mjs --scan-dir <repo-relative-scan-dir>
11
+
12
+ Validates the ProjectDNA 5/5 agentic smoke posture: ontology, golden cases, query steward, benchmark, oracle, sample quarantine, and safety gates.`);
13
+ }
14
+
15
+ function parseArgs(argv) {
16
+ const out = {};
17
+ for (let i = 0; i < argv.length; i += 1) {
18
+ const arg = argv[i];
19
+ if (arg === "--scan-dir") out.scanDir = argv[++i];
20
+ else if (arg === "--help" || arg === "-h") out.help = true;
21
+ else throw new Error(`unknown argument: ${arg}`);
22
+ }
23
+ return out;
24
+ }
25
+
26
+ function resolveRepoDir(input) {
27
+ if (!input || isAbsolute(input)) throw new Error("--scan-dir must be repo-relative");
28
+ const resolved = resolve(repoRoot, input);
29
+ const rel = relative(repoRoot, resolved);
30
+ if (rel.startsWith("..") || rel === "") throw new Error("--scan-dir must stay inside repo and not be repo root");
31
+ if (!existsSync(resolved)) throw new Error(`--scan-dir not found: ${input}`);
32
+ return resolved;
33
+ }
34
+
35
+ function readJson(path, errors, label) {
36
+ if (!existsSync(path)) {
37
+ errors.push(`missing ${label}: ${relative(repoRoot, path).split(sep).join("/")}`);
38
+ return undefined;
39
+ }
40
+ try {
41
+ return JSON.parse(readFileSync(path, "utf8"));
42
+ } catch (error) {
43
+ errors.push(`invalid JSON in ${label}: ${error instanceof Error ? error.message : String(error)}`);
44
+ return undefined;
45
+ }
46
+ }
47
+
48
+ function runNode(args) {
49
+ return execFileSync(process.execPath, args, { cwd: repoRoot, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim().split("\n")[0] ?? "";
50
+ }
51
+
52
+ function broadCitation(citation) {
53
+ const match = /:L(\d+)-L?(\d+)$/.exec(String(citation));
54
+ return match ? Number(match[2]) - Number(match[1]) + 1 > 250 : false;
55
+ }
56
+
57
+ function main() {
58
+ const args = parseArgs(process.argv.slice(2));
59
+ if (args.help || !args.scanDir) {
60
+ usage();
61
+ if (!args.help) process.exit(2);
62
+ return;
63
+ }
64
+ const scanDir = resolveRepoDir(args.scanDir);
65
+ const scanDirRel = relative(repoRoot, scanDir).split(sep).join("/");
66
+ const errors = [];
67
+ const warnings = [];
68
+ const commandResults = [];
69
+
70
+ for (const command of [
71
+ ["scripts/project-dna/validate-scan-artifacts.mjs", "--scan-dir", scanDirRel],
72
+ ["scripts/project-dna/validate-ontology.mjs", "--scan-dir", scanDirRel],
73
+ ["scripts/project-dna/validate-golden-cases.mjs", "--scan-dir", scanDirRel],
74
+ ]) {
75
+ try {
76
+ commandResults.push({ command: `node ${command.join(" ")}`, output: runNode(command) });
77
+ } catch (error) {
78
+ errors.push(`validator failed: node ${command.join(" ")} :: ${error instanceof Error ? error.message : String(error)}`);
79
+ }
80
+ }
81
+
82
+ const sampleSummaryPath = join(scanDir, "quarantine", "sample-project", "project-dna-sample-summary.json");
83
+ if (existsSync(sampleSummaryPath)) {
84
+ try {
85
+ commandResults.push({ command: `node scripts/project-dna/validate-sample-project.mjs --sample-dir ${scanDirRel}/quarantine/sample-project`, output: runNode(["scripts/project-dna/validate-sample-project.mjs", "--sample-dir", `${scanDirRel}/quarantine/sample-project`]) });
86
+ } catch (error) {
87
+ errors.push(`sample validator failed: ${error instanceof Error ? error.message : String(error)}`);
88
+ }
89
+ } else {
90
+ errors.push("sample summary missing; 5/5 requires quarantine sample evidence");
91
+ }
92
+
93
+ const benchmark = readJson(join(scanDir, "bench", "benchmark-smoke.json"), errors, "benchmark-smoke.json");
94
+ const oracle = readJson(join(scanDir, "oracle", "project-dna-smoke-oracle-review.json"), errors, "project-dna-smoke-oracle-review.json");
95
+ const querySteward = readJson(join(scanDir, "query-steward-smoke.json"), errors, "query-steward-smoke.json");
96
+
97
+ if (benchmark) {
98
+ if (benchmark.schema !== "zob.project-dna-benchmark-smoke.v1") errors.push("benchmark schema mismatch");
99
+ if (benchmark.status !== "passed") errors.push("benchmark status must be passed");
100
+ if (benchmark.benchmark_kind !== "golden-agentic-5of5-smoke") errors.push("benchmark_kind must be golden-agentic-5of5-smoke");
101
+ if (benchmark.metrics?.cases_total < 5) errors.push("benchmark must evaluate at least five golden cases");
102
+ if (benchmark.metrics?.cases_passed !== benchmark.metrics?.cases_total) errors.push("all golden benchmark cases must pass");
103
+ if (benchmark.gates?.source_project_modified !== false) errors.push("benchmark source_project_modified must be false");
104
+ if (benchmark.gates?.knowledge_backend_write_enabled !== false) errors.push("benchmark knowledge_backend_write_enabled must be false");
105
+ if (benchmark.gates?.promotion_allowed !== false) errors.push("benchmark promotion_allowed must be false");
106
+ }
107
+
108
+ if (oracle) {
109
+ if (oracle.schema !== "zob.oracle-review.v1") errors.push("oracle schema mismatch");
110
+ if (oracle.verdict !== "PASS") errors.push("oracle verdict must be PASS");
111
+ if (oracle.no_ship !== false) errors.push("oracle no_ship must be false");
112
+ }
113
+
114
+ if (querySteward) {
115
+ if (querySteward.schema !== "zob.project-dna-query-steward-report.v1") errors.push("query steward schema mismatch");
116
+ if (querySteward.raw_query_persisted !== false) errors.push("query steward must not persist raw query");
117
+ if (querySteward.controlled_expansion?.stored_raw_terms !== false) errors.push("query steward must not persist raw expansion terms");
118
+ if (querySteward.loading_rules?.bounded_context_only !== true) errors.push("query steward bounded_context_only must be true");
119
+ if (querySteward.safety?.knowledge_backend_write_enabled !== false) errors.push("query steward backend write must be false");
120
+ }
121
+
122
+ const benchmarkCases = benchmark?.cases ?? [];
123
+ const allCitations = benchmarkCases.flatMap((testCase) => testCase.citations_checked ?? []);
124
+ if (allCitations.length > 0) {
125
+ const broad = allCitations.filter(broadCitation).length;
126
+ const ratio = broad / allCitations.length;
127
+ if (ratio > 0.75) warnings.push(`broad citation ratio high: ${ratio.toFixed(2)}; acceptable for smoke only, not production 5/5`);
128
+ }
129
+
130
+ const result = {
131
+ schema: "zob.project-dna-5of5-validation.v1",
132
+ valid: errors.length === 0,
133
+ scan_dir: scanDirRel,
134
+ errors,
135
+ warnings,
136
+ command_results: commandResults,
137
+ gates: {
138
+ agents_first: true,
139
+ deterministic_scripts_as_tools: true,
140
+ ontology_required: true,
141
+ golden_cases_required: true,
142
+ query_steward_required: true,
143
+ oracle_required: true,
144
+ source_project_modified: false,
145
+ knowledge_backend_write_enabled: false,
146
+ durable_promotion_allowed: false,
147
+ writeback_policy: "proposal_only",
148
+ }
149
+ };
150
+ console.log(JSON.stringify(result, null, 2));
151
+ if (errors.length > 0) process.exit(1);
152
+ }
153
+
154
+ try {
155
+ main();
156
+ } catch (error) {
157
+ console.error(JSON.stringify({ schema: "zob.project-dna-5of5-validation-error.v1", error: error instanceof Error ? error.message : String(error), source_project_modified: false, knowledge_backend_write_enabled: false }, null, 2));
158
+ process.exit(1);
159
+ }
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync, readFileSync } from "node:fs";
3
+ import { isAbsolute, relative, resolve } from "node:path";
4
+
5
+ const repoRoot = process.cwd();
6
+
7
+ function usage() {
8
+ console.error("Usage: node scripts/project-dna/validate-golden-cases.mjs --golden-cases <repo-relative-json>");
9
+ }
10
+
11
+ function parseArgs(argv) {
12
+ const out = {};
13
+ for (let i = 0; i < argv.length; i += 1) {
14
+ const arg = argv[i];
15
+ if (arg === "--golden-cases") out.goldenCases = argv[++i];
16
+ else if (arg === "--scan-dir") out.goldenCases = `${argv[++i].replace(/\/$/, "")}/golden-cases-smoke.json`;
17
+ else if (arg === "--help" || arg === "-h") out.help = true;
18
+ else throw new Error(`unknown argument: ${arg}`);
19
+ }
20
+ return out;
21
+ }
22
+
23
+ function resolveRepoPath(input, label) {
24
+ if (!input || isAbsolute(input)) throw new Error(`${label} must be repo-relative`);
25
+ const resolved = resolve(repoRoot, input);
26
+ const rel = relative(repoRoot, resolved);
27
+ if (rel.startsWith("..") || rel === "") throw new Error(`${label} must stay inside repo and not be repo root`);
28
+ if (!existsSync(resolved)) throw new Error(`${label} not found: ${input}`);
29
+ return resolved;
30
+ }
31
+
32
+ function main() {
33
+ const args = parseArgs(process.argv.slice(2));
34
+ if (args.help || !args.goldenCases) {
35
+ usage();
36
+ if (!args.help) process.exit(2);
37
+ return;
38
+ }
39
+ const suitePath = resolveRepoPath(args.goldenCases, "--golden-cases");
40
+ const suite = JSON.parse(readFileSync(suitePath, "utf8"));
41
+ const errors = [];
42
+ if (suite.schema !== "zob.project-dna-golden-suite.v1") errors.push("golden suite schema mismatch");
43
+ if (suite.raw_queries_persisted !== false) errors.push("raw_queries_persisted must be false");
44
+ if (suite.knowledge_backend_write_enabled !== false) errors.push("knowledge_backend_write_enabled must be false");
45
+ if (suite.promotion_policy !== "proposal_only") errors.push("promotion_policy must be proposal_only");
46
+ if (!Array.isArray(suite.cases) || suite.cases.length < 5) errors.push("at least five golden cases required for 5/5 smoke");
47
+ const ids = new Set();
48
+ for (const testCase of suite.cases ?? []) {
49
+ if (typeof testCase.id !== "string" || !/^[a-z0-9._-]+$/.test(testCase.id)) errors.push(`invalid case id: ${testCase.id}`);
50
+ if (ids.has(testCase.id)) errors.push(`duplicate case id: ${testCase.id}`);
51
+ ids.add(testCase.id);
52
+ if (typeof testCase.intent_id !== "string" || !testCase.intent_id) errors.push(`${testCase.id} intent_id required`);
53
+ if (typeof testCase.query !== "string" || testCase.query.length < 1) errors.push(`${testCase.id} transient query required`);
54
+ if (!Array.isArray(testCase.required_citation_includes) || testCase.required_citation_includes.length < 1) errors.push(`${testCase.id} required_citation_includes required`);
55
+ if (!Array.isArray(testCase.required_files_to_read_first) || testCase.required_files_to_read_first.length < 1) errors.push(`${testCase.id} required_files_to_read_first required`);
56
+ if (!Array.isArray(testCase.required_safety) || !testCase.required_safety.includes("bounded_context_only") || !testCase.required_safety.includes("citation_required")) errors.push(`${testCase.id} required_safety must include bounded_context_only and citation_required`);
57
+ if (Number(testCase.score_threshold) < 5) errors.push(`${testCase.id} score_threshold must be 5 for 5/5 smoke`);
58
+ }
59
+ const result = {
60
+ schema: "zob.project-dna-golden-suite-validation.v1",
61
+ valid: errors.length === 0,
62
+ golden_cases: relative(repoRoot, suitePath),
63
+ case_count: Array.isArray(suite.cases) ? suite.cases.length : 0,
64
+ errors,
65
+ source_project_modified: false,
66
+ knowledge_backend_write_enabled: false,
67
+ durable_promotion_allowed: false,
68
+ };
69
+ console.log(JSON.stringify(result, null, 2));
70
+ if (errors.length > 0) process.exit(1);
71
+ }
72
+
73
+ try {
74
+ main();
75
+ } catch (error) {
76
+ console.error(JSON.stringify({ schema: "zob.project-dna-golden-suite-validation-error.v1", error: error instanceof Error ? error.message : String(error), source_project_modified: false, knowledge_backend_write_enabled: false }, null, 2));
77
+ process.exit(1);
78
+ }
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync, readFileSync } from "node:fs";
3
+ import { isAbsolute, relative, resolve } from "node:path";
4
+
5
+ const repoRoot = process.cwd();
6
+ const FORBIDDEN_BODY_KEYS = new Set(["body", "content", "prompt", "output", "message", "rawConversation", "conversationHistory", "snippet", "diff", "patch"]);
7
+
8
+ function usage() {
9
+ console.error("Usage: node scripts/project-dna/validate-ontology.mjs --ontology <repo-relative-json>");
10
+ }
11
+
12
+ function parseArgs(argv) {
13
+ const out = {};
14
+ for (let i = 0; i < argv.length; i += 1) {
15
+ const arg = argv[i];
16
+ if (arg === "--ontology") out.ontology = argv[++i];
17
+ else if (arg === "--scan-dir") out.ontology = `${argv[++i].replace(/\/$/, "")}/ontology.json`;
18
+ else if (arg === "--help" || arg === "-h") out.help = true;
19
+ else throw new Error(`unknown argument: ${arg}`);
20
+ }
21
+ return out;
22
+ }
23
+
24
+ function resolveRepoPath(input, label) {
25
+ if (!input || isAbsolute(input)) throw new Error(`${label} must be repo-relative`);
26
+ const resolved = resolve(repoRoot, input);
27
+ const rel = relative(repoRoot, resolved);
28
+ if (rel.startsWith("..") || rel === "") throw new Error(`${label} must stay inside repo and not be repo root`);
29
+ if (!existsSync(resolved)) throw new Error(`${label} not found: ${input}`);
30
+ return resolved;
31
+ }
32
+
33
+ function findForbiddenKeys(value, trail = "$", hits = []) {
34
+ if (!value || typeof value !== "object") return hits;
35
+ if (Array.isArray(value)) {
36
+ value.forEach((child, index) => findForbiddenKeys(child, `${trail}[${index}]`, hits));
37
+ return hits;
38
+ }
39
+ for (const [key, child] of Object.entries(value)) {
40
+ if (FORBIDDEN_BODY_KEYS.has(key)) hits.push(`${trail}.${key}`);
41
+ findForbiddenKeys(child, `${trail}.${key}`, hits);
42
+ }
43
+ return hits;
44
+ }
45
+
46
+ function main() {
47
+ const args = parseArgs(process.argv.slice(2));
48
+ if (args.help || !args.ontology) {
49
+ usage();
50
+ if (!args.help) process.exit(2);
51
+ return;
52
+ }
53
+ const ontologyPath = resolveRepoPath(args.ontology, "--ontology");
54
+ const ontology = JSON.parse(readFileSync(ontologyPath, "utf8"));
55
+ const errors = [];
56
+ if (ontology.schema !== "zob.project-dna-ontology.v1") errors.push("ontology schema mismatch");
57
+ if (typeof ontology.ontology_id !== "string" || !ontology.ontology_id) errors.push("ontology_id required");
58
+ if (ontology.source_safe !== true) errors.push("source_safe must be true");
59
+ if (ontology.raw_bodies_stored !== false) errors.push("raw_bodies_stored must be false");
60
+ if (ontology.knowledge_backend_write_enabled !== false) errors.push("knowledge_backend_write_enabled must be false");
61
+ if (ontology.promotion_policy !== "proposal_only") errors.push("promotion_policy must be proposal_only");
62
+ if (!Array.isArray(ontology.concepts) || ontology.concepts.length < 5) errors.push("at least five concepts required for 5/5 smoke");
63
+ const ids = new Set();
64
+ for (const concept of ontology.concepts ?? []) {
65
+ if (typeof concept.id !== "string" || !/^[a-z0-9_.-]+$/.test(concept.id)) errors.push(`invalid concept id: ${concept.id}`);
66
+ if (ids.has(concept.id)) errors.push(`duplicate concept id: ${concept.id}`);
67
+ ids.add(concept.id);
68
+ if (!Array.isArray(concept.aliases) || concept.aliases.length < 1) errors.push(`${concept.id} aliases required`);
69
+ if (!Array.isArray(concept.expected_file_hints) || concept.expected_file_hints.length < 1) errors.push(`${concept.id} expected_file_hints required`);
70
+ if (!Array.isArray(concept.minimum_citation_roles) || concept.minimum_citation_roles.length < 1) errors.push(`${concept.id} minimum_citation_roles required`);
71
+ }
72
+ if (!Array.isArray(ontology.edge_types) || !ontology.edge_types.includes("tested_by") || !ontology.edge_types.includes("validated_by")) errors.push("edge_types must include tested_by and validated_by");
73
+ if (ontology.citation_policy?.citation_required !== true) errors.push("citation_policy.citation_required must be true");
74
+ if (ontology.citation_policy?.prefer_symbol_ranges !== true) errors.push("citation_policy.prefer_symbol_ranges must be true");
75
+ if (ontology.citation_policy?.raw_body_storage_allowed !== false) errors.push("citation_policy.raw_body_storage_allowed must be false");
76
+ const bodyHits = findForbiddenKeys(ontology);
77
+ if (bodyHits.length > 0) errors.push(`ontology contains forbidden raw/body-like keys: ${bodyHits.slice(0, 10).join(", ")}`);
78
+ const result = {
79
+ schema: "zob.project-dna-ontology-validation.v1",
80
+ valid: errors.length === 0,
81
+ ontology: relative(repoRoot, ontologyPath),
82
+ concept_count: Array.isArray(ontology.concepts) ? ontology.concepts.length : 0,
83
+ errors,
84
+ source_project_modified: false,
85
+ knowledge_backend_write_enabled: false,
86
+ durable_promotion_allowed: false,
87
+ };
88
+ console.log(JSON.stringify(result, null, 2));
89
+ if (errors.length > 0) process.exit(1);
90
+ }
91
+
92
+ try {
93
+ main();
94
+ } catch (error) {
95
+ console.error(JSON.stringify({ schema: "zob.project-dna-ontology-validation-error.v1", error: error instanceof Error ? error.message : String(error), source_project_modified: false, knowledge_backend_write_enabled: false }, null, 2));
96
+ process.exit(1);
97
+ }
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env node
2
+ import { execFileSync } from "node:child_process";
3
+ import { existsSync, readFileSync } from "node:fs";
4
+ import { isAbsolute, join, relative, resolve } from "node:path";
5
+
6
+ const repoRoot = process.cwd();
7
+ const REQUIRED = [
8
+ "package.json",
9
+ "README.md",
10
+ "src/config/index.mjs",
11
+ "src/example-module/index.mjs",
12
+ "src/tools/example-tool.mjs",
13
+ "src/extension.mjs",
14
+ ".pi/agents/example-agent.md",
15
+ ".pi/skills/example-skill/SKILL.md",
16
+ "test/sample.test.mjs",
17
+ "scripts/validate-sample.mjs",
18
+ "project-dna-sample-summary.json",
19
+ ];
20
+
21
+ function usage() {
22
+ console.error("Usage: node scripts/project-dna/validate-sample-project.mjs --sample-dir <repo-relative-quarantine-sample-dir>");
23
+ }
24
+
25
+ function parseArgs(argv) {
26
+ const out = {};
27
+ for (let i = 0; i < argv.length; i += 1) {
28
+ const arg = argv[i];
29
+ if (arg === "--sample-dir") out.sampleDir = argv[++i];
30
+ else if (arg === "--help" || arg === "-h") out.help = true;
31
+ else throw new Error(`unknown argument: ${arg}`);
32
+ }
33
+ return out;
34
+ }
35
+
36
+ function resolveRepoDir(input) {
37
+ if (!input || isAbsolute(input)) throw new Error("--sample-dir must be repo-relative");
38
+ const resolved = resolve(repoRoot, input);
39
+ const rel = relative(repoRoot, resolved);
40
+ if (rel.startsWith("..") || rel === "") throw new Error("--sample-dir must stay inside repo and not be repo root");
41
+ if (!rel.split(/[/\\]/).includes("quarantine")) throw new Error("--sample-dir must be under a quarantine path");
42
+ return resolved;
43
+ }
44
+
45
+ function runNode(args, cwd) {
46
+ return execFileSync(process.execPath, args, { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
47
+ }
48
+
49
+ function main() {
50
+ const args = parseArgs(process.argv.slice(2));
51
+ if (args.help || !args.sampleDir) {
52
+ usage();
53
+ if (!args.help) process.exit(2);
54
+ return;
55
+ }
56
+ const sampleDir = resolveRepoDir(args.sampleDir);
57
+ const errors = [];
58
+ const missing = REQUIRED.filter((path) => !existsSync(join(sampleDir, path)));
59
+ if (missing.length > 0) errors.push(`missing required sample files: ${missing.join(", ")}`);
60
+ let pkg;
61
+ let summary;
62
+ if (missing.length === 0) {
63
+ pkg = JSON.parse(readFileSync(join(sampleDir, "package.json"), "utf8"));
64
+ summary = JSON.parse(readFileSync(join(sampleDir, "project-dna-sample-summary.json"), "utf8"));
65
+ if (pkg.projectDna?.source_files_copied !== false) errors.push("package projectDna.source_files_copied must be false");
66
+ if (pkg.projectDna?.source_project_modified !== false) errors.push("package projectDna.source_project_modified must be false");
67
+ if (pkg.projectDna?.knowledge_backend_write_enabled !== false) errors.push("package projectDna.knowledge_backend_write_enabled must be false");
68
+ if (summary.quarantine_only !== true) errors.push("summary quarantine_only must be true");
69
+ if (summary.source_files_copied !== false) errors.push("summary source_files_copied must be false");
70
+ if (summary.source_project_modified !== false) errors.push("summary source_project_modified must be false");
71
+ if (summary.knowledge_backend_write_enabled !== false) errors.push("summary knowledge_backend_write_enabled must be false");
72
+ if (Object.keys(pkg.dependencies ?? {}).length !== 0 || Object.keys(pkg.devDependencies ?? {}).length !== 0) errors.push("P1 sample smoke must be dependency-free");
73
+ }
74
+
75
+ const commandResults = [];
76
+ if (errors.length === 0) {
77
+ for (const file of ["src/config/index.mjs", "src/example-module/index.mjs", "src/tools/example-tool.mjs", "src/extension.mjs", "test/sample.test.mjs", "scripts/validate-sample.mjs"]) {
78
+ runNode(["--check", file], sampleDir);
79
+ commandResults.push(`node --check ${file}`);
80
+ }
81
+ commandResults.push(`node scripts/validate-sample.mjs -> ${runNode(["scripts/validate-sample.mjs"], sampleDir).split("\n")[0]}`);
82
+ commandResults.push(`node test/sample.test.mjs -> ${runNode(["test/sample.test.mjs"], sampleDir)}`);
83
+ }
84
+
85
+ const result = {
86
+ schema: "zob.project-dna-sample-validation.v1",
87
+ sample_dir: relative(repoRoot, sampleDir),
88
+ valid: errors.length === 0,
89
+ errors,
90
+ required_files: REQUIRED,
91
+ command_results: commandResults,
92
+ quarantine_only: true,
93
+ source_project_modified: false,
94
+ knowledge_backend_write_enabled: false,
95
+ };
96
+ console.log(JSON.stringify(result, null, 2));
97
+ if (errors.length > 0) process.exit(1);
98
+ }
99
+
100
+ try {
101
+ main();
102
+ } catch (error) {
103
+ console.error(JSON.stringify({ schema: "zob.project-dna-sample-validation-error.v1", error: error instanceof Error ? error.message : String(error), source_project_modified: false, knowledge_backend_write_enabled: false }, null, 2));
104
+ process.exit(1);
105
+ }