coderio 1.0.1 → 1.0.2

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/index.d.ts CHANGED
@@ -801,8 +801,10 @@ declare class Workspace {
801
801
  initWorkspace(subPath: string, rootPath?: string, appName?: string): WorkspaceStructure;
802
802
  /**
803
803
  * Delete all files and directories inside the workspace
804
+ * @param workspace - The workspace structure
805
+ * @param exclude - Optional list of file/directory names to exclude from deletion
804
806
  */
805
- deleteWorkspace(workspace: WorkspaceStructure): void;
807
+ deleteWorkspace(workspace: WorkspaceStructure, exclude?: string[]): void;
806
808
  /**
807
809
  * Resolve the absolute path to the source code directory
808
810
  * @param paths - The workspace structure
package/dist/index.js CHANGED
@@ -472,7 +472,7 @@ var parseFigmaUrl = (url) => {
472
472
  if (!fileId || !nodeId) {
473
473
  throw new Error("Invalid Figma URL");
474
474
  }
475
- return { fileId, name, nodeId, projectName: `${name}_${nodeId}` };
475
+ return { fileId, name, nodeId, projectName: `${name}_${nodeId.replace(/:/g, "_")}` };
476
476
  };
477
477
 
478
478
  // src/tools/figma-tool/index.ts
@@ -636,12 +636,17 @@ var Workspace = class {
636
636
  }
637
637
  /**
638
638
  * Delete all files and directories inside the workspace
639
+ * @param workspace - The workspace structure
640
+ * @param exclude - Optional list of file/directory names to exclude from deletion
639
641
  */
640
- deleteWorkspace(workspace) {
642
+ deleteWorkspace(workspace, exclude = []) {
641
643
  try {
642
644
  if (fs2.existsSync(workspace.root)) {
643
645
  const entries = fs2.readdirSync(workspace.root);
644
646
  for (const entry of entries) {
647
+ if (exclude.includes(entry)) {
648
+ continue;
649
+ }
645
650
  const fullPath = path2.join(workspace.root, entry);
646
651
  fs2.rmSync(fullPath, { recursive: true, force: true });
647
652
  }
@@ -695,7 +700,7 @@ function saveDebugLog(requestInfo, responseInfo) {
695
700
  "------------response------------",
696
701
  JSON.stringify(responseInfo, null, 2)
697
702
  ].join("\n");
698
- writeFile(workspaceManager.path?.debug ?? "", `fetch_${(/* @__PURE__ */ new Date()).toISOString()}.md`, debugContent);
703
+ writeFile(workspaceManager.path?.debug ?? "", `fetch_${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-")}.md`, debugContent);
699
704
  }
700
705
  async function get(url, config) {
701
706
  const response = await axios.get(url, config);
@@ -1458,10 +1463,13 @@ var FigmaTool = class {
1458
1463
  }
1459
1464
  const document = await fetchFigmaNode(fileId, nodeId, token);
1460
1465
  if (!document || !document?.children?.length) {
1461
- return void 0;
1466
+ throw new Error("Failed to fetch Figma document");
1462
1467
  }
1463
1468
  const images = await fetchFigmaImages(fileId, nodeId, token);
1464
1469
  const thumbnail = images?.[nodeId] || "";
1470
+ if (!thumbnail) {
1471
+ throw new Error("Failed to fetch Figma document thumbnail");
1472
+ }
1465
1473
  document.thumbnailUrl = thumbnail;
1466
1474
  const cleanedDocument = cleanFigma(document);
1467
1475
  return cleanedDocument;