ai-builder 0.1.4 → 0.1.6
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/dist/index.js +6 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -72,7 +72,8 @@ async function trackInstall(type, slug, cliVersion) {
|
|
|
72
72
|
headers: { "Content-Type": "application/json" },
|
|
73
73
|
body: JSON.stringify({ type, slug, cliVersion })
|
|
74
74
|
});
|
|
75
|
-
|
|
75
|
+
const result = await response.json();
|
|
76
|
+
logger.debug({ type, slug, cliVersion, status: response.status, result }, "Install tracked");
|
|
76
77
|
} catch (error) {
|
|
77
78
|
logger.debug({ err: error, type, slug }, "Install tracking failed (non-critical)");
|
|
78
79
|
}
|
|
@@ -160,8 +161,8 @@ function getInstallPath(type, artifactName) {
|
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
function installArtifact(artifact, options = {}) {
|
|
163
|
-
const
|
|
164
|
-
const installPath = getInstallPath(artifact.type, artifactName
|
|
164
|
+
const artifactName = artifact.slug.split("/")[1];
|
|
165
|
+
const installPath = getInstallPath(artifact.type, artifactName);
|
|
165
166
|
const files = [];
|
|
166
167
|
if (!options.force && isInstalled(artifact.type, artifact.author, artifactName || artifact.name)) {
|
|
167
168
|
return { installed: false, files: [] };
|
|
@@ -256,12 +257,12 @@ async function addCommand(type, slug, options) {
|
|
|
256
257
|
spinner.warn(`${artifact.name} is already installed. Use --force to reinstall.`);
|
|
257
258
|
return;
|
|
258
259
|
}
|
|
259
|
-
trackInstall(type, slug, CLI_VERSION);
|
|
260
260
|
spinner.succeed(
|
|
261
261
|
`Installed ${chalk.green(artifact.name)} to ${chalk.dim(artifact.installPath)}`
|
|
262
262
|
);
|
|
263
263
|
console.log();
|
|
264
264
|
printUsageHint(type, artifactSlug);
|
|
265
|
+
await trackInstall(type, slug, CLI_VERSION);
|
|
265
266
|
} catch (error) {
|
|
266
267
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
267
268
|
spinner.fail(chalk.red(`Failed to install: ${message}`));
|
|
@@ -322,7 +323,7 @@ async function installStack(stackSlug, options) {
|
|
|
322
323
|
const result = installArtifact(resolved, { force: options.force });
|
|
323
324
|
if (result.installed) {
|
|
324
325
|
artifactSpinner.succeed(`Installed ${chalk.green(artifact.name)}`);
|
|
325
|
-
trackInstall(artifact.type, artifact.slug, CLI_VERSION);
|
|
326
|
+
await trackInstall(artifact.type, artifact.slug, CLI_VERSION);
|
|
326
327
|
installed++;
|
|
327
328
|
} else {
|
|
328
329
|
artifactSpinner.info(`${artifact.name} already installed`);
|