@typecad/cuttlefish 1.0.0-alpha.10 → 1.0.0-alpha.12

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.
@@ -8,8 +8,12 @@ type OptimizationLevel = 'none' | 'size' | 'speed' | 'balanced';
8
8
  * Output section — controls how generated C++ is laid out.
9
9
  */
10
10
  interface CuttlefishOutputConfig {
11
- /** Target build framework. */
12
- framework: OutputFramework;
11
+ /**
12
+ * Target build framework. Optional — the top-level `framework` field is the
13
+ * primary source; this mirrors it for the output section and is rarely set.
14
+ * Matches the optional Zod `output.framework` in config-schema.ts.
15
+ */
16
+ framework?: OutputFramework;
13
17
  /** Optimization level. */
14
18
  optimize?: OptimizationLevel;
15
19
  /** Directory to write generated files into (relative to project root). */
@@ -50,8 +54,12 @@ export interface CuttlefishConfig {
50
54
  /**
51
55
  * MCU package providing silicon definitions.
52
56
  * Example: '@typecad/mcu-atmega328p'
57
+ *
58
+ * Optional for native/host targets — a desktop build has no MCU (the
59
+ * loader generates a boardless `@typecad/board` shim). Embedded targets
60
+ * should set this (or the deprecated `board`).
53
61
  */
54
- mcu: string;
62
+ mcu?: string;
55
63
  /**
56
64
  * Board package to use. (Deprecated — use mcu + contract instead)
57
65
  */
@@ -20,17 +20,17 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
20
20
  generateHeaderFile: z.ZodBoolean;
21
21
  customBridgeShim: z.ZodOptional<z.ZodString>;
22
22
  }, "strip", z.ZodTypeAny, {
23
+ sourceExtension: "cpp" | "ino" | "cc" | "h";
23
24
  entrypointFunctionName: string;
24
25
  requiresLoopFunction: boolean;
25
- sourceExtension: "ino" | "cc" | "cpp" | "h";
26
26
  generateHeaderFile: boolean;
27
27
  overrideBaseName?: string | undefined;
28
28
  outputSubdirectory?: string | undefined;
29
29
  customBridgeShim?: string | undefined;
30
30
  }, {
31
+ sourceExtension: "cpp" | "ino" | "cc" | "h";
31
32
  entrypointFunctionName: string;
32
33
  requiresLoopFunction: boolean;
33
- sourceExtension: "ino" | "cc" | "cpp" | "h";
34
34
  generateHeaderFile: boolean;
35
35
  overrideBaseName?: string | undefined;
36
36
  outputSubdirectory?: string | undefined;
@@ -41,13 +41,13 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
41
41
  forcedIncludes: z.ZodArray<z.ZodString, "many">;
42
42
  symbolAliases: z.ZodRecord<z.ZodString, z.ZodString>;
43
43
  }, "strip", z.ZodTypeAny, {
44
- targets: string[];
45
44
  forcedIncludes: string[];
46
45
  symbolAliases: Record<string, string>;
47
- }, {
48
46
  targets: string[];
47
+ }, {
49
48
  forcedIncludes: string[];
50
49
  symbolAliases: Record<string, string>;
50
+ targets: string[];
51
51
  }>;
52
52
  hal: z.ZodObject<{
53
53
  [x: string]: z.ZodObject<{
@@ -57,12 +57,12 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
57
57
  partialCoverage: z.ZodDefault<z.ZodBoolean>;
58
58
  }, "strip", z.ZodTypeAny, {
59
59
  supported: boolean;
60
- ops: Record<string, "supported" | "stub" | "unsupported" | "probe-inconclusive" | "polyfill">;
60
+ ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
61
61
  partialCoverage: boolean;
62
62
  unsupportedReason?: string | undefined;
63
63
  }, {
64
64
  supported: boolean;
65
- ops: Record<string, "supported" | "stub" | "unsupported" | "probe-inconclusive" | "polyfill">;
65
+ ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
66
66
  unsupportedReason?: string | undefined;
67
67
  partialCoverage?: boolean | undefined;
68
68
  }>;
@@ -81,12 +81,12 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
81
81
  partialCoverage: z.ZodDefault<z.ZodBoolean>;
82
82
  }, "strip", z.ZodTypeAny, {
83
83
  supported: boolean;
84
- ops: Record<string, "supported" | "stub" | "unsupported" | "probe-inconclusive" | "polyfill">;
84
+ ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
85
85
  partialCoverage: boolean;
86
86
  unsupportedReason?: string | undefined;
87
87
  }, {
88
88
  supported: boolean;
89
- ops: Record<string, "supported" | "stub" | "unsupported" | "probe-inconclusive" | "polyfill">;
89
+ ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
90
90
  unsupportedReason?: string | undefined;
91
91
  partialCoverage?: boolean | undefined;
92
92
  }>, z.objectOutputType<{
@@ -97,12 +97,12 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
97
97
  partialCoverage: z.ZodDefault<z.ZodBoolean>;
98
98
  }, "strip", z.ZodTypeAny, {
99
99
  supported: boolean;
100
- ops: Record<string, "supported" | "stub" | "unsupported" | "probe-inconclusive" | "polyfill">;
100
+ ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
101
101
  partialCoverage: boolean;
102
102
  unsupportedReason?: string | undefined;
103
103
  }, {
104
104
  supported: boolean;
105
- ops: Record<string, "supported" | "stub" | "unsupported" | "probe-inconclusive" | "polyfill">;
105
+ ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
106
106
  unsupportedReason?: string | undefined;
107
107
  partialCoverage?: boolean | undefined;
108
108
  }>;
@@ -121,12 +121,12 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
121
121
  partialCoverage: z.ZodDefault<z.ZodBoolean>;
122
122
  }, "strip", z.ZodTypeAny, {
123
123
  supported: boolean;
124
- ops: Record<string, "supported" | "stub" | "unsupported" | "probe-inconclusive" | "polyfill">;
124
+ ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
125
125
  partialCoverage: boolean;
126
126
  unsupportedReason?: string | undefined;
127
127
  }, {
128
128
  supported: boolean;
129
- ops: Record<string, "supported" | "stub" | "unsupported" | "probe-inconclusive" | "polyfill">;
129
+ ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
130
130
  unsupportedReason?: string | undefined;
131
131
  partialCoverage?: boolean | undefined;
132
132
  }>, "strip">, z.objectInputType<{
@@ -137,12 +137,12 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
137
137
  partialCoverage: z.ZodDefault<z.ZodBoolean>;
138
138
  }, "strip", z.ZodTypeAny, {
139
139
  supported: boolean;
140
- ops: Record<string, "supported" | "stub" | "unsupported" | "probe-inconclusive" | "polyfill">;
140
+ ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
141
141
  partialCoverage: boolean;
142
142
  unsupportedReason?: string | undefined;
143
143
  }, {
144
144
  supported: boolean;
145
- ops: Record<string, "supported" | "stub" | "unsupported" | "probe-inconclusive" | "polyfill">;
145
+ ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
146
146
  unsupportedReason?: string | undefined;
147
147
  partialCoverage?: boolean | undefined;
148
148
  }>;
@@ -161,12 +161,12 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
161
161
  partialCoverage: z.ZodDefault<z.ZodBoolean>;
162
162
  }, "strip", z.ZodTypeAny, {
163
163
  supported: boolean;
164
- ops: Record<string, "supported" | "stub" | "unsupported" | "probe-inconclusive" | "polyfill">;
164
+ ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
165
165
  partialCoverage: boolean;
166
166
  unsupportedReason?: string | undefined;
167
167
  }, {
168
168
  supported: boolean;
169
- ops: Record<string, "supported" | "stub" | "unsupported" | "probe-inconclusive" | "polyfill">;
169
+ ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
170
170
  unsupportedReason?: string | undefined;
171
171
  partialCoverage?: boolean | undefined;
172
172
  }>, "strip">>;
@@ -222,16 +222,19 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
222
222
  compile: z.ZodBoolean;
223
223
  upload: z.ZodBoolean;
224
224
  monitor: z.ZodBoolean;
225
+ debug: z.ZodOptional<z.ZodBoolean>;
225
226
  }, "strip", z.ZodTypeAny, {
226
227
  prepare: boolean;
227
228
  compile: boolean;
228
229
  upload: boolean;
229
230
  monitor: boolean;
231
+ debug?: boolean | undefined;
230
232
  }, {
231
233
  prepare: boolean;
232
234
  compile: boolean;
233
235
  upload: boolean;
234
236
  monitor: boolean;
237
+ debug?: boolean | undefined;
235
238
  }>;
236
239
  reexportedFrom: z.ZodOptional<z.ZodString>;
237
240
  }, "strip", z.ZodTypeAny, {
@@ -241,6 +244,7 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
241
244
  compile: boolean;
242
245
  upload: boolean;
243
246
  monitor: boolean;
247
+ debug?: boolean | undefined;
244
248
  };
245
249
  reexportedFrom?: string | undefined;
246
250
  }, {
@@ -250,6 +254,7 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
250
254
  compile: boolean;
251
255
  upload: boolean;
252
256
  monitor: boolean;
257
+ debug?: boolean | undefined;
253
258
  };
254
259
  reexportedFrom?: string | undefined;
255
260
  }>;
@@ -305,12 +310,12 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
305
310
  recommendedStringImpl: "std_string" | "static_string";
306
311
  }>;
307
312
  }, "strip", z.ZodTypeAny, {
308
- normalizeCppType: boolean;
309
- mathHeader: "none" | "<math.h>" | "<Arduino.h>";
313
+ needsIostream: boolean;
310
314
  needsStdString: boolean;
311
315
  needsStdVector: boolean;
312
- needsIostream: boolean;
313
316
  needsStdFunction: boolean;
317
+ mathHeader: "none" | "<math.h>" | "<Arduino.h>";
318
+ normalizeCppType: boolean;
314
319
  stdlibSupport: {
315
320
  hasVector: boolean;
316
321
  hasString: boolean;
@@ -321,12 +326,12 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
321
326
  recommendedStringImpl: "std_string" | "static_string";
322
327
  };
323
328
  }, {
324
- normalizeCppType: boolean;
325
- mathHeader: "none" | "<math.h>" | "<Arduino.h>";
329
+ needsIostream: boolean;
326
330
  needsStdString: boolean;
327
331
  needsStdVector: boolean;
328
- needsIostream: boolean;
329
332
  needsStdFunction: boolean;
333
+ mathHeader: "none" | "<math.h>" | "<Arduino.h>";
334
+ normalizeCppType: boolean;
330
335
  stdlibSupport: {
331
336
  hasVector: boolean;
332
337
  hasString: boolean;
@@ -371,42 +376,42 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
371
376
  zephyr?: string | undefined;
372
377
  }>>;
373
378
  }, "strip", z.ZodTypeAny, {
379
+ hal: {
380
+ [x: string]: {
381
+ supported: boolean;
382
+ ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
383
+ partialCoverage: boolean;
384
+ unsupportedReason?: string | undefined;
385
+ };
386
+ raw?: unknown;
387
+ } & {
388
+ [k: string]: {
389
+ supported: boolean;
390
+ ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
391
+ partialCoverage: boolean;
392
+ unsupportedReason?: string | undefined;
393
+ };
394
+ };
395
+ packageName: string;
374
396
  schemaVersion: 1;
375
397
  frameworkId: string;
376
- packageName: string;
377
398
  canonical: boolean;
378
399
  displayName: string;
379
400
  description: string;
380
401
  implementationMode: "from-scratch" | "extends-canonical" | "extends-other";
381
402
  entrypoint: {
403
+ sourceExtension: "cpp" | "ino" | "cc" | "h";
382
404
  entrypointFunctionName: string;
383
405
  requiresLoopFunction: boolean;
384
- sourceExtension: "ino" | "cc" | "cpp" | "h";
385
406
  generateHeaderFile: boolean;
386
407
  overrideBaseName?: string | undefined;
387
408
  outputSubdirectory?: string | undefined;
388
409
  customBridgeShim?: string | undefined;
389
410
  };
390
411
  profile: {
391
- targets: string[];
392
412
  forcedIncludes: string[];
393
413
  symbolAliases: Record<string, string>;
394
- };
395
- hal: {
396
- [x: string]: {
397
- supported: boolean;
398
- ops: Record<string, "supported" | "stub" | "unsupported" | "probe-inconclusive" | "polyfill">;
399
- partialCoverage: boolean;
400
- unsupportedReason?: string | undefined;
401
- };
402
- raw?: unknown;
403
- } & {
404
- [k: string]: {
405
- supported: boolean;
406
- ops: Record<string, "supported" | "stub" | "unsupported" | "probe-inconclusive" | "polyfill">;
407
- partialCoverage: boolean;
408
- unsupportedReason?: string | undefined;
409
- };
414
+ targets: string[];
410
415
  };
411
416
  polyfills: {
412
417
  emitted: {
@@ -426,16 +431,17 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
426
431
  compile: boolean;
427
432
  upload: boolean;
428
433
  monitor: boolean;
434
+ debug?: boolean | undefined;
429
435
  };
430
436
  reexportedFrom?: string | undefined;
431
437
  };
432
438
  typeEmission: {
433
- normalizeCppType: boolean;
434
- mathHeader: "none" | "<math.h>" | "<Arduino.h>";
439
+ needsIostream: boolean;
435
440
  needsStdString: boolean;
436
441
  needsStdVector: boolean;
437
- needsIostream: boolean;
438
442
  needsStdFunction: boolean;
443
+ mathHeader: "none" | "<math.h>" | "<Arduino.h>";
444
+ normalizeCppType: boolean;
439
445
  stdlibSupport: {
440
446
  hasVector: boolean;
441
447
  hasString: boolean;
@@ -451,6 +457,12 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
451
457
  hardwareTestGroups: string[];
452
458
  halResolutionTests: string[];
453
459
  };
460
+ doctor?: {
461
+ available: boolean;
462
+ } | undefined;
463
+ licenses?: {
464
+ available: boolean;
465
+ } | undefined;
454
466
  basedOn?: string | undefined;
455
467
  inheritsStrategyId?: string | undefined;
456
468
  libraryResolution?: {
@@ -460,51 +472,45 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
460
472
  tryGenerateLibDecl: boolean;
461
473
  reexportedFrom?: string | undefined;
462
474
  } | undefined;
463
- doctor?: {
464
- available: boolean;
465
- } | undefined;
466
- licenses?: {
467
- available: boolean;
468
- } | undefined;
469
475
  compat?: {
470
476
  zephyr?: string | undefined;
471
477
  } | undefined;
472
478
  }, {
479
+ hal: {
480
+ [x: string]: {
481
+ supported: boolean;
482
+ ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
483
+ unsupportedReason?: string | undefined;
484
+ partialCoverage?: boolean | undefined;
485
+ };
486
+ raw?: unknown;
487
+ } & {
488
+ [k: string]: {
489
+ supported: boolean;
490
+ ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
491
+ unsupportedReason?: string | undefined;
492
+ partialCoverage?: boolean | undefined;
493
+ };
494
+ };
495
+ packageName: string;
473
496
  schemaVersion: 1;
474
497
  frameworkId: string;
475
- packageName: string;
476
498
  displayName: string;
477
499
  description: string;
478
500
  implementationMode: "from-scratch" | "extends-canonical" | "extends-other";
479
501
  entrypoint: {
502
+ sourceExtension: "cpp" | "ino" | "cc" | "h";
480
503
  entrypointFunctionName: string;
481
504
  requiresLoopFunction: boolean;
482
- sourceExtension: "ino" | "cc" | "cpp" | "h";
483
505
  generateHeaderFile: boolean;
484
506
  overrideBaseName?: string | undefined;
485
507
  outputSubdirectory?: string | undefined;
486
508
  customBridgeShim?: string | undefined;
487
509
  };
488
510
  profile: {
489
- targets: string[];
490
511
  forcedIncludes: string[];
491
512
  symbolAliases: Record<string, string>;
492
- };
493
- hal: {
494
- [x: string]: {
495
- supported: boolean;
496
- ops: Record<string, "supported" | "stub" | "unsupported" | "probe-inconclusive" | "polyfill">;
497
- unsupportedReason?: string | undefined;
498
- partialCoverage?: boolean | undefined;
499
- };
500
- raw?: unknown;
501
- } & {
502
- [k: string]: {
503
- supported: boolean;
504
- ops: Record<string, "supported" | "stub" | "unsupported" | "probe-inconclusive" | "polyfill">;
505
- unsupportedReason?: string | undefined;
506
- partialCoverage?: boolean | undefined;
507
- };
513
+ targets: string[];
508
514
  };
509
515
  polyfills: {
510
516
  emitted: {
@@ -524,16 +530,17 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
524
530
  compile: boolean;
525
531
  upload: boolean;
526
532
  monitor: boolean;
533
+ debug?: boolean | undefined;
527
534
  };
528
535
  reexportedFrom?: string | undefined;
529
536
  };
530
537
  typeEmission: {
531
- normalizeCppType: boolean;
532
- mathHeader: "none" | "<math.h>" | "<Arduino.h>";
538
+ needsIostream: boolean;
533
539
  needsStdString: boolean;
534
540
  needsStdVector: boolean;
535
- needsIostream: boolean;
536
541
  needsStdFunction: boolean;
542
+ mathHeader: "none" | "<math.h>" | "<Arduino.h>";
543
+ normalizeCppType: boolean;
537
544
  stdlibSupport: {
538
545
  hasVector: boolean;
539
546
  hasString: boolean;
@@ -549,6 +556,12 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
549
556
  hardwareTestGroups: string[];
550
557
  halResolutionTests: string[];
551
558
  };
559
+ doctor?: {
560
+ available: boolean;
561
+ } | undefined;
562
+ licenses?: {
563
+ available: boolean;
564
+ } | undefined;
552
565
  canonical?: boolean | undefined;
553
566
  basedOn?: string | undefined;
554
567
  inheritsStrategyId?: string | undefined;
@@ -559,12 +572,6 @@ export declare const FrameworkManifestSchema: z.ZodObject<{
559
572
  tryGenerateLibDecl: boolean;
560
573
  reexportedFrom?: string | undefined;
561
574
  } | undefined;
562
- doctor?: {
563
- available: boolean;
564
- } | undefined;
565
- licenses?: {
566
- available: boolean;
567
- } | undefined;
568
575
  compat?: {
569
576
  zephyr?: string | undefined;
570
577
  } | undefined;
@@ -84,6 +84,7 @@ const ToolchainCoverageSchema = z.object({
84
84
  compile: z.boolean(),
85
85
  upload: z.boolean(),
86
86
  monitor: z.boolean(),
87
+ debug: z.boolean().optional(),
87
88
  }),
88
89
  reexportedFrom: z.string().optional(),
89
90
  });
@@ -42,3 +42,5 @@ export { KNOWN_FRAMEWORK_PACKAGES, loadFrameworkManifest, } from './framework-ma
42
42
  export type { KnownFrameworkPackage } from './framework-manifest-registry.js';
43
43
  export { validateFrameworkManifest } from './validate-framework-manifest.js';
44
44
  export type { ManifestValidationContext, ManifestValidationResult, ManifestValidationError, ManifestValidationWarning, } from './validate-framework-manifest.js';
45
+ export type { CopyleftRisk, LicenseSource, LibraryLicenseEntry, DiscoveredDependency, ReadFile, ReadDir, ResolveLicenseOptions, } from './spdx-licenses.js';
46
+ export { SPDX_TABLE, RISK_RANK, LICENSE_FILENAMES, normalize, identifySpdx, classifyRisk, readLicenseFileIn, readLicenseFile, readSourceHeaders, resolveLibraryLicense, riskBracket, statusMark, countByRisk, } from './spdx-licenses.js';
@@ -43,3 +43,4 @@ export { FrameworkManifestSchema, defineFrameworkManifest, HAL_CATEGORIES, POLYF
43
43
  export { KNOWN_FRAMEWORK_PACKAGES, loadFrameworkManifest, } from './framework-manifest-registry.js';
44
44
  // Framework manifest validator
45
45
  export { validateFrameworkManifest } from './validate-framework-manifest.js';
46
+ export { SPDX_TABLE, RISK_RANK, LICENSE_FILENAMES, normalize, identifySpdx, classifyRisk, readLicenseFileIn, readLicenseFile, readSourceHeaders, resolveLibraryLicense, riskBracket, statusMark, countByRisk, } from './spdx-licenses.js';
@@ -0,0 +1,139 @@
1
+ export type CopyleftRisk = "permissive" | "weak-copyleft" | "strong-copyleft" | "unknown";
2
+ /**
3
+ * Where a license declaration was found.
4
+ *
5
+ * `"library.properties"` is the Arduino library-manifest form (kept verbatim
6
+ * for Arduino parity); `"manifest"` is the framework-neutral form for any
7
+ * other manifest reader a framework supplies (e.g. a west module.yml).
8
+ */
9
+ export type LicenseSource = "library.properties" | "manifest" | "license-file" | "source-header" | "none";
10
+ /**
11
+ * A resolved license row for a single dependency. Frameworks render this into
12
+ * their own CLI tables.
13
+ */
14
+ export interface LibraryLicenseEntry {
15
+ name: string;
16
+ version: string | undefined;
17
+ /** Install/root directory of the dependency (where its LICENSE lives). */
18
+ path: string;
19
+ /** Normalized SPDX ID (e.g. "BSD-3-Clause"); undefined if not determined. */
20
+ spdx: string | undefined;
21
+ risk: CopyleftRisk;
22
+ source: LicenseSource;
23
+ }
24
+ /**
25
+ * Neutral dependency shape every framework adapts its enumeration to. Arduino
26
+ * maps `{ name, version, install_dir }` → `{ name, version, installDir }`;
27
+ * Zephyr maps a west-listed project (`{ name, abspath }`) the same way.
28
+ */
29
+ export interface DiscoveredDependency {
30
+ name: string;
31
+ version?: string;
32
+ /** Absolute path to the dependency's install/root directory. */
33
+ installDir?: string;
34
+ }
35
+ /** Injected file reader (returns undefined on missing/unreadable). */
36
+ export type ReadFile = (p: string) => string | undefined;
37
+ /** Injected directory lister (returns [] on missing/unreadable). */
38
+ export type ReadDir = (d: string) => string[];
39
+ interface SpdxEntry {
40
+ id: string;
41
+ aliases: string[];
42
+ risk: CopyleftRisk;
43
+ /** Substrings, ALL of which must appear in the normalized license text. */
44
+ markers: string[];
45
+ /**
46
+ * Short-form phrases for sparse source-header comments where the full license
47
+ * text is absent (e.g. Adafruit's "BSD license, all text here must be
48
+ * included"). ANY one match is sufficient. Lower-cased on use.
49
+ */
50
+ shortMarkers: string[];
51
+ }
52
+ export declare const SPDX_TABLE: readonly SpdxEntry[];
53
+ export declare const RISK_RANK: Record<CopyleftRisk, number>;
54
+ /**
55
+ * Candidate LICENSE filenames checked case-insensitively. Includes the British
56
+ * "LICENCE" spelling (e.g. lvgl ships LICENCE.txt) and the `.rst`
57
+ * (reStructuredText) form common in Zephyr/Linux modules (e.g.
58
+ * trusted-firmware-m ships `license.rst`).
59
+ *
60
+ * Deliberately does NOT match per-component `COPYING.<spec>` files (e.g.
61
+ * picolibc's COPYING.GPL2 / COPYING.NEWLIB / COPYING.picolibc): those name a
62
+ * specific license rather than the project license, and matching COPYING.GPL2
63
+ * would falsely flag a BSD project as strong-copyleft.
64
+ */
65
+ export declare const LICENSE_FILENAMES: readonly string[];
66
+ /**
67
+ * Normalize license input text for matching: trim, lowercase, strip surrounding
68
+ * quotes/whitespace.
69
+ */
70
+ export declare function normalize(input: string): string;
71
+ /**
72
+ * Resolve a raw license input (either a short manifest value, the full text of
73
+ * a LICENSE file, or a source-file header comment) to a canonical SPDX ID.
74
+ *
75
+ * Matching priority:
76
+ * 1. SPDX-License-Identifier: <id> marker (authoritative when present)
77
+ * 2. exact alias match (suits the short manifest value)
78
+ * 3. substring markers match, ALL markers required (suits full LICENSE text)
79
+ * 4. shortMarkers match, ANY one sufficient (suits sparse header comments
80
+ * like Adafruit's "BSD license, all text here must be included")
81
+ *
82
+ * Returns the SPDX ID string, or undefined if nothing matched.
83
+ */
84
+ export declare function identifySpdx(input: string): string | undefined;
85
+ /**
86
+ * Classify the copyleft risk of a known SPDX ID. Returns "unknown" for
87
+ * unrecognized ids.
88
+ */
89
+ export declare function classifyRisk(spdx: string): CopyleftRisk;
90
+ /**
91
+ * Read the first LICENSE/COPYING file found in a directory and return its text.
92
+ * Checks the directory itself only (no recursion). The match is
93
+ * case-insensitive, but the file is read using its REAL on-disk name (not the
94
+ * canonical candidate) so it works on case-sensitive filesystems where a module
95
+ * ships e.g. `license.rst` rather than `LICENSE.rst`.
96
+ */
97
+ export declare function readLicenseFileIn(dir: string, readFile: ReadFile, readdir: ReadDir): string | undefined;
98
+ /**
99
+ * Read the first LICENSE/COPYING file found in installDir or one of its common
100
+ * subdirectories (e.g. `src/`, where Arduino's own libraries keep it).
101
+ */
102
+ export declare function readLicenseFile(installDir: string, readFile: ReadFile, readdir: ReadDir, subdirs?: readonly string[]): string | undefined;
103
+ /**
104
+ * Read the leading header comment of each candidate source file in installDir
105
+ * (and its subdirs) and concatenate them, so the SPDX matcher can look for
106
+ * license phrases. The license notice usually lives in the file named after the
107
+ * dependency itself, so such files are scanned first; then a cap of further
108
+ * headers/sources is scanned to keep this cheap.
109
+ */
110
+ export declare function readSourceHeaders(depName: string, installDir: string, readFile: ReadFile, readdir: ReadDir, subdirs?: readonly string[]): string | undefined;
111
+ export interface ResolveLicenseOptions {
112
+ /** Subdirs searched for a LICENSE file / source headers beyond the root. */
113
+ subdirs?: readonly string[];
114
+ /**
115
+ * Read a manifest file's text for a license field. Given the install dir and
116
+ * the readFile seam, return the raw license value (or undefined). Arduino
117
+ * wires this to read `library.properties` `license=`. Omit to skip the
118
+ * manifest step (e.g. a framework whose manifest carries no license field).
119
+ */
120
+ readManifestLicense?: (installDir: string, readFile: ReadFile) => string | undefined;
121
+ /**
122
+ * LicenseSource label attached when the license is found via
123
+ * `readManifestLicense`. Defaults to `"manifest"`; Arduino passes
124
+ * `"library.properties"` for parity with its existing output.
125
+ */
126
+ manifestSourceLabel?: LicenseSource;
127
+ }
128
+ /**
129
+ * Resolve a single dependency's license. Priority: manifest → LICENSE file →
130
+ * source-file header comments → none.
131
+ *
132
+ * Never throws: an unreadable manifest/LICENSE/source simply falls through to
133
+ * the next step, ending at a `"none"` / unknown entry.
134
+ */
135
+ export declare function resolveLibraryLicense(dep: DiscoveredDependency, readFile: ReadFile, readdir: ReadDir, options?: ResolveLicenseOptions): LibraryLicenseEntry;
136
+ export declare function riskBracket(risk: CopyleftRisk): string;
137
+ export declare function statusMark(risk: CopyleftRisk): string;
138
+ export declare function countByRisk(libs: LibraryLicenseEntry[]): Record<CopyleftRisk, number>;
139
+ export {};