star-sdk-cli 0.1.12 → 0.1.13
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/README.md +52 -0
- package/dist/cli.mjs +32 -1
- package/package.json +5 -3
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# star-sdk-cli
|
|
2
|
+
|
|
3
|
+
CLI for [Star SDK](https://www.npmjs.com/package/star-sdk) — register games, deploy to hosting, and install AI coding docs.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
All commands run via `npx star-sdk` (no global install needed).
|
|
8
|
+
|
|
9
|
+
### Commands
|
|
10
|
+
|
|
11
|
+
| Command | Description |
|
|
12
|
+
|---------|-------------|
|
|
13
|
+
| `npx star-sdk init "Game Name"` | Register a game, get a gameId and deploy key |
|
|
14
|
+
| `npx star-sdk deploy [path]` | Deploy your game to Star hosting |
|
|
15
|
+
| `npx star-sdk install [agent]` | Install SDK docs for AI coding tools |
|
|
16
|
+
| `npx star-sdk docs [topic]` | Print API docs (audio, canvas, leaderboard) |
|
|
17
|
+
| `npx star-sdk whoami` | Show current game config |
|
|
18
|
+
|
|
19
|
+
### Workflow
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# 1. Register your game
|
|
23
|
+
npx star-sdk init "My Game"
|
|
24
|
+
# Creates .starrc with gameId and deploy key
|
|
25
|
+
|
|
26
|
+
# 2. Build your game (use the gameId from .starrc)
|
|
27
|
+
# ... write your game code ...
|
|
28
|
+
|
|
29
|
+
# 3. Deploy
|
|
30
|
+
npx star-sdk deploy
|
|
31
|
+
# => Live at https://buildwithstar.com/games/<id>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### AI Agent Support
|
|
35
|
+
|
|
36
|
+
Install SDK documentation directly into your AI coding tool:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx star-sdk install # Claude Code (default)
|
|
40
|
+
npx star-sdk install cursor # Cursor
|
|
41
|
+
npx star-sdk install codex # OpenAI Codex
|
|
42
|
+
npx star-sdk install windsurf # Windsurf
|
|
43
|
+
npx star-sdk install aider # Aider
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Documentation
|
|
47
|
+
|
|
48
|
+
Full docs at [buildwithstar.com/docs/sdk](https://buildwithstar.com/docs/sdk)
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
MIT
|
package/dist/cli.mjs
CHANGED
|
@@ -231,6 +231,16 @@ Complete working games are in the \`examples/\` directory (also published with t
|
|
|
231
231
|
- **reaction-time** \u2014 Test your reflexes over 5 rounds, DOM-based (no canvas)
|
|
232
232
|
|
|
233
233
|
Each example is a single HTML file, no build step \u2014 imports from esm.sh.
|
|
234
|
+
|
|
235
|
+
## Deploy
|
|
236
|
+
|
|
237
|
+
When the game is ready, deploy it with one command:
|
|
238
|
+
|
|
239
|
+
\`\`\`bash
|
|
240
|
+
npx star-sdk deploy
|
|
241
|
+
\`\`\`
|
|
242
|
+
|
|
243
|
+
This uploads the game to Star hosting and returns a live URL. Requires \`npx star-sdk init\` to have been run first (which creates the deploy key in \`.starrc\`).
|
|
234
244
|
`;
|
|
235
245
|
var AUDIO_DOCS = `**Installation**
|
|
236
246
|
|
|
@@ -1098,7 +1108,7 @@ game(({ ctx, width, height, loop, ui, on, canvas }) => {
|
|
|
1098
1108
|
- Score submission (works for guests and logged-in users)
|
|
1099
1109
|
- Leaderboard UI (modal with rankings)
|
|
1100
1110
|
- Weekly/all-time timeframes
|
|
1101
|
-
-
|
|
1111
|
+
- Configurable sort order (\`'asc'\` for lower-is-better, \`'desc'\` for higher-is-better)
|
|
1102
1112
|
|
|
1103
1113
|
---
|
|
1104
1114
|
|
|
@@ -1289,6 +1299,27 @@ const data = await leaderboard.getScores({
|
|
|
1289
1299
|
|
|
1290
1300
|
---
|
|
1291
1301
|
|
|
1302
|
+
**Sort Order:**
|
|
1303
|
+
|
|
1304
|
+
By default, leaderboards rank higher scores first (\`'desc'\`). For games where lower is better (reaction time, speedruns, golf), set \`sort: 'asc'\`:
|
|
1305
|
+
|
|
1306
|
+
\`\`\`javascript
|
|
1307
|
+
const leaderboard = createLeaderboard({ gameId: '<gameId from .starrc>', sort: 'asc' });
|
|
1308
|
+
\`\`\`
|
|
1309
|
+
|
|
1310
|
+
**IMPORTANT: Do NOT invert scores to fake ascending order.** Use \`sort: 'asc'\` instead.
|
|
1311
|
+
|
|
1312
|
+
\`\`\`javascript
|
|
1313
|
+
// BAD \u2014 do not do this
|
|
1314
|
+
leaderboard.submit(10000 - reactionTimeMs);
|
|
1315
|
+
|
|
1316
|
+
// GOOD \u2014 submit the real value with sort: 'asc'
|
|
1317
|
+
const leaderboard = createLeaderboard({ gameId, sort: 'asc' });
|
|
1318
|
+
leaderboard.submit(reactionTimeMs);
|
|
1319
|
+
\`\`\`
|
|
1320
|
+
|
|
1321
|
+
---
|
|
1322
|
+
|
|
1292
1323
|
**Tips:**
|
|
1293
1324
|
|
|
1294
1325
|
1. **Call \`submit()\` before \`show()\`** - Ensures your score appears immediately in the leaderboard.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "star-sdk-cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "CLI
|
|
3
|
+
"version": "0.1.13",
|
|
4
|
+
"description": "CLI for Star SDK — register games, install AI docs, and deploy to Star hosting",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"star-sdk": "./dist/cli.mjs"
|
|
@@ -33,7 +33,9 @@
|
|
|
33
33
|
"sdk",
|
|
34
34
|
"cli",
|
|
35
35
|
"games",
|
|
36
|
-
"leaderboard"
|
|
36
|
+
"leaderboard",
|
|
37
|
+
"deploy",
|
|
38
|
+
"hosting"
|
|
37
39
|
],
|
|
38
40
|
"dependencies": {
|
|
39
41
|
"archiver": "^7.0.0"
|