@canonical/prism-cli 0.0.0-stage → 0.51.0-experimental.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 +43 -2
- package/dist/.build-ok +0 -0
- package/dist/package.json +124 -0
- package/dist/prism.conf.js +42 -0
- package/dist/prism.conf.js.map +1 -0
- package/dist/src/bin.js +11 -0
- package/dist/src/bin.js.map +1 -0
- package/dist/src/build/generatorSurface.js +117 -0
- package/dist/src/build/generatorSurface.js.map +1 -0
- package/dist/src/build/index.js +24 -0
- package/dist/src/build/index.js.map +1 -0
- package/dist/src/capabilities/capabilities/capabilities.render.js +74 -0
- package/dist/src/capabilities/capabilities/capabilities.render.js.map +1 -0
- package/dist/src/capabilities/capabilities/capabilities.verb.js +62 -0
- package/dist/src/capabilities/capabilities/capabilities.verb.js.map +1 -0
- package/dist/src/capabilities/capabilities/catalog.js +140 -0
- package/dist/src/capabilities/capabilities/catalog.js.map +1 -0
- package/dist/src/capabilities/capabilities/index.js +13 -0
- package/dist/src/capabilities/capabilities/index.js.map +1 -0
- package/dist/src/capabilities/capabilities/types.js +11 -0
- package/dist/src/capabilities/capabilities/types.js.map +1 -0
- package/dist/src/capabilities/colophon/collectColophon.js +83 -0
- package/dist/src/capabilities/colophon/collectColophon.js.map +1 -0
- package/dist/src/capabilities/colophon/colophon.render.js +62 -0
- package/dist/src/capabilities/colophon/colophon.render.js.map +1 -0
- package/dist/src/capabilities/colophon/colophon.verb.js +44 -0
- package/dist/src/capabilities/colophon/colophon.verb.js.map +1 -0
- package/dist/src/capabilities/colophon/index.js +5 -0
- package/dist/src/capabilities/colophon/index.js.map +1 -0
- package/dist/src/capabilities/colophon/markdownTerminal.js +90 -0
- package/dist/src/capabilities/colophon/markdownTerminal.js.map +1 -0
- package/dist/src/capabilities/colophon/types.js +10 -0
- package/dist/src/capabilities/colophon/types.js.map +1 -0
- package/dist/src/capabilities/config/collectConfigShow.js +59 -0
- package/dist/src/capabilities/config/collectConfigShow.js.map +1 -0
- package/dist/src/capabilities/config/field.render.js +22 -0
- package/dist/src/capabilities/config/field.render.js.map +1 -0
- package/dist/src/capabilities/config/fields.js +46 -0
- package/dist/src/capabilities/config/fields.js.map +1 -0
- package/dist/src/capabilities/config/get.verb.js +63 -0
- package/dist/src/capabilities/config/get.verb.js.map +1 -0
- package/dist/src/capabilities/config/index.js +5 -0
- package/dist/src/capabilities/config/index.js.map +1 -0
- package/dist/src/capabilities/config/runField.js +59 -0
- package/dist/src/capabilities/config/runField.js.map +1 -0
- package/dist/src/capabilities/config/runGet.js +28 -0
- package/dist/src/capabilities/config/runGet.js.map +1 -0
- package/dist/src/capabilities/config/runSet.js +53 -0
- package/dist/src/capabilities/config/runSet.js.map +1 -0
- package/dist/src/capabilities/config/set.verb.js +69 -0
- package/dist/src/capabilities/config/set.verb.js.map +1 -0
- package/dist/src/capabilities/config/show.render.js +123 -0
- package/dist/src/capabilities/config/show.render.js.map +1 -0
- package/dist/src/capabilities/config/show.verb.js +45 -0
- package/dist/src/capabilities/config/show.verb.js.map +1 -0
- package/dist/src/capabilities/config/types.js +5 -0
- package/dist/src/capabilities/config/types.js.map +1 -0
- package/dist/src/capabilities/config/unset.verb.js +51 -0
- package/dist/src/capabilities/config/unset.verb.js.map +1 -0
- package/dist/src/capabilities/create/cliProjection.js +203 -0
- package/dist/src/capabilities/create/cliProjection.js.map +1 -0
- package/dist/src/capabilities/create/constants.js +51 -0
- package/dist/src/capabilities/create/constants.js.map +1 -0
- package/dist/src/capabilities/create/create.render.js +105 -0
- package/dist/src/capabilities/create/create.render.js.map +1 -0
- package/dist/src/capabilities/create/create.verb.js +413 -0
- package/dist/src/capabilities/create/create.verb.js.map +1 -0
- package/dist/src/capabilities/create/createHelp.js +47 -0
- package/dist/src/capabilities/create/createHelp.js.map +1 -0
- package/dist/src/capabilities/create/generatorToVerbSpec.js +106 -0
- package/dist/src/capabilities/create/generatorToVerbSpec.js.map +1 -0
- package/dist/src/capabilities/create/index.js +43 -0
- package/dist/src/capabilities/create/index.js.map +1 -0
- package/dist/src/capabilities/create/moduleNotFound.js +23 -0
- package/dist/src/capabilities/create/moduleNotFound.js.map +1 -0
- package/dist/src/capabilities/create/mount.js +302 -0
- package/dist/src/capabilities/create/mount.js.map +1 -0
- package/dist/src/capabilities/create/pathJail.js +65 -0
- package/dist/src/capabilities/create/pathJail.js.map +1 -0
- package/dist/src/capabilities/create/pickGenerator.js +48 -0
- package/dist/src/capabilities/create/pickGenerator.js.map +1 -0
- package/dist/src/capabilities/distribution.js +82 -0
- package/dist/src/capabilities/distribution.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/checkKeStore.js +41 -0
- package/dist/src/capabilities/doctor/checks/checkKeStore.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/checkNodeVersion.js +26 -0
- package/dist/src/capabilities/doctor/checks/checkNodeVersion.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/checkPackageRefs.js +156 -0
- package/dist/src/capabilities/doctor/checks/checkPackageRefs.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/checkPaths.js +62 -0
- package/dist/src/capabilities/doctor/checks/checkPaths.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/checkPragmaVersion.js +32 -0
- package/dist/src/capabilities/doctor/checks/checkPragmaVersion.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/checkShellCompletions.js +199 -0
- package/dist/src/capabilities/doctor/checks/checkShellCompletions.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/harnessInventory.js +195 -0
- package/dist/src/capabilities/doctor/checks/harnessInventory.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/index.js +27 -0
- package/dist/src/capabilities/doctor/checks/index.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/isSupportedNodeVersion.js +32 -0
- package/dist/src/capabilities/doctor/checks/isSupportedNodeVersion.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/mcpCommand.js +57 -0
- package/dist/src/capabilities/doctor/checks/mcpCommand.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/targetHealth.js +459 -0
- package/dist/src/capabilities/doctor/checks/targetHealth.js.map +1 -0
- package/dist/src/capabilities/doctor/doctor.render.js +164 -0
- package/dist/src/capabilities/doctor/doctor.render.js.map +1 -0
- package/dist/src/capabilities/doctor/doctor.verb.js +51 -0
- package/dist/src/capabilities/doctor/doctor.verb.js.map +1 -0
- package/dist/src/capabilities/doctor/index.js +5 -0
- package/dist/src/capabilities/doctor/index.js.map +1 -0
- package/dist/src/capabilities/doctor/runChecks.js +88 -0
- package/dist/src/capabilities/doctor/runChecks.js.map +1 -0
- package/dist/src/capabilities/doctor/types.js +5 -0
- package/dist/src/capabilities/doctor/types.js.map +1 -0
- package/dist/src/capabilities/graph/connect.render.js +101 -0
- package/dist/src/capabilities/graph/connect.render.js.map +1 -0
- package/dist/src/capabilities/graph/connect.types.js +21 -0
- package/dist/src/capabilities/graph/connect.types.js.map +1 -0
- package/dist/src/capabilities/graph/connect.verb.js +150 -0
- package/dist/src/capabilities/graph/connect.verb.js.map +1 -0
- package/dist/src/capabilities/graph/index.js +21 -0
- package/dist/src/capabilities/graph/index.js.map +1 -0
- package/dist/src/capabilities/graph/inspect.render.js +82 -0
- package/dist/src/capabilities/graph/inspect.render.js.map +1 -0
- package/dist/src/capabilities/graph/inspect.verb.js +55 -0
- package/dist/src/capabilities/graph/inspect.verb.js.map +1 -0
- package/dist/src/capabilities/graph/query.render.js +105 -0
- package/dist/src/capabilities/graph/query.render.js.map +1 -0
- package/dist/src/capabilities/graph/query.verb.js +51 -0
- package/dist/src/capabilities/graph/query.verb.js.map +1 -0
- package/dist/src/capabilities/graph/queryText.js +234 -0
- package/dist/src/capabilities/graph/queryText.js.map +1 -0
- package/dist/src/capabilities/graph/relationIndex.js +302 -0
- package/dist/src/capabilities/graph/relationIndex.js.map +1 -0
- package/dist/src/capabilities/graph/runConnect.js +456 -0
- package/dist/src/capabilities/graph/runConnect.js.map +1 -0
- package/dist/src/capabilities/graph/runQuery.js +60 -0
- package/dist/src/capabilities/graph/runQuery.js.map +1 -0
- package/dist/src/capabilities/index.js +64 -0
- package/dist/src/capabilities/index.js.map +1 -0
- package/dist/src/capabilities/info/collectInfo.js +74 -0
- package/dist/src/capabilities/info/collectInfo.js.map +1 -0
- package/dist/src/capabilities/info/index.js +5 -0
- package/dist/src/capabilities/info/index.js.map +1 -0
- package/dist/src/capabilities/info/info.render.js +68 -0
- package/dist/src/capabilities/info/info.render.js.map +1 -0
- package/dist/src/capabilities/info/info.verb.js +44 -0
- package/dist/src/capabilities/info/info.verb.js.map +1 -0
- package/dist/src/capabilities/info/types.js +5 -0
- package/dist/src/capabilities/info/types.js.map +1 -0
- package/dist/src/capabilities/meta/complete.verb.js +43 -0
- package/dist/src/capabilities/meta/complete.verb.js.map +1 -0
- package/dist/src/capabilities/meta/index.js +13 -0
- package/dist/src/capabilities/meta/index.js.map +1 -0
- package/dist/src/capabilities/meta/mcp.verb.js +35 -0
- package/dist/src/capabilities/meta/mcp.verb.js.map +1 -0
- package/dist/src/capabilities/ontology/index.js +21 -0
- package/dist/src/capabilities/ontology/index.js.map +1 -0
- package/dist/src/capabilities/ontology/queries.js +123 -0
- package/dist/src/capabilities/ontology/queries.js.map +1 -0
- package/dist/src/capabilities/ontology/render.js +66 -0
- package/dist/src/capabilities/ontology/render.js.map +1 -0
- package/dist/src/capabilities/ontology/verbs.js +190 -0
- package/dist/src/capabilities/ontology/verbs.js.map +1 -0
- package/dist/src/capabilities/packages/add.verb.js +67 -0
- package/dist/src/capabilities/packages/add.verb.js.map +1 -0
- package/dist/src/capabilities/packages/dependencies.js +103 -0
- package/dist/src/capabilities/packages/dependencies.js.map +1 -0
- package/dist/src/capabilities/packages/files.js +190 -0
- package/dist/src/capabilities/packages/files.js.map +1 -0
- package/dist/src/capabilities/packages/git.js +178 -0
- package/dist/src/capabilities/packages/git.js.map +1 -0
- package/dist/src/capabilities/packages/index.js +30 -0
- package/dist/src/capabilities/packages/index.js.map +1 -0
- package/dist/src/capabilities/packages/init.verb.js +40 -0
- package/dist/src/capabilities/packages/init.verb.js.map +1 -0
- package/dist/src/capabilities/packages/install.js +338 -0
- package/dist/src/capabilities/packages/install.js.map +1 -0
- package/dist/src/capabilities/packages/lockfile.js +378 -0
- package/dist/src/capabilities/packages/lockfile.js.map +1 -0
- package/dist/src/capabilities/packages/manifest.js +181 -0
- package/dist/src/capabilities/packages/manifest.js.map +1 -0
- package/dist/src/capabilities/packages/npm.js +216 -0
- package/dist/src/capabilities/packages/npm.js.map +1 -0
- package/dist/src/capabilities/packages/packages.render.js +59 -0
- package/dist/src/capabilities/packages/packages.render.js.map +1 -0
- package/dist/src/capabilities/packages/range.js +134 -0
- package/dist/src/capabilities/packages/range.js.map +1 -0
- package/dist/src/capabilities/packages/remove.verb.js +38 -0
- package/dist/src/capabilities/packages/remove.verb.js.map +1 -0
- package/dist/src/capabilities/packages/runLock.js +316 -0
- package/dist/src/capabilities/packages/runLock.js.map +1 -0
- package/dist/src/capabilities/packages/runVerbs.js +86 -0
- package/dist/src/capabilities/packages/runVerbs.js.map +1 -0
- package/dist/src/capabilities/packages/skills.js +233 -0
- package/dist/src/capabilities/packages/skills.js.map +1 -0
- package/dist/src/capabilities/packages/source.js +251 -0
- package/dist/src/capabilities/packages/source.js.map +1 -0
- package/dist/src/capabilities/packages/tar.js +200 -0
- package/dist/src/capabilities/packages/tar.js.map +1 -0
- package/dist/src/capabilities/packages/types.js +5 -0
- package/dist/src/capabilities/packages/types.js.map +1 -0
- package/dist/src/capabilities/packages/update.verb.js +46 -0
- package/dist/src/capabilities/packages/update.verb.js.map +1 -0
- package/dist/src/capabilities/prompt/index.js +16 -0
- package/dist/src/capabilities/prompt/index.js.map +1 -0
- package/dist/src/capabilities/prompt/prompt.render.js +78 -0
- package/dist/src/capabilities/prompt/prompt.render.js.map +1 -0
- package/dist/src/capabilities/prompt/types.js +10 -0
- package/dist/src/capabilities/prompt/types.js.map +1 -0
- package/dist/src/capabilities/prompt/verbs.js +104 -0
- package/dist/src/capabilities/prompt/verbs.js.map +1 -0
- package/dist/src/capabilities/resources/index.js +10 -0
- package/dist/src/capabilities/resources/index.js.map +1 -0
- package/dist/src/capabilities/resources/provider.js +433 -0
- package/dist/src/capabilities/resources/provider.js.map +1 -0
- package/dist/src/capabilities/setup/buildPlan.js +194 -0
- package/dist/src/capabilities/setup/buildPlan.js.map +1 -0
- package/dist/src/capabilities/setup/index.js +5 -0
- package/dist/src/capabilities/setup/index.js.map +1 -0
- package/dist/src/capabilities/setup/mode.js +53 -0
- package/dist/src/capabilities/setup/mode.js.map +1 -0
- package/dist/src/capabilities/setup/operations/index.js +44 -0
- package/dist/src/capabilities/setup/operations/index.js.map +1 -0
- package/dist/src/capabilities/setup/operations/setupCompletions.js +164 -0
- package/dist/src/capabilities/setup/operations/setupCompletions.js.map +1 -0
- package/dist/src/capabilities/setup/operations/setupConfig.js +103 -0
- package/dist/src/capabilities/setup/operations/setupConfig.js.map +1 -0
- package/dist/src/capabilities/setup/operations/setupGenerator.js +461 -0
- package/dist/src/capabilities/setup/operations/setupGenerator.js.map +1 -0
- package/dist/src/capabilities/setup/operations/setupLsp.js +646 -0
- package/dist/src/capabilities/setup/operations/setupLsp.js.map +1 -0
- package/dist/src/capabilities/setup/operations/setupMcp.js +399 -0
- package/dist/src/capabilities/setup/operations/setupMcp.js.map +1 -0
- package/dist/src/capabilities/setup/operations/setupSkills.js +820 -0
- package/dist/src/capabilities/setup/operations/setupSkills.js.map +1 -0
- package/dist/src/capabilities/setup/operations/writability.js +114 -0
- package/dist/src/capabilities/setup/operations/writability.js.map +1 -0
- package/dist/src/capabilities/setup/plan.js +177 -0
- package/dist/src/capabilities/setup/plan.js.map +1 -0
- package/dist/src/capabilities/setup/plan.render.js +295 -0
- package/dist/src/capabilities/setup/plan.render.js.map +1 -0
- package/dist/src/capabilities/setup/setup.render.js +60 -0
- package/dist/src/capabilities/setup/setup.render.js.map +1 -0
- package/dist/src/capabilities/setup/setup.verb.js +452 -0
- package/dist/src/capabilities/setup/setup.verb.js.map +1 -0
- package/dist/src/capabilities/setup/shell.js +196 -0
- package/dist/src/capabilities/setup/shell.js.map +1 -0
- package/dist/src/capabilities/setup/targets.js +524 -0
- package/dist/src/capabilities/setup/targets.js.map +1 -0
- package/dist/src/capabilities/setup/types.js +5 -0
- package/dist/src/capabilities/setup/types.js.map +1 -0
- package/dist/src/capabilities/shared/assertExecOk.js +142 -0
- package/dist/src/capabilities/shared/assertExecOk.js.map +1 -0
- package/dist/src/capabilities/shared/calls.js +16 -0
- package/dist/src/capabilities/shared/calls.js.map +1 -0
- package/dist/src/capabilities/shared/index.js +28 -0
- package/dist/src/capabilities/shared/index.js.map +1 -0
- package/dist/src/capabilities/shared/packageManager.js +350 -0
- package/dist/src/capabilities/shared/packageManager.js.map +1 -0
- package/dist/src/capabilities/shared/registry.js +49 -0
- package/dist/src/capabilities/shared/registry.js.map +1 -0
- package/dist/src/capabilities/shared/releaseState.js +177 -0
- package/dist/src/capabilities/shared/releaseState.js.map +1 -0
- package/dist/src/capabilities/shared/semver.js +77 -0
- package/dist/src/capabilities/shared/semver.js.map +1 -0
- package/dist/src/capabilities/skill/discover.js +265 -0
- package/dist/src/capabilities/skill/discover.js.map +1 -0
- package/dist/src/capabilities/skill/index.js +10 -0
- package/dist/src/capabilities/skill/index.js.map +1 -0
- package/dist/src/capabilities/skill/render.js +52 -0
- package/dist/src/capabilities/skill/render.js.map +1 -0
- package/dist/src/capabilities/skill/verbs.js +84 -0
- package/dist/src/capabilities/skill/verbs.js.map +1 -0
- package/dist/src/capabilities/sources/collectStatus.js +108 -0
- package/dist/src/capabilities/sources/collectStatus.js.map +1 -0
- package/dist/src/capabilities/sources/index.js +14 -0
- package/dist/src/capabilities/sources/index.js.map +1 -0
- package/dist/src/capabilities/sources/installSkills.js +308 -0
- package/dist/src/capabilities/sources/installSkills.js.map +1 -0
- 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 +60 -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 +491 -0
- package/dist/src/capabilities/sources/runUpdate.js.map +1 -0
- package/dist/src/capabilities/sources/status.render.js +80 -0
- package/dist/src/capabilities/sources/status.render.js.map +1 -0
- package/dist/src/capabilities/sources/status.verb.js +41 -0
- package/dist/src/capabilities/sources/status.verb.js.map +1 -0
- package/dist/src/capabilities/sources/types.js +6 -0
- package/dist/src/capabilities/sources/types.js.map +1 -0
- package/dist/src/capabilities/sources/update.render.js +34 -0
- package/dist/src/capabilities/sources/update.render.js.map +1 -0
- package/dist/src/capabilities/sources/update.verb.js +57 -0
- package/dist/src/capabilities/sources/update.verb.js.map +1 -0
- package/dist/src/capabilities/upgrade/index.js +5 -0
- package/dist/src/capabilities/upgrade/index.js.map +1 -0
- package/dist/src/capabilities/upgrade/runUpgrade.js +138 -0
- package/dist/src/capabilities/upgrade/runUpgrade.js.map +1 -0
- package/dist/src/capabilities/upgrade/types.js +5 -0
- package/dist/src/capabilities/upgrade/types.js.map +1 -0
- package/dist/src/capabilities/upgrade/upgrade.render.js +52 -0
- package/dist/src/capabilities/upgrade/upgrade.render.js.map +1 -0
- package/dist/src/capabilities/upgrade/upgrade.verb.js +54 -0
- package/dist/src/capabilities/upgrade/upgrade.verb.js.map +1 -0
- package/dist/src/capabilities/version/index.js +10 -0
- package/dist/src/capabilities/version/index.js.map +1 -0
- package/dist/src/capabilities/version/version.verb.js +37 -0
- package/dist/src/capabilities/version/version.verb.js.map +1 -0
- package/dist/src/constants.js +105 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/index.js +12 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/kernel/baseDirs.js +58 -0
- package/dist/src/kernel/baseDirs.js.map +1 -0
- package/dist/src/kernel/completion/complete.js +66 -0
- package/dist/src/kernel/completion/complete.js.map +1 -0
- package/dist/src/kernel/completion/emitScripts.js +92 -0
- package/dist/src/kernel/completion/emitScripts.js.map +1 -0
- package/dist/src/kernel/completion/entitySource.js +286 -0
- package/dist/src/kernel/completion/entitySource.js.map +1 -0
- package/dist/src/kernel/completion/index.js +14 -0
- package/dist/src/kernel/completion/index.js.map +1 -0
- package/dist/src/kernel/completion/model.js +301 -0
- package/dist/src/kernel/completion/model.js.map +1 -0
- package/dist/src/kernel/completion/parse.js +253 -0
- package/dist/src/kernel/completion/parse.js.map +1 -0
- package/dist/src/kernel/completion/rank.js +101 -0
- package/dist/src/kernel/completion/rank.js.map +1 -0
- package/dist/src/kernel/completion/resolve.js +101 -0
- package/dist/src/kernel/completion/resolve.js.map +1 -0
- package/dist/src/kernel/completion/templates/bash.js +209 -0
- package/dist/src/kernel/completion/templates/bash.js.map +1 -0
- package/dist/src/kernel/completion/templates/fish.js +214 -0
- package/dist/src/kernel/completion/templates/fish.js.map +1 -0
- package/dist/src/kernel/completion/templates/index.js +23 -0
- package/dist/src/kernel/completion/templates/index.js.map +1 -0
- package/dist/src/kernel/completion/templates/shared.js +98 -0
- package/dist/src/kernel/completion/templates/shared.js.map +1 -0
- package/dist/src/kernel/completion/templates/zsh.js +201 -0
- package/dist/src/kernel/completion/templates/zsh.js.map +1 -0
- package/dist/src/kernel/completion/types.js +13 -0
- package/dist/src/kernel/completion/types.js.map +1 -0
- package/dist/src/kernel/config/defaults.js +20 -0
- package/dist/src/kernel/config/defaults.js.map +1 -0
- package/dist/src/kernel/config/evaluateProjectConfig.js +206 -0
- package/dist/src/kernel/config/evaluateProjectConfig.js.map +1 -0
- package/dist/src/kernel/config/findProjectConfig.js +8 -0
- package/dist/src/kernel/config/findProjectConfig.js.map +1 -0
- package/dist/src/kernel/config/firstRun.js +34 -0
- package/dist/src/kernel/config/firstRun.js.map +1 -0
- package/dist/src/kernel/config/globalConfig.js +79 -0
- package/dist/src/kernel/config/globalConfig.js.map +1 -0
- package/dist/src/kernel/config/index.js +16 -0
- package/dist/src/kernel/config/index.js.map +1 -0
- package/dist/src/kernel/config/paths.js +32 -0
- package/dist/src/kernel/config/paths.js.map +1 -0
- package/dist/src/kernel/config/readConfig.js +79 -0
- package/dist/src/kernel/config/readConfig.js.map +1 -0
- package/dist/src/kernel/config/schema.js +129 -0
- package/dist/src/kernel/config/schema.js.map +1 -0
- package/dist/src/kernel/config/types.js +19 -0
- package/dist/src/kernel/config/types.js.map +1 -0
- package/dist/src/kernel/config/writeConfigField.js +59 -0
- package/dist/src/kernel/config/writeConfigField.js.map +1 -0
- package/dist/src/kernel/copy.js +43 -0
- package/dist/src/kernel/copy.js.map +1 -0
- package/dist/src/kernel/distribution/index.js +6 -0
- package/dist/src/kernel/distribution/index.js.map +1 -0
- package/dist/src/kernel/distribution/packageRoot.js +58 -0
- package/dist/src/kernel/distribution/packageRoot.js.map +1 -0
- package/dist/src/kernel/distribution/registry.js +77 -0
- package/dist/src/kernel/distribution/registry.js.map +1 -0
- package/dist/src/kernel/distribution/types.js +16 -0
- package/dist/src/kernel/distribution/types.js.map +1 -0
- package/dist/src/kernel/error/PragmaError.js +149 -0
- package/dist/src/kernel/error/PragmaError.js.map +1 -0
- package/dist/src/kernel/error/constants.js +40 -0
- package/dist/src/kernel/error/constants.js.map +1 -0
- package/dist/src/kernel/error/fromTaskError.js +96 -0
- package/dist/src/kernel/error/fromTaskError.js.map +1 -0
- package/dist/src/kernel/error/index.js +13 -0
- package/dist/src/kernel/error/index.js.map +1 -0
- package/dist/src/kernel/error/recovery.js +34 -0
- package/dist/src/kernel/error/recovery.js.map +1 -0
- package/dist/src/kernel/error/renderError.js +125 -0
- package/dist/src/kernel/error/renderError.js.map +1 -0
- package/dist/src/kernel/error/serialize.js +25 -0
- package/dist/src/kernel/error/serialize.js.map +1 -0
- package/dist/src/kernel/error/types.js +9 -0
- package/dist/src/kernel/error/types.js.map +1 -0
- package/dist/src/kernel/error/validOptions.js +41 -0
- package/dist/src/kernel/error/validOptions.js.map +1 -0
- package/dist/src/kernel/index.js +34 -0
- package/dist/src/kernel/index.js.map +1 -0
- package/dist/src/kernel/interactivity.js +68 -0
- package/dist/src/kernel/interactivity.js.map +1 -0
- package/dist/src/kernel/packs/collect.js +340 -0
- package/dist/src/kernel/packs/collect.js.map +1 -0
- package/dist/src/kernel/packs/compile.js +451 -0
- package/dist/src/kernel/packs/compile.js.map +1 -0
- package/dist/src/kernel/packs/cursor.js +135 -0
- package/dist/src/kernel/packs/cursor.js.map +1 -0
- package/dist/src/kernel/packs/disclosure.js +76 -0
- package/dist/src/kernel/packs/disclosure.js.map +1 -0
- package/dist/src/kernel/packs/glob.js +38 -0
- package/dist/src/kernel/packs/glob.js.map +1 -0
- package/dist/src/kernel/packs/graphql/buildLookupDocument.js +265 -0
- package/dist/src/kernel/packs/graphql/buildLookupDocument.js.map +1 -0
- package/dist/src/kernel/packs/graphql/fetchGraphqlLookup.js +157 -0
- package/dist/src/kernel/packs/graphql/fetchGraphqlLookup.js.map +1 -0
- package/dist/src/kernel/packs/graphql/index.js +20 -0
- package/dist/src/kernel/packs/graphql/index.js.map +1 -0
- package/dist/src/kernel/packs/graphql/nameMap.js +63 -0
- package/dist/src/kernel/packs/graphql/nameMap.js.map +1 -0
- package/dist/src/kernel/packs/index.js +34 -0
- package/dist/src/kernel/packs/index.js.map +1 -0
- package/dist/src/kernel/packs/iri.js +108 -0
- package/dist/src/kernel/packs/iri.js.map +1 -0
- package/dist/src/kernel/packs/paging.js +108 -0
- package/dist/src/kernel/packs/paging.js.map +1 -0
- package/dist/src/kernel/packs/projectNouns.js +212 -0
- package/dist/src/kernel/packs/projectNouns.js.map +1 -0
- package/dist/src/kernel/packs/renderPack.js +328 -0
- package/dist/src/kernel/packs/renderPack.js.map +1 -0
- package/dist/src/kernel/packs/resolveEntity.js +485 -0
- package/dist/src/kernel/packs/resolveEntity.js.map +1 -0
- package/dist/src/kernel/packs/runBodies.js +337 -0
- package/dist/src/kernel/packs/runBodies.js.map +1 -0
- package/dist/src/kernel/packs/sample.js +56 -0
- package/dist/src/kernel/packs/sample.js.map +1 -0
- package/dist/src/kernel/packs/schema.js +623 -0
- package/dist/src/kernel/packs/schema.js.map +1 -0
- package/dist/src/kernel/packs/sparql/authorQuery.js +227 -0
- package/dist/src/kernel/packs/sparql/authorQuery.js.map +1 -0
- package/dist/src/kernel/packs/sparql/buildListQuery.js +318 -0
- package/dist/src/kernel/packs/sparql/buildListQuery.js.map +1 -0
- package/dist/src/kernel/packs/sparql/buildLookupQuery.js +611 -0
- package/dist/src/kernel/packs/sparql/buildLookupQuery.js.map +1 -0
- package/dist/src/kernel/packs/sparql/escape.js +21 -0
- package/dist/src/kernel/packs/sparql/escape.js.map +1 -0
- package/dist/src/kernel/packs/sparql/filterValues.js +154 -0
- package/dist/src/kernel/packs/sparql/filterValues.js.map +1 -0
- package/dist/src/kernel/packs/sparql/index.js +41 -0
- package/dist/src/kernel/packs/sparql/index.js.map +1 -0
- package/dist/src/kernel/packs/sparql/runSelect.js +105 -0
- package/dist/src/kernel/packs/sparql/runSelect.js.map +1 -0
- package/dist/src/kernel/packs/sparql/searchTerm.js +25 -0
- package/dist/src/kernel/packs/sparql/searchTerm.js.map +1 -0
- package/dist/src/kernel/packs/storyRules.js +178 -0
- package/dist/src/kernel/packs/storyRules.js.map +1 -0
- package/dist/src/kernel/packs/tierScope.js +310 -0
- package/dist/src/kernel/packs/tierScope.js.map +1 -0
- package/dist/src/kernel/packs/types.js +114 -0
- package/dist/src/kernel/packs/types.js.map +1 -0
- package/dist/src/kernel/packs/uniqueness.js +30 -0
- package/dist/src/kernel/packs/uniqueness.js.map +1 -0
- package/dist/src/kernel/project/cli/buildProgram.js +276 -0
- package/dist/src/kernel/project/cli/buildProgram.js.map +1 -0
- package/dist/src/kernel/project/cli/constants.js +27 -0
- package/dist/src/kernel/project/cli/constants.js.map +1 -0
- package/dist/src/kernel/project/cli/dispatch.js +552 -0
- package/dist/src/kernel/project/cli/dispatch.js.map +1 -0
- package/dist/src/kernel/project/cli/exitCodes.js +66 -0
- package/dist/src/kernel/project/cli/exitCodes.js.map +1 -0
- package/dist/src/kernel/project/cli/globalFlags.js +219 -0
- package/dist/src/kernel/project/cli/globalFlags.js.map +1 -0
- package/dist/src/kernel/project/cli/helpFormat.js +58 -0
- package/dist/src/kernel/project/cli/helpFormat.js.map +1 -0
- package/dist/src/kernel/project/cli/index.js +14 -0
- package/dist/src/kernel/project/cli/index.js.map +1 -0
- package/dist/src/kernel/project/cli/rootHelp.js +266 -0
- package/dist/src/kernel/project/cli/rootHelp.js.map +1 -0
- package/dist/src/kernel/project/cli/suggest.js +75 -0
- package/dist/src/kernel/project/cli/suggest.js.map +1 -0
- package/dist/src/kernel/project/cli/suggestNames.js +163 -0
- package/dist/src/kernel/project/cli/suggestNames.js.map +1 -0
- package/dist/src/kernel/project/cli/verbHelp.js +130 -0
- package/dist/src/kernel/project/cli/verbHelp.js.map +1 -0
- package/dist/src/kernel/project/mcp/buildServer.js +74 -0
- package/dist/src/kernel/project/mcp/buildServer.js.map +1 -0
- package/dist/src/kernel/project/mcp/envelope.js +38 -0
- package/dist/src/kernel/project/mcp/envelope.js.map +1 -0
- package/dist/src/kernel/project/mcp/index.js +8 -0
- package/dist/src/kernel/project/mcp/index.js.map +1 -0
- package/dist/src/kernel/project/mcp/instructions.js +114 -0
- package/dist/src/kernel/project/mcp/instructions.js.map +1 -0
- package/dist/src/kernel/project/mcp/mcpError.js +42 -0
- package/dist/src/kernel/project/mcp/mcpError.js.map +1 -0
- package/dist/src/kernel/project/mcp/prompts/index.js +36 -0
- package/dist/src/kernel/project/mcp/prompts/index.js.map +1 -0
- package/dist/src/kernel/project/mcp/prompts/provider.js +98 -0
- package/dist/src/kernel/project/mcp/prompts/provider.js.map +1 -0
- package/dist/src/kernel/project/mcp/prompts/source.js +163 -0
- package/dist/src/kernel/project/mcp/prompts/source.js.map +1 -0
- package/dist/src/kernel/project/mcp/registerVerb.js +378 -0
- package/dist/src/kernel/project/mcp/registerVerb.js.map +1 -0
- package/dist/src/kernel/project/mcp/serve.js +35 -0
- package/dist/src/kernel/project/mcp/serve.js.map +1 -0
- package/dist/src/kernel/render/compactUri.js +24 -0
- package/dist/src/kernel/render/compactUri.js.map +1 -0
- package/dist/src/kernel/render/contracts.js +10 -0
- package/dist/src/kernel/render/contracts.js.map +1 -0
- package/dist/src/kernel/render/disclosure.js +34 -0
- package/dist/src/kernel/render/disclosure.js.map +1 -0
- package/dist/src/kernel/render/displaySafe.js +72 -0
- package/dist/src/kernel/render/displaySafe.js.map +1 -0
- package/dist/src/kernel/render/envelope.js +30 -0
- package/dist/src/kernel/render/envelope.js.map +1 -0
- package/dist/src/kernel/render/formatters.js +27 -0
- package/dist/src/kernel/render/formatters.js.map +1 -0
- package/dist/src/kernel/render/index.js +15 -0
- package/dist/src/kernel/render/index.js.map +1 -0
- package/dist/src/kernel/render/prefixes.js +46 -0
- package/dist/src/kernel/render/prefixes.js.map +1 -0
- package/dist/src/kernel/render/renderers.js +500 -0
- package/dist/src/kernel/render/renderers.js.map +1 -0
- package/dist/src/kernel/render/style.js +105 -0
- package/dist/src/kernel/render/style.js.map +1 -0
- package/dist/src/kernel/render/turtle.js +211 -0
- package/dist/src/kernel/render/turtle.js.map +1 -0
- package/dist/src/kernel/render/vocabulary.js +174 -0
- package/dist/src/kernel/render/vocabulary.js.map +1 -0
- package/dist/src/kernel/render/writeStdout.js +43 -0
- package/dist/src/kernel/render/writeStdout.js.map +1 -0
- package/dist/src/kernel/runtime/boot.js +49 -0
- package/dist/src/kernel/runtime/boot.js.map +1 -0
- package/dist/src/kernel/runtime/facade.js +39 -0
- package/dist/src/kernel/runtime/facade.js.map +1 -0
- package/dist/src/kernel/runtime/findProjectConfig.js +58 -0
- package/dist/src/kernel/runtime/findProjectConfig.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/build.js +182 -0
- package/dist/src/kernel/runtime/graphpack/build.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/buildIndex.js +320 -0
- package/dist/src/kernel/runtime/graphpack/buildIndex.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/embedded.js +114 -0
- package/dist/src/kernel/runtime/graphpack/embedded.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/hash.js +43 -0
- package/dist/src/kernel/runtime/graphpack/hash.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/index.js +11 -0
- package/dist/src/kernel/runtime/graphpack/index.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/manifest.js +159 -0
- package/dist/src/kernel/runtime/graphpack/manifest.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/read.js +143 -0
- package/dist/src/kernel/runtime/graphpack/read.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/schemas.js +88 -0
- package/dist/src/kernel/runtime/graphpack/schemas.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/stories.js +68 -0
- package/dist/src/kernel/runtime/graphpack/stories.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/types.js +69 -0
- package/dist/src/kernel/runtime/graphpack/types.js.map +1 -0
- package/dist/src/kernel/runtime/index.js +8 -0
- package/dist/src/kernel/runtime/index.js.map +1 -0
- package/dist/src/kernel/runtime/loadSession.js +43 -0
- package/dist/src/kernel/runtime/loadSession.js.map +1 -0
- package/dist/src/kernel/runtime/lockState.js +151 -0
- package/dist/src/kernel/runtime/lockState.js.map +1 -0
- package/dist/src/kernel/runtime/packVersion.js +75 -0
- package/dist/src/kernel/runtime/packVersion.js.map +1 -0
- package/dist/src/kernel/runtime/paths.js +160 -0
- package/dist/src/kernel/runtime/paths.js.map +1 -0
- package/dist/src/kernel/runtime/probe.js +37 -0
- package/dist/src/kernel/runtime/probe.js.map +1 -0
- package/dist/src/kernel/runtime/readEntity.js +417 -0
- package/dist/src/kernel/runtime/readEntity.js.map +1 -0
- package/dist/src/kernel/runtime/refs/gitOps.js +347 -0
- package/dist/src/kernel/runtime/refs/gitOps.js.map +1 -0
- package/dist/src/kernel/runtime/refs/index.js +29 -0
- package/dist/src/kernel/runtime/refs/index.js.map +1 -0
- package/dist/src/kernel/runtime/refs/parseRef.js +86 -0
- package/dist/src/kernel/runtime/refs/parseRef.js.map +1 -0
- package/dist/src/kernel/runtime/refs/resolve.js +397 -0
- package/dist/src/kernel/runtime/refs/resolve.js.map +1 -0
- package/dist/src/kernel/runtime/resolveSources.js +179 -0
- package/dist/src/kernel/runtime/resolveSources.js.map +1 -0
- package/dist/src/kernel/runtime/store.js +75 -0
- package/dist/src/kernel/runtime/store.js.map +1 -0
- package/dist/src/kernel/runtime/storeReadiness.js +52 -0
- package/dist/src/kernel/runtime/storeReadiness.js.map +1 -0
- package/dist/src/kernel/runtime/types.js +11 -0
- package/dist/src/kernel/runtime/types.js.map +1 -0
- package/dist/src/kernel/spec/asVerb.js +21 -0
- package/dist/src/kernel/spec/asVerb.js.map +1 -0
- 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 +576 -0
- package/dist/src/kernel/spec/emitReference.js.map +1 -0
- package/dist/src/kernel/spec/emitSurface.js +214 -0
- package/dist/src/kernel/spec/emitSurface.js.map +1 -0
- package/dist/src/kernel/spec/guidance.js +63 -0
- package/dist/src/kernel/spec/guidance.js.map +1 -0
- package/dist/src/kernel/spec/index.js +11 -0
- package/dist/src/kernel/spec/index.js.map +1 -0
- package/dist/src/kernel/spec/surfaceConformance.js +103 -0
- package/dist/src/kernel/spec/surfaceConformance.js.map +1 -0
- package/dist/src/kernel/spec/types.js +14 -0
- package/dist/src/kernel/spec/types.js.map +1 -0
- package/dist/src/kernel/spec/validate.js +110 -0
- package/dist/src/kernel/spec/validate.js.map +1 -0
- package/dist/src/kernel/spec/wireType.js +36 -0
- package/dist/src/kernel/spec/wireType.js.map +1 -0
- package/dist/src/kernel/vocabulary.js +92 -0
- package/dist/src/kernel/vocabulary.js.map +1 -0
- package/dist/src/main.js +453 -0
- package/dist/src/main.js.map +1 -0
- package/dist/src/run.js +22 -0
- package/dist/src/run.js.map +1 -0
- package/dist/src/testing/behavioral/liveReadSurface.js +68 -0
- package/dist/src/testing/behavioral/liveReadSurface.js.map +1 -0
- package/dist/src/testing/build.globalSetup.js +569 -0
- package/dist/src/testing/build.globalSetup.js.map +1 -0
- package/dist/src/testing/eval/cases/stable.js +144 -0
- package/dist/src/testing/eval/cases/stable.js.map +1 -0
- package/dist/src/testing/eval/harness.js +44 -0
- package/dist/src/testing/eval/harness.js.map +1 -0
- package/dist/src/testing/helpers/callSchema.js +36 -0
- package/dist/src/testing/helpers/callSchema.js.map +1 -0
- package/dist/src/testing/helpers/fixtureGraph.js +118 -0
- package/dist/src/testing/helpers/fixtureGraph.js.map +1 -0
- package/dist/src/testing/helpers/packRuntime.js +79 -0
- package/dist/src/testing/helpers/packRuntime.js.map +1 -0
- package/dist/src/testing/helpers/parity.js +82 -0
- package/dist/src/testing/helpers/parity.js.map +1 -0
- package/dist/src/testing/helpers/projectCli.js +28 -0
- package/dist/src/testing/helpers/projectCli.js.map +1 -0
- package/dist/src/testing/helpers/projectMcp.js +104 -0
- package/dist/src/testing/helpers/projectMcp.js.map +1 -0
- package/dist/src/testing/helpers/runCli.js +155 -0
- package/dist/src/testing/helpers/runCli.js.map +1 -0
- package/dist/src/testing/index.js +79 -0
- package/dist/src/testing/index.js.map +1 -0
- package/dist/src/testing/prismRoot.js +13 -0
- package/dist/src/testing/prismRoot.js.map +1 -0
- package/dist/src/testing/setup/build.js +6 -0
- package/dist/src/testing/setup/build.js.map +1 -0
- package/dist/src/testing/setup/calls.js +3 -0
- package/dist/src/testing/setup/calls.js.map +1 -0
- package/dist/src/testing/setup/offline-registry.js +3 -0
- package/dist/src/testing/setup/offline-registry.js.map +1 -0
- package/dist/src/testing/setup/temp-root.js +3 -0
- package/dist/src/testing/setup/temp-root.js.map +1 -0
- package/dist/src/testing/setup/xdg.js +3 -0
- package/dist/src/testing/setup/xdg.js.map +1 -0
- package/dist/src/testing/setupCallChecking.js +29 -0
- package/dist/src/testing/setupCallChecking.js.map +1 -0
- package/dist/src/testing/setupOfflineRegistry.js +19 -0
- package/dist/src/testing/setupOfflineRegistry.js.map +1 -0
- package/dist/src/testing/setupXdgIsolation.js +84 -0
- package/dist/src/testing/setupXdgIsolation.js.map +1 -0
- package/dist/src/testing/tempRoot.globalSetup.js +115 -0
- package/dist/src/testing/tempRoot.globalSetup.js.map +1 -0
- package/dist/src/types.js +11 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +122 -4
- package/prism.conf.ts +50 -0
- package/src/bin.ts +12 -0
- package/src/build/generatorSurface.ts +151 -0
- package/src/build/index.ts +42 -0
- package/src/capabilities/capabilities/capabilities.render.ts +94 -0
- package/src/capabilities/capabilities/capabilities.verb.ts +69 -0
- package/src/capabilities/capabilities/catalog.ts +174 -0
- package/src/capabilities/capabilities/index.ts +15 -0
- package/src/capabilities/capabilities/types.ts +58 -0
- package/src/capabilities/colophon/collectColophon.ts +94 -0
- package/src/capabilities/colophon/colophon.render.ts +74 -0
- package/src/capabilities/colophon/colophon.verb.ts +49 -0
- package/src/capabilities/colophon/index.ts +6 -0
- package/src/capabilities/colophon/markdownTerminal.ts +104 -0
- package/src/capabilities/colophon/types.ts +37 -0
- package/src/capabilities/config/collectConfigShow.ts +69 -0
- package/src/capabilities/config/field.render.ts +27 -0
- package/src/capabilities/config/fields.ts +61 -0
- package/src/capabilities/config/get.verb.ts +72 -0
- package/src/capabilities/config/index.ts +10 -0
- package/src/capabilities/config/runField.ts +77 -0
- package/src/capabilities/config/runGet.ts +34 -0
- package/src/capabilities/config/runSet.ts +64 -0
- package/src/capabilities/config/set.verb.ts +80 -0
- package/src/capabilities/config/show.render.ts +142 -0
- package/src/capabilities/config/show.verb.ts +51 -0
- package/src/capabilities/config/types.ts +49 -0
- package/src/capabilities/config/unset.verb.ts +60 -0
- package/src/capabilities/create/cliProjection.ts +244 -0
- package/src/capabilities/create/constants.ts +67 -0
- package/src/capabilities/create/create.render.ts +121 -0
- package/src/capabilities/create/create.verb.ts +492 -0
- package/src/capabilities/create/createHelp.ts +71 -0
- package/src/capabilities/create/generatorToVerbSpec.ts +113 -0
- package/src/capabilities/create/index.ts +49 -0
- package/src/capabilities/create/moduleNotFound.ts +28 -0
- package/src/capabilities/create/mount.ts +403 -0
- package/src/capabilities/create/pathJail.ts +76 -0
- package/src/capabilities/create/pickGenerator.ts +51 -0
- package/src/capabilities/distribution.ts +109 -0
- package/src/capabilities/doctor/checks/checkKeStore.ts +42 -0
- package/src/capabilities/doctor/checks/checkNodeVersion.ts +29 -0
- package/src/capabilities/doctor/checks/checkPackageRefs.ts +186 -0
- package/src/capabilities/doctor/checks/checkPaths.ts +81 -0
- package/src/capabilities/doctor/checks/checkPragmaVersion.ts +36 -0
- package/src/capabilities/doctor/checks/checkShellCompletions.ts +217 -0
- package/src/capabilities/doctor/checks/harnessInventory.ts +302 -0
- package/src/capabilities/doctor/checks/index.ts +27 -0
- package/src/capabilities/doctor/checks/isSupportedNodeVersion.ts +31 -0
- package/src/capabilities/doctor/checks/mcpCommand.ts +69 -0
- package/src/capabilities/doctor/checks/targetHealth.ts +576 -0
- package/src/capabilities/doctor/doctor.render.ts +199 -0
- package/src/capabilities/doctor/doctor.verb.ts +57 -0
- package/src/capabilities/doctor/index.ts +6 -0
- package/src/capabilities/doctor/runChecks.ts +104 -0
- package/src/capabilities/doctor/types.ts +63 -0
- package/src/capabilities/graph/connect.render.ts +141 -0
- package/src/capabilities/graph/connect.types.ts +136 -0
- package/src/capabilities/graph/connect.verb.ts +168 -0
- package/src/capabilities/graph/index.ts +23 -0
- package/src/capabilities/graph/inspect.render.ts +94 -0
- package/src/capabilities/graph/inspect.verb.ts +66 -0
- package/src/capabilities/graph/query.render.ts +127 -0
- package/src/capabilities/graph/query.verb.ts +61 -0
- package/src/capabilities/graph/queryText.ts +287 -0
- package/src/capabilities/graph/relationIndex.ts +372 -0
- package/src/capabilities/graph/runConnect.ts +576 -0
- package/src/capabilities/graph/runQuery.ts +80 -0
- package/src/capabilities/index.ts +73 -0
- package/src/capabilities/info/collectInfo.ts +90 -0
- package/src/capabilities/info/index.ts +6 -0
- package/src/capabilities/info/info.render.ts +89 -0
- package/src/capabilities/info/info.verb.ts +49 -0
- package/src/capabilities/info/types.ts +50 -0
- package/src/capabilities/meta/complete.verb.ts +52 -0
- package/src/capabilities/meta/index.ts +15 -0
- package/src/capabilities/meta/mcp.verb.ts +39 -0
- package/src/capabilities/ontology/index.ts +23 -0
- package/src/capabilities/ontology/queries.ts +197 -0
- package/src/capabilities/ontology/render.ts +86 -0
- package/src/capabilities/ontology/verbs.ts +242 -0
- package/src/capabilities/packages/add.verb.ts +86 -0
- package/src/capabilities/packages/dependencies.ts +122 -0
- package/src/capabilities/packages/files.ts +260 -0
- package/src/capabilities/packages/git.ts +218 -0
- package/src/capabilities/packages/index.ts +32 -0
- package/src/capabilities/packages/init.verb.ts +48 -0
- package/src/capabilities/packages/install.ts +480 -0
- package/src/capabilities/packages/lockfile.ts +493 -0
- package/src/capabilities/packages/manifest.ts +222 -0
- package/src/capabilities/packages/npm.ts +271 -0
- package/src/capabilities/packages/packages.render.ts +62 -0
- package/src/capabilities/packages/range.ts +149 -0
- package/src/capabilities/packages/remove.verb.ts +48 -0
- package/src/capabilities/packages/runLock.ts +430 -0
- package/src/capabilities/packages/runVerbs.ts +122 -0
- package/src/capabilities/packages/skills.ts +290 -0
- package/src/capabilities/packages/source.ts +338 -0
- package/src/capabilities/packages/tar.ts +217 -0
- package/src/capabilities/packages/types.ts +32 -0
- package/src/capabilities/packages/update.verb.ts +58 -0
- package/src/capabilities/prompt/index.ts +18 -0
- package/src/capabilities/prompt/prompt.render.ts +91 -0
- package/src/capabilities/prompt/types.ts +30 -0
- package/src/capabilities/prompt/verbs.ts +122 -0
- package/src/capabilities/resources/index.ts +15 -0
- package/src/capabilities/resources/provider.ts +535 -0
- package/src/capabilities/setup/buildPlan.ts +267 -0
- package/src/capabilities/setup/index.ts +12 -0
- package/src/capabilities/setup/mode.ts +74 -0
- package/src/capabilities/setup/operations/index.ts +94 -0
- package/src/capabilities/setup/operations/setupCompletions.ts +221 -0
- package/src/capabilities/setup/operations/setupConfig.ts +129 -0
- package/src/capabilities/setup/operations/setupGenerator.ts +651 -0
- package/src/capabilities/setup/operations/setupLsp.ts +934 -0
- package/src/capabilities/setup/operations/setupMcp.ts +583 -0
- package/src/capabilities/setup/operations/setupSkills.ts +1057 -0
- package/src/capabilities/setup/operations/writability.ts +135 -0
- package/src/capabilities/setup/plan.render.ts +371 -0
- package/src/capabilities/setup/plan.ts +320 -0
- package/src/capabilities/setup/setup.render.ts +70 -0
- package/src/capabilities/setup/setup.verb.ts +555 -0
- package/src/capabilities/setup/shell.ts +237 -0
- package/src/capabilities/setup/targets.ts +685 -0
- package/src/capabilities/setup/types.ts +88 -0
- package/src/capabilities/shared/assertExecOk.ts +169 -0
- package/src/capabilities/shared/calls.ts +20 -0
- package/src/capabilities/shared/index.ts +45 -0
- package/src/capabilities/shared/packageManager.ts +457 -0
- package/src/capabilities/shared/registry.ts +63 -0
- package/src/capabilities/shared/releaseState.ts +221 -0
- package/src/capabilities/shared/semver.ts +74 -0
- package/src/capabilities/skill/discover.ts +288 -0
- package/src/capabilities/skill/index.ts +12 -0
- package/src/capabilities/skill/render.ts +64 -0
- package/src/capabilities/skill/verbs.ts +103 -0
- package/src/capabilities/sources/collectStatus.ts +117 -0
- package/src/capabilities/sources/index.ts +16 -0
- package/src/capabilities/sources/installSkills.ts +380 -0
- package/src/capabilities/sources/reset.render.ts +43 -0
- package/src/capabilities/sources/reset.verb.ts +70 -0
- package/src/capabilities/sources/runReset.ts +65 -0
- package/src/capabilities/sources/runUpdate.ts +619 -0
- package/src/capabilities/sources/status.render.ts +95 -0
- package/src/capabilities/sources/status.verb.ts +51 -0
- package/src/capabilities/sources/types.ts +70 -0
- package/src/capabilities/sources/update.render.ts +42 -0
- package/src/capabilities/sources/update.verb.ts +68 -0
- package/src/capabilities/upgrade/index.ts +6 -0
- package/src/capabilities/upgrade/runUpgrade.ts +161 -0
- package/src/capabilities/upgrade/types.ts +29 -0
- package/src/capabilities/upgrade/upgrade.render.ts +61 -0
- package/src/capabilities/upgrade/upgrade.verb.ts +62 -0
- package/src/capabilities/version/index.ts +12 -0
- package/src/capabilities/version/version.verb.ts +40 -0
- package/src/constants.ts +145 -0
- package/src/index.ts +50 -0
- package/src/kernel/baseDirs.ts +73 -0
- package/src/kernel/completion/complete.ts +77 -0
- package/src/kernel/completion/emitScripts.ts +124 -0
- package/src/kernel/completion/entitySource.ts +303 -0
- package/src/kernel/completion/index.ts +42 -0
- package/src/kernel/completion/model.ts +349 -0
- package/src/kernel/completion/parse.ts +309 -0
- package/src/kernel/completion/rank.ts +118 -0
- package/src/kernel/completion/resolve.ts +134 -0
- package/src/kernel/completion/templates/bash.ts +254 -0
- package/src/kernel/completion/templates/fish.ts +267 -0
- package/src/kernel/completion/templates/index.ts +23 -0
- package/src/kernel/completion/templates/shared.ts +134 -0
- package/src/kernel/completion/templates/zsh.ts +246 -0
- package/src/kernel/completion/types.ts +160 -0
- package/src/kernel/config/defaults.ts +23 -0
- package/src/kernel/config/evaluateProjectConfig.ts +240 -0
- package/src/kernel/config/findProjectConfig.ts +8 -0
- package/src/kernel/config/firstRun.ts +34 -0
- package/src/kernel/config/globalConfig.ts +94 -0
- package/src/kernel/config/index.ts +34 -0
- package/src/kernel/config/paths.ts +36 -0
- package/src/kernel/config/readConfig.ts +95 -0
- package/src/kernel/config/schema.ts +144 -0
- package/src/kernel/config/types.ts +162 -0
- package/src/kernel/config/writeConfigField.ts +82 -0
- package/src/kernel/copy.ts +54 -0
- package/src/kernel/distribution/index.ts +27 -0
- package/src/kernel/distribution/packageRoot.ts +58 -0
- package/src/kernel/distribution/registry.ts +99 -0
- package/src/kernel/distribution/types.ts +330 -0
- package/src/kernel/error/PragmaError.ts +184 -0
- package/src/kernel/error/constants.ts +41 -0
- package/src/kernel/error/fromTaskError.ts +102 -0
- package/src/kernel/error/index.ts +23 -0
- package/src/kernel/error/recovery.ts +37 -0
- package/src/kernel/error/renderError.ts +154 -0
- package/src/kernel/error/serialize.ts +28 -0
- package/src/kernel/error/types.ts +83 -0
- package/src/kernel/error/validOptions.ts +45 -0
- package/src/kernel/index.ts +35 -0
- package/src/kernel/interactivity.ts +69 -0
- package/src/kernel/packs/collect.ts +445 -0
- package/src/kernel/packs/compile.ts +596 -0
- package/src/kernel/packs/cursor.ts +135 -0
- package/src/kernel/packs/disclosure.ts +98 -0
- package/src/kernel/packs/glob.ts +39 -0
- package/src/kernel/packs/graphql/buildLookupDocument.ts +404 -0
- package/src/kernel/packs/graphql/fetchGraphqlLookup.ts +216 -0
- package/src/kernel/packs/graphql/index.ts +20 -0
- package/src/kernel/packs/graphql/nameMap.ts +67 -0
- package/src/kernel/packs/index.ts +40 -0
- package/src/kernel/packs/iri.ts +129 -0
- package/src/kernel/packs/paging.ts +110 -0
- package/src/kernel/packs/projectNouns.ts +251 -0
- package/src/kernel/packs/renderPack.ts +478 -0
- package/src/kernel/packs/resolveEntity.ts +734 -0
- package/src/kernel/packs/runBodies.ts +494 -0
- package/src/kernel/packs/sample.ts +60 -0
- package/src/kernel/packs/schema.ts +719 -0
- package/src/kernel/packs/sparql/authorQuery.ts +257 -0
- package/src/kernel/packs/sparql/buildListQuery.ts +434 -0
- package/src/kernel/packs/sparql/buildLookupQuery.ts +681 -0
- package/src/kernel/packs/sparql/escape.ts +22 -0
- package/src/kernel/packs/sparql/filterValues.ts +201 -0
- package/src/kernel/packs/sparql/index.ts +53 -0
- package/src/kernel/packs/sparql/runSelect.ts +160 -0
- package/src/kernel/packs/sparql/searchTerm.ts +29 -0
- package/src/kernel/packs/storyRules.ts +213 -0
- package/src/kernel/packs/tierScope.ts +407 -0
- package/src/kernel/packs/types.ts +893 -0
- package/src/kernel/packs/uniqueness.ts +35 -0
- package/src/kernel/project/cli/buildProgram.ts +380 -0
- package/src/kernel/project/cli/constants.ts +34 -0
- package/src/kernel/project/cli/dispatch.ts +680 -0
- package/src/kernel/project/cli/exitCodes.ts +68 -0
- package/src/kernel/project/cli/globalFlags.ts +256 -0
- package/src/kernel/project/cli/helpFormat.ts +70 -0
- package/src/kernel/project/cli/index.ts +21 -0
- package/src/kernel/project/cli/rootHelp.ts +338 -0
- package/src/kernel/project/cli/suggest.ts +91 -0
- package/src/kernel/project/cli/suggestNames.ts +195 -0
- package/src/kernel/project/cli/verbHelp.ts +157 -0
- package/src/kernel/project/mcp/buildServer.ts +89 -0
- package/src/kernel/project/mcp/envelope.ts +45 -0
- package/src/kernel/project/mcp/index.ts +8 -0
- package/src/kernel/project/mcp/instructions.ts +141 -0
- package/src/kernel/project/mcp/mcpError.ts +52 -0
- package/src/kernel/project/mcp/prompts/index.ts +37 -0
- package/src/kernel/project/mcp/prompts/provider.ts +120 -0
- package/src/kernel/project/mcp/prompts/source.ts +209 -0
- package/src/kernel/project/mcp/registerVerb.ts +426 -0
- package/src/kernel/project/mcp/serve.ts +42 -0
- package/src/kernel/render/compactUri.ts +25 -0
- package/src/kernel/render/contracts.ts +101 -0
- package/src/kernel/render/disclosure.ts +46 -0
- package/src/kernel/render/displaySafe.ts +80 -0
- package/src/kernel/render/envelope.ts +49 -0
- package/src/kernel/render/formatters.ts +31 -0
- package/src/kernel/render/index.ts +30 -0
- package/src/kernel/render/prefixes.ts +48 -0
- package/src/kernel/render/renderers.ts +682 -0
- package/src/kernel/render/style.ts +127 -0
- package/src/kernel/render/turtle.ts +242 -0
- package/src/kernel/render/vocabulary.ts +276 -0
- package/src/kernel/render/writeStdout.ts +49 -0
- package/src/kernel/runtime/boot.ts +59 -0
- package/src/kernel/runtime/facade.ts +47 -0
- package/src/kernel/runtime/findProjectConfig.ts +62 -0
- package/src/kernel/runtime/graphpack/build.ts +260 -0
- package/src/kernel/runtime/graphpack/buildIndex.ts +371 -0
- package/src/kernel/runtime/graphpack/embedded.ts +136 -0
- package/src/kernel/runtime/graphpack/hash.ts +56 -0
- package/src/kernel/runtime/graphpack/index.ts +21 -0
- package/src/kernel/runtime/graphpack/manifest.ts +172 -0
- package/src/kernel/runtime/graphpack/read.ts +170 -0
- package/src/kernel/runtime/graphpack/schemas.ts +97 -0
- package/src/kernel/runtime/graphpack/stories.ts +84 -0
- package/src/kernel/runtime/graphpack/types.ts +187 -0
- package/src/kernel/runtime/index.ts +15 -0
- package/src/kernel/runtime/loadSession.ts +57 -0
- package/src/kernel/runtime/lockState.ts +196 -0
- package/src/kernel/runtime/packVersion.ts +84 -0
- package/src/kernel/runtime/paths.ts +176 -0
- package/src/kernel/runtime/probe.ts +39 -0
- package/src/kernel/runtime/readEntity.ts +598 -0
- package/src/kernel/runtime/refs/gitOps.ts +426 -0
- package/src/kernel/runtime/refs/index.ts +39 -0
- package/src/kernel/runtime/refs/parseRef.ts +127 -0
- package/src/kernel/runtime/refs/resolve.ts +475 -0
- package/src/kernel/runtime/resolveSources.ts +235 -0
- package/src/kernel/runtime/store.ts +90 -0
- package/src/kernel/runtime/storeReadiness.ts +61 -0
- package/src/kernel/runtime/types.ts +266 -0
- package/src/kernel/spec/asVerb.ts +23 -0
- package/src/kernel/spec/call.ts +186 -0
- package/src/kernel/spec/emitReference.ts +701 -0
- package/src/kernel/spec/emitSurface.ts +285 -0
- package/src/kernel/spec/guidance.ts +68 -0
- package/src/kernel/spec/index.ts +41 -0
- package/src/kernel/spec/surfaceConformance.ts +143 -0
- package/src/kernel/spec/types.ts +636 -0
- package/src/kernel/spec/validate.ts +126 -0
- package/src/kernel/spec/wireType.ts +53 -0
- package/src/kernel/vocabulary.ts +121 -0
- package/src/main.ts +615 -0
- package/src/run.ts +26 -0
- package/src/testing/behavioral/liveReadSurface.ts +112 -0
- package/src/testing/build.globalSetup.ts +641 -0
- package/src/testing/eval/cases/stable.ts +165 -0
- package/src/testing/eval/harness.ts +91 -0
- package/src/testing/helpers/callSchema.ts +40 -0
- package/src/testing/helpers/fixtureGraph.ts +165 -0
- package/src/testing/helpers/packRuntime.ts +117 -0
- package/src/testing/helpers/parity.ts +119 -0
- package/src/testing/helpers/projectCli.ts +36 -0
- package/src/testing/helpers/projectMcp.ts +178 -0
- package/src/testing/helpers/runCli.ts +209 -0
- package/src/testing/index.ts +218 -0
- package/src/testing/prismRoot.ts +14 -0
- package/src/testing/setup/build.ts +5 -0
- package/src/testing/setup/calls.ts +2 -0
- package/src/testing/setup/offline-registry.ts +2 -0
- package/src/testing/setup/temp-root.ts +2 -0
- package/src/testing/setup/xdg.ts +2 -0
- package/src/testing/setupCallChecking.ts +30 -0
- package/src/testing/setupOfflineRegistry.ts +20 -0
- package/src/testing/setupXdgIsolation.ts +87 -0
- package/src/testing/tempRoot.globalSetup.ts +122 -0
- package/src/types.ts +61 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE single pack compiler: one validated {@link PackDefinition} → a set of
|
|
3
|
+
* {@link VerbSpec}s, projected by the CLI and MCP projectors like any other
|
|
4
|
+
* verb. This closes fork F3 (two pack compilers → one) — `list`, extra
|
|
5
|
+
* list-shaped verbs, `lookup`, and `sample` all compile here, and the fetch
|
|
6
|
+
* source (`sparql`/`graphql`) is a run-body detail invisible to the projectors.
|
|
7
|
+
*
|
|
8
|
+
* Pure, storeless spec-generation: it builds paths, params, formatters, and run
|
|
9
|
+
* closures without touching the store or zod, so it runs on the
|
|
10
|
+
* `--help`/`__complete` fast path (the distribution's declared stories compile
|
|
11
|
+
* at import, in `capabilities/distribution.ts`; the dynamic merge is
|
|
12
|
+
* `collect.assembleEffectiveModules`/`loadEffectiveModules`).
|
|
13
|
+
* The heavy work is deferred into the run closures (behind the lazy runtime
|
|
14
|
+
* facade).
|
|
15
|
+
*/
|
|
16
|
+
import { BIN_NAME, DETAIL_LEVELS } from "../../constants.js";
|
|
17
|
+
import { PragmaError } from "../error/index.js";
|
|
18
|
+
import { displaySafeFields } from "../render/displaySafe.js";
|
|
19
|
+
import { compactUri, DEFAULT_PREFIX_MAP } from "../render/index.js";
|
|
20
|
+
import { asVerb } from "../spec/asVerb.js";
|
|
21
|
+
import { DEFAULT_LIST_LIMIT, MAX_LIST_WINDOW } from "./paging.js";
|
|
22
|
+
import { listFormatters, lookupFormatters, sampleFormatters, } from "./renderPack.js";
|
|
23
|
+
import { MAX_SAMPLE_COUNT, MIN_SAMPLE_COUNT, sampleDefaultCount, } from "./sample.js";
|
|
24
|
+
import { storyIssues } from "./storyRules.js";
|
|
25
|
+
import { EVERY_TIER, TIER_PARAM, } from "./types.js";
|
|
26
|
+
// The run bodies pull the SPARQL/GraphQL fetch layer; they are dynamic-imported
|
|
27
|
+
// per invocation so `compilePack` (reached on the storeless --help/__complete
|
|
28
|
+
// fast path via capabilities/index) never statically loads them.
|
|
29
|
+
const runBodies = () => import("./runBodies.js");
|
|
30
|
+
/** The read capability every pack verb carries (store-backed, exposed to MCP). */
|
|
31
|
+
const READ_CAPABILITY = {
|
|
32
|
+
needsStore: true,
|
|
33
|
+
mutates: false,
|
|
34
|
+
mcp: {
|
|
35
|
+
expose: true,
|
|
36
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Compile a validated pack definition into its verbs.
|
|
41
|
+
*
|
|
42
|
+
* @param definition - A validated pack definition.
|
|
43
|
+
* @param source - Where the definition came from, for diagnostics.
|
|
44
|
+
* @param prefixes - The merged prefix map used for display compaction.
|
|
45
|
+
* @param nouns - The other stories' lookups, which a filter naming a noun
|
|
46
|
+
* resolves its values through. Read at run time only.
|
|
47
|
+
* @returns The compiled verbs (list, extra verbs, lookup, sample), in order.
|
|
48
|
+
*/
|
|
49
|
+
export function compilePack(definition, source, prefixes, nouns) {
|
|
50
|
+
const { noun } = definition;
|
|
51
|
+
const verbs = [];
|
|
52
|
+
const tierScope = definition.tierScope;
|
|
53
|
+
// A story may declare a lookup alone; a miss must not point at a `list` it lacks.
|
|
54
|
+
const hasList = definition.list !== undefined;
|
|
55
|
+
if (definition.list) {
|
|
56
|
+
verbs.push(compileListVerb(definition.list, {
|
|
57
|
+
noun,
|
|
58
|
+
verb: "list",
|
|
59
|
+
summary: definition.description ?? `List ${noun} entries.`,
|
|
60
|
+
doc: definition.toolDescription,
|
|
61
|
+
...guidanceOf(definition),
|
|
62
|
+
source,
|
|
63
|
+
prefixes,
|
|
64
|
+
...(nouns ? { nouns } : {}),
|
|
65
|
+
...(tierScope ? { tierScope } : {}),
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
for (const verb of definition.verbs ?? []) {
|
|
69
|
+
verbs.push(compileListVerb(verb, {
|
|
70
|
+
noun,
|
|
71
|
+
verb: verb.verb,
|
|
72
|
+
summary: verb.description ?? `List ${noun} ${verb.verb}.`,
|
|
73
|
+
doc: verb.toolDescription,
|
|
74
|
+
...guidanceOf(verb),
|
|
75
|
+
source,
|
|
76
|
+
prefixes,
|
|
77
|
+
...(nouns ? { nouns } : {}),
|
|
78
|
+
...(tierScope ? { tierScope } : {}),
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
if (definition.lookup) {
|
|
82
|
+
// Normalised ONCE, here, so the lookup verb, its run body, both fetch lanes
|
|
83
|
+
// and the sample all read the same declaration.
|
|
84
|
+
const lookup = withDisclosure(definition.lookup);
|
|
85
|
+
verbs.push(compileLookupVerb(lookup, noun, source, prefixes, hasList, tierScope));
|
|
86
|
+
if (lookup.sample) {
|
|
87
|
+
verbs.push(compileSampleVerb(lookup, noun, source, prefixes, hasList));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return verbs;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Derive a story's MCP resource listing from the types its lookup addresses.
|
|
94
|
+
*
|
|
95
|
+
* ZERO new authoring: a read story ALREADY declares its type set
|
|
96
|
+
* (`lookup.type` / `lookup.types`) because that is what its name resolve is
|
|
97
|
+
* constrained by, so the slice of the index the noun contributes to the listing
|
|
98
|
+
* IS that declaration read a second time by a different reader — never written
|
|
99
|
+
* a second time by the author. Each type contributes ONE collection entry (its
|
|
100
|
+
* class entry, carrying the instance count); the individuals stay reachable
|
|
101
|
+
* through the `{+uri}` template and its autocomplete.
|
|
102
|
+
*
|
|
103
|
+
* Returns `undefined` for a story with no lookup (a list-only noun addresses no
|
|
104
|
+
* class, so it can name no slice).
|
|
105
|
+
*
|
|
106
|
+
* @param definition - A validated pack definition.
|
|
107
|
+
* @returns Its declared listing, or `undefined` when it declares no types.
|
|
108
|
+
*/
|
|
109
|
+
export function compileListable(definition) {
|
|
110
|
+
const lookup = definition.lookup;
|
|
111
|
+
if (!lookup)
|
|
112
|
+
return undefined;
|
|
113
|
+
const types = lookup.types ?? (lookup.type ? [lookup.type] : []);
|
|
114
|
+
if (types.length === 0)
|
|
115
|
+
return undefined;
|
|
116
|
+
// `PackLookup.type`/`types` accept a prefixed name OR an absolute IRI, but the
|
|
117
|
+
// listing is keyed on the index's PREFIXED types. Copied verbatim, a lookup
|
|
118
|
+
// legitimately constrained to `https://…/Widget` compiles clean and then
|
|
119
|
+
// matches no class and no weight — a story that is valid everywhere else and
|
|
120
|
+
// silently contributes nothing here. Compacted against the same map
|
|
121
|
+
// `resolveUri` expands with, so the two directions agree.
|
|
122
|
+
const compact = (type) => compactUri(type, DEFAULT_PREFIX_MAP);
|
|
123
|
+
const weights = Object.fromEntries(Object.entries(lookup.weights ?? {}).map(([type, weight]) => [
|
|
124
|
+
compact(type),
|
|
125
|
+
weight,
|
|
126
|
+
]));
|
|
127
|
+
return {
|
|
128
|
+
sources: types.map(compact).map((type) => ({
|
|
129
|
+
type,
|
|
130
|
+
as: "collection",
|
|
131
|
+
// Unlisted types weigh 1 — the default is "as important as any other",
|
|
132
|
+
// so a story that declares no weights needs no weights.
|
|
133
|
+
weight: weights[type] ?? 1,
|
|
134
|
+
})),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Compile a story into the capability module that carries it.
|
|
139
|
+
*
|
|
140
|
+
* The ONE place a {@link PackDefinition} becomes a {@link CapabilityModule} —
|
|
141
|
+
* the distribution's static stories and the dynamic (config/package) ones come
|
|
142
|
+
* through here alike, so a module-level projection derived from the story
|
|
143
|
+
* (today: {@link compileListable}) cannot reach one tier and miss the other.
|
|
144
|
+
*
|
|
145
|
+
* That door is also where the COMPILABILITY rules are checked
|
|
146
|
+
* ({@link ./storyRules.storyIssues}), for the same reason. The zod grammar runs
|
|
147
|
+
* for config- and package-declared stories only, so a rule stated only there
|
|
148
|
+
* was a declaration-time refusal for a third-party author and a first-call
|
|
149
|
+
* CONFIG_ERROR for the distribution's own stories. The rules are pure string
|
|
150
|
+
* work over text the story already carries, which is what makes them affordable
|
|
151
|
+
* on this path; a story that passed zod has passed them already, so the throw
|
|
152
|
+
* below is reachable only for a story that never saw zod.
|
|
153
|
+
*
|
|
154
|
+
* @param definition - A validated pack definition.
|
|
155
|
+
* @param source - Where the definition came from, for diagnostics.
|
|
156
|
+
* @param prefixes - The merged prefix map used for display compaction.
|
|
157
|
+
* @param nouns - As {@link compilePack}.
|
|
158
|
+
* @returns The module: the compiled verbs plus the story's module-level data.
|
|
159
|
+
* @throws PragmaError CONFIG_ERROR when the definition cannot be compiled,
|
|
160
|
+
* naming the field and the rule.
|
|
161
|
+
*/
|
|
162
|
+
export function compileStoryModule(declared, source, prefixes, nouns) {
|
|
163
|
+
// Every story is third-party text on its way to a terminal: its display
|
|
164
|
+
// fields lose their control characters before anything prints them.
|
|
165
|
+
const definition = displaySafeFields(declared);
|
|
166
|
+
const issue = storyIssues(definition)[0];
|
|
167
|
+
if (issue) {
|
|
168
|
+
throw PragmaError.configError(`Invalid story in ${source.label} at ${issue.path.join(".")}: ${issue.message}`);
|
|
169
|
+
}
|
|
170
|
+
const listable = compileListable(definition);
|
|
171
|
+
const module = {
|
|
172
|
+
name: definition.noun,
|
|
173
|
+
story: true,
|
|
174
|
+
verbs: compilePack(definition, source, prefixes, nouns),
|
|
175
|
+
colophon: definition.colophon,
|
|
176
|
+
...(listable ? { mcpListable: listable } : {}),
|
|
177
|
+
};
|
|
178
|
+
compiledFrom.set(module, { definition, source, prefixes });
|
|
179
|
+
return module;
|
|
180
|
+
}
|
|
181
|
+
/** What each story module was compiled from. */
|
|
182
|
+
const compiledFrom = new WeakMap();
|
|
183
|
+
/**
|
|
184
|
+
* The story a module was compiled from by {@link compileStoryModule}, with the
|
|
185
|
+
* source and prefixes it was compiled under; `undefined` for any other module.
|
|
186
|
+
*/
|
|
187
|
+
export function storyOf(module) {
|
|
188
|
+
return compiledFrom.get(module);
|
|
189
|
+
}
|
|
190
|
+
/** Carry a story half's declared guidance onto its verb, omitting what is absent. */
|
|
191
|
+
function guidanceOf(half) {
|
|
192
|
+
return {
|
|
193
|
+
...(half.useWhen ? { useWhen: half.useWhen } : {}),
|
|
194
|
+
...(half.example ? { example: half.example } : {}),
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
/** Compile the `list` verb or an extra list-shaped verb. */
|
|
198
|
+
function compileListVerb(shape, meta) {
|
|
199
|
+
const params = [
|
|
200
|
+
...projectFilters(shape.filters),
|
|
201
|
+
...projectSearch(shape.search),
|
|
202
|
+
...tierParams(meta.tierScope),
|
|
203
|
+
...PAGE_PARAMS,
|
|
204
|
+
];
|
|
205
|
+
const filterExample = shape.filters?.find((f) => f.values !== undefined);
|
|
206
|
+
const verb = {
|
|
207
|
+
path: [meta.noun, meta.verb],
|
|
208
|
+
summary: meta.summary,
|
|
209
|
+
...(meta.doc ? { doc: meta.doc } : {}),
|
|
210
|
+
...guidanceOf(meta),
|
|
211
|
+
params,
|
|
212
|
+
output: {
|
|
213
|
+
formatters: listFormatters(shape, {
|
|
214
|
+
heading: `${capitalize(meta.noun)}${meta.verb === "list" ? "" : ` ${meta.verb}`}`,
|
|
215
|
+
noun: meta.noun,
|
|
216
|
+
prefixes: meta.prefixes,
|
|
217
|
+
}),
|
|
218
|
+
},
|
|
219
|
+
examples: [
|
|
220
|
+
{ cmd: `${BIN_NAME} ${meta.noun} ${meta.verb}` },
|
|
221
|
+
...(filterExample
|
|
222
|
+
? [
|
|
223
|
+
{
|
|
224
|
+
cmd: `${BIN_NAME} ${meta.noun} ${meta.verb} --${filterExample.param} ${quoteExample(filterExample.values?.at(0) ?? "")}`,
|
|
225
|
+
},
|
|
226
|
+
]
|
|
227
|
+
: []),
|
|
228
|
+
{ cmd: `${BIN_NAME} ${meta.noun} ${meta.verb} --format llm` },
|
|
229
|
+
],
|
|
230
|
+
capability: READ_CAPABILITY,
|
|
231
|
+
run: (params, rt) => runBodies().then((m) => m.makeListRun(shape, {
|
|
232
|
+
source: meta.source,
|
|
233
|
+
prefixes: meta.prefixes,
|
|
234
|
+
...(meta.nouns ? { nouns: meta.nouns } : {}),
|
|
235
|
+
...(meta.tierScope ? { tierScope: meta.tierScope } : {}),
|
|
236
|
+
})(params, rt)),
|
|
237
|
+
};
|
|
238
|
+
return asVerb(verb);
|
|
239
|
+
}
|
|
240
|
+
/** Compile the `lookup` verb (variadic names → resolved entities). */
|
|
241
|
+
function compileLookupVerb(lookup, noun, source, prefixes, hasList, tierScope) {
|
|
242
|
+
// Derive-by-default: every lookup completes its `<name>` from the pack index
|
|
243
|
+
// (empty type = any, the reader handles it), UNLESS the pack opts out
|
|
244
|
+
// (`completion.enabled:false`). `match`/`minChars` tune the derived heuristic.
|
|
245
|
+
const completeType = lookup.type ?? lookup.types?.at(0) ?? "";
|
|
246
|
+
const completion = lookup.completion;
|
|
247
|
+
const nameParam = {
|
|
248
|
+
kind: "string[]",
|
|
249
|
+
name: "name",
|
|
250
|
+
doc: `${capitalize(noun)} names, prefixed names/IRIs, or glob patterns.`,
|
|
251
|
+
positional: true,
|
|
252
|
+
required: true,
|
|
253
|
+
...(completion?.enabled === false
|
|
254
|
+
? {}
|
|
255
|
+
: {
|
|
256
|
+
complete: {
|
|
257
|
+
kind: "names",
|
|
258
|
+
source: {
|
|
259
|
+
from: "index",
|
|
260
|
+
...(completeType ? { type: completeType } : {}),
|
|
261
|
+
},
|
|
262
|
+
...(completion?.match ? { match: completion.match } : {}),
|
|
263
|
+
...(completion?.minChars !== undefined
|
|
264
|
+
? { minChars: completion.minChars }
|
|
265
|
+
: {}),
|
|
266
|
+
},
|
|
267
|
+
}),
|
|
268
|
+
};
|
|
269
|
+
const verb = {
|
|
270
|
+
path: [noun, "lookup"],
|
|
271
|
+
summary: lookup.description ?? `Look up ${noun} details by name, IRI, or glob.`,
|
|
272
|
+
...(lookup.toolDescription ? { doc: lookup.toolDescription } : {}),
|
|
273
|
+
...guidanceOf(lookup),
|
|
274
|
+
params: [nameParam, ...tierParams(tierScope)],
|
|
275
|
+
output: { formatters: lookupFormatters(lookup, prefixes) },
|
|
276
|
+
examples: [
|
|
277
|
+
{ cmd: `${BIN_NAME} ${noun} lookup <name>` },
|
|
278
|
+
...(tierScope
|
|
279
|
+
? [
|
|
280
|
+
{
|
|
281
|
+
cmd: `${BIN_NAME} ${noun} lookup --tier all <name>`,
|
|
282
|
+
note: "every tier, not just the ones in scope",
|
|
283
|
+
},
|
|
284
|
+
]
|
|
285
|
+
: []),
|
|
286
|
+
],
|
|
287
|
+
disclosure: disclosureSpec(lookup.disclosure),
|
|
288
|
+
capability: READ_CAPABILITY,
|
|
289
|
+
run: (params, rt) => runBodies().then((m) => m.makeLookupRun(lookup, noun, source, prefixes, hasList, tierScope)(params, rt)),
|
|
290
|
+
};
|
|
291
|
+
return asVerb(verb);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* The `--tier` parameter a TIERED noun's reads carry (`tier` over MCP).
|
|
295
|
+
*
|
|
296
|
+
* Kernel-added, like the page: being tiered is declared, but the argument that
|
|
297
|
+
* steers the scope is the kernel's to name — one spelling across every tiered
|
|
298
|
+
* noun, so an agent that learned `--tier` on `block list` can use it on
|
|
299
|
+
* `concept list` without asking. The help text names the default and the
|
|
300
|
+
* escape, because a scope a caller cannot see is exactly the hidden behaviour
|
|
301
|
+
* CONSTITUTION §VI rules out.
|
|
302
|
+
*
|
|
303
|
+
* Not `repeatable`: a repeated `--tier` would be two chains, and the scope is
|
|
304
|
+
* one chain. The run body refuses an array rather than quietly taking the last.
|
|
305
|
+
*/
|
|
306
|
+
function tierParams(tierScope) {
|
|
307
|
+
if (!tierScope)
|
|
308
|
+
return [];
|
|
309
|
+
return [
|
|
310
|
+
{
|
|
311
|
+
kind: "string",
|
|
312
|
+
name: TIER_PARAM,
|
|
313
|
+
doc: `Read this tier and its ancestors (default: the top-level tiers; "${EVERY_TIER}" for every tier).`,
|
|
314
|
+
},
|
|
315
|
+
];
|
|
316
|
+
}
|
|
317
|
+
/** Compile the `sample` verb (N random exemplars at the highest level). */
|
|
318
|
+
function compileSampleVerb(lookup, noun, source, prefixes, hasList) {
|
|
319
|
+
const defaultCount = sampleDefaultCount(lookup);
|
|
320
|
+
const config = lookup.sample === true ? undefined : lookup.sample;
|
|
321
|
+
// Most samples take a `[count]` positional; where the covenant freezes a
|
|
322
|
+
// no-argument sample the pack sets `fixedCount`, so the compiler omits it and
|
|
323
|
+
// the sample always returns the default count.
|
|
324
|
+
const countParam = config?.fixedCount
|
|
325
|
+
? []
|
|
326
|
+
: [
|
|
327
|
+
{
|
|
328
|
+
kind: "string",
|
|
329
|
+
name: "count",
|
|
330
|
+
doc: `Number of samples (${MIN_SAMPLE_COUNT}–${MAX_SAMPLE_COUNT}, default ${defaultCount}).`,
|
|
331
|
+
positional: true,
|
|
332
|
+
},
|
|
333
|
+
];
|
|
334
|
+
const verb = {
|
|
335
|
+
path: [noun, "sample"],
|
|
336
|
+
summary: config?.description ??
|
|
337
|
+
`Return randomly selected complete ${noun} entries as exemplars.`,
|
|
338
|
+
...(config?.toolDescription ? { doc: config.toolDescription } : {}),
|
|
339
|
+
...guidanceOf(config ?? {}),
|
|
340
|
+
params: countParam,
|
|
341
|
+
output: { formatters: sampleFormatters(lookup, noun, prefixes) },
|
|
342
|
+
examples: [
|
|
343
|
+
{ cmd: `${BIN_NAME} ${noun} sample` },
|
|
344
|
+
...(config?.fixedCount ? [] : [{ cmd: `${BIN_NAME} ${noun} sample 3` }]),
|
|
345
|
+
],
|
|
346
|
+
capability: READ_CAPABILITY,
|
|
347
|
+
run: (params, rt) => runBodies().then((m) => m.makeSampleRun(lookup, noun, source, prefixes, defaultCount, hasList)(params, rt)),
|
|
348
|
+
};
|
|
349
|
+
return asVerb(verb);
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Give a lookup that declares no disclosure the canonical ladder: default
|
|
353
|
+
* `detailed` (so its default answer is unchanged) and untagged expands from
|
|
354
|
+
* `standard` (so `summary` is the fields alone, and `standard` equals
|
|
355
|
+
* `detailed`). A declared disclosure is returned as written.
|
|
356
|
+
*/
|
|
357
|
+
function withDisclosure(lookup) {
|
|
358
|
+
if (lookup.disclosure)
|
|
359
|
+
return lookup;
|
|
360
|
+
return {
|
|
361
|
+
...lookup,
|
|
362
|
+
disclosure: { levels: [...DETAIL_LEVELS], default: IMPUTED_DEFAULT_LEVEL },
|
|
363
|
+
...(lookup.expand
|
|
364
|
+
? {
|
|
365
|
+
expand: lookup.expand.map((expand) => ({
|
|
366
|
+
...expand,
|
|
367
|
+
level: expand.level ?? IMPUTED_EXPAND_LEVEL,
|
|
368
|
+
})),
|
|
369
|
+
}
|
|
370
|
+
: {}),
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
/** The level an imputed disclosure answers at when none is asked for: all of it. */
|
|
374
|
+
const IMPUTED_DEFAULT_LEVEL = "detailed";
|
|
375
|
+
/** The level from which an imputed disclosure shows an untagged expand. */
|
|
376
|
+
const IMPUTED_EXPAND_LEVEL = "standard";
|
|
377
|
+
/** Normalize a pack disclosure into a {@link DisclosureSpec} (default → base). */
|
|
378
|
+
function disclosureSpec(disclosure) {
|
|
379
|
+
const levels = disclosure?.levels ?? [];
|
|
380
|
+
return {
|
|
381
|
+
levels: [...levels],
|
|
382
|
+
default: disclosure?.default ?? levels[0] ?? "summary",
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* The page parameters EVERY list-shaped verb carries — `list` and every extra
|
|
387
|
+
* verb alike.
|
|
388
|
+
*
|
|
389
|
+
* Not declared per story, and not declarable: a page is a property of a
|
|
390
|
+
* list-shaped read, so a story that forgot to declare one would be the one
|
|
391
|
+
* answer an agent could not bound. The default is named in the help text
|
|
392
|
+
* because a cap a caller cannot see is exactly the hidden behaviour
|
|
393
|
+
* CONSTITUTION §VI rules out — the number a caller gets when they pass nothing
|
|
394
|
+
* has to be readable in `--help`.
|
|
395
|
+
*/
|
|
396
|
+
const PAGE_PARAMS = [
|
|
397
|
+
{
|
|
398
|
+
kind: "number",
|
|
399
|
+
name: "limit",
|
|
400
|
+
doc: `Maximum rows to return, 1 to ${MAX_LIST_WINDOW} (default ${DEFAULT_LIST_LIMIT}).`,
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
kind: "string",
|
|
404
|
+
name: "after",
|
|
405
|
+
doc: "Continue from a previous page: the cursor that page reported.",
|
|
406
|
+
},
|
|
407
|
+
];
|
|
408
|
+
/** Project declared filters onto verb params (enum for a value set, else string). */
|
|
409
|
+
function projectFilters(filters) {
|
|
410
|
+
return (filters ?? []).map((filter) => {
|
|
411
|
+
const doc = filter.description ??
|
|
412
|
+
(filter.values
|
|
413
|
+
? `Filter by ${filter.variable} (${filter.values.join(", ")}).`
|
|
414
|
+
: `Filter by ${filter.variable}.`);
|
|
415
|
+
if (filter.values) {
|
|
416
|
+
return {
|
|
417
|
+
kind: "enum",
|
|
418
|
+
name: filter.param,
|
|
419
|
+
doc,
|
|
420
|
+
values: [...filter.values],
|
|
421
|
+
repeatable: true,
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
kind: "string",
|
|
426
|
+
name: filter.param,
|
|
427
|
+
doc,
|
|
428
|
+
repeatable: true,
|
|
429
|
+
};
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
/** Project a declared free-text search onto the `search` param. */
|
|
433
|
+
function projectSearch(search) {
|
|
434
|
+
if (!search)
|
|
435
|
+
return [];
|
|
436
|
+
return [
|
|
437
|
+
{
|
|
438
|
+
kind: "string",
|
|
439
|
+
name: "search",
|
|
440
|
+
doc: search.description ?? `Search in ${search.variables.join(", ")}.`,
|
|
441
|
+
},
|
|
442
|
+
];
|
|
443
|
+
}
|
|
444
|
+
/** Quote a filter example value when it is not a bare word. */
|
|
445
|
+
function quoteExample(value) {
|
|
446
|
+
return /^[\w.-]+$/.test(value) ? value : JSON.stringify(value);
|
|
447
|
+
}
|
|
448
|
+
function capitalize(value) {
|
|
449
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
450
|
+
}
|
|
451
|
+
//# sourceMappingURL=compile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../../src/kernel/packs/compile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEpE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAQ3C,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EACL,cAAc,EACd,gBAAgB,EAEhB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EACL,UAAU,EAWV,UAAU,GACX,MAAM,YAAY,CAAC;AAEpB,gFAAgF;AA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2
|
+
* The cursor a caller spends to ask for the page after this one.
|
|
3
|
+
*
|
|
4
|
+
* WHY AN OFFSET. The candidate alternative is a keyset cursor encoding the last
|
|
5
|
+
* row's ordering key, which does not drift when the store changes underneath a
|
|
6
|
+
* caller. It cannot be general, and `block list` is the counterexample: it
|
|
7
|
+
* orders by `?tierRank`, a variable its SELECT does not project, so the
|
|
8
|
+
* ordering key is not in the rows at all — and a pagination mechanism that
|
|
9
|
+
* works only for stories whose ordering keys happen to be columns is not a
|
|
10
|
+
* pagination mechanism. An offset needs nothing from the rows.
|
|
11
|
+
*
|
|
12
|
+
* The drift an offset admits is bounded by what the store is: a read-only,
|
|
13
|
+
* content-addressed pack that changes only when `sources update` rebuilds it.
|
|
14
|
+
* Between two pages of one browse there is no writer.
|
|
15
|
+
*
|
|
16
|
+
* What an offset cannot survive is the caller changing the QUESTION between
|
|
17
|
+
* pages — different filters, a different search term, another story — which is
|
|
18
|
+
* why the cursor carries a fingerprint of the read it was issued for and
|
|
19
|
+
* refuses to be spent on another. That is the failure worth catching, and the
|
|
20
|
+
* one a bare integer would have answered wrongly and in silence.
|
|
21
|
+
*
|
|
22
|
+
* The encoding is opaque on purpose: a caller who cannot read it cannot come to
|
|
23
|
+
* depend on it, so the day a story needs a keyset cursor the cursor's contents
|
|
24
|
+
* change and its contract does not.
|
|
25
|
+
*
|
|
26
|
+
* The fingerprint does not cover the OFFSET, and cannot: a cursor is a token
|
|
27
|
+
* this build issued, not a signed one, so its `o` is editable by anyone who
|
|
28
|
+
* base64-decodes it. That is why the offset is BOUNDED here as well as parsed
|
|
29
|
+
* here — an `o` of 2^53 is a legal JSON integer that the store answers with a
|
|
30
|
+
* raw parse error, so {@link ./paging.MAX_LIST_WINDOW} is checked before the
|
|
31
|
+
* number can reach a query.
|
|
32
|
+
*/
|
|
33
|
+
import { createHash } from "node:crypto";
|
|
34
|
+
import { PragmaError } from "../error/index.js";
|
|
35
|
+
import { MAX_LIST_WINDOW } from "./paging.js";
|
|
36
|
+
/** The cursor encoding's own version, so a future keyset form is tellable apart. */
|
|
37
|
+
const CURSOR_VERSION = 1;
|
|
38
|
+
/**
|
|
39
|
+
* The identity of the read a cursor belongs to — the author query and the
|
|
40
|
+
* arguments that narrow it, hashed short.
|
|
41
|
+
*
|
|
42
|
+
* Each part is LENGTH-PREFIXED rather than merely joined. A separator is only
|
|
43
|
+
* unambiguous if it cannot occur inside a part, and these parts are SPARQL
|
|
44
|
+
* text and JSON — there is no such character. Two different argument lists
|
|
45
|
+
* hashing the same would let a cursor be spent on a read it was not issued
|
|
46
|
+
* for, which is the single thing this function exists to prevent.
|
|
47
|
+
*
|
|
48
|
+
* @param parts - Everything that decides which rows the read returns.
|
|
49
|
+
* @returns A short, stable fingerprint.
|
|
50
|
+
*/
|
|
51
|
+
export function pageFingerprint(parts) {
|
|
52
|
+
const hash = createHash("sha256");
|
|
53
|
+
for (const part of parts)
|
|
54
|
+
hash.update(`${part.length}:${part}`);
|
|
55
|
+
return hash.digest("base64url").slice(0, 12);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Encode the cursor that asks for the rows after this page.
|
|
59
|
+
*
|
|
60
|
+
* @param offset - The row index the next page starts at.
|
|
61
|
+
* @param fingerprint - The read this cursor may be spent on.
|
|
62
|
+
* @returns An opaque, URL-safe token.
|
|
63
|
+
*/
|
|
64
|
+
export function encodeCursor(offset, fingerprint) {
|
|
65
|
+
const payload = JSON.stringify({
|
|
66
|
+
v: CURSOR_VERSION,
|
|
67
|
+
o: offset,
|
|
68
|
+
q: fingerprint,
|
|
69
|
+
});
|
|
70
|
+
return Buffer.from(payload, "utf8").toString("base64url");
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Read an `--after`/`after` cursor back into an offset.
|
|
74
|
+
*
|
|
75
|
+
* @param provided - The raw argument, if any.
|
|
76
|
+
* @param fingerprint - The read the cursor must have been issued for.
|
|
77
|
+
* @returns The row index to start at (0 when no cursor was given).
|
|
78
|
+
* @throws PragmaError INVALID_INPUT when the token is not a cursor this build
|
|
79
|
+
* issued, or was issued for a different read — a mismatch answered with rows
|
|
80
|
+
* would be a page of the wrong question, with nothing to show it.
|
|
81
|
+
*/
|
|
82
|
+
export function readCursor(provided, fingerprint) {
|
|
83
|
+
if (provided === undefined)
|
|
84
|
+
return 0;
|
|
85
|
+
const decoded = decodeCursor(provided);
|
|
86
|
+
if (!decoded) {
|
|
87
|
+
throw PragmaError.invalidInput("after", String(provided), {
|
|
88
|
+
recovery: {
|
|
89
|
+
message: "--after takes the cursor from a previous page of this same read; run the read without it to start from the first page.",
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (decoded.q !== fingerprint) {
|
|
94
|
+
throw PragmaError.invalidInput("after", String(provided), {
|
|
95
|
+
recovery: {
|
|
96
|
+
message: "This cursor was issued for a different read — the filters or the search term changed. Run the new read without --after to start from its first page.",
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return decoded.o;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The cursor payload, or `undefined` for anything that is not one.
|
|
104
|
+
*
|
|
105
|
+
* The offset is checked against {@link MAX_LIST_WINDOW} here rather than at the
|
|
106
|
+
* store: an unbounded `o` is emitted straight into the generated query's
|
|
107
|
+
* `OFFSET`, where a number the engine cannot express comes back as a parse
|
|
108
|
+
* error dressed as an internal one. Refused here, a hand-edited offset is the
|
|
109
|
+
* same calm INVALID_INPUT as every other malformed cursor.
|
|
110
|
+
*/
|
|
111
|
+
function decodeCursor(provided) {
|
|
112
|
+
if (typeof provided !== "string" || provided === "")
|
|
113
|
+
return undefined;
|
|
114
|
+
let parsed;
|
|
115
|
+
try {
|
|
116
|
+
parsed = JSON.parse(Buffer.from(provided, "base64url").toString("utf8"));
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
if (typeof parsed !== "object" || parsed === null)
|
|
122
|
+
return undefined;
|
|
123
|
+
const payload = parsed;
|
|
124
|
+
if (payload.v !== CURSOR_VERSION)
|
|
125
|
+
return undefined;
|
|
126
|
+
if (!Number.isInteger(payload.o))
|
|
127
|
+
return undefined;
|
|
128
|
+
const offset = payload.o;
|
|
129
|
+
if (offset < 0 || offset > MAX_LIST_WINDOW)
|
|
130
|
+
return undefined;
|
|
131
|
+
if (typeof payload.q !== "string")
|
|
132
|
+
return undefined;
|
|
133
|
+
return { o: offset, q: payload.q };
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=cursor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../../../src/kernel/packs/cursor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,oFAAoF;AACpF,MAAM,cAAc,GAAG,CAAC,CAAC;AAEzB;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,eAAe,CAAC,KAAwB;IACtD,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC;IAChE,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,WAAmB;IAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC;QAC7B,CAAC,EAAE,cAAc;QACjB,CAAC,EAAE,MAAM;QACT,CAAC,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