@fugood/bricks-ctor 2.25.0-beta.8 → 2.25.0-beta.80
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 -24
- package/tools/__tests__/legacy-forwarder.test.js +91 -0
- package/tools/_forward.ts +26 -0
- package/tools/deploy.ts +3 -164
- package/tools/mcp-server.ts +3 -27
- package/tools/postinstall.ts +3 -234
- package/tools/pull.ts +3 -121
- package/tools/push-config.ts +4 -0
- package/tools/simulator.ts +4 -0
- package/compile/__tests__/index.test.js +0 -115
- package/compile/action-name-map.ts +0 -1015
- package/compile/index.ts +0 -1458
- package/compile/util.ts +0 -358
- package/index.ts +0 -6
- package/skills/bricks-ctor/SKILL.md +0 -32
- package/skills/bricks-ctor/rules/animation.md +0 -160
- package/skills/bricks-ctor/rules/architecture-patterns.md +0 -69
- package/skills/bricks-ctor/rules/automations.md +0 -221
- package/skills/bricks-ctor/rules/buttress.md +0 -156
- package/skills/bricks-ctor/rules/data-calculation.md +0 -209
- package/skills/bricks-ctor/rules/local-sync.md +0 -129
- package/skills/bricks-ctor/rules/media-flow.md +0 -158
- package/skills/bricks-ctor/rules/remote-data-bank.md +0 -196
- package/skills/bricks-ctor/rules/standby-transition.md +0 -124
- package/skills/bricks-design/LICENSE.txt +0 -180
- package/skills/bricks-design/SKILL.md +0 -66
- package/skills/rive-marketplace/SKILL.md +0 -99
- package/tools/_git-author.ts +0 -29
- package/tools/_shell.ts +0 -173
- 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-tools/compile.ts +0 -92
- package/tools/mcp-tools/huggingface.ts +0 -762
- package/tools/mcp-tools/icons.ts +0 -81
- package/tools/mcp-tools/lottie.ts +0 -102
- package/tools/mcp-tools/media.ts +0 -110
- package/tools/preview-main.mjs +0 -306
- package/tools/preview.ts +0 -150
- package/types/animation.ts +0 -111
- package/types/automation.ts +0 -235
- package/types/brick-base.ts +0 -80
- package/types/bricks/Camera.ts +0 -246
- package/types/bricks/Chart.ts +0 -372
- package/types/bricks/GenerativeMedia.ts +0 -290
- package/types/bricks/Icon.ts +0 -98
- package/types/bricks/Image.ts +0 -126
- package/types/bricks/Items.ts +0 -476
- package/types/bricks/Lottie.ts +0 -168
- package/types/bricks/Maps.ts +0 -262
- package/types/bricks/QrCode.ts +0 -117
- package/types/bricks/Rect.ts +0 -150
- package/types/bricks/RichText.ts +0 -128
- package/types/bricks/Rive.ts +0 -220
- package/types/bricks/Sketch.ts +0 -254
- package/types/bricks/Slideshow.ts +0 -201
- package/types/bricks/Svg.ts +0 -99
- package/types/bricks/Text.ts +0 -148
- package/types/bricks/TextInput.ts +0 -242
- package/types/bricks/Video.ts +0 -175
- package/types/bricks/VideoStreaming.ts +0 -112
- package/types/bricks/WebRtcStream.ts +0 -65
- package/types/bricks/WebView.ts +0 -168
- package/types/bricks/index.ts +0 -22
- package/types/canvas.ts +0 -82
- package/types/common.ts +0 -144
- package/types/data-calc-command.ts +0 -7005
- package/types/data-calc-script.ts +0 -21
- package/types/data-calc.ts +0 -11
- package/types/data.ts +0 -95
- package/types/generators/AlarmClock.ts +0 -110
- package/types/generators/Assistant.ts +0 -621
- package/types/generators/BleCentral.ts +0 -247
- package/types/generators/BlePeripheral.ts +0 -208
- package/types/generators/CanvasMap.ts +0 -74
- package/types/generators/CastlesPay.ts +0 -87
- package/types/generators/DataBank.ts +0 -160
- package/types/generators/File.ts +0 -432
- package/types/generators/GraphQl.ts +0 -132
- package/types/generators/Http.ts +0 -222
- package/types/generators/HttpServer.ts +0 -176
- package/types/generators/Information.ts +0 -103
- package/types/generators/Intent.ts +0 -168
- package/types/generators/Iterator.ts +0 -108
- package/types/generators/Keyboard.ts +0 -105
- package/types/generators/LlmAnthropicCompat.ts +0 -212
- package/types/generators/LlmAppleBuiltin.ts +0 -159
- package/types/generators/LlmGgml.ts +0 -861
- package/types/generators/LlmMediaTekNeuroPilot.ts +0 -235
- package/types/generators/LlmMlx.ts +0 -227
- package/types/generators/LlmOnnx.ts +0 -213
- package/types/generators/LlmOpenAiCompat.ts +0 -312
- package/types/generators/LlmQualcommAiEngine.ts +0 -247
- package/types/generators/Mcp.ts +0 -637
- package/types/generators/McpServer.ts +0 -289
- package/types/generators/MediaFlow.ts +0 -170
- package/types/generators/MqttBroker.ts +0 -141
- package/types/generators/MqttClient.ts +0 -141
- package/types/generators/Question.ts +0 -408
- package/types/generators/RealtimeTranscription.ts +0 -287
- package/types/generators/RerankerGgml.ts +0 -191
- package/types/generators/SerialPort.ts +0 -151
- package/types/generators/SoundPlayer.ts +0 -94
- package/types/generators/SoundRecorder.ts +0 -130
- package/types/generators/SpeechToTextGgml.ts +0 -419
- package/types/generators/SpeechToTextOnnx.ts +0 -236
- package/types/generators/SpeechToTextPlatform.ts +0 -85
- package/types/generators/SqLite.ts +0 -159
- package/types/generators/Step.ts +0 -107
- package/types/generators/SttAppleBuiltin.ts +0 -130
- package/types/generators/Tcp.ts +0 -126
- package/types/generators/TcpServer.ts +0 -147
- package/types/generators/TextToSpeechAppleBuiltin.ts +0 -127
- package/types/generators/TextToSpeechGgml.ts +0 -221
- package/types/generators/TextToSpeechOnnx.ts +0 -178
- package/types/generators/TextToSpeechOpenAiLike.ts +0 -121
- package/types/generators/ThermalPrinter.ts +0 -191
- package/types/generators/Tick.ts +0 -83
- package/types/generators/Udp.ts +0 -120
- package/types/generators/VadGgml.ts +0 -250
- package/types/generators/VadOnnx.ts +0 -231
- package/types/generators/VadTraditional.ts +0 -138
- package/types/generators/VectorStore.ts +0 -257
- package/types/generators/Watchdog.ts +0 -107
- package/types/generators/WebCrawler.ts +0 -103
- package/types/generators/WebRtc.ts +0 -181
- package/types/generators/WebSocket.ts +0 -148
- package/types/generators/index.ts +0 -57
- package/types/index.ts +0 -13
- package/types/subspace.ts +0 -60
- package/types/switch.ts +0 -51
- package/types/system.ts +0 -707
- package/utils/__tests__/id.test.js +0 -58
- package/utils/calc.ts +0 -126
- package/utils/data.ts +0 -497
- package/utils/event-props.ts +0 -886
- package/utils/id.ts +0 -80
package/tools/pull.ts
CHANGED
|
@@ -1,122 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { sh } from './_shell'
|
|
4
|
-
import { buildCommitArgs } from './_git-author'
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { forwardLegacyCtorTool } from './_forward.ts'
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
const args = process.argv.slice(2)
|
|
8
|
-
const force = args.includes('--force') || args.includes('-f')
|
|
9
|
-
|
|
10
|
-
// Check git status
|
|
11
|
-
const { exitCode } = await sh`cd ${cwd} && git status`.nothrow()
|
|
12
|
-
const isGitRepo = exitCode === 0
|
|
13
|
-
|
|
14
|
-
if (isGitRepo) {
|
|
15
|
-
const unstagedChanges = await sh`cd ${cwd} && git diff --name-only --diff-filter=ACMR`.text()
|
|
16
|
-
if (unstagedChanges) {
|
|
17
|
-
if (force) {
|
|
18
|
-
console.log('Force mode: committing unstaged changes before pull...')
|
|
19
|
-
await sh`cd ${cwd} && git add .`
|
|
20
|
-
const preCommitArgs = await buildCommitArgs(cwd, [
|
|
21
|
-
'chore(force-pull): saved unstaged changes before pull',
|
|
22
|
-
])
|
|
23
|
-
await sh`cd ${cwd} && git ${preCommitArgs}`
|
|
24
|
-
} else {
|
|
25
|
-
throw new Error('Unstaged changes found, please commit or stash your changes before pulling')
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
} else {
|
|
29
|
-
const confirmContinue = prompt(
|
|
30
|
-
'No git repository found, so it will not be safe to pull, continue? (y/n)',
|
|
31
|
-
)
|
|
32
|
-
if (confirmContinue !== 'y') throw new Error('Pull cancelled')
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Read application.json
|
|
36
|
-
const app = JSON.parse(await readFile(`${cwd}/application.json`, 'utf8'))
|
|
37
|
-
|
|
38
|
-
const isModule = app.type === 'module'
|
|
39
|
-
const command = isModule ? 'module' : 'app'
|
|
40
|
-
|
|
41
|
-
// Fetch project files using CLI
|
|
42
|
-
console.log(`Pulling ${command} project (${app.id})...`)
|
|
43
|
-
const result = await sh`bricks ${command} project-pull ${app.id} --json`.quiet().nothrow()
|
|
44
|
-
|
|
45
|
-
if (result.exitCode !== 0) {
|
|
46
|
-
const output = result.stderr.toString() || result.stdout.toString()
|
|
47
|
-
try {
|
|
48
|
-
const json = JSON.parse(output)
|
|
49
|
-
throw new Error(json.error || 'Pull failed')
|
|
50
|
-
} catch {
|
|
51
|
-
throw new Error(output || 'Pull failed')
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const { files, lastCommitId } = JSON.parse(result.stdout.toString())
|
|
56
|
-
|
|
57
|
-
let useMain = false
|
|
58
|
-
if (isGitRepo && !force) {
|
|
59
|
-
console.log(`Checking commit ${lastCommitId}...`)
|
|
60
|
-
const found = (await sh`cd ${cwd} && git rev-list -1 ${lastCommitId}`.nothrow().text())
|
|
61
|
-
.trim()
|
|
62
|
-
.match(/^[\da-f]{40}$/)
|
|
63
|
-
|
|
64
|
-
const commitId = (await sh`cd ${cwd} && git rev-parse HEAD`.text()).trim()
|
|
65
|
-
|
|
66
|
-
if (commitId === lastCommitId) throw new Error('Commit not changed')
|
|
67
|
-
|
|
68
|
-
const branchName = isModule
|
|
69
|
-
? 'BRICKS_PROJECT_try-pull-module'
|
|
70
|
-
: 'BRICKS_PROJECT_try-pull-application'
|
|
71
|
-
|
|
72
|
-
await sh`cd ${cwd} && git branch -D ${branchName}`.nothrow()
|
|
73
|
-
|
|
74
|
-
if (found) {
|
|
75
|
-
await sh`cd ${cwd} && git checkout -b ${branchName} ${lastCommitId}`.nothrow()
|
|
76
|
-
} else {
|
|
77
|
-
await sh`cd ${cwd} && git checkout -b ${branchName}`
|
|
78
|
-
useMain = true
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const oxfmtConfig = await readFile(`${cwd}/.oxfmtrc.json`, 'utf8')
|
|
83
|
-
.then(JSON.parse)
|
|
84
|
-
.catch(() => ({
|
|
85
|
-
trailingComma: 'all',
|
|
86
|
-
tabWidth: 2,
|
|
87
|
-
semi: false,
|
|
88
|
-
singleQuote: true,
|
|
89
|
-
printWidth: 100,
|
|
90
|
-
}))
|
|
91
|
-
|
|
92
|
-
await Promise.all(
|
|
93
|
-
files.map(async (file: { name: string; input: string; formatable?: boolean }) => {
|
|
94
|
-
let content = file.input
|
|
95
|
-
if (file.formatable) {
|
|
96
|
-
const result = await format(file.name, file.input, oxfmtConfig)
|
|
97
|
-
content = result.code
|
|
98
|
-
}
|
|
99
|
-
return writeFile(`${cwd}/${file.name}`, content)
|
|
100
|
-
}),
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
if (isGitRepo) {
|
|
104
|
-
await sh`cd ${cwd} && git add .`
|
|
105
|
-
const hasChanges = !!(await sh`cd ${cwd} && git diff --cached --name-only`.text()).trim()
|
|
106
|
-
if (hasChanges) {
|
|
107
|
-
const commitMsg = force
|
|
108
|
-
? `chore(force-pull): apply force pull-${command}`
|
|
109
|
-
: isModule
|
|
110
|
-
? 'chore(project): apply file changes from BRICKS module'
|
|
111
|
-
: 'chore(project): apply file changes from BRICKS application'
|
|
112
|
-
const commitArgs = await buildCommitArgs(cwd, [commitMsg])
|
|
113
|
-
await sh`cd ${cwd} && git ${commitArgs}`
|
|
114
|
-
}
|
|
115
|
-
if (!force && !useMain) {
|
|
116
|
-
await sh`cd ${cwd} && git merge main`
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
console.log(
|
|
121
|
-
`${isModule ? 'Module' : 'App'} project pulled: ${files.length} files${force ? ' (force)' : ''}`,
|
|
122
|
-
)
|
|
4
|
+
forwardLegacyCtorTool('pull', import.meta.url)
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { compile } from '../index'
|
|
2
|
-
|
|
3
|
-
const SUBSPACE_ID = 'SUBSPACE_00000000-0000-0000-0000-000000000001'
|
|
4
|
-
const CANVAS_ID = 'CANVAS_00000000-0000-0000-0000-000000000001'
|
|
5
|
-
const ANIMATION_ID = 'ANIMATION_00000000-0000-0000-0000-000000000001'
|
|
6
|
-
|
|
7
|
-
const makeApp = (animations) => {
|
|
8
|
-
const rootCanvas = {
|
|
9
|
-
__typename: 'Canvas',
|
|
10
|
-
id: CANVAS_ID,
|
|
11
|
-
items: [],
|
|
12
|
-
}
|
|
13
|
-
const rootSubspace = {
|
|
14
|
-
__typename: 'Subspace',
|
|
15
|
-
id: SUBSPACE_ID,
|
|
16
|
-
title: 'Main Subspace',
|
|
17
|
-
layout: {
|
|
18
|
-
width: 96,
|
|
19
|
-
height: 54,
|
|
20
|
-
},
|
|
21
|
-
rootCanvas,
|
|
22
|
-
canvases: [rootCanvas],
|
|
23
|
-
animations,
|
|
24
|
-
bricks: [],
|
|
25
|
-
generators: [],
|
|
26
|
-
data: [],
|
|
27
|
-
dataRouting: [],
|
|
28
|
-
dataCalculation: [],
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
name: 'Compile animation test',
|
|
33
|
-
rootSubspace,
|
|
34
|
-
subspaces: [rootSubspace],
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
describe('compile animations', () => {
|
|
39
|
-
test('normalizes mixed legacy spring config', async () => {
|
|
40
|
-
const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {})
|
|
41
|
-
try {
|
|
42
|
-
const config = await compile(
|
|
43
|
-
makeApp([
|
|
44
|
-
{
|
|
45
|
-
__typename: 'Animation',
|
|
46
|
-
id: ANIMATION_ID,
|
|
47
|
-
alias: 'btnPressOut',
|
|
48
|
-
title: 'Button Press Out',
|
|
49
|
-
property: 'transform.scale',
|
|
50
|
-
config: {
|
|
51
|
-
__type: 'AnimationSpringConfig',
|
|
52
|
-
toValue: 1,
|
|
53
|
-
friction: 5,
|
|
54
|
-
tension: 200,
|
|
55
|
-
speed: 14,
|
|
56
|
-
bounciness: 8,
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
]),
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
expect(config.subspace_map[SUBSPACE_ID].animation_map[ANIMATION_ID].config).toEqual({
|
|
63
|
-
toValue: 1,
|
|
64
|
-
friction: 5,
|
|
65
|
-
tension: 200,
|
|
66
|
-
})
|
|
67
|
-
const warning = warnSpy.mock.calls[0][0]
|
|
68
|
-
expect(warning).toContain('Resolved animation spring config')
|
|
69
|
-
expect(warning).toContain('Button Press Out')
|
|
70
|
-
expect(warning).toContain('btnPressOut')
|
|
71
|
-
expect(warning).toContain('transform.scale')
|
|
72
|
-
expect(warning).toContain('Main Subspace')
|
|
73
|
-
expect(warning).not.toContain('ANIMATION_')
|
|
74
|
-
expect(warning).not.toContain('SUBSPACE_')
|
|
75
|
-
} finally {
|
|
76
|
-
warnSpy.mockRestore()
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
test('rejects invalid animation property', async () => {
|
|
81
|
-
await expect(
|
|
82
|
-
compile(
|
|
83
|
-
makeApp([
|
|
84
|
-
{
|
|
85
|
-
__typename: 'Animation',
|
|
86
|
-
id: ANIMATION_ID,
|
|
87
|
-
property: 'transform.skewX',
|
|
88
|
-
config: {
|
|
89
|
-
__type: 'AnimationTimingConfig',
|
|
90
|
-
toValue: 1,
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
]),
|
|
94
|
-
),
|
|
95
|
-
).rejects.toThrow(/Invalid animation property/)
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
test('rejects invalid animation config type', async () => {
|
|
99
|
-
await expect(
|
|
100
|
-
compile(
|
|
101
|
-
makeApp([
|
|
102
|
-
{
|
|
103
|
-
__typename: 'Animation',
|
|
104
|
-
id: ANIMATION_ID,
|
|
105
|
-
property: 'opacity',
|
|
106
|
-
config: {
|
|
107
|
-
__type: 'AnimationUnknownConfig',
|
|
108
|
-
toValue: 1,
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
]),
|
|
112
|
-
),
|
|
113
|
-
).rejects.toThrow(/Invalid animation config type/)
|
|
114
|
-
})
|
|
115
|
-
})
|