@canonical/pragma-cli 0.18.0 → 0.21.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/LICENSE +166 -0
- package/dist/pragma +0 -0
- package/package.json +31 -18
- package/src/constants.ts +1 -1
- package/src/domains/block/blockConfig.ts +47 -3
- package/src/domains/block/commands/list.test.ts +1 -1
- package/src/domains/block/commands/list.ts +27 -0
- package/src/domains/block/commands/lookup.ts +26 -52
- package/src/domains/block/formatters/index.ts +1 -1
- package/src/domains/block/formatters/list.test.ts +1 -1
- package/src/domains/block/formatters/list.ts +28 -42
- package/src/domains/block/formatters/lookup.test.ts +3 -2
- package/src/domains/block/formatters/lookup.ts +91 -296
- package/src/domains/block/formatters/types.ts +1 -1
- package/src/domains/block/operations/list.test.ts +1 -1
- package/src/domains/block/operations/list.ts +1 -1
- package/src/domains/block/operations/lookup.test.ts +29 -8
- package/src/domains/block/operations/lookup.ts +94 -16
- package/src/domains/block/orchestration/blockEmptyError.ts +1 -1
- package/src/domains/block/orchestration/buildBlockFilters.ts +1 -1
- package/src/domains/block/orchestration/enrichBlocks.ts +6 -2
- package/src/domains/block/orchestration/resolveBlockList.ts +1 -1
- package/src/domains/block/orchestration/resolveBlockLookup.ts +8 -2
- package/src/domains/block/types.ts +1 -1
- package/src/domains/config/commands/channel.ts +6 -4
- package/src/domains/config/commands/tier.ts +6 -4
- package/src/domains/config/mcp/specs.ts +18 -6
- package/src/domains/config/operations/validateTier.ts +1 -1
- package/src/domains/config/tasks/index.ts +3 -0
- package/src/domains/config/tasks/setChannel.ts +30 -0
- package/src/domains/config/tasks/setTier.ts +33 -0
- package/src/domains/create/commands/package.test.ts +2 -2
- package/src/domains/doctor/mcp/index.ts +1 -1
- package/src/domains/doctor/mcp/specs.ts +2 -49
- package/src/domains/graph/commands/inspect.test.ts +1 -1
- package/src/domains/graph/formatters/inspect.ts +12 -7
- package/src/domains/graph/operations/inspectUri.ts +4 -1
- package/src/domains/info/commands/upgrade.ts +6 -3
- package/src/domains/info/index.ts +3 -1
- package/src/domains/info/mcp/index.ts +2 -0
- package/src/domains/info/mcp/specs.ts +65 -0
- package/src/domains/llm/data/commandReference.ts +4 -4
- package/src/domains/llm/data/decisionTrees.ts +14 -12
- package/src/domains/llm/operations/collectContext.ts +1 -1
- package/src/domains/modifier/commands/list.ts +9 -0
- package/src/domains/modifier/commands/lookup.ts +22 -42
- package/src/domains/modifier/formatters/index.ts +4 -1
- package/src/domains/modifier/formatters/list.test.ts +1 -1
- package/src/domains/modifier/formatters/list.ts +13 -26
- package/src/domains/modifier/formatters/lookup.test.ts +1 -1
- package/src/domains/modifier/formatters/lookup.ts +41 -29
- package/src/domains/modifier/index.ts +1 -0
- package/src/domains/modifier/modifierConfig.ts +36 -0
- package/src/domains/modifier/operations/list.ts +1 -1
- package/src/domains/modifier/operations/lookup.ts +4 -3
- package/src/domains/modifier/orchestration/resolveModifierLookup.ts +1 -1
- package/src/domains/modifier/types.ts +1 -1
- package/src/domains/ontology/commands/list.test.ts +1 -1
- package/src/domains/ontology/commands/list.ts +18 -0
- package/src/domains/ontology/commands/show.test.ts +1 -1
- package/src/domains/ontology/formatters/list.ts +5 -3
- package/src/domains/ontology/formatters/show.ts +38 -13
- package/src/domains/ontology/helpers/queryClasses.ts +1 -1
- package/src/domains/ontology/helpers/queryProperties.ts +1 -1
- package/src/domains/ontology/operations/listOntologies.ts +1 -1
- package/src/domains/ontology/operations/showOntology.ts +1 -1
- package/src/domains/setup/helpers/completionScripts.test.ts +3 -3
- package/src/domains/setup/helpers/completionScripts.ts +4 -4
- package/src/domains/shared/ToolSpec.ts +1 -1
- package/src/domains/shared/context.ts +3 -2
- package/src/domains/shared/contracts.ts +40 -1
- package/src/domains/shared/filters/buildFilterConfig.ts +1 -2
- package/src/domains/shared/filters/buildFilters.ts +1 -1
- package/src/domains/shared/filters/describeFilters.ts +1 -1
- package/src/domains/shared/formatters.ts +47 -0
- package/src/domains/shared/renderers.ts +410 -0
- package/src/domains/shared/runtime.ts +7 -22
- package/src/domains/shared/types/block.ts +107 -0
- package/src/domains/shared/types/common.ts +33 -0
- package/src/domains/shared/types/graph.ts +17 -0
- package/src/domains/shared/types/index.ts +49 -0
- package/src/domains/shared/types/modifier.ts +22 -0
- package/src/domains/shared/types/ontology.ts +50 -0
- package/src/domains/shared/types/runtime.ts +21 -0
- package/src/domains/shared/types/standard.ts +64 -0
- package/src/domains/shared/types/tier.ts +15 -0
- package/src/domains/shared/types/token.ts +30 -0
- package/src/domains/standard/commands/list.ts +9 -0
- package/src/domains/standard/commands/lookup.ts +22 -50
- package/src/domains/standard/formatters/categories.test.ts +1 -1
- package/src/domains/standard/formatters/categories.ts +1 -1
- package/src/domains/standard/formatters/index.ts +4 -1
- package/src/domains/standard/formatters/list.test.ts +4 -1
- package/src/domains/standard/formatters/list.ts +112 -84
- package/src/domains/standard/formatters/lookup.test.ts +1 -1
- package/src/domains/standard/formatters/lookup.ts +85 -70
- package/src/domains/standard/formatters/types.ts +1 -1
- package/src/domains/standard/index.ts +1 -0
- package/src/domains/standard/operations/categories.ts +1 -1
- package/src/domains/standard/operations/list.ts +1 -1
- package/src/domains/standard/operations/lookup.ts +1 -1
- package/src/domains/standard/orchestration/buildStandardFilters.ts +1 -1
- package/src/domains/standard/orchestration/resolveStandardList.ts +4 -1
- package/src/domains/standard/orchestration/resolveStandardLookup.ts +1 -1
- package/src/domains/standard/orchestration/standardEmptyError.ts +1 -1
- package/src/domains/standard/standardConfig.ts +42 -0
- package/src/domains/standard/types.ts +1 -1
- package/src/domains/tier/commands/list.ts +16 -0
- package/src/domains/tier/formatters/list.test.ts +1 -1
- package/src/domains/tier/formatters/list.ts +11 -6
- package/src/domains/tier/operations/list.ts +1 -1
- package/src/domains/token/commands/list.ts +9 -0
- package/src/domains/token/commands/lookup.ts +22 -48
- package/src/domains/token/formatters/index.ts +4 -1
- package/src/domains/token/formatters/list.test.ts +1 -1
- package/src/domains/token/formatters/list.ts +15 -28
- package/src/domains/token/formatters/lookup.test.ts +2 -2
- package/src/domains/token/formatters/lookup.ts +80 -45
- package/src/domains/token/index.ts +1 -0
- package/src/domains/token/operations/list.ts +1 -1
- package/src/domains/token/operations/lookup.ts +1 -1
- package/src/domains/token/orchestration/resolveTokenLookup.ts +1 -1
- package/src/domains/token/tokenConfig.ts +38 -0
- package/src/domains/token/types.ts +1 -1
- package/src/index.ts +1 -1
- package/src/mcp/runMcpServer.test.ts +2 -2
- package/src/mcp/tools/index.ts +2 -0
- package/src/mcp/tools/registerTools.test.ts +8 -3
- package/src/package-manager/types.ts +1 -3
- package/src/pipeline/createProgram.ts +20 -1
- package/src/pipeline/index.ts +4 -1
- package/src/pipeline/parseGlobalFlags.test.ts +92 -0
- package/src/pipeline/parseGlobalFlags.ts +25 -0
- package/src/pipeline/runCli.orchestration.test.ts +1 -0
- package/src/pipeline/runCli.ts +11 -4
- package/src/pipeline/runInteractiveCommand.ts +198 -0
- package/src/testing/cli.ts +2 -2
- package/src/testing/fixtures.ts +2 -2
- package/src/testing/integration/boot.test.ts +2 -2
- package/src/testing/integration/cli-user-stories.test.ts +198 -0
- package/src/testing/integration/edge-cases.test.ts +263 -0
- package/src/testing/integration/parity.test.ts +377 -27
- package/src/testing/store.ts +1 -1
- package/src/tui/components/BulletList/BulletList.tsx +46 -0
- package/src/tui/components/BulletList/index.ts +2 -0
- package/src/tui/components/BulletList/types.ts +6 -0
- package/src/tui/components/Card/Card.tsx +73 -0
- package/src/tui/components/Card/index.ts +1 -0
- package/src/tui/components/Card/types.ts +12 -0
- package/src/tui/components/CodeBlock/CodeBlock.tsx +37 -0
- package/src/tui/components/CodeBlock/index.ts +2 -0
- package/src/tui/components/CodeBlock/types.ts +6 -0
- package/src/tui/components/DataRow/DataRow.tsx +80 -0
- package/src/tui/components/DataRow/index.ts +2 -0
- package/src/tui/components/DataRow/types.ts +14 -0
- package/src/tui/components/FieldRow/FieldRow.tsx +24 -0
- package/src/tui/components/FieldRow/index.ts +2 -0
- package/src/tui/components/FieldRow/types.ts +10 -0
- package/src/tui/components/HeaderRow/HeaderRow.tsx +32 -0
- package/src/tui/components/HeaderRow/index.ts +2 -0
- package/src/tui/components/HeaderRow/types.ts +8 -0
- package/src/tui/components/MarkdownText/MarkdownText.tsx +19 -0
- package/src/tui/components/MarkdownText/index.ts +2 -0
- package/src/tui/components/MarkdownText/types.ts +4 -0
- package/src/tui/components/MiniTable/MiniTable.tsx +82 -0
- package/src/tui/components/MiniTable/index.ts +2 -0
- package/src/tui/components/MiniTable/types.ts +6 -0
- package/src/tui/components/SectionRenderer/SectionRenderer.tsx +91 -0
- package/src/tui/components/SectionRenderer/index.ts +2 -0
- package/src/tui/components/SectionRenderer/types.ts +15 -0
- package/src/tui/components/TreeView/TreeView.tsx +84 -0
- package/src/tui/components/TreeView/index.ts +2 -0
- package/src/tui/components/TreeView/types.ts +6 -0
- package/src/tui/components/index.ts +19 -0
- package/src/tui/constants.ts +39 -0
- package/src/tui/createListView.ts +23 -0
- package/src/tui/createLookupView.ts +26 -0
- package/src/tui/helpers/computeWidths.ts +53 -0
- package/src/tui/helpers/fitColumns.ts +33 -0
- package/src/tui/helpers/formatMarkdown.ts +19 -0
- package/src/tui/helpers/getTerminalSize.ts +16 -0
- package/src/tui/helpers/index.ts +6 -0
- package/src/tui/helpers/syntaxColor.ts +67 -0
- package/src/tui/helpers/truncateText.ts +12 -0
- package/src/tui/hooks/index.ts +3 -0
- package/src/tui/hooks/types.ts +7 -0
- package/src/tui/hooks/useAutoExit.ts +17 -0
- package/src/tui/hooks/useTerminalSize.ts +19 -0
- package/src/tui/index.ts +15 -0
- package/src/tui/renderInk.tsx +18 -0
- package/src/tui/types.ts +12 -0
- package/src/tui/views/ListView/ListView.tsx +104 -0
- package/src/tui/views/ListView/index.ts +2 -0
- package/src/tui/views/ListView/types.ts +14 -0
- package/src/tui/views/LookupView/LookupView.tsx +244 -0
- package/src/tui/views/LookupView/index.ts +2 -0
- package/src/tui/views/LookupView/types.ts +16 -0
- package/src/tui/views/index.ts +4 -0
- package/src/domains/shared/types.test-d.ts +0 -127
- package/src/domains/shared/types.ts +0 -348
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { RenderLookupOptions } from "../../../domains/shared/contracts.js";
|
|
2
|
+
|
|
3
|
+
export interface LookupViewProps<T> {
|
|
4
|
+
/** Lookup results to render as stacked cards. */
|
|
5
|
+
readonly results: readonly T[];
|
|
6
|
+
/** Lookup errors to display after result cards. */
|
|
7
|
+
readonly errors: readonly {
|
|
8
|
+
readonly query: string;
|
|
9
|
+
readonly code: string;
|
|
10
|
+
readonly message: string;
|
|
11
|
+
}[];
|
|
12
|
+
/** Lookup rendering options (title, fields, sections, overrides). */
|
|
13
|
+
readonly options: RenderLookupOptions<T>;
|
|
14
|
+
/** Domain name for card coloring. */
|
|
15
|
+
readonly domain: string;
|
|
16
|
+
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compile-time type tests.
|
|
3
|
-
*
|
|
4
|
-
* Asserts that shared operation return types match their contracts.
|
|
5
|
-
* Checked by `tsc --noEmit`, not executed at runtime.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { Store, URI } from "@canonical/ke";
|
|
9
|
-
import { expectTypeOf } from "expect-type";
|
|
10
|
-
import { listBlocks, lookupBlock } from "../block/operations/index.js";
|
|
11
|
-
import { listModifiers, lookupModifier } from "../modifier/operations/index.js";
|
|
12
|
-
import {
|
|
13
|
-
listCategories,
|
|
14
|
-
listStandards,
|
|
15
|
-
lookupStandard,
|
|
16
|
-
} from "../standard/operations/index.js";
|
|
17
|
-
import { listTiers } from "../tier/operations/index.js";
|
|
18
|
-
import { listTokens, lookupToken } from "../token/operations/index.js";
|
|
19
|
-
import type {
|
|
20
|
-
AnatomyNode,
|
|
21
|
-
AnatomyTree,
|
|
22
|
-
BlockDetailed,
|
|
23
|
-
BlockDigest,
|
|
24
|
-
BlockSummary,
|
|
25
|
-
CategorySummary,
|
|
26
|
-
CodeBlock,
|
|
27
|
-
FilterConfig,
|
|
28
|
-
ModifierFamily,
|
|
29
|
-
StandardDetailed,
|
|
30
|
-
StandardRef,
|
|
31
|
-
StandardSummary,
|
|
32
|
-
TierEntry,
|
|
33
|
-
TokenDetailed,
|
|
34
|
-
TokenRef,
|
|
35
|
-
TokenSummary,
|
|
36
|
-
} from "./types.js";
|
|
37
|
-
|
|
38
|
-
// =============================================================================
|
|
39
|
-
// Type structure assertions
|
|
40
|
-
// =============================================================================
|
|
41
|
-
|
|
42
|
-
// BlockSummary
|
|
43
|
-
expectTypeOf<BlockSummary["uri"]>().toEqualTypeOf<URI>();
|
|
44
|
-
expectTypeOf<BlockSummary["name"]>().toBeString();
|
|
45
|
-
expectTypeOf<BlockSummary["type"]>().toEqualTypeOf<
|
|
46
|
-
"component" | "pattern" | "layout" | "subcomponent"
|
|
47
|
-
>();
|
|
48
|
-
expectTypeOf<BlockSummary["tier"]>().toBeString();
|
|
49
|
-
expectTypeOf<BlockSummary["modifiers"]>().toEqualTypeOf<readonly string[]>();
|
|
50
|
-
expectTypeOf<BlockSummary["nodeCount"]>().toBeNumber();
|
|
51
|
-
expectTypeOf<BlockSummary["tokenCount"]>().toBeNumber();
|
|
52
|
-
|
|
53
|
-
// BlockDigest extends BlockSummary
|
|
54
|
-
expectTypeOf<BlockDigest>().toMatchTypeOf<BlockSummary>();
|
|
55
|
-
expectTypeOf<BlockDigest["summary"]>().toEqualTypeOf<string | null>();
|
|
56
|
-
|
|
57
|
-
// BlockDetailed extends BlockSummary
|
|
58
|
-
expectTypeOf<BlockDetailed>().toMatchTypeOf<BlockDigest>();
|
|
59
|
-
expectTypeOf<BlockDetailed["anatomy"]>().toEqualTypeOf<AnatomyTree | null>();
|
|
60
|
-
expectTypeOf<BlockDetailed["tokens"]>().toEqualTypeOf<readonly TokenRef[]>();
|
|
61
|
-
expectTypeOf<BlockDetailed["standards"]>().toEqualTypeOf<
|
|
62
|
-
readonly StandardRef[]
|
|
63
|
-
>();
|
|
64
|
-
|
|
65
|
-
// AnatomyNode
|
|
66
|
-
expectTypeOf<AnatomyNode["type"]>().toEqualTypeOf<"named" | "anonymous">();
|
|
67
|
-
expectTypeOf<AnatomyNode["children"]>().toEqualTypeOf<readonly AnatomyNode[]>();
|
|
68
|
-
|
|
69
|
-
// StandardSummary
|
|
70
|
-
expectTypeOf<StandardSummary["uri"]>().toEqualTypeOf<URI>();
|
|
71
|
-
expectTypeOf<StandardSummary["name"]>().toBeString();
|
|
72
|
-
expectTypeOf<StandardSummary["category"]>().toBeString();
|
|
73
|
-
|
|
74
|
-
// StandardDetailed extends StandardSummary
|
|
75
|
-
expectTypeOf<StandardDetailed>().toMatchTypeOf<StandardSummary>();
|
|
76
|
-
expectTypeOf<StandardDetailed["dos"]>().toEqualTypeOf<readonly CodeBlock[]>();
|
|
77
|
-
expectTypeOf<StandardDetailed["donts"]>().toEqualTypeOf<readonly CodeBlock[]>();
|
|
78
|
-
|
|
79
|
-
// CodeBlock
|
|
80
|
-
expectTypeOf<CodeBlock["language"]>().toBeString();
|
|
81
|
-
expectTypeOf<CodeBlock["code"]>().toBeString();
|
|
82
|
-
|
|
83
|
-
// CategorySummary
|
|
84
|
-
expectTypeOf<CategorySummary["name"]>().toBeString();
|
|
85
|
-
expectTypeOf<CategorySummary["standardCount"]>().toBeNumber();
|
|
86
|
-
|
|
87
|
-
// ModifierFamily
|
|
88
|
-
expectTypeOf<ModifierFamily["uri"]>().toEqualTypeOf<URI>();
|
|
89
|
-
expectTypeOf<ModifierFamily["values"]>().toEqualTypeOf<readonly string[]>();
|
|
90
|
-
|
|
91
|
-
// TokenSummary
|
|
92
|
-
expectTypeOf<TokenSummary["uri"]>().toEqualTypeOf<URI>();
|
|
93
|
-
expectTypeOf<TokenSummary["name"]>().toBeString();
|
|
94
|
-
expectTypeOf<TokenSummary["category"]>().toBeString();
|
|
95
|
-
|
|
96
|
-
// TokenDetailed extends TokenSummary
|
|
97
|
-
expectTypeOf<TokenDetailed>().toMatchTypeOf<TokenSummary>();
|
|
98
|
-
|
|
99
|
-
// TierEntry
|
|
100
|
-
expectTypeOf<TierEntry["uri"]>().toEqualTypeOf<URI>();
|
|
101
|
-
expectTypeOf<TierEntry["path"]>().toBeString();
|
|
102
|
-
expectTypeOf<TierEntry["depth"]>().toBeNumber();
|
|
103
|
-
|
|
104
|
-
// FilterConfig
|
|
105
|
-
expectTypeOf<FilterConfig["channel"]>().toEqualTypeOf<
|
|
106
|
-
"normal" | "experimental" | "prerelease"
|
|
107
|
-
>();
|
|
108
|
-
|
|
109
|
-
// =============================================================================
|
|
110
|
-
// Operation return type assertions
|
|
111
|
-
// =============================================================================
|
|
112
|
-
|
|
113
|
-
declare const store: Store;
|
|
114
|
-
declare const filters: FilterConfig;
|
|
115
|
-
|
|
116
|
-
expectTypeOf(listBlocks).returns.resolves.toEqualTypeOf<BlockSummary[]>();
|
|
117
|
-
expectTypeOf(lookupBlock).returns.resolves.toEqualTypeOf<BlockDetailed>();
|
|
118
|
-
expectTypeOf(listStandards).returns.resolves.toEqualTypeOf<StandardSummary[]>();
|
|
119
|
-
expectTypeOf(lookupStandard).returns.resolves.toEqualTypeOf<StandardDetailed>();
|
|
120
|
-
expectTypeOf(listCategories).returns.resolves.toEqualTypeOf<
|
|
121
|
-
CategorySummary[]
|
|
122
|
-
>();
|
|
123
|
-
expectTypeOf(listModifiers).returns.resolves.toEqualTypeOf<ModifierFamily[]>();
|
|
124
|
-
expectTypeOf(lookupModifier).returns.resolves.toEqualTypeOf<ModifierFamily>();
|
|
125
|
-
expectTypeOf(listTokens).returns.resolves.toEqualTypeOf<TokenSummary[]>();
|
|
126
|
-
expectTypeOf(lookupToken).returns.resolves.toEqualTypeOf<TokenDetailed>();
|
|
127
|
-
expectTypeOf(listTiers).returns.resolves.toEqualTypeOf<TierEntry[]>();
|
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared operation return types.
|
|
3
|
-
*
|
|
4
|
-
* Contract between the operations layer (D3) and CLI/MCP adapters.
|
|
5
|
-
* Same data, different presentations.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { URI } from "@canonical/ke";
|
|
9
|
-
|
|
10
|
-
// =============================================================================
|
|
11
|
-
// Block
|
|
12
|
-
// =============================================================================
|
|
13
|
-
|
|
14
|
-
/** Summary view of a design-system block (component, pattern, or primitive). */
|
|
15
|
-
export interface BlockSummary {
|
|
16
|
-
/** Full RDF URI identifying this block in the ke store. */
|
|
17
|
-
readonly uri: URI;
|
|
18
|
-
/** Human-readable name (local name extracted from URI). */
|
|
19
|
-
readonly name: string;
|
|
20
|
-
/** Normalized ontology type for the block. */
|
|
21
|
-
readonly type: "component" | "pattern" | "layout" | "subcomponent";
|
|
22
|
-
/** Tier path this block belongs to (e.g., `"global"`, `"apps/lxd"`). */
|
|
23
|
-
readonly tier: string;
|
|
24
|
-
/** Active modifier names applied to this block. */
|
|
25
|
-
readonly modifiers: readonly string[];
|
|
26
|
-
/** Framework implementations declared for this block, with availability flags. */
|
|
27
|
-
readonly implementations: readonly {
|
|
28
|
-
framework: string;
|
|
29
|
-
available: boolean;
|
|
30
|
-
}[];
|
|
31
|
-
/** Number of anatomy nodes (DOM elements) in this block's anatomy tree. */
|
|
32
|
-
readonly nodeCount: number;
|
|
33
|
-
/** Number of design tokens referenced by this block. */
|
|
34
|
-
readonly tokenCount: number;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** Digest view of a block for richer summary displays. */
|
|
38
|
-
export interface BlockDigest extends BlockSummary {
|
|
39
|
-
/** Summary guidance when present in the graph. */
|
|
40
|
-
readonly summary: string | null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/** Single node in a block's anatomy tree (recursive). */
|
|
44
|
-
export interface AnatomyNode {
|
|
45
|
-
/** Element name (e.g., `"trigger"`, `"panel"`). */
|
|
46
|
-
readonly name: string;
|
|
47
|
-
/** Whether the node is explicitly named or inferred as anonymous. */
|
|
48
|
-
readonly type: "named" | "anonymous";
|
|
49
|
-
/** Child nodes nested under this element. */
|
|
50
|
-
readonly children: readonly AnatomyNode[];
|
|
51
|
-
/** Named slot this node exposes, if any. */
|
|
52
|
-
readonly slot?: string;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/** Wrapper around the root of a block's anatomy tree. */
|
|
56
|
-
export interface AnatomyTree {
|
|
57
|
-
/** Top-level anatomy node from which all children descend. */
|
|
58
|
-
readonly root: AnatomyNode;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/** Detailed view of a block, extending the digest with anatomy, tokens, and standards. */
|
|
62
|
-
export interface BlockDetailed extends BlockDigest {
|
|
63
|
-
/** Guidance on when the block should be used. */
|
|
64
|
-
readonly whenToUse: string | null;
|
|
65
|
-
/** Guidance on when the block should not be used. */
|
|
66
|
-
readonly whenNotToUse: string | null;
|
|
67
|
-
/** Additional usage guidance. */
|
|
68
|
-
readonly guidelines: string | null;
|
|
69
|
-
/** YAML anatomy DSL payload when present. */
|
|
70
|
-
readonly anatomyDsl: string | null;
|
|
71
|
-
/** Legacy anatomy payload when present. */
|
|
72
|
-
readonly anatomyClassic: string | null;
|
|
73
|
-
/** Figma reference link when present. */
|
|
74
|
-
readonly figmaLink: string | null;
|
|
75
|
-
/** Full anatomy tree, or `null` if the block declares no anatomy. */
|
|
76
|
-
readonly anatomy: AnatomyTree | null;
|
|
77
|
-
/** Modifier families with their allowed values. */
|
|
78
|
-
readonly modifierValues: readonly {
|
|
79
|
-
family: string;
|
|
80
|
-
values: readonly string[];
|
|
81
|
-
}[];
|
|
82
|
-
/** Modifier families resolved as richer objects. */
|
|
83
|
-
readonly modifierFamilies: readonly {
|
|
84
|
-
uri: URI;
|
|
85
|
-
name: string;
|
|
86
|
-
values: readonly string[];
|
|
87
|
-
}[];
|
|
88
|
-
/** Property metadata resolved from blank nodes. */
|
|
89
|
-
readonly properties: readonly {
|
|
90
|
-
name: string;
|
|
91
|
-
propertyType: string;
|
|
92
|
-
optional: boolean;
|
|
93
|
-
defaultValue: string | null;
|
|
94
|
-
constraints: string | null;
|
|
95
|
-
}[];
|
|
96
|
-
/** Direct subcomponents of the block. */
|
|
97
|
-
readonly subcomponents: readonly {
|
|
98
|
-
uri: URI;
|
|
99
|
-
name: string;
|
|
100
|
-
}[];
|
|
101
|
-
/** File paths to framework-specific implementations. */
|
|
102
|
-
readonly implementationPaths: readonly { framework: string; path: string }[];
|
|
103
|
-
/** Design tokens referenced by this block. */
|
|
104
|
-
readonly tokens: readonly TokenRef[];
|
|
105
|
-
/** Standards (guidelines/rules) that apply to this block. */
|
|
106
|
-
readonly standards: readonly StandardRef[];
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// =============================================================================
|
|
110
|
-
// Standard
|
|
111
|
-
// =============================================================================
|
|
112
|
-
|
|
113
|
-
/** Summary view of a design-system standard (guideline or rule). */
|
|
114
|
-
export interface StandardSummary {
|
|
115
|
-
/** Full RDF URI identifying this standard in the ke store. */
|
|
116
|
-
readonly uri: URI;
|
|
117
|
-
/** Human-readable name of the standard. */
|
|
118
|
-
readonly name: string;
|
|
119
|
-
/** Category grouping (e.g., `"accessibility"`, `"layout"`). */
|
|
120
|
-
readonly category: string;
|
|
121
|
-
/** Brief prose description of what the standard prescribes. */
|
|
122
|
-
readonly description: string;
|
|
123
|
-
/** URI of the parent standard this one extends, if any. */
|
|
124
|
-
readonly extends?: string;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/** Fenced code block used in standard do/don't examples. */
|
|
128
|
-
export interface CodeBlock {
|
|
129
|
-
/** Programming language identifier for syntax highlighting. */
|
|
130
|
-
readonly language: string;
|
|
131
|
-
/** Source code content of the example. */
|
|
132
|
-
readonly code: string;
|
|
133
|
-
/** Optional explanatory caption displayed alongside the code. */
|
|
134
|
-
readonly caption?: string;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/** Detailed view of a standard, extending the summary with code examples. */
|
|
138
|
-
export interface StandardDetailed extends StandardSummary {
|
|
139
|
-
/** Positive examples demonstrating correct usage. */
|
|
140
|
-
readonly dos: readonly CodeBlock[];
|
|
141
|
-
/** Negative examples demonstrating incorrect usage. */
|
|
142
|
-
readonly donts: readonly CodeBlock[];
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/** Summary of a standards category with its member count. */
|
|
146
|
-
export interface CategorySummary {
|
|
147
|
-
/** Category name (e.g., `"accessibility"`, `"layout"`). */
|
|
148
|
-
readonly name: string;
|
|
149
|
-
/** Number of standards belonging to this category. */
|
|
150
|
-
readonly standardCount: number;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/** Optional filters for narrowing the standards list. */
|
|
154
|
-
export interface StandardListFilters {
|
|
155
|
-
/** Restrict results to a single category name. */
|
|
156
|
-
readonly category?: string;
|
|
157
|
-
/** Free-text search term matched against standard names and descriptions. */
|
|
158
|
-
readonly search?: string;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// =============================================================================
|
|
162
|
-
// Modifier
|
|
163
|
-
// =============================================================================
|
|
164
|
-
|
|
165
|
-
/** A modifier family (e.g., "size", "variant") with its allowed values. */
|
|
166
|
-
export interface ModifierFamily {
|
|
167
|
-
/** Full RDF URI identifying this modifier family. */
|
|
168
|
-
readonly uri: URI;
|
|
169
|
-
/** Human-readable family name. */
|
|
170
|
-
readonly name: string;
|
|
171
|
-
/** Allowed values within this family (e.g., `["small", "medium", "large"]`). */
|
|
172
|
-
readonly values: readonly string[];
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// =============================================================================
|
|
176
|
-
// Token
|
|
177
|
-
// =============================================================================
|
|
178
|
-
|
|
179
|
-
/** Summary view of a design token. */
|
|
180
|
-
export interface TokenSummary {
|
|
181
|
-
/** Full RDF URI identifying this token in the ke store. */
|
|
182
|
-
readonly uri: URI;
|
|
183
|
-
/** Human-readable token name (e.g., `"color-primary"`). */
|
|
184
|
-
readonly name: string;
|
|
185
|
-
/** Token category (e.g., `"color"`, `"spacing"`, `"typography"`). */
|
|
186
|
-
readonly category: string;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/** Detailed view of a token, extending the summary with per-theme resolved values. */
|
|
190
|
-
export interface TokenDetailed extends TokenSummary {
|
|
191
|
-
/** Resolved values keyed by theme (e.g., `{ theme: "dark", value: "#fff" }`). */
|
|
192
|
-
readonly values: readonly { theme: string; value: string }[];
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/** Lightweight reference to a token (name + URI), used in cross-references. */
|
|
196
|
-
export interface TokenRef {
|
|
197
|
-
/** Human-readable token name. */
|
|
198
|
-
readonly name: string;
|
|
199
|
-
/** Full RDF URI of the referenced token. */
|
|
200
|
-
readonly uri: URI;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// =============================================================================
|
|
204
|
-
// Standard cross-reference
|
|
205
|
-
// =============================================================================
|
|
206
|
-
|
|
207
|
-
/** Lightweight reference to a standard, used in block cross-references. */
|
|
208
|
-
export interface StandardRef {
|
|
209
|
-
/** Human-readable standard name. */
|
|
210
|
-
readonly name: string;
|
|
211
|
-
/** Full RDF URI of the referenced standard. */
|
|
212
|
-
readonly uri: URI;
|
|
213
|
-
/** Category the referenced standard belongs to. */
|
|
214
|
-
readonly category: string;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// =============================================================================
|
|
218
|
-
// Tier
|
|
219
|
-
// =============================================================================
|
|
220
|
-
|
|
221
|
-
/** A single entry in the tier hierarchy (e.g., `global`, `apps`, `apps/lxd`). */
|
|
222
|
-
export interface TierEntry {
|
|
223
|
-
/** Full RDF URI identifying this tier in the ke store. */
|
|
224
|
-
readonly uri: URI;
|
|
225
|
-
/** Slash-separated tier path (e.g., `"apps/lxd"`). */
|
|
226
|
-
readonly path: string;
|
|
227
|
-
/** Path of the parent tier, if this is not the root. */
|
|
228
|
-
readonly parent?: string;
|
|
229
|
-
/** Nesting depth in the tier hierarchy (0 = root). */
|
|
230
|
-
readonly depth: number;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// =============================================================================
|
|
234
|
-
// Graph
|
|
235
|
-
// =============================================================================
|
|
236
|
-
|
|
237
|
-
/** A predicate group from `graph inspect`: one predicate with all its objects. */
|
|
238
|
-
export interface PredicateGroup {
|
|
239
|
-
/** RDF predicate URI (e.g., `"rdfs:label"`). */
|
|
240
|
-
readonly predicate: string;
|
|
241
|
-
/** Object values (URIs or literals) associated with this predicate. */
|
|
242
|
-
readonly objects: readonly string[];
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/** Result of `graph inspect <uri>`: all triples where URI is subject. */
|
|
246
|
-
export interface InspectResult {
|
|
247
|
-
/** The inspected subject URI. */
|
|
248
|
-
readonly uri: string;
|
|
249
|
-
/** Predicate groups aggregating all outgoing triples. */
|
|
250
|
-
readonly groups: readonly PredicateGroup[];
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// =============================================================================
|
|
254
|
-
// Ontology
|
|
255
|
-
// =============================================================================
|
|
256
|
-
|
|
257
|
-
/** Summary of a loaded ontology namespace from `ontology list`. */
|
|
258
|
-
export interface OntologySummary {
|
|
259
|
-
/** Short prefix alias (e.g., `"ds"`, `"cs"`). */
|
|
260
|
-
readonly prefix: string;
|
|
261
|
-
/** Full namespace URI the prefix expands to. */
|
|
262
|
-
readonly namespace: string;
|
|
263
|
-
/** Number of OWL/RDFS classes defined in this namespace. */
|
|
264
|
-
readonly classCount: number;
|
|
265
|
-
/** Number of properties (object + datatype) defined in this namespace. */
|
|
266
|
-
readonly propertyCount: number;
|
|
267
|
-
readonly anatomyCount: number;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/** A class in an ontology's class hierarchy. */
|
|
271
|
-
export interface OntologyClass {
|
|
272
|
-
/** Full URI of the class. */
|
|
273
|
-
readonly uri: string;
|
|
274
|
-
/** Human-readable label (rdfs:label). */
|
|
275
|
-
readonly label: string;
|
|
276
|
-
/** URI of the direct superclass, if declared. */
|
|
277
|
-
readonly superclass?: string;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
/** A property in an ontology namespace. */
|
|
281
|
-
export interface OntologyProperty {
|
|
282
|
-
/** Full URI of the property. */
|
|
283
|
-
readonly uri: string;
|
|
284
|
-
/** Human-readable label (rdfs:label). */
|
|
285
|
-
readonly label: string;
|
|
286
|
-
/** URI of the domain class this property applies to, if declared. */
|
|
287
|
-
readonly domain?: string;
|
|
288
|
-
/** URI of the range class or datatype, if declared. */
|
|
289
|
-
readonly range?: string;
|
|
290
|
-
/** Whether this is an object property (links classes) or datatype property (links to literals). */
|
|
291
|
-
readonly type: "object" | "datatype";
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/** Detailed view of a single ontology namespace from `ontology show`. */
|
|
295
|
-
export interface OntologyDetailed {
|
|
296
|
-
/** Short prefix alias (e.g., `"ds"`). */
|
|
297
|
-
readonly prefix: string;
|
|
298
|
-
/** Full namespace URI the prefix expands to. */
|
|
299
|
-
readonly namespace: string;
|
|
300
|
-
/** All classes defined in this namespace. */
|
|
301
|
-
readonly classes: readonly OntologyClass[];
|
|
302
|
-
/** All properties defined in this namespace. */
|
|
303
|
-
readonly properties: readonly OntologyProperty[];
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
// =============================================================================
|
|
307
|
-
// Filter configuration
|
|
308
|
-
// =============================================================================
|
|
309
|
-
|
|
310
|
-
/** Runtime filter settings controlling tier and channel visibility in queries. */
|
|
311
|
-
export interface FilterConfig {
|
|
312
|
-
/** Active tier path, or `undefined` for all-tiers visibility. */
|
|
313
|
-
readonly tier: string | undefined;
|
|
314
|
-
/** Release channel determining which stability levels are visible. */
|
|
315
|
-
readonly channel: "normal" | "experimental" | "prerelease";
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
// =============================================================================
|
|
319
|
-
// Disclosure
|
|
320
|
-
// =============================================================================
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Controls how much detail an operation returns.
|
|
324
|
-
*
|
|
325
|
-
* - `"summary"` — minimal fields (names and counts).
|
|
326
|
-
* - `"digest"` — intermediate detail with optional example length cap.
|
|
327
|
-
* - `"detailed"` — full content including code blocks and anatomy.
|
|
328
|
-
*/
|
|
329
|
-
export type Disclosure =
|
|
330
|
-
| { readonly level: "summary" }
|
|
331
|
-
| { readonly level: "digest"; readonly maxExampleLength?: number }
|
|
332
|
-
| { readonly level: "detailed" };
|
|
333
|
-
|
|
334
|
-
// =============================================================================
|
|
335
|
-
// Batch
|
|
336
|
-
// =============================================================================
|
|
337
|
-
|
|
338
|
-
/** Outcome of a batch operation: successful results alongside per-item errors. */
|
|
339
|
-
export interface BatchResult<T> {
|
|
340
|
-
/** Items that were processed successfully. */
|
|
341
|
-
readonly results: readonly T[];
|
|
342
|
-
/** Items that failed, each carrying the entity name, error code, and message. */
|
|
343
|
-
readonly errors: readonly {
|
|
344
|
-
name: string;
|
|
345
|
-
code: string;
|
|
346
|
-
message: string;
|
|
347
|
-
}[];
|
|
348
|
-
}
|