@typecad/cuttlefish 1.0.0-alpha.13 → 1.0.0-alpha.15

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 (343) hide show
  1. package/README.md +82 -79
  2. package/assets/editor-extensions/typecad-debug/README.md +141 -0
  3. package/assets/editor-extensions/typecad-debug/out/extension.js +347 -0
  4. package/assets/editor-extensions/typecad-debug/out/extension.js.map +1 -0
  5. package/assets/editor-extensions/typecad-debug/package.json +76 -0
  6. package/assets/editor-extensions/typecad-ui/LICENSE +27 -0
  7. package/assets/editor-extensions/typecad-ui/README.md +52 -0
  8. package/assets/editor-extensions/typecad-ui/file-icon-dark.png +0 -0
  9. package/assets/editor-extensions/typecad-ui/file-icon-light.png +0 -0
  10. package/assets/editor-extensions/typecad-ui/icon.png +0 -0
  11. package/assets/editor-extensions/typecad-ui/language-configuration.json +43 -0
  12. package/assets/editor-extensions/typecad-ui/package.json +54 -0
  13. package/assets/editor-extensions/typecad-ui/snippets/typecad-ui.json +80 -0
  14. package/assets/editor-extensions/typecad-ui/syntaxes/markdown-ui.json +45 -0
  15. package/assets/editor-extensions/typecad-ui/syntaxes/typecad-ui.tmLanguage.json +1269 -0
  16. package/dist/api/config.d.ts +30 -27
  17. package/dist/api/schema/types.d.ts +20 -3
  18. package/dist/api/shared/async-runtime-static.d.ts +1 -1
  19. package/dist/api/shared/async-runtime-static.js +5 -5
  20. package/dist/api/shared/async-types.d.ts +3 -2
  21. package/dist/api/shared/board-catalog.d.ts +2 -0
  22. package/dist/api/shared/board-catalog.js +6 -0
  23. package/dist/api/shared/board-resolver.d.ts +4 -7
  24. package/dist/api/shared/board-resolver.js +2 -1
  25. package/dist/api/shared/coop-scheduler.d.ts +1 -1
  26. package/dist/api/shared/coop-scheduler.js +1 -1
  27. package/dist/api/shared/cpp-type-ir.d.ts +1 -1
  28. package/dist/api/shared/cpp-type-ir.js +1 -1
  29. package/dist/api/shared/display-profile.d.ts +1 -1
  30. package/dist/api/shared/display-profile.js +3 -5
  31. package/dist/api/shared/framework-manifest-registry.d.ts +1 -1
  32. package/dist/api/shared/framework-manifest-registry.js +0 -1
  33. package/dist/api/shared/framework-manifest.d.ts +65 -507
  34. package/dist/api/shared/framework-manifest.js +6 -11
  35. package/dist/api/shared/hal-op-ir.d.ts +294 -685
  36. package/dist/api/shared/hal-op-ir.js +31 -65
  37. package/dist/api/shared/index.d.ts +0 -4
  38. package/dist/api/shared/index.js +1 -7
  39. package/dist/api/shared/ir-core.d.ts +6 -0
  40. package/dist/api/shared/ir-declarations.d.ts +4 -0
  41. package/dist/api/shared/ir.d.ts +1 -3
  42. package/dist/api/shared/platform-strategy.d.ts +14 -37
  43. package/dist/api/shared/polyfill-helper-registry.js +0 -5
  44. package/dist/api/shared/polyfill-types.js +0 -27
  45. package/dist/api/shared/promise-runtime.js +3 -3
  46. package/dist/api/shared/spdx-licenses.d.ts +12 -10
  47. package/dist/api/shared/spdx-licenses.js +1 -1
  48. package/dist/api/shared/toolchain-types.d.ts +1 -1
  49. package/dist/api/shared/toolchain-types.js +3 -3
  50. package/dist/api/shared/types.d.ts +0 -3
  51. package/dist/api/shared/validate-framework-manifest.js +13 -33
  52. package/dist/board-catalog/dts-reader.d.ts +220 -0
  53. package/dist/board-catalog/dts-reader.js +1052 -0
  54. package/dist/board-catalog/index.d.ts +11 -0
  55. package/dist/board-catalog/index.js +12 -0
  56. package/dist/board-catalog/pinconfig.d.ts +48 -0
  57. package/dist/board-catalog/pinconfig.js +263 -0
  58. package/dist/board-catalog/sdk.d.ts +82 -0
  59. package/dist/board-catalog/sdk.js +180 -0
  60. package/dist/board-catalog/store.d.ts +196 -0
  61. package/dist/board-catalog/store.js +363 -0
  62. package/dist/board-catalog/types.d.ts +233 -0
  63. package/dist/board-catalog/types.js +7 -0
  64. package/dist/board-catalog/walker.d.ts +112 -0
  65. package/dist/board-catalog/walker.js +1101 -0
  66. package/dist/cli-utils.d.ts +2 -2
  67. package/dist/cli-utils.js +5 -5
  68. package/dist/cli.js +227 -244
  69. package/dist/config-loader.d.ts +14 -19
  70. package/dist/config-loader.js +242 -78
  71. package/dist/config-schema.d.ts +19 -227
  72. package/dist/config-schema.js +9 -8
  73. package/dist/contract/board-generator.d.ts +4 -4
  74. package/dist/contract/board-generator.js +16 -5
  75. package/dist/contract/contract-parser.d.ts +36 -127
  76. package/dist/contract/contract-parser.js +76 -0
  77. package/dist/contract/index.d.ts +1 -1
  78. package/dist/contract/index.js +70 -21
  79. package/dist/create/active-board-catalog.d.ts +9 -0
  80. package/dist/create/active-board-catalog.js +94 -0
  81. package/dist/create/board-catalog.generated.d.ts +96 -0
  82. package/dist/create/board-catalog.generated.js +128737 -0
  83. package/dist/create/board-search.d.ts +23 -0
  84. package/dist/create/board-search.js +88 -0
  85. package/dist/create/editor-integration.d.ts +32 -0
  86. package/dist/create/editor-integration.js +257 -0
  87. package/dist/create/eslint-rules-template.d.ts +2 -2
  88. package/dist/create/framework-catalog.d.ts +48 -8
  89. package/dist/create/framework-catalog.js +58 -44
  90. package/dist/create/index.d.ts +8 -13
  91. package/dist/create/index.js +5 -9
  92. package/dist/create/mcu-target.d.ts +39 -0
  93. package/dist/create/mcu-target.js +80 -0
  94. package/dist/create/pack-targets.d.ts +19 -0
  95. package/dist/create/pack-targets.js +56 -0
  96. package/dist/create/{init-scaffold.d.ts → scaffold.d.ts} +8 -11
  97. package/dist/create/{init-scaffold.js → scaffold.js} +28 -87
  98. package/dist/create/templates.d.ts +51 -0
  99. package/dist/create/{init-templates.js → templates.js} +135 -116
  100. package/dist/create/wizard.d.ts +19 -0
  101. package/dist/create/wizard.js +314 -0
  102. package/dist/debug/preprocessor.d.ts +5 -0
  103. package/dist/debug/preprocessor.js +31 -7
  104. package/dist/diagnostics/diagnostics-report.d.ts +1 -1
  105. package/dist/diagnostics/diagnostics-report.js +3 -11
  106. package/dist/diagnostics/json-schema.d.ts +1 -1
  107. package/dist/diagnostics/md-writer.js +2 -2
  108. package/dist/diagnostics/mermaid-builder.d.ts +1 -1
  109. package/dist/diagnostics/mermaid-builder.js +1 -1
  110. package/dist/emit/cpp-emitter.js +4 -1
  111. package/dist/emit/emitters/class-emitter.js +32 -4
  112. package/dist/emit/emitters/emitter-context.d.ts +11 -0
  113. package/dist/emit/emitters/entrypoint-synthesizer.js +1 -1
  114. package/dist/emit/emitters/function-emitter-impl.js +33 -17
  115. package/dist/emit/emitters/output-finalizer.d.ts +7 -0
  116. package/dist/emit/emitters/output-finalizer.js +31 -23
  117. package/dist/emit/emitters/setup.js +147 -63
  118. package/dist/emit/emitters/top-level-prep.js +1 -1
  119. package/dist/emit/emitters/type-decl-emitter.js +13 -8
  120. package/dist/emit/emitters/ui-emitter.js +1 -1
  121. package/dist/emit/expression-renderer.d.ts +3 -3
  122. package/dist/emit/expression-renderer.js +17 -7
  123. package/dist/emit/route-hal-op.js +17 -48
  124. package/dist/emit/snprintf-helpers.d.ts +1 -3
  125. package/dist/emit/snprintf-helpers.js +1 -39
  126. package/dist/emit/statement-renderer.d.ts +0 -4
  127. package/dist/emit/statement-renderer.js +54 -45
  128. package/dist/emit/utils/async-state-machine.d.ts +16 -9
  129. package/dist/emit/utils/async-state-machine.js +56 -54
  130. package/dist/emit/utils/comment-helpers.d.ts +0 -8
  131. package/dist/emit/utils/comment-helpers.js +1 -1
  132. package/dist/emit/utils/cpp-helpers.d.ts +2 -2
  133. package/dist/emit/utils/cpp-helpers.js +2 -2
  134. package/dist/emit/utils/hal-op-cpp-type.js +4 -6
  135. package/dist/emit/utils/index.d.ts +3 -3
  136. package/dist/emit/utils/index.js +3 -3
  137. package/dist/emit/utils/type-inference.d.ts +1 -29
  138. package/dist/emit/utils/type-inference.js +0 -75
  139. package/dist/framework-package.d.ts +3 -0
  140. package/dist/framework-package.js +23 -6
  141. package/dist/framework-registry.d.ts +5 -5
  142. package/dist/frameworks/native/graphics/terminal-preview.d.ts +5 -0
  143. package/dist/frameworks/native/graphics/terminal-preview.js +33 -0
  144. package/dist/frameworks/native/index.d.ts +3 -0
  145. package/dist/frameworks/native/index.js +15 -0
  146. package/dist/frameworks/native/native-compile.d.ts +17 -0
  147. package/dist/frameworks/native/native-compile.js +170 -0
  148. package/dist/frameworks/native/native-config.d.ts +41 -0
  149. package/dist/frameworks/native/native-config.js +7 -0
  150. package/dist/frameworks/native/strategy.d.ts +97 -0
  151. package/dist/frameworks/native/strategy.js +664 -0
  152. package/dist/ir/board-resolver.d.ts +18 -23
  153. package/dist/ir/board-resolver.js +43 -401
  154. package/dist/ir/build-ir-state.d.ts +3 -0
  155. package/dist/ir/build-ir-state.js +42 -0
  156. package/dist/ir/build-ir.d.ts +1 -1
  157. package/dist/ir/build-ir.js +64 -45
  158. package/dist/ir/declaration-builders.js +1 -0
  159. package/dist/ir/expression-to-ir.js +17 -10
  160. package/dist/ir/hal/hal-emitter.d.ts +0 -2
  161. package/dist/ir/hal/hal-emitter.js +92 -41
  162. package/dist/ir/hal/hal-parser.d.ts +5 -5
  163. package/dist/ir/hal/hal-parser.js +128 -36
  164. package/dist/ir/hal/hal-plugins.d.ts +0 -1
  165. package/dist/ir/hal/hal-plugins.js +425 -716
  166. package/dist/ir/heap-analysis.js +2 -41
  167. package/dist/ir/identifier-collector.js +32 -20
  168. package/dist/ir/network-validation.js +7 -11
  169. package/dist/ir/ownership-analysis.js +75 -13
  170. package/dist/ir/peripheral-usage.d.ts +8 -2
  171. package/dist/ir/peripheral-usage.js +78 -149
  172. package/dist/ir/peripheral-validation.js +23 -3
  173. package/dist/ir/pin-capability-validation.d.ts +12 -0
  174. package/dist/ir/pin-capability-validation.js +61 -97
  175. package/dist/ir/pin-mode-validation.js +5 -5
  176. package/dist/ir/program-analysis.d.ts +8 -15
  177. package/dist/ir/program-analysis.js +140 -323
  178. package/dist/ir/pulldown-validation.js +11 -4
  179. package/dist/ir/resource-analysis.js +15 -3
  180. package/dist/ir/statement-to-ir.js +0 -6
  181. package/dist/ir/timing-validation.js +1 -1
  182. package/dist/ir/transformers/array-methods.js +11 -5
  183. package/dist/ir/transformers/call-statement.js +20 -87
  184. package/dist/ir/transformers/callback-context-registry.d.ts +1 -1
  185. package/dist/ir/transformers/callback-context-registry.js +8 -16
  186. package/dist/ir/transformers/control-flow.js +0 -13
  187. package/dist/ir/transformers/expressions.js +10 -9
  188. package/dist/ir/transformers/hal-call-resolver.d.ts +2 -2
  189. package/dist/ir/transformers/hal-call-resolver.js +24 -10
  190. package/dist/ir/transformers/hal-emit-helpers.d.ts +2 -2
  191. package/dist/ir/transformers/hal-emit-helpers.js +2 -2
  192. package/dist/ir/transformers/namespace-methods.js +1 -1
  193. package/dist/ir/transformers/ui-callback-lowering.d.ts +0 -2
  194. package/dist/ir/transformers/ui-callback-lowering.js +0 -24
  195. package/dist/ir/transformers/variables.js +338 -42
  196. package/dist/ir/try-catch-validation.js +4 -3
  197. package/dist/ir/type-resolution.js +15 -4
  198. package/dist/ir/validation-orchestrator.js +0 -9
  199. package/dist/libdef/cpp-to-decl.d.ts +0 -9
  200. package/dist/libdef/cpp-to-decl.js +0 -72
  201. package/dist/libdef/registry.d.ts +0 -1
  202. package/dist/libdef/registry.js +1 -24
  203. package/dist/library/catalog.d.ts +35 -0
  204. package/dist/library/catalog.js +67 -0
  205. package/dist/library/cli.d.ts +2 -0
  206. package/dist/library/cli.js +168 -0
  207. package/dist/library/init.d.ts +25 -0
  208. package/dist/library/init.js +397 -0
  209. package/dist/library/install.d.ts +9 -0
  210. package/dist/library/install.js +80 -0
  211. package/dist/library/registry-search.d.ts +34 -0
  212. package/dist/library/registry-search.js +50 -0
  213. package/dist/library/validate.d.ts +17 -0
  214. package/dist/library/validate.js +175 -0
  215. package/dist/library-packages.d.ts +95 -0
  216. package/dist/library-packages.js +275 -0
  217. package/dist/mapping/peripheral-names.js +9 -4
  218. package/dist/mapping/source-map.d.ts +3 -4
  219. package/dist/mapping/source-map.js +12 -18
  220. package/dist/orchestrator/graph-builder.d.ts +3 -3
  221. package/dist/orchestrator/graph-builder.js +29 -12
  222. package/dist/orchestrator/type-checker.d.ts +3 -3
  223. package/dist/orchestrator/type-checker.js +3 -3
  224. package/dist/platform/async-runtime.js +1 -1
  225. package/dist/platform/coop-scheduler-runtime.js +2 -2
  226. package/dist/platform/generic-debug-codegen.d.ts +36 -0
  227. package/dist/platform/generic-debug-codegen.js +185 -0
  228. package/dist/platform/generic-strategy.d.ts +3 -4
  229. package/dist/platform/generic-strategy.js +5 -80
  230. package/dist/platform/index.js +1 -1
  231. package/dist/platform/registry.d.ts +2 -2
  232. package/dist/platform/registry.js +2 -2
  233. package/dist/preview/client.js +17 -3
  234. package/dist/safety/asil-decorators.d.ts +32 -0
  235. package/dist/safety/asil-decorators.js +32 -0
  236. package/dist/safety/authoring.d.ts +85 -0
  237. package/dist/safety/authoring.js +61 -0
  238. package/dist/safety/engine.d.ts +3 -0
  239. package/dist/safety/engine.js +83 -0
  240. package/dist/safety/hal/ops.d.ts +48 -0
  241. package/dist/safety/hal/ops.js +46 -0
  242. package/dist/safety/iso26262/analyze.d.ts +13 -0
  243. package/dist/safety/iso26262/analyze.js +29 -0
  244. package/dist/safety/iso26262/asil.d.ts +10 -0
  245. package/dist/safety/iso26262/asil.js +22 -0
  246. package/dist/safety/iso26262/collect.d.ts +14 -0
  247. package/dist/safety/iso26262/collect.js +137 -0
  248. package/dist/safety/iso26262/goto-checker.d.ts +10 -0
  249. package/dist/safety/iso26262/goto-checker.js +72 -0
  250. package/dist/safety/iso26262/heap-checker.d.ts +7 -0
  251. package/dist/safety/iso26262/heap-checker.js +57 -0
  252. package/dist/safety/iso26262/init-checker.d.ts +13 -0
  253. package/dist/safety/iso26262/init-checker.js +127 -0
  254. package/dist/safety/iso26262/loop-checker.d.ts +7 -0
  255. package/dist/safety/iso26262/loop-checker.js +86 -0
  256. package/dist/safety/iso26262/recursion-checker.d.ts +9 -0
  257. package/dist/safety/iso26262/recursion-checker.js +134 -0
  258. package/dist/safety/iso26262/sidecar-writer.d.ts +25 -0
  259. package/dist/safety/iso26262/sidecar-writer.js +13 -0
  260. package/dist/safety/passes/pinMode-intercept.d.ts +3 -0
  261. package/dist/safety/passes/pinMode-intercept.js +60 -0
  262. package/dist/safety/runtime/mode-table.d.ts +5 -0
  263. package/dist/safety/runtime/mode-table.js +55 -0
  264. package/dist/safety/runtime/polyfills.d.ts +6 -0
  265. package/dist/safety/runtime/polyfills.js +12 -0
  266. package/dist/safety/runtime/result-struct.d.ts +11 -0
  267. package/dist/safety/runtime/result-struct.js +98 -0
  268. package/dist/safety/runtime/safe-int.d.ts +33 -0
  269. package/dist/safety/runtime/safe-int.js +170 -0
  270. package/dist/safety/runtime/safe-traits.d.ts +4 -0
  271. package/dist/safety/runtime/safe-traits.js +95 -0
  272. package/dist/safety/runtime/safe-variable.d.ts +39 -0
  273. package/dist/safety/runtime/safe-variable.js +226 -0
  274. package/dist/safety/runtime/vote.d.ts +8 -0
  275. package/dist/safety/runtime/vote.js +92 -0
  276. package/dist/safety/runtime/write-verify.d.ts +8 -0
  277. package/dist/safety/runtime/write-verify.js +71 -0
  278. package/dist/safety/safe-int-types.d.ts +45 -0
  279. package/dist/safety/safe-int-types.js +25 -0
  280. package/dist/safety/safe-variable-types.d.ts +29 -0
  281. package/dist/safety/safe-variable-types.js +19 -0
  282. package/dist/safety/safety-bridge.d.ts +5 -6
  283. package/dist/safety/safety-bridge.js +15 -28
  284. package/dist/safety/sidecar-bridge.d.ts +1 -3
  285. package/dist/safety/sidecar-bridge.js +3 -20
  286. package/dist/safety/specifiers.d.ts +6 -0
  287. package/dist/safety/specifiers.js +14 -0
  288. package/dist/safety-hook.d.ts +8 -7
  289. package/dist/safety-hook.js +12 -13
  290. package/dist/testing.d.ts +5 -6
  291. package/dist/testing.js +5 -5
  292. package/dist/transpile/resolution.d.ts +1 -1
  293. package/dist/transpile/resolution.js +18 -9
  294. package/dist/transpile/test-pins.d.ts +18 -0
  295. package/dist/transpile/test-pins.js +142 -0
  296. package/dist/transpile.d.ts +1 -2
  297. package/dist/transpile.js +90 -29
  298. package/dist/types.d.ts +45 -26
  299. package/dist/ui-hook.d.ts +1 -1
  300. package/dist/utils/cli.d.ts +2 -2
  301. package/dist/utils/cli.js +160 -157
  302. package/dist/utils/fs.d.ts +3 -4
  303. package/dist/utils/fs.js +4 -5
  304. package/dist/utils/strings.d.ts +0 -1
  305. package/dist/utils/strings.js +0 -8
  306. package/dist/utils/ui.d.ts +5 -2
  307. package/dist/utils/ui.js +13 -3
  308. package/package.json +158 -149
  309. package/dist/add-preset.d.ts +0 -4
  310. package/dist/add-preset.js +0 -74
  311. package/dist/api/shared/async-symbol-detector.d.ts +0 -11
  312. package/dist/api/shared/async-symbol-detector.js +0 -140
  313. package/dist/api/shared/native-display-op-resolver.d.ts +0 -10
  314. package/dist/api/shared/native-display-op-resolver.js +0 -64
  315. package/dist/create/board-checklist.d.ts +0 -2
  316. package/dist/create/board-checklist.js +0 -52
  317. package/dist/create/board-codegen.d.ts +0 -9
  318. package/dist/create/board-codegen.js +0 -238
  319. package/dist/create/board-generators.d.ts +0 -12
  320. package/dist/create/board-generators.js +0 -651
  321. package/dist/create/board-spec.d.ts +0 -637
  322. package/dist/create/board-spec.js +0 -214
  323. package/dist/create/init-templates.d.ts +0 -28
  324. package/dist/create/init-wizard.d.ts +0 -8
  325. package/dist/create/init-wizard.js +0 -182
  326. package/dist/install/framework-catalog.d.ts +0 -53
  327. package/dist/install/framework-catalog.js +0 -107
  328. package/dist/install/handle-install.d.ts +0 -35
  329. package/dist/install/handle-install.js +0 -177
  330. package/dist/install/index.d.ts +0 -4
  331. package/dist/install/index.js +0 -3
  332. package/dist/ir/pin-state-tracking.d.ts +0 -58
  333. package/dist/ir/pin-state-tracking.js +0 -182
  334. package/dist/ir/pwm-timer-sharing.d.ts +0 -4
  335. package/dist/ir/pwm-timer-sharing.js +0 -94
  336. package/dist/ir/timer0-pwm-timing-conflict.d.ts +0 -4
  337. package/dist/ir/timer0-pwm-timing-conflict.js +0 -72
  338. package/dist/libdef/component-decls.d.ts +0 -2
  339. package/dist/libdef/component-decls.js +0 -6
  340. package/dist/libdef/component-discovery.d.ts +0 -43
  341. package/dist/libdef/component-discovery.js +0 -83
  342. package/dist/theme-tokens.d.ts +0 -22
  343. package/dist/theme-tokens.js +0 -172
package/dist/utils/cli.js CHANGED
@@ -13,12 +13,20 @@ export function printHelp() {
13
13
  console.log(` cuttlefish create [name] [options]`);
14
14
  console.log(` cuttlefish build [options]`);
15
15
  console.log(` cuttlefish preview [--config <path>] [--port <port>]`);
16
- console.log(` cuttlefish gen-libdefs <input.ts>`);
17
- console.log(` cuttlefish board add <spec.jsonc> [--force] Generate board + MCU packages from a chip spec`);
18
16
  console.log(` cuttlefish gen-decls <input.cpp|--all <directory>>`);
19
- console.log(` cuttlefish map-error <mapFile> [options]`);
17
+ console.log(` cuttlefish board sync [zephyr-base] Rebuild the board catalog from your Zephyr tree (after west update)`);
18
+ console.log(` cuttlefish board regen Regenerate the project-local board module (.cuttlefish/board.ts + board.json)`);
20
19
  console.log(` cuttlefish doctor Check the active framework's environment (e.g. toolchain + board core)`);
21
- console.log(` cuttlefish licenses [--all] [--strict] Scan this project's Arduino libraries for SPDX licenses (--all: every installed library)`);
20
+ console.log(` cuttlefish licenses [--all] [--strict] Scan this project's libraries for SPDX licenses (--all: every installed library)`);
21
+ console.log();
22
+ console.log(chalk.cyan(`LIBRARY PACKAGES`) + chalk.gray(` (npm keywords are the catalog)`));
23
+ console.log();
24
+ console.log(` cuttlefish library search [text] [--category <id>] [--json]`);
25
+ console.log(` Browse cuttlefish library packages on npm, optionally by category`);
26
+ console.log(` cuttlefish library install <pkg...> Install library packages into this project`);
27
+ console.log(` cuttlefish library init [name] [--framework <id>] [--category <id>] [--targets <list>]`);
28
+ console.log(` Scaffold a new library package (interactive; --yes takes defaults)`);
29
+ console.log(` cuttlefish library validate [path] [--json] Validate a library package (manifest, shims, keywords, AUTOSAR strict)`);
22
30
  console.log();
23
31
  console.log(chalk.gray(`Transpilation is always performed first. Use --compile, --upload, and`));
24
32
  console.log(chalk.gray(`--monitor to chain operations after transpilation.`));
@@ -72,7 +80,7 @@ export function printHelp() {
72
80
  console.log();
73
81
  console.log(` --build-target <id> Framework-specific build target identifier.`);
74
82
  console.log(` Required by most frameworks for --compile and --upload.`);
75
- console.log(` Example: arduino:avr:uno, esp32:esp32:esp32dev, cmake:Debug`);
83
+ console.log(` Example: blackpill_f411ce/stm32f411xe, esp32s3_devkitc/esp32s3/procpu`);
76
84
  console.log();
77
85
  console.log(` --port <port> Serial port of the connected board.`);
78
86
  console.log(` Required for --upload and --monitor.`);
@@ -82,7 +90,7 @@ export function printHelp() {
82
90
  console.log();
83
91
  console.log(` --framework <pkg> Framework package for code generation strategy.`);
84
92
  console.log(` Overrides cuttlefish.config.ts framework setting.`);
85
- console.log(` Example: @typecad/framework-arduino, @typecad/framework-native`);
93
+ console.log(` Example: @typecad/framework-zephyr, @typecad/framework-native`);
86
94
  console.log();
87
95
  console.log(chalk.cyan(`BUILD COMMAND`));
88
96
  console.log();
@@ -129,17 +137,23 @@ export function printHelp() {
129
137
  console.log(chalk.cyan(`PROJECT CREATION`));
130
138
  console.log();
131
139
  console.log(` create [name] Create a new TypeCAD project`);
132
- console.log(` Interactive wizard if no --target flag.`);
140
+ console.log(` Interactive wizard (also with --board on a terminal;`);
141
+ console.log(` piped/CI runs are non-interactive).`);
133
142
  console.log();
134
- console.log(` --target, -t <id> Target platform (native, arduino-uno, esp32-devkit)`);
143
+ console.log(` --target, -t <id> Target platform (native, or any catalog board)`);
135
144
  console.log();
136
145
  console.log(` --board, -b <id> Alias for --target`);
137
146
  console.log();
138
- console.log(` --framework, -f <pkg> Framework (arduino, avr, native)`);
147
+ console.log(` --framework, -f <pkg> Framework (zephyr, native)`);
148
+ console.log();
149
+ console.log(` --probe, --flash <id> Probe/flash method (stlink, dfu, jlink, ...) —`);
150
+ console.log(` what uploads AND debugs the board`);
151
+ console.log();
152
+ console.log(` --port, -p <port> Serial port the board is on (COM10, /dev/ttyACM0)`);
139
153
  console.log();
140
- console.log(` --baud <rate> Serial baud rate (default: 9600)`);
154
+ console.log(` --baud <rate> Serial baud rate (default: 115200 on Zephyr, 9600 otherwise)`);
141
155
  console.log();
142
- console.log(` --no-sketch Skip generating starter sketch`);
156
+ console.log(` --no-starter Skip generating the starter program`);
143
157
  console.log();
144
158
  console.log(` --outDir, -o <path> Output directory (default: ./<name>)`);
145
159
  console.log();
@@ -151,8 +165,10 @@ export function printHelp() {
151
165
  console.log(chalk.gray(` # Native desktop project`));
152
166
  console.log(` cuttlefish create my-app --target native`);
153
167
  console.log();
154
- console.log(chalk.gray(` # Arduino Uno project`));
155
- console.log(` cuttlefish create my-project --target arduino-uno`);
168
+ console.log(chalk.gray(` # Zephyr board project`));
169
+ console.log(` cuttlefish create my-project --target blackpill-f411ce`);
170
+ console.log();
171
+ console.log(chalk.gray(` # Custom STM32F411 hardware — generated Zephyr board`));
156
172
  console.log();
157
173
  console.log(chalk.gray(` # Build using config entry point`));
158
174
  console.log(` cuttlefish build --compile --upload --port COM4`);
@@ -163,29 +179,23 @@ export function printHelp() {
163
179
  console.log(chalk.gray(` # Transpile to generic C++`));
164
180
  console.log(` cuttlefish src/main.ts`);
165
181
  console.log();
166
- console.log(chalk.gray(` # Transpile using Arduino framework`));
167
- console.log(` cuttlefish sketch.ts --framework @typecad/framework-arduino --outDir ./build`);
182
+ console.log(chalk.gray(` # Transpile using the Zephyr framework`));
183
+ console.log(` cuttlefish main.ts --framework @typecad/framework-zephyr --outDir ./build`);
168
184
  console.log();
169
- console.log(chalk.gray(` # Transpile and compile for Arduino Uno`));
170
- console.log(` cuttlefish sketch.ts --framework @typecad/framework-arduino --compile --build-target arduino:avr:uno`);
185
+ console.log(chalk.gray(` # Transpile and compile for the Black Pill`));
186
+ console.log(` cuttlefish main.ts --framework @typecad/framework-zephyr --compile --build-target blackpill_f411ce/stm32f411xe`);
171
187
  console.log();
172
188
  console.log(chalk.gray(` # Transpile, compile, and upload`));
173
- console.log(` cuttlefish sketch.ts --framework @typecad/framework-arduino --compile --upload --build-target arduino:avr:uno --port COM4`);
189
+ console.log(` cuttlefish main.ts --framework @typecad/framework-zephyr --compile --upload --build-target blackpill_f411ce/stm32f411xe --port COM4`);
174
190
  console.log();
175
191
  console.log(chalk.gray(` # Full chain: transpile → compile → upload → monitor`));
176
- console.log(` cuttlefish sketch.ts --framework @typecad/framework-arduino --compile --upload --monitor --build-target arduino:avr:uno --port COM4 --baud 115200`);
192
+ console.log(` cuttlefish main.ts --framework @typecad/framework-zephyr --compile --upload --monitor --build-target blackpill_f411ce/stm32f411xe --port COM4 --baud 115200`);
177
193
  console.log();
178
194
  console.log(chalk.gray(` # Watch mode: auto-retranspile on changes`));
179
- console.log(` cuttlefish sketch.ts --watch`);
180
- console.log();
181
- console.log(chalk.gray(` # Watch and auto-compile for Arduino`));
182
- console.log(` cuttlefish sketch.ts --framework @typecad/framework-arduino --watch --compile --build-target arduino:avr:uno`);
195
+ console.log(` cuttlefish main.ts --watch`);
183
196
  console.log();
184
- console.log(chalk.gray(` # Generate library definitions from imports`));
185
- console.log(` cuttlefish gen-libdefs src/sensor.ts`);
186
- console.log();
187
- console.log(chalk.gray(` # Map a C++ error to TypeScript source`));
188
- console.log(` cuttlefish map-error .build/sketch.cpp.map --line 42 --column 5 --message "undefined reference"`);
197
+ console.log(chalk.gray(` # Watch and auto-compile`));
198
+ console.log(` cuttlefish main.ts --framework @typecad/framework-zephyr --watch --compile --build-target blackpill_f411ce/stm32f411xe`);
189
199
  console.log();
190
200
  }
191
201
  function readFlag(argv, flag) {
@@ -231,10 +241,11 @@ function parsePipelineCommand(argv, command, inputFile) {
231
241
  const emitMapsFlag = readFirstFlagValue(argv, ["--emit-maps"]);
232
242
  const buildTarget = readFirstFlagValue(argv, ["--build-target"]);
233
243
  const port = readFirstFlagValue(argv, ["--port"]);
234
- // Default to undefined (NOT 9600) so the build/upload/monitor flow's
235
- // `options.baud ?? config.console.baudRate` falls through to the configured
236
- // baud. Hardcoding 9600 here shadowed config.console.baudRate whenever --baud
237
- // was absent (the monitor then opened the port at 9600, ignoring the config).
244
+ const probeFlag = readFirstFlagValue(argv, ["--probe", "--flash"]);
245
+ // Default to undefined (NOT a hardcoded baud) so the build/upload/monitor
246
+ // flow falls through to the framework's monitor default when --baud is
247
+ // absent. Hardcoding 9600 here forced the monitor to open the port at 9600
248
+ // and ignore --baud given elsewhere.
238
249
  const baud = readNumberFlag(argv, ["--baud"]);
239
250
  const frameworkFlag = readFirstFlagValue(argv, ["--framework"]);
240
251
  const compile = readBooleanFlag(argv, ["--compile"]);
@@ -298,8 +309,8 @@ function parsePipelineCommand(argv, command, inputFile) {
298
309
  throw new Error("--upload requires --compile.");
299
310
  }
300
311
  // Note: port validation is deferred to the build path, which checks the
301
- // effective port (CLI --port flag OR config.console.port). This allows
302
- // setting the port in cuttlefish.config.ts instead of on every command.
312
+ // effective port (CLI --port flag OR the CUTTLEFISH_PORT env var). This
313
+ // allows setting the port in the environment instead of on every command.
303
314
  if (watch && monitor) {
304
315
  throw new Error("--watch and --monitor cannot be used together (monitor blocks the process).");
305
316
  }
@@ -325,6 +336,7 @@ function parsePipelineCommand(argv, command, inputFile) {
325
336
  monitor,
326
337
  watch,
327
338
  port,
339
+ probe: probeFlag,
328
340
  baud,
329
341
  platformContext,
330
342
  treeShaking,
@@ -354,26 +366,24 @@ export function parseCommandLine(argv) {
354
366
  const framework = readFirstFlagValue(argv, ["--framework", "-f"]);
355
367
  const baudRaw = readFirstFlagValue(argv, ["--baud"]);
356
368
  const outDir = readFirstFlagValue(argv, ["--outDir", "--out-dir", "-o"]);
357
- const noSketch = argv.includes("--no-sketch");
369
+ const noStarter = argv.includes("--no-starter");
358
370
  const noInstall = argv.includes("--no-install");
371
+ const probeFlag = readFirstFlagValue(argv, ["--probe", "--flash"]);
372
+ const portFlag = readFirstFlagValue(argv, ["--port", "-p"]);
359
373
  const baud = baudRaw && !Number.isNaN(Number(baudRaw)) ? Number(baudRaw) : undefined;
360
374
  return {
361
375
  command: "create",
376
+ probe: probeFlag,
362
377
  projectName,
363
378
  target,
364
379
  baud,
365
380
  framework,
366
- noSketch,
381
+ noStarter,
367
382
  noInstall,
383
+ port: portFlag,
368
384
  outDir: outDir ? path.resolve(process.cwd(), outDir) : undefined,
369
385
  };
370
386
  }
371
- if (firstArg === "create-board") {
372
- throw new Error(`The 'create-board' command has been removed. Board scaffolding is now in @typecad/create.`);
373
- }
374
- if (firstArg === "init") {
375
- throw new Error(`Use 'cuttlefish create' instead of 'cuttlefish init'.`);
376
- }
377
387
  // build subcommand — entry point comes from cuttlefish.config.ts
378
388
  if (firstArg === "build") {
379
389
  return parsePipelineCommand(argv, "build");
@@ -441,9 +451,85 @@ export function parseCommandLine(argv) {
441
451
  platformContext: {},
442
452
  };
443
453
  }
444
- // Named subcommands
445
- if (firstArg === "gen-libdefs" || firstArg === "gen-decls" || firstArg === "map-error") {
446
- const command = firstArg;
454
+ // board subcommand — project-local board module management
455
+ // (sync: rebuild the board catalog overlay from the user's Zephyr tree
456
+ // the refresh path after `west update`; regen: re-emit
457
+ // .cuttlefish/board.ts + board.json from the active catalog).
458
+ if (firstArg === "board") {
459
+ const sub = argv[3];
460
+ if (sub === "sync") {
461
+ // Optional positional: an explicit Zephyr checkout to sync from.
462
+ const positional = argv.slice(4).find((a) => !a.startsWith("-"));
463
+ return { command: "board", subcommand: "sync", zephyrBase: positional };
464
+ }
465
+ if (sub !== "regen") {
466
+ throw new Error("Usage: cuttlefish board <sync|regen> — 'sync' rebuilds the board catalog from your " +
467
+ "Zephyr tree, 'regen' regenerates .cuttlefish/board.ts + board.json for the config's " +
468
+ "board target.");
469
+ }
470
+ return { command: "board", subcommand: "regen" };
471
+ }
472
+ // library subcommand — the cuttlefish library package manager
473
+ // (search/install/init/validate; npm keywords are the catalog).
474
+ if (firstArg === "library") {
475
+ const sub = argv[3];
476
+ const known = new Set(["search", "install", "init", "validate"]);
477
+ if (!sub || !known.has(sub)) {
478
+ throw new Error("Usage: cuttlefish library <search|install|init|validate> [args]. " +
479
+ "Try 'cuttlefish library search' to browse, or 'cuttlefish library init <name>'.");
480
+ }
481
+ const subcommand = sub;
482
+ // Value flags accept both forms (--category led and --category=led); the
483
+ // generic readFlag helper only handles the space-separated form, which
484
+ // would silently drop an equals-form filter.
485
+ const valueFlags = new Set(["--category", "--framework", "--targets", "--dir"]);
486
+ const flagValues = new Map();
487
+ const positionals = [];
488
+ let jsonFlag = false;
489
+ let yesFlag = false;
490
+ for (let i = 4; i < argv.length; i++) {
491
+ const tok = argv[i];
492
+ if (tok.startsWith("--") && tok.includes("=")) {
493
+ const eq = tok.indexOf("=");
494
+ flagValues.set(tok.slice(0, eq), tok.slice(eq + 1));
495
+ continue;
496
+ }
497
+ if (valueFlags.has(tok)) {
498
+ if (i + 1 < argv.length) {
499
+ flagValues.set(tok, argv[++i]);
500
+ }
501
+ continue;
502
+ }
503
+ if (tok === "--json") {
504
+ jsonFlag = true;
505
+ continue;
506
+ }
507
+ if (tok === "--yes" || tok === "-y") {
508
+ yesFlag = true;
509
+ continue;
510
+ }
511
+ if (tok.startsWith("-"))
512
+ continue;
513
+ positionals.push(tok);
514
+ }
515
+ const category = flagValues.get("--category");
516
+ if (category !== undefined && subcommand !== "search" && subcommand !== "init") {
517
+ throw new Error("--category applies to 'library search' and 'library init' only.");
518
+ }
519
+ return {
520
+ command: "library",
521
+ subcommand,
522
+ positionals,
523
+ category,
524
+ framework: flagValues.get("--framework"),
525
+ targets: flagValues.get("--targets"),
526
+ dir: flagValues.get("--dir"),
527
+ yes: yesFlag,
528
+ json: jsonFlag,
529
+ };
530
+ }
531
+ // gen-decls subcommand — generate .d.ts from C++ files
532
+ if (firstArg === "gen-decls") {
447
533
  const emitFlag = readFirstFlagValue(argv, ["--emit"]);
448
534
  const targetFlag = readFirstFlagValue(argv, ["--target"]);
449
535
  const outDir = readFirstFlagValue(argv, ["--outDir", "--out-dir"]);
@@ -456,124 +542,40 @@ export function parseCommandLine(argv) {
456
542
  architecture: buildTarget?.split(":")?.[1]?.toLowerCase(),
457
543
  frameworkData: { buildTarget },
458
544
  };
459
- if (command === "map-error") {
460
- const mapFile = argv[3];
461
- if (!mapFile) {
462
- throw new Error("Missing source map path for map-error.");
463
- }
464
- const cppLineRaw = readFirstFlagValue(argv, ["--line", "--cpp-line"]);
465
- if (!cppLineRaw || Number.isNaN(Number(cppLineRaw))) {
466
- throw new Error("map-error requires --line <number>.");
467
- }
468
- const cppColumnRaw = readFirstFlagValue(argv, ["--column", "--cpp-column"]);
469
- const cppFile = readFirstFlagValue(argv, ["--cpp-file"]);
470
- const message = readFirstFlagValue(argv, ["--message"]);
471
- return {
472
- command,
473
- emitMode,
474
- target,
475
- outDir: outDir ? path.resolve(process.cwd(), outDir) : undefined,
476
- emitMaps,
477
- noTranspile: false,
478
- compile: false,
479
- upload: false,
480
- monitor: false,
481
- watch: false,
482
- baud: 9600,
483
- platformContext,
484
- mapFile: path.resolve(process.cwd(), mapFile),
485
- cppFile: cppFile ? path.resolve(process.cwd(), cppFile) : undefined,
486
- cppLine: Number(cppLineRaw),
487
- cppColumn: cppColumnRaw ? Number(cppColumnRaw) : 1,
488
- message,
489
- };
490
- }
491
- // gen-decls - generate .d.ts from C++ files
492
- if (command === "gen-decls") {
493
- const allFlag = argv.includes("--all");
494
- const componentsFlag = argv.includes("--components");
495
- if (allFlag && componentsFlag) {
496
- throw new Error("gen-decls: --components and --all are mutually exclusive. Use one or the other.");
497
- }
498
- // The positional path may sit at argv[3] or argv[4] depending on whether
499
- // --all precedes or follows it. Scan argv starting after the subcommand
500
- // name (argv[2]) for the first token that is not a flag and not a known
501
- // flag's value. This mirrors the default-pipeline approach of "first
502
- // non-flag token wins".
503
- const booleanFlags = new Set(["--all", "--components"]);
504
- const valueFlags = new Set([
505
- "--emit", "--target", "--outDir", "--out-dir", "--emit-maps", "--build-target",
506
- ]);
507
- let inputPath;
508
- for (let i = 3; i < argv.length; i++) {
509
- const tok = argv[i];
510
- if (valueFlags.has(tok)) {
511
- // Value-consuming flag: skip its value (if any) so it isn't mistaken
512
- // for the positional path.
513
- if (i + 1 < argv.length) {
514
- i++;
515
- }
516
- continue;
517
- }
518
- if (tok.startsWith("-")) {
519
- continue; // boolean flag (e.g. --all) or unknown flag — ignore
545
+ const allFlag = argv.includes("--all");
546
+ // The positional path may sit at argv[3] or argv[4] depending on whether
547
+ // --all precedes or follows it. Scan argv starting after the subcommand
548
+ // name (argv[2]) for the first token that is not a flag and not a known
549
+ // flag's value. This mirrors the default-pipeline approach of "first
550
+ // non-flag token wins".
551
+ const valueFlags = new Set([
552
+ "--emit", "--target", "--outDir", "--out-dir", "--emit-maps", "--build-target",
553
+ ]);
554
+ let inputPath;
555
+ for (let i = 3; i < argv.length; i++) {
556
+ const tok = argv[i];
557
+ if (valueFlags.has(tok)) {
558
+ // Value-consuming flag: skip its value (if any) so it isn't mistaken
559
+ // for the positional path.
560
+ if (i + 1 < argv.length) {
561
+ i++;
520
562
  }
521
- inputPath = tok;
522
- break;
523
- }
524
- // --components mode: scan managed_components/ + components/ declared in
525
- // cuttlefish.config.ts. Falls back to cwd when no path is given.
526
- if (componentsFlag) {
527
- const componentsDir = inputPath || process.cwd();
528
- return {
529
- command: "gen-decls",
530
- inputFile: undefined,
531
- emitMode,
532
- target,
533
- outDir: outDir ? path.resolve(process.cwd(), outDir) : undefined,
534
- emitMaps,
535
- noTranspile: false,
536
- compile: false,
537
- upload: false,
538
- monitor: false,
539
- watch: false,
540
- baud: 9600,
541
- platformContext,
542
- scanDir: undefined,
543
- componentsDir: path.resolve(process.cwd(), componentsDir),
544
- };
563
+ continue;
545
564
  }
546
- if (!inputPath && !allFlag) {
547
- throw new Error("Missing input C++ file path. Use: gen-decls <file.cpp> or gen-decls --all <directory>");
565
+ if (tok.startsWith("-")) {
566
+ continue; // boolean flag (e.g. --all) or unknown flag ignore
548
567
  }
549
- const scanDir = allFlag ? (inputPath || process.cwd()) : undefined;
550
- const inputFile = allFlag ? undefined : inputPath;
551
- return {
552
- command: "gen-decls",
553
- inputFile: inputFile ? path.resolve(process.cwd(), inputFile) : undefined,
554
- emitMode,
555
- target,
556
- outDir: outDir ? path.resolve(process.cwd(), outDir) : undefined,
557
- emitMaps,
558
- noTranspile: false,
559
- compile: false,
560
- upload: false,
561
- monitor: false,
562
- watch: false,
563
- baud: 9600,
564
- platformContext,
565
- // Custom fields for gen-decls
566
- scanDir: scanDir ? path.resolve(process.cwd(), scanDir) : undefined,
567
- };
568
+ inputPath = tok;
569
+ break;
568
570
  }
569
- // gen-libdefs
570
- const inputFile = argv[3];
571
- if (!inputFile) {
572
- throw new Error("Missing input TypeScript file path.");
571
+ if (!inputPath && !allFlag) {
572
+ throw new Error("Missing input C++ file path. Use: gen-decls <file.cpp> or gen-decls --all <directory>");
573
573
  }
574
+ const scanDir = allFlag ? (inputPath || process.cwd()) : undefined;
575
+ const inputFile = allFlag ? undefined : inputPath;
574
576
  return {
575
- command,
576
- inputFile: path.resolve(process.cwd(), inputFile),
577
+ command: "gen-decls",
578
+ inputFile: inputFile ? path.resolve(process.cwd(), inputFile) : undefined,
577
579
  emitMode,
578
580
  target,
579
581
  outDir: outDir ? path.resolve(process.cwd(), outDir) : undefined,
@@ -585,6 +587,7 @@ export function parseCommandLine(argv) {
585
587
  watch: false,
586
588
  baud: 9600,
587
589
  platformContext,
590
+ scanDir: scanDir ? path.resolve(process.cwd(), scanDir) : undefined,
588
591
  };
589
592
  }
590
593
  // Default: firstArg is the input file (unless it's a flag like --expect)
@@ -8,10 +8,9 @@ export declare function listFiles(dirPath: string, extension: string): string[];
8
8
  * Recursive variant of {@link listFiles}. Walks `dirPath` depth-first and
9
9
  * returns every file (in every subdirectory) whose name ends with `extension`.
10
10
  *
11
- * Used by {@link loadLibraryDefinitions} so libdefs under nested cache dirs
12
- * like `.cuttlefish/component-decls/<component>/` are discovered. Purely
13
- * additive vs. the non-recursive `listFiles` single-level layouts keep
14
- * working, nested layouts now also work.
11
+ * Used by {@link loadLibraryDefinitions} so libdefs in project subdirectories
12
+ * are discovered. Purely additive vs. the non-recursive `listFiles` —
13
+ * single-level layouts keep working, nested layouts now also work.
15
14
  *
16
15
  * Returns absolute paths. Unreadable directories are silently skipped
17
16
  * (matches `listFiles`'s not-exist behavior for non-existent roots).
package/dist/utils/fs.js CHANGED
@@ -25,7 +25,7 @@ export function writeText(filePath, content) {
25
25
  ensureDir(path.dirname(filePath));
26
26
  const resolved = path.resolve(filePath);
27
27
  // Skip writing when content is identical — preserves mtime so downstream
28
- // build tools (idf.py/ninja, arduino-cli, make) can skip recompilation.
28
+ // build tools (west/ninja, make) can skip recompilation.
29
29
  // The file still counts as "written this run" (it is current output).
30
30
  writtenFiles.add(resolved);
31
31
  try {
@@ -50,10 +50,9 @@ export function listFiles(dirPath, extension) {
50
50
  * Recursive variant of {@link listFiles}. Walks `dirPath` depth-first and
51
51
  * returns every file (in every subdirectory) whose name ends with `extension`.
52
52
  *
53
- * Used by {@link loadLibraryDefinitions} so libdefs under nested cache dirs
54
- * like `.cuttlefish/component-decls/<component>/` are discovered. Purely
55
- * additive vs. the non-recursive `listFiles` single-level layouts keep
56
- * working, nested layouts now also work.
53
+ * Used by {@link loadLibraryDefinitions} so libdefs in project subdirectories
54
+ * are discovered. Purely additive vs. the non-recursive `listFiles` —
55
+ * single-level layouts keep working, nested layouts now also work.
57
56
  *
58
57
  * Returns absolute paths. Unreadable directories are silently skipped
59
58
  * (matches `listFiles`'s not-exist behavior for non-existent roots).
@@ -32,4 +32,3 @@ export declare function escapeCppStringLiteral(value: string): string;
32
32
  * format argument to snprintf(...) — NOT for snprintf *arguments* or for
33
33
  * standalone C++ string literals, where a bare `%` is harmless. */
34
34
  export declare function escapeSnprintfFormatFragment(value: string): string;
35
- export declare function normalizeKebabName(name: string): string;
@@ -132,11 +132,3 @@ export function escapeCppStringLiteral(value) {
132
132
  export function escapeSnprintfFormatFragment(value) {
133
133
  return escapeCppStringLiteral(value).replace(/%/g, "%%");
134
134
  }
135
- export function normalizeKebabName(name) {
136
- return name
137
- .toLowerCase()
138
- .replace(/[\s_]+/g, '-')
139
- .replace(/[^a-z0-9-]/g, '')
140
- .replace(/-+/g, '-')
141
- .replace(/^-|-$/g, '');
142
- }
@@ -1,3 +1,5 @@
1
+ declare const VERSION: string;
2
+ export { VERSION };
1
3
  /**
2
4
  * Print the Cuttlefish branded header
3
5
  */
@@ -33,9 +35,10 @@ export declare function printCompiling(target: string): void;
33
35
  */
34
36
  export declare function printDebugStrategy(framework: string): void;
35
37
  /**
36
- * Print uploading step
38
+ * Print uploading step. Probe/USB flashing carries no serial port — the
39
+ * destination is omitted rather than printed as "undefined".
37
40
  */
38
- export declare function printUploading(port: string): void;
41
+ export declare function printUploading(port?: string): void;
39
42
  /**
40
43
  * Print monitoring step
41
44
  */
package/dist/utils/ui.js CHANGED
@@ -1,5 +1,13 @@
1
1
  import chalk from "chalk";
2
- const VERSION = "0.1.0";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ // Real package version (dist/utils/ui.js → ../../package.json). Previously
6
+ // hardcoded "0.1.0", which drifted from the published version and misled
7
+ // bug reports into blaming a stale global install.
8
+ const pkgPath = path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "..", "package.json");
9
+ const VERSION = JSON.parse(fs.readFileSync(pkgPath, "utf8")).version ?? "unknown";
10
+ export { VERSION };
3
11
  // Icons
4
12
  const ICON_CUTTLEFISH = "⤳";
5
13
  const ICON_COMPILE = "⇉";
@@ -77,10 +85,12 @@ export function printDebugStrategy(framework) {
77
85
  console.log(chalk.cyan(`${ICON_COMPILE} Preparing to debug using `) + chalk.white(framework));
78
86
  }
79
87
  /**
80
- * Print uploading step
88
+ * Print uploading step. Probe/USB flashing carries no serial port — the
89
+ * destination is omitted rather than printed as "undefined".
81
90
  */
82
91
  export function printUploading(port) {
83
- console.log(chalk.cyan(`${ICON_UPLOAD} Uploading to `) + chalk.white(port));
92
+ const destination = port ? chalk.cyan(" to ") + chalk.white(port) : "";
93
+ console.log(chalk.cyan(`${ICON_UPLOAD} Uploading`) + destination);
84
94
  }
85
95
  /**
86
96
  * Print monitoring step