@typecad/cuttlefish 1.0.0-alpha.13 → 1.0.0-alpha.14
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/assets/editor-extensions/typecad-debug/README.md +142 -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 +8 -1
- package/dist/api/shared/framework-manifest.d.ts +61 -504
- package/dist/cli.js +17 -6
- package/dist/config-loader.js +3 -1
- package/dist/config-schema.d.ts +17 -223
- package/dist/config-schema.js +1 -0
- package/dist/contract/contract-parser.d.ts +9 -127
- package/dist/create/board-checklist.js +1 -1
- package/dist/create/board-codegen.js +4 -4
- package/dist/create/board-spec.d.ts +74 -530
- package/dist/create/editor-integration.d.ts +30 -0
- package/dist/create/editor-integration.js +218 -0
- package/dist/create/eslint-rules-template.d.ts +2 -2
- package/dist/create/framework-catalog.d.ts +8 -0
- package/dist/create/framework-catalog.js +28 -5
- package/dist/create/index.d.ts +7 -6
- package/dist/create/index.js +5 -4
- package/dist/create/{init-scaffold.d.ts → scaffold.d.ts} +4 -4
- package/dist/create/{init-scaffold.js → scaffold.js} +33 -2
- package/dist/create/templates.d.ts +29 -0
- package/dist/create/{init-templates.js → templates.js} +15 -0
- package/dist/create/wizard.d.ts +8 -0
- package/dist/create/{init-wizard.js → wizard.js} +11 -4
- package/dist/emit/emitters/setup.js +22 -0
- package/dist/ir/build-ir.js +24 -3
- 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/orchestrator/graph-builder.js +16 -0
- package/dist/preview/client.js +17 -3
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +1 -1
- package/dist/transpile.js +55 -0
- package/dist/types.d.ts +19 -0
- package/dist/utils/cli.d.ts +2 -2
- package/dist/utils/cli.js +68 -3
- package/package.json +16 -8
- package/dist/create/init-templates.d.ts +0 -28
- package/dist/create/init-wizard.d.ts +0 -8
package/dist/cli.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import { parseCommandLine, printHelp } from "./utils/cli.js";
|
|
5
|
-
import {
|
|
5
|
+
import { runLibraryCommand } from "./library/cli.js";
|
|
6
|
+
import { scaffoldProject, printCreateNextSteps, KNOWN_TARGETS, frameworksForTarget, frameworkCatalogEntry, frameworkCompatibleWithTarget, FRAMEWORK_CATALOG, frameworkTargetProfile } from "./create/index.js";
|
|
6
7
|
import { generateFrameworkDebugArtifacts } from "./create/debug-artifacts.js";
|
|
7
|
-
import {
|
|
8
|
+
import { runCreateWizard } from "./create/index.js";
|
|
8
9
|
import { installProjectDependencies } from "./create/install-deps.js";
|
|
9
10
|
import { generateLibraryDefinitions, transpileFile } from "./transpile.js";
|
|
10
11
|
import { generateDecl, generateDeclsForDirectory, generateComponentDeclsForProject } from "./libdef/cpp-to-decl.js";
|
|
@@ -65,8 +66,9 @@ async function handleCreate(options) {
|
|
|
65
66
|
const available = KNOWN_TARGETS.map(t => ` - ${t.id} (${t.displayName})`).join("\n");
|
|
66
67
|
throw new Error(`Unknown target '${targetId}'. Available targets:\n${available}`);
|
|
67
68
|
}
|
|
68
|
-
// Resolve the framework. --framework wins
|
|
69
|
-
//
|
|
69
|
+
// Resolve the framework. --framework wins (validated against the board's
|
|
70
|
+
// compatible set); otherwise narrow via the catalog for the chosen board
|
|
71
|
+
// and auto-pick when exactly one is compatible.
|
|
70
72
|
let frameworkId;
|
|
71
73
|
let frameworkPackage;
|
|
72
74
|
if (options.framework) {
|
|
@@ -75,6 +77,11 @@ async function handleCreate(options) {
|
|
|
75
77
|
const available = FRAMEWORK_CATALOG.filter(f => f.installable).map(f => f.id).join(", ");
|
|
76
78
|
throw new Error(`Unknown framework '${options.framework}'. Available: ${available}`);
|
|
77
79
|
}
|
|
80
|
+
if (!frameworkCompatibleWithTarget(target, requested.id)) {
|
|
81
|
+
const list = frameworksForTarget(target).filter(f => f.installable).map(f => f.id).join(", ");
|
|
82
|
+
throw new Error(`Framework '${requested.id}' is not compatible with target '${target.id}' (${target.displayName}). ` +
|
|
83
|
+
`Compatible frameworks: ${list}`);
|
|
84
|
+
}
|
|
78
85
|
frameworkId = requested.id;
|
|
79
86
|
frameworkPackage = requested.packageName;
|
|
80
87
|
}
|
|
@@ -115,7 +122,7 @@ async function handleCreate(options) {
|
|
|
115
122
|
finalizeCreate(result, options);
|
|
116
123
|
}
|
|
117
124
|
else {
|
|
118
|
-
const wizardResult = await
|
|
125
|
+
const wizardResult = await runCreateWizard({
|
|
119
126
|
projectName: options.projectName,
|
|
120
127
|
board: options.board,
|
|
121
128
|
framework: options.framework,
|
|
@@ -170,7 +177,7 @@ function finalizeCreate(result, options) {
|
|
|
170
177
|
if (debugArtifacts.length > 0) {
|
|
171
178
|
console.log(`\n${chalk.green("✓")} Debug profile: ${debugArtifacts.map((f) => chalk.white(f)).join(", ")}`);
|
|
172
179
|
}
|
|
173
|
-
|
|
180
|
+
printCreateNextSteps(result.options, result.outDir, { installed, debugProfile: debugArtifacts.length > 0 });
|
|
174
181
|
}
|
|
175
182
|
async function handleBoardAdd(options) {
|
|
176
183
|
const { scaffoldBoardPackages, parseBoardSpec, generateFrameworkChecklist } = await import("./create/index.js");
|
|
@@ -203,6 +210,10 @@ async function main() {
|
|
|
203
210
|
await handleBoardAdd(options);
|
|
204
211
|
return;
|
|
205
212
|
}
|
|
213
|
+
if (options.command === "library") {
|
|
214
|
+
await runLibraryCommand(options);
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
206
217
|
if (options.command === "preview") {
|
|
207
218
|
await runPreviewServer({
|
|
208
219
|
configPath: options.configPath,
|
package/dist/config-loader.js
CHANGED
|
@@ -450,11 +450,13 @@ export function parseConfigFile(configPath) {
|
|
|
450
450
|
// Parse zephyr-specific config section.
|
|
451
451
|
const zephyrKconfig = extractStringRecord(configObject, ["zephyr", "kconfig"], warn);
|
|
452
452
|
const zephyrCmakeArgs = extractStringArray(configObject, ["zephyr", "cmakeArgs"], warn);
|
|
453
|
+
const zephyrRunnerArgs = extractStringArray(configObject, ["zephyr", "runnerArgs"], warn);
|
|
453
454
|
const zephyrRunner = flat.get("zephyr.runner");
|
|
454
|
-
if (zephyrKconfig || zephyrCmakeArgs || typeof zephyrRunner === "string") {
|
|
455
|
+
if (zephyrKconfig || zephyrCmakeArgs || zephyrRunnerArgs || typeof zephyrRunner === "string") {
|
|
455
456
|
resolved.zephyrConfig = {
|
|
456
457
|
...(zephyrKconfig ? { kconfig: zephyrKconfig } : {}),
|
|
457
458
|
...(zephyrCmakeArgs ? { cmakeArgs: zephyrCmakeArgs } : {}),
|
|
459
|
+
...(zephyrRunnerArgs ? { runnerArgs: zephyrRunnerArgs } : {}),
|
|
458
460
|
...(typeof zephyrRunner === "string" ? { runner: zephyrRunner } : {}),
|
|
459
461
|
};
|
|
460
462
|
}
|
package/dist/config-schema.d.ts
CHANGED
|
@@ -4,257 +4,51 @@ import { z } from 'zod';
|
|
|
4
4
|
*
|
|
5
5
|
* `target` and `board` are required. Everything else is optional.
|
|
6
6
|
*/
|
|
7
|
-
export declare const CuttlefishConfigSchema: z.
|
|
7
|
+
export declare const CuttlefishConfigSchema: z.ZodObject<{
|
|
8
8
|
entry: z.ZodOptional<z.ZodString>;
|
|
9
9
|
target: z.ZodOptional<z.ZodString>;
|
|
10
10
|
mcu: z.ZodOptional<z.ZodString>;
|
|
11
11
|
board: z.ZodOptional<z.ZodString>;
|
|
12
12
|
contract: z.ZodOptional<z.ZodString>;
|
|
13
13
|
framework: z.ZodOptional<z.ZodString>;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
psram: z.ZodOptional<z.ZodEnum<["opi", "quad"]>>;
|
|
14
|
+
psram: z.ZodOptional<z.ZodEnum<{
|
|
15
|
+
opi: "opi";
|
|
16
|
+
quad: "quad";
|
|
17
|
+
}>>;
|
|
19
18
|
output: z.ZodOptional<z.ZodObject<{
|
|
20
19
|
framework: z.ZodOptional<z.ZodString>;
|
|
21
20
|
outDir: z.ZodOptional<z.ZodString>;
|
|
22
21
|
defines: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
23
|
-
extraFlags: z.ZodOptional<z.ZodArray<z.ZodString
|
|
24
|
-
},
|
|
25
|
-
framework?: string | undefined;
|
|
26
|
-
outDir?: string | undefined;
|
|
27
|
-
defines?: Record<string, string> | undefined;
|
|
28
|
-
extraFlags?: string[] | undefined;
|
|
29
|
-
}, {
|
|
30
|
-
framework?: string | undefined;
|
|
31
|
-
outDir?: string | undefined;
|
|
32
|
-
defines?: Record<string, string> | undefined;
|
|
33
|
-
extraFlags?: string[] | undefined;
|
|
34
|
-
}>>;
|
|
22
|
+
extraFlags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
23
|
+
}, z.core.$strict>>;
|
|
35
24
|
frameworkData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
36
|
-
include: z.ZodOptional<z.ZodArray<z.ZodString
|
|
37
|
-
exclude: z.ZodOptional<z.ZodArray<z.ZodString
|
|
25
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
26
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
38
27
|
test: z.ZodOptional<z.ZodObject<{
|
|
39
|
-
include: z.ZodOptional<z.ZodArray<z.ZodString
|
|
28
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
40
29
|
port: z.ZodOptional<z.ZodString>;
|
|
41
30
|
baudRate: z.ZodOptional<z.ZodNumber>;
|
|
42
31
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
43
32
|
buildTarget: z.ZodOptional<z.ZodString>;
|
|
44
33
|
board: z.ZodOptional<z.ZodString>;
|
|
45
|
-
},
|
|
46
|
-
board?: string | undefined;
|
|
47
|
-
include?: string[] | undefined;
|
|
48
|
-
port?: string | undefined;
|
|
49
|
-
baudRate?: number | undefined;
|
|
50
|
-
timeout?: number | undefined;
|
|
51
|
-
buildTarget?: string | undefined;
|
|
52
|
-
}, {
|
|
53
|
-
board?: string | undefined;
|
|
54
|
-
include?: string[] | undefined;
|
|
55
|
-
port?: string | undefined;
|
|
56
|
-
baudRate?: number | undefined;
|
|
57
|
-
timeout?: number | undefined;
|
|
58
|
-
buildTarget?: string | undefined;
|
|
59
|
-
}>>;
|
|
34
|
+
}, z.core.$strict>>;
|
|
60
35
|
toolchain: z.ZodOptional<z.ZodObject<{
|
|
61
36
|
type: z.ZodOptional<z.ZodString>;
|
|
62
37
|
frameworkOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
63
|
-
},
|
|
64
|
-
type?: string | undefined;
|
|
65
|
-
frameworkOptions?: Record<string, unknown> | undefined;
|
|
66
|
-
}, {
|
|
67
|
-
type?: string | undefined;
|
|
68
|
-
frameworkOptions?: Record<string, unknown> | undefined;
|
|
69
|
-
}>>;
|
|
38
|
+
}, z.core.$strict>>;
|
|
70
39
|
console: z.ZodOptional<z.ZodObject<{
|
|
71
40
|
baudRate: z.ZodOptional<z.ZodNumber>;
|
|
72
41
|
port: z.ZodOptional<z.ZodString>;
|
|
73
|
-
},
|
|
74
|
-
port?: string | undefined;
|
|
75
|
-
baudRate?: number | undefined;
|
|
76
|
-
}, {
|
|
77
|
-
port?: string | undefined;
|
|
78
|
-
baudRate?: number | undefined;
|
|
79
|
-
}>>;
|
|
42
|
+
}, z.core.$strict>>;
|
|
80
43
|
native: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
81
|
-
/** Display profile config (driver, wiring, touch) — loosely typed here so
|
|
82
|
-
* the loader's presence/shape extraction round-trips through validation. */
|
|
83
44
|
display: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
84
45
|
zephyr: z.ZodOptional<z.ZodObject<{
|
|
85
46
|
kconfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
86
|
-
cmakeArgs: z.ZodOptional<z.ZodArray<z.ZodString
|
|
47
|
+
cmakeArgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
87
48
|
runner: z.ZodOptional<z.ZodString>;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
runner?: string | undefined;
|
|
92
|
-
}, {
|
|
93
|
-
kconfig?: Record<string, string> | undefined;
|
|
94
|
-
cmakeArgs?: string[] | undefined;
|
|
95
|
-
runner?: string | undefined;
|
|
96
|
-
}>>;
|
|
97
|
-
}, "strict", z.ZodTypeAny, {
|
|
98
|
-
entry?: string | undefined;
|
|
99
|
-
target?: string | undefined;
|
|
100
|
-
mcu?: string | undefined;
|
|
101
|
-
board?: string | undefined;
|
|
102
|
-
contract?: string | undefined;
|
|
103
|
-
framework?: string | undefined;
|
|
104
|
-
psram?: "opi" | "quad" | undefined;
|
|
105
|
-
output?: {
|
|
106
|
-
framework?: string | undefined;
|
|
107
|
-
outDir?: string | undefined;
|
|
108
|
-
defines?: Record<string, string> | undefined;
|
|
109
|
-
extraFlags?: string[] | undefined;
|
|
110
|
-
} | undefined;
|
|
111
|
-
frameworkData?: Record<string, unknown> | undefined;
|
|
112
|
-
include?: string[] | undefined;
|
|
113
|
-
exclude?: string[] | undefined;
|
|
114
|
-
test?: {
|
|
115
|
-
board?: string | undefined;
|
|
116
|
-
include?: string[] | undefined;
|
|
117
|
-
port?: string | undefined;
|
|
118
|
-
baudRate?: number | undefined;
|
|
119
|
-
timeout?: number | undefined;
|
|
120
|
-
buildTarget?: string | undefined;
|
|
121
|
-
} | undefined;
|
|
122
|
-
toolchain?: {
|
|
123
|
-
type?: string | undefined;
|
|
124
|
-
frameworkOptions?: Record<string, unknown> | undefined;
|
|
125
|
-
} | undefined;
|
|
126
|
-
console?: {
|
|
127
|
-
port?: string | undefined;
|
|
128
|
-
baudRate?: number | undefined;
|
|
129
|
-
} | undefined;
|
|
130
|
-
native?: Record<string, unknown> | undefined;
|
|
131
|
-
display?: Record<string, unknown> | undefined;
|
|
132
|
-
zephyr?: {
|
|
133
|
-
kconfig?: Record<string, string> | undefined;
|
|
134
|
-
cmakeArgs?: string[] | undefined;
|
|
135
|
-
runner?: string | undefined;
|
|
136
|
-
} | undefined;
|
|
137
|
-
}, {
|
|
138
|
-
entry?: string | undefined;
|
|
139
|
-
target?: string | undefined;
|
|
140
|
-
mcu?: string | undefined;
|
|
141
|
-
board?: string | undefined;
|
|
142
|
-
contract?: string | undefined;
|
|
143
|
-
framework?: string | undefined;
|
|
144
|
-
psram?: "opi" | "quad" | undefined;
|
|
145
|
-
output?: {
|
|
146
|
-
framework?: string | undefined;
|
|
147
|
-
outDir?: string | undefined;
|
|
148
|
-
defines?: Record<string, string> | undefined;
|
|
149
|
-
extraFlags?: string[] | undefined;
|
|
150
|
-
} | undefined;
|
|
151
|
-
frameworkData?: Record<string, unknown> | undefined;
|
|
152
|
-
include?: string[] | undefined;
|
|
153
|
-
exclude?: string[] | undefined;
|
|
154
|
-
test?: {
|
|
155
|
-
board?: string | undefined;
|
|
156
|
-
include?: string[] | undefined;
|
|
157
|
-
port?: string | undefined;
|
|
158
|
-
baudRate?: number | undefined;
|
|
159
|
-
timeout?: number | undefined;
|
|
160
|
-
buildTarget?: string | undefined;
|
|
161
|
-
} | undefined;
|
|
162
|
-
toolchain?: {
|
|
163
|
-
type?: string | undefined;
|
|
164
|
-
frameworkOptions?: Record<string, unknown> | undefined;
|
|
165
|
-
} | undefined;
|
|
166
|
-
console?: {
|
|
167
|
-
port?: string | undefined;
|
|
168
|
-
baudRate?: number | undefined;
|
|
169
|
-
} | undefined;
|
|
170
|
-
native?: Record<string, unknown> | undefined;
|
|
171
|
-
display?: Record<string, unknown> | undefined;
|
|
172
|
-
zephyr?: {
|
|
173
|
-
kconfig?: Record<string, string> | undefined;
|
|
174
|
-
cmakeArgs?: string[] | undefined;
|
|
175
|
-
runner?: string | undefined;
|
|
176
|
-
} | undefined;
|
|
177
|
-
}>, {
|
|
178
|
-
entry?: string | undefined;
|
|
179
|
-
target?: string | undefined;
|
|
180
|
-
mcu?: string | undefined;
|
|
181
|
-
board?: string | undefined;
|
|
182
|
-
contract?: string | undefined;
|
|
183
|
-
framework?: string | undefined;
|
|
184
|
-
psram?: "opi" | "quad" | undefined;
|
|
185
|
-
output?: {
|
|
186
|
-
framework?: string | undefined;
|
|
187
|
-
outDir?: string | undefined;
|
|
188
|
-
defines?: Record<string, string> | undefined;
|
|
189
|
-
extraFlags?: string[] | undefined;
|
|
190
|
-
} | undefined;
|
|
191
|
-
frameworkData?: Record<string, unknown> | undefined;
|
|
192
|
-
include?: string[] | undefined;
|
|
193
|
-
exclude?: string[] | undefined;
|
|
194
|
-
test?: {
|
|
195
|
-
board?: string | undefined;
|
|
196
|
-
include?: string[] | undefined;
|
|
197
|
-
port?: string | undefined;
|
|
198
|
-
baudRate?: number | undefined;
|
|
199
|
-
timeout?: number | undefined;
|
|
200
|
-
buildTarget?: string | undefined;
|
|
201
|
-
} | undefined;
|
|
202
|
-
toolchain?: {
|
|
203
|
-
type?: string | undefined;
|
|
204
|
-
frameworkOptions?: Record<string, unknown> | undefined;
|
|
205
|
-
} | undefined;
|
|
206
|
-
console?: {
|
|
207
|
-
port?: string | undefined;
|
|
208
|
-
baudRate?: number | undefined;
|
|
209
|
-
} | undefined;
|
|
210
|
-
native?: Record<string, unknown> | undefined;
|
|
211
|
-
display?: Record<string, unknown> | undefined;
|
|
212
|
-
zephyr?: {
|
|
213
|
-
kconfig?: Record<string, string> | undefined;
|
|
214
|
-
cmakeArgs?: string[] | undefined;
|
|
215
|
-
runner?: string | undefined;
|
|
216
|
-
} | undefined;
|
|
217
|
-
}, {
|
|
218
|
-
entry?: string | undefined;
|
|
219
|
-
target?: string | undefined;
|
|
220
|
-
mcu?: string | undefined;
|
|
221
|
-
board?: string | undefined;
|
|
222
|
-
contract?: string | undefined;
|
|
223
|
-
framework?: string | undefined;
|
|
224
|
-
psram?: "opi" | "quad" | undefined;
|
|
225
|
-
output?: {
|
|
226
|
-
framework?: string | undefined;
|
|
227
|
-
outDir?: string | undefined;
|
|
228
|
-
defines?: Record<string, string> | undefined;
|
|
229
|
-
extraFlags?: string[] | undefined;
|
|
230
|
-
} | undefined;
|
|
231
|
-
frameworkData?: Record<string, unknown> | undefined;
|
|
232
|
-
include?: string[] | undefined;
|
|
233
|
-
exclude?: string[] | undefined;
|
|
234
|
-
test?: {
|
|
235
|
-
board?: string | undefined;
|
|
236
|
-
include?: string[] | undefined;
|
|
237
|
-
port?: string | undefined;
|
|
238
|
-
baudRate?: number | undefined;
|
|
239
|
-
timeout?: number | undefined;
|
|
240
|
-
buildTarget?: string | undefined;
|
|
241
|
-
} | undefined;
|
|
242
|
-
toolchain?: {
|
|
243
|
-
type?: string | undefined;
|
|
244
|
-
frameworkOptions?: Record<string, unknown> | undefined;
|
|
245
|
-
} | undefined;
|
|
246
|
-
console?: {
|
|
247
|
-
port?: string | undefined;
|
|
248
|
-
baudRate?: number | undefined;
|
|
249
|
-
} | undefined;
|
|
250
|
-
native?: Record<string, unknown> | undefined;
|
|
251
|
-
display?: Record<string, unknown> | undefined;
|
|
252
|
-
zephyr?: {
|
|
253
|
-
kconfig?: Record<string, string> | undefined;
|
|
254
|
-
cmakeArgs?: string[] | undefined;
|
|
255
|
-
runner?: string | undefined;
|
|
256
|
-
} | undefined;
|
|
257
|
-
}>;
|
|
49
|
+
runnerArgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
50
|
+
}, z.core.$strict>>;
|
|
51
|
+
}, z.core.$strict>;
|
|
258
52
|
/** Inferred TypeScript type from the Zod schema. */
|
|
259
53
|
export type ValidatedCuttlefishConfig = z.infer<typeof CuttlefishConfigSchema>;
|
|
260
54
|
/**
|
package/dist/config-schema.js
CHANGED
|
@@ -39,6 +39,7 @@ const ZephyrConfig = z.object({
|
|
|
39
39
|
kconfig: z.record(z.string(), z.string()).optional(),
|
|
40
40
|
cmakeArgs: z.array(z.string()).optional(),
|
|
41
41
|
runner: z.string().optional(),
|
|
42
|
+
runnerArgs: z.array(z.string()).optional(),
|
|
42
43
|
}).strict();
|
|
43
44
|
/**
|
|
44
45
|
* Schema for the full CuttlefishConfig shape.
|
|
@@ -11,13 +11,7 @@ export declare const CONTRACT_VERSION: 1;
|
|
|
11
11
|
declare const ContractComponentSchema: z.ZodObject<{
|
|
12
12
|
reference: z.ZodString;
|
|
13
13
|
dnp: z.ZodBoolean;
|
|
14
|
-
},
|
|
15
|
-
reference: z.ZodString;
|
|
16
|
-
dnp: z.ZodBoolean;
|
|
17
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
18
|
-
reference: z.ZodString;
|
|
19
|
-
dnp: z.ZodBoolean;
|
|
20
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
14
|
+
}, z.core.$loose>;
|
|
21
15
|
/**
|
|
22
16
|
* Info about a single connected MCU pin. The fields cuttlefish consumes
|
|
23
17
|
* (pinName, pinType, net) are required; boardName is optional (present only
|
|
@@ -31,46 +25,14 @@ declare const ContractPinSchema: z.ZodObject<{
|
|
|
31
25
|
externalComponents: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
32
26
|
reference: z.ZodString;
|
|
33
27
|
dnp: z.ZodBoolean;
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
dnp: z.ZodBoolean;
|
|
37
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
38
|
-
reference: z.ZodString;
|
|
39
|
-
dnp: z.ZodBoolean;
|
|
40
|
-
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
41
|
-
}, "strict", z.ZodTypeAny, {
|
|
42
|
-
pinName: string;
|
|
43
|
-
pinType: string;
|
|
44
|
-
net: string;
|
|
45
|
-
externalComponents: z.objectOutputType<{
|
|
46
|
-
reference: z.ZodString;
|
|
47
|
-
dnp: z.ZodBoolean;
|
|
48
|
-
}, z.ZodTypeAny, "passthrough">[];
|
|
49
|
-
boardName?: string | undefined;
|
|
50
|
-
}, {
|
|
51
|
-
pinName: string;
|
|
52
|
-
pinType: string;
|
|
53
|
-
net: string;
|
|
54
|
-
boardName?: string | undefined;
|
|
55
|
-
externalComponents?: z.objectInputType<{
|
|
56
|
-
reference: z.ZodString;
|
|
57
|
-
dnp: z.ZodBoolean;
|
|
58
|
-
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
59
|
-
}>;
|
|
28
|
+
}, z.core.$loose>>>;
|
|
29
|
+
}, z.core.$strict>;
|
|
60
30
|
/** Which peripheral buses have all their required pins wired. */
|
|
61
31
|
declare const AvailablePeripheralsSchema: z.ZodObject<{
|
|
62
32
|
i2c: z.ZodBoolean;
|
|
63
33
|
spi: z.ZodBoolean;
|
|
64
34
|
uart: z.ZodBoolean;
|
|
65
|
-
},
|
|
66
|
-
i2c: boolean;
|
|
67
|
-
spi: boolean;
|
|
68
|
-
uart: boolean;
|
|
69
|
-
}, {
|
|
70
|
-
i2c: boolean;
|
|
71
|
-
spi: boolean;
|
|
72
|
-
uart: boolean;
|
|
73
|
-
}>;
|
|
35
|
+
}, z.core.$strict>;
|
|
74
36
|
/**
|
|
75
37
|
* The top-level contract object. `.strict()` so a future v2 contract with new
|
|
76
38
|
* top-level keys is rejected clearly (complementing the version check) rather
|
|
@@ -80,11 +42,7 @@ export declare const HwContractSchema: z.ZodObject<{
|
|
|
80
42
|
version: z.ZodLiteral<1>;
|
|
81
43
|
mcu: z.ZodObject<{
|
|
82
44
|
symbol: z.ZodString;
|
|
83
|
-
},
|
|
84
|
-
symbol: z.ZodString;
|
|
85
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
86
|
-
symbol: z.ZodString;
|
|
87
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
45
|
+
}, z.core.$loose>;
|
|
88
46
|
connectedPins: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
89
47
|
pinName: z.ZodString;
|
|
90
48
|
pinType: z.ZodString;
|
|
@@ -93,90 +51,14 @@ export declare const HwContractSchema: z.ZodObject<{
|
|
|
93
51
|
externalComponents: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
94
52
|
reference: z.ZodString;
|
|
95
53
|
dnp: z.ZodBoolean;
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
dnp: z.ZodBoolean;
|
|
99
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
100
|
-
reference: z.ZodString;
|
|
101
|
-
dnp: z.ZodBoolean;
|
|
102
|
-
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
103
|
-
}, "strict", z.ZodTypeAny, {
|
|
104
|
-
pinName: string;
|
|
105
|
-
pinType: string;
|
|
106
|
-
net: string;
|
|
107
|
-
externalComponents: z.objectOutputType<{
|
|
108
|
-
reference: z.ZodString;
|
|
109
|
-
dnp: z.ZodBoolean;
|
|
110
|
-
}, z.ZodTypeAny, "passthrough">[];
|
|
111
|
-
boardName?: string | undefined;
|
|
112
|
-
}, {
|
|
113
|
-
pinName: string;
|
|
114
|
-
pinType: string;
|
|
115
|
-
net: string;
|
|
116
|
-
boardName?: string | undefined;
|
|
117
|
-
externalComponents?: z.objectInputType<{
|
|
118
|
-
reference: z.ZodString;
|
|
119
|
-
dnp: z.ZodBoolean;
|
|
120
|
-
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
121
|
-
}>>;
|
|
54
|
+
}, z.core.$loose>>>;
|
|
55
|
+
}, z.core.$strict>>;
|
|
122
56
|
availablePeripherals: z.ZodObject<{
|
|
123
57
|
i2c: z.ZodBoolean;
|
|
124
58
|
spi: z.ZodBoolean;
|
|
125
59
|
uart: z.ZodBoolean;
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
spi: boolean;
|
|
129
|
-
uart: boolean;
|
|
130
|
-
}, {
|
|
131
|
-
i2c: boolean;
|
|
132
|
-
spi: boolean;
|
|
133
|
-
uart: boolean;
|
|
134
|
-
}>;
|
|
135
|
-
}, "strict", z.ZodTypeAny, {
|
|
136
|
-
mcu: {
|
|
137
|
-
symbol: string;
|
|
138
|
-
} & {
|
|
139
|
-
[k: string]: unknown;
|
|
140
|
-
};
|
|
141
|
-
version: 1;
|
|
142
|
-
connectedPins: Record<string, {
|
|
143
|
-
pinName: string;
|
|
144
|
-
pinType: string;
|
|
145
|
-
net: string;
|
|
146
|
-
externalComponents: z.objectOutputType<{
|
|
147
|
-
reference: z.ZodString;
|
|
148
|
-
dnp: z.ZodBoolean;
|
|
149
|
-
}, z.ZodTypeAny, "passthrough">[];
|
|
150
|
-
boardName?: string | undefined;
|
|
151
|
-
}>;
|
|
152
|
-
availablePeripherals: {
|
|
153
|
-
i2c: boolean;
|
|
154
|
-
spi: boolean;
|
|
155
|
-
uart: boolean;
|
|
156
|
-
};
|
|
157
|
-
}, {
|
|
158
|
-
mcu: {
|
|
159
|
-
symbol: string;
|
|
160
|
-
} & {
|
|
161
|
-
[k: string]: unknown;
|
|
162
|
-
};
|
|
163
|
-
version: 1;
|
|
164
|
-
connectedPins: Record<string, {
|
|
165
|
-
pinName: string;
|
|
166
|
-
pinType: string;
|
|
167
|
-
net: string;
|
|
168
|
-
boardName?: string | undefined;
|
|
169
|
-
externalComponents?: z.objectInputType<{
|
|
170
|
-
reference: z.ZodString;
|
|
171
|
-
dnp: z.ZodBoolean;
|
|
172
|
-
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
173
|
-
}>;
|
|
174
|
-
availablePeripherals: {
|
|
175
|
-
i2c: boolean;
|
|
176
|
-
spi: boolean;
|
|
177
|
-
uart: boolean;
|
|
178
|
-
};
|
|
179
|
-
}>;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
}, z.core.$strict>;
|
|
180
62
|
export type ContractComponent = z.infer<typeof ContractComponentSchema>;
|
|
181
63
|
export type ContractPin = z.infer<typeof ContractPinSchema>;
|
|
182
64
|
export type AvailablePeripherals = z.infer<typeof AvailablePeripheralsSchema>;
|
|
@@ -37,7 +37,7 @@ export function generateFrameworkChecklist(spec) {
|
|
|
37
37
|
'',
|
|
38
38
|
'Then rebuild and test:',
|
|
39
39
|
' npm run build --workspaces',
|
|
40
|
-
' npx vitest run tests/packages/transpiler/
|
|
40
|
+
' npx vitest run tests/packages/transpiler/scaffold.test.ts',
|
|
41
41
|
' npx vitest run tests/packages/framework-arduino/',
|
|
42
42
|
'',
|
|
43
43
|
];
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// registry/tests/README (idempotently), and returns the file list + the
|
|
5
5
|
// framework-anticipation checklist.
|
|
6
6
|
//
|
|
7
|
-
// Pattern: mirrors
|
|
7
|
+
// Pattern: mirrors scaffold.ts's scaffoldProject — a writeFile closure
|
|
8
8
|
// + fs.writeFileSync + tracks createdFiles.
|
|
9
9
|
// ---------------------------------------------------------------------------
|
|
10
10
|
import path from 'node:path';
|
|
@@ -100,12 +100,12 @@ export function scaffoldBoardPackages(spec, opts = {}) {
|
|
|
100
100
|
}
|
|
101
101
|
catch { /* best-effort: skip if package.json isn't valid */ }
|
|
102
102
|
}
|
|
103
|
-
// 2.
|
|
104
|
-
const scaffoldPath = path.join(rootDir, 'packages', 'cuttlefish', 'src', 'create', '
|
|
103
|
+
// 2. scaffold.ts registry entry
|
|
104
|
+
const scaffoldPath = path.join(rootDir, 'packages', 'cuttlefish', 'src', 'create', 'scaffold.ts');
|
|
105
105
|
const registryEntry = ` {\n id: '${spec.boardId}',\n displayName: '${spec.boardName}',\n isNative: false,\n architecture: '${arch}',\n boardPackage: '@typecad/board-${arch}',\n frameworkPackage: '@typecad/framework-arduino',\n framework: 'arduino',\n buildTarget: '${spec.fqbn}',\n mcu: '${arch}',\n },\n`;
|
|
106
106
|
insertAfter(scaffoldPath, " _knownTargets: KnownTarget[] = [", registryEntry, `'${spec.boardId}'`);
|
|
107
107
|
// 3. KNOWN_BOARDS test
|
|
108
|
-
const testPath = path.join(rootDir, 'tests', 'packages', 'transpiler', '
|
|
108
|
+
const testPath = path.join(rootDir, 'tests', 'packages', 'transpiler', 'scaffold.test.ts');
|
|
109
109
|
const testEntry = `
|
|
110
110
|
it("contains ${spec.boardId}", () => {
|
|
111
111
|
const b = KNOWN_BOARDS.find(b => b.id === '${spec.boardId}');
|