@fugood/bricks-ctor 2.25.0-beta.60 → 2.25.0-beta.61
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 +4 -28
- package/tools/deploy.ts +19 -176
- package/tools/mcp-server.ts +16 -33
- package/tools/postinstall.ts +21 -292
- package/tools/pull.ts +15 -195
- package/tools/push-config.ts +18 -113
- package/tools/simulator.ts +19 -148
- package/compile/__tests__/config-diff.test.js +0 -100
- package/compile/__tests__/index.test.js +0 -461
- package/compile/__tests__/util.test.js +0 -450
- package/compile/action-name-map.ts +0 -1079
- package/compile/config-diff.ts +0 -155
- package/compile/index.ts +0 -1594
- package/compile/util.ts +0 -482
- package/index.ts +0 -6
- package/skills/bricks-ctor/SKILL.md +0 -38
- package/skills/bricks-ctor/references/animation.md +0 -160
- package/skills/bricks-ctor/references/architecture-patterns.md +0 -88
- package/skills/bricks-ctor/references/automations.md +0 -232
- package/skills/bricks-ctor/references/buttress.md +0 -245
- package/skills/bricks-ctor/references/data-calculation.md +0 -252
- package/skills/bricks-ctor/references/local-sync.md +0 -129
- package/skills/bricks-ctor/references/media-flow.md +0 -165
- package/skills/bricks-ctor/references/remote-data-bank.md +0 -196
- package/skills/bricks-ctor/references/simulator.md +0 -132
- package/skills/bricks-ctor/references/source-editing-tools.md +0 -81
- package/skills/bricks-ctor/references/standby-transition.md +0 -124
- package/skills/bricks-ctor/references/verification-toolchain.md +0 -200
- package/skills/bricks-design/SKILL.md +0 -171
- package/skills/bricks-design/references/architecture-truths.md +0 -132
- package/skills/bricks-design/references/avoiding-complexity.md +0 -91
- package/skills/bricks-design/references/design-critique.md +0 -195
- package/skills/bricks-design/references/design-languages.md +0 -265
- package/skills/bricks-design/references/performance.md +0 -116
- package/skills/bricks-design/references/presentation-and-slideshow.md +0 -137
- package/skills/bricks-design/references/translating-inputs.md +0 -152
- package/skills/bricks-design/references/variations-and-tweaks.md +0 -124
- package/skills/bricks-design/references/when-the-brief-is-branded.md +0 -284
- package/skills/bricks-design/references/when-the-brief-is-vague.md +0 -85
- package/skills/bricks-design/references/workflow.md +0 -134
- package/skills/bricks-ux/SKILL.md +0 -114
- package/skills/bricks-ux/references/accessibility.md +0 -162
- package/skills/bricks-ux/references/flow-states.md +0 -175
- package/skills/bricks-ux/references/interaction-archetypes.md +0 -189
- package/skills/bricks-ux/references/monitoring-screens.md +0 -153
- package/skills/bricks-ux/references/pressable-composition.md +0 -126
- package/skills/bricks-ux/references/user-journey.md +0 -168
- package/skills/bricks-ux/references/ux-critique.md +0 -256
- package/skills/rive-marketplace/SKILL.md +0 -99
- package/tools/__tests__/_cli-error.test.ts +0 -35
- package/tools/__tests__/_mcp-config.test.ts +0 -67
- package/tools/__tests__/pull.test.ts +0 -108
- package/tools/_cli-error.ts +0 -17
- package/tools/_edits-log.ts +0 -41
- package/tools/_git-author.ts +0 -37
- package/tools/_last-pushed-commit.ts +0 -28
- package/tools/_mcp-config.ts +0 -42
- package/tools/_shell.ts +0 -180
- package/tools/icons/.gitattributes +0 -1
- package/tools/icons/fa6pro-glyphmap.json +0 -4686
- package/tools/icons/fa6pro-meta.json +0 -1
- package/tools/mcp-env.ts +0 -13
- package/tools/mcp-tools/__tests__/data-calc-editing.test.js +0 -516
- package/tools/mcp-tools/__tests__/entry-editing.test.js +0 -866
- package/tools/mcp-tools/__tests__/huggingface.test.ts +0 -49
- package/tools/mcp-tools/__tests__/icons.test.ts +0 -21
- package/tools/mcp-tools/__tests__/mcp-env.test.js +0 -19
- package/tools/mcp-tools/_editing-helpers.ts +0 -98
- package/tools/mcp-tools/_verify.ts +0 -50
- package/tools/mcp-tools/compile.ts +0 -104
- package/tools/mcp-tools/data-calc-editing.ts +0 -1311
- package/tools/mcp-tools/entry-editing.ts +0 -2297
- package/tools/mcp-tools/huggingface.ts +0 -772
- package/tools/mcp-tools/icons.ts +0 -97
- package/tools/mcp-tools/lottie.ts +0 -102
- package/tools/mcp-tools/media.ts +0 -113
- package/tools/simulator-main.mjs +0 -488
- package/tools/simulator-preload.cjs +0 -16
- package/types/animation.d.ts +0 -116
- package/types/automation.d.ts +0 -231
- package/types/brick-base.d.ts +0 -80
- package/types/bricks/Camera.d.ts +0 -246
- package/types/bricks/Chart.d.ts +0 -372
- package/types/bricks/GenerativeMedia.d.ts +0 -290
- package/types/bricks/Icon.d.ts +0 -98
- package/types/bricks/Image.d.ts +0 -126
- package/types/bricks/Items.d.ts +0 -480
- package/types/bricks/Lottie.d.ts +0 -168
- package/types/bricks/Maps.d.ts +0 -262
- package/types/bricks/QrCode.d.ts +0 -117
- package/types/bricks/Rect.d.ts +0 -150
- package/types/bricks/RichText.d.ts +0 -131
- package/types/bricks/Rive.d.ts +0 -220
- package/types/bricks/Scene3D.d.ts +0 -676
- package/types/bricks/Sketch.d.ts +0 -256
- package/types/bricks/Slideshow.d.ts +0 -201
- package/types/bricks/Svg.d.ts +0 -99
- package/types/bricks/Text.d.ts +0 -148
- package/types/bricks/TextInput.d.ts +0 -242
- package/types/bricks/Video.d.ts +0 -242
- package/types/bricks/VideoStreaming.d.ts +0 -112
- package/types/bricks/WebRtcStream.d.ts +0 -65
- package/types/bricks/WebView.d.ts +0 -168
- package/types/bricks/index.d.ts +0 -23
- package/types/canvas.d.ts +0 -82
- package/types/common.d.ts +0 -141
- package/types/data-calc-command/base.d.ts +0 -57
- package/types/data-calc-command/collection.d.ts +0 -418
- package/types/data-calc-command/color.d.ts +0 -432
- package/types/data-calc-command/constant.d.ts +0 -50
- package/types/data-calc-command/datetime.d.ts +0 -147
- package/types/data-calc-command/file.d.ts +0 -129
- package/types/data-calc-command/index.d.ts +0 -13
- package/types/data-calc-command/iteratee.d.ts +0 -23
- package/types/data-calc-command/logictype.d.ts +0 -190
- package/types/data-calc-command/math.d.ts +0 -275
- package/types/data-calc-command/object.d.ts +0 -119
- package/types/data-calc-command/sandbox.d.ts +0 -66
- package/types/data-calc-command/string.d.ts +0 -407
- package/types/data-calc-script.d.ts +0 -21
- package/types/data-calc.d.ts +0 -12
- package/types/data.d.ts +0 -97
- package/types/generators/AlarmClock.d.ts +0 -110
- package/types/generators/Assistant.d.ts +0 -640
- package/types/generators/BleCentral.d.ts +0 -247
- package/types/generators/BlePeripheral.d.ts +0 -208
- package/types/generators/CanvasMap.d.ts +0 -74
- package/types/generators/CastlesPay.d.ts +0 -87
- package/types/generators/DataBank.d.ts +0 -160
- package/types/generators/File.d.ts +0 -432
- package/types/generators/GraphQl.d.ts +0 -132
- package/types/generators/Http.d.ts +0 -222
- package/types/generators/HttpServer.d.ts +0 -230
- package/types/generators/Information.d.ts +0 -103
- package/types/generators/Intent.d.ts +0 -168
- package/types/generators/Iterator.d.ts +0 -108
- package/types/generators/Keyboard.d.ts +0 -105
- package/types/generators/LlmAnthropicCompat.d.ts +0 -212
- package/types/generators/LlmAppleBuiltin.d.ts +0 -159
- package/types/generators/LlmGgml.d.ts +0 -903
- package/types/generators/LlmMediaTekNeuroPilot.d.ts +0 -235
- package/types/generators/LlmMlx.d.ts +0 -228
- package/types/generators/LlmOnnx.d.ts +0 -213
- package/types/generators/LlmOpenAiCompat.d.ts +0 -312
- package/types/generators/LlmQualcommAiEngine.d.ts +0 -247
- package/types/generators/Mcp.d.ts +0 -637
- package/types/generators/McpServer.d.ts +0 -289
- package/types/generators/MediaFlow.d.ts +0 -170
- package/types/generators/MqttBroker.d.ts +0 -141
- package/types/generators/MqttClient.d.ts +0 -141
- package/types/generators/Question.d.ts +0 -408
- package/types/generators/RealtimeTranscription.d.ts +0 -287
- package/types/generators/RerankerGgml.d.ts +0 -195
- package/types/generators/SerialPort.d.ts +0 -151
- package/types/generators/SoundPlayer.d.ts +0 -94
- package/types/generators/SoundRecorder.d.ts +0 -139
- package/types/generators/SpeechToTextGgml.d.ts +0 -424
- package/types/generators/SpeechToTextOnnx.d.ts +0 -236
- package/types/generators/SpeechToTextPlatform.d.ts +0 -85
- package/types/generators/SqLite.d.ts +0 -159
- package/types/generators/Step.d.ts +0 -107
- package/types/generators/SttAppleBuiltin.d.ts +0 -153
- package/types/generators/Tcp.d.ts +0 -126
- package/types/generators/TcpServer.d.ts +0 -147
- package/types/generators/TextToSpeechAppleBuiltin.d.ts +0 -127
- package/types/generators/TextToSpeechGgml.d.ts +0 -221
- package/types/generators/TextToSpeechOnnx.d.ts +0 -178
- package/types/generators/TextToSpeechOpenAiLike.d.ts +0 -121
- package/types/generators/ThermalPrinter.d.ts +0 -193
- package/types/generators/Tick.d.ts +0 -83
- package/types/generators/Udp.d.ts +0 -120
- package/types/generators/VadGgml.d.ts +0 -260
- package/types/generators/VadOnnx.d.ts +0 -231
- package/types/generators/VadTraditional.d.ts +0 -138
- package/types/generators/VectorStore.d.ts +0 -257
- package/types/generators/Watchdog.d.ts +0 -107
- package/types/generators/WebCrawler.d.ts +0 -103
- package/types/generators/WebRtc.d.ts +0 -181
- package/types/generators/WebSocket.d.ts +0 -148
- package/types/generators/index.d.ts +0 -57
- package/types/index.d.ts +0 -13
- package/types/subspace.d.ts +0 -60
- package/types/switch.d.ts +0 -51
- package/types/system.d.ts +0 -707
- package/utils/__tests__/calc.test.js +0 -25
- package/utils/__tests__/id.test.js +0 -154
- package/utils/calc.ts +0 -130
- package/utils/data.ts +0 -495
- package/utils/event-props.ts +0 -912
- package/utils/id.ts +0 -133
package/compile/config-diff.ts
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises'
|
|
2
|
-
import path from 'node:path'
|
|
3
|
-
|
|
4
|
-
// The compiled config artifact written by `bun compile` (see the generated
|
|
5
|
-
// project's `compile.ts`; bricks-project-generator/index.js:762).
|
|
6
|
-
export const BUILD_CONFIG_RELATIVE = '.bricks/build/application-config.json'
|
|
7
|
-
|
|
8
|
-
// `compile()` derives these top-level fields from `Date.now()`
|
|
9
|
-
// (compile/index.ts `title: \`${app.name}(${timestamp})\`` and `update_timestamp`),
|
|
10
|
-
// so they differ on every run regardless of source. Excluded from the comparison —
|
|
11
|
-
// only the *top-level* keys are dropped, so nested subspace/brick `title`s still diff.
|
|
12
|
-
const VOLATILE_TOP_LEVEL_FIELDS = ['title', 'update_timestamp']
|
|
13
|
-
|
|
14
|
-
// A minimal, path-keyed config change (Option A): a generic patch, not coupled to
|
|
15
|
-
// bricks-config-editor's action vocabulary. `path` is an array of object keys /
|
|
16
|
-
// array indices, ready for the editor's `setYValueAtPath` (or a delete) so applying
|
|
17
|
-
// the patch is a single Yjs `'local'` transaction == one undo/redo entry.
|
|
18
|
-
export type ConfigPatchOp =
|
|
19
|
-
| { op: 'set'; path: Array<string | number>; value: unknown }
|
|
20
|
-
| { op: 'unset'; path: Array<string | number> }
|
|
21
|
-
|
|
22
|
-
export type ConfigChange =
|
|
23
|
-
| { status: 'ok'; ops: ConfigPatchOp[]; opCount: number }
|
|
24
|
-
| { status: 'no_baseline' }
|
|
25
|
-
| { status: 'unavailable' }
|
|
26
|
-
|
|
27
|
-
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
28
|
-
typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
29
|
-
|
|
30
|
-
const isJsonDroppedValue = (value: unknown) =>
|
|
31
|
-
value === undefined || typeof value === 'function' || typeof value === 'symbol'
|
|
32
|
-
|
|
33
|
-
const toJsonComparableScalar = (value: unknown) => {
|
|
34
|
-
if (typeof value === 'number' && !Number.isFinite(value)) return null
|
|
35
|
-
return value
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const toJsonCompatibleValue = (value: unknown): unknown => {
|
|
39
|
-
if (isJsonDroppedValue(value)) return undefined
|
|
40
|
-
if (Array.isArray(value)) {
|
|
41
|
-
return value.map((item) => (isJsonDroppedValue(item) ? null : toJsonCompatibleValue(item)))
|
|
42
|
-
}
|
|
43
|
-
if (isRecord(value)) {
|
|
44
|
-
return Object.entries(value).reduce((acc, [key, item]) => {
|
|
45
|
-
if (!isJsonDroppedValue(item)) acc[key] = toJsonCompatibleValue(item)
|
|
46
|
-
return acc
|
|
47
|
-
}, {})
|
|
48
|
-
}
|
|
49
|
-
return toJsonComparableScalar(value)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const hasJsonObjectKey = (value: Record<string, unknown>, key: string) =>
|
|
53
|
-
Object.prototype.hasOwnProperty.call(value, key) && !isJsonDroppedValue(value[key])
|
|
54
|
-
|
|
55
|
-
const getJsonArrayItem = (value: unknown[], index: number) => {
|
|
56
|
-
const item = value[index]
|
|
57
|
-
return isJsonDroppedValue(item) ? null : item
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const deepEqual = (a: unknown, b: unknown): boolean => {
|
|
61
|
-
a = toJsonComparableScalar(a)
|
|
62
|
-
b = toJsonComparableScalar(b)
|
|
63
|
-
if (a === b) return true
|
|
64
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
65
|
-
if (a.length !== b.length) return false
|
|
66
|
-
for (let index = 0; index < a.length; index += 1) {
|
|
67
|
-
if (!deepEqual(getJsonArrayItem(a, index), getJsonArrayItem(b, index))) return false
|
|
68
|
-
}
|
|
69
|
-
return true
|
|
70
|
-
}
|
|
71
|
-
if (isRecord(a) && isRecord(b)) {
|
|
72
|
-
let comparableAKeys = 0
|
|
73
|
-
for (const key of Object.keys(a)) {
|
|
74
|
-
if (isJsonDroppedValue(a[key])) continue
|
|
75
|
-
comparableAKeys += 1
|
|
76
|
-
if (!hasJsonObjectKey(b, key) || !deepEqual(a[key], b[key])) return false
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
let comparableBKeys = 0
|
|
80
|
-
for (const key of Object.keys(b)) {
|
|
81
|
-
if (!isJsonDroppedValue(b[key])) comparableBKeys += 1
|
|
82
|
-
}
|
|
83
|
-
return comparableAKeys === comparableBKeys
|
|
84
|
-
}
|
|
85
|
-
return false
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const normalizeConfig = (config: unknown) => {
|
|
89
|
-
if (!isRecord(config)) return config
|
|
90
|
-
const normalized = { ...config }
|
|
91
|
-
for (const field of VOLATILE_TOP_LEVEL_FIELDS) delete normalized[field]
|
|
92
|
-
return normalized
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Objects recurse key-wise; equal-length arrays recurse element-wise; everything else
|
|
96
|
-
// (scalars, type changes, length-changed arrays) emits one whole-value `set` at that
|
|
97
|
-
// path. The editor's `applyJsonDiffToYType` minimizes the actual Yjs ops downstream,
|
|
98
|
-
// so a whole-array `set` on insert/remove still yields a minimal CRDT mutation.
|
|
99
|
-
const diffInto = (
|
|
100
|
-
before: unknown,
|
|
101
|
-
after: unknown,
|
|
102
|
-
currentPath: Array<string | number>,
|
|
103
|
-
ops: ConfigPatchOp[],
|
|
104
|
-
) => {
|
|
105
|
-
if (deepEqual(before, after)) return
|
|
106
|
-
|
|
107
|
-
if (isRecord(before) && isRecord(after)) {
|
|
108
|
-
const keys = new Set([...Object.keys(before), ...Object.keys(after)])
|
|
109
|
-
for (const key of keys) {
|
|
110
|
-
const beforeHasKey = hasJsonObjectKey(before, key)
|
|
111
|
-
const afterHasKey = hasJsonObjectKey(after, key)
|
|
112
|
-
if (!beforeHasKey && !afterHasKey) continue
|
|
113
|
-
|
|
114
|
-
const nextPath = [...currentPath, key]
|
|
115
|
-
if (!afterHasKey) ops.push({ op: 'unset', path: nextPath })
|
|
116
|
-
else if (!beforeHasKey) {
|
|
117
|
-
ops.push({ op: 'set', path: nextPath, value: toJsonCompatibleValue(after[key]) })
|
|
118
|
-
} else diffInto(before[key], after[key], nextPath, ops)
|
|
119
|
-
}
|
|
120
|
-
return
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (Array.isArray(before) && Array.isArray(after) && before.length === after.length) {
|
|
124
|
-
for (let index = 0; index < after.length; index += 1) {
|
|
125
|
-
diffInto(
|
|
126
|
-
getJsonArrayItem(before, index),
|
|
127
|
-
getJsonArrayItem(after, index),
|
|
128
|
-
[...currentPath, index],
|
|
129
|
-
ops,
|
|
130
|
-
)
|
|
131
|
-
}
|
|
132
|
-
return
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
ops.push({ op: 'set', path: currentPath, value: toJsonCompatibleValue(after) })
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// Diff two compiled configs. `before == null` means there was no prior build to compare
|
|
139
|
-
// (first compile); `after == null` means the fresh artifact could not be read.
|
|
140
|
-
export const computeConfigChange = (before: unknown, after: unknown): ConfigChange => {
|
|
141
|
-
if (before == null) return { status: 'no_baseline' }
|
|
142
|
-
if (after == null) return { status: 'unavailable' }
|
|
143
|
-
const ops: ConfigPatchOp[] = []
|
|
144
|
-
diffInto(normalizeConfig(before), normalizeConfig(after), [], ops)
|
|
145
|
-
return { status: 'ok', ops, opCount: ops.length }
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Read the last-compiled config artifact. Returns null when it is absent or unreadable.
|
|
149
|
-
export const readBuildConfig = async (projectDir: string): Promise<unknown> => {
|
|
150
|
-
try {
|
|
151
|
-
return JSON.parse(await readFile(path.join(projectDir, BUILD_CONFIG_RELATIVE), 'utf8'))
|
|
152
|
-
} catch {
|
|
153
|
-
return null
|
|
154
|
-
}
|
|
155
|
-
}
|