@maka/maka-cli 5.226.0 → 5.227.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/bundle/typescript/package.json +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/types/repro.js +36 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/repro-boot.js +62 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/repro-launch.js +19 -38
- package/bundle/typescript/src/commands/game/sideQuest.sub.cmd.js +10 -3
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maka/maka-cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.227.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"summary": "A command line tool for scaffolding Meteor 3.x applications using either React.",
|
|
6
6
|
"description": "A command line tool for scaffolding Meteor 3.x applications using React.",
|
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE BENCH'S ACTOR. One name, used for the seat, for the transcript's
|
|
3
|
+
* visibility filter, and for the post-boot fixture state below.
|
|
4
|
+
*
|
|
5
|
+
* IT LIVES HERE, in the types module, on purpose. utilities/repro-launch
|
|
6
|
+
* declared it, and the launcher's whole design is that the game graph
|
|
7
|
+
* (repro-scene, the harness, blessed, 150 files) stays behind a dynamic
|
|
8
|
+
* import so `maka --help` does not pay for it. Once the site needed the
|
|
9
|
+
* same constant, anything that re-exported it from a module importing
|
|
10
|
+
* the builder would have dragged that graph back across the lazy
|
|
11
|
+
* boundary. This file imports nothing, so both sides can share the name
|
|
12
|
+
* for free.
|
|
13
|
+
*/
|
|
14
|
+
export const REPRO_ACTOR = 'Tester';
|
|
15
|
+
/**
|
|
16
|
+
* THE FIXTURE A BENCH ACTUALLY BUILDS FROM.
|
|
17
|
+
*
|
|
18
|
+
* One rule, and it is not a convenience: a bench written with
|
|
19
|
+
* `repro.premise` and no `fixture.premise` is the common shape, so the
|
|
20
|
+
* reader's framing doubles as the scene's story when the fixture has
|
|
21
|
+
* none of its own. Three callers build a bench -- the headless dry run,
|
|
22
|
+
* the CLI's live launcher, and maka-cli.com's web bench -- and each had
|
|
23
|
+
* to know this. Two of them spelling it the same way and a third
|
|
24
|
+
* forgetting is how a bench acquires a different opening line depending
|
|
25
|
+
* on where it was run from.
|
|
26
|
+
*
|
|
27
|
+
* Here rather than beside the builder because this file imports nothing,
|
|
28
|
+
* so the launcher can apply the rule without reaching across its lazy
|
|
29
|
+
* boundary into the game graph.
|
|
30
|
+
*/
|
|
31
|
+
export function reproFixtureOf(repro) {
|
|
32
|
+
const fixture = { ...(repro.fixture ?? {}) };
|
|
33
|
+
if (!fixture.premise && repro.premise)
|
|
34
|
+
fixture.premise = repro.premise;
|
|
35
|
+
return fixture;
|
|
36
|
+
}
|
|
1
37
|
/**
|
|
2
38
|
* THE FIXTURE SCHEMA'S VERSION, and the engine side is the source of
|
|
3
39
|
* truth for it. Anything that GENERATES repro drafts -- the
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { buildReproScene, reproArchetypeName } from '../factories/repro-scene.js';
|
|
2
|
+
import { saveForArchetype } from '../headless-harness.js';
|
|
3
|
+
import { REPRO_ACTOR, reproFixtureOf } from '../types/repro.js';
|
|
4
|
+
/**
|
|
5
|
+
* The scene and the runner a bench starts with.
|
|
6
|
+
*/
|
|
7
|
+
export function buildReproBoot(repro) {
|
|
8
|
+
const fixture = reproFixtureOf(repro);
|
|
9
|
+
const build = buildReproScene(fixture);
|
|
10
|
+
const archetype = reproArchetypeName(fixture);
|
|
11
|
+
return {
|
|
12
|
+
fixture,
|
|
13
|
+
build,
|
|
14
|
+
seed: build.seed,
|
|
15
|
+
archetype,
|
|
16
|
+
save: saveForArchetype(REPRO_ACTOR, archetype),
|
|
17
|
+
warnings: build.warnings,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* THE KNOBS THE SEED CANNOT CARRY, applied to a booted session.
|
|
22
|
+
*
|
|
23
|
+
* Call this after the session is up and before the first step (or, on
|
|
24
|
+
* the site, before the first status push) -- the point of both knobs is
|
|
25
|
+
* that the bench OPENS on a runner already in that state, so a reporter
|
|
26
|
+
* reads the condition on their first look rather than watching it be
|
|
27
|
+
* applied.
|
|
28
|
+
*
|
|
29
|
+
* Silent when the fixture asks for neither, and silent when the actor is
|
|
30
|
+
* missing: a bench whose runner did not boot has a larger problem than
|
|
31
|
+
* its damage boxes, and it will say so in the transcript.
|
|
32
|
+
*/
|
|
33
|
+
export async function applyReproFixtureState(game, fixture, actorName = REPRO_ACTOR) {
|
|
34
|
+
// START WOUNDED (fixture.wounded): the boxes go on before the first
|
|
35
|
+
// step, so the transcript opens on a runner who already needs the
|
|
36
|
+
// verb under test.
|
|
37
|
+
if (fixture.wounded) {
|
|
38
|
+
const runner = game.scene.getPlayerByName(actorName);
|
|
39
|
+
if (runner) {
|
|
40
|
+
if (fixture.wounded.physical)
|
|
41
|
+
runner.takeDamage(fixture.wounded.physical);
|
|
42
|
+
if (fixture.wounded.stun)
|
|
43
|
+
runner.takeStun(fixture.wounded.stun);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// NUYEN (fixture.nuyen): a credstick in the pack, because money lives
|
|
47
|
+
// on a carrier item (Player.currency sums them) and the pregen has none.
|
|
48
|
+
if (fixture.nuyen && fixture.nuyen > 0) {
|
|
49
|
+
const runner = game.scene.getPlayerByName(actorName);
|
|
50
|
+
if (runner) {
|
|
51
|
+
const { ItemFactory } = await import('../factories/item-factory.js');
|
|
52
|
+
const stick = await new ItemFactory().createItemFromJson({
|
|
53
|
+
name: 'Certified Credstick', description: 'Cash that does not ask questions.',
|
|
54
|
+
size: 'Tiny', category: 'Credstick', shape: 'Slab', color: 'Black', texture: 'Plastic',
|
|
55
|
+
rating: 'Common', weight: 0.1, transferable: true,
|
|
56
|
+
});
|
|
57
|
+
stick.addCurrency(fixture.nuyen);
|
|
58
|
+
runner.addInventory(stick);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=repro-boot.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import { fetchReviewQueue } from './backlog.js';
|
|
3
|
+
import { REPRO_ACTOR } from '../types/repro.js';
|
|
3
4
|
/**
|
|
4
5
|
* Resolve `<id>` or `<n>` against a FRESH review queue.
|
|
5
6
|
*
|
|
@@ -157,8 +158,14 @@ export function readReproFile(candidate) {
|
|
|
157
158
|
* since the last step and print them under the output they explain.
|
|
158
159
|
*/
|
|
159
160
|
/** The bench's actor. One name, used for the seat and for the
|
|
160
|
-
* visibility filter below.
|
|
161
|
-
|
|
161
|
+
* visibility filter below.
|
|
162
|
+
*
|
|
163
|
+
* Defined in types/repro.ts and re-exported here so the many callers
|
|
164
|
+
* that import it from the launcher keep working. It had to move: the
|
|
165
|
+
* site needs the same constant, and a module that reaches it through
|
|
166
|
+
* anything importing the scene builder would drag the game graph back
|
|
167
|
+
* across this file's lazy boundary. See the note on the constant. */
|
|
168
|
+
export { REPRO_ACTOR };
|
|
162
169
|
const stripTags = (s) => s.replace(/\{\/?[a-z-]+\}/g, '');
|
|
163
170
|
/**
|
|
164
171
|
* ONE STEP OF TRANSCRIPT, pure: the command's return string, then what
|
|
@@ -221,49 +228,23 @@ export function renderStepLines(step, text, fresh, actor = REPRO_ACTOR) {
|
|
|
221
228
|
return lines;
|
|
222
229
|
}
|
|
223
230
|
export async function dryRunRepro(repro) {
|
|
224
|
-
|
|
225
|
-
|
|
231
|
+
// The scene, the runner and the post-boot knobs all come from
|
|
232
|
+
// repro-boot, which is the ONE definition of what a bench boots as --
|
|
233
|
+
// shared with maka-cli.com's live bench so the transcript below and
|
|
234
|
+
// the session a reporter types into cannot describe different
|
|
235
|
+
// scenarios. See that module's header.
|
|
236
|
+
const [{ buildReproBoot, applyReproFixtureState }, { bootSession }] = await Promise.all([
|
|
237
|
+
import('./repro-boot.js'),
|
|
226
238
|
import('../headless-harness.js'),
|
|
227
239
|
]);
|
|
228
|
-
const
|
|
229
|
-
// The reader's framing doubles as the bench's story when the fixture
|
|
230
|
-
// has none of its own -- one sentence, written once.
|
|
231
|
-
if (!fixture.premise && repro.premise)
|
|
232
|
-
fixture.premise = repro.premise;
|
|
233
|
-
const built = buildReproScene(fixture);
|
|
240
|
+
const built = buildReproBoot(repro);
|
|
234
241
|
const events = [];
|
|
235
242
|
const session = await bootSession({
|
|
236
243
|
seed: built.seed,
|
|
237
|
-
players: [
|
|
244
|
+
players: [built.save],
|
|
238
245
|
events,
|
|
239
246
|
});
|
|
240
|
-
|
|
241
|
-
// step, so the transcript opens on a runner who already needs the
|
|
242
|
-
// verb under test.
|
|
243
|
-
if (fixture.wounded) {
|
|
244
|
-
const runner = session.game.scene.getPlayerByName(REPRO_ACTOR);
|
|
245
|
-
if (runner) {
|
|
246
|
-
if (fixture.wounded.physical)
|
|
247
|
-
runner.takeDamage(fixture.wounded.physical);
|
|
248
|
-
if (fixture.wounded.stun)
|
|
249
|
-
runner.takeStun(fixture.wounded.stun);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
// NUYEN (fixture.nuyen): a credstick in the pack, because money lives
|
|
253
|
-
// on a carrier item (Player.currency sums them) and the pregen has none.
|
|
254
|
-
if (fixture.nuyen && fixture.nuyen > 0) {
|
|
255
|
-
const runner = session.game.scene.getPlayerByName(REPRO_ACTOR);
|
|
256
|
-
if (runner) {
|
|
257
|
-
const { ItemFactory } = await import('../factories/item-factory.js');
|
|
258
|
-
const stick = await new ItemFactory().createItemFromJson({
|
|
259
|
-
name: 'Certified Credstick', description: 'Cash that does not ask questions.',
|
|
260
|
-
size: 'Tiny', category: 'Credstick', shape: 'Slab', color: 'Black', texture: 'Plastic',
|
|
261
|
-
rating: 'Common', weight: 0.1, transferable: true,
|
|
262
|
-
});
|
|
263
|
-
stick.addCurrency(fixture.nuyen);
|
|
264
|
-
runner.addInventory(stick);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
247
|
+
await applyReproFixtureState(session.game, built.fixture);
|
|
267
248
|
const lines = [];
|
|
268
249
|
// THE FIRST PAINT IS NOT PART OF STEP ONE. bootSession pushes every
|
|
269
250
|
// player's panels the moment the session comes up (B7NNNesy5gvRSbZpp),
|
|
@@ -6,6 +6,10 @@ import { Actions } from '../../tools/actions/actions.class.js';
|
|
|
6
6
|
import { Log } from '../../tools/log/log.class.js';
|
|
7
7
|
import { AI } from '../../tools/ai/ai.class.js';
|
|
8
8
|
import { spawnSelf } from '../../tools/self-spawn/self-spawn.js';
|
|
9
|
+
// A value import, not a type-only one, for reproFixtureOf -- safe
|
|
10
|
+
// against this file's "no game graph on `maka --help`" rule because
|
|
11
|
+
// types/repro.ts reaches only two leaf enum modules.
|
|
12
|
+
import { reproFixtureOf } from './sideQuest/types/repro.js';
|
|
9
13
|
/**
|
|
10
14
|
* SPAWN THE GAME AND BE ITS JANITOR.
|
|
11
15
|
*
|
|
@@ -77,9 +81,12 @@ export async function spawnGame(launchFilePath, logFilePath) {
|
|
|
77
81
|
*/
|
|
78
82
|
async function launchReproBench(repro, item, makaDir) {
|
|
79
83
|
const { buildReproScene, reproArchetypeName } = await import('./sideQuest/factories/repro-scene.js');
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
// The one premise rule, shared with the dry run and the web bench --
|
|
85
|
+
// see reproFixtureOf. This path stops at the scene: the game rolls the
|
|
86
|
+
// character itself from `archetype` below, so it deliberately does NOT
|
|
87
|
+
// go through repro-boot, which would pull the headless harness (and
|
|
88
|
+
// with it game.ts) into the PARENT process that only spawns the child.
|
|
89
|
+
const fixture = reproFixtureOf(repro);
|
|
83
90
|
let built;
|
|
84
91
|
try {
|
|
85
92
|
built = buildReproScene(fixture);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maka/maka-cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.227.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"summary": "A command line tool for scaffolding Meteor 3.x applications using either React.",
|
|
6
6
|
"description": "A command line tool for scaffolding Meteor 3.x applications using React.",
|