@shrkcrft/inspector 0.1.0-alpha.30 → 0.1.0-alpha.31

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 (693) hide show
  1. package/dist/acceptance-replay.js +1 -1
  2. package/dist/agent-contract-templates.js +6 -6
  3. package/dist/agent-contract.d.ts.map +1 -1
  4. package/dist/agent-contract.js +13 -8
  5. package/dist/agent-orchestration.js +2 -2
  6. package/dist/agent-task-prep.d.ts +16 -0
  7. package/dist/agent-task-prep.d.ts.map +1 -1
  8. package/dist/agent-task-prep.js +51 -4
  9. package/dist/ai-readiness.d.ts.map +1 -1
  10. package/dist/ai-readiness.js +21 -3
  11. package/dist/architecture-map.d.ts +16 -0
  12. package/dist/architecture-map.d.ts.map +1 -1
  13. package/dist/architecture-map.js +42 -26
  14. package/dist/area-explore.d.ts +2 -2
  15. package/dist/area-explore.d.ts.map +1 -1
  16. package/dist/area-explore.js +36 -16
  17. package/dist/area-map.d.ts +56 -11
  18. package/dist/area-map.d.ts.map +1 -1
  19. package/dist/area-map.js +106 -25
  20. package/dist/asset-doctor-proposed-exit.d.ts +21 -0
  21. package/dist/asset-doctor-proposed-exit.d.ts.map +1 -0
  22. package/dist/asset-doctor-proposed-exit.js +22 -0
  23. package/dist/asset-provenance.js +1 -1
  24. package/dist/boundaries-changed-only.d.ts +24 -1
  25. package/dist/boundaries-changed-only.d.ts.map +1 -1
  26. package/dist/boundaries-changed-only.js +12 -2
  27. package/dist/boundary-check-options.model.d.ts +40 -0
  28. package/dist/boundary-check-options.model.d.ts.map +1 -0
  29. package/dist/boundary-check-options.model.js +1 -0
  30. package/dist/boundary-check-result.model.d.ts +89 -0
  31. package/dist/boundary-check-result.model.d.ts.map +1 -0
  32. package/dist/boundary-check-result.model.js +1 -0
  33. package/dist/boundary-configuration-status.d.ts +38 -0
  34. package/dist/boundary-configuration-status.d.ts.map +1 -0
  35. package/dist/boundary-configuration-status.js +118 -0
  36. package/dist/boundary-configuration-status.model.d.ts +37 -0
  37. package/dist/boundary-configuration-status.model.d.ts.map +1 -0
  38. package/dist/boundary-configuration-status.model.js +1 -0
  39. package/dist/boundary-load-issue.model.d.ts +30 -0
  40. package/dist/boundary-load-issue.model.d.ts.map +1 -0
  41. package/dist/boundary-load-issue.model.js +1 -0
  42. package/dist/boundary-rule-check.model.d.ts +44 -0
  43. package/dist/boundary-rule-check.model.d.ts.map +1 -0
  44. package/dist/boundary-rule-check.model.js +1 -0
  45. package/dist/boundary-rule-invalidation.model.d.ts +31 -0
  46. package/dist/boundary-rule-invalidation.model.d.ts.map +1 -0
  47. package/dist/boundary-rule-invalidation.model.js +1 -0
  48. package/dist/boundary-rule-set-diff.model.d.ts +75 -0
  49. package/dist/boundary-rule-set-diff.model.d.ts.map +1 -0
  50. package/dist/boundary-rule-set-diff.model.js +1 -0
  51. package/dist/boundary-rule-sources.d.ts +28 -0
  52. package/dist/boundary-rule-sources.d.ts.map +1 -0
  53. package/dist/boundary-rule-sources.js +110 -0
  54. package/dist/boundary-stale-exception-finding.model.d.ts +12 -0
  55. package/dist/boundary-stale-exception-finding.model.d.ts.map +1 -0
  56. package/dist/boundary-stale-exception-finding.model.js +1 -0
  57. package/dist/boundary-unit-liveness.d.ts +35 -0
  58. package/dist/boundary-unit-liveness.d.ts.map +1 -0
  59. package/dist/boundary-unit-liveness.js +71 -0
  60. package/dist/change-intent.d.ts +3 -0
  61. package/dist/change-intent.d.ts.map +1 -1
  62. package/dist/change-intent.js +61 -27
  63. package/dist/changes-summary.d.ts.map +1 -1
  64. package/dist/changes-summary.js +19 -9
  65. package/dist/ci-integrity-report.js +1 -1
  66. package/dist/ci-predict.d.ts.map +1 -1
  67. package/dist/ci-predict.js +38 -5
  68. package/dist/code-intelligence-doctor.d.ts +6 -0
  69. package/dist/code-intelligence-doctor.d.ts.map +1 -1
  70. package/dist/code-intelligence-doctor.js +22 -7
  71. package/dist/command-recommender.d.ts +45 -2
  72. package/dist/command-recommender.d.ts.map +1 -1
  73. package/dist/command-recommender.js +41 -263
  74. package/dist/command-resolution-status.d.ts +44 -0
  75. package/dist/command-resolution-status.d.ts.map +1 -0
  76. package/dist/command-resolution-status.js +44 -0
  77. package/dist/command-safety-level.d.ts +15 -0
  78. package/dist/command-safety-level.d.ts.map +1 -0
  79. package/dist/command-safety-level.js +43 -0
  80. package/dist/command-taxonomy.js +1 -1
  81. package/dist/compliance-evidence.js +1 -1
  82. package/dist/compliance-profiles.js +1 -1
  83. package/dist/construct-registry.d.ts +40 -0
  84. package/dist/construct-registry.d.ts.map +1 -1
  85. package/dist/construct-registry.js +186 -82
  86. package/dist/context-tuning.d.ts +4 -0
  87. package/dist/context-tuning.d.ts.map +1 -1
  88. package/dist/context-tuning.js +10 -7
  89. package/dist/contract-template-registry.d.ts +10 -0
  90. package/dist/contract-template-registry.d.ts.map +1 -1
  91. package/dist/contract-template-registry.js +59 -33
  92. package/dist/contribution-kind.d.ts +52 -0
  93. package/dist/contribution-kind.d.ts.map +1 -0
  94. package/dist/contribution-kind.js +52 -0
  95. package/dist/contribution-load-failures.d.ts +106 -0
  96. package/dist/contribution-load-failures.d.ts.map +1 -0
  97. package/dist/contribution-load-failures.js +575 -0
  98. package/dist/contributions-report.d.ts +28 -0
  99. package/dist/contributions-report.d.ts.map +1 -0
  100. package/dist/contributions-report.js +242 -0
  101. package/dist/convention-registry.d.ts +22 -0
  102. package/dist/convention-registry.d.ts.map +1 -1
  103. package/dist/convention-registry.js +79 -39
  104. package/dist/coverage-report.d.ts.map +1 -1
  105. package/dist/coverage-report.js +6 -6
  106. package/dist/custom-checks.d.ts +60 -1
  107. package/dist/custom-checks.d.ts.map +1 -1
  108. package/dist/custom-checks.js +159 -6
  109. package/dist/dashboard/dashboard-data.d.ts +6 -0
  110. package/dist/dashboard/dashboard-data.d.ts.map +1 -1
  111. package/dist/dashboard/dashboard-data.js +99 -8
  112. package/dist/dashboard/dashboard-knowledge.d.ts.map +1 -1
  113. package/dist/dashboard/dashboard-knowledge.js +14 -2
  114. package/dist/decision-records.d.ts +20 -0
  115. package/dist/decision-records.d.ts.map +1 -1
  116. package/dist/decision-records.js +68 -20
  117. package/dist/declared-cross-references.d.ts +61 -0
  118. package/dist/declared-cross-references.d.ts.map +1 -0
  119. package/dist/declared-cross-references.js +550 -0
  120. package/dist/declared-gate-plane-rules.d.ts +24 -0
  121. package/dist/declared-gate-plane-rules.d.ts.map +1 -0
  122. package/dist/declared-gate-plane-rules.js +39 -0
  123. package/dist/declared-reference-coverage.d.ts +27 -0
  124. package/dist/declared-reference-coverage.d.ts.map +1 -0
  125. package/dist/declared-reference-coverage.js +50 -0
  126. package/dist/declared-xref-status.d.ts +19 -0
  127. package/dist/declared-xref-status.d.ts.map +1 -0
  128. package/dist/declared-xref-status.js +19 -0
  129. package/dist/delegate-pack-recipes.d.ts +13 -2
  130. package/dist/delegate-pack-recipes.d.ts.map +1 -1
  131. package/dist/delegate-pack-recipes.js +45 -14
  132. package/dist/demo-package.js +2 -2
  133. package/dist/demo-script.js +2 -2
  134. package/dist/demo-workflow.js +3 -3
  135. package/dist/dev-cycle.js +1 -1
  136. package/dist/dev-session.js +1 -1
  137. package/dist/doc-references.d.ts +23 -2
  138. package/dist/doc-references.d.ts.map +1 -1
  139. package/dist/doc-references.js +96 -17
  140. package/dist/doctor-result.d.ts +8 -0
  141. package/dist/doctor-result.d.ts.map +1 -1
  142. package/dist/doctor-verdict-kind.d.ts +19 -0
  143. package/dist/doctor-verdict-kind.d.ts.map +1 -0
  144. package/dist/doctor-verdict-kind.js +19 -0
  145. package/dist/doctor-verdict.d.ts +18 -0
  146. package/dist/doctor-verdict.d.ts.map +1 -0
  147. package/dist/doctor-verdict.js +28 -0
  148. package/dist/drift.d.ts +17 -0
  149. package/dist/drift.d.ts.map +1 -1
  150. package/dist/drift.js +40 -10
  151. package/dist/entrypoint-matrix.d.ts.map +1 -1
  152. package/dist/entrypoint-matrix.js +4 -1
  153. package/dist/feedback-ingestion.d.ts +28 -2
  154. package/dist/feedback-ingestion.d.ts.map +1 -1
  155. package/dist/feedback-ingestion.js +68 -19
  156. package/dist/fix-preview.d.ts.map +1 -1
  157. package/dist/fix-preview.js +9 -5
  158. package/dist/framework-extractor-outcomes.d.ts +27 -0
  159. package/dist/framework-extractor-outcomes.d.ts.map +1 -0
  160. package/dist/framework-extractor-outcomes.js +83 -0
  161. package/dist/fuzzy-impact.js +1 -1
  162. package/dist/healing-plan.d.ts.map +1 -1
  163. package/dist/healing-plan.js +3 -4
  164. package/dist/helper-catalog.d.ts +25 -0
  165. package/dist/helper-catalog.d.ts.map +1 -0
  166. package/dist/helper-catalog.js +91 -0
  167. package/dist/helper-registry.d.ts.map +1 -1
  168. package/dist/helper-registry.js +17 -1
  169. package/dist/helper-view.d.ts +33 -0
  170. package/dist/helper-view.d.ts.map +1 -0
  171. package/dist/helper-view.js +1 -0
  172. package/dist/i-asset-doctor-flags.d.ts +16 -0
  173. package/dist/i-asset-doctor-flags.d.ts.map +1 -0
  174. package/dist/i-asset-doctor-flags.js +1 -0
  175. package/dist/i-command-resolution.d.ts +22 -0
  176. package/dist/i-command-resolution.d.ts.map +1 -0
  177. package/dist/i-command-resolution.js +1 -0
  178. package/dist/i-command-resolve-options.d.ts +24 -0
  179. package/dist/i-command-resolve-options.d.ts.map +1 -0
  180. package/dist/i-command-resolve-options.js +1 -0
  181. package/dist/i-command-safety.d.ts +13 -0
  182. package/dist/i-command-safety.d.ts.map +1 -0
  183. package/dist/i-command-safety.js +1 -0
  184. package/dist/i-contribution-accepted-entry.d.ts +18 -0
  185. package/dist/i-contribution-accepted-entry.d.ts.map +1 -0
  186. package/dist/i-contribution-accepted-entry.js +1 -0
  187. package/dist/i-contribution-entry-rejection.d.ts +21 -0
  188. package/dist/i-contribution-entry-rejection.d.ts.map +1 -0
  189. package/dist/i-contribution-entry-rejection.js +1 -0
  190. package/dist/i-contribution-file-issue.d.ts +18 -0
  191. package/dist/i-contribution-file-issue.d.ts.map +1 -0
  192. package/dist/i-contribution-file-issue.js +1 -0
  193. package/dist/i-contribution-file-report.d.ts +40 -0
  194. package/dist/i-contribution-file-report.d.ts.map +1 -0
  195. package/dist/i-contribution-file-report.js +1 -0
  196. package/dist/i-contribution-file-validation.d.ts +24 -0
  197. package/dist/i-contribution-file-validation.d.ts.map +1 -0
  198. package/dist/i-contribution-file-validation.js +1 -0
  199. package/dist/i-contributions-report.d.ts +31 -0
  200. package/dist/i-contributions-report.d.ts.map +1 -0
  201. package/dist/i-contributions-report.js +1 -0
  202. package/dist/i-declared-xref-field.d.ts +25 -0
  203. package/dist/i-declared-xref-field.d.ts.map +1 -0
  204. package/dist/i-declared-xref-field.js +1 -0
  205. package/dist/i-declared-xref-issue.d.ts +25 -0
  206. package/dist/i-declared-xref-issue.d.ts.map +1 -0
  207. package/dist/i-declared-xref-issue.js +1 -0
  208. package/dist/i-declared-xref-report.d.ts +48 -0
  209. package/dist/i-declared-xref-report.d.ts.map +1 -0
  210. package/dist/i-declared-xref-report.js +1 -0
  211. package/dist/i-declared-xref-row.d.ts +29 -0
  212. package/dist/i-declared-xref-row.d.ts.map +1 -0
  213. package/dist/i-declared-xref-row.js +1 -0
  214. package/dist/i-doctor-verdict.d.ts +10 -0
  215. package/dist/i-doctor-verdict.d.ts.map +1 -0
  216. package/dist/i-doctor-verdict.js +1 -0
  217. package/dist/i-kind-outcomes.d.ts +13 -0
  218. package/dist/i-kind-outcomes.d.ts.map +1 -0
  219. package/dist/i-kind-outcomes.js +1 -0
  220. package/dist/i-pack-doctor-verdict.d.ts +15 -0
  221. package/dist/i-pack-doctor-verdict.d.ts.map +1 -0
  222. package/dist/i-pack-doctor-verdict.js +1 -0
  223. package/dist/i-probed-id-field.d.ts +17 -0
  224. package/dist/i-probed-id-field.d.ts.map +1 -0
  225. package/dist/i-probed-id-field.js +1 -0
  226. package/dist/i-reference-kind-declaration.d.ts +38 -0
  227. package/dist/i-reference-kind-declaration.d.ts.map +1 -0
  228. package/dist/i-reference-kind-declaration.js +1 -0
  229. package/dist/i-reference-warm-options.d.ts +21 -0
  230. package/dist/i-reference-warm-options.d.ts.map +1 -0
  231. package/dist/i-reference-warm-options.js +1 -0
  232. package/dist/i-registry-outcomes.d.ts +16 -0
  233. package/dist/i-registry-outcomes.d.ts.map +1 -0
  234. package/dist/i-registry-outcomes.js +1 -0
  235. package/dist/i-scaffold-pattern-doctor-report.d.ts +35 -0
  236. package/dist/i-scaffold-pattern-doctor-report.d.ts.map +1 -0
  237. package/dist/i-scaffold-pattern-doctor-report.js +1 -0
  238. package/dist/i-search-tuning-key-probe.d.ts +30 -0
  239. package/dist/i-search-tuning-key-probe.d.ts.map +1 -0
  240. package/dist/i-search-tuning-key-probe.js +1 -0
  241. package/dist/i-search-tuning-lint-issue.d.ts +61 -0
  242. package/dist/i-search-tuning-lint-issue.d.ts.map +1 -0
  243. package/dist/i-search-tuning-lint-issue.js +1 -0
  244. package/dist/i-search-tuning-lint-report.d.ts +38 -0
  245. package/dist/i-search-tuning-lint-report.d.ts.map +1 -0
  246. package/dist/i-search-tuning-lint-report.js +1 -0
  247. package/dist/i-unresolvable-reference-scan.d.ts +14 -0
  248. package/dist/i-unresolvable-reference-scan.d.ts.map +1 -0
  249. package/dist/i-unresolvable-reference-scan.js +1 -0
  250. package/dist/i-unresolvable-reference.d.ts +29 -0
  251. package/dist/i-unresolvable-reference.d.ts.map +1 -0
  252. package/dist/i-unresolvable-reference.js +1 -0
  253. package/dist/i-workspace-profile-payload.d.ts +12 -0
  254. package/dist/i-workspace-profile-payload.d.ts.map +1 -0
  255. package/dist/i-workspace-profile-payload.js +1 -0
  256. package/dist/impact-analysis.d.ts +15 -0
  257. package/dist/impact-analysis.d.ts.map +1 -1
  258. package/dist/impact-analysis.js +58 -13
  259. package/dist/impact-render.d.ts.map +1 -1
  260. package/dist/impact-render.js +22 -0
  261. package/dist/import-hygiene.d.ts +35 -1
  262. package/dist/import-hygiene.d.ts.map +1 -1
  263. package/dist/import-hygiene.js +107 -13
  264. package/dist/index.d.ts +141 -0
  265. package/dist/index.d.ts.map +1 -1
  266. package/dist/index.js +172 -0
  267. package/dist/inspection-discovery.d.ts +45 -0
  268. package/dist/inspection-discovery.d.ts.map +1 -0
  269. package/dist/inspection-discovery.js +70 -0
  270. package/dist/knowledge-advisory-code.d.ts +17 -0
  271. package/dist/knowledge-advisory-code.d.ts.map +1 -0
  272. package/dist/knowledge-advisory-code.js +17 -0
  273. package/dist/knowledge-aged-entry.d.ts +10 -0
  274. package/dist/knowledge-aged-entry.d.ts.map +1 -0
  275. package/dist/knowledge-aged-entry.js +1 -0
  276. package/dist/knowledge-authoring.d.ts +24 -1
  277. package/dist/knowledge-authoring.d.ts.map +1 -1
  278. package/dist/knowledge-authoring.js +46 -7
  279. package/dist/knowledge-entry-verdict-record.d.ts +22 -0
  280. package/dist/knowledge-entry-verdict-record.d.ts.map +1 -0
  281. package/dist/knowledge-entry-verdict-record.js +1 -0
  282. package/dist/knowledge-entry-verdict.d.ts +17 -0
  283. package/dist/knowledge-entry-verdict.d.ts.map +1 -0
  284. package/dist/knowledge-entry-verdict.js +17 -0
  285. package/dist/knowledge-graph.d.ts +6 -0
  286. package/dist/knowledge-graph.d.ts.map +1 -1
  287. package/dist/knowledge-graph.js +18 -7
  288. package/dist/knowledge-kind-bucket.d.ts +19 -0
  289. package/dist/knowledge-kind-bucket.d.ts.map +1 -0
  290. package/dist/knowledge-kind-bucket.js +1 -0
  291. package/dist/knowledge-load-failure.d.ts +23 -0
  292. package/dist/knowledge-load-failure.d.ts.map +1 -0
  293. package/dist/knowledge-load-failure.js +1 -0
  294. package/dist/knowledge-reference-kind-bucket.d.ts +11 -0
  295. package/dist/knowledge-reference-kind-bucket.d.ts.map +1 -0
  296. package/dist/knowledge-reference-kind-bucket.js +1 -0
  297. package/dist/knowledge-stale-advisory.d.ts +14 -0
  298. package/dist/knowledge-stale-advisory.d.ts.map +1 -0
  299. package/dist/knowledge-stale-advisory.js +1 -0
  300. package/dist/knowledge-stale-coverage.d.ts +19 -0
  301. package/dist/knowledge-stale-coverage.d.ts.map +1 -0
  302. package/dist/knowledge-stale-coverage.js +1 -0
  303. package/dist/knowledge-stale-gate-flags.d.ts +33 -0
  304. package/dist/knowledge-stale-gate-flags.d.ts.map +1 -0
  305. package/dist/knowledge-stale-gate-flags.js +1 -0
  306. package/dist/knowledge-stale-gate-input.d.ts +46 -0
  307. package/dist/knowledge-stale-gate-input.d.ts.map +1 -0
  308. package/dist/knowledge-stale-gate-input.js +1 -0
  309. package/dist/knowledge-stale-gate-result.d.ts +33 -0
  310. package/dist/knowledge-stale-gate-result.d.ts.map +1 -0
  311. package/dist/knowledge-stale-gate-result.js +1 -0
  312. package/dist/knowledge-stale-gate-rule.d.ts +33 -0
  313. package/dist/knowledge-stale-gate-rule.d.ts.map +1 -0
  314. package/dist/knowledge-stale-gate-rule.js +1 -0
  315. package/dist/knowledge-stale-gate-violation.d.ts +13 -0
  316. package/dist/knowledge-stale-gate-violation.d.ts.map +1 -0
  317. package/dist/knowledge-stale-gate-violation.js +1 -0
  318. package/dist/knowledge-stale-gate.d.ts +83 -0
  319. package/dist/knowledge-stale-gate.d.ts.map +1 -0
  320. package/dist/knowledge-stale-gate.js +429 -0
  321. package/dist/knowledge-stale-quality-gate.d.ts +26 -0
  322. package/dist/knowledge-stale-quality-gate.d.ts.map +1 -0
  323. package/dist/knowledge-stale-quality-gate.js +110 -0
  324. package/dist/knowledge-stale.d.ts +122 -9
  325. package/dist/knowledge-stale.d.ts.map +1 -1
  326. package/dist/knowledge-stale.js +996 -291
  327. package/dist/knowledge-unverifiable-reason.d.ts +12 -0
  328. package/dist/knowledge-unverifiable-reason.d.ts.map +1 -0
  329. package/dist/knowledge-unverifiable-reason.js +12 -0
  330. package/dist/loader-diagnostics.d.ts +14 -2
  331. package/dist/loader-diagnostics.d.ts.map +1 -1
  332. package/dist/match-terms.d.ts +48 -0
  333. package/dist/match-terms.d.ts.map +1 -0
  334. package/dist/match-terms.js +155 -0
  335. package/dist/migration-profile-registry.d.ts +10 -0
  336. package/dist/migration-profile-registry.d.ts.map +1 -1
  337. package/dist/migration-profile-registry.js +57 -34
  338. package/dist/migration-readiness.d.ts.map +1 -1
  339. package/dist/migration-readiness.js +1 -3
  340. package/dist/nearest-id.d.ts +10 -26
  341. package/dist/nearest-id.d.ts.map +1 -1
  342. package/dist/nearest-id.js +9 -59
  343. package/dist/pack-asset-freshness.d.ts +65 -0
  344. package/dist/pack-asset-freshness.d.ts.map +1 -0
  345. package/dist/pack-asset-freshness.js +340 -0
  346. package/dist/pack-author-ux.d.ts +24 -3
  347. package/dist/pack-author-ux.d.ts.map +1 -1
  348. package/dist/pack-author-ux.js +87 -93
  349. package/dist/pack-contributions-inventory.d.ts +79 -39
  350. package/dist/pack-contributions-inventory.d.ts.map +1 -1
  351. package/dist/pack-contributions-inventory.js +443 -286
  352. package/dist/pack-doctor-verdict.d.ts +29 -0
  353. package/dist/pack-doctor-verdict.d.ts.map +1 -0
  354. package/dist/pack-doctor-verdict.js +45 -0
  355. package/dist/pack-doctor.d.ts +74 -1
  356. package/dist/pack-doctor.d.ts.map +1 -1
  357. package/dist/pack-doctor.js +281 -1
  358. package/dist/pack-helper-plan.d.ts +24 -0
  359. package/dist/pack-helper-plan.d.ts.map +1 -0
  360. package/dist/pack-helper-plan.js +77 -0
  361. package/dist/pack-helper-registry.d.ts +14 -0
  362. package/dist/pack-helper-registry.d.ts.map +1 -1
  363. package/dist/pack-helper-registry.js +76 -37
  364. package/dist/pack-manifest-reader.d.ts +8 -0
  365. package/dist/pack-manifest-reader.d.ts.map +1 -0
  366. package/dist/pack-manifest-reader.js +79 -0
  367. package/dist/pack-release-check.d.ts +14 -1
  368. package/dist/pack-release-check.d.ts.map +1 -1
  369. package/dist/pack-release-check.js +23 -1
  370. package/dist/pack-signature-status.d.ts +18 -6
  371. package/dist/pack-signature-status.d.ts.map +1 -1
  372. package/dist/pack-signature-status.js +59 -105
  373. package/dist/pack-test-runner.d.ts +27 -5
  374. package/dist/pack-test-runner.d.ts.map +1 -1
  375. package/dist/pack-test-runner.js +91 -35
  376. package/dist/pack-typecheck.d.ts +8 -0
  377. package/dist/pack-typecheck.d.ts.map +1 -0
  378. package/dist/pack-typecheck.js +76 -0
  379. package/dist/plan-review.d.ts +2 -0
  380. package/dist/plan-review.d.ts.map +1 -1
  381. package/dist/plan-review.js +17 -5
  382. package/dist/plan-simulation.d.ts.map +1 -1
  383. package/dist/plan-simulation.js +16 -5
  384. package/dist/playbook-load-issue.d.ts +16 -0
  385. package/dist/playbook-load-issue.d.ts.map +1 -0
  386. package/dist/playbook-load-issue.js +1 -0
  387. package/dist/playbook-registry.d.ts +32 -1
  388. package/dist/playbook-registry.d.ts.map +1 -1
  389. package/dist/playbook-registry.js +144 -55
  390. package/dist/policy-declaration.d.ts +18 -0
  391. package/dist/policy-declaration.d.ts.map +1 -0
  392. package/dist/policy-declaration.js +1 -0
  393. package/dist/policy-engine.d.ts +8 -0
  394. package/dist/policy-engine.d.ts.map +1 -1
  395. package/dist/policy-engine.js +26 -9
  396. package/dist/policy-overrides.d.ts.map +1 -1
  397. package/dist/policy-overrides.js +4 -4
  398. package/dist/policy-registry.d.ts +27 -0
  399. package/dist/policy-registry.d.ts.map +1 -1
  400. package/dist/policy-registry.js +87 -20
  401. package/dist/probed-id-fields.d.ts +21 -0
  402. package/dist/probed-id-fields.d.ts.map +1 -0
  403. package/dist/probed-id-fields.js +25 -0
  404. package/dist/probed-id-source.d.ts +11 -0
  405. package/dist/probed-id-source.d.ts.map +1 -0
  406. package/dist/probed-id-source.js +11 -0
  407. package/dist/profile-registry.d.ts +25 -2
  408. package/dist/profile-registry.d.ts.map +1 -1
  409. package/dist/profile-registry.js +59 -6
  410. package/dist/quality-gate-examination.d.ts +15 -0
  411. package/dist/quality-gate-examination.d.ts.map +1 -0
  412. package/dist/quality-gate-examination.js +15 -0
  413. package/dist/quality-gate-row-status.d.ts +19 -0
  414. package/dist/quality-gate-row-status.d.ts.map +1 -0
  415. package/dist/quality-gate-row-status.js +28 -0
  416. package/dist/quality-gate-status.d.ts +16 -0
  417. package/dist/quality-gate-status.d.ts.map +1 -0
  418. package/dist/quality-gate-status.js +16 -0
  419. package/dist/quality-html.d.ts.map +1 -1
  420. package/dist/quality-html.js +14 -3
  421. package/dist/quality-report-coverage.d.ts +26 -0
  422. package/dist/quality-report-coverage.d.ts.map +1 -0
  423. package/dist/quality-report-coverage.js +48 -0
  424. package/dist/quality-report.d.ts +28 -1
  425. package/dist/quality-report.d.ts.map +1 -1
  426. package/dist/quality-report.js +263 -35
  427. package/dist/query-intent-kind.d.ts +18 -0
  428. package/dist/query-intent-kind.d.ts.map +1 -0
  429. package/dist/query-intent-kind.js +18 -0
  430. package/dist/query-intent-result.d.ts +23 -0
  431. package/dist/query-intent-result.d.ts.map +1 -0
  432. package/dist/query-intent-result.js +1 -0
  433. package/dist/query-intent.d.ts +18 -0
  434. package/dist/query-intent.d.ts.map +1 -0
  435. package/dist/query-intent.js +336 -0
  436. package/dist/query-resolver.d.ts +18 -0
  437. package/dist/query-resolver.d.ts.map +1 -1
  438. package/dist/query-resolver.js +7 -4
  439. package/dist/ranked-recommendations.d.ts +36 -0
  440. package/dist/ranked-recommendations.d.ts.map +1 -0
  441. package/dist/ranked-recommendations.js +1 -0
  442. package/dist/ranker-explainability.d.ts.map +1 -1
  443. package/dist/ranker-explainability.js +38 -10
  444. package/dist/recommend-recipe.d.ts +17 -0
  445. package/dist/recommend-recipe.d.ts.map +1 -0
  446. package/dist/recommend-recipe.js +1 -0
  447. package/dist/recommend-recipes.d.ts +9 -0
  448. package/dist/recommend-recipes.d.ts.map +1 -0
  449. package/dist/recommend-recipes.js +106 -0
  450. package/dist/recommendation-candidate.d.ts +30 -0
  451. package/dist/recommendation-candidate.d.ts.map +1 -0
  452. package/dist/recommendation-candidate.js +1 -0
  453. package/dist/recommendation-confidence.d.ts +27 -0
  454. package/dist/recommendation-confidence.d.ts.map +1 -0
  455. package/dist/recommendation-confidence.js +1 -0
  456. package/dist/recommendation-ranking-options.d.ts +24 -0
  457. package/dist/recommendation-ranking-options.d.ts.map +1 -0
  458. package/dist/recommendation-ranking-options.js +1 -0
  459. package/dist/recommendation-ranking.d.ts +50 -0
  460. package/dist/recommendation-ranking.d.ts.map +1 -0
  461. package/dist/recommendation-ranking.js +527 -0
  462. package/dist/recommendation-source.d.ts +23 -0
  463. package/dist/recommendation-source.d.ts.map +1 -0
  464. package/dist/recommendation-source.js +23 -0
  465. package/dist/recommendation-suppression.d.ts +14 -0
  466. package/dist/recommendation-suppression.d.ts.map +1 -0
  467. package/dist/recommendation-suppression.js +14 -0
  468. package/dist/reference-asset-kind.d.ts +14 -0
  469. package/dist/reference-asset-kind.d.ts.map +1 -0
  470. package/dist/reference-asset-kind.js +14 -0
  471. package/dist/reference-content-check.d.ts +32 -0
  472. package/dist/reference-content-check.d.ts.map +1 -0
  473. package/dist/reference-content-check.js +143 -0
  474. package/dist/reference-failure.d.ts +31 -0
  475. package/dist/reference-failure.d.ts.map +1 -0
  476. package/dist/reference-failure.js +31 -0
  477. package/dist/reference-id-status.d.ts +15 -0
  478. package/dist/reference-id-status.d.ts.map +1 -0
  479. package/dist/reference-id-status.js +15 -0
  480. package/dist/reference-kind-declarations.d.ts +42 -0
  481. package/dist/reference-kind-declarations.d.ts.map +1 -0
  482. package/dist/reference-kind-declarations.js +142 -0
  483. package/dist/reference-lookup.d.ts +6 -0
  484. package/dist/reference-lookup.d.ts.map +1 -1
  485. package/dist/reference-lookup.js +13 -5
  486. package/dist/reference-registry.d.ts +109 -11
  487. package/dist/reference-registry.d.ts.map +1 -1
  488. package/dist/reference-registry.js +186 -30
  489. package/dist/reference-subject.d.ts +20 -0
  490. package/dist/reference-subject.d.ts.map +1 -0
  491. package/dist/reference-subject.js +1 -0
  492. package/dist/registration-hint-discovery-status.d.ts +25 -0
  493. package/dist/registration-hint-discovery-status.d.ts.map +1 -0
  494. package/dist/registration-hint-discovery-status.js +25 -0
  495. package/dist/registration-hint-registry.d.ts +80 -0
  496. package/dist/registration-hint-registry.d.ts.map +1 -1
  497. package/dist/registration-hint-registry.js +356 -138
  498. package/dist/registry-lifecycle.d.ts +200 -19
  499. package/dist/registry-lifecycle.d.ts.map +1 -1
  500. package/dist/registry-lifecycle.js +526 -136
  501. package/dist/release-readiness.d.ts.map +1 -1
  502. package/dist/release-readiness.js +10 -7
  503. package/dist/release-smoke.d.ts.map +1 -1
  504. package/dist/release-smoke.js +11 -7
  505. package/dist/report-site.d.ts.map +1 -1
  506. package/dist/report-site.js +25 -7
  507. package/dist/repository-intelligence.d.ts.map +1 -1
  508. package/dist/repository-intelligence.js +3 -2
  509. package/dist/repository-knowledge-model.d.ts.map +1 -1
  510. package/dist/repository-knowledge-model.js +18 -5
  511. package/dist/resolve-project-config.d.ts +64 -0
  512. package/dist/resolve-project-config.d.ts.map +1 -1
  513. package/dist/resolve-project-config.js +240 -32
  514. package/dist/reuse/compute-reuse-coverage.d.ts +29 -0
  515. package/dist/reuse/compute-reuse-coverage.d.ts.map +1 -0
  516. package/dist/reuse/compute-reuse-coverage.js +198 -0
  517. package/dist/reuse/rank-reuse-candidates.d.ts +38 -0
  518. package/dist/reuse/rank-reuse-candidates.d.ts.map +1 -0
  519. package/dist/reuse/rank-reuse-candidates.js +212 -0
  520. package/dist/reuse/rank-reuse-options.d.ts +20 -0
  521. package/dist/reuse/rank-reuse-options.d.ts.map +1 -0
  522. package/dist/reuse/rank-reuse-options.js +1 -0
  523. package/dist/reuse/rank-reuse-suggestions.d.ts +15 -0
  524. package/dist/reuse/rank-reuse-suggestions.d.ts.map +1 -0
  525. package/dist/reuse/rank-reuse-suggestions.js +31 -0
  526. package/dist/reuse/resolve-curated-reuse.d.ts +43 -0
  527. package/dist/reuse/resolve-curated-reuse.d.ts.map +1 -0
  528. package/dist/reuse/resolve-curated-reuse.js +115 -0
  529. package/dist/reuse/reuse-candidate.d.ts +29 -0
  530. package/dist/reuse/reuse-candidate.d.ts.map +1 -0
  531. package/dist/reuse/reuse-candidate.js +1 -0
  532. package/dist/reuse/reuse-coverage-report.d.ts +74 -0
  533. package/dist/reuse/reuse-coverage-report.d.ts.map +1 -0
  534. package/dist/reuse/reuse-coverage-report.js +1 -0
  535. package/dist/reuse/reuse-curated-coverage.d.ts +36 -0
  536. package/dist/reuse/reuse-curated-coverage.d.ts.map +1 -0
  537. package/dist/reuse/reuse-curated-coverage.js +1 -0
  538. package/dist/reuse/reuse-curated-resolution.d.ts +36 -0
  539. package/dist/reuse/reuse-curated-resolution.d.ts.map +1 -0
  540. package/dist/reuse/reuse-curated-resolution.js +1 -0
  541. package/dist/reuse/reuse-curated-status.d.ts +21 -0
  542. package/dist/reuse/reuse-curated-status.d.ts.map +1 -0
  543. package/dist/reuse/reuse-curated-status.js +21 -0
  544. package/dist/reuse/reuse-match-detail.d.ts +15 -0
  545. package/dist/reuse/reuse-match-detail.d.ts.map +1 -0
  546. package/dist/reuse/reuse-match-detail.js +1 -0
  547. package/dist/reuse/reuse-ranking.d.ts +37 -0
  548. package/dist/reuse/reuse-ranking.d.ts.map +1 -0
  549. package/dist/reuse/reuse-ranking.js +1 -0
  550. package/dist/reuse/reuse-suggestion.d.ts +19 -0
  551. package/dist/reuse/reuse-suggestion.d.ts.map +1 -0
  552. package/dist/reuse/reuse-suggestion.js +1 -0
  553. package/dist/reuse/reuse-symbol-lookup.d.ts +28 -0
  554. package/dist/reuse/reuse-symbol-lookup.d.ts.map +1 -0
  555. package/dist/reuse/reuse-symbol-lookup.js +1 -0
  556. package/dist/reuse/reuse-tokenize.d.ts +11 -0
  557. package/dist/reuse/reuse-tokenize.d.ts.map +1 -0
  558. package/dist/reuse/reuse-tokenize.js +26 -0
  559. package/dist/reuse/score-reuse-name.d.ts +16 -0
  560. package/dist/reuse/score-reuse-name.d.ts.map +1 -0
  561. package/dist/reuse/score-reuse-name.js +35 -0
  562. package/dist/reuse/score-reuse-primitive.d.ts +33 -0
  563. package/dist/reuse/score-reuse-primitive.d.ts.map +1 -0
  564. package/dist/reuse/score-reuse-primitive.js +92 -0
  565. package/dist/review-packet.d.ts +2 -0
  566. package/dist/review-packet.d.ts.map +1 -1
  567. package/dist/review-packet.js +13 -6
  568. package/dist/role-views.d.ts.map +1 -1
  569. package/dist/role-views.js +16 -16
  570. package/dist/routing-recommends-channels.d.ts +24 -0
  571. package/dist/routing-recommends-channels.d.ts.map +1 -0
  572. package/dist/routing-recommends-channels.js +19 -0
  573. package/dist/run-boundary-check.d.ts +118 -0
  574. package/dist/run-boundary-check.d.ts.map +1 -0
  575. package/dist/run-boundary-check.js +592 -0
  576. package/dist/safety-audit.js +1 -1
  577. package/dist/scaffold-coverage.js +1 -1
  578. package/dist/scaffold-pattern-doctor-report.d.ts +19 -0
  579. package/dist/scaffold-pattern-doctor-report.d.ts.map +1 -0
  580. package/dist/scaffold-pattern-doctor-report.js +54 -0
  581. package/dist/scaffold-patterns.d.ts +75 -1
  582. package/dist/scaffold-patterns.d.ts.map +1 -1
  583. package/dist/scaffold-patterns.js +375 -84
  584. package/dist/schema-inventory.d.ts.map +1 -1
  585. package/dist/schema-inventory.js +4 -3
  586. package/dist/search-document-id.d.ts +52 -0
  587. package/dist/search-document-id.d.ts.map +1 -0
  588. package/dist/search-document-id.js +72 -0
  589. package/dist/search-document-prefix.d.ts +7 -0
  590. package/dist/search-document-prefix.d.ts.map +1 -0
  591. package/dist/search-document-prefix.js +1 -0
  592. package/dist/search-index.d.ts.map +1 -1
  593. package/dist/search-index.js +20 -23
  594. package/dist/search-tuning-explain.d.ts +6 -0
  595. package/dist/search-tuning-explain.d.ts.map +1 -1
  596. package/dist/search-tuning-explain.js +19 -17
  597. package/dist/search-tuning-key-probes.d.ts +16 -0
  598. package/dist/search-tuning-key-probes.d.ts.map +1 -0
  599. package/dist/search-tuning-key-probes.js +65 -0
  600. package/dist/search-tuning-key-resolution.d.ts +25 -0
  601. package/dist/search-tuning-key-resolution.d.ts.map +1 -0
  602. package/dist/search-tuning-key-resolution.js +1 -0
  603. package/dist/search-tuning-key-resolver.d.ts +4 -0
  604. package/dist/search-tuning-key-resolver.d.ts.map +1 -0
  605. package/dist/search-tuning-key-resolver.js +107 -0
  606. package/dist/search-tuning-key-status.d.ts +24 -0
  607. package/dist/search-tuning-key-status.d.ts.map +1 -0
  608. package/dist/search-tuning-key-status.js +24 -0
  609. package/dist/search-tuning-lint.d.ts +9 -0
  610. package/dist/search-tuning-lint.d.ts.map +1 -0
  611. package/dist/search-tuning-lint.js +468 -0
  612. package/dist/search-tuning-registry.d.ts +43 -0
  613. package/dist/search-tuning-registry.d.ts.map +1 -1
  614. package/dist/search-tuning-registry.js +214 -49
  615. package/dist/self-audit.d.ts +12 -0
  616. package/dist/self-audit.d.ts.map +1 -1
  617. package/dist/self-audit.js +36 -10
  618. package/dist/self-config-doctor-v2.d.ts +145 -3
  619. package/dist/self-config-doctor-v2.d.ts.map +1 -1
  620. package/dist/self-config-doctor-v2.js +1304 -181
  621. package/dist/self-config-doctor.d.ts +20 -1
  622. package/dist/self-config-doctor.d.ts.map +1 -1
  623. package/dist/self-config-doctor.js +53 -280
  624. package/dist/settled-unit-states.d.ts +9 -0
  625. package/dist/settled-unit-states.d.ts.map +1 -0
  626. package/dist/settled-unit-states.js +14 -0
  627. package/dist/sharkcraft-inspector.d.ts +34 -0
  628. package/dist/sharkcraft-inspector.d.ts.map +1 -1
  629. package/dist/sharkcraft-inspector.js +273 -26
  630. package/dist/spec/spec-evidence.d.ts.map +1 -1
  631. package/dist/spec/spec-evidence.js +14 -20
  632. package/dist/split-identifier.d.ts +21 -0
  633. package/dist/split-identifier.d.ts.map +1 -0
  634. package/dist/split-identifier.js +27 -0
  635. package/dist/start-here.d.ts.map +1 -1
  636. package/dist/start-here.js +1 -2
  637. package/dist/substitute-placeholders.d.ts +8 -0
  638. package/dist/substitute-placeholders.d.ts.map +1 -0
  639. package/dist/substitute-placeholders.js +9 -0
  640. package/dist/symbol-index.d.ts +33 -0
  641. package/dist/symbol-index.d.ts.map +1 -1
  642. package/dist/symbol-index.js +241 -3
  643. package/dist/symbol-member-entry.d.ts +26 -0
  644. package/dist/symbol-member-entry.d.ts.map +1 -0
  645. package/dist/symbol-member-entry.js +1 -0
  646. package/dist/symbol-member-kind.d.ts +14 -0
  647. package/dist/symbol-member-kind.d.ts.map +1 -0
  648. package/dist/symbol-member-kind.js +14 -0
  649. package/dist/task-packet.d.ts.map +1 -1
  650. package/dist/task-packet.js +52 -9
  651. package/dist/task-ranker.d.ts +8 -0
  652. package/dist/task-ranker.d.ts.map +1 -1
  653. package/dist/task-ranker.js +25 -13
  654. package/dist/task-risk.js +1 -1
  655. package/dist/task-routing-hint-registry.d.ts +20 -1
  656. package/dist/task-routing-hint-registry.d.ts.map +1 -1
  657. package/dist/task-routing-hint-registry.js +186 -42
  658. package/dist/template-drift.d.ts.map +1 -1
  659. package/dist/template-drift.js +30 -9
  660. package/dist/template-lint.d.ts.map +1 -1
  661. package/dist/template-lint.js +160 -2
  662. package/dist/term-query.d.ts +10 -0
  663. package/dist/term-query.d.ts.map +1 -0
  664. package/dist/term-query.js +1 -0
  665. package/dist/test-definitions.d.ts +6 -3
  666. package/dist/test-definitions.d.ts.map +1 -1
  667. package/dist/test-runner.d.ts +95 -10
  668. package/dist/test-runner.d.ts.map +1 -1
  669. package/dist/test-runner.js +309 -308
  670. package/dist/tuning-query-tokens.d.ts +29 -0
  671. package/dist/tuning-query-tokens.d.ts.map +1 -0
  672. package/dist/tuning-query-tokens.js +51 -0
  673. package/dist/typecheck-files.d.ts +36 -0
  674. package/dist/typecheck-files.d.ts.map +1 -0
  675. package/dist/typecheck-files.js +158 -0
  676. package/dist/uncertainty.js +1 -1
  677. package/dist/universal-search.d.ts.map +1 -1
  678. package/dist/universal-search.js +5 -3
  679. package/dist/unregistered-exports.d.ts +19 -0
  680. package/dist/unregistered-exports.d.ts.map +1 -0
  681. package/dist/unregistered-exports.js +141 -0
  682. package/dist/unresolvable-reason.d.ts +11 -0
  683. package/dist/unresolvable-reason.d.ts.map +1 -0
  684. package/dist/unresolvable-reason.js +11 -0
  685. package/dist/upgrade-advisor.d.ts.map +1 -1
  686. package/dist/upgrade-advisor.js +16 -9
  687. package/dist/validate-contribution-file.d.ts +4 -0
  688. package/dist/validate-contribution-file.d.ts.map +1 -0
  689. package/dist/validate-contribution-file.js +228 -0
  690. package/dist/why-file.d.ts +3 -0
  691. package/dist/why-file.d.ts.map +1 -1
  692. package/dist/why-file.js +7 -3
  693. package/package.json +17 -17
@@ -1,64 +1,142 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import * as nodePath from 'node:path';
3
3
  import { buildContext } from '@shrkcrft/context';
4
- import { listConstructs } from "./construct-registry.js";
5
- import { listPolicyIds } from "./policy-registry.js";
6
- import { listPlaybooks } from "./playbook-registry.js";
7
4
  import { buildTaskPacket } from "./task-packet.js";
8
5
  import { rankKnowledgeEntries } from "./task-ranker.js";
9
6
  import { contextTuningBoostFor } from "./context-tuning.js";
10
7
  import { buildProjectOverview, renderOverviewText } from "./project-overview.js";
11
- import { HELPERS } from "./helper-registry.js";
12
- import { importModuleViaLoader } from '@shrkcrft/core';
8
+ import { importModuleViaLoader, RejectionCause } from '@shrkcrft/core';
9
+ import { CommandResolutionStatus } from "./command-resolution-status.js";
10
+ import { COMMAND_INDEX_NOT_INJECTED, isCacheBackedKind, isCommandResolved, isReferenceCacheWarm, referenceIdExists, referenceIdsFor, resolveShrkCommandReference, warmReferenceRegistries, } from "./reference-registry.js";
11
+ /** The `list` verb that prints each registry — named in every diagnostic. */
12
+ const LIST_VERBS = Object.freeze({
13
+ template: 'shrk templates list',
14
+ rule: 'shrk rules list',
15
+ pipeline: 'shrk pipelines list',
16
+ helper: 'shrk helper list',
17
+ playbook: 'shrk playbooks list',
18
+ policy: 'shrk policy list',
19
+ construct: 'shrk constructs list',
20
+ knowledge: 'shrk knowledge list',
21
+ command: 'shrk surface list',
22
+ });
23
+ function consulted(inspection, kind) {
24
+ return {
25
+ kind,
26
+ listVerb: LIST_VERBS[kind] ?? `shrk ${kind} list`,
27
+ size: kind === 'command' ? 0 : referenceIdsFor(inspection, kind).length,
28
+ };
29
+ }
30
+ /**
31
+ * THE existence answer for a test expectation — the shared reference registry,
32
+ * never a private set. A cache-backed kind read before the registries were
33
+ * warmed is `unverifiable`, not "your correct id does not exist".
34
+ */
35
+ function existence(inspection, kind, id) {
36
+ if (referenceIdExists(inspection, kind, id))
37
+ return 'exists';
38
+ if (isCacheBackedKind(kind) && !isReferenceCacheWarm(inspection))
39
+ return 'unverifiable';
40
+ return 'missing';
41
+ }
42
+ /** A test file's default array; `error` (first line) when the import threw. A missing file is `[]`. */
13
43
  async function importDefaultArray(absPath) {
14
44
  if (!existsSync(absPath))
15
- return [];
45
+ return { items: [] };
16
46
  try {
17
47
  const mod = (await importModuleViaLoader(absPath));
18
- return Array.isArray(mod.default) ? mod.default : [];
48
+ return { items: Array.isArray(mod.default) ? mod.default : [] };
19
49
  }
20
- catch {
21
- return [];
50
+ catch (e) {
51
+ return { items: [], error: (e.message ?? String(e)).split('\n')[0].trim() };
22
52
  }
23
53
  }
24
54
  /**
25
- * Load context tests from local sharkcraft config + any pack contributions.
55
+ * THE context / agent-contract test acceptance predicate (round 12, 12.1): a
56
+ * non-empty string `id` and a string `task` — `[]` means accepted. Tests used
57
+ * to load with no per-entry validation (a test without a `task` ran against
58
+ * `undefined`), and a file that failed to import became `[]` in silence.
26
59
  */
27
- export async function loadContextTests(inspection) {
60
+ export function testDefinitionRejectionReasons(raw) {
61
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw))
62
+ return ['(entry): must be an object'];
63
+ const t = raw;
64
+ const out = [];
65
+ if (typeof t.id !== 'string' || t.id.length === 0)
66
+ out.push('id: must be a non-empty string');
67
+ if (typeof t.task !== 'string')
68
+ out.push('task: must be a string');
69
+ return out;
70
+ }
71
+ async function loadTestDefinitions(inspection, localName, slot) {
28
72
  const tests = [];
73
+ const entries = [];
74
+ const issues = [];
75
+ const rejected = [];
76
+ const readInto = async (file, packageName) => {
77
+ const r = await importDefaultArray(file);
78
+ const rel = nodePath.relative(inspection.projectRoot, file) || file;
79
+ if (r.error !== undefined) {
80
+ issues.push({
81
+ severity: 'warning',
82
+ code: 'load-failed',
83
+ message: `${packageName ? `Pack ${packageName} (${rel})` : `Failed to load ${rel}`}: ${r.error}`,
84
+ source: file,
85
+ ...(packageName ? { packageName } : {}),
86
+ });
87
+ return;
88
+ }
89
+ r.items.forEach((item, index) => {
90
+ const reasons = testDefinitionRejectionReasons(item);
91
+ if (reasons.length > 0) {
92
+ const id = item && typeof item === 'object' ? item.id : undefined;
93
+ rejected.push({
94
+ file,
95
+ index,
96
+ exportName: 'default',
97
+ ...(typeof id === 'string' && id.length > 0 ? { entryId: id } : {}),
98
+ reasons,
99
+ cause: RejectionCause.Invalid,
100
+ });
101
+ return;
102
+ }
103
+ tests.push(item);
104
+ entries.push({ id: item.id, file, ...(packageName ? { packageName } : {}) });
105
+ });
106
+ };
29
107
  // Local config file.
30
108
  if (inspection.sharkcraftDir) {
31
- const local = nodePath.join(inspection.sharkcraftDir, 'context-tests.ts');
32
- if (existsSync(local)) {
33
- tests.push(...(await importDefaultArray(local)));
34
- }
109
+ const local = nodePath.join(inspection.sharkcraftDir, localName);
110
+ if (existsSync(local))
111
+ await readInto(local);
35
112
  }
36
113
  // Pack contributions.
37
114
  for (const pack of inspection.packs.validPacks) {
38
115
  const c = pack.manifest.contributions;
39
- for (const rel of c.contextTestFiles ?? []) {
40
- const full = nodePath.resolve(pack.packageRoot, rel);
41
- tests.push(...(await importDefaultArray(full)));
42
- }
116
+ for (const rel of c[slot] ?? [])
117
+ await readInto(nodePath.resolve(pack.packageRoot, rel), pack.packageName);
43
118
  }
44
- return tests;
119
+ return { tests, entries, issues, rejected };
120
+ }
121
+ /**
122
+ * Context tests WITH what did not take effect (round 12, 12.1): files that
123
+ * failed to import and every declared test the loader refused.
124
+ */
125
+ export async function loadContextTestsWithIssues(inspection) {
126
+ return loadTestDefinitions(inspection, 'context-tests.ts', 'contextTestFiles');
127
+ }
128
+ /** Agent-contract tests WITH what did not take effect (round 12, 12.1). */
129
+ export async function loadAgentContractTestsWithIssues(inspection) {
130
+ return loadTestDefinitions(inspection, 'agent-tests.ts', 'agentTestFiles');
131
+ }
132
+ /**
133
+ * Load context tests from local sharkcraft config + any pack contributions.
134
+ */
135
+ export async function loadContextTests(inspection) {
136
+ return [...(await loadContextTestsWithIssues(inspection)).tests];
45
137
  }
46
138
  export async function loadAgentContractTests(inspection) {
47
- const tests = [];
48
- if (inspection.sharkcraftDir) {
49
- const local = nodePath.join(inspection.sharkcraftDir, 'agent-tests.ts');
50
- if (existsSync(local)) {
51
- tests.push(...(await importDefaultArray(local)));
52
- }
53
- }
54
- for (const pack of inspection.packs.validPacks) {
55
- const c = pack.manifest.contributions;
56
- for (const rel of c.agentTestFiles ?? []) {
57
- const full = nodePath.resolve(pack.packageRoot, rel);
58
- tests.push(...(await importDefaultArray(full)));
59
- }
60
- }
61
- return tests;
139
+ return [...(await loadAgentContractTestsWithIssues(inspection)).tests];
62
140
  }
63
141
  export function runContextTest(inspection, test) {
64
142
  const overview = buildProjectOverview(inspection.workspace, inspection.config?.projectName);
@@ -91,29 +169,33 @@ export function runContextTest(inspection, test) {
91
169
  // Diagnostics: only populate on failure. Show the top-ranked alternatives
92
170
  // the ranker chose for the task, so the test author can see what beat the
93
171
  // expected entry — and tighten the rule's appliesWhen/tags accordingly.
172
+ // `mustInclude` is a RANKER-SURFACED assertion; whether the id exists at all
173
+ // is answered by the shared registry, the set `shrk knowledge list` prints.
94
174
  let diagnostics;
95
175
  if (!passed) {
96
176
  const ranked = rankKnowledgeEntries(inspection.knowledgeEntries, test.task);
177
+ const knowledgeRegistry = consulted(inspection, 'knowledge');
97
178
  diagnostics = [];
98
179
  for (const id of missingInclude) {
99
- const exists = inspection.knowledgeEntries.some((e) => e.id === id);
180
+ const exists = referenceIdExists(inspection, 'knowledge', id);
100
181
  diagnostics.push({
101
182
  id,
102
183
  existsInRegistry: exists,
184
+ consulted: knowledgeRegistry,
103
185
  topAlternatives: ranked.slice(0, 5).map((r) => ({
104
186
  id: r.item.id,
105
187
  score: r.score,
106
188
  reasons: r.reasons,
107
189
  })),
108
- suggestions: buildMissingIncludeSuggestions(id, exists, test.task),
190
+ suggestions: buildMissingIncludeSuggestions(id, exists, test.task, knowledgeRegistry),
109
191
  });
110
192
  }
111
193
  for (const id of unexpectedInclude) {
112
- const entry = inspection.knowledgeEntries.find((e) => e.id === id);
113
194
  const reasons = ranked.find((r) => r.item.id === id)?.reasons ?? [];
114
195
  diagnostics.push({
115
196
  id,
116
- existsInRegistry: !!entry,
197
+ existsInRegistry: referenceIdExists(inspection, 'knowledge', id),
198
+ consulted: knowledgeRegistry,
117
199
  topAlternatives: reasons.length
118
200
  ? [{ id, score: ranked.find((r) => r.item.id === id)?.score ?? 0, reasons }]
119
201
  : undefined,
@@ -141,10 +223,10 @@ export function runContextTest(inspection, test) {
141
223
  result.diagnostics = diagnostics;
142
224
  return result;
143
225
  }
144
- function buildMissingIncludeSuggestions(id, existsInRegistry, task) {
226
+ function buildMissingIncludeSuggestions(id, existsInRegistry, task, registry) {
145
227
  if (!existsInRegistry) {
146
228
  return [
147
- `Entry "${id}" does not exist in the inspection — either install the pack that ships it or correct the id.`,
229
+ `Entry "${id}" is not in the knowledge registry (the ${registry.size} ids \`${registry.listVerb}\` prints) — this expectation can never pass. Install the pack that ships it or correct the id.`,
148
230
  `If the test expectation is wrong, update sharkcraft/context-tests.ts.`,
149
231
  ];
150
232
  }
@@ -156,38 +238,91 @@ function buildMissingIncludeSuggestions(id, existsInRegistry, task) {
156
238
  `Or raise its priority / shorten the title to include task-relevant tokens.`,
157
239
  ];
158
240
  }
159
- export function runAgentContractTest(inspection, test, registries) {
241
+ export function runAgentContractTest(inspection, test,
242
+ /** @deprecated Ignored — existence resolves through the shared reference registry. */
243
+ _registries) {
160
244
  // Self-tests assert specific rules/templates appear for a task — they
161
245
  // test semantics, not packet size. Opt out of the compact cap so the
162
246
  // assertions see the full ranking.
163
247
  const packet = buildTaskPacket(inspection, test.task, { maxTokens: 3500, compact: false });
164
248
  const actualPipelines = packet.recommendedPipelines.map((p) => p.pipelineId);
249
+ // ── Ranker-SURFACED expectations (order-sensitive) ─────────────────────
165
250
  const missingTemplates = (test.expectedTemplates ?? []).filter((id) => !packet.relevantTemplates.some((t) => t.id === id));
166
251
  const missingRules = (test.expectedRules ?? []).filter((id) => !packet.relevantRules.some((r) => r.id === id));
167
252
  const missingForbidden = (test.expectedForbiddenActions ?? []).filter((a) => !packet.forbiddenActions.includes(a));
168
253
  const missingVerification = (test.expectedVerificationCommands ?? []).filter((c) => !packet.verificationCommands.includes(c));
169
- // New expectation checks. Each one fails when the asset is missing
170
- // from the relevant registry (drift detection) or — for commands — also
171
- // not surfaced in the packet's recommended set.
172
- const helperRegistry = registries?.helpers ?? loadHelperRegistryQuietly();
173
- const playbookList = registries?.playbooks ?? listPlaybookIdsQuietly(inspection);
174
- const policyChecks = registries?.policies ?? listPolicyIdsQuietly(inspection);
175
- const constructList = registries?.constructs ?? listConstructIdsQuietly(inspection);
176
- const commandCatalog = registries?.commands ?? listCommandIdsQuietly(inspection);
177
- const knowledgeIds = registries?.knowledge ?? new Set(inspection.knowledgeEntries.map((e) => e.id));
178
- const missingHelpers = (test.expectedHelpers ?? []).filter((id) => !helperRegistry.has(id));
179
- const missingPlaybooks = (test.expectedPlaybooks ?? []).filter((id) => !playbookList.has(id));
180
- const missingPolicies = (test.expectedPolicies ?? []).filter((id) => !policyChecks.has(id));
181
- const missingConstructs = (test.expectedConstructs ?? []).filter((id) => !constructList.has(id));
182
- const missingCommands = (test.expectedCommands ?? []).filter((id) => {
183
- if (packet.recommendedCliCommands.includes(id))
184
- return false;
185
- // Accept either the catalog id form ("dev start") or the bare
186
- // first token ("dev"). The catalog uses dotted ids that map to the
187
- // command shape; we accept either form.
188
- return !commandCatalog.has(id) && !commandCatalog.has(id.split(' ')[0]);
189
- });
190
- const missingKnowledge = (test.expectedKnowledge ?? []).filter((id) => !knowledgeIds.has(id));
254
+ // ── Registry-EXISTENCE expectations (stable) ───────────────────────────
255
+ // One authority: the shared reference registry. The runner used to keep a
256
+ // parallel resolver (a `*Quietly` helper per kind) whose helper set missed
257
+ // pack helpers, and whose command set read a property no inspection has —
258
+ // so every correct `expectedCommands` entry failed.
259
+ const unverified = [];
260
+ const unverifiedIds = new Set();
261
+ const existsCheck = (kind, ids) => {
262
+ const missing = [];
263
+ for (const id of ids ?? []) {
264
+ const status = existence(inspection, kind, id);
265
+ if (status === 'exists')
266
+ continue;
267
+ missing.push(id);
268
+ if (status === 'unverifiable') {
269
+ unverified.push(`${kind}:${id}`);
270
+ unverifiedIds.add(`${kind}:${id}`);
271
+ }
272
+ }
273
+ return missing;
274
+ };
275
+ const missingHelpers = existsCheck('helper', test.expectedHelpers);
276
+ const missingPlaybooks = existsCheck('playbook', test.expectedPlaybooks);
277
+ const missingPolicies = existsCheck('policy', test.expectedPolicies);
278
+ const missingConstructs = existsCheck('construct', test.expectedConstructs);
279
+ const missingKnowledge = existsCheck('knowledge', test.expectedKnowledge);
280
+ // ── Commands: surfaced by the packet, OR a command that really resolves ─
281
+ const missingCommands = [];
282
+ const commandDiagnostics = [];
283
+ for (const cmd of test.expectedCommands ?? []) {
284
+ if (packet.recommendedCliCommands.includes(cmd))
285
+ continue;
286
+ // A command REFERENCE: the bare catalog form (`dev start`) is read as
287
+ // `shrk dev start` by the one resolver — no private normalisation here.
288
+ const resolution = resolveShrkCommandReference(inspection, cmd);
289
+ if (resolution.status === CommandResolutionStatus.Unverified) {
290
+ missingCommands.push(cmd);
291
+ unverified.push(`command:${cmd}`);
292
+ unverifiedIds.add(`command:${cmd}`);
293
+ commandDiagnostics.push({
294
+ id: cmd,
295
+ kind: 'command',
296
+ existsInRegistry: false,
297
+ assertion: 'exists',
298
+ code: 'unverifiable',
299
+ consulted: consulted(inspection, 'command'),
300
+ suggestions: [
301
+ `Command "${cmd}" was not surfaced for "${test.task}", and it could not be resolved: ${COMMAND_INDEX_NOT_INJECTED}.`,
302
+ 'Run the test through the CLI (`shrk test agent`), which injects the live command index.',
303
+ ],
304
+ });
305
+ continue;
306
+ }
307
+ if (isCommandResolved(resolution))
308
+ continue;
309
+ missingCommands.push(cmd);
310
+ commandDiagnostics.push({
311
+ id: cmd,
312
+ kind: 'command',
313
+ existsInRegistry: false,
314
+ assertion: 'exists',
315
+ code: 'unknown-command',
316
+ consulted: consulted(inspection, 'command'),
317
+ ...(resolution.closest && resolution.closest.length > 0 ? { closest: resolution.closest } : {}),
318
+ suggestions: [
319
+ `Command "${cmd}" does not resolve (${resolution.status}${resolution.reason ? ` — ${resolution.reason}` : ''}) — this expectation can never pass.`,
320
+ resolution.closest && resolution.closest.length > 0
321
+ ? `Did you mean \`${resolution.closest[0]}\`?`
322
+ : 'Run `shrk surface list` for every real command.',
323
+ ],
324
+ });
325
+ }
191
326
  // mustNotInclude — fail if any of these ids ended up surfaced in the packet.
192
327
  const surfacedIds = new Set();
193
328
  for (const t of packet.relevantTemplates)
@@ -202,77 +337,82 @@ export function runAgentContractTest(inspection, test, registries) {
202
337
  surfacedIds.add(p.preset.id);
203
338
  const unexpectedlyIncluded = (test.mustNotInclude ?? []).filter((id) => surfacedIds.has(id));
204
339
  const pipelineOk = !test.expectedPipeline || actualPipelines.includes(test.expectedPipeline);
205
- const passed = pipelineOk &&
206
- missingTemplates.length === 0 &&
207
- missingRules.length === 0 &&
208
- missingForbidden.length === 0 &&
209
- missingVerification.length === 0 &&
210
- missingHelpers.length === 0 &&
211
- missingPlaybooks.length === 0 &&
212
- missingPolicies.length === 0 &&
213
- missingConstructs.length === 0 &&
214
- missingCommands.length === 0 &&
215
- missingKnowledge.length === 0 &&
216
- unexpectedlyIncluded.length === 0;
217
- // Diagnostics on failure: per missing id, explain whether the entry
218
- // exists in the registry and how to make it surface.
340
+ const failing = (pipelineOk ? 0 : 1) +
341
+ missingTemplates.length +
342
+ missingRules.length +
343
+ missingForbidden.length +
344
+ missingVerification.length +
345
+ missingHelpers.length +
346
+ missingPlaybooks.length +
347
+ missingPolicies.length +
348
+ missingConstructs.length +
349
+ missingCommands.length +
350
+ missingKnowledge.length +
351
+ unexpectedlyIncluded.length;
352
+ const passed = failing === 0;
353
+ const verdict = passed
354
+ ? 'pass'
355
+ : failing === unverified.length
356
+ ? 'not-verified'
357
+ : 'fail';
358
+ // Diagnostics on failure: per missing id, whether it exists, WHICH registry
359
+ // said so, and how to make it surface.
219
360
  let diagnostics;
220
361
  if (!passed) {
221
362
  diagnostics = [];
222
- for (const id of missingTemplates) {
223
- const exists = inspection.templates.some((t) => t.id === id);
224
- diagnostics.push({
363
+ const surfacedDiagnostic = (kind, id, whenExists) => {
364
+ const exists = referenceIdExists(inspection, kind, id);
365
+ const registry = consulted(inspection, kind);
366
+ const label = kind[0].toUpperCase() + kind.slice(1);
367
+ return {
225
368
  id,
226
- kind: 'template',
369
+ kind,
227
370
  existsInRegistry: exists,
371
+ assertion: 'surfaced',
372
+ code: exists ? 'not-surfaced' : 'unknown-id',
373
+ consulted: registry,
228
374
  suggestions: exists
229
- ? [
230
- `Template "${id}" exists but the ranker did not place it in the top results.`,
231
- 'Add task-aligned tags/appliesWhen to the template (e.g. tags:["service"], appliesWhen:["generate-service"]).',
232
- 'Reference the template from a preset that matches the task profile (includes.templateIds).',
233
- 'Reference it from a pipeline step (`step.references`).',
234
- ]
375
+ ? whenExists
235
376
  : [
236
- `Template "${id}" does not exist — install the pack that ships it or correct the id.`,
377
+ `${label} "${id}" is not registered — it is not among the ${registry.size} ids \`${registry.listVerb}\` prints, so this expectation can never pass.`,
378
+ 'Install the pack that ships it or correct the id.',
237
379
  ],
238
- });
380
+ };
381
+ };
382
+ for (const id of missingTemplates) {
383
+ diagnostics.push(surfacedDiagnostic('template', id, [
384
+ `Template "${id}" exists but the ranker did not place it in the top results.`,
385
+ 'Add task-aligned tags/appliesWhen to the template (e.g. tags:["service"], appliesWhen:["generate-service"]).',
386
+ 'Reference the template from a preset that matches the task profile (includes.templateIds).',
387
+ 'Reference it from a pipeline step (`step.references`).',
388
+ ]));
239
389
  }
240
390
  for (const id of missingRules) {
241
- const exists = inspection.knowledgeEntries.some((e) => e.id === id);
242
- diagnostics.push({
243
- id,
244
- kind: 'rule',
245
- existsInRegistry: exists,
246
- suggestions: exists
247
- ? [
248
- `Rule "${id}" exists but the ranker did not surface it for "${test.task}".`,
249
- 'Align its appliesWhen with the domain (e.g. generate-service / generate-utility / create-pipeline).',
250
- 'Add domain tags (service / utility / route / pipeline).',
251
- 'Reference it from actionHints.relatedTemplates on a rule that *is* ranking, or include it in a preset.',
252
- ]
253
- : [
254
- `Rule "${id}" does not exist — install the pack that ships it or correct the id.`,
255
- ],
256
- });
391
+ // The RULE registry (what `shrk rules list` prints) — it used to be the
392
+ // knowledge entries, so a knowledge-but-not-rule id was told "exists but
393
+ // not surfaced", a permanently red test with a false hint.
394
+ diagnostics.push(surfacedDiagnostic('rule', id, [
395
+ `Rule "${id}" exists but the ranker did not surface it for "${test.task}".`,
396
+ 'Align its appliesWhen with the domain (e.g. generate-service / generate-utility / create-pipeline).',
397
+ 'Add domain tags (service / utility / route / pipeline).',
398
+ 'Reference it from actionHints.relatedTemplates on a rule that *is* ranking, or include it in a preset.',
399
+ ]));
257
400
  }
258
401
  if (!pipelineOk && test.expectedPipeline) {
259
- diagnostics.push({
260
- id: test.expectedPipeline,
261
- kind: 'pipeline',
262
- existsInRegistry: inspection.pipelines.some((p) => p.id === test.expectedPipeline),
263
- suggestions: [
264
- `Pipeline "${test.expectedPipeline}" did not rank in the top 3 for "${test.task}".`,
265
- 'Add domain-aligned tags to the pipeline (tags:["plugin"], …).',
266
- 'Add task tokens to its title / description so the ranker catches them.',
267
- 'Reference the pipeline from a preset that the task profile recommends.',
268
- ],
269
- });
402
+ diagnostics.push(surfacedDiagnostic('pipeline', test.expectedPipeline, [
403
+ `Pipeline "${test.expectedPipeline}" did not rank in the top 3 for "${test.task}".`,
404
+ 'Add domain-aligned tags to the pipeline (tags:["plugin"], …).',
405
+ 'Add task tokens to its title / description so the ranker catches them.',
406
+ 'Reference the pipeline from a preset that the task profile recommends.',
407
+ ]));
270
408
  }
271
409
  for (const action of missingForbidden) {
272
410
  diagnostics.push({
273
411
  id: action,
274
412
  kind: 'forbidden-action',
275
413
  existsInRegistry: false,
414
+ assertion: 'surfaced',
415
+ code: 'not-aggregated',
276
416
  suggestions: [
277
417
  `No rule's actionHints.forbiddenActions contains "${action}" for this task's relevant set.`,
278
418
  'Add the forbiddenAction to one of the high-priority rules that match this task.',
@@ -284,83 +424,58 @@ export function runAgentContractTest(inspection, test, registries) {
284
424
  id: cmd,
285
425
  kind: 'verification-command',
286
426
  existsInRegistry: false,
427
+ assertion: 'surfaced',
428
+ code: 'not-aggregated',
287
429
  suggestions: [
288
430
  `Verification command "${cmd}" is not aggregated for this task.`,
289
431
  'Add it to a high-priority rule\'s actionHints.verificationCommands.',
290
432
  ],
291
433
  });
292
434
  }
293
- // Diagnostics for the new expectation slots.
294
- for (const id of missingHelpers) {
295
- diagnostics.push({
435
+ const existsDiagnostic = (kind, id, hint) => {
436
+ const registry = consulted(inspection, kind);
437
+ const cold = unverifiedIds.has(`${kind}:${id}`);
438
+ return {
296
439
  id,
297
- kind: 'helper',
298
- existsInRegistry: helperRegistry.has(id),
299
- suggestions: [
300
- `Helper "${id}" not found in the helper registry — install the pack that ships it or correct the id.`,
301
- 'Make sure the helper is registered in HELPERS in packages/inspector/src/helper-registry.ts (or a pack contribution).',
302
- ],
303
- });
440
+ kind,
441
+ existsInRegistry: false,
442
+ assertion: 'exists',
443
+ code: cold ? 'unverifiable' : 'unknown-id',
444
+ consulted: registry,
445
+ suggestions: cold
446
+ ? [
447
+ `The ${kind} registry was not warmed, so "${id}" could not be looked up — NOT VERIFIED.`,
448
+ 'Call warmReferenceRegistries(inspection) before running agent tests.',
449
+ ]
450
+ : [
451
+ `${kind[0].toUpperCase() + kind.slice(1)} "${id}" is not registered — it is not among the ${registry.size} ids \`${registry.listVerb}\` prints.`,
452
+ hint,
453
+ ],
454
+ };
455
+ };
456
+ for (const id of missingHelpers) {
457
+ diagnostics.push(existsDiagnostic('helper', id, 'Register it in HELPERS (packages/inspector/src/helper-registry.ts) or ship it from a pack helperFiles contribution.'));
304
458
  }
305
459
  for (const id of missingPlaybooks) {
306
- diagnostics.push({
307
- id,
308
- kind: 'playbook',
309
- existsInRegistry: playbookList.has(id),
310
- suggestions: [
311
- `Playbook "${id}" not found in the playbook registry — install the pack that ships it or correct the id.`,
312
- 'Ensure the playbook file is referenced in sharkcraft.config.ts / pack contributions and exports a default array.',
313
- ],
314
- });
460
+ diagnostics.push(existsDiagnostic('playbook', id, 'Ensure the playbook file is referenced in sharkcraft.config.ts / pack contributions and exports a default array.'));
315
461
  }
316
462
  for (const id of missingPolicies) {
317
- diagnostics.push({
318
- id,
319
- kind: 'policy',
320
- existsInRegistry: policyChecks.has(id),
321
- suggestions: [
322
- `Policy "${id}" not found in the policy-engine checks — install the pack that ships it or correct the id.`,
323
- 'Add it to sharkcraft/policies.ts or a pack policyCheckFile.',
324
- ],
325
- });
463
+ diagnostics.push(existsDiagnostic('policy', id, 'Add it to sharkcraft/policies.ts or a pack policyCheckFile.'));
326
464
  }
327
465
  for (const id of missingConstructs) {
328
- diagnostics.push({
329
- id,
330
- kind: 'construct',
331
- existsInRegistry: constructList.has(id),
332
- suggestions: [
333
- `Construct "${id}" not found in the construct registry — install the pack that ships it or correct the id.`,
334
- 'Add a defineConstruct() entry in sharkcraft/constructs.ts or a pack constructFile.',
335
- ],
336
- });
337
- }
338
- for (const id of missingCommands) {
339
- diagnostics.push({
340
- id,
341
- kind: 'command',
342
- existsInRegistry: commandCatalog.has(id) || commandCatalog.has(id.split(' ')[0]),
343
- suggestions: [
344
- `Command "${id}" was not surfaced for "${test.task}" and is not in the command catalog.`,
345
- 'Add it to a high-priority rule\'s actionHints.commands or check the command-catalog.ts entries.',
346
- ],
347
- });
466
+ diagnostics.push(existsDiagnostic('construct', id, 'Add a defineConstruct() entry in sharkcraft/constructs.ts or a pack constructFile.'));
348
467
  }
468
+ diagnostics.push(...commandDiagnostics);
349
469
  for (const id of missingKnowledge) {
350
- diagnostics.push({
351
- id,
352
- kind: 'knowledge',
353
- existsInRegistry: knowledgeIds.has(id),
354
- suggestions: [
355
- `Knowledge entry "${id}" is not present in the inspection — install the pack that ships it or correct the id.`,
356
- ],
357
- });
470
+ diagnostics.push(existsDiagnostic('knowledge', id, 'Install the pack that ships it or correct the id.'));
358
471
  }
359
472
  for (const id of unexpectedlyIncluded) {
360
473
  diagnostics.push({
361
474
  id,
362
475
  kind: 'must-not-include',
363
476
  existsInRegistry: true,
477
+ assertion: 'surfaced',
478
+ code: 'surfaced-but-forbidden',
364
479
  suggestions: [
365
480
  `"${id}" was surfaced by the ranker but the test forbids it.`,
366
481
  'Narrow its appliesWhen / tags to avoid matching this task wording.',
@@ -372,6 +487,7 @@ export function runAgentContractTest(inspection, test, registries) {
372
487
  id: test.id,
373
488
  task: test.task,
374
489
  passed,
490
+ verdict,
375
491
  actualPipelines,
376
492
  missingTemplates,
377
493
  missingRules,
@@ -385,6 +501,8 @@ export function runAgentContractTest(inspection, test, registries) {
385
501
  missingKnowledge,
386
502
  unexpectedlyIncluded,
387
503
  };
504
+ if (unverified.length > 0)
505
+ result.unverified = unverified;
388
506
  if (test.expectedPipeline)
389
507
  result.expectedPipeline = test.expectedPipeline;
390
508
  if (!passed) {
@@ -400,149 +518,32 @@ export function runAgentContractTest(inspection, test, registries) {
400
518
  `missingKnowledge=${missingKnowledge.length}`,
401
519
  `unexpectedlyIncluded=${unexpectedlyIncluded.length}`,
402
520
  ];
521
+ if (unverified.length > 0)
522
+ partsList.push(`unverified=${unverified.length}`);
403
523
  result.failureSummary = partsList.join(' ');
404
524
  }
405
525
  if (diagnostics)
406
526
  result.diagnostics = diagnostics;
407
527
  return result;
408
528
  }
409
- // ── Registry helpers ────────────────────────────────────────────────
410
- function loadHelperRegistryQuietly() {
411
- try {
412
- return new Set(HELPERS.map((h) => h.id));
413
- }
414
- catch {
415
- return new Set();
416
- }
417
- }
418
- function listPlaybookIdsQuietly(inspection) {
419
- try {
420
- return new Set(listPlaybooks(inspection).map((p) => p.id));
421
- }
422
- catch {
423
- return new Set();
424
- }
425
- }
426
- function listPolicyIdsQuietly(inspection) {
427
- return new Set(listPolicyIds(inspection));
428
- }
429
- function listConstructIdsQuietly(inspection) {
430
- try {
431
- return new Set(listConstructs(inspection).map((c) => c.id));
432
- }
433
- catch {
434
- return new Set();
435
- }
436
- }
437
- function listCommandIdsQuietly(inspection) {
438
- const cat = inspection.commandCatalog ?? [];
439
- const out = new Set();
440
- for (const c of cat) {
441
- if (c.id)
442
- out.add(c.id);
443
- if (c.command)
444
- out.add(c.command);
445
- }
446
- return out;
447
- }
448
529
  /**
449
- * Async pre-loader for agent-contract test registries. Reads local
450
- * sharkcraft/policies.ts, sharkcraft/constructs.ts, sharkcraft/playbooks/
451
- * (and pack contributions where present). Result is sync-friendly so the
452
- * runner can stay sync.
530
+ * Warm the shared reference registry and return a snapshot of it.
531
+ *
532
+ * @deprecated Call `warmReferenceRegistries(inspection, options)` directly (the
533
+ * CLI: `warmCliReferenceRegistries`) — the runners read the registry itself.
534
+ * The snapshot is a projection of that one authority, never a second source:
535
+ * the old loader re-read policies / playbooks / constructs from its own file
536
+ * list and returned the built-in helpers only (no pack helpers).
453
537
  */
454
- export async function loadAgentContractRegistries(inspection) {
538
+ export async function loadAgentContractRegistries(inspection, options = {}) {
539
+ await warmReferenceRegistries(inspection, options);
540
+ const ids = (kind) => new Set(referenceIdsFor(inspection, kind));
455
541
  return {
456
- helpers: loadHelperRegistryQuietly(),
457
- playbooks: await loadPlaybookIdsAsync(inspection),
458
- policies: await loadPolicyIdsAsync(inspection),
459
- constructs: await loadConstructIdsAsync(inspection),
460
- commands: listCommandIdsQuietly(inspection),
461
- knowledge: new Set(inspection.knowledgeEntries.map((e) => e.id)),
542
+ helpers: ids('helper'),
543
+ playbooks: ids('playbook'),
544
+ policies: ids('policy'),
545
+ constructs: ids('construct'),
546
+ commands: new Set(),
547
+ knowledge: ids('knowledge'),
462
548
  };
463
549
  }
464
- async function importDefaultIdsArray(absPath) {
465
- if (!existsSync(absPath))
466
- return [];
467
- try {
468
- const mod = (await importModuleViaLoader(absPath));
469
- return Array.isArray(mod.default) ? mod.default : [];
470
- }
471
- catch {
472
- return [];
473
- }
474
- }
475
- async function loadPolicyIdsAsync(inspection) {
476
- const out = new Set();
477
- if (inspection.sharkcraftDir) {
478
- const local = nodePath.join(inspection.sharkcraftDir, 'policies.ts');
479
- for (const entry of await importDefaultIdsArray(local)) {
480
- if (entry?.id)
481
- out.add(entry.id);
482
- }
483
- }
484
- for (const pack of inspection.packs.validPacks) {
485
- const c = pack.manifest.contributions;
486
- for (const rel of c.policyCheckFiles ?? []) {
487
- const full = nodePath.resolve(pack.packageRoot, rel);
488
- for (const entry of await importDefaultIdsArray(full)) {
489
- if (entry?.id)
490
- out.add(entry.id);
491
- }
492
- }
493
- }
494
- // Also include any policyChecks already on the inspection (sync fallback).
495
- for (const id of listPolicyIdsQuietly(inspection))
496
- out.add(id);
497
- return out;
498
- }
499
- async function loadPlaybookIdsAsync(inspection) {
500
- const out = new Set();
501
- // Sync fallback from registry.
502
- for (const id of listPlaybookIdsQuietly(inspection))
503
- out.add(id);
504
- // Local file.
505
- if (inspection.sharkcraftDir) {
506
- const local = nodePath.join(inspection.sharkcraftDir, 'playbooks.ts');
507
- for (const entry of await importDefaultIdsArray(local)) {
508
- if (entry?.id)
509
- out.add(entry.id);
510
- }
511
- }
512
- // Pack contributions.
513
- for (const pack of inspection.packs.validPacks) {
514
- const c = pack.manifest.contributions;
515
- for (const rel of c.playbookFiles ?? []) {
516
- const full = nodePath.resolve(pack.packageRoot, rel);
517
- for (const entry of await importDefaultIdsArray(full)) {
518
- if (entry?.id)
519
- out.add(entry.id);
520
- }
521
- }
522
- }
523
- return out;
524
- }
525
- async function loadConstructIdsAsync(inspection) {
526
- const out = new Set();
527
- // Sync fallback first.
528
- for (const id of listConstructIdsQuietly(inspection))
529
- out.add(id);
530
- if (inspection.sharkcraftDir) {
531
- const local = nodePath.join(inspection.sharkcraftDir, 'constructs.ts');
532
- for (const entry of await importDefaultIdsArray(local)) {
533
- if (entry?.id)
534
- out.add(entry.id);
535
- }
536
- }
537
- for (const pack of inspection.packs.validPacks) {
538
- const c = pack.manifest.contributions;
539
- for (const rel of c.constructFiles ?? []) {
540
- const full = nodePath.resolve(pack.packageRoot, rel);
541
- for (const entry of await importDefaultIdsArray(full)) {
542
- if (entry?.id)
543
- out.add(entry.id);
544
- }
545
- }
546
- }
547
- return out;
548
- }