@aivin-labs/cli 1.0.0
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/README.md +214 -0
- package/bin/assets/aivin-icon.png +0 -0
- package/bin/cli.mjs +1256 -0
- package/bin/lib/auth.mjs +355 -0
- package/bin/lib/browserAutomation.mjs +575 -0
- package/bin/lib/codegen.mjs +858 -0
- package/bin/lib/connectors.mjs +217 -0
- package/bin/lib/context.mjs +149 -0
- package/bin/lib/deploy.mjs +350 -0
- package/bin/lib/mcpProxy.mjs +380 -0
- package/bin/lib/mission.mjs +68 -0
- package/bin/lib/missionStream.mjs +656 -0
- package/bin/lib/pluginTrigger.mjs +535 -0
- package/bin/lib/scaffold.mjs +653 -0
- package/bin/lib/store.mjs +204 -0
- package/bin/lib/tasks.mjs +345 -0
- package/bin/lib/util.mjs +40 -0
- package/bin/lib/workspace.mjs +280 -0
- package/docs/CHANGELOG.md +8 -0
- package/docs/CLI.md +1079 -0
- package/docs/GETTING_STARTED.md +234 -0
- package/package.json +59 -0
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { execSync } from 'child_process';
|
|
5
|
+
import axios from 'axios';
|
|
6
|
+
import { flattenManifestFile } from '@aivin-labs/sdk';
|
|
7
|
+
|
|
8
|
+
// ── Shared deploy helpers ────────────────────────────────────────────────
|
|
9
|
+
|
|
10
|
+
export const DEPLOY_EXCLUDE_DIRS = ['node_modules', '.git', '.tmp', 'dist', 'build', '.test'];
|
|
11
|
+
|
|
12
|
+
// `package-lock.json` is NOT excluded - the backend's generated Dockerfile runs `npm ci`, which
|
|
13
|
+
// requires a lockfile to exist in the build context; see ensureLockfile() below.
|
|
14
|
+
export const DEPLOY_EXCLUDE_FILES = ['.gitignore', 'yarn.lock'];
|
|
15
|
+
|
|
16
|
+
// Matches '.env' and every variant (.env.local, .env.production, ...) - these can carry real
|
|
17
|
+
// secrets and must never end up in the uploaded `files` payload.
|
|
18
|
+
export const isEnvFile = (name) => name === '.env' || name.startsWith('.env.');
|
|
19
|
+
|
|
20
|
+
export function readDirectoryRecursive(dir, basePath = '') {
|
|
21
|
+
const files = {};
|
|
22
|
+
const items = fs.readdirSync(dir);
|
|
23
|
+
|
|
24
|
+
for (const item of items) {
|
|
25
|
+
const fullPath = path.join(dir, item);
|
|
26
|
+
// Backend keys are always forward-slash, matching how it's later written back with
|
|
27
|
+
// `path.resolve(communityPluginDir, filename)` - on Windows, `path.join` here would produce
|
|
28
|
+
// backslash-separated keys (e.g. "src\\main.ts") that the backend's POSIX filesystem treats as
|
|
29
|
+
// one literal filename containing a backslash, not a nested path - breaking every deploy.
|
|
30
|
+
const relativePath = basePath ? `${basePath}/${item}` : item;
|
|
31
|
+
const stat = fs.statSync(fullPath);
|
|
32
|
+
|
|
33
|
+
if (stat.isDirectory()) {
|
|
34
|
+
if (!DEPLOY_EXCLUDE_DIRS.includes(item)) {
|
|
35
|
+
Object.assign(files, readDirectoryRecursive(fullPath, relativePath));
|
|
36
|
+
}
|
|
37
|
+
} else if (!DEPLOY_EXCLUDE_FILES.includes(item) && !isEnvFile(item)) {
|
|
38
|
+
files[relativePath] = fs.readFileSync(fullPath, 'utf8');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return files;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function incrementVersion(version) {
|
|
46
|
+
const parts = (version || '1.0.0').split('.');
|
|
47
|
+
const patch = parseInt(parts[2] || '0') + 1;
|
|
48
|
+
return `${parts[0] || '1'}.${parts[1] || '0'}.${patch}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Matches the backend's real PluginDeployRequestDto (src/plugins/dto/PluginDTO.ts):
|
|
53
|
+
* { id, manifest, stacks?, files, client?, user_id? }. There's no visibility/scope flag to set here
|
|
54
|
+
* - a plugin deployed through this CLI is always private to your org. The platform's only real
|
|
55
|
+
* "submit to the public store" path is `publish_scope: 'community'` through the browser
|
|
56
|
+
* CodeEditor's `/code/publish` (a different runtime entirely - sandboxed LITE plugins, not this
|
|
57
|
+
* SDK's Docker/gRPC ones); there's currently no CLI-reachable equivalent for that.
|
|
58
|
+
*
|
|
59
|
+
* `files` must be omitted entirely (not sent as `{}`) for a proxy/MCP manifest - the backend's
|
|
60
|
+
* PluginDeploymentService only takes its "manifest-only" branch when `body.files` is falsy
|
|
61
|
+
* (see the `if (body.files) {...} else if (parsedManifest?.proxy_config) {...}` check there); an
|
|
62
|
+
* empty object would still be truthy and misroute a codeless proxy plugin into the code-deploy path.
|
|
63
|
+
*
|
|
64
|
+
* `manifest` here is already flattened (see `flattenManifestFile()`) - a multi-function plugin
|
|
65
|
+
* authored as `{ ...commonFields, plugins: [...] }` on disk arrives here as a flat array of entries.
|
|
66
|
+
* The backend's `deployUnified` checks `Array.isArray(parsedManifest)` BEFORE it even looks at
|
|
67
|
+
* `body.id`, so no top-level `id` is sent for that shape. If every entry declares `proxy_config`
|
|
68
|
+
* there's no code at all (same reasoning as the single-manifest case); otherwise `files` is
|
|
69
|
+
* included, since a multi-function plugin's entries all share one `src/main.ts`/container - see
|
|
70
|
+
* docs/MANIFEST.md#multi-function-plugins.
|
|
71
|
+
*/
|
|
72
|
+
export function buildDeploymentPayload(manifest, pluginFiles) {
|
|
73
|
+
if (Array.isArray(manifest)) {
|
|
74
|
+
const allProxy = manifest.every((m) => m.proxy_config);
|
|
75
|
+
return allProxy ? { manifest } : { manifest, files: pluginFiles };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const id = manifest.id || manifest.name.toLowerCase().replace(/[^a-z0-9-]/g, '-');
|
|
79
|
+
if (manifest.proxy_config) {
|
|
80
|
+
return { id, manifest };
|
|
81
|
+
}
|
|
82
|
+
return { id, manifest, files: pluginFiles };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The backend's generated Dockerfile runs `npm ci` (not `npm install`) for reproducible builds -
|
|
87
|
+
* that command hard-requires a lockfile to already exist, but `aivin create`'s scaffold doesn't
|
|
88
|
+
* generate one (only `npm install`, a manual step, does). Rather than make deploy depend on the
|
|
89
|
+
* developer remembering to run that first, generate one automatically (fast - `--package-lock-only`
|
|
90
|
+
* skips downloading/writing node_modules) whenever it's missing.
|
|
91
|
+
*/
|
|
92
|
+
export function ensureLockfile(currentDir) {
|
|
93
|
+
const lockPath = path.join(currentDir, 'package-lock.json');
|
|
94
|
+
if (fs.existsSync(lockPath)) return;
|
|
95
|
+
|
|
96
|
+
console.log(chalk.gray(' No package-lock.json found - generating one (required for the container build)...'));
|
|
97
|
+
try {
|
|
98
|
+
execSync('npm install --package-lock-only', { cwd: currentDir, stdio: 'pipe' });
|
|
99
|
+
} catch (error) {
|
|
100
|
+
throw new Error(
|
|
101
|
+
`Failed to generate package-lock.json: ${error.stderr?.toString().trim() || error.message}`,
|
|
102
|
+
{ cause: error },
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Generates a sample input for `entry.input` (POST /code/generate-sample-data - same AI helper the
|
|
109
|
+
* browser CodeEditor uses) and invokes the freshly deployed plugin with it (POST /plugins/execute),
|
|
110
|
+
* so `aivin test` actually verifies the plugin *runs*, not just that the container built. Returns
|
|
111
|
+
* one result record per entry; never throws - a failure to test is recorded, not fatal to the CLI.
|
|
112
|
+
*/
|
|
113
|
+
export async function smokeTestEntry(serverUrl, authHeaders, entry, workspaceId) {
|
|
114
|
+
const result = { plugin_id: entry.id, name: entry.name, func: entry.func || undefined };
|
|
115
|
+
|
|
116
|
+
let sampleInput = {};
|
|
117
|
+
try {
|
|
118
|
+
const sampleRes = await axios.post(
|
|
119
|
+
`${serverUrl}/code/generate-sample-data`,
|
|
120
|
+
{ input_schema: entry.input || {}, logic: entry.description },
|
|
121
|
+
authHeaders,
|
|
122
|
+
);
|
|
123
|
+
sampleInput = sampleRes.data || {};
|
|
124
|
+
} catch (error) {
|
|
125
|
+
result.sample_data_error = error.response?.data?.message || error.message;
|
|
126
|
+
}
|
|
127
|
+
result.input = sampleInput;
|
|
128
|
+
|
|
129
|
+
const start = Date.now();
|
|
130
|
+
try {
|
|
131
|
+
const execRes = await axios.post(
|
|
132
|
+
`${serverUrl}/plugins/execute`,
|
|
133
|
+
{ plugin_id: entry.id, arguments: sampleInput, workspace_id: workspaceId, purpose: 'aivin test - automated smoke test' },
|
|
134
|
+
authHeaders,
|
|
135
|
+
);
|
|
136
|
+
result.duration_ms = Date.now() - start;
|
|
137
|
+
result.response = execRes.data;
|
|
138
|
+
const status = String(execRes.data?.status || '').toLowerCase();
|
|
139
|
+
// A plugin legitimately blocked on human input/auth is not a *failure* of the plugin itself.
|
|
140
|
+
result.passed = ['success', 'waiting', 'needs_auth', 'hil_timeout'].includes(status) || execRes.data?.status === undefined;
|
|
141
|
+
} catch (error) {
|
|
142
|
+
result.duration_ms = Date.now() - start;
|
|
143
|
+
result.passed = false;
|
|
144
|
+
result.error = error.response?.data?.message || error.message;
|
|
145
|
+
}
|
|
146
|
+
return result;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Runs `smokeTestEntry` for every non-proxy entry and writes a JSON report to `.test/` in the
|
|
151
|
+
* current project - one file per `aivin test` run, so you can diff/compare across runs.
|
|
152
|
+
*/
|
|
153
|
+
export async function runSmokeTest({ currentDir, serverUrl, apiKey, entries, isProxyPlugin, workspaceOverride }) {
|
|
154
|
+
if (isProxyPlugin) {
|
|
155
|
+
console.log(chalk.gray(' Proxy plugin - no generic smoke test to run (calls an external system, not your code).'));
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const authHeaders = { headers: { Authorization: `Bearer ${apiKey || 'dev-token'}` } };
|
|
160
|
+
|
|
161
|
+
let workspaceId = workspaceOverride;
|
|
162
|
+
if (!workspaceId) {
|
|
163
|
+
try {
|
|
164
|
+
const wsRes = await axios.get(`${serverUrl}/workspace/list`, authHeaders);
|
|
165
|
+
const workspaces = Array.isArray(wsRes.data) ? wsRes.data : wsRes.data?.items || [];
|
|
166
|
+
workspaceId = workspaces[0]?.id || workspaces[0]?._id;
|
|
167
|
+
} catch (error) {
|
|
168
|
+
console.log(chalk.yellow(`⚠️ Couldn't look up a workspace to test against (${error.message}) - skipping smoke test. Pass --workspace <id> to specify one directly.`));
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (!workspaceId) {
|
|
173
|
+
console.log(chalk.yellow('⚠️ No workspace found for this account - skipping smoke test. Pass --workspace <id> to specify one directly.'));
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
console.log(chalk.blue('🧪 Running smoke test (generated input, real invoke)...'));
|
|
178
|
+
// Give the container a moment to finish binding its gRPC server after the build/up completed.
|
|
179
|
+
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
180
|
+
|
|
181
|
+
const results = [];
|
|
182
|
+
for (const entry of entries) {
|
|
183
|
+
// A mixed multi-function batch can have some proxy entries and some real-code entries (see
|
|
184
|
+
// buildDeploymentPayload's doc comment) - the batch-level `isProxyPlugin` check above only
|
|
185
|
+
// catches the all-proxy case, so skip proxy entries individually here too: they call an
|
|
186
|
+
// external system, not your code, same reasoning as the early-return above.
|
|
187
|
+
if (entry.proxy_config) {
|
|
188
|
+
console.log(chalk.gray(` ${entry.name} - proxy plugin, no generic smoke test to run`));
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
const result = await smokeTestEntry(serverUrl, authHeaders, entry, workspaceId);
|
|
192
|
+
results.push(result);
|
|
193
|
+
const icon = result.passed ? chalk.green('✅') : chalk.red('❌');
|
|
194
|
+
const label = `${result.name}${result.func ? ` [${result.func}]` : ''}`;
|
|
195
|
+
console.log(` ${icon} ${label} - ${result.passed ? `passed (${result.duration_ms}ms)` : `failed: ${result.error || 'unexpected status'}`}`);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// A failure writing the report (permissions, disk full, ...) shouldn't be reported as a failed
|
|
199
|
+
// deploy - the deploy itself already succeeded by the time we get here.
|
|
200
|
+
try {
|
|
201
|
+
const testDir = path.join(currentDir, '.test');
|
|
202
|
+
fs.mkdirSync(testDir, { recursive: true });
|
|
203
|
+
const reportPath = path.join(testDir, `${new Date().toISOString().replace(/[:.]/g, '-')}.json`);
|
|
204
|
+
fs.writeFileSync(
|
|
205
|
+
reportPath,
|
|
206
|
+
JSON.stringify({ timestamp: new Date().toISOString(), workspace_id: workspaceId, passed: results.every((r) => r.passed), results }, null, 2),
|
|
207
|
+
);
|
|
208
|
+
console.log(chalk.gray(` Report saved: ${path.relative(currentDir, reportPath)}`));
|
|
209
|
+
} catch (error) {
|
|
210
|
+
console.log(chalk.yellow(`⚠️ Smoke test ran, but saving the report failed: ${error.message}`));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export async function deployPlugin({ endpointPath, label, smokeTest, workspaceOverride }) {
|
|
215
|
+
console.log(chalk.blue(`🚀 ${label}...`));
|
|
216
|
+
|
|
217
|
+
const currentDir = process.cwd();
|
|
218
|
+
const manifestPath = path.join(currentDir, 'manifest.json');
|
|
219
|
+
|
|
220
|
+
if (!fs.existsSync(manifestPath)) {
|
|
221
|
+
throw new Error('manifest.json not found in current directory');
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// `rawManifest` is exactly what's on disk - possibly the ergonomic { ...commonFields, plugins:
|
|
225
|
+
// [...] } multi-function authoring shape (see docs/MANIFEST.md#multi-function-plugins). `manifest`
|
|
226
|
+
// is always either a single object or a flat array, the only two shapes anything downstream of
|
|
227
|
+
// this needs to understand. For the group shape these are DIFFERENT objects (flatten copies
|
|
228
|
+
// fields), so version bump / assigned-id write-back has to target `rawManifest`, not `manifest` -
|
|
229
|
+
// for the other two shapes they're the same object/array, so mutating one mutates both.
|
|
230
|
+
const rawManifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
231
|
+
const isGroupShape = !!(rawManifest && typeof rawManifest === 'object' && !Array.isArray(rawManifest) && Array.isArray(rawManifest.plugins));
|
|
232
|
+
|
|
233
|
+
const manifest = flattenManifestFile(rawManifest);
|
|
234
|
+
const isBatch = Array.isArray(manifest);
|
|
235
|
+
const entries = isBatch ? manifest : [manifest];
|
|
236
|
+
|
|
237
|
+
const isProxyPlugin = entries.every((m) => m.proxy_config);
|
|
238
|
+
if (!isProxyPlugin) {
|
|
239
|
+
ensureLockfile(currentDir);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const serverUrl = process.env.AIVIN_BASE_URL || 'https://api.aivin.cloud';
|
|
243
|
+
const apiKey = process.env.API_KEY;
|
|
244
|
+
|
|
245
|
+
if (isBatch) {
|
|
246
|
+
console.log(
|
|
247
|
+
`📦 ${entries.length} plugins (batch): ${entries.map((m) => `${m.name}${m.func ? `[${m.func}]` : ''}`).join(', ')}`,
|
|
248
|
+
);
|
|
249
|
+
} else {
|
|
250
|
+
console.log(
|
|
251
|
+
`📦 ${manifest.name} v${manifest.version}` +
|
|
252
|
+
(isProxyPlugin ? ` [proxy: ${manifest.proxy_config.type}]` : ''),
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
if (!apiKey) {
|
|
256
|
+
console.log(chalk.yellow('⚠️ API_KEY not set - run `aivin login` first'));
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const pluginFiles = isProxyPlugin ? undefined : readDirectoryRecursive(currentDir);
|
|
260
|
+
const deploymentData = buildDeploymentPayload(manifest, pluginFiles);
|
|
261
|
+
|
|
262
|
+
const loadingChars = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
263
|
+
let loadingIndex = 0;
|
|
264
|
+
const loadingLabel = isProxyPlugin ? 'Registering proxy manifest...' : 'Uploading and scanning code...';
|
|
265
|
+
const loadingInterval = setInterval(() => {
|
|
266
|
+
process.stdout.write(`\r${chalk.cyan(loadingChars[loadingIndex])} ${loadingLabel}`);
|
|
267
|
+
loadingIndex = (loadingIndex + 1) % loadingChars.length;
|
|
268
|
+
}, 100);
|
|
269
|
+
|
|
270
|
+
try {
|
|
271
|
+
const response = await axios.post(`${serverUrl}${endpointPath}`, deploymentData, {
|
|
272
|
+
headers: {
|
|
273
|
+
'Content-Type': 'application/json',
|
|
274
|
+
Authorization: `Bearer ${apiKey || 'dev-token'}`,
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
clearInterval(loadingInterval);
|
|
279
|
+
process.stdout.write('\r' + ' '.repeat(50) + '\r');
|
|
280
|
+
|
|
281
|
+
const result = response.data ?? {};
|
|
282
|
+
if (result.success === false) {
|
|
283
|
+
throw new Error(result.message || `HTTP ${response.status}: ${response.statusText}`);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
console.log(chalk.green(`✅ ${label} succeeded!`));
|
|
287
|
+
// deployUnified's array branch returns { group_id, count, plugin_ids } - plugin_ids is in the
|
|
288
|
+
// same order as the entries we sent, so map them back onto each entry's `id`. For the group
|
|
289
|
+
// authoring shape, that means writing into rawManifest.plugins[i] (the flattened `entries` are
|
|
290
|
+
// disposable copies, not what's on disk).
|
|
291
|
+
if (isBatch) {
|
|
292
|
+
if (Array.isArray(result.plugin_ids)) {
|
|
293
|
+
result.plugin_ids.forEach((assignedId, i) => {
|
|
294
|
+
if (!assignedId || !entries[i] || assignedId === entries[i].id) return;
|
|
295
|
+
entries[i].id = assignedId;
|
|
296
|
+
if (isGroupShape && rawManifest.plugins[i]) rawManifest.plugins[i].id = assignedId;
|
|
297
|
+
});
|
|
298
|
+
console.log(chalk.gray(` Plugin IDs assigned: ${result.plugin_ids.join(', ')}`));
|
|
299
|
+
}
|
|
300
|
+
} else if (result.plugin_id && result.plugin_id !== manifest.id) {
|
|
301
|
+
// The backend's single-plugin deploy path always reassigns the real, persisted id server-side
|
|
302
|
+
// (never equal to what we sent) - `result.plugin_id` is the ONLY place that real id is ever
|
|
303
|
+
// reported back. Without writing it back here, every later `aivin test`/`plugin trigger` call
|
|
304
|
+
// would keep using the id we originally sent, which was never actually saved as this plugin's
|
|
305
|
+
// queryable id, and every /plugins/execute call by id would fail with "plugin not found".
|
|
306
|
+
manifest.id = result.plugin_id;
|
|
307
|
+
console.log(chalk.gray(` Plugin ID assigned: ${result.plugin_id}`));
|
|
308
|
+
}
|
|
309
|
+
if (result.group_id) {
|
|
310
|
+
console.log(chalk.gray(` Group ID: ${result.group_id}`));
|
|
311
|
+
}
|
|
312
|
+
if (result.message) {
|
|
313
|
+
console.log(chalk.gray(` Message: ${result.message}`));
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (isGroupShape) {
|
|
317
|
+
// One shared `version` field, not one per entry.
|
|
318
|
+
rawManifest.version = incrementVersion(rawManifest.version);
|
|
319
|
+
fs.writeFileSync(manifestPath, JSON.stringify(rawManifest, null, 2));
|
|
320
|
+
console.log(chalk.blue(`🔄 Version auto-incremented to: ${rawManifest.version}`));
|
|
321
|
+
} else {
|
|
322
|
+
entries.forEach((m) => { m.version = incrementVersion(m.version); });
|
|
323
|
+
fs.writeFileSync(manifestPath, JSON.stringify(rawManifest, null, 2));
|
|
324
|
+
console.log(chalk.blue(`🔄 Version auto-incremented to: ${entries.map((m) => m.version).join(', ')}`));
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (smokeTest) {
|
|
328
|
+
await runSmokeTest({ currentDir, serverUrl, apiKey, entries, isProxyPlugin, workspaceOverride });
|
|
329
|
+
}
|
|
330
|
+
} catch (error) {
|
|
331
|
+
clearInterval(loadingInterval);
|
|
332
|
+
process.stdout.write('\r' + ' '.repeat(50) + '\r');
|
|
333
|
+
|
|
334
|
+
const message = error.response?.data?.message || error.message;
|
|
335
|
+
console.log(chalk.red(`❌ ${label} failed:`), message);
|
|
336
|
+
|
|
337
|
+
if (error.code === 'ECONNREFUSED' || message.includes('ECONNREFUSED')) {
|
|
338
|
+
console.log(chalk.yellow('🔧 Check if the Aivin server is running and accessible'));
|
|
339
|
+
} else if (error.response?.status === 401 || error.response?.status === 403) {
|
|
340
|
+
console.log(chalk.yellow('🔧 Check your API_KEY environment variable'));
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (pluginFiles) {
|
|
344
|
+
console.log(
|
|
345
|
+
chalk.gray(`📁 ${Object.keys(pluginFiles).length} files were prepared for deployment`),
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
process.exitCode = 1;
|
|
349
|
+
}
|
|
350
|
+
}
|