@codebakers/cli 1.1.4 → 1.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 +53 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -91,8 +91,24 @@ async function fetchPatterns(patterns) {
|
|
|
91
91
|
body: JSON.stringify({ patterns })
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
+
async function checkCliVersion() {
|
|
95
|
+
try {
|
|
96
|
+
const baseUrl = getApiUrl();
|
|
97
|
+
const response = await fetchFn(`${baseUrl}/api/cli/version`);
|
|
98
|
+
if (!response.ok) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
return response.json();
|
|
102
|
+
} catch {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
94
106
|
|
|
95
107
|
// src/commands/setup.ts
|
|
108
|
+
import { createRequire } from "module";
|
|
109
|
+
var require2 = createRequire(import.meta.url);
|
|
110
|
+
var packageJson = require2("../../package.json");
|
|
111
|
+
var CURRENT_VERSION = packageJson.version;
|
|
96
112
|
var CODEBAKERS_MARKER = "# CODEBAKERS SMART ROUTER";
|
|
97
113
|
var USER_CONTENT_SEPARATOR = `
|
|
98
114
|
|
|
@@ -216,28 +232,61 @@ Validation failed: ${validation.error || "Unknown error"}`));
|
|
|
216
232
|
console.log(chalk.dim("The AI will use CodeBakers patterns for any changes.\n"));
|
|
217
233
|
console.log(chalk.bold("Other Commands:\n"));
|
|
218
234
|
console.log(chalk.cyan(" /feature [idea]") + chalk.dim(" - Add new functionality"));
|
|
219
|
-
console.log(chalk.cyan(" /
|
|
235
|
+
console.log(chalk.cyan(" /design [path]") + chalk.dim(" - Clone design from mockups"));
|
|
236
|
+
console.log(chalk.cyan(" /status") + chalk.dim(" - View project progress"));
|
|
237
|
+
console.log(chalk.cyan(" /commands") + chalk.dim(" - List all commands\n"));
|
|
220
238
|
} else {
|
|
221
239
|
console.log(chalk.green(`\u2713 ${greeting} ready to build!
|
|
222
240
|
`));
|
|
223
|
-
console.log(chalk.bold("
|
|
241
|
+
console.log(chalk.bold("6 Commands to Know:\n"));
|
|
224
242
|
console.log(chalk.cyan(" /build [idea]"));
|
|
225
243
|
console.log(chalk.dim(" Start a new project. AI asks questions, plans everything,"));
|
|
226
244
|
console.log(chalk.dim(" then builds phase by phase with tests.\n"));
|
|
227
245
|
console.log(chalk.cyan(" /feature [idea]"));
|
|
228
246
|
console.log(chalk.dim(" Add to an existing project. AI analyzes your codebase"));
|
|
229
247
|
console.log(chalk.dim(" and integrates the new feature properly.\n"));
|
|
248
|
+
console.log(chalk.cyan(" /design [path]"));
|
|
249
|
+
console.log(chalk.dim(" Clone a design pixel-perfect from mockups or websites."));
|
|
250
|
+
console.log(chalk.dim(' Example: /design ./mockups or /design "like Linear"\n'));
|
|
230
251
|
console.log(chalk.cyan(" /status"));
|
|
231
252
|
console.log(chalk.dim(" See project progress, what's built, what's next.\n"));
|
|
232
253
|
console.log(chalk.cyan(" /audit"));
|
|
233
254
|
console.log(chalk.dim(" Review code quality, security, and get a score.\n"));
|
|
234
|
-
console.log(chalk.
|
|
235
|
-
console.log(chalk.
|
|
255
|
+
console.log(chalk.cyan(" /commands"));
|
|
256
|
+
console.log(chalk.dim(" List all available commands.\n"));
|
|
257
|
+
console.log(chalk.bold("Examples:"));
|
|
258
|
+
console.log(chalk.white(" /build a project management tool for remote teams"));
|
|
259
|
+
console.log(chalk.white(" /design ./mockups\n"));
|
|
236
260
|
console.log(chalk.dim("The AI will ask discovery questions, create a PRD, and"));
|
|
237
261
|
console.log(chalk.dim("build your app with production patterns + tests.\n"));
|
|
238
262
|
}
|
|
263
|
+
checkForUpdates();
|
|
239
264
|
});
|
|
240
265
|
}
|
|
266
|
+
async function checkForUpdates() {
|
|
267
|
+
try {
|
|
268
|
+
const versionInfo = await checkCliVersion();
|
|
269
|
+
if (!versionInfo) return;
|
|
270
|
+
const currentParts = CURRENT_VERSION.split(".").map(Number);
|
|
271
|
+
const latestParts = versionInfo.latest.split(".").map(Number);
|
|
272
|
+
let needsUpdate = false;
|
|
273
|
+
for (let i = 0; i < 3; i++) {
|
|
274
|
+
if ((latestParts[i] || 0) > (currentParts[i] || 0)) {
|
|
275
|
+
needsUpdate = true;
|
|
276
|
+
break;
|
|
277
|
+
} else if ((latestParts[i] || 0) < (currentParts[i] || 0)) {
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
if (needsUpdate) {
|
|
282
|
+
console.log(chalk.yellow(`
|
|
283
|
+
\u{1F4E6} Update available: ${CURRENT_VERSION} \u2192 ${versionInfo.latest}`));
|
|
284
|
+
console.log(chalk.dim(` Run: ${versionInfo.updateCommand}
|
|
285
|
+
`));
|
|
286
|
+
}
|
|
287
|
+
} catch {
|
|
288
|
+
}
|
|
289
|
+
}
|
|
241
290
|
function detectExistingProject() {
|
|
242
291
|
const cwd = process.cwd();
|
|
243
292
|
const indicators = [
|