@canonical/design-system 0.1.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/.mcp.json +8 -0
- package/README.md +438 -0
- package/biome.json +6 -0
- package/bun.lock +349 -0
- package/data/apps/component/file_tree.ttl +8 -0
- package/data/apps/component/key_value_pair.ttl +8 -0
- package/data/apps/component/navigation.ttl +8 -0
- package/data/apps/component/skeleton_loading.ttl +8 -0
- package/data/apps/component/status_bar.ttl +8 -0
- package/data/apps/component/toolbar.ttl +8 -0
- package/data/apps/layout/application_layout.ttl +8 -0
- package/data/apps/layout/empty_layout.ttl +8 -0
- package/data/apps/layout/list_page_layout.ttl +8 -0
- package/data/apps/layout/settings_page_layout.ttl +8 -0
- package/data/apps/pattern/code_diff.ttl +8 -0
- package/data/apps/pattern/data_table.ttl +8 -0
- package/data/apps/pattern/destructive_modal.ttl +8 -0
- package/data/apps/pattern/key_value_summary.ttl +8 -0
- package/data/apps/pattern/keyboard_shortcuts.ttl +8 -0
- package/data/apps/pattern/notification_center.ttl +8 -0
- package/data/apps/pattern/side_panel.ttl +8 -0
- package/data/apps/pattern/sidepanel_stacked.ttl +8 -0
- package/data/apps.ttl +5 -0
- package/data/apps_wpe.ttl +5 -0
- package/data/documentation/layout/documentation_layout.ttl +8 -0
- package/data/documentation.ttl +5 -0
- package/data/global/component/accordion.ttl +14 -0
- package/data/global/component/announcement.ttl +8 -0
- package/data/global/component/badge.ttl +9 -0
- package/data/global/component/button.ttl +20 -0
- package/data/global/component/card.ttl +8 -0
- package/data/global/component/chip.ttl +8 -0
- package/data/global/component/code_snippet.ttl +8 -0
- package/data/global/component/contextual_menu.ttl +8 -0
- package/data/global/component/heading.ttl +14 -0
- package/data/global/component/icon.ttl +14 -0
- package/data/global/component/icon_in_container.ttl +8 -0
- package/data/global/component/keyboard_key.ttl +8 -0
- package/data/global/component/label.ttl +15 -0
- package/data/global/component/link.ttl +8 -0
- package/data/global/component/notification_inline.ttl +8 -0
- package/data/global/component/notification_toast.ttl +8 -0
- package/data/global/component/pagination.ttl +8 -0
- package/data/global/component/popover.ttl +8 -0
- package/data/global/component/rich_text_editor.ttl +8 -0
- package/data/global/component/search_bar.ttl +8 -0
- package/data/global/component/table.ttl +8 -0
- package/data/global/component/tabs.ttl +8 -0
- package/data/global/component/theme_switcher.ttl +8 -0
- package/data/global/component/tile.ttl +14 -0
- package/data/global/component/tooltip.ttl +8 -0
- package/data/global/group/buttons.ttl +8 -0
- package/data/global/group/cards.ttl +8 -0
- package/data/global/group/tiles.ttl +8 -0
- package/data/global/layout/error_layout.ttl +8 -0
- package/data/global/layout/form_layout.ttl +8 -0
- package/data/global/layout/identity_page_form.ttl +8 -0
- package/data/global/modifier/alpha.ttl +6 -0
- package/data/global/modifier/beta.ttl +6 -0
- package/data/global/modifier/caution.ttl +6 -0
- package/data/global/modifier/comfortable.ttl +6 -0
- package/data/global/modifier/completed.ttl +6 -0
- package/data/global/modifier/constructive.ttl +6 -0
- package/data/global/modifier/dark.ttl +6 -0
- package/data/global/modifier/dense.ttl +6 -0
- package/data/global/modifier/destructive.ttl +6 -0
- package/data/global/modifier/editable.ttl +6 -0
- package/data/global/modifier/elevated.ttl +6 -0
- package/data/global/modifier/error.ttl +6 -0
- package/data/global/modifier/experimental.ttl +6 -0
- package/data/global/modifier/failed.ttl +6 -0
- package/data/global/modifier/focused.ttl +6 -0
- package/data/global/modifier/highlighted.ttl +6 -0
- package/data/global/modifier/in_progress.ttl +6 -0
- package/data/global/modifier/information.ttl +6 -0
- package/data/global/modifier/light.ttl +6 -0
- package/data/global/modifier/loading.ttl +6 -0
- package/data/global/modifier/muted.ttl +6 -0
- package/data/global/modifier/paper.ttl +6 -0
- package/data/global/modifier/planned.ttl +6 -0
- package/data/global/modifier/primary.ttl +6 -0
- package/data/global/modifier/secondary.ttl +6 -0
- package/data/global/modifier/stable.ttl +6 -0
- package/data/global/modifier/success.ttl +6 -0
- package/data/global/modifier/tertiary.ttl +6 -0
- package/data/global/modifier/warning.ttl +6 -0
- package/data/global/modifier/wireframe.ttl +6 -0
- package/data/global/modifier_family/_color_luminosity.ttl +7 -0
- package/data/global/modifier_family/_emphasis.ttl +7 -0
- package/data/global/modifier_family/_other.ttl +7 -0
- package/data/global/modifier_family/anticipation.ttl +7 -0
- package/data/global/modifier_family/criticality.ttl +7 -0
- package/data/global/modifier_family/density.ttl +7 -0
- package/data/global/modifier_family/importance.ttl +7 -0
- package/data/global/modifier_family/lifecycle.ttl +7 -0
- package/data/global/modifier_family/release.ttl +7 -0
- package/data/global/pattern/breadcrumbs.ttl +14 -0
- package/data/global/pattern/info_table.ttl +8 -0
- package/data/global/pattern/modal.ttl +8 -0
- package/data/global/pattern/navigation.ttl +8 -0
- package/data/global/pattern/select_button.ttl +8 -0
- package/data/global/pattern/stepper.ttl +8 -0
- package/data/global/pattern/table_of_contents.ttl +8 -0
- package/data/global/pattern/timeline.ttl +14 -0
- package/data/global/subcomponent/accordion-item.ttl +19 -0
- package/data/global/subcomponent/breadcrumbs-item.ttl +19 -0
- package/data/global/subcomponent/card-content.ttl +14 -0
- package/data/global/subcomponent/card-header.ttl +14 -0
- package/data/global/subcomponent/card-image.ttl +20 -0
- package/data/global/subcomponent/divider.ttl +8 -0
- package/data/global/subcomponent/modal-content.ttl +8 -0
- package/data/global/subcomponent/modal-footer.ttl +8 -0
- package/data/global/subcomponent/modal-header.ttl +8 -0
- package/data/global/subcomponent/spinner.ttl +8 -0
- package/data/global/subcomponent/table-cell.ttl +8 -0
- package/data/global/subcomponent/table-row.ttl +8 -0
- package/data/global/subcomponent/tile-content.ttl +14 -0
- package/data/global/subcomponent/tile-header.ttl +14 -0
- package/data/global/subcomponent/timeline-content.ttl +14 -0
- package/data/global/subcomponent/timeline-event.ttl +31 -0
- package/data/global/subcomponent/timeline-footer.ttl +8 -0
- package/data/global/subcomponent/timeline-header.ttl +8 -0
- package/data/global.ttl +5 -0
- package/data/global_form/component/checkbox_input.ttl +8 -0
- package/data/global_form/component/choices_input.ttl +8 -0
- package/data/global_form/component/combobox_input.ttl +8 -0
- package/data/global_form/component/custom_choices_input.ttl +8 -0
- package/data/global_form/component/datepicker_input.ttl +8 -0
- package/data/global_form/component/rating_input.ttl +8 -0
- package/data/global_form/component/segmented_control_input.ttl +8 -0
- package/data/global_form/component/slider_input.ttl +8 -0
- package/data/global_form/component/switch_input.ttl +8 -0
- package/data/global_form/component/text_input.ttl +8 -0
- package/data/global_form/component/textarea_input.ttl +8 -0
- package/data/global_form/component/wysiwginput.ttl +8 -0
- package/data/global_form/pattern/field.ttl +8 -0
- package/data/global_form/pattern/form.ttl +8 -0
- package/data/global_form/subcomponent/field-description.ttl +8 -0
- package/data/global_form/subcomponent/field-label.ttl +8 -0
- package/data/global_form.ttl +5 -0
- package/data/site/component/quote.ttl +8 -0
- package/data/site/component/rule.ttl +8 -0
- package/data/site/component/section.ttl +8 -0
- package/data/site/layout/site_layout.ttl +8 -0
- package/data/site/pattern/hero-github.ttl +8 -0
- package/data/site/pattern/hero.ttl +8 -0
- package/data/site/pattern/info_table.ttl +8 -0
- package/data/site/pattern/skip_link.ttl +8 -0
- package/data/site.ttl +5 -0
- package/data/stores.ttl +5 -0
- package/definitions/ontology.ttl +498 -0
- package/package.json +42 -0
- package/session/A.DSL.md +429 -0
- package/session/B.NOTES.md +84 -0
- package/session/global.component.accordion.yaml +13 -0
- package/session/global.component.button.yaml +26 -0
- package/session/global.component.card.yaml +24 -0
- package/session/global.component.icon.yaml +7 -0
- package/session/global.component.label.yaml +7 -0
- package/session/global.component.tile.yaml +21 -0
- package/session/global.component.timeline.yaml +20 -0
- package/session/global.pattern.breadcrumbs.yaml +13 -0
- package/session/global.subcomponent.accordion-item.yaml +37 -0
- package/session/global.subcomponent.breadcrumbs-item.yaml +21 -0
- package/session/global.subcomponent.card-content.yaml +7 -0
- package/session/global.subcomponent.card-header.yaml +22 -0
- package/session/global.subcomponent.card-image.yaml +7 -0
- package/session/global.subcomponent.tile-content.yaml +7 -0
- package/session/global.subcomponent.tile-header.yaml +8 -0
- package/session/global.subcomponent.timeline-content.yaml +13 -0
- package/session/global.subcomponent.timeline-event.yaml +20 -0
- package/session/global.subcomponent.timeline-footer.yaml +9 -0
- package/session/global.subcomponent.timeline-header.yaml +18 -0
- package/skills/anatomy-author/ANATOMY_DSL_SPEC.md +423 -0
- package/skills/anatomy-author/SKILL.md +911 -0
- package/skills/component-specifier/SKILL.md +413 -0
- package/skills/design-auditor/SKILL.md +428 -0
- package/source.json +101 -0
- package/src/cli.ts +45 -0
- package/src/collect/generateTurtle.tests.ts +200 -0
- package/src/collect/generateTurtle.ts +187 -0
- package/src/collect/index.ts +4 -0
- package/src/collect/scanAnnotations.tests.ts +138 -0
- package/src/collect/scanAnnotations.ts +78 -0
- package/src/collect/types.ts +57 -0
- package/src/collect/validateCollectConfig.tests.ts +116 -0
- package/src/collect/validateCollectConfig.ts +74 -0
- package/src/collect-implementations.ts +99 -0
- package/src/commands/extract.tests.ts +41 -0
- package/src/commands/extract.ts +48 -0
- package/src/commands/index.ts +3 -0
- package/src/commands/list.tests.ts +26 -0
- package/src/commands/list.ts +26 -0
- package/src/commands/transform.tests.ts +28 -0
- package/src/commands/transform.ts +133 -0
- package/src/config/index.ts +2 -0
- package/src/config/source.schema.json +110 -0
- package/src/config/types.ts +97 -0
- package/src/config/validateConfig.tests.ts +46 -0
- package/src/config/validateConfig.ts +21 -0
- package/src/constants.ts +20 -0
- package/src/graph/GraphStore.tests.ts +157 -0
- package/src/graph/GraphStore.ts +200 -0
- package/src/graph/PrefixMap.tests.ts +129 -0
- package/src/graph/PrefixMap.ts +95 -0
- package/src/graph/buildUri.tests.ts +158 -0
- package/src/graph/buildUri.ts +69 -0
- package/src/graph/index.ts +4 -0
- package/src/graph/types.ts +20 -0
- package/src/providers/CodaProvider.tests.ts +241 -0
- package/src/providers/CodaProvider.ts +174 -0
- package/src/providers/CodaProvider.types.generated.ts +12236 -0
- package/src/providers/index.ts +18 -0
- package/src/serializers/JSONSerializer.tests.ts +79 -0
- package/src/serializers/JSONSerializer.ts +87 -0
- package/src/serializers/TTLSerializer.tests.ts +75 -0
- package/src/serializers/TTLSerializer.ts +99 -0
- package/src/serializers/index.ts +3 -0
- package/src/serializers/types.ts +16 -0
- package/src/transform/resolveReferences.tests.ts +63 -0
- package/src/transform/resolveReferences.ts +36 -0
- package/src/transform/resolveValue.tests.ts +76 -0
- package/src/transform/resolveValue.ts +87 -0
- package/src/transform/transform.tests.ts +99 -0
- package/src/transform/transform.ts +109 -0
- package/src/transform/transformRow.tests.ts +269 -0
- package/src/transform/transformRow.ts +220 -0
- package/src/transform/types.ts +26 -0
- package/tsconfig.json +8 -0
- package/vite.config.ts +11 -0
- package/vitest.config.ts +21 -0
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
# Design Auditor
|
|
2
|
+
|
|
3
|
+
Audit design system coverage, consistency, and quality. This semantic skill analyzes the ontology to find gaps, inconsistencies, and opportunities for improvement across components, patterns, and documentation.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- Reviewing design system health and completeness
|
|
8
|
+
- Finding components missing documentation or guidelines
|
|
9
|
+
- Identifying inconsistent modifier family usage
|
|
10
|
+
- Discovering orphaned or underutilized elements
|
|
11
|
+
- Preparing for design system roadmap planning
|
|
12
|
+
- Auditing before a major release
|
|
13
|
+
|
|
14
|
+
## Discovery Flow
|
|
15
|
+
|
|
16
|
+
Start with a broad inventory, then drill into specific concerns:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
sem_readme(package: "design-system")
|
|
20
|
+
→ Get overview of classes and counts
|
|
21
|
+
|
|
22
|
+
sem_lookup_batch(types: ["dso:Component", "dso:Pattern", "dso:Layout"])
|
|
23
|
+
→ Get full inventory across types
|
|
24
|
+
|
|
25
|
+
sem_sparql({quality queries})
|
|
26
|
+
→ Run specific audit queries
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Audit Dimensions
|
|
30
|
+
|
|
31
|
+
### 1. Coverage Audit
|
|
32
|
+
What's documented vs. what's missing?
|
|
33
|
+
|
|
34
|
+
### 2. Consistency Audit
|
|
35
|
+
Are similar components structured similarly?
|
|
36
|
+
|
|
37
|
+
### 3. Quality Audit
|
|
38
|
+
How complete is the documentation?
|
|
39
|
+
|
|
40
|
+
### 4. Usage Audit
|
|
41
|
+
What's connected vs. orphaned?
|
|
42
|
+
|
|
43
|
+
## Key Queries
|
|
44
|
+
|
|
45
|
+
### Coverage: Components by Tier
|
|
46
|
+
|
|
47
|
+
```sparql
|
|
48
|
+
PREFIX dso: <https://ds.canonical.com/ontology#>
|
|
49
|
+
|
|
50
|
+
SELECT ?tierName (COUNT(?c) as ?componentCount) WHERE {
|
|
51
|
+
?c a dso:Component ;
|
|
52
|
+
dso:tier ?tier .
|
|
53
|
+
?tier dso:name ?tierName .
|
|
54
|
+
} GROUP BY ?tierName
|
|
55
|
+
ORDER BY DESC(?componentCount)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Interpretation**: Identify tiers with few components - may indicate gaps or opportunities.
|
|
59
|
+
|
|
60
|
+
### Coverage: UIBlock Types Distribution
|
|
61
|
+
|
|
62
|
+
```sparql
|
|
63
|
+
PREFIX dso: <https://ds.canonical.com/ontology#>
|
|
64
|
+
|
|
65
|
+
SELECT ?type (COUNT(?block) as ?count) WHERE {
|
|
66
|
+
VALUES ?type { dso:Component dso:Pattern dso:Layout dso:Subcomponent }
|
|
67
|
+
?block a ?type .
|
|
68
|
+
} GROUP BY ?type
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Interpretation**: Healthy ratio is roughly 3:1:0.5 for Component:Pattern:Layout. Low pattern count may indicate missing UX documentation.
|
|
72
|
+
|
|
73
|
+
### Quality: Components Missing Descriptions
|
|
74
|
+
|
|
75
|
+
```sparql
|
|
76
|
+
PREFIX dso: <https://ds.canonical.com/ontology#>
|
|
77
|
+
|
|
78
|
+
SELECT ?component ?name WHERE {
|
|
79
|
+
?component a dso:Component ;
|
|
80
|
+
dso:name ?name .
|
|
81
|
+
FILTER(!bound(?desc) || ?desc = "")
|
|
82
|
+
OPTIONAL { ?component dso:description ?desc }
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Interpretation**: Components without descriptions are undocumented. High priority to fix.
|
|
87
|
+
|
|
88
|
+
### Quality: Components Missing Usage Guidance
|
|
89
|
+
|
|
90
|
+
```sparql
|
|
91
|
+
PREFIX dso: <https://ds.canonical.com/ontology#>
|
|
92
|
+
|
|
93
|
+
SELECT ?component ?name WHERE {
|
|
94
|
+
?component a dso:Component ;
|
|
95
|
+
dso:name ?name .
|
|
96
|
+
FILTER NOT EXISTS { ?component dso:whenToUse ?when }
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Interpretation**: `whenToUse` is critical for adoption. Missing guidance means designers don't know when to apply the component.
|
|
101
|
+
|
|
102
|
+
### Quality: Components Missing Guidelines
|
|
103
|
+
|
|
104
|
+
```sparql
|
|
105
|
+
PREFIX dso: <https://ds.canonical.com/ontology#>
|
|
106
|
+
|
|
107
|
+
SELECT ?component ?name WHERE {
|
|
108
|
+
?component a dso:Component ;
|
|
109
|
+
dso:name ?name .
|
|
110
|
+
FILTER NOT EXISTS { ?component dso:guidelines ?g }
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Consistency: Modifier Family Usage
|
|
115
|
+
|
|
116
|
+
```sparql
|
|
117
|
+
PREFIX dso: <https://ds.canonical.com/ontology#>
|
|
118
|
+
|
|
119
|
+
SELECT ?family ?familyName (COUNT(?component) as ?usage) WHERE {
|
|
120
|
+
?family a dso:ModifierFamily ;
|
|
121
|
+
dso:name ?familyName .
|
|
122
|
+
OPTIONAL {
|
|
123
|
+
?component a dso:Component ;
|
|
124
|
+
dso:hasModifierFamily ?family .
|
|
125
|
+
}
|
|
126
|
+
} GROUP BY ?family ?familyName
|
|
127
|
+
ORDER BY DESC(?usage)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Interpretation**: Modifier families with 0 usage may be unused or missing adoption. Families with very high usage are core to the system.
|
|
131
|
+
|
|
132
|
+
### Consistency: Components Without Modifier Families
|
|
133
|
+
|
|
134
|
+
```sparql
|
|
135
|
+
PREFIX dso: <https://ds.canonical.com/ontology#>
|
|
136
|
+
|
|
137
|
+
SELECT ?component ?name WHERE {
|
|
138
|
+
?component a dso:Component ;
|
|
139
|
+
dso:name ?name .
|
|
140
|
+
FILTER NOT EXISTS { ?component dso:hasModifierFamily ?mf }
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Interpretation**: Not all components need modifiers, but many do. Review whether these components should have variants.
|
|
145
|
+
|
|
146
|
+
### Usage: Orphaned Subcomponents
|
|
147
|
+
|
|
148
|
+
```sparql
|
|
149
|
+
PREFIX dso: <https://ds.canonical.com/ontology#>
|
|
150
|
+
|
|
151
|
+
SELECT ?sub ?name WHERE {
|
|
152
|
+
?sub a dso:Subcomponent ;
|
|
153
|
+
dso:name ?name .
|
|
154
|
+
FILTER NOT EXISTS { ?sub dso:parentComponent ?parent }
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Interpretation**: Subcomponents without parents are orphaned - either fix the relationship or promote to Component.
|
|
159
|
+
|
|
160
|
+
### Usage: Components With Subcomponents
|
|
161
|
+
|
|
162
|
+
```sparql
|
|
163
|
+
PREFIX dso: <https://ds.canonical.com/ontology#>
|
|
164
|
+
|
|
165
|
+
SELECT ?component ?componentName (COUNT(?sub) as ?subCount) WHERE {
|
|
166
|
+
?component a dso:Component ;
|
|
167
|
+
dso:name ?componentName .
|
|
168
|
+
?sub dso:parentComponent ?component .
|
|
169
|
+
} GROUP BY ?component ?componentName
|
|
170
|
+
ORDER BY DESC(?subCount)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Interpretation**: Complex components have more subcomponents. Very high counts may indicate over-decomposition.
|
|
174
|
+
|
|
175
|
+
### Cross-Tier: Potential Promotion Candidates
|
|
176
|
+
|
|
177
|
+
```sparql
|
|
178
|
+
PREFIX dso: <https://ds.canonical.com/ontology#>
|
|
179
|
+
|
|
180
|
+
SELECT ?component ?name ?tierName WHERE {
|
|
181
|
+
?component a dso:Component ;
|
|
182
|
+
dso:name ?name ;
|
|
183
|
+
dso:tier ?tier .
|
|
184
|
+
?tier dso:name ?tierName .
|
|
185
|
+
|
|
186
|
+
# Find non-global components that might be universal
|
|
187
|
+
FILTER(?tier != <https://ds.canonical.com/data/global>)
|
|
188
|
+
|
|
189
|
+
# Heuristic: has modifier families (suggests maturity)
|
|
190
|
+
FILTER EXISTS { ?component dso:hasModifierFamily ?mf }
|
|
191
|
+
FILTER EXISTS { ?component dso:description ?d }
|
|
192
|
+
FILTER EXISTS { ?component dso:whenToUse ?w }
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Interpretation**: Well-documented tier-specific components may be candidates for promotion to global.
|
|
197
|
+
|
|
198
|
+
## Audit Report Template
|
|
199
|
+
|
|
200
|
+
```markdown
|
|
201
|
+
## Design System Audit Report
|
|
202
|
+
|
|
203
|
+
**Generated:** {date}
|
|
204
|
+
**Package:** design-system
|
|
205
|
+
**Version:** {version}
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
### Executive Summary
|
|
210
|
+
|
|
211
|
+
| Metric | Count | Health |
|
|
212
|
+
|--------|-------|--------|
|
|
213
|
+
| Components | {n} | {status} |
|
|
214
|
+
| Patterns | {n} | {status} |
|
|
215
|
+
| Layouts | {n} | {status} |
|
|
216
|
+
| Subcomponents | {n} | {status} |
|
|
217
|
+
| Modifier Families | {n} | {status} |
|
|
218
|
+
| Documentation Coverage | {%} | {status} |
|
|
219
|
+
|
|
220
|
+
**Overall Health:** {Good/Needs Attention/Critical}
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
### Coverage Analysis
|
|
225
|
+
|
|
226
|
+
#### By Tier
|
|
227
|
+
|
|
228
|
+
| Tier | Components | Patterns | Layouts |
|
|
229
|
+
|------|------------|----------|---------|
|
|
230
|
+
| global | {n} | {n} | {n} |
|
|
231
|
+
| apps | {n} | {n} | {n} |
|
|
232
|
+
| site | {n} | {n} | {n} |
|
|
233
|
+
| ... | ... | ... | ... |
|
|
234
|
+
|
|
235
|
+
**Observations:**
|
|
236
|
+
- {observation 1}
|
|
237
|
+
- {observation 2}
|
|
238
|
+
|
|
239
|
+
**Recommendations:**
|
|
240
|
+
- {recommendation 1}
|
|
241
|
+
- {recommendation 2}
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
### Quality Analysis
|
|
246
|
+
|
|
247
|
+
#### Documentation Completeness
|
|
248
|
+
|
|
249
|
+
| Property | Present | Missing | Coverage |
|
|
250
|
+
|----------|---------|---------|----------|
|
|
251
|
+
| description | {n} | {n} | {%} |
|
|
252
|
+
| whenToUse | {n} | {n} | {%} |
|
|
253
|
+
| whenNotToUse | {n} | {n} | {%} |
|
|
254
|
+
| guidelines | {n} | {n} | {%} |
|
|
255
|
+
| figmaLink | {n} | {n} | {%} |
|
|
256
|
+
|
|
257
|
+
**Components Needing Attention:**
|
|
258
|
+
1. {component}: missing {properties}
|
|
259
|
+
2. {component}: missing {properties}
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
### Consistency Analysis
|
|
264
|
+
|
|
265
|
+
#### Modifier Family Usage
|
|
266
|
+
|
|
267
|
+
| Family | Components Using | Coverage |
|
|
268
|
+
|--------|-----------------|----------|
|
|
269
|
+
| importance | {n} | {assessment} |
|
|
270
|
+
| criticality | {n} | {assessment} |
|
|
271
|
+
| density | {n} | {assessment} |
|
|
272
|
+
| ... | ... | ... |
|
|
273
|
+
|
|
274
|
+
**Inconsistencies Found:**
|
|
275
|
+
- {inconsistency 1}
|
|
276
|
+
- {inconsistency 2}
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
### Structural Analysis
|
|
281
|
+
|
|
282
|
+
#### Component Composition
|
|
283
|
+
|
|
284
|
+
| Component | Subcomponents | Assessment |
|
|
285
|
+
|-----------|---------------|------------|
|
|
286
|
+
| {name} | {n} | {assessment} |
|
|
287
|
+
|
|
288
|
+
**Orphaned Elements:**
|
|
289
|
+
- {list of orphaned subcomponents}
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
### Recommendations
|
|
294
|
+
|
|
295
|
+
#### High Priority
|
|
296
|
+
1. {action item with specific components}
|
|
297
|
+
2. {action item}
|
|
298
|
+
|
|
299
|
+
#### Medium Priority
|
|
300
|
+
1. {action item}
|
|
301
|
+
2. {action item}
|
|
302
|
+
|
|
303
|
+
#### Low Priority / Nice to Have
|
|
304
|
+
1. {action item}
|
|
305
|
+
2. {action item}
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
### Appendix: Raw Data
|
|
310
|
+
|
|
311
|
+
<details>
|
|
312
|
+
<summary>Components Missing Documentation</summary>
|
|
313
|
+
|
|
314
|
+
{list}
|
|
315
|
+
|
|
316
|
+
</details>
|
|
317
|
+
|
|
318
|
+
<details>
|
|
319
|
+
<summary>Unused Modifier Families</summary>
|
|
320
|
+
|
|
321
|
+
{list}
|
|
322
|
+
|
|
323
|
+
</details>
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## Workflow
|
|
327
|
+
|
|
328
|
+
### Quick Health Check
|
|
329
|
+
|
|
330
|
+
For a rapid assessment:
|
|
331
|
+
|
|
332
|
+
```
|
|
333
|
+
1. sem_readme(package: "design-system")
|
|
334
|
+
→ Check class counts
|
|
335
|
+
|
|
336
|
+
2. Run "Components Missing Descriptions" query
|
|
337
|
+
→ If > 20% missing, flag as concern
|
|
338
|
+
|
|
339
|
+
3. Run "Modifier Family Usage" query
|
|
340
|
+
→ If any family has 0 usage, investigate
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### Full Audit
|
|
344
|
+
|
|
345
|
+
For comprehensive review:
|
|
346
|
+
|
|
347
|
+
```
|
|
348
|
+
1. Inventory
|
|
349
|
+
sem_lookup_batch(types: ["dso:Component", "dso:Pattern", "dso:Layout", "dso:Subcomponent"])
|
|
350
|
+
|
|
351
|
+
2. Coverage queries (all)
|
|
352
|
+
|
|
353
|
+
3. Quality queries (all)
|
|
354
|
+
|
|
355
|
+
4. Consistency queries (all)
|
|
356
|
+
|
|
357
|
+
5. Usage queries (all)
|
|
358
|
+
|
|
359
|
+
6. Generate report using template
|
|
360
|
+
|
|
361
|
+
7. Prioritize recommendations
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Targeted Audit
|
|
365
|
+
|
|
366
|
+
For specific concerns:
|
|
367
|
+
|
|
368
|
+
| Concern | Queries to Run |
|
|
369
|
+
|---------|----------------|
|
|
370
|
+
| "Are we missing patterns?" | Coverage by tier, Component:Pattern ratio |
|
|
371
|
+
| "Is documentation complete?" | All Quality queries |
|
|
372
|
+
| "Are modifiers consistent?" | Modifier Family Usage, Components Without Modifiers |
|
|
373
|
+
| "Any orphaned elements?" | Orphaned Subcomponents |
|
|
374
|
+
| "What needs promotion?" | Promotion Candidates |
|
|
375
|
+
|
|
376
|
+
## Interpreting Results
|
|
377
|
+
|
|
378
|
+
### Health Indicators
|
|
379
|
+
|
|
380
|
+
| Metric | Good | Warning | Critical |
|
|
381
|
+
|--------|------|---------|----------|
|
|
382
|
+
| Description coverage | >90% | 70-90% | <70% |
|
|
383
|
+
| whenToUse coverage | >80% | 60-80% | <60% |
|
|
384
|
+
| Orphaned elements | 0 | 1-3 | >3 |
|
|
385
|
+
| Unused modifier families | 0-1 | 2-3 | >3 |
|
|
386
|
+
| Component:Pattern ratio | 2:1 to 4:1 | 5:1 to 7:1 | >7:1 |
|
|
387
|
+
|
|
388
|
+
### Common Issues and Fixes
|
|
389
|
+
|
|
390
|
+
| Issue | Likely Cause | Recommended Action |
|
|
391
|
+
|-------|--------------|-------------------|
|
|
392
|
+
| Many components missing descriptions | Rapid growth without documentation | Documentation sprint |
|
|
393
|
+
| Low pattern count | Focus on components over UX | Pattern extraction workshop |
|
|
394
|
+
| Unused modifier families | Premature abstraction | Remove or document intended use |
|
|
395
|
+
| Orphaned subcomponents | Refactoring without cleanup | Link to parents or promote |
|
|
396
|
+
| Tier imbalance | Organic growth | Review tier definitions |
|
|
397
|
+
|
|
398
|
+
## Following next_steps
|
|
399
|
+
|
|
400
|
+
After running queries, sem tools provide contextual guidance:
|
|
401
|
+
|
|
402
|
+
```json
|
|
403
|
+
{
|
|
404
|
+
"results": [...],
|
|
405
|
+
"next_steps": [
|
|
406
|
+
"Use sem_context on specific components to understand relationships",
|
|
407
|
+
"Use sem_describe to see full property definitions"
|
|
408
|
+
]
|
|
409
|
+
}
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
Follow these to drill deeper into specific findings.
|
|
413
|
+
|
|
414
|
+
## Tips
|
|
415
|
+
|
|
416
|
+
1. **Start with sem_readme**: Get the big picture before diving into queries
|
|
417
|
+
2. **Run all coverage queries first**: Establishes baseline
|
|
418
|
+
3. **Don't fix everything at once**: Prioritize by impact
|
|
419
|
+
4. **Track metrics over time**: Run audits regularly to measure improvement
|
|
420
|
+
5. **Share reports with stakeholders**: Visibility drives improvement
|
|
421
|
+
6. **Automate recurring audits**: Consider scheduling monthly checks
|
|
422
|
+
|
|
423
|
+
## Limitations
|
|
424
|
+
|
|
425
|
+
- Cannot assess visual design quality (only metadata)
|
|
426
|
+
- Cannot verify Figma link validity (only presence)
|
|
427
|
+
- Pattern quality is subjective (coverage is objective)
|
|
428
|
+
- Does not analyze implementation libraries (ImplementationObject)
|
package/source.json
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./src/config/source.schema.json",
|
|
3
|
+
"document": "NyzE_TLZDh",
|
|
4
|
+
"provider": "coda",
|
|
5
|
+
"extract": {
|
|
6
|
+
"output": "tmp/extract.json",
|
|
7
|
+
"tables": {
|
|
8
|
+
"uiBlocks": "grid-20dWwIHYhx",
|
|
9
|
+
"uiBlockTypes": "grid-bahkR65Cvp",
|
|
10
|
+
"tiers": "grid-KdW0T6RE3B",
|
|
11
|
+
"modifierFamilies": "grid-2diO06C-8N",
|
|
12
|
+
"modifiers": "grid-aygAVqOfFj",
|
|
13
|
+
"properties": "grid-20chnVyhaz"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"transform": {
|
|
17
|
+
"format": "ttl",
|
|
18
|
+
"outputDir": "data/",
|
|
19
|
+
"atomicity": "instance",
|
|
20
|
+
"cleanupExtract": false,
|
|
21
|
+
"tables": {
|
|
22
|
+
"uiBlocks": {
|
|
23
|
+
"@context": {
|
|
24
|
+
"dso": "https://ds.canonical.com/ontology#",
|
|
25
|
+
"ds": "https://ds.canonical.com/data/",
|
|
26
|
+
"name": "dso:name",
|
|
27
|
+
"description": "dso:description",
|
|
28
|
+
"anatomy_dsl": "dso:anatomyDsl",
|
|
29
|
+
"Anatomy (classic)": "dso:anatomyClassic",
|
|
30
|
+
"tier": { "@id": "dso:tier", "@type": "@id" },
|
|
31
|
+
"properties": {
|
|
32
|
+
"@id": "dso:hasProperty",
|
|
33
|
+
"@inline": {
|
|
34
|
+
"table": "properties",
|
|
35
|
+
"class": "dso:Property",
|
|
36
|
+
"properties": {
|
|
37
|
+
"property name": "dso:name",
|
|
38
|
+
"type": "dso:propertyType",
|
|
39
|
+
"description": "dso:description",
|
|
40
|
+
"optional": "dso:optional",
|
|
41
|
+
"default": "dso:defaultValue"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"modifier_families": { "@id": "dso:hasModifierFamily", "@type": "@id", "@container": "@set" }
|
|
46
|
+
},
|
|
47
|
+
"class": "{type}",
|
|
48
|
+
"uriTemplate": "{uri}"
|
|
49
|
+
},
|
|
50
|
+
"tiers": {
|
|
51
|
+
"@context": {
|
|
52
|
+
"dso": "https://ds.canonical.com/ontology#",
|
|
53
|
+
"ds": "https://ds.canonical.com/data/",
|
|
54
|
+
"name": "dso:name"
|
|
55
|
+
},
|
|
56
|
+
"class": "dso:Tier",
|
|
57
|
+
"uriTemplate": "{uri}"
|
|
58
|
+
},
|
|
59
|
+
"modifierFamilies": {
|
|
60
|
+
"@context": {
|
|
61
|
+
"dso": "https://ds.canonical.com/ontology#",
|
|
62
|
+
"ds": "https://ds.canonical.com/data/",
|
|
63
|
+
"name": "dso:name",
|
|
64
|
+
"description": "dso:description",
|
|
65
|
+
"tier": { "@id": "dso:tier", "@type": "@id" }
|
|
66
|
+
},
|
|
67
|
+
"class": "dso:ModifierFamily",
|
|
68
|
+
"uriTemplate": "{uri}"
|
|
69
|
+
},
|
|
70
|
+
"modifiers": {
|
|
71
|
+
"@context": {
|
|
72
|
+
"dso": "https://ds.canonical.com/ontology#",
|
|
73
|
+
"ds": "https://ds.canonical.com/data/",
|
|
74
|
+
"name": "dso:name",
|
|
75
|
+
"description": "dso:description",
|
|
76
|
+
"family": { "@id": "dso:modifierFamily", "@type": "@id" }
|
|
77
|
+
},
|
|
78
|
+
"class": "dso:Modifier",
|
|
79
|
+
"uriTemplate": "{uri}"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"references": {
|
|
83
|
+
"uiBlockTypes": {
|
|
84
|
+
"uriTemplate": "dso:{name}",
|
|
85
|
+
"keyColumn": "name"
|
|
86
|
+
},
|
|
87
|
+
"tiers": {
|
|
88
|
+
"uriTemplate": "{uri}",
|
|
89
|
+
"keyColumn": "name"
|
|
90
|
+
},
|
|
91
|
+
"modifierFamilies": {
|
|
92
|
+
"uriTemplate": "{uri}",
|
|
93
|
+
"keyColumn": "name"
|
|
94
|
+
},
|
|
95
|
+
"modifiers": {
|
|
96
|
+
"uriTemplate": "{uri}",
|
|
97
|
+
"keyColumn": "name"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
package/src/cli.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { validateConfig } from "./config/index.js";
|
|
4
|
+
import { list, extract, transform } from "./commands/index.js";
|
|
5
|
+
|
|
6
|
+
const COMMANDS = ["list", "extract", "transform"] as const;
|
|
7
|
+
type Command = (typeof COMMANDS)[number];
|
|
8
|
+
|
|
9
|
+
async function main(): Promise<void> {
|
|
10
|
+
const args = process.argv.slice(2);
|
|
11
|
+
|
|
12
|
+
if (args.length < 2) {
|
|
13
|
+
console.log("Usage: bun src/cli.ts <command> <config.json>");
|
|
14
|
+
console.log("Commands: list, extract, transform");
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const [command, configPath] = args as [Command, string];
|
|
19
|
+
|
|
20
|
+
if (!COMMANDS.includes(command)) {
|
|
21
|
+
console.error(`Unknown command: ${command}`);
|
|
22
|
+
console.log(`Available commands: ${COMMANDS.join(", ")}`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const content = await readFile(configPath, "utf-8");
|
|
27
|
+
const config = validateConfig(JSON.parse(content));
|
|
28
|
+
|
|
29
|
+
switch (command) {
|
|
30
|
+
case "list":
|
|
31
|
+
await list(config);
|
|
32
|
+
break;
|
|
33
|
+
case "extract":
|
|
34
|
+
await extract(config);
|
|
35
|
+
break;
|
|
36
|
+
case "transform":
|
|
37
|
+
await transform(config);
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
main().catch((err) => {
|
|
43
|
+
console.error("Error:", err.message);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
});
|