raffina 0.2.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 Raffina contributors
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,129 @@
1
+ # Raffina
2
+
3
+ **Make AI-built interfaces feel intentional.**
4
+
5
+ Raffina is an evidence-backed design extraction and verification CLI for humans and coding agents. Give it a public website and it builds a reusable brand system from the rendered page—logos, fonts, colors, spacing, layout, assets, motion, shape, and voice. Use that system to guide an implementation, measure the rendered result, and iterate toward the reference.
6
+
7
+ Raffina is in early beta. Its artifacts are runtime-validated and versioned, but commands and scoring details may still evolve before 1.0.
8
+
9
+ Raffina is a design compiler and linter, not an official brand guide or a substitute for human review.
10
+
11
+ ## Install
12
+
13
+ Run without installing:
14
+
15
+ ```bash
16
+ bunx raffina --help
17
+ ```
18
+
19
+ Or install globally:
20
+
21
+ ```bash
22
+ bun add --global raffina
23
+ raffina --version
24
+ ```
25
+
26
+ The package is one bundled Bun CLI. It requires Bun 1.3 or newer and Chrome or Chromium for webpage extraction and verification. Set `CHROME_PATH` when the browser is installed in a non-standard location.
27
+
28
+ ## Quick start
29
+
30
+ Extract a responsive reference:
31
+
32
+ ```bash
33
+ bunx raffina extract https://cursor.com \
34
+ --viewport 1440x1000 \
35
+ --viewport 390x844 \
36
+ --screenshot 'reference-{viewport}.png' \
37
+ --output cursor.brand.json
38
+ ```
39
+
40
+ Inspect the useful system:
41
+
42
+ ```bash
43
+ bunx raffina inspect cursor.brand.json
44
+ bunx raffina inspect cursor.brand.json --json --summary
45
+ ```
46
+
47
+ Start the target application, then verify its rendered result:
48
+
49
+ ```bash
50
+ bunx raffina verify http://localhost:3000 \
51
+ --brand cursor.brand.json \
52
+ --viewport 1440x1000 \
53
+ --screenshot target.png \
54
+ --output report.json
55
+ ```
56
+
57
+ Iterate with category deltas, regressions, and ranked next fixes:
58
+
59
+ ```bash
60
+ bunx raffina iterate http://localhost:3000 \
61
+ --brand cursor.brand.json \
62
+ --history .raffina/iterations.json \
63
+ --report .raffina/latest.report.json \
64
+ --screenshot .raffina/latest.png \
65
+ --label hero-layout \
66
+ --json --summary
67
+ ```
68
+
69
+ ## Commands
70
+
71
+ | Command | Purpose |
72
+ | --- | --- |
73
+ | `raffina extract <url>` | Render a website and build a typed, evidence-backed brand system. |
74
+ | `raffina inspect <brand>` | Read the system as a human summary or bounded agent digest. |
75
+ | `raffina apply <brand> <target>` | Preview or write portable tokens and a conservative codebase adapter. |
76
+ | `raffina verify <target>` | Score one rendered target and produce actionable evidence. |
77
+ | `raffina iterate <target>` | Append an attempt, deltas, regressions, and next fixes. |
78
+ | `raffina skill install` | Install the bundled agent design-loop skill into Codex. |
79
+
80
+ Run `raffina <command> --help` for every option. Every command supports machine-readable output through `--json`.
81
+
82
+ ## What verification checks
83
+
84
+ Raffina measures screenshot structure, spatial composition, rendered colors, typography and loaded font bytes, asset identity, motion grammar, shape, and representative voice signals.
85
+
86
+ The default `brand` profile checks exact identity and voice. Use `--profile visual-system` to transfer composition, color, typography, motion, and shape while preserving the target product's logo and copy.
87
+
88
+ An `on-brand` verdict requires an overall score of at least 85, at least 80% evidence coverage, and the load-bearing category gates. Missing evidence becomes `not-measured`; it never silently receives a perfect score. Verification is specific to the captured viewport and state.
89
+
90
+ The installed package includes the exact formulas, evidence requirements, category ceilings, gate logic, and repair ordering in `docs/verification.md`.
91
+
92
+ ## Agent workflow
93
+
94
+ The package includes the `raffina-design-loop` skill:
95
+
96
+ ```bash
97
+ bunx raffina skill install
98
+ ```
99
+
100
+ It guides an agent through:
101
+
102
+ ```text
103
+ extract → inspect → understand the target → render a baseline
104
+ → implement one focused change → verify → keep or revert → repeat
105
+ ```
106
+
107
+ The CLI remains the deterministic measurement engine. The skill provides implementation strategy, bounded context, responsive iteration rules, and regression guardrails.
108
+
109
+ ## Providers
110
+
111
+ - `local` is the default and requires no paid service.
112
+ - `firecrawl` uses Firecrawl's hosted branding response.
113
+ - `hybrid` keeps rendered local evidence as the baseline and uses Firecrawl as an independent semantic vote.
114
+
115
+ ```bash
116
+ FIRECRAWL_API_KEY=... bunx raffina extract https://example.com \
117
+ --provider hybrid \
118
+ --output example.brand.json
119
+ ```
120
+
121
+ Provider conflicts remain visible rather than being silently overwritten. Never commit provider keys.
122
+
123
+ ## Important limits
124
+
125
+ Raffina does not grant rights to public assets, infer uncaptured routes or states, or replace human judgment for originality, accessibility, licensing, and brand-owner intent. It records asset URLs and fingerprints but does not redistribute logos, imagery, or fonts.
126
+
127
+ Source, architecture, benchmark evidence, and release instructions live in the [Raffina repository](https://github.com/zvadaadam/raffina).
128
+
129
+ MIT licensed.
Binary file