@agentuity/cli 0.0.15 → 0.0.17

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,CAmD9E;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.17",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./dist/index.d.ts",
@@ -1,7 +1,7 @@
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';
4
- import { pipeline } from 'node:stream/promises';
2
+ import { existsSync, mkdirSync, mkdtempSync, renameSync, readdirSync, cpSync, rmSync } from 'node:fs';
3
+ import { homedir, tmpdir } from 'node:os';
4
+ import { finished } from 'node:stream/promises';
5
5
  import { createGunzip } from 'node:zlib';
6
6
  import { extract, type Headers } from 'tar-fs';
7
7
  import type { Logger } from '../../logger';
@@ -68,41 +68,37 @@ 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, {
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
+ const extractor = extract(tempDir, {
88
85
  filter: (name: string) => name.startsWith(prefix),
89
86
  map: (header: Headers) => {
90
87
  header.name = header.name.substring(prefix.length);
91
88
  return header;
92
89
  },
93
- })
94
- );
95
- }
96
- );
90
+ });
97
91
 
98
- await cleanup(tempDir, dest);
92
+ stream.pipe(createGunzip()).pipe(extractor);
93
+ await finished(extractor);
94
+ }
95
+ );
99
96
 
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}`);
97
+ await cleanup(tempDir, dest);
98
+ } finally {
99
+ // Clean up temp directory
100
+ rmSync(tempDir, { recursive: true, force: true });
104
101
  }
105
- rmSync(tempDir, { recursive: true, force: true });
106
102
  }
107
103
 
108
104
  export async function setupProject(options: SetupOptions): Promise<void> {