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