@fugood/bricks-project 2.23.2 → 2.23.4

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.
Files changed (95) hide show
  1. package/compile/index.ts +343 -125
  2. package/package.json +4 -2
  3. package/skills/bricks-project/rules/automations.md +7 -7
  4. package/tools/deploy.ts +39 -10
  5. package/tools/mcp-server.ts +10 -877
  6. package/tools/mcp-tools/compile.ts +91 -0
  7. package/tools/mcp-tools/huggingface.ts +653 -0
  8. package/tools/mcp-tools/icons.ts +60 -0
  9. package/tools/mcp-tools/lottie.ts +102 -0
  10. package/tools/mcp-tools/media.ts +110 -0
  11. package/tools/postinstall.ts +11 -6
  12. package/tools/pull.ts +25 -9
  13. package/tsconfig.json +16 -0
  14. package/types/bricks/Camera.ts +1 -1
  15. package/types/bricks/Chart.ts +1 -1
  16. package/types/bricks/GenerativeMedia.ts +1 -1
  17. package/types/bricks/Icon.ts +1 -1
  18. package/types/bricks/Image.ts +1 -1
  19. package/types/bricks/Items.ts +1 -1
  20. package/types/bricks/Lottie.ts +1 -1
  21. package/types/bricks/Maps.ts +1 -1
  22. package/types/bricks/QrCode.ts +1 -1
  23. package/types/bricks/Rect.ts +1 -1
  24. package/types/bricks/RichText.ts +1 -1
  25. package/types/bricks/Rive.ts +1 -1
  26. package/types/bricks/Slideshow.ts +1 -1
  27. package/types/bricks/Svg.ts +1 -1
  28. package/types/bricks/Text.ts +1 -1
  29. package/types/bricks/TextInput.ts +1 -1
  30. package/types/bricks/Video.ts +1 -1
  31. package/types/bricks/VideoStreaming.ts +1 -1
  32. package/types/bricks/WebRtcStream.ts +1 -1
  33. package/types/bricks/WebView.ts +1 -1
  34. package/types/canvas.ts +2 -2
  35. package/types/common.ts +4 -4
  36. package/types/generators/AlarmClock.ts +1 -1
  37. package/types/generators/Assistant.ts +1 -1
  38. package/types/generators/BleCentral.ts +1 -1
  39. package/types/generators/BlePeripheral.ts +1 -1
  40. package/types/generators/CanvasMap.ts +1 -1
  41. package/types/generators/CastlesPay.ts +1 -1
  42. package/types/generators/DataBank.ts +1 -1
  43. package/types/generators/File.ts +1 -1
  44. package/types/generators/GraphQl.ts +1 -1
  45. package/types/generators/Http.ts +1 -1
  46. package/types/generators/HttpServer.ts +1 -1
  47. package/types/generators/Information.ts +1 -1
  48. package/types/generators/Intent.ts +1 -1
  49. package/types/generators/Iterator.ts +1 -1
  50. package/types/generators/Keyboard.ts +1 -1
  51. package/types/generators/LlmAnthropicCompat.ts +1 -1
  52. package/types/generators/LlmAppleBuiltin.ts +1 -1
  53. package/types/generators/LlmGgml.ts +1 -1
  54. package/types/generators/LlmOnnx.ts +1 -1
  55. package/types/generators/LlmOpenAiCompat.ts +1 -1
  56. package/types/generators/LlmQualcommAiEngine.ts +1 -1
  57. package/types/generators/Mcp.ts +1 -1
  58. package/types/generators/McpServer.ts +1 -1
  59. package/types/generators/MediaFlow.ts +1 -1
  60. package/types/generators/MqttBroker.ts +1 -1
  61. package/types/generators/MqttClient.ts +1 -1
  62. package/types/generators/Question.ts +1 -1
  63. package/types/generators/RealtimeTranscription.ts +1 -1
  64. package/types/generators/RerankerGgml.ts +1 -1
  65. package/types/generators/SerialPort.ts +1 -1
  66. package/types/generators/SoundPlayer.ts +1 -1
  67. package/types/generators/SoundRecorder.ts +1 -1
  68. package/types/generators/SpeechToTextGgml.ts +1 -1
  69. package/types/generators/SpeechToTextOnnx.ts +1 -1
  70. package/types/generators/SpeechToTextPlatform.ts +1 -1
  71. package/types/generators/SqLite.ts +1 -1
  72. package/types/generators/Step.ts +1 -1
  73. package/types/generators/SttAppleBuiltin.ts +1 -1
  74. package/types/generators/Tcp.ts +1 -1
  75. package/types/generators/TcpServer.ts +1 -1
  76. package/types/generators/TextToSpeechAppleBuiltin.ts +1 -1
  77. package/types/generators/TextToSpeechGgml.ts +1 -1
  78. package/types/generators/TextToSpeechOnnx.ts +1 -1
  79. package/types/generators/TextToSpeechOpenAiLike.ts +1 -1
  80. package/types/generators/ThermalPrinter.ts +1 -1
  81. package/types/generators/Tick.ts +1 -1
  82. package/types/generators/Udp.ts +1 -1
  83. package/types/generators/VadGgml.ts +1 -1
  84. package/types/generators/VadOnnx.ts +1 -1
  85. package/types/generators/VadTraditional.ts +1 -1
  86. package/types/generators/VectorStore.ts +1 -1
  87. package/types/generators/Watchdog.ts +1 -1
  88. package/types/generators/WebCrawler.ts +1 -1
  89. package/types/generators/WebRtc.ts +1 -1
  90. package/types/generators/WebSocket.ts +1 -1
  91. package/types/system.ts +1 -1
  92. package/utils/calc.ts +16 -10
  93. package/utils/id.ts +4 -0
  94. package/api/index.ts +0 -1
  95. package/api/instance.ts +0 -213
package/package.json CHANGED
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "name": "@fugood/bricks-project",
3
- "version": "2.23.2",
3
+ "version": "2.23.4",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
+ "typecheck": "tsc --noEmit",
6
7
  "build": "bun scripts/build.js"
7
8
  },
8
9
  "dependencies": {
9
- "@fugood/bricks-cli": "^2.23.0",
10
+ "@fugood/bricks-cli": "^2.23.4",
10
11
  "@huggingface/gguf": "^0.3.2",
11
12
  "@iarna/toml": "^3.0.0",
12
13
  "@modelcontextprotocol/sdk": "^1.15.0",
13
14
  "@toon-format/toon": "^2.1.0",
15
+ "@types/bun": "^1.3.9",
14
16
  "@types/escodegen": "^0.0.10",
15
17
  "@types/lodash": "^4.17.12",
16
18
  "acorn": "^8.13.0",
@@ -35,14 +35,14 @@ Automations can validate:
35
35
  ```typescript
36
36
  const testLoginFlow: AutomationTest = {
37
37
  __typename: 'AutomationTest',
38
- id: 'test-login-flow',
38
+ id: makeId('test'),
39
39
  title: 'Test Login Flow',
40
40
  timeout: 30000,
41
41
  trigger_type: 'launch',
42
42
  cases: [
43
43
  {
44
44
  __typename: 'TestCase',
45
- id: 'wait-login-canvas',
45
+ id: makeId('test_case'),
46
46
  name: 'Wait for login canvas',
47
47
  run: ['wait_until_canvas_change', () => mainSubspace, () => loginCanvas, 5000],
48
48
  exit_on_failed: true,
@@ -53,7 +53,7 @@ const testLoginFlow: AutomationTest = {
53
53
  },
54
54
  {
55
55
  __typename: 'TestCase',
56
- id: 'press-username',
56
+ id: makeId('test_case'),
57
57
  name: 'Press username input',
58
58
  run: ['brick_press', () => mainSubspace, () => usernameInput],
59
59
  exit_on_failed: true,
@@ -64,7 +64,7 @@ const testLoginFlow: AutomationTest = {
64
64
  },
65
65
  {
66
66
  __typename: 'TestCase',
67
- id: 'assert-username',
67
+ id: makeId('test_case'),
68
68
  name: 'Assert username value',
69
69
  run: ['assert_property', () => mainSubspace, () => usernameData, 'testuser'],
70
70
  exit_on_failed: true,
@@ -75,7 +75,7 @@ const testLoginFlow: AutomationTest = {
75
75
  },
76
76
  {
77
77
  __typename: 'TestCase',
78
- id: 'press-login',
78
+ id: makeId('test_case'),
79
79
  name: 'Press login button',
80
80
  run: ['brick_press', () => mainSubspace, () => loginButton],
81
81
  exit_on_failed: true,
@@ -86,7 +86,7 @@ const testLoginFlow: AutomationTest = {
86
86
  },
87
87
  {
88
88
  __typename: 'TestCase',
89
- id: 'wait-dashboard',
89
+ id: makeId('test_case'),
90
90
  name: 'Wait for dashboard',
91
91
  run: ['wait_until_canvas_change', () => mainSubspace, () => dashboardCanvas, 10000],
92
92
  exit_on_failed: true,
@@ -182,7 +182,7 @@ Visual regression testing with screenshot comparison:
182
182
  ```typescript
183
183
  {
184
184
  __typename: 'TestCase',
185
- id: 'screenshot-dashboard',
185
+ id: makeId('test_case'),
186
186
  name: 'Match dashboard screenshot',
187
187
  run: ['match_screenshot', 'dashboard-initial-state', 0.01, 3],
188
188
  exit_on_failed: true,
package/tools/deploy.ts CHANGED
@@ -4,29 +4,40 @@ import { parseArgs } from 'util'
4
4
  const cwd = process.cwd()
5
5
 
6
6
  const {
7
- values: { changelogs: changelogsArg, 'changelogs-file': changelogsFile, yes },
7
+ values: {
8
+ changelogs: changelogsArg,
9
+ 'changelogs-file': changelogsFile,
10
+ 'auto-commit': autoCommit,
11
+ yes,
12
+ help,
13
+ },
8
14
  } = parseArgs({
9
15
  args: Bun.argv.slice(2),
10
16
  options: {
11
17
  changelogs: { type: 'string' },
12
18
  'changelogs-file': { type: 'string' },
19
+ 'auto-commit': { type: 'boolean' },
13
20
  yes: { type: 'boolean', short: 'y' },
21
+ help: { type: 'boolean', short: 'h' },
14
22
  },
15
23
  allowPositionals: true,
16
24
  })
17
25
 
26
+ if (help) {
27
+ console.log(`Options:
28
+ --changelogs <text> Changelogs text for the release
29
+ --changelogs-file <path> Read changelogs from a file
30
+ --auto-commit Auto-commit unstaged changes before deploying
31
+ -y, --yes Skip all prompts
32
+ -h, --help Show this help message`)
33
+ process.exit(0) // eslint-disable-line unicorn/no-process-exit
34
+ }
35
+
18
36
  // Check git status
19
- const { exitCode } = await $`cd ${cwd} && git status`.nothrow()
37
+ const { exitCode } = await $`cd ${cwd} && git status`.quiet().nothrow()
20
38
  const isGitRepo = exitCode === 0
21
39
 
22
- let commitId = ''
23
- if (isGitRepo) {
24
- const unstagedChanges = await $`cd ${cwd} && git diff --name-only --diff-filter=ACMR`.text()
25
- if (unstagedChanges)
26
- throw new Error('Unstaged changes found, please commit or stash your changes before deploying')
27
-
28
- commitId = (await $`cd ${cwd} && git rev-parse HEAD`.text()).trim()
29
- } else if (!yes) {
40
+ if (!isGitRepo && !yes) {
30
41
  const confirmContinue = prompt('No git repository found, continue? (y/n)')
31
42
  if (confirmContinue !== 'y') throw new Error('Deployment cancelled')
32
43
  }
@@ -53,6 +64,24 @@ if (changelogsArg) {
53
64
  changelogs = prompt('Enter changelogs (optional, press Enter to skip):') || ''
54
65
  }
55
66
 
67
+ // Handle unstaged changes
68
+ let commitId = ''
69
+ if (isGitRepo) {
70
+ const unstagedChanges = await $`cd ${cwd} && git diff --name-only --diff-filter=ACMR`.text()
71
+ if (unstagedChanges) {
72
+ if (autoCommit) {
73
+ const commitMsg = `chore: release ${version || 'new version'}`
74
+ const commitBody = changelogs || '[no changelogs]'
75
+ await $`cd ${cwd} && git add -A && git commit -m ${commitMsg} -m ${commitBody}`
76
+ } else {
77
+ throw new Error(
78
+ 'Unstaged changes found, please commit or stash your changes before deploying',
79
+ )
80
+ }
81
+ }
82
+ commitId = (await $`cd ${cwd} && git rev-parse HEAD`.text()).trim()
83
+ }
84
+
56
85
  // Ask for confirmation
57
86
  if (!yes) {
58
87
  const confirm = prompt('Are you sure you want to deploy? (y/n)')