builderos-cli 2.0.1 → 2.0.2
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/index.js +18 -9
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -105,11 +105,15 @@ async function fileExists(path) {
|
|
|
105
105
|
async function fetchAPI(endpoint) {
|
|
106
106
|
try {
|
|
107
107
|
const url = `${options.apiUrl}${endpoint}`;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
|
|
109
|
+
// Only set Host header if API URL is not builder-os.test
|
|
110
|
+
// (for cases where we need to access through IP but want nginx to route correctly)
|
|
111
|
+
const headers = {};
|
|
112
|
+
if (!options.apiUrl.includes('builder-os.test')) {
|
|
113
|
+
headers['Host'] = 'builder-os.test';
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const response = await fetch(url, { headers });
|
|
113
117
|
|
|
114
118
|
if (!response.ok) {
|
|
115
119
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
@@ -118,6 +122,8 @@ async function fetchAPI(endpoint) {
|
|
|
118
122
|
return await response.json();
|
|
119
123
|
} catch (error) {
|
|
120
124
|
console.error(`❌ Error fetching ${endpoint}:`, error.message);
|
|
125
|
+
console.error(` URL: ${url}`);
|
|
126
|
+
console.error(` Stack:`, error.stack);
|
|
121
127
|
return null;
|
|
122
128
|
}
|
|
123
129
|
}
|
|
@@ -166,12 +172,15 @@ async function installSkills() {
|
|
|
166
172
|
|
|
167
173
|
// Fetch skills list
|
|
168
174
|
const data = await fetchAPI('/api/skills');
|
|
169
|
-
if (!data || !data.
|
|
175
|
+
if (!data || !data.data) {
|
|
170
176
|
console.log(' ❌ Failed to fetch skills list');
|
|
177
|
+
if (data) {
|
|
178
|
+
console.log(' Response structure:', JSON.stringify(Object.keys(data)));
|
|
179
|
+
}
|
|
171
180
|
return;
|
|
172
181
|
}
|
|
173
182
|
|
|
174
|
-
const skills = data.
|
|
183
|
+
const skills = data.data;
|
|
175
184
|
console.log(` Found ${skills.length} skills`);
|
|
176
185
|
|
|
177
186
|
// Create .claude/skills directory
|
|
@@ -187,7 +196,7 @@ async function installSkills() {
|
|
|
187
196
|
|
|
188
197
|
const skillData = await fetchAPI(`/api/skills/${skill.slug}`);
|
|
189
198
|
|
|
190
|
-
if (!skillData || !skillData.content) {
|
|
199
|
+
if (!skillData || !skillData.data || !skillData.data.content) {
|
|
191
200
|
console.log(` ⚠️ No content available`);
|
|
192
201
|
failedSkills.push(skill.slug);
|
|
193
202
|
continue;
|
|
@@ -199,7 +208,7 @@ async function installSkills() {
|
|
|
199
208
|
|
|
200
209
|
// Write skill.md
|
|
201
210
|
const skillPath = join(skillDir, 'skill.md');
|
|
202
|
-
await writeFile(skillPath, skillData.content);
|
|
211
|
+
await writeFile(skillPath, skillData.data.content);
|
|
203
212
|
|
|
204
213
|
console.log(` ✅ Saved to ${skillDir}/skill.md`);
|
|
205
214
|
successCount++;
|