@overscore/cli 0.11.11 → 0.11.12
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 +41 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1336,11 +1336,15 @@ async function syncPlatformRules(targetDir, baseUrl, apiKey) {
|
|
|
1336
1336
|
/**
|
|
1337
1337
|
* Explicit on-demand platform rules sync. Reports what changed so Claude
|
|
1338
1338
|
* can tell the user what's new. Called by `npx @overscore/cli platform update`.
|
|
1339
|
+
*
|
|
1340
|
+
* With `--check`: read-only mode. Reports what *would* change without writing.
|
|
1339
1341
|
*/
|
|
1340
|
-
async function platformUpdate() {
|
|
1342
|
+
async function platformUpdate(checkOnly = false) {
|
|
1341
1343
|
const { apiUrl, apiKey } = await loadEnv();
|
|
1342
1344
|
const baseUrl = apiUrl.replace(/\/api$/, "");
|
|
1343
|
-
console.log(
|
|
1345
|
+
console.log(checkOnly
|
|
1346
|
+
? "\n Checking platform rules (no changes will be written)...\n"
|
|
1347
|
+
: "\n Syncing platform rules from Hub...\n");
|
|
1344
1348
|
const capPath = path.resolve(process.cwd(), ".claude", "platform-capabilities.md");
|
|
1345
1349
|
const prevContent = fs.existsSync(capPath) ? fs.readFileSync(capPath, "utf-8") : null;
|
|
1346
1350
|
const prevVersion = prevContent?.match(/^version:\s*(.+)$/m)?.[1]?.trim() ?? null;
|
|
@@ -1360,19 +1364,41 @@ async function platformUpdate() {
|
|
|
1360
1364
|
for (const [relPath, content] of Object.entries(data.files)) {
|
|
1361
1365
|
const fullPath = path.join(process.cwd(), ".claude", relPath);
|
|
1362
1366
|
const existing = fs.existsSync(fullPath) ? fs.readFileSync(fullPath, "utf-8") : null;
|
|
1363
|
-
|
|
1364
|
-
fs.writeFileSync(fullPath, content);
|
|
1365
|
-
if (existing !== content)
|
|
1367
|
+
if (existing !== content) {
|
|
1366
1368
|
updated.push(relPath);
|
|
1369
|
+
if (!checkOnly) {
|
|
1370
|
+
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
|
|
1371
|
+
fs.writeFileSync(fullPath, content);
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
// syncClaudeMdImports only makes sense if we're actually writing files.
|
|
1376
|
+
// In check mode, compute whether imports would be added by reading current state.
|
|
1377
|
+
let claudeWouldChange = false;
|
|
1378
|
+
if (checkOnly) {
|
|
1379
|
+
const claudeMdPath = path.join(process.cwd(), ".claude", "CLAUDE.md");
|
|
1380
|
+
if (fs.existsSync(claudeMdPath)) {
|
|
1381
|
+
const cmContent = fs.readFileSync(claudeMdPath, "utf-8");
|
|
1382
|
+
const heading = cmContent.match(/^#\s+Overscore\s+(Dashboard|Analysis)/im);
|
|
1383
|
+
if (heading) {
|
|
1384
|
+
const required = heading[1].toLowerCase() === "analysis" ? ANALYSIS_IMPORTS : DASHBOARD_IMPORTS;
|
|
1385
|
+
claudeWouldChange = required.some((imp) => !cmContent.includes(imp));
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
if (claudeWouldChange)
|
|
1389
|
+
updated.push(".claude/CLAUDE.md (@imports would be added)");
|
|
1390
|
+
}
|
|
1391
|
+
else {
|
|
1392
|
+
const claudeUpdated = syncClaudeMdImports(process.cwd());
|
|
1393
|
+
if (claudeUpdated)
|
|
1394
|
+
updated.push(".claude/CLAUDE.md (@imports updated)");
|
|
1367
1395
|
}
|
|
1368
|
-
const claudeUpdated = syncClaudeMdImports(process.cwd());
|
|
1369
|
-
if (claudeUpdated)
|
|
1370
|
-
updated.push(".claude/CLAUDE.md (@imports updated)");
|
|
1371
1396
|
if (updated.length === 0) {
|
|
1372
1397
|
console.log(" Already up to date — no changes.\n");
|
|
1373
1398
|
return;
|
|
1374
1399
|
}
|
|
1375
|
-
|
|
1400
|
+
const verb = checkOnly ? "Would update" : "Updated";
|
|
1401
|
+
console.log(` ${verb} ${updated.length} file${updated.length === 1 ? "" : "s"}:\n`);
|
|
1376
1402
|
for (const f of updated)
|
|
1377
1403
|
console.log(` ${f}`);
|
|
1378
1404
|
if (updated.includes("platform-capabilities.md")) {
|
|
@@ -2394,17 +2420,20 @@ else if (command === "analysis") {
|
|
|
2394
2420
|
}
|
|
2395
2421
|
else if (command === "platform") {
|
|
2396
2422
|
if (subcommand === "update") {
|
|
2397
|
-
|
|
2423
|
+
const checkOnly = process.argv.includes("--check");
|
|
2424
|
+
platformUpdate(checkOnly);
|
|
2398
2425
|
}
|
|
2399
2426
|
else {
|
|
2400
2427
|
console.log(`
|
|
2401
2428
|
overscore platform — Manage platform rules and capabilities
|
|
2402
2429
|
|
|
2403
2430
|
Commands:
|
|
2404
|
-
update
|
|
2431
|
+
update Sync latest platform rules, skills, and capabilities from Hub
|
|
2432
|
+
update --check Show what would change without writing anything
|
|
2405
2433
|
|
|
2406
|
-
|
|
2434
|
+
Examples:
|
|
2407
2435
|
npx @overscore/cli platform update
|
|
2436
|
+
npx @overscore/cli platform update --check
|
|
2408
2437
|
`);
|
|
2409
2438
|
}
|
|
2410
2439
|
}
|