@canonical/pragma-cli 0.38.0 → 0.42.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.
- package/README.md +3 -3
- package/dist/package.json +16 -16
- package/dist/pragma.conf.js +273 -176
- package/dist/pragma.conf.js.map +1 -1
- package/dist/src/capabilities/capabilities/capabilities.verb.js +2 -0
- package/dist/src/capabilities/capabilities/capabilities.verb.js.map +1 -1
- package/dist/src/capabilities/capabilities/catalog.js +47 -51
- package/dist/src/capabilities/capabilities/catalog.js.map +1 -1
- package/dist/src/capabilities/capabilities/index.js +2 -0
- package/dist/src/capabilities/capabilities/index.js.map +1 -1
- package/dist/src/capabilities/capabilities/types.js +5 -5
- package/dist/src/capabilities/colophon/colophon.render.js +7 -4
- package/dist/src/capabilities/colophon/colophon.render.js.map +1 -1
- package/dist/src/capabilities/colophon/colophon.verb.js +1 -0
- package/dist/src/capabilities/colophon/colophon.verb.js.map +1 -1
- package/dist/src/capabilities/colophon/markdownTerminal.js.map +1 -1
- package/dist/src/capabilities/config/get.verb.js +2 -0
- package/dist/src/capabilities/config/get.verb.js.map +1 -1
- package/dist/src/capabilities/config/runField.js +2 -2
- package/dist/src/capabilities/config/runField.js.map +1 -1
- package/dist/src/capabilities/config/set.verb.js +2 -0
- package/dist/src/capabilities/config/set.verb.js.map +1 -1
- package/dist/src/capabilities/config/show.render.js.map +1 -1
- package/dist/src/capabilities/config/show.verb.js +1 -0
- package/dist/src/capabilities/config/show.verb.js.map +1 -1
- package/dist/src/capabilities/config/unset.verb.js +2 -0
- package/dist/src/capabilities/config/unset.verb.js.map +1 -1
- package/dist/src/capabilities/create/constants.js +8 -5
- package/dist/src/capabilities/create/constants.js.map +1 -1
- package/dist/src/capabilities/create/create.render.js.map +1 -1
- package/dist/src/capabilities/create/create.verb.js +36 -7
- package/dist/src/capabilities/create/create.verb.js.map +1 -1
- package/dist/src/capabilities/create/createSurface.generated.js +22 -0
- package/dist/src/capabilities/create/createSurface.generated.js.map +1 -1
- package/dist/src/capabilities/create/index.js +1 -1
- package/dist/src/capabilities/create/pickGenerator.js +1 -0
- package/dist/src/capabilities/create/pickGenerator.js.map +1 -1
- package/dist/src/capabilities/distribution.js +3 -1
- package/dist/src/capabilities/distribution.js.map +1 -1
- package/dist/src/capabilities/doctor/checks/checkPackageRefs.js +10 -2
- package/dist/src/capabilities/doctor/checks/checkPackageRefs.js.map +1 -1
- package/dist/src/capabilities/doctor/checks/targetHealth.js.map +1 -1
- package/dist/src/capabilities/doctor/doctor.verb.js +2 -0
- package/dist/src/capabilities/doctor/doctor.verb.js.map +1 -1
- package/dist/src/capabilities/graph/connect.verb.js +2 -0
- package/dist/src/capabilities/graph/connect.verb.js.map +1 -1
- package/dist/src/capabilities/graph/inspect.render.js +7 -1
- package/dist/src/capabilities/graph/inspect.render.js.map +1 -1
- package/dist/src/capabilities/graph/inspect.verb.js +2 -0
- package/dist/src/capabilities/graph/inspect.verb.js.map +1 -1
- package/dist/src/capabilities/graph/query.render.js +37 -5
- package/dist/src/capabilities/graph/query.render.js.map +1 -1
- package/dist/src/capabilities/graph/query.verb.js +2 -0
- package/dist/src/capabilities/graph/query.verb.js.map +1 -1
- package/dist/src/capabilities/graph/queryText.js +28 -0
- package/dist/src/capabilities/graph/queryText.js.map +1 -1
- package/dist/src/capabilities/graph/runConnect.js +3 -3
- package/dist/src/capabilities/graph/runConnect.js.map +1 -1
- package/dist/src/capabilities/graph/runQuery.js +8 -6
- package/dist/src/capabilities/graph/runQuery.js.map +1 -1
- package/dist/src/capabilities/info/info.verb.js +2 -0
- package/dist/src/capabilities/info/info.verb.js.map +1 -1
- package/dist/src/capabilities/meta/mcp.verb.js +1 -0
- package/dist/src/capabilities/meta/mcp.verb.js.map +1 -1
- package/dist/src/capabilities/ontology/verbs.js +7 -10
- package/dist/src/capabilities/ontology/verbs.js.map +1 -1
- package/dist/src/capabilities/prompt/verbs.js +5 -4
- package/dist/src/capabilities/prompt/verbs.js.map +1 -1
- package/dist/src/capabilities/resources/provider.js +6 -3
- package/dist/src/capabilities/resources/provider.js.map +1 -1
- package/dist/src/capabilities/setup/operations/writability.js.map +1 -1
- package/dist/src/capabilities/setup/plan.render.js.map +1 -1
- package/dist/src/capabilities/setup/setup.verb.js +13 -5
- package/dist/src/capabilities/setup/setup.verb.js.map +1 -1
- package/dist/src/capabilities/shared/calls.js +16 -0
- package/dist/src/capabilities/shared/calls.js.map +1 -0
- package/dist/src/capabilities/shared/packageManager.js.map +1 -1
- package/dist/src/capabilities/skill/discover.js.map +1 -1
- package/dist/src/capabilities/skill/render.js +7 -5
- package/dist/src/capabilities/skill/render.js.map +1 -1
- package/dist/src/capabilities/skill/verbs.js +5 -4
- package/dist/src/capabilities/skill/verbs.js.map +1 -1
- package/dist/src/capabilities/sources/collectStatus.js +6 -1
- package/dist/src/capabilities/sources/collectStatus.js.map +1 -1
- package/dist/src/capabilities/sources/index.js +4 -3
- package/dist/src/capabilities/sources/index.js.map +1 -1
- package/dist/src/capabilities/sources/reset.render.js +37 -0
- package/dist/src/capabilities/sources/reset.render.js.map +1 -0
- package/dist/src/capabilities/sources/reset.verb.js +51 -0
- package/dist/src/capabilities/sources/reset.verb.js.map +1 -0
- package/dist/src/capabilities/sources/runReset.js +59 -0
- package/dist/src/capabilities/sources/runReset.js.map +1 -0
- package/dist/src/capabilities/sources/runUpdate.js +7 -6
- package/dist/src/capabilities/sources/runUpdate.js.map +1 -1
- package/dist/src/capabilities/sources/status.render.js +24 -8
- package/dist/src/capabilities/sources/status.render.js.map +1 -1
- package/dist/src/capabilities/sources/status.verb.js +1 -0
- package/dist/src/capabilities/sources/status.verb.js.map +1 -1
- package/dist/src/capabilities/sources/update.verb.js +2 -0
- package/dist/src/capabilities/sources/update.verb.js.map +1 -1
- package/dist/src/capabilities/upgrade/upgrade.verb.js +1 -0
- package/dist/src/capabilities/upgrade/upgrade.verb.js.map +1 -1
- package/dist/src/capabilities/version/version.verb.js +1 -0
- package/dist/src/capabilities/version/version.verb.js.map +1 -1
- package/dist/src/constants.js +4 -3
- package/dist/src/constants.js.map +1 -1
- package/dist/src/kernel/completion/complete.js.map +1 -1
- package/dist/src/kernel/completion/emitScripts.js.map +1 -1
- package/dist/src/kernel/completion/parse.js.map +1 -1
- package/dist/src/kernel/completion/rank.js.map +1 -1
- package/dist/src/kernel/completion/resolve.js.map +1 -1
- package/dist/src/kernel/config/readConfig.js.map +1 -1
- package/dist/src/kernel/error/PragmaError.js.map +1 -1
- package/dist/src/kernel/error/index.js +1 -1
- package/dist/src/kernel/error/index.js.map +1 -1
- package/dist/src/kernel/error/recovery.js +24 -42
- package/dist/src/kernel/error/recovery.js.map +1 -1
- package/dist/src/kernel/packs/collect.js +123 -9
- package/dist/src/kernel/packs/collect.js.map +1 -1
- package/dist/src/kernel/packs/compile.js +74 -15
- package/dist/src/kernel/packs/compile.js.map +1 -1
- package/dist/src/kernel/packs/graphql/fetchGraphqlLookup.js +3 -3
- package/dist/src/kernel/packs/graphql/fetchGraphqlLookup.js.map +1 -1
- package/dist/src/kernel/packs/iri.js +2 -4
- package/dist/src/kernel/packs/iri.js.map +1 -1
- package/dist/src/kernel/packs/renderPack.js +90 -50
- package/dist/src/kernel/packs/renderPack.js.map +1 -1
- package/dist/src/kernel/packs/resolveEntity.js +202 -90
- package/dist/src/kernel/packs/resolveEntity.js.map +1 -1
- package/dist/src/kernel/packs/runBodies.js +89 -30
- package/dist/src/kernel/packs/runBodies.js.map +1 -1
- package/dist/src/kernel/packs/schema.js +66 -12
- package/dist/src/kernel/packs/schema.js.map +1 -1
- package/dist/src/kernel/packs/sparql/buildListQuery.js +80 -13
- package/dist/src/kernel/packs/sparql/buildListQuery.js.map +1 -1
- package/dist/src/kernel/packs/sparql/buildLookupQuery.js +41 -13
- package/dist/src/kernel/packs/sparql/buildLookupQuery.js.map +1 -1
- package/dist/src/kernel/packs/sparql/filterValues.js +32 -23
- package/dist/src/kernel/packs/sparql/filterValues.js.map +1 -1
- package/dist/src/kernel/packs/sparql/runSelect.js +3 -5
- package/dist/src/kernel/packs/sparql/runSelect.js.map +1 -1
- package/dist/src/kernel/packs/storyRules.js +31 -4
- package/dist/src/kernel/packs/storyRules.js.map +1 -1
- package/dist/src/kernel/packs/tierScope.js +3 -3
- package/dist/src/kernel/packs/tierScope.js.map +1 -1
- package/dist/src/kernel/packs/types.js +4 -0
- package/dist/src/kernel/packs/types.js.map +1 -1
- package/dist/src/kernel/project/cli/buildProgram.js +4 -0
- package/dist/src/kernel/project/cli/buildProgram.js.map +1 -1
- package/dist/src/kernel/project/cli/dispatch.js +32 -8
- package/dist/src/kernel/project/cli/dispatch.js.map +1 -1
- package/dist/src/kernel/project/cli/globalFlags.js.map +1 -1
- package/dist/src/kernel/project/cli/suggestNames.js +44 -1
- package/dist/src/kernel/project/cli/suggestNames.js.map +1 -1
- package/dist/src/kernel/project/cli/verbHelp.js +17 -18
- package/dist/src/kernel/project/cli/verbHelp.js.map +1 -1
- package/dist/src/kernel/project/mcp/buildServer.js +11 -4
- package/dist/src/kernel/project/mcp/buildServer.js.map +1 -1
- package/dist/src/kernel/project/mcp/envelope.js +3 -2
- package/dist/src/kernel/project/mcp/envelope.js.map +1 -1
- package/dist/src/kernel/project/mcp/instructions.js +101 -31
- package/dist/src/kernel/project/mcp/instructions.js.map +1 -1
- package/dist/src/kernel/project/mcp/registerVerb.js +59 -23
- package/dist/src/kernel/project/mcp/registerVerb.js.map +1 -1
- package/dist/src/kernel/render/envelope.js.map +1 -1
- package/dist/src/kernel/render/renderers.js +3 -3
- package/dist/src/kernel/render/renderers.js.map +1 -1
- package/dist/src/kernel/render/turtle.js +21 -4
- package/dist/src/kernel/render/turtle.js.map +1 -1
- package/dist/src/kernel/runtime/boot.js.map +1 -1
- package/dist/src/kernel/runtime/graphpack/build.js +54 -1
- package/dist/src/kernel/runtime/graphpack/build.js.map +1 -1
- package/dist/src/kernel/runtime/graphpack/manifest.js +14 -0
- package/dist/src/kernel/runtime/graphpack/manifest.js.map +1 -1
- package/dist/src/kernel/runtime/graphpack/read.js +3 -5
- package/dist/src/kernel/runtime/graphpack/read.js.map +1 -1
- package/dist/src/kernel/runtime/graphpack/schemas.js +1 -0
- package/dist/src/kernel/runtime/graphpack/schemas.js.map +1 -1
- package/dist/src/kernel/runtime/loadSession.js +8 -1
- package/dist/src/kernel/runtime/loadSession.js.map +1 -1
- package/dist/src/kernel/runtime/packVersion.js +75 -0
- package/dist/src/kernel/runtime/packVersion.js.map +1 -0
- package/dist/src/kernel/runtime/readEntity.js +43 -4
- package/dist/src/kernel/runtime/readEntity.js.map +1 -1
- package/dist/src/kernel/runtime/refs/resolve.js.map +1 -1
- package/dist/src/kernel/runtime/resolveSources.js +61 -9
- package/dist/src/kernel/runtime/resolveSources.js.map +1 -1
- package/dist/src/kernel/runtime/storeReadiness.js +3 -2
- package/dist/src/kernel/runtime/storeReadiness.js.map +1 -1
- package/dist/src/kernel/spec/call.js +167 -0
- package/dist/src/kernel/spec/call.js.map +1 -0
- package/dist/src/kernel/spec/emitReference.js +9 -13
- package/dist/src/kernel/spec/emitReference.js.map +1 -1
- package/dist/src/kernel/spec/emitSurface.js +8 -1
- package/dist/src/kernel/spec/emitSurface.js.map +1 -1
- package/dist/src/kernel/spec/guidance.js +63 -0
- package/dist/src/kernel/spec/guidance.js.map +1 -0
- package/dist/src/kernel/spec/wireType.js +36 -0
- package/dist/src/kernel/spec/wireType.js.map +1 -0
- package/package.json +16 -16
- package/pragma.conf.ts +294 -177
- package/src/capabilities/block.parity.test.ts +1 -1
- package/src/capabilities/callRule.test.ts +147 -0
- package/src/capabilities/capabilities/capabilities.test.ts +47 -19
- package/src/capabilities/capabilities/capabilities.verb.ts +2 -0
- package/src/capabilities/capabilities/catalog.ts +60 -55
- package/src/capabilities/capabilities/index.ts +2 -0
- package/src/capabilities/capabilities/types.ts +16 -19
- package/src/capabilities/colophon/colophon.render.ts +9 -5
- package/src/capabilities/colophon/colophon.verb.ts +1 -0
- package/src/capabilities/config/get.verb.ts +2 -0
- package/src/capabilities/config/runField.ts +3 -3
- package/src/capabilities/config/set.verb.ts +3 -0
- package/src/capabilities/config/show.verb.ts +2 -0
- package/src/capabilities/config/unset.verb.ts +2 -0
- package/src/capabilities/create/constants.ts +8 -5
- package/src/capabilities/create/create.mcp.test.ts +173 -1
- package/src/capabilities/create/create.test.ts +4 -2
- package/src/capabilities/create/create.verb.ts +45 -3
- package/src/capabilities/create/createGrammar.test.ts +41 -5
- package/src/capabilities/create/createSurface.generated.ts +22 -0
- package/src/capabilities/create/crossCli.subprocess.test.ts +53 -14
- package/src/capabilities/create/index.ts +1 -1
- package/src/capabilities/create/pickGenerator.ts +1 -0
- package/src/capabilities/create/shippedCreate.subprocess.test.ts +28 -7
- package/src/capabilities/distribution.test.ts +6 -3
- package/src/capabilities/distribution.ts +6 -0
- package/src/capabilities/doctor/checks/checkPackageRefs.ts +14 -2
- package/src/capabilities/doctor/doctor.test.ts +38 -1
- package/src/capabilities/doctor/doctor.verb.ts +2 -0
- package/src/capabilities/emptyRecovery.test.ts +5 -0
- package/src/capabilities/graph/connect.verb.ts +2 -0
- package/src/capabilities/graph/inspect.render.ts +9 -1
- package/src/capabilities/graph/inspect.test.ts +73 -0
- package/src/capabilities/graph/inspect.verb.ts +2 -0
- package/src/capabilities/graph/query.render.test.ts +35 -0
- package/src/capabilities/graph/query.render.ts +45 -7
- package/src/capabilities/graph/query.shipped.exec.test.ts +44 -0
- package/src/capabilities/graph/query.verb.ts +2 -0
- package/src/capabilities/graph/queryText.test.ts +55 -1
- package/src/capabilities/graph/queryText.ts +47 -0
- package/src/capabilities/graph/runConnect.ts +4 -5
- package/src/capabilities/graph/runQuery.ts +23 -9
- package/src/capabilities/info/info.verb.ts +2 -0
- package/src/capabilities/links.shipped.exec.test.ts +398 -0
- package/src/capabilities/listBudget.shipped.exec.test.ts +2 -2
- package/src/capabilities/listLookup.shipped.exec.test.ts +122 -13
- package/src/capabilities/listQuery.shipped.exec.test.ts +39 -16
- package/src/capabilities/lookupBudget.shipped.exec.test.ts +208 -0
- package/src/capabilities/meta/mcp.verb.ts +2 -0
- package/src/capabilities/ontology/ontology.test.ts +24 -0
- package/src/capabilities/ontology/verbs.ts +16 -12
- package/src/capabilities/prompt/verbs.ts +10 -4
- package/src/capabilities/resources/provider.ts +7 -3
- package/src/capabilities/resources/resources.test.ts +2 -1
- package/src/capabilities/setup/setup.verb.ts +16 -0
- package/src/capabilities/shared/calls.ts +20 -0
- package/src/capabilities/skill/render.ts +9 -6
- package/src/capabilities/skill/verbs.ts +8 -4
- package/src/capabilities/sources/collectStatus.ts +6 -1
- package/src/capabilities/sources/index.ts +4 -3
- package/src/capabilities/sources/reset.render.test.ts +33 -0
- package/src/capabilities/sources/reset.render.ts +43 -0
- package/src/capabilities/sources/reset.verb.ts +59 -0
- package/src/capabilities/sources/runReset.ts +65 -0
- package/src/capabilities/sources/runUpdate.ts +12 -11
- package/src/capabilities/sources/sources.test.ts +158 -3
- package/src/capabilities/sources/status.render.test.ts +63 -1
- package/src/capabilities/sources/status.render.ts +25 -8
- package/src/capabilities/sources/status.verb.ts +2 -0
- package/src/capabilities/sources/types.ts +26 -0
- package/src/capabilities/sources/update.verb.ts +3 -0
- package/src/capabilities/surface.test.ts +29 -4
- package/src/capabilities/token.parity.test.ts +3 -2
- package/src/capabilities/tokenGraph.shipped.exec.test.ts +14 -2
- package/src/capabilities/upgrade/upgrade.verb.ts +1 -0
- package/src/capabilities/variable.parity.test.ts +2 -1
- package/src/capabilities/version/version.verb.ts +1 -0
- package/src/capabilities/wireContract.test.ts +110 -0
- package/src/constants.ts +4 -3
- package/src/kernel/completion/shellDrive.test.ts +2 -2
- package/src/kernel/copy.test.ts +1 -1
- package/src/kernel/error/PragmaError.test.ts +7 -3
- package/src/kernel/error/index.ts +1 -1
- package/src/kernel/error/recovery.test.ts +52 -18
- package/src/kernel/error/recovery.ts +25 -46
- package/src/kernel/error/types.ts +1 -1
- package/src/kernel/packs/collect.test.ts +79 -0
- package/src/kernel/packs/collect.ts +151 -11
- package/src/kernel/packs/compile.test.ts +107 -10
- package/src/kernel/packs/compile.ts +100 -11
- package/src/kernel/packs/filteredEmpty.test.ts +22 -5
- package/src/kernel/packs/graphql/fetchGraphqlLookup.ts +5 -6
- package/src/kernel/packs/graphqlSource.test.ts +42 -0
- package/src/kernel/packs/iri.ts +5 -4
- package/src/kernel/packs/listNotice.test.ts +1 -1
- package/src/kernel/packs/nounLink.test.ts +385 -0
- package/src/kernel/packs/renderPack.ts +137 -57
- package/src/kernel/packs/resolveEntity.test.ts +170 -1
- package/src/kernel/packs/resolveEntity.ts +281 -101
- package/src/kernel/packs/runBodies.ts +133 -31
- package/src/kernel/packs/schema.ts +77 -12
- package/src/kernel/packs/sparql/buildListQuery.test.ts +78 -1
- package/src/kernel/packs/sparql/buildListQuery.ts +106 -16
- package/src/kernel/packs/sparql/buildLookupQuery.ts +44 -13
- package/src/kernel/packs/sparql/filterValues.test.ts +36 -4
- package/src/kernel/packs/sparql/filterValues.ts +50 -31
- package/src/kernel/packs/sparql/runSelect.ts +4 -6
- package/src/kernel/packs/storyRules.ts +37 -4
- package/src/kernel/packs/tierScope.test.ts +120 -6
- package/src/kernel/packs/tierScope.ts +5 -7
- package/src/kernel/packs/toolDescription.test.ts +59 -74
- package/src/kernel/packs/types.ts +93 -11
- package/src/kernel/project/cli/buildProgram.ts +4 -0
- package/src/kernel/project/cli/dispatch.ts +34 -8
- package/src/kernel/project/cli/suggest.test.ts +77 -0
- package/src/kernel/project/cli/suggestNames.ts +47 -1
- package/src/kernel/project/cli/verbHelp.ts +16 -19
- package/src/kernel/project/mcp/buildServer.ts +15 -4
- package/src/kernel/project/mcp/envelope.ts +3 -2
- package/src/kernel/project/mcp/instructions.ts +123 -35
- package/src/kernel/project/mcp/prompts/prompts.test.ts +136 -20
- package/src/kernel/project/mcp/registerVerb.test.ts +28 -0
- package/src/kernel/project/mcp/registerVerb.ts +67 -29
- package/src/kernel/render/__snapshots__/renderers.test.ts.snap +1 -1
- package/src/kernel/render/renderers.test.ts +2 -2
- package/src/kernel/render/renderers.ts +3 -3
- package/src/kernel/render/turtle.ts +24 -4
- package/src/kernel/runtime/graphpack/build.ts +58 -1
- package/src/kernel/runtime/graphpack/graphpack.test.ts +20 -0
- package/src/kernel/runtime/graphpack/manifest.ts +15 -0
- package/src/kernel/runtime/graphpack/read.ts +4 -6
- package/src/kernel/runtime/graphpack/schemas.ts +1 -0
- package/src/kernel/runtime/graphpack/types.ts +13 -0
- package/src/kernel/runtime/loadSession.ts +8 -1
- package/src/kernel/runtime/packVersion.test.ts +61 -0
- package/src/kernel/runtime/packVersion.ts +84 -0
- package/src/kernel/runtime/readEntity.ts +61 -6
- package/src/kernel/runtime/resolveSources.test.ts +90 -7
- package/src/kernel/runtime/resolveSources.ts +91 -10
- package/src/kernel/runtime/storeReadiness.ts +4 -4
- package/src/kernel/runtime/types.ts +12 -0
- package/src/kernel/spec/call.test.ts +95 -0
- package/src/kernel/spec/call.ts +186 -0
- package/src/kernel/spec/emitReference.ts +9 -13
- package/src/kernel/spec/emitSurface.ts +9 -1
- package/src/kernel/spec/guidance.test.ts +49 -0
- package/src/kernel/spec/guidance.ts +68 -0
- package/src/kernel/spec/index.ts +4 -0
- package/src/kernel/spec/surfaceConformance.test.ts +2 -2
- package/src/kernel/spec/types.ts +64 -7
- package/src/kernel/spec/wireType.ts +53 -0
- package/src/testing/behavioral/README.md +1 -1
- package/src/testing/behavioral/errorMatrix.mcp.test.ts +2 -1
- package/src/testing/behavioral/journeys.firstInstall.test.ts +72 -2
- package/src/testing/behavioral/parity.test.ts +40 -0
- package/src/testing/eval/__snapshots__/eval.test.ts.snap +1 -1
- package/src/testing/eval/cases/assembly.ts +4 -3
- package/src/testing/eval/cases/stable.ts +2 -3
- package/src/testing/helpers/callSchema.ts +40 -0
- package/src/testing/helpers/parity.ts +35 -2
- package/src/testing/setupCallChecking.ts +30 -0
- package/dist/src/capabilities/capabilities/hints.js +0 -223
- package/dist/src/capabilities/capabilities/hints.js.map +0 -1
- package/src/capabilities/capabilities/hints.ts +0 -266
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a parameter accepts on the wire, stated once: the MCP schema is built
|
|
3
|
+
* from it and the reference prints it. A `string[]` positional and every
|
|
4
|
+
* `repeatable` flag are LISTS — advertised as an array, with one bare string
|
|
5
|
+
* coerced to a list of one. Pure and zod-free (the reference is storeless).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { ParamSpec } from "./types.js";
|
|
9
|
+
|
|
10
|
+
/** The type of one value of a parameter. */
|
|
11
|
+
export type WireItem =
|
|
12
|
+
| { readonly kind: "string" | "number" | "boolean" }
|
|
13
|
+
| { readonly kind: "enum"; readonly values: readonly string[] };
|
|
14
|
+
|
|
15
|
+
/** A parameter's wire type: what one value is, and whether several are taken. */
|
|
16
|
+
export interface WireType {
|
|
17
|
+
readonly item: WireItem;
|
|
18
|
+
/** Several values are accepted (and one bare value is coerced to a list). */
|
|
19
|
+
readonly list: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Derive the wire type of a parameter from its spec.
|
|
24
|
+
*
|
|
25
|
+
* @param param - The parameter spec.
|
|
26
|
+
* @returns The one statement both the schema and the reference read.
|
|
27
|
+
*/
|
|
28
|
+
export function wireType(param: ParamSpec): WireType {
|
|
29
|
+
if (param.kind === "string[]") {
|
|
30
|
+
return { item: { kind: "string" }, list: true };
|
|
31
|
+
}
|
|
32
|
+
const item: WireItem =
|
|
33
|
+
param.kind === "enum"
|
|
34
|
+
? { kind: "enum", values: param.values }
|
|
35
|
+
: { kind: param.kind };
|
|
36
|
+
return { item, list: param.repeatable === true };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Print a wire type as the reference's type label (`string[]`,
|
|
41
|
+
* `enum(a, b)[]`). Enum values are comma-joined, never pipe-joined, so the
|
|
42
|
+
* label is safe inside a Markdown table cell without escaping.
|
|
43
|
+
*
|
|
44
|
+
* @param wire - The wire type to print.
|
|
45
|
+
* @returns The label.
|
|
46
|
+
*/
|
|
47
|
+
export function formatWireType(wire: WireType): string {
|
|
48
|
+
const item =
|
|
49
|
+
wire.item.kind === "enum"
|
|
50
|
+
? `enum(${wire.item.values.join(", ")})`
|
|
51
|
+
: wire.item.kind;
|
|
52
|
+
return wire.list ? `${item}[]` : item;
|
|
53
|
+
}
|
|
@@ -136,7 +136,7 @@ assuming a mismatch is a bug:
|
|
|
136
136
|
## Extension points this PR left for you, by owner
|
|
137
137
|
|
|
138
138
|
- **PR5 (`create`)** — `C1` in the port ledger. No journey exists yet for
|
|
139
|
-
`create component/package/application` dry-run/real/byte-equality. Add
|
|
139
|
+
`create component/package/application/page` dry-run/real/byte-equality. Add
|
|
140
140
|
`journeys.create.test.ts` here plus its own eval cases.
|
|
141
141
|
- **PR6 (config mutation, info enrichment, doctor, upgrade, setup, `graph
|
|
142
142
|
query`)** — `C2`/`C3`/`C4` — **BUILT**. Each new verb ships its own
|
|
@@ -225,7 +225,8 @@ describe("empty ≠ silence on the machine surfaces", () => {
|
|
|
225
225
|
expect(result.data).toEqual([]);
|
|
226
226
|
const notice = (result.meta as { notice?: string }).notice ?? "";
|
|
227
227
|
expect(notice).toContain(
|
|
228
|
-
|
|
228
|
+
// Spelled as the MCP argument, not the CLI flag: this is a tool result.
|
|
229
|
+
'No standard matches `search: "zzz-nothing-matches-this"`.',
|
|
229
230
|
);
|
|
230
231
|
expect(notice).toContain("Category slugs come from the graph");
|
|
231
232
|
});
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* hierarchy with no `Global`, is a change a human should be made to look at.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import { mkdtempSync, writeFileSync } from "node:fs";
|
|
16
|
+
import { mkdirSync, mkdtempSync, writeFileSync } from "node:fs";
|
|
17
17
|
import { tmpdir } from "node:os";
|
|
18
|
-
import { join } from "node:path";
|
|
18
|
+
import { dirname, join } from "node:path";
|
|
19
19
|
import { describe, expect, it, vi } from "vitest";
|
|
20
20
|
import { storyModules } from "../../capabilities/distribution.js";
|
|
21
21
|
import { checkPackageRefs } from "../../capabilities/doctor/checks/checkPackageRefs.js";
|
|
@@ -24,8 +24,10 @@ import { collectStatus } from "../../capabilities/sources/collectStatus.js";
|
|
|
24
24
|
import { PragmaError } from "../../kernel/error/PragmaError.js";
|
|
25
25
|
import { executeVerb } from "../../kernel/project/cli/dispatch.js";
|
|
26
26
|
import { bootRuntime } from "../../kernel/runtime/boot.js";
|
|
27
|
+
import { activePackPath, packDir } from "../../kernel/runtime/paths.js";
|
|
27
28
|
import type { GlobalFlags } from "../../kernel/runtime/types.js";
|
|
28
29
|
import type { CapabilityModule, VerbSpec } from "../../kernel/spec/types.js";
|
|
30
|
+
import { projectMcp } from "../helpers/projectMcp.js";
|
|
29
31
|
|
|
30
32
|
// Every case here boots its own runtime — a fresh install is what is under test —
|
|
31
33
|
// and the first read in the process parses the embedded pack cold: 65,000 triples,
|
|
@@ -235,3 +237,71 @@ describe("first install — the surfaces say where the answers come from", () =>
|
|
|
235
237
|
expect(result.detail).toContain("pragma sources update");
|
|
236
238
|
});
|
|
237
239
|
});
|
|
240
|
+
|
|
241
|
+
describe("after an upgrade — a pack an older CLI built does not answer", () => {
|
|
242
|
+
/**
|
|
243
|
+
* A cwd pointed at a complete pack that some older CLI built.
|
|
244
|
+
*
|
|
245
|
+
* Planted rather than built: the point is what the boot does with the
|
|
246
|
+
* POINTER, and the pack it names is never loaded — if it were, this pack's
|
|
247
|
+
* one-triple graph would answer instead of the snapshot, which is exactly the
|
|
248
|
+
* failure under test.
|
|
249
|
+
*/
|
|
250
|
+
function stalePackCwd(): { cwd: string; hash: string } {
|
|
251
|
+
const cwd = mkdtempSync(join(tmpdir(), "pragma-stale-"));
|
|
252
|
+
const hash = "c".repeat(64);
|
|
253
|
+
const dir = packDir(hash);
|
|
254
|
+
mkdirSync(dir, { recursive: true });
|
|
255
|
+
writeFileSync(join(dir, "data.nq"), "<urn:s> <urn:p> <urn:o> .\n");
|
|
256
|
+
writeFileSync(join(dir, "schema.json"), "{}");
|
|
257
|
+
writeFileSync(join(dir, "index.json"), "{}");
|
|
258
|
+
writeFileSync(join(dir, "stories.json"), "[]");
|
|
259
|
+
writeFileSync(
|
|
260
|
+
join(dir, "manifest.json"),
|
|
261
|
+
JSON.stringify({
|
|
262
|
+
name: "pragma",
|
|
263
|
+
version: "0.1.0",
|
|
264
|
+
sourceRef: "@canonical/design-system@git:ac03466",
|
|
265
|
+
contentHash: hash,
|
|
266
|
+
prefixes: {},
|
|
267
|
+
createdAt: "2026-09-10T21:49:00.411Z",
|
|
268
|
+
}),
|
|
269
|
+
);
|
|
270
|
+
mkdirSync(dirname(activePackPath(cwd)), { recursive: true });
|
|
271
|
+
writeFileSync(activePackPath(cwd), hash);
|
|
272
|
+
return { cwd, hash };
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
it("the read answers from the shipped snapshot, and its meta names the pack", async () => {
|
|
276
|
+
const { cwd, hash } = stalePackCwd();
|
|
277
|
+
const outcome = await executeVerb(
|
|
278
|
+
verbOf(blockModule, "block list"),
|
|
279
|
+
{},
|
|
280
|
+
NO_MUTATION,
|
|
281
|
+
bootRuntime(JSON_FLAGS, cwd),
|
|
282
|
+
);
|
|
283
|
+
const envelope = JSON.parse(outcome.stdout as string) as {
|
|
284
|
+
data: { name: string }[];
|
|
285
|
+
meta: Record<string, unknown>;
|
|
286
|
+
};
|
|
287
|
+
// The upgrade's own graph answered — the planted pack holds one triple and
|
|
288
|
+
// no blocks at all, so a row named Button can only have come from the
|
|
289
|
+
// snapshot.
|
|
290
|
+
expect(envelope.data.map((row) => row.name)).toContain("Button");
|
|
291
|
+
// And the answer says, as data, which pack it did not come from.
|
|
292
|
+
expect(envelope.meta.ignoredPack).toEqual({
|
|
293
|
+
contentHash: hash,
|
|
294
|
+
builtBy: "0.1.0",
|
|
295
|
+
builtAt: "2026-09-10T21:49:00.411Z",
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
it("the same read over MCP carries the same meta", async () => {
|
|
300
|
+
const { cwd, hash } = stalePackCwd();
|
|
301
|
+
const mcp = await projectMcp([blockModule], cwd);
|
|
302
|
+
const envelope = await mcp.callTool("block_list");
|
|
303
|
+
expect(envelope.meta).toMatchObject({
|
|
304
|
+
ignoredPack: { contentHash: hash, builtBy: "0.1.0" },
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
});
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
assertCliMcpParity,
|
|
38
38
|
JSON_FLAGS,
|
|
39
39
|
NO_MUTATION,
|
|
40
|
+
noticeOf,
|
|
40
41
|
} from "../helpers/parity.js";
|
|
41
42
|
import { projectMcp } from "../helpers/projectMcp.js";
|
|
42
43
|
import { listVerbs, liveVerbs, lookupVerbs } from "./liveReadSurface.js";
|
|
@@ -78,6 +79,45 @@ describe("assertCliMcpParity — the shared helper, over stable-now nouns (A5)",
|
|
|
78
79
|
});
|
|
79
80
|
});
|
|
80
81
|
|
|
82
|
+
describe("the one place the envelopes differ: the spelling inside meta.notice", () => {
|
|
83
|
+
it("an empty list is equal on both surfaces but for how its next step is spelled", async () => {
|
|
84
|
+
// A search that matches nothing: the empty answer names it, says how to
|
|
85
|
+
// widen, and keeps the story's next call — unless that call is the rebuild,
|
|
86
|
+
// which a miss on a healthy store must never advise.
|
|
87
|
+
const standardModule = capabilities.find(
|
|
88
|
+
(module) => module.name === "standard",
|
|
89
|
+
);
|
|
90
|
+
const verb = standardModule?.verbs.find(
|
|
91
|
+
(v) => v.path[1] === "list",
|
|
92
|
+
) as VerbSpec;
|
|
93
|
+
const cwd = freshCwd();
|
|
94
|
+
const params = { search: "zzz-nothing-matches-this" };
|
|
95
|
+
const cliEnvelope = await assertCliMcpParity({
|
|
96
|
+
modules: capabilities,
|
|
97
|
+
verb,
|
|
98
|
+
tool: "standard_list",
|
|
99
|
+
cwd,
|
|
100
|
+
params,
|
|
101
|
+
});
|
|
102
|
+
expect(cliEnvelope.data).toEqual([]);
|
|
103
|
+
const cliNotice = noticeOf(cliEnvelope) as string;
|
|
104
|
+
expect(cliNotice).toContain("`--search zzz-nothing-matches-this`");
|
|
105
|
+
expect(cliNotice).toContain("Run `pragma standard categories`.");
|
|
106
|
+
|
|
107
|
+
const mcp = await projectMcp(capabilities, cwd);
|
|
108
|
+
const mcpNotice = noticeOf(await mcp.callTool("standard_list", params));
|
|
109
|
+
const rebuilt = noticeOf(await mcp.callTool("token_consumers", params));
|
|
110
|
+
await mcp.cleanup();
|
|
111
|
+
expect(mcpNotice).toContain('`search: "zzz-nothing-matches-this"`');
|
|
112
|
+
expect(mcpNotice).toContain("Call `standard_categories {}`.");
|
|
113
|
+
expect(mcpNotice).not.toContain("pragma ");
|
|
114
|
+
// A story whose next call IS the rebuild keeps its account and drops it.
|
|
115
|
+
expect(rebuilt).toContain("drop the argument, or loosen it");
|
|
116
|
+
expect(rebuilt).not.toContain("sources_update");
|
|
117
|
+
// Two full-registry MCP servers and a CLI dispatch: slow on a busy machine.
|
|
118
|
+
}, 30_000);
|
|
119
|
+
});
|
|
120
|
+
|
|
81
121
|
describe("plan-first is uniform across surfaces (A6)", () => {
|
|
82
122
|
it("CLI --dry-run and MCP no-confirm describe the SAME effects, in different meta shapes", async () => {
|
|
83
123
|
const cwd = freshCwd();
|
|
@@ -48,7 +48,7 @@ exports[`eval harness — seed gate > runs the full seed (stable + read-noun) ca
|
|
|
48
48
|
"passed": true,
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
|
-
"id": "content-instructions-present-and-
|
|
51
|
+
"id": "content-instructions-present-and-index-tools-by-question",
|
|
52
52
|
"kind": "content",
|
|
53
53
|
"passed": true,
|
|
54
54
|
},
|
|
@@ -93,15 +93,16 @@ export const assemblyEvalCases: readonly EvalCase[] = [
|
|
|
93
93
|
},
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
|
-
id: "content-instructions-present-and-
|
|
96
|
+
id: "content-instructions-present-and-index-tools-by-question",
|
|
97
97
|
kind: "content",
|
|
98
98
|
input:
|
|
99
|
-
"the server sends handshake instructions that mention `capabilities` and the discovery
|
|
99
|
+
"the server sends handshake instructions that mention `capabilities` and index tools by the question each answers (the index replaced the prose discovery sequence).",
|
|
100
100
|
async expect({ mcp }) {
|
|
101
101
|
const instructions = mcp.instructions();
|
|
102
102
|
assert.ok(instructions, "expected server instructions at initialize");
|
|
103
103
|
assert.match(String(instructions), /capabilities/);
|
|
104
|
-
assert.match(String(instructions)
|
|
104
|
+
assert.match(String(instructions), /^When asked:$/m);
|
|
105
|
+
assert.match(String(instructions), /^token_consumers — /m);
|
|
105
106
|
},
|
|
106
107
|
},
|
|
107
108
|
{
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import assert from "node:assert/strict";
|
|
10
10
|
import { compilePack } from "../../../kernel/packs/compile.js";
|
|
11
11
|
import type { PackDefinition } from "../../../kernel/packs/types.js";
|
|
12
|
+
import { CONDENSED_SDL_TOKEN_BUDGET } from "../../../kernel/spec/emitSurface.js";
|
|
12
13
|
import type { CapabilityModule } from "../../../kernel/spec/types.js";
|
|
13
14
|
import { bootFixtureRuntime } from "../../helpers/fixtureGraph.js";
|
|
14
15
|
import { projectMcp } from "../../helpers/projectMcp.js";
|
|
@@ -58,8 +59,6 @@ const WIDGET_PACK: PackDefinition = {
|
|
|
58
59
|
},
|
|
59
60
|
};
|
|
60
61
|
|
|
61
|
-
/** The condensed-SDL token-budget ceiling the covenant reserves (seeded, not enforced). */
|
|
62
|
-
const CONDENSED_SDL_TOKEN_BUDGET = 8000;
|
|
63
62
|
/** The old suite's one token anchor: ~1 token per 4 characters. */
|
|
64
63
|
const CHARS_PER_TOKEN = 4;
|
|
65
64
|
|
|
@@ -83,7 +82,7 @@ export const stableEvalCases: readonly EvalCase[] = [
|
|
|
83
82
|
id: "content-condensed-sdl-token-budget",
|
|
84
83
|
kind: "content",
|
|
85
84
|
input:
|
|
86
|
-
"the aggregate live MCP tool catalog (name + description + inputSchema, whatever it currently contains) stays under the condensedSDL budget (
|
|
85
|
+
"the aggregate live MCP tool catalog (name + description + inputSchema, whatever it currently contains) stays under the condensedSDL budget (kernel/spec/emitSurface.ts#CONDENSED_SDL_TOKEN_BUDGET, ~1 token/4 chars).",
|
|
87
86
|
async expect({ mcp }) {
|
|
88
87
|
const tools = await mcp.listTools();
|
|
89
88
|
assert.ok(tools.length > 0, "expected at least one registered tool");
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE validator of a call: the named verb's real MCP input schema.
|
|
3
|
+
*
|
|
4
|
+
* `capabilities/callRule.test.ts` runs the statically known calls through it,
|
|
5
|
+
* and `setupCallChecking.ts` installs the same function on the call renderer
|
|
6
|
+
* (which hands it the declared verb the call names),
|
|
7
|
+
* so a recovery built where an error is thrown is held to exactly the rule an
|
|
8
|
+
* example is.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
import { buildToolShape } from "../../kernel/project/mcp/registerVerb.js";
|
|
13
|
+
import type { Call, VerbSpec } from "../../kernel/spec/types.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Say what is wrong with a call, or nothing.
|
|
17
|
+
*
|
|
18
|
+
* @param call - The call to check.
|
|
19
|
+
* @param verb - The verb it names, or `undefined` when none is registered.
|
|
20
|
+
* @returns The problem: it names no registered verb, or its params fail that
|
|
21
|
+
* verb's tool schema.
|
|
22
|
+
*/
|
|
23
|
+
export function findCallProblem(
|
|
24
|
+
call: Call,
|
|
25
|
+
verb: VerbSpec | undefined,
|
|
26
|
+
): string | undefined {
|
|
27
|
+
if (!verb) return "names no registered verb";
|
|
28
|
+
// A call is a next step or an example, and neither may skip the plan or pick
|
|
29
|
+
// a write root: `confirm` and `cwd` are the caller's to add, never a hint's.
|
|
30
|
+
const { confirm: _confirm, cwd: _cwd, ...shape } = buildToolShape(verb);
|
|
31
|
+
const parsed = z
|
|
32
|
+
.object(shape)
|
|
33
|
+
.strict()
|
|
34
|
+
.safeParse(call.params ?? {});
|
|
35
|
+
return parsed.success
|
|
36
|
+
? undefined
|
|
37
|
+
: parsed.error.issues
|
|
38
|
+
.map((issue) => `${issue.path.join(".")}: ${issue.message}`)
|
|
39
|
+
.join("; ");
|
|
40
|
+
}
|
|
@@ -7,7 +7,14 @@
|
|
|
7
7
|
* no separate condensed/text/tokens MCP shape in v2 (confirmed:
|
|
8
8
|
* `mcp/envelope.ts` reuses the CLI's envelope builders verbatim), so parity
|
|
9
9
|
* simplifies to structural data-equality — no byte-exact `condensed ===
|
|
10
|
-
* fmt.llm(...)` comparison to reproduce.
|
|
10
|
+
* fmt.llm(...)` comparison to reproduce. The contract has ONE exception, and
|
|
11
|
+
* the asserter normalises exactly it: inside `meta.notice`, a call or argument
|
|
12
|
+
* is spelled as a command on the CLI and as a tool call over MCP. Only those
|
|
13
|
+
* spellings are normalised — the backticked spans and the `Run`/`Call` lead —
|
|
14
|
+
* so a scope or paging sentence missing from one surface still fails. What it
|
|
15
|
+
* CANNOT see: a span is blanked whole, so the two surfaces naming a different
|
|
16
|
+
* argument VALUE (or a different call) inside one goes unnoticed here — the
|
|
17
|
+
* renderers' own tests pin those spellings. This generalizes the pattern already
|
|
11
18
|
* proven ad hoc in `mcp/parity.test.ts` (`probe echo`) and `sources.test.ts`
|
|
12
19
|
* (`sources status`) into one reusable helper every read noun's tests drive.
|
|
13
20
|
*/
|
|
@@ -51,6 +58,30 @@ export interface ParityCase {
|
|
|
51
58
|
readonly flags?: Partial<GlobalFlags>;
|
|
52
59
|
}
|
|
53
60
|
|
|
61
|
+
/** An envelope's `meta.notice` sentence, if it carries one. */
|
|
62
|
+
export function noticeOf(
|
|
63
|
+
envelope: Record<string, unknown>,
|
|
64
|
+
): string | undefined {
|
|
65
|
+
return (envelope.meta as { notice?: string } | undefined)?.notice;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The envelope with its notice's surface spellings blanked: every backticked
|
|
70
|
+
* span (a call, an argument) and the `Run`/`Call` lead before one. The prose
|
|
71
|
+
* around them — which sentences are present, in what order — is kept.
|
|
72
|
+
*/
|
|
73
|
+
function withNormalisedNotice(envelope: Record<string, unknown>): unknown {
|
|
74
|
+
const notice = noticeOf(envelope);
|
|
75
|
+
if (notice === undefined) return envelope;
|
|
76
|
+
const normalised = notice
|
|
77
|
+
.replace(/\b(Run|Call) (?=`)/g, "")
|
|
78
|
+
.replace(/``.*?``|`[^`]*`/g, "`…`");
|
|
79
|
+
return {
|
|
80
|
+
...envelope,
|
|
81
|
+
meta: { ...(envelope.meta as object), notice: normalised },
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
54
85
|
/**
|
|
55
86
|
* Run the same read through the CLI (`--format json`) and MCP, and assert the
|
|
56
87
|
* two envelopes are deep-equal.
|
|
@@ -81,6 +112,8 @@ export async function assertCliMcpParity(
|
|
|
81
112
|
await mcp.cleanup();
|
|
82
113
|
}
|
|
83
114
|
|
|
84
|
-
expect(cliEnvelope).toEqual(
|
|
115
|
+
expect(withNormalisedNotice(cliEnvelope)).toEqual(
|
|
116
|
+
withNormalisedNotice(mcpEnvelope),
|
|
117
|
+
);
|
|
85
118
|
return cliEnvelope;
|
|
86
119
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-file test setup: make every call rendered under test prove itself.
|
|
3
|
+
*
|
|
4
|
+
* A recovery is built where an error is thrown, from values only that line
|
|
5
|
+
* knows, so the recoveries cannot be listed ahead of time the way examples and
|
|
6
|
+
* pack empties can (`capabilities/callRule.test.ts` lists those). What can be
|
|
7
|
+
* done is to check each one as it is built, with the SAME validator the
|
|
8
|
+
* conformance test uses (`helpers/callSchema.ts` — the verb's real MCP input
|
|
9
|
+
* schema): a recovery naming a verb that does not exist, or params its schema
|
|
10
|
+
* rejects, throws. A fixture's verbs are not the distribution's, so a test that
|
|
11
|
+
* renders a call to one declares it first.
|
|
12
|
+
*
|
|
13
|
+
* The residual, stated plainly: this reaches a recovery only on a line some
|
|
14
|
+
* test executes, and with one set of values. A line no test runs is unchecked
|
|
15
|
+
* until one does.
|
|
16
|
+
*
|
|
17
|
+
* Imported inside the hook, not at the top: a setup file's static imports are
|
|
18
|
+
* evaluated before the test file's `vi.mock` calls register, which would hand
|
|
19
|
+
* `identity.test.ts` this distribution's constants instead of its fork's.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { beforeAll } from "vitest";
|
|
23
|
+
|
|
24
|
+
beforeAll(async () => {
|
|
25
|
+
const { capabilities } = await import("../capabilities/index.js");
|
|
26
|
+
const call = await import("../kernel/spec/call.js");
|
|
27
|
+
const { findCallProblem } = await import("./helpers/callSchema.js");
|
|
28
|
+
call.declareVerbs(capabilities.flatMap((module) => module.verbs));
|
|
29
|
+
call.checkCallsWith(findCallProblem);
|
|
30
|
+
});
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The one authored input to the `capabilities` catalog: a `use_when` behavioural
|
|
3
|
-
* hint + category per tool. Everything else (the tool SET, counts, discovery
|
|
4
|
-
* samples) is DERIVED from the live grammar at build time, so this table is the
|
|
5
|
-
* only thing to keep in sync — and the drift-guard test (`capabilities.test.ts`)
|
|
6
|
-
* fails CI if a live tool has no hint, a hint names a tool that no longer
|
|
7
|
-
* exists, or a hint's category disagrees with the tool's real `mutates` flag.
|
|
8
|
-
*
|
|
9
|
-
* `use_when` strings for the surviving tools are ported verbatim from the old
|
|
10
|
-
* shell's `domains/llm/data/toolCatalog.ts`; the net-new v2 tools (config_set,
|
|
11
|
-
* graph_query, setup, upgrade, doctor, capabilities, prompt_*, sources_*,
|
|
12
|
-
* tier_lookup, create_*) are authored here.
|
|
13
|
-
*/
|
|
14
|
-
import { BIN_NAME } from "../../constants.js";
|
|
15
|
-
/**
|
|
16
|
-
* Behavioural hints keyed by the LIVE tool name (`emitSurface` naming rule:
|
|
17
|
-
* `noun` or `noun_verb`). Categories: `write` ⟺ the verb mutates; `orientation`
|
|
18
|
-
* = the session-start map; `diagnostic` = environment/version reporting; else
|
|
19
|
-
* `read`. The drift guard enforces every one of those invariants.
|
|
20
|
-
*/
|
|
21
|
-
export const TOOL_HINTS = {
|
|
22
|
-
// — Orientation ————————————————————————————————————————————————————————————
|
|
23
|
-
capabilities: {
|
|
24
|
-
category: "orientation",
|
|
25
|
-
use_when: "Starting a session — understand conventions, available tools, and the discovery flow",
|
|
26
|
-
},
|
|
27
|
-
// — Diagnostic ————————————————————————————————————————————————————————————
|
|
28
|
-
doctor: {
|
|
29
|
-
category: "diagnostic",
|
|
30
|
-
use_when: "Diagnosing environment issues — config, store, completions, MCP health",
|
|
31
|
-
},
|
|
32
|
-
info: {
|
|
33
|
-
category: "diagnostic",
|
|
34
|
-
use_when: `Checking ${BIN_NAME} version, configuration summary, and store state`,
|
|
35
|
-
},
|
|
36
|
-
// — Read ——————————————————————————————————————————————————————————————————
|
|
37
|
-
block_list: {
|
|
38
|
-
category: "read",
|
|
39
|
-
use_when: "Browsing all components, patterns, layouts, and subcomponents in the store",
|
|
40
|
-
},
|
|
41
|
-
block_lookup: {
|
|
42
|
-
category: "read",
|
|
43
|
-
use_when: "Need full anatomy, modifiers, tokens, and standards for specific blocks by name or IRI",
|
|
44
|
-
},
|
|
45
|
-
block_sample: {
|
|
46
|
-
category: "read",
|
|
47
|
-
use_when: "See actual block data shapes before querying — returns random instances each call, prevents guessing at property names",
|
|
48
|
-
},
|
|
49
|
-
colophon: {
|
|
50
|
-
category: "read",
|
|
51
|
-
use_when: "Understanding how the active domain is built — its declared colophon, for onboarding or a demo",
|
|
52
|
-
},
|
|
53
|
-
config_get: {
|
|
54
|
-
category: "read",
|
|
55
|
-
use_when: "Reading ONE config field's effective value and the layer it came from — the single-value form of config_show",
|
|
56
|
-
},
|
|
57
|
-
config_show: {
|
|
58
|
-
category: "read",
|
|
59
|
-
use_when: "Checking the active configuration (tier, channel, detail) and which layer set each field",
|
|
60
|
-
},
|
|
61
|
-
graph_connect: {
|
|
62
|
-
category: "read",
|
|
63
|
-
use_when: "Deciding whether two entities are related at all — the shortest relation paths between them, or which kind of nothing there is",
|
|
64
|
-
},
|
|
65
|
-
graph_inspect: {
|
|
66
|
-
category: "read",
|
|
67
|
-
use_when: "Examining all triples for a specific URI — predicates, objects, and types",
|
|
68
|
-
},
|
|
69
|
-
graph_query: {
|
|
70
|
-
category: "read",
|
|
71
|
-
use_when: "Complex SPARQL joins or aggregations that other tools cannot express",
|
|
72
|
-
},
|
|
73
|
-
modifier_list: {
|
|
74
|
-
category: "read",
|
|
75
|
-
use_when: "Listing all modifier families and their allowed values",
|
|
76
|
-
},
|
|
77
|
-
modifier_lookup: {
|
|
78
|
-
category: "read",
|
|
79
|
-
use_when: "Need values and usage details for specific modifier families by name",
|
|
80
|
-
},
|
|
81
|
-
modifier_sample: {
|
|
82
|
-
category: "read",
|
|
83
|
-
use_when: "See actual modifier data shapes (with value lists) before querying — returns random instances each call",
|
|
84
|
-
},
|
|
85
|
-
ontology_list: {
|
|
86
|
-
category: "read",
|
|
87
|
-
use_when: "Discovering loaded namespaces, prefixes, and class/property counts",
|
|
88
|
-
},
|
|
89
|
-
ontology_lookup: {
|
|
90
|
-
category: "read",
|
|
91
|
-
use_when: "Exploring the full schema of a namespace by name — classes, properties, and hierarchy",
|
|
92
|
-
},
|
|
93
|
-
prompt_list: {
|
|
94
|
-
category: "read",
|
|
95
|
-
use_when: "Browsing the workflow prompt templates the active graph offers",
|
|
96
|
-
},
|
|
97
|
-
prompt_lookup: {
|
|
98
|
-
category: "read",
|
|
99
|
-
use_when: "Fetching a specific workflow prompt template's body and arguments by name",
|
|
100
|
-
},
|
|
101
|
-
skill_list: {
|
|
102
|
-
category: "read",
|
|
103
|
-
use_when: "Discovering agent skills provided by installed packs",
|
|
104
|
-
},
|
|
105
|
-
skill_lookup: {
|
|
106
|
-
category: "read",
|
|
107
|
-
use_when: "Loading full SKILL.md instructions for a specific agent skill by name",
|
|
108
|
-
},
|
|
109
|
-
sources_status: {
|
|
110
|
-
category: "read",
|
|
111
|
-
use_when: "Checking whether the local knowledge-graph pack is built and current",
|
|
112
|
-
},
|
|
113
|
-
standard_list: {
|
|
114
|
-
category: "read",
|
|
115
|
-
use_when: "Browsing code standards, optionally filtered by category or search term",
|
|
116
|
-
},
|
|
117
|
-
standard_lookup: {
|
|
118
|
-
category: "read",
|
|
119
|
-
use_when: "Need do/don't code examples for specific coding standards by name or IRI",
|
|
120
|
-
},
|
|
121
|
-
standard_categories: {
|
|
122
|
-
category: "read",
|
|
123
|
-
use_when: "Discovering which standard categories exist before filtering",
|
|
124
|
-
},
|
|
125
|
-
concept_list: {
|
|
126
|
-
category: "read",
|
|
127
|
-
use_when: "Browsing long-form design-system concepts (foundations, how-to guides, decision guides)",
|
|
128
|
-
},
|
|
129
|
-
concept_lookup: {
|
|
130
|
-
category: "read",
|
|
131
|
-
use_when: "Reading a concept's full Markdown documentation by name or IRI",
|
|
132
|
-
},
|
|
133
|
-
implementation_list: {
|
|
134
|
-
category: "read",
|
|
135
|
-
use_when: "Finding which library implements a block, on which platform, and where its source lives",
|
|
136
|
-
},
|
|
137
|
-
implementation_libraries: {
|
|
138
|
-
category: "read",
|
|
139
|
-
use_when: "Discovering which implementation libraries exist, and how much of the design system each covers",
|
|
140
|
-
},
|
|
141
|
-
standard_sample: {
|
|
142
|
-
category: "read",
|
|
143
|
-
use_when: "See actual standard data shapes (with dos/donts) before querying — returns random instances each call",
|
|
144
|
-
},
|
|
145
|
-
tier_list: {
|
|
146
|
-
category: "read",
|
|
147
|
-
use_when: "Picking the tier to scope a read to (the `tier` parameter)",
|
|
148
|
-
},
|
|
149
|
-
tier_lookup: {
|
|
150
|
-
category: "read",
|
|
151
|
-
use_when: "Need the blocks scoped to a specific tier by name",
|
|
152
|
-
},
|
|
153
|
-
token_list: {
|
|
154
|
-
category: "read",
|
|
155
|
-
use_when: "Browsing which token SYMBOLS exist (the logical dotted names), optionally by type or by the symbol a channel provisions",
|
|
156
|
-
},
|
|
157
|
-
token_lookup: {
|
|
158
|
-
category: "read",
|
|
159
|
-
use_when: "Need one symbol in full — its definitions, the families that may rebind it, and what it resolves to at each position",
|
|
160
|
-
},
|
|
161
|
-
token_values: {
|
|
162
|
-
category: "read",
|
|
163
|
-
use_when: "Need the value a symbol resolves to at a position, with the chain that produced it or the symbol it derives from",
|
|
164
|
-
},
|
|
165
|
-
token_consumers: {
|
|
166
|
-
category: "read",
|
|
167
|
-
use_when: "Need which blocks consume a symbol, at which style key, state and rank",
|
|
168
|
-
},
|
|
169
|
-
token_sample: {
|
|
170
|
-
category: "read",
|
|
171
|
-
use_when: "See actual token symbol data shapes before querying — returns random instances each call",
|
|
172
|
-
},
|
|
173
|
-
variable_list: {
|
|
174
|
-
category: "read",
|
|
175
|
-
use_when: "Browsing the platform names a stylesheet declares, by platform, symbol, tier, visibility or coordinate — including the 236 that stand for no symbol",
|
|
176
|
-
},
|
|
177
|
-
variable_lookup: {
|
|
178
|
-
category: "read",
|
|
179
|
-
use_when: "Need one platform variable in full — its symbol, tier, visibility, and every selector and at-rule it is declared under",
|
|
180
|
-
},
|
|
181
|
-
variable_chain: {
|
|
182
|
-
category: "read",
|
|
183
|
-
use_when: "Need what a variable finally means: the transitive walk to every symbol it reaches",
|
|
184
|
-
},
|
|
185
|
-
variable_sample: {
|
|
186
|
-
category: "read",
|
|
187
|
-
use_when: "See actual platform variable data shapes before querying — returns random instances each call",
|
|
188
|
-
},
|
|
189
|
-
// — Write ——————————————————————————————————————————————————————————————————
|
|
190
|
-
config_set: {
|
|
191
|
-
category: "write",
|
|
192
|
-
use_when: "Setting any config field by name — tier, channel, or detail (e.g. `config set tier apps/lxd`)",
|
|
193
|
-
},
|
|
194
|
-
config_unset: {
|
|
195
|
-
category: "write",
|
|
196
|
-
use_when: 'Clearing a config field so the built-in default applies again — no value means "remove", this tool does',
|
|
197
|
-
},
|
|
198
|
-
create_component: {
|
|
199
|
-
category: "write",
|
|
200
|
-
use_when: "Scaffolding a new component (React, Svelte, or Lit)",
|
|
201
|
-
},
|
|
202
|
-
create_package: {
|
|
203
|
-
category: "write",
|
|
204
|
-
use_when: "Scaffolding a new npm package with proper monorepo configuration",
|
|
205
|
-
},
|
|
206
|
-
create_application: {
|
|
207
|
-
category: "write",
|
|
208
|
-
use_when: "Scaffolding a new React application with routing, optional Relay, and either server-side rendering or a client-only SPA",
|
|
209
|
-
},
|
|
210
|
-
setup: {
|
|
211
|
-
category: "write",
|
|
212
|
-
use_when: `Installing ${BIN_NAME}'s shell completions, MCP config, skills, and LSP into the environment`,
|
|
213
|
-
},
|
|
214
|
-
sources_update: {
|
|
215
|
-
category: "write",
|
|
216
|
-
use_when: "Building or refreshing the knowledge-graph pack from the configured packs",
|
|
217
|
-
},
|
|
218
|
-
upgrade: {
|
|
219
|
-
category: "write",
|
|
220
|
-
use_when: `Upgrading the ${BIN_NAME} CLI itself to the latest release`,
|
|
221
|
-
},
|
|
222
|
-
};
|
|
223
|
-
//# sourceMappingURL=hints.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hints.js","sourceRoot":"","sources":["../../../../src/capabilities/capabilities/hints.ts"],"names":[],"mappings":"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"}
|