create-remix-game 1.3.1 → 1.4.0
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
CHANGED
|
@@ -6,7 +6,7 @@ import os from 'os';
|
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import prompts from 'prompts';
|
|
8
8
|
import { initGitRepo } from './git.js';
|
|
9
|
-
import { installDependencies, installLatestPackages } from './install.js';
|
|
9
|
+
import { installAgentSkills, installDependencies, installLatestPackages } from './install.js';
|
|
10
10
|
import { scaffold } from './scaffold.js';
|
|
11
11
|
/**
|
|
12
12
|
* Extracts game ID from a Remix URL or returns the input if already a UUID
|
|
@@ -243,6 +243,9 @@ async function main() {
|
|
|
243
243
|
await installDependencies(projectPath, config.packageManager);
|
|
244
244
|
// Install packages that need @latest (0.x versions, etc.)
|
|
245
245
|
await installLatestPackages(projectPath, config.packageManager, ['@farcade/game-sdk@latest']);
|
|
246
|
+
// Install agent skills (non-blocking — warns and continues on failure)
|
|
247
|
+
console.log(chalk.cyan('✓ Installing agent skills...'));
|
|
248
|
+
await installAgentSkills(projectPath, ['farworld-labs/remix-skills']);
|
|
246
249
|
// Initialize git
|
|
247
250
|
if (config.initGit) {
|
|
248
251
|
await initGitRepo(projectPath);
|
package/dist/install.d.ts
CHANGED
|
@@ -4,3 +4,9 @@ export declare function installDependencies(projectPath: string, packageManager:
|
|
|
4
4
|
* (e.g., 0.x versions that won't auto-update with caret ranges)
|
|
5
5
|
*/
|
|
6
6
|
export declare function installLatestPackages(projectPath: string, packageManager: string, packages: string[]): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Install agent skills via npx skills add (Vercel skills ecosystem).
|
|
9
|
+
* Non-blocking: logs a warning and continues if installation fails.
|
|
10
|
+
* Stamps the installed commit SHA so the dev server can check for updates.
|
|
11
|
+
*/
|
|
12
|
+
export declare function installAgentSkills(projectPath: string, skills: string[]): Promise<void>;
|
package/dist/install.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import { spawn } from 'child_process';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import https from 'https';
|
|
5
|
+
import path from 'path';
|
|
3
6
|
export async function installDependencies(projectPath, packageManager) {
|
|
4
7
|
return new Promise((resolve, reject) => {
|
|
5
8
|
const command = packageManager === 'yarn' ? 'yarn' : packageManager;
|
|
@@ -38,8 +41,8 @@ export async function installLatestPackages(projectPath, packageManager, package
|
|
|
38
41
|
return;
|
|
39
42
|
return new Promise((resolve, reject) => {
|
|
40
43
|
const command = packageManager === 'yarn' ? 'yarn' : packageManager;
|
|
41
|
-
const addCmd = packageManager === '
|
|
42
|
-
const args =
|
|
44
|
+
const addCmd = packageManager === 'npm' ? 'install' : 'add';
|
|
45
|
+
const args = [addCmd, '-D', ...packages];
|
|
43
46
|
const child = spawn(command, args, {
|
|
44
47
|
cwd: projectPath,
|
|
45
48
|
stdio: 'pipe',
|
|
@@ -65,3 +68,67 @@ export async function installLatestPackages(projectPath, packageManager, package
|
|
|
65
68
|
});
|
|
66
69
|
});
|
|
67
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Fetch the latest commit SHA for a GitHub repo (owner/repo format).
|
|
73
|
+
*/
|
|
74
|
+
function fetchLatestCommitSha(repo) {
|
|
75
|
+
return new Promise((resolve) => {
|
|
76
|
+
const req = https.get(`https://api.github.com/repos/${repo}/commits/HEAD`, { headers: { 'User-Agent': 'create-remix-game', Accept: 'application/vnd.github.sha' } }, (res) => {
|
|
77
|
+
let data = '';
|
|
78
|
+
res.on('data', (chunk) => (data += chunk.toString()));
|
|
79
|
+
res.on('end', () => resolve(res.statusCode === 200 ? data.trim() : null));
|
|
80
|
+
});
|
|
81
|
+
req.on('error', () => resolve(null));
|
|
82
|
+
req.setTimeout(5000, () => {
|
|
83
|
+
req.destroy();
|
|
84
|
+
resolve(null);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function skillVersionPath(projectPath) {
|
|
89
|
+
return path.join(projectPath, '.remix', '.skills-version');
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Install agent skills via npx skills add (Vercel skills ecosystem).
|
|
93
|
+
* Non-blocking: logs a warning and continues if installation fails.
|
|
94
|
+
* Stamps the installed commit SHA so the dev server can check for updates.
|
|
95
|
+
*/
|
|
96
|
+
export async function installAgentSkills(projectPath, skills) {
|
|
97
|
+
for (const skill of skills) {
|
|
98
|
+
try {
|
|
99
|
+
await new Promise((resolve, reject) => {
|
|
100
|
+
const child = spawn('npx', ['skills', 'add', skill, '-a', 'claude-code', '-y'], {
|
|
101
|
+
cwd: projectPath,
|
|
102
|
+
stdio: 'pipe',
|
|
103
|
+
shell: true,
|
|
104
|
+
});
|
|
105
|
+
let errorOutput = '';
|
|
106
|
+
child.stderr?.on('data', (data) => {
|
|
107
|
+
errorOutput += data.toString();
|
|
108
|
+
});
|
|
109
|
+
child.on('close', (code) => {
|
|
110
|
+
if (code !== 0) {
|
|
111
|
+
reject(new Error(errorOutput || `Exit code ${code}`));
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
console.log(chalk.cyan(`✓ Agent skill installed: ${skill}`));
|
|
115
|
+
resolve();
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
child.on('error', (error) => {
|
|
119
|
+
reject(error);
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
// Stamp the installed version (best-effort)
|
|
123
|
+
const sha = await fetchLatestCommitSha(skill);
|
|
124
|
+
if (sha) {
|
|
125
|
+
const versionFile = skillVersionPath(projectPath);
|
|
126
|
+
fs.mkdirSync(path.dirname(versionFile), { recursive: true });
|
|
127
|
+
fs.writeFileSync(versionFile, JSON.stringify({ repo: skill, sha, installedAt: new Date().toISOString() }) + '\n');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
console.log(chalk.yellow(`⚠ Could not install agent skill: ${skill} (skipped)`));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
package/package.json
CHANGED