@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,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execute a `source: "graphql"` pack lookup's generated document and unwrap the
|
|
3
|
+
* result to the flat pack entity shape.
|
|
4
|
+
*
|
|
5
|
+
* Retargeted onto the PR2 facade: the compiled schema comes from the booted
|
|
6
|
+
* `StoreSession` (`rt.store.get()`), and the document runs through
|
|
7
|
+
* `rt.query.graphql` (ke-graphql's in-process `executeLocal` — no server, no
|
|
8
|
+
* HTTP). Relay envelopes are unwrapped here (connections → arrays, entity
|
|
9
|
+
* references → IRI strings, prefixed URIs → full IRIs), so the resolved entity
|
|
10
|
+
* is shape-identical to the SPARQL path.
|
|
11
|
+
*
|
|
12
|
+
* Injection safety: the resolved entity IRI enters execution EXCLUSIVELY via
|
|
13
|
+
* `variableValues.uri` — never interpolated into the document text, which is
|
|
14
|
+
* composed only from validated pack terms and compiled schema names.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { callRecovery, PragmaError } from "../../error/index.js";
|
|
18
|
+
import type { PragmaRuntime } from "../../runtime/index.js";
|
|
19
|
+
import type { PackChildRow, PackEntity, PackLookup } from "../types.js";
|
|
20
|
+
import {
|
|
21
|
+
buildLookupDocument,
|
|
22
|
+
type FieldProjection,
|
|
23
|
+
} from "./buildLookupDocument.js";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @param rt - The runtime (lazy store + query facade).
|
|
27
|
+
* @param lookup - The validated lookup declaration.
|
|
28
|
+
* @param entityUri - IRI resolved by the SPARQL name→URI query (store output).
|
|
29
|
+
* @param entityName - The entity's canonical stored name.
|
|
30
|
+
* @param source - Pack source, for error attribution.
|
|
31
|
+
* @param prefixes - The runtime's merged prefix map (prefixed→full expansion).
|
|
32
|
+
* @param level - Active canonical level (gates fields/expands at fetch).
|
|
33
|
+
* @returns The unwrapped pack entity.
|
|
34
|
+
* @throws PragmaError STORE_UNAVAILABLE when execution reports errors,
|
|
35
|
+
* ENTITY_NOT_FOUND when a resolved IRI has no typed node in the schema.
|
|
36
|
+
* @note Impure — reads the compiled schema and queries the store.
|
|
37
|
+
*/
|
|
38
|
+
export async function fetchGraphqlLookup(
|
|
39
|
+
rt: Pick<PragmaRuntime, "store" | "query">,
|
|
40
|
+
lookup: PackLookup,
|
|
41
|
+
entityUri: string,
|
|
42
|
+
entityName: string,
|
|
43
|
+
source: string,
|
|
44
|
+
prefixes: Readonly<Record<string, string>>,
|
|
45
|
+
level?: string,
|
|
46
|
+
): Promise<PackEntity> {
|
|
47
|
+
const session = await rt.store.get();
|
|
48
|
+
const plan = buildLookupDocument(lookup, session.schema, source, level);
|
|
49
|
+
|
|
50
|
+
const result = await rt.query.graphql(plan.source, { uri: entityUri });
|
|
51
|
+
|
|
52
|
+
if (result.errors && result.errors.length > 0) {
|
|
53
|
+
const messages = result.errors
|
|
54
|
+
.slice(0, 3)
|
|
55
|
+
.map((error) => error.message)
|
|
56
|
+
.join("; ");
|
|
57
|
+
throw PragmaError.storeUnavailable(`GraphQL lookup failed: ${messages}`, {
|
|
58
|
+
// `graph inspect` needs a <uri>; `ontology list` is runnable as-is.
|
|
59
|
+
recovery: callRecovery(
|
|
60
|
+
{ verb: "ontology list" },
|
|
61
|
+
"Check the loaded ontology and namespaces.",
|
|
62
|
+
),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const node = (result.data as { node?: unknown } | null | undefined)?.node;
|
|
67
|
+
if (node === null || node === undefined || typeof node !== "object") {
|
|
68
|
+
// The name→URI resolve DID find this IRI, so the store is available — the
|
|
69
|
+
// entity simply has no typed node (its rdf:type is missing from the loaded
|
|
70
|
+
// ontology). That is a runtime not-found, not an unavailable store (exit 3).
|
|
71
|
+
throw new PragmaError({
|
|
72
|
+
code: "ENTITY_NOT_FOUND",
|
|
73
|
+
message: `Cannot resolve <${entityUri}> — its rdf:type may be missing from the ontology.`,
|
|
74
|
+
recovery: callRecovery(
|
|
75
|
+
{ verb: "graph inspect", params: { uri: entityUri } },
|
|
76
|
+
"Inspect the entity's triples to check its rdf:type.",
|
|
77
|
+
),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const entity: PackEntity = { uri: entityUri, name: entityName };
|
|
82
|
+
const record = node as Record<string, unknown>;
|
|
83
|
+
for (const projection of plan.projections) {
|
|
84
|
+
const value = unwrapProjection(
|
|
85
|
+
record[projection.name],
|
|
86
|
+
projection,
|
|
87
|
+
prefixes,
|
|
88
|
+
);
|
|
89
|
+
if (value !== undefined) entity[projection.name] = value;
|
|
90
|
+
}
|
|
91
|
+
return entity;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Unwrap one projected key to the flat pack shape (absent → omitted). */
|
|
95
|
+
function unwrapProjection(
|
|
96
|
+
value: unknown,
|
|
97
|
+
projection: FieldProjection,
|
|
98
|
+
prefixes: Readonly<Record<string, string>>,
|
|
99
|
+
): string | readonly PackChildRow[] | undefined {
|
|
100
|
+
switch (projection.kind) {
|
|
101
|
+
case "scalar":
|
|
102
|
+
return value === null || value === undefined ? undefined : String(value);
|
|
103
|
+
case "iri":
|
|
104
|
+
return value === null || value === undefined
|
|
105
|
+
? undefined
|
|
106
|
+
: expandPrefixed(String(value), prefixes);
|
|
107
|
+
case "entity":
|
|
108
|
+
return unwrapEntityRef(value, prefixes);
|
|
109
|
+
case "collection": {
|
|
110
|
+
const nodes = collectionNodes(value, projection.connection);
|
|
111
|
+
return nodes.map((node) =>
|
|
112
|
+
unwrapChildRow(node, projection.children, prefixes),
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Unwrap `{ uri }` to the full IRI string (the identity field is prefixed). */
|
|
119
|
+
function unwrapEntityRef(
|
|
120
|
+
value: unknown,
|
|
121
|
+
prefixes: Readonly<Record<string, string>>,
|
|
122
|
+
): string | undefined {
|
|
123
|
+
const uri = (value as { uri?: unknown } | null | undefined)?.uri;
|
|
124
|
+
return typeof uri === "string" ? expandPrefixed(uri, prefixes) : undefined;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Strip the Relay envelope (or pass a plain list through) to node records. */
|
|
128
|
+
function collectionNodes(
|
|
129
|
+
value: unknown,
|
|
130
|
+
connection: boolean,
|
|
131
|
+
): Record<string, unknown>[] {
|
|
132
|
+
if (connection) {
|
|
133
|
+
const edges = (value as { edges?: unknown } | null | undefined)?.edges;
|
|
134
|
+
if (!Array.isArray(edges)) return [];
|
|
135
|
+
return edges
|
|
136
|
+
.map((edge) => (edge as { node?: unknown }).node)
|
|
137
|
+
.filter(
|
|
138
|
+
(node): node is Record<string, unknown> =>
|
|
139
|
+
typeof node === "object" && node !== null,
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
if (!Array.isArray(value)) return [];
|
|
143
|
+
return value.filter(
|
|
144
|
+
(node): node is Record<string, unknown> =>
|
|
145
|
+
typeof node === "object" && node !== null,
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Unwrap one child row. A nested expand with a single scalar select collapses
|
|
151
|
+
* each grandchild to that value (so `values: ["Dense", "Comfortable"]`); a
|
|
152
|
+
* multi-field select keeps one record per grandchild.
|
|
153
|
+
*/
|
|
154
|
+
function unwrapChildRow(
|
|
155
|
+
node: Record<string, unknown>,
|
|
156
|
+
children: readonly FieldProjection[],
|
|
157
|
+
prefixes: Readonly<Record<string, string>>,
|
|
158
|
+
): PackChildRow {
|
|
159
|
+
const row: PackChildRow = {};
|
|
160
|
+
for (const child of children) {
|
|
161
|
+
const value = node[child.name];
|
|
162
|
+
if (child.kind === "collection") {
|
|
163
|
+
const grandchildren = collectionNodes(value, child.connection);
|
|
164
|
+
const single =
|
|
165
|
+
child.children.length === 1 && child.children[0]?.kind === "scalar"
|
|
166
|
+
? child.children[0]
|
|
167
|
+
: undefined;
|
|
168
|
+
row[child.name] = single
|
|
169
|
+
? grandchildren
|
|
170
|
+
.map((grandchild) => grandchild[single.name])
|
|
171
|
+
.filter((v): v is string => v !== null && v !== undefined)
|
|
172
|
+
.map(String)
|
|
173
|
+
: grandchildren.map((grandchild) => {
|
|
174
|
+
const record: Record<string, string> = {};
|
|
175
|
+
for (const leaf of child.children) {
|
|
176
|
+
const leafValue = unwrapLeaf(
|
|
177
|
+
grandchild[leaf.name],
|
|
178
|
+
leaf,
|
|
179
|
+
prefixes,
|
|
180
|
+
);
|
|
181
|
+
if (leafValue !== undefined) record[leaf.name] = leafValue;
|
|
182
|
+
}
|
|
183
|
+
return record;
|
|
184
|
+
});
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
const unwrapped = unwrapLeaf(value, child, prefixes);
|
|
188
|
+
if (unwrapped !== undefined) row[child.name] = unwrapped;
|
|
189
|
+
}
|
|
190
|
+
return row;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** Unwrap one non-collection leaf value (entity refs and `uri` → full IRIs). */
|
|
194
|
+
function unwrapLeaf(
|
|
195
|
+
value: unknown,
|
|
196
|
+
leaf: FieldProjection,
|
|
197
|
+
prefixes: Readonly<Record<string, string>>,
|
|
198
|
+
): string | undefined {
|
|
199
|
+
if (leaf.kind === "entity") return unwrapEntityRef(value, prefixes);
|
|
200
|
+
if (value === null || value === undefined) return undefined;
|
|
201
|
+
return leaf.kind === "iri"
|
|
202
|
+
? expandPrefixed(String(value), prefixes)
|
|
203
|
+
: String(value);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** Expand a prefixed URI (`ds:global`) to its full IRI via the merged prefixes. */
|
|
207
|
+
function expandPrefixed(
|
|
208
|
+
uri: string,
|
|
209
|
+
prefixes: Readonly<Record<string, string>>,
|
|
210
|
+
): string {
|
|
211
|
+
if (uri.includes("://")) return uri;
|
|
212
|
+
const colon = uri.indexOf(":");
|
|
213
|
+
if (colon === -1) return uri;
|
|
214
|
+
const namespace = prefixes[uri.slice(0, colon)];
|
|
215
|
+
return namespace ? `${namespace}${uri.slice(colon + 1)}` : uri;
|
|
216
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The GraphQL lookup path — what a `source: "graphql"` pack story executes
|
|
3
|
+
* once SPARQL has resolved its name to an entity IRI.
|
|
4
|
+
*
|
|
5
|
+
* The three files here are one function split for testability, not three
|
|
6
|
+
* services: the naming rules derive schema field names from the RDF properties
|
|
7
|
+
* a pack declares, the document generator turns a lookup declaration plus
|
|
8
|
+
* those names into the single query to run, and the fetcher executes it and
|
|
9
|
+
* unwraps the Relay envelope into the same flat entity shape the SPARQL path
|
|
10
|
+
* produces. Only the last of those is something a caller does.
|
|
11
|
+
*
|
|
12
|
+
* So the barrel is one export, and the narrowness is the point. The document
|
|
13
|
+
* generator's contract is that the entity IRI travels as a query VARIABLE and
|
|
14
|
+
* never as interpolated text, and that a document is composed only from
|
|
15
|
+
* validated pack terms and compiled schema names. Handing out the generator on
|
|
16
|
+
* its own would hand out a way to build a document and execute it by some
|
|
17
|
+
* other route; handing out the fetcher hands out the guarantee with it.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export { fetchGraphqlLookup } from "./fetchGraphqlLookup.js";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The GraphQL naming rules the pack document generator needs — ported verbatim
|
|
3
|
+
* from ke-graphql's internal `compiler/nameMap` (Pass 4). ke-graphql does not
|
|
4
|
+
* re-export these helpers from its public entry, so they are reimplemented here
|
|
5
|
+
* with the SAME logic to guarantee the derived field names match the names the
|
|
6
|
+
* compiler actually generated. Keeping the port faithful is load-bearing: a
|
|
7
|
+
* divergence would derive a field the schema does not expose.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** Irregular plurals the suffix rules cannot produce. */
|
|
11
|
+
const IRREGULAR_PLURALS: Record<string, string> = {
|
|
12
|
+
child: "children",
|
|
13
|
+
person: "people",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Pluralize a camelCase field name (matching ke-graphql):
|
|
18
|
+
* a. irregulars (child → children), preserving a camelCase prefix
|
|
19
|
+
* b. already ends in 's' → unchanged
|
|
20
|
+
* c. consonant + 'y' → 'ies'
|
|
21
|
+
* d. x/z/ch/sh → '+es'
|
|
22
|
+
* e. default → '+s'
|
|
23
|
+
*/
|
|
24
|
+
export function pluralize(name: string): string {
|
|
25
|
+
for (const [singular, plural] of Object.entries(IRREGULAR_PLURALS)) {
|
|
26
|
+
if (name.toLowerCase() === singular) {
|
|
27
|
+
return name[0] === name[0]?.toUpperCase()
|
|
28
|
+
? plural.charAt(0).toUpperCase() + plural.slice(1)
|
|
29
|
+
: plural;
|
|
30
|
+
}
|
|
31
|
+
const suffix = singular.charAt(0).toUpperCase() + singular.slice(1);
|
|
32
|
+
if (name.endsWith(suffix)) {
|
|
33
|
+
return (
|
|
34
|
+
name.slice(0, -suffix.length) +
|
|
35
|
+
plural.charAt(0).toUpperCase() +
|
|
36
|
+
plural.slice(1)
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (name.endsWith("s")) return name;
|
|
41
|
+
if (/[^aeiou]y$/i.test(name)) return `${name.slice(0, -1)}ies`;
|
|
42
|
+
if (/(x|z|ch|sh)$/i.test(name)) return `${name}es`;
|
|
43
|
+
return `${name}s`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Strip a leading `has`/`is` verb from a field name (matching ke-graphql). */
|
|
47
|
+
export function stripVerbPrefix(name: string): string {
|
|
48
|
+
for (const prefix of ["has", "is"]) {
|
|
49
|
+
if (
|
|
50
|
+
name.startsWith(prefix) &&
|
|
51
|
+
name.length > prefix.length &&
|
|
52
|
+
name[prefix.length] === name[prefix.length]?.toUpperCase()
|
|
53
|
+
) {
|
|
54
|
+
const stripped = name.slice(prefix.length);
|
|
55
|
+
return stripped.charAt(0).toLowerCase() + stripped.slice(1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return name;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The schema's page-size clamp for Relay connections. ke-graphql's
|
|
63
|
+
* `MAX_PAGE_SIZE`; stated explicitly on generated connection selections to make
|
|
64
|
+
* the fetched window visible. The schema clamps regardless, so an inlined value
|
|
65
|
+
* only affects the stated bound, never correctness.
|
|
66
|
+
*/
|
|
67
|
+
export const MAX_PAGE_SIZE = 100;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The packs domain — declared stories become runnable verbs.
|
|
3
|
+
*
|
|
4
|
+
* One pipeline runs end to end inside this folder: a JSON pack declaration is
|
|
5
|
+
* parsed and validated, compiled into `VerbSpec`s, and given run bodies that
|
|
6
|
+
* resolve entities out of the graph and formatters that render them. The
|
|
7
|
+
* intermediate stages — the schema parser, the query/render/run-body builders,
|
|
8
|
+
* the entity resolver, the sampler, the glob expander — are steps in that
|
|
9
|
+
* pipeline, not services, and they stay off this barrel: a caller reaching for
|
|
10
|
+
* one of them is a caller reassembling the pipeline by hand, and the whole
|
|
11
|
+
* point of compiling a pack once is that nobody has to.
|
|
12
|
+
*
|
|
13
|
+
* What crosses the boundary is the pipeline's ends and the contracts naming
|
|
14
|
+
* them. `compilePack` is the entry the distribution and the config-story path
|
|
15
|
+
* both take. `validateStories` and `loadEffectiveModules` are the two ways
|
|
16
|
+
* third-party stories are admitted — the first screens records and reports
|
|
17
|
+
* every problem (which is how `doctor` reports a story the CLI drops rather
|
|
18
|
+
* than letting it vanish), the second is the full load the MCP server and the
|
|
19
|
+
* `capabilities` verb take. `resolvePackDetail` and `resolveUri` are the two
|
|
20
|
+
* decisions a pack's own reads defer to the runtime, and `verbKey` is the
|
|
21
|
+
* identity function every surface keys a verb by.
|
|
22
|
+
*
|
|
23
|
+
* `loadEffectiveModules` reads config and the answering pack behind DYNAMIC
|
|
24
|
+
* imports so a bare `--help` never pays for either; consumers reach it lazily
|
|
25
|
+
* today for exactly that reason, and routing it through this barrel statically
|
|
26
|
+
* would put the config reader back on the fast path.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export type { StoryProblem } from "./collect.js";
|
|
30
|
+
export { loadEffectiveModules, validateStories } from "./collect.js";
|
|
31
|
+
export { compilePack } from "./compile.js";
|
|
32
|
+
export { resolvePackDetail } from "./disclosure.js";
|
|
33
|
+
export { resolveUri } from "./iri.js";
|
|
34
|
+
export type {
|
|
35
|
+
PackDefinition,
|
|
36
|
+
PackRow,
|
|
37
|
+
StorySource,
|
|
38
|
+
} from "./types.js";
|
|
39
|
+
export { distributionSource } from "./types.js";
|
|
40
|
+
export { verbKey } from "./uniqueness.js";
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IRI utilities for pack lookups addressed by prefixed name or absolute IRI.
|
|
3
|
+
*
|
|
4
|
+
* `resolveUri` expands a prefixed name through the store's merged prefix map (a
|
|
5
|
+
* registered prefix always wins; a foreign absolute IRI passes through);
|
|
6
|
+
* `isEmbeddableIri` is the stricter `scheme://…` shape a resolved IRI must match
|
|
7
|
+
* before it can be interpolated into a generated `<iri>` query token.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { callRecovery, PragmaError } from "../error/index.js";
|
|
11
|
+
|
|
12
|
+
/** Characters not allowed inside a SPARQL `<IRI>`. */
|
|
13
|
+
const UNSAFE_IRI_PATTERN = /[<>"{}|\\^`\s]/;
|
|
14
|
+
|
|
15
|
+
/** A general absolute IRI: `scheme://…` (http, https, …) or a `urn:` opaque IRI. */
|
|
16
|
+
const ABSOLUTE_IRI_PATTERN = /^(?:[A-Za-z][A-Za-z0-9+.-]*:\/\/|urn:)\S/i;
|
|
17
|
+
|
|
18
|
+
/** The embeddable-IRI shape: an authority-bearing `scheme://…` with no IRI-breakers. */
|
|
19
|
+
const EMBEDDABLE_IRI_PATTERN = /^[A-Za-z][\w+.-]*:\/\/[^<>"\s]+$/;
|
|
20
|
+
|
|
21
|
+
/** Whether a resolved IRI is safe to embed as a `<iri>` query token. */
|
|
22
|
+
export function isEmbeddableIri(value: string): boolean {
|
|
23
|
+
return EMBEDDABLE_IRI_PATTERN.test(value);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Resolve a prefixed or absolute URI to its full form.
|
|
28
|
+
*
|
|
29
|
+
* A value that fails to resolve and carries a `%` is retried once decoded, so a
|
|
30
|
+
* client that percent-encodes the URI it addresses (`ds%3AComponent`) is served
|
|
31
|
+
* rather than rejected. Every diagnostic names the value the CALLER supplied —
|
|
32
|
+
* the safety check runs on the expansion, but nobody typed the expansion.
|
|
33
|
+
*
|
|
34
|
+
* @param uri - A full or prefixed URI string.
|
|
35
|
+
* @param prefixes - The store's merged prefix→namespace map.
|
|
36
|
+
* @returns The fully expanded URI.
|
|
37
|
+
* @throws PragmaError INVALID_INPUT when the format is invalid or the prefix is unknown.
|
|
38
|
+
*/
|
|
39
|
+
export function resolveUri(
|
|
40
|
+
uri: string,
|
|
41
|
+
prefixes: Readonly<Record<string, string>>,
|
|
42
|
+
): string {
|
|
43
|
+
const direct = tryResolveUri(uri, prefixes);
|
|
44
|
+
if (typeof direct === "string") return direct;
|
|
45
|
+
|
|
46
|
+
const decoded = uri.includes("%") ? decodeOnce(uri) : undefined;
|
|
47
|
+
if (decoded !== undefined && decoded !== uri) {
|
|
48
|
+
const viaDecoded = tryResolveUri(decoded, prefixes);
|
|
49
|
+
if (typeof viaDecoded === "string") return viaDecoded;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Report the input as given, never the decoded or expanded form.
|
|
53
|
+
throw direct;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* One resolution attempt: the expanded IRI, or the error describing `uri`.
|
|
58
|
+
*
|
|
59
|
+
* @param uri - The candidate URI, as the caller wrote it.
|
|
60
|
+
* @param prefixes - The store's merged prefix→namespace map.
|
|
61
|
+
* @returns The expanded IRI on success, else the PragmaError to report.
|
|
62
|
+
*/
|
|
63
|
+
function tryResolveUri(
|
|
64
|
+
uri: string,
|
|
65
|
+
prefixes: Readonly<Record<string, string>>,
|
|
66
|
+
): string | PragmaError {
|
|
67
|
+
const colonIdx = uri.indexOf(":");
|
|
68
|
+
if (colonIdx === -1) {
|
|
69
|
+
return PragmaError.invalidInput("uri", uri, {
|
|
70
|
+
recovery: {
|
|
71
|
+
message: 'Use a prefixed URI (e.g. "prefix:name") or a full URI.',
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const prefix = uri.slice(0, colonIdx);
|
|
77
|
+
const namespace = prefixes[prefix];
|
|
78
|
+
if (namespace !== undefined) {
|
|
79
|
+
const resolved = `${namespace}${uri.slice(colonIdx + 1)}`;
|
|
80
|
+
return unsafeIriError(uri, resolved) ?? resolved;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (ABSOLUTE_IRI_PATTERN.test(uri)) {
|
|
84
|
+
return unsafeIriError(uri, uri) ?? uri;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return PragmaError.invalidInput("prefix", prefix, {
|
|
88
|
+
validOptions: Object.keys(prefixes),
|
|
89
|
+
recovery: callRecovery(
|
|
90
|
+
{ verb: "ontology list" },
|
|
91
|
+
"List known ontology prefixes.",
|
|
92
|
+
),
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Guard the EXPANSION, name the INPUT: the check is on the IRI that would reach
|
|
98
|
+
* a query, the message is about the value the caller actually typed.
|
|
99
|
+
*
|
|
100
|
+
* @param input - The URI as the caller wrote it.
|
|
101
|
+
* @param resolved - The expanded IRI the check runs against.
|
|
102
|
+
* @returns The error when `resolved` carries IRI-breaking characters, else undefined.
|
|
103
|
+
*/
|
|
104
|
+
function unsafeIriError(
|
|
105
|
+
input: string,
|
|
106
|
+
resolved: string,
|
|
107
|
+
): PragmaError | undefined {
|
|
108
|
+
if (!UNSAFE_IRI_PATTERN.test(resolved)) return undefined;
|
|
109
|
+
return PragmaError.invalidInput("uri", input, {
|
|
110
|
+
recovery: { message: "URI contains characters not allowed in IRIs." },
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Percent-decode a value, tolerating malformed encodings.
|
|
116
|
+
*
|
|
117
|
+
* `decodeURIComponent` throws `URIError` on a stray `%` — a decode ATTEMPT must
|
|
118
|
+
* never turn a reportable input error into a crash.
|
|
119
|
+
*
|
|
120
|
+
* @param value - The possibly percent-encoded value.
|
|
121
|
+
* @returns The decoded value, or undefined when it cannot be decoded.
|
|
122
|
+
*/
|
|
123
|
+
function decodeOnce(value: string): string | undefined {
|
|
124
|
+
try {
|
|
125
|
+
return decodeURIComponent(value);
|
|
126
|
+
} catch {
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The page a list-shaped verb answers with: how many rows, and where from.
|
|
3
|
+
*
|
|
4
|
+
* WHY A DEFAULT AT ALL. Before this, no list carried a cap: every declared
|
|
5
|
+
* story returned its whole population on every call, and an agent calling one
|
|
6
|
+
* speculatively paid for all of it. A default is what makes the cap real — a
|
|
7
|
+
* `--limit` nobody passes bounds nothing.
|
|
8
|
+
*
|
|
9
|
+
* WHY THIS DEFAULT. It answers to TWO constraints, and it is the largest number
|
|
10
|
+
* that satisfies both.
|
|
11
|
+
*
|
|
12
|
+
* From below: it stays above the row count of every story that already existed
|
|
13
|
+
* when the page arrived (the largest, `block list`, is 252), so no answer that
|
|
14
|
+
* was whole before the pair is truncated by it now.
|
|
15
|
+
*
|
|
16
|
+
* From above: the payload budget bounds ONE answer, and the suite that enforces
|
|
17
|
+
* it requires the largest default answer to sit under 0.8 of the ceiling —
|
|
18
|
+
* 100,000 bytes — so a ceiling nothing approaches keeps catching things and one
|
|
19
|
+
* sitting on the measurement does not flake. The fattest row any declared story
|
|
20
|
+
* serialises is `token values` at 244 bytes, so 300 rows of it is about 73 KB
|
|
21
|
+
* and the gate holds with room to spare.
|
|
22
|
+
*
|
|
23
|
+
* The first constraint alone gave 500, which is what this was, and the second
|
|
24
|
+
* retired it: the token-graph stories brought populations of 745, 1,156, 1,237
|
|
25
|
+
* and 1,746 rows, and at 500 rows `token values` measured 121,776 bytes —
|
|
26
|
+
* inside the ceiling and past the gate, with no headroom left. So the number is
|
|
27
|
+
* now derived from the budget rather than from a population that no longer
|
|
28
|
+
* bounds anything.
|
|
29
|
+
*
|
|
30
|
+
* It is still a KERNEL default and not a per-story one — a story has no
|
|
31
|
+
* page-size knob, so there is exactly one number to know, and it is written
|
|
32
|
+
* here, in the help text of every list verb, and in `BUDGETS.md` beside the
|
|
33
|
+
* payload it bounds. A per-story knob is what to reach for when one story's
|
|
34
|
+
* rows are so much fatter than the rest that one number cannot serve both;
|
|
35
|
+
* that is not true of any story today.
|
|
36
|
+
*
|
|
37
|
+
* WHY A CEILING AS WELL. The page's two integers are emitted into the query
|
|
38
|
+
* ({@link ./sparql/buildListQuery}), and the store's own `LIMIT`/`OFFSET` must
|
|
39
|
+
* fit a 32-bit integer while `Number.isInteger` admits anything up to 2^53. So
|
|
40
|
+
* `--limit 9007199254740991` — the natural "give me everything" an agent
|
|
41
|
+
* writes — used to reach the engine and come back as a raw parse error wrapped
|
|
42
|
+
* in INTERNAL_ERROR and "report this issue", from a flag whose own help invited
|
|
43
|
+
* a larger number. {@link MAX_LIST_WINDOW} is where both halves of the window
|
|
44
|
+
* are refused instead, with the typed INVALID_INPUT the rest of the pair uses
|
|
45
|
+
* and the ceiling named in the message.
|
|
46
|
+
*
|
|
47
|
+
* The cursor that carries a caller from one page to the next is
|
|
48
|
+
* {@link ./cursor}, kept apart because it hashes and this module is reached
|
|
49
|
+
* from the compiler on the storeless `--help` path. It bounds its own offset by
|
|
50
|
+
* the same ceiling, from here.
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
import { PragmaError } from "../error/index.js";
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Rows a list-shaped verb returns when the caller names no `--limit`.
|
|
57
|
+
*
|
|
58
|
+
* Derived from the payload budget and from the populations that predate the
|
|
59
|
+
* page — see the module note for both halves of the arithmetic.
|
|
60
|
+
*/
|
|
61
|
+
export const DEFAULT_LIST_LIMIT = 300;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The largest `--limit`, and the largest cursor offset, the kernel admits.
|
|
65
|
+
*
|
|
66
|
+
* NOT the engine's limit, which is an implementation detail of the pinned store
|
|
67
|
+
* and would make the refusal a fact about oxigraph. It comes from the payload
|
|
68
|
+
* budget instead, which is a fact about the answer: `BUDGETS.md`'s
|
|
69
|
+
* `LIST_PAYLOAD_BUDGET_BYTES` is 125,000, and the narrowest row a story can
|
|
70
|
+
* possibly serialise is `{}` plus its separating comma — three bytes — so no
|
|
71
|
+
* answer of more than 41,666 rows can be inside the budget whatever a story's
|
|
72
|
+
* columns are. A limit that cannot produce a legal answer is not a legal limit;
|
|
73
|
+
* rounded down to a number a message can carry, that is 40,000. It stays 22×
|
|
74
|
+
* the largest population the distribution ships (1,746) and 133× the default
|
|
75
|
+
* page, so it refuses nothing a caller could want today.
|
|
76
|
+
*
|
|
77
|
+
* The cursor's OFFSET takes the same ceiling, for a reason of its own: an offset
|
|
78
|
+
* is a count of rows already answered, and a walk that has passed 40,000 of
|
|
79
|
+
* them is walking a population more than two orders of magnitude larger than
|
|
80
|
+
* any single legal answer — the point at which the cursor to spend is a keyset
|
|
81
|
+
* cursor, which is what the encoding's `v` field exists to allow. Until such a
|
|
82
|
+
* story exists, an offset that large is a hand-built or tampered token, and one
|
|
83
|
+
* typed refusal is the honest answer to both.
|
|
84
|
+
*
|
|
85
|
+
* `listBudget.shipped.exec.test.ts` asserts the arithmetic tying this to the
|
|
86
|
+
* budget, so the two cannot drift apart in silence.
|
|
87
|
+
*/
|
|
88
|
+
export const MAX_LIST_WINDOW = 40_000;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Read the `--limit`/`limit` argument.
|
|
92
|
+
*
|
|
93
|
+
* @param provided - The raw argument, if any.
|
|
94
|
+
* @returns The requested limit, or {@link DEFAULT_LIST_LIMIT}.
|
|
95
|
+
* @throws PragmaError INVALID_INPUT for anything that is not a whole number
|
|
96
|
+
* between 1 and {@link MAX_LIST_WINDOW}. The ceiling is named in the message:
|
|
97
|
+
* a refusal that does not say what it would accept is a guessing game.
|
|
98
|
+
*/
|
|
99
|
+
export function readLimit(provided: unknown): number {
|
|
100
|
+
if (provided === undefined) return DEFAULT_LIST_LIMIT;
|
|
101
|
+
const value = typeof provided === "number" ? provided : Number(provided);
|
|
102
|
+
if (!Number.isInteger(value) || value < 1 || value > MAX_LIST_WINDOW) {
|
|
103
|
+
throw PragmaError.invalidInput("limit", String(provided), {
|
|
104
|
+
recovery: {
|
|
105
|
+
message: `--limit takes a whole number of rows, 1 to ${MAX_LIST_WINDOW} (default ${DEFAULT_LIST_LIMIT}).`,
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return value;
|
|
110
|
+
}
|