@rhizogrip/spore-cli 1.43.0 → 1.45.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.
Files changed (2) hide show
  1. package/bin/spore.js +10 -4
  2. package/package.json +2 -2
package/bin/spore.js CHANGED
@@ -49,7 +49,9 @@ const VERBS = `Usage:
49
49
  spore send <name> -- <message> -- ends the options, for a message that starts with -
50
50
  spore send|attach <name> --json for a program: the turn's events, one JSON object a line
51
51
  spore attach <name> --json --after <seq> the events after <seq>; 0 for the whole log
52
- spore fork <name> --at <call> <new> [--definition <f>] [--replay] carry a turn on from one of its rounds, in a copy
52
+ spore fork <name> <new> a copy as it stands between turns, schedules left behind
53
+ spore fork <name> --at turn:<n> <new> the same, as it stood after turn n
54
+ spore fork <name> --at <call> <new> [--replay] carry a turn on from one of its rounds, in a copy
53
55
  spore attach <name> [-n <lines>] watch a turn that is already going
54
56
  spore stop <name> SIGTERM it, mid-round
55
57
  spore extend <name> wall 30m|cost 1.50|rounds 20 give the running turn more, up to its extend.<limit>
@@ -116,12 +118,12 @@ ${VERBS}
116
118
  one you are standing in
117
119
  message read from stdin when not given
118
120
  -- ends the options, for a message that starts with -
119
- --definition the .cmk to give it, instead of your default
121
+ --definition the .cmk to give it, instead of your default; for fork, the one the copy runs under
120
122
  --from the spore to cut it from: what it can do, never what it did
121
123
  --json for a program: the answer as JSON, with the same exit code
122
124
  --debug verbose logging on stderr
123
125
 
124
- send, attach and fork exit 0 when the turn answered, 1 when it ended with no answer,
126
+ send, attach and a fork at a call exit 0 when the turn answered, 1 when it ended with no answer,
125
127
  3 when you walked away — Ctrl-C leaves the turn running, spore attach picks it up —
126
128
  and 4 when it wrapped up at a soft limit, its answer saying what remains.
127
129
 
@@ -363,13 +365,17 @@ if (verb === 'stop') {
363
365
 
364
366
  if (verb === 'fork') {
365
367
  const [into] = rest
366
- if (!asked || !argv.at || !into) fail('fork needs a spore, a call and somewhere new — spore fork <name> --at <call> <new> [--definition <f>] [--replay]')
368
+ if (!asked || !into) fail('fork needs a spore and somewhere new — spore fork <name> [--at turn:<n> | --at <call> [--replay]] <new> [--definition <f>]')
367
369
  let made
368
370
  try {
369
371
  made = fork({ run: spore(asked), at: argv.at, into: workspaceFor(into).path, definition: argv.definition, replay: argv.replay, debug: argv.debug })
370
372
  } catch (err) {
371
373
  fail(errorText(err))
372
374
  }
375
+ if (made.pid === undefined) {
376
+ console.error(`spore: forked ${made.from} after turn ${made.turnNo} into ${made.ws} — its next message starts its first turn`)
377
+ process.exit(0)
378
+ }
373
379
  console.error(`spore: forked ${made.from} at ${made.at}, round ${made.rounds} — carrying it on in ${made.ws}`)
374
380
  renderHeader(made.ws, grantOf(made.ws))
375
381
  const ended = await follow(made.ws, { lines: 0, status: true })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhizogrip/spore-cli",
3
- "version": "1.43.0",
3
+ "version": "1.45.0",
4
4
  "author": {
5
5
  "name": "Christophe Le Bars",
6
6
  "email": "clb@toort.net"
@@ -54,7 +54,7 @@
54
54
  "minimist": "^1.2.8"
55
55
  },
56
56
  "optionalDependencies": {
57
- "@rhizogrip/spore": "1.43.0"
57
+ "@rhizogrip/spore": "1.45.0"
58
58
  },
59
59
  "license": "Apache-2.0"
60
60
  }