@canonical/pragma-cli 0.38.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (330) hide show
  1. package/README.md +1 -1
  2. package/dist/package.json +14 -14
  3. package/dist/pragma.conf.js +273 -176
  4. package/dist/pragma.conf.js.map +1 -1
  5. package/dist/src/capabilities/capabilities/capabilities.verb.js +2 -0
  6. package/dist/src/capabilities/capabilities/capabilities.verb.js.map +1 -1
  7. package/dist/src/capabilities/capabilities/catalog.js +47 -51
  8. package/dist/src/capabilities/capabilities/catalog.js.map +1 -1
  9. package/dist/src/capabilities/capabilities/index.js +2 -0
  10. package/dist/src/capabilities/capabilities/index.js.map +1 -1
  11. package/dist/src/capabilities/capabilities/types.js +5 -5
  12. package/dist/src/capabilities/colophon/colophon.render.js +7 -4
  13. package/dist/src/capabilities/colophon/colophon.render.js.map +1 -1
  14. package/dist/src/capabilities/colophon/colophon.verb.js +1 -0
  15. package/dist/src/capabilities/colophon/colophon.verb.js.map +1 -1
  16. package/dist/src/capabilities/config/get.verb.js +2 -0
  17. package/dist/src/capabilities/config/get.verb.js.map +1 -1
  18. package/dist/src/capabilities/config/runField.js +2 -2
  19. package/dist/src/capabilities/config/runField.js.map +1 -1
  20. package/dist/src/capabilities/config/set.verb.js +2 -0
  21. package/dist/src/capabilities/config/set.verb.js.map +1 -1
  22. package/dist/src/capabilities/config/show.verb.js +1 -0
  23. package/dist/src/capabilities/config/show.verb.js.map +1 -1
  24. package/dist/src/capabilities/config/unset.verb.js +2 -0
  25. package/dist/src/capabilities/config/unset.verb.js.map +1 -1
  26. package/dist/src/capabilities/create/constants.js +2 -2
  27. package/dist/src/capabilities/create/create.verb.js +14 -4
  28. package/dist/src/capabilities/create/create.verb.js.map +1 -1
  29. package/dist/src/capabilities/distribution.js +3 -1
  30. package/dist/src/capabilities/distribution.js.map +1 -1
  31. package/dist/src/capabilities/doctor/checks/checkPackageRefs.js +10 -2
  32. package/dist/src/capabilities/doctor/checks/checkPackageRefs.js.map +1 -1
  33. package/dist/src/capabilities/doctor/doctor.verb.js +2 -0
  34. package/dist/src/capabilities/doctor/doctor.verb.js.map +1 -1
  35. package/dist/src/capabilities/graph/connect.verb.js +2 -0
  36. package/dist/src/capabilities/graph/connect.verb.js.map +1 -1
  37. package/dist/src/capabilities/graph/inspect.render.js +7 -1
  38. package/dist/src/capabilities/graph/inspect.render.js.map +1 -1
  39. package/dist/src/capabilities/graph/inspect.verb.js +2 -0
  40. package/dist/src/capabilities/graph/inspect.verb.js.map +1 -1
  41. package/dist/src/capabilities/graph/query.render.js +37 -5
  42. package/dist/src/capabilities/graph/query.render.js.map +1 -1
  43. package/dist/src/capabilities/graph/query.verb.js +2 -0
  44. package/dist/src/capabilities/graph/query.verb.js.map +1 -1
  45. package/dist/src/capabilities/graph/queryText.js +28 -0
  46. package/dist/src/capabilities/graph/queryText.js.map +1 -1
  47. package/dist/src/capabilities/graph/runConnect.js +3 -3
  48. package/dist/src/capabilities/graph/runConnect.js.map +1 -1
  49. package/dist/src/capabilities/graph/runQuery.js +8 -6
  50. package/dist/src/capabilities/graph/runQuery.js.map +1 -1
  51. package/dist/src/capabilities/info/info.verb.js +2 -0
  52. package/dist/src/capabilities/info/info.verb.js.map +1 -1
  53. package/dist/src/capabilities/meta/mcp.verb.js +1 -0
  54. package/dist/src/capabilities/meta/mcp.verb.js.map +1 -1
  55. package/dist/src/capabilities/ontology/verbs.js +7 -10
  56. package/dist/src/capabilities/ontology/verbs.js.map +1 -1
  57. package/dist/src/capabilities/prompt/verbs.js +5 -4
  58. package/dist/src/capabilities/prompt/verbs.js.map +1 -1
  59. package/dist/src/capabilities/resources/provider.js +6 -3
  60. package/dist/src/capabilities/resources/provider.js.map +1 -1
  61. package/dist/src/capabilities/setup/setup.verb.js +13 -5
  62. package/dist/src/capabilities/setup/setup.verb.js.map +1 -1
  63. package/dist/src/capabilities/shared/calls.js +16 -0
  64. package/dist/src/capabilities/shared/calls.js.map +1 -0
  65. package/dist/src/capabilities/skill/render.js +7 -5
  66. package/dist/src/capabilities/skill/render.js.map +1 -1
  67. package/dist/src/capabilities/skill/verbs.js +5 -4
  68. package/dist/src/capabilities/skill/verbs.js.map +1 -1
  69. package/dist/src/capabilities/sources/collectStatus.js +6 -1
  70. package/dist/src/capabilities/sources/collectStatus.js.map +1 -1
  71. package/dist/src/capabilities/sources/index.js +4 -3
  72. package/dist/src/capabilities/sources/index.js.map +1 -1
  73. package/dist/src/capabilities/sources/reset.render.js +37 -0
  74. package/dist/src/capabilities/sources/reset.render.js.map +1 -0
  75. package/dist/src/capabilities/sources/reset.verb.js +51 -0
  76. package/dist/src/capabilities/sources/reset.verb.js.map +1 -0
  77. package/dist/src/capabilities/sources/runReset.js +59 -0
  78. package/dist/src/capabilities/sources/runReset.js.map +1 -0
  79. package/dist/src/capabilities/sources/runUpdate.js +7 -6
  80. package/dist/src/capabilities/sources/runUpdate.js.map +1 -1
  81. package/dist/src/capabilities/sources/status.render.js +24 -8
  82. package/dist/src/capabilities/sources/status.render.js.map +1 -1
  83. package/dist/src/capabilities/sources/status.verb.js +1 -0
  84. package/dist/src/capabilities/sources/status.verb.js.map +1 -1
  85. package/dist/src/capabilities/sources/update.verb.js +2 -0
  86. package/dist/src/capabilities/sources/update.verb.js.map +1 -1
  87. package/dist/src/capabilities/upgrade/upgrade.verb.js +1 -0
  88. package/dist/src/capabilities/upgrade/upgrade.verb.js.map +1 -1
  89. package/dist/src/capabilities/version/version.verb.js +1 -0
  90. package/dist/src/capabilities/version/version.verb.js.map +1 -1
  91. package/dist/src/constants.js +4 -3
  92. package/dist/src/constants.js.map +1 -1
  93. package/dist/src/kernel/error/index.js +1 -1
  94. package/dist/src/kernel/error/index.js.map +1 -1
  95. package/dist/src/kernel/error/recovery.js +24 -42
  96. package/dist/src/kernel/error/recovery.js.map +1 -1
  97. package/dist/src/kernel/packs/collect.js +123 -9
  98. package/dist/src/kernel/packs/collect.js.map +1 -1
  99. package/dist/src/kernel/packs/compile.js +74 -15
  100. package/dist/src/kernel/packs/compile.js.map +1 -1
  101. package/dist/src/kernel/packs/graphql/fetchGraphqlLookup.js +3 -3
  102. package/dist/src/kernel/packs/graphql/fetchGraphqlLookup.js.map +1 -1
  103. package/dist/src/kernel/packs/iri.js +2 -4
  104. package/dist/src/kernel/packs/iri.js.map +1 -1
  105. package/dist/src/kernel/packs/renderPack.js +90 -50
  106. package/dist/src/kernel/packs/renderPack.js.map +1 -1
  107. package/dist/src/kernel/packs/resolveEntity.js +202 -90
  108. package/dist/src/kernel/packs/resolveEntity.js.map +1 -1
  109. package/dist/src/kernel/packs/runBodies.js +89 -30
  110. package/dist/src/kernel/packs/runBodies.js.map +1 -1
  111. package/dist/src/kernel/packs/schema.js +66 -12
  112. package/dist/src/kernel/packs/schema.js.map +1 -1
  113. package/dist/src/kernel/packs/sparql/buildListQuery.js +80 -13
  114. package/dist/src/kernel/packs/sparql/buildListQuery.js.map +1 -1
  115. package/dist/src/kernel/packs/sparql/buildLookupQuery.js +41 -13
  116. package/dist/src/kernel/packs/sparql/buildLookupQuery.js.map +1 -1
  117. package/dist/src/kernel/packs/sparql/filterValues.js +32 -23
  118. package/dist/src/kernel/packs/sparql/filterValues.js.map +1 -1
  119. package/dist/src/kernel/packs/sparql/runSelect.js +3 -5
  120. package/dist/src/kernel/packs/sparql/runSelect.js.map +1 -1
  121. package/dist/src/kernel/packs/storyRules.js +31 -4
  122. package/dist/src/kernel/packs/storyRules.js.map +1 -1
  123. package/dist/src/kernel/packs/tierScope.js +3 -3
  124. package/dist/src/kernel/packs/tierScope.js.map +1 -1
  125. package/dist/src/kernel/packs/types.js +4 -0
  126. package/dist/src/kernel/packs/types.js.map +1 -1
  127. package/dist/src/kernel/project/cli/buildProgram.js +4 -0
  128. package/dist/src/kernel/project/cli/buildProgram.js.map +1 -1
  129. package/dist/src/kernel/project/cli/dispatch.js +32 -8
  130. package/dist/src/kernel/project/cli/dispatch.js.map +1 -1
  131. package/dist/src/kernel/project/cli/suggestNames.js +44 -1
  132. package/dist/src/kernel/project/cli/suggestNames.js.map +1 -1
  133. package/dist/src/kernel/project/cli/verbHelp.js +17 -18
  134. package/dist/src/kernel/project/cli/verbHelp.js.map +1 -1
  135. package/dist/src/kernel/project/mcp/buildServer.js +11 -4
  136. package/dist/src/kernel/project/mcp/buildServer.js.map +1 -1
  137. package/dist/src/kernel/project/mcp/envelope.js +3 -2
  138. package/dist/src/kernel/project/mcp/envelope.js.map +1 -1
  139. package/dist/src/kernel/project/mcp/instructions.js +101 -31
  140. package/dist/src/kernel/project/mcp/instructions.js.map +1 -1
  141. package/dist/src/kernel/project/mcp/registerVerb.js +59 -23
  142. package/dist/src/kernel/project/mcp/registerVerb.js.map +1 -1
  143. package/dist/src/kernel/render/renderers.js +3 -3
  144. package/dist/src/kernel/render/turtle.js +21 -4
  145. package/dist/src/kernel/render/turtle.js.map +1 -1
  146. package/dist/src/kernel/runtime/graphpack/build.js +54 -1
  147. package/dist/src/kernel/runtime/graphpack/build.js.map +1 -1
  148. package/dist/src/kernel/runtime/graphpack/manifest.js +14 -0
  149. package/dist/src/kernel/runtime/graphpack/manifest.js.map +1 -1
  150. package/dist/src/kernel/runtime/graphpack/read.js +3 -5
  151. package/dist/src/kernel/runtime/graphpack/read.js.map +1 -1
  152. package/dist/src/kernel/runtime/graphpack/schemas.js +1 -0
  153. package/dist/src/kernel/runtime/graphpack/schemas.js.map +1 -1
  154. package/dist/src/kernel/runtime/loadSession.js +8 -1
  155. package/dist/src/kernel/runtime/loadSession.js.map +1 -1
  156. package/dist/src/kernel/runtime/packVersion.js +75 -0
  157. package/dist/src/kernel/runtime/packVersion.js.map +1 -0
  158. package/dist/src/kernel/runtime/readEntity.js +43 -4
  159. package/dist/src/kernel/runtime/readEntity.js.map +1 -1
  160. package/dist/src/kernel/runtime/resolveSources.js +61 -9
  161. package/dist/src/kernel/runtime/resolveSources.js.map +1 -1
  162. package/dist/src/kernel/runtime/storeReadiness.js +3 -2
  163. package/dist/src/kernel/runtime/storeReadiness.js.map +1 -1
  164. package/dist/src/kernel/spec/call.js +167 -0
  165. package/dist/src/kernel/spec/call.js.map +1 -0
  166. package/dist/src/kernel/spec/emitReference.js +9 -13
  167. package/dist/src/kernel/spec/emitReference.js.map +1 -1
  168. package/dist/src/kernel/spec/emitSurface.js +8 -1
  169. package/dist/src/kernel/spec/emitSurface.js.map +1 -1
  170. package/dist/src/kernel/spec/guidance.js +63 -0
  171. package/dist/src/kernel/spec/guidance.js.map +1 -0
  172. package/dist/src/kernel/spec/wireType.js +36 -0
  173. package/dist/src/kernel/spec/wireType.js.map +1 -0
  174. package/package.json +14 -14
  175. package/pragma.conf.ts +294 -177
  176. package/src/capabilities/block.parity.test.ts +1 -1
  177. package/src/capabilities/callRule.test.ts +147 -0
  178. package/src/capabilities/capabilities/capabilities.test.ts +47 -19
  179. package/src/capabilities/capabilities/capabilities.verb.ts +2 -0
  180. package/src/capabilities/capabilities/catalog.ts +60 -55
  181. package/src/capabilities/capabilities/index.ts +2 -0
  182. package/src/capabilities/capabilities/types.ts +16 -19
  183. package/src/capabilities/colophon/colophon.render.ts +9 -5
  184. package/src/capabilities/colophon/colophon.verb.ts +1 -0
  185. package/src/capabilities/config/get.verb.ts +2 -0
  186. package/src/capabilities/config/runField.ts +3 -3
  187. package/src/capabilities/config/set.verb.ts +3 -0
  188. package/src/capabilities/config/show.verb.ts +2 -0
  189. package/src/capabilities/config/unset.verb.ts +2 -0
  190. package/src/capabilities/create/constants.ts +2 -2
  191. package/src/capabilities/create/create.verb.ts +16 -0
  192. package/src/capabilities/create/createGrammar.test.ts +1 -1
  193. package/src/capabilities/distribution.test.ts +6 -3
  194. package/src/capabilities/distribution.ts +6 -0
  195. package/src/capabilities/doctor/checks/checkPackageRefs.ts +14 -2
  196. package/src/capabilities/doctor/doctor.test.ts +38 -1
  197. package/src/capabilities/doctor/doctor.verb.ts +2 -0
  198. package/src/capabilities/emptyRecovery.test.ts +5 -0
  199. package/src/capabilities/graph/connect.verb.ts +2 -0
  200. package/src/capabilities/graph/inspect.render.ts +9 -1
  201. package/src/capabilities/graph/inspect.test.ts +73 -0
  202. package/src/capabilities/graph/inspect.verb.ts +2 -0
  203. package/src/capabilities/graph/query.render.test.ts +35 -0
  204. package/src/capabilities/graph/query.render.ts +45 -7
  205. package/src/capabilities/graph/query.shipped.exec.test.ts +44 -0
  206. package/src/capabilities/graph/query.verb.ts +2 -0
  207. package/src/capabilities/graph/queryText.test.ts +55 -1
  208. package/src/capabilities/graph/queryText.ts +47 -0
  209. package/src/capabilities/graph/runConnect.ts +4 -5
  210. package/src/capabilities/graph/runQuery.ts +23 -9
  211. package/src/capabilities/info/info.verb.ts +2 -0
  212. package/src/capabilities/links.shipped.exec.test.ts +398 -0
  213. package/src/capabilities/listBudget.shipped.exec.test.ts +2 -2
  214. package/src/capabilities/listLookup.shipped.exec.test.ts +122 -13
  215. package/src/capabilities/listQuery.shipped.exec.test.ts +39 -16
  216. package/src/capabilities/lookupBudget.shipped.exec.test.ts +208 -0
  217. package/src/capabilities/meta/mcp.verb.ts +2 -0
  218. package/src/capabilities/ontology/ontology.test.ts +24 -0
  219. package/src/capabilities/ontology/verbs.ts +16 -12
  220. package/src/capabilities/prompt/verbs.ts +10 -4
  221. package/src/capabilities/resources/provider.ts +7 -3
  222. package/src/capabilities/resources/resources.test.ts +2 -1
  223. package/src/capabilities/setup/setup.verb.ts +16 -0
  224. package/src/capabilities/shared/calls.ts +20 -0
  225. package/src/capabilities/skill/render.ts +9 -6
  226. package/src/capabilities/skill/verbs.ts +8 -4
  227. package/src/capabilities/sources/collectStatus.ts +6 -1
  228. package/src/capabilities/sources/index.ts +4 -3
  229. package/src/capabilities/sources/reset.render.test.ts +33 -0
  230. package/src/capabilities/sources/reset.render.ts +43 -0
  231. package/src/capabilities/sources/reset.verb.ts +59 -0
  232. package/src/capabilities/sources/runReset.ts +65 -0
  233. package/src/capabilities/sources/runUpdate.ts +12 -11
  234. package/src/capabilities/sources/sources.test.ts +158 -3
  235. package/src/capabilities/sources/status.render.test.ts +63 -1
  236. package/src/capabilities/sources/status.render.ts +25 -8
  237. package/src/capabilities/sources/status.verb.ts +2 -0
  238. package/src/capabilities/sources/types.ts +26 -0
  239. package/src/capabilities/sources/update.verb.ts +3 -0
  240. package/src/capabilities/surface.test.ts +2 -2
  241. package/src/capabilities/token.parity.test.ts +3 -2
  242. package/src/capabilities/tokenGraph.shipped.exec.test.ts +14 -2
  243. package/src/capabilities/upgrade/upgrade.verb.ts +1 -0
  244. package/src/capabilities/variable.parity.test.ts +2 -1
  245. package/src/capabilities/version/version.verb.ts +1 -0
  246. package/src/capabilities/wireContract.test.ts +110 -0
  247. package/src/constants.ts +4 -3
  248. package/src/kernel/copy.test.ts +1 -1
  249. package/src/kernel/error/PragmaError.test.ts +7 -3
  250. package/src/kernel/error/index.ts +1 -1
  251. package/src/kernel/error/recovery.test.ts +52 -18
  252. package/src/kernel/error/recovery.ts +25 -46
  253. package/src/kernel/error/types.ts +1 -1
  254. package/src/kernel/packs/collect.test.ts +79 -0
  255. package/src/kernel/packs/collect.ts +151 -11
  256. package/src/kernel/packs/compile.test.ts +107 -10
  257. package/src/kernel/packs/compile.ts +100 -11
  258. package/src/kernel/packs/filteredEmpty.test.ts +22 -5
  259. package/src/kernel/packs/graphql/fetchGraphqlLookup.ts +5 -6
  260. package/src/kernel/packs/graphqlSource.test.ts +42 -0
  261. package/src/kernel/packs/iri.ts +5 -4
  262. package/src/kernel/packs/listNotice.test.ts +1 -1
  263. package/src/kernel/packs/nounLink.test.ts +385 -0
  264. package/src/kernel/packs/renderPack.ts +137 -57
  265. package/src/kernel/packs/resolveEntity.test.ts +170 -1
  266. package/src/kernel/packs/resolveEntity.ts +281 -101
  267. package/src/kernel/packs/runBodies.ts +133 -31
  268. package/src/kernel/packs/schema.ts +77 -12
  269. package/src/kernel/packs/sparql/buildListQuery.test.ts +78 -1
  270. package/src/kernel/packs/sparql/buildListQuery.ts +106 -16
  271. package/src/kernel/packs/sparql/buildLookupQuery.ts +44 -13
  272. package/src/kernel/packs/sparql/filterValues.test.ts +36 -4
  273. package/src/kernel/packs/sparql/filterValues.ts +50 -31
  274. package/src/kernel/packs/sparql/runSelect.ts +4 -6
  275. package/src/kernel/packs/storyRules.ts +37 -4
  276. package/src/kernel/packs/tierScope.test.ts +120 -6
  277. package/src/kernel/packs/tierScope.ts +5 -7
  278. package/src/kernel/packs/toolDescription.test.ts +59 -74
  279. package/src/kernel/packs/types.ts +93 -11
  280. package/src/kernel/project/cli/buildProgram.ts +4 -0
  281. package/src/kernel/project/cli/dispatch.ts +34 -8
  282. package/src/kernel/project/cli/suggest.test.ts +77 -0
  283. package/src/kernel/project/cli/suggestNames.ts +47 -1
  284. package/src/kernel/project/cli/verbHelp.ts +16 -19
  285. package/src/kernel/project/mcp/buildServer.ts +15 -4
  286. package/src/kernel/project/mcp/envelope.ts +3 -2
  287. package/src/kernel/project/mcp/instructions.ts +123 -35
  288. package/src/kernel/project/mcp/prompts/prompts.test.ts +136 -20
  289. package/src/kernel/project/mcp/registerVerb.test.ts +28 -0
  290. package/src/kernel/project/mcp/registerVerb.ts +67 -29
  291. package/src/kernel/render/__snapshots__/renderers.test.ts.snap +1 -1
  292. package/src/kernel/render/renderers.test.ts +2 -2
  293. package/src/kernel/render/renderers.ts +3 -3
  294. package/src/kernel/render/turtle.ts +24 -4
  295. package/src/kernel/runtime/graphpack/build.ts +58 -1
  296. package/src/kernel/runtime/graphpack/graphpack.test.ts +20 -0
  297. package/src/kernel/runtime/graphpack/manifest.ts +15 -0
  298. package/src/kernel/runtime/graphpack/read.ts +4 -6
  299. package/src/kernel/runtime/graphpack/schemas.ts +1 -0
  300. package/src/kernel/runtime/graphpack/types.ts +13 -0
  301. package/src/kernel/runtime/loadSession.ts +8 -1
  302. package/src/kernel/runtime/packVersion.test.ts +61 -0
  303. package/src/kernel/runtime/packVersion.ts +84 -0
  304. package/src/kernel/runtime/readEntity.ts +61 -6
  305. package/src/kernel/runtime/resolveSources.test.ts +90 -7
  306. package/src/kernel/runtime/resolveSources.ts +91 -10
  307. package/src/kernel/runtime/storeReadiness.ts +4 -4
  308. package/src/kernel/runtime/types.ts +12 -0
  309. package/src/kernel/spec/call.test.ts +95 -0
  310. package/src/kernel/spec/call.ts +186 -0
  311. package/src/kernel/spec/emitReference.ts +9 -13
  312. package/src/kernel/spec/emitSurface.ts +9 -1
  313. package/src/kernel/spec/guidance.test.ts +49 -0
  314. package/src/kernel/spec/guidance.ts +68 -0
  315. package/src/kernel/spec/index.ts +4 -0
  316. package/src/kernel/spec/surfaceConformance.test.ts +2 -2
  317. package/src/kernel/spec/types.ts +64 -7
  318. package/src/kernel/spec/wireType.ts +53 -0
  319. package/src/testing/behavioral/errorMatrix.mcp.test.ts +2 -1
  320. package/src/testing/behavioral/journeys.firstInstall.test.ts +72 -2
  321. package/src/testing/behavioral/parity.test.ts +40 -0
  322. package/src/testing/eval/__snapshots__/eval.test.ts.snap +1 -1
  323. package/src/testing/eval/cases/assembly.ts +4 -3
  324. package/src/testing/eval/cases/stable.ts +2 -3
  325. package/src/testing/helpers/callSchema.ts +40 -0
  326. package/src/testing/helpers/parity.ts +35 -2
  327. package/src/testing/setupCallChecking.ts +30 -0
  328. package/dist/src/capabilities/capabilities/hints.js +0 -223
  329. package/dist/src/capabilities/capabilities/hints.js.map +0 -1
  330. package/src/capabilities/capabilities/hints.ts +0 -266
package/pragma.conf.ts CHANGED
@@ -15,8 +15,8 @@
15
15
  * module's load runs on `--help`, `__complete` and `--version`. That also makes
16
16
  * the reverse edge impossible — importing `constants.js` from here is a
17
17
  * temporal-dead-zone cycle. It is also why no string below names the binary
18
- * except `name` itself: an `emptyRecovery.cli` is the command WITHOUT the
19
- * binary name, and the renderer prepends the consuming distribution's.
18
+ * except `name` itself: an `emptyRecovery.call` names a verb path, never the
19
+ * binary, and the renderer spells it for the consuming distribution.
20
20
  * `capabilities/lazy.test.ts` pins both halves of that.
21
21
  */
22
22
 
@@ -148,7 +148,10 @@ const designSystemStories: readonly PackDefinition[] = [
148
148
  noun: "block",
149
149
  description: "List all design system blocks.",
150
150
  toolDescription:
151
- "List all design system blocks with their type, tier, and modifier families. Use when browsing which blocks exist. Example: block_list {}.",
151
+ "List all design system blocks with their type, tier, and modifier families.",
152
+ useWhen:
153
+ "when asked which components, patterns, layouts or subcomponents exist — all four are blocks, and every one of them is read through the block tools",
154
+ example: { tier: "all" },
152
155
  colophon: DESIGN_SYSTEM_COLOPHON,
153
156
  // Blocks are TIERED, so every read of them is SCOPED: `block list` answers
154
157
  // from the top-level tiers, `--tier apps_lxd` from that tier and its
@@ -220,13 +223,16 @@ const designSystemStories: readonly PackDefinition[] = [
220
223
  emptyRecovery: {
221
224
  message:
222
225
  "No blocks in the store. Build it from the configured design-system packs.",
223
- cli: "sources update",
226
+ call: { verb: "sources update" },
224
227
  },
225
228
  },
226
229
  lookup: {
227
230
  source: "graphql",
228
231
  toolDescription:
229
- 'Get detailed information about one or more design system blocks including anatomy, modifiers, and properties. Use when you need the full spec of specific blocks by name — detail: "summary" trims to the base view. Example: block_lookup { name: ["Button"] }.',
232
+ 'Get detailed information about one or more design system blocks including anatomy, modifiers, and properties. `detail: "summary"` trims to the base view.',
233
+ useWhen:
234
+ "when asked about one component, pattern or layout by name — its anatomy, properties, variants, or when to use it",
235
+ example: { name: ["Button", "Accordion"] },
230
236
  by: "ds:name",
231
237
  types: ["ds:Component", "ds:Pattern", "ds:Layout", "ds:Subcomponent"],
232
238
  // A subcomponent is a PART of a block, never the block someone means:
@@ -353,7 +359,7 @@ const designSystemStories: readonly PackDefinition[] = [
353
359
  relation: "ds:hasSubcomponent",
354
360
  level: "detailed",
355
361
  select: [
356
- { name: "name", property: "ds:name" },
362
+ { name: "name", property: "ds:name", noun: "block" },
357
363
  { name: "uri", property: "ds:name", graphqlField: "uri" },
358
364
  ],
359
365
  },
@@ -404,7 +410,19 @@ const designSystemStories: readonly PackDefinition[] = [
404
410
  // The dotted name, not the symbol's IRI: it is the address
405
411
  // `token lookup` and `token consumers --symbol` both take, so a row
406
412
  // here is a query a reader can run.
407
- { name: "symbol", property: "ds:consumesSymbol/rdfs:label" },
413
+ {
414
+ name: "symbol",
415
+ property: "ds:consumesSymbol/rdfs:label",
416
+ noun: "token",
417
+ },
418
+ // The CSS names that symbol is written as. `many`, so a second
419
+ // variable adds a name to the cell and not a row.
420
+ {
421
+ name: "variable",
422
+ property: "ds:consumesSymbol/^dt:ofSymbol/rdfs:label",
423
+ many: true,
424
+ noun: "variable",
425
+ },
408
426
  { name: "key", property: "anatomy:styleKey" },
409
427
  { name: "state", property: "anatomy:styleState" },
410
428
  { name: "rank", property: "ds:rank" },
@@ -428,7 +446,9 @@ const designSystemStories: readonly PackDefinition[] = [
428
446
  sample: {
429
447
  fixedCount: true,
430
448
  toolDescription:
431
- "Return randomly selected complete design-system blocks as exemplars. Use BEFORE writing queries to see actual data shapes, anatomy, and property names. Example: block_sample {}.",
449
+ "Return randomly selected complete design-system blocks as exemplars.",
450
+ useWhen:
451
+ "before your first block query, to see what a real block record looks like instead of guessing field names",
432
452
  },
433
453
  },
434
454
  },
@@ -458,7 +478,10 @@ const designSystemStories: readonly PackDefinition[] = [
458
478
  noun: "token",
459
479
  description: "List the design-token symbols.",
460
480
  toolDescription:
461
- 'List the design-token SYMBOLS — logical dotted names (`color.text`), with the type and description from the symbol\'s OWN definition, and the symbol a channel provisions. The CSS custom-property names a stylesheet declares are variable_list. Example: token_list { type: "color" }.',
481
+ "List the design-token SYMBOLS — logical dotted names (`color.text`), with the type and description from the symbol's OWN definition, and the symbol a channel provisions. The CSS custom-property names a stylesheet declares are variable_list.",
482
+ useWhen:
483
+ "when asked which design tokens exist — colours, spacing, typography — or to find a token's exact name",
484
+ example: { type: ["color", "dimension"] },
462
485
  list: {
463
486
  // Type and description are DEFINITION-level facts, and 393 of the 745
464
487
  // symbols have more than one definition (`color.text` has 20). The one
@@ -497,7 +520,7 @@ const designSystemStories: readonly PackDefinition[] = [
497
520
  // 60-second timeout; over this query it takes 1.8 s, and the whole
498
521
  // population comes back in 71 ms rather than 1.1 s a page.
499
522
  query: [
500
- "SELECT DISTINCT ?uri ?name ?type ?description ?channelOf",
523
+ "SELECT DISTINCT ?uri ?name ?type ?description ?channelOf ?channelOfUri",
501
524
  "WHERE {",
502
525
  " ?uri a dt:TokenSymbol ;",
503
526
  " rdfs:label ?name .",
@@ -506,7 +529,7 @@ const designSystemStories: readonly PackDefinition[] = [
506
529
  // noun of its own. Bound to the base symbol's LABEL, not its IRI: the
507
530
  // filter column and the displayed column are one column, and an
508
531
  // unbound IRI cell renders as a full IRI.
509
- " OPTIONAL { ?uri dt:channelOf/rdfs:label ?channelOf }",
532
+ " OPTIONAL { ?uri dt:channelOf ?channelOfUri . ?channelOfUri rdfs:label ?channelOf }",
510
533
  " OPTIONAL {",
511
534
  " ?resolved dt:forSymbol ?uri ;",
512
535
  " dt:resolutionChain/rdf:first ?definition .",
@@ -520,7 +543,7 @@ const designSystemStories: readonly PackDefinition[] = [
520
543
  columns: [
521
544
  { field: "name", label: "Name" },
522
545
  { field: "type", label: "Type" },
523
- { field: "channelOf", label: "Channel of" },
546
+ { field: "channelOf", label: "Channel of", noun: "token" },
524
547
  { field: "description", label: "Description" },
525
548
  { field: "uri", label: "IRI" },
526
549
  ],
@@ -545,22 +568,11 @@ const designSystemStories: readonly PackDefinition[] = [
545
568
  {
546
569
  param: "channelOf",
547
570
  variable: "channelOf",
548
- // The dimension is "which SYMBOL", so the roster is EVERY symbol —
571
+ // The dimension is "which SYMBOL", so every symbol is admissible —
549
572
  // not the far smaller set that happens to have a channel today.
550
- // Asking for a symbol nothing provisions is the documented calm empty
551
- // list, which is the whole reason a vocabulary is read from the graph
552
- // rather than from the rows a page returned.
553
- //
554
- // Keyed on `rdfs:label`, the same term the column binds and the same
555
- // term the lookup resolves by. All three move together or not at all.
556
- vocabulary: {
557
- query: [
558
- "SELECT DISTINCT ?channelOf WHERE {",
559
- " ?symbol a dt:TokenSymbol ;",
560
- " rdfs:label ?channelOf .",
561
- "}",
562
- ].join("\n"),
563
- },
573
+ // Asking for a symbol nothing provisions is a calm empty list.
574
+ noun: "token",
575
+ entity: "channelOfUri",
564
576
  description: "Filter to one symbol's channels.",
565
577
  },
566
578
  ],
@@ -580,7 +592,10 @@ const designSystemStories: readonly PackDefinition[] = [
580
592
  description:
581
593
  "List the value each symbol resolves to at each position, with its chain or its derivation.",
582
594
  toolDescription:
583
- 'List the resolved token VALUES — one row per (symbol, position) the graph materialises, with the value and either its resolution chain or the symbol it derives from. Only MATERIALISED positions appear, not the permutation space: a position with no row falls through to the base symbol. A derived row carries a derivation and no value cell. Example: token_values { symbol: "color.text" }.',
595
+ "List the resolved token VALUES — one row per (symbol, position) the graph materialises, with the value and either its resolution chain or the symbol it derives from. Only MATERIALISED positions appear, not the permutation space: a position with no row falls through to the base symbol. A derived row carries a derivation and no value cell.",
596
+ useWhen:
597
+ "when asked what value a token has, in light, dark or any other mode",
598
+ example: { symbol: ["color.text", "color.border"] },
584
599
  // The resolved-value shape admits exactly one of a chain or a
585
600
  // derivation, so BOTH are selected wherever a value is projected. A
586
601
  // surface that selected only the chain would show a blank row for every
@@ -602,7 +617,7 @@ const designSystemStories: readonly PackDefinition[] = [
602
617
  // definition the value was authored in, and that is what the lookup's
603
618
  // `values` expand projects with `rdf:first`.
604
619
  query: [
605
- "SELECT ?symbol ?position ?value ?derivedFrom",
620
+ "SELECT ?symbol ?position ?value ?derivedFrom ?symbolUri",
606
621
  ' (GROUP_CONCAT(DISTINCT ?chainItem; SEPARATOR=" ") AS ?chain)',
607
622
  "WHERE {",
608
623
  " ?resolved a dt:ResolvedValue ;",
@@ -622,11 +637,11 @@ const designSystemStories: readonly PackDefinition[] = [
622
637
  // its cell is empty rather than a full IRI.
623
638
  ' BIND(REPLACE(REPLACE(STR(?coordinate), "^.*[/#]", ""), "^coordinate[.]", "") AS ?position)',
624
639
  "}",
625
- "GROUP BY ?resolved ?symbol ?position ?value ?derivedFrom",
640
+ "GROUP BY ?resolved ?symbol ?position ?value ?derivedFrom ?symbolUri",
626
641
  "ORDER BY ?symbol ?position",
627
642
  ].join("\n"),
628
643
  columns: [
629
- { field: "symbol", label: "Symbol" },
644
+ { field: "symbol", label: "Symbol", noun: "token" },
630
645
  { field: "position", label: "Position" },
631
646
  { field: "value", label: "Value" },
632
647
  { field: "chain", label: "Chain" },
@@ -636,14 +651,8 @@ const designSystemStories: readonly PackDefinition[] = [
636
651
  {
637
652
  param: "symbol",
638
653
  variable: "symbol",
639
- vocabulary: {
640
- query: [
641
- "SELECT DISTINCT ?symbol WHERE {",
642
- " ?s a dt:TokenSymbol ;",
643
- " rdfs:label ?symbol .",
644
- "}",
645
- ].join("\n"),
646
- },
654
+ noun: "token",
655
+ entity: "symbolUri",
647
656
  description: "Filter to one symbol.",
648
657
  },
649
658
  {
@@ -672,7 +681,7 @@ const designSystemStories: readonly PackDefinition[] = [
672
681
  emptyRecovery: {
673
682
  message:
674
683
  "Resolved token values come from the @canonical/token-ontology pack, and a value is only addressable by symbol once that pack publishes its name literals — a store built without that pack carries none.",
675
- cli: "sources update",
684
+ call: { verb: "sources update" },
676
685
  },
677
686
  },
678
687
  {
@@ -680,7 +689,10 @@ const designSystemStories: readonly PackDefinition[] = [
680
689
  description:
681
690
  "List which blocks consume which token symbol, at which style key, state and rank.",
682
691
  toolDescription:
683
- 'List the token BINDINGS the design system records — which block consumes which symbol, at which style key, state, rank and node. Every column is identity: two bindings differing only in state are different facts. The block is the CONSUMING block; via names the block whose anatomy the binding was authored in, and is blank when that is the consuming block itself. Name the symbol by its dotted name (symbol) or by a CSS variable standing for it (variable). Answers empty until the packs record bindings. Example: token_consumers { variable: "color-text" }.',
692
+ "List the token BINDINGS the design system records — which block consumes which symbol, at which style key, state, rank and node. Every column is identity: two bindings differing only in state are different facts. The block is the CONSUMING block; via names the block whose anatomy the binding was authored in, and is blank when that is the consuming block itself. Name the symbol by its dotted name (symbol) or by a CSS variable standing for it (variable); narrow to the components a name reaches, or to one by IRI, with block. Answers empty until the packs record bindings.",
693
+ useWhen:
694
+ "when asked which components use a token, or what changing one affects",
695
+ example: { symbol: ["color.text", "color.border"] },
684
696
  // Seven identity columns, and not one of them is decoration: a binding
685
697
  // is identified by the whole tuple, so dropping `rank` or `node` would
686
698
  // publish rows a caller cannot tell apart — which is worse than a wide
@@ -707,7 +719,7 @@ const designSystemStories: readonly PackDefinition[] = [
707
719
  // because "Button via Button" is not news and 24 of Button's rows
708
720
  // would say it.
709
721
  query: [
710
- "SELECT ?block ?via ?symbol ?key ?state ?rank ?node ?uri",
722
+ "SELECT ?block ?via ?symbol ?key ?state ?rank ?node ?uri ?blockUri ?symbolUri",
711
723
  ' (GROUP_CONCAT(DISTINCT ?variableName; SEPARATOR=" ") AS ?variable)',
712
724
  "WHERE {",
713
725
  " ?blockUri ds:hasTokenBinding ?uri .",
@@ -719,13 +731,9 @@ const designSystemStories: readonly PackDefinition[] = [
719
731
  " OPTIONAL { ?uri ds:node ?node }",
720
732
  " OPTIONAL { ?uri ds:viaBlock ?viaUri . OPTIONAL { ?viaUri ds:name ?viaName } }",
721
733
  " OPTIONAL { ?blockUri ds:name ?blockName }",
722
- // Every platform spelling of the consumed symbol, as a SET rather
723
- // than a join that multiplies the row: 204 symbols carry both a
724
- // kebab and a camelCase variable, and binding one row per variable
725
- // would publish each binding twice under names a caller cannot tell
726
- // apart. Aggregated, both spellings land in one cell and `--variable`
727
- // set-matches either — which is also why the two spellings of one
728
- // symbol return the SAME set rather than partitioning it.
734
+ // The variable standing for the consumed symbol, as a SET rather
735
+ // than a join: a second platform's variable must add a name to the
736
+ // cell, not a second row for one binding.
729
737
  " OPTIONAL {",
730
738
  " ?variableUri dt:ofSymbol ?symbolUri ;",
731
739
  " rdfs:label ?variableName .",
@@ -740,7 +748,7 @@ const designSystemStories: readonly PackDefinition[] = [
740
748
  ' COALESCE(?viaName, REPLACE(STR(?viaUri), "^.*[/#]", "")),',
741
749
  ' "") AS ?via)',
742
750
  "}",
743
- "GROUP BY ?block ?via ?symbol ?key ?state ?rank ?node ?uri",
751
+ "GROUP BY ?block ?via ?symbol ?key ?state ?rank ?node ?uri ?blockUri ?symbolUri",
744
752
  // `?via` second, so a block's OWN bindings (blank via, which sorts
745
753
  // first) come before the ones it inherits, and the inherited ones
746
754
  // stay grouped by the block they come from.
@@ -758,66 +766,41 @@ const designSystemStories: readonly PackDefinition[] = [
758
766
  // in; a story cannot reorder that, so the column goes rather than the
759
767
  // block staying second to an unusable id.
760
768
  columns: [
761
- { field: "block", label: "Block" },
769
+ { field: "block", label: "Block", noun: "block" },
762
770
  { field: "via", label: "Via" },
763
- { field: "symbol", label: "Symbol" },
764
- { field: "variable", label: "Variables" },
771
+ { field: "symbol", label: "Symbol", noun: "token" },
772
+ { field: "variable", label: "Variables", noun: "variable" },
765
773
  { field: "key", label: "Style key" },
766
774
  { field: "state", label: "State" },
767
775
  { field: "rank", label: "Rank" },
768
776
  { field: "node", label: "Node" },
769
777
  ],
770
778
  filters: [
779
+ {
780
+ param: "block",
781
+ variable: "block",
782
+ // By IRI, because a block name is not an address: 313 blocks
783
+ // share some 277 names. A name means every block it reaches, in
784
+ // every tier; a prefixed IRI means one.
785
+ noun: "block",
786
+ entity: "blockUri",
787
+ description:
788
+ "Filter to the blocks a name reaches (every tier), or to one block by IRI.",
789
+ },
771
790
  {
772
791
  param: "symbol",
773
792
  variable: "symbol",
774
- vocabulary: {
775
- query: [
776
- "SELECT DISTINCT ?symbol WHERE {",
777
- " ?s a dt:TokenSymbol ;",
778
- " rdfs:label ?symbol .",
779
- "}",
780
- ].join("\n"),
781
- },
793
+ noun: "token",
794
+ entity: "symbolUri",
782
795
  description: "Filter to one symbol.",
783
796
  },
784
797
  {
785
798
  param: "variable",
786
799
  variable: "variable",
787
- // The SAME constraint as `--symbol`, named by the other spelling.
788
- // A web implementer holds a CSS custom-property name, not a dotted
789
- // symbol, so answering "what breaks if I change --color-text" used
790
- // to take two calls and a spelling the caller did not start with.
791
- // The join is in the query instead.
792
- //
793
- // `set`, because the cell is every platform spelling of the
794
- // consumed symbol and one row legitimately belongs to all of them.
795
- match: "set",
796
- // The variable labels, the same source `variable lookup` resolves
797
- // against — so a name that works there works here.
798
- vocabulary: {
799
- query: [
800
- "SELECT DISTINCT ?variable WHERE {",
801
- " ?v a dt:Variable ;",
802
- " rdfs:label ?variable .",
803
- "}",
804
- ].join("\n"),
805
- },
806
- // Two things a caller will otherwise assume, both wrong.
807
- //
808
- // A CHANNEL variable and its semantic sibling are DIFFERENT
809
- // constraints: `--variable modifier-color-text` finds the blocks
810
- // that bind the channel, `--variable color-text` those that bind
811
- // the symbol, and neither includes the other. Whether a block's
812
- // resolution eventually reaches the other through a fallback is a
813
- // question about the consumed list, not about this single-symbol
814
- // join, and blurring them here would answer a question nobody
815
- // asked with rows nobody can check.
816
- //
817
- // And a variable standing for NO symbol has no answer down this
818
- // path at all — 236 of them do — which is an empty answer for a
819
- // reason the recovery below names, not evidence that nothing
820
- // consumes it.
800
+ // Constrains the SYMBOL, through any variable standing for it.
801
+ noun: "variable",
802
+ entity: "symbolUri",
803
+ via: "^dt:ofSymbol",
821
804
  description:
822
805
  "A CSS variable name for the consumed symbol — the other spelling of the symbol parameter. A channel variable and its semantic sibling differ.",
823
806
  },
@@ -871,20 +854,10 @@ const designSystemStories: readonly PackDefinition[] = [
871
854
  variables: ["block", "via", "symbol", "key", "state", "node"],
872
855
  description: "Search block, via, symbol, key, state and node.",
873
856
  },
874
- // Deliberately `sources update`: unlike `standard list`, this story's
875
- // data does NOT ride the embedded snapshot — the binding records are
876
- // written by the design-system packs, so an empty answer here can be a
877
- // store that predates them.
878
- //
879
- // CAN be, not is — which is why the message opens on the two cases
880
- // rather than asserting one. This text prints under a filtered miss too
881
- // (`--symbol color.text`), where "nothing is recorded at all" would be a
882
- // claim the answer cannot support, so it names both readings and hands
883
- // the reader the one command that separates them.
884
857
  emptyRecovery: {
885
858
  message:
886
- "Either no component uses this token, or no component is recorded as using any token yet — which components use which tokens comes from the component anatomies in the design-system document, and a copy of the graph built before any anatomy named its tokens is empty for every token. Run the same command without `--symbol` to tell the two apart: an empty unfiltered answer means the graph predates the anatomies and fills in once they are written and the graph is rebuilt. If you asked about a CSS variable rather than a token: some variables are computed from others (the `--hover--…` and `--disabled--…` ones, for example) and stand for no token, so nothing is ever recorded as using them; `pragma variable chain --variable <name>` shows what such a variable ends up as.",
887
- cli: "sources update",
859
+ "Which components use which tokens is recorded from the component anatomies, and not every component's anatomy names its tokens yet, so a component with no rows may simply not be recorded. A CSS variable computed from others (the `--hover--…` and `--disabled--…` ones, for example) stands for no token and is never recorded as used; the variable chain read shows what it ends up as. If this list is empty with no filter at all, the graph predates the anatomies and a rebuild fills it in.",
860
+ call: { verb: "sources update" },
888
861
  },
889
862
  },
890
863
  ],
@@ -899,13 +872,17 @@ const designSystemStories: readonly PackDefinition[] = [
899
872
  description:
900
873
  "Look up one or more token symbols by dotted name, IRI, or glob.",
901
874
  toolDescription:
902
- 'Get one design-token symbol in full: its own type and description, every definition behind it with that definition\'s own type and description, the modifier families that may rebind it, and the value it resolves to at each position. Address it by the dotted name token_list publishes (`color.text`), by prefixed name, by IRI, or by a glob. Example: token_lookup { name: ["color.text"] }.',
875
+ "Get one design-token symbol in full: its own type and description, every definition behind it with that definition's own type and description, the modifier families that may rebind it, and the value it resolves to at each position. Address it by the dotted name token_list publishes (`color.text`), by prefixed name, by IRI, or by a glob.",
876
+ useWhen:
877
+ "when asked everything about one token by name: where it is defined, what can change it, and its values",
878
+ example: { name: ["color.text", "color.border"] },
903
879
  fields: [
904
880
  // Single-valued: a channel provisions exactly one symbol.
905
881
  {
906
882
  name: "channelOf",
907
883
  property: "dt:channelOf/rdfs:label",
908
884
  label: "Channel of",
885
+ noun: "token",
909
886
  },
910
887
  // The same pair `token list` publishes, reached the same way: the head
911
888
  // of a resolved value's chain is the definition that value was authored
@@ -935,10 +912,22 @@ const designSystemStories: readonly PackDefinition[] = [
935
912
  },
936
913
  ],
937
914
  expand: [
915
+ {
916
+ name: "variables",
917
+ heading: "CSS variables",
918
+ // Without their leading dashes — the address `variable lookup` takes.
919
+ // Tokens whose name has a capital carry an older camelCase twin
920
+ // variable until canonical/design-tokens#141 lands.
921
+ relation: "^dt:ofSymbol",
922
+ level: "summary",
923
+ orderBy: ["name"],
924
+ select: [{ name: "name", property: "rdfs:label", noun: "variable" }],
925
+ },
938
926
  {
939
927
  name: "definitions",
940
928
  heading: "Definitions",
941
929
  kind: "table",
930
+ level: "standard",
942
931
  // The inverse edge: definitions point AT the symbol
943
932
  // (`?definition dt:symbol ?uri`), so the relation from the symbol is
944
933
  // `^dt:symbol`. 1,311 definitions stand behind 745 symbols.
@@ -952,17 +941,30 @@ const designSystemStories: readonly PackDefinition[] = [
952
941
  {
953
942
  name: "coverage",
954
943
  heading: "Covered by",
944
+ level: "standard",
955
945
  // Coverage hangs on the FAMILY, not on the symbol
956
946
  // (`?family dt:covers ?symbol`), so this is the inverse too. The
957
947
  // family is a `ds:` entity, so its name comes from the
958
948
  // design-system pack rather than the token ontology.
959
949
  relation: "^dt:covers",
960
- select: [{ name: "family", property: "ds:name" }],
950
+ select: [{ name: "family", property: "ds:name", noun: "modifier" }],
951
+ },
952
+ {
953
+ name: "channels",
954
+ heading: "Channels",
955
+ level: "standard",
956
+ // The symbols that provision this one, at most two. What a channel
957
+ // derives from at each position is that channel's own `values`
958
+ // table: a second hop here would repeat each channel once per
959
+ // position.
960
+ relation: "^dt:channelOf",
961
+ select: [{ name: "name", property: "rdfs:label", noun: "token" }],
961
962
  },
962
963
  {
963
964
  name: "values",
964
965
  heading: "Values",
965
966
  kind: "table",
967
+ level: "standard",
966
968
  relation: "^dt:forSymbol",
967
969
  // BOTH the chain and the derivation, for the reason `token values`
968
970
  // states: the shape admits exactly one of them, and selecting only
@@ -983,14 +985,24 @@ const designSystemStories: readonly PackDefinition[] = [
983
985
  { name: "position", property: "dt:coordinate" },
984
986
  { name: "value", property: "dt:resolvesTo" },
985
987
  { name: "chain", property: "dt:resolutionChain/rdf:first" },
986
- { name: "derivedFrom", property: "dt:derivedFrom/rdfs:label" },
988
+ {
989
+ name: "derivedFrom",
990
+ property: "dt:derivedFrom/rdfs:label",
991
+ noun: "token",
992
+ },
987
993
  ],
988
994
  },
989
995
  ],
996
+ disclosure: {
997
+ levels: ["summary", "standard", "detailed"],
998
+ default: "detailed",
999
+ },
990
1000
  sample: {
991
1001
  fixedCount: true,
992
1002
  toolDescription:
993
- "Return random complete design-token symbols — definitions, coverage and resolved values — as exemplars. Use BEFORE writing queries to see real data shapes. Example: token_sample {}.",
1003
+ "Return random complete design-token symbols — definitions, coverage and resolved values — as exemplars.",
1004
+ useWhen:
1005
+ "before your first token query, to see what a real token record looks like",
994
1006
  },
995
1007
  },
996
1008
  },
@@ -1018,15 +1030,18 @@ const designSystemStories: readonly PackDefinition[] = [
1018
1030
  description:
1019
1031
  "List the platform variables the design tokens are emitted as.",
1020
1032
  toolDescription:
1021
- 'List the platform VARIABLES a stylesheet declares as CSS custom properties, with the symbol each stands for, its tier, visibility and the coordinates it is selected at. 236 stand for no symbol, so token_list cannot reach them. Address one WITHOUT its leading dashes (`color-text`). Example: variable_list { symbol: "color.text" }.',
1033
+ "List the platform VARIABLES a stylesheet declares as CSS custom properties, with the symbol each stands for, its tier, visibility and the coordinates it is selected at. 236 stand for no symbol, so token_list cannot reach them. Address one WITHOUT its leading dashes (`color-text`).",
1034
+ useWhen:
1035
+ "when asked which CSS custom properties (variables) exist, or which CSS variable stands for a token",
1036
+ example: { symbol: ["color.text", "color.border"] },
1022
1037
  list: {
1023
1038
  query: [
1024
- "SELECT ?uri ?name ?platform ?symbol ?tier ?visibility",
1039
+ "SELECT ?uri ?name ?platform ?symbol ?tier ?visibility ?symbolUri",
1025
1040
  ' (GROUP_CONCAT(DISTINCT ?coordinateName; SEPARATOR=" ") AS ?coordinate)',
1026
1041
  "WHERE {",
1027
1042
  " ?uri a dt:Variable ;",
1028
1043
  " rdfs:label ?name .",
1029
- " OPTIONAL { ?uri dt:ofSymbol/rdfs:label ?symbol }",
1044
+ " OPTIONAL { ?uri dt:ofSymbol ?symbolUri . ?symbolUri rdfs:label ?symbol }",
1030
1045
  " OPTIONAL { ?uri dt:tier ?tierUri }",
1031
1046
  " OPTIONAL { ?uri dt:visibility ?visibilityUri }",
1032
1047
  // A variable is selected at a coordinate two ways, and both count: the
@@ -1049,12 +1064,12 @@ const designSystemStories: readonly PackDefinition[] = [
1049
1064
  ' BIND(REPLACE(REPLACE(STR(?tierUri), "^.*[/#]", ""), "^tier[.]", "") AS ?tier)',
1050
1065
  ' BIND(REPLACE(REPLACE(STR(?visibilityUri), "^.*[/#]", ""), "^visibility[.]", "") AS ?visibility)',
1051
1066
  "}",
1052
- "GROUP BY ?uri ?name ?platform ?symbol ?tier ?visibility",
1067
+ "GROUP BY ?uri ?name ?platform ?symbol ?tier ?visibility ?symbolUri",
1053
1068
  "ORDER BY ?name",
1054
1069
  ].join("\n"),
1055
1070
  columns: [
1056
1071
  { field: "name", label: "Name" },
1057
- { field: "symbol", label: "Symbol" },
1072
+ { field: "symbol", label: "Symbol", noun: "token" },
1058
1073
  { field: "tier", label: "Tier" },
1059
1074
  { field: "visibility", label: "Visibility" },
1060
1075
  { field: "platform", label: "Platform" },
@@ -1083,16 +1098,8 @@ const designSystemStories: readonly PackDefinition[] = [
1083
1098
  {
1084
1099
  param: "symbol",
1085
1100
  variable: "symbol",
1086
- // The symbol roster, read the same way `token list`'s `channelOf`
1087
- // filter reads it: every symbol, keyed on `rdfs:label`.
1088
- vocabulary: {
1089
- query: [
1090
- "SELECT DISTINCT ?symbol WHERE {",
1091
- " ?s a dt:TokenSymbol ;",
1092
- " rdfs:label ?symbol .",
1093
- "}",
1094
- ].join("\n"),
1095
- },
1101
+ noun: "token",
1102
+ entity: "symbolUri",
1096
1103
  description: "Filter to one symbol.",
1097
1104
  },
1098
1105
  {
@@ -1147,8 +1154,7 @@ const designSystemStories: readonly PackDefinition[] = [
1147
1154
  },
1148
1155
  emptyRecovery: {
1149
1156
  message:
1150
- "Platform variables come from the @canonical/token-ontology pack, and a variable is only addressable once that pack publishes its name literals — a store built without that pack carries none.",
1151
- cli: "sources update",
1157
+ "Some tokens, such as the composite typography ones (`typography.heading.1`), have no CSS variable of their own; the token values read shows their value.",
1152
1158
  },
1153
1159
  },
1154
1160
  verbs: [
@@ -1157,7 +1163,9 @@ const designSystemStories: readonly PackDefinition[] = [
1157
1163
  description:
1158
1164
  "List the walk from a variable to every symbol it reaches, through every variable in between.",
1159
1165
  toolDescription:
1160
- 'List the resolution WALK: every (variable, symbol) pair a variable reaches through what its declarations reference, transitively — what a variable finally means. The closure runs over every declaration of every hop, so one variable can reach dozens of pairs. Example: variable_chain { variable: "modifier-color-text" }.',
1166
+ "List the resolution WALK: every (variable, symbol) pair a variable reaches through what its declarations reference, transitively — what a variable finally means. The closure runs over every declaration of every hop, so one variable can reach dozens of pairs.",
1167
+ useWhen: "when asked which tokens a CSS variable ends up referring to",
1168
+ example: { variable: ["modifier-color-text", "modifier-color-border"] },
1161
1169
  // ONE property path carries the whole walk, which is why this is a
1162
1170
  // query and not a traversal in code. `dt:references` is an rdf:List of
1163
1171
  // the variables a declaration's value reads, so each hop is
@@ -1165,7 +1173,7 @@ const designSystemStories: readonly PackDefinition[] = [
1165
1173
  // the whole thing transitive. The terminal is a variable that stands
1166
1174
  // for a symbol, which is what `dt:ofSymbol` reads.
1167
1175
  query: [
1168
- "SELECT ?variable ?reaches ?symbol",
1176
+ "SELECT ?variable ?reaches ?symbol ?uri ?symbolUri",
1169
1177
  "WHERE {",
1170
1178
  " ?uri a dt:Variable ;",
1171
1179
  " rdfs:label ?variable .",
@@ -1177,47 +1185,30 @@ const designSystemStories: readonly PackDefinition[] = [
1177
1185
  "ORDER BY ?variable ?reaches ?symbol",
1178
1186
  ].join("\n"),
1179
1187
  columns: [
1180
- { field: "variable", label: "Variable" },
1188
+ { field: "variable", label: "Variable", noun: "variable" },
1181
1189
  { field: "reaches", label: "Reaches" },
1182
- { field: "symbol", label: "Symbol" },
1190
+ { field: "symbol", label: "Symbol", noun: "token" },
1183
1191
  ],
1184
1192
  filters: [
1185
1193
  {
1186
1194
  param: "variable",
1187
1195
  variable: "variable",
1188
- // The variable roster, keyed on the same `rdfs:label` the column
1189
- // binds and the lookup resolves by — the CSS name with its leading
1190
- // `--` already stripped, which is the only form typable as a
1191
- // positional. `variable.parity.test.ts` pins that the stripping is
1192
- // injective and collides with no symbol name.
1193
- vocabulary: {
1194
- query: [
1195
- "SELECT DISTINCT ?variable WHERE {",
1196
- " ?v a dt:Variable ;",
1197
- " rdfs:label ?variable .",
1198
- "}",
1199
- ].join("\n"),
1200
- },
1196
+ noun: "variable",
1197
+ entity: "uri",
1201
1198
  description: "Filter to one variable.",
1202
1199
  },
1203
1200
  {
1204
1201
  param: "symbol",
1205
1202
  variable: "symbol",
1206
- vocabulary: {
1207
- query: [
1208
- "SELECT DISTINCT ?symbol WHERE {",
1209
- " ?s a dt:TokenSymbol ;",
1210
- " rdfs:label ?symbol .",
1211
- "}",
1212
- ].join("\n"),
1213
- },
1203
+ noun: "token",
1204
+ entity: "symbolUri",
1214
1205
  description: "Filter to one symbol.",
1215
1206
  },
1216
1207
  ],
1217
1208
  emptyRecovery: {
1218
1209
  message:
1219
1210
  "A resolution walk follows the declarations the @canonical/token-ontology pack provides, and the walk is only addressable by name once that pack publishes its name literals — a store built without that pack carries none.",
1220
- cli: "sources update",
1211
+ call: { verb: "sources update" },
1221
1212
  },
1222
1213
  },
1223
1214
  ],
@@ -1232,9 +1223,17 @@ const designSystemStories: readonly PackDefinition[] = [
1232
1223
  description:
1233
1224
  "Look up one or more platform variables by name (without the leading dashes), IRI, or glob.",
1234
1225
  toolDescription:
1235
- 'Get one platform variable in full: its symbol, tier, visibility, and EVERY place it is declared — the selector and at-rule stack, the emitted value, the source location, the coordinate it also applies at, and the derivation. Address it by the CSS name WITHOUT its leading dashes (`color-text`). Example: variable_lookup { name: ["color-text"] }.',
1226
+ "Get one platform variable in full: its symbol, tier, visibility, and EVERY place it is declared — the selector and at-rule stack, the emitted value, the source location, the coordinate it also applies at, and the derivation. Address it by the CSS name WITHOUT its leading dashes (`color-text`).",
1227
+ useWhen:
1228
+ "when asked about one CSS variable by name: what it stands for and everywhere it is declared",
1229
+ example: { name: ["color-text", "color-border"] },
1236
1230
  fields: [
1237
- { name: "symbol", property: "dt:ofSymbol/rdfs:label", label: "Symbol" },
1231
+ {
1232
+ name: "symbol",
1233
+ property: "dt:ofSymbol/rdfs:label",
1234
+ label: "Symbol",
1235
+ noun: "token",
1236
+ },
1238
1237
  { name: "tier", property: "dt:tier", label: "Tier" },
1239
1238
  { name: "visibility", property: "dt:visibility", label: "Visibility" },
1240
1239
  ],
@@ -1244,6 +1243,7 @@ const designSystemStories: readonly PackDefinition[] = [
1244
1243
  heading: "Declarations",
1245
1244
  kind: "table",
1246
1245
  relation: "dt:declaredAt",
1246
+ level: "standard",
1247
1247
  // 927 variables are declared once; the rest up to 17 times, which is
1248
1248
  // why this is an expand and not a set of fields.
1249
1249
  select: [
@@ -1267,11 +1267,39 @@ const designSystemStories: readonly PackDefinition[] = [
1267
1267
  { name: "derives", property: "dt:derives" },
1268
1268
  ],
1269
1269
  },
1270
+ {
1271
+ name: "values",
1272
+ heading: "Values",
1273
+ kind: "table",
1274
+ // What the variable's symbol resolves to, one row per position the
1275
+ // graph materialises: the base row has no position, a channel's rows
1276
+ // carry the symbol each position derives from and no value. A
1277
+ // declaration's `emits` is the stylesheet's expression; this is the
1278
+ // value that expression comes to.
1279
+ relation: "dt:ofSymbol/^dt:forSymbol",
1280
+ level: "detailed",
1281
+ orderBy: ["position"],
1282
+ select: [
1283
+ { name: "position", property: "dt:coordinate" },
1284
+ { name: "value", property: "dt:resolvesTo" },
1285
+ {
1286
+ name: "derivedFrom",
1287
+ property: "dt:derivedFrom/rdfs:label",
1288
+ noun: "token",
1289
+ },
1290
+ ],
1291
+ },
1270
1292
  ],
1293
+ disclosure: {
1294
+ levels: ["summary", "standard", "detailed"],
1295
+ default: "detailed",
1296
+ },
1271
1297
  sample: {
1272
1298
  fixedCount: true,
1273
1299
  toolDescription:
1274
- "Return random complete platform variables — symbol, tier, visibility and every declaration — as exemplars. Use BEFORE writing queries to see real data shapes. Example: variable_sample {}.",
1300
+ "Return random complete platform variables — symbol, tier, visibility and every declaration — as exemplars.",
1301
+ useWhen:
1302
+ "before your first variable query, to see what a real CSS variable record looks like",
1275
1303
  },
1276
1304
  },
1277
1305
  },
@@ -1284,8 +1312,10 @@ const designSystemStories: readonly PackDefinition[] = [
1284
1312
  {
1285
1313
  noun: "modifier",
1286
1314
  description: "List all modifier families.",
1287
- toolDescription:
1288
- "List all modifier families with their values. Use when browsing which modifier families exist and the values each allows. Example: modifier_list {}.",
1315
+ toolDescription: "List all modifier families with their values.",
1316
+ useWhen:
1317
+ "when asked which variants or options components can take — importance, size, density and the like — and the values each allows",
1318
+ example: { tier: "all" },
1289
1319
  // Tiered like blocks — 11 of the modifier families carry a `ds:tier` — so
1290
1320
  // the same scope, declared with the same four terms. The scope is per NOUN
1291
1321
  // because being tiered is a fact about the entities, and the design
@@ -1319,7 +1349,7 @@ const designSystemStories: readonly PackDefinition[] = [
1319
1349
  emptyRecovery: {
1320
1350
  message:
1321
1351
  "No modifier families in the store. Build it from the configured design-system packs.",
1322
- cli: "sources update",
1352
+ call: { verb: "sources update" },
1323
1353
  },
1324
1354
  },
1325
1355
  lookup: {
@@ -1327,19 +1357,80 @@ const designSystemStories: readonly PackDefinition[] = [
1327
1357
  by: "ds:name",
1328
1358
  type: "ds:ModifierFamily",
1329
1359
  toolDescription:
1330
- 'Get values and usage details for one or more modifier families by name. Use when you need the allowed values of specific families. Example: modifier_lookup { name: ["importance"] }.',
1360
+ "Get values and usage details for one or more modifier families by name.",
1361
+ useWhen:
1362
+ "when asked which values one option allows, such as the levels of importance",
1363
+ example: { name: ["Importance", "Density"] },
1331
1364
  expand: [
1332
1365
  {
1333
1366
  name: "values",
1334
1367
  heading: "Values",
1335
1368
  relation: "ds:hasModifier",
1369
+ level: "standard",
1336
1370
  select: [{ name: "name", property: "ds:name" }],
1337
1371
  },
1372
+ // The token side of the family, joined on the family's own IRI — an
1373
+ // axis is not named after its family (`theme` encodes Mode). SPARQL
1374
+ // lane: three of the four start on an inverse edge, which a generated
1375
+ // document cannot walk.
1376
+ {
1377
+ name: "axis",
1378
+ heading: "Token axis",
1379
+ relation: "^dt:encodes",
1380
+ source: "sparql",
1381
+ level: "standard",
1382
+ select: [{ name: "name", property: "w3c-tokens:name" }],
1383
+ },
1384
+ {
1385
+ name: "positions",
1386
+ heading: "Positions",
1387
+ kind: "table",
1388
+ relation: "^dt:encodes/w3c-tokens:context",
1389
+ source: "sparql",
1390
+ level: "standard",
1391
+ orderBy: ["context"],
1392
+ select: [
1393
+ { name: "context", property: "w3c-tokens:name" },
1394
+ { name: "position", property: "dt:encodes" },
1395
+ { name: "value", property: "dt:encodes/dt:concept/ds:name" },
1396
+ ],
1397
+ },
1398
+ {
1399
+ name: "contract",
1400
+ heading: "Token contract",
1401
+ kind: "table",
1402
+ relation: "dt:contract",
1403
+ source: "sparql",
1404
+ level: "standard",
1405
+ select: [
1406
+ { name: "level", property: "dt:level" },
1407
+ { name: "provision", property: "dt:provision" },
1408
+ { name: "providesType", property: "dt:providesType" },
1409
+ ],
1410
+ },
1411
+ {
1412
+ name: "tokens",
1413
+ heading: "Covered tokens",
1414
+ // The symbols a value of this family may rebind. A block can declare
1415
+ // the family and consume none of them; `token consumers` says which
1416
+ // do. At `detailed` only: Mode covers 354 of them.
1417
+ relation: "dt:covers",
1418
+ source: "sparql",
1419
+ level: "detailed",
1420
+ orderBy: ["name"],
1421
+ select: [{ name: "name", property: "rdfs:label", noun: "token" }],
1422
+ },
1338
1423
  ],
1424
+ disclosure: {
1425
+ levels: ["summary", "standard", "detailed"],
1426
+ default: "detailed",
1427
+ },
1339
1428
  sample: {
1340
1429
  fixedCount: true,
1341
1430
  toolDescription:
1342
- "Return randomly selected complete modifier families (with value lists) as exemplars. Use BEFORE writing queries to see actual data shapes. Example: modifier_sample {}.",
1431
+ "Return randomly selected complete modifier families (with value lists) as exemplars.",
1432
+ useWhen:
1433
+ "before your first modifier query, to see what a real modifier family record looks like",
1343
1434
  },
1344
1435
  },
1345
1436
  },
@@ -1356,7 +1447,9 @@ const designSystemStories: readonly PackDefinition[] = [
1356
1447
  noun: "tier",
1357
1448
  description: "List all tiers in the design system ontology.",
1358
1449
  toolDescription:
1359
- "List all tiers in the design-system ontology. Use when picking the tier to read with: the `tier` parameter scopes a read to one tier plus its ancestors, and this list is never scoped itself. Example: tier_list {}.",
1450
+ "List all tiers in the design-system ontology. The `tier` parameter scopes a read to one tier plus its ancestors, and this list is never scoped itself.",
1451
+ useWhen:
1452
+ "when asked which tiers the design system has — global, apps, a single product — or before passing `tier` to another tool",
1360
1453
  list: {
1361
1454
  query: [
1362
1455
  "SELECT ?uri ?name WHERE {",
@@ -1375,7 +1468,9 @@ const designSystemStories: readonly PackDefinition[] = [
1375
1468
  type: "ds:Tier",
1376
1469
  description: "Show tiers by name, with the blocks scoped to each.",
1377
1470
  toolDescription:
1378
- 'Get one or more tiers by name, with the blocks scoped directly to each. Use when you need which blocks a specific tier carries. Example: tier_lookup { name: ["apps/lxd"] }.',
1471
+ "Get one or more tiers by name, with the blocks scoped directly to each.",
1472
+ useWhen: "when asked which components belong to one tier or product",
1473
+ example: { name: ["apps/lxd", "global"] },
1379
1474
  expand: [
1380
1475
  {
1381
1476
  name: "blocks",
@@ -1399,7 +1494,10 @@ const conceptStory: PackDefinition = {
1399
1494
  noun: "concept",
1400
1495
  description: "List design-system concepts.",
1401
1496
  toolDescription:
1402
- 'List design-system concepts — long-form foundations, how-to guides, and decision guides not bound to a single UI block. Optionally filter by type or search. Example: concept_list { type: "Explanation" }.',
1497
+ "List design-system concepts — long-form foundations, how-to guides, and decision guides not bound to a single UI block. Optionally filter by type or search.",
1498
+ useWhen:
1499
+ "when asked for design guidance that is not about one component — foundations, how-to guides, decision guides",
1500
+ example: { type: ["Explanation", "How to guide"] },
1403
1501
  // Concepts carry a `ds:tier` too (4 of them do), so they are scoped on the
1404
1502
  // same terms as blocks and modifier families. Its `list` publishes no tier
1405
1503
  // COLUMN and does not need to: the scope constrains the entity through
@@ -1455,7 +1553,7 @@ const conceptStory: PackDefinition = {
1455
1553
  emptyRecovery: {
1456
1554
  message:
1457
1555
  "Concepts come from the @canonical/design-system pack, and a local store built without it carries none — refresh it.",
1458
- cli: "sources update",
1556
+ call: { verb: "sources update" },
1459
1557
  },
1460
1558
  },
1461
1559
  lookup: {
@@ -1465,7 +1563,9 @@ const conceptStory: PackDefinition = {
1465
1563
  description:
1466
1564
  "Look up a concept's full documentation by name, IRI, or glob.",
1467
1565
  toolDescription:
1468
- 'Get a design-system concept\'s full Markdown documentation. Address concepts by the name concept_list publishes, by prefixed name (ds:concept.…), by absolute IRI, or by a glob. Example: concept_lookup { name: ["Foundations: Grid"] }.',
1566
+ "Get a design-system concept's full Markdown documentation. Address concepts by the name concept_list publishes, by prefixed name (ds:concept.…), by absolute IRI, or by a glob.",
1567
+ useWhen: "when asked to read one guide or foundation in full",
1568
+ example: { name: ["Foundations: Spacing", "Foundations: Surfaces"] },
1469
1569
  fields: [
1470
1570
  { name: "type", property: "ds:conceptType/ds:name", label: "Type" },
1471
1571
  { name: "tier", property: "ds:tier", label: "Tier" },
@@ -1516,7 +1616,10 @@ const implementationStory: PackDefinition = {
1516
1616
  noun: "implementation",
1517
1617
  description: "List which library implements which design-system block.",
1518
1618
  toolDescription:
1519
- 'List the implementations of design-system blocks — which library implements which block, on which platform, and the source file it lives in. Optionally filter by platform or library, or search. Example: implementation_list { platform: "react" }.',
1619
+ "List the implementations of design-system blocks — which library implements which block, on which platform, and the source file it lives in. Optionally filter by platform or library, or search.",
1620
+ useWhen:
1621
+ "when asked whether a component is implemented in React, Svelte or another library, or where its source code lives",
1622
+ example: { platform: ["react", "svelte"] },
1520
1623
  list: {
1521
1624
  // The library is the subject that carries the platform, so the row is
1522
1625
  // assembled from BOTH ends of `ds:hasImplementation`. `?block` prefers the
@@ -1584,7 +1687,7 @@ const implementationStory: PackDefinition = {
1584
1687
  emptyRecovery: {
1585
1688
  message:
1586
1689
  "Implementations come from the @canonical/ds-implementations pack, and a local store built without it carries none — refresh it.",
1587
- cli: "sources update",
1690
+ call: { verb: "sources update" },
1588
1691
  },
1589
1692
  },
1590
1693
  verbs: [
@@ -1592,7 +1695,9 @@ const implementationStory: PackDefinition = {
1592
1695
  verb: "libraries",
1593
1696
  description: "List the implementation libraries.",
1594
1697
  toolDescription:
1595
- "List the design-system implementation libraries — platform, tier, released version, and how many blocks each one implements. Example: implementation_libraries {}.",
1698
+ "List the design-system implementation libraries — platform, tier, released version, and how many blocks each one implements.",
1699
+ useWhen:
1700
+ "when asked which component libraries exist and what each covers",
1596
1701
  // `ds:implementationCount` is asserted by the aggregate index on the SAME
1597
1702
  // subject the per-library file describes, so the two merge in the store
1598
1703
  // and the count needs no aggregation here.
@@ -1620,7 +1725,7 @@ const implementationStory: PackDefinition = {
1620
1725
  emptyRecovery: {
1621
1726
  message:
1622
1727
  "No implementation libraries in the store. The @canonical/ds-implementations pack provides them; refresh the local store.",
1623
- cli: "sources update",
1728
+ call: { verb: "sources update" },
1624
1729
  },
1625
1730
  },
1626
1731
  ],
@@ -1640,7 +1745,10 @@ const codeStandardsStories: readonly PackDefinition[] = [
1640
1745
  noun: "standard",
1641
1746
  description: "List all code standards.",
1642
1747
  toolDescription:
1643
- 'List code standards: one ROW per standard — its IRI, name, category and description — not the standards themselves. Take a row\'s `name` VERBATIM to standard_lookup for the dos and donts. Optionally filter by category slug (a parent slug answers for its whole branch; standard_categories lists them) or by search term. Example: standard_list { category: "react" }.',
1748
+ "List code standards: one ROW per standard — its IRI, name, category and description — not the standards themselves. Take a row's `name` VERBATIM to standard_lookup for the dos and donts. Optionally filter by category slug (a parent slug answers for its whole branch; standard_categories lists them) or by search term.",
1749
+ useWhen:
1750
+ "when asked which coding rules or conventions apply — for React, CSS, testing, documentation and so on",
1751
+ example: { category: ["react", "css"] },
1644
1752
  list: {
1645
1753
  query: [
1646
1754
  // `?category` is the LEAF a standard is filed under — what a row
@@ -1723,7 +1831,7 @@ const codeStandardsStories: readonly PackDefinition[] = [
1723
1831
  emptyRecovery: {
1724
1832
  message:
1725
1833
  "Category slugs come from the graph, and a parent slug answers for its whole branch — read them out rather than guessing.",
1726
- cli: "standard categories",
1834
+ call: { verb: "standard categories" },
1727
1835
  },
1728
1836
  },
1729
1837
  verbs: [
@@ -1732,7 +1840,8 @@ const codeStandardsStories: readonly PackDefinition[] = [
1732
1840
  description:
1733
1841
  "List all standard categories with counts (a parent counts its whole branch).",
1734
1842
  toolDescription:
1735
- "List all code standard categories with the number of standards each covers. Categories are a hierarchy: a parent's count includes every descendant, and `standard_list { category }` answers for the same set. Use this to pick a valid slug before filtering. Example: standard_categories {}.",
1843
+ "List all code standard categories with the number of standards each covers. Categories are a hierarchy: a parent's count includes every descendant, and `standard_list { category }` answers for the same set. Use this to pick a valid slug before filtering.",
1844
+ useWhen: "when asked which areas the code standards cover",
1736
1845
  query: [
1737
1846
  // The same reflexive roll-up `list` filters with — written the other
1738
1847
  // way round (every category whose broader-chain reaches ?cat), so the
@@ -1762,7 +1871,7 @@ const codeStandardsStories: readonly PackDefinition[] = [
1762
1871
  emptyRecovery: {
1763
1872
  message:
1764
1873
  "The code standards ship with the CLI itself, so no categories at all means the store did not load — not that it is out of date.",
1765
- cli: "doctor",
1874
+ call: { verb: "doctor" },
1766
1875
  },
1767
1876
  },
1768
1877
  ],
@@ -1805,7 +1914,12 @@ const codeStandardsStories: readonly PackDefinition[] = [
1805
1914
  description:
1806
1915
  "Look up one or more standards by name, IRI, or glob. --detail standard adds the dos, --detail detailed adds the don'ts.",
1807
1916
  toolDescription:
1808
- 'Get one or more code standards in full, with dos and don\'ts as code examples. `detail` DEFAULTS to "summary", which returns neither: pass detail: "standard" for the dos and detail: "detailed" for dos AND don\'ts. Address a standard by the name standard_list publishes (`react/component/tsdoc`), by prefixed name (`cs:react.component.tsdoc`), by absolute IRI, or by a glob over any of those. Example: standard_lookup { name: ["react/component/tsdoc"], detail: "detailed" }.',
1917
+ 'Get one or more code standards in full, with dos and don\'ts as code examples. `detail` DEFAULTS to "summary", which returns neither: pass detail: "standard" for the dos and detail: "detailed" for dos AND don\'ts. Address a standard by the name standard_list publishes (`react/component/tsdoc`), by prefixed name (`cs:react.component.tsdoc`), by absolute IRI, or by a glob over any of those.',
1918
+ useWhen: "when asked how code should be written under one rule",
1919
+ example: {
1920
+ name: ["cs:react.component.tsdoc", "cs:react.component.props"],
1921
+ detail: "detailed",
1922
+ },
1809
1923
  fields: [
1810
1924
  {
1811
1925
  name: "category",
@@ -1851,7 +1965,10 @@ const codeStandardsStories: readonly PackDefinition[] = [
1851
1965
  description:
1852
1966
  "Return randomly selected complete standard instances as exemplars for shape discovery.",
1853
1967
  toolDescription:
1854
- "Return 1–5 randomly selected complete code standard instances as exemplars. Use BEFORE writing queries to see actual data shapes, property names, and value formats. Each call returns different instances. Example: standard_sample { count: 2 }.",
1968
+ "Return 1–5 randomly selected complete code standard instances as exemplars. Each call returns different instances.",
1969
+ useWhen:
1970
+ "before your first standards query, to see what a real code standard record looks like",
1971
+ example: { count: "2" },
1855
1972
  },
1856
1973
  },
1857
1974
  },