@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.
- package/README.md +82 -79
- package/assets/editor-extensions/typecad-debug/README.md +141 -0
- package/assets/editor-extensions/typecad-debug/out/extension.js +347 -0
- package/assets/editor-extensions/typecad-debug/out/extension.js.map +1 -0
- package/assets/editor-extensions/typecad-debug/package.json +76 -0
- package/assets/editor-extensions/typecad-ui/LICENSE +27 -0
- package/assets/editor-extensions/typecad-ui/README.md +52 -0
- package/assets/editor-extensions/typecad-ui/file-icon-dark.png +0 -0
- package/assets/editor-extensions/typecad-ui/file-icon-light.png +0 -0
- package/assets/editor-extensions/typecad-ui/icon.png +0 -0
- package/assets/editor-extensions/typecad-ui/language-configuration.json +43 -0
- package/assets/editor-extensions/typecad-ui/package.json +54 -0
- package/assets/editor-extensions/typecad-ui/snippets/typecad-ui.json +80 -0
- package/assets/editor-extensions/typecad-ui/syntaxes/markdown-ui.json +45 -0
- package/assets/editor-extensions/typecad-ui/syntaxes/typecad-ui.tmLanguage.json +1269 -0
- package/dist/api/config.d.ts +30 -27
- package/dist/api/schema/types.d.ts +20 -3
- package/dist/api/shared/async-runtime-static.d.ts +1 -1
- package/dist/api/shared/async-runtime-static.js +5 -5
- package/dist/api/shared/async-types.d.ts +3 -2
- package/dist/api/shared/board-catalog.d.ts +2 -0
- package/dist/api/shared/board-catalog.js +6 -0
- package/dist/api/shared/board-resolver.d.ts +4 -7
- package/dist/api/shared/board-resolver.js +2 -1
- package/dist/api/shared/coop-scheduler.d.ts +1 -1
- package/dist/api/shared/coop-scheduler.js +1 -1
- package/dist/api/shared/cpp-type-ir.d.ts +1 -1
- package/dist/api/shared/cpp-type-ir.js +1 -1
- package/dist/api/shared/display-profile.d.ts +1 -1
- package/dist/api/shared/display-profile.js +3 -5
- package/dist/api/shared/framework-manifest-registry.d.ts +1 -1
- package/dist/api/shared/framework-manifest-registry.js +0 -1
- package/dist/api/shared/framework-manifest.d.ts +65 -507
- package/dist/api/shared/framework-manifest.js +6 -11
- package/dist/api/shared/hal-op-ir.d.ts +294 -685
- package/dist/api/shared/hal-op-ir.js +31 -65
- package/dist/api/shared/index.d.ts +0 -4
- package/dist/api/shared/index.js +1 -7
- package/dist/api/shared/ir-core.d.ts +6 -0
- package/dist/api/shared/ir-declarations.d.ts +4 -0
- package/dist/api/shared/ir.d.ts +1 -3
- package/dist/api/shared/platform-strategy.d.ts +14 -37
- package/dist/api/shared/polyfill-helper-registry.js +0 -5
- package/dist/api/shared/polyfill-types.js +0 -27
- package/dist/api/shared/promise-runtime.js +3 -3
- package/dist/api/shared/spdx-licenses.d.ts +12 -10
- package/dist/api/shared/spdx-licenses.js +1 -1
- package/dist/api/shared/toolchain-types.d.ts +1 -1
- package/dist/api/shared/toolchain-types.js +3 -3
- package/dist/api/shared/types.d.ts +0 -3
- package/dist/api/shared/validate-framework-manifest.js +13 -33
- package/dist/board-catalog/dts-reader.d.ts +220 -0
- package/dist/board-catalog/dts-reader.js +1052 -0
- package/dist/board-catalog/index.d.ts +11 -0
- package/dist/board-catalog/index.js +12 -0
- package/dist/board-catalog/pinconfig.d.ts +48 -0
- package/dist/board-catalog/pinconfig.js +263 -0
- package/dist/board-catalog/sdk.d.ts +82 -0
- package/dist/board-catalog/sdk.js +180 -0
- package/dist/board-catalog/store.d.ts +196 -0
- package/dist/board-catalog/store.js +363 -0
- package/dist/board-catalog/types.d.ts +233 -0
- package/dist/board-catalog/types.js +7 -0
- package/dist/board-catalog/walker.d.ts +112 -0
- package/dist/board-catalog/walker.js +1101 -0
- package/dist/cli-utils.d.ts +2 -2
- package/dist/cli-utils.js +5 -5
- package/dist/cli.js +227 -244
- package/dist/config-loader.d.ts +14 -19
- package/dist/config-loader.js +242 -78
- package/dist/config-schema.d.ts +19 -227
- package/dist/config-schema.js +9 -8
- package/dist/contract/board-generator.d.ts +4 -4
- package/dist/contract/board-generator.js +16 -5
- package/dist/contract/contract-parser.d.ts +36 -127
- package/dist/contract/contract-parser.js +76 -0
- package/dist/contract/index.d.ts +1 -1
- package/dist/contract/index.js +70 -21
- package/dist/create/active-board-catalog.d.ts +9 -0
- package/dist/create/active-board-catalog.js +94 -0
- package/dist/create/board-catalog.generated.d.ts +96 -0
- package/dist/create/board-catalog.generated.js +128737 -0
- package/dist/create/board-search.d.ts +23 -0
- package/dist/create/board-search.js +88 -0
- package/dist/create/editor-integration.d.ts +32 -0
- package/dist/create/editor-integration.js +257 -0
- package/dist/create/eslint-rules-template.d.ts +2 -2
- package/dist/create/framework-catalog.d.ts +48 -8
- package/dist/create/framework-catalog.js +58 -44
- package/dist/create/index.d.ts +8 -13
- package/dist/create/index.js +5 -9
- package/dist/create/mcu-target.d.ts +39 -0
- package/dist/create/mcu-target.js +80 -0
- package/dist/create/pack-targets.d.ts +19 -0
- package/dist/create/pack-targets.js +56 -0
- package/dist/create/{init-scaffold.d.ts → scaffold.d.ts} +8 -11
- package/dist/create/{init-scaffold.js → scaffold.js} +28 -87
- package/dist/create/templates.d.ts +51 -0
- package/dist/create/{init-templates.js → templates.js} +135 -116
- package/dist/create/wizard.d.ts +19 -0
- package/dist/create/wizard.js +314 -0
- package/dist/debug/preprocessor.d.ts +5 -0
- package/dist/debug/preprocessor.js +31 -7
- package/dist/diagnostics/diagnostics-report.d.ts +1 -1
- package/dist/diagnostics/diagnostics-report.js +3 -11
- package/dist/diagnostics/json-schema.d.ts +1 -1
- package/dist/diagnostics/md-writer.js +2 -2
- package/dist/diagnostics/mermaid-builder.d.ts +1 -1
- package/dist/diagnostics/mermaid-builder.js +1 -1
- package/dist/emit/cpp-emitter.js +4 -1
- package/dist/emit/emitters/class-emitter.js +32 -4
- package/dist/emit/emitters/emitter-context.d.ts +11 -0
- package/dist/emit/emitters/entrypoint-synthesizer.js +1 -1
- package/dist/emit/emitters/function-emitter-impl.js +33 -17
- package/dist/emit/emitters/output-finalizer.d.ts +7 -0
- package/dist/emit/emitters/output-finalizer.js +31 -23
- package/dist/emit/emitters/setup.js +147 -63
- package/dist/emit/emitters/top-level-prep.js +1 -1
- package/dist/emit/emitters/type-decl-emitter.js +13 -8
- package/dist/emit/emitters/ui-emitter.js +1 -1
- package/dist/emit/expression-renderer.d.ts +3 -3
- package/dist/emit/expression-renderer.js +17 -7
- package/dist/emit/route-hal-op.js +17 -48
- package/dist/emit/snprintf-helpers.d.ts +1 -3
- package/dist/emit/snprintf-helpers.js +1 -39
- package/dist/emit/statement-renderer.d.ts +0 -4
- package/dist/emit/statement-renderer.js +54 -45
- package/dist/emit/utils/async-state-machine.d.ts +16 -9
- package/dist/emit/utils/async-state-machine.js +56 -54
- package/dist/emit/utils/comment-helpers.d.ts +0 -8
- package/dist/emit/utils/comment-helpers.js +1 -1
- package/dist/emit/utils/cpp-helpers.d.ts +2 -2
- package/dist/emit/utils/cpp-helpers.js +2 -2
- package/dist/emit/utils/hal-op-cpp-type.js +4 -6
- package/dist/emit/utils/index.d.ts +3 -3
- package/dist/emit/utils/index.js +3 -3
- package/dist/emit/utils/type-inference.d.ts +1 -29
- package/dist/emit/utils/type-inference.js +0 -75
- package/dist/framework-package.d.ts +3 -0
- package/dist/framework-package.js +23 -6
- package/dist/framework-registry.d.ts +5 -5
- package/dist/frameworks/native/graphics/terminal-preview.d.ts +5 -0
- package/dist/frameworks/native/graphics/terminal-preview.js +33 -0
- package/dist/frameworks/native/index.d.ts +3 -0
- package/dist/frameworks/native/index.js +15 -0
- package/dist/frameworks/native/native-compile.d.ts +17 -0
- package/dist/frameworks/native/native-compile.js +170 -0
- package/dist/frameworks/native/native-config.d.ts +41 -0
- package/dist/frameworks/native/native-config.js +7 -0
- package/dist/frameworks/native/strategy.d.ts +97 -0
- package/dist/frameworks/native/strategy.js +664 -0
- package/dist/ir/board-resolver.d.ts +18 -23
- package/dist/ir/board-resolver.js +43 -401
- package/dist/ir/build-ir-state.d.ts +3 -0
- package/dist/ir/build-ir-state.js +42 -0
- package/dist/ir/build-ir.d.ts +1 -1
- package/dist/ir/build-ir.js +64 -45
- package/dist/ir/declaration-builders.js +1 -0
- package/dist/ir/expression-to-ir.js +17 -10
- package/dist/ir/hal/hal-emitter.d.ts +0 -2
- package/dist/ir/hal/hal-emitter.js +92 -41
- package/dist/ir/hal/hal-parser.d.ts +5 -5
- package/dist/ir/hal/hal-parser.js +128 -36
- package/dist/ir/hal/hal-plugins.d.ts +0 -1
- package/dist/ir/hal/hal-plugins.js +425 -716
- package/dist/ir/heap-analysis.js +2 -41
- package/dist/ir/identifier-collector.js +32 -20
- package/dist/ir/network-validation.js +7 -11
- package/dist/ir/ownership-analysis.js +75 -13
- package/dist/ir/peripheral-usage.d.ts +8 -2
- package/dist/ir/peripheral-usage.js +78 -149
- package/dist/ir/peripheral-validation.js +23 -3
- package/dist/ir/pin-capability-validation.d.ts +12 -0
- package/dist/ir/pin-capability-validation.js +61 -97
- package/dist/ir/pin-mode-validation.js +5 -5
- package/dist/ir/program-analysis.d.ts +8 -15
- package/dist/ir/program-analysis.js +140 -323
- package/dist/ir/pulldown-validation.js +11 -4
- package/dist/ir/resource-analysis.js +15 -3
- package/dist/ir/statement-to-ir.js +0 -6
- package/dist/ir/timing-validation.js +1 -1
- package/dist/ir/transformers/array-methods.js +11 -5
- package/dist/ir/transformers/call-statement.js +20 -87
- package/dist/ir/transformers/callback-context-registry.d.ts +1 -1
- package/dist/ir/transformers/callback-context-registry.js +8 -16
- package/dist/ir/transformers/control-flow.js +0 -13
- package/dist/ir/transformers/expressions.js +10 -9
- package/dist/ir/transformers/hal-call-resolver.d.ts +2 -2
- package/dist/ir/transformers/hal-call-resolver.js +24 -10
- package/dist/ir/transformers/hal-emit-helpers.d.ts +2 -2
- package/dist/ir/transformers/hal-emit-helpers.js +2 -2
- package/dist/ir/transformers/namespace-methods.js +1 -1
- package/dist/ir/transformers/ui-callback-lowering.d.ts +0 -2
- package/dist/ir/transformers/ui-callback-lowering.js +0 -24
- package/dist/ir/transformers/variables.js +338 -42
- package/dist/ir/try-catch-validation.js +4 -3
- package/dist/ir/type-resolution.js +15 -4
- package/dist/ir/validation-orchestrator.js +0 -9
- package/dist/libdef/cpp-to-decl.d.ts +0 -9
- package/dist/libdef/cpp-to-decl.js +0 -72
- package/dist/libdef/registry.d.ts +0 -1
- package/dist/libdef/registry.js +1 -24
- package/dist/library/catalog.d.ts +35 -0
- package/dist/library/catalog.js +67 -0
- package/dist/library/cli.d.ts +2 -0
- package/dist/library/cli.js +168 -0
- package/dist/library/init.d.ts +25 -0
- package/dist/library/init.js +397 -0
- package/dist/library/install.d.ts +9 -0
- package/dist/library/install.js +80 -0
- package/dist/library/registry-search.d.ts +34 -0
- package/dist/library/registry-search.js +50 -0
- package/dist/library/validate.d.ts +17 -0
- package/dist/library/validate.js +175 -0
- package/dist/library-packages.d.ts +95 -0
- package/dist/library-packages.js +275 -0
- package/dist/mapping/peripheral-names.js +9 -4
- package/dist/mapping/source-map.d.ts +3 -4
- package/dist/mapping/source-map.js +12 -18
- package/dist/orchestrator/graph-builder.d.ts +3 -3
- package/dist/orchestrator/graph-builder.js +29 -12
- package/dist/orchestrator/type-checker.d.ts +3 -3
- package/dist/orchestrator/type-checker.js +3 -3
- package/dist/platform/async-runtime.js +1 -1
- package/dist/platform/coop-scheduler-runtime.js +2 -2
- package/dist/platform/generic-debug-codegen.d.ts +36 -0
- package/dist/platform/generic-debug-codegen.js +185 -0
- package/dist/platform/generic-strategy.d.ts +3 -4
- package/dist/platform/generic-strategy.js +5 -80
- package/dist/platform/index.js +1 -1
- package/dist/platform/registry.d.ts +2 -2
- package/dist/platform/registry.js +2 -2
- package/dist/preview/client.js +17 -3
- package/dist/safety/asil-decorators.d.ts +32 -0
- package/dist/safety/asil-decorators.js +32 -0
- package/dist/safety/authoring.d.ts +85 -0
- package/dist/safety/authoring.js +61 -0
- package/dist/safety/engine.d.ts +3 -0
- package/dist/safety/engine.js +83 -0
- package/dist/safety/hal/ops.d.ts +48 -0
- package/dist/safety/hal/ops.js +46 -0
- package/dist/safety/iso26262/analyze.d.ts +13 -0
- package/dist/safety/iso26262/analyze.js +29 -0
- package/dist/safety/iso26262/asil.d.ts +10 -0
- package/dist/safety/iso26262/asil.js +22 -0
- package/dist/safety/iso26262/collect.d.ts +14 -0
- package/dist/safety/iso26262/collect.js +137 -0
- package/dist/safety/iso26262/goto-checker.d.ts +10 -0
- package/dist/safety/iso26262/goto-checker.js +72 -0
- package/dist/safety/iso26262/heap-checker.d.ts +7 -0
- package/dist/safety/iso26262/heap-checker.js +57 -0
- package/dist/safety/iso26262/init-checker.d.ts +13 -0
- package/dist/safety/iso26262/init-checker.js +127 -0
- package/dist/safety/iso26262/loop-checker.d.ts +7 -0
- package/dist/safety/iso26262/loop-checker.js +86 -0
- package/dist/safety/iso26262/recursion-checker.d.ts +9 -0
- package/dist/safety/iso26262/recursion-checker.js +134 -0
- package/dist/safety/iso26262/sidecar-writer.d.ts +25 -0
- package/dist/safety/iso26262/sidecar-writer.js +13 -0
- package/dist/safety/passes/pinMode-intercept.d.ts +3 -0
- package/dist/safety/passes/pinMode-intercept.js +60 -0
- package/dist/safety/runtime/mode-table.d.ts +5 -0
- package/dist/safety/runtime/mode-table.js +55 -0
- package/dist/safety/runtime/polyfills.d.ts +6 -0
- package/dist/safety/runtime/polyfills.js +12 -0
- package/dist/safety/runtime/result-struct.d.ts +11 -0
- package/dist/safety/runtime/result-struct.js +98 -0
- package/dist/safety/runtime/safe-int.d.ts +33 -0
- package/dist/safety/runtime/safe-int.js +170 -0
- package/dist/safety/runtime/safe-traits.d.ts +4 -0
- package/dist/safety/runtime/safe-traits.js +95 -0
- package/dist/safety/runtime/safe-variable.d.ts +39 -0
- package/dist/safety/runtime/safe-variable.js +226 -0
- package/dist/safety/runtime/vote.d.ts +8 -0
- package/dist/safety/runtime/vote.js +92 -0
- package/dist/safety/runtime/write-verify.d.ts +8 -0
- package/dist/safety/runtime/write-verify.js +71 -0
- package/dist/safety/safe-int-types.d.ts +45 -0
- package/dist/safety/safe-int-types.js +25 -0
- package/dist/safety/safe-variable-types.d.ts +29 -0
- package/dist/safety/safe-variable-types.js +19 -0
- package/dist/safety/safety-bridge.d.ts +5 -6
- package/dist/safety/safety-bridge.js +15 -28
- package/dist/safety/sidecar-bridge.d.ts +1 -3
- package/dist/safety/sidecar-bridge.js +3 -20
- package/dist/safety/specifiers.d.ts +6 -0
- package/dist/safety/specifiers.js +14 -0
- package/dist/safety-hook.d.ts +8 -7
- package/dist/safety-hook.js +12 -13
- package/dist/testing.d.ts +5 -6
- package/dist/testing.js +5 -5
- package/dist/transpile/resolution.d.ts +1 -1
- package/dist/transpile/resolution.js +18 -9
- package/dist/transpile/test-pins.d.ts +18 -0
- package/dist/transpile/test-pins.js +142 -0
- package/dist/transpile.d.ts +1 -2
- package/dist/transpile.js +90 -29
- package/dist/types.d.ts +45 -26
- package/dist/ui-hook.d.ts +1 -1
- package/dist/utils/cli.d.ts +2 -2
- package/dist/utils/cli.js +160 -157
- package/dist/utils/fs.d.ts +3 -4
- package/dist/utils/fs.js +4 -5
- package/dist/utils/strings.d.ts +0 -1
- package/dist/utils/strings.js +0 -8
- package/dist/utils/ui.d.ts +5 -2
- package/dist/utils/ui.js +13 -3
- package/package.json +158 -149
- package/dist/add-preset.d.ts +0 -4
- package/dist/add-preset.js +0 -74
- package/dist/api/shared/async-symbol-detector.d.ts +0 -11
- package/dist/api/shared/async-symbol-detector.js +0 -140
- package/dist/api/shared/native-display-op-resolver.d.ts +0 -10
- package/dist/api/shared/native-display-op-resolver.js +0 -64
- package/dist/create/board-checklist.d.ts +0 -2
- package/dist/create/board-checklist.js +0 -52
- package/dist/create/board-codegen.d.ts +0 -9
- package/dist/create/board-codegen.js +0 -238
- package/dist/create/board-generators.d.ts +0 -12
- package/dist/create/board-generators.js +0 -651
- package/dist/create/board-spec.d.ts +0 -637
- package/dist/create/board-spec.js +0 -214
- package/dist/create/init-templates.d.ts +0 -28
- package/dist/create/init-wizard.d.ts +0 -8
- package/dist/create/init-wizard.js +0 -182
- package/dist/install/framework-catalog.d.ts +0 -53
- package/dist/install/framework-catalog.js +0 -107
- package/dist/install/handle-install.d.ts +0 -35
- package/dist/install/handle-install.js +0 -177
- package/dist/install/index.d.ts +0 -4
- package/dist/install/index.js +0 -3
- package/dist/ir/pin-state-tracking.d.ts +0 -58
- package/dist/ir/pin-state-tracking.js +0 -182
- package/dist/ir/pwm-timer-sharing.d.ts +0 -4
- package/dist/ir/pwm-timer-sharing.js +0 -94
- package/dist/ir/timer0-pwm-timing-conflict.d.ts +0 -4
- package/dist/ir/timer0-pwm-timing-conflict.js +0 -72
- package/dist/libdef/component-decls.d.ts +0 -2
- package/dist/libdef/component-decls.js +0 -6
- package/dist/libdef/component-discovery.d.ts +0 -43
- package/dist/libdef/component-discovery.js +0 -83
- package/dist/theme-tokens.d.ts +0 -22
- 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
|
|
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
|
|
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:
|
|
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-
|
|
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
|
|
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,
|
|
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 (
|
|
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-
|
|
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(` #
|
|
155
|
-
console.log(` cuttlefish create my-project --target
|
|
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
|
|
167
|
-
console.log(` cuttlefish
|
|
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
|
|
170
|
-
console.log(` cuttlefish
|
|
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
|
|
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
|
|
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
|
|
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(` #
|
|
185
|
-
console.log(` cuttlefish
|
|
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
|
-
|
|
235
|
-
//
|
|
236
|
-
//
|
|
237
|
-
//
|
|
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
|
|
302
|
-
// setting the port in
|
|
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
|
|
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
|
-
|
|
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
|
-
//
|
|
445
|
-
|
|
446
|
-
|
|
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
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
const
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
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
|
-
|
|
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 (
|
|
547
|
-
|
|
565
|
+
if (tok.startsWith("-")) {
|
|
566
|
+
continue; // boolean flag (e.g. --all) or unknown flag — ignore
|
|
548
567
|
}
|
|
549
|
-
|
|
550
|
-
|
|
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
|
-
|
|
570
|
-
|
|
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)
|
package/dist/utils/fs.d.ts
CHANGED
|
@@ -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
|
|
12
|
-
*
|
|
13
|
-
*
|
|
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 (
|
|
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
|
|
54
|
-
*
|
|
55
|
-
*
|
|
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).
|
package/dist/utils/strings.d.ts
CHANGED
|
@@ -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;
|
package/dist/utils/strings.js
CHANGED
|
@@ -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
|
-
}
|
package/dist/utils/ui.d.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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
|