@0dai-dev/cli 3.1.7 → 3.1.9
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/bin/0dai.js +16 -5
- package/package.json +1 -1
package/bin/0dai.js
CHANGED
|
@@ -344,9 +344,16 @@ function writeFiles(target, files) {
|
|
|
344
344
|
if (rel.endsWith("settings.json")) {
|
|
345
345
|
finalContent = mergeSettingsJson(existing, content);
|
|
346
346
|
merged++;
|
|
347
|
-
} else if (rel === "AGENTS.md"
|
|
348
|
-
|
|
349
|
-
|
|
347
|
+
} else if (rel === "AGENTS.md") {
|
|
348
|
+
if (existing.includes("managed: false")) {
|
|
349
|
+
unchanged++; // User owns this file, skip
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
// Backup existing AGENTS.md before overwrite
|
|
353
|
+
const backupDir = path.join(target, "ai", ".backups");
|
|
354
|
+
fs.mkdirSync(backupDir, { recursive: true });
|
|
355
|
+
fs.writeFileSync(path.join(backupDir, "AGENTS.md.bak"), existing, "utf8");
|
|
356
|
+
updated++;
|
|
350
357
|
} else {
|
|
351
358
|
updated++;
|
|
352
359
|
}
|
|
@@ -1379,8 +1386,12 @@ async function checkVersion() {
|
|
|
1379
1386
|
|
|
1380
1387
|
const result = await apiCall("/v1/version");
|
|
1381
1388
|
if (result.version && result.version !== VERSION) {
|
|
1382
|
-
|
|
1383
|
-
|
|
1389
|
+
// Only suggest update if remote version is actually newer
|
|
1390
|
+
const cmp = (a, b) => { const [a1,a2,a3] = a.split(".").map(Number); const [b1,b2,b3] = b.split(".").map(Number); return a1 - b1 || a2 - b2 || a3 - b3; };
|
|
1391
|
+
if (cmp(result.version, VERSION) > 0) {
|
|
1392
|
+
log(`Update available: ${VERSION} → ${result.version}`);
|
|
1393
|
+
console.log(` Run: npm update -g @0dai-dev/cli\n`);
|
|
1394
|
+
}
|
|
1384
1395
|
}
|
|
1385
1396
|
} catch {}
|
|
1386
1397
|
}
|