@contextai-core/cli 0.1.4 → 0.1.5
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/package.json +1 -1
- package/src/actions/install.js +10 -5
package/package.json
CHANGED
package/src/actions/install.js
CHANGED
|
@@ -33,7 +33,9 @@ export async function installPackage(packageSlug, options = {}) {
|
|
|
33
33
|
// 1. Fetch pack from Supabase
|
|
34
34
|
spinner.text = `Fetching pack info for ${packageSlug}...`;
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const supabase = getSupabase();
|
|
37
|
+
|
|
38
|
+
const { data: pack, error } = await supabase
|
|
37
39
|
.from('packs')
|
|
38
40
|
.select('*')
|
|
39
41
|
.eq('slug', packageSlug)
|
|
@@ -153,10 +155,13 @@ export async function installPackage(packageSlug, options = {}) {
|
|
|
153
155
|
const tempDir = path.join(os.tmpdir(), `contextai-${Date.now()}`);
|
|
154
156
|
zip.extractAllTo(tempDir, true);
|
|
155
157
|
|
|
156
|
-
// Find actual root
|
|
157
|
-
const items = fs.readdirSync(tempDir);
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
// Find actual root (only unwrap if it's a single folder)
|
|
159
|
+
const items = fs.readdirSync(tempDir).filter(i => !i.startsWith('.') && i !== '__MACOSX');
|
|
160
|
+
let sourceDir = tempDir;
|
|
161
|
+
|
|
162
|
+
if (items.length === 1 && fs.statSync(path.join(tempDir, items[0])).isDirectory()) {
|
|
163
|
+
sourceDir = path.join(tempDir, items[0]);
|
|
164
|
+
}
|
|
160
165
|
|
|
161
166
|
spinner.text = 'Injecting Verified Context...';
|
|
162
167
|
copyRecursiveSync(sourceDir, targetDir);
|