@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/tools/mcp-tools/icons.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
import * as TOON from '@toon-format/toon'
|
|
4
|
-
import Fuse from 'fuse.js'
|
|
5
|
-
import glyphmap from '../icons/fa6pro-glyphmap.json'
|
|
6
|
-
import glyphmapMeta from '../icons/fa6pro-meta.json'
|
|
7
|
-
|
|
8
|
-
type IconStyle = 'brands' | 'duotone' | 'light' | 'regular' | 'solid' | 'thin'
|
|
9
|
-
|
|
10
|
-
// Bitmask bits for icon family membership (compact metadata format)
|
|
11
|
-
const STYLE_BITS: Record<IconStyle, number> = {
|
|
12
|
-
brands: 1,
|
|
13
|
-
thin: 2,
|
|
14
|
-
light: 4,
|
|
15
|
-
regular: 8,
|
|
16
|
-
solid: 16,
|
|
17
|
-
duotone: 256,
|
|
18
|
-
}
|
|
19
|
-
const ALL_STYLES = Object.keys(STYLE_BITS) as IconStyle[]
|
|
20
|
-
|
|
21
|
-
// Metadata is shipped as { bitmaskValue: [iconName, ...] } with the dominant
|
|
22
|
-
// 510 (all non-brand families) omitted. Expand to a flat lookup once.
|
|
23
|
-
const DEFAULT_BITMASK = 510
|
|
24
|
-
const compactMeta = glyphmapMeta as Record<string, string[]>
|
|
25
|
-
const iconMeta: Record<string, number> = {}
|
|
26
|
-
for (const name of Object.keys(glyphmap)) iconMeta[name] = DEFAULT_BITMASK
|
|
27
|
-
for (const bitmaskKey of Object.keys(compactMeta)) {
|
|
28
|
-
const value = Number(bitmaskKey)
|
|
29
|
-
const names = compactMeta[bitmaskKey]
|
|
30
|
-
for (const name of names) iconMeta[name] = value
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const iconList = Object.entries(glyphmap as Record<string, number>).map(([name, code]) => {
|
|
34
|
-
const bits = iconMeta[name] || 0
|
|
35
|
-
const styles = ALL_STYLES.filter((s) => bits & STYLE_BITS[s])
|
|
36
|
-
return { name, code, styles }
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
const fuseOptions = {
|
|
40
|
-
keys: ['name'],
|
|
41
|
-
threshold: 0.3,
|
|
42
|
-
includeScore: true,
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const iconFuse = new Fuse(iconList, fuseOptions)
|
|
46
|
-
const iconFuseByStyle = new Map<IconStyle, Fuse<(typeof iconList)[number]>>()
|
|
47
|
-
|
|
48
|
-
function getStyleFuse(style: IconStyle) {
|
|
49
|
-
let fuse = iconFuseByStyle.get(style)
|
|
50
|
-
if (!fuse) {
|
|
51
|
-
fuse = new Fuse(
|
|
52
|
-
iconList.filter((icon) => icon.styles.includes(style)),
|
|
53
|
-
fuseOptions,
|
|
54
|
-
)
|
|
55
|
-
iconFuseByStyle.set(style, fuse)
|
|
56
|
-
}
|
|
57
|
-
return fuse
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function searchIcons(query: string, limit: number, style?: IconStyle) {
|
|
61
|
-
if (style) return getStyleFuse(style).search(query, { limit })
|
|
62
|
-
return iconFuse.search(query, { limit })
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function register(server: McpServer) {
|
|
66
|
-
server.tool(
|
|
67
|
-
'icon_search',
|
|
68
|
-
{
|
|
69
|
-
query: z.string().describe('Search keywords for FontAwesome 6 Pro icons'),
|
|
70
|
-
limit: z.number().min(1).max(100).optional().default(10),
|
|
71
|
-
style: z
|
|
72
|
-
.enum(['brands', 'duotone', 'light', 'regular', 'solid', 'thin'])
|
|
73
|
-
.optional()
|
|
74
|
-
.describe('Filter by icon style'),
|
|
75
|
-
},
|
|
76
|
-
async ({ query, limit, style }) => {
|
|
77
|
-
const results = searchIcons(query, limit, style)
|
|
78
|
-
|
|
79
|
-
const icons = results.map((r) => ({
|
|
80
|
-
name: r.item.name,
|
|
81
|
-
code: r.item.code,
|
|
82
|
-
unicode: `U+${r.item.code.toString(16).toUpperCase()}`,
|
|
83
|
-
styles: r.item.styles,
|
|
84
|
-
score: r.score,
|
|
85
|
-
}))
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
content: [
|
|
89
|
-
{
|
|
90
|
-
type: 'text',
|
|
91
|
-
text: TOON.encode({ count: icons.length, icons }),
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
)
|
|
97
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
import * as TOON from '@toon-format/toon'
|
|
4
|
-
|
|
5
|
-
const LOTTIEFILES_API_URL = 'https://lottiefiles.com/api'
|
|
6
|
-
|
|
7
|
-
export function register(server: McpServer) {
|
|
8
|
-
server.tool(
|
|
9
|
-
'lottie_search',
|
|
10
|
-
{
|
|
11
|
-
query: z.string().describe('Search keywords for animations'),
|
|
12
|
-
page: z.number().min(1).optional().default(1),
|
|
13
|
-
limit: z.number().min(1).max(100).optional().default(10),
|
|
14
|
-
},
|
|
15
|
-
async ({ query, page, limit }) => {
|
|
16
|
-
try {
|
|
17
|
-
const url = new URL(`${LOTTIEFILES_API_URL}/search/get-animations`)
|
|
18
|
-
url.searchParams.set('query', query)
|
|
19
|
-
url.searchParams.set('page', String(page))
|
|
20
|
-
url.searchParams.set('limit', String(limit))
|
|
21
|
-
url.searchParams.set('format', 'json')
|
|
22
|
-
|
|
23
|
-
const response = await fetch(url.toString())
|
|
24
|
-
const data = await response.json()
|
|
25
|
-
const animations = data?.data?.data ?? []
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
content: [
|
|
29
|
-
{
|
|
30
|
-
type: 'text',
|
|
31
|
-
text: TOON.encode({ count: animations.length, animations }),
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
}
|
|
35
|
-
} catch (err: any) {
|
|
36
|
-
return {
|
|
37
|
-
content: [{ type: 'text', text: `Failed to search animations: ${err.message}` }],
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
server.tool(
|
|
44
|
-
'lottie_get_details',
|
|
45
|
-
{
|
|
46
|
-
id: z.string().describe('Animation file ID'),
|
|
47
|
-
},
|
|
48
|
-
async ({ id }) => {
|
|
49
|
-
try {
|
|
50
|
-
const url = new URL(`${LOTTIEFILES_API_URL}/animations/get-animation-data`)
|
|
51
|
-
url.searchParams.set('fileId', id)
|
|
52
|
-
url.searchParams.set('format', 'json')
|
|
53
|
-
|
|
54
|
-
const response = await fetch(url.toString())
|
|
55
|
-
const data = await response.json()
|
|
56
|
-
|
|
57
|
-
return {
|
|
58
|
-
content: [{ type: 'text', text: TOON.encode(data) }],
|
|
59
|
-
}
|
|
60
|
-
} catch (err: any) {
|
|
61
|
-
return {
|
|
62
|
-
content: [{ type: 'text', text: `Failed to get animation: ${err.message}` }],
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
server.tool(
|
|
69
|
-
'lottie_popular',
|
|
70
|
-
{
|
|
71
|
-
page: z.number().min(1).optional().default(1),
|
|
72
|
-
limit: z.number().min(1).max(100).optional().default(10),
|
|
73
|
-
},
|
|
74
|
-
async ({ page, limit }) => {
|
|
75
|
-
try {
|
|
76
|
-
const url = new URL(
|
|
77
|
-
`${LOTTIEFILES_API_URL}/iconscout/popular-animations-weekly?api=%26sort%3Dpopular`,
|
|
78
|
-
)
|
|
79
|
-
url.searchParams.set('page', String(page))
|
|
80
|
-
url.searchParams.set('limit', String(limit))
|
|
81
|
-
url.searchParams.set('format', 'json')
|
|
82
|
-
|
|
83
|
-
const response = await fetch(url.toString())
|
|
84
|
-
const data = await response.json()
|
|
85
|
-
const animations = data?.popularWeeklyData?.data ?? []
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
content: [
|
|
89
|
-
{
|
|
90
|
-
type: 'text',
|
|
91
|
-
text: TOON.encode({ count: animations.length, animations }),
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
}
|
|
95
|
-
} catch (err: any) {
|
|
96
|
-
return {
|
|
97
|
-
content: [{ type: 'text', text: `Failed to get popular animations: ${err.message}` }],
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
)
|
|
102
|
-
}
|
package/tools/mcp-tools/media.ts
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
import { sh } from '../_shell'
|
|
4
|
-
|
|
5
|
-
// MCP results are rendered as raw text — disable ANSI colors from the child.
|
|
6
|
-
const noColorEnv = { FORCE_COLOR: '0', NO_COLOR: '1' }
|
|
7
|
-
|
|
8
|
-
const runBricks = async (projectDir: string, ...args: string[]) => {
|
|
9
|
-
try {
|
|
10
|
-
return await sh`bunx bricks ${args}`.cwd(projectDir).env(noColorEnv).text()
|
|
11
|
-
} catch (err: any) {
|
|
12
|
-
throw new Error(err.stderr?.toString() || err.message)
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function register(server: McpServer, projectDir: string) {
|
|
17
|
-
server.tool('media_boxes', {}, async () => {
|
|
18
|
-
try {
|
|
19
|
-
const output = await runBricks(projectDir, 'media', 'boxes')
|
|
20
|
-
return { content: [{ type: 'text', text: output }] }
|
|
21
|
-
} catch (err: any) {
|
|
22
|
-
return { content: [{ type: 'text', text: `Failed to list media boxes: ${err.message}` }] }
|
|
23
|
-
}
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
server.tool('media_get_box', { id: z.string().describe('Media box ID') }, async ({ id }) => {
|
|
27
|
-
try {
|
|
28
|
-
const output = await runBricks(projectDir, 'media', 'box', id)
|
|
29
|
-
return { content: [{ type: 'text', text: output }] }
|
|
30
|
-
} catch (err: any) {
|
|
31
|
-
return { content: [{ type: 'text', text: `Failed to get media box: ${err.message}` }] }
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
server.tool(
|
|
36
|
-
'media_files',
|
|
37
|
-
{
|
|
38
|
-
boxId: z.string().describe('Media box ID'),
|
|
39
|
-
types: z.string().describe('Comma-separated file types to include').optional(),
|
|
40
|
-
userTag: z.array(z.string()).describe('Filter by user tags').optional(),
|
|
41
|
-
limit: z.number().describe('Limit results').optional(),
|
|
42
|
-
offset: z.number().describe('Offset results').optional(),
|
|
43
|
-
},
|
|
44
|
-
async ({ boxId, types, userTag, limit, offset }) => {
|
|
45
|
-
try {
|
|
46
|
-
const args = ['media', 'files', boxId]
|
|
47
|
-
if (types) args.push('-t', types)
|
|
48
|
-
if (userTag) userTag.forEach((tag) => args.push('-u', tag))
|
|
49
|
-
if (limit != null) args.push('-l', String(limit))
|
|
50
|
-
if (offset != null) args.push('-o', String(offset))
|
|
51
|
-
const output = await runBricks(projectDir, ...args)
|
|
52
|
-
return { content: [{ type: 'text', text: output }] }
|
|
53
|
-
} catch (err: any) {
|
|
54
|
-
return { content: [{ type: 'text', text: `Failed to list media files: ${err.message}` }] }
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
server.tool('media_file', { id: z.string().describe('Media file ID') }, async ({ id }) => {
|
|
60
|
-
try {
|
|
61
|
-
const output = await runBricks(projectDir, 'media', 'file', id)
|
|
62
|
-
return { content: [{ type: 'text', text: output }] }
|
|
63
|
-
} catch (err: any) {
|
|
64
|
-
return { content: [{ type: 'text', text: `Failed to get media file: ${err.message}` }] }
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
server.tool(
|
|
69
|
-
'media_upload_files',
|
|
70
|
-
{
|
|
71
|
-
boxId: z.string().describe('Target media box ID'),
|
|
72
|
-
files: z.array(z.string()).min(1).describe('File paths to upload'),
|
|
73
|
-
description: z.string().describe('File description').optional(),
|
|
74
|
-
userTags: z.array(z.string()).max(15).describe('User tags (max 15)').optional(),
|
|
75
|
-
imageVersion: z
|
|
76
|
-
.array(z.string())
|
|
77
|
-
.describe('Image resize specs as WxH or WxH:STRATEGY')
|
|
78
|
-
.optional(),
|
|
79
|
-
imageVersionType: z.enum(['jpg', 'png']).describe('Image output format').optional(),
|
|
80
|
-
enableAiAnalysis: z.boolean().describe('Enable AI analysis').optional(),
|
|
81
|
-
aiInstruction: z.string().describe('Custom AI analysis instruction').optional(),
|
|
82
|
-
concurrency: z.number().min(1).describe('Max concurrent uploads').optional(),
|
|
83
|
-
},
|
|
84
|
-
async ({
|
|
85
|
-
boxId,
|
|
86
|
-
files,
|
|
87
|
-
description,
|
|
88
|
-
userTags,
|
|
89
|
-
imageVersion,
|
|
90
|
-
imageVersionType,
|
|
91
|
-
enableAiAnalysis,
|
|
92
|
-
aiInstruction,
|
|
93
|
-
concurrency,
|
|
94
|
-
}) => {
|
|
95
|
-
try {
|
|
96
|
-
const args = ['media', 'upload', boxId, ...files]
|
|
97
|
-
if (description) args.push('-d', description)
|
|
98
|
-
if (userTags) userTags.forEach((tag) => args.push('-t', tag))
|
|
99
|
-
if (imageVersion) imageVersion.forEach((spec) => args.push('--image-version', spec))
|
|
100
|
-
if (imageVersionType) args.push('--image-version-type', imageVersionType)
|
|
101
|
-
if (enableAiAnalysis) args.push('--enable-ai-analysis')
|
|
102
|
-
if (aiInstruction) args.push('--ai-instruction', aiInstruction)
|
|
103
|
-
if (concurrency != null) args.push('--concurrency', String(concurrency))
|
|
104
|
-
const output = await runBricks(projectDir, ...args)
|
|
105
|
-
return { content: [{ type: 'text', text: output }] }
|
|
106
|
-
} catch (err: any) {
|
|
107
|
-
return {
|
|
108
|
-
content: [{ type: 'text', text: `Failed to upload media files: ${err.message}` }],
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
)
|
|
113
|
-
}
|