@canonical/pragma-cli 0.35.0 → 0.36.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 +2 -2
- package/bundled-skills/add-standard/SKILL.md +338 -0
- package/bundled-skills/adoption-a1-styles/SKILL.md +269 -0
- package/bundled-skills/adoption-a2-components/SKILL.md +291 -0
- package/bundled-skills/adoption-a3-forms/SKILL.md +260 -0
- package/bundled-skills/anatomy-author/ANATOMY_DSL_SPEC.md +406 -0
- package/bundled-skills/anatomy-author/SKILL.md +1226 -0
- package/bundled-skills/design-auditor/SKILL.md +455 -0
- package/bundled-skills/implement-component/SKILL.md +333 -0
- package/bundled-skills/specify-component/SKILL.md +331 -0
- package/bundled-skills/specify-pattern/SKILL.md +292 -0
- package/dist/package.json +16 -15
- package/dist/pragma.conf.js +236 -34
- package/dist/pragma.conf.js.map +1 -1
- package/dist/src/bin.js +1 -1
- package/dist/src/bin.js.map +1 -1
- package/dist/src/capabilities/colophon/colophon.render.js +1 -1
- package/dist/src/capabilities/colophon/colophon.render.js.map +1 -1
- package/dist/src/capabilities/create/mount.js +4 -3
- package/dist/src/capabilities/create/mount.js.map +1 -1
- package/dist/src/capabilities/doctor/checks/checkPackageRefs.js +60 -4
- package/dist/src/capabilities/doctor/checks/checkPackageRefs.js.map +1 -1
- package/dist/src/capabilities/doctor/checks/checkShellCompletions.js +8 -8
- package/dist/src/capabilities/doctor/checks/checkShellCompletions.js.map +1 -1
- package/dist/src/capabilities/doctor/checks/harnessInventory.js +195 -0
- package/dist/src/capabilities/doctor/checks/harnessInventory.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/index.js +6 -6
- package/dist/src/capabilities/doctor/checks/targetHealth.js +194 -50
- package/dist/src/capabilities/doctor/checks/targetHealth.js.map +1 -1
- package/dist/src/capabilities/doctor/doctor.render.js +43 -64
- package/dist/src/capabilities/doctor/doctor.render.js.map +1 -1
- package/dist/src/capabilities/doctor/doctor.verb.js +6 -2
- package/dist/src/capabilities/doctor/doctor.verb.js.map +1 -1
- package/dist/src/capabilities/doctor/runChecks.js +14 -11
- package/dist/src/capabilities/doctor/runChecks.js.map +1 -1
- package/dist/src/capabilities/graph/query.render.js +2 -2
- package/dist/src/capabilities/graph/query.render.js.map +1 -1
- package/dist/src/capabilities/info/collectInfo.js +8 -2
- package/dist/src/capabilities/info/collectInfo.js.map +1 -1
- package/dist/src/capabilities/info/info.render.js +6 -2
- package/dist/src/capabilities/info/info.render.js.map +1 -1
- package/dist/src/capabilities/prompt/prompt.render.js +2 -2
- package/dist/src/capabilities/prompt/prompt.render.js.map +1 -1
- package/dist/src/capabilities/setup/buildPlan.js +43 -39
- package/dist/src/capabilities/setup/buildPlan.js.map +1 -1
- package/dist/src/capabilities/setup/mode.js +2 -2
- package/dist/src/capabilities/setup/operations/index.js +4 -4
- package/dist/src/capabilities/setup/operations/index.js.map +1 -1
- package/dist/src/capabilities/setup/operations/setupGenerator.js +92 -45
- package/dist/src/capabilities/setup/operations/setupGenerator.js.map +1 -1
- package/dist/src/capabilities/setup/operations/setupLsp.js +88 -36
- package/dist/src/capabilities/setup/operations/setupLsp.js.map +1 -1
- package/dist/src/capabilities/setup/operations/setupMcp.js +97 -51
- package/dist/src/capabilities/setup/operations/setupMcp.js.map +1 -1
- package/dist/src/capabilities/setup/operations/setupSkills.js +325 -47
- package/dist/src/capabilities/setup/operations/setupSkills.js.map +1 -1
- package/dist/src/capabilities/setup/plan.js.map +1 -1
- package/dist/src/capabilities/setup/plan.render.js +144 -66
- package/dist/src/capabilities/setup/plan.render.js.map +1 -1
- package/dist/src/capabilities/setup/setup.render.js +1 -1
- package/dist/src/capabilities/setup/setup.verb.js +86 -33
- package/dist/src/capabilities/setup/setup.verb.js.map +1 -1
- package/dist/src/capabilities/setup/targets.js +110 -45
- package/dist/src/capabilities/setup/targets.js.map +1 -1
- package/dist/src/capabilities/shared/index.js +6 -5
- package/dist/src/capabilities/shared/index.js.map +1 -1
- package/dist/src/capabilities/shared/packageManager.js +300 -54
- package/dist/src/capabilities/shared/packageManager.js.map +1 -1
- package/dist/src/capabilities/skill/discover.js +97 -11
- package/dist/src/capabilities/skill/discover.js.map +1 -1
- package/dist/src/capabilities/skill/render.js +2 -2
- package/dist/src/capabilities/skill/render.js.map +1 -1
- package/dist/src/capabilities/sources/installSkills.js +145 -3
- package/dist/src/capabilities/sources/installSkills.js.map +1 -1
- package/dist/src/capabilities/sources/runUpdate.js +68 -2
- package/dist/src/capabilities/sources/runUpdate.js.map +1 -1
- package/dist/src/capabilities/sources/update.verb.js +3 -3
- package/dist/src/capabilities/sources/update.verb.js.map +1 -1
- package/dist/src/capabilities/upgrade/runUpgrade.js +43 -7
- package/dist/src/capabilities/upgrade/runUpgrade.js.map +1 -1
- package/dist/src/capabilities/upgrade/upgrade.render.js +10 -2
- package/dist/src/capabilities/upgrade/upgrade.render.js.map +1 -1
- package/dist/src/constants.js +6 -1
- package/dist/src/constants.js.map +1 -1
- package/dist/src/kernel/index.js +11 -2
- package/dist/src/kernel/index.js.map +1 -1
- package/dist/src/kernel/interactivity.js +68 -0
- package/dist/src/kernel/interactivity.js.map +1 -0
- package/dist/src/kernel/packs/renderPack.js +3 -3
- package/dist/src/kernel/packs/renderPack.js.map +1 -1
- package/dist/src/kernel/packs/resolveEntity.js +63 -12
- package/dist/src/kernel/packs/resolveEntity.js.map +1 -1
- package/dist/src/kernel/packs/runBodies.js +57 -4
- package/dist/src/kernel/packs/runBodies.js.map +1 -1
- package/dist/src/kernel/packs/schema.js +54 -2
- package/dist/src/kernel/packs/schema.js.map +1 -1
- package/dist/src/kernel/packs/sparql/applyFilters.js +104 -5
- package/dist/src/kernel/packs/sparql/applyFilters.js.map +1 -1
- package/dist/src/kernel/packs/sparql/buildLookupQuery.js +306 -43
- package/dist/src/kernel/packs/sparql/buildLookupQuery.js.map +1 -1
- package/dist/src/kernel/packs/types.js.map +1 -1
- package/dist/src/kernel/project/cli/buildProgram.js +1 -1
- package/dist/src/kernel/project/cli/buildProgram.js.map +1 -1
- package/dist/src/kernel/project/cli/dispatch.js +23 -23
- package/dist/src/kernel/project/cli/dispatch.js.map +1 -1
- package/dist/src/kernel/project/cli/globalFlags.js +4 -1
- package/dist/src/kernel/project/cli/globalFlags.js.map +1 -1
- package/dist/src/kernel/project/cli/helpFormat.js +1 -2
- package/dist/src/kernel/project/cli/helpFormat.js.map +1 -1
- package/dist/src/kernel/project/cli/rootHelp.js +34 -4
- package/dist/src/kernel/project/cli/rootHelp.js.map +1 -1
- package/dist/src/kernel/project/mcp/registerVerb.js +16 -1
- package/dist/src/kernel/project/mcp/registerVerb.js.map +1 -1
- package/dist/src/kernel/render/renderers.js +1 -1
- package/dist/src/kernel/render/style.js +29 -9
- package/dist/src/kernel/render/style.js.map +1 -1
- package/dist/src/kernel/render/vocabulary.js +174 -0
- package/dist/src/kernel/render/vocabulary.js.map +1 -0
- package/dist/src/kernel/spec/emitReference.js +1 -1
- package/dist/src/kernel/spec/emitReference.js.map +1 -1
- package/package.json +16 -15
- package/pragma.conf.ts +241 -34
- package/src/bin.ts +8 -1
- package/src/capabilities/block.parity.test.ts +25 -11
- package/src/capabilities/block.shipped.exec.test.ts +282 -0
- package/src/capabilities/block.tierRank.exec.test.ts +300 -0
- package/src/capabilities/colophon/colophon.render.ts +1 -2
- package/src/capabilities/colophon/colophon.test.ts +2 -2
- package/src/capabilities/create/createGrammar.test.ts +1 -1
- package/src/capabilities/create/mount.ts +3 -3
- package/src/capabilities/distribution.parity.test.ts +4 -0
- package/src/capabilities/doctor/checks/checkPackageRefs.ts +69 -4
- package/src/capabilities/doctor/checks/checkShellCompletions.test.ts +6 -4
- package/src/capabilities/doctor/checks/checkShellCompletions.ts +8 -8
- package/src/capabilities/doctor/checks/harnessInventory.test.ts +219 -0
- package/src/capabilities/doctor/checks/harnessInventory.ts +298 -0
- package/src/capabilities/doctor/checks/index.ts +6 -6
- package/src/capabilities/doctor/checks/targetHealth.ts +229 -59
- package/src/capabilities/doctor/doctor.render.test.ts +108 -32
- package/src/capabilities/doctor/doctor.render.ts +56 -80
- package/src/capabilities/doctor/doctor.test.ts +247 -35
- package/src/capabilities/doctor/doctor.verb.ts +7 -2
- package/src/capabilities/doctor/runChecks.ts +14 -11
- package/src/capabilities/doctor/types.ts +15 -24
- package/src/capabilities/emptyRecovery.test.ts +10 -2
- package/src/capabilities/graph/query.render.ts +2 -2
- package/src/capabilities/info/collectInfo.ts +8 -1
- package/src/capabilities/info/info.render.ts +6 -2
- package/src/capabilities/info/info.test.ts +37 -1
- package/src/capabilities/info/types.ts +10 -2
- package/src/capabilities/prompt/prompt.render.ts +2 -2
- package/src/capabilities/renderVocabularySync.test.ts +82 -0
- package/src/capabilities/scopeTypeSync.test.ts +29 -15
- package/src/capabilities/setup/buildPlan.ts +45 -41
- package/src/capabilities/setup/index.ts +1 -1
- package/src/capabilities/setup/mode.ts +2 -2
- package/src/capabilities/setup/operations/index.ts +6 -1
- package/src/capabilities/setup/operations/setupGenerator.ts +144 -70
- package/src/capabilities/setup/operations/setupLsp.ts +129 -37
- package/src/capabilities/setup/operations/setupMcp.ts +132 -61
- package/src/capabilities/setup/operations/setupSkills.ts +392 -58
- package/src/capabilities/setup/plan.render.ts +171 -76
- package/src/capabilities/setup/plan.ts +17 -12
- package/src/capabilities/setup/setup.mcp.correctness.test.ts +9 -9
- package/src/capabilities/setup/setup.render.test.ts +50 -36
- package/src/capabilities/setup/setup.render.ts +1 -1
- package/src/capabilities/setup/setup.test.ts +881 -50
- package/src/capabilities/setup/setup.verb.ts +91 -33
- package/src/capabilities/setup/targets.ts +120 -52
- package/src/capabilities/setup/types.ts +10 -18
- package/src/capabilities/shared/index.ts +17 -6
- package/src/capabilities/shared/packageManager.test.ts +421 -6
- package/src/capabilities/shared/packageManager.ts +394 -59
- package/src/capabilities/skill/bundledSkills.test.ts +347 -0
- package/src/capabilities/skill/discover.ts +100 -11
- package/src/capabilities/skill/render.ts +2 -2
- package/src/capabilities/skill/skill.test.ts +17 -4
- package/src/capabilities/sources/installSkills.ts +181 -3
- package/src/capabilities/sources/runUpdate.ts +78 -2
- package/src/capabilities/sources/sources.test.ts +228 -0
- package/src/capabilities/sources/update.verb.ts +3 -3
- package/src/capabilities/surface.test.ts +2 -2
- package/src/capabilities/upgrade/runUpgrade.ts +45 -6
- package/src/capabilities/upgrade/types.ts +10 -2
- package/src/capabilities/upgrade/upgrade.render.ts +9 -2
- package/src/capabilities/upgrade/upgrade.test.ts +72 -0
- package/src/constants.ts +6 -1
- package/src/identity.test.ts +18 -5
- package/src/kernel/completion/entitySource.test.ts +15 -2
- package/src/kernel/completion/safety.test.ts +16 -9
- package/src/kernel/config/defaults.test.ts +2 -1
- package/src/kernel/index.ts +11 -2
- package/src/kernel/interactivity.test.ts +76 -0
- package/src/kernel/interactivity.ts +69 -0
- package/src/kernel/packs/compile.test.ts +92 -0
- package/src/kernel/packs/renderPack.ts +3 -3
- package/src/kernel/packs/resolveEntity.test.ts +75 -14
- package/src/kernel/packs/resolveEntity.ts +88 -24
- package/src/kernel/packs/runBodies.ts +84 -19
- package/src/kernel/packs/schema.ts +60 -4
- package/src/kernel/packs/sparql/applyFilters.ts +125 -4
- package/src/kernel/packs/sparql/buildLookupQuery.test.ts +290 -0
- package/src/kernel/packs/sparql/buildLookupQuery.ts +323 -45
- package/src/kernel/packs/toolDescription.test.ts +35 -1
- package/src/kernel/packs/types.ts +125 -2
- package/src/kernel/project/cli/buildProgram.test.ts +73 -2
- package/src/kernel/project/cli/buildProgram.ts +8 -1
- package/src/kernel/project/cli/dispatch.test.ts +5 -4
- package/src/kernel/project/cli/dispatch.ts +25 -24
- package/src/kernel/project/cli/globalFlags.ts +4 -1
- package/src/kernel/project/cli/helpFormat.ts +1 -2
- package/src/kernel/project/cli/rootHelp.ts +36 -3
- package/src/kernel/project/mcp/registerVerb.ts +20 -1
- package/src/kernel/render/renderers.ts +1 -1
- package/src/kernel/render/style.ts +32 -9
- package/src/kernel/render/vocabulary.ts +276 -0
- package/src/kernel/spec/emitReference.ts +1 -1
- package/src/kernel/spec/types.ts +35 -6
- package/src/testing/PARITY_GAPS.ts +9 -3
- package/src/testing/behavioral/docExamples.test.ts +4 -2
- package/src/testing/behavioral/errorMatrix.mcp.test.ts +110 -7
- package/src/testing/behavioral/journeys.firstInstall.test.ts +7 -2
- package/src/testing/behavioral/journeys.packageStories.test.ts +6 -3
- package/src/testing/eval/__snapshots__/eval.test.ts.snap +26 -1
- package/src/testing/eval/cases/readNouns.ts +245 -9
- package/src/testing/fixtures/blockGraph.ts +28 -13
- package/src/testing/fixtures/graph/canonical.ts +95 -12
- package/dist/src/capabilities/shared/bands.js +0 -16
- package/dist/src/capabilities/shared/bands.js.map +0 -1
- package/src/capabilities/shared/bands.ts +0 -16
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specify-pattern
|
|
3
|
+
description: Specify a new design-system pattern from the repeatable user context it serves; also runs as a guided tutorial on a worked example
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Specify Pattern
|
|
7
|
+
|
|
8
|
+
Create a NEW pattern on the design/spec side. The skeleton is the same eight steps as
|
|
9
|
+
`specify-component`, with the emphasis inverted by the defining principle:
|
|
10
|
+
|
|
11
|
+
**A pattern is defined by the repeatable USER CONTEXT it serves — the situation, the
|
|
12
|
+
job, the flow it recurs in — more than by the atomicity of the element itself.**
|
|
13
|
+
|
|
14
|
+
A component earns its place by being a distinct element; a pattern earns its place by a
|
|
15
|
+
situation that keeps coming back and an arrangement that keeps answering it. Every step
|
|
16
|
+
below is aimed at that context.
|
|
17
|
+
|
|
18
|
+
In a fresh session, orient first:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pragma capabilities
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Working mode: assistant to a design authority
|
|
25
|
+
|
|
26
|
+
Most of the time this skill runs in collaboration with a senior designer or engineer —
|
|
27
|
+
they are the design authority, you are the assistant whose job is to make them
|
|
28
|
+
successful. Default to that mode: lay out the workflow direction step by step, do the
|
|
29
|
+
legwork (graph searches, ontology reads, benchmark research) and return digestible
|
|
30
|
+
findings, and bring each decision to the person as a recommendation plus a question
|
|
31
|
+
rather than a fait accompli. They hold context the graph does not — which situations
|
|
32
|
+
actually recur across products, history, naming precedent — so ask the questions that
|
|
33
|
+
draw that knowledge out; for patterns especially, the recurring CONTEXT often lives in
|
|
34
|
+
the person's experience before it lives in any data.
|
|
35
|
+
|
|
36
|
+
Full autonomy is the exception, not the default: run the whole flow alone only when
|
|
37
|
+
explicitly asked to. Even then, list every judgment call made unilaterally in the
|
|
38
|
+
final report so a human can revisit them.
|
|
39
|
+
|
|
40
|
+
Decision gates — in collaboration, pause at each and resolve it WITH the person:
|
|
41
|
+
|
|
42
|
+
1. The step-1 verdicts: for the pattern AND for each composed component.
|
|
43
|
+
2. Whether the entry IS a pattern (a recurring arrangement, not a component or layout).
|
|
44
|
+
3. The step-3 context definition and composition rule — what is fixed, what varies.
|
|
45
|
+
4. The step-4 adopt/reject decisions from the benchmark.
|
|
46
|
+
5. The step-5 state model spanning the composed components.
|
|
47
|
+
|
|
48
|
+
## When to Use
|
|
49
|
+
|
|
50
|
+
- A recurring arrangement of components (a flow, a page region, a repeated pairing)
|
|
51
|
+
needs a formal specification
|
|
52
|
+
- The same ad-hoc composition keeps being rebuilt across apps and should be named
|
|
53
|
+
|
|
54
|
+
## When NOT to Use
|
|
55
|
+
|
|
56
|
+
- Specifying a single element — use `specify-component`
|
|
57
|
+
- Implementing an already-specified block — use `implement-component`
|
|
58
|
+
- Writing only the anatomy — use `anatomy-author`
|
|
59
|
+
|
|
60
|
+
## Opening move: ask, or offer the tutorial
|
|
61
|
+
|
|
62
|
+
Activation is an opening, not a starting gun. Unless the first message already names
|
|
63
|
+
the work, ask for the starting point — as a suggestion carrying an example, not as a
|
|
64
|
+
form to fill in:
|
|
65
|
+
|
|
66
|
+
> To get started, tell me the pattern you'd like to work on — a name if it has one, or
|
|
67
|
+
> just the situation behind it, like "people keep having to confirm before something
|
|
68
|
+
> destructive happens".
|
|
69
|
+
|
|
70
|
+
The situation is the better of the two starts: this skill defines a pattern by the
|
|
71
|
+
context it serves, so what recurs matters more than what it is called. Ask again only
|
|
72
|
+
for what the next step genuinely blocks on.
|
|
73
|
+
|
|
74
|
+
If the activation message already carries the starting point, do not re-ask — say what
|
|
75
|
+
you took it to be, and go.
|
|
76
|
+
|
|
77
|
+
Offer the tutorial in the same breath, because this skill doubles as one:
|
|
78
|
+
|
|
79
|
+
> Or if you'd rather see the flow first, I can run it as a tutorial: I'll take a
|
|
80
|
+
> plausible example — confirming a destructive action, say — and walk you through the
|
|
81
|
+
> eight steps on it.
|
|
82
|
+
|
|
83
|
+
Tutorial mode is the step narration below, turned up: the same outcome-path-conclusion
|
|
84
|
+
frame, with the reasoning at each decision gate made fully explicit and a check that
|
|
85
|
+
the person is with you before the next step. Stop short of anything that lands — no spec
|
|
86
|
+
file written, no proposal filed — unless they ask to keep what you built.
|
|
87
|
+
|
|
88
|
+
## Every step is narrated: outcome, path, conclusion
|
|
89
|
+
|
|
90
|
+
Every step is addressed to the person — once before it runs, once when it ends. This is
|
|
91
|
+
not tutorial manner. It holds in the ordinary flow too: the person is the design
|
|
92
|
+
authority, and they can only steer a step they saw coming. A decision gate met cold is
|
|
93
|
+
a decision they cannot really make.
|
|
94
|
+
|
|
95
|
+
**Open** the step with what it is FOR — the outcome it should leave behind — and how
|
|
96
|
+
you are about to get there. **Close** it with a sentence saying what it established and
|
|
97
|
+
what that means for the step after. One sentence each is enough; the failure mode is
|
|
98
|
+
silence, not length, and a step whose outcome looks obvious still gets its sentence
|
|
99
|
+
rather than a shrug.
|
|
100
|
+
|
|
101
|
+
Do:
|
|
102
|
+
|
|
103
|
+
> **Step 1 — search the graph, twice.** The outcome is two verdicts: whether a pattern
|
|
104
|
+
> already answers this situation, and whether the components it would compose exist.
|
|
105
|
+
> The path is `pragma block list`, then `block lookup` on the near patterns and on each
|
|
106
|
+
> part.
|
|
107
|
+
>
|
|
108
|
+
> …
|
|
109
|
+
>
|
|
110
|
+
> So: no pattern covers destructive confirmation, and both parts it would compose
|
|
111
|
+
> (`Modal`, `Button`) already exist — the gap is the arrangement, not the pieces, which
|
|
112
|
+
> is exactly what step 2 has to defend.
|
|
113
|
+
|
|
114
|
+
Don't:
|
|
115
|
+
|
|
116
|
+
> Step 1 — Search
|
|
117
|
+
>
|
|
118
|
+
> No confirmation pattern. Modal and Button exist.
|
|
119
|
+
|
|
120
|
+
Both carry the same facts. Only the first says what the step was trying to achieve and
|
|
121
|
+
what it settled — and only the first lets the person cut in with the thing they know
|
|
122
|
+
and the graph does not, which is the whole reason they are here.
|
|
123
|
+
|
|
124
|
+
## Asked about the skill: methodology and outcomes first
|
|
125
|
+
|
|
126
|
+
A question about what this skill does — what it covers, what its steps are, how it
|
|
127
|
+
works — is answered in that order: the METHOD it applies and the OUTCOMES it leaves
|
|
128
|
+
the person holding come first, the step-by-step breakdown comes after.
|
|
129
|
+
|
|
130
|
+
Two or three sentences of method is enough: what the skill treats as its object, the
|
|
131
|
+
discipline that makes it work, and what exists at the end that did not exist before.
|
|
132
|
+
The enumeration then reads as steps in service of something, rather than as a list to
|
|
133
|
+
be got through.
|
|
134
|
+
|
|
135
|
+
What this prevents is a table of contents standing in for an answer. A reply opening
|
|
136
|
+
with the step names tells someone who already knows the skill nothing new, and someone
|
|
137
|
+
who does not, nothing at all.
|
|
138
|
+
|
|
139
|
+
So, asked what this skill is:
|
|
140
|
+
|
|
141
|
+
> It specifies a pattern, and the defining move is that a pattern is defined by the
|
|
142
|
+
> repeatable USER CONTEXT it serves — the situation, the job, the flow it recurs in —
|
|
143
|
+
> more than by the atomicity of the element. Every step is aimed at that context. You
|
|
144
|
+
> end holding a spec that names the situation, fixes what the arrangement holds
|
|
145
|
+
> constant and what it lets vary, and records the judgment calls behind both.
|
|
146
|
+
|
|
147
|
+
Then, and only then, the breakdown.
|
|
148
|
+
|
|
149
|
+
## The spec falls under standards too
|
|
150
|
+
|
|
151
|
+
A pattern spec is Turtle, and Turtle has standards — the `turtle` category, with
|
|
152
|
+
`ui-blocks` governing how blocks and their parts are modelled (take the actual set
|
|
153
|
+
from `pragma standard categories`, not from this list). Pull them before writing and
|
|
154
|
+
hold the Do/Don't pairs open; a spec that contradicts a pulled standard carries a
|
|
155
|
+
RECORDED deviation in the proposal, ideally also filed as an issue. The standards
|
|
156
|
+
apply independent of any package dependency and are open to contribution: a missing
|
|
157
|
+
or wrong modelling rule is something to propose a change for, not to silently work
|
|
158
|
+
around.
|
|
159
|
+
|
|
160
|
+
## The eight steps
|
|
161
|
+
|
|
162
|
+
### 1. Search the graph — patterns AND their parts
|
|
163
|
+
|
|
164
|
+
Search twice: for existing patterns near the candidate, and for the components the
|
|
165
|
+
candidate pattern composes.
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
pragma block list # patterns are blocks — the list covers them, with tiers
|
|
169
|
+
pragma block lookup <Name-or-glob> # the closest existing patterns, in full (MCP: block_lookup); a glob repeats a multi-tier name once per IRI and every repeat is the SAME block — the fragment query below lists the tiers
|
|
170
|
+
pragma block sample # real entry shapes before writing queries
|
|
171
|
+
pragma modifier list # the modifier families blocks draw from
|
|
172
|
+
pragma tier list # the tiers a block can live in
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Search by name fragment when the naming is uncertain:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
pragma graph query "SELECT ?b ?name WHERE { ?b ds:name ?name . FILTER(CONTAINS(LCASE(?name), 'nav')) }"
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Then look up EACH component the candidate arrangement composes
|
|
182
|
+
(`pragma block lookup <Name>` per component) — a pattern spec over parts the system does
|
|
183
|
+
not cover is really a component gap plus a pattern gap; name both.
|
|
184
|
+
|
|
185
|
+
> The covered set is whatever the graph answers today. Query it live — never copy its
|
|
186
|
+
> output into documentation, PRs, or this skill.
|
|
187
|
+
|
|
188
|
+
Outcome gate: **either "exists — stop or extend it" or a NAMED gap**, for the pattern
|
|
189
|
+
and for each composed component.
|
|
190
|
+
|
|
191
|
+
### 2. Understand the ontology
|
|
192
|
+
|
|
193
|
+
Same read as specify-component:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
pragma ontology lookup ds
|
|
197
|
+
pragma ontology lookup ds --class UIBlock # the block-level properties every entry carries
|
|
198
|
+
pragma ontology lookup ds --class Pattern # what Pattern itself declares
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
`--class` shows only what a class declares itself — Pattern declares nothing of its
|
|
202
|
+
own today; usage, guidelines, properties, and tier come from `ds:UIBlock`, and
|
|
203
|
+
`summary`/`name` from `ds:Entity`, further up the chain (`--class Entity`).
|
|
204
|
+
|
|
205
|
+
The entry follows the documented conventions — `ds:summary`; `ds:usage` with
|
|
206
|
+
`### When to use` / `### When not to use`; `ds:guidelines` with Accessibility as a
|
|
207
|
+
convention; `ds:hasProperty`; modifier families; tier — and `pragma block sample`
|
|
208
|
+
overrules this list wherever real entries differ. The draw is RANDOM and many blocks are near-empty, so a sample can come back content-free and teach you nothing: re-run it until it lands on a filled entry, or inspect a block you already know is documented. Each field's acceptance criteria
|
|
209
|
+
are on the property itself: `pragma graph inspect ds:usage` / `ds:guidelines` print
|
|
210
|
+
the `ds:acceptanceCriteria` the content must satisfy. Read the category definitions
|
|
211
|
+
too — `pragma ontology lookup ds` above lists every `ds:UIBlock` subclass; read what each one means with `pragma graph inspect ds:<Subclass>`
|
|
212
|
+
(each prints its `skos:definition`) — and confirm the entry IS a pattern — a recurring
|
|
213
|
+
arrangement, not a single element or a space-dividing layout — BEFORE writing.
|
|
214
|
+
|
|
215
|
+
### 3. Define the context and the composition rule
|
|
216
|
+
|
|
217
|
+
The main definition names the RECURRING CONTEXT, not just the shape:
|
|
218
|
+
|
|
219
|
+
- When does this arrangement apply — the situation, the job, the flow it recurs in
|
|
220
|
+
- Which components does it orchestrate
|
|
221
|
+
- What varies per use, and what is fixed (the composition rule)
|
|
222
|
+
|
|
223
|
+
Disambiguate from the step-1 neighbors explicitly ("unlike X, this …") — for a pattern
|
|
224
|
+
that includes naming the contexts the neighbors serve.
|
|
225
|
+
|
|
226
|
+
### 4. Research & benchmark pattern catalogs
|
|
227
|
+
|
|
228
|
+
Benchmark against the pattern sections of other systems — React Aria, Carbon, Material,
|
|
229
|
+
shadcn (list extensible): how they frame the same context, what they compose, the
|
|
230
|
+
accessibility pattern, the naming, the state model. Output: a short comparison table
|
|
231
|
+
plus what pragma adopts, what it rejects, and why.
|
|
232
|
+
|
|
233
|
+
### 5. State-complexity gate — expect it to fire
|
|
234
|
+
|
|
235
|
+
Patterns orchestrate state ACROSS components, so this gate fires more often than for a
|
|
236
|
+
single component: selection flowing between parts, async steps, wizard-like progressions.
|
|
237
|
+
|
|
238
|
+
When it fires, write the **"States & interaction"** section inside the guidelines
|
|
239
|
+
content of the spec, same as specify-component: states, events and transitions, initial
|
|
240
|
+
state, error states, keyboard interactions per state — here spanning the composed
|
|
241
|
+
components, not just one.
|
|
242
|
+
|
|
243
|
+
### 6. Write the documentation (without the anatomy)
|
|
244
|
+
|
|
245
|
+
Markdown or Turtle following the step-2 structure; category = pattern.
|
|
246
|
+
|
|
247
|
+
**Output location (hard rule)**: a standalone spec file the sync cannot destroy.
|
|
248
|
+
|
|
249
|
+
- In canonical/design-system: `specs/<tier>.pattern.<snake_name>.{md,ttl}`
|
|
250
|
+
- In any other repo: that repo's design-docs location
|
|
251
|
+
|
|
252
|
+
NEVER write into design-system `data/` — it is regenerated destructively from Coda by
|
|
253
|
+
CI, and hand edits are overwritten by the next sync. Database entry is a separate,
|
|
254
|
+
currently-human step: a person pastes the spec content into Coda.
|
|
255
|
+
|
|
256
|
+
### 7. Write the anatomy DSL — where the skeleton is stable
|
|
257
|
+
|
|
258
|
+
Where the pattern has a stable structural skeleton, write its anatomy via the
|
|
259
|
+
`anatomy-author` skill (`pragma skill lookup anatomy-author`). A pattern whose whole
|
|
260
|
+
point is a varying arrangement may carry only the invariant frame; say which parts are
|
|
261
|
+
anatomy and which are composition rule. The produced DSL lands in the step-6 spec file
|
|
262
|
+
under `specs/` — in a `.md` spec as its anatomy section, in a `.ttl` spec as the
|
|
263
|
+
block's `ds:anatomyDsl` string literal — never under `data/`; entry into Coda stays
|
|
264
|
+
the human step.
|
|
265
|
+
|
|
266
|
+
### 8. Pair with tokens — placeholder
|
|
267
|
+
|
|
268
|
+
**Left blank for now** — token pairing content lands with the token work. Do not invent
|
|
269
|
+
token guidance.
|
|
270
|
+
|
|
271
|
+
## Response format
|
|
272
|
+
|
|
273
|
+
Report the spec-file path, then the eight step outcomes as a checklist (pattern AND
|
|
274
|
+
composed components named in step 1; the composition rule stated in step 3).
|
|
275
|
+
|
|
276
|
+
## Related skills
|
|
277
|
+
|
|
278
|
+
- `specify-component` — the sibling flow for single elements (and for component gaps
|
|
279
|
+
step 1 uncovers)
|
|
280
|
+
- `anatomy-author` — the step-7 engine
|
|
281
|
+
- `implement-component` — after the spec is approved
|
|
282
|
+
|
|
283
|
+
## Support
|
|
284
|
+
|
|
285
|
+
If this skill leads somewhere broken — a command that errors, guidance that
|
|
286
|
+
contradicts what the live system answers, a gap the flow cannot cover — you are not
|
|
287
|
+
stuck:
|
|
288
|
+
|
|
289
|
+
- Raise an issue in the pragma repo: https://github.com/canonical/pragma/issues —
|
|
290
|
+
include the skill name, what was run, and expected vs. actual outcome.
|
|
291
|
+
- Or contact the design-system team owners directly through your organization's
|
|
292
|
+
professional messaging channels for assistance.
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/pragma-cli",
|
|
3
3
|
"description": "CLI and MCP server over Canonical's design-system knowledge graph.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.36.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "src/index.ts",
|
|
7
7
|
"types": "src/index.ts",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"src",
|
|
13
13
|
"dist",
|
|
14
|
-
"pragma.conf.ts"
|
|
14
|
+
"pragma.conf.ts",
|
|
15
|
+
"bundled-skills"
|
|
15
16
|
],
|
|
16
17
|
"author": {
|
|
17
18
|
"email": "webteam@canonical.com",
|
|
@@ -48,14 +49,14 @@
|
|
|
48
49
|
"eval": "bun run src/testing/eval/report.ts"
|
|
49
50
|
},
|
|
50
51
|
"dependencies": {
|
|
51
|
-
"@canonical/harnesses": "^0.
|
|
52
|
-
"@canonical/ke": "^0.
|
|
53
|
-
"@canonical/ke-graphql": "^0.
|
|
54
|
-
"@canonical/summon-application": "^0.
|
|
55
|
-
"@canonical/summon-component": "^0.
|
|
56
|
-
"@canonical/summon-core": "^0.
|
|
57
|
-
"@canonical/summon-package": "^0.
|
|
58
|
-
"@canonical/task": "^0.
|
|
52
|
+
"@canonical/harnesses": "^0.36.0",
|
|
53
|
+
"@canonical/ke": "^0.36.0",
|
|
54
|
+
"@canonical/ke-graphql": "^0.36.0",
|
|
55
|
+
"@canonical/summon-application": "^0.36.0",
|
|
56
|
+
"@canonical/summon-component": "^0.36.0",
|
|
57
|
+
"@canonical/summon-core": "^0.36.0",
|
|
58
|
+
"@canonical/summon-package": "^0.36.0",
|
|
59
|
+
"@canonical/task": "^0.36.0",
|
|
59
60
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
60
61
|
"chalk": "^5.6.2",
|
|
61
62
|
"commander": "^14.0.3",
|
|
@@ -66,10 +67,10 @@
|
|
|
66
67
|
"devDependencies": {
|
|
67
68
|
"@biomejs/biome": "2.4.9",
|
|
68
69
|
"@canonical/anatomy-dsl": "^0.2.2",
|
|
69
|
-
"@canonical/biome-config": "^0.
|
|
70
|
-
"@canonical/summon": "^0.
|
|
71
|
-
"@canonical/typescript-config": "^0.
|
|
72
|
-
"@canonical/webarchitect": "^0.
|
|
70
|
+
"@canonical/biome-config": "^0.36.0",
|
|
71
|
+
"@canonical/summon": "^0.36.0",
|
|
72
|
+
"@canonical/typescript-config": "^0.36.0",
|
|
73
|
+
"@canonical/webarchitect": "^0.36.0",
|
|
73
74
|
"@types/bun": "^1.3.10",
|
|
74
75
|
"@types/node": "^26.0.0",
|
|
75
76
|
"@vitest/coverage-v8": "^4.0.18",
|
|
@@ -79,5 +80,5 @@
|
|
|
79
80
|
"engines": {
|
|
80
81
|
"node": ">=22.18 <23 || >=23.6"
|
|
81
82
|
},
|
|
82
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "78eb47ac10104e914eeacd331795e14b832703d4"
|
|
83
84
|
}
|