@canonical/pragma-cli 0.33.0 → 0.34.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 +7 -7
- package/dist/pragma +0 -0
- package/package.json +18 -15
- package/pragma.conf.ts +664 -0
- package/src/bin.ts +13 -4
- package/src/capabilities/block.parity.test.ts +250 -0
- package/src/capabilities/capabilities/capabilities.render.ts +3 -2
- package/src/capabilities/capabilities/capabilities.verb.ts +31 -13
- package/src/capabilities/capabilities/catalog.ts +18 -10
- package/src/capabilities/capabilities/hints.ts +13 -19
- package/src/capabilities/colophon/collectColophon.ts +34 -19
- package/src/capabilities/colophon/colophon.verb.ts +8 -4
- package/src/capabilities/colophon/types.ts +16 -7
- package/src/capabilities/config/collectConfigShow.test.ts +57 -0
- package/src/capabilities/config/collectConfigShow.ts +41 -4
- package/src/capabilities/config/fields.ts +0 -27
- package/src/capabilities/config/set.verb.ts +7 -3
- package/src/capabilities/config/show.render.test.ts +77 -5
- package/src/capabilities/config/show.render.ts +7 -12
- package/src/capabilities/config/show.verb.ts +4 -3
- package/src/capabilities/config/types.ts +8 -0
- package/src/capabilities/create/byteEquality.test.ts +78 -100
- package/src/capabilities/create/compiledCreate.subprocess.test.ts +52 -15
- package/src/capabilities/create/constants.ts +75 -0
- package/src/capabilities/create/create.mcp.test.ts +2 -2
- package/src/capabilities/create/create.test.ts +162 -15
- package/src/capabilities/create/create.verb.ts +140 -69
- package/src/capabilities/create/index.ts +2 -10
- package/src/capabilities/create/pickGenerator.ts +34 -28
- package/src/capabilities/create/templates.embedded.generated.ts +4 -29
- package/src/capabilities/create/types.ts +10 -6
- package/src/capabilities/{standard/parity.test.ts → distribution.parity.test.ts} +24 -14
- package/src/capabilities/distribution.test.ts +120 -0
- package/src/capabilities/distribution.ts +59 -0
- package/src/capabilities/doctor/checks/checkConfigFile.ts +6 -5
- package/src/capabilities/doctor/checks/checkKeStore.ts +2 -2
- package/src/capabilities/doctor/checks/checkMcpConfigured.ts +7 -6
- package/src/capabilities/doctor/checks/checkPackageRefs.ts +79 -45
- package/src/capabilities/doctor/checks/checkPragmaVersion.ts +3 -2
- package/src/capabilities/doctor/checks/checkShellCompletions.test.ts +61 -11
- package/src/capabilities/doctor/checks/checkShellCompletions.ts +63 -23
- package/src/capabilities/doctor/checks/checkSkillsSymlinked.ts +3 -2
- package/src/capabilities/doctor/doctor.render.test.ts +6 -6
- package/src/capabilities/doctor/doctor.render.ts +2 -1
- package/src/capabilities/doctor/doctor.test.ts +37 -8
- package/src/capabilities/doctor/doctor.verb.ts +6 -2
- package/src/capabilities/doctor/runChecks.ts +5 -5
- package/src/capabilities/doctor/types.ts +1 -1
- package/src/capabilities/emptyRecovery.test.ts +32 -15
- package/src/capabilities/graph/inspect.verb.ts +3 -2
- package/src/capabilities/graph/query.verb.ts +3 -2
- package/src/capabilities/graph/runQuery.ts +8 -5
- package/src/capabilities/index.ts +22 -18
- package/src/capabilities/info/collectInfo.ts +10 -6
- package/src/capabilities/info/info.render.ts +3 -2
- package/src/capabilities/info/info.verb.ts +3 -2
- package/src/capabilities/lazy.test.ts +93 -2
- package/src/capabilities/ontology/verbs.ts +21 -21
- package/src/capabilities/prompt/prompt.test.ts +12 -6
- package/src/capabilities/prompt/verbs.ts +24 -11
- package/src/capabilities/resources/provider.ts +30 -11
- package/src/capabilities/resources/resources.test.ts +85 -29
- package/src/capabilities/setup/operations/setupGenerator.ts +16 -9
- package/src/capabilities/setup/operations/setupMcp.ts +2 -2
- package/src/capabilities/setup/operations/setupSkills.ts +3 -3
- package/src/capabilities/setup/setup.verb.ts +12 -5
- package/src/capabilities/setup/shell.ts +29 -3
- package/src/capabilities/skill/discover.ts +11 -5
- package/src/capabilities/skill/render.ts +4 -5
- package/src/capabilities/skill/verbs.ts +7 -7
- package/src/capabilities/sources/collectStatus.ts +55 -50
- package/src/capabilities/sources/index.ts +1 -1
- package/src/capabilities/sources/installSkills.ts +2 -2
- package/src/capabilities/sources/runUpdate.ts +113 -122
- package/src/capabilities/sources/sources.test.ts +111 -117
- package/src/capabilities/sources/status.render.test.ts +53 -24
- package/src/capabilities/sources/status.render.ts +24 -29
- package/src/capabilities/sources/status.verb.ts +15 -8
- package/src/capabilities/sources/types.ts +18 -25
- package/src/capabilities/sources/update.render.ts +9 -2
- package/src/capabilities/sources/update.verb.ts +12 -23
- package/src/capabilities/surface.test.ts +33 -10
- package/src/capabilities/tier.parity.test.ts +144 -0
- package/src/capabilities/upgrade/upgrade.verb.ts +7 -3
- package/src/constants.test.ts +8 -6
- package/src/constants.ts +47 -21
- package/src/identity.test.ts +333 -0
- package/src/index.ts +2 -2
- package/src/kernel/completion/__snapshots__/emitScripts.test.ts.snap +5 -2
- package/src/kernel/completion/emitScripts.test.ts +1 -1
- package/src/kernel/completion/emitScripts.ts +4 -2
- package/src/kernel/completion/entitySource.test.ts +185 -41
- package/src/kernel/completion/entitySource.ts +117 -107
- package/src/kernel/completion/model.test.ts +1 -1
- package/src/kernel/completion/model.ts +11 -0
- package/src/kernel/completion/safety.test.ts +82 -36
- package/src/kernel/completion/shellDrive.test.ts +592 -0
- package/src/kernel/completion/templates/fish.ts +28 -6
- package/src/kernel/completion/types.ts +3 -3
- package/src/kernel/config/__snapshots__/firstRun.test.ts.snap +1 -1
- package/src/kernel/config/defaults.test.ts +85 -0
- package/src/kernel/config/defaults.ts +12 -23
- package/src/kernel/config/evaluateProjectConfig.ts +2 -3
- package/src/kernel/config/findProjectConfig.ts +4 -3
- package/src/kernel/config/firstRun.ts +12 -5
- package/src/kernel/config/globalConfig.ts +2 -2
- package/src/kernel/config/index.ts +4 -5
- package/src/kernel/config/paths.ts +17 -17
- package/src/kernel/config/readConfig.test.ts +242 -6
- package/src/kernel/config/readConfig.ts +8 -8
- package/src/kernel/config/schema.test.ts +50 -0
- package/src/kernel/config/schema.ts +97 -10
- package/src/kernel/config/types.ts +73 -19
- package/src/kernel/copy.test.ts +453 -0
- package/src/kernel/error/PragmaError.test.ts +1 -1
- package/src/kernel/error/constants.ts +3 -2
- package/src/kernel/error/index.ts +1 -1
- package/src/kernel/error/recovery.test.ts +22 -45
- package/src/kernel/error/recovery.ts +22 -27
- package/src/kernel/error/types.ts +5 -4
- package/src/kernel/packs/collect.test.ts +195 -11
- package/src/kernel/packs/collect.ts +213 -58
- package/src/kernel/packs/compile.test.ts +163 -7
- package/src/kernel/packs/compile.ts +15 -12
- package/src/kernel/packs/disclosure.test.ts +5 -2
- package/src/kernel/packs/graphql/fetchGraphqlLookup.ts +11 -10
- package/src/kernel/packs/graphqlSource.test.ts +6 -3
- package/src/kernel/packs/iri.ts +5 -7
- package/src/kernel/packs/renderPack.ts +5 -3
- package/src/kernel/packs/resolveEntity.ts +21 -17
- package/src/kernel/packs/runBodies.ts +15 -14
- package/src/kernel/packs/schema.ts +96 -10
- package/src/kernel/packs/sparql/runSelect.test.ts +104 -10
- package/src/kernel/packs/sparql/runSelect.ts +73 -34
- package/src/kernel/packs/toolDescription.test.ts +10 -2
- package/src/kernel/packs/types.ts +39 -4
- package/src/kernel/packs/uniqueness.ts +4 -4
- package/src/kernel/project/cli/buildProgram.test.ts +9 -4
- package/src/kernel/project/cli/dispatch.test.ts +67 -0
- package/src/kernel/project/cli/dispatch.ts +34 -12
- package/src/kernel/project/cli/helpFormat.ts +1 -1
- package/src/kernel/project/cli/rootHelp.ts +105 -105
- package/src/kernel/project/mcp/buildServer.ts +11 -6
- package/src/kernel/project/mcp/instructions.ts +11 -6
- package/src/kernel/project/mcp/parity.test.ts +39 -1
- 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 +68 -67
- package/src/kernel/project/mcp/registerVerb.ts +25 -6
- package/src/kernel/project/mcp/serve.ts +11 -3
- package/src/kernel/project/mcp/toolDescriptions.test.ts +6 -2
- package/src/kernel/render/disclosure.ts +4 -2
- package/src/kernel/render/prefixes.test.ts +36 -0
- package/src/kernel/render/prefixes.ts +40 -13
- package/src/kernel/render/renderers.test.ts +1 -1
- 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 +52 -17
- 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 +37 -11
- 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 +4 -9
- 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/paths.ts +64 -15
- package/src/kernel/runtime/probe.test.ts +8 -4
- package/src/kernel/runtime/readEntity.ts +6 -5
- package/src/kernel/runtime/refs/gitOps.ts +1 -19
- package/src/kernel/runtime/refs/parseRef.ts +7 -7
- package/src/kernel/runtime/refs/resolve.ts +78 -62
- package/src/kernel/runtime/resolveSources.test.ts +63 -24
- package/src/kernel/runtime/resolveSources.ts +36 -25
- package/src/kernel/runtime/storeReadiness.ts +9 -8
- package/src/kernel/runtime/storeless.test.ts +1 -1
- package/src/kernel/runtime/wasmEmbed.test.ts +22 -19
- package/src/kernel/spec/emitReference.test.ts +3 -3
- package/src/kernel/spec/emitReference.ts +144 -11
- package/src/kernel/spec/emitSurface.ts +9 -5
- package/src/kernel/spec/surfaceConformance.test.ts +2 -2
- package/src/kernel/spec/surfaceConformance.ts +8 -0
- package/src/kernel/spec/types.ts +29 -9
- 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/errorMatrix.mcp.test.ts +4 -3
- package/src/testing/behavioral/errorMatrix.storeless.test.ts +1 -1
- package/src/testing/behavioral/exitCodes.e2e.test.ts +6 -5
- package/src/testing/behavioral/harness.foundation.test.ts +14 -5
- package/src/testing/behavioral/journeys.cli.test.ts +116 -75
- package/src/testing/behavioral/journeys.defaultPack.test.ts +82 -176
- package/src/testing/behavioral/journeys.firstInstall.test.ts +167 -0
- 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/mcpSurface.test.ts +9 -4
- 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 +25 -13
- 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/fixtureCapability.ts +45 -1
- package/src/testing/fixtures/graph/canonical.ts +6 -3
- package/src/testing/fixtures/graph/defaultPack.ts +6 -5
- package/src/testing/fixtures/graph/owlExport.ts +7 -5
- 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 +6 -0
- package/src/testing/perf/budgets.test.ts +4 -0
- package/src/testing/perf/budgets.ts +22 -7
- package/src/testing/perf/globalSetup.ts +121 -6
- package/src/types.ts +2 -2
- 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/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/runtime/graphpack/embedded/sample.ttl +0 -39
- package/src/kernel/runtime/lock.ts +0 -90
package/pragma.conf.ts
ADDED
|
@@ -0,0 +1,664 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pragma distribution config — identity, default packs, and the read
|
|
3
|
+
* stories those packs supply.
|
|
4
|
+
*
|
|
5
|
+
* Consumed three times: statically imported by `src/kernel/config/defaults.ts`
|
|
6
|
+
* as the lowest config layer (compiled into the binary — no fs), by
|
|
7
|
+
* `src/capabilities/distribution.ts` (which compiles the declared stories into
|
|
8
|
+
* capability modules at module load), and at build time by the bundler. A
|
|
9
|
+
* NON-magic name on purpose: `findProjectConfig` only discovers
|
|
10
|
+
* `pragma.config.{ts,js}`, so this file is never mistaken for a project config.
|
|
11
|
+
* Validated by the same `parseRawConfig` as every layer.
|
|
12
|
+
*
|
|
13
|
+
* INERT DATA. It must never gain a value import: `src/constants.ts` statically
|
|
14
|
+
* imports it to project the program's identity, so anything that runs at this
|
|
15
|
+
* module's load runs on `--help`, `__complete` and `--version`. That also makes
|
|
16
|
+
* the reverse edge impossible — importing `constants.js` from here is a
|
|
17
|
+
* temporal-dead-zone cycle. It is also why no string below names the binary
|
|
18
|
+
* except `name` itself: an `emptyRecovery.cli` is the command WITHOUT the
|
|
19
|
+
* binary name, and the renderer prepends the consuming distribution's.
|
|
20
|
+
* `capabilities/lazy.test.ts` pins both halves of that.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import type { RawConfig } from "./src/kernel/config/types.js";
|
|
24
|
+
import type { PackDefinition } from "./src/kernel/packs/types.js";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The design-system domain colophon — the ontology + graph story, surfaced by
|
|
28
|
+
* `pragma colophon` after pragma's own. Declared on the flagship UI-block noun
|
|
29
|
+
* because `block` most embodies the design system; it narrates the DOMAIN (what
|
|
30
|
+
* the graph models), not the toolchain (pragma's built-in section).
|
|
31
|
+
*/
|
|
32
|
+
const DESIGN_SYSTEM_COLOPHON = `The Canonical design system is a **knowledge graph**, not a component library.
|
|
33
|
+
Every block, token, modifier, standard, and tier is a node in an RDF store,
|
|
34
|
+
described by the \`ds:\` ontology and queried the same way whether you reach it
|
|
35
|
+
over GraphQL or raw SPARQL.
|
|
36
|
+
|
|
37
|
+
## What the graph models
|
|
38
|
+
|
|
39
|
+
- **Blocks** — components, patterns, layouts, and subcomponents (the \`ds:UIBlock\`
|
|
40
|
+
family). A block carries its anatomy, guidelines, and \`when to use\` / \`when
|
|
41
|
+
not to use\` narrative as graph properties, not prose in a wiki.
|
|
42
|
+
- **Modifiers** — families of variant values (\`ds:hasModifierFamily\` →
|
|
43
|
+
\`ds:hasModifier\`) a block composes, so a variant is a relationship, not a
|
|
44
|
+
string.
|
|
45
|
+
- **Tokens** — the themeable design values, resolved per theme.
|
|
46
|
+
- **Standards** — the do / don't coding guidance, categorized and linked to the
|
|
47
|
+
blocks they govern.
|
|
48
|
+
|
|
49
|
+
## How it fits together
|
|
50
|
+
|
|
51
|
+
- **Tiers** are a hierarchy (\`global\` > \`apps\` > \`apps/lxd\`): a lower tier
|
|
52
|
+
inherits and overrides the blocks of its ancestors, so scoping a query to a
|
|
53
|
+
tier walks that chain.
|
|
54
|
+
- **Channels** (\`normal\`, \`experimental\`, \`prerelease\`) gate visibility, so an
|
|
55
|
+
in-progress block never leaks into a stable answer.
|
|
56
|
+
|
|
57
|
+
## Why RDF
|
|
58
|
+
|
|
59
|
+
One graph makes every relationship first-class and queryable: \`block lookup\`
|
|
60
|
+
follows edges to modifiers and subcomponents, \`graph query\` runs arbitrary
|
|
61
|
+
SPARQL, and \`ontology show\` reads the schema itself. The store is built once
|
|
62
|
+
by \`sources update\` and addressed by content hash, so the domain you query is
|
|
63
|
+
exactly the domain that was published.`;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The read stories the design-system pack supplies — `block`, `token`,
|
|
67
|
+
* `modifier` and `tier` as declared data rather than code.
|
|
68
|
+
*
|
|
69
|
+
* The association with the pack is the point: when `@canonical/design-system`
|
|
70
|
+
* starts shipping its own `stories/*.json`, this block is deleted and the
|
|
71
|
+
* package tier takes over with no code change here or anywhere else. The local
|
|
72
|
+
* `readonly PackDefinition[]` annotation is what type-checks them —
|
|
73
|
+
* `PackSource.stories` is deliberately `readonly unknown[]`, because the config
|
|
74
|
+
* layer does not know the pack grammar (`parsePackDefinition` does).
|
|
75
|
+
*/
|
|
76
|
+
const designSystemStories: readonly PackDefinition[] = [
|
|
77
|
+
// `block list` is declared content (L-OPEN-9): one unfiltered SELECT over
|
|
78
|
+
// the four UIBlock classes, listing ALL blocks — experimental and alpha ones
|
|
79
|
+
// included, for everyone — until filtering returns in declared form. The
|
|
80
|
+
// hand-written tier-chain/channel filtering (and its `--all-tiers` escape)
|
|
81
|
+
// is removed with the code, an owner-signed consequence. Display parity
|
|
82
|
+
// lives IN the query: `VALUES ?class` closes the type set, so the BINDs
|
|
83
|
+
// that derive `name` (declared name, else the IRI's local name), `type`
|
|
84
|
+
// (lowercased class local name), and `tier` (tier IRI's local name) operate
|
|
85
|
+
// over known shapes — the `standard` story's BIND/COALESCE precedent.
|
|
86
|
+
//
|
|
87
|
+
// `block lookup` is served over the GraphQL fetch path (ONE generated document
|
|
88
|
+
// over the `UIBlock` interface covering Component/Pattern/Layout/Subcomponent).
|
|
89
|
+
// Base level mirrors the old summary view (name/tier/summary); the default is
|
|
90
|
+
// `detailed`, matching the old CLI which rendered anatomy and modifiers
|
|
91
|
+
// without a flag. A derived name that maps onto no schema field is omitted
|
|
92
|
+
// (OPTIONAL parity), so a graph lacking whenToUse/whenNotToUse degrades
|
|
93
|
+
// gracefully.
|
|
94
|
+
//
|
|
95
|
+
// Disclosure declares the FULL canonical ladder `[summary, standard,
|
|
96
|
+
// detailed]` — the same set `standard` declares — so a config
|
|
97
|
+
// `detail=standard` names a level `block` advertises rather than one it
|
|
98
|
+
// silently accepts-then-degrades. Block carries no `standard`-tier content of
|
|
99
|
+
// its own; gating is by canonical index, so `standard` resolves to the base
|
|
100
|
+
// view. Only the level SET is aligned: the per-noun DEFAULT stays domain-tuned
|
|
101
|
+
// (`block` rich-by-default, `standard` terse-by-default).
|
|
102
|
+
{
|
|
103
|
+
noun: "block",
|
|
104
|
+
description: "List all design system blocks.",
|
|
105
|
+
toolDescription:
|
|
106
|
+
"List all design system blocks with their type, tier, and modifier families. Use when browsing which blocks exist. Example: block_list {}.",
|
|
107
|
+
colophon: DESIGN_SYSTEM_COLOPHON,
|
|
108
|
+
list: {
|
|
109
|
+
query: [
|
|
110
|
+
"SELECT ?uri ?name ?type ?tier",
|
|
111
|
+
' (GROUP_CONCAT(DISTINCT ?modName; separator=", ") AS ?modifiers)',
|
|
112
|
+
"WHERE {",
|
|
113
|
+
" VALUES ?class { ds:Component ds:Pattern ds:Layout ds:Subcomponent }",
|
|
114
|
+
" ?uri a ?class .",
|
|
115
|
+
" OPTIONAL { ?uri ds:name ?dsName }",
|
|
116
|
+
" OPTIONAL { ?uri ds:tier ?tierUri }",
|
|
117
|
+
" OPTIONAL { ?uri ds:hasModifierFamily ?family . ?family ds:name ?modName }",
|
|
118
|
+
' BIND(COALESCE(?dsName, REPLACE(STR(?uri), "^.*[/#]", "")) AS ?name)',
|
|
119
|
+
' BIND(LCASE(REPLACE(STR(?class), "^.*[/#]", "")) AS ?type)',
|
|
120
|
+
' BIND(REPLACE(STR(?tierUri), "^.*[/#]", "") AS ?tier)',
|
|
121
|
+
"}",
|
|
122
|
+
"GROUP BY ?uri ?name ?type ?tier",
|
|
123
|
+
"ORDER BY ?name",
|
|
124
|
+
].join("\n"),
|
|
125
|
+
columns: [
|
|
126
|
+
{ field: "name", label: "Name" },
|
|
127
|
+
{ field: "type", label: "Type" },
|
|
128
|
+
{ field: "tier", label: "Tier" },
|
|
129
|
+
{ field: "modifiers", label: "Modifiers" },
|
|
130
|
+
{ field: "uri", label: "IRI" },
|
|
131
|
+
],
|
|
132
|
+
emptyRecovery: {
|
|
133
|
+
message:
|
|
134
|
+
"No blocks in the store. Build it from the configured design-system packs.",
|
|
135
|
+
cli: "sources update",
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
lookup: {
|
|
139
|
+
source: "graphql",
|
|
140
|
+
toolDescription:
|
|
141
|
+
'Get detailed information about one or more design system blocks including anatomy, modifiers, and properties. Use when you need the full spec of specific blocks by name — detail: "summary" trims to the base view. Example: block_lookup { names: ["Button"] }.',
|
|
142
|
+
by: "ds:name",
|
|
143
|
+
types: ["ds:Component", "ds:Pattern", "ds:Layout", "ds:Subcomponent"],
|
|
144
|
+
graphqlType: "UIBlock",
|
|
145
|
+
fields: [
|
|
146
|
+
{ name: "tier", property: "ds:tier", label: "Tier" },
|
|
147
|
+
{
|
|
148
|
+
name: "figmaLink",
|
|
149
|
+
property: "ds:figmaLink",
|
|
150
|
+
label: "Figma",
|
|
151
|
+
level: "detailed",
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
sections: [
|
|
155
|
+
{ name: "summary", property: "ds:summary", label: "Summary" },
|
|
156
|
+
{
|
|
157
|
+
name: "whenToUse",
|
|
158
|
+
property: "ds:whenToUse",
|
|
159
|
+
label: "When to use",
|
|
160
|
+
level: "detailed",
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: "whenNotToUse",
|
|
164
|
+
property: "ds:whenNotToUse",
|
|
165
|
+
label: "When not to use",
|
|
166
|
+
level: "detailed",
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: "guidelines",
|
|
170
|
+
property: "ds:guidelines",
|
|
171
|
+
label: "Guidelines",
|
|
172
|
+
level: "detailed",
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "anatomyDsl",
|
|
176
|
+
property: "ds:anatomyDsl",
|
|
177
|
+
label: "Anatomy (DSL)",
|
|
178
|
+
kind: "code",
|
|
179
|
+
level: "detailed",
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: "anatomyClassic",
|
|
183
|
+
property: "ds:anatomyClassic",
|
|
184
|
+
label: "Anatomy (classic)",
|
|
185
|
+
kind: "code",
|
|
186
|
+
level: "detailed",
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
expand: [
|
|
190
|
+
{
|
|
191
|
+
name: "modifierFamilies",
|
|
192
|
+
heading: "Modifier Families",
|
|
193
|
+
relation: "ds:hasModifierFamily",
|
|
194
|
+
level: "detailed",
|
|
195
|
+
select: [
|
|
196
|
+
{ name: "name", property: "ds:name" },
|
|
197
|
+
{
|
|
198
|
+
name: "values",
|
|
199
|
+
relation: "ds:hasModifier",
|
|
200
|
+
select: [{ name: "name", property: "ds:name" }],
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: "properties",
|
|
206
|
+
heading: "Properties",
|
|
207
|
+
relation: "ds:hasProperty",
|
|
208
|
+
kind: "table",
|
|
209
|
+
level: "detailed",
|
|
210
|
+
select: [
|
|
211
|
+
{ name: "name", property: "ds:name" },
|
|
212
|
+
{ name: "type", property: "ds:propertyType" },
|
|
213
|
+
{ name: "optional", property: "ds:optional" },
|
|
214
|
+
],
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: "subcomponents",
|
|
218
|
+
heading: "Subcomponents",
|
|
219
|
+
relation: "ds:hasSubcomponent",
|
|
220
|
+
level: "detailed",
|
|
221
|
+
select: [
|
|
222
|
+
{ name: "name", property: "ds:name" },
|
|
223
|
+
{ name: "uri", property: "ds:name", graphqlField: "uri" },
|
|
224
|
+
],
|
|
225
|
+
},
|
|
226
|
+
],
|
|
227
|
+
disclosure: {
|
|
228
|
+
levels: ["summary", "standard", "detailed"],
|
|
229
|
+
default: "detailed",
|
|
230
|
+
},
|
|
231
|
+
sample: {
|
|
232
|
+
fixedCount: true,
|
|
233
|
+
toolDescription:
|
|
234
|
+
"Return randomly selected complete design-system blocks as exemplars. Use BEFORE writing queries to see actual data shapes, anatomy, and property names.",
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
// Design tokens: SPARQL-sourced on both verbs. There is no `ds:Token` GraphQL
|
|
240
|
+
// type to project against when the graph ships no tokens, and the lookup reads
|
|
241
|
+
// a property path (`ds:tokenType/rdfs:label`) only SPARQL can express. The
|
|
242
|
+
// `emptyRecovery` install hint is the story users see on an empty store. The
|
|
243
|
+
// noun is now purely declarative: `token add-config` wrote a starter file, and
|
|
244
|
+
// L-OPEN-9 removed it rather than growing the read grammar a mutation verb.
|
|
245
|
+
{
|
|
246
|
+
noun: "token",
|
|
247
|
+
description: "List all design tokens.",
|
|
248
|
+
toolDescription:
|
|
249
|
+
"List all design tokens with their type. Use when browsing which tokens exist under the active scope. Example: token_list {}.",
|
|
250
|
+
list: {
|
|
251
|
+
query: [
|
|
252
|
+
"SELECT ?uri ?name ?category WHERE {",
|
|
253
|
+
" ?uri a ds:Token ;",
|
|
254
|
+
" ds:tokenId ?name .",
|
|
255
|
+
" OPTIONAL {",
|
|
256
|
+
" ?uri ds:tokenType ?type .",
|
|
257
|
+
" ?type rdfs:label ?category .",
|
|
258
|
+
" }",
|
|
259
|
+
"}",
|
|
260
|
+
"ORDER BY ?name",
|
|
261
|
+
].join("\n"),
|
|
262
|
+
columns: [
|
|
263
|
+
{ field: "uri", label: "IRI" },
|
|
264
|
+
{ field: "name", label: "Name" },
|
|
265
|
+
{ field: "category", label: "Type" },
|
|
266
|
+
],
|
|
267
|
+
emptyRecovery: {
|
|
268
|
+
message:
|
|
269
|
+
"No tokens in the store. Build it from the configured design-system packs.",
|
|
270
|
+
cli: "sources update",
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
lookup: {
|
|
274
|
+
source: "sparql",
|
|
275
|
+
by: "ds:tokenId",
|
|
276
|
+
type: "ds:Token",
|
|
277
|
+
toolDescription:
|
|
278
|
+
'Get type and theme values for one or more design tokens by name. Use when resolving specific tokens\' light/dark values. Example: token_lookup { names: ["color.primary"] }.',
|
|
279
|
+
fields: [
|
|
280
|
+
{
|
|
281
|
+
name: "category",
|
|
282
|
+
property: "ds:tokenType/rdfs:label",
|
|
283
|
+
label: "Type",
|
|
284
|
+
},
|
|
285
|
+
{ name: "valueLight", property: "ds:valueLight", label: "Light value" },
|
|
286
|
+
{ name: "valueDark", property: "ds:valueDark", label: "Dark value" },
|
|
287
|
+
],
|
|
288
|
+
sample: {
|
|
289
|
+
fixedCount: true,
|
|
290
|
+
toolDescription:
|
|
291
|
+
"Return randomly selected complete design tokens (with theme values) as exemplars. Use BEFORE writing queries to see actual data shapes.",
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
|
|
296
|
+
// Modifier families. `modifier list` is SPARQL (an alternation path collects
|
|
297
|
+
// values asserted in either direction); `modifier lookup` is GRAPHQL, where
|
|
298
|
+
// the compiled `ModifierFamily.modifiers` field is the declared-inverse union
|
|
299
|
+
// and resolves both directions in ONE generated document — exactly the case
|
|
300
|
+
// the GraphQL fetch path exists for.
|
|
301
|
+
{
|
|
302
|
+
noun: "modifier",
|
|
303
|
+
description: "List all modifier families.",
|
|
304
|
+
toolDescription:
|
|
305
|
+
"List all modifier families with their values. Use when browsing which modifier families exist and the values each allows. Example: modifier_list {}.",
|
|
306
|
+
list: {
|
|
307
|
+
query: [
|
|
308
|
+
"SELECT ?uri ?name",
|
|
309
|
+
' (GROUP_CONCAT(DISTINCT ?valueName; separator=", ") AS ?values)',
|
|
310
|
+
"WHERE {",
|
|
311
|
+
" ?uri a ds:ModifierFamily ;",
|
|
312
|
+
" ds:name ?name .",
|
|
313
|
+
" OPTIONAL {",
|
|
314
|
+
" ?uri (ds:hasModifier|^ds:modifierFamily) ?value .",
|
|
315
|
+
" ?value ds:name ?valueName .",
|
|
316
|
+
" }",
|
|
317
|
+
"}",
|
|
318
|
+
"GROUP BY ?uri ?name",
|
|
319
|
+
"ORDER BY ?name",
|
|
320
|
+
].join("\n"),
|
|
321
|
+
columns: [
|
|
322
|
+
{ field: "uri", label: "IRI" },
|
|
323
|
+
{ field: "name", label: "Name" },
|
|
324
|
+
{ field: "values", label: "Values" },
|
|
325
|
+
],
|
|
326
|
+
emptyRecovery: {
|
|
327
|
+
message:
|
|
328
|
+
"No modifier families in the store. Build it from the configured design-system packs.",
|
|
329
|
+
cli: "sources update",
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
lookup: {
|
|
333
|
+
source: "graphql",
|
|
334
|
+
by: "ds:name",
|
|
335
|
+
type: "ds:ModifierFamily",
|
|
336
|
+
toolDescription:
|
|
337
|
+
'Get values and usage details for one or more modifier families by name. Use when you need the allowed values of specific families. Example: modifier_lookup { names: ["importance"] }.',
|
|
338
|
+
expand: [
|
|
339
|
+
{
|
|
340
|
+
name: "values",
|
|
341
|
+
heading: "Values",
|
|
342
|
+
relation: "ds:hasModifier",
|
|
343
|
+
select: [{ name: "name", property: "ds:name" }],
|
|
344
|
+
},
|
|
345
|
+
],
|
|
346
|
+
sample: {
|
|
347
|
+
fixedCount: true,
|
|
348
|
+
toolDescription:
|
|
349
|
+
"Return randomly selected complete modifier families (with value lists) as exemplars. Use BEFORE writing queries to see actual data shapes.",
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
|
|
354
|
+
// Tiers. The hierarchy is encoded in the slash-separated path string
|
|
355
|
+
// (`apps/lxd`), not in graph edges, so `tier list` is a flat, name-ordered
|
|
356
|
+
// list. `tier lookup` resolves a tier by its declared name and expands the
|
|
357
|
+
// blocks scoped DIRECTLY to it through the inverse path `^ds:tier` — a
|
|
358
|
+
// single-hop expand the generated sub-SELECT emits as `<tier> ^ds:tier ?child`
|
|
359
|
+
// (property paths, inverse included, are in-contract for `PackExpand.relation`).
|
|
360
|
+
// Retiring the bespoke single-`<name>` lookup for this declared variadic one
|
|
361
|
+
// is an L-OPEN-9 covenant change, recorded in the covenant's $comment.
|
|
362
|
+
{
|
|
363
|
+
noun: "tier",
|
|
364
|
+
description: "List all tiers in the design system ontology.",
|
|
365
|
+
toolDescription:
|
|
366
|
+
"List all tiers in the design-system ontology. Use when understanding the tier hierarchy before setting a tier filter. Example: tier_list {}.",
|
|
367
|
+
list: {
|
|
368
|
+
query: [
|
|
369
|
+
"SELECT ?uri ?name WHERE {",
|
|
370
|
+
" ?uri a ds:Tier ;",
|
|
371
|
+
" ds:name ?name .",
|
|
372
|
+
"} ORDER BY ?name",
|
|
373
|
+
].join("\n"),
|
|
374
|
+
columns: [
|
|
375
|
+
{ field: "uri", label: "IRI" },
|
|
376
|
+
{ field: "name", label: "Name" },
|
|
377
|
+
],
|
|
378
|
+
},
|
|
379
|
+
lookup: {
|
|
380
|
+
source: "sparql",
|
|
381
|
+
by: "ds:name",
|
|
382
|
+
type: "ds:Tier",
|
|
383
|
+
description: "Show tiers by name, with the blocks scoped to each.",
|
|
384
|
+
toolDescription:
|
|
385
|
+
'Get one or more tiers by name, with the blocks scoped directly to each. Use when you need which blocks a specific tier carries. Example: tier_lookup { names: ["apps/lxd"] }.',
|
|
386
|
+
expand: [
|
|
387
|
+
{
|
|
388
|
+
name: "blocks",
|
|
389
|
+
heading: "Blocks",
|
|
390
|
+
relation: "^ds:tier",
|
|
391
|
+
select: [{ name: "name", property: "ds:name" }],
|
|
392
|
+
},
|
|
393
|
+
],
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
];
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* The read story the code-standards pack supplies — `standard` as declared data.
|
|
400
|
+
*
|
|
401
|
+
* Normalized for the v2 grammar: the old `digest` level is the canonical
|
|
402
|
+
* `standard`, so disclosure gates by the canonical index. The default is
|
|
403
|
+
* `summary` (base fields by name), `--detail standard` adds the `dos` examples,
|
|
404
|
+
* `--detail detailed` adds `donts`. `cs:extends` stays the raw IRI in JSON
|
|
405
|
+
* (renderers compact it at display time).
|
|
406
|
+
*/
|
|
407
|
+
const codeStandardsStories: readonly PackDefinition[] = [
|
|
408
|
+
{
|
|
409
|
+
noun: "standard",
|
|
410
|
+
description: "List all code standards.",
|
|
411
|
+
toolDescription:
|
|
412
|
+
"List code standards. Optionally filter by category or search term.",
|
|
413
|
+
list: {
|
|
414
|
+
query: [
|
|
415
|
+
"SELECT ?uri ?name ?category ?description",
|
|
416
|
+
"WHERE {",
|
|
417
|
+
" ?uri a cs:CodeStandard ;",
|
|
418
|
+
" cs:description ?description .",
|
|
419
|
+
" OPTIONAL { ?uri cs:name ?n . }",
|
|
420
|
+
' BIND(COALESCE(?n, REPLACE(STRAFTER(STR(?uri), "#"), "\\\\.", "/")) AS ?name)',
|
|
421
|
+
" OPTIONAL {",
|
|
422
|
+
" ?uri cs:hasCategory ?cat .",
|
|
423
|
+
" ?cat cs:slug ?category .",
|
|
424
|
+
" }",
|
|
425
|
+
"}",
|
|
426
|
+
"ORDER BY ?name",
|
|
427
|
+
].join("\n"),
|
|
428
|
+
columns: [
|
|
429
|
+
{ field: "uri", label: "IRI" },
|
|
430
|
+
{ field: "name", label: "Name" },
|
|
431
|
+
{ field: "category", label: "Category" },
|
|
432
|
+
{ field: "description", label: "Description" },
|
|
433
|
+
],
|
|
434
|
+
filters: [
|
|
435
|
+
{
|
|
436
|
+
param: "category",
|
|
437
|
+
variable: "category",
|
|
438
|
+
description: "Filter by category name.",
|
|
439
|
+
},
|
|
440
|
+
],
|
|
441
|
+
search: {
|
|
442
|
+
variables: ["name", "description"],
|
|
443
|
+
description: "Search in name and description.",
|
|
444
|
+
},
|
|
445
|
+
},
|
|
446
|
+
verbs: [
|
|
447
|
+
{
|
|
448
|
+
verb: "categories",
|
|
449
|
+
description: "List all standard categories with counts.",
|
|
450
|
+
toolDescription: "List all code standard categories.",
|
|
451
|
+
query: [
|
|
452
|
+
"SELECT ?name (COUNT(?standard) AS ?count)",
|
|
453
|
+
"WHERE {",
|
|
454
|
+
" ?cat a cs:Category ;",
|
|
455
|
+
" cs:slug ?name .",
|
|
456
|
+
" OPTIONAL {",
|
|
457
|
+
" ?standard a cs:CodeStandard ;",
|
|
458
|
+
" cs:hasCategory ?cat .",
|
|
459
|
+
" }",
|
|
460
|
+
"}",
|
|
461
|
+
"GROUP BY ?name",
|
|
462
|
+
"ORDER BY ?name",
|
|
463
|
+
].join("\n"),
|
|
464
|
+
columns: [
|
|
465
|
+
{ field: "name", label: "Category" },
|
|
466
|
+
{ field: "count", label: "Standards" },
|
|
467
|
+
],
|
|
468
|
+
},
|
|
469
|
+
],
|
|
470
|
+
lookup: {
|
|
471
|
+
source: "sparql",
|
|
472
|
+
by: "cs:name",
|
|
473
|
+
type: "cs:CodeStandard",
|
|
474
|
+
description:
|
|
475
|
+
"Look up detailed information for a standard by name, IRI, or glob.",
|
|
476
|
+
toolDescription:
|
|
477
|
+
"Get detailed information about one or more code standards including dos and donts with code examples. Address standards by name, prefixed name (cs:…), absolute IRI, or glob pattern (react/component/*).",
|
|
478
|
+
fields: [
|
|
479
|
+
{
|
|
480
|
+
name: "category",
|
|
481
|
+
property: "cs:hasCategory/cs:slug",
|
|
482
|
+
label: "Category",
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
name: "description",
|
|
486
|
+
property: "cs:description",
|
|
487
|
+
label: "Description",
|
|
488
|
+
},
|
|
489
|
+
{ name: "extends", property: "cs:extends", label: "Extends" },
|
|
490
|
+
],
|
|
491
|
+
expand: [
|
|
492
|
+
{
|
|
493
|
+
name: "dos",
|
|
494
|
+
heading: "Do",
|
|
495
|
+
relation: "cs:do",
|
|
496
|
+
select: [
|
|
497
|
+
{ name: "caption", property: "cs:description" },
|
|
498
|
+
{ name: "language", property: "cs:language" },
|
|
499
|
+
{ name: "code", property: "cs:code" },
|
|
500
|
+
],
|
|
501
|
+
level: "standard",
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
name: "donts",
|
|
505
|
+
heading: "Don't",
|
|
506
|
+
relation: "cs:dont",
|
|
507
|
+
select: [
|
|
508
|
+
{ name: "caption", property: "cs:description" },
|
|
509
|
+
{ name: "language", property: "cs:language" },
|
|
510
|
+
{ name: "code", property: "cs:code" },
|
|
511
|
+
],
|
|
512
|
+
level: "detailed",
|
|
513
|
+
},
|
|
514
|
+
],
|
|
515
|
+
disclosure: {
|
|
516
|
+
levels: ["summary", "standard", "detailed"],
|
|
517
|
+
default: "summary",
|
|
518
|
+
},
|
|
519
|
+
sample: {
|
|
520
|
+
description:
|
|
521
|
+
"Return randomly selected complete standard instances as exemplars for shape discovery.",
|
|
522
|
+
toolDescription:
|
|
523
|
+
"Return 1–5 randomly selected complete code standard instances as exemplars. Use BEFORE writing queries to see actual data shapes, property names, and value formats. Each call returns different instances.",
|
|
524
|
+
},
|
|
525
|
+
},
|
|
526
|
+
},
|
|
527
|
+
];
|
|
528
|
+
|
|
529
|
+
export default {
|
|
530
|
+
name: "pragma",
|
|
531
|
+
help: "Explore the design system",
|
|
532
|
+
// The toolchain's own colophon — CONTENT this distribution declares, not
|
|
533
|
+
// machinery: `pragma colophon` renders whatever stands here as its first
|
|
534
|
+
// section, titled with the distribution's name, before any active pack's
|
|
535
|
+
// domain colophon. A fork tells its own story by editing this declaration.
|
|
536
|
+
// `markdown` is the full narrative; `summary` is the condensed `--format llm`
|
|
537
|
+
// form. Both are BODIES with no leading H1 (the renderer supplies the
|
|
538
|
+
// heading), grounded in this tree's real architecture.
|
|
539
|
+
colophon: {
|
|
540
|
+
markdown: `pragma is a **domain-based toolchain**: one CLI and one MCP server projected
|
|
541
|
+
from a single grammar, serving a knowledge-graph domain that reads as data.
|
|
542
|
+
|
|
543
|
+
## The effect monad
|
|
544
|
+
|
|
545
|
+
Reads are plain \`async\` functions; a mutation instead *describes* its effects
|
|
546
|
+
as a \`Task\` (\`@canonical/task\`) that is interpreted — under the real node
|
|
547
|
+
interpreter, a \`--dry-run\` planner, or an \`--undo\` reverser. Describe-then-
|
|
548
|
+
interpret means dry-run and undo come for free, and the dispatcher tells the two
|
|
549
|
+
worlds apart on one bit: \`capability.mutates\`.
|
|
550
|
+
|
|
551
|
+
## One grammar, many projections
|
|
552
|
+
|
|
553
|
+
Every capability is a \`VerbSpec\` — a noun, its params, its effect profile, its
|
|
554
|
+
formatters. The CLI commands, the MCP tools, shell completion, and the
|
|
555
|
+
surface/docs are all *projections* of that one shape, so they cannot drift. The
|
|
556
|
+
projected surface is frozen in a covenant (\`surface/surface.v2.json\`): a single
|
|
557
|
+
source of truth a test asserts the live grammar still emits, tool for tool.
|
|
558
|
+
|
|
559
|
+
## LLM-optimized output
|
|
560
|
+
|
|
561
|
+
Each verb renders three ways — \`plain\` for a terminal, \`json\` for the machine
|
|
562
|
+
envelope, and \`llm\` for condensed Markdown. \`--format llm\` (or a non-interactive
|
|
563
|
+
stdout) selects the agent form: the same data, shaped for a model to read. This
|
|
564
|
+
colophon is itself a showcase of that render model.
|
|
565
|
+
|
|
566
|
+
## Modular, storeless by construction
|
|
567
|
+
|
|
568
|
+
Capabilities ship as **modules** — named bundles of verbs with optional
|
|
569
|
+
boot / resource / prompt hooks. A verb declares whether it \`needsStore\`, and
|
|
570
|
+
the dispatcher boots the triple store *only* for those; a storeless verb
|
|
571
|
+
(\`info\`, \`config\`, \`capabilities\`, \`colophon\`) never pays for the graph.
|
|
572
|
+
|
|
573
|
+
## Scaffolding
|
|
574
|
+
|
|
575
|
+
\`pragma create\` scaffolds components, packages, and applications through the
|
|
576
|
+
\`@canonical/summon-*\` generators, reusing summon's rich Ink wizard when it runs
|
|
577
|
+
interactively.
|
|
578
|
+
|
|
579
|
+
## The domain reads as data
|
|
580
|
+
|
|
581
|
+
A domain is a **pack**: a declarative \`PackDefinition\` (its list / lookup
|
|
582
|
+
queries) compiled into verbs, backed by a content-addressed graphpack that
|
|
583
|
+
\`sources update\` builds once. Swap the pack and the same pragma serves a
|
|
584
|
+
different domain — including the domain colophon printed below this one.
|
|
585
|
+
|
|
586
|
+
Made by the Canonical Webteam — https://canonical.com.`,
|
|
587
|
+
summary: `pragma is a domain-based toolchain: one CLI + MCP server projected from a single \`VerbSpec\` grammar.
|
|
588
|
+
|
|
589
|
+
- **Effect monad** (\`@canonical/task\`): reads are async; a mutation returns an interpreted \`Task\`, so \`--dry-run\` and \`--undo\` are free. The dispatcher branches on \`capability.mutates\`.
|
|
590
|
+
- **One grammar, many projections**: CLI, MCP tools, completion, and docs all project one \`VerbSpec\`; the emitted surface is frozen in a covenant so the projections never drift.
|
|
591
|
+
- **LLM-optimized output**: every verb renders \`plain\` / \`json\` / \`llm\`; \`--format llm\` (or a piped stdout) emits condensed Markdown for agents.
|
|
592
|
+
- **Modular + storeless**: capability modules; the triple store boots only for \`needsStore\` verbs.
|
|
593
|
+
- **Domain as data**: a pack is a declarative \`PackDefinition\` compiled to verbs over a content-addressed graph built by \`sources update\`.
|
|
594
|
+
|
|
595
|
+
Made by the Canonical Webteam — https://canonical.com.`,
|
|
596
|
+
},
|
|
597
|
+
issuesUrl: "https://github.com/canonical/pragma/issues",
|
|
598
|
+
packs: [
|
|
599
|
+
{
|
|
600
|
+
name: "@canonical/design-system",
|
|
601
|
+
source: "git+https://github.com/canonical/design-system.git#main",
|
|
602
|
+
stories: designSystemStories,
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
name: "@canonical/anatomy-dsl",
|
|
606
|
+
source: "git+https://github.com/canonical/anatomy-dsl.git#main",
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
name: "@canonical/code-standards",
|
|
610
|
+
source: "git+https://github.com/canonical/web-code-standards.git#main",
|
|
611
|
+
stories: codeStandardsStories,
|
|
612
|
+
},
|
|
613
|
+
],
|
|
614
|
+
// This distribution's domain namespaces, declared once and read twice.
|
|
615
|
+
//
|
|
616
|
+
// (1) They pin what `sources update` builds the store with. The design system
|
|
617
|
+
// declares `ds:` twice — `…/` in `definitions/` and `…/data/` in `data/` —
|
|
618
|
+
// and prefix harvesting is last-wins over a filename sort, so which one binds
|
|
619
|
+
// is an accident of file naming. The config layer wins every harvest: without
|
|
620
|
+
// this pin an added or renamed upstream file can silently compact every `ds:`
|
|
621
|
+
// entity to the wrong prefix, and `block list` stops resolving.
|
|
622
|
+
//
|
|
623
|
+
// (2) They are the domain half of the kernel's `DEFAULT_PREFIX_MAP`
|
|
624
|
+
// (`src/kernel/render/prefixes.ts`) — what the CLI compacts in output AND
|
|
625
|
+
// what it expands a user-typed `ds:Button` / `cs:rule` through before a
|
|
626
|
+
// lookup. Drop a namespace here and its lookups stop resolving; that is why
|
|
627
|
+
// `cs:` is listed even though nothing rebinds it upstream.
|
|
628
|
+
prefixes: {
|
|
629
|
+
ds: "https://ds.canonical.com/",
|
|
630
|
+
cs: "http://pragma.canonical.com/codestandards#",
|
|
631
|
+
},
|
|
632
|
+
channel: "normal",
|
|
633
|
+
detail: "standard",
|
|
634
|
+
} satisfies RawConfig;
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* The domain terms the kernel reads this distribution's graph with.
|
|
638
|
+
*
|
|
639
|
+
* A separate export because it is NOT a config layer field: it is compiled in
|
|
640
|
+
* and read at module load by `src/kernel/vocabulary.ts`, whose readers (the
|
|
641
|
+
* storeless completion fast path, the pack index builder) cannot reach a config
|
|
642
|
+
* layer at all. Layering it would let a project config set it and change
|
|
643
|
+
* nothing. A fork edits these values and rebuilds; `parseVocabulary` type-checks
|
|
644
|
+
* the shape and rejects a term that is not a prefixed name.
|
|
645
|
+
*
|
|
646
|
+
* Every prefix used here must be bound in `prefixes` above. `rdfs:label` and
|
|
647
|
+
* `rdfs:comment` are deliberately absent — the kernel treats standard
|
|
648
|
+
* vocabulary as universal.
|
|
649
|
+
*
|
|
650
|
+
* The `prompt` terms are a READ CONTRACT, not a claim about instances: this
|
|
651
|
+
* distribution's graph currently carries no `ds:Prompt` entities at all, so
|
|
652
|
+
* `prompt list` is honestly empty. Declaring the shape anyway is what makes an
|
|
653
|
+
* empty result mean "the graph has none" rather than "nothing was declared".
|
|
654
|
+
*/
|
|
655
|
+
export const vocabulary = {
|
|
656
|
+
altName: "ds:name",
|
|
657
|
+
prompt: {
|
|
658
|
+
type: "ds:Prompt",
|
|
659
|
+
body: "ds:promptBody",
|
|
660
|
+
argument: "ds:promptArgument",
|
|
661
|
+
argName: "ds:argName",
|
|
662
|
+
argRequired: "ds:argRequired",
|
|
663
|
+
},
|
|
664
|
+
};
|