@fugood/bricks-ctor 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/compile/action-name-map.ts +988 -0
- package/compile/index.ts +1245 -0
- package/compile/util.ts +358 -0
- package/index.ts +6 -0
- package/package.json +28 -0
- package/skills/bricks-design/LICENSE.txt +180 -0
- package/skills/bricks-design/SKILL.md +66 -0
- package/skills/bricks-project/SKILL.md +32 -0
- package/skills/bricks-project/rules/animation.md +159 -0
- package/skills/bricks-project/rules/architecture-patterns.md +69 -0
- package/skills/bricks-project/rules/automations.md +221 -0
- package/skills/bricks-project/rules/buttress.md +156 -0
- package/skills/bricks-project/rules/data-calculation.md +208 -0
- package/skills/bricks-project/rules/local-sync.md +129 -0
- package/skills/bricks-project/rules/media-flow.md +158 -0
- package/skills/bricks-project/rules/remote-data-bank.md +196 -0
- package/skills/bricks-project/rules/standby-transition.md +124 -0
- package/skills/rive-marketplace/SKILL.md +99 -0
- package/tools/deploy.ts +151 -0
- package/tools/icons/.gitattributes +1 -0
- package/tools/icons/fa6pro-glyphmap.json +4686 -0
- package/tools/icons/fa6pro-meta.json +3671 -0
- package/tools/mcp-server.ts +28 -0
- package/tools/mcp-tools/compile.ts +91 -0
- package/tools/mcp-tools/huggingface.ts +762 -0
- package/tools/mcp-tools/icons.ts +70 -0
- package/tools/mcp-tools/lottie.ts +102 -0
- package/tools/mcp-tools/media.ts +110 -0
- package/tools/postinstall.ts +229 -0
- package/tools/preview-main.mjs +293 -0
- package/tools/preview.ts +143 -0
- package/tools/pull.ts +116 -0
- package/tsconfig.json +16 -0
- package/types/animation.ts +100 -0
- package/types/automation.ts +235 -0
- package/types/brick-base.ts +80 -0
- package/types/bricks/Camera.ts +246 -0
- package/types/bricks/Chart.ts +372 -0
- package/types/bricks/GenerativeMedia.ts +276 -0
- package/types/bricks/Icon.ts +98 -0
- package/types/bricks/Image.ts +114 -0
- package/types/bricks/Items.ts +476 -0
- package/types/bricks/Lottie.ts +168 -0
- package/types/bricks/Maps.ts +262 -0
- package/types/bricks/QrCode.ts +117 -0
- package/types/bricks/Rect.ts +150 -0
- package/types/bricks/RichText.ts +128 -0
- package/types/bricks/Rive.ts +220 -0
- package/types/bricks/Slideshow.ts +201 -0
- package/types/bricks/Svg.ts +99 -0
- package/types/bricks/Text.ts +148 -0
- package/types/bricks/TextInput.ts +242 -0
- package/types/bricks/Video.ts +175 -0
- package/types/bricks/VideoStreaming.ts +112 -0
- package/types/bricks/WebRtcStream.ts +65 -0
- package/types/bricks/WebView.ts +168 -0
- package/types/bricks/index.ts +21 -0
- package/types/canvas.ts +82 -0
- package/types/common.ts +144 -0
- package/types/data-calc-command.ts +7005 -0
- package/types/data-calc-script.ts +21 -0
- package/types/data-calc.ts +11 -0
- package/types/data.ts +95 -0
- package/types/generators/AlarmClock.ts +110 -0
- package/types/generators/Assistant.ts +621 -0
- package/types/generators/BleCentral.ts +247 -0
- package/types/generators/BlePeripheral.ts +208 -0
- package/types/generators/CanvasMap.ts +74 -0
- package/types/generators/CastlesPay.ts +87 -0
- package/types/generators/DataBank.ts +160 -0
- package/types/generators/File.ts +432 -0
- package/types/generators/GraphQl.ts +132 -0
- package/types/generators/Http.ts +222 -0
- package/types/generators/HttpServer.ts +176 -0
- package/types/generators/Information.ts +103 -0
- package/types/generators/Intent.ts +168 -0
- package/types/generators/Iterator.ts +108 -0
- package/types/generators/Keyboard.ts +105 -0
- package/types/generators/LlmAnthropicCompat.ts +212 -0
- package/types/generators/LlmAppleBuiltin.ts +159 -0
- package/types/generators/LlmGgml.ts +861 -0
- package/types/generators/LlmMediaTekNeuroPilot.ts +235 -0
- package/types/generators/LlmMlx.ts +227 -0
- package/types/generators/LlmOnnx.ts +213 -0
- package/types/generators/LlmOpenAiCompat.ts +244 -0
- package/types/generators/LlmQualcommAiEngine.ts +247 -0
- package/types/generators/Mcp.ts +637 -0
- package/types/generators/McpServer.ts +289 -0
- package/types/generators/MediaFlow.ts +170 -0
- package/types/generators/MqttBroker.ts +141 -0
- package/types/generators/MqttClient.ts +141 -0
- package/types/generators/Question.ts +408 -0
- package/types/generators/RealtimeTranscription.ts +279 -0
- package/types/generators/RerankerGgml.ts +191 -0
- package/types/generators/SerialPort.ts +151 -0
- package/types/generators/SoundPlayer.ts +94 -0
- package/types/generators/SoundRecorder.ts +130 -0
- package/types/generators/SpeechToTextGgml.ts +415 -0
- package/types/generators/SpeechToTextOnnx.ts +236 -0
- package/types/generators/SpeechToTextPlatform.ts +85 -0
- package/types/generators/SqLite.ts +159 -0
- package/types/generators/Step.ts +107 -0
- package/types/generators/SttAppleBuiltin.ts +130 -0
- package/types/generators/Tcp.ts +126 -0
- package/types/generators/TcpServer.ts +147 -0
- package/types/generators/TextToSpeechAppleBuiltin.ts +127 -0
- package/types/generators/TextToSpeechGgml.ts +221 -0
- package/types/generators/TextToSpeechOnnx.ts +178 -0
- package/types/generators/TextToSpeechOpenAiLike.ts +121 -0
- package/types/generators/ThermalPrinter.ts +191 -0
- package/types/generators/Tick.ts +83 -0
- package/types/generators/Udp.ts +120 -0
- package/types/generators/VadGgml.ts +250 -0
- package/types/generators/VadOnnx.ts +231 -0
- package/types/generators/VadTraditional.ts +138 -0
- package/types/generators/VectorStore.ts +257 -0
- package/types/generators/Watchdog.ts +107 -0
- package/types/generators/WebCrawler.ts +103 -0
- package/types/generators/WebRtc.ts +181 -0
- package/types/generators/WebSocket.ts +148 -0
- package/types/generators/index.ts +57 -0
- package/types/index.ts +13 -0
- package/types/subspace.ts +59 -0
- package/types/switch.ts +51 -0
- package/types/system.ts +707 -0
- package/utils/calc.ts +126 -0
- package/utils/data.ts +497 -0
- package/utils/event-props.ts +836 -0
- package/utils/id.ts +80 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
2
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
3
|
+
|
|
4
|
+
import { register as registerCompile } from './mcp-tools/compile'
|
|
5
|
+
import { register as registerLottie } from './mcp-tools/lottie'
|
|
6
|
+
import { register as registerIcons } from './mcp-tools/icons'
|
|
7
|
+
import { register as registerHuggingface } from './mcp-tools/huggingface'
|
|
8
|
+
import { register as registerMedia } from './mcp-tools/media'
|
|
9
|
+
|
|
10
|
+
const server = new McpServer({
|
|
11
|
+
name: 'bricks-ctor',
|
|
12
|
+
version: '1.0.0',
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
const { dirname } = import.meta
|
|
16
|
+
const projectDir = String(dirname).split('/node_modules/')[0]
|
|
17
|
+
|
|
18
|
+
// NOTE: Cursor (Or VSCode) seems set ELECTRON_RUN_AS_NODE to 1, so we need to unset it
|
|
19
|
+
process.env.ELECTRON_RUN_AS_NODE = ''
|
|
20
|
+
|
|
21
|
+
registerCompile(server, projectDir)
|
|
22
|
+
registerLottie(server)
|
|
23
|
+
registerIcons(server)
|
|
24
|
+
registerHuggingface(server)
|
|
25
|
+
registerMedia(server, projectDir)
|
|
26
|
+
|
|
27
|
+
const transport = new StdioServerTransport()
|
|
28
|
+
await server.connect(transport)
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
import { $ } from 'bun'
|
|
4
|
+
|
|
5
|
+
export function register(server: McpServer, projectDir: string) {
|
|
6
|
+
const { dirname } = import.meta
|
|
7
|
+
|
|
8
|
+
server.tool('compile', {}, async () => {
|
|
9
|
+
let log = ''
|
|
10
|
+
try {
|
|
11
|
+
log += 'Type checking & Compiling...'
|
|
12
|
+
log += await $`bun compile`.cwd(projectDir).text()
|
|
13
|
+
} catch (err) {
|
|
14
|
+
log += `${err.stdout.toString()}\n${err.stderr.toString()}`
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
content: [{ type: 'text', text: log }],
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
server.tool(
|
|
22
|
+
'preview',
|
|
23
|
+
{
|
|
24
|
+
delay: z
|
|
25
|
+
.number()
|
|
26
|
+
.describe('Delay in milliseconds before taking screenshot')
|
|
27
|
+
.optional()
|
|
28
|
+
.default(3000),
|
|
29
|
+
width: z.number().describe('Width of the screenshot').optional().default(600),
|
|
30
|
+
height: z.number().optional().default(480),
|
|
31
|
+
responseImage: z
|
|
32
|
+
.boolean()
|
|
33
|
+
.describe(
|
|
34
|
+
'Whether to response image content (base64 encoded jpeg). If false, only saved path will be responded as text.',
|
|
35
|
+
)
|
|
36
|
+
.optional()
|
|
37
|
+
.default(false),
|
|
38
|
+
testId: z.string().describe('Automation test ID to trigger').optional(),
|
|
39
|
+
testTitleLike: z
|
|
40
|
+
.string()
|
|
41
|
+
.describe('Find automation test by partial title match (case-insensitive)')
|
|
42
|
+
.optional(),
|
|
43
|
+
} as any,
|
|
44
|
+
async ({ delay, width, height, responseImage, testId, testTitleLike }: any) => {
|
|
45
|
+
let log = ''
|
|
46
|
+
let error = false
|
|
47
|
+
try {
|
|
48
|
+
const toolsDir = `${dirname}/..`
|
|
49
|
+
const args = [
|
|
50
|
+
'--no-keep-open',
|
|
51
|
+
'--take-screenshot',
|
|
52
|
+
JSON.stringify({
|
|
53
|
+
delay,
|
|
54
|
+
width,
|
|
55
|
+
height,
|
|
56
|
+
path: `${toolsDir}/screenshot.jpg`,
|
|
57
|
+
closeAfter: true,
|
|
58
|
+
headless: true,
|
|
59
|
+
}),
|
|
60
|
+
]
|
|
61
|
+
if (testId) args.push('--test-id', testId)
|
|
62
|
+
if (testTitleLike) args.push('--test-title-like', testTitleLike)
|
|
63
|
+
log = await $`bunx --bun electron ${toolsDir}/preview-main.mjs ${args}`
|
|
64
|
+
.cwd(projectDir)
|
|
65
|
+
.text()
|
|
66
|
+
} catch (err) {
|
|
67
|
+
log = `${err.stdout.toString()}\n${err.stderr.toString()}`
|
|
68
|
+
error = true
|
|
69
|
+
}
|
|
70
|
+
let screenshotBase64: string | null = null
|
|
71
|
+
if (!error && responseImage) {
|
|
72
|
+
const toolsDir = `${dirname}/..`
|
|
73
|
+
const screenshot = await Bun.file(`${toolsDir}/screenshot.jpg`).arrayBuffer()
|
|
74
|
+
screenshotBase64 = Buffer.from(screenshot).toString('base64')
|
|
75
|
+
}
|
|
76
|
+
const content: Array<
|
|
77
|
+
{ type: 'text'; text: string } | { type: 'image'; data: string; mimeType: string }
|
|
78
|
+
> = [{ type: 'text', text: log }]
|
|
79
|
+
if (screenshotBase64) {
|
|
80
|
+
content.push({
|
|
81
|
+
type: 'image',
|
|
82
|
+
data: screenshotBase64,
|
|
83
|
+
mimeType: 'image/jpeg',
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
content,
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
)
|
|
91
|
+
}
|