fetchtype 0.0.1 → 0.1.1

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 ADDED
@@ -0,0 +1,134 @@
1
+ # fetchtype
2
+
3
+ Typography validation for design systems. Catch readability bugs, enforce WCAG thresholds, and export tokens to CSS, Tailwind, shadcn, and W3C Design Tokens — from one file.
4
+
5
+ ```bash
6
+ pnpm add -D fetchtype
7
+ ```
8
+
9
+ ## Quick start
10
+
11
+ ```bash
12
+ # Generate a starter token file
13
+ fetchtype init
14
+
15
+ # Start from a preset (editorial | dashboard | ecommerce | docs)
16
+ fetchtype init --preset dashboard
17
+
18
+ # Or describe what you're building
19
+ fetchtype init --prompt "modern SaaS dashboard with dark mode"
20
+
21
+ # Validate against 13 rules
22
+ fetchtype validate -i fetchtype.tokens.json
23
+
24
+ # Export to any format
25
+ fetchtype build -i fetchtype.tokens.json --format tailwind
26
+ ```
27
+
28
+ ## What gets checked
29
+
30
+ 13 rules covering accessibility, readability, and structural consistency:
31
+
32
+ | Rule | Threshold |
33
+ |------|-----------|
34
+ | Text contrast | ≥ 4.5:1 (WCAG AA) |
35
+ | Body line-height | ≥ 1.5 |
36
+ | Button font-size | ≥ 14px |
37
+ | Caption / label font-size | ≥ 11px |
38
+ | Prose width | ≤ 75ch |
39
+ | Heading size direction | h1 → h6 decreasing |
40
+ | Heading line-height | < body line-height |
41
+ | Spacing scale | Monotonically increasing |
42
+ | Scale divergence | Within ±10% of computed scale |
43
+ | Dark mode completeness | All themes covered |
44
+ | Font fallback chains | Generic fallback present |
45
+ | Font payload | ≤ 150 KB estimated |
46
+ | Token references | Resolve without cycles |
47
+
48
+ ## Commands
49
+
50
+ | Command | Description |
51
+ |---------|-------------|
52
+ | `init [output]` | Write a starter token file. `--preset`, `--prompt`, `--force` |
53
+ | `validate -i <path>` | Validate tokens. `--github` for PR annotations, `--json` |
54
+ | `build -i <path>` | Export tokens. `--format` (css\|json\|tailwind\|shadcn\|w3c\|all) |
55
+ | `import -i <path>` | Import a W3C Design Tokens file |
56
+ | `suggest -c <context>` | Recommend fonts. Context: display\|interface\|reading\|mono |
57
+ | `preview -i <path>` | Start a live preview server with file watching |
58
+ | `mcp` | Start an MCP server for AI agent integration |
59
+
60
+ ## Token format
61
+
62
+ ```json
63
+ {
64
+ "typography": {
65
+ "heading": { "lineHeight": 1.1, "fontSize": "3rem" },
66
+ "body": { "lineHeight": 1.6, "fontSize": "1rem" },
67
+ "button": { "fontSize": "0.9375rem" },
68
+ "caption": { "fontSize": "0.8125rem" }
69
+ },
70
+ "color": {
71
+ "light": { "text": "#111827", "background": "#ffffff" },
72
+ "dark": { "text": "#f9fafb", "background": "#111827" }
73
+ },
74
+ "hierarchy": {
75
+ "scale": "major-third",
76
+ "baseSize": "1rem"
77
+ }
78
+ }
79
+ ```
80
+
81
+ 12 typography contexts: heading, subheading, body, caption, button, label, input, code, blockquote, chart-label, chart-axis, chart-title. Plus color, spacing, layout, hierarchy, optional themes and modes.
82
+
83
+ ## Export formats
84
+
85
+ ```bash
86
+ fetchtype build -i fetchtype.tokens.json -o dist/tokens --format all
87
+ ```
88
+
89
+ | Format | Output | Description |
90
+ |--------|--------|-------------|
91
+ | `css` | `tokens.css` | CSS custom properties with configurable prefix |
92
+ | `json` | `tokens.json` | Fully resolved token values |
93
+ | `tailwind` | `tailwind.config.ts` | `theme.extend` partial |
94
+ | `shadcn` | `shadcn.css` | HSL variables, shadcn-compatible |
95
+ | `w3c` | `tokens.w3c.json` | W3C Design Tokens Community Group format |
96
+
97
+ ## CI integration
98
+
99
+ Add `--github` to emit inline PR annotations and a step summary:
100
+
101
+ ```yaml
102
+ - name: Validate typography
103
+ run: pnpm exec fetchtype validate -i fetchtype.tokens.json --github
104
+ ```
105
+
106
+ ## Presets
107
+
108
+ | Preset | Tuned for |
109
+ |--------|-----------|
110
+ | `base` | General-purpose defaults |
111
+ | `editorial` | Long-form reading — larger body, generous line-height, serif, 65ch prose |
112
+ | `dashboard` | Data-dense — compact body, tighter line-height, monospace, wider content |
113
+ | `ecommerce` | Product and conversion pages |
114
+ | `docs` | Documentation sites |
115
+
116
+ ## AI agent integration
117
+
118
+ fetchtype includes an MCP server so AI coding agents can validate and generate typography tokens directly:
119
+
120
+ ```bash
121
+ fetchtype mcp
122
+ ```
123
+
124
+ Exposes five tools: `validate`, `build`, `suggest`, `init`, and `presets`.
125
+
126
+ ## Links
127
+
128
+ - [fetchtype.com](https://fetchtype.com) — Homepage
129
+ - [fetchtype.dev](https://fetchtype.dev) — Documentation
130
+ - [npm](https://www.npmjs.com/package/fetchtype)
131
+
132
+ ## License
133
+
134
+ MIT
package/dist/bin.d.ts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/bin.js ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ runCli
4
+ } from "./chunk-KNQYU2Y2.js";
5
+
6
+ // src/bin.ts
7
+ import process from "process";
8
+ process.exitCode = await runCli(process.argv.slice(2));
9
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport process from 'node:process';\n\nimport { runCli } from './index.js';\n\nprocess.exitCode = await runCli(process.argv.slice(2));\n"],"mappings":";;;;;;AAEA,OAAO,aAAa;AAIpB,QAAQ,WAAW,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC,CAAC;","names":[]}