@rodyssey/cli 0.1.1 → 0.1.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/dist/cli.js +74 -8
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2326,9 +2326,9 @@ ${errorText}`);
|
|
|
2326
2326
|
✨ Deployment successful!`);
|
|
2327
2327
|
}
|
|
2328
2328
|
|
|
2329
|
-
// src/upgrade-
|
|
2329
|
+
// src/upgrade-template.ts
|
|
2330
2330
|
import { execSync as execSync3 } from "node:child_process";
|
|
2331
|
-
import { existsSync as existsSync3 } from "node:fs";
|
|
2331
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync, copyFileSync, rmSync as rmSync2 } from "node:fs";
|
|
2332
2332
|
var TEMPLATES = {
|
|
2333
2333
|
webapp: {
|
|
2334
2334
|
name: "webapp (SPA)",
|
|
@@ -2355,6 +2355,11 @@ var TEMPLATES = {
|
|
|
2355
2355
|
]
|
|
2356
2356
|
}
|
|
2357
2357
|
};
|
|
2358
|
+
var CLI_SCRIPTS = {
|
|
2359
|
+
"link-game-sdk": "bunx @rodyssey/cli app update-game-sdk",
|
|
2360
|
+
deploy: "bunx @rodyssey/cli app deploy",
|
|
2361
|
+
"upgrade-template": "bunx @rodyssey/cli app upgrade-template"
|
|
2362
|
+
};
|
|
2358
2363
|
function detectTemplate() {
|
|
2359
2364
|
if (existsSync3("app")) {
|
|
2360
2365
|
console.log(`\uD83D\uDD0D Detected fullstack template (found app/ directory)
|
|
@@ -2370,10 +2375,66 @@ function detectTemplate() {
|
|
|
2370
2375
|
`);
|
|
2371
2376
|
return TEMPLATES["webapp"];
|
|
2372
2377
|
}
|
|
2373
|
-
|
|
2378
|
+
function updatePackageJsonScripts() {
|
|
2379
|
+
const pkgPath = "package.json";
|
|
2380
|
+
if (!existsSync3(pkgPath)) {
|
|
2381
|
+
console.log("⚠️ No package.json found, skipping scripts update");
|
|
2382
|
+
return;
|
|
2383
|
+
}
|
|
2384
|
+
const pkg = JSON.parse(readFileSync3(pkgPath, "utf-8"));
|
|
2385
|
+
if (!pkg.scripts) {
|
|
2386
|
+
pkg.scripts = {};
|
|
2387
|
+
}
|
|
2388
|
+
let updated = false;
|
|
2389
|
+
for (const [name, cmd] of Object.entries(CLI_SCRIPTS)) {
|
|
2390
|
+
if (pkg.scripts[name] !== cmd) {
|
|
2391
|
+
const action = pkg.scripts[name] ? "Updated" : "Added";
|
|
2392
|
+
pkg.scripts[name] = cmd;
|
|
2393
|
+
console.log(` \uD83D\uDCDD ${action} script: "${name}"`);
|
|
2394
|
+
updated = true;
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
if (updated) {
|
|
2398
|
+
writeFileSync2(pkgPath, JSON.stringify(pkg, null, 2) + `
|
|
2399
|
+
`, "utf-8");
|
|
2400
|
+
console.log(`✅ package.json scripts updated
|
|
2401
|
+
`);
|
|
2402
|
+
} else {
|
|
2403
|
+
console.log(`✅ package.json scripts already up to date
|
|
2404
|
+
`);
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
function updateCliSkill() {
|
|
2408
|
+
const cliRemote = "ro-cli";
|
|
2409
|
+
const cliRepo = "https://github.com/airconcepts/ro-cli.git";
|
|
2410
|
+
try {
|
|
2411
|
+
let remoteExists = false;
|
|
2412
|
+
try {
|
|
2413
|
+
execSync3(`git remote get-url ${cliRemote}`, { stdio: "ignore" });
|
|
2414
|
+
remoteExists = true;
|
|
2415
|
+
} catch {}
|
|
2416
|
+
if (!remoteExists) {
|
|
2417
|
+
console.log(` ➕ Adding remote '${cliRemote}'...`);
|
|
2418
|
+
execSync3(`git remote add ${cliRemote} ${cliRepo}`, { stdio: "inherit" });
|
|
2419
|
+
}
|
|
2420
|
+
execSync3(`git fetch ${cliRemote}`, { stdio: "inherit" });
|
|
2421
|
+
execSync3(`git checkout ${cliRemote}/main -- skills/ro-cli/SKILL.md`, { stdio: "inherit" });
|
|
2422
|
+
if (existsSync3("skills/ro-cli/SKILL.md")) {
|
|
2423
|
+
mkdirSync(".agent/skills/ro-cli", { recursive: true });
|
|
2424
|
+
copyFileSync("skills/ro-cli/SKILL.md", ".agent/skills/ro-cli/SKILL.md");
|
|
2425
|
+
rmSync2("skills", { recursive: true, force: true });
|
|
2426
|
+
console.log(` ✅ CLI skill updated
|
|
2427
|
+
`);
|
|
2428
|
+
}
|
|
2429
|
+
} catch (error) {
|
|
2430
|
+
console.log(` ⚠️ Failed to update CLI skill: ${error instanceof Error ? error.message : error}
|
|
2431
|
+
`);
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
async function upgradeTemplate() {
|
|
2374
2435
|
const template = detectTemplate();
|
|
2375
2436
|
try {
|
|
2376
|
-
console.log(`\uD83D\uDD04 Starting
|
|
2437
|
+
console.log(`\uD83D\uDD04 Starting template upgrade for ${template.name}...`);
|
|
2377
2438
|
let remoteExists = false;
|
|
2378
2439
|
try {
|
|
2379
2440
|
execSync3(`git remote get-url ${template.remoteName}`, { stdio: "ignore" });
|
|
@@ -2387,7 +2448,7 @@ async function upgradeAgent() {
|
|
|
2387
2448
|
}
|
|
2388
2449
|
console.log("⬇️ Fetching latest changes from template...");
|
|
2389
2450
|
execSync3(`git fetch ${template.remoteName}`, { stdio: "inherit" });
|
|
2390
|
-
console.log("\uD83D\uDCC2 Updating
|
|
2451
|
+
console.log("\uD83D\uDCC2 Updating template files...");
|
|
2391
2452
|
const checkoutList = template.checkoutFiles.join(" ");
|
|
2392
2453
|
execSync3(`git checkout ${template.remoteName}/main -- ${checkoutList}`, { stdio: "inherit" });
|
|
2393
2454
|
for (const file of template.newFiles) {
|
|
@@ -2402,7 +2463,12 @@ async function upgradeAgent() {
|
|
|
2402
2463
|
console.log(`⏭️ Skipping ${file} (already exists)`);
|
|
2403
2464
|
}
|
|
2404
2465
|
}
|
|
2405
|
-
console.log(
|
|
2466
|
+
console.log(`
|
|
2467
|
+
\uD83D\uDD27 Updating CLI skill documentation...`);
|
|
2468
|
+
updateCliSkill();
|
|
2469
|
+
console.log("\uD83D\uDCE6 Updating package.json scripts...");
|
|
2470
|
+
updatePackageJsonScripts();
|
|
2471
|
+
console.log("✅ Template upgrade complete! Please check git status for changes.");
|
|
2406
2472
|
} catch (error) {
|
|
2407
2473
|
console.error("❌ Upgrade failed:", error);
|
|
2408
2474
|
process.exit(1);
|
|
@@ -2606,7 +2672,7 @@ app.command("update-game-sdk").description("Download and update the GameSDK libr
|
|
|
2606
2672
|
app.command("deploy").description("Build and deploy the webapp to the server").option("-e, --env <environment>", "Target environment (development | staging | production)", "development").action(async (options) => {
|
|
2607
2673
|
await deploy(options.env);
|
|
2608
2674
|
});
|
|
2609
|
-
app.command("upgrade-
|
|
2610
|
-
await
|
|
2675
|
+
app.command("upgrade-template").description("Upgrade template files and CLI scripts from the template repository").action(async () => {
|
|
2676
|
+
await upgradeTemplate();
|
|
2611
2677
|
});
|
|
2612
2678
|
program.parse();
|