@fugood/bricks-project 2.24.0-beta.8 → 2.24.0

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 (124) hide show
  1. package/compile/action-name-map.ts +38 -0
  2. package/compile/index.ts +460 -158
  3. package/compile/util.ts +2 -0
  4. package/package.json +7 -3
  5. package/package.json.bak +27 -0
  6. package/skills/{bricks-project → bricks-ctor}/SKILL.md +2 -2
  7. package/skills/{bricks-project → bricks-ctor}/rules/animation.md +1 -1
  8. package/skills/{bricks-project → bricks-ctor}/rules/architecture-patterns.md +7 -0
  9. package/skills/{bricks-project → bricks-ctor}/rules/automations.md +7 -7
  10. package/skills/{bricks-project → bricks-ctor}/rules/buttress.md +10 -7
  11. package/skills/{bricks-project → bricks-ctor}/rules/data-calculation.md +1 -1
  12. package/skills/{bricks-project → bricks-ctor}/rules/local-sync.md +2 -2
  13. package/skills/{bricks-project → bricks-ctor}/rules/media-flow.md +3 -3
  14. package/skills/{bricks-project → bricks-ctor}/rules/remote-data-bank.md +6 -6
  15. package/skills/{bricks-project → bricks-ctor}/rules/standby-transition.md +1 -1
  16. package/skills/bricks-design/LICENSE.txt +180 -0
  17. package/skills/bricks-design/SKILL.md +66 -0
  18. package/tools/deploy.ts +66 -12
  19. package/tools/icons/fa6pro-meta.json +3669 -26125
  20. package/tools/mcp-server.ts +11 -878
  21. package/tools/mcp-tools/compile.ts +91 -0
  22. package/tools/mcp-tools/huggingface.ts +762 -0
  23. package/tools/mcp-tools/icons.ts +70 -0
  24. package/tools/mcp-tools/lottie.ts +102 -0
  25. package/tools/mcp-tools/media.ts +110 -0
  26. package/tools/postinstall.ts +137 -40
  27. package/tools/preview-main.mjs +135 -2
  28. package/tools/preview.ts +41 -2
  29. package/tools/pull.ts +37 -19
  30. package/tsconfig.json +16 -0
  31. package/types/animation.ts +4 -0
  32. package/types/automation.ts +4 -1
  33. package/types/brick-base.ts +1 -1
  34. package/types/bricks/Camera.ts +48 -13
  35. package/types/bricks/Chart.ts +10 -4
  36. package/types/bricks/GenerativeMedia.ts +30 -14
  37. package/types/bricks/Icon.ts +9 -5
  38. package/types/bricks/Image.ts +10 -6
  39. package/types/bricks/Items.ts +29 -15
  40. package/types/bricks/Lottie.ts +15 -7
  41. package/types/bricks/Maps.ts +16 -8
  42. package/types/bricks/QrCode.ts +9 -5
  43. package/types/bricks/Rect.ts +45 -6
  44. package/types/bricks/RichText.ts +9 -5
  45. package/types/bricks/Rive.ts +21 -11
  46. package/types/bricks/Slideshow.ts +20 -10
  47. package/types/bricks/Svg.ts +8 -4
  48. package/types/bricks/Text.ts +9 -5
  49. package/types/bricks/TextInput.ts +23 -13
  50. package/types/bricks/Video.ts +11 -7
  51. package/types/bricks/VideoStreaming.ts +8 -4
  52. package/types/bricks/WebRtcStream.ts +7 -3
  53. package/types/bricks/WebView.ts +12 -8
  54. package/types/canvas.ts +4 -2
  55. package/types/common.ts +19 -12
  56. package/types/data-calc-command.ts +2 -0
  57. package/types/data-calc.ts +1 -0
  58. package/types/data.ts +2 -0
  59. package/types/generators/AlarmClock.ts +17 -11
  60. package/types/generators/Assistant.ts +69 -18
  61. package/types/generators/BleCentral.ts +31 -11
  62. package/types/generators/BlePeripheral.ts +11 -7
  63. package/types/generators/CanvasMap.ts +10 -6
  64. package/types/generators/CastlesPay.ts +15 -7
  65. package/types/generators/DataBank.ts +44 -9
  66. package/types/generators/File.ts +109 -30
  67. package/types/generators/GraphQl.ts +12 -6
  68. package/types/generators/Http.ts +33 -10
  69. package/types/generators/HttpServer.ts +23 -15
  70. package/types/generators/Information.ts +9 -5
  71. package/types/generators/Intent.ts +15 -5
  72. package/types/generators/Iterator.ts +15 -11
  73. package/types/generators/Keyboard.ts +27 -13
  74. package/types/generators/LlmAnthropicCompat.ts +33 -11
  75. package/types/generators/LlmAppleBuiltin.ts +25 -10
  76. package/types/generators/LlmGgml.ts +140 -31
  77. package/types/generators/LlmMediaTekNeuroPilot.ts +235 -0
  78. package/types/generators/LlmMlx.ts +227 -0
  79. package/types/generators/LlmOnnx.ts +34 -14
  80. package/types/generators/LlmOpenAiCompat.ts +47 -11
  81. package/types/generators/LlmQualcommAiEngine.ts +45 -13
  82. package/types/generators/Mcp.ts +375 -34
  83. package/types/generators/McpServer.ts +58 -19
  84. package/types/generators/MediaFlow.ts +38 -12
  85. package/types/generators/MqttBroker.ts +29 -11
  86. package/types/generators/MqttClient.ts +19 -9
  87. package/types/generators/Question.ts +13 -9
  88. package/types/generators/RealtimeTranscription.ts +108 -19
  89. package/types/generators/RerankerGgml.ts +43 -12
  90. package/types/generators/SerialPort.ts +18 -10
  91. package/types/generators/SoundPlayer.ts +10 -4
  92. package/types/generators/SoundRecorder.ts +24 -9
  93. package/types/generators/SpeechToTextGgml.ts +52 -18
  94. package/types/generators/SpeechToTextOnnx.ts +18 -11
  95. package/types/generators/SpeechToTextPlatform.ts +15 -7
  96. package/types/generators/SqLite.ts +20 -10
  97. package/types/generators/Step.ts +9 -5
  98. package/types/generators/SttAppleBuiltin.ts +22 -9
  99. package/types/generators/Tcp.ts +13 -9
  100. package/types/generators/TcpServer.ts +20 -14
  101. package/types/generators/TextToSpeechAppleBuiltin.ts +21 -8
  102. package/types/generators/TextToSpeechGgml.ts +29 -11
  103. package/types/generators/TextToSpeechOnnx.ts +19 -12
  104. package/types/generators/TextToSpeechOpenAiLike.ts +14 -8
  105. package/types/generators/ThermalPrinter.ts +13 -9
  106. package/types/generators/Tick.ts +11 -7
  107. package/types/generators/Udp.ts +17 -8
  108. package/types/generators/VadGgml.ts +51 -14
  109. package/types/generators/VadOnnx.ts +42 -12
  110. package/types/generators/VadTraditional.ts +28 -13
  111. package/types/generators/VectorStore.ts +33 -12
  112. package/types/generators/Watchdog.ts +19 -10
  113. package/types/generators/WebCrawler.ts +11 -7
  114. package/types/generators/WebRtc.ts +30 -16
  115. package/types/generators/WebSocket.ts +11 -7
  116. package/types/generators/index.ts +2 -0
  117. package/types/subspace.ts +4 -0
  118. package/types/system.ts +1 -1
  119. package/utils/event-props.ts +833 -1022
  120. package/utils/id.ts +4 -0
  121. package/api/index.ts +0 -1
  122. package/api/instance.ts +0 -213
  123. package/types/generators/TextToSpeechApple.ts +0 -113
  124. package/types/generators/TtsAppleBuiltin.ts +0 -105
package/tools/deploy.ts CHANGED
@@ -4,29 +4,46 @@ 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
+ 'auto-version': autoVersion,
12
+ version: versionArg,
13
+ yes,
14
+ help,
15
+ },
8
16
  } = parseArgs({
9
17
  args: Bun.argv.slice(2),
10
18
  options: {
11
19
  changelogs: { type: 'string' },
12
20
  'changelogs-file': { type: 'string' },
21
+ 'auto-commit': { type: 'boolean' },
22
+ 'auto-version': { type: 'boolean' },
23
+ version: { type: 'string' },
13
24
  yes: { type: 'boolean', short: 'y' },
25
+ help: { type: 'boolean', short: 'h' },
14
26
  },
15
27
  allowPositionals: true,
16
28
  })
17
29
 
30
+ if (help) {
31
+ console.log(`Options:
32
+ --changelogs <text> Changelogs text for the release
33
+ --changelogs-file <path> Read changelogs from a file
34
+ --auto-commit Auto-commit unstaged changes before deploying
35
+ --auto-version Auto-bump patch version before deploying
36
+ --version <version> Set explicit version for the release
37
+ -y, --yes Skip all prompts
38
+ -h, --help Show this help message`)
39
+ process.exit(0)
40
+ }
41
+
18
42
  // Check git status
19
- const { exitCode } = await $`cd ${cwd} && git status`.nothrow()
43
+ const { exitCode } = await $`cd ${cwd} && git status`.quiet().nothrow()
20
44
  const isGitRepo = exitCode === 0
21
45
 
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) {
46
+ if (!isGitRepo && !yes) {
30
47
  const confirmContinue = prompt('No git repository found, continue? (y/n)')
31
48
  if (confirmContinue !== 'y') throw new Error('Deployment cancelled')
32
49
  }
@@ -35,9 +52,28 @@ if (isGitRepo) {
35
52
  const app = await Bun.file(`${cwd}/application.json`).json()
36
53
  const config = await Bun.file(`${cwd}/.bricks/build/application-config.json`).json()
37
54
 
38
- // Get version from project's package.json
55
+ // Resolve version: explicit flag > auto-bump > package.json
39
56
  const pkgFile = Bun.file(`${cwd}/package.json`)
40
- const version = (await pkgFile.exists()) ? (await pkgFile.json()).version : undefined
57
+ const pkgExists = await pkgFile.exists()
58
+ let version: string | undefined
59
+
60
+ if (versionArg) {
61
+ version = versionArg
62
+ if (pkgExists) {
63
+ const pkg = await pkgFile.json()
64
+ pkg.version = version
65
+ await Bun.write(`${cwd}/package.json`, JSON.stringify(pkg, null, 2) + '\n')
66
+ }
67
+ } else if (autoVersion && pkgExists) {
68
+ const pkg = await pkgFile.json()
69
+ const parts = (pkg.version || '0.0.0').split('.')
70
+ parts[2] = String(Number(parts[2] || 0) + 1)
71
+ version = parts.join('.')
72
+ pkg.version = version
73
+ await Bun.write(`${cwd}/package.json`, JSON.stringify(pkg, null, 2) + '\n')
74
+ } else {
75
+ version = pkgExists ? (await pkgFile.json()).version : undefined
76
+ }
41
77
 
42
78
  // Get changelog from flag or file
43
79
  let changelogs = ''
@@ -53,6 +89,24 @@ if (changelogsArg) {
53
89
  changelogs = prompt('Enter changelogs (optional, press Enter to skip):') || ''
54
90
  }
55
91
 
92
+ // Handle unstaged changes
93
+ let commitId = ''
94
+ if (isGitRepo) {
95
+ const unstagedChanges = await $`cd ${cwd} && git diff --name-only --diff-filter=ACMR`.text()
96
+ if (unstagedChanges) {
97
+ if (autoCommit) {
98
+ const commitMsg = `chore: release ${version || 'new version'}`
99
+ const commitBody = changelogs || '[no changelogs]'
100
+ await $`cd ${cwd} && git add -A && git commit -m ${commitMsg} -m ${commitBody}`
101
+ } else {
102
+ throw new Error(
103
+ 'Unstaged changes found, please commit or stash your changes before deploying',
104
+ )
105
+ }
106
+ }
107
+ commitId = (await $`cd ${cwd} && git rev-parse HEAD`.text()).trim()
108
+ }
109
+
56
110
  // Ask for confirmation
57
111
  if (!yes) {
58
112
  const confirm = prompt('Are you sure you want to deploy? (y/n)')