@agentuity/cli 0.0.15 → 0.0.16

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,CAuD9E;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":"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,CAoD9E;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.15",
3
+ "version": "0.0.16",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./dist/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  import { join, resolve } from 'node:path';
2
- import { existsSync, mkdirSync, renameSync, readdirSync, cpSync, rmSync } from 'node:fs';
3
- import { homedir } from 'node:os';
2
+ import { existsSync, mkdirSync, mkdtempSync, renameSync, readdirSync, cpSync, rmSync } from 'node:fs';
3
+ import { homedir, tmpdir } from 'node:os';
4
4
  import { pipeline } from 'node:stream/promises';
5
5
  import { createGunzip } from 'node:zlib';
6
6
  import { extract, type Headers } from 'tar-fs';
@@ -68,41 +68,38 @@ export async function downloadTemplate(options: DownloadOptions): Promise<void>
68
68
  const branch = templateBranch || GITHUB_BRANCH;
69
69
  const templatePath = `templates/${template.directory}`;
70
70
  const url = `https://codeload.github.com/${GITHUB_REPO}/tar.gz/${branch}`;
71
- const tempDir = join(dest, '.temp-download');
72
- mkdirSync(tempDir, { recursive: true });
73
-
74
- await downloadWithSpinner(
75
- {
76
- url,
77
- message: templateBranch
78
- ? `Downloading template files from branch ${branch}...`
79
- : 'Downloading template files...',
80
- },
81
- async (stream) => {
82
- // Extract only the template directory from tarball
83
- const prefix = `sdk-${branch}/${templatePath}/`;
84
- await pipeline(
85
- stream,
86
- createGunzip(),
87
- extract(tempDir, {
88
- filter: (name: string) => name.startsWith(prefix),
89
- map: (header: Headers) => {
90
- header.name = header.name.substring(prefix.length);
91
- return header;
92
- },
93
- })
94
- );
95
- }
96
- );
97
-
98
- await cleanup(tempDir, dest);
71
+ const tempDir = mkdtempSync(join(tmpdir(), 'agentuity-'));
72
+
73
+ try {
74
+ await downloadWithSpinner(
75
+ {
76
+ url,
77
+ message: templateBranch
78
+ ? `Downloading template files from branch ${branch}...`
79
+ : 'Downloading template files...',
80
+ },
81
+ async (stream) => {
82
+ // Extract only the template directory from tarball
83
+ const prefix = `sdk-${branch}/${templatePath}/`;
84
+ await pipeline(
85
+ stream,
86
+ createGunzip(),
87
+ extract(tempDir, {
88
+ filter: (name: string) => name.startsWith(prefix),
89
+ map: (header: Headers) => {
90
+ header.name = header.name.substring(prefix.length);
91
+ return header;
92
+ },
93
+ })
94
+ );
95
+ }
96
+ );
99
97
 
100
- // Extra safety: refuse to delete root or home directories
101
- const home = homedir();
102
- if (tempDir === '/' || tempDir === home) {
103
- throw new Error(`Refusing to delete protected path: ${tempDir}`);
98
+ await cleanup(tempDir, dest);
99
+ } finally {
100
+ // Clean up temp directory
101
+ rmSync(tempDir, { recursive: true, force: true });
104
102
  }
105
- rmSync(tempDir, { recursive: true, force: true });
106
103
  }
107
104
 
108
105
  export async function setupProject(options: SetupOptions): Promise<void> {