@catchdrift/overlay 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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dave Yoon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # @catchdrift/overlay
2
+
3
+ > Drop-in design system coverage overlay for React apps. Press **D** to see drift.
4
+
5
+ Drift reads your live React component tree, compares every rendered component against your design system registry, flags token violations (hardcoded colors, spacing, radii, font sizes), and gives your page a real coverage score — all without touching your source code.
6
+
7
+ ---
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @catchdrift/overlay
13
+ ```
14
+
15
+ ## Setup
16
+
17
+ ```tsx
18
+ // src/main.tsx (or wherever your app mounts)
19
+ import { DriftOverlay } from '@catchdrift/overlay'
20
+
21
+ function App() {
22
+ return (
23
+ <>
24
+ <YourApp />
25
+
26
+ {/* Dev-only — tree-shaken in production builds */}
27
+ {import.meta.env.DEV && (
28
+ <DriftOverlay
29
+ config={{
30
+ storybookUrl: 'https://your-storybook.chromatic.com',
31
+ figmaFileKey: 'your-figma-file-key',
32
+ threshold: 80,
33
+ components: {
34
+ // Register every component in your design system
35
+ Button: { storyPath: 'primitives-button--primary' },
36
+ Input: { storyPath: 'primitives-input--default' },
37
+ Modal: { storyPath: 'primitives-modal--default' },
38
+ Navbar: { storyPath: 'shell-navbar--default' },
39
+ // ...
40
+ }
41
+ }}
42
+ />
43
+ )}
44
+ </>
45
+ )
46
+ }
47
+ ```
48
+
49
+ Press **D** in the browser to open the overlay.
50
+
51
+ ---
52
+
53
+ ## Config reference
54
+
55
+ | Option | Type | Description |
56
+ |---|---|---|
57
+ | `components` | `Record<string, DriftComponentEntry>` | **Required.** Your DS component registry. |
58
+ | `storybookUrl` | `string` | Storybook base URL. Default: `http://localhost:6006` |
59
+ | `chromaticUrl` | `string` | Deployed Storybook URL for public links (Chromatic, Netlify, etc.) |
60
+ | `figmaFileKey` | `string` | Figma file key — enables "Open in Figma" links. |
61
+ | `jiraBaseUrl` | `string` | Jira instance URL for one-click ticket creation. |
62
+ | `jiraProjectKey` | `string` | Jira project key to pre-fill new tickets. |
63
+ | `threshold` | `number` | Coverage threshold for CI (0–100). Default: `80` |
64
+
65
+ ### Component entry
66
+
67
+ ```ts
68
+ {
69
+ storyPath?: string // e.g. 'primitives-button--primary' → powers "Open in Storybook" links
70
+ figmaLink?: string // e.g. 'https://figma.com/design/KEY?node-id=1:2'
71
+ }
72
+ ```
73
+
74
+ ---
75
+
76
+ ## What it detects
77
+
78
+ - **Component gaps** — components rendered on screen that aren't in your registry
79
+ - **Token violations** — hardcoded colors, border-radius, spacing, font-size, font-weight that should be CSS variables
80
+ - **Style overrides** — DS components using inline styles instead of tokens
81
+
82
+ ## What the overlay shows
83
+
84
+ - Live DS coverage score per page (%)
85
+ - Color-coded borders on every component (green = DS, red = gap, orange = drifted, grey = approved)
86
+ - Inspect any component — see props, token violations, fix prompts
87
+ - One-click "Fix this" — copies an AI prompt to clipboard for Claude Code or Cursor
88
+ - Promote gaps — generates a structured Cursor/Claude prompt to build the missing component
89
+ - Coverage history — tracks your score per page across the session
90
+
91
+ ---
92
+
93
+ ## CI integration
94
+
95
+ Use the companion CLI for headless scanning on every PR:
96
+
97
+ ```bash
98
+ npx @catchdrift/cli check --url http://localhost:5173 --threshold 80
99
+ ```
100
+
101
+ See [catchdrift.ai](https://catchdrift.ai) for the full GitHub Action setup.
102
+
103
+ ---
104
+
105
+ ## License
106
+
107
+ MIT — [catchdrift.ai](https://catchdrift.ai)