@rodyssey/cli 0.0.6 → 0.0.8
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 +133 -0
- package/package.json +4 -1
package/dist/cli.js
CHANGED
|
@@ -2144,6 +2144,136 @@ async function create(projectName, repoUrl, templateName) {
|
|
|
2144
2144
|
`);
|
|
2145
2145
|
}
|
|
2146
2146
|
|
|
2147
|
+
// src/update-game-sdk.ts
|
|
2148
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
2149
|
+
import { dirname, join } from "node:path";
|
|
2150
|
+
var BASE_URL = "https://development-app.rodyssey.ai";
|
|
2151
|
+
var FILES = [
|
|
2152
|
+
{
|
|
2153
|
+
url: `${BASE_URL}/game-sdk.js`,
|
|
2154
|
+
path: "public/game-sdk.js",
|
|
2155
|
+
description: "GameSDK JavaScript library"
|
|
2156
|
+
},
|
|
2157
|
+
{
|
|
2158
|
+
url: `${BASE_URL}/game-sdk.d.ts`,
|
|
2159
|
+
path: "src/types/game-sdk.d.ts",
|
|
2160
|
+
description: "GameSDK TypeScript definitions"
|
|
2161
|
+
}
|
|
2162
|
+
];
|
|
2163
|
+
async function downloadFile(url, path3, description) {
|
|
2164
|
+
try {
|
|
2165
|
+
console.log(`
|
|
2166
|
+
\uD83D\uDCE5 Downloading ${description}...`);
|
|
2167
|
+
console.log(` URL: ${url}`);
|
|
2168
|
+
console.log(` Path: ${path3}`);
|
|
2169
|
+
const response = await fetch(url);
|
|
2170
|
+
if (!response.ok) {
|
|
2171
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
2172
|
+
}
|
|
2173
|
+
const content = await response.text();
|
|
2174
|
+
const dir = dirname(path3);
|
|
2175
|
+
await mkdir(dir, { recursive: true });
|
|
2176
|
+
await writeFile(path3, content, "utf-8");
|
|
2177
|
+
console.log(`✅ Downloaded ${description} (${content.length} bytes)
|
|
2178
|
+
`);
|
|
2179
|
+
return true;
|
|
2180
|
+
} catch (error) {
|
|
2181
|
+
console.error(`❌ Failed to download ${description}:`);
|
|
2182
|
+
console.error(` ${error instanceof Error ? error.message : String(error)}
|
|
2183
|
+
`);
|
|
2184
|
+
return false;
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
async function downloadManifest() {
|
|
2188
|
+
const url = `${BASE_URL}/skills/manifest.json`;
|
|
2189
|
+
try {
|
|
2190
|
+
console.log("\uD83D\uDCE5 Downloading manifest...");
|
|
2191
|
+
console.log(` URL: ${url}
|
|
2192
|
+
`);
|
|
2193
|
+
const response = await fetch(url);
|
|
2194
|
+
if (!response.ok) {
|
|
2195
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
2196
|
+
}
|
|
2197
|
+
const manifest = await response.json();
|
|
2198
|
+
console.log(`✅ Manifest downloaded successfully`);
|
|
2199
|
+
console.log(` Name: ${manifest.name}`);
|
|
2200
|
+
console.log(` Version: ${manifest.version}`);
|
|
2201
|
+
console.log(` Documentation files: ${manifest.documentation.length}
|
|
2202
|
+
`);
|
|
2203
|
+
return manifest;
|
|
2204
|
+
} catch (error) {
|
|
2205
|
+
console.error("❌ Failed to download manifest:");
|
|
2206
|
+
console.error(` ${error instanceof Error ? error.message : String(error)}
|
|
2207
|
+
`);
|
|
2208
|
+
return null;
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
async function downloadDocumentation(manifest) {
|
|
2212
|
+
console.log(`\uD83D\uDCDA Downloading documentation files...
|
|
2213
|
+
`);
|
|
2214
|
+
let successCount = 0;
|
|
2215
|
+
let failCount = 0;
|
|
2216
|
+
for (const doc of manifest.documentation) {
|
|
2217
|
+
const url = `${BASE_URL}/skills/${doc.file}`;
|
|
2218
|
+
const path3 = join(".agent", "skills", "game-sdk", doc.file);
|
|
2219
|
+
const description = `${doc.title} (${doc.category})`;
|
|
2220
|
+
const success = await downloadFile(url, path3, description);
|
|
2221
|
+
if (success) {
|
|
2222
|
+
successCount++;
|
|
2223
|
+
} else {
|
|
2224
|
+
failCount++;
|
|
2225
|
+
}
|
|
2226
|
+
}
|
|
2227
|
+
console.log(`
|
|
2228
|
+
\uD83D\uDCCA Documentation download summary:`);
|
|
2229
|
+
console.log(` ✅ Success: ${successCount}`);
|
|
2230
|
+
if (failCount > 0) {
|
|
2231
|
+
console.log(` ❌ Failed: ${failCount}`);
|
|
2232
|
+
}
|
|
2233
|
+
console.log();
|
|
2234
|
+
return { successCount, failCount };
|
|
2235
|
+
}
|
|
2236
|
+
async function updateGameSdk() {
|
|
2237
|
+
console.log(`\uD83D\uDE80 GameSDK Download Script
|
|
2238
|
+
`);
|
|
2239
|
+
console.log("=".repeat(60));
|
|
2240
|
+
let totalSuccess = 0;
|
|
2241
|
+
let totalFail = 0;
|
|
2242
|
+
console.log(`\uD83D\uDCE6 Downloading core SDK files...
|
|
2243
|
+
`);
|
|
2244
|
+
for (const file of FILES) {
|
|
2245
|
+
const success = await downloadFile(file.url, file.path, file.description);
|
|
2246
|
+
if (success) {
|
|
2247
|
+
totalSuccess++;
|
|
2248
|
+
} else {
|
|
2249
|
+
totalFail++;
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
const manifest = await downloadManifest();
|
|
2253
|
+
if (manifest) {
|
|
2254
|
+
const { successCount, failCount } = await downloadDocumentation(manifest);
|
|
2255
|
+
totalSuccess += successCount;
|
|
2256
|
+
totalFail += failCount;
|
|
2257
|
+
} else {
|
|
2258
|
+
console.log(`⚠️ Skipping documentation download due to manifest error
|
|
2259
|
+
`);
|
|
2260
|
+
}
|
|
2261
|
+
console.log("=".repeat(60));
|
|
2262
|
+
console.log(`\uD83C\uDF89 Download Complete!
|
|
2263
|
+
`);
|
|
2264
|
+
console.log(`\uD83D\uDCCA Final Summary:`);
|
|
2265
|
+
console.log(` ✅ Successfully downloaded: ${totalSuccess} files`);
|
|
2266
|
+
if (totalFail > 0) {
|
|
2267
|
+
console.log(` ❌ Failed: ${totalFail} files`);
|
|
2268
|
+
console.log(`
|
|
2269
|
+
⚠️ Some files failed to download. Please check the errors above.`);
|
|
2270
|
+
process.exit(1);
|
|
2271
|
+
} else {
|
|
2272
|
+
console.log(`
|
|
2273
|
+
✨ All files downloaded successfully!`);
|
|
2274
|
+
}
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2147
2277
|
// src/cli.ts
|
|
2148
2278
|
var TEMPLATES = {
|
|
2149
2279
|
webapp: {
|
|
@@ -2200,4 +2330,7 @@ app.command("create").argument("<project-name>", "Name of the project to create"
|
|
|
2200
2330
|
const template = TEMPLATES[templateName];
|
|
2201
2331
|
await create(projectName, template.repo, templateName);
|
|
2202
2332
|
});
|
|
2333
|
+
app.command("update-game-sdk").description("Download and update the GameSDK library, types, and documentation").action(async () => {
|
|
2334
|
+
await updateGameSdk();
|
|
2335
|
+
});
|
|
2203
2336
|
program.parse();
|