@typecad/cuttlefish 1.0.0-alpha.14 → 1.0.0-alpha.16

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 (315) hide show
  1. package/README.md +82 -79
  2. package/assets/editor-extensions/typecad-debug/README.md +25 -26
  3. package/dist/api/config.d.ts +22 -26
  4. package/dist/api/schema/types.d.ts +20 -3
  5. package/dist/api/shared/async-runtime-static.d.ts +1 -1
  6. package/dist/api/shared/async-runtime-static.js +5 -5
  7. package/dist/api/shared/async-types.d.ts +3 -2
  8. package/dist/api/shared/board-catalog.d.ts +2 -0
  9. package/dist/api/shared/board-catalog.js +6 -0
  10. package/dist/api/shared/board-resolver.d.ts +4 -7
  11. package/dist/api/shared/board-resolver.js +2 -1
  12. package/dist/api/shared/coop-scheduler.d.ts +1 -1
  13. package/dist/api/shared/coop-scheduler.js +1 -1
  14. package/dist/api/shared/cpp-type-ir.d.ts +1 -1
  15. package/dist/api/shared/cpp-type-ir.js +1 -1
  16. package/dist/api/shared/display-profile.d.ts +1 -1
  17. package/dist/api/shared/display-profile.js +3 -5
  18. package/dist/api/shared/framework-manifest-registry.d.ts +1 -1
  19. package/dist/api/shared/framework-manifest-registry.js +0 -1
  20. package/dist/api/shared/framework-manifest.d.ts +7 -6
  21. package/dist/api/shared/framework-manifest.js +6 -11
  22. package/dist/api/shared/hal-op-ir.d.ts +294 -685
  23. package/dist/api/shared/hal-op-ir.js +31 -65
  24. package/dist/api/shared/index.d.ts +0 -4
  25. package/dist/api/shared/index.js +1 -7
  26. package/dist/api/shared/ir-core.d.ts +6 -0
  27. package/dist/api/shared/ir-declarations.d.ts +4 -0
  28. package/dist/api/shared/ir.d.ts +1 -3
  29. package/dist/api/shared/platform-strategy.d.ts +14 -37
  30. package/dist/api/shared/polyfill-helper-registry.js +0 -5
  31. package/dist/api/shared/polyfill-types.js +0 -27
  32. package/dist/api/shared/promise-runtime.js +3 -3
  33. package/dist/api/shared/spdx-licenses.d.ts +12 -10
  34. package/dist/api/shared/spdx-licenses.js +1 -1
  35. package/dist/api/shared/toolchain-types.d.ts +1 -1
  36. package/dist/api/shared/toolchain-types.js +3 -3
  37. package/dist/api/shared/types.d.ts +0 -3
  38. package/dist/api/shared/validate-framework-manifest.js +13 -33
  39. package/dist/board-catalog/dts-reader.d.ts +220 -0
  40. package/dist/board-catalog/dts-reader.js +1052 -0
  41. package/dist/board-catalog/index.d.ts +11 -0
  42. package/dist/board-catalog/index.js +12 -0
  43. package/dist/board-catalog/pinconfig.d.ts +48 -0
  44. package/dist/board-catalog/pinconfig.js +263 -0
  45. package/dist/board-catalog/sdk.d.ts +82 -0
  46. package/dist/board-catalog/sdk.js +180 -0
  47. package/dist/board-catalog/store.d.ts +196 -0
  48. package/dist/board-catalog/store.js +363 -0
  49. package/dist/board-catalog/types.d.ts +233 -0
  50. package/dist/board-catalog/types.js +7 -0
  51. package/dist/board-catalog/walker.d.ts +112 -0
  52. package/dist/board-catalog/walker.js +1101 -0
  53. package/dist/cli-utils.d.ts +2 -2
  54. package/dist/cli-utils.js +5 -5
  55. package/dist/cli.js +219 -242
  56. package/dist/config-loader.d.ts +14 -19
  57. package/dist/config-loader.js +240 -78
  58. package/dist/config-schema.d.ts +3 -5
  59. package/dist/config-schema.js +8 -8
  60. package/dist/contract/board-generator.d.ts +4 -4
  61. package/dist/contract/board-generator.js +16 -5
  62. package/dist/contract/contract-parser.d.ts +27 -0
  63. package/dist/contract/contract-parser.js +76 -0
  64. package/dist/contract/index.d.ts +1 -1
  65. package/dist/contract/index.js +70 -21
  66. package/dist/create/active-board-catalog.d.ts +9 -0
  67. package/dist/create/active-board-catalog.js +94 -0
  68. package/dist/create/board-catalog.generated.d.ts +96 -0
  69. package/dist/create/board-catalog.generated.js +128737 -0
  70. package/dist/create/board-search.d.ts +23 -0
  71. package/dist/create/board-search.js +88 -0
  72. package/dist/create/editor-integration.d.ts +4 -2
  73. package/dist/create/editor-integration.js +41 -2
  74. package/dist/create/framework-catalog.d.ts +57 -9
  75. package/dist/create/framework-catalog.js +76 -57
  76. package/dist/create/index.d.ts +5 -11
  77. package/dist/create/index.js +3 -8
  78. package/dist/create/mcu-target.d.ts +39 -0
  79. package/dist/create/mcu-target.js +80 -0
  80. package/dist/create/pack-targets.d.ts +19 -0
  81. package/dist/create/pack-targets.js +56 -0
  82. package/dist/create/scaffold.d.ts +4 -7
  83. package/dist/create/scaffold.js +19 -109
  84. package/dist/create/templates.d.ts +32 -5
  85. package/dist/create/templates.js +130 -116
  86. package/dist/create/wizard.d.ts +12 -1
  87. package/dist/create/wizard.js +168 -38
  88. package/dist/debug/preprocessor.d.ts +5 -0
  89. package/dist/debug/preprocessor.js +31 -7
  90. package/dist/diagnostics/diagnostics-report.d.ts +1 -1
  91. package/dist/diagnostics/diagnostics-report.js +3 -11
  92. package/dist/diagnostics/json-schema.d.ts +1 -1
  93. package/dist/diagnostics/md-writer.js +2 -2
  94. package/dist/diagnostics/mermaid-builder.d.ts +1 -1
  95. package/dist/diagnostics/mermaid-builder.js +1 -1
  96. package/dist/emit/cpp-emitter.js +4 -1
  97. package/dist/emit/emitters/class-emitter.js +32 -4
  98. package/dist/emit/emitters/emitter-context.d.ts +11 -0
  99. package/dist/emit/emitters/entrypoint-synthesizer.js +1 -1
  100. package/dist/emit/emitters/function-emitter-impl.js +33 -17
  101. package/dist/emit/emitters/output-finalizer.d.ts +7 -0
  102. package/dist/emit/emitters/output-finalizer.js +31 -23
  103. package/dist/emit/emitters/setup.js +125 -63
  104. package/dist/emit/emitters/top-level-prep.js +1 -1
  105. package/dist/emit/emitters/type-decl-emitter.js +13 -8
  106. package/dist/emit/emitters/ui-emitter.js +1 -1
  107. package/dist/emit/expression-renderer.d.ts +3 -3
  108. package/dist/emit/expression-renderer.js +17 -7
  109. package/dist/emit/route-hal-op.js +17 -48
  110. package/dist/emit/snprintf-helpers.d.ts +1 -3
  111. package/dist/emit/snprintf-helpers.js +1 -39
  112. package/dist/emit/statement-renderer.d.ts +0 -4
  113. package/dist/emit/statement-renderer.js +54 -45
  114. package/dist/emit/utils/async-state-machine.d.ts +16 -9
  115. package/dist/emit/utils/async-state-machine.js +56 -54
  116. package/dist/emit/utils/comment-helpers.d.ts +0 -8
  117. package/dist/emit/utils/comment-helpers.js +1 -1
  118. package/dist/emit/utils/cpp-helpers.d.ts +2 -2
  119. package/dist/emit/utils/cpp-helpers.js +2 -2
  120. package/dist/emit/utils/hal-op-cpp-type.js +4 -6
  121. package/dist/emit/utils/index.d.ts +3 -3
  122. package/dist/emit/utils/index.js +3 -3
  123. package/dist/emit/utils/type-inference.d.ts +1 -29
  124. package/dist/emit/utils/type-inference.js +0 -75
  125. package/dist/framework-package.d.ts +3 -0
  126. package/dist/framework-package.js +23 -6
  127. package/dist/framework-registry.d.ts +5 -5
  128. package/dist/frameworks/native/graphics/terminal-preview.d.ts +5 -0
  129. package/dist/frameworks/native/graphics/terminal-preview.js +33 -0
  130. package/dist/frameworks/native/index.d.ts +3 -0
  131. package/dist/frameworks/native/index.js +15 -0
  132. package/dist/frameworks/native/native-compile.d.ts +17 -0
  133. package/dist/frameworks/native/native-compile.js +170 -0
  134. package/dist/frameworks/native/native-config.d.ts +41 -0
  135. package/dist/frameworks/native/native-config.js +7 -0
  136. package/dist/frameworks/native/strategy.d.ts +97 -0
  137. package/dist/frameworks/native/strategy.js +664 -0
  138. package/dist/ir/board-resolver.d.ts +18 -23
  139. package/dist/ir/board-resolver.js +43 -401
  140. package/dist/ir/build-ir-state.d.ts +3 -0
  141. package/dist/ir/build-ir-state.js +42 -0
  142. package/dist/ir/build-ir.d.ts +1 -1
  143. package/dist/ir/build-ir.js +40 -42
  144. package/dist/ir/declaration-builders.js +1 -0
  145. package/dist/ir/expression-to-ir.js +17 -10
  146. package/dist/ir/hal/hal-emitter.d.ts +0 -2
  147. package/dist/ir/hal/hal-emitter.js +92 -41
  148. package/dist/ir/hal/hal-parser.d.ts +5 -5
  149. package/dist/ir/hal/hal-parser.js +128 -36
  150. package/dist/ir/hal/hal-plugins.d.ts +0 -1
  151. package/dist/ir/hal/hal-plugins.js +425 -716
  152. package/dist/ir/heap-analysis.js +2 -41
  153. package/dist/ir/identifier-collector.js +32 -20
  154. package/dist/ir/network-validation.js +7 -11
  155. package/dist/ir/ownership-analysis.js +75 -13
  156. package/dist/ir/peripheral-usage.d.ts +8 -2
  157. package/dist/ir/peripheral-usage.js +78 -149
  158. package/dist/ir/peripheral-validation.js +23 -3
  159. package/dist/ir/pin-capability-validation.d.ts +12 -0
  160. package/dist/ir/pin-capability-validation.js +61 -97
  161. package/dist/ir/pin-mode-validation.js +5 -5
  162. package/dist/ir/program-analysis.d.ts +8 -15
  163. package/dist/ir/program-analysis.js +140 -323
  164. package/dist/ir/pulldown-validation.js +11 -4
  165. package/dist/ir/resource-analysis.js +15 -3
  166. package/dist/ir/statement-to-ir.js +0 -6
  167. package/dist/ir/timing-validation.js +1 -1
  168. package/dist/ir/transformers/array-methods.js +11 -5
  169. package/dist/ir/transformers/call-statement.js +20 -87
  170. package/dist/ir/transformers/callback-context-registry.d.ts +1 -1
  171. package/dist/ir/transformers/callback-context-registry.js +8 -16
  172. package/dist/ir/transformers/control-flow.js +0 -13
  173. package/dist/ir/transformers/expressions.js +10 -9
  174. package/dist/ir/transformers/hal-call-resolver.d.ts +2 -2
  175. package/dist/ir/transformers/hal-call-resolver.js +24 -10
  176. package/dist/ir/transformers/hal-emit-helpers.d.ts +2 -2
  177. package/dist/ir/transformers/hal-emit-helpers.js +2 -2
  178. package/dist/ir/transformers/namespace-methods.js +1 -1
  179. package/dist/ir/transformers/ui-callback-lowering.d.ts +0 -2
  180. package/dist/ir/transformers/ui-callback-lowering.js +0 -24
  181. package/dist/ir/transformers/variables.js +338 -42
  182. package/dist/ir/try-catch-validation.js +4 -3
  183. package/dist/ir/type-resolution.js +15 -4
  184. package/dist/ir/validation-orchestrator.js +0 -9
  185. package/dist/libdef/cpp-to-decl.d.ts +0 -9
  186. package/dist/libdef/cpp-to-decl.js +0 -72
  187. package/dist/libdef/registry.d.ts +0 -1
  188. package/dist/libdef/registry.js +1 -24
  189. package/dist/library/init.d.ts +1 -1
  190. package/dist/library/init.js +137 -137
  191. package/dist/library-packages.d.ts +1 -1
  192. package/dist/library-packages.js +1 -1
  193. package/dist/mapping/peripheral-names.js +9 -4
  194. package/dist/mapping/source-map.d.ts +3 -4
  195. package/dist/mapping/source-map.js +12 -18
  196. package/dist/orchestrator/graph-builder.d.ts +3 -3
  197. package/dist/orchestrator/graph-builder.js +13 -12
  198. package/dist/orchestrator/type-checker.d.ts +3 -3
  199. package/dist/orchestrator/type-checker.js +3 -3
  200. package/dist/platform/async-runtime.js +1 -1
  201. package/dist/platform/coop-scheduler-runtime.js +2 -2
  202. package/dist/platform/generic-debug-codegen.d.ts +36 -0
  203. package/dist/platform/generic-debug-codegen.js +185 -0
  204. package/dist/platform/generic-strategy.d.ts +3 -4
  205. package/dist/platform/generic-strategy.js +5 -80
  206. package/dist/platform/index.js +1 -1
  207. package/dist/platform/registry.d.ts +2 -2
  208. package/dist/platform/registry.js +2 -2
  209. package/dist/safety/asil-decorators.d.ts +32 -0
  210. package/dist/safety/asil-decorators.js +32 -0
  211. package/dist/safety/authoring.d.ts +85 -0
  212. package/dist/safety/authoring.js +61 -0
  213. package/dist/safety/engine.d.ts +3 -0
  214. package/dist/safety/engine.js +83 -0
  215. package/dist/safety/hal/ops.d.ts +48 -0
  216. package/dist/safety/hal/ops.js +46 -0
  217. package/dist/safety/iso26262/analyze.d.ts +13 -0
  218. package/dist/safety/iso26262/analyze.js +29 -0
  219. package/dist/safety/iso26262/asil.d.ts +10 -0
  220. package/dist/safety/iso26262/asil.js +22 -0
  221. package/dist/safety/iso26262/collect.d.ts +14 -0
  222. package/dist/safety/iso26262/collect.js +137 -0
  223. package/dist/safety/iso26262/goto-checker.d.ts +10 -0
  224. package/dist/safety/iso26262/goto-checker.js +72 -0
  225. package/dist/safety/iso26262/heap-checker.d.ts +7 -0
  226. package/dist/safety/iso26262/heap-checker.js +57 -0
  227. package/dist/safety/iso26262/init-checker.d.ts +13 -0
  228. package/dist/safety/iso26262/init-checker.js +127 -0
  229. package/dist/safety/iso26262/loop-checker.d.ts +7 -0
  230. package/dist/safety/iso26262/loop-checker.js +86 -0
  231. package/dist/safety/iso26262/recursion-checker.d.ts +9 -0
  232. package/dist/safety/iso26262/recursion-checker.js +134 -0
  233. package/dist/safety/iso26262/sidecar-writer.d.ts +25 -0
  234. package/dist/safety/iso26262/sidecar-writer.js +13 -0
  235. package/dist/safety/passes/pinMode-intercept.d.ts +3 -0
  236. package/dist/safety/passes/pinMode-intercept.js +60 -0
  237. package/dist/safety/runtime/mode-table.d.ts +5 -0
  238. package/dist/safety/runtime/mode-table.js +55 -0
  239. package/dist/safety/runtime/polyfills.d.ts +6 -0
  240. package/dist/safety/runtime/polyfills.js +12 -0
  241. package/dist/safety/runtime/result-struct.d.ts +11 -0
  242. package/dist/safety/runtime/result-struct.js +98 -0
  243. package/dist/safety/runtime/safe-int.d.ts +33 -0
  244. package/dist/safety/runtime/safe-int.js +170 -0
  245. package/dist/safety/runtime/safe-traits.d.ts +4 -0
  246. package/dist/safety/runtime/safe-traits.js +95 -0
  247. package/dist/safety/runtime/safe-variable.d.ts +39 -0
  248. package/dist/safety/runtime/safe-variable.js +226 -0
  249. package/dist/safety/runtime/vote.d.ts +8 -0
  250. package/dist/safety/runtime/vote.js +92 -0
  251. package/dist/safety/runtime/write-verify.d.ts +8 -0
  252. package/dist/safety/runtime/write-verify.js +71 -0
  253. package/dist/safety/safe-int-types.d.ts +45 -0
  254. package/dist/safety/safe-int-types.js +25 -0
  255. package/dist/safety/safe-variable-types.d.ts +29 -0
  256. package/dist/safety/safe-variable-types.js +19 -0
  257. package/dist/safety/safety-bridge.d.ts +5 -6
  258. package/dist/safety/safety-bridge.js +15 -28
  259. package/dist/safety/sidecar-bridge.d.ts +1 -3
  260. package/dist/safety/sidecar-bridge.js +3 -20
  261. package/dist/safety/specifiers.d.ts +6 -0
  262. package/dist/safety/specifiers.js +14 -0
  263. package/dist/safety-hook.d.ts +8 -7
  264. package/dist/safety-hook.js +12 -13
  265. package/dist/testing.d.ts +4 -5
  266. package/dist/testing.js +5 -5
  267. package/dist/transpile/resolution.d.ts +1 -1
  268. package/dist/transpile/resolution.js +18 -9
  269. package/dist/transpile/test-pins.d.ts +18 -0
  270. package/dist/transpile/test-pins.js +142 -0
  271. package/dist/transpile.d.ts +1 -2
  272. package/dist/transpile.js +36 -30
  273. package/dist/types.d.ts +26 -26
  274. package/dist/ui-hook.d.ts +1 -1
  275. package/dist/utils/cli.d.ts +2 -2
  276. package/dist/utils/cli.js +92 -154
  277. package/dist/utils/fs.d.ts +3 -4
  278. package/dist/utils/fs.js +4 -5
  279. package/dist/utils/strings.d.ts +0 -1
  280. package/dist/utils/strings.js +0 -8
  281. package/dist/utils/ui.d.ts +5 -2
  282. package/dist/utils/ui.js +13 -3
  283. package/package.json +158 -157
  284. package/dist/add-preset.d.ts +0 -4
  285. package/dist/add-preset.js +0 -74
  286. package/dist/api/shared/async-symbol-detector.d.ts +0 -11
  287. package/dist/api/shared/async-symbol-detector.js +0 -140
  288. package/dist/api/shared/native-display-op-resolver.d.ts +0 -10
  289. package/dist/api/shared/native-display-op-resolver.js +0 -64
  290. package/dist/create/board-checklist.d.ts +0 -2
  291. package/dist/create/board-checklist.js +0 -52
  292. package/dist/create/board-codegen.d.ts +0 -9
  293. package/dist/create/board-codegen.js +0 -238
  294. package/dist/create/board-generators.d.ts +0 -12
  295. package/dist/create/board-generators.js +0 -651
  296. package/dist/create/board-spec.d.ts +0 -181
  297. package/dist/create/board-spec.js +0 -214
  298. package/dist/install/framework-catalog.d.ts +0 -53
  299. package/dist/install/framework-catalog.js +0 -107
  300. package/dist/install/handle-install.d.ts +0 -35
  301. package/dist/install/handle-install.js +0 -177
  302. package/dist/install/index.d.ts +0 -4
  303. package/dist/install/index.js +0 -3
  304. package/dist/ir/pin-state-tracking.d.ts +0 -58
  305. package/dist/ir/pin-state-tracking.js +0 -182
  306. package/dist/ir/pwm-timer-sharing.d.ts +0 -4
  307. package/dist/ir/pwm-timer-sharing.js +0 -94
  308. package/dist/ir/timer0-pwm-timing-conflict.d.ts +0 -4
  309. package/dist/ir/timer0-pwm-timing-conflict.js +0 -72
  310. package/dist/libdef/component-decls.d.ts +0 -2
  311. package/dist/libdef/component-decls.js +0 -6
  312. package/dist/libdef/component-discovery.d.ts +0 -43
  313. package/dist/libdef/component-discovery.js +0 -83
  314. package/dist/theme-tokens.d.ts +0 -22
  315. package/dist/theme-tokens.js +0 -172
@@ -0,0 +1,19 @@
1
+ import type { BoardDataEntry } from '../board-catalog/types.js';
2
+ import type { KnownTarget } from './scaffold.js';
3
+ export declare function architectureFromSoc(soc: string): string;
4
+ /** Look up a pack entry by qualified identifier or bare board name.
5
+ * Bare names with multiple variants return the first (deterministic —
6
+ * the pack is keyed in directory-walk order). */
7
+ export declare function findPackBoard(idOrTarget: string): {
8
+ identifier: string;
9
+ name: string;
10
+ vendor: string;
11
+ soc: string;
12
+ probeMethods?: BoardDataEntry['probeMethods'];
13
+ } | undefined;
14
+ /** Build a create-flow KnownTarget from a pack entry. */
15
+ export declare function packBoardAsTarget(entry: {
16
+ identifier: string;
17
+ name: string;
18
+ soc: string;
19
+ }): KnownTarget;
@@ -0,0 +1,56 @@
1
+ // ---------------------------------------------------------------------------
2
+ // pack-targets.ts — any-board target resolution off the generated catalog.
3
+ //
4
+ // The curated KNOWN_TARGETS list covers the nine hardware-validated boards;
5
+ // the board data pack carries every Zephyr board variant (1,300+). This
6
+ // module turns a pack entry into the same KnownTarget shape the create flow
7
+ // consumes, so `cuttlefish create --target <any-zephyr-board>` works with no
8
+ // per-board catalog entry. The soc's prefix derives an architecture id for
9
+ // framework narrowing (the fallback maps unknowns to zephyr anyway).
10
+ // ---------------------------------------------------------------------------
11
+ import { activeBoardCatalog, findBoardInCatalog } from '../board-catalog/index.js';
12
+ /** A coarse architecture id derived from a Zephyr soc name. Used only for
13
+ * framework narrowing and display — every value here resolves through
14
+ * FALLBACK_FRAMEWORKS to zephyr, which is correct for every pack board;
15
+ * the known families just display nicely. */
16
+ const SOC_FAMILIES = [
17
+ [/^esp32/, 'esp32'],
18
+ [/^nrf5/, 'nrf52'],
19
+ [/^nrf9/, 'nrf91'],
20
+ [/^stm32/, 'stm32'],
21
+ [/^stm32mp/, 'stm32mp1'],
22
+ [/^rp2/, 'rp2040'],
23
+ [/^samd/, 'samd'],
24
+ [/^mcimx|^imx/, 'imx'],
25
+ ];
26
+ export function architectureFromSoc(soc) {
27
+ for (const [re, family] of SOC_FAMILIES) {
28
+ if (re.test(soc))
29
+ return family;
30
+ }
31
+ return soc;
32
+ }
33
+ /** Look up a pack entry by qualified identifier or bare board name.
34
+ * Bare names with multiple variants return the first (deterministic —
35
+ * the pack is keyed in directory-walk order). */
36
+ export function findPackBoard(idOrTarget) {
37
+ const data = activeBoardCatalog();
38
+ const raw = idOrTarget.trim();
39
+ const entry = findBoardInCatalog(data, raw);
40
+ if (entry) {
41
+ return { identifier: entry.identifier, name: entry.name, vendor: entry.vendor, soc: entry.identifier.split('/')[1], probeMethods: entry.probeMethods };
42
+ }
43
+ return undefined;
44
+ }
45
+ /** Build a create-flow KnownTarget from a pack entry. */
46
+ export function packBoardAsTarget(entry) {
47
+ return {
48
+ id: entry.identifier.split('/')[0],
49
+ displayName: entry.name,
50
+ isNative: false,
51
+ architecture: architectureFromSoc(entry.soc),
52
+ board: entry.identifier,
53
+ buildTarget: entry.identifier,
54
+ soc: entry.soc,
55
+ };
56
+ }
@@ -5,7 +5,9 @@ export interface KnownTarget {
5
5
  displayName: string;
6
6
  isNative: boolean;
7
7
  architecture?: ArchitectureIdentifier;
8
- boardPackage?: string;
8
+ /** Qualified Zephyr board target — the config's board: value and the
9
+ * boardgen input (materialized to .cuttlefish/board.ts at create). */
10
+ board?: string;
9
11
  /** Framework package + id. Optional on embedded targets: the scaffold wizard
10
12
  * fills these in by discovering installed @typecad/framework-* packages, so
11
13
  * KNOWN_TARGETS board entries do not hardcode a framework. Native targets
@@ -13,17 +15,12 @@ export interface KnownTarget {
13
15
  frameworkPackage?: string;
14
16
  framework?: string;
15
17
  buildTarget?: string;
16
- mcu?: string;
18
+ soc?: string;
17
19
  /** Framework-specific config (becomes frameworkData in cuttlefish.config.ts).
18
20
  * Carries framework-specific target/options data for the selected framework. */
19
21
  frameworkData?: Record<string, unknown>;
20
22
  }
21
- export declare function registerKnownTarget(target: KnownTarget): void;
22
23
  export declare const KNOWN_TARGETS: ReadonlyArray<KnownTarget>;
23
- /** @deprecated Use KNOWN_TARGETS */
24
- export declare const KNOWN_BOARDS: KnownTarget[];
25
- /** @deprecated Use KnownTarget */
26
- export type KnownBoard = KnownTarget;
27
24
  export declare function normalizeProjectName(name: string): string;
28
25
  export interface ScaffoldProjectResult {
29
26
  createdFiles: string[];
@@ -1,7 +1,7 @@
1
1
  import path from "node:path";
2
2
  import fs from "node:fs";
3
3
  import chalk from "chalk";
4
- import { generateProjectPackageJson, generateProjectTsconfig, generateProjectConfig, generateProjectEnvDts, generateStarterSketch, generateStarterTest, generateStarterSim, generateGitignore, generateEditorconfig, generateBoardForwardingFile, generateEslintConfig, } from "./templates.js";
4
+ import { generateProjectPackageJson, generateProjectTsconfig, generateProjectConfig, generateProjectEnvDts, generateStarterProgram, generateStarterTest, generateStarterSim, generateGitignore, generateEditorconfig, generateEslintConfig, } from "./templates.js";
5
5
  import { generateEslintRules } from "./eslint-rules-template.js";
6
6
  import { writeEditorIntegration } from "./editor-integration.js";
7
7
  const _knownTargets = [
@@ -12,104 +12,10 @@ const _knownTargets = [
12
12
  frameworkPackage: '@typecad/framework-native',
13
13
  framework: 'native',
14
14
  },
15
- {
16
- id: 'arduino-uno',
17
- displayName: 'Arduino Uno',
18
- isNative: false,
19
- architecture: 'avr',
20
- boardPackage: '@typecad/board-arduino-uno',
21
- buildTarget: 'arduino:avr:uno',
22
- mcu: 'atmega328p',
23
- },
24
- {
25
- id: 'esp32-devkit',
26
- displayName: 'ESP32 DevKit',
27
- isNative: false,
28
- architecture: 'esp32',
29
- boardPackage: '@typecad/board-esp32-devkit',
30
- buildTarget: 'esp32:esp32:esp32',
31
- mcu: 'esp32',
32
- },
33
- {
34
- id: 'esp32s3',
35
- displayName: 'ESP32-S3',
36
- isNative: false,
37
- architecture: 'esp32s3',
38
- boardPackage: '@typecad/board-esp32s3',
39
- buildTarget: 'esp32:esp32:esp32s3',
40
- mcu: 'esp32s3',
41
- },
42
- {
43
- id: 'esp32c3',
44
- displayName: 'ESP32-C3',
45
- isNative: false,
46
- architecture: 'esp32c3',
47
- boardPackage: '@typecad/board-esp32c3',
48
- buildTarget: 'esp32:esp32:esp32c3',
49
- mcu: 'esp32c3',
50
- },
51
- {
52
- id: 'esp32c6',
53
- displayName: 'ESP32-C6',
54
- isNative: false,
55
- architecture: 'esp32c6',
56
- boardPackage: '@typecad/board-esp32c6',
57
- buildTarget: 'esp32:esp32:esp32c6',
58
- mcu: 'esp32c6',
59
- },
60
- {
61
- id: 'rp2040',
62
- displayName: 'RP2040 (Pico)',
63
- isNative: false,
64
- architecture: 'rp2040',
65
- boardPackage: '@typecad/board-rp2040',
66
- buildTarget: 'rp2040:rp2040:rpipico',
67
- mcu: 'rp2040',
68
- },
69
- {
70
- id: 'rp2350',
71
- displayName: 'RP2350 (Pico 2)',
72
- isNative: false,
73
- architecture: 'rp2350',
74
- boardPackage: '@typecad/board-rp2350',
75
- buildTarget: 'rp2040:rp2040:rpipico2',
76
- mcu: 'rp2350',
77
- },
78
- {
79
- id: 'xiao-nrf52840',
80
- displayName: 'XIAO nRF52840',
81
- isNative: false,
82
- architecture: 'nrf52',
83
- boardPackage: '@typecad/board-xiao-nrf52840',
84
- // Zephyr-only target: the build target is the `west build -b` board id,
85
- // not an Arduino FQBN (frameworkTargetProfile resolves it for Zephyr).
86
- buildTarget: 'xiao_ble/nrf52840',
87
- mcu: 'nrf52840',
88
- },
89
- {
90
- id: 'blackpill-f411ce',
91
- displayName: 'Black Pill (STM32F411)',
92
- isNative: false,
93
- architecture: 'stm32f411',
94
- boardPackage: '@typecad/board-blackpill-f411ce',
95
- // Zephyr-only target: the build target is the `west build -b` board id,
96
- // not an Arduino FQBN (frameworkTargetProfile resolves it for Zephyr).
97
- buildTarget: 'blackpill_f411ce/stm32f411xe',
98
- mcu: 'stm32f411',
99
- },
100
15
  ];
101
- export function registerKnownTarget(target) {
102
- const existing = _knownTargets.findIndex(t => t.id === target.id);
103
- if (existing >= 0) {
104
- _knownTargets[existing] = target;
105
- }
106
- else {
107
- _knownTargets.push(target);
108
- }
109
- }
16
+ // Bare-silicon (contract) targets were removed with the curated soc layer:
17
+ // every embedded target resolves through the board catalog like any other.
110
18
  export const KNOWN_TARGETS = _knownTargets;
111
- /** @deprecated Use KNOWN_TARGETS */
112
- export const KNOWN_BOARDS = _knownTargets;
113
19
  export function normalizeProjectName(name) {
114
20
  return name
115
21
  .toLowerCase()
@@ -151,18 +57,20 @@ export function scaffoldProject(options, outDir) {
151
57
  writeFile('.editorconfig', generateEditorconfig(options));
152
58
  // Editor integration: workspace-bundled VS Code extension for .ui syntax
153
59
  // highlighting (best-effort — warns and skips if the assets are missing).
154
- for (const file of writeEditorIntegration(resolvedOutDir))
60
+ // hideNpm: end-user projects are not npm packages — hide VS Code's NPM
61
+ // Scripts view and npm task detection.
62
+ for (const file of writeEditorIntegration(resolvedOutDir, undefined, true))
155
63
  createdFiles.push(file);
156
- if (options.boardPackage) {
157
- const boardFilePath = path.join(cuttlefishDir, 'board.ts');
158
- fs.writeFileSync(boardFilePath, generateBoardForwardingFile(options.boardPackage), 'utf-8');
159
- createdFiles.push(boardFilePath);
64
+ if (options.board) {
65
+ // Board-target projects materialize .cuttlefish/board.ts + board.json on
66
+ // the first build (config-loader → the framework's board generator);
67
+ // nothing to write here.
160
68
  }
161
- if (options.includeSketch) {
69
+ if (options.includeStarter) {
162
70
  const entryName = 'main.ts';
163
- const sketchPath = path.join(srcDir, entryName);
164
- fs.writeFileSync(sketchPath, generateStarterSketch(options), 'utf-8');
165
- createdFiles.push(sketchPath);
71
+ const entryPath = path.join(srcDir, entryName);
72
+ fs.writeFileSync(entryPath, generateStarterProgram(options), 'utf-8');
73
+ createdFiles.push(entryPath);
166
74
  }
167
75
  // Embedded projects get a starter hardware test (@typecad/expect / cuttlefish-test).
168
76
  // Native projects have no serial/board path, so they get no test setup.
@@ -205,7 +113,6 @@ export function printCreateNextSteps(options, outDir, opts = {}) {
205
113
  console.log(chalk.bold.white("To edit .ui files (VS Code):"));
206
114
  console.log(` ${chalk.cyan("open the folder and approve the workspace extension")} ${chalk.dim("(adds .ui syntax highlighting)")}`);
207
115
  if (!options.isNative) {
208
- const portHint = process.platform === 'win32' ? 'COM4' : '/dev/ttyACM0';
209
116
  console.log();
210
117
  console.log(chalk.bold.white("To simulate without hardware:"));
211
118
  console.log(` ${chalk.cyan("npm run simulate")}`);
@@ -215,7 +122,10 @@ export function printCreateNextSteps(options, outDir, opts = {}) {
215
122
  console.log();
216
123
  console.log(chalk.bold.white("To run hardware tests:"));
217
124
  console.log(` ${chalk.cyan("npm run test:hw")}`);
218
- console.log();
219
- console.log(chalk.dim(`Edit ${chalk.white("cuttlefish.config.ts")} to change the serial port from ${chalk.white(portHint)} to your port.`));
125
+ if (!options.port) {
126
+ const portHint = process.platform === 'win32' ? 'COM4' : '/dev/ttyACM0';
127
+ console.log();
128
+ console.log(chalk.dim(`No serial port was set — edit ${chalk.white("cuttlefish.config.ts")} to change ${chalk.white(portHint)} to your port (or pass --port on any command).`));
129
+ }
220
130
  }
221
131
  }
@@ -5,25 +5,52 @@ export interface CreateProjectOptions {
5
5
  targetDisplayName: string;
6
6
  isNative: boolean;
7
7
  architecture?: ArchitectureIdentifier;
8
- boardPackage?: string;
8
+ /** Qualified Zephyr board target (board-target projects). */
9
+ board?: string;
10
+ /** True when the board's devicetree declares an LED (pack fact — drives
11
+ * the starter between an I/O skeleton and LED-blink). */
12
+ hasLed?: boolean;
9
13
  frameworkPackage: string;
10
14
  framework: string;
11
15
  buildTarget?: string;
12
- mcu?: string;
16
+ /** Zephyr SoC name (bare-silicon / contract projects). */
17
+ soc?: string;
13
18
  baudRate?: number;
14
- includeSketch: boolean;
19
+ includeStarter: boolean;
15
20
  toolchainType?: string;
16
21
  /** Extra frameworkData fields (e.g. `{ target: 'esp32s3' }` for framework-esp32). */
17
22
  frameworkData?: Record<string, unknown>;
23
+ /** Selected probe-method id (Zephyr boards with a probeMethods table);
24
+ * emits the zephyr.probe section in the scaffolded config. */
25
+ probeMethod?: string;
26
+ /** Probe methods the board supports (wizard/catalog data) — used to write
27
+ * the config comment listing the alternatives. */
28
+ probeMethods?: {
29
+ id: string;
30
+ description?: string;
31
+ }[];
32
+ /** Pre-baked zephyr.runnerArgs for the selected probe method (from
33
+ * probeRunnerQuirks — board-catalog facts, e.g. an srst-based openocd.cfg
34
+ * behind a debug header with no NRST). Emitted after probe with an
35
+ * explanatory comment. */
36
+ probeRunnerArgs?: string[];
37
+ /** Serial port picked at create time (test.port). Absent →
38
+ * the platform hint placeholder. */
39
+ port?: string;
40
+ /** MCU-only Zephyr target: emit `zephyr.customBoard: true` so the framework
41
+ * generates an out-of-tree board named after the build target. */
42
+ zephyrCustomBoard?: boolean;
43
+ /** Starter-program pin for MCU-only targets (a port name — bare silicon has
44
+ * no board-level LED alias). */
45
+ starterPin?: string;
18
46
  }
19
47
  export declare function generateProjectPackageJson(options: CreateProjectOptions): string;
20
48
  export declare function generateProjectTsconfig(options: CreateProjectOptions): string;
21
49
  export declare function generateProjectConfig(options: CreateProjectOptions): string;
22
50
  export declare function generateProjectEnvDts(options: CreateProjectOptions): string;
23
- export declare function generateStarterSketch(options: CreateProjectOptions): string;
51
+ export declare function generateStarterProgram(options: CreateProjectOptions): string;
24
52
  export declare function generateStarterTest(_options: CreateProjectOptions): string;
25
53
  export declare function generateStarterSim(options: CreateProjectOptions): string;
26
- export declare function generateBoardForwardingFile(boardPackage: string): string;
27
54
  export declare function generateGitignore(_options: CreateProjectOptions): string;
28
55
  export declare function generateEditorconfig(_options: CreateProjectOptions): string;
29
56
  export declare function generateEslintConfig(_options: CreateProjectOptions): string;