@tscircuit/cli 0.1.1298 → 0.1.1300

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/dist/cli/main.js CHANGED
@@ -100574,7 +100574,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
100574
100574
  // lib/getVersion.ts
100575
100575
  import { createRequire as createRequire2 } from "node:module";
100576
100576
  // package.json
100577
- var version = "0.1.1297";
100577
+ var version = "0.1.1299";
100578
100578
  var package_default = {
100579
100579
  name: "@tscircuit/cli",
100580
100580
  version,
@@ -100588,7 +100588,7 @@ var package_default = {
100588
100588
  "@biomejs/biome": "^1.9.4",
100589
100589
  "@tscircuit/circuit-json-placement-analysis": "^0.0.6",
100590
100590
  "@tscircuit/circuit-json-routing-analysis": "^0.0.1",
100591
- "@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#d09c8d74f3085b29744bb0f1c9864c1154c69436",
100591
+ "@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#c7cfc20927dc5e24414a669e7bcfdecd83504f3e",
100592
100592
  "@tscircuit/fake-snippets": "^0.0.182",
100593
100593
  "@tscircuit/file-server": "^0.0.32",
100594
100594
  "@tscircuit/image-utils": "^0.0.3",
@@ -241234,6 +241234,32 @@ var registerCheckRouting = (program2) => {
241234
241234
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/analyze-schematic-placement.ts
241235
241235
  import { cju as cju7 } from "@tscircuit/circuit-json-util";
241236
241236
 
241237
+ // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/capacitor-orientation.ts
241238
+ var HORIZONTAL_CAPACITOR_SYMBOL_NAMES = new Set([
241239
+ "capacitor_left",
241240
+ "capacitor_right"
241241
+ ]);
241242
+ var isSchematicComponent = (element) => element.type === "schematic_component";
241243
+ var isSourceCapacitor = (circuitJson, sourceComponentId) => {
241244
+ if (!sourceComponentId)
241245
+ return false;
241246
+ return circuitJson.some((element) => element.type === "source_component" && element.source_component_id === sourceComponentId && element.ftype === "simple_capacitor");
241247
+ };
241248
+ var generateCapacitorOrientationIssues = (componentPlacements, circuitJson) => {
241249
+ const placementBySchematicComponentId = new Map(componentPlacements.filter((placement) => placement.schematicComponentId).map((placement) => [placement.schematicComponentId, placement]));
241250
+ return circuitJson.filter(isSchematicComponent).filter((schematicComponent) => isSourceCapacitor(circuitJson, schematicComponent.source_component_id) && HORIZONTAL_CAPACITOR_SYMBOL_NAMES.has(schematicComponent.symbol_name ?? "")).flatMap((schematicComponent) => {
241251
+ const schematicBox = placementBySchematicComponentId.get(schematicComponent.schematic_component_id);
241252
+ if (!schematicBox)
241253
+ return [];
241254
+ return [
241255
+ {
241256
+ lineItemType: "CapacitorSymbolHorizontal",
241257
+ schematicBox
241258
+ }
241259
+ ];
241260
+ });
241261
+ };
241262
+
241237
241263
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/schematic-box-overlap.ts
241238
241264
  var getCenteredRectBounds = (box2) => {
241239
241265
  const halfWidth = box2.width / 2;
@@ -241313,6 +241339,80 @@ var generateSchematicPlacementIssues = (componentPlacements) => {
241313
241339
  return issues;
241314
241340
  };
241315
241341
 
241342
+ // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/verbose-net-label.ts
241343
+ var VERBOSE_NET_LABEL_MESSAGE = "Create trace with schDisplayLabel";
241344
+ var isSchematicNetLabel = (element) => element.type === "schematic_net_label";
241345
+ var isSourcePort = (element) => element.type === "source_port";
241346
+ var getSourceComponentWithName = (element) => {
241347
+ if (element.type !== "source_component" || !("source_component_id" in element) || !("name" in element) || typeof element.source_component_id !== "string" || typeof element.name !== "string") {
241348
+ return null;
241349
+ }
241350
+ return {
241351
+ type: "source_component",
241352
+ source_component_id: element.source_component_id,
241353
+ name: element.name
241354
+ };
241355
+ };
241356
+ var getSourcePortNameCandidates = (sourcePort) => [
241357
+ sourcePort.most_frequently_referenced_by_name,
241358
+ sourcePort.name,
241359
+ ...sourcePort.port_hints ?? [],
241360
+ sourcePort.pin_number === undefined ? undefined : String(sourcePort.pin_number)
241361
+ ].filter((name) => Boolean(name));
241362
+ var getBestSourcePortName = (sourcePort) => sourcePort.most_frequently_referenced_by_name ?? sourcePort.name ?? (sourcePort.pin_number === undefined ? "" : `pin${sourcePort.pin_number}`);
241363
+ var getLabelTokenToInvolvedPinMap = (circuitJson) => {
241364
+ const sourceComponentById = new Map(circuitJson.flatMap((element) => {
241365
+ const sourceComponent = getSourceComponentWithName(element);
241366
+ return sourceComponent ? [sourceComponent] : [];
241367
+ }).map((sourceComponent) => [
241368
+ sourceComponent.source_component_id,
241369
+ sourceComponent
241370
+ ]));
241371
+ const tokenToInvolvedPin = new Map;
241372
+ for (const sourcePort of circuitJson.filter(isSourcePort)) {
241373
+ if (!sourcePort.source_component_id)
241374
+ continue;
241375
+ const sourceComponent = sourceComponentById.get(sourcePort.source_component_id);
241376
+ if (!sourceComponent?.name)
241377
+ continue;
241378
+ const involvedPin = `${sourceComponent.name}.${getBestSourcePortName(sourcePort)}`;
241379
+ for (const portName of getSourcePortNameCandidates(sourcePort)) {
241380
+ tokenToInvolvedPin.set(`${sourceComponent.name}_${portName}`, involvedPin);
241381
+ }
241382
+ }
241383
+ return tokenToInvolvedPin;
241384
+ };
241385
+ var getInvolvedPins = (netLabelText, tokenToInvolvedPin) => {
241386
+ const involvedPins = new Set;
241387
+ for (const token of netLabelText.split("/")) {
241388
+ const involvedPin = tokenToInvolvedPin.get(token);
241389
+ if (involvedPin)
241390
+ involvedPins.add(involvedPin);
241391
+ }
241392
+ return Array.from(involvedPins);
241393
+ };
241394
+ var generateVerboseNetLabelIssues = (circuitJson) => {
241395
+ const tokenToInvolvedPin = getLabelTokenToInvolvedPinMap(circuitJson);
241396
+ const issuesByText = new Map;
241397
+ for (const netLabel of circuitJson.filter(isSchematicNetLabel)) {
241398
+ if (!netLabel.text.includes("/"))
241399
+ continue;
241400
+ if (issuesByText.has(netLabel.text))
241401
+ continue;
241402
+ issuesByText.set(netLabel.text, {
241403
+ lineItemType: "VerboseSchematicNetLabel",
241404
+ schematicNetLabelId: netLabel.schematic_net_label_id,
241405
+ sourceNetId: netLabel.source_net_id,
241406
+ text: netLabel.text,
241407
+ involvedPins: getInvolvedPins(netLabel.text, tokenToInvolvedPin),
241408
+ schX: netLabel.center.x,
241409
+ schY: netLabel.center.y,
241410
+ message: VERBOSE_NET_LABEL_MESSAGE
241411
+ });
241412
+ }
241413
+ return Array.from(issuesByText.values());
241414
+ };
241415
+
241316
241416
  // node_modules/@tscircuit/circuit-json-schematic-placement-analysis/lib/analyze-schematic-placement.ts
241317
241417
  var fmtNumber5 = (value) => {
241318
241418
  if (Number.isInteger(value))
@@ -241324,7 +241424,7 @@ var fmtDelta = (value) => {
241324
241424
  return value > 0 ? `+${formattedValue}` : formattedValue;
241325
241425
  };
241326
241426
  var isSchematicBox = (element) => element.type === "schematic_box";
241327
- var isSchematicComponent = (element) => element.type === "schematic_component";
241427
+ var isSchematicComponent2 = (element) => element.type === "schematic_component";
241328
241428
  var getSourceComponentName = (circuitJson, sourceComponentId) => {
241329
241429
  if (!sourceComponentId)
241330
241430
  return;
@@ -241371,7 +241471,8 @@ var getSourceComponentMetadata = (schematicBox, circuitJson) => {
241371
241471
  var addAttr = (attrs, key, value, options) => {
241372
241472
  if (value === undefined)
241373
241473
  return;
241374
- attrs.push(`${key}="${typeof value === "number" ? options?.formatDelta ? fmtDelta(value) : fmtNumber5(value) : escapeAttr3(value)}"`);
241474
+ const stringValue = typeof value === "number" ? options?.formatDelta ? fmtDelta(value) : fmtNumber5(value) : options?.escape === false ? value : escapeAttr3(value);
241475
+ attrs.push(`${key}="${stringValue}"`);
241375
241476
  };
241376
241477
  var lineItemToString3 = (lineItem) => {
241377
241478
  const attrs = [];
@@ -241400,6 +241501,24 @@ var overlapIssueToString = (issue) => {
241400
241501
  ].join(`
241401
241502
  `);
241402
241503
  };
241504
+ var capacitorSymbolHorizontalIssueToString = (issue) => {
241505
+ const attrs = [];
241506
+ addAttr(attrs, "componentName", issue.schematicBox.sourceComponentName);
241507
+ addAttr(attrs, "schX", issue.schematicBox.schX);
241508
+ addAttr(attrs, "schY", issue.schematicBox.schY);
241509
+ addAttr(attrs, "width", issue.schematicBox.width);
241510
+ addAttr(attrs, "height", issue.schematicBox.height);
241511
+ return `<CapacitorSymbolHorizontal ${attrs.join(" ")} />`;
241512
+ };
241513
+ var verboseSchematicNetLabelIssueToString = (issue) => {
241514
+ const attrs = [];
241515
+ addAttr(attrs, "message", issue.message, { escape: false });
241516
+ addAttr(attrs, "text", issue.text);
241517
+ addAttr(attrs, "involvedPins", issue.involvedPins.join(","));
241518
+ addAttr(attrs, "schX", issue.schX);
241519
+ addAttr(attrs, "schY", issue.schY);
241520
+ return `<VerboseSchematicNetLabel ${attrs.join(" ")} />`;
241521
+ };
241403
241522
  var correctionSuggestionToString = (suggestion) => {
241404
241523
  const attrs = [];
241405
241524
  addAttr(attrs, "target", suggestion.targetComponentName);
@@ -241439,6 +241558,10 @@ class SchematicPlacementAnalysis {
241439
241558
  switch (issue.lineItemType) {
241440
241559
  case "ComponentOverlap":
241441
241560
  return overlapIssueToString(issue);
241561
+ case "CapacitorSymbolHorizontal":
241562
+ return capacitorSymbolHorizontalIssueToString(issue);
241563
+ case "VerboseSchematicNetLabel":
241564
+ return verboseSchematicNetLabelIssueToString(issue);
241442
241565
  default:
241443
241566
  return "";
241444
241567
  }
@@ -241451,12 +241574,16 @@ class SchematicPlacementAnalysis {
241451
241574
  }
241452
241575
  var analyzeSchematicPlacement = (circuitJson) => {
241453
241576
  const schematicBoxes = circuitJson.filter(isSchematicBox);
241454
- const schematicComponentIds = new Set(circuitJson.filter(isSchematicComponent).map((schematicComponent) => schematicComponent.schematic_component_id));
241577
+ const schematicComponentIds = new Set(circuitJson.filter(isSchematicComponent2).map((schematicComponent) => schematicComponent.schematic_component_id));
241455
241578
  const lineItems = [
241456
- ...circuitJson.filter(isSchematicComponent).map((schematicComponent) => schematicComponentToLineItem(schematicComponent, circuitJson, schematicBoxes.find((schematicBox) => schematicBox.schematic_component_id === schematicComponent.schematic_component_id))),
241579
+ ...circuitJson.filter(isSchematicComponent2).map((schematicComponent) => schematicComponentToLineItem(schematicComponent, circuitJson, schematicBoxes.find((schematicBox) => schematicBox.schematic_component_id === schematicComponent.schematic_component_id))),
241457
241580
  ...schematicBoxes.filter((schematicBox) => !schematicBox.schematic_component_id || !schematicComponentIds.has(schematicBox.schematic_component_id)).map((schematicBox) => schematicBoxToLineItem(schematicBox, circuitJson))
241458
241581
  ];
241459
- const issues = generateSchematicPlacementIssues(lineItems);
241582
+ const issues = [
241583
+ ...generateSchematicPlacementIssues(lineItems),
241584
+ ...generateCapacitorOrientationIssues(lineItems, circuitJson),
241585
+ ...generateVerboseNetLabelIssues(circuitJson)
241586
+ ];
241460
241587
  return new SchematicPlacementAnalysis([
241461
241588
  ...lineItems,
241462
241589
  ...issues.length > 0 ? [{ lineItemType: "SchematicPlacementIssues", issues }] : []
package/dist/lib/index.js CHANGED
@@ -65661,7 +65661,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
65661
65661
  }));
65662
65662
  };
65663
65663
  // package.json
65664
- var version = "0.1.1297";
65664
+ var version = "0.1.1299";
65665
65665
  var package_default = {
65666
65666
  name: "@tscircuit/cli",
65667
65667
  version,
@@ -65675,7 +65675,7 @@ var package_default = {
65675
65675
  "@biomejs/biome": "^1.9.4",
65676
65676
  "@tscircuit/circuit-json-placement-analysis": "^0.0.6",
65677
65677
  "@tscircuit/circuit-json-routing-analysis": "^0.0.1",
65678
- "@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#d09c8d74f3085b29744bb0f1c9864c1154c69436",
65678
+ "@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#c7cfc20927dc5e24414a669e7bcfdecd83504f3e",
65679
65679
  "@tscircuit/fake-snippets": "^0.0.182",
65680
65680
  "@tscircuit/file-server": "^0.0.32",
65681
65681
  "@tscircuit/image-utils": "^0.0.3",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1298",
3
+ "version": "0.1.1300",
4
4
  "main": "dist/cli/main.js",
5
5
  "exports": {
6
6
  ".": "./dist/cli/main.js",
@@ -11,7 +11,7 @@
11
11
  "@biomejs/biome": "^1.9.4",
12
12
  "@tscircuit/circuit-json-placement-analysis": "^0.0.6",
13
13
  "@tscircuit/circuit-json-routing-analysis": "^0.0.1",
14
- "@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#d09c8d74f3085b29744bb0f1c9864c1154c69436",
14
+ "@tscircuit/circuit-json-schematic-placement-analysis": "github:tscircuit/circuit-json-schematic-placement-analysis#c7cfc20927dc5e24414a669e7bcfdecd83504f3e",
15
15
  "@tscircuit/fake-snippets": "^0.0.182",
16
16
  "@tscircuit/file-server": "^0.0.32",
17
17
  "@tscircuit/image-utils": "^0.0.3",