@tscircuit/cli 0.1.1838 → 0.1.1840

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.
@@ -11851,16 +11851,28 @@ function analyzeCircuitJson(circuitJson) {
11851
11851
  const hasWarningType = typeof item.warning_type === "string";
11852
11852
  const isTypedError = typeof t === "string" && t.endsWith("_error");
11853
11853
  const isTypedWarning = typeof t === "string" && t.endsWith("_warning");
11854
- if (hasErrorType || isTypedError) {
11855
- errors.push(item);
11856
- continue;
11857
- }
11858
11854
  if (hasWarningType || isTypedWarning) {
11859
11855
  warnings.push(item);
11856
+ continue;
11857
+ }
11858
+ if (hasErrorType || isTypedError) {
11859
+ errors.push(item);
11860
11860
  }
11861
11861
  }
11862
11862
  return { errors, warnings };
11863
11863
  }
11864
+ function formatCircuitJsonDiagnostics({
11865
+ errors,
11866
+ warnings
11867
+ }) {
11868
+ const lines = [`Errors: ${errors.length}`, `Warnings: ${warnings.length}`];
11869
+ for (const issue of [...errors, ...warnings]) {
11870
+ const issueType = issue.warning_type ?? issue.error_type ?? issue.type ?? "unknown_issue";
11871
+ lines.push(`- ${issueType}: ${issue.message ?? ""}`);
11872
+ }
11873
+ return lines.join(`
11874
+ `);
11875
+ }
11864
11876
 
11865
11877
  // lib/shared/generate-circuit-json.tsx
11866
11878
  import fs7 from "node:fs";
@@ -12139,7 +12151,9 @@ class AutorouterDiagnostics {
12139
12151
  };
12140
12152
  if (this.options.enabled && !this.hasWrittenPlacementSnapshot) {
12141
12153
  const placementCircuitJson = this.getCurrentCircuitJson().filter((element) => !this.isRouteElement(element));
12142
- this.writePngSnapshot("placement-unrouted.png", placementCircuitJson);
12154
+ this.writePngSnapshot("placement-unrouted.png", placementCircuitJson, {
12155
+ shouldDrawRatsNest: true
12156
+ });
12143
12157
  this.hasWrittenPlacementSnapshot = true;
12144
12158
  }
12145
12159
  if (this.options.enabled) {
@@ -12387,9 +12401,9 @@ class AutorouterDiagnostics {
12387
12401
  this.logArtifact(filePath);
12388
12402
  return filePath;
12389
12403
  }
12390
- writePngSnapshot(fileName, circuitJson) {
12404
+ writePngSnapshot(fileName, circuitJson, options) {
12391
12405
  try {
12392
- const pcbSvg = convertCircuitJsonToPcbSvg(circuitJson);
12406
+ const pcbSvg = convertCircuitJsonToPcbSvg(circuitJson, options);
12393
12407
  const png = convertSvgToPngBuffer(pcbSvg);
12394
12408
  const debugDir = path2.resolve(this.options.debugDir ?? DEFAULT_DEBUG_DIR);
12395
12409
  fs2.mkdirSync(debugDir, { recursive: true });
@@ -13198,9 +13212,10 @@ var EMPTY_IGNORE_COUNTS = () => ({
13198
13212
  pin_specification: 0,
13199
13213
  placement: 0,
13200
13214
  routing: 0,
13215
+ source: 0,
13201
13216
  unknown: 0
13202
13217
  });
13203
- var normalizeCategory = (category) => category === "netlist" || category === "pin_specification" || category === "placement" || category === "routing" ? category : "unknown";
13218
+ var normalizeCategory = (category) => category === "netlist" || category === "pin_specification" || category === "placement" || category === "routing" || category === "source" ? category : "unknown";
13204
13219
  var categorizeIssue = (issue) => normalizeCategory(categorizeErrorOrWarning(issue));
13205
13220
  var shouldIgnoreCategory = (category, ignoreOptions) => {
13206
13221
  switch (category) {
@@ -13261,6 +13276,7 @@ var formatIgnoredDrcCounts = (counts) => [
13261
13276
  ["pin_specification", counts.pin_specification],
13262
13277
  ["placement", counts.placement],
13263
13278
  ["routing", counts.routing],
13279
+ ["source", counts.source],
13264
13280
  ["unknown", counts.unknown]
13265
13281
  ].filter(([, count]) => count > 0).map(([category, count]) => `${category}: ${count}`).join(", ");
13266
13282