@agentuity/cli 0.0.17 → 0.0.18

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.
@@ -1 +1 @@
1
- {"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../src/cmd/project/download.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD,UAAU,eAAe;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,YAAY;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CACf;AAsBD,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAmD9E;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAgCvE"}
1
+ {"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../src/cmd/project/download.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD,UAAU,eAAe;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,YAAY;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CACf;AAsBD,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA+D9E;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAgCvE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentuity/cli",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./dist/index.d.ts",
@@ -1,6 +1,15 @@
1
1
  import { join, resolve } from 'node:path';
2
- import { existsSync, mkdirSync, mkdtempSync, renameSync, readdirSync, cpSync, rmSync } from 'node:fs';
3
- import { homedir, tmpdir } from 'node:os';
2
+ import {
3
+ existsSync,
4
+ mkdirSync,
5
+ mkdtempSync,
6
+ renameSync,
7
+ readdirSync,
8
+ cpSync,
9
+ rmSync,
10
+ createReadStream,
11
+ } from 'node:fs';
12
+ import { tmpdir } from 'node:os';
4
13
  import { finished } from 'node:stream/promises';
5
14
  import { createGunzip } from 'node:zlib';
6
15
  import { extract, type Headers } from 'tar-fs';
@@ -69,8 +78,10 @@ export async function downloadTemplate(options: DownloadOptions): Promise<void>
69
78
  const templatePath = `templates/${template.directory}`;
70
79
  const url = `https://codeload.github.com/${GITHUB_REPO}/tar.gz/${branch}`;
71
80
  const tempDir = mkdtempSync(join(tmpdir(), 'agentuity-'));
81
+ const tarballPath = join(tempDir, 'download.tar.gz');
72
82
 
73
83
  try {
84
+ // Download tarball to temp file
74
85
  await downloadWithSpinner(
75
86
  {
76
87
  url,
@@ -79,22 +90,32 @@ export async function downloadTemplate(options: DownloadOptions): Promise<void>
79
90
  : 'Downloading template files...',
80
91
  },
81
92
  async (stream) => {
82
- // Extract only the template directory from tarball
83
- const prefix = `sdk-${branch}/${templatePath}/`;
84
- const extractor = extract(tempDir, {
85
- filter: (name: string) => name.startsWith(prefix),
86
- map: (header: Headers) => {
87
- header.name = header.name.substring(prefix.length);
88
- return header;
89
- },
90
- });
91
-
92
- stream.pipe(createGunzip()).pipe(extractor);
93
- await finished(extractor);
93
+ // Write stream to file
94
+ const chunks: Buffer[] = [];
95
+ for await (const chunk of stream) {
96
+ chunks.push(Buffer.from(chunk));
97
+ }
98
+ await Bun.write(tarballPath, Buffer.concat(chunks));
94
99
  }
95
100
  );
96
101
 
97
- await cleanup(tempDir, dest);
102
+ // Extract tarball
103
+ const extractDir = join(tempDir, 'extract');
104
+ mkdirSync(extractDir, { recursive: true });
105
+
106
+ const prefix = `sdk-${branch}/${templatePath}/`;
107
+ const extractor = extract(extractDir, {
108
+ filter: (name: string) => name.startsWith(prefix),
109
+ map: (header: Headers) => {
110
+ header.name = header.name.substring(prefix.length);
111
+ return header;
112
+ },
113
+ });
114
+
115
+ createReadStream(tarballPath).pipe(createGunzip()).pipe(extractor);
116
+ await finished(extractor);
117
+
118
+ await cleanup(extractDir, dest);
98
119
  } finally {
99
120
  // Clean up temp directory
100
121
  rmSync(tempDir, { recursive: true, force: true });