brandspec 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/LICENSE +21 -0
- package/README.md +230 -0
- package/dist/cli.js +1516 -0
- package/dist/index.cjs +773 -0
- package/dist/index.d.cts +402 -0
- package/dist/index.d.ts +402 -0
- package/dist/index.js +718 -0
- package/package.json +61 -0
- package/schema/spec/assets.md +219 -0
- package/schema/spec/core.md +203 -0
- package/schema/spec/guidelines.md +110 -0
- package/schema/spec/tokens.md +389 -0
- package/schema/v0.1.0.yaml +201 -0
- package/workshop/SKILL.md +218 -0
- package/workshop/flow.md +181 -0
- package/workshop/phases/01-discovery.md +156 -0
- package/workshop/phases/02-concept.md +234 -0
- package/workshop/phases/03-visual.md +271 -0
- package/workshop/phases/04-documentation.md +99 -0
- package/workshop/templates/_workshop/decisions.yml +15 -0
- package/workshop/templates/_workshop/memo.md +23 -0
- package/workshop/templates/_workshop/position.yml +9 -0
- package/workshop/templates/_workshop/session.md +28 -0
- package/workshop/templates/brand.yaml +112 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
/** Brand metadata. Only `name` is required. */
|
|
2
|
+
interface BrandspecMeta {
|
|
3
|
+
name: string;
|
|
4
|
+
version?: string;
|
|
5
|
+
updated?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
url?: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
interface BrandspecVoice {
|
|
11
|
+
tone?: string[];
|
|
12
|
+
principles?: string[];
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
interface BrandspecCore {
|
|
16
|
+
essence?: string;
|
|
17
|
+
tagline?: string;
|
|
18
|
+
mission?: string;
|
|
19
|
+
vision?: string;
|
|
20
|
+
values?: string[];
|
|
21
|
+
personality?: string[];
|
|
22
|
+
voice?: BrandspecVoice;
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
}
|
|
25
|
+
/** W3C DTCG-compliant design token. */
|
|
26
|
+
interface DesignToken {
|
|
27
|
+
$value: string;
|
|
28
|
+
$type?: string;
|
|
29
|
+
$description?: string;
|
|
30
|
+
$extensions?: Record<string, unknown>;
|
|
31
|
+
[key: string]: unknown;
|
|
32
|
+
}
|
|
33
|
+
interface BrandspecTokens {
|
|
34
|
+
colors?: Record<string, DesignToken>;
|
|
35
|
+
typography?: Record<string, DesignToken>;
|
|
36
|
+
spacing?: Record<string, DesignToken>;
|
|
37
|
+
radius?: Record<string, DesignToken>;
|
|
38
|
+
[key: string]: Record<string, DesignToken> | undefined;
|
|
39
|
+
}
|
|
40
|
+
interface BrandspecAsset {
|
|
41
|
+
file: string;
|
|
42
|
+
id?: string;
|
|
43
|
+
role?: string;
|
|
44
|
+
variant?: string;
|
|
45
|
+
context?: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
formats?: Array<{
|
|
48
|
+
path: string;
|
|
49
|
+
width?: number;
|
|
50
|
+
height?: number;
|
|
51
|
+
}>;
|
|
52
|
+
tags?: string[];
|
|
53
|
+
[key: string]: unknown;
|
|
54
|
+
}
|
|
55
|
+
interface GuidelineRule {
|
|
56
|
+
id?: string;
|
|
57
|
+
description: string;
|
|
58
|
+
severity: "info" | "warning" | "error";
|
|
59
|
+
criteria?: string[];
|
|
60
|
+
applies_to?: string;
|
|
61
|
+
[key: string]: unknown;
|
|
62
|
+
}
|
|
63
|
+
interface GuidelineSection {
|
|
64
|
+
content?: string;
|
|
65
|
+
rules?: GuidelineRule[];
|
|
66
|
+
[key: string]: unknown;
|
|
67
|
+
}
|
|
68
|
+
interface BrandspecYaml {
|
|
69
|
+
meta: BrandspecMeta;
|
|
70
|
+
core?: BrandspecCore;
|
|
71
|
+
tokens?: BrandspecTokens;
|
|
72
|
+
assets?: BrandspecAsset[];
|
|
73
|
+
guidelines?: Record<string, GuidelineSection>;
|
|
74
|
+
extensions?: Record<string, unknown>;
|
|
75
|
+
[key: string]: unknown;
|
|
76
|
+
}
|
|
77
|
+
interface ParseResult {
|
|
78
|
+
success: boolean;
|
|
79
|
+
data?: BrandspecYaml;
|
|
80
|
+
errors: string[];
|
|
81
|
+
warnings: string[];
|
|
82
|
+
}
|
|
83
|
+
interface ValidationResult {
|
|
84
|
+
valid: boolean;
|
|
85
|
+
errors: string[];
|
|
86
|
+
warnings: string[];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Parse a YAML string into a typed BrandspecYaml object.
|
|
91
|
+
* Performs structural validation (required fields, correct types).
|
|
92
|
+
* For full schema validation, use `validate()` after parsing.
|
|
93
|
+
*/
|
|
94
|
+
declare function parse(content: string): ParseResult;
|
|
95
|
+
/** Serialize a BrandspecYaml object back to YAML string. */
|
|
96
|
+
declare function serialize(data: BrandspecYaml): string;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Validate a parsed object against the brandspec JSON Schema.
|
|
100
|
+
* Use `parse()` first to get a typed object, then `validate()` for full schema compliance.
|
|
101
|
+
*/
|
|
102
|
+
declare function validate(data: unknown): ValidationResult;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* brandspec JSON Schema v0.1.0
|
|
106
|
+
* Bundled from schema/v0.1.0.yaml
|
|
107
|
+
*
|
|
108
|
+
* This is the canonical schema inlined as a JS object
|
|
109
|
+
* so it ships with the package without runtime YAML parsing.
|
|
110
|
+
*/
|
|
111
|
+
declare const schema: {
|
|
112
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
113
|
+
readonly $id: "https://brandspec.tools/schema/v0.1.0";
|
|
114
|
+
readonly title: "brandspec";
|
|
115
|
+
readonly description: "Brand Identity specification format";
|
|
116
|
+
readonly type: "object";
|
|
117
|
+
readonly required: readonly ["meta"];
|
|
118
|
+
readonly properties: {
|
|
119
|
+
readonly meta: {
|
|
120
|
+
readonly type: "object";
|
|
121
|
+
readonly description: "Brand metadata";
|
|
122
|
+
readonly required: readonly ["name"];
|
|
123
|
+
readonly properties: {
|
|
124
|
+
readonly name: {
|
|
125
|
+
readonly type: "string";
|
|
126
|
+
readonly description: "Brand name";
|
|
127
|
+
};
|
|
128
|
+
readonly version: {
|
|
129
|
+
readonly type: "string";
|
|
130
|
+
readonly description: "Brand spec version (semver)";
|
|
131
|
+
};
|
|
132
|
+
readonly updated: {
|
|
133
|
+
readonly type: "string";
|
|
134
|
+
readonly format: "date";
|
|
135
|
+
readonly description: "Last updated date";
|
|
136
|
+
};
|
|
137
|
+
readonly description: {
|
|
138
|
+
readonly type: "string";
|
|
139
|
+
readonly description: "Brief brand description";
|
|
140
|
+
};
|
|
141
|
+
readonly url: {
|
|
142
|
+
readonly type: "string";
|
|
143
|
+
readonly format: "uri";
|
|
144
|
+
readonly description: "Brand website";
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
readonly additionalProperties: true;
|
|
148
|
+
};
|
|
149
|
+
readonly core: {
|
|
150
|
+
readonly type: "object";
|
|
151
|
+
readonly description: "Brand essence, personality, and voice";
|
|
152
|
+
readonly properties: {
|
|
153
|
+
readonly essence: {
|
|
154
|
+
readonly type: "string";
|
|
155
|
+
};
|
|
156
|
+
readonly tagline: {
|
|
157
|
+
readonly type: "string";
|
|
158
|
+
};
|
|
159
|
+
readonly mission: {
|
|
160
|
+
readonly type: "string";
|
|
161
|
+
};
|
|
162
|
+
readonly vision: {
|
|
163
|
+
readonly type: "string";
|
|
164
|
+
};
|
|
165
|
+
readonly values: {
|
|
166
|
+
readonly type: "array";
|
|
167
|
+
readonly items: {
|
|
168
|
+
readonly type: "string";
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
readonly personality: {
|
|
172
|
+
readonly type: "array";
|
|
173
|
+
readonly items: {
|
|
174
|
+
readonly type: "string";
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
readonly voice: {
|
|
178
|
+
readonly type: "object";
|
|
179
|
+
readonly properties: {
|
|
180
|
+
readonly tone: {
|
|
181
|
+
readonly type: "array";
|
|
182
|
+
readonly items: {
|
|
183
|
+
readonly type: "string";
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
readonly principles: {
|
|
187
|
+
readonly type: "array";
|
|
188
|
+
readonly items: {
|
|
189
|
+
readonly type: "string";
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
readonly additionalProperties: true;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
readonly additionalProperties: true;
|
|
197
|
+
};
|
|
198
|
+
readonly tokens: {
|
|
199
|
+
readonly type: "object";
|
|
200
|
+
readonly description: "Design tokens (W3C DTCG compliant)";
|
|
201
|
+
readonly additionalProperties: true;
|
|
202
|
+
};
|
|
203
|
+
readonly assets: {
|
|
204
|
+
readonly type: "array";
|
|
205
|
+
readonly description: "Brand assets";
|
|
206
|
+
readonly items: {
|
|
207
|
+
readonly type: "object";
|
|
208
|
+
readonly required: readonly ["file"];
|
|
209
|
+
readonly properties: {
|
|
210
|
+
readonly file: {
|
|
211
|
+
readonly type: "string";
|
|
212
|
+
};
|
|
213
|
+
readonly id: {
|
|
214
|
+
readonly type: "string";
|
|
215
|
+
};
|
|
216
|
+
readonly role: {
|
|
217
|
+
readonly type: "string";
|
|
218
|
+
};
|
|
219
|
+
readonly variant: {
|
|
220
|
+
readonly type: "string";
|
|
221
|
+
};
|
|
222
|
+
readonly context: {
|
|
223
|
+
readonly type: "string";
|
|
224
|
+
};
|
|
225
|
+
readonly description: {
|
|
226
|
+
readonly type: "string";
|
|
227
|
+
};
|
|
228
|
+
readonly formats: {
|
|
229
|
+
readonly type: "array";
|
|
230
|
+
readonly items: {
|
|
231
|
+
readonly type: "object";
|
|
232
|
+
readonly properties: {
|
|
233
|
+
readonly path: {
|
|
234
|
+
readonly type: "string";
|
|
235
|
+
};
|
|
236
|
+
readonly width: {
|
|
237
|
+
readonly type: "integer";
|
|
238
|
+
};
|
|
239
|
+
readonly height: {
|
|
240
|
+
readonly type: "integer";
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
readonly additionalProperties: true;
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
readonly tags: {
|
|
247
|
+
readonly type: "array";
|
|
248
|
+
readonly items: {
|
|
249
|
+
readonly type: "string";
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
readonly additionalProperties: true;
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
readonly guidelines: {
|
|
257
|
+
readonly type: "object";
|
|
258
|
+
readonly description: "Usage guidelines";
|
|
259
|
+
readonly additionalProperties: {
|
|
260
|
+
readonly type: "object";
|
|
261
|
+
readonly properties: {
|
|
262
|
+
readonly content: {
|
|
263
|
+
readonly type: "string";
|
|
264
|
+
};
|
|
265
|
+
readonly rules: {
|
|
266
|
+
readonly type: "array";
|
|
267
|
+
readonly items: {
|
|
268
|
+
readonly $ref: "#/$defs/guidelineRule";
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
readonly additionalProperties: true;
|
|
273
|
+
};
|
|
274
|
+
};
|
|
275
|
+
readonly extensions: {
|
|
276
|
+
readonly type: "object";
|
|
277
|
+
readonly description: "Custom extensions";
|
|
278
|
+
readonly additionalProperties: true;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
readonly additionalProperties: true;
|
|
282
|
+
readonly $defs: {
|
|
283
|
+
readonly guidelineRule: {
|
|
284
|
+
readonly type: "object";
|
|
285
|
+
readonly required: readonly ["description", "severity"];
|
|
286
|
+
readonly properties: {
|
|
287
|
+
readonly id: {
|
|
288
|
+
readonly type: "string";
|
|
289
|
+
};
|
|
290
|
+
readonly description: {
|
|
291
|
+
readonly type: "string";
|
|
292
|
+
};
|
|
293
|
+
readonly severity: {
|
|
294
|
+
readonly type: "string";
|
|
295
|
+
readonly enum: readonly ["info", "warning", "error"];
|
|
296
|
+
};
|
|
297
|
+
readonly criteria: {
|
|
298
|
+
readonly type: "array";
|
|
299
|
+
readonly items: {
|
|
300
|
+
readonly type: "string";
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
readonly applies_to: {
|
|
304
|
+
readonly type: "string";
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
readonly additionalProperties: true;
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Extract all tokens as flat CSS custom properties.
|
|
314
|
+
*
|
|
315
|
+
* Output:
|
|
316
|
+
* :root {
|
|
317
|
+
* --primary: oklch(0.65 0.18 250);
|
|
318
|
+
* --primary-foreground: oklch(0.98 0.01 250);
|
|
319
|
+
* --font-heading: Inter, system-ui, sans-serif;
|
|
320
|
+
* ...
|
|
321
|
+
* }
|
|
322
|
+
*/
|
|
323
|
+
declare function toCss(data: BrandspecYaml): string;
|
|
324
|
+
/**
|
|
325
|
+
* Generate a Tailwind v4 CSS import with theme tokens.
|
|
326
|
+
*
|
|
327
|
+
* Tailwind v4 uses CSS-based configuration:
|
|
328
|
+
* @theme {
|
|
329
|
+
* --color-primary: oklch(0.65 0.18 250);
|
|
330
|
+
* --font-heading: Inter, system-ui, sans-serif;
|
|
331
|
+
* }
|
|
332
|
+
*/
|
|
333
|
+
declare function toTailwindCss(data: BrandspecYaml): string;
|
|
334
|
+
/**
|
|
335
|
+
* Generate Figma-compatible tokens JSON (Style Dictionary / Tokens Studio format).
|
|
336
|
+
*/
|
|
337
|
+
declare function toFigmaTokens(data: BrandspecYaml): string;
|
|
338
|
+
/**
|
|
339
|
+
* Generate Style Dictionary token file (DTCG format) + config.
|
|
340
|
+
*
|
|
341
|
+
* Outputs two files:
|
|
342
|
+
* tokens.json — DTCG token definitions ($value, $type)
|
|
343
|
+
* config.json — Style Dictionary v4 config with common platforms
|
|
344
|
+
*
|
|
345
|
+
* Usage: `npx style-dictionary build --config config.json`
|
|
346
|
+
*/
|
|
347
|
+
declare function toStyleDictionary(data: BrandspecYaml): {
|
|
348
|
+
tokens: string;
|
|
349
|
+
config: string;
|
|
350
|
+
};
|
|
351
|
+
/** Flatten all tokens to a simple key-value map. */
|
|
352
|
+
declare function flattenTokens(data: BrandspecYaml): Array<{
|
|
353
|
+
group: string;
|
|
354
|
+
name: string;
|
|
355
|
+
token: DesignToken;
|
|
356
|
+
}>;
|
|
357
|
+
|
|
358
|
+
declare const API_BASE: string;
|
|
359
|
+
declare function getCredentialsPath(): string;
|
|
360
|
+
declare function loadToken(): string | null;
|
|
361
|
+
declare function parseOrgBrand(str: string): {
|
|
362
|
+
org: string;
|
|
363
|
+
brand: string;
|
|
364
|
+
} | null;
|
|
365
|
+
declare function loadRemote(args: string[]): {
|
|
366
|
+
org: string;
|
|
367
|
+
brand: string;
|
|
368
|
+
} | null;
|
|
369
|
+
declare function ensureBrandspecrc(org: string, brand: string): void;
|
|
370
|
+
declare function saveCredentials(token: string): void;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Lint engine for brand.yaml files.
|
|
374
|
+
* Ported from brandspec-tools SaaS — single source of truth.
|
|
375
|
+
*/
|
|
376
|
+
|
|
377
|
+
type LintSeverity = "error" | "warning" | "info";
|
|
378
|
+
interface LintResult {
|
|
379
|
+
rule: string;
|
|
380
|
+
severity: LintSeverity;
|
|
381
|
+
message: string;
|
|
382
|
+
path?: string;
|
|
383
|
+
}
|
|
384
|
+
interface LintReport {
|
|
385
|
+
score: number;
|
|
386
|
+
results: LintResult[];
|
|
387
|
+
errors: number;
|
|
388
|
+
warnings: number;
|
|
389
|
+
infos: number;
|
|
390
|
+
}
|
|
391
|
+
declare function lintBrandspec(spec: BrandspecYaml): LintReport;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Color utilities for brandspec lint rules.
|
|
395
|
+
* Ported from brandspec-tools SaaS — single source of truth.
|
|
396
|
+
*/
|
|
397
|
+
/** Parse hex, rgb(), or oklch() color string to [r, g, b] 0-255 */
|
|
398
|
+
declare function parseColor(color: string): [number, number, number] | null;
|
|
399
|
+
/** WCAG contrast ratio between two color strings */
|
|
400
|
+
declare function getContrastRatio(color1: string, color2: string): number;
|
|
401
|
+
|
|
402
|
+
export { API_BASE, type BrandspecAsset, type BrandspecCore, type BrandspecMeta, type BrandspecTokens, type BrandspecVoice, type BrandspecYaml, type DesignToken, type GuidelineRule, type GuidelineSection, type LintReport, type LintResult, type LintSeverity, type ParseResult, type ValidationResult, ensureBrandspecrc, flattenTokens, getContrastRatio, getCredentialsPath, lintBrandspec, loadRemote, loadToken, parse, parseColor, parseOrgBrand, saveCredentials, schema, serialize, toCss, toFigmaTokens, toStyleDictionary, toTailwindCss, validate };
|