@typecad/cuttlefish 0.1.0-alpha.1

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 (377) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +79 -0
  3. package/dist/api/board-types.d.ts +1 -0
  4. package/dist/api/board-types.js +4 -0
  5. package/dist/api/capabilities.d.ts +12 -0
  6. package/dist/api/capabilities.js +1 -0
  7. package/dist/api/config.d.ts +120 -0
  8. package/dist/api/config.js +7 -0
  9. package/dist/api/index.d.ts +5 -0
  10. package/dist/api/index.js +2 -0
  11. package/dist/api/schema/builder.d.ts +14 -0
  12. package/dist/api/schema/builder.js +15 -0
  13. package/dist/api/schema/index.d.ts +2 -0
  14. package/dist/api/schema/index.js +1 -0
  15. package/dist/api/schema/types.d.ts +257 -0
  16. package/dist/api/schema/types.js +4 -0
  17. package/dist/api/shared/async-runtime-static.d.ts +8 -0
  18. package/dist/api/shared/async-runtime-static.js +201 -0
  19. package/dist/api/shared/async-types.d.ts +42 -0
  20. package/dist/api/shared/async-types.js +8 -0
  21. package/dist/api/shared/board-resolver.d.ts +12 -0
  22. package/dist/api/shared/board-resolver.js +7 -0
  23. package/dist/api/shared/cpp-type-ir.d.ts +229 -0
  24. package/dist/api/shared/cpp-type-ir.js +672 -0
  25. package/dist/api/shared/display-adapter.d.ts +12 -0
  26. package/dist/api/shared/display-adapter.js +145 -0
  27. package/dist/api/shared/display-adapters/eink-mono.d.ts +2 -0
  28. package/dist/api/shared/display-adapters/eink-mono.js +53 -0
  29. package/dist/api/shared/display-adapters/sdl.d.ts +2 -0
  30. package/dist/api/shared/display-adapters/sdl.js +452 -0
  31. package/dist/api/shared/display-adapters/ssd1309.d.ts +2 -0
  32. package/dist/api/shared/display-adapters/ssd1309.js +136 -0
  33. package/dist/api/shared/display-adapters/st7796.d.ts +2 -0
  34. package/dist/api/shared/display-adapters/st7796.js +132 -0
  35. package/dist/api/shared/display-capabilities.d.ts +45 -0
  36. package/dist/api/shared/display-capabilities.js +54 -0
  37. package/dist/api/shared/display-op-ir.d.ts +62 -0
  38. package/dist/api/shared/display-op-ir.js +19 -0
  39. package/dist/api/shared/display-profile.d.ts +265 -0
  40. package/dist/api/shared/display-profile.js +338 -0
  41. package/dist/api/shared/graphics-strategy.d.ts +29 -0
  42. package/dist/api/shared/graphics-strategy.js +11 -0
  43. package/dist/api/shared/hal-op-ir.d.ts +393 -0
  44. package/dist/api/shared/hal-op-ir.js +18 -0
  45. package/dist/api/shared/index.d.ts +26 -0
  46. package/dist/api/shared/index.js +21 -0
  47. package/dist/api/shared/ir-core.d.ts +363 -0
  48. package/dist/api/shared/ir-core.js +8 -0
  49. package/dist/api/shared/ir-declarations.d.ts +201 -0
  50. package/dist/api/shared/ir-declarations.js +26 -0
  51. package/dist/api/shared/ir.d.ts +85 -0
  52. package/dist/api/shared/ir.js +13 -0
  53. package/dist/api/shared/platform-strategy.d.ts +402 -0
  54. package/dist/api/shared/platform-strategy.js +14 -0
  55. package/dist/api/shared/polyfill-helper-registry.d.ts +11 -0
  56. package/dist/api/shared/polyfill-helper-registry.js +86 -0
  57. package/dist/api/shared/polyfill-types.d.ts +33 -0
  58. package/dist/api/shared/polyfill-types.js +76 -0
  59. package/dist/api/shared/promise-runtime.d.ts +10 -0
  60. package/dist/api/shared/promise-runtime.js +244 -0
  61. package/dist/api/shared/snprintf-types.d.ts +29 -0
  62. package/dist/api/shared/snprintf-types.js +8 -0
  63. package/dist/api/shared/string-method-registry.d.ts +53 -0
  64. package/dist/api/shared/string-method-registry.js +168 -0
  65. package/dist/api/shared/toolchain-types.d.ts +63 -0
  66. package/dist/api/shared/toolchain-types.js +71 -0
  67. package/dist/api/shared/types.d.ts +50 -0
  68. package/dist/api/shared/types.js +6 -0
  69. package/dist/ast/parse.d.ts +2 -0
  70. package/dist/ast/parse.js +4 -0
  71. package/dist/cache.d.ts +26 -0
  72. package/dist/cache.js +95 -0
  73. package/dist/cli-utils.d.ts +37 -0
  74. package/dist/cli-utils.js +250 -0
  75. package/dist/cli.d.ts +2 -0
  76. package/dist/cli.js +635 -0
  77. package/dist/config-loader.d.ts +78 -0
  78. package/dist/config-loader.js +508 -0
  79. package/dist/config-schema.d.ts +233 -0
  80. package/dist/config-schema.js +83 -0
  81. package/dist/create/board-checklist.d.ts +2 -0
  82. package/dist/create/board-checklist.js +52 -0
  83. package/dist/create/board-codegen.d.ts +9 -0
  84. package/dist/create/board-codegen.js +238 -0
  85. package/dist/create/board-generators.d.ts +12 -0
  86. package/dist/create/board-generators.js +652 -0
  87. package/dist/create/board-spec.d.ts +640 -0
  88. package/dist/create/board-spec.js +215 -0
  89. package/dist/create/eslint-rules-template.d.ts +2 -0
  90. package/dist/create/eslint-rules-template.js +672 -0
  91. package/dist/create/index.d.ts +11 -0
  92. package/dist/create/index.js +8 -0
  93. package/dist/create/init-scaffold.d.ts +27 -0
  94. package/dist/create/init-scaffold.js +150 -0
  95. package/dist/create/init-templates.d.ts +24 -0
  96. package/dist/create/init-templates.js +379 -0
  97. package/dist/create/init-wizard.d.ts +8 -0
  98. package/dist/create/init-wizard.js +168 -0
  99. package/dist/debug/breakpoint-loader.d.ts +24 -0
  100. package/dist/debug/breakpoint-loader.js +137 -0
  101. package/dist/debug/index.d.ts +3 -0
  102. package/dist/debug/index.js +7 -0
  103. package/dist/debug/preprocessor.d.ts +9 -0
  104. package/dist/debug/preprocessor.js +214 -0
  105. package/dist/debug/types.d.ts +32 -0
  106. package/dist/debug/types.js +6 -0
  107. package/dist/diagnostics/diagnostics-report.d.ts +51 -0
  108. package/dist/diagnostics/diagnostics-report.js +333 -0
  109. package/dist/diagnostics/json-schema.d.ts +138 -0
  110. package/dist/diagnostics/json-schema.js +27 -0
  111. package/dist/diagnostics/md-writer.d.ts +10 -0
  112. package/dist/diagnostics/md-writer.js +336 -0
  113. package/dist/diagnostics/mermaid-builder.d.ts +65 -0
  114. package/dist/diagnostics/mermaid-builder.js +681 -0
  115. package/dist/emit/cpp-emitter.d.ts +6 -0
  116. package/dist/emit/cpp-emitter.js +48 -0
  117. package/dist/emit/emitters/class-emitter.d.ts +2 -0
  118. package/dist/emit/emitters/class-emitter.js +523 -0
  119. package/dist/emit/emitters/emitter-context.d.ts +174 -0
  120. package/dist/emit/emitters/emitter-context.js +1 -0
  121. package/dist/emit/emitters/entrypoint-synthesizer.d.ts +2 -0
  122. package/dist/emit/emitters/entrypoint-synthesizer.js +175 -0
  123. package/dist/emit/emitters/function-emitter-impl.d.ts +19 -0
  124. package/dist/emit/emitters/function-emitter-impl.js +428 -0
  125. package/dist/emit/emitters/line-appender.d.ts +15 -0
  126. package/dist/emit/emitters/line-appender.js +344 -0
  127. package/dist/emit/emitters/namespace-emitter.d.ts +2 -0
  128. package/dist/emit/emitters/namespace-emitter.js +324 -0
  129. package/dist/emit/emitters/output-finalizer.d.ts +4 -0
  130. package/dist/emit/emitters/output-finalizer.js +267 -0
  131. package/dist/emit/emitters/setup.d.ts +3 -0
  132. package/dist/emit/emitters/setup.js +851 -0
  133. package/dist/emit/emitters/top-level-prep.d.ts +2 -0
  134. package/dist/emit/emitters/top-level-prep.js +706 -0
  135. package/dist/emit/emitters/type-decl-emitter.d.ts +2 -0
  136. package/dist/emit/emitters/type-decl-emitter.js +251 -0
  137. package/dist/emit/emitters/ui-emitter.d.ts +21 -0
  138. package/dist/emit/emitters/ui-emitter.js +564 -0
  139. package/dist/emit/enum-emitter.d.ts +1 -0
  140. package/dist/emit/enum-emitter.js +1 -0
  141. package/dist/emit/expression-renderer.d.ts +283 -0
  142. package/dist/emit/expression-renderer.js +1477 -0
  143. package/dist/emit/native-helpers-emitter.d.ts +11 -0
  144. package/dist/emit/native-helpers-emitter.js +34 -0
  145. package/dist/emit/route-hal-op.d.ts +5 -0
  146. package/dist/emit/route-hal-op.js +13 -0
  147. package/dist/emit/snprintf-helpers.d.ts +17 -0
  148. package/dist/emit/snprintf-helpers.js +462 -0
  149. package/dist/emit/statement-renderer.d.ts +189 -0
  150. package/dist/emit/statement-renderer.js +948 -0
  151. package/dist/emit/utils/async-state-machine.d.ts +42 -0
  152. package/dist/emit/utils/async-state-machine.js +343 -0
  153. package/dist/emit/utils/comment-helpers.d.ts +20 -0
  154. package/dist/emit/utils/comment-helpers.js +31 -0
  155. package/dist/emit/utils/cpp-helpers.d.ts +47 -0
  156. package/dist/emit/utils/cpp-helpers.js +85 -0
  157. package/dist/emit/utils/include-resolver.d.ts +58 -0
  158. package/dist/emit/utils/include-resolver.js +155 -0
  159. package/dist/emit/utils/index.d.ts +8 -0
  160. package/dist/emit/utils/index.js +12 -0
  161. package/dist/emit/utils/type-inference.d.ts +159 -0
  162. package/dist/emit/utils/type-inference.js +559 -0
  163. package/dist/eslint-check.d.ts +10 -0
  164. package/dist/eslint-check.js +102 -0
  165. package/dist/framework-package.d.ts +10 -0
  166. package/dist/framework-package.js +58 -0
  167. package/dist/framework-registry.d.ts +39 -0
  168. package/dist/framework-registry.js +30 -0
  169. package/dist/incremental-cache.d.ts +116 -0
  170. package/dist/incremental-cache.js +335 -0
  171. package/dist/ir/adc-range-validation.d.ts +11 -0
  172. package/dist/ir/adc-range-validation.js +250 -0
  173. package/dist/ir/ast-node-utils.d.ts +8 -0
  174. package/dist/ir/ast-node-utils.js +32 -0
  175. package/dist/ir/board-pin-utils.d.ts +13 -0
  176. package/dist/ir/board-pin-utils.js +65 -0
  177. package/dist/ir/board-resolver.d.ts +36 -0
  178. package/dist/ir/board-resolver.js +437 -0
  179. package/dist/ir/build-ir-state.d.ts +167 -0
  180. package/dist/ir/build-ir-state.js +306 -0
  181. package/dist/ir/build-ir.d.ts +2 -0
  182. package/dist/ir/build-ir.js +808 -0
  183. package/dist/ir/call-graph.d.ts +35 -0
  184. package/dist/ir/call-graph.js +194 -0
  185. package/dist/ir/compile-time-only.d.ts +2 -0
  186. package/dist/ir/compile-time-only.js +16 -0
  187. package/dist/ir/declaration-builders.d.ts +9 -0
  188. package/dist/ir/declaration-builders.js +608 -0
  189. package/dist/ir/entry-points.d.ts +30 -0
  190. package/dist/ir/entry-points.js +191 -0
  191. package/dist/ir/expression-to-ir.d.ts +5 -0
  192. package/dist/ir/expression-to-ir.js +2249 -0
  193. package/dist/ir/extract-property-chain.d.ts +10 -0
  194. package/dist/ir/extract-property-chain.js +30 -0
  195. package/dist/ir/feature-prescan.d.ts +3 -0
  196. package/dist/ir/feature-prescan.js +43 -0
  197. package/dist/ir/feature-registry.d.ts +30 -0
  198. package/dist/ir/feature-registry.js +816 -0
  199. package/dist/ir/filter.d.ts +7 -0
  200. package/dist/ir/filter.js +85 -0
  201. package/dist/ir/function-builder.d.ts +19 -0
  202. package/dist/ir/function-builder.js +670 -0
  203. package/dist/ir/hal/hal-emitter.d.ts +62 -0
  204. package/dist/ir/hal/hal-emitter.js +735 -0
  205. package/dist/ir/hal/hal-parser.d.ts +61 -0
  206. package/dist/ir/hal/hal-parser.js +473 -0
  207. package/dist/ir/hal/hal-plugins.d.ts +34 -0
  208. package/dist/ir/hal/hal-plugins.js +706 -0
  209. package/dist/ir/hal-resolver.d.ts +5 -0
  210. package/dist/ir/hal-resolver.js +5 -0
  211. package/dist/ir/heap-analysis.d.ts +8 -0
  212. package/dist/ir/heap-analysis.js +350 -0
  213. package/dist/ir/heap-array-validation.d.ts +24 -0
  214. package/dist/ir/heap-array-validation.js +29 -0
  215. package/dist/ir/identifier-collector.d.ts +18 -0
  216. package/dist/ir/identifier-collector.js +439 -0
  217. package/dist/ir/interrupt-analysis.d.ts +39 -0
  218. package/dist/ir/interrupt-analysis.js +467 -0
  219. package/dist/ir/memory-budget-validation.d.ts +10 -0
  220. package/dist/ir/memory-budget-validation.js +86 -0
  221. package/dist/ir/namespace-builder.d.ts +7 -0
  222. package/dist/ir/namespace-builder.js +152 -0
  223. package/dist/ir/ownership-analysis.d.ts +9 -0
  224. package/dist/ir/ownership-analysis.js +1207 -0
  225. package/dist/ir/peripheral-ownership.d.ts +3 -0
  226. package/dist/ir/peripheral-ownership.js +152 -0
  227. package/dist/ir/peripheral-symbols.d.ts +7 -0
  228. package/dist/ir/peripheral-symbols.js +57 -0
  229. package/dist/ir/peripheral-usage.d.ts +54 -0
  230. package/dist/ir/peripheral-usage.js +691 -0
  231. package/dist/ir/peripheral-validation.d.ts +8 -0
  232. package/dist/ir/peripheral-validation.js +77 -0
  233. package/dist/ir/pin-alias-conflict.d.ts +4 -0
  234. package/dist/ir/pin-alias-conflict.js +34 -0
  235. package/dist/ir/pin-capability-validation.d.ts +6 -0
  236. package/dist/ir/pin-capability-validation.js +413 -0
  237. package/dist/ir/pin-mode-validation.d.ts +10 -0
  238. package/dist/ir/pin-mode-validation.js +301 -0
  239. package/dist/ir/pin-safety.d.ts +11 -0
  240. package/dist/ir/pin-safety.js +58 -0
  241. package/dist/ir/program-analysis.d.ts +44 -0
  242. package/dist/ir/program-analysis.js +589 -0
  243. package/dist/ir/pulldown-validation.d.ts +7 -0
  244. package/dist/ir/pulldown-validation.js +49 -0
  245. package/dist/ir/pwm-timer-sharing.d.ts +4 -0
  246. package/dist/ir/pwm-timer-sharing.js +93 -0
  247. package/dist/ir/reachability.d.ts +68 -0
  248. package/dist/ir/reachability.js +224 -0
  249. package/dist/ir/register-decorators.d.ts +6 -0
  250. package/dist/ir/register-decorators.js +49 -0
  251. package/dist/ir/render-expr.d.ts +4 -0
  252. package/dist/ir/render-expr.js +127 -0
  253. package/dist/ir/resource-analysis.d.ts +19 -0
  254. package/dist/ir/resource-analysis.js +153 -0
  255. package/dist/ir/statement-to-ir.d.ts +23 -0
  256. package/dist/ir/statement-to-ir.js +349 -0
  257. package/dist/ir/symbol-table.d.ts +68 -0
  258. package/dist/ir/symbol-table.js +179 -0
  259. package/dist/ir/symbol-types.d.ts +56 -0
  260. package/dist/ir/symbol-types.js +107 -0
  261. package/dist/ir/timer0-pwm-timing-conflict.d.ts +4 -0
  262. package/dist/ir/timer0-pwm-timing-conflict.js +71 -0
  263. package/dist/ir/timing-validation.d.ts +7 -0
  264. package/dist/ir/timing-validation.js +95 -0
  265. package/dist/ir/transformers/array-methods.d.ts +8 -0
  266. package/dist/ir/transformers/array-methods.js +493 -0
  267. package/dist/ir/transformers/call-statement.d.ts +5 -0
  268. package/dist/ir/transformers/call-statement.js +758 -0
  269. package/dist/ir/transformers/callback-context-registry.d.ts +20 -0
  270. package/dist/ir/transformers/callback-context-registry.js +55 -0
  271. package/dist/ir/transformers/canvas-lowering.d.ts +42 -0
  272. package/dist/ir/transformers/canvas-lowering.js +249 -0
  273. package/dist/ir/transformers/control-flow.d.ts +8 -0
  274. package/dist/ir/transformers/control-flow.js +508 -0
  275. package/dist/ir/transformers/expressions.d.ts +7 -0
  276. package/dist/ir/transformers/expressions.js +406 -0
  277. package/dist/ir/transformers/hal-call-resolver.d.ts +29 -0
  278. package/dist/ir/transformers/hal-call-resolver.js +274 -0
  279. package/dist/ir/transformers/hal-emit-helpers.d.ts +14 -0
  280. package/dist/ir/transformers/hal-emit-helpers.js +63 -0
  281. package/dist/ir/transformers/namespace-methods.d.ts +20 -0
  282. package/dist/ir/transformers/namespace-methods.js +110 -0
  283. package/dist/ir/transformers/register-assignment.d.ts +5 -0
  284. package/dist/ir/transformers/register-assignment.js +56 -0
  285. package/dist/ir/transformers/ui-call-resolver.d.ts +149 -0
  286. package/dist/ir/transformers/ui-call-resolver.js +1136 -0
  287. package/dist/ir/transformers/ui-callback-lowering.d.ts +62 -0
  288. package/dist/ir/transformers/ui-callback-lowering.js +623 -0
  289. package/dist/ir/transformers/ui-mount.d.ts +20 -0
  290. package/dist/ir/transformers/ui-mount.js +35 -0
  291. package/dist/ir/transformers/ui-reactive.d.ts +68 -0
  292. package/dist/ir/transformers/ui-reactive.js +129 -0
  293. package/dist/ir/transformers/variables.d.ts +14 -0
  294. package/dist/ir/transformers/variables.js +1045 -0
  295. package/dist/ir/try-catch-validation.d.ts +26 -0
  296. package/dist/ir/try-catch-validation.js +128 -0
  297. package/dist/ir/type-resolution.d.ts +31 -0
  298. package/dist/ir/type-resolution.js +977 -0
  299. package/dist/ir/ui-element-auto-wire.d.ts +50 -0
  300. package/dist/ir/ui-element-auto-wire.js +218 -0
  301. package/dist/ir/unit-suspicion-validation.d.ts +12 -0
  302. package/dist/ir/unit-suspicion-validation.js +296 -0
  303. package/dist/ir/utils/walk-ir.d.ts +6 -0
  304. package/dist/ir/utils/walk-ir.js +162 -0
  305. package/dist/ir/validation-orchestrator.d.ts +4 -0
  306. package/dist/ir/validation-orchestrator.js +45 -0
  307. package/dist/libdef/base-class-resolver.d.ts +23 -0
  308. package/dist/libdef/base-class-resolver.js +50 -0
  309. package/dist/libdef/cpp-to-decl.d.ts +34 -0
  310. package/dist/libdef/cpp-to-decl.js +584 -0
  311. package/dist/libdef/header-parser.d.ts +53 -0
  312. package/dist/libdef/header-parser.js +269 -0
  313. package/dist/libdef/registry.d.ts +10 -0
  314. package/dist/libdef/registry.js +142 -0
  315. package/dist/mapping/peripheral-names.d.ts +23 -0
  316. package/dist/mapping/peripheral-names.js +63 -0
  317. package/dist/mapping/source-map.d.ts +46 -0
  318. package/dist/mapping/source-map.js +207 -0
  319. package/dist/orchestrator/dts-generator.d.ts +17 -0
  320. package/dist/orchestrator/dts-generator.js +83 -0
  321. package/dist/orchestrator/graph-builder.d.ts +18 -0
  322. package/dist/orchestrator/graph-builder.js +218 -0
  323. package/dist/orchestrator/semantic-facts-verifier.d.ts +38 -0
  324. package/dist/orchestrator/semantic-facts-verifier.js +121 -0
  325. package/dist/orchestrator/semantic-facts.d.ts +141 -0
  326. package/dist/orchestrator/semantic-facts.js +652 -0
  327. package/dist/orchestrator/type-checker.d.ts +39 -0
  328. package/dist/orchestrator/type-checker.js +760 -0
  329. package/dist/platform/async-runtime.d.ts +8 -0
  330. package/dist/platform/async-runtime.js +26 -0
  331. package/dist/platform/generic-strategy.d.ts +101 -0
  332. package/dist/platform/generic-strategy.js +289 -0
  333. package/dist/platform/index.d.ts +4 -0
  334. package/dist/platform/index.js +9 -0
  335. package/dist/platform/registry.d.ts +21 -0
  336. package/dist/platform/registry.js +42 -0
  337. package/dist/platform/toolchain.d.ts +4 -0
  338. package/dist/platform/toolchain.js +43 -0
  339. package/dist/preview/client.d.ts +1 -0
  340. package/dist/preview/client.js +137 -0
  341. package/dist/preview/server.d.ts +5 -0
  342. package/dist/preview/server.js +199 -0
  343. package/dist/profiler/index.d.ts +28 -0
  344. package/dist/profiler/index.js +28 -0
  345. package/dist/profiler/profiler.d.ts +95 -0
  346. package/dist/profiler/profiler.js +338 -0
  347. package/dist/profiler/types.d.ts +87 -0
  348. package/dist/profiler/types.js +12 -0
  349. package/dist/stores/display-profile-store.d.ts +16 -0
  350. package/dist/stores/display-profile-store.js +48 -0
  351. package/dist/stores/theme-store.d.ts +13 -0
  352. package/dist/stores/theme-store.js +30 -0
  353. package/dist/testing.d.ts +45 -0
  354. package/dist/testing.js +47 -0
  355. package/dist/transpile/resolution.d.ts +29 -0
  356. package/dist/transpile/resolution.js +282 -0
  357. package/dist/transpile.d.ts +3 -0
  358. package/dist/transpile.js +722 -0
  359. package/dist/types.d.ts +217 -0
  360. package/dist/types.js +1 -0
  361. package/dist/ui/ui-bridge.d.ts +4 -0
  362. package/dist/ui/ui-bridge.js +34 -0
  363. package/dist/ui-hook.d.ts +84 -0
  364. package/dist/ui-hook.js +45 -0
  365. package/dist/utils/cli.d.ts +3 -0
  366. package/dist/utils/cli.js +463 -0
  367. package/dist/utils/fs.d.ts +4 -0
  368. package/dist/utils/fs.js +23 -0
  369. package/dist/utils/logger.d.ts +2 -0
  370. package/dist/utils/logger.js +8 -0
  371. package/dist/utils/strings.d.ts +35 -0
  372. package/dist/utils/strings.js +142 -0
  373. package/dist/utils/ui.d.ts +66 -0
  374. package/dist/utils/ui.js +149 -0
  375. package/dist/watch.d.ts +35 -0
  376. package/dist/watch.js +111 -0
  377. package/package.json +127 -0
@@ -0,0 +1,463 @@
1
+ import path from "node:path";
2
+ import chalk from "chalk";
3
+ const VERSION = "0.1.0";
4
+ const ICON_CUTTLEFISH = "⤳";
5
+ export function printHelp() {
6
+ console.log();
7
+ console.log(chalk.cyan(`${ICON_CUTTLEFISH} Cuttlefish`) + chalk.gray(` v${VERSION}`));
8
+ console.log(chalk.gray(` TypeScript to C++ transpiler`));
9
+ console.log();
10
+ console.log(chalk.cyan(`USAGE`));
11
+ console.log();
12
+ console.log(` cuttlefish <input.ts> [options]`);
13
+ console.log(` cuttlefish create [name] [options]`);
14
+ console.log(` cuttlefish build [options]`);
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
+ console.log(` cuttlefish gen-decls <input.cpp|--all <directory>>`);
19
+ console.log(` cuttlefish map-error <mapFile> [options]`);
20
+ console.log();
21
+ console.log(chalk.gray(`Transpilation is always performed first. Use --compile, --upload, and`));
22
+ console.log(chalk.gray(`--monitor to chain operations after transpilation.`));
23
+ console.log();
24
+ console.log(chalk.cyan(`OPTIONS`));
25
+ console.log();
26
+ console.log(` --emit <mode> Emit mode: "cpp" or "split" (default: split)`);
27
+ console.log(` - cpp: single output file`);
28
+ console.log(` - split: separate .cpp and .h files`);
29
+ console.log(` Note: Output file extension is determined by the framework strategy`);
30
+ console.log();
31
+ console.log(` --target <platform> Target platform string (default: generic).`);
32
+ console.log(` The loaded framework package registers its own target id.`);
33
+ console.log();
34
+ console.log(` --outDir, --out-dir <path>`);
35
+ console.log(` Output directory for generated files (default: input file directory)`);
36
+ console.log();
37
+ console.log(` --emit-maps <bool> Emit source maps: "true" or "false" (default: true)`);
38
+ console.log(` Source maps enable mapping C++ errors back to TypeScript`);
39
+ console.log();
40
+ console.log(chalk.cyan(`BUILD COMMANDS`) + chalk.gray(` (chain in order: --compile → --upload → --monitor)`));
41
+ console.log();
42
+ console.log(` --compile Compile the generated output using the framework toolchain.`);
43
+ console.log(` Requires a build target (e.g. via --build-target or config).`);
44
+ console.log();
45
+ console.log(` --upload Upload the compiled firmware to the board.`);
46
+ console.log(` Requires: --compile, --port (if applicable to framework).`);
47
+ console.log();
48
+ console.log(` --monitor Open an interactive serial monitor after upload.`);
49
+ console.log(` Requires: --port (if applicable to framework).`);
50
+ console.log();
51
+ console.log(chalk.cyan(`TESTING`));
52
+ console.log();
53
+ console.log(` --expect [file] Run hardware tests via @typecad/expect.`);
54
+ console.log(` Optionally specify a test file to run a single test.`);
55
+ console.log(` Discovers test files and validates via serial.`);
56
+ console.log();
57
+ console.log(` --build-target <id> Framework-specific build target identifier.`);
58
+ console.log(` Required by most frameworks for --compile and --upload.`);
59
+ console.log(` Example: arduino:avr:uno, esp32:esp32:esp32dev, cmake:Debug`);
60
+ console.log();
61
+ console.log(` --port <port> Serial port of the connected board.`);
62
+ console.log(` Required for --upload and --monitor.`);
63
+ console.log(` Example: COM4, /dev/ttyACM0`);
64
+ console.log();
65
+ console.log(` --baud <rate> Baud rate for --monitor (default: 9600)`);
66
+ console.log();
67
+ console.log(` --framework <pkg> Framework package for code generation strategy.`);
68
+ console.log(` Overrides cuttlefish.config.ts framework setting.`);
69
+ console.log(` Example: @typecad/framework-arduino, @typecad/framework-native`);
70
+ console.log();
71
+ console.log(chalk.cyan(`BUILD COMMAND`));
72
+ console.log();
73
+ console.log(` build Build using entry point from cuttlefish.config.ts`);
74
+ console.log(` Requires 'entry' field in config file.`);
75
+ console.log(` Supports all transpile, compile, upload, and watch options.`);
76
+ console.log();
77
+ console.log(` preview Start a browser preview for the configured UI display.`);
78
+ console.log(` Uses cuttlefish.config.ts by default.`);
79
+ console.log();
80
+ console.log(chalk.cyan(`WATCH MODE`));
81
+ console.log();
82
+ console.log(` --watch, -w Watch for file changes and retranspile automatically.`);
83
+ console.log(` Monitors the entry file and all imports for changes.`);
84
+ console.log(` Works with --compile and --upload.`);
85
+ console.log(` Incompatible with --monitor.`);
86
+ console.log();
87
+ console.log(chalk.cyan(`TREE-SHAKING OPTIONS`));
88
+ console.log();
89
+ console.log(` --no-tree-shake Disable tree-shaking (dead code elimination)`);
90
+ console.log();
91
+ console.log(` --keep-unused-enums Keep all enums even if not referenced`);
92
+ console.log();
93
+ console.log(` --keep-unused-classes Keep all classes even if not instantiated`);
94
+ console.log();
95
+ console.log(` --keep-unused-types Keep all type aliases even if not used`);
96
+ console.log();
97
+ console.log(` --keep-unused-variables Keep all top-level variables even if not referenced`);
98
+ console.log();
99
+ console.log(` --entry-point <name> Add a custom entry point symbol (repeatable)`);
100
+ console.log(` Default entry points determined by the framework strategy.`);
101
+ console.log();
102
+ console.log(` --diagnostics Generate diagnostics.md and diagnostics.json reports`);
103
+ console.log(` Includes IR graph, heap analysis, and task analysis`);
104
+ console.log();
105
+ console.log(` --help, -h Show this help message`);
106
+ console.log();
107
+ console.log(chalk.cyan(`PROJECT CREATION`));
108
+ console.log();
109
+ console.log(` create [name] Create a new TypeCAD project`);
110
+ console.log(` Interactive wizard if no --target flag.`);
111
+ console.log();
112
+ console.log(` --target, -t <id> Target platform (native, arduino-uno, esp32-devkit)`);
113
+ console.log();
114
+ console.log(` --board, -b <id> Alias for --target`);
115
+ console.log();
116
+ console.log(` --framework, -f <pkg> Framework (arduino, avr, native)`);
117
+ console.log();
118
+ console.log(` --baud <rate> Serial baud rate (default: 9600)`);
119
+ console.log();
120
+ console.log(` --no-sketch Skip generating starter sketch`);
121
+ console.log();
122
+ console.log(` --outDir, -o <path> Output directory (default: ./<name>)`);
123
+ console.log();
124
+ console.log(chalk.cyan(`EXAMPLES`));
125
+ console.log();
126
+ console.log(chalk.gray(` # Interactive project setup`));
127
+ console.log(` cuttlefish create`);
128
+ console.log();
129
+ console.log(chalk.gray(` # Native desktop project`));
130
+ console.log(` cuttlefish create my-app --target native`);
131
+ console.log();
132
+ console.log(chalk.gray(` # Arduino Uno project`));
133
+ console.log(` cuttlefish create my-project --target arduino-uno`);
134
+ console.log();
135
+ console.log(chalk.gray(` # Build using config entry point`));
136
+ console.log(` cuttlefish build --compile --upload --port COM4`);
137
+ console.log();
138
+ console.log(chalk.gray(` # Build in watch mode`));
139
+ console.log(` cuttlefish build --watch`);
140
+ console.log();
141
+ console.log(chalk.gray(` # Transpile to generic C++`));
142
+ console.log(` cuttlefish src/main.ts`);
143
+ console.log();
144
+ console.log(chalk.gray(` # Transpile using Arduino framework`));
145
+ console.log(` cuttlefish sketch.ts --framework @typecad/framework-arduino --outDir ./build`);
146
+ console.log();
147
+ console.log(chalk.gray(` # Transpile and compile for Arduino Uno`));
148
+ console.log(` cuttlefish sketch.ts --framework @typecad/framework-arduino --compile --build-target arduino:avr:uno`);
149
+ console.log();
150
+ console.log(chalk.gray(` # Transpile, compile, and upload`));
151
+ console.log(` cuttlefish sketch.ts --framework @typecad/framework-arduino --compile --upload --build-target arduino:avr:uno --port COM4`);
152
+ console.log();
153
+ console.log(chalk.gray(` # Full chain: transpile → compile → upload → monitor`));
154
+ console.log(` cuttlefish sketch.ts --framework @typecad/framework-arduino --compile --upload --monitor --build-target arduino:avr:uno --port COM4 --baud 115200`);
155
+ console.log();
156
+ console.log(chalk.gray(` # Watch mode: auto-retranspile on changes`));
157
+ console.log(` cuttlefish sketch.ts --watch`);
158
+ console.log();
159
+ console.log(chalk.gray(` # Watch and auto-compile for Arduino`));
160
+ console.log(` cuttlefish sketch.ts --framework @typecad/framework-arduino --watch --compile --build-target arduino:avr:uno`);
161
+ console.log();
162
+ console.log(chalk.gray(` # Generate library definitions from imports`));
163
+ console.log(` cuttlefish gen-libdefs src/sensor.ts`);
164
+ console.log();
165
+ console.log(chalk.gray(` # Map a C++ error to TypeScript source`));
166
+ console.log(` cuttlefish map-error .build/sketch.cpp.map --line 42 --column 5 --message "undefined reference"`);
167
+ console.log();
168
+ }
169
+ function readFlag(argv, flag) {
170
+ const index = argv.indexOf(flag);
171
+ if (index === -1 || index === argv.length - 1) {
172
+ return undefined;
173
+ }
174
+ return argv[index + 1];
175
+ }
176
+ function readFirstFlagValue(argv, flags) {
177
+ for (const flag of flags) {
178
+ const value = readFlag(argv, flag);
179
+ if (value !== undefined) {
180
+ return value;
181
+ }
182
+ }
183
+ return undefined;
184
+ }
185
+ function readBooleanFlag(argv, flags) {
186
+ return flags.some(flag => argv.includes(flag));
187
+ }
188
+ function readNumberFlag(argv, flags, defaultValue) {
189
+ const rawValue = readFirstFlagValue(argv, flags);
190
+ if (rawValue === undefined) {
191
+ return defaultValue;
192
+ }
193
+ const parsed = Number(rawValue);
194
+ return Number.isNaN(parsed) ? defaultValue : parsed;
195
+ }
196
+ function readRepeatedFlag(argv, flag) {
197
+ const values = [];
198
+ for (let i = 0; i < argv.length; i++) {
199
+ if (argv[i] === flag && i + 1 < argv.length && !argv[i + 1].startsWith("-")) {
200
+ values.push(argv[i + 1]);
201
+ }
202
+ }
203
+ return values;
204
+ }
205
+ function parsePipelineCommand(argv, command, inputFile) {
206
+ const emitFlag = readFirstFlagValue(argv, ["--emit"]);
207
+ const targetFlag = readFirstFlagValue(argv, ["--target"]);
208
+ const outDir = readFirstFlagValue(argv, ["--outDir", "--out-dir"]);
209
+ const emitMapsFlag = readFirstFlagValue(argv, ["--emit-maps"]);
210
+ const buildTarget = readFirstFlagValue(argv, ["--build-target"]);
211
+ const port = readFirstFlagValue(argv, ["--port"]);
212
+ const baud = readNumberFlag(argv, ["--baud"], 9600) ?? 9600;
213
+ const frameworkFlag = readFirstFlagValue(argv, ["--framework"]);
214
+ const compile = readBooleanFlag(argv, ["--compile"]);
215
+ const upload = readBooleanFlag(argv, ["--upload"]);
216
+ const monitor = readBooleanFlag(argv, ["--monitor"]);
217
+ const watch = readBooleanFlag(argv, ["--watch"]) || argv.includes("-w");
218
+ const debug = readBooleanFlag(argv, ["--debug"]);
219
+ const noTranspile = readBooleanFlag(argv, ["--no-transpile"]);
220
+ const force = readBooleanFlag(argv, ["--force"]);
221
+ const skipTypeCheck = readBooleanFlag(argv, ["--skip-type-check"]);
222
+ const diagnostics = readBooleanFlag(argv, ["--diagnostics"]);
223
+ const expect = readBooleanFlag(argv, ["--expect"]);
224
+ const expectArg = readFlag(argv, "--expect");
225
+ const expectFile = expect && expectArg && !expectArg.startsWith("-") ? expectArg : undefined;
226
+ const noTreeShake = readBooleanFlag(argv, ["--no-tree-shake"]);
227
+ const keepUnusedEnums = readBooleanFlag(argv, ["--keep-unused-enums"]);
228
+ const keepUnusedClasses = readBooleanFlag(argv, ["--keep-unused-classes"]);
229
+ const keepUnusedTypes = readBooleanFlag(argv, ["--keep-unused-types"]);
230
+ const keepUnusedVariables = readBooleanFlag(argv, ["--keep-unused-variables"]);
231
+ const entryPoints = readRepeatedFlag(argv, "--entry-point");
232
+ const emitMode = emitFlag === "cpp" || emitFlag === "split" ? emitFlag : "split";
233
+ const emitMaps = emitMapsFlag === undefined ? true : emitMapsFlag !== "false";
234
+ // Accept any target string — the framework package registers its own strategy id.
235
+ // Fall back to "generic" (GenericStrategy) when not specified.
236
+ const target = targetFlag ?? "generic";
237
+ const platformContext = {
238
+ architecture: buildTarget?.split(":")?.[1]?.toLowerCase(),
239
+ frameworkData: { buildTarget },
240
+ };
241
+ if (upload && !compile) {
242
+ throw new Error("--upload requires --compile.");
243
+ }
244
+ // Note: port validation is deferred to the build path, which checks the
245
+ // effective port (CLI --port flag OR config.console.port). This allows
246
+ // setting the port in cuttlefish.config.ts instead of on every command.
247
+ if (watch && monitor) {
248
+ throw new Error("--watch and --monitor cannot be used together (monitor blocks the process).");
249
+ }
250
+ const treeShaking = {
251
+ enabled: !noTreeShake,
252
+ keepUnusedEnums,
253
+ keepUnusedClasses,
254
+ keepUnusedTypeAliases: keepUnusedTypes,
255
+ keepUnusedVariables,
256
+ reportUnused: false,
257
+ entryPoints: entryPoints.length > 0 ? entryPoints : undefined,
258
+ };
259
+ return {
260
+ command,
261
+ inputFile: inputFile ? path.resolve(process.cwd(), inputFile) : undefined,
262
+ emitMode,
263
+ target,
264
+ outDir: outDir ? path.resolve(process.cwd(), outDir) : undefined,
265
+ emitMaps,
266
+ noTranspile: command === "default" ? noTranspile : false,
267
+ compile,
268
+ upload,
269
+ monitor,
270
+ watch,
271
+ port,
272
+ baud,
273
+ platformContext,
274
+ treeShaking,
275
+ debug,
276
+ force,
277
+ skipTypeCheck,
278
+ diagnostics,
279
+ expect,
280
+ expectFile,
281
+ frameworkPackage: frameworkFlag,
282
+ };
283
+ }
284
+ export function parseCommandLine(argv) {
285
+ const firstArg = argv[2];
286
+ if (!firstArg || firstArg === "--help" || firstArg === "-h") {
287
+ return "help";
288
+ }
289
+ // create subcommand — project scaffolding
290
+ if (firstArg === "create") {
291
+ const secondArg = argv[3];
292
+ const projectName = secondArg && !secondArg.startsWith("-") ? secondArg : undefined;
293
+ const target = readFirstFlagValue(argv, ["--target", "-t"])
294
+ ?? readFirstFlagValue(argv, ["--board", "-b"]);
295
+ const framework = readFirstFlagValue(argv, ["--framework", "-f"]);
296
+ const baudRaw = readFirstFlagValue(argv, ["--baud"]);
297
+ const outDir = readFirstFlagValue(argv, ["--outDir", "--out-dir", "-o"]);
298
+ const noSketch = argv.includes("--no-sketch");
299
+ const baud = baudRaw && !Number.isNaN(Number(baudRaw)) ? Number(baudRaw) : undefined;
300
+ return {
301
+ command: "create",
302
+ projectName,
303
+ target,
304
+ baud,
305
+ framework,
306
+ noSketch,
307
+ outDir: outDir ? path.resolve(process.cwd(), outDir) : undefined,
308
+ };
309
+ }
310
+ if (firstArg === "create-board") {
311
+ throw new Error(`The 'create-board' command has been removed. Board scaffolding is now in @typecad/create.`);
312
+ }
313
+ if (firstArg === "init") {
314
+ throw new Error(`Use 'cuttlefish create' instead of 'cuttlefish init'.`);
315
+ }
316
+ // build subcommand — entry point comes from cuttlefish.config.ts
317
+ if (firstArg === "build") {
318
+ return parsePipelineCommand(argv, "build");
319
+ }
320
+ if (firstArg === "preview") {
321
+ const configPath = readFirstFlagValue(argv, ["--config"]);
322
+ const port = readNumberFlag(argv, ["--port"]);
323
+ return {
324
+ command: "preview",
325
+ inputFile: undefined,
326
+ emitMode: "split",
327
+ target: "generic",
328
+ emitMaps: true,
329
+ noTranspile: false,
330
+ compile: false,
331
+ upload: false,
332
+ monitor: false,
333
+ watch: false,
334
+ baud: 9600,
335
+ platformContext: {},
336
+ configPath: configPath ? path.resolve(process.cwd(), configPath) : undefined,
337
+ port: port ? String(port) : undefined,
338
+ };
339
+ }
340
+ // Named subcommands
341
+ if (firstArg === "gen-libdefs" || firstArg === "gen-decls" || firstArg === "map-error") {
342
+ const command = firstArg;
343
+ const emitFlag = readFirstFlagValue(argv, ["--emit"]);
344
+ const targetFlag = readFirstFlagValue(argv, ["--target"]);
345
+ const outDir = readFirstFlagValue(argv, ["--outDir", "--out-dir"]);
346
+ const emitMapsFlag = readFirstFlagValue(argv, ["--emit-maps"]);
347
+ const buildTarget = readFirstFlagValue(argv, ["--build-target"]);
348
+ const emitMode = emitFlag === "cpp" || emitFlag === "split" ? emitFlag : "split";
349
+ const target = targetFlag ?? "generic";
350
+ const emitMaps = emitMapsFlag === undefined ? true : emitMapsFlag !== "false";
351
+ const platformContext = {
352
+ architecture: buildTarget?.split(":")?.[1]?.toLowerCase(),
353
+ frameworkData: { buildTarget },
354
+ };
355
+ if (command === "map-error") {
356
+ const mapFile = argv[3];
357
+ if (!mapFile) {
358
+ throw new Error("Missing source map path for map-error.");
359
+ }
360
+ const cppLineRaw = readFirstFlagValue(argv, ["--line", "--cpp-line"]);
361
+ if (!cppLineRaw || Number.isNaN(Number(cppLineRaw))) {
362
+ throw new Error("map-error requires --line <number>.");
363
+ }
364
+ const cppColumnRaw = readFirstFlagValue(argv, ["--column", "--cpp-column"]);
365
+ const cppFile = readFirstFlagValue(argv, ["--cpp-file"]);
366
+ const message = readFirstFlagValue(argv, ["--message"]);
367
+ return {
368
+ command,
369
+ emitMode,
370
+ target,
371
+ outDir: outDir ? path.resolve(process.cwd(), outDir) : undefined,
372
+ emitMaps,
373
+ noTranspile: false,
374
+ compile: false,
375
+ upload: false,
376
+ monitor: false,
377
+ watch: false,
378
+ baud: 9600,
379
+ platformContext,
380
+ mapFile: path.resolve(process.cwd(), mapFile),
381
+ cppFile: cppFile ? path.resolve(process.cwd(), cppFile) : undefined,
382
+ cppLine: Number(cppLineRaw),
383
+ cppColumn: cppColumnRaw ? Number(cppColumnRaw) : 1,
384
+ message,
385
+ };
386
+ }
387
+ // gen-decls - generate .d.ts from C++ files
388
+ if (command === "gen-decls") {
389
+ const allFlag = argv.includes("--all");
390
+ // The positional path may sit at argv[3] or argv[4] depending on whether
391
+ // --all precedes or follows it. Scan argv starting after the subcommand
392
+ // name (argv[2]) for the first token that is not a flag and not a known
393
+ // flag's value. This mirrors the default-pipeline approach of "first
394
+ // non-flag token wins".
395
+ const booleanFlags = new Set(["--all"]);
396
+ const valueFlags = new Set([
397
+ "--emit", "--target", "--outDir", "--out-dir", "--emit-maps", "--build-target",
398
+ ]);
399
+ let inputPath;
400
+ for (let i = 3; i < argv.length; i++) {
401
+ const tok = argv[i];
402
+ if (valueFlags.has(tok)) {
403
+ // Value-consuming flag: skip its value (if any) so it isn't mistaken
404
+ // for the positional path.
405
+ if (i + 1 < argv.length) {
406
+ i++;
407
+ }
408
+ continue;
409
+ }
410
+ if (tok.startsWith("-")) {
411
+ continue; // boolean flag (e.g. --all) or unknown flag — ignore
412
+ }
413
+ inputPath = tok;
414
+ break;
415
+ }
416
+ if (!inputPath && !allFlag) {
417
+ throw new Error("Missing input C++ file path. Use: gen-decls <file.cpp> or gen-decls --all <directory>");
418
+ }
419
+ const scanDir = allFlag ? (inputPath || process.cwd()) : undefined;
420
+ const inputFile = allFlag ? undefined : inputPath;
421
+ return {
422
+ command: "gen-decls",
423
+ inputFile: inputFile ? path.resolve(process.cwd(), inputFile) : undefined,
424
+ emitMode,
425
+ target,
426
+ outDir: outDir ? path.resolve(process.cwd(), outDir) : undefined,
427
+ emitMaps,
428
+ noTranspile: false,
429
+ compile: false,
430
+ upload: false,
431
+ monitor: false,
432
+ watch: false,
433
+ baud: 9600,
434
+ platformContext,
435
+ // Custom fields for gen-decls
436
+ scanDir: scanDir ? path.resolve(process.cwd(), scanDir) : undefined,
437
+ };
438
+ }
439
+ // gen-libdefs
440
+ const inputFile = argv[3];
441
+ if (!inputFile) {
442
+ throw new Error("Missing input TypeScript file path.");
443
+ }
444
+ return {
445
+ command,
446
+ inputFile: path.resolve(process.cwd(), inputFile),
447
+ emitMode,
448
+ target,
449
+ outDir: outDir ? path.resolve(process.cwd(), outDir) : undefined,
450
+ emitMaps,
451
+ noTranspile: false,
452
+ compile: false,
453
+ upload: false,
454
+ monitor: false,
455
+ watch: false,
456
+ baud: 9600,
457
+ platformContext,
458
+ };
459
+ }
460
+ // Default: firstArg is the input file (unless it's a flag like --expect)
461
+ const inputFile = firstArg.startsWith("-") ? undefined : firstArg;
462
+ return parsePipelineCommand(argv, "default", inputFile);
463
+ }
@@ -0,0 +1,4 @@
1
+ export declare function ensureDir(dirPath: string): void;
2
+ export declare function readText(filePath: string): string;
3
+ export declare function writeText(filePath: string, content: string): void;
4
+ export declare function listFiles(dirPath: string, extension: string): string[];
@@ -0,0 +1,23 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ export function ensureDir(dirPath) {
4
+ if (!fs.existsSync(dirPath)) {
5
+ fs.mkdirSync(dirPath, { recursive: true });
6
+ }
7
+ }
8
+ export function readText(filePath) {
9
+ return fs.readFileSync(filePath, "utf8");
10
+ }
11
+ export function writeText(filePath, content) {
12
+ ensureDir(path.dirname(filePath));
13
+ fs.writeFileSync(filePath, content, "utf8");
14
+ }
15
+ export function listFiles(dirPath, extension) {
16
+ if (!fs.existsSync(dirPath)) {
17
+ return [];
18
+ }
19
+ return fs
20
+ .readdirSync(dirPath)
21
+ .filter((name) => name.toLowerCase().endsWith(extension.toLowerCase()))
22
+ .map((name) => path.join(dirPath, name));
23
+ }
@@ -0,0 +1,2 @@
1
+ export declare function debug(message: string, enabled?: boolean): void;
2
+ export declare function info(message: string): void;
@@ -0,0 +1,8 @@
1
+ export function debug(message, enabled = false) {
2
+ if (enabled) {
3
+ console.log(message);
4
+ }
5
+ }
6
+ export function info(message) {
7
+ console.log(message);
8
+ }
@@ -0,0 +1,35 @@
1
+ export declare function toModuleKey(moduleSpecifier: string): string;
2
+ export declare function toPascalCase(input: string): string;
3
+ export declare function withLineColumn(content: string, position: number): {
4
+ line: number;
5
+ column: number;
6
+ };
7
+ /**
8
+ * Escapes a name that conflicts with a C++ reserved keyword by appending `_`.
9
+ * Additionally checks against the optional `platformNames` set, which should
10
+ * come from `PlatformStrategy.reservedNames()` for the active framework.
11
+ *
12
+ * For example, `register` → `register_`.
13
+ * With Arduino strategy: `min` → `min_`, `map` → `map_`.
14
+ */
15
+ export declare function escapeCppKeyword(name: string, platformNames?: ReadonlySet<string>): string;
16
+ /**
17
+ * Escape the trailing member name of a (possibly compound) C++ lvalue/access
18
+ * string against the reserved-name sets. Handles both bare identifiers
19
+ * (`min` → `min_`) and member-access chains (`this->min`, `obj.min`,
20
+ * `ptr->field`) by renaming only the final segment, so a reserved member name
21
+ * is escaped consistently with how the field is DECLARED (renameStructField /
22
+ * escapeCppKeyword applied to the bare field name). Demo #33: applying plain
23
+ * escapeCppKeyword to the compound string `this.min` left `min` untouched,
24
+ * diverging from the access path and producing a declaration/access mismatch.
25
+ */
26
+ export declare function escapeTrailingMember(text: string, platformNames?: ReadonlySet<string>): string;
27
+ export declare function escapeCppStringLiteral(value: string): string;
28
+ /** Escape a literal text fragment destined for a snprintf *format* string.
29
+ * Same as escapeCppStringLiteral, but also doubles `%` so a trailing or
30
+ * embedded percent (e.g. `meter: ${v}%`) doesn't get misread as a conversion
31
+ * specifier on hardware. Use this for any fragment that becomes part of the
32
+ * format argument to snprintf(...) — NOT for snprintf *arguments* or for
33
+ * standalone C++ string literals, where a bare `%` is harmless. */
34
+ export declare function escapeSnprintfFormatFragment(value: string): string;
35
+ export declare function normalizeKebabName(name: string): string;