cox-protocol-package 1.0.2 → 1.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/COX_FILE_FORMAT_SPECIFICATION_v1.0.md +40 -200
  3. package/FINALIZATION.md +50 -0
  4. package/LocalAppManager/Dashboard/analytics_sidebar_panels/analytics_sidebar_panels.cox +56 -0
  5. package/LocalAppManager/Dashboard/analytics_sidebar_panels/analytics_sidebar_panels_screenshot.placeholder.txt +1 -0
  6. package/LocalAppManager/Dashboard/dashboard.cox +62 -0
  7. package/LocalAppManager/Dashboard/dashboard_screenshot.placeholder.txt +1 -0
  8. package/LocalAppManager/Dashboard/left_navigation_sidebar/left_navigation_sidebar.cox +56 -0
  9. package/LocalAppManager/Dashboard/left_navigation_sidebar/left_navigation_sidebar_screenshot.placeholder.txt +1 -0
  10. package/LocalAppManager/Dashboard/projects_grid_cards/projects_grid_cards.cox +56 -0
  11. package/LocalAppManager/Dashboard/projects_grid_cards/projects_grid_cards_screenshot.placeholder.txt +1 -0
  12. package/LocalAppManager/Dashboard/top_header_stats_bar/top_header_stats_bar.cox +56 -0
  13. package/LocalAppManager/Dashboard/top_header_stats_bar/top_header_stats_bar_screenshot.placeholder.txt +1 -0
  14. package/MANIFEST.in +20 -0
  15. package/README.md +67 -154
  16. package/bin/cox-protocol.js +23 -97
  17. package/cox_protocol/__init__.py +2 -0
  18. package/cox_protocol/__main__.py +3 -0
  19. package/cox_protocol/compiler.py +273 -0
  20. package/cox_protocol/cox_cli.py +146 -0
  21. package/cox_protocol/cox_lib.py +599 -0
  22. package/cox_protocol/package_target.py +262 -0
  23. package/cox_protocol/react_target.py +306 -0
  24. package/cox_protocol/scaffold.py +56 -0
  25. package/cox_protocol/schemas/cox.component.v1.schema.json +180 -0
  26. package/cox_protocol/schemas/cox.crop_metadata.v1.schema.json +83 -0
  27. package/cox_protocol/schemas/cox.manifest.v1.schema.json +172 -0
  28. package/cox_protocol/schemas/cox.page.v1.schema.json +242 -0
  29. package/cox_protocol/schemas/cox.protocol.v1.schema.json +38 -0
  30. package/cox_protocol/starter/README.md +7 -0
  31. package/cox_protocol/starter/manifest.cox +26 -0
  32. package/cox_protocol/starter/page/action_button/action_button.cox +34 -0
  33. package/cox_protocol/starter/page/action_button/reference.svg +1 -0
  34. package/cox_protocol/starter/page/page.cox +39 -0
  35. package/cox_protocol/starter/page/reference.svg +1 -0
  36. package/editor-support/vscode/CHANGELOG.md +6 -0
  37. package/editor-support/vscode/README.md +2 -1
  38. package/editor-support/vscode/package.json +3 -3
  39. package/editor-support/vscode/snippets/cox-common.json +1 -1
  40. package/editor-support/vscode/snippets/cox-component.json +2 -1
  41. package/editor-support/vscode/snippets/cox-crop-metadata.json +1 -1
  42. package/editor-support/vscode/snippets/cox-manifest.json +1 -1
  43. package/editor-support/vscode/snippets/cox-page.json +2 -1
  44. package/editor-support/vscode/snippets/cox-protocol.json +1 -1
  45. package/examples/quickstart/README.md +7 -0
  46. package/examples/quickstart/manifest.cox +26 -0
  47. package/examples/quickstart/page/action_button/action_button.cox +34 -0
  48. package/examples/quickstart/page/action_button/reference.svg +1 -0
  49. package/examples/quickstart/page/page.cox +39 -0
  50. package/examples/quickstart/page/reference.svg +1 -0
  51. package/guides/contract-demo.md +24 -0
  52. package/guides/npm-installation.md +16 -287
  53. package/manifest.cox +7 -4
  54. package/package.json +30 -14
  55. package/protocols/recursive_decomposition_protocol.cox +8 -8
  56. package/pyproject.toml +17 -6
  57. package/schemas/cox.component.v1.schema.json +17 -4
  58. package/schemas/cox.crop_metadata.v1.schema.json +1 -1
  59. package/schemas/cox.manifest.v1.schema.json +1 -1
  60. package/schemas/cox.page.v1.schema.json +17 -4
  61. package/schemas/cox.protocol.v1.schema.json +1 -1
  62. package/scripts/check_distribution.py +87 -0
  63. package/scripts/demo.py +62 -0
  64. package/scripts/package-vscode.mjs +12 -0
  65. package/scripts/release_check.py +86 -0
  66. package/tests/conftest.py +21 -0
  67. package/tests/test_cli_and_typescript.py +123 -0
  68. package/tests/test_compiler.py +279 -0
  69. package/tests/test_validation.py +215 -0
  70. package/tools/__init__.py +2 -2
  71. package/tools/cox_cli.py +2 -123
  72. package/tools/cox_lib.py +2 -558
  73. package/tools/package_target.py +2 -214
  74. package/tools/react_target.py +2 -278
@@ -0,0 +1,180 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "cox.component.v1",
4
+ "title": "COX Component Spec",
5
+ "type": "object",
6
+ "required": [
7
+ "CoxVersion",
8
+ "FileType",
9
+ "ComponentName",
10
+ "Slug",
11
+ "Schema",
12
+ "Role",
13
+ "EvidenceSummary",
14
+ "VisibleStructure",
15
+ "Interactions",
16
+ "NamingDecision"
17
+ ],
18
+ "properties": {
19
+ "CoxVersion": {
20
+ "const": "1.0"
21
+ },
22
+ "FileType": {
23
+ "const": "component_spec"
24
+ },
25
+ "ComponentName": {
26
+ "type": "string",
27
+ "minLength": 1
28
+ },
29
+ "Slug": {
30
+ "type": "string",
31
+ "pattern": "^[a-z0-9]+(_[a-z0-9]+)*$"
32
+ },
33
+ "Schema": {
34
+ "const": "cox.component.v1"
35
+ },
36
+ "Role": {
37
+ "type": "string"
38
+ },
39
+ "EvidenceSummary": {
40
+ "$ref": "#/$defs/evidenceSummary"
41
+ },
42
+ "VisibleStructure": {
43
+ "type": "object"
44
+ },
45
+ "Interactions": {
46
+ "$ref": "#/$defs/interactionSummary"
47
+ },
48
+ "NamingDecision": {
49
+ "$ref": "#/$defs/namingDecision"
50
+ },
51
+ "VisualStyle": {
52
+ "type": "object"
53
+ },
54
+ "Responsive": {
55
+ "type": "object"
56
+ },
57
+ "ImplementationHints": {
58
+ "type": "array",
59
+ "items": {
60
+ "type": "string"
61
+ }
62
+ },
63
+ "ChildSubcomponents": {
64
+ "type": "array"
65
+ }
66
+ },
67
+ "$defs": {
68
+ "evidenceSummary": {
69
+ "type": "object",
70
+ "properties": {
71
+ "Visible": {
72
+ "type": "array",
73
+ "items": {
74
+ "type": "string"
75
+ }
76
+ },
77
+ "UserSpecified": {
78
+ "type": "array",
79
+ "items": {
80
+ "type": "string"
81
+ }
82
+ },
83
+ "Inferred": {
84
+ "type": "array",
85
+ "items": {
86
+ "type": "string"
87
+ }
88
+ },
89
+ "Intended": {
90
+ "type": "array",
91
+ "items": {
92
+ "type": "string"
93
+ }
94
+ },
95
+ "Recommended": {
96
+ "type": "array",
97
+ "items": {
98
+ "type": "string"
99
+ }
100
+ }
101
+ },
102
+ "additionalProperties": false
103
+ },
104
+ "interactionSummary": {
105
+ "type": "object",
106
+ "properties": {
107
+ "Visible": {
108
+ "type": "array",
109
+ "items": {
110
+ "type": "string"
111
+ }
112
+ },
113
+ "Inferred": {
114
+ "type": "array",
115
+ "items": {
116
+ "type": "string"
117
+ }
118
+ },
119
+ "Intended": {
120
+ "type": "array",
121
+ "items": {
122
+ "type": "string"
123
+ }
124
+ },
125
+ "Recommended": {
126
+ "type": "array",
127
+ "items": {
128
+ "type": "string"
129
+ }
130
+ },
131
+ "UserSpecified": {
132
+ "type": "array",
133
+ "items": {
134
+ "type": "string"
135
+ }
136
+ }
137
+ },
138
+ "additionalProperties": false
139
+ },
140
+ "namingDecision": {
141
+ "type": "object",
142
+ "required": [
143
+ "ChosenName",
144
+ "Reason",
145
+ "RejectedAlternatives",
146
+ "AmbiguityRisk",
147
+ "EvidenceLevel"
148
+ ],
149
+ "properties": {
150
+ "ChosenName": {
151
+ "type": "string"
152
+ },
153
+ "Reason": {
154
+ "type": "string"
155
+ },
156
+ "RejectedAlternatives": {
157
+ "type": "array",
158
+ "items": {
159
+ "type": "string"
160
+ }
161
+ },
162
+ "AmbiguityRisk": {
163
+ "type": "string"
164
+ },
165
+ "EvidenceLevel": {
166
+ "type": "string",
167
+ "enum": [
168
+ "Visible",
169
+ "UserSpecified",
170
+ "Inferred",
171
+ "Intended",
172
+ "Recommended"
173
+ ]
174
+ }
175
+ },
176
+ "additionalProperties": true
177
+ }
178
+ },
179
+ "additionalProperties": true
180
+ }
@@ -0,0 +1,83 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "cox.crop_metadata.v1",
4
+ "title": "COX Crop Metadata",
5
+ "type": "object",
6
+ "required": [
7
+ "CoxVersion",
8
+ "FileType",
9
+ "Slug",
10
+ "Schema",
11
+ "SourceScreenshot",
12
+ "OutputScreenshot",
13
+ "BoundaryConfidence",
14
+ "EstimatedBoundingBox"
15
+ ],
16
+ "properties": {
17
+ "CoxVersion": {
18
+ "const": "1.0"
19
+ },
20
+ "FileType": {
21
+ "const": "crop_metadata"
22
+ },
23
+ "Slug": {
24
+ "type": "string",
25
+ "pattern": "^[a-z0-9]+(_[a-z0-9]+)*$"
26
+ },
27
+ "Schema": {
28
+ "const": "cox.crop_metadata.v1"
29
+ },
30
+ "SourceScreenshot": {
31
+ "type": "string"
32
+ },
33
+ "OutputScreenshot": {
34
+ "type": "string"
35
+ },
36
+ "BoundaryConfidence": {
37
+ "type": "string",
38
+ "enum": [
39
+ "High",
40
+ "Medium",
41
+ "Low"
42
+ ]
43
+ },
44
+ "EstimatedBoundingBox": {
45
+ "type": "object",
46
+ "required": [
47
+ "Unit",
48
+ "X",
49
+ "Y",
50
+ "Width",
51
+ "Height"
52
+ ],
53
+ "properties": {
54
+ "Unit": {
55
+ "type": "string"
56
+ },
57
+ "X": {
58
+ "type": "string"
59
+ },
60
+ "Y": {
61
+ "type": "string"
62
+ },
63
+ "Width": {
64
+ "type": "string"
65
+ },
66
+ "Height": {
67
+ "type": "string"
68
+ }
69
+ },
70
+ "additionalProperties": true
71
+ },
72
+ "IncludedPaddingReason": {
73
+ "type": "string"
74
+ },
75
+ "ExcludedRegions": {
76
+ "type": "array",
77
+ "items": {
78
+ "type": "string"
79
+ }
80
+ }
81
+ },
82
+ "additionalProperties": true
83
+ }
@@ -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,242 @@
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": false
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
+ "UserSpecified": {
194
+ "type": "array",
195
+ "items": {
196
+ "type": "string"
197
+ }
198
+ }
199
+ },
200
+ "additionalProperties": false
201
+ },
202
+ "namingDecision": {
203
+ "type": "object",
204
+ "required": [
205
+ "ChosenName",
206
+ "Reason",
207
+ "RejectedAlternatives",
208
+ "AmbiguityRisk",
209
+ "EvidenceLevel"
210
+ ],
211
+ "properties": {
212
+ "ChosenName": {
213
+ "type": "string"
214
+ },
215
+ "Reason": {
216
+ "type": "string"
217
+ },
218
+ "RejectedAlternatives": {
219
+ "type": "array",
220
+ "items": {
221
+ "type": "string"
222
+ }
223
+ },
224
+ "AmbiguityRisk": {
225
+ "type": "string"
226
+ },
227
+ "EvidenceLevel": {
228
+ "type": "string",
229
+ "enum": [
230
+ "Visible",
231
+ "UserSpecified",
232
+ "Inferred",
233
+ "Intended",
234
+ "Recommended"
235
+ ]
236
+ }
237
+ },
238
+ "additionalProperties": true
239
+ }
240
+ },
241
+ "additionalProperties": true
242
+ }
@@ -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
+ }