@clunkyard/cli 2.0.0 → 2.0.1
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 +6 -2
- package/package.json +1 -1
- package/project.cjs +1 -1
- package/runtime.cjs +26 -2
package/README.md
CHANGED
|
@@ -25,6 +25,10 @@ all-language builder. SDK/engine caches under ignored `.clunkyard/` are keyed
|
|
|
25
25
|
by their content hashes and remain reusable across CLI updates. Other
|
|
26
26
|
commands are `list`, `setup`, `clean` and `migrate`.
|
|
27
27
|
|
|
28
|
+
Local matches use a resource mode supported by `bot.json`. Open-capable robots
|
|
29
|
+
use Open; Wasm- or DSL-only robots keep their fuel or operation meter and play
|
|
30
|
+
the bundled Vane rival with its DSL meter.
|
|
31
|
+
|
|
28
32
|
JavaScript/TypeScript projects use the ordinary npm alias
|
|
29
33
|
`clunkyard@npm:@clunkyard/sdk@2.0.0`. `package-lock.json` pins the reviewed
|
|
30
34
|
integrity. The first build runs `npm ci --ignore-scripts`; the package has no
|
|
@@ -34,8 +38,8 @@ assets currently require Linux x86-64/glibc 2.39+ (Ubuntu 24.04+ or WSL2).
|
|
|
34
38
|
JavaScript, TypeScript and the Vane/Cadence/Glyph Node routes use WebAssembly.
|
|
35
39
|
|
|
36
40
|
`@2` receives compatible tooling updates. For an exact tool version, run
|
|
37
|
-
`npx --yes @clunkyard/cli@2.0.
|
|
38
|
-
`CLUNKYARD='npx --yes @clunkyard/cli@2.0.
|
|
41
|
+
`npx --yes @clunkyard/cli@2.0.1` or set
|
|
42
|
+
`CLUNKYARD='npx --yes @clunkyard/cli@2.0.1'` with Make. Commit the npm lockfile
|
|
39
43
|
for reproducible JavaScript/TypeScript dependencies. Match replays record the
|
|
40
44
|
game rules and robot actions; local timings do not qualify hosted budgets.
|
|
41
45
|
|
package/package.json
CHANGED
package/project.cjs
CHANGED
|
@@ -72,7 +72,7 @@ npx --yes @clunkyard/cli@2 match 77 3d zero-g
|
|
|
72
72
|
|
|
73
73
|
Keep a baseline commit. Repeat several seeds and rulesets; compare contacts, battery, aim, shots, hits and eliminations in the replay. Local trials run programs as your user. Use hosted trials to measure arena budgets before a tournament.
|
|
74
74
|
|
|
75
|
-
The CLI packages SDK ${catalogue.sdkVersion}/protocol 2 asset identities from the immutable [${catalogue.release} release](https://github.com/clunkyard/game-kit/releases/tag/${catalogue.release}). \`@2\` receives compatible tooling fixes without copying scripts into your robot repository. To reproduce an exact tool version, use \`npx --yes @clunkyard/cli@2.0.
|
|
75
|
+
The CLI packages SDK ${catalogue.sdkVersion}/protocol 2 asset identities from the immutable [${catalogue.release} release](https://github.com/clunkyard/game-kit/releases/tag/${catalogue.release}). \`@2\` receives compatible tooling fixes without copying scripts into your robot repository. To reproduce an exact tool version, use \`npx --yes @clunkyard/cli@2.0.1\` or set \`CLUNKYARD='npx --yes @clunkyard/cli@2.0.1'\` with Make. SDK/engine caches are identified by their content hashes and remain reusable across CLI updates.
|
|
76
76
|
|
|
77
77
|
## Play online
|
|
78
78
|
|
package/runtime.cjs
CHANGED
|
@@ -6,6 +6,13 @@ const {extract,readAsset}=require('./archive.cjs');
|
|
|
6
6
|
const catalogue=require('./catalogue.json');
|
|
7
7
|
const {readManifest}=require('./project.cjs');
|
|
8
8
|
|
|
9
|
+
function selectLocalResourceMode(bot,supported) {
|
|
10
|
+
if(supported.includes('open'))return 'open';
|
|
11
|
+
const metered=supported.find(mode=>mode==='dsl'||mode==='wasm');
|
|
12
|
+
if(metered)return metered;
|
|
13
|
+
throw new Error(`${bot.name} supports resource modes [${supported.join(', ')}]. Local trials need open, dsl or wasm; use a hosted trial for trusted budgets.`);
|
|
14
|
+
}
|
|
15
|
+
|
|
9
16
|
function createRuntime(project,entry=path.join(__dirname,'cli.cjs')) {
|
|
10
17
|
const root=path.resolve(project),initial=readManifest(root),lock=catalogue.languages[initial.language];
|
|
11
18
|
const cache=path.join(root,'.clunkyard');
|
|
@@ -136,7 +143,24 @@ async function match(args) {
|
|
|
136
143
|
await build();
|
|
137
144
|
fs.mkdirSync(path.join(root,'replays'),{recursive:true});
|
|
138
145
|
const replay=path.join(root,'replays',`trial-${seed}.json`);
|
|
139
|
-
|
|
146
|
+
const {supportedResourceModes}=require(path.join(engine,'src','resources.js'));
|
|
147
|
+
const m=manifest(),resourceMode=selectLocalResourceMode(m,supportedResourceModes(m));
|
|
148
|
+
if(resourceMode==='open'){
|
|
149
|
+
run(process.execPath,[path.join(engine,'src','cli.js'),'match','--bot','@'+path.join(cache,'local-bot.json'),'--bot','@'+path.join(engine,'bots','practice','bot.json'),'--mode',mode,'--ruleset',ruleset,'--resource-mode',resourceMode,'--seed',seed,'--ticks','360','--turn-ms','2000','--startup-ms','60000','--replay',replay]);
|
|
150
|
+
}else{
|
|
151
|
+
// The pinned engine already supports mixed Reflex entries: the player's
|
|
152
|
+
// Wasm/DSL robot and the bundled Vane rival each keep their own meter.
|
|
153
|
+
const {resolveBot,validateSelection}=require(path.join(engine,'src','roster.js'));
|
|
154
|
+
const {runMatch,saveReplay}=require(path.join(engine,'src','match.js'));
|
|
155
|
+
const player=resolveBot('@'+path.join(cache,'local-bot.json'),[],engine,mode,ruleset);
|
|
156
|
+
const rival=resolveBot('@'+path.join(engine,'bots','practice','bot.json'),[],engine,mode,ruleset);
|
|
157
|
+
player.resourcePolicy={mode:resourceMode};rival.resourcePolicy={mode:'dsl'};
|
|
158
|
+
const bots=[player,rival];validateSelection(bots,mode,ruleset);
|
|
159
|
+
const result=await runMatch(bots,{mode,ruleset,seed:Number(seed),maxTicks:360,turnMs:2000,startupMs:60000,resourcePolicy:{v:3,class:'reflex',policy:'fair-compute-v1'}});
|
|
160
|
+
saveReplay(result.replay,replay);
|
|
161
|
+
console.log(`Result: ${result.result?.winners?.join(', ')||'draw'} (${result.result?.reason||'unknown'})`);
|
|
162
|
+
console.log(`Replay: ${replay}`);
|
|
163
|
+
}
|
|
140
164
|
const failures=JSON.parse(fs.readFileSync(replay,'utf8')).failures||[];
|
|
141
165
|
if(failures.length)throw new Error(`Match recorded ${failures.map(value=>`${value.botId}: ${value.code}`).join(', ')}. Inspect ${replay}.`);
|
|
142
166
|
}
|
|
@@ -198,4 +222,4 @@ async function main(action='build',args=[]){
|
|
|
198
222
|
return {main};
|
|
199
223
|
}
|
|
200
224
|
|
|
201
|
-
module.exports={createRuntime};
|
|
225
|
+
module.exports={createRuntime,selectLocalResourceMode};
|