@canonical/pragma-cli 0.36.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/bundled-skills/adoption-a1-styles/SKILL.md +24 -0
- package/bundled-skills/adoption-a2-components/SKILL.md +22 -6
- package/bundled-skills/anatomy-author/ANATOMY_DSL_SPEC.md +1397 -327
- package/bundled-skills/anatomy-author/SKILL.md +840 -137
- package/bundled-skills/design-auditor/SKILL.md +133 -9
- package/bundled-skills/implement-component/SKILL.md +192 -23
- package/bundled-skills/specify-component/SKILL.md +124 -12
- package/bundled-skills/specify-pattern/SKILL.md +47 -8
- package/dist/package.json +23 -20
- package/dist/pragma.conf.js +963 -40
- package/dist/pragma.conf.js.map +1 -1
- package/dist/src/capabilities/capabilities/catalog.js +14 -5
- package/dist/src/capabilities/capabilities/catalog.js.map +1 -1
- package/dist/src/capabilities/capabilities/hints.js +33 -5
- package/dist/src/capabilities/capabilities/hints.js.map +1 -1
- package/dist/src/capabilities/config/show.render.js +30 -2
- package/dist/src/capabilities/config/show.render.js.map +1 -1
- package/dist/src/capabilities/create/create.verb.js +2 -1
- package/dist/src/capabilities/create/create.verb.js.map +1 -1
- package/dist/src/capabilities/create/createSurface.generated.js +23 -1
- package/dist/src/capabilities/create/createSurface.generated.js.map +1 -1
- package/dist/src/capabilities/doctor/checks/checkNodeVersion.js +11 -6
- package/dist/src/capabilities/doctor/checks/checkNodeVersion.js.map +1 -1
- package/dist/src/capabilities/doctor/checks/harnessInventory.js +1 -1
- package/dist/src/capabilities/doctor/checks/harnessInventory.js.map +1 -1
- package/dist/src/capabilities/doctor/checks/isSupportedNodeVersion.js +38 -0
- package/dist/src/capabilities/doctor/checks/isSupportedNodeVersion.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/targetHealth.js +104 -14
- package/dist/src/capabilities/doctor/checks/targetHealth.js.map +1 -1
- 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 +147 -0
- package/dist/src/capabilities/graph/connect.verb.js.map +1 -0
- package/dist/src/capabilities/graph/index.js +5 -3
- package/dist/src/capabilities/graph/index.js.map +1 -1
- package/dist/src/capabilities/graph/queryText.js +206 -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 +21 -4
- package/dist/src/capabilities/graph/runQuery.js.map +1 -1
- package/dist/src/capabilities/setup/buildPlan.js +6 -2
- package/dist/src/capabilities/setup/buildPlan.js.map +1 -1
- package/dist/src/capabilities/setup/operations/index.js +7 -2
- package/dist/src/capabilities/setup/operations/index.js.map +1 -1
- package/dist/src/capabilities/setup/operations/setupCompletions.js +6 -2
- package/dist/src/capabilities/setup/operations/setupCompletions.js.map +1 -1
- package/dist/src/capabilities/setup/operations/setupConfig.js +4 -2
- package/dist/src/capabilities/setup/operations/setupConfig.js.map +1 -1
- package/dist/src/capabilities/setup/operations/setupGenerator.js +72 -14
- package/dist/src/capabilities/setup/operations/setupGenerator.js.map +1 -1
- package/dist/src/capabilities/setup/operations/setupLsp.js +372 -62
- package/dist/src/capabilities/setup/operations/setupLsp.js.map +1 -1
- package/dist/src/capabilities/setup/operations/setupMcp.js +150 -5
- package/dist/src/capabilities/setup/operations/setupMcp.js.map +1 -1
- package/dist/src/capabilities/setup/operations/setupSkills.js +4 -2
- package/dist/src/capabilities/setup/operations/setupSkills.js.map +1 -1
- 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.map +1 -1
- package/dist/src/capabilities/setup/setup.verb.js +80 -31
- package/dist/src/capabilities/setup/setup.verb.js.map +1 -1
- package/dist/src/capabilities/setup/targets.js +124 -42
- package/dist/src/capabilities/setup/targets.js.map +1 -1
- package/dist/src/capabilities/shared/index.js +1 -1
- package/dist/src/capabilities/shared/index.js.map +1 -1
- package/dist/src/constants.js +7 -1
- package/dist/src/constants.js.map +1 -1
- package/dist/src/kernel/error/renderError.js +3 -2
- package/dist/src/kernel/error/renderError.js.map +1 -1
- package/dist/src/kernel/error/validOptions.js +41 -0
- package/dist/src/kernel/error/validOptions.js.map +1 -0
- package/dist/src/kernel/packs/compile.js +90 -6
- package/dist/src/kernel/packs/compile.js.map +1 -1
- package/dist/src/kernel/packs/cursor.js +135 -0
- package/dist/src/kernel/packs/cursor.js.map +1 -0
- package/dist/src/kernel/packs/graphql/buildLookupDocument.js +9 -2
- package/dist/src/kernel/packs/graphql/buildLookupDocument.js.map +1 -1
- package/dist/src/kernel/packs/paging.js +108 -0
- package/dist/src/kernel/packs/paging.js.map +1 -0
- package/dist/src/kernel/packs/renderPack.js +154 -5
- package/dist/src/kernel/packs/renderPack.js.map +1 -1
- package/dist/src/kernel/packs/resolveEntity.js +118 -19
- package/dist/src/kernel/packs/resolveEntity.js.map +1 -1
- package/dist/src/kernel/packs/runBodies.js +156 -18
- package/dist/src/kernel/packs/runBodies.js.map +1 -1
- package/dist/src/kernel/packs/schema.js +160 -12
- package/dist/src/kernel/packs/schema.js.map +1 -1
- 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 +251 -0
- package/dist/src/kernel/packs/sparql/buildListQuery.js.map +1 -0
- package/dist/src/kernel/packs/sparql/buildLookupQuery.js +125 -22
- package/dist/src/kernel/packs/sparql/buildLookupQuery.js.map +1 -1
- package/dist/src/kernel/packs/sparql/filterValues.js +145 -0
- package/dist/src/kernel/packs/sparql/filterValues.js.map +1 -0
- package/dist/src/kernel/packs/sparql/index.js +24 -14
- package/dist/src/kernel/packs/sparql/index.js.map +1 -1
- package/dist/src/kernel/packs/sparql/runSelect.js +10 -4
- package/dist/src/kernel/packs/sparql/runSelect.js.map +1 -1
- 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 +151 -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 +80 -0
- package/dist/src/kernel/packs/types.js.map +1 -1
- package/dist/src/kernel/project/cli/buildProgram.js +10 -1
- package/dist/src/kernel/project/cli/buildProgram.js.map +1 -1
- package/dist/src/kernel/project/cli/dispatch.js +104 -3
- package/dist/src/kernel/project/cli/dispatch.js.map +1 -1
- package/dist/src/kernel/project/cli/rootHelp.js +8 -5
- package/dist/src/kernel/project/cli/rootHelp.js.map +1 -1
- package/dist/src/kernel/project/cli/suggestNames.js +31 -7
- package/dist/src/kernel/project/cli/suggestNames.js.map +1 -1
- package/dist/src/kernel/project/mcp/registerVerb.js +5 -1
- package/dist/src/kernel/project/mcp/registerVerb.js.map +1 -1
- package/dist/src/kernel/render/renderers.js +34 -2
- package/dist/src/kernel/render/renderers.js.map +1 -1
- package/dist/src/kernel/runtime/graphpack/embedded/pack.generated.js +2 -3
- package/dist/src/kernel/runtime/graphpack/embedded/pack.generated.js.map +1 -1
- package/dist/src/kernel/runtime/graphpack/embedded/pack.index.generated.js +1 -1
- package/dist/src/kernel/runtime/graphpack/embedded/pack.index.generated.js.map +1 -1
- package/dist/src/kernel/runtime/graphpack/embedded/pack.manifest.generated.js +4 -0
- package/dist/src/kernel/runtime/graphpack/embedded/pack.manifest.generated.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/embedded.js +13 -6
- package/dist/src/kernel/runtime/graphpack/embedded.js.map +1 -1
- package/dist/src/kernel/runtime/graphpack/read.js +17 -10
- package/dist/src/kernel/runtime/graphpack/read.js.map +1 -1
- package/dist/src/kernel/runtime/loadSession.js +3 -1
- package/dist/src/kernel/runtime/loadSession.js.map +1 -1
- package/dist/src/kernel/runtime/probe.js +1 -1
- package/dist/src/kernel/runtime/probe.js.map +1 -1
- package/dist/src/kernel/runtime/readEntity.js +19 -4
- package/dist/src/kernel/runtime/readEntity.js.map +1 -1
- package/dist/src/kernel/runtime/refs/parseRef.js +17 -1
- package/dist/src/kernel/runtime/refs/parseRef.js.map +1 -1
- package/dist/src/kernel/runtime/refs/resolve.js +38 -5
- package/dist/src/kernel/runtime/refs/resolve.js.map +1 -1
- package/dist/src/kernel/spec/emitReference.js +1 -1
- package/dist/src/kernel/spec/emitReference.js.map +1 -1
- package/package.json +23 -20
- package/pragma.conf.ts +983 -40
- package/src/capabilities/block.parity.test.ts +207 -27
- package/src/capabilities/block.shipped.exec.test.ts +156 -14
- package/src/capabilities/block.tierRank.exec.test.ts +46 -9
- package/src/capabilities/capabilities/catalog.ts +14 -5
- package/src/capabilities/capabilities/hints.ts +40 -5
- package/src/capabilities/config/collectConfigShow.test.ts +1 -0
- package/src/capabilities/config/set.test.ts +24 -25
- package/src/capabilities/config/show.render.test.ts +9 -4
- package/src/capabilities/config/show.render.ts +30 -2
- package/src/capabilities/create/byteEquality.test.ts +28 -1
- package/src/capabilities/create/create.test.ts +1 -0
- package/src/capabilities/create/create.verb.ts +2 -1
- package/src/capabilities/create/createGrammar.test.ts +4 -1
- package/src/capabilities/create/createSurface.generated.ts +23 -1
- package/src/capabilities/create/crossCli.subprocess.test.ts +10 -3
- package/src/capabilities/distribution.parity.test.ts +12 -11
- package/src/capabilities/distribution.test.ts +77 -7
- package/src/capabilities/doctor/checks/checkNodeVersion.test.ts +49 -0
- package/src/capabilities/doctor/checks/checkNodeVersion.ts +11 -7
- package/src/capabilities/doctor/checks/harnessInventory.test.ts +13 -6
- package/src/capabilities/doctor/checks/harnessInventory.ts +8 -4
- package/src/capabilities/doctor/checks/isSupportedNodeVersion.test.ts +111 -0
- package/src/capabilities/doctor/checks/isSupportedNodeVersion.ts +34 -0
- package/src/capabilities/doctor/checks/mcpCommand.test.ts +7 -1
- package/src/capabilities/doctor/checks/targetHealth.ts +114 -13
- package/src/capabilities/doctor/doctor.test.ts +327 -36
- package/src/capabilities/emptyRecovery.test.ts +84 -28
- package/src/capabilities/graph/connect.render.ts +141 -0
- package/src/capabilities/graph/connect.shipped.exec.test.ts +370 -0
- package/src/capabilities/graph/connect.test.ts +361 -0
- package/src/capabilities/graph/connect.types.ts +136 -0
- package/src/capabilities/graph/connect.verb.ts +165 -0
- package/src/capabilities/graph/index.ts +5 -3
- package/src/capabilities/graph/query.shipped.exec.test.ts +66 -0
- package/src/capabilities/graph/query.test.ts +17 -0
- package/src/capabilities/graph/queryText.test.ts +121 -0
- package/src/capabilities/graph/queryText.ts +240 -0
- package/src/capabilities/graph/relationIndex.ts +372 -0
- package/src/capabilities/graph/runConnect.ts +577 -0
- package/src/capabilities/graph/runQuery.ts +21 -6
- package/src/capabilities/lazy.test.ts +32 -2
- package/src/capabilities/listBudget.shipped.exec.test.ts +239 -0
- package/src/capabilities/listLookup.shipped.exec.test.ts +387 -0
- package/src/capabilities/listQuery.shipped.exec.test.ts +400 -0
- package/src/capabilities/resources/resources.test.ts +38 -2
- package/src/capabilities/setup/buildPlan.ts +7 -1
- package/src/capabilities/setup/operations/index.ts +14 -0
- package/src/capabilities/setup/operations/setupCompletions.ts +9 -2
- package/src/capabilities/setup/operations/setupConfig.ts +7 -2
- package/src/capabilities/setup/operations/setupGenerator.ts +93 -15
- package/src/capabilities/setup/operations/setupLsp.ts +544 -85
- package/src/capabilities/setup/operations/setupMcp.ts +212 -4
- package/src/capabilities/setup/operations/setupSkills.ts +7 -2
- package/src/capabilities/setup/operations/writability.test.ts +151 -0
- package/src/capabilities/setup/operations/writability.ts +135 -0
- package/src/capabilities/setup/plan.ts +11 -0
- package/src/capabilities/setup/setup.test.ts +992 -16
- package/src/capabilities/setup/setup.verb.ts +84 -36
- package/src/capabilities/setup/targets.ts +152 -48
- package/src/capabilities/setup/types.ts +41 -5
- package/src/capabilities/shared/index.ts +1 -0
- package/src/capabilities/sources/sources.test.ts +55 -0
- package/src/capabilities/surface.test.ts +59 -11
- package/src/capabilities/tier.parity.test.ts +2 -2
- package/src/capabilities/token.parity.test.ts +784 -0
- package/src/capabilities/tokenGraph.cli.test.ts +279 -0
- package/src/capabilities/tokenGraph.shipped.exec.test.ts +653 -0
- package/src/capabilities/variable.parity.test.ts +448 -0
- package/src/constants.ts +8 -0
- package/src/kernel/completion/shellDrive.test.ts +32 -30
- package/src/kernel/config/defaults.test.ts +21 -2
- package/src/kernel/config/readConfig.test.ts +1 -1
- package/src/kernel/error/renderError.ts +3 -2
- package/src/kernel/error/validOptions.test.ts +57 -0
- package/src/kernel/error/validOptions.ts +45 -0
- package/src/kernel/packs/collect.test.ts +2 -0
- package/src/kernel/packs/compile.test.ts +188 -15
- package/src/kernel/packs/compile.ts +109 -14
- package/src/kernel/packs/cursor.ts +135 -0
- package/src/kernel/packs/filteredEmpty.test.ts +213 -0
- package/src/kernel/packs/graphql/buildLookupDocument.ts +16 -9
- package/src/kernel/packs/graphqlSource.test.ts +152 -0
- package/src/kernel/packs/listNotice.test.ts +156 -0
- package/src/kernel/packs/paging.ts +110 -0
- package/src/kernel/packs/renderPack.ts +186 -13
- package/src/kernel/packs/resolveEntity.test.ts +62 -3
- package/src/kernel/packs/resolveEntity.ts +186 -26
- package/src/kernel/packs/runBodies.ts +196 -26
- package/src/kernel/packs/schema.ts +180 -13
- package/src/kernel/packs/sparql/authorQuery.test.ts +179 -0
- package/src/kernel/packs/sparql/authorQuery.ts +257 -0
- package/src/kernel/packs/sparql/buildListQuery.test.ts +344 -0
- package/src/kernel/packs/sparql/buildListQuery.ts +344 -0
- package/src/kernel/packs/sparql/buildLookupQuery.test.ts +138 -0
- package/src/kernel/packs/sparql/buildLookupQuery.ts +140 -20
- package/src/kernel/packs/sparql/filterValues.test.ts +86 -0
- package/src/kernel/packs/sparql/filterValues.ts +182 -0
- package/src/kernel/packs/sparql/index.ts +30 -14
- package/src/kernel/packs/sparql/runSelect.test.ts +63 -0
- package/src/kernel/packs/sparql/runSelect.ts +42 -2
- package/src/kernel/packs/sparql/searchTerm.ts +29 -0
- package/src/kernel/packs/storyRules.ts +180 -0
- package/src/kernel/packs/tierScope.test.ts +487 -0
- package/src/kernel/packs/tierScope.ts +409 -0
- package/src/kernel/packs/toolDescription.test.ts +13 -10
- package/src/kernel/packs/types.ts +311 -9
- package/src/kernel/project/cli/buildProgram.ts +17 -1
- package/src/kernel/project/cli/dispatch.test.ts +87 -0
- package/src/kernel/project/cli/dispatch.ts +114 -4
- package/src/kernel/project/cli/rootHelp.ts +8 -5
- package/src/kernel/project/cli/suggest.test.ts +35 -0
- package/src/kernel/project/cli/suggestNames.ts +34 -7
- package/src/kernel/project/mcp/registerVerb.ts +5 -1
- package/src/kernel/render/contracts.ts +2 -0
- package/src/kernel/render/prefixes.test.ts +2 -0
- package/src/kernel/render/renderers.test.ts +43 -0
- package/src/kernel/render/renderers.ts +34 -1
- package/src/kernel/runtime/graphpack/embedded/pack.generated.ts +2 -3
- package/src/kernel/runtime/graphpack/embedded/pack.index.generated.ts +1 -1
- package/src/kernel/runtime/graphpack/embedded/pack.manifest.generated.ts +3 -0
- package/src/kernel/runtime/graphpack/embedded.ts +14 -6
- package/src/kernel/runtime/graphpack/graphpack.test.ts +31 -5
- package/src/kernel/runtime/graphpack/read.ts +17 -13
- package/src/kernel/runtime/loadSession.ts +3 -1
- package/src/kernel/runtime/probe.ts +1 -1
- package/src/kernel/runtime/readEntity.ts +19 -4
- package/src/kernel/runtime/refs/parseRef.test.ts +49 -1
- package/src/kernel/runtime/refs/parseRef.ts +25 -1
- package/src/kernel/runtime/refs/resolve.ts +39 -5
- package/src/kernel/runtime/types.ts +30 -0
- package/src/kernel/spec/emitReference.ts +1 -1
- package/src/kernel/spec/surfaceConformance.test.ts +2 -2
- package/src/kernel/spec/types.ts +17 -0
- package/src/testing/PARITY_GAPS.ts +4 -4
- package/src/testing/behavioral/agentSession.mcp.test.ts +43 -39
- package/src/testing/behavioral/completion.test.ts +7 -6
- package/src/testing/behavioral/disclosure.test.ts +39 -37
- package/src/testing/behavioral/errorMatrix.mcp.test.ts +82 -64
- package/src/testing/behavioral/errorMatrix.storeless.test.ts +11 -10
- package/src/testing/behavioral/journeys.cli.test.ts +71 -32
- package/src/testing/behavioral/journeys.defaultPack.test.ts +6 -4
- package/src/testing/behavioral/journeys.firstInstall.test.ts +70 -5
- package/src/testing/behavioral/journeys.mcpLifecycle.mcp.test.ts +4 -3
- package/src/testing/behavioral/journeys.packageStories.test.ts +2 -1
- package/src/testing/behavioral/mcpSurface.test.ts +28 -25
- package/src/testing/behavioral/parity.test.ts +25 -23
- package/src/testing/eval/__snapshots__/eval.test.ts.snap +20 -0
- package/src/testing/eval/cases/effectful.ts +7 -1
- package/src/testing/eval/cases/readNouns.ts +100 -11
- package/src/testing/fixtures/blockGraph.ts +89 -5
- package/src/testing/fixtures/connectGraph.ts +159 -0
- package/src/testing/fixtures/graph/canonical.ts +128 -32
- package/src/testing/helpers/fsProbe.ts +88 -0
- package/src/testing/helpers/runCli.test.ts +44 -0
- package/src/testing/helpers/runCli.ts +27 -3
- package/src/testing/perf/budgets.test.ts +3 -1
- package/src/testing/perf/budgets.ts +138 -54
- package/dist/src/kernel/packs/sparql/applyFilters.js +0 -167
- package/dist/src/kernel/packs/sparql/applyFilters.js.map +0 -1
- package/dist/src/kernel/packs/sparql/applySearch.js +0 -25
- package/dist/src/kernel/packs/sparql/applySearch.js.map +0 -1
- package/src/kernel/packs/sparql/applyFilters.ts +0 -203
- package/src/kernel/packs/sparql/applySearch.ts +0 -33
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The declaration rules a list story must satisfy to be COMPILABLE, checked
|
|
3
|
+
* without zod so that every story is held to them — including the
|
|
4
|
+
* distribution's own.
|
|
5
|
+
*
|
|
6
|
+
* WHY NOT IN THE GRAMMAR. `schema.ts` is the zod gate, and it runs for config-
|
|
7
|
+
* and package-declared stories only: `capabilities/distribution.ts` compiles
|
|
8
|
+
* `pragma.conf.ts` statically and never revalidates it, deliberately, because
|
|
9
|
+
* zod on the `--help`/`__complete` fast path is latency every invocation pays.
|
|
10
|
+
* The consequence was that three rules whose violation is a CONFIG_ERROR — a
|
|
11
|
+
* query a page cannot wrap, a filtered variable the query does not project, a
|
|
12
|
+
* filter with nothing to admit a value against — were declaration-time refusals
|
|
13
|
+
* for a third-party author and FIRST-CALL failures for the distribution. The
|
|
14
|
+
* same rule reaching one tier and missing the other is the shape this domain
|
|
15
|
+
* keeps closing (see `compileStoryModule`), so the rules live here, in pure
|
|
16
|
+
* string work the fast path can afford, and the grammar delegates to them
|
|
17
|
+
* rather than restating them.
|
|
18
|
+
*
|
|
19
|
+
* These are the COMPILABILITY rules only. Everything about a definition's
|
|
20
|
+
* SHAPE — required fields, enums, mutual exclusions, reserved param names —
|
|
21
|
+
* stays in the zod schema, which is where a shape is best expressed and which
|
|
22
|
+
* a statically typed `pragma.conf.ts` already satisfies by construction.
|
|
23
|
+
*/
|
|
24
|
+
import { readAuthorQuery } from "./sparql/authorQuery.js";
|
|
25
|
+
import { ENTITY_VARIABLE, RESERVED_VARIABLE_PREFIX, TIER_PARAM, } from "./types.js";
|
|
26
|
+
/** The message a filter declaring neither `values` nor a `vocabulary` gets. */
|
|
27
|
+
const FILTER_VOCABULARY_MESSAGE = 'a filter must declare "values" or a "vocabulary" query — a value-free filter with neither has nothing to check a caller\'s value against';
|
|
28
|
+
/**
|
|
29
|
+
* Every compilability rule one list-shaped body breaks.
|
|
30
|
+
*
|
|
31
|
+
* @param shape - A `list` or an extra list-shaped verb.
|
|
32
|
+
* @param path - Where that body sits in the definition, for the issue paths.
|
|
33
|
+
* @returns The issues: each filter's own rule first, at its own `filters.N`
|
|
34
|
+
* path, then the query's. A caller reporting only the first (zod, and
|
|
35
|
+
* `compileStoryModule`) therefore names the most local fault it can, and the
|
|
36
|
+
* query rules stop at the first one that makes the rest unjudgeable — a
|
|
37
|
+
* projection cannot be checked against a query the reader could not read.
|
|
38
|
+
*/
|
|
39
|
+
export function listShapeIssues(shape, path) {
|
|
40
|
+
const issues = [];
|
|
41
|
+
for (const [index, filter] of (shape.filters ?? []).entries()) {
|
|
42
|
+
if (filter.values === undefined && filter.vocabulary === undefined) {
|
|
43
|
+
issues.push({
|
|
44
|
+
path: [...path, "filters", index],
|
|
45
|
+
message: FILTER_VOCABULARY_MESSAGE,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const constrained = [
|
|
50
|
+
...(shape.filters ?? []).map((filter) => filter.variable),
|
|
51
|
+
...(shape.search?.variables ?? []),
|
|
52
|
+
];
|
|
53
|
+
const read = readAuthorQuery(shape.query);
|
|
54
|
+
if (!read.ok) {
|
|
55
|
+
issues.push({
|
|
56
|
+
path: [...path, "query"],
|
|
57
|
+
message: `a list query must be wrappable in a page, and ${read.reason} — every list answer is one page, and a page is a wrapping SELECT over the story's own query.`,
|
|
58
|
+
});
|
|
59
|
+
return issues;
|
|
60
|
+
}
|
|
61
|
+
if (constrained.length === 0)
|
|
62
|
+
return issues;
|
|
63
|
+
if (shape.query.includes(RESERVED_VARIABLE_PREFIX)) {
|
|
64
|
+
issues.push({
|
|
65
|
+
path: [...path, "query"],
|
|
66
|
+
message: `a filtered or searched list query may not use the reserved variable prefix "?${RESERVED_VARIABLE_PREFIX}", which the generated filter clauses bind a caller's values to. Rename it.`,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const projection = read.query.projection;
|
|
70
|
+
if (!projection) {
|
|
71
|
+
issues.push({
|
|
72
|
+
path: [...path, "query"],
|
|
73
|
+
message: "a list declaring filters or a search must project its SELECT variables by name — the page projects the same names in the same order, which `SELECT *` cannot promise.",
|
|
74
|
+
});
|
|
75
|
+
return issues;
|
|
76
|
+
}
|
|
77
|
+
for (const variable of constrained) {
|
|
78
|
+
if (!projection.includes(variable)) {
|
|
79
|
+
issues.push({
|
|
80
|
+
path: [...path, "query"],
|
|
81
|
+
message: `"${variable}" is filtered or searched but not projected by the query (it selects ${projection.join(", ")}).`,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return issues;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Every compilability rule a whole definition breaks, `list` and extra verbs
|
|
89
|
+
* alike.
|
|
90
|
+
*
|
|
91
|
+
* @param definition - The definition about to be compiled.
|
|
92
|
+
* @returns The issues, empty when it compiles.
|
|
93
|
+
*/
|
|
94
|
+
export function storyIssues(definition) {
|
|
95
|
+
const issues = [];
|
|
96
|
+
if (definition.list) {
|
|
97
|
+
issues.push(...listShapeIssues(definition.list, ["list"]));
|
|
98
|
+
issues.push(...tierScopeIssues(definition.tierScope, definition.list, ["list"]));
|
|
99
|
+
}
|
|
100
|
+
for (const [index, verb] of (definition.verbs ?? []).entries()) {
|
|
101
|
+
issues.push(...listShapeIssues(verb, ["verbs", index]));
|
|
102
|
+
issues.push(...tierScopeIssues(definition.tierScope, verb, ["verbs", index]));
|
|
103
|
+
}
|
|
104
|
+
return issues;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The two rules a TIER-SCOPED noun's list-shaped body must satisfy.
|
|
108
|
+
*
|
|
109
|
+
* Both are the same kind of fault — a declaration that would compile and then
|
|
110
|
+
* scope nothing, silently:
|
|
111
|
+
*
|
|
112
|
+
* - It must PROJECT its entity variable. The scope clause constrains that
|
|
113
|
+
* variable through the noun's declared `via` edge, so a body that publishes
|
|
114
|
+
* rows without it (`standard categories` projects a name and a count) is a
|
|
115
|
+
* body the scope cannot narrow. Refusing it here is the difference between a
|
|
116
|
+
* declaration error an author reads once and a list that quietly answers
|
|
117
|
+
* from every tier while its heading claims a scope.
|
|
118
|
+
* - Its own filters may not claim the `tier` param, which the kernel puts on
|
|
119
|
+
* every tiered noun's reads. A story filter of that name would collide with
|
|
120
|
+
* the flag Commander has already registered — the failure mode
|
|
121
|
+
* {@link RESERVED_STORY_PARAMS} exists to prevent, conditional here because
|
|
122
|
+
* an UNSCOPED noun's `tier` filter is legitimate (`variable list --tier`
|
|
123
|
+
* filters the token graph's own `dt:tier`, which this scope does not touch).
|
|
124
|
+
*/
|
|
125
|
+
export function tierScopeIssues(tierScope, shape, path) {
|
|
126
|
+
if (!tierScope)
|
|
127
|
+
return [];
|
|
128
|
+
const issues = [];
|
|
129
|
+
for (const [index, filter] of (shape.filters ?? []).entries()) {
|
|
130
|
+
if (filter.param === TIER_PARAM) {
|
|
131
|
+
issues.push({
|
|
132
|
+
path: [...path, "filters", index],
|
|
133
|
+
message: `a tier-scoped story may not declare a "${TIER_PARAM}" filter — the kernel puts that parameter on every tiered noun's reads, and the two would collide`,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const read = readAuthorQuery(shape.query);
|
|
138
|
+
// An unreadable query is already reported by `listShapeIssues`, and the
|
|
139
|
+
// projection cannot be judged against a query nobody could read.
|
|
140
|
+
if (!read.ok)
|
|
141
|
+
return issues;
|
|
142
|
+
const projection = read.query.projection;
|
|
143
|
+
if (projection !== undefined && !projection.includes(ENTITY_VARIABLE)) {
|
|
144
|
+
issues.push({
|
|
145
|
+
path: [...path, "query"],
|
|
146
|
+
message: `a tier-scoped story must project ?${ENTITY_VARIABLE} — the tier scope is compiled in as a constraint on that variable (it selects ${projection.join(", ")}).`,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return issues;
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=storyRules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storyRules.js","sourceRoot":"","sources":["../../../../src/kernel/packs/storyRules.ts"],"names":[],"mappings":"AAAA;;;;;;;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C;IACzC,IAAI,UAAU,KAAK,SAAS,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;QACtE,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC;YACxB,OAAO,EAAE,qCAAqC,eAAe,iFAAiF,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;SACxK,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tier scope: which tiers a read of a tiered noun answers from.
|
|
3
|
+
*
|
|
4
|
+
* WHAT IT IS FOR. The design system's tier hierarchy has two levels — five
|
|
5
|
+
* top-level tiers (`global`, `apps`, `sites`, `documentation`, `stores`) and
|
|
6
|
+
* ten second-level ones beneath `apps` and `sites` — and every read used to
|
|
7
|
+
* answer from all fifteen at once. `block list` printed 252 blocks, a third of
|
|
8
|
+
* them belonging to one product's own screens; `block lookup button` printed
|
|
9
|
+
* the global Button AND Launchpad's, concatenated, with nothing saying why
|
|
10
|
+
* there were two. The `tier` config key that was supposed to narrow this was
|
|
11
|
+
* read by nothing. So a read of a tiered noun now has a SCOPE, and the scope is
|
|
12
|
+
* part of the query rather than a predicate over what the query returned.
|
|
13
|
+
*
|
|
14
|
+
* THE RULE, in one place:
|
|
15
|
+
*
|
|
16
|
+
* - DEFAULT — the top-level tiers. A tier is top-level when its path-shaped
|
|
17
|
+
* name has no `/` (see {@link PackTierScope.by}): nothing sits above it.
|
|
18
|
+
* - A CHOSEN tier (`--tier apps_lxd`, or `tier: "apps_lxd"` in config) — that
|
|
19
|
+
* tier, its ancestors, and the declared base tier. `apps_lxd` therefore
|
|
20
|
+
* answers from `global`, `apps` and `apps_lxd`: the blocks an LXD screen is
|
|
21
|
+
* actually built from, which is the chain the design system's own colophon
|
|
22
|
+
* describes ("a lower tier inherits and overrides the blocks of its
|
|
23
|
+
* ancestors").
|
|
24
|
+
* - `all` — no scope at all, the pre-scope behaviour, reachable per call
|
|
25
|
+
* (`--tier all`) or as a setting (`tier: "all"`).
|
|
26
|
+
*
|
|
27
|
+
* PRECEDENCE is the one every other per-call argument has: the flag beats the
|
|
28
|
+
* config, the config beats the default. A per-call `--tier` is not a second
|
|
29
|
+
* narrowing on top of a configured one — it REPLACES it, because a chain is not
|
|
30
|
+
* an intersection of chains and an agent that passes `--tier apps_lxd` on a
|
|
31
|
+
* machine configured to `apps_launchpad` means the first.
|
|
32
|
+
*
|
|
33
|
+
* THE HIERARCHY IS READ FROM THE STORE, ONCE. Nothing here enumerates a tier:
|
|
34
|
+
* the tiers, their names and therefore their parents are read from the pack the
|
|
35
|
+
* session booted, so a tier added upstream tomorrow is scoped correctly with no
|
|
36
|
+
* edit here. The read is memoized per store SESSION (not per process): a
|
|
37
|
+
* `sources update` on the long-lived MCP server invalidates the session, and the
|
|
38
|
+
* next read re-learns the hierarchy from the pack that replaced it.
|
|
39
|
+
*/
|
|
40
|
+
import { cliRecovery, PragmaError } from "../error/index.js";
|
|
41
|
+
import { formatTerm } from "./sparql/escape.js";
|
|
42
|
+
import { runSelect } from "./sparql/runSelect.js";
|
|
43
|
+
import { EVERY_TIER } from "./types.js";
|
|
44
|
+
/**
|
|
45
|
+
* Every tier read once per store session, per declaration.
|
|
46
|
+
*
|
|
47
|
+
* Keyed on the SESSION so the memo cannot outlive the pack it describes, and
|
|
48
|
+
* nested by declaration so the three nouns that declare the same hierarchy
|
|
49
|
+
* (`block`, `modifier`, `concept`) share ONE query rather than issuing three
|
|
50
|
+
* identical ones per invocation. A `WeakMap` because the session is the owner:
|
|
51
|
+
* when the runtime drops it, this drops with it.
|
|
52
|
+
*/
|
|
53
|
+
const SESSIONS = new WeakMap();
|
|
54
|
+
/** The SELECT reading every tier and its path-shaped name. */
|
|
55
|
+
function hierarchyQuery(declaration) {
|
|
56
|
+
return [
|
|
57
|
+
"SELECT ?tier ?name WHERE {",
|
|
58
|
+
` ?tier a ${formatTerm(declaration.type)} .`,
|
|
59
|
+
` ?tier ${formatTerm(declaration.by)} ?name .`,
|
|
60
|
+
"}",
|
|
61
|
+
"ORDER BY ?name",
|
|
62
|
+
].join("\n");
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Read (once per session) the tier hierarchy a declaration describes.
|
|
66
|
+
*
|
|
67
|
+
* @param rt - The runtime, for the store and the query facade.
|
|
68
|
+
* @param declaration - The noun's declared tier hierarchy.
|
|
69
|
+
* @param source - The story's provenance, for a query diagnosis.
|
|
70
|
+
* @returns The hierarchy, memoized for this store session.
|
|
71
|
+
*/
|
|
72
|
+
export async function readTierHierarchy(rt, declaration, source) {
|
|
73
|
+
const session = await rt.store.get();
|
|
74
|
+
const key = [
|
|
75
|
+
declaration.type,
|
|
76
|
+
declaration.via,
|
|
77
|
+
declaration.by,
|
|
78
|
+
declaration.base ?? "",
|
|
79
|
+
].join("|");
|
|
80
|
+
let perDeclaration = SESSIONS.get(session);
|
|
81
|
+
if (!perDeclaration) {
|
|
82
|
+
perDeclaration = new Map();
|
|
83
|
+
SESSIONS.set(session, perDeclaration);
|
|
84
|
+
}
|
|
85
|
+
const memoized = perDeclaration.get(key);
|
|
86
|
+
if (memoized)
|
|
87
|
+
return memoized;
|
|
88
|
+
const reading = runSelect(rt, hierarchyQuery(declaration), source).then((rows) => buildTierHierarchy(rows.map((row) => ({ iri: row.tier ?? "", name: row.name ?? "" })), declaration));
|
|
89
|
+
perDeclaration.set(key, reading);
|
|
90
|
+
return reading;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The local name of a term: everything after its last `#`, `/` or `:`.
|
|
94
|
+
*
|
|
95
|
+
* The `:` is what makes one function serve both spellings a term arrives in. A
|
|
96
|
+
* tier read out of the store is an absolute IRI
|
|
97
|
+
* (`https://ds.canonical.com/global`), and the declared `base` beside it is a
|
|
98
|
+
* PREFIXED name (`ds:global`) — the grammar admits either, everywhere. Reading
|
|
99
|
+
* only `#` and `/` left `ds:global` as its own local name, so the base tier
|
|
100
|
+
* matched nothing and the base-first reporting order silently became
|
|
101
|
+
* alphabetical.
|
|
102
|
+
*/
|
|
103
|
+
export function localName(term) {
|
|
104
|
+
return term.replace(/^.*[#/:]/, "");
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Every spelling of a tier a caller may type.
|
|
108
|
+
*
|
|
109
|
+
* Three, because three are in circulation and all of them are the reader's own
|
|
110
|
+
* words: the local name the `Tier` column prints (`apps_lxd`), the display name
|
|
111
|
+
* `tier list` prints (`Apps/LXD`), and that display name with its separator
|
|
112
|
+
* written the way the IRI writes it (`apps/lxd` — the spelling the config key's
|
|
113
|
+
* own documentation used before anything read it). Refusing two of the three
|
|
114
|
+
* would be refusing a value this distribution itself published.
|
|
115
|
+
*/
|
|
116
|
+
function spellings(tier) {
|
|
117
|
+
return [
|
|
118
|
+
tier.local.toLowerCase(),
|
|
119
|
+
tier.name.toLowerCase(),
|
|
120
|
+
tier.name.toLowerCase().replaceAll("/", "_"),
|
|
121
|
+
];
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Build the hierarchy from the rows the store returned.
|
|
125
|
+
*
|
|
126
|
+
* Exported for the unit tests, which state the hierarchy rules over a handful
|
|
127
|
+
* of rows rather than over the shipped pack's fifteen tiers.
|
|
128
|
+
*
|
|
129
|
+
* @param rows - One `{ iri, name }` per tier.
|
|
130
|
+
* @param declaration - The noun's declared tier hierarchy.
|
|
131
|
+
* @returns The hierarchy, with tiers carrying an empty IRI or name dropped —
|
|
132
|
+
* a tier the scope cannot address or place is not a tier it can scope by.
|
|
133
|
+
*/
|
|
134
|
+
export function buildTierHierarchy(rows, declaration) {
|
|
135
|
+
const tiers = [];
|
|
136
|
+
for (const row of rows) {
|
|
137
|
+
if (row.iri === "" || row.name === "")
|
|
138
|
+
continue;
|
|
139
|
+
tiers.push({
|
|
140
|
+
iri: row.iri,
|
|
141
|
+
name: row.name,
|
|
142
|
+
local: localName(row.iri),
|
|
143
|
+
depth: row.name.split("/").length,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
const bySpelling = new Map();
|
|
147
|
+
for (const tier of tiers) {
|
|
148
|
+
for (const spelling of spellings(tier)) {
|
|
149
|
+
if (!bySpelling.has(spelling))
|
|
150
|
+
bySpelling.set(spelling, tier);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const declaredBase = declaration.base;
|
|
154
|
+
const base = declaredBase === undefined
|
|
155
|
+
? undefined
|
|
156
|
+
: tiers.find((tier) => tier.iri === declaredBase ||
|
|
157
|
+
tier.local.toLowerCase() === localName(declaredBase).toLowerCase());
|
|
158
|
+
return { tiers, bySpelling, ...(base ? { base } : {}) };
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The reporting order: the base tier first, then shallowest first, then
|
|
162
|
+
* alphabetical.
|
|
163
|
+
*
|
|
164
|
+
* The base leads because it is what the rest inherit from, and the chain then
|
|
165
|
+
* reads root-to-leaf (`global, apps, apps_lxd`) — the direction the hierarchy
|
|
166
|
+
* is written in everywhere else in this distribution.
|
|
167
|
+
*/
|
|
168
|
+
function orderTiers(tiers, base) {
|
|
169
|
+
return [...tiers].sort((left, right) => {
|
|
170
|
+
if (left.iri === right.iri)
|
|
171
|
+
return 0;
|
|
172
|
+
if (base) {
|
|
173
|
+
if (left.iri === base.iri)
|
|
174
|
+
return -1;
|
|
175
|
+
if (right.iri === base.iri)
|
|
176
|
+
return 1;
|
|
177
|
+
}
|
|
178
|
+
return (left.depth - right.depth ||
|
|
179
|
+
left.local.localeCompare(right.local) ||
|
|
180
|
+
left.iri.localeCompare(right.iri));
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
/** The tiers whose name states no parent — the default scope. */
|
|
184
|
+
function topLevel(hierarchy) {
|
|
185
|
+
return hierarchy.tiers.filter((tier) => tier.depth === 1);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* The chosen tier's chain: itself, every tier its name sits under, and the base.
|
|
189
|
+
*
|
|
190
|
+
* An ancestor is found by NAME, not by an edge, because the graph asserts no
|
|
191
|
+
* edge (see {@link PackTierScope}). A name segment naming no declared tier
|
|
192
|
+
* contributes nothing — an orphan `Apps/LXD` in a pack with no `Apps` is
|
|
193
|
+
* scoped to itself and the base, which is the honest reading of the only
|
|
194
|
+
* hierarchy it states.
|
|
195
|
+
*/
|
|
196
|
+
function chain(hierarchy, chosen) {
|
|
197
|
+
const segments = chosen.name.split("/");
|
|
198
|
+
const ancestorNames = new Set(segments.slice(0, -1).map((_, index) => segments
|
|
199
|
+
.slice(0, index + 1)
|
|
200
|
+
.join("/")
|
|
201
|
+
.toLowerCase()));
|
|
202
|
+
const selected = hierarchy.tiers.filter((tier) => tier.iri === chosen.iri ||
|
|
203
|
+
ancestorNames.has(tier.name.toLowerCase()) ||
|
|
204
|
+
(hierarchy.base !== undefined && tier.iri === hierarchy.base.iri));
|
|
205
|
+
return orderTiers(selected, hierarchy.base);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Resolve the scope one read answers under.
|
|
209
|
+
*
|
|
210
|
+
* @param hierarchy - The tiers the store knows.
|
|
211
|
+
* @param request - The per-call argument and the configured default.
|
|
212
|
+
* @returns Every tier (when asked for, or when the store knows no tiers), else
|
|
213
|
+
* the chosen tier's chain, else the top-level tiers.
|
|
214
|
+
* @throws PragmaError INVALID_INPUT when a tier was asked for by a name no tier
|
|
215
|
+
* answers to, carrying the names that do.
|
|
216
|
+
*/
|
|
217
|
+
export function resolveTierScope(hierarchy, request) {
|
|
218
|
+
// A graph with no tiers in it is not a narrowed graph: there is nothing to
|
|
219
|
+
// scope by, so the read answers as it always did and says nothing about a
|
|
220
|
+
// scope it never applied.
|
|
221
|
+
if (hierarchy.tiers.length === 0)
|
|
222
|
+
return { kind: "all" };
|
|
223
|
+
const perCall = readRequested(request.requested);
|
|
224
|
+
const asked = perCall ?? request.configured?.trim();
|
|
225
|
+
if (asked === undefined || asked === "") {
|
|
226
|
+
return {
|
|
227
|
+
kind: "tiers",
|
|
228
|
+
tiers: orderTiers(topLevel(hierarchy), hierarchy.base),
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
if (asked.toLowerCase() === EVERY_TIER)
|
|
232
|
+
return { kind: "all" };
|
|
233
|
+
const chosen = hierarchy.bySpelling.get(asked.toLowerCase());
|
|
234
|
+
if (!chosen) {
|
|
235
|
+
const validOptions = [
|
|
236
|
+
EVERY_TIER,
|
|
237
|
+
...hierarchy.tiers.map((tier) => tier.local).sort(),
|
|
238
|
+
];
|
|
239
|
+
// The recovery names WHERE the bad value came from, because the two places
|
|
240
|
+
// are fixed differently and only one of them is in the caller's hand: a
|
|
241
|
+
// per-call `--tier` is retyped, a configured one is unset. A reader whose
|
|
242
|
+
// machine is set to a tier this pack does not carry would otherwise be told
|
|
243
|
+
// to retype an argument they never typed.
|
|
244
|
+
throw PragmaError.invalidInput("tier", asked, {
|
|
245
|
+
validOptions,
|
|
246
|
+
recovery: perCall === undefined
|
|
247
|
+
? cliRecovery("config unset tier", `The \`tier\` config key names "${asked}", which is not one of this pack's ${hierarchy.tiers.length} tiers. Clear it, or set one that exists.`, { tool: "config_unset", params: { key: "tier" } })
|
|
248
|
+
: cliRecovery("tier list", `Name one of the ${hierarchy.tiers.length} tiers, or "${EVERY_TIER}" for every tier.`, { tool: "tier_list", params: {} }),
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
return { kind: "tiers", tiers: chain(hierarchy, chosen), chosen };
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* The per-call argument as a tier name.
|
|
255
|
+
*
|
|
256
|
+
* @throws PragmaError INVALID_INPUT when it is not a string — a repeated
|
|
257
|
+
* `--tier` is a caller asking for two chains at once, which is not a chain.
|
|
258
|
+
*/
|
|
259
|
+
function readRequested(provided) {
|
|
260
|
+
if (provided === undefined)
|
|
261
|
+
return undefined;
|
|
262
|
+
if (typeof provided === "string") {
|
|
263
|
+
const trimmed = provided.trim();
|
|
264
|
+
return trimmed === "" ? undefined : trimmed;
|
|
265
|
+
}
|
|
266
|
+
throw PragmaError.invalidInput("tier", String(provided), {
|
|
267
|
+
recovery: {
|
|
268
|
+
message: `Pass one tier name, or "${EVERY_TIER}" for every tier.`,
|
|
269
|
+
},
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* The scope one read of a tiered noun answers under, resolved from everything
|
|
274
|
+
* that has a say: the story's declaration, the caller's argument, the config.
|
|
275
|
+
*
|
|
276
|
+
* @param rt - The runtime (store for the hierarchy, config for the default).
|
|
277
|
+
* @param declaration - The noun's declared hierarchy, absent when it is not
|
|
278
|
+
* tiered — in which case there is no scope and nothing is read.
|
|
279
|
+
* @param requested - The per-call `--tier` argument, if any.
|
|
280
|
+
* @param source - The story's provenance, for a query diagnosis.
|
|
281
|
+
* @returns The scope, or `undefined` for an unscoped noun.
|
|
282
|
+
* @throws PragmaError INVALID_INPUT when the tier asked for does not exist.
|
|
283
|
+
*/
|
|
284
|
+
export async function resolveReadScope(rt, declaration, requested, source) {
|
|
285
|
+
if (!declaration)
|
|
286
|
+
return undefined;
|
|
287
|
+
const hierarchy = await readTierHierarchy(rt, declaration, source);
|
|
288
|
+
const { config } = await rt.loadConfig();
|
|
289
|
+
return resolveTierScope(hierarchy, {
|
|
290
|
+
requested,
|
|
291
|
+
...(config.tier === undefined ? {} : { configured: config.tier }),
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* The scope in the words a reader can type back: `global, apps, apps_lxd`.
|
|
296
|
+
*
|
|
297
|
+
* @param scope - The resolved scope.
|
|
298
|
+
* @returns The in-scope tier local names, or `undefined` for every tier — a
|
|
299
|
+
* read that narrowed nothing has no scope to report.
|
|
300
|
+
*/
|
|
301
|
+
export function scopeLabel(scope) {
|
|
302
|
+
if (scope.kind === "all")
|
|
303
|
+
return undefined;
|
|
304
|
+
return scope.tiers.map((tier) => tier.local).join(", ");
|
|
305
|
+
}
|
|
306
|
+
/** The in-scope tier IRIs, for the query filter. */
|
|
307
|
+
export function scopeIris(scope) {
|
|
308
|
+
return scope.kind === "all" ? [] : scope.tiers.map((tier) => tier.iri);
|
|
309
|
+
}
|
|
310
|
+
//# sourceMappingURL=tierScope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tierScope.js","sourceRoot":"","sources":["../../../../src/kernel/packs/tierScope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG7D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAwC,MAAM,YAAY,CAAC;AAuC9E;;;;;;;;GAQG;AACH,MAAM,QAAQ,GAAG,IAAI,OAAO,EAGzB,CAAC;AAEJ,8DAA8D;AAC9D,SAAS,cAAc,CAAC,WAA0B;IAChD,OAAO;QACL,4BAA4B;QAC5B,aAAa,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI;QAC7C,WAAW,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC,UAAU;QAC/C,GAAG;QACH,gBAAgB;KACjB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,EAAiB,EACjB,WAA0B,EAC1B,MAAmB;IAEnB,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;IACrC,MAAM,GAAG,GAAG;QACV,WAAW,CAAC,IAAI;QAChB,WAAW,CAAC,GAAG;QACf,WAAW,CAAC,EAAE;QACd,WAAW,CAAC,IAAI,IAAI,EAAE;KACvB,CAAC,I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@@
|
|
|
18
18
|
* is by that canonical index — a pack's declared `levels` is any ordered subset
|
|
19
19
|
* of the canonical set.
|
|
20
20
|
*/
|
|
21
|
+
/**
|
|
22
|
+
* The parameter names the KERNEL puts on a compiled verb, which a story's own
|
|
23
|
+
* filter may therefore not claim.
|
|
24
|
+
*
|
|
25
|
+
* `search` is a story's declared free-text flag; `detail` the disclosure
|
|
26
|
+
* selector; `name` and `count` a lookup's and a sample's positionals; `limit`
|
|
27
|
+
* and `after` the page every list-shaped verb carries. A filter claiming one
|
|
28
|
+
* would collide with a flag the CLI has already registered — a Commander
|
|
29
|
+
* failure outside every error envelope the CLI owns. Declared here, in the
|
|
30
|
+
* zod-free grammar, so the validator that refuses them and any reader that
|
|
31
|
+
* needs to tell a story's OWN params from the kernel's read one list.
|
|
32
|
+
*/
|
|
33
|
+
export const RESERVED_STORY_PARAMS = [
|
|
34
|
+
"search",
|
|
35
|
+
"detail",
|
|
36
|
+
"name",
|
|
37
|
+
"count",
|
|
38
|
+
"limit",
|
|
39
|
+
"after",
|
|
40
|
+
];
|
|
41
|
+
/**
|
|
42
|
+
* The SPARQL VARIABLE prefix the kernel reserves, which a story's own query may
|
|
43
|
+
* therefore not use.
|
|
44
|
+
*
|
|
45
|
+
* The generated filter and search clauses bind a caller's values to variables
|
|
46
|
+
* under this prefix (`?__pragmaFilter0`, `?__pragmaSearch`). A story query using
|
|
47
|
+
* it would have its own variable shadowed, and the symptom would be a filter
|
|
48
|
+
* matching nothing with nothing raised anywhere. Beside the reserved PARAMS for
|
|
49
|
+
* the same reason: the grammar that refuses it and the builder that mints it
|
|
50
|
+
* must read one name, and this file is the zod-free place both can reach — the
|
|
51
|
+
* builder lives behind the dynamically imported run bodies, so nothing on the
|
|
52
|
+
* `--help` fast path may import it.
|
|
53
|
+
*/
|
|
54
|
+
export const RESERVED_VARIABLE_PREFIX = "__pragma";
|
|
55
|
+
/**
|
|
56
|
+
* The `--tier` value that turns the tier scope OFF — every tier, the way every
|
|
57
|
+
* read answered before the scope existed.
|
|
58
|
+
*
|
|
59
|
+
* A word rather than a second flag (this distribution retired an `--all-tiers`
|
|
60
|
+
* once already): `--tier all` answers the same question the flag already asks,
|
|
61
|
+
* so there is one argument to learn and one to document.
|
|
62
|
+
*
|
|
63
|
+
* Declared HERE, in the zod-free grammar, for the reason
|
|
64
|
+
* {@link RESERVED_VARIABLE_PREFIX} is: the compiler that puts the flag on a
|
|
65
|
+
* verb runs on the storeless `--help` fast path, and the run body that reads it
|
|
66
|
+
* lives behind a dynamic import. Both must read one spelling.
|
|
67
|
+
*/
|
|
68
|
+
export const EVERY_TIER = "all";
|
|
69
|
+
/**
|
|
70
|
+
* The parameter name the kernel puts on a TIER-SCOPED noun's reads (`--tier`,
|
|
71
|
+
* `tier` over MCP).
|
|
72
|
+
*
|
|
73
|
+
* Not in {@link RESERVED_STORY_PARAMS}, because it is reserved CONDITIONALLY:
|
|
74
|
+
* an unscoped noun may still declare a `tier` filter of its own, and one does —
|
|
75
|
+
* `variable list --tier` filters the token graph's `dt:tier`, a different
|
|
76
|
+
* predicate in a different namespace from the `ds:tier` this scope reads. The
|
|
77
|
+
* rule that a SCOPED story may not claim it lives in {@link ./storyRules}.
|
|
78
|
+
*/
|
|
79
|
+
export const TIER_PARAM = "tier";
|
|
80
|
+
/**
|
|
81
|
+
* The SELECT variable a list-shaped story publishes its entity IRI in.
|
|
82
|
+
*
|
|
83
|
+
* A convention this package already depends on twice — the condensed renderer
|
|
84
|
+
* titles a row from `uri`/`name`, and every shipped list's IRI column is `uri`
|
|
85
|
+
* — stated here because the tier scope is compiled in as a constraint on that
|
|
86
|
+
* variable, and because both the storeless declaration rules and the query
|
|
87
|
+
* builder behind the dynamic import must read one spelling of it.
|
|
88
|
+
*/
|
|
89
|
+
export const ENTITY_VARIABLE = "uri";
|
|
21
90
|
/** Whether an expand-select entry is a nested expand (vs a plain field). */
|
|
22
91
|
export function isNestedExpand(entry) {
|
|
23
92
|
return "relation" in entry;
|
|
24
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Which lane resolves one expand: its own declared {@link PackExpand.source},
|
|
96
|
+
* else the lookup's, else SPARQL.
|
|
97
|
+
*
|
|
98
|
+
* Read by BOTH lanes — the GraphQL document generator skips what it does not
|
|
99
|
+
* own, and the entity fetcher runs it — so the question is answered in one
|
|
100
|
+
* place rather than asked twice with two spellings.
|
|
101
|
+
*/
|
|
102
|
+
export function expandIsSparql(lookup, expand) {
|
|
103
|
+
return (expand.source ?? lookup.source ?? "sparql") === "sparql";
|
|
104
|
+
}
|
|
25
105
|
/** A story the distribution itself declares (`pragma.conf.ts` and its kin). */
|
|
26
106
|
export const distributionSource = (label) => ({
|
|
27
107
|
label,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/kernel/packs/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/kernel/packs/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAsB;IACtD,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;CACR,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,UAAU,CAAC;AAEnD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC;AAEhC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AAgGrC,4EAA4E;AAC5E,MAAM,UAAU,cAAc,CAC5B,KAAuB;IAEvB,OAAO,UAAU,IAAI,KAAK,CAAC;AAC7B,CAAC;AAiFD;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAkC,EAClC,MAAkC;IAElC,OAAO,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,IAAI,QAAQ,CAAC,KAAK,QAAQ,CAAC;AACnE,CAAC;AAqgBD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAAe,EAAE,CAAC,CAAC;IACjE,KAAK;IACL,MAAM,EAAE,cAAc;CACvB,CAAC,CAAC"}
|
|
@@ -124,7 +124,16 @@ function attachVerb(parent, verb, name, programName, globalFlags) {
|
|
|
124
124
|
registerParams(command, verb);
|
|
125
125
|
command.action(async (...actionArgs) => {
|
|
126
126
|
const { positionals: positionalArgs, opts } = splitActionArgs(actionArgs);
|
|
127
|
-
|
|
127
|
+
// `command.args` is every operand this leaf received; the action arguments
|
|
128
|
+
// are only the DECLARED ones, so a verb that declares none is handed
|
|
129
|
+
// nothing and a stray word vanishes between the two. Dispatch reads the
|
|
130
|
+
// longer of the two lists and refuses what the verb cannot take
|
|
131
|
+
// (`dispatch.ts#refuseExcessPositionals`) — Commander's own excess check
|
|
132
|
+
// cannot: a sub-verb-only noun opts into excess operands to keep its
|
|
133
|
+
// "unknown command" suggestion, and `copyInheritedSettings` hands that
|
|
134
|
+
// opt-in down to every verb attached beneath it.
|
|
135
|
+
const operands = command.args.filter((arg) => typeof arg === "string");
|
|
136
|
+
await dispatch(verb, operands.length > positionalArgs.length ? operands : positionalArgs, opts, globalFlags);
|
|
128
137
|
});
|
|
129
138
|
}
|
|
130
139
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildProgram.js","sourceRoot":"","sources":["../../../../../src/kernel/project/cli/buildProgram.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EACL,QAAQ,EACR,UAAU,EAC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