@dealdeploy/skl 1.10.2 → 1.10.3

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.
Files changed (3) hide show
  1. package/bunfig.toml +3 -0
  2. package/lib.ts +16 -14
  3. package/package.json +1 -1
package/bunfig.toml ADDED
@@ -0,0 +1,3 @@
1
+ [test]
2
+ root = "."
3
+ exclude = ["opensrc/", "node_modules/"]
package/lib.ts CHANGED
@@ -299,25 +299,27 @@ export async function downloadSkillFiles(
299
299
  branch: string,
300
300
  prefix: string,
301
301
  destDir: string,
302
- tree: { path: string; type: string }[],
302
+ tree: { path: string; type: string; sha?: string }[],
303
303
  ): Promise<number> {
304
304
  const prefixSlash = prefix + "/";
305
- const files = tree
306
- .filter((e) => e.type === "blob" && e.path.startsWith(prefixSlash))
307
- .map((e) => e.path);
308
-
309
- const baseUrl = `https://raw.githubusercontent.com/${repo}/${branch}`;
310
-
311
- for (const filePath of files) {
312
- const url = `${baseUrl}/${filePath}`;
313
- const resp = await fetch(url);
314
- if (!resp.ok) continue;
315
- const content = await resp.arrayBuffer();
316
- const relativePath = filePath.substring(prefixSlash.length);
305
+ const files = tree.filter(
306
+ (e) => e.type === "blob" && e.path.startsWith(prefixSlash),
307
+ );
308
+
309
+ for (const file of files) {
310
+ const proc = Bun.spawn(
311
+ ["gh", "api", `repos/${repo}/git/blobs/${file.sha}`, "--jq", ".content"],
312
+ { stdout: "pipe", stderr: "pipe" },
313
+ );
314
+ const out = await new Response(proc.stdout).text();
315
+ const code = await proc.exited;
316
+ if (code !== 0) continue;
317
+ const content = Buffer.from(out.trim(), "base64");
318
+ const relativePath = file.path.substring(prefixSlash.length);
317
319
  const dest = join(destDir, relativePath);
318
320
  const dir = dest.substring(0, dest.lastIndexOf("/"));
319
321
  mkdirSync(dir, { recursive: true });
320
- writeFileSync(dest, Buffer.from(content));
322
+ writeFileSync(dest, content);
321
323
  }
322
324
 
323
325
  return files.length;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dealdeploy/skl",
3
- "version": "1.10.2",
3
+ "version": "1.10.3",
4
4
  "description": "TUI skill manager for Claude Code agents",
5
5
  "module": "index.ts",
6
6
  "bin": {