uro-cli 0.21.0__tar.gz → 0.22.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: uro-cli
3
- Version: 0.21.0
3
+ Version: 0.22.0
4
4
  Summary: Uro Engine reference client — play, dry-run, and dev tools against the engine
5
5
  Project-URL: Homepage, https://github.com/cupskeee/uro
6
6
  Project-URL: Repository, https://github.com/cupskeee/uro
@@ -12,8 +12,8 @@ Requires-Python: >=3.12
12
12
  Requires-Dist: python-dotenv>=1.0
13
13
  Requires-Dist: rich>=13.9
14
14
  Requires-Dist: typer>=0.27.2
15
- Requires-Dist: uro-core[llm,postgres]==0.21.0
16
- Requires-Dist: uro-server==0.21.0
15
+ Requires-Dist: uro-core[llm,postgres]==0.22.0
16
+ Requires-Dist: uro-server==0.22.0
17
17
  Requires-Dist: websockets>=16.1
18
18
  Description-Content-Type: text/markdown
19
19
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "uro-cli"
3
- version = "0.21.0"
3
+ version = "0.22.0"
4
4
  description = "Uro Engine reference client — play, dry-run, and dev tools against the engine"
5
5
  license = "MIT"
6
6
  license-files = ["LICENSE"]
@@ -13,8 +13,8 @@ requires-python = ">=3.12"
13
13
  # pair a new uro-cli with an old uro-core; `just release` bumps all three together, and the
14
14
  # `{workspace = true}` sources make a drifted pin fail `uv sync` locally.
15
15
  dependencies = [
16
- "uro-core[postgres,llm]==0.21.0",
17
- "uro-server==0.21.0",
16
+ "uro-core[postgres,llm]==0.22.0",
17
+ "uro-server==0.22.0",
18
18
  "typer>=0.27.2",
19
19
  "rich>=13.9",
20
20
  "websockets>=16.1",
@@ -821,7 +821,8 @@ def beat_detail_lines(
821
821
  lines.append(f" ? {c['id']}: {c['prompt']} — `uro character choose` or /choose")
822
822
  wait = details.get("encounter") # D-112: the fight waits on a player's choice
823
823
  if wait:
824
- lines.append(f" · the fight waits on {wait['actor_id']}:")
824
+ who = f" (player {wait['participant_id']})" if wait.get("participant_id") else ""
825
+ lines.append(f" · the fight waits on {wait['actor_id']}{who}:")
825
826
  lines += refusal_lines("", wait.get("legal_actions") or [])[1:]
826
827
  created = details.get("created") or []
827
828
  if created:
@@ -1142,6 +1143,10 @@ def connect(
1142
1143
  msg["reason"], msg.get("legal_actions") or []
1143
1144
  ):
1144
1145
  typer.echo(line)
1146
+ if msg.get("waiting_on"): # D-114: it is another character's move
1147
+ typer.echo(f" (the fight waits on {msg['waiting_on']})")
1148
+ elif kind == "encounter_abandoned": # D-114: the game closed the fight
1149
+ typer.echo(" · the fight was closed, undecided")
1145
1150
  elif kind == "intent_rejected":
1146
1151
  typer.echo(
1147
1152
  f" ✗ [{msg['participant_id']}] intent rejected: {msg['text']!r}"
@@ -1729,13 +1734,23 @@ def chronicle(
1729
1734
  else:
1730
1735
  w = await _world_or_exit(store, world)
1731
1736
  branch_id = (await _branch_or_exit(store, w, branch)).branch_id
1732
- beats = await store.recent_beats(branch_id, limit)
1737
+ records = await store.beat_records(branch_id, limit)
1733
1738
  finally:
1734
1739
  await store.close()
1735
- if not beats:
1740
+ if not records:
1736
1741
  typer.echo("(no beats yet)")
1737
- for beat in beats:
1742
+ for record in records: # each beat's words, then what its commit said (D-115)
1743
+ beat = record.beat
1738
1744
  typer.echo(f"> [{beat.participant_id}] {beat.intent_text}")
1745
+ for check in record.checks:
1746
+ typer.echo(f" · {check.affordance}: {check.outcome}")
1747
+ if record.mode == "encounter":
1748
+ typer.echo(" · a fight")
1749
+ if record.created:
1750
+ made = ", ".join(f"{c.name} ({c.kind})" for c in record.created)
1751
+ typer.echo(f" + new: {made}")
1752
+ for t in record.threads_changed:
1753
+ typer.echo(f" ~ plot {t.from_state or 'new'} → {t.to_state}: {t.stakes}")
1739
1754
  typer.echo(f"{beat.narration}\n")
1740
1755
 
1741
1756
  _run_async(_run)
@@ -1855,6 +1870,53 @@ def rules_validate(path: str) -> None:
1855
1870
  )
1856
1871
 
1857
1872
 
1873
+ @ruleset_app.command("describe")
1874
+ def ruleset_describe(
1875
+ ruleset_id: str = typer.Argument(..., help="A ruleset id, as `uro ruleset list` shows them."),
1876
+ config: Path | None = typer.Option( # noqa: B008
1877
+ None,
1878
+ "--config",
1879
+ help="The settings to describe it under: a .toml or .json file (what a world's "
1880
+ "`[ruleset.config]` or a campaign's settings would hold). Default: its defaults.",
1881
+ ),
1882
+ as_json: bool = typer.Option(False, "--json", help="Everything, as JSON."),
1883
+ ) -> None:
1884
+ """One ruleset as it stands under given settings (D-114): the checks it offers and what a
1885
+ character spec may say. For a ruleset whose game is its settings (uro-composable; examples in
1886
+ examples/definitions/), this is how to read the game."""
1887
+ import tomllib
1888
+
1889
+ from uro_core.characters import ruleset_info
1890
+
1891
+ settings: dict[str, Any] | None = None
1892
+ if config is not None:
1893
+ try:
1894
+ text = config.read_text()
1895
+ settings = tomllib.loads(text) if config.suffix == ".toml" else json.loads(text)
1896
+ except (OSError, ValueError) as exc:
1897
+ typer.echo(f"can't read {config}: {exc}", err=True)
1898
+ raise typer.Exit(1) from exc
1899
+ try:
1900
+ info = ruleset_info(registry.resolve(ruleset_id, "", settings))
1901
+ except (KeyError, ValueError) as exc:
1902
+ typer.echo(str(exc.args[0]) if exc.args else str(exc), err=True)
1903
+ raise typer.Exit(1) from exc
1904
+ if as_json:
1905
+ typer.echo(json.dumps(info, indent=2))
1906
+ return
1907
+ typer.echo(f"{info['id']}@{info['version']}")
1908
+ spec = info["spec_schema"]
1909
+ closed = spec.get("additionalProperties") is False
1910
+ keys = ", ".join(spec.get("properties", {})) or ("(nothing to choose)" if closed else "(any)")
1911
+ typer.echo(f" spec: {keys}")
1912
+ if not info["affordances"]:
1913
+ typer.echo(" no checks: every beat is narration")
1914
+ for a in info["affordances"]:
1915
+ triggers = f" [{', '.join(a['trigger_categories'])}]" if a["trigger_categories"] else ""
1916
+ fight = " (starts a fight)" if a["starts_encounter"] else ""
1917
+ typer.echo(f" {a['id']}: {a['description']}{triggers}{fight}")
1918
+
1919
+
1858
1920
  @ruleset_app.command("list")
1859
1921
  def ruleset_list() -> None:
1860
1922
  """The rulesets a world can declare (`\\[ruleset] id` in world.toml): the built-ins and
@@ -2248,9 +2310,15 @@ def campaign_new(
2248
2310
  def campaign_encounter(
2249
2311
  campaign_id: str,
2250
2312
  participant: str = typer.Option(None, "--participant", help="whose fight (default: any)"),
2313
+ abandon: bool = typer.Option(
2314
+ False,
2315
+ "--abandon",
2316
+ help="end the fight without deciding it (D-114): sheets stay as they are",
2317
+ ),
2251
2318
  ) -> None:
2252
2319
  """The fight waiting on a player's choice in a campaign that plays fights turn by turn
2253
- (D-112): whose turn it is and the actions to send (`/act` in `uro play`/`uro connect`)."""
2320
+ (D-112): whose turn it is and the actions to send (`/act` in `uro play`/`uro connect`).
2321
+ `--abandon` closes it undecided: nobody wins, is wounded or looted."""
2254
2322
 
2255
2323
  async def _run() -> None:
2256
2324
  store = build_store()
@@ -2263,6 +2331,10 @@ def campaign_encounter(
2263
2331
  ruleset=await registry.resolve_for_campaign(store, c),
2264
2332
  )
2265
2333
  try:
2334
+ if abandon:
2335
+ ended = await engine.abandon_fight(c, participant)
2336
+ typer.echo(f"abandoned {ended}" if ended else "(no fight was open)")
2337
+ return
2266
2338
  wait = await engine.fight_status(c, participant)
2267
2339
  except ChoiceRefused as exc:
2268
2340
  typer.echo(f"error: {exc}", err=True)
@@ -2538,11 +2610,16 @@ def character_preview(
2538
2610
  raise typer.Exit(1) from exc
2539
2611
  finally:
2540
2612
  await store.close()
2613
+ left = (preview.guidance or {}).get("left") or []
2541
2614
  if not preview.ok:
2542
2615
  _echo_refused(CharSpecError(preview.problems))
2616
+ if left: # D-114: the ruleset's own count of what the build still wants
2617
+ typer.echo(f"still to do: {json.dumps(left)}", err=True)
2543
2618
  raise typer.Exit(1)
2544
2619
  typer.echo(f"ok ({preview.ruleset}):")
2545
2620
  typer.echo(json.dumps(preview.sheet, indent=2, sort_keys=True))
2621
+ if left:
2622
+ typer.echo(f"still to do: {json.dumps(left)}")
2546
2623
 
2547
2624
  _run_async(_run)
2548
2625
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes