cox-protocol-package 1.0.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.
Files changed (53) hide show
  1. package/COX_FILE_FORMAT_SPECIFICATION_v1.0.md +236 -0
  2. package/LICENSE +21 -0
  3. package/README.md +192 -0
  4. package/bin/cox-protocol.js +57 -0
  5. package/editor-support/vscode/.vscodeignore +9 -0
  6. package/editor-support/vscode/CHANGELOG.md +12 -0
  7. package/editor-support/vscode/LICENSE +21 -0
  8. package/editor-support/vscode/README.md +32 -0
  9. package/editor-support/vscode/language-configuration.json +47 -0
  10. package/editor-support/vscode/package.json +90 -0
  11. package/editor-support/vscode/snippets/cox-common.json +12 -0
  12. package/editor-support/vscode/snippets/cox-component.json +41 -0
  13. package/editor-support/vscode/snippets/cox-crop-metadata.json +23 -0
  14. package/editor-support/vscode/snippets/cox-manifest.json +39 -0
  15. package/editor-support/vscode/snippets/cox-page.json +44 -0
  16. package/editor-support/vscode/snippets/cox-protocol.json +16 -0
  17. package/editor-support/vscode/syntaxes/cox.tmLanguage.json +30 -0
  18. package/guides/imported-packages/cox_protocol_package_compiled.md +32 -0
  19. package/guides/npm-installation.md +296 -0
  20. package/manifest.cox +106 -0
  21. package/package.json +53 -0
  22. package/protocols/coding_agent_starting_point.cox +67 -0
  23. package/protocols/component_binding_graph.cox +52 -0
  24. package/protocols/design_tokens.cox +42 -0
  25. package/protocols/deterministic_naming_convention.cox +159 -0
  26. package/protocols/evidence_and_uncertainty_protocol.cox +42 -0
  27. package/protocols/llm_agent_zip_recreation_instructions.cox +87 -0
  28. package/protocols/recursive_decomposition_protocol.cox +96 -0
  29. package/protocols/screenshot_partitioning_protocol.cox +64 -0
  30. package/protocols/sub_agents_orchestration.cox +85 -0
  31. package/protocols/visual_acceptance_checklist.cox +30 -0
  32. package/protocols/website_logic_and_functionality.cox +82 -0
  33. package/pyproject.toml +51 -0
  34. package/requirements.txt +4 -0
  35. package/schemas/cox.component.v1.schema.json +167 -0
  36. package/schemas/cox.crop_metadata.v1.schema.json +83 -0
  37. package/schemas/cox.manifest.v1.schema.json +172 -0
  38. package/schemas/cox.page.v1.schema.json +229 -0
  39. package/schemas/cox.protocol.v1.schema.json +38 -0
  40. package/skills/design-spec-writer/SKILL.md +182 -0
  41. package/skills/package-docs-writer/SKILL.md +270 -0
  42. package/skills/screenshot-semantic-namer/SKILL.md +96 -0
  43. package/skills/visual-token-extractor/SKILL.md +102 -0
  44. package/skills/zip-design-orchestrator/SKILL.md +113 -0
  45. package/skills/zip-packager/SKILL.md +127 -0
  46. package/templates/ComponentName.cox.template +33 -0
  47. package/templates/Page.cox.template +36 -0
  48. package/templates/crop_metadata.cox.template +15 -0
  49. package/tools/__init__.py +3 -0
  50. package/tools/cox_cli.py +127 -0
  51. package/tools/cox_lib.py +557 -0
  52. package/tools/package_target.py +214 -0
  53. package/tools/react_target.py +278 -0
@@ -0,0 +1,172 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "cox.manifest.v1",
4
+ "title": "COX Manifest",
5
+ "type": "object",
6
+ "required": [
7
+ "CoxVersion",
8
+ "FileType",
9
+ "Slug",
10
+ "Schema",
11
+ "ProjectName",
12
+ "ProtocolExtension",
13
+ "MimeType",
14
+ "EntryPoint",
15
+ "Pages"
16
+ ],
17
+ "properties": {
18
+ "CoxVersion": {
19
+ "const": "1.0"
20
+ },
21
+ "FileType": {
22
+ "const": "manifest"
23
+ },
24
+ "Slug": {
25
+ "type": "string",
26
+ "pattern": "^[a-z0-9]+(_[a-z0-9]+)*$"
27
+ },
28
+ "Schema": {
29
+ "const": "cox.manifest.v1"
30
+ },
31
+ "ProjectName": {
32
+ "type": "string",
33
+ "minLength": 1
34
+ },
35
+ "PackageName": {
36
+ "type": "string"
37
+ },
38
+ "ProtocolExtension": {
39
+ "const": ".cox"
40
+ },
41
+ "MimeType": {
42
+ "const": "application/vnd.cox+yaml"
43
+ },
44
+ "Encoding": {
45
+ "const": "UTF-8"
46
+ },
47
+ "SyntaxBase": {
48
+ "const": "YAML-compatible structured text"
49
+ },
50
+ "EntryPoint": {
51
+ "const": "manifest.cox"
52
+ },
53
+ "ReferenceDocs": {
54
+ "type": "array",
55
+ "items": {
56
+ "type": "string"
57
+ }
58
+ },
59
+ "GuideDocs": {
60
+ "type": "array",
61
+ "items": {
62
+ "type": "string"
63
+ }
64
+ },
65
+ "ProtocolDocs": {
66
+ "type": "array",
67
+ "items": {
68
+ "type": "string"
69
+ }
70
+ },
71
+ "SkillBundles": {
72
+ "type": "array",
73
+ "items": {
74
+ "type": "string"
75
+ }
76
+ },
77
+ "Schemas": {
78
+ "type": "array",
79
+ "items": {
80
+ "type": "string"
81
+ }
82
+ },
83
+ "ToolingFiles": {
84
+ "type": "array",
85
+ "items": {
86
+ "type": "string"
87
+ }
88
+ },
89
+ "Pages": {
90
+ "type": "array",
91
+ "minItems": 1,
92
+ "items": {
93
+ "type": "object",
94
+ "required": [
95
+ "PageName",
96
+ "Slug",
97
+ "Folder",
98
+ "PageInstruction",
99
+ "PageScreenshotPlaceholder",
100
+ "Components"
101
+ ],
102
+ "properties": {
103
+ "PageName": {
104
+ "type": "string"
105
+ },
106
+ "Slug": {
107
+ "type": "string",
108
+ "pattern": "^[a-z0-9]+(_[a-z0-9]+)*$"
109
+ },
110
+ "Folder": {
111
+ "type": "string"
112
+ },
113
+ "PageInstruction": {
114
+ "type": "string"
115
+ },
116
+ "PageScreenshotPlaceholder": {
117
+ "type": "string"
118
+ },
119
+ "Components": {
120
+ "type": "array",
121
+ "items": {
122
+ "type": "object",
123
+ "required": [
124
+ "Slug",
125
+ "Folder",
126
+ "ComponentInstruction",
127
+ "ComponentScreenshotPlaceholder"
128
+ ],
129
+ "properties": {
130
+ "Slug": {
131
+ "type": "string",
132
+ "pattern": "^[a-z0-9]+(_[a-z0-9]+)*$"
133
+ },
134
+ "Folder": {
135
+ "type": "string"
136
+ },
137
+ "ComponentInstruction": {
138
+ "type": "string"
139
+ },
140
+ "ComponentScreenshotPlaceholder": {
141
+ "type": "string"
142
+ }
143
+ },
144
+ "additionalProperties": true
145
+ }
146
+ }
147
+ },
148
+ "additionalProperties": true
149
+ }
150
+ },
151
+ "BuildTargets": {
152
+ "type": "array",
153
+ "minItems": 1,
154
+ "uniqueItems": true,
155
+ "items": {
156
+ "type": "string",
157
+ "enum": [
158
+ "json",
159
+ "react",
160
+ "package"
161
+ ]
162
+ }
163
+ },
164
+ "VerificationRules": {
165
+ "type": "array",
166
+ "items": {
167
+ "type": "string"
168
+ }
169
+ }
170
+ },
171
+ "additionalProperties": true
172
+ }
@@ -0,0 +1,229 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "cox.page.v1",
4
+ "title": "COX Page Spec",
5
+ "type": "object",
6
+ "required": [
7
+ "CoxVersion",
8
+ "FileType",
9
+ "PageName",
10
+ "Slug",
11
+ "Schema",
12
+ "ProjectName",
13
+ "EvidenceSummary",
14
+ "VisibleStructure",
15
+ "Interactions",
16
+ "NamingDecision",
17
+ "Layout",
18
+ "Children",
19
+ "RecursiveDecompositionDecision"
20
+ ],
21
+ "properties": {
22
+ "CoxVersion": {
23
+ "const": "1.0"
24
+ },
25
+ "FileType": {
26
+ "const": "page_spec"
27
+ },
28
+ "PageName": {
29
+ "type": "string",
30
+ "minLength": 1
31
+ },
32
+ "Slug": {
33
+ "type": "string",
34
+ "pattern": "^[a-z0-9]+(_[a-z0-9]+)*$"
35
+ },
36
+ "Schema": {
37
+ "const": "cox.page.v1"
38
+ },
39
+ "ProjectName": {
40
+ "type": "string",
41
+ "minLength": 1
42
+ },
43
+ "PageType": {
44
+ "type": "string"
45
+ },
46
+ "EvidenceSummary": {
47
+ "$ref": "#/$defs/evidenceSummary"
48
+ },
49
+ "VisibleStructure": {
50
+ "type": "object"
51
+ },
52
+ "Interactions": {
53
+ "$ref": "#/$defs/interactionSummary"
54
+ },
55
+ "NamingDecision": {
56
+ "$ref": "#/$defs/namingDecision"
57
+ },
58
+ "Layout": {
59
+ "type": "object",
60
+ "required": [
61
+ "Desktop",
62
+ "Tablet",
63
+ "Mobile"
64
+ ],
65
+ "properties": {
66
+ "Desktop": {
67
+ "type": "string"
68
+ },
69
+ "Tablet": {
70
+ "type": "string"
71
+ },
72
+ "Mobile": {
73
+ "type": "string"
74
+ }
75
+ },
76
+ "additionalProperties": true
77
+ },
78
+ "Children": {
79
+ "type": "object",
80
+ "properties": {
81
+ "Components": {
82
+ "type": "array",
83
+ "items": {
84
+ "type": "object",
85
+ "required": [
86
+ "Slug",
87
+ "Folder",
88
+ "Role"
89
+ ],
90
+ "properties": {
91
+ "Slug": {
92
+ "type": "string",
93
+ "pattern": "^[a-z0-9]+(_[a-z0-9]+)*$"
94
+ },
95
+ "Folder": {
96
+ "type": "string"
97
+ },
98
+ "Role": {
99
+ "type": "string"
100
+ }
101
+ },
102
+ "additionalProperties": true
103
+ }
104
+ }
105
+ },
106
+ "additionalProperties": true
107
+ },
108
+ "RecursiveDecompositionDecision": {
109
+ "type": "object",
110
+ "required": [
111
+ "Complexity",
112
+ "Reason",
113
+ "Action"
114
+ ],
115
+ "properties": {
116
+ "Complexity": {
117
+ "type": "string"
118
+ },
119
+ "Reason": {
120
+ "type": "string"
121
+ },
122
+ "Action": {
123
+ "type": "string"
124
+ }
125
+ },
126
+ "additionalProperties": true
127
+ }
128
+ },
129
+ "$defs": {
130
+ "evidenceSummary": {
131
+ "type": "object",
132
+ "properties": {
133
+ "Visible": {
134
+ "type": "array",
135
+ "items": {
136
+ "type": "string"
137
+ }
138
+ },
139
+ "UserSpecified": {
140
+ "type": "array",
141
+ "items": {
142
+ "type": "string"
143
+ }
144
+ },
145
+ "Inferred": {
146
+ "type": "array",
147
+ "items": {
148
+ "type": "string"
149
+ }
150
+ },
151
+ "Intended": {
152
+ "type": "array",
153
+ "items": {
154
+ "type": "string"
155
+ }
156
+ },
157
+ "Recommended": {
158
+ "type": "array",
159
+ "items": {
160
+ "type": "string"
161
+ }
162
+ }
163
+ },
164
+ "additionalProperties": true
165
+ },
166
+ "interactionSummary": {
167
+ "type": "object",
168
+ "properties": {
169
+ "Visible": {
170
+ "type": "array",
171
+ "items": {
172
+ "type": "string"
173
+ }
174
+ },
175
+ "Inferred": {
176
+ "type": "array",
177
+ "items": {
178
+ "type": "string"
179
+ }
180
+ },
181
+ "Intended": {
182
+ "type": "array",
183
+ "items": {
184
+ "type": "string"
185
+ }
186
+ },
187
+ "Recommended": {
188
+ "type": "array",
189
+ "items": {
190
+ "type": "string"
191
+ }
192
+ }
193
+ },
194
+ "additionalProperties": true
195
+ },
196
+ "namingDecision": {
197
+ "type": "object",
198
+ "required": [
199
+ "ChosenName",
200
+ "Reason",
201
+ "RejectedAlternatives",
202
+ "AmbiguityRisk",
203
+ "EvidenceLevel"
204
+ ],
205
+ "properties": {
206
+ "ChosenName": {
207
+ "type": "string"
208
+ },
209
+ "Reason": {
210
+ "type": "string"
211
+ },
212
+ "RejectedAlternatives": {
213
+ "type": "array",
214
+ "items": {
215
+ "type": "string"
216
+ }
217
+ },
218
+ "AmbiguityRisk": {
219
+ "type": "string"
220
+ },
221
+ "EvidenceLevel": {
222
+ "type": "string"
223
+ }
224
+ },
225
+ "additionalProperties": true
226
+ }
227
+ },
228
+ "additionalProperties": true
229
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "cox.protocol.v1",
4
+ "title": "COX Protocol Document",
5
+ "type": "object",
6
+ "required": [
7
+ "CoxVersion",
8
+ "FileType",
9
+ "Slug",
10
+ "Schema",
11
+ "ProtocolName",
12
+ "Purpose"
13
+ ],
14
+ "properties": {
15
+ "CoxVersion": {
16
+ "const": "1.0"
17
+ },
18
+ "FileType": {
19
+ "const": "protocol_doc"
20
+ },
21
+ "Slug": {
22
+ "type": "string",
23
+ "pattern": "^[a-z0-9]+(_[a-z0-9]+)*$"
24
+ },
25
+ "Schema": {
26
+ "const": "cox.protocol.v1"
27
+ },
28
+ "ProtocolName": {
29
+ "type": "string",
30
+ "minLength": 1
31
+ },
32
+ "Purpose": {
33
+ "type": "string",
34
+ "minLength": 1
35
+ }
36
+ },
37
+ "additionalProperties": true
38
+ }
@@ -0,0 +1,182 @@
1
+ ---
2
+ name: design-spec-writer
3
+ description: >
4
+ Expert at writing per-screenshot design specification files in both human-readable compact markdown
5
+ (.design.md) and machine-readable YAML (.yaml) formats, following the LLMAgentZipRecreation spec
6
+ structure. Use this skill for Steps 04 and 05 of the LLMAgentZipRecreation workflow, or any time
7
+ the user wants structured component specs generated from UI screenshots. Trigger on: "write design
8
+ specs for these screenshots", "generate component YAML from this mockup", "document this UI section",
9
+ "create .design.md files from these images", or when the zip-design-orchestrator delegates Steps
10
+ 04–05. Also valuable standalone when a developer or designer wants implementation-ready component
11
+ documentation from any UI reference.
12
+ ---
13
+
14
+ # Design Spec Writer
15
+
16
+ You are the expert for **Steps 04 and 05** of the LLMAgentZipRecreation workflow. For each renamed
17
+ screenshot, you produce two files:
18
+ - `{slug}.design.md` — human-readable, compact nested component format
19
+ - `{slug}.yaml` — machine-readable YAML component hierarchy
20
+
21
+ Both files reference the shared `VisualTokens` from the visual-token-extractor. Process each
22
+ screenshot one at a time, completing both files before moving to the next.
23
+
24
+ ---
25
+
26
+ ## Step 04 — Write `.design.md` (Human-Readable Spec)
27
+
28
+ ### Format Rules
29
+
30
+ Use the **compact special nested component format**: nested `{Block: [...]}` syntax that reads as
31
+ markdown but describes design structure concisely.
32
+
33
+ ```markdown
34
+ # {SectionName}
35
+
36
+ {SectionLayout: [desktop-first, glass surface, native macOS spacing]}
37
+ {PrimaryRegion: [role, alignment, width behavior]}
38
+ {SecondaryRegion: [role, alignment, width behavior]}
39
+
40
+ {ComponentName: [key visual traits, animation, states]}
41
+ {SubComponent: {property: value} {property: value}}
42
+ {Interaction: [hover, click, keyboard, drag, menu]}
43
+
44
+ {VisualTokens: [→ see shared visual_tokens block]}
45
+
46
+ {Responsive: [xl behavior, lg behavior, md behavior, sm behavior]}
47
+ ```
48
+
49
+ ### Required Sections
50
+
51
+ Every `.design.md` must contain:
52
+ 1. **Section name** as H1
53
+ 2. **Layout block** — overall structure, regions, alignment
54
+ 3. **Component blocks** — one per major UI component visible in the screenshot
55
+ 4. **VisualStyle reference** — pointer to shared visual tokens
56
+ 5. **InteractionNotes** — hover, click, keyboard, drag, empty-state behaviors
57
+ 6. **ResponsiveBehavior** — how the section adapts across breakpoints
58
+
59
+ ### Component Writing Rules
60
+
61
+ - Describe **visible structure**, not product marketing copy
62
+ - Use **implementation vocabulary**: `grid`, `stack`, `row`, `panel`, `card`, `rail`, `toolbar`,
63
+ `token`, `state`, `pill`, `badge`, `overlay`
64
+ - Note **states explicitly**: `default`, `hover`, `active`, `loading`, `empty`, `error`, `running`,
65
+ `stopped`, `selected`
66
+ - Mark anything not clearly visible as `[Inferred]`
67
+
68
+ ### Example Output
69
+
70
+ ```markdown
71
+ # Projects Grid Cards
72
+
73
+ {ProjectsLayout: [main content area, desktop-first, fills remaining width after sidebar]}
74
+ {GridRegion: [4-col xl, 3-col lg, 2-col md, 1-col sm, auto-fill with min-width]}
75
+ {ControlsBar: [row above grid, sort dropdown + grid/list toggle, right-aligned]}
76
+
77
+ {ProjectCardsGrid: [glass surface, 8px gap, staggered fade-in on load]}
78
+ {ProjectCard: [glass card, rounded-xl, hover lift, shadow elevation]}
79
+ {ProjectInfo {Title: body text, black, bold, fills row} {ActionMenu: ellipsis, fixed width}}
80
+ {ProjectCreativeVisual {PreviewStage: wide screenshot panel, clean perspective} {IconBadge: overlapping lower-left} {PortBadge: floating lower-right pill}}
81
+ {ProjectMeta {Description: two-line clamp, muted} {StatsRow: stars + branches + last activity} {StatusDot: green running / amber stopped}}
82
+ {Interaction: [hover → card lifts + shadow deepens, click → navigate to project detail]}
83
+
84
+ {EmptyState: [centered illustration + CTA button, shown when no projects exist]}
85
+
86
+ {Responsive: [4col-xl, 3col-lg, 2col-md, 1col-sm]}
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Step 05 — Write `.yaml` (Machine-Readable Spec)
92
+
93
+ ### YAML Rules
94
+
95
+ - Valid YAML only — always verify indentation
96
+ - `PascalCase` keys for components
97
+ - Arrays for: responsive variants, states, supported controls
98
+ - Concise scalar values for styling tokens
99
+ - Reference `VisualTokens` at the top level — don't repeat token values inline
100
+
101
+ ### Required Top-Level Keys
102
+
103
+ ```yaml
104
+ Section: ""
105
+ Purpose: ""
106
+ Layout: {}
107
+ Components: {}
108
+ VisualStyle:
109
+ Tokens: "→ shared VisualTokens block"
110
+ Interactions: []
111
+ Responsive: {}
112
+ ImplementationHints: []
113
+ ```
114
+
115
+ ### Component Pattern
116
+
117
+ ```yaml
118
+ Components:
119
+ ComponentName:
120
+ Structure:
121
+ - "Subpart description"
122
+ - "Subpart description"
123
+ Visual:
124
+ Surface: "glass card"
125
+ Border: "1px translucent stroke"
126
+ Radius: "large (16px)"
127
+ Shadow: "0 2px 8px rgba(0,0,0,0.08)"
128
+ States:
129
+ - default
130
+ - hover
131
+ - active
132
+ - loading
133
+ Behavior:
134
+ Hover: "translateY -2px, shadow deepens"
135
+ Active: "accent ring (2px blue-violet)"
136
+ Empty: "placeholder illustration + CTA"
137
+ DataBindings:
138
+ - "projectId"
139
+ - "status"
140
+ - "lastAccessed"
141
+ ```
142
+
143
+ ### Card Grid Specific Pattern
144
+
145
+ ```yaml
146
+ ProjectCardsGrid:
147
+ Columns:
148
+ xl: 4
149
+ lg: 3
150
+ md: 2
151
+ sm: 1
152
+ Gap: "8px"
153
+ Sorting: true
154
+ GridListToggle: true
155
+ CardAnimation: "GSAP-friendly staggered fade + lift"
156
+ VirtualScrolling: true # Inferred for large sets
157
+ ```
158
+
159
+ ### Implementation Hints
160
+
161
+ Always include 2–4 `ImplementationHints` that an engineer can act on immediately:
162
+
163
+ ```yaml
164
+ ImplementationHints:
165
+ - "Use CSS grid with auto-fill and min-width for responsive columns"
166
+ - "GSAP staggerFrom for card entry animation (delay: 0.05s per card)"
167
+ - "Status dot color driven by project.status enum (running/stopped/paused/error)"
168
+ - "Preview image cached at 400×240px, refreshed on project save"
169
+ ```
170
+
171
+ ---
172
+
173
+ ## Processing Order
174
+
175
+ For each slug in the project:
176
+ 1. Load (view) the renamed screenshot
177
+ 2. Write the `.design.md`
178
+ 3. Write the `.yaml`
179
+ 4. Move to the next slug
180
+
181
+ Confirm completion of each pair before moving on:
182
+ > "✓ `projects_grid_cards.design.md` + `.yaml` written. Moving to `analytics_sidebar_panels`…"