@telelabsai/ship 1.1.14 → 1.1.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.
- package/cli/commands/sync.js +50 -20
- package/package.json +1 -1
package/cli/commands/sync.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const https = require('https');
|
|
2
2
|
const http = require('http');
|
|
3
|
-
const { execSync
|
|
3
|
+
const { execSync } = require('child_process');
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const prompts = require('prompts');
|
|
@@ -33,7 +33,13 @@ function sync(args) {
|
|
|
33
33
|
process.exit(1);
|
|
34
34
|
}
|
|
35
35
|
if (data.error) {
|
|
36
|
-
|
|
36
|
+
if (data.error === 'Invalid token' || data.error === 'Missing authorization') {
|
|
37
|
+
console.error(' Your session has expired or is invalid.\n');
|
|
38
|
+
console.error(' Please re-authenticate:');
|
|
39
|
+
console.error(' ship auth login\n');
|
|
40
|
+
} else {
|
|
41
|
+
console.error(` Error: ${data.error}\n`);
|
|
42
|
+
}
|
|
37
43
|
process.exit(1);
|
|
38
44
|
}
|
|
39
45
|
|
|
@@ -97,11 +103,10 @@ function sync(args) {
|
|
|
97
103
|
}
|
|
98
104
|
}
|
|
99
105
|
|
|
100
|
-
// Install via claude plugin add
|
|
106
|
+
// Install via claude plugin marketplace add + plugin install
|
|
101
107
|
console.log(`\n Installing "${selected.name}"...\n`);
|
|
102
108
|
|
|
103
109
|
try {
|
|
104
|
-
// Check if claude is installed
|
|
105
110
|
execSync('claude --version', { stdio: 'pipe' });
|
|
106
111
|
} catch {
|
|
107
112
|
console.error(' Error: Claude Code is not installed.');
|
|
@@ -109,25 +114,50 @@ function sync(args) {
|
|
|
109
114
|
process.exit(1);
|
|
110
115
|
}
|
|
111
116
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
// Step 1: Add the marketplace
|
|
118
|
+
console.log(' Adding marketplace...\n');
|
|
119
|
+
try {
|
|
120
|
+
execSync(`claude plugin marketplace add ${selected.deployUrl}`, {
|
|
121
|
+
stdio: 'inherit',
|
|
122
|
+
cwd: process.cwd(),
|
|
123
|
+
});
|
|
124
|
+
} catch (err) {
|
|
125
|
+
console.error(`\n Failed to add marketplace.\n`);
|
|
126
|
+
process.exit(1);
|
|
127
|
+
}
|
|
116
128
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
129
|
+
// Step 2: Install each plugin
|
|
130
|
+
const plugins = selected.plugins || [];
|
|
131
|
+
const marketplaceName = selected.marketplaceName;
|
|
132
|
+
|
|
133
|
+
if (!marketplaceName || plugins.length === 0) {
|
|
134
|
+
console.log(' ✓ Marketplace added. No plugins to auto-install.\n');
|
|
135
|
+
saveSyncConfig(process.cwd(), selected.slug);
|
|
136
|
+
process.exit(0);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
let failed = false;
|
|
140
|
+
for (const plugin of plugins) {
|
|
141
|
+
const installId = `${plugin.name}@${marketplaceName}`;
|
|
142
|
+
console.log(` Installing ${installId}...\n`);
|
|
143
|
+
try {
|
|
144
|
+
execSync(`claude plugin install ${installId}`, {
|
|
145
|
+
stdio: 'inherit',
|
|
146
|
+
cwd: process.cwd(),
|
|
147
|
+
});
|
|
148
|
+
} catch {
|
|
149
|
+
console.error(` Failed to install ${installId}\n`);
|
|
150
|
+
failed = true;
|
|
123
151
|
}
|
|
124
|
-
|
|
125
|
-
});
|
|
152
|
+
}
|
|
126
153
|
|
|
127
|
-
|
|
128
|
-
console.
|
|
129
|
-
|
|
130
|
-
|
|
154
|
+
if (!failed) {
|
|
155
|
+
console.log(`\n ✓ "${selected.name}" installed successfully.\n`);
|
|
156
|
+
} else {
|
|
157
|
+
console.log(`\n ⚠ Some plugins failed to install.\n`);
|
|
158
|
+
}
|
|
159
|
+
saveSyncConfig(process.cwd(), selected.slug);
|
|
160
|
+
process.exit(failed ? 1 : 0);
|
|
131
161
|
});
|
|
132
162
|
}
|
|
133
163
|
|