@fugood/bricks-project 2.24.0-beta.39 → 2.24.0-beta.40
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/package.json +3 -4
- package/package.json.bak +27 -0
- package/skills/bricks-design/LICENSE.txt +180 -0
- package/skills/bricks-design/SKILL.md +66 -0
- package/skills/bricks-project/SKILL.md +2 -2
- package/skills/bricks-project/rules/animation.md +1 -1
- package/skills/bricks-project/rules/architecture-patterns.md +1 -1
- package/skills/bricks-project/rules/buttress.md +1 -1
- package/skills/bricks-project/rules/data-calculation.md +1 -1
- package/skills/bricks-project/rules/local-sync.md +2 -2
- package/skills/bricks-project/rules/media-flow.md +3 -3
- package/skills/bricks-project/rules/remote-data-bank.md +6 -6
- package/skills/bricks-project/rules/standby-transition.md +1 -1
- package/tools/mcp-server.ts +1 -1
- package/tools/postinstall.ts +19 -10
- package/tools/preview-main.mjs +25 -19
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fugood/bricks-project",
|
|
3
|
-
"version": "2.24.0-beta.
|
|
3
|
+
"version": "2.24.0-beta.40",
|
|
4
4
|
"main": "index.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"typecheck": "tsc --noEmit",
|
|
7
7
|
"build": "bun scripts/build.js"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@fugood/bricks-cli": "^2.24.0-beta.
|
|
10
|
+
"@fugood/bricks-cli": "^2.24.0-beta.40",
|
|
11
11
|
"@huggingface/gguf": "^0.3.2",
|
|
12
12
|
"@iarna/toml": "^3.0.0",
|
|
13
13
|
"@modelcontextprotocol/sdk": "^1.15.0",
|
|
@@ -23,6 +23,5 @@
|
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"oxfmt": "^0.36.0"
|
|
26
|
-
}
|
|
27
|
-
"gitHead": "f74322101339ff5efb796a89fcd8f0a52c2465ce"
|
|
26
|
+
}
|
|
28
27
|
}
|
package/package.json.bak
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fugood/bricks-ctor",
|
|
3
|
+
"version": "2.24.0-beta.40",
|
|
4
|
+
"main": "index.ts",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"typecheck": "tsc --noEmit",
|
|
7
|
+
"build": "bun scripts/build.js"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@fugood/bricks-cli": "^2.24.0-beta.40",
|
|
11
|
+
"@huggingface/gguf": "^0.3.2",
|
|
12
|
+
"@iarna/toml": "^3.0.0",
|
|
13
|
+
"@modelcontextprotocol/sdk": "^1.15.0",
|
|
14
|
+
"@toon-format/toon": "^2.1.0",
|
|
15
|
+
"@types/bun": "^1.3.9",
|
|
16
|
+
"@types/escodegen": "^0.0.10",
|
|
17
|
+
"@types/lodash": "^4.17.12",
|
|
18
|
+
"acorn": "^8.13.0",
|
|
19
|
+
"escodegen": "2.1.0",
|
|
20
|
+
"fuse.js": "^7.0.0",
|
|
21
|
+
"lodash": "^4.17.4",
|
|
22
|
+
"uuid": "^8.3.1"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"oxfmt": "^0.36.0"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
This skill is a derivative work based on:
|
|
179
|
+
https://github.com/anthropics/skills/blob/main/skills/frontend-design/SKILL.md
|
|
180
|
+
Copyright Anthropic, PBC. Licensed under the Apache License, Version 2.0.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bricks-design
|
|
3
|
+
description: Create distinctive, production-grade BRICKS application interfaces with high design quality. Use this skill when the user asks to build BRICKS canvases, screens, layouts, or applications. Generates creative, polished BRICKS code that avoids generic aesthetics.
|
|
4
|
+
license: Complete terms in LICENSE.txt (Apache-2.0, based on github.com/anthropics/skills)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
This skill guides creation of distinctive, production-grade BRICKS application interfaces that avoid generic aesthetics. Implement working code with exceptional attention to visual design and creative choices.
|
|
8
|
+
|
|
9
|
+
The user provides interface requirements: a screen, layout, application, or component to build. They may include context about the purpose, audience, platform, or technical constraints.
|
|
10
|
+
|
|
11
|
+
## Design Thinking
|
|
12
|
+
|
|
13
|
+
Before coding, understand the context and commit to a **bold** aesthetic direction:
|
|
14
|
+
- **Purpose**: What problem does this interface solve? Who uses it? What platform(s)?
|
|
15
|
+
- **Tone**: Pick a strong direction: brutally minimal, maximalist, retro-futuristic, organic/natural, luxury/refined, playful, editorial/magazine, brutalist/raw, art deco/geometric, soft/pastel, industrial/utilitarian, etc. Use these for inspiration but design one true to the aesthetic.
|
|
16
|
+
- **Constraints**: Target platform (mobile, TV, desktop, kiosk), screen dimensions, accessibility needs.
|
|
17
|
+
- **Differentiation**: What makes this UNFORGETTABLE? What's the one thing someone will remember?
|
|
18
|
+
|
|
19
|
+
**CRITICAL**: Choose a clear conceptual direction and execute it with precision. Bold maximalism and refined minimalism both work — the key is intentionality, not intensity.
|
|
20
|
+
|
|
21
|
+
Then implement working BRICKS TypeScript code that is:
|
|
22
|
+
- Production-grade and functional
|
|
23
|
+
- Visually striking and memorable
|
|
24
|
+
- Cohesive with a clear aesthetic point-of-view
|
|
25
|
+
- Meticulously refined in every detail
|
|
26
|
+
|
|
27
|
+
## Aesthetics Guidelines
|
|
28
|
+
|
|
29
|
+
### Typography
|
|
30
|
+
Choose fonts that are beautiful, unique, and interesting. Avoid defaulting to system fonts — opt for distinctive choices that elevate the interface. Pair a characterful display font with a refined body font. Create clear typographic hierarchy through weight, size, spacing, and alignment. Use auto-scaling (`fontSizeVector`) when text should fill its container proportionally.
|
|
31
|
+
|
|
32
|
+
### Color & Theme
|
|
33
|
+
Commit to a cohesive palette. Dominant colors with sharp accents outperform timid, evenly-distributed palettes. Use gradients for rich, atmospheric surfaces — multi-stop linear gradients create far more depth than flat fills. Use Data nodes as a shared color store for consistency across bricks.
|
|
34
|
+
|
|
35
|
+
### Motion & Animation
|
|
36
|
+
Focus on high-impact moments: one well-orchestrated canvas enter with staggered standby reveals creates more delight than scattered micro-interactions. Use spring animations for natural, bouncy UI elements. Use composed animations (parallel/sequence) for coordinated entrance choreography. Reserve looping animations (`breatheStart`) for attention-drawing elements — overuse dulls their impact.
|
|
37
|
+
|
|
38
|
+
### Spatial Composition
|
|
39
|
+
Absolute positioning gives total control — use it creatively. Overlap bricks. Create asymmetric layouts. Use generous negative space OR controlled density. Break grid expectations. Consider rotation for diagonal flow and perspective. Vary scale dramatically between elements for visual tension.
|
|
40
|
+
|
|
41
|
+
### Depth & Atmosphere
|
|
42
|
+
Create atmosphere through layered elements rather than flat solid colors:
|
|
43
|
+
- **Gradients** with multiple color stops for rich backgrounds
|
|
44
|
+
- **Shadows** for elevation and hierarchy
|
|
45
|
+
- **Blur effects** (blur, progressive blur, liquid glass) for glass morphism on native platforms
|
|
46
|
+
- **Opacity layering** — stack semi-transparent rects for texture and depth
|
|
47
|
+
- **Border details** — per-side colors, styles, and widths for decorative framing
|
|
48
|
+
|
|
49
|
+
### Interactive Polish
|
|
50
|
+
Design interactions that feel tactile and responsive:
|
|
51
|
+
- Scale/opacity animations on press for physical feedback
|
|
52
|
+
- Focus states for TV/controller navigation
|
|
53
|
+
- Outlet-driven switches for state-dependent visual changes
|
|
54
|
+
- Deliberate long-press patterns for secondary actions
|
|
55
|
+
|
|
56
|
+
## What to NEVER Do
|
|
57
|
+
|
|
58
|
+
- **No generic aesthetics**: Avoid the same tired palette, the same safe layout, the same system font on every screen. Each design should feel distinct and intentional.
|
|
59
|
+
- **No flat sameness**: Don't make every canvas look like the same template with different text. Vary spatial composition, color weight, animation timing, and typographic scale.
|
|
60
|
+
- **No placeholder layouts**: Don't just center everything in a grid. Use the absolute positioning system to create spatial interest — overlap, offset, scale contrast.
|
|
61
|
+
|
|
62
|
+
Vary between light and dark themes, different fonts, different aesthetics across generations. NEVER converge on common choices across designs.
|
|
63
|
+
|
|
64
|
+
**IMPORTANT**: Match implementation complexity to the aesthetic vision. Maximalist designs need elaborate animations, layered rects, and rich gradients. Minimalist designs need restraint, precision in spacing, and carefully chosen typography. Elegance comes from executing the vision well.
|
|
65
|
+
|
|
66
|
+
Remember: The agent is capable of extraordinary creative work. Don't hold back — show what can truly be created when thinking outside the box and committing fully to a distinctive vision.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: bricks-
|
|
2
|
+
name: bricks-ctor
|
|
3
3
|
description: Advanced BRICKS configuration knowledge. Covers Standby Transition, Automations (E2E testing), Data Calculation (JS sandbox libraries), Local Sync, Remote Data Bank, Media Flow, and Buttress (remote inference). Triggers on multi-device sync, cloud data, media assets, AI offloading, E2E testing, or canvas transitions.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# BRICKS
|
|
6
|
+
# BRICKS Ctor - Advanced Features
|
|
7
7
|
|
|
8
8
|
This skill covers advanced BRICKS features not in the main project instructions.
|
|
9
9
|
|
|
@@ -8,7 +8,7 @@ BRICKS Animation system for animating brick transforms and opacity. Animations a
|
|
|
8
8
|
Standard duration-based animation with easing.
|
|
9
9
|
|
|
10
10
|
```typescript
|
|
11
|
-
import { makeId } from 'bricks-
|
|
11
|
+
import { makeId } from 'bricks-ctor'
|
|
12
12
|
|
|
13
13
|
const fadeIn: AnimationDef = {
|
|
14
14
|
__typename: 'Animation',
|
|
@@ -41,7 +41,7 @@ ONLY for deriving, formatting, or aggregating values from other data. Not for or
|
|
|
41
41
|
|
|
42
42
|
Set `alias` on entities to give them a stable, human-readable name:
|
|
43
43
|
- Code generation uses alias as the variable name (e.g., `alias: 'submitBtn'` → `export const submitBtn`)
|
|
44
|
-
- At runtime, devtools MCP tools accept alias instead of short ID and selectors can match by alias. Note: bricks-
|
|
44
|
+
- At runtime, devtools MCP tools accept alias instead of short ID and selectors can match by alias. Note: bricks-ctor does not directly interact with devtools MCP — aliases here primarily affect code generation
|
|
45
45
|
- Aliases must be unique across the application — duplicates are excluded from resolution
|
|
46
46
|
|
|
47
47
|
## Flow Decomposition
|
|
@@ -40,7 +40,7 @@ In generator properties, configure Buttress settings:
|
|
|
40
40
|
## Generator Configuration Example
|
|
41
41
|
|
|
42
42
|
```typescript
|
|
43
|
-
import { makeId } from 'bricks-
|
|
43
|
+
import { makeId } from 'bricks-ctor'
|
|
44
44
|
|
|
45
45
|
const llmGenerator: GeneratorLLM = {
|
|
46
46
|
__typename: 'Generator',
|
|
@@ -7,7 +7,7 @@ Transform and compute Data Bank values using JavaScript scripts.
|
|
|
7
7
|
JavaScript code executed in a sandbox with access to inputs and outputs.
|
|
8
8
|
|
|
9
9
|
```typescript
|
|
10
|
-
import { makeId } from 'bricks-
|
|
10
|
+
import { makeId } from 'bricks-ctor'
|
|
11
11
|
|
|
12
12
|
const calculation: DataCalculationScript = {
|
|
13
13
|
__typename: 'DataCalculationScript',
|
|
@@ -49,7 +49,7 @@ const subspace: Subspace = {
|
|
|
49
49
|
### Data Local Sync
|
|
50
50
|
|
|
51
51
|
```typescript
|
|
52
|
-
import { makeId } from 'bricks-
|
|
52
|
+
import { makeId } from 'bricks-ctor'
|
|
53
53
|
|
|
54
54
|
const data: Data = {
|
|
55
55
|
__typename: 'Data',
|
|
@@ -65,7 +65,7 @@ const data: Data = {
|
|
|
65
65
|
### Generator Local Sync
|
|
66
66
|
|
|
67
67
|
```typescript
|
|
68
|
-
import { makeId } from 'bricks-
|
|
68
|
+
import { makeId } from 'bricks-ctor'
|
|
69
69
|
|
|
70
70
|
const generator: GeneratorTimer = {
|
|
71
71
|
__typename: 'Generator',
|
|
@@ -21,7 +21,7 @@ Use `Generator Media Flow` to:
|
|
|
21
21
|
Quick setup: Create new Property with `As Media Resource file list?` option.
|
|
22
22
|
|
|
23
23
|
```typescript
|
|
24
|
-
import { makeId } from 'bricks-
|
|
24
|
+
import { makeId } from 'bricks-ctor'
|
|
25
25
|
|
|
26
26
|
const mediaListGenerator: GeneratorMediaFlow = {
|
|
27
27
|
__typename: 'Generator',
|
|
@@ -52,7 +52,7 @@ Link Data properties to Media Flow for asset selection:
|
|
|
52
52
|
| `lottie-file-uri` | Lottie animation selector |
|
|
53
53
|
|
|
54
54
|
```typescript
|
|
55
|
-
import { makeId } from 'bricks-
|
|
55
|
+
import { makeId } from 'bricks-ctor'
|
|
56
56
|
|
|
57
57
|
const backgroundImage: Data = {
|
|
58
58
|
__typename: 'Data',
|
|
@@ -84,7 +84,7 @@ Assets with these kinds are **preloaded** during application launch.
|
|
|
84
84
|
Connect Generator Media Flow output to Brick Slideshow:
|
|
85
85
|
|
|
86
86
|
```typescript
|
|
87
|
-
import { makeId, linkData } from 'bricks-
|
|
87
|
+
import { makeId, linkData } from 'bricks-ctor'
|
|
88
88
|
|
|
89
89
|
const slideshow: BrickSlideshow = {
|
|
90
90
|
__typename: 'Brick',
|
|
@@ -18,7 +18,7 @@ remoteUpdate?:
|
|
|
18
18
|
Sync across all devices using the same application.
|
|
19
19
|
|
|
20
20
|
```typescript
|
|
21
|
-
import { makeId } from 'bricks-
|
|
21
|
+
import { makeId } from 'bricks-ctor'
|
|
22
22
|
|
|
23
23
|
const data: Data = {
|
|
24
24
|
__typename: 'Data',
|
|
@@ -36,7 +36,7 @@ const data: Data = {
|
|
|
36
36
|
Share data across different applications. Must create Global Data first on BANK page.
|
|
37
37
|
|
|
38
38
|
```typescript
|
|
39
|
-
import { makeId } from 'bricks-
|
|
39
|
+
import { makeId } from 'bricks-ctor'
|
|
40
40
|
|
|
41
41
|
const data: Data = {
|
|
42
42
|
__typename: 'Data',
|
|
@@ -54,7 +54,7 @@ const data: Data = {
|
|
|
54
54
|
Isolate data per device while still allowing web page control.
|
|
55
55
|
|
|
56
56
|
```typescript
|
|
57
|
-
import { makeId } from 'bricks-
|
|
57
|
+
import { makeId } from 'bricks-ctor'
|
|
58
58
|
|
|
59
59
|
const data: Data = {
|
|
60
60
|
__typename: 'Data',
|
|
@@ -132,7 +132,7 @@ const routedData: Data = {
|
|
|
132
132
|
### Digital Signage Content Management
|
|
133
133
|
|
|
134
134
|
```typescript
|
|
135
|
-
import { makeId } from 'bricks-
|
|
135
|
+
import { makeId } from 'bricks-ctor'
|
|
136
136
|
|
|
137
137
|
// Remote-updated announcement
|
|
138
138
|
const announcement: Data = {
|
|
@@ -151,7 +151,7 @@ Operator updates content via web page → All displays update in real-time.
|
|
|
151
151
|
### Multi-Location Coordination
|
|
152
152
|
|
|
153
153
|
```typescript
|
|
154
|
-
import { makeId } from 'bricks-
|
|
154
|
+
import { makeId } from 'bricks-ctor'
|
|
155
155
|
|
|
156
156
|
// Global data shared across locations
|
|
157
157
|
const globalConfig: Data = {
|
|
@@ -170,7 +170,7 @@ Update once → All locations receive update.
|
|
|
170
170
|
### Per-Device Customization
|
|
171
171
|
|
|
172
172
|
```typescript
|
|
173
|
-
import { makeId } from 'bricks-
|
|
173
|
+
import { makeId } from 'bricks-ctor'
|
|
174
174
|
|
|
175
175
|
// Device-specific greeting
|
|
176
176
|
const deviceGreeting: Data = {
|
package/tools/mcp-server.ts
CHANGED
package/tools/postinstall.ts
CHANGED
|
@@ -39,21 +39,28 @@ async function pathExists(f: string) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
// Migrate old projects: remove legacy project/ directory
|
|
43
|
+
const oldProjectDir = path.join(cwd, 'project')
|
|
44
|
+
if (await exists(oldProjectDir)) {
|
|
45
|
+
await rm(oldProjectDir, { recursive: true, force: true })
|
|
46
|
+
console.log('Removed legacy project/ directory')
|
|
47
|
+
}
|
|
48
|
+
|
|
42
49
|
// handle flag --skip-copy
|
|
43
50
|
const skipCopyProject = process.argv.includes('--skip-copy-project')
|
|
44
51
|
if (skipCopyProject) {
|
|
45
|
-
console.log('Skipping copy of files to
|
|
52
|
+
console.log('Skipping copy of files to ctor/')
|
|
46
53
|
} else {
|
|
47
54
|
const libFiles = ['types', 'utils', 'index.ts']
|
|
48
55
|
|
|
49
|
-
await $`mkdir -p ${cwd}/
|
|
50
|
-
await Promise.all(libFiles.map((file) => $`cp -r ${__dirname}/../${file} ${cwd}/
|
|
51
|
-
console.log('Copied files to
|
|
56
|
+
await $`mkdir -p ${cwd}/ctor`
|
|
57
|
+
await Promise.all(libFiles.map((file) => $`cp -r ${__dirname}/../${file} ${cwd}/ctor`))
|
|
58
|
+
console.log('Copied files to ctor/')
|
|
52
59
|
}
|
|
53
60
|
|
|
54
61
|
const projectMcpServer = {
|
|
55
62
|
command: 'bun',
|
|
56
|
-
args: [`${cwd}/node_modules/@fugood/bricks-
|
|
63
|
+
args: [`${cwd}/node_modules/@fugood/bricks-ctor/tools/mcp-server.ts`],
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
type CodexMcpConfig = {
|
|
@@ -63,7 +70,7 @@ type CodexMcpConfig = {
|
|
|
63
70
|
// Claude Code and AGENTS.md projects both use the shared project .mcp.json file.
|
|
64
71
|
const defaultMcpConfig = {
|
|
65
72
|
mcpServers: {
|
|
66
|
-
'bricks-
|
|
73
|
+
'bricks-ctor': projectMcpServer,
|
|
67
74
|
},
|
|
68
75
|
}
|
|
69
76
|
|
|
@@ -74,7 +81,8 @@ const handleMcpConfigOverride = async (mcpConfigPath: string) => {
|
|
|
74
81
|
try {
|
|
75
82
|
mcpConfig = JSON.parse(configStr)
|
|
76
83
|
if (!mcpConfig?.mcpServers) throw new Error('mcpServers is not defined')
|
|
77
|
-
mcpConfig.mcpServers['bricks-
|
|
84
|
+
mcpConfig.mcpServers['bricks-ctor'] = projectMcpServer
|
|
85
|
+
delete mcpConfig.mcpServers['bricks-project']
|
|
78
86
|
} catch {
|
|
79
87
|
mcpConfig = defaultMcpConfig
|
|
80
88
|
}
|
|
@@ -186,7 +194,7 @@ if (hasAgentsMd) {
|
|
|
186
194
|
// Codex stores its project-local MCP config in .codex/config.toml.
|
|
187
195
|
const defaultCodexMcpConfig = {
|
|
188
196
|
mcp_servers: {
|
|
189
|
-
'bricks-
|
|
197
|
+
'bricks-ctor': projectMcpServer,
|
|
190
198
|
},
|
|
191
199
|
}
|
|
192
200
|
|
|
@@ -198,7 +206,8 @@ if (hasAgentsMd) {
|
|
|
198
206
|
const parsed = TOML.parse(configStr) as Partial<CodexMcpConfig>
|
|
199
207
|
if (!parsed?.mcp_servers) throw new Error('mcp_servers is not defined')
|
|
200
208
|
mcpConfig = { mcp_servers: parsed.mcp_servers }
|
|
201
|
-
mcpConfig.mcp_servers['bricks-
|
|
209
|
+
mcpConfig.mcp_servers['bricks-ctor'] = projectMcpServer
|
|
210
|
+
delete mcpConfig.mcp_servers['bricks-project']
|
|
202
211
|
} catch {
|
|
203
212
|
mcpConfig = defaultCodexMcpConfig
|
|
204
213
|
}
|
|
@@ -211,7 +220,7 @@ if (hasAgentsMd) {
|
|
|
211
220
|
console.log(`Updated ${mcpConfigPath}`)
|
|
212
221
|
}
|
|
213
222
|
|
|
214
|
-
// Keep the Codex TOML MCP config aligned with the same bricks-
|
|
223
|
+
// Keep the Codex TOML MCP config aligned with the same bricks-ctor server entry.
|
|
215
224
|
const codexConfigPath = `${cwd}/.codex/config.toml`
|
|
216
225
|
await handleCodexMcpConfigOverride(codexConfigPath)
|
|
217
226
|
}
|
package/tools/preview-main.mjs
CHANGED
|
@@ -112,6 +112,23 @@ const startCdpServer = async (mainWindow, port) => {
|
|
|
112
112
|
} catch {}
|
|
113
113
|
})
|
|
114
114
|
|
|
115
|
+
// Find an available port before binding
|
|
116
|
+
const findPort = (p) =>
|
|
117
|
+
new Promise((resolve) => {
|
|
118
|
+
const probe = createServer()
|
|
119
|
+
probe.once('error', () => {
|
|
120
|
+
if (p < port + 100) resolve(findPort(p + 1))
|
|
121
|
+
else resolve(null)
|
|
122
|
+
})
|
|
123
|
+
probe.listen(p, () => probe.close(() => resolve(p)))
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const actualPort = await findPort(port)
|
|
127
|
+
if (!actualPort) {
|
|
128
|
+
console.warn(`CDP server: no available port in range ${port}-${port + 99}`)
|
|
129
|
+
return
|
|
130
|
+
}
|
|
131
|
+
|
|
115
132
|
// HTTP discovery endpoints (chrome://inspect, Playwright, etc.)
|
|
116
133
|
const httpServer = createServer((req, res) => {
|
|
117
134
|
if (req.url === '/json/list' || req.url === '/json') {
|
|
@@ -124,7 +141,7 @@ const startCdpServer = async (mainWindow, port) => {
|
|
|
124
141
|
title: 'BRICKS Preview',
|
|
125
142
|
type: 'page',
|
|
126
143
|
url: previewUrl,
|
|
127
|
-
webSocketDebuggerUrl: `ws://localhost:${
|
|
144
|
+
webSocketDebuggerUrl: `ws://localhost:${actualPort}/ws`,
|
|
128
145
|
},
|
|
129
146
|
]),
|
|
130
147
|
)
|
|
@@ -141,7 +158,7 @@ const startCdpServer = async (mainWindow, port) => {
|
|
|
141
158
|
res.end(
|
|
142
159
|
JSON.stringify({
|
|
143
160
|
name: 'BRICKS Preview',
|
|
144
|
-
port,
|
|
161
|
+
port: actualPort,
|
|
145
162
|
protocols: ['cdp'],
|
|
146
163
|
hasPasscode: false,
|
|
147
164
|
}),
|
|
@@ -174,23 +191,12 @@ const startCdpServer = async (mainWindow, port) => {
|
|
|
174
191
|
ws.on('close', () => clients.delete(ws))
|
|
175
192
|
})
|
|
176
193
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
} else {
|
|
184
|
-
reject(err)
|
|
185
|
-
}
|
|
186
|
-
})
|
|
187
|
-
httpServer.listen(p, () => {
|
|
188
|
-
console.log(`CDP server: ws://localhost:${p}/ws`)
|
|
189
|
-
console.log(`Inspect: devtools://devtools/bundled/inspector.html?ws=localhost:${p}/ws`)
|
|
190
|
-
resolve(p)
|
|
191
|
-
})
|
|
192
|
-
})
|
|
193
|
-
await listen(port)
|
|
194
|
+
httpServer.listen(actualPort, () => {
|
|
195
|
+
console.log(`CDP server: ws://localhost:${actualPort}/ws`)
|
|
196
|
+
console.log(
|
|
197
|
+
`Inspect: devtools://devtools/bundled/inspector.html?ws=localhost:${actualPort}/ws`,
|
|
198
|
+
)
|
|
199
|
+
})
|
|
194
200
|
}
|
|
195
201
|
|
|
196
202
|
app.on('ready', () => {
|