@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contextai-core/cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Give your AI agents persistent memory. Install pre-built context packs for Cursor, Windsurf, Copilot & more.",
5
5
  "author": "ContextAI",
6
6
  "license": "ISC",
@@ -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 { data: purchaseData, error: purchaseError } = await getSupabase()
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
- const rootItem = items.find(i => fs.statSync(path.join(tempDir, i)).isDirectory());
159
- const sourceDir = rootItem ? path.join(tempDir, rootItem) : tempDir;
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);