ai-exodus 2.0.0 → 2.0.1

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/deploy.js +23 -19
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "ai-exodus",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Migrate your AI relationship from any platform to Claude. Your AI belongs to you.",
5
5
  "type": "module",
6
6
  "bin": {
7
- "ai-exodus": "./bin/cli.js"
7
+ "ai-exodus": "bin/cli.js"
8
8
  },
9
9
  "files": [
10
10
  "bin/",
@@ -38,6 +38,6 @@
38
38
  },
39
39
  "repository": {
40
40
  "type": "git",
41
- "url": "https://github.com/martusha89/ai-exodus"
41
+ "url": "git+https://github.com/martusha89/ai-exodus.git"
42
42
  }
43
43
  }
package/src/deploy.js CHANGED
@@ -31,6 +31,19 @@ export async function deploy(options) {
31
31
  process.exit(1);
32
32
  }
33
33
 
34
+ // Check wrangler is authenticated
35
+ const whoamiOk = await checkCommand('npx', ['wrangler', 'whoami']);
36
+ if (!whoamiOk) {
37
+ console.error(' Error: Not logged into Cloudflare.');
38
+ console.error('');
39
+ console.error(' Run this first:');
40
+ console.error(' npx wrangler login');
41
+ console.error('');
42
+ console.error(' This opens your browser to log in (or create a free account).');
43
+ console.error(' Then run ai-exodus deploy again.');
44
+ process.exit(1);
45
+ }
46
+
34
47
  // Check if portal source exists
35
48
  if (!existsSync(join(PORTAL_DIR, 'worker.js'))) {
36
49
  console.error(' Error: Portal source not found at ' + PORTAL_DIR);
@@ -98,27 +111,18 @@ MCP_SECRET = "${mcpSecret}"
98
111
  // Step 3: Initialize database schema
99
112
  console.log(' [3/4] Initializing database schema...');
100
113
  try {
101
- const schemaContent = await readFile(join(PORTAL_DIR, 'schema.sql'), 'utf-8');
102
- // Split by semicolons and run each statement (wrangler --file can be finicky)
103
- const statements = schemaContent.split(';').map(s => s.trim()).filter(s => s.length > 5);
104
- for (const stmt of statements) {
105
- try {
106
- await runCommand('npx', ['wrangler', 'd1', 'execute', dbName, '--remote', '--command', stmt + ';'], { verbose, cwd: deployDir });
107
- } catch (err) {
108
- const msg = err.message || '';
109
- // Tolerate "already exists" and argument parsing issues with CREATE INDEX
110
- if (msg.includes('already exists') || msg.includes('Unknown arguments') || msg.includes('must provide')) {
111
- if (verbose) console.log(' (skipped: ' + msg.slice(0, 80) + ')');
112
- } else {
113
- console.error(' Schema error: ' + msg.slice(0, 200));
114
- console.error(' Deploy may fail — check your database manually.');
115
- }
116
- }
117
- }
114
+ await runCommand('npx', ['wrangler', 'd1', 'execute', dbName, '--remote', '--file', 'schema.sql'], { verbose, cwd: deployDir });
118
115
  console.log(' Schema applied.');
119
116
  } catch (err) {
120
- console.error(' Schema initialization failed: ' + err.message);
121
- console.error(' Try applying manually: npx wrangler d1 execute ' + dbName + ' --remote --file schema.sql');
117
+ const msg = err.message || '';
118
+ if (msg.includes('already exists')) {
119
+ console.log(' Schema already exists (this is fine).');
120
+ } else {
121
+ console.error(' Schema initialization failed.');
122
+ console.error(' Try applying manually:');
123
+ console.error(' npx wrangler d1 execute ' + dbName + ' --remote --file ' + join(deployDir, 'schema.sql'));
124
+ console.error(' Error: ' + msg.slice(0, 200));
125
+ }
122
126
  }
123
127
 
124
128
  // Step 4: Deploy worker