@canonical/pragma-cli 0.33.0 → 0.35.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 +153 -30
- package/dist/.build-ok +0 -0
- package/dist/package.json +83 -0
- package/dist/pragma.conf.js +814 -0
- package/dist/pragma.conf.js.map +1 -0
- package/dist/src/bin.js +356 -0
- package/dist/src/bin.js.map +1 -0
- package/dist/src/capabilities/capabilities/capabilities.render.js +70 -0
- package/dist/src/capabilities/capabilities/capabilities.render.js.map +1 -0
- package/dist/src/capabilities/capabilities/capabilities.verb.js +59 -0
- package/dist/src/capabilities/capabilities/capabilities.verb.js.map +1 -0
- package/dist/src/capabilities/capabilities/catalog.js +130 -0
- package/dist/src/capabilities/capabilities/catalog.js.map +1 -0
- package/dist/src/capabilities/capabilities/hints.js +195 -0
- package/dist/src/capabilities/capabilities/hints.js.map +1 -0
- package/dist/src/capabilities/capabilities/index.js +11 -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 +59 -0
- package/dist/src/capabilities/colophon/colophon.render.js.map +1 -0
- package/dist/src/capabilities/colophon/colophon.verb.js +43 -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 +61 -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 +66 -0
- package/dist/src/capabilities/config/set.verb.js.map +1 -0
- package/dist/src/capabilities/config/show.render.js +84 -0
- package/dist/src/capabilities/config/show.render.js.map +1 -0
- package/dist/src/capabilities/config/show.verb.js +44 -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 +49 -0
- package/dist/src/capabilities/config/unset.verb.js.map +1 -0
- package/dist/src/capabilities/create/cliProjection.js +195 -0
- package/dist/src/capabilities/create/cliProjection.js.map +1 -0
- package/dist/src/capabilities/create/constants.js +47 -0
- package/dist/src/capabilities/create/constants.js.map +1 -0
- package/dist/src/capabilities/create/create.render.js +100 -0
- package/dist/src/capabilities/create/create.render.js.map +1 -0
- package/dist/src/capabilities/create/create.verb.js +438 -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/createSurface.generated.js +394 -0
- package/dist/src/capabilities/create/createSurface.generated.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 +18 -0
- package/dist/src/capabilities/create/index.js.map +1 -0
- package/dist/src/capabilities/create/messages.js +16 -0
- package/dist/src/capabilities/create/messages.js.map +1 -0
- package/dist/src/capabilities/create/mount.js +293 -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 +53 -0
- package/dist/src/capabilities/create/pickGenerator.js.map +1 -0
- package/dist/src/capabilities/create/types.js +2 -0
- package/dist/src/capabilities/create/types.js.map +1 -0
- package/dist/src/capabilities/distribution.js +40 -0
- package/dist/src/capabilities/distribution.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/checkKeStore.js +40 -0
- package/dist/src/capabilities/doctor/checks/checkKeStore.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/checkNodeVersion.js +21 -0
- package/dist/src/capabilities/doctor/checks/checkNodeVersion.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/checkPackageRefs.js +92 -0
- package/dist/src/capabilities/doctor/checks/checkPackageRefs.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/checkPragmaVersion.js +19 -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/index.js +27 -0
- package/dist/src/capabilities/doctor/checks/index.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 +205 -0
- package/dist/src/capabilities/doctor/checks/targetHealth.js.map +1 -0
- package/dist/src/capabilities/doctor/doctor.render.js +185 -0
- package/dist/src/capabilities/doctor/doctor.render.js.map +1 -0
- package/dist/src/capabilities/doctor/doctor.verb.js +45 -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 +83 -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/index.js +19 -0
- package/dist/src/capabilities/graph/index.js.map +1 -0
- package/dist/src/capabilities/graph/inspect.render.js +76 -0
- package/dist/src/capabilities/graph/inspect.render.js.map +1 -0
- package/dist/src/capabilities/graph/inspect.verb.js +53 -0
- package/dist/src/capabilities/graph/inspect.verb.js.map +1 -0
- package/dist/src/capabilities/graph/query.render.js +73 -0
- package/dist/src/capabilities/graph/query.render.js.map +1 -0
- package/dist/src/capabilities/graph/query.verb.js +49 -0
- package/dist/src/capabilities/graph/query.verb.js.map +1 -0
- package/dist/src/capabilities/graph/runQuery.js +41 -0
- package/dist/src/capabilities/graph/runQuery.js.map +1 -0
- package/dist/src/capabilities/index.js +56 -0
- package/dist/src/capabilities/index.js.map +1 -0
- package/dist/src/capabilities/info/collectInfo.js +66 -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 +53 -0
- package/dist/src/capabilities/info/info.render.js.map +1 -0
- package/dist/src/capabilities/info/info.verb.js +42 -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 +34 -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 +181 -0
- package/dist/src/capabilities/ontology/verbs.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 +93 -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 +423 -0
- package/dist/src/capabilities/resources/provider.js.map +1 -0
- package/dist/src/capabilities/setup/buildPlan.js +168 -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 +39 -0
- package/dist/src/capabilities/setup/operations/index.js.map +1 -0
- package/dist/src/capabilities/setup/operations/setupCompletions.js +160 -0
- package/dist/src/capabilities/setup/operations/setupCompletions.js.map +1 -0
- package/dist/src/capabilities/setup/operations/setupConfig.js +101 -0
- package/dist/src/capabilities/setup/operations/setupConfig.js.map +1 -0
- package/dist/src/capabilities/setup/operations/setupGenerator.js +343 -0
- package/dist/src/capabilities/setup/operations/setupGenerator.js.map +1 -0
- package/dist/src/capabilities/setup/operations/setupLsp.js +277 -0
- package/dist/src/capabilities/setup/operations/setupLsp.js.map +1 -0
- package/dist/src/capabilities/setup/operations/setupMcp.js +207 -0
- package/dist/src/capabilities/setup/operations/setupMcp.js.map +1 -0
- package/dist/src/capabilities/setup/operations/setupSkills.js +316 -0
- package/dist/src/capabilities/setup/operations/setupSkills.js.map +1 -0
- package/dist/src/capabilities/setup/plan.js +128 -0
- package/dist/src/capabilities/setup/plan.js.map +1 -0
- package/dist/src/capabilities/setup/plan.render.js +193 -0
- package/dist/src/capabilities/setup/plan.render.js.map +1 -0
- package/dist/src/capabilities/setup/setup.render.js +54 -0
- package/dist/src/capabilities/setup/setup.render.js.map +1 -0
- package/dist/src/capabilities/setup/setup.verb.js +334 -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 +263 -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 +137 -0
- package/dist/src/capabilities/shared/assertExecOk.js.map +1 -0
- package/dist/src/capabilities/shared/bands.js +16 -0
- package/dist/src/capabilities/shared/bands.js.map +1 -0
- package/dist/src/capabilities/shared/index.js +26 -0
- package/dist/src/capabilities/shared/index.js.map +1 -0
- package/dist/src/capabilities/shared/packageManager.js +103 -0
- package/dist/src/capabilities/shared/packageManager.js.map +1 -0
- package/dist/src/capabilities/shared/registry.js +55 -0
- package/dist/src/capabilities/shared/registry.js.map +1 -0
- package/dist/src/capabilities/skill/discover.js +195 -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 +49 -0
- package/dist/src/capabilities/skill/render.js.map +1 -0
- package/dist/src/capabilities/skill/verbs.js +83 -0
- package/dist/src/capabilities/skill/verbs.js.map +1 -0
- package/dist/src/capabilities/sources/collectStatus.js +103 -0
- package/dist/src/capabilities/sources/collectStatus.js.map +1 -0
- package/dist/src/capabilities/sources/index.js +13 -0
- package/dist/src/capabilities/sources/index.js.map +1 -0
- package/dist/src/capabilities/sources/installSkills.js +167 -0
- package/dist/src/capabilities/sources/installSkills.js.map +1 -0
- package/dist/src/capabilities/sources/runUpdate.js +394 -0
- package/dist/src/capabilities/sources/runUpdate.js.map +1 -0
- package/dist/src/capabilities/sources/status.render.js +64 -0
- package/dist/src/capabilities/sources/status.render.js.map +1 -0
- package/dist/src/capabilities/sources/status.verb.js +40 -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 +55 -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 +99 -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 +44 -0
- package/dist/src/capabilities/upgrade/upgrade.render.js.map +1 -0
- package/dist/src/capabilities/upgrade/upgrade.verb.js +52 -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 +36 -0
- package/dist/src/capabilities/version/version.verb.js.map +1 -0
- package/dist/src/constants.js +82 -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/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 +285 -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 +100 -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 +17 -0
- package/dist/src/kernel/config/defaults.js.map +1 -0
- package/dist/src/kernel/config/evaluateProjectConfig.js +126 -0
- package/dist/src/kernel/config/evaluateProjectConfig.js.map +1 -0
- package/dist/src/kernel/config/findProjectConfig.js +43 -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 +35 -0
- package/dist/src/kernel/config/paths.js.map +1 -0
- package/dist/src/kernel/config/readConfig.js +78 -0
- package/dist/src/kernel/config/readConfig.js.map +1 -0
- package/dist/src/kernel/config/schema.js +130 -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/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 +52 -0
- package/dist/src/kernel/error/recovery.js.map +1 -0
- package/dist/src/kernel/error/renderError.js +115 -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/index.js +25 -0
- package/dist/src/kernel/index.js.map +1 -0
- package/dist/src/kernel/packs/collect.js +187 -0
- package/dist/src/kernel/packs/collect.js.map +1 -0
- package/dist/src/kernel/packs/compile.js +304 -0
- package/dist/src/kernel/packs/compile.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 +258 -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 +110 -0
- package/dist/src/kernel/packs/iri.js.map +1 -0
- package/dist/src/kernel/packs/renderPack.js +129 -0
- package/dist/src/kernel/packs/renderPack.js.map +1 -0
- package/dist/src/kernel/packs/resolveEntity.js +223 -0
- package/dist/src/kernel/packs/resolveEntity.js.map +1 -0
- package/dist/src/kernel/packs/runBodies.js +87 -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 +369 -0
- package/dist/src/kernel/packs/schema.js.map +1 -0
- package/dist/src/kernel/packs/sparql/applyFilters.js +68 -0
- package/dist/src/kernel/packs/sparql/applyFilters.js.map +1 -0
- package/dist/src/kernel/packs/sparql/applySearch.js +25 -0
- package/dist/src/kernel/packs/sparql/applySearch.js.map +1 -0
- package/dist/src/kernel/packs/sparql/buildLookupQuery.js +217 -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/index.js +31 -0
- package/dist/src/kernel/packs/sparql/index.js.map +1 -0
- package/dist/src/kernel/packs/sparql/runSelect.js +101 -0
- package/dist/src/kernel/packs/sparql/runSelect.js.map +1 -0
- package/dist/src/kernel/packs/types.js +30 -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 +263 -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 +420 -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 +216 -0
- package/dist/src/kernel/project/cli/globalFlags.js.map +1 -0
- package/dist/src/kernel/project/cli/helpFormat.js +59 -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 +197 -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 +96 -0
- package/dist/src/kernel/project/cli/suggestNames.js.map +1 -0
- package/dist/src/kernel/project/cli/verbHelp.js +131 -0
- package/dist/src/kernel/project/cli/verbHelp.js.map +1 -0
- package/dist/src/kernel/project/mcp/buildServer.js +67 -0
- package/dist/src/kernel/project/mcp/buildServer.js.map +1 -0
- package/dist/src/kernel/project/mcp/envelope.js +37 -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 +44 -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 +154 -0
- package/dist/src/kernel/project/mcp/prompts/source.js.map +1 -0
- package/dist/src/kernel/project/mcp/registerVerb.js +300 -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/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 +468 -0
- package/dist/src/kernel/render/renderers.js.map +1 -0
- package/dist/src/kernel/render/style.js +85 -0
- package/dist/src/kernel/render/style.js.map +1 -0
- package/dist/src/kernel/render/turtle.js +194 -0
- package/dist/src/kernel/render/turtle.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/graphpack/build.js +122 -0
- package/dist/src/kernel/runtime/graphpack/build.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/buildIndex.js +303 -0
- package/dist/src/kernel/runtime/graphpack/buildIndex.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/embedded/pack.generated.js +6 -0
- package/dist/src/kernel/runtime/graphpack/embedded/pack.generated.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/embedded/pack.index.generated.js +4 -0
- package/dist/src/kernel/runtime/graphpack/embedded/pack.index.generated.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/embedded/pack.stories.generated.js +4 -0
- package/dist/src/kernel/runtime/graphpack/embedded/pack.stories.generated.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/embedded.js +82 -0
- package/dist/src/kernel/runtime/graphpack/embedded.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/hash.js +38 -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 +145 -0
- package/dist/src/kernel/runtime/graphpack/manifest.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/read.js +92 -0
- package/dist/src/kernel/runtime/graphpack/read.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/schemas.js +70 -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 +55 -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 +34 -0
- package/dist/src/kernel/runtime/loadSession.js.map +1 -0
- package/dist/src/kernel/runtime/paths.js +78 -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 +363 -0
- package/dist/src/kernel/runtime/readEntity.js.map +1 -0
- package/dist/src/kernel/runtime/refs/gitOps.js +65 -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 +70 -0
- package/dist/src/kernel/runtime/refs/parseRef.js.map +1 -0
- package/dist/src/kernel/runtime/refs/resolve.js +332 -0
- package/dist/src/kernel/runtime/refs/resolve.js.map +1 -0
- package/dist/src/kernel/runtime/resolveSources.js +62 -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 +51 -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/emitReference.js +578 -0
- package/dist/src/kernel/spec/emitReference.js.map +1 -0
- package/dist/src/kernel/spec/emitSurface.js +202 -0
- package/dist/src/kernel/spec/emitSurface.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/vocabulary.js +97 -0
- package/dist/src/kernel/vocabulary.js.map +1 -0
- package/dist/src/types.js +11 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +25 -24
- package/pragma.conf.ts +853 -0
- package/src/bin.ts +276 -82
- package/src/capabilities/block.parity.test.ts +253 -0
- package/src/capabilities/capabilities/capabilities.render.ts +4 -3
- package/src/capabilities/capabilities/capabilities.verb.ts +32 -14
- package/src/capabilities/capabilities/catalog.ts +20 -12
- package/src/capabilities/capabilities/hints.ts +43 -24
- package/src/capabilities/capabilities/index.ts +1 -1
- package/src/capabilities/colophon/collectColophon.ts +50 -24
- package/src/capabilities/colophon/colophon.render.ts +25 -1
- package/src/capabilities/colophon/colophon.test.ts +42 -21
- package/src/capabilities/colophon/colophon.verb.ts +9 -5
- package/src/capabilities/colophon/types.ts +16 -7
- package/src/capabilities/config/collectConfigShow.test.ts +58 -0
- package/src/capabilities/config/collectConfigShow.ts +43 -6
- package/src/capabilities/config/field.render.ts +4 -5
- package/src/capabilities/config/fields.ts +17 -37
- package/src/capabilities/config/get.verb.ts +70 -0
- package/src/capabilities/config/getUnset.test.ts +264 -0
- package/src/capabilities/config/index.ts +5 -1
- package/src/capabilities/config/runField.ts +40 -22
- package/src/capabilities/config/runGet.ts +34 -0
- package/src/capabilities/config/runSet.ts +35 -9
- package/src/capabilities/config/set.test.ts +48 -14
- package/src/capabilities/config/set.verb.ts +14 -9
- package/src/capabilities/config/show.render.test.ts +77 -5
- package/src/capabilities/config/show.render.ts +8 -13
- package/src/capabilities/config/show.verb.ts +13 -9
- package/src/capabilities/config/types.ts +26 -4
- package/src/capabilities/config/unset.verb.ts +58 -0
- package/src/capabilities/create/byteEquality.subprocess.test.ts +2 -3
- package/src/capabilities/create/byteEquality.test.ts +95 -103
- package/src/capabilities/create/cliProjection.ts +227 -0
- package/src/capabilities/create/constants.ts +50 -0
- package/src/capabilities/create/create.mcp.test.ts +91 -7
- package/src/capabilities/create/create.render.ts +71 -7
- package/src/capabilities/create/create.test.ts +523 -162
- package/src/capabilities/create/create.verb.ts +361 -321
- package/src/capabilities/create/createGrammar.test.ts +865 -0
- package/src/capabilities/create/createHelp.ts +71 -0
- package/src/capabilities/create/createSurface.generated.ts +400 -0
- package/src/capabilities/create/crossCli.subprocess.test.ts +745 -0
- package/src/capabilities/create/cwdJail.test.ts +24 -5
- package/src/capabilities/create/generatorToVerbSpec.test.ts +186 -0
- package/src/capabilities/create/generatorToVerbSpec.ts +13 -11
- package/src/capabilities/create/index.ts +9 -14
- package/src/capabilities/create/messages.ts +18 -0
- package/src/capabilities/create/mount.ts +391 -0
- package/src/capabilities/create/pathJail.test.ts +90 -0
- package/src/capabilities/create/pathJail.ts +8 -5
- package/src/capabilities/create/pickGenerator.ts +40 -46
- package/src/capabilities/create/shippedCreate.subprocess.test.ts +164 -0
- package/src/capabilities/create/types.ts +29 -5
- package/src/capabilities/{standard/parity.test.ts → distribution.parity.test.ts} +24 -14
- package/src/capabilities/distribution.test.ts +122 -0
- package/src/capabilities/distribution.ts +54 -0
- package/src/capabilities/doctor/checks/checkKeStore.ts +9 -7
- package/src/capabilities/doctor/checks/checkPackageRefs.ts +82 -46
- package/src/capabilities/doctor/checks/checkPragmaVersion.ts +5 -4
- package/src/capabilities/doctor/checks/checkShellCompletions.test.ts +125 -30
- package/src/capabilities/doctor/checks/checkShellCompletions.ts +113 -27
- package/src/capabilities/doctor/checks/index.ts +27 -0
- package/src/capabilities/doctor/checks/mcpCommand.test.ts +100 -0
- package/src/capabilities/doctor/checks/mcpCommand.ts +69 -0
- package/src/capabilities/doctor/checks/targetHealth.ts +274 -0
- package/src/capabilities/doctor/doctor.render.test.ts +24 -13
- package/src/capabilities/doctor/doctor.render.ts +45 -20
- package/src/capabilities/doctor/doctor.test.ts +158 -40
- package/src/capabilities/doctor/doctor.verb.ts +9 -5
- package/src/capabilities/doctor/runChecks.ts +65 -66
- package/src/capabilities/doctor/types.ts +21 -5
- package/src/capabilities/emptyRecovery.test.ts +44 -22
- package/src/capabilities/graph/examples.exec.test.ts +107 -0
- package/src/capabilities/graph/index.ts +1 -1
- package/src/capabilities/graph/inspect.render.ts +70 -22
- package/src/capabilities/graph/inspect.test.ts +260 -5
- package/src/capabilities/graph/inspect.verb.ts +18 -5
- package/src/capabilities/graph/query.render.ts +15 -3
- package/src/capabilities/graph/query.verb.ts +5 -4
- package/src/capabilities/graph/runQuery.ts +9 -7
- package/src/capabilities/index.ts +25 -19
- package/src/capabilities/info/collectInfo.ts +15 -10
- package/src/capabilities/info/info.render.ts +4 -3
- package/src/capabilities/info/info.verb.ts +4 -3
- package/src/capabilities/lazy.test.ts +125 -2
- package/src/capabilities/meta/complete.verb.ts +1 -1
- package/src/capabilities/meta/index.ts +1 -1
- package/src/capabilities/meta/mcp.verb.ts +10 -8
- package/src/capabilities/ontology/index.ts +15 -11
- package/src/capabilities/ontology/ontology.test.ts +6 -55
- package/src/capabilities/ontology/queries.ts +2 -2
- package/src/capabilities/ontology/render.ts +3 -4
- package/src/capabilities/ontology/verbs.ts +42 -83
- package/src/capabilities/prompt/index.ts +2 -2
- package/src/capabilities/prompt/prompt.render.ts +6 -2
- package/src/capabilities/prompt/prompt.test.ts +12 -6
- package/src/capabilities/prompt/types.ts +1 -1
- package/src/capabilities/prompt/verbs.ts +26 -14
- package/src/capabilities/reference.test.ts +63 -0
- package/src/capabilities/resources/provider.ts +367 -91
- package/src/capabilities/resources/resources.test.ts +411 -59
- package/src/capabilities/setup/buildPlan.ts +236 -0
- package/src/capabilities/setup/index.ts +7 -7
- package/src/capabilities/setup/mode.ts +74 -0
- package/src/capabilities/setup/operations/index.ts +74 -0
- package/src/capabilities/setup/operations/setupCompletions.ts +97 -24
- package/src/capabilities/setup/operations/setupConfig.ts +124 -0
- package/src/capabilities/setup/operations/setupGenerator.ts +397 -320
- package/src/capabilities/setup/operations/setupLsp.ts +329 -68
- package/src/capabilities/setup/operations/setupMcp.ts +137 -97
- package/src/capabilities/setup/operations/setupSkills.ts +336 -108
- package/src/capabilities/setup/plan.render.ts +241 -0
- package/src/capabilities/setup/plan.ts +236 -0
- package/src/capabilities/setup/setup.mcp.correctness.test.ts +432 -0
- package/src/capabilities/setup/setup.render.test.ts +281 -73
- package/src/capabilities/setup/setup.render.ts +45 -77
- package/src/capabilities/setup/setup.test.ts +972 -209
- package/src/capabilities/setup/setup.verb.ts +233 -74
- package/src/capabilities/setup/shell.test.ts +86 -0
- package/src/capabilities/setup/shell.ts +166 -14
- package/src/capabilities/setup/targets.ts +367 -0
- package/src/capabilities/setup/types.ts +18 -57
- package/src/capabilities/shared/assertExecOk.ts +68 -10
- package/src/capabilities/shared/index.ts +32 -0
- package/src/capabilities/shared/packageManager.test.ts +55 -0
- package/src/capabilities/shared/packageManager.ts +62 -6
- package/src/capabilities/skill/discover.ts +47 -9
- package/src/capabilities/skill/index.ts +1 -1
- package/src/capabilities/skill/render.ts +14 -14
- package/src/capabilities/skill/skill.test.ts +7 -5
- package/src/capabilities/skill/verbs.ts +9 -10
- package/src/capabilities/sources/collectStatus.ts +61 -51
- package/src/capabilities/sources/index.ts +2 -2
- package/src/capabilities/sources/installSkills.ts +86 -9
- package/src/capabilities/sources/runUpdate.ts +164 -141
- package/src/capabilities/sources/sources.test.ts +265 -119
- package/src/capabilities/sources/status.render.test.ts +53 -24
- package/src/capabilities/sources/status.render.ts +25 -30
- package/src/capabilities/sources/status.verb.ts +16 -9
- package/src/capabilities/sources/types.ts +18 -25
- package/src/capabilities/sources/update.render.ts +10 -3
- package/src/capabilities/sources/update.verb.ts +13 -24
- package/src/capabilities/surface.test.ts +165 -25
- package/src/capabilities/tier.parity.test.ts +144 -0
- package/src/capabilities/upgrade/runUpgrade.ts +8 -8
- package/src/capabilities/upgrade/upgrade.render.ts +4 -5
- package/src/capabilities/upgrade/upgrade.test.ts +3 -3
- package/src/capabilities/upgrade/upgrade.verb.ts +8 -4
- package/src/capabilities/version/index.ts +12 -0
- package/src/capabilities/version/version.test.ts +66 -0
- package/src/capabilities/version/version.verb.ts +39 -0
- package/src/constants.test.ts +8 -6
- package/src/constants.ts +78 -22
- package/src/identity.test.ts +348 -0
- package/src/index.ts +2 -2
- package/src/kernel/completion/__snapshots__/emitScripts.test.ts.snap +20 -15
- package/src/kernel/completion/complete.test.ts +12 -2
- package/src/kernel/completion/complete.ts +1 -1
- package/src/kernel/completion/emitScripts.test.ts +1 -1
- package/src/kernel/completion/emitScripts.ts +5 -3
- package/src/kernel/completion/entitySource.test.ts +185 -41
- package/src/kernel/completion/entitySource.ts +133 -110
- package/src/kernel/completion/model.test.ts +165 -13
- package/src/kernel/completion/model.ts +105 -14
- package/src/kernel/completion/parse.test.ts +4 -7
- package/src/kernel/completion/parse.ts +15 -0
- package/src/kernel/completion/resolve.test.ts +0 -1
- package/src/kernel/completion/safety.test.ts +104 -50
- package/src/kernel/completion/shellDrive.test.ts +611 -0
- package/src/kernel/completion/templates/bash.ts +7 -2
- package/src/kernel/completion/templates/fish.ts +28 -6
- package/src/kernel/completion/templates/index.ts +23 -0
- package/src/kernel/completion/types.ts +10 -3
- package/src/kernel/config/defaults.test.ts +108 -0
- package/src/kernel/config/defaults.ts +13 -23
- package/src/kernel/config/evaluateProjectConfig.ts +33 -11
- package/src/kernel/config/findProjectConfig.ts +4 -3
- package/src/kernel/config/firstRun.test.ts +44 -38
- package/src/kernel/config/firstRun.ts +24 -81
- package/src/kernel/config/globalConfig.ts +2 -2
- package/src/kernel/config/index.ts +5 -6
- package/src/kernel/config/paths.ts +17 -17
- package/src/kernel/config/readConfig.test.ts +246 -7
- package/src/kernel/config/readConfig.ts +8 -8
- package/src/kernel/config/schema.test.ts +50 -0
- package/src/kernel/config/schema.ts +100 -11
- package/src/kernel/config/types.ts +75 -19
- package/src/kernel/copy.test.ts +483 -0
- package/src/kernel/copy.ts +54 -0
- package/src/kernel/error/PragmaError.test.ts +6 -3
- package/src/kernel/error/PragmaError.ts +4 -2
- package/src/kernel/error/constants.ts +7 -4
- package/src/kernel/error/fromTaskError.ts +28 -6
- package/src/kernel/error/index.ts +1 -1
- package/src/kernel/error/recovery.test.ts +22 -45
- package/src/kernel/error/recovery.ts +36 -27
- package/src/kernel/error/renderError.ts +42 -1
- package/src/kernel/error/types.ts +25 -4
- package/src/kernel/index.ts +26 -0
- package/src/kernel/packs/collect.test.ts +195 -11
- package/src/kernel/packs/collect.ts +212 -61
- package/src/kernel/packs/compile.test.ts +293 -8
- package/src/kernel/packs/compile.ts +108 -15
- package/src/kernel/packs/disclosure.test.ts +5 -2
- package/src/kernel/packs/disclosure.ts +2 -2
- package/src/kernel/packs/graphql/buildLookupDocument.ts +1 -1
- package/src/kernel/packs/graphql/fetchGraphqlLookup.ts +13 -13
- package/src/kernel/packs/graphql/index.ts +20 -0
- package/src/kernel/packs/graphqlSource.test.ts +6 -3
- package/src/kernel/packs/index.ts +40 -0
- package/src/kernel/packs/iri.test.ts +73 -0
- package/src/kernel/packs/iri.ts +70 -20
- package/src/kernel/packs/renderPack.ts +28 -7
- package/src/kernel/packs/resolveEntity.test.ts +213 -0
- package/src/kernel/packs/resolveEntity.ts +132 -34
- package/src/kernel/packs/runBodies.ts +16 -16
- package/src/kernel/packs/sample.ts +1 -1
- package/src/kernel/packs/schema.ts +114 -11
- package/src/kernel/packs/sparql/applyFilters.ts +16 -17
- package/src/kernel/packs/sparql/buildLookupQuery.ts +75 -3
- package/src/kernel/packs/sparql/index.ts +37 -0
- package/src/kernel/packs/sparql/runSelect.test.ts +104 -10
- package/src/kernel/packs/sparql/runSelect.ts +75 -37
- package/src/kernel/packs/toolDescription.test.ts +52 -5
- package/src/kernel/packs/types.ts +52 -4
- package/src/kernel/packs/uniqueness.ts +5 -5
- package/src/kernel/project/cli/buildProgram.test.ts +157 -17
- package/src/kernel/project/cli/buildProgram.ts +77 -18
- package/src/kernel/project/cli/constants.ts +34 -0
- package/src/kernel/project/cli/dispatch.test.ts +227 -3
- package/src/kernel/project/cli/dispatch.ts +250 -48
- package/src/kernel/project/cli/exitCodes.ts +1 -1
- package/src/kernel/project/cli/globalFlags.test.ts +117 -1
- package/src/kernel/project/cli/globalFlags.ts +130 -30
- package/src/kernel/project/cli/helpFormat.ts +14 -1
- package/src/kernel/project/cli/rootHelp.ts +140 -111
- package/src/kernel/project/cli/suggest.test.ts +33 -1
- package/src/kernel/project/cli/suggest.ts +25 -1
- package/src/kernel/project/cli/verbHelp.test.ts +30 -0
- package/src/kernel/project/cli/verbHelp.ts +23 -7
- package/src/kernel/project/mcp/buildServer.ts +18 -10
- package/src/kernel/project/mcp/envelope.ts +2 -2
- package/src/kernel/project/mcp/instructions.ts +12 -7
- package/src/kernel/project/mcp/mcpError.ts +1 -1
- package/src/kernel/project/mcp/parity.test.ts +42 -1
- package/src/kernel/project/mcp/prompts/index.ts +37 -0
- package/src/kernel/project/mcp/prompts/prompts.test.ts +120 -5
- package/src/kernel/project/mcp/prompts/provider.ts +22 -8
- package/src/kernel/project/mcp/prompts/source.ts +69 -68
- package/src/kernel/project/mcp/registerVerb.ts +56 -11
- package/src/kernel/project/mcp/serve.ts +13 -5
- package/src/kernel/project/mcp/toolDescriptions.test.ts +6 -2
- package/src/kernel/render/__snapshots__/renderers.test.ts.snap +7 -4
- package/src/kernel/render/contracts.ts +21 -0
- package/src/kernel/render/disclosure.ts +4 -2
- package/src/kernel/render/envelope.ts +2 -3
- package/src/kernel/render/formatters.ts +1 -1
- package/src/kernel/render/prefixes.test.ts +36 -0
- package/src/kernel/render/prefixes.ts +40 -13
- package/src/kernel/render/renderers.test.ts +244 -7
- package/src/kernel/render/renderers.ts +222 -20
- package/src/kernel/render/style.test.ts +75 -24
- package/src/kernel/render/style.ts +31 -1
- package/src/kernel/render/turtle.ts +222 -0
- package/src/kernel/runtime/graphpack/build.ts +29 -3
- package/src/kernel/runtime/graphpack/buildIndex.test.ts +46 -0
- package/src/kernel/runtime/graphpack/buildIndex.ts +53 -18
- package/src/kernel/runtime/graphpack/embedded/pack.generated.ts +5 -5
- package/src/kernel/runtime/graphpack/embedded/pack.index.generated.ts +3 -3
- package/src/kernel/runtime/graphpack/embedded/pack.stories.generated.ts +3 -0
- package/src/kernel/runtime/graphpack/embedded.ts +39 -13
- package/src/kernel/runtime/graphpack/graphpack.test.ts +205 -5
- package/src/kernel/runtime/graphpack/hash.ts +3 -2
- package/src/kernel/runtime/graphpack/index.ts +1 -1
- package/src/kernel/runtime/graphpack/manifest.ts +114 -12
- package/src/kernel/runtime/graphpack/read.ts +5 -11
- package/src/kernel/runtime/graphpack/schemas.ts +74 -0
- package/src/kernel/runtime/graphpack/stories.ts +84 -0
- package/src/kernel/runtime/graphpack/types.ts +61 -48
- package/src/kernel/runtime/loadSession.ts +1 -1
- package/src/kernel/runtime/paths.ts +64 -15
- package/src/kernel/runtime/probe.test.ts +8 -4
- package/src/kernel/runtime/probe.ts +6 -6
- package/src/kernel/runtime/readEntity.ts +477 -32
- package/src/kernel/runtime/refs/gitOps.ts +1 -19
- package/src/kernel/runtime/refs/index.ts +39 -0
- package/src/kernel/runtime/refs/parseRef.ts +8 -8
- package/src/kernel/runtime/refs/resolve.ts +82 -66
- package/src/kernel/runtime/resolveSources.test.ts +63 -24
- package/src/kernel/runtime/resolveSources.ts +36 -25
- package/src/kernel/runtime/storeReadiness.ts +10 -10
- package/src/kernel/runtime/storeless.test.ts +1 -1
- package/src/kernel/runtime/types.ts +15 -1
- package/src/kernel/runtime/wasmEmbed.test.ts +56 -55
- package/src/kernel/spec/emitReference.test.ts +3 -3
- package/src/kernel/spec/emitReference.ts +242 -34
- package/src/kernel/spec/emitSurface.ts +57 -11
- package/src/kernel/spec/surfaceConformance.test.ts +4 -2
- package/src/kernel/spec/surfaceConformance.ts +8 -0
- package/src/kernel/spec/types.ts +277 -13
- package/src/kernel/spec/validate.ts +2 -1
- package/src/kernel/vocabulary.test.ts +164 -0
- package/src/kernel/vocabulary.ts +146 -0
- package/src/testing/PARITY_GAPS.ts +8 -2
- package/src/testing/behavioral/README.md +3 -3
- package/src/testing/behavioral/completion.test.ts +19 -6
- package/src/testing/behavioral/docExamples.test.ts +14 -0
- package/src/testing/behavioral/errorMatrix.mcp.test.ts +6 -5
- package/src/testing/behavioral/errorMatrix.storeless.test.ts +1 -1
- package/src/testing/behavioral/exitCodes.e2e.test.ts +6 -5
- package/src/testing/behavioral/firstRun.e2e.test.ts +24 -24
- package/src/testing/behavioral/harness.foundation.test.ts +14 -5
- package/src/testing/behavioral/journeys.cli.test.ts +117 -76
- package/src/testing/behavioral/journeys.defaultPack.test.ts +88 -182
- package/src/testing/behavioral/journeys.firstInstall.test.ts +167 -0
- package/src/testing/behavioral/journeys.implementation.test.ts +206 -0
- package/src/testing/behavioral/journeys.interactiveTty.e2e.test.ts +2 -2
- package/src/testing/behavioral/journeys.mcpLifecycle.mcp.test.ts +9 -6
- package/src/testing/behavioral/journeys.packageStories.test.ts +188 -0
- package/src/testing/behavioral/liveReadSurface.ts +4 -3
- package/src/testing/behavioral/mcpServe.e2e.test.ts +57 -2
- package/src/testing/behavioral/mcpSurface.test.ts +10 -5
- package/src/testing/behavioral/rootCli.e2e.test.ts +26 -2
- package/src/testing/behavioral/staleCommands.test.ts +10 -0
- package/src/testing/eval/__snapshots__/eval.test.ts.snap +7 -7
- package/src/testing/eval/cases/assembly.ts +13 -6
- package/src/testing/eval/cases/effectful.ts +28 -15
- package/src/testing/eval/cases/readNouns.ts +22 -20
- package/src/testing/eval/cases/stable.ts +5 -1
- package/src/testing/eval/eval.test.ts +7 -1
- package/src/testing/fixtures/blockGraph.ts +79 -0
- package/src/testing/fixtures/fixtureCapability.ts +45 -1
- package/src/testing/fixtures/graph/canonical.ts +94 -5
- package/src/testing/fixtures/graph/defaultPack.ts +7 -6
- package/src/testing/fixtures/graph/owlExport.ts +7 -5
- package/src/testing/helpers/blankCanonicalRanges.ts +36 -0
- package/src/testing/helpers/fixtureGraph.ts +33 -16
- package/src/testing/helpers/packRuntime.ts +2 -3
- package/src/testing/helpers/projectCli.ts +2 -1
- package/src/testing/helpers/projectMcp.ts +38 -6
- package/src/testing/helpers/runCli.ts +35 -18
- package/src/testing/perf/budgets.test.ts +24 -9
- package/src/testing/perf/budgets.ts +76 -12
- package/src/testing/perf/codegen.test.ts +126 -0
- package/src/testing/perf/globalSetup.test.ts +286 -0
- package/src/testing/perf/globalSetup.ts +611 -14
- package/src/testing/perf/measure.test.ts +38 -0
- package/src/testing/perf/measure.ts +23 -4
- package/src/testing/setupXdgIsolation.ts +81 -21
- package/src/testing/tempRoot.globalSetup.ts +122 -0
- package/src/types.ts +2 -2
- package/dist/pragma +0 -0
- package/src/capabilities/block/blockList.test.ts +0 -79
- package/src/capabilities/block/blockList.verb.ts +0 -163
- package/src/capabilities/block/index.ts +0 -25
- package/src/capabilities/block/pack.ts +0 -166
- package/src/capabilities/block/parity.test.ts +0 -187
- package/src/capabilities/block/tierChain.ts +0 -78
- package/src/capabilities/colophon/pragmaColophon.ts +0 -66
- package/src/capabilities/create/compiledCreate.subprocess.test.ts +0 -152
- package/src/capabilities/create/templates.embedded.generated.ts +0 -53
- package/src/capabilities/doctor/checks/checkConfigFile.ts +0 -41
- package/src/capabilities/doctor/checks/checkMcpCommands.ts +0 -114
- package/src/capabilities/doctor/checks/checkMcpConfigured.ts +0 -67
- package/src/capabilities/doctor/checks/checkSkillsSymlinked.ts +0 -60
- package/src/capabilities/doctor/checks/deriveBand.test.ts +0 -42
- package/src/capabilities/doctor/checks/deriveBand.ts +0 -28
- package/src/capabilities/modifier/index.ts +0 -15
- package/src/capabilities/modifier/pack.ts +0 -64
- package/src/capabilities/standard/index.ts +0 -18
- package/src/capabilities/standard/pack.ts +0 -128
- package/src/capabilities/tier/index.ts +0 -19
- package/src/capabilities/tier/lookup.render.test.ts +0 -72
- package/src/capabilities/tier/lookup.render.ts +0 -59
- package/src/capabilities/tier/lookup.test.ts +0 -83
- package/src/capabilities/tier/lookup.verb.ts +0 -44
- package/src/capabilities/tier/pack.ts +0 -28
- package/src/capabilities/tier/runLookup.ts +0 -87
- package/src/capabilities/token/addConfig.render.ts +0 -27
- package/src/capabilities/token/addConfig.test.ts +0 -62
- package/src/capabilities/token/addConfig.verb.ts +0 -40
- package/src/capabilities/token/index.ts +0 -19
- package/src/capabilities/token/pack.ts +0 -58
- package/src/capabilities/token/runAddConfig.ts +0 -95
- package/src/kernel/completion/bashDrive.test.ts +0 -73
- package/src/kernel/config/__snapshots__/firstRun.test.ts.snap +0 -11
- package/src/kernel/runtime/graphpack/embedded/sample.ttl +0 -39
- package/src/kernel/runtime/lock.ts +0 -90
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synthesize a setup invocation as a summon `GeneratorDefinition` driven by the
|
|
3
|
+
* TARGET TABLE, so the run-all and every sub-verb flow through the same
|
|
4
|
+
* `execute` seam `create` uses — inheriting the Ink wizard, the recap/confirm
|
|
5
|
+
* gate, live progress, colours, and the shared cancel fixes by construction.
|
|
6
|
+
*
|
|
7
|
+
* The shape mirrors `create`: detection runs FOR REAL up front (once per
|
|
8
|
+
* target/band, in `detectTargets`), then a PURE `generate` composes only the
|
|
9
|
+
* effects for the SELECTED rows. `generate` must stay re-interpretable —
|
|
10
|
+
* `execute` invokes it more than once (the confirm-gate preview and the build) —
|
|
11
|
+
* so it is composed from combinators and does no reads of its own.
|
|
12
|
+
*
|
|
13
|
+
* The wizard is the PLAN'S EDITOR, not a parallel path: its choices are the plan
|
|
14
|
+
* rows, and what it edits is each row's `selected` flag. There is exactly one
|
|
15
|
+
* list of things this command can do, and the preview, the wizard, the progress
|
|
16
|
+
* lines and the recap are four views of it.
|
|
17
|
+
*
|
|
18
|
+
* This module carries NO static import of `@canonical/summon-core` VALUES or of
|
|
19
|
+
* React/Ink — it only `import type`s the generator shape and builds plain object
|
|
20
|
+
* literals over `@canonical/task`. It is itself reached only through the verb's
|
|
21
|
+
* lazy dynamic import, so the fast paths stay free of it.
|
|
22
|
+
*/
|
|
23
|
+
import { flatMap, pure, recover, sequence_, warn, } from "@canonical/task";
|
|
24
|
+
import { BIN_NAME } from "../../../constants.js";
|
|
25
|
+
import { PragmaError } from "../../../kernel/error/index.js";
|
|
26
|
+
import { buildPlan, detectionFailure, detectTargets, draftFor, resolveRoots, } from "../buildPlan.js";
|
|
27
|
+
import { isActionable, TARGET_IDS, withRows, } from "../plan.js";
|
|
28
|
+
/** The answer key the run-all's row multiselect writes. */
|
|
29
|
+
const ROWS_ANSWER = "targets";
|
|
30
|
+
/** The answer key the opt-in per-file MCP narrowing writes. */
|
|
31
|
+
const MCP_FILES_ANSWER = "mcpTargets";
|
|
32
|
+
/** The answer key the opt-in per-editor LSP narrowing writes. */
|
|
33
|
+
const LSP_EDITORS_ANSWER = "lspEditors";
|
|
34
|
+
/** Which answer key carries a target's per-child selection, if it has one. */
|
|
35
|
+
const CHILD_ANSWER = {
|
|
36
|
+
mcp: MCP_FILES_ANSWER,
|
|
37
|
+
lsp: LSP_EDITORS_ANSWER,
|
|
38
|
+
};
|
|
39
|
+
/** A row's identity in an answer bag: band-qualified, so `both` stays unambiguous. */
|
|
40
|
+
const rowKey = (band, target) => `${band}:${target}`;
|
|
41
|
+
/**
|
|
42
|
+
* Where a failed row's error lands during interpretation.
|
|
43
|
+
*
|
|
44
|
+
* Per-row failure isolation needs somewhere to put "row X failed with Y", and
|
|
45
|
+
* `execute` yields only the generator's answers and effects — the value of the
|
|
46
|
+
* composed task is discarded. So the recover handlers record here, and the head
|
|
47
|
+
* of the sequence CLEARS it: `generate` is invoked fresh per interpretation, so
|
|
48
|
+
* the clear runs first on every drive and the last drive (the real one, which
|
|
49
|
+
* follows `execute`'s mocked preview) is the one whose records survive. The
|
|
50
|
+
* composition itself stays pure and re-interpretable — nothing is captured in
|
|
51
|
+
* the task, only written while it runs.
|
|
52
|
+
*/
|
|
53
|
+
class OutcomeSink {
|
|
54
|
+
errors = new Map();
|
|
55
|
+
/** Forget every recorded failure — run at the head of each interpretation. */
|
|
56
|
+
clear() {
|
|
57
|
+
this.errors.clear();
|
|
58
|
+
}
|
|
59
|
+
record(key, error) {
|
|
60
|
+
this.errors.set(key, error);
|
|
61
|
+
}
|
|
62
|
+
get(key) {
|
|
63
|
+
return this.errors.get(key);
|
|
64
|
+
}
|
|
65
|
+
get failureCount() {
|
|
66
|
+
return this.errors.size;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** The {@link PragmaError} a row failure carries, or a wrapper around it. */
|
|
70
|
+
const rowPragmaError = (error) => error.cause instanceof PragmaError
|
|
71
|
+
? error.cause
|
|
72
|
+
: new PragmaError({ code: "UNSUPPORTED", message: error.message });
|
|
73
|
+
/**
|
|
74
|
+
* Run the chosen rows with per-row failure isolation. The rows are independent
|
|
75
|
+
* installers, so one unsatisfiable prerequisite must not consume the others: a
|
|
76
|
+
* sequenced composition let a failing editor sideload abort the run before MCP
|
|
77
|
+
* or skills ever executed, so on every machine without a usable editor CLI the
|
|
78
|
+
* single advertised onboarding command configured nothing that mattered.
|
|
79
|
+
*
|
|
80
|
+
* Each row runs under a `recover` frame: the failure is reported inline (a
|
|
81
|
+
* `warn` right where it happened), recorded on the sink, and the remaining rows
|
|
82
|
+
* still run. The aggregate outcome is decided afterwards by the caller reading
|
|
83
|
+
* the sink — a run whose every failure is recorded does NOT rethrow, because the
|
|
84
|
+
* recap is the report and the exit code comes from the plan's own rule.
|
|
85
|
+
*
|
|
86
|
+
* Only failures travelling the task FAILURE CHANNEL are isolable — a synchronous
|
|
87
|
+
* throw bypasses the trampoline's recovery frames — which is why the row bodies
|
|
88
|
+
* raise via `checkExecOk`/`failPragma`, never a bare throw. Interruption bypasses
|
|
89
|
+
* recovery by interpreter invariant, so Ctrl-C still stops the whole run.
|
|
90
|
+
*/
|
|
91
|
+
const runRowsIsolated = (sink, rows) => flatMap(pure(undefined), () => {
|
|
92
|
+
sink.clear();
|
|
93
|
+
return sequence_(rows.map(({ key, task }) => recover(task, (error) => flatMap(warn(`The ${key.split(":")[1]} step did not complete — continuing with the remaining targets.`), () => {
|
|
94
|
+
sink.record(key, error);
|
|
95
|
+
return pure(undefined);
|
|
96
|
+
}))));
|
|
97
|
+
});
|
|
98
|
+
/** Build a generator's `meta` (no stamping — the version is just header text). */
|
|
99
|
+
const buildMeta = (rt, title) => ({
|
|
100
|
+
name: title,
|
|
101
|
+
displayName: title,
|
|
102
|
+
description: `Configure ${BIN_NAME} on this machine`,
|
|
103
|
+
version: rt.version,
|
|
104
|
+
});
|
|
105
|
+
/** Read a multiselect answer as a string array. */
|
|
106
|
+
const readList = (answers, key) => Array.isArray(answers[key]) ? answers[key] : undefined;
|
|
107
|
+
/**
|
|
108
|
+
* The wizard's row multiselect — its choices ARE the plan rows. Actionable rows
|
|
109
|
+
* are pre-selected; an already-current row is offered DE-selected, so a re-run
|
|
110
|
+
* never proposes to rewrite what is already correct. A skip row is not a choice
|
|
111
|
+
* at all (summon's choice shape has no disabled state) but stays a visible row
|
|
112
|
+
* in the plan and the recap, carrying its reason.
|
|
113
|
+
*/
|
|
114
|
+
const buildRowsPrompt = (plan) => {
|
|
115
|
+
const choices = plan.rows
|
|
116
|
+
.filter((row) => row.action !== "skip")
|
|
117
|
+
.map((row) => ({
|
|
118
|
+
label: `${row.target} — ${row.detail}${row.action === "none" ? " (already configured)" : ""}`,
|
|
119
|
+
value: rowKey(row.band, row.target),
|
|
120
|
+
}));
|
|
121
|
+
return {
|
|
122
|
+
name: ROWS_ANSWER,
|
|
123
|
+
type: "multiselect",
|
|
124
|
+
message: "Which targets would you like to configure?",
|
|
125
|
+
choices,
|
|
126
|
+
default: plan.rows
|
|
127
|
+
.filter((row) => row.selected)
|
|
128
|
+
.map((row) => rowKey(row.band, row.target)),
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
/** The opt-in "customize which files" gate — defaults to false. */
|
|
132
|
+
const buildCustomizePrompt = (when) => ({
|
|
133
|
+
name: "customize",
|
|
134
|
+
type: "confirm",
|
|
135
|
+
message: `Customize which files ${BIN_NAME} configures?`,
|
|
136
|
+
default: false,
|
|
137
|
+
when,
|
|
138
|
+
});
|
|
139
|
+
/**
|
|
140
|
+
* The per-file MCP multiselect — one row per deduplicated config file, across
|
|
141
|
+
* every band the run covers. An already-current file is DEFAULT-DESELECTED; a
|
|
142
|
+
* file that is absent or drifted stays selected. Retained unchanged from the
|
|
143
|
+
* landed opt-in narrowing: it is row-level CHILD selection, which is exactly
|
|
144
|
+
* what the plan's child rows are.
|
|
145
|
+
*/
|
|
146
|
+
const buildChildPrompt = (plan, target, message, when) => {
|
|
147
|
+
const children = childrenOf(plan, target);
|
|
148
|
+
return {
|
|
149
|
+
name: CHILD_ANSWER[target],
|
|
150
|
+
type: "multiselect",
|
|
151
|
+
message,
|
|
152
|
+
when,
|
|
153
|
+
choices: children.map((child) => ({
|
|
154
|
+
label: `${child.label} — ${child.action}`,
|
|
155
|
+
value: child.key,
|
|
156
|
+
})),
|
|
157
|
+
default: children
|
|
158
|
+
.filter((child) => child.action !== "unchanged")
|
|
159
|
+
.map((child) => child.key),
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
/** Every child row a target contributes, across the bands in the plan. */
|
|
163
|
+
const childrenOf = (plan, target) => plan.rows
|
|
164
|
+
.filter((row) => row.target === target)
|
|
165
|
+
.flatMap((row) => row.children ?? []);
|
|
166
|
+
/** Whether a row was chosen: by the wizard's answer, else by its own default. */
|
|
167
|
+
const isChosen = (row, chosen) => row.action !== "skip" &&
|
|
168
|
+
(chosen === undefined
|
|
169
|
+
? row.selected
|
|
170
|
+
: chosen.includes(rowKey(row.band, row.target)));
|
|
171
|
+
/**
|
|
172
|
+
* What a row DID, as a past-tense word. The row's detail says what and where;
|
|
173
|
+
* the note says what happened to it, so a progress line and a recap line read
|
|
174
|
+
* as sentences rather than as two halves of one.
|
|
175
|
+
*/
|
|
176
|
+
const ACTION_NOTES = {
|
|
177
|
+
install: "installed",
|
|
178
|
+
update: "updated",
|
|
179
|
+
link: "linked",
|
|
180
|
+
remove: "removed",
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* The `2 added, 1 updated` note a row's children produce — counted over the
|
|
184
|
+
* children the run KEPT, not the ones it was offered.
|
|
185
|
+
*
|
|
186
|
+
* `kept` is the row's own child answer: the MCP files, or the LSP editors, the
|
|
187
|
+
* wizard narrowed to. Counting the plan's children instead recapped `2 added`
|
|
188
|
+
* for a run the user had just narrowed to one file, so the plan and the result
|
|
189
|
+
* described different work. Absent (`undefined`) means the narrowing prompt was
|
|
190
|
+
* never answered, which is the same thing the compose bodies read as "all".
|
|
191
|
+
*
|
|
192
|
+
* @param row - The plan row.
|
|
193
|
+
* @param kept - The child keys the run retained, or `undefined` for all.
|
|
194
|
+
* @returns The counts note, or `undefined` when the row has no children.
|
|
195
|
+
*/
|
|
196
|
+
function childNote(row, kept) {
|
|
197
|
+
const children = (row.children ?? []).filter((child) => kept === undefined || kept.includes(child.key));
|
|
198
|
+
if (children.length === 0)
|
|
199
|
+
return undefined;
|
|
200
|
+
const count = (action) => children.filter((child) => child.action === action).length;
|
|
201
|
+
const parts = [
|
|
202
|
+
count("add") > 0 ? `${count("add")} added` : "",
|
|
203
|
+
count("update") > 0 ? `${count("update")} updated` : "",
|
|
204
|
+
count("unchanged") > 0 ? `${count("unchanged")} unchanged` : "",
|
|
205
|
+
].filter((part) => part.length > 0);
|
|
206
|
+
return parts.length > 0 ? parts.join(", ") : undefined;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Build one invocation: detect, plan, synthesize the generator, and expose the
|
|
210
|
+
* projection back onto the plan.
|
|
211
|
+
*
|
|
212
|
+
* @param rt - The per-invocation runtime.
|
|
213
|
+
* @param mode - The entry point: the run-all, or one target.
|
|
214
|
+
* @param scope - The resolved band selection.
|
|
215
|
+
* @param removal - Compose the removal (`--undo`) instead of the install.
|
|
216
|
+
* @returns The plan, the generator, and the answers-to-plan projection.
|
|
217
|
+
* @note Impure — runs every selected target's real detection.
|
|
218
|
+
*/
|
|
219
|
+
export async function buildSetupRun(rt, mode, scope, removal = false) {
|
|
220
|
+
const ids = mode === "all" ? [...TARGET_IDS] : [mode];
|
|
221
|
+
const roots = await resolveRoots(rt);
|
|
222
|
+
const detected = await detectTargets(rt, ids, scope);
|
|
223
|
+
const plan = buildPlan(scope, roots, detected, ids, removal);
|
|
224
|
+
const sink = new OutcomeSink();
|
|
225
|
+
const prompts = [];
|
|
226
|
+
if (mode === "all")
|
|
227
|
+
prompts.push(buildRowsPrompt(plan));
|
|
228
|
+
// A target is worth narrowing only when it has more than one child to choose
|
|
229
|
+
// between. `mcp` offers its config files; `lsp` offers the editors on PATH —
|
|
230
|
+
// a machine with several VS Code forks should not have the extension pushed
|
|
231
|
+
// into all of them just because they are installed.
|
|
232
|
+
const narrowable = [
|
|
233
|
+
["mcp", "Configure MCP for which files?"],
|
|
234
|
+
["lsp", "Install the extension into which editors?"],
|
|
235
|
+
].filter(([target]) => !removal && childrenOf(plan, target).length > 1);
|
|
236
|
+
if (narrowable.length > 0) {
|
|
237
|
+
const anyChosen = (answers) => {
|
|
238
|
+
const chosen = readList(answers, ROWS_ANSWER);
|
|
239
|
+
return narrowable.some(([target]) => plan.rows.some((row) => row.target === target && isChosen(row, chosen)));
|
|
240
|
+
};
|
|
241
|
+
prompts.push(buildCustomizePrompt(anyChosen));
|
|
242
|
+
for (const [target, message] of narrowable) {
|
|
243
|
+
const rowChosen = (answers) => {
|
|
244
|
+
const chosen = readList(answers, ROWS_ANSWER);
|
|
245
|
+
return plan.rows.some((row) => row.target === target && isChosen(row, chosen));
|
|
246
|
+
};
|
|
247
|
+
prompts.push(buildChildPrompt(plan, target, message, (answers) => answers.customize === true && rowChosen(answers)));
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
/** The detection behind a row, for composing and for re-reading its draft. */
|
|
251
|
+
const detectionFor = (row) => detected.find((d) => d.target.id === row.target && d.band === row.band);
|
|
252
|
+
const generator = {
|
|
253
|
+
meta: buildMeta(rt, mode === "all" ? `${BIN_NAME} setup` : `${BIN_NAME} setup ${mode}`),
|
|
254
|
+
prompts,
|
|
255
|
+
generate: (answers) => {
|
|
256
|
+
const chosen = readList(answers, ROWS_ANSWER);
|
|
257
|
+
const tasks = plan.rows.flatMap((row) => {
|
|
258
|
+
if (!isChosen(row, chosen))
|
|
259
|
+
return [];
|
|
260
|
+
const hit = detectionFor(row);
|
|
261
|
+
if (hit === undefined)
|
|
262
|
+
return [];
|
|
263
|
+
// Each target reads ITS OWN child answer. One shared list was handing
|
|
264
|
+
// MCP file paths to every other target's compose.
|
|
265
|
+
const key = CHILD_ANSWER[row.target];
|
|
266
|
+
const children = key === undefined ? undefined : readList(answers, key);
|
|
267
|
+
const task = removal
|
|
268
|
+
? hit.target.composeRemoval(hit.detection)
|
|
269
|
+
: hit.target.compose(hit.detection, children);
|
|
270
|
+
return [{ key: rowKey(row.band, row.target), task }];
|
|
271
|
+
});
|
|
272
|
+
return runRowsIsolated(sink, tasks);
|
|
273
|
+
},
|
|
274
|
+
};
|
|
275
|
+
/** The outcome one row ended in, read off the sink and its own draft. */
|
|
276
|
+
const outcomeFor = (row, chosen, answers) => {
|
|
277
|
+
const hit = detectionFor(row);
|
|
278
|
+
// A row whose DETECTION threw has no draft to read and nothing to compose,
|
|
279
|
+
// and it is not a skip: the target was requested and did not happen. It
|
|
280
|
+
// reports `failed` with its own cause, exactly as a failed compose does, so
|
|
281
|
+
// the run names it instead of reporting a clean sweep over its siblings.
|
|
282
|
+
const failure = hit === undefined ? undefined : detectionFailure(hit);
|
|
283
|
+
if (failure !== undefined)
|
|
284
|
+
return { status: "failed", note: failure };
|
|
285
|
+
const draft = hit === undefined ? undefined : draftFor(hit, roots, removal);
|
|
286
|
+
if (row.action === "skip") {
|
|
287
|
+
return {
|
|
288
|
+
status: "skipped",
|
|
289
|
+
...(draft?.remedy === undefined ? {} : { remedy: draft.remedy }),
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
// An already-current row reports `noop` whether or not it was selected. It
|
|
293
|
+
// is offered DE-selected (there is nothing to do to it), and returning no
|
|
294
|
+
// outcome at all left a converged re-run with a plan-shaped output that
|
|
295
|
+
// claimed nothing had run — while the row still rendered a bare green ✓.
|
|
296
|
+
// Convergence is a real result: one quiet line per row, zero writes.
|
|
297
|
+
if (row.action === "none")
|
|
298
|
+
return { status: "noop", note: "unchanged" };
|
|
299
|
+
if (!isChosen(row, chosen))
|
|
300
|
+
return undefined;
|
|
301
|
+
const error = sink.get(rowKey(row.band, row.target));
|
|
302
|
+
if (error !== undefined) {
|
|
303
|
+
const pragma = rowPragmaError(error);
|
|
304
|
+
return {
|
|
305
|
+
status: "failed",
|
|
306
|
+
note: pragma.message,
|
|
307
|
+
...(pragma.recovery?.message === undefined
|
|
308
|
+
? {}
|
|
309
|
+
: { remedy: pragma.recovery.message }),
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
if (!isActionable(row.action))
|
|
313
|
+
return { status: "noop" };
|
|
314
|
+
// A removal never borrows the forward child summary: its children are the
|
|
315
|
+
// files the entry is being taken OUT of, and counting them as "1 updated"
|
|
316
|
+
// described the opposite of what the run had just done.
|
|
317
|
+
const childKey = CHILD_ANSWER[row.target];
|
|
318
|
+
const kept = childKey === undefined ? undefined : readList(answers, childKey);
|
|
319
|
+
const note = removal
|
|
320
|
+
? ACTION_NOTES[row.action]
|
|
321
|
+
: (childNote(row, kept) ?? ACTION_NOTES[row.action]);
|
|
322
|
+
return {
|
|
323
|
+
status: removal ? "removed" : "done",
|
|
324
|
+
...(note === undefined ? {} : { note }),
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
return {
|
|
328
|
+
plan,
|
|
329
|
+
generator,
|
|
330
|
+
applied: (answers) => {
|
|
331
|
+
const chosen = readList(answers, ROWS_ANSWER);
|
|
332
|
+
return withRows(plan, plan.rows.map((row) => {
|
|
333
|
+
const outcome = outcomeFor(row, chosen, answers);
|
|
334
|
+
return {
|
|
335
|
+
...row,
|
|
336
|
+
selected: isChosen(row, chosen),
|
|
337
|
+
...(outcome === undefined ? {} : { outcome }),
|
|
338
|
+
};
|
|
339
|
+
}));
|
|
340
|
+
},
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
//# sourceMappingURL=setupGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupGenerator.js","sourceRoot":"","sources":["../../../../../src/capabilities/setup/operations/setupGenerator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH,OAAO,EACL,OAAO,EACP,IAAI,EACJ,OAAO,EACP,SAAS,EAGT,IAAI,GACL,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,EACL,SAAS,EAET,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,YAAY,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,YAAY,EAKZ,UAAU,EAEV,QAAQ,GACT,MAAM,YAAY,CAAC;AAGpB,2DAA2D;AAC3D,MAAM,WAAW,GAAG,SAAS,CAAC;AAE9B,+DAA+D;AAC/D,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAEtC,iEAAiE;AACjE,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAExC,8EAA8E;AAC9E,MAAM,YAAY,GAAsC;IACtD,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,kBAAkB;CACxB,CAAC;AAEF,sFAAsF;AACtF,MAAM,MAAM,GAAG,CAAC,IAAe,EAAE,MAAgB,EAAU,EAAE,CAC3D,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC;AActB;;;;;;;;;;;GAWG;AACH,MAAM,WAAW;IACE,MAAM,GAAG,IAAI,GAAG,EAAqB,CAAC;IAEvD,8EAA8E;IAC9E,KAAK;QACH,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAED,MAAM,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,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO;QACL,IAAI;QACJ,SAAS;QACT,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE;YACnB,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAC9C,OAAO,QAAQ,CACb,IAAI,EACJ,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAW,EAAE;gBAC7B,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;gBACjD,OAAO;oBACL,GAAG,GAAG;oBACN,QAAQ,EAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;oBAC/B,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;iBAC9C,CAAC;YACJ,CAAC,CAAC,CACH,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `setup lsp` — ensure the Terrazzo LSP extension is installed in every
|
|
3
|
+
* VS Code-family editor present on this machine.
|
|
4
|
+
*
|
|
5
|
+
* There is no marketplace listing yet: the install is a VSIX SIDELOAD. The
|
|
6
|
+
* published npm package bundles the VSIX, so the install is two exec steps —
|
|
7
|
+
* fetch the package into a pragma-owned staging dir (`bun add`, so the VSIX
|
|
8
|
+
* lands at a DURABLE path a user can retry by hand, not bunx's ephemeral
|
|
9
|
+
* `/tmp/bunx-…` cache), then `<editor cli> --install-extension <vsix>` for
|
|
10
|
+
* each detected editor. The package's own `install.mjs` bin is deliberately
|
|
11
|
+
* NOT used: it hardcodes the `code` CLI, which is precisely what left
|
|
12
|
+
* VSCodium/Cursor/Windsurf/Antigravity machines unable to install at all.
|
|
13
|
+
*
|
|
14
|
+
* `detectLsp` probes FOR REAL up front, and spawns NOTHING: an editor is
|
|
15
|
+
* "present" when its CLI resolves on PATH (the `editorClis` registry names
|
|
16
|
+
* them), and "installed" when its extensions dir holds a
|
|
17
|
+
* `canonical.terrazzo-lsp-extension-<version>/` entry. Running
|
|
18
|
+
* `--list-extensions` instead would be the natural probe, but Cursor's Linux
|
|
19
|
+
* launcher OPENS THE EDITOR on that flag — a detection step must never launch
|
|
20
|
+
* an app, so the fs is the source of truth. The full extension id is matched
|
|
21
|
+
* (not the old `terrazzo` substring, which any other terrazzo-named extension
|
|
22
|
+
* could false-positive).
|
|
23
|
+
*
|
|
24
|
+
* No editor CLI found is a NAMED SKIP, not an error: the message says what was
|
|
25
|
+
* looked for and what to do, and the run exits 0 — there is nothing on this
|
|
26
|
+
* machine the step could honestly fail at. Real failures (fetch, sideload)
|
|
27
|
+
* travel the task failure channel (`checkExecOk`) with a recovery that names a
|
|
28
|
+
* command runnable on THIS machine, so the run-all can isolate the step
|
|
29
|
+
* (S1-1) and a direct `setup lsp` still renders the original error.
|
|
30
|
+
*/
|
|
31
|
+
import { existsSync, readdirSync } from "node:fs";
|
|
32
|
+
import { join } from "node:path";
|
|
33
|
+
import { exec, flatMap, mkdir, sequence_, } from "@canonical/task";
|
|
34
|
+
import { BIN_NAME } from "../../../constants.js";
|
|
35
|
+
import { checkExecOk, guardMissingBinary } from "../../shared/index.js";
|
|
36
|
+
/** The full extension id, as the editor's extensions dir spells it. */
|
|
37
|
+
const EXTENSION_ID = "canonical.terrazzo-lsp-extension";
|
|
38
|
+
/** The npm package whose tarball bundles the VSIX. */
|
|
39
|
+
const LSP_PACKAGE = "@canonical/terrazzo-lsp-extension";
|
|
40
|
+
/**
|
|
41
|
+
* Whether an editor CLI resolves on PATH, given the candidate paths the host
|
|
42
|
+
* would consider for it.
|
|
43
|
+
*
|
|
44
|
+
* The candidates come from `@canonical/harnesses`' `executableCandidates` —
|
|
45
|
+
* the same helper harness detection resolves `process` signals with — rather
|
|
46
|
+
* than from a local `PATH`-join here. That local version joined the BARE name
|
|
47
|
+
* onto each PATH directory, which resolves nothing on Windows: `code`,
|
|
48
|
+
* `codium` and friends install as `.cmd` shims, so every installed editor
|
|
49
|
+
* went unseen and `setup lsp` took the no-editor path. That path is a named
|
|
50
|
+
* SKIP, so the run exited 0 reporting a clean answer on a machine that had
|
|
51
|
+
* the editor — a wrong skip reads as correct, which is worse than a wrong
|
|
52
|
+
* failure. One implementation of the platform rules means the probe cannot
|
|
53
|
+
* drift away from detection's.
|
|
54
|
+
*/
|
|
55
|
+
const cliOnPath = (candidates) => candidates.some((candidate) => existsSync(candidate));
|
|
56
|
+
/**
|
|
57
|
+
* The oldest extension release whose bundled language server actually starts.
|
|
58
|
+
*
|
|
59
|
+
* Every VSIX before this one ships the server as ~166 loose modules importing
|
|
60
|
+
* `colorjs.io`, `@lezer/common` and `@lezer/css` by BARE SPECIFIER, with no
|
|
61
|
+
* `node_modules` beside them — so the server dies on load under `node` and
|
|
62
|
+
* under `bun --no-install`. It appeared to work only because the extension
|
|
63
|
+
* prefers Bun, and Bun silently fetches missing packages from the network at
|
|
64
|
+
* spawn time; a machine without that behaviour got a language server that
|
|
65
|
+
* never started, and one with it got a server resolving unpinned dependencies
|
|
66
|
+
* over the wire. Fixed in 0.8.3, which bundles the server into one file
|
|
67
|
+
* (canonical/design-tokens#110).
|
|
68
|
+
*/
|
|
69
|
+
const MIN_EXTENSION_VERSION = "0.8.3";
|
|
70
|
+
/** {@link MIN_EXTENSION_VERSION}, parsed once. */
|
|
71
|
+
const MINIMUM = MIN_EXTENSION_VERSION.split(".").map(Number);
|
|
72
|
+
/**
|
|
73
|
+
* A version this check can actually read: dot-separated digit runs, nothing
|
|
74
|
+
* else. Deliberately strict — see {@link parseVersion}.
|
|
75
|
+
*/
|
|
76
|
+
const NUMERIC_VERSION = /^\d+(?:\.\d+)*$/;
|
|
77
|
+
/**
|
|
78
|
+
* Parse a dotted numeric version, or `undefined` when it is not one.
|
|
79
|
+
*
|
|
80
|
+
* `Number.parseInt` is the wrong tool here and quietly breaks the fail-closed
|
|
81
|
+
* rule this module claims: it accepts numeric PREFIXES, so `1.0.0junk` reads
|
|
82
|
+
* as `[1, 0, 0]`, and `|| 0` turns a `NaN` component into a zero, so
|
|
83
|
+
* `1.invalid.0` also reads as `[1, 0, 0]`. Both then compare NEWER than the
|
|
84
|
+
* minimum and report a broken extension as installed — the exact wrong-skip
|
|
85
|
+
* this version check exists to prevent, reintroduced by the parser.
|
|
86
|
+
*
|
|
87
|
+
* So the whole string is validated before any component is trusted.
|
|
88
|
+
*/
|
|
89
|
+
const parseVersion = (value) => NUMERIC_VERSION.test(value)
|
|
90
|
+
? value.split(".").map((part) => Number(part))
|
|
91
|
+
: undefined;
|
|
92
|
+
/** Compare two dotted numeric versions. Returns <0, 0, >0 like a comparator. */
|
|
93
|
+
const compareVersions = (left, right) => {
|
|
94
|
+
for (let i = 0; i < Math.max(left.length, right.length); i++) {
|
|
95
|
+
const diff = (left[i] ?? 0) - (right[i] ?? 0);
|
|
96
|
+
if (diff !== 0)
|
|
97
|
+
return diff;
|
|
98
|
+
}
|
|
99
|
+
return 0;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Whether an editor's extensions dir holds a copy new enough to WORK.
|
|
103
|
+
*
|
|
104
|
+
* Version-aware on purpose. Matching any `canonical.terrazzo-lsp-extension-*`
|
|
105
|
+
* entry meant a machine carrying a build whose server cannot start reported
|
|
106
|
+
* `installed`, so `setup lsp` skipped it and `doctor` called it healthy —
|
|
107
|
+
* a wrong skip that reads as correct, which is worse than a wrong failure and
|
|
108
|
+
* is exactly the trap this module's docblock warns about elsewhere. Everyone
|
|
109
|
+
* who ran `setup lsp` before {@link MIN_EXTENSION_VERSION} would have kept a
|
|
110
|
+
* dead language server forever, with nothing telling them why.
|
|
111
|
+
*
|
|
112
|
+
* An unparseable suffix counts as too old: a directory this function cannot
|
|
113
|
+
* read the version of is one it cannot vouch for.
|
|
114
|
+
*/
|
|
115
|
+
const extensionInstalled = (editor, platform) => {
|
|
116
|
+
let entries;
|
|
117
|
+
try {
|
|
118
|
+
entries = readdirSync(editor.extensionsDir(platform));
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
return false; // No extensions dir — nothing installed.
|
|
122
|
+
}
|
|
123
|
+
const prefix = `${EXTENSION_ID}-`;
|
|
124
|
+
return entries.some((entry) => {
|
|
125
|
+
const lower = entry.toLowerCase();
|
|
126
|
+
if (!lower.startsWith(prefix))
|
|
127
|
+
return false;
|
|
128
|
+
const version = parseVersion(lower.slice(prefix.length));
|
|
129
|
+
if (version === undefined)
|
|
130
|
+
return false; // Unreadable: cannot vouch for it.
|
|
131
|
+
return compareVersions(version, MINIMUM) >= 0;
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Probe every registry editor: CLI presence via PATH lookup, installed-state
|
|
136
|
+
* via the extensions dir — no spawns (see the module docblock for why).
|
|
137
|
+
*
|
|
138
|
+
* @param _cwd - Unused; kept so every `detectX` shares the (cwd) shape.
|
|
139
|
+
* @returns The detected {@link LspDetection}.
|
|
140
|
+
* @note Impure — reads PATH dirs and editor extension dirs off the real fs.
|
|
141
|
+
*/
|
|
142
|
+
export async function detectLsp(_cwd) {
|
|
143
|
+
const { editorClis, executableCandidates, readPlatformEnv, userDataBase } = await import("@canonical/harnesses");
|
|
144
|
+
const platform = readPlatformEnv();
|
|
145
|
+
const editors = editorClis
|
|
146
|
+
.filter((editor) => cliOnPath(executableCandidates(editor.cli, platform)))
|
|
147
|
+
.map((editor) => ({
|
|
148
|
+
editor,
|
|
149
|
+
installed: extensionInstalled(editor, platform),
|
|
150
|
+
}));
|
|
151
|
+
const state = editors.length === 0
|
|
152
|
+
? "unknown"
|
|
153
|
+
: editors.every((e) => e.installed)
|
|
154
|
+
? "installed"
|
|
155
|
+
: "absent";
|
|
156
|
+
return {
|
|
157
|
+
available: true,
|
|
158
|
+
state,
|
|
159
|
+
editors,
|
|
160
|
+
probed: editorClis.map((editor) => editor.cli),
|
|
161
|
+
stagingDir: join(userDataBase(platform), BIN_NAME, "lsp"),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The editors an install would act on: those missing the extension, narrowed to
|
|
166
|
+
* the user's per-editor selection when the wizard collected one.
|
|
167
|
+
*
|
|
168
|
+
* A machine commonly has several VS Code forks installed and the user wants the
|
|
169
|
+
* extension in one of them. Installing into all of them because they are on
|
|
170
|
+
* PATH is the same overreach the MCP row already avoids by offering its files.
|
|
171
|
+
*
|
|
172
|
+
* @param d - The detection gathered up front.
|
|
173
|
+
* @param chosen - Selected editor CLI names, or undefined for "all pending".
|
|
174
|
+
* @returns The editors to install into.
|
|
175
|
+
*/
|
|
176
|
+
export const selectedEditors = (d, chosen) => {
|
|
177
|
+
const pending = d.editors.filter((e) => !e.installed);
|
|
178
|
+
return chosen === undefined
|
|
179
|
+
? pending
|
|
180
|
+
: pending.filter((e) => chosen.includes(e.editor.cli));
|
|
181
|
+
};
|
|
182
|
+
/** The editor names in a detection (for messages/results). */
|
|
183
|
+
export const lspEditorNames = (d) => d.editors.map((e) => e.editor.name);
|
|
184
|
+
/**
|
|
185
|
+
* The named-skip reason for a machine with no VS Code-family CLI on PATH. It
|
|
186
|
+
* names every CLI that was probed, because a skip the user cannot act on is
|
|
187
|
+
* only honest if it says what would have counted.
|
|
188
|
+
*
|
|
189
|
+
* @param d - The detection gathered up front.
|
|
190
|
+
* @returns The reason line.
|
|
191
|
+
*/
|
|
192
|
+
export const lspSkipReason = (d) => `no VS Code-family editor CLI on PATH (${d.probed.join(", ")})`;
|
|
193
|
+
/**
|
|
194
|
+
* The remedy beneath that skip. It states plainly that nothing is possible here
|
|
195
|
+
* yet rather than offering a command for a binary this machine lacks — the rule
|
|
196
|
+
* every remedy line in this capability holds to.
|
|
197
|
+
*/
|
|
198
|
+
export const LSP_SKIP_REMEDY = "no action is possible on this machine yet — install VS Code or VSCodium, then run this again";
|
|
199
|
+
/**
|
|
200
|
+
* Compose the LSP-install effects for a detection.
|
|
201
|
+
*
|
|
202
|
+
* Built from re-runnable combinators (NOT a single-use `gen`) because
|
|
203
|
+
* `execute` interprets the task twice (preview + perform); a dry-run mocks
|
|
204
|
+
* every exec (exit 0), so the preview shows the fetch + per-editor sideloads
|
|
205
|
+
* without spawning. Failures travel the task failure channel with
|
|
206
|
+
* machine-honest recoveries (see module docblock).
|
|
207
|
+
*
|
|
208
|
+
* @param d - The detection gathered up front.
|
|
209
|
+
* @returns A Task installing the extension into each editor missing it.
|
|
210
|
+
*/
|
|
211
|
+
export function composeLsp(d, chosen) {
|
|
212
|
+
// Nothing to install: no editor CLI on PATH (a named skip the plan row
|
|
213
|
+
// carries) or every detected editor already has it. Both compose NOTHING —
|
|
214
|
+
// what the run SAYS about this target is the plan row's business.
|
|
215
|
+
if (d.state !== "absent")
|
|
216
|
+
return sequence_([]);
|
|
217
|
+
const pending = selectedEditors(d, chosen);
|
|
218
|
+
// Every pending editor was deselected — there is no fetch to do either.
|
|
219
|
+
if (pending.length === 0)
|
|
220
|
+
return sequence_([]);
|
|
221
|
+
const vsixPath = lspVsixPath(d);
|
|
222
|
+
// Fetch the VSIX-bundling package into the pragma-owned staging dir. `bun`
|
|
223
|
+
// (not bunx) so the unpacked package — and its VSIX — survives at a stable
|
|
224
|
+
// path the recovery lines below can honestly point at.
|
|
225
|
+
const fetchCommand = `bun add ${LSP_PACKAGE}@latest`;
|
|
226
|
+
const fetchVsix = guardMissingBinary("bun", {
|
|
227
|
+
message: `Install Bun (https://bun.sh), then run \`${BIN_NAME} setup lsp\` again.`,
|
|
228
|
+
}, sequence_([
|
|
229
|
+
mkdir(d.stagingDir, true),
|
|
230
|
+
flatMap(exec("bun", ["add", `${LSP_PACKAGE}@latest`], d.stagingDir), (result) => checkExecOk(fetchCommand, result, {
|
|
231
|
+
message: "The extension package cannot be fetched — this machine cannot reach registry.npmjs.org. Check the connection, then run " +
|
|
232
|
+
`\`${BIN_NAME} setup lsp\` again.`,
|
|
233
|
+
})),
|
|
234
|
+
]));
|
|
235
|
+
const sideloads = pending.map(({ editor }) => {
|
|
236
|
+
const command = `${editor.cli} --install-extension ${vsixPath}`;
|
|
237
|
+
return guardMissingBinary(editor.cli, {
|
|
238
|
+
message: `The \`${editor.cli}\` CLI disappeared from PATH mid-run — restore it, then run \`${BIN_NAME} setup lsp\` again.`,
|
|
239
|
+
}, flatMap(exec(editor.cli, ["--install-extension", vsixPath], d.stagingDir), (result) => checkExecOk(command, result, {
|
|
240
|
+
message: `${editor.name} refused the VSIX (its output is above). The file is kept at ${vsixPath} — retry by hand with ` +
|
|
241
|
+
`\`${command}\`, or update ${editor.name} first.`,
|
|
242
|
+
})));
|
|
243
|
+
});
|
|
244
|
+
return sequence_([fetchVsix, ...sideloads]);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Compose the removal — deliberately empty. An extension install is an `exec`,
|
|
248
|
+
* and an `exec` carries no reversal: pretending otherwise is what made
|
|
249
|
+
* `setup lsp --undo` report a step count for work it never did. The honest
|
|
250
|
+
* answer is the plan row's, which names the editor CLI that CAN uninstall it
|
|
251
|
+
* (see {@link lspUninstallRemedy}) or states that this machine has none.
|
|
252
|
+
*
|
|
253
|
+
* @param _d - The detection (unused; the shape is the table's).
|
|
254
|
+
* @returns An empty Task.
|
|
255
|
+
*/
|
|
256
|
+
export function composeLspRemoval(_d) {
|
|
257
|
+
return sequence_([]);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* The uninstall instruction for a detection — a command that runs on THIS
|
|
261
|
+
* machine, or `undefined` when no editor CLI was found and there is therefore
|
|
262
|
+
* nothing honest to print.
|
|
263
|
+
*
|
|
264
|
+
* @param d - The detection gathered up front.
|
|
265
|
+
* @returns The uninstall command, or undefined.
|
|
266
|
+
*/
|
|
267
|
+
export function lspUninstallRemedy(d) {
|
|
268
|
+
const cli = d.editors.at(0)?.editor.cli;
|
|
269
|
+
return cli === undefined
|
|
270
|
+
? undefined
|
|
271
|
+
: `${cli} --uninstall-extension ${EXTENSION_ID}`;
|
|
272
|
+
}
|
|
273
|
+
/** The VSIX path a failed sideload leaves behind for a manual retry. */
|
|
274
|
+
export function lspVsixPath(d) {
|
|
275
|
+
return join(d.stagingDir, "node_modules", ...LSP_PACKAGE.split("/"), "terrazzo-lsp.vsix");
|
|
276
|
+
}
|
|
277
|
+
//# sourceMappingURL=setupLsp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupLsp.js","sourceRoot":"","sources":["../../../../../src/capabilities/setup/operations/setupLsp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAEL,IAAI,EACJ,OAAO,EACP,KAAK,EACL,SAAS,GAEV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAGxE,uEAAuE;AACvE,MAAM,YAAY,GAAG,kCAAkC,CAAC;AAExD,sDAAsD;AACtD,MAAM,WAAW,GAAG,mCAAmC,CAAC;AA2BxD;;;;;;;;;;;;;;GAcG;AACH,MAAM,SAAS,GAAG,CAAC,UAA6B,EAAW,EAAE,CAC3D,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;AAExD;;;;;;;;;;;;GAYG;AACH,MAAM,qBAAqB,GAAG,OAAO,CAAC;AAEtC,kDAAkD;AAClD,MAAM,OAAO,GAAa,qBAAqB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAEvE;;;GAGG;AACH,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAE1C;;;;;;;;;;;GAWG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