@tscircuit/cli 0.1.1792 → 0.1.1793

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 CHANGED
@@ -80,6 +80,28 @@ The `build` command also accepts the following options:
80
80
  - `--ignore-placement-drc` - suppress placement DRC diagnostics
81
81
  - `--ignore-routing-drc` - suppress routing DRC diagnostics
82
82
 
83
+ ### KiCad PCM compatibility
84
+
85
+ `tsci build --kicad-pcm` uses the package license from `package.json` and
86
+ selects the oldest compatible PCM schema by default. Licenses accepted by PCM
87
+ schema v1 produce a feed for KiCad 6–10. Other non-empty license strings use
88
+ schema v2 and require KiCad 10 or newer.
89
+
90
+ Projects can select a schema or declare a distribution-specific PCM license in
91
+ `tscircuit.config.json`:
92
+
93
+ ```json
94
+ {
95
+ "kicadPcm": {
96
+ "schemaVersion": "auto",
97
+ "license": "CC-BY-ND-4.0"
98
+ }
99
+ }
100
+ ```
101
+
102
+ Set `schemaVersion` to `1` or `2` to force a schema. Forcing v1 rejects licenses
103
+ that are not in KiCad's v1 license list instead of substituting another license.
104
+
83
105
  ### Debug autorouting stages
84
106
 
85
107
  Use `--autorouter-debug` to log each autorouting stage and write visual
@@ -11666,6 +11666,10 @@ var pcbSnapshotSettingsSchema = z.object({
11666
11666
  showPcbNotes: z.boolean().optional(),
11667
11667
  showFabricationNotes: z.boolean().optional()
11668
11668
  });
11669
+ var kicadPcmSettingsSchema = z.object({
11670
+ schemaVersion: z.union([z.literal("auto"), z.literal(1), z.literal(2)]).optional(),
11671
+ license: z.string().trim().min(1).optional()
11672
+ });
11669
11673
  var projectConfigSchema = z.object({
11670
11674
  mainEntrypoint: z.string().optional(),
11671
11675
  libraryEntrypoint: z.string().optional(),
@@ -11680,6 +11684,7 @@ var projectConfigSchema = z.object({
11680
11684
  kicadProjectEntrypointPath: z.string().optional(),
11681
11685
  kicadLibraryEntrypointPath: z.string().optional(),
11682
11686
  kicadLibraryName: z.string().optional(),
11687
+ kicadPcm: kicadPcmSettingsSchema.optional(),
11683
11688
  alwaysUseLatestTscircuitOnCloud: z.boolean().optional(),
11684
11689
  build: z.object({
11685
11690
  circuitJson: z.boolean().optional(),
package/dist/cli/main.js CHANGED
@@ -118506,7 +118506,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
118506
118506
  // lib/getVersion.ts
118507
118507
  import { createRequire as createRequire2 } from "node:module";
118508
118508
  // package.json
118509
- var version = "0.1.1791";
118509
+ var version = "0.1.1792";
118510
118510
  var package_default = {
118511
118511
  name: "@tscircuit/cli",
118512
118512
  version,
@@ -122606,6 +122606,10 @@ var pcbSnapshotSettingsSchema = z.object({
122606
122606
  showPcbNotes: z.boolean().optional(),
122607
122607
  showFabricationNotes: z.boolean().optional()
122608
122608
  });
122609
+ var kicadPcmSettingsSchema = z.object({
122610
+ schemaVersion: z.union([z.literal("auto"), z.literal(1), z.literal(2)]).optional(),
122611
+ license: z.string().trim().min(1).optional()
122612
+ });
122609
122613
  var projectConfigSchema = z.object({
122610
122614
  mainEntrypoint: z.string().optional(),
122611
122615
  libraryEntrypoint: z.string().optional(),
@@ -122620,6 +122624,7 @@ var projectConfigSchema = z.object({
122620
122624
  kicadProjectEntrypointPath: z.string().optional(),
122621
122625
  kicadLibraryEntrypointPath: z.string().optional(),
122622
122626
  kicadLibraryName: z.string().optional(),
122627
+ kicadPcm: kicadPcmSettingsSchema.optional(),
122623
122628
  alwaysUseLatestTscircuitOnCloud: z.boolean().optional(),
122624
122629
  build: z.object({
122625
122630
  circuitJson: z.boolean().optional(),
@@ -130967,13 +130972,129 @@ import path31 from "node:path";
130967
130972
  import crypto3 from "node:crypto";
130968
130973
 
130969
130974
  // lib/shared/kicad-pcm-license.ts
130970
- var KICAD_PCM_SCHEMA_VERSION = 2;
130971
- var KICAD_PCM_SCHEMA_URL = "https://go.kicad.org/pcm/schemas/v2";
130975
+ var KICAD_PCM_SCHEMA_URLS = {
130976
+ 1: "https://go.kicad.org/pcm/schemas/v1",
130977
+ 2: "https://go.kicad.org/pcm/schemas/v2"
130978
+ };
130979
+ var KICAD_PCM_SCHEMA_URL = KICAD_PCM_SCHEMA_URLS[2];
130980
+ var KICAD_PCM_V1_LICENSES = [
130981
+ "public-domain",
130982
+ "Apache",
130983
+ "Apache-1.0",
130984
+ "Apache-2.0",
130985
+ "Artistic",
130986
+ "Artistic-1.0",
130987
+ "Artistic-2.0",
130988
+ "BSD",
130989
+ "BSD-2-Clause",
130990
+ "BSD-3-Clause",
130991
+ "BSD-4-Clause",
130992
+ "ISC",
130993
+ "CC-BY",
130994
+ "CC-BY-1.0",
130995
+ "CC-BY-2.0",
130996
+ "CC-BY-2.5",
130997
+ "CC-BY-3.0",
130998
+ "CC-BY-4.0",
130999
+ "CC-BY-SA",
131000
+ "CC-BY-SA-1.0",
131001
+ "CC-BY-SA-2.0",
131002
+ "CC-BY-SA-2.5",
131003
+ "CC-BY-SA-3.0",
131004
+ "CC-BY-SA-4.0",
131005
+ "CC-BY-ND",
131006
+ "CC-BY-ND-1.0",
131007
+ "CC-BY-ND-2.0",
131008
+ "CC-BY-ND-2.5",
131009
+ "CC-BY-ND-3.0",
131010
+ "CC-BY-ND-4.0",
131011
+ "CC-BY-NC",
131012
+ "CC-BY-NC-1.0",
131013
+ "CC-BY-NC-2.0",
131014
+ "CC-BY-NC-2.5",
131015
+ "CC-BY-NC-3.0",
131016
+ "CC-BY-NC-4.0",
131017
+ "CC-BY-NC-SA",
131018
+ "CC-BY-NC-SA-1.0",
131019
+ "CC-BY-NC-SA-2.0",
131020
+ "CC-BY-NC-SA-2.5",
131021
+ "CC-BY-NC-SA-3.0",
131022
+ "CC-BY-NC-SA-4.0",
131023
+ "CC-BY-NC-ND",
131024
+ "CC-BY-NC-ND-1.0",
131025
+ "CC-BY-NC-ND-2.0",
131026
+ "CC-BY-NC-ND-2.5",
131027
+ "CC-BY-NC-ND-3.0",
131028
+ "CC-BY-NC-ND-4.0",
131029
+ "CC0-1.0",
131030
+ "CDDL-1.0",
131031
+ "CPL",
131032
+ "EFL",
131033
+ "EFL-1.0",
131034
+ "EFL-2.0",
131035
+ "MIT",
131036
+ "GPL",
131037
+ "GPL-1.0",
131038
+ "GPL-2.0",
131039
+ "GPL-3.0",
131040
+ "LGPL",
131041
+ "LGPL-2.1",
131042
+ "LGPL-3.0",
131043
+ "GNU-LGPL-2.0",
131044
+ "GFDL",
131045
+ "GFDL-1.0",
131046
+ "GFDL-1.1",
131047
+ "GFDL-1.2",
131048
+ "GFDL-1.3",
131049
+ "GFDL-NIV",
131050
+ "LPPL",
131051
+ "LPPL-1.0",
131052
+ "LPPL-1.1",
131053
+ "LPPL-1.2",
131054
+ "LPPL-1.3",
131055
+ "MPL-1.1",
131056
+ "Perl",
131057
+ "Python-2.0",
131058
+ "QPL-1.0",
131059
+ "W3C",
131060
+ "Zlib",
131061
+ "Zope",
131062
+ "Zope-1.0",
131063
+ "Zope-1.1",
131064
+ "Zope-2.0",
131065
+ "Zope-2.1",
131066
+ "CERN-OHL",
131067
+ "WTFPL",
131068
+ "Unlicense",
131069
+ "open-source",
131070
+ "unrestricted"
131071
+ ];
131072
+ var kicadPcmV1LicenseSet = new Set(KICAD_PCM_V1_LICENSES);
131073
+ var isValidKicadPcmV1License = (license) => typeof license === "string" && kicadPcmV1LicenseSet.has(license.trim());
131074
+ function assertValidKicadPcmV1License(license) {
131075
+ if (!isValidKicadPcmV1License(license)) {
131076
+ const value = typeof license === "string" ? license.trim() : "";
131077
+ throw new Error(`Invalid KiCad PCM v1 license "${value || "(empty)"}". Choose a license allowed by ${KICAD_PCM_SCHEMA_URLS[1]} or use schema version 2 for KiCad 10+`);
131078
+ }
131079
+ }
130972
131080
  var isValidKicadPcmV2License = (license) => typeof license === "string" && license.trim().length > 0;
130973
131081
  function assertValidKicadPcmV2License(license) {
130974
131082
  if (!isValidKicadPcmV2License(license)) {
130975
- throw new Error(`Invalid KiCad PCM v2 license "(empty)". License must be a non-empty string allowed by ${KICAD_PCM_SCHEMA_URL}`);
131083
+ throw new Error(`Invalid KiCad PCM v2 license "(empty)". License must be a non-empty string allowed by ${KICAD_PCM_SCHEMA_URLS[2]}`);
131084
+ }
131085
+ }
131086
+ function resolveKicadPcmSchemaVersion({
131087
+ license,
131088
+ preference = "auto"
131089
+ }) {
131090
+ assertValidKicadPcmV2License(license);
131091
+ if (preference === 1) {
131092
+ assertValidKicadPcmV1License(license);
131093
+ return 1;
130976
131094
  }
131095
+ if (preference === 2)
131096
+ return 2;
131097
+ return isValidKicadPcmV1License(license) ? 1 : 2;
130977
131098
  }
130978
131099
 
130979
131100
  // lib/shared/generate-pcm-assets.ts
@@ -130985,18 +131106,23 @@ async function generatePcmAssets(options) {
130985
131106
  description = "",
130986
131107
  descriptionFull = `Visit https://tscircuit.com/${author}/${packageName} for more information.`,
130987
131108
  license,
131109
+ schemaVersion: schemaVersionPreference = "auto",
130988
131110
  kicadLibraryPath,
130989
131111
  outputDir,
130990
131112
  baseUrl,
130991
131113
  displayName = `${author}/${packageName}`
130992
131114
  } = options;
130993
- assertValidKicadPcmV2License(license);
131115
+ const schemaVersion = resolveKicadPcmSchemaVersion({
131116
+ license,
131117
+ preference: schemaVersionPreference
131118
+ });
131119
+ const schemaUrl = KICAD_PCM_SCHEMA_URLS[schemaVersion];
130994
131120
  const normalizedLicense = license.trim();
130995
131121
  const identifier = `com.tscircuit.${author}.${packageName}`.toLowerCase().replace(/[^a-z0-9.-]/g, "-").slice(0, 50);
130996
131122
  fs29.mkdirSync(outputDir, { recursive: true });
130997
131123
  console.log("Creating metadata.json...");
130998
131124
  const metadata = {
130999
- $schema: KICAD_PCM_SCHEMA_URL,
131125
+ $schema: schemaUrl,
131000
131126
  name: displayName,
131001
131127
  description: description.slice(0, 500),
131002
131128
  description_full: descriptionFull.slice(0, 5000),
@@ -131065,8 +131191,8 @@ async function generatePcmAssets(options) {
131065
131191
  const packagesJsonSha256 = crypto3.createHash("sha256").update(packagesJsonBuffer).digest("hex");
131066
131192
  const packagesJsonUrl = baseUrl ? `${baseUrl}/pcm/packages.json` : "./packages.json";
131067
131193
  const repositoryJson = {
131068
- $schema: KICAD_PCM_SCHEMA_URL,
131069
- schema_version: KICAD_PCM_SCHEMA_VERSION,
131194
+ $schema: schemaUrl,
131195
+ ...schemaVersion === 2 ? { schema_version: 2 } : {},
131070
131196
  name: displayName,
131071
131197
  maintainer: {
131072
131198
  name: author,
@@ -131088,7 +131214,8 @@ async function generatePcmAssets(options) {
131088
131214
  packagesJsonPath,
131089
131215
  packageZipPath: zipFilePath,
131090
131216
  packageZipSha256: sha256,
131091
- packageZipSize: zipSize
131217
+ packageZipSize: zipSize,
131218
+ schemaVersion
131092
131219
  };
131093
131220
  }
131094
131221
  function addDirectoryToZip(opts) {
@@ -131163,8 +131290,12 @@ async function buildKicadPcm({
131163
131290
  const version2 = packageJson.version || "1.0.0";
131164
131291
  const author = getPackageAuthor(packageJson.name || "") || "tscircuit";
131165
131292
  const description = packageJson.description || "";
131166
- assertValidKicadPcmV2License(packageJson.license);
131167
- const license = packageJson.license.trim();
131293
+ const license = projectConfig?.kicadPcm?.license ?? packageJson.license;
131294
+ const schemaVersion = resolveKicadPcmSchemaVersion({
131295
+ license,
131296
+ preference: projectConfig?.kicadPcm?.schemaVersion
131297
+ });
131298
+ const normalizedLicense = license.trim();
131168
131299
  const libraryName = kicadLibraryNameOption ?? resolveKicadLibraryName({ projectDir });
131169
131300
  const kicadLibOutputDir = path32.join(distDir, "kicad-library-pcm");
131170
131301
  const kicadPcmPackageId = `com_tscircuit_${author}_${packageName}`.replace(/\./g, "_");
@@ -131186,7 +131317,8 @@ async function buildKicadPcm({
131186
131317
  version: version2,
131187
131318
  author,
131188
131319
  description,
131189
- license,
131320
+ license: normalizedLicense,
131321
+ schemaVersion,
131190
131322
  kicadLibraryPath: kicadLibOutputDir,
131191
131323
  outputDir: pcmOutputDir,
131192
131324
  baseUrl,
@@ -4170,6 +4170,10 @@ var pcbSnapshotSettingsSchema = z.object({
4170
4170
  showPcbNotes: z.boolean().optional(),
4171
4171
  showFabricationNotes: z.boolean().optional()
4172
4172
  });
4173
+ var kicadPcmSettingsSchema = z.object({
4174
+ schemaVersion: z.union([z.literal("auto"), z.literal(1), z.literal(2)]).optional(),
4175
+ license: z.string().trim().min(1).optional()
4176
+ });
4173
4177
  var projectConfigSchema = z.object({
4174
4178
  mainEntrypoint: z.string().optional(),
4175
4179
  libraryEntrypoint: z.string().optional(),
@@ -4184,6 +4188,7 @@ var projectConfigSchema = z.object({
4184
4188
  kicadProjectEntrypointPath: z.string().optional(),
4185
4189
  kicadLibraryEntrypointPath: z.string().optional(),
4186
4190
  kicadLibraryName: z.string().optional(),
4191
+ kicadPcm: kicadPcmSettingsSchema.optional(),
4187
4192
  alwaysUseLatestTscircuitOnCloud: z.boolean().optional(),
4188
4193
  build: z.object({
4189
4194
  circuitJson: z.boolean().optional(),
package/dist/lib/index.js CHANGED
@@ -65757,7 +65757,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
65757
65757
  }));
65758
65758
  };
65759
65759
  // package.json
65760
- var version = "0.1.1791";
65760
+ var version = "0.1.1792";
65761
65761
  var package_default = {
65762
65762
  name: "@tscircuit/cli",
65763
65763
  version,
@@ -75018,14 +75018,130 @@ import path10 from "node:path";
75018
75018
  import crypto3 from "node:crypto";
75019
75019
 
75020
75020
  // lib/shared/kicad-pcm-license.ts
75021
- var KICAD_PCM_SCHEMA_VERSION = 2;
75022
- var KICAD_PCM_SCHEMA_URL = "https://go.kicad.org/pcm/schemas/v2";
75021
+ var KICAD_PCM_SCHEMA_URLS = {
75022
+ 1: "https://go.kicad.org/pcm/schemas/v1",
75023
+ 2: "https://go.kicad.org/pcm/schemas/v2"
75024
+ };
75025
+ var KICAD_PCM_SCHEMA_URL = KICAD_PCM_SCHEMA_URLS[2];
75026
+ var KICAD_PCM_V1_LICENSES = [
75027
+ "public-domain",
75028
+ "Apache",
75029
+ "Apache-1.0",
75030
+ "Apache-2.0",
75031
+ "Artistic",
75032
+ "Artistic-1.0",
75033
+ "Artistic-2.0",
75034
+ "BSD",
75035
+ "BSD-2-Clause",
75036
+ "BSD-3-Clause",
75037
+ "BSD-4-Clause",
75038
+ "ISC",
75039
+ "CC-BY",
75040
+ "CC-BY-1.0",
75041
+ "CC-BY-2.0",
75042
+ "CC-BY-2.5",
75043
+ "CC-BY-3.0",
75044
+ "CC-BY-4.0",
75045
+ "CC-BY-SA",
75046
+ "CC-BY-SA-1.0",
75047
+ "CC-BY-SA-2.0",
75048
+ "CC-BY-SA-2.5",
75049
+ "CC-BY-SA-3.0",
75050
+ "CC-BY-SA-4.0",
75051
+ "CC-BY-ND",
75052
+ "CC-BY-ND-1.0",
75053
+ "CC-BY-ND-2.0",
75054
+ "CC-BY-ND-2.5",
75055
+ "CC-BY-ND-3.0",
75056
+ "CC-BY-ND-4.0",
75057
+ "CC-BY-NC",
75058
+ "CC-BY-NC-1.0",
75059
+ "CC-BY-NC-2.0",
75060
+ "CC-BY-NC-2.5",
75061
+ "CC-BY-NC-3.0",
75062
+ "CC-BY-NC-4.0",
75063
+ "CC-BY-NC-SA",
75064
+ "CC-BY-NC-SA-1.0",
75065
+ "CC-BY-NC-SA-2.0",
75066
+ "CC-BY-NC-SA-2.5",
75067
+ "CC-BY-NC-SA-3.0",
75068
+ "CC-BY-NC-SA-4.0",
75069
+ "CC-BY-NC-ND",
75070
+ "CC-BY-NC-ND-1.0",
75071
+ "CC-BY-NC-ND-2.0",
75072
+ "CC-BY-NC-ND-2.5",
75073
+ "CC-BY-NC-ND-3.0",
75074
+ "CC-BY-NC-ND-4.0",
75075
+ "CC0-1.0",
75076
+ "CDDL-1.0",
75077
+ "CPL",
75078
+ "EFL",
75079
+ "EFL-1.0",
75080
+ "EFL-2.0",
75081
+ "MIT",
75082
+ "GPL",
75083
+ "GPL-1.0",
75084
+ "GPL-2.0",
75085
+ "GPL-3.0",
75086
+ "LGPL",
75087
+ "LGPL-2.1",
75088
+ "LGPL-3.0",
75089
+ "GNU-LGPL-2.0",
75090
+ "GFDL",
75091
+ "GFDL-1.0",
75092
+ "GFDL-1.1",
75093
+ "GFDL-1.2",
75094
+ "GFDL-1.3",
75095
+ "GFDL-NIV",
75096
+ "LPPL",
75097
+ "LPPL-1.0",
75098
+ "LPPL-1.1",
75099
+ "LPPL-1.2",
75100
+ "LPPL-1.3",
75101
+ "MPL-1.1",
75102
+ "Perl",
75103
+ "Python-2.0",
75104
+ "QPL-1.0",
75105
+ "W3C",
75106
+ "Zlib",
75107
+ "Zope",
75108
+ "Zope-1.0",
75109
+ "Zope-1.1",
75110
+ "Zope-2.0",
75111
+ "Zope-2.1",
75112
+ "CERN-OHL",
75113
+ "WTFPL",
75114
+ "Unlicense",
75115
+ "open-source",
75116
+ "unrestricted"
75117
+ ];
75118
+ var kicadPcmV1LicenseSet = new Set(KICAD_PCM_V1_LICENSES);
75119
+ var isValidKicadPcmV1License = (license) => typeof license === "string" && kicadPcmV1LicenseSet.has(license.trim());
75120
+ function assertValidKicadPcmV1License(license) {
75121
+ if (!isValidKicadPcmV1License(license)) {
75122
+ const value = typeof license === "string" ? license.trim() : "";
75123
+ throw new Error(`Invalid KiCad PCM v1 license "${value || "(empty)"}". Choose a license allowed by ${KICAD_PCM_SCHEMA_URLS[1]} or use schema version 2 for KiCad 10+`);
75124
+ }
75125
+ }
75023
75126
  var isValidKicadPcmV2License = (license) => typeof license === "string" && license.trim().length > 0;
75024
75127
  function assertValidKicadPcmV2License(license) {
75025
75128
  if (!isValidKicadPcmV2License(license)) {
75026
- throw new Error(`Invalid KiCad PCM v2 license "(empty)". License must be a non-empty string allowed by ${KICAD_PCM_SCHEMA_URL}`);
75129
+ throw new Error(`Invalid KiCad PCM v2 license "(empty)". License must be a non-empty string allowed by ${KICAD_PCM_SCHEMA_URLS[2]}`);
75027
75130
  }
75028
75131
  }
75132
+ function resolveKicadPcmSchemaVersion({
75133
+ license,
75134
+ preference = "auto"
75135
+ }) {
75136
+ assertValidKicadPcmV2License(license);
75137
+ if (preference === 1) {
75138
+ assertValidKicadPcmV1License(license);
75139
+ return 1;
75140
+ }
75141
+ if (preference === 2)
75142
+ return 2;
75143
+ return isValidKicadPcmV1License(license) ? 1 : 2;
75144
+ }
75029
75145
 
75030
75146
  // lib/shared/generate-pcm-assets.ts
75031
75147
  async function generatePcmAssets(options) {
@@ -75036,18 +75152,23 @@ async function generatePcmAssets(options) {
75036
75152
  description = "",
75037
75153
  descriptionFull = `Visit https://tscircuit.com/${author}/${packageName} for more information.`,
75038
75154
  license,
75155
+ schemaVersion: schemaVersionPreference = "auto",
75039
75156
  kicadLibraryPath,
75040
75157
  outputDir,
75041
75158
  baseUrl,
75042
75159
  displayName = `${author}/${packageName}`
75043
75160
  } = options;
75044
- assertValidKicadPcmV2License(license);
75161
+ const schemaVersion = resolveKicadPcmSchemaVersion({
75162
+ license,
75163
+ preference: schemaVersionPreference
75164
+ });
75165
+ const schemaUrl = KICAD_PCM_SCHEMA_URLS[schemaVersion];
75045
75166
  const normalizedLicense = license.trim();
75046
75167
  const identifier = `com.tscircuit.${author}.${packageName}`.toLowerCase().replace(/[^a-z0-9.-]/g, "-").slice(0, 50);
75047
75168
  fs8.mkdirSync(outputDir, { recursive: true });
75048
75169
  console.log("Creating metadata.json...");
75049
75170
  const metadata = {
75050
- $schema: KICAD_PCM_SCHEMA_URL,
75171
+ $schema: schemaUrl,
75051
75172
  name: displayName,
75052
75173
  description: description.slice(0, 500),
75053
75174
  description_full: descriptionFull.slice(0, 5000),
@@ -75116,8 +75237,8 @@ async function generatePcmAssets(options) {
75116
75237
  const packagesJsonSha256 = crypto3.createHash("sha256").update(packagesJsonBuffer).digest("hex");
75117
75238
  const packagesJsonUrl = baseUrl ? `${baseUrl}/pcm/packages.json` : "./packages.json";
75118
75239
  const repositoryJson = {
75119
- $schema: KICAD_PCM_SCHEMA_URL,
75120
- schema_version: KICAD_PCM_SCHEMA_VERSION,
75240
+ $schema: schemaUrl,
75241
+ ...schemaVersion === 2 ? { schema_version: 2 } : {},
75121
75242
  name: displayName,
75122
75243
  maintainer: {
75123
75244
  name: author,
@@ -75139,7 +75260,8 @@ async function generatePcmAssets(options) {
75139
75260
  packagesJsonPath,
75140
75261
  packageZipPath: zipFilePath,
75141
75262
  packageZipSha256: sha256,
75142
- packageZipSize: zipSize
75263
+ packageZipSize: zipSize,
75264
+ schemaVersion
75143
75265
  };
75144
75266
  }
75145
75267
  function addDirectoryToZip(opts) {
@@ -75207,6 +75329,10 @@ var pcbSnapshotSettingsSchema = z21.object({
75207
75329
  showPcbNotes: z21.boolean().optional(),
75208
75330
  showFabricationNotes: z21.boolean().optional()
75209
75331
  });
75332
+ var kicadPcmSettingsSchema = z21.object({
75333
+ schemaVersion: z21.union([z21.literal("auto"), z21.literal(1), z21.literal(2)]).optional(),
75334
+ license: z21.string().trim().min(1).optional()
75335
+ });
75210
75336
  var projectConfigSchema = z21.object({
75211
75337
  mainEntrypoint: z21.string().optional(),
75212
75338
  libraryEntrypoint: z21.string().optional(),
@@ -75221,6 +75347,7 @@ var projectConfigSchema = z21.object({
75221
75347
  kicadProjectEntrypointPath: z21.string().optional(),
75222
75348
  kicadLibraryEntrypointPath: z21.string().optional(),
75223
75349
  kicadLibraryName: z21.string().optional(),
75350
+ kicadPcm: kicadPcmSettingsSchema.optional(),
75224
75351
  alwaysUseLatestTscircuitOnCloud: z21.boolean().optional(),
75225
75352
  build: z21.object({
75226
75353
  circuitJson: z21.boolean().optional(),
@@ -75422,8 +75549,12 @@ async function buildKicadPcm({
75422
75549
  const version2 = packageJson.version || "1.0.0";
75423
75550
  const author = getPackageAuthor(packageJson.name || "") || "tscircuit";
75424
75551
  const description = packageJson.description || "";
75425
- assertValidKicadPcmV2License(packageJson.license);
75426
- const license = packageJson.license.trim();
75552
+ const license = projectConfig?.kicadPcm?.license ?? packageJson.license;
75553
+ const schemaVersion = resolveKicadPcmSchemaVersion({
75554
+ license,
75555
+ preference: projectConfig?.kicadPcm?.schemaVersion
75556
+ });
75557
+ const normalizedLicense = license.trim();
75427
75558
  const libraryName = kicadLibraryNameOption ?? resolveKicadLibraryName({ projectDir });
75428
75559
  const kicadLibOutputDir = path13.join(distDir, "kicad-library-pcm");
75429
75560
  const kicadPcmPackageId = `com_tscircuit_${author}_${packageName}`.replace(/\./g, "_");
@@ -75445,7 +75576,8 @@ async function buildKicadPcm({
75445
75576
  version: version2,
75446
75577
  author,
75447
75578
  description,
75448
- license,
75579
+ license: normalizedLicense,
75580
+ schemaVersion,
75449
75581
  kicadLibraryPath: kicadLibOutputDir,
75450
75582
  outputDir: pcmOutputDir,
75451
75583
  baseUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1792",
3
+ "version": "0.1.1793",
4
4
  "main": "dist/cli/main.js",
5
5
  "exports": {
6
6
  ".": "./dist/cli/main.js",
@@ -83,6 +83,22 @@
83
83
  "type": "string",
84
84
  "description": "Name for the generated KiCad library. Falls back to package.json name, then directory name."
85
85
  },
86
+ "kicadPcm": {
87
+ "type": "object",
88
+ "additionalProperties": false,
89
+ "properties": {
90
+ "schemaVersion": {
91
+ "enum": ["auto", 1, 2],
92
+ "description": "KiCad PCM schema version. Auto uses v1 when compatible for KiCad 6-10 support, otherwise v2 for KiCad 10+."
93
+ },
94
+ "license": {
95
+ "type": "string",
96
+ "minLength": 1,
97
+ "description": "Distribution-specific license for KiCad PCM output. Falls back to package.json license."
98
+ }
99
+ },
100
+ "description": "KiCad PCM output settings."
101
+ },
86
102
  "alwaysUseLatestTscircuitOnCloud": {
87
103
  "type": "boolean",
88
104
  "description": "Always use the latest TSCircuit version when building on the cloud."