ai-builder 0.1.3 → 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/dist/index.js +19 -7
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -10,12 +10,24 @@ import chalk from "chalk";
|
|
|
10
10
|
import ora from "ora";
|
|
11
11
|
|
|
12
12
|
// src/services/api.ts
|
|
13
|
-
import { createCliLogger } from "@aibuilder/logger/adapters/cli";
|
|
14
13
|
var API_BASE = process.env.AI_BUILDER_API_URL || "https://aibuilder.sh/api";
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
14
|
+
var isDebug = process.env.DEBUG?.includes("ai-builder");
|
|
15
|
+
var logger = {
|
|
16
|
+
debug: (ctx, msg) => {
|
|
17
|
+
if (isDebug) console.error(`[debug] ${msg}`, ctx);
|
|
18
|
+
},
|
|
19
|
+
startTimer: (name) => {
|
|
20
|
+
const start = Date.now();
|
|
21
|
+
return {
|
|
22
|
+
done: (ctx) => {
|
|
23
|
+
if (isDebug) {
|
|
24
|
+
const durationMs = Date.now() - start;
|
|
25
|
+
console.error(`[debug] ${name}`, { ...ctx, durationMs });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
};
|
|
19
31
|
async function resolveArtifact(type, slug) {
|
|
20
32
|
const url = `${API_BASE}/resolve?type=${encodeURIComponent(type)}&slug=${encodeURIComponent(slug)}`;
|
|
21
33
|
const timer = logger.startTimer("api-resolve");
|
|
@@ -148,8 +160,8 @@ function getInstallPath(type, artifactName) {
|
|
|
148
160
|
}
|
|
149
161
|
}
|
|
150
162
|
function installArtifact(artifact, options = {}) {
|
|
151
|
-
const
|
|
152
|
-
const installPath = getInstallPath(artifact.type, artifactName
|
|
163
|
+
const artifactName = artifact.slug.split("/")[1];
|
|
164
|
+
const installPath = getInstallPath(artifact.type, artifactName);
|
|
153
165
|
const files = [];
|
|
154
166
|
if (!options.force && isInstalled(artifact.type, artifact.author, artifactName || artifact.name)) {
|
|
155
167
|
return { installed: false, files: [] };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-builder",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "CLI for installing Claude Code artifacts from aibuilder.sh",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@aibuilder/logger": "workspace:*",
|
|
26
25
|
"chalk": "^5.3.0",
|
|
27
26
|
"commander": "^12.1.0",
|
|
28
27
|
"ora": "^8.1.0"
|