Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
design_handoff.hpp
Go to the documentation of this file.
1#pragma once
2
3// pulp::design — Claude Design project-folder handoff contract.
4//
5// A design tool can export more than a single screen of HTML: a whole project
6// folder carrying a design system (`_ds/<slug>/` — token CSS + a readme), a
7// per-asset ledger (`.pulp-design-meta.json`, the same sidecar the CLI records),
8// and a **handoff README** that states implementer intent in machine-readable
9// prose — most importantly the explicit *fidelity declaration*: recreate the
10// screens pixel-for-pixel (hi-fi) or restyle them into the target design system
11// (lo-fi). That one bit prevents a whole class of wasted pixel-matching effort on
12// designs that were only ever meant to be re-skinned.
13//
14// This translation unit parses that folder + README into a structured
15// HandoffContract so the intent is a value the importer can act on instead of a
16// paragraph a human has to read. It is pure: it takes already-read text and a
17// directory listing, and does no filesystem or network I/O itself — the CLI owns
18// the walk. The formats are community conventions, not a vendor API, so the
19// contract is a versioned fingerprint (kHandoffFormatVersion) and every parse is
20// tolerant: an absent section is empty, never an error.
21
22#include <string>
23#include <string_view>
24#include <utility>
25#include <vector>
26
27namespace pulp::design {
28
30inline constexpr std::string_view kHandoffFormatVersion = "2026.07-design-handoff-v1";
31
38
40std::string_view fidelity_intent_name(FidelityIntent intent);
41
46
51 std::string name;
52 std::string path;
53 std::vector<std::pair<std::string, std::string>> specs;
54};
55
58 std::string format_version;
59 std::string source;
61 std::vector<std::string> design_systems;
62 std::vector<HandoffScreen> screens;
63 std::vector<std::pair<std::string, std::string>> tokens;
64 std::vector<std::string> interactions;
65};
66
75HandoffContract parse_handoff_readme(std::string_view markdown, std::string_view source);
76
80void merge_design_systems(HandoffContract& contract, const std::vector<std::string>& slugs);
81
83std::string handoff_contract_json(const HandoffContract& contract);
84
85} // namespace pulp::design
Definition design_adherence.hpp:32
constexpr std::string_view kHandoffFormatVersion
Format id stamped into the contract; bump on a non-additive shape change.
Definition design_handoff.hpp:30
std::string_view fidelity_intent_name(FidelityIntent intent)
Stable lowercase slug for a fidelity intent ("hifi" | "lofi" | "unspecified").
HandoffContract parse_handoff_readme(std::string_view markdown, std::string_view source)
Parse a handoff README (Markdown) into a contract.
FidelityIntent
The implementer intent the handoff declares for the screens.
Definition design_handoff.hpp:33
@ hifi
recreate pixel-for-pixel (the design IS the spec)
Definition design_handoff.hpp:35
@ lofi
restyle into the target design system (adapt, don't trace)
Definition design_handoff.hpp:36
@ unspecified
no declaration found — the importer must ask or default
Definition design_handoff.hpp:34
FidelityIntent fidelity_intent_from_text(std::string_view text)
Parse a fidelity value as written in a handoff README ("hi-fi", "high", "pixel-perfect",...
std::string handoff_contract_json(const HandoffContract &contract)
Serialize a contract to deterministic JSON for the import report.
void merge_design_systems(HandoffContract &contract, const std::vector< std::string > &slugs)
Merge design-system slugs discovered on disk (the _ds/<slug>/ directory names) into an already-parsed...
The parsed handoff contract.
Definition design_handoff.hpp:57
std::string format_version
kHandoffFormatVersion
Definition design_handoff.hpp:58
std::vector< HandoffScreen > screens
in document order
Definition design_handoff.hpp:62
FidelityIntent fidelity
Definition design_handoff.hpp:60
std::vector< std::string > design_systems
bound system slugs, sorted+unique
Definition design_handoff.hpp:61
std::vector< std::pair< std::string, std::string > > tokens
token table rows, in order
Definition design_handoff.hpp:63
std::string source
folder or README path
Definition design_handoff.hpp:59
std::vector< std::string > interactions
interaction/state notes
Definition design_handoff.hpp:64
One screen the handoff describes: a display name, an optional relative path to its source (from a (pa...
Definition design_handoff.hpp:50
std::vector< std::pair< std::string, std::string > > specs
Definition design_handoff.hpp:53
std::string name
Definition design_handoff.hpp:51
std::string path
empty when the heading carried no (path)
Definition design_handoff.hpp:52