Skip to content

Add dice command with TRPG-style notation support#9

Merged
fluo10 merged 2 commits intomainfrom
feat/dice
Mar 14, 2026
Merged

Add dice command with TRPG-style notation support#9
fluo10 merged 2 commits intomainfrom
feat/dice

Conversation

@fluo10
Copy link
Copy Markdown
Owner

@fluo10 fluo10 commented Mar 14, 2026

Summary

  • Adds tryluck dice command for rolling dice via CLI and MCP
  • Supports TRPG-style dice notation (3d10, d6+2, 2d8-1) as a positional argument, as well as CLI-style flags (-d/--sides, -m/--modifier)
  • Dice notation (containing d) always shows {"rolls": [...], "total": N}; plain count returns a plain array (consistent with coin and tarot)
  • --sum flag or non-zero modifier also triggers total output
  • MCP tool added with notation, count, sides, modifier, and sum parameters

Test plan

  • tryluck dice → single d6 roll, plain value
  • tryluck dice 3 → three d6 rolls, plain array
  • tryluck dice 3d10 → three d10 rolls + Total: (notation implies total)
  • tryluck dice d6 → single d6 roll + Total: (notation implies total)
  • tryluck dice d20+5 → one d20 roll with modifier + Total:
  • tryluck dice 2d6 -m 3 → two d6 rolls with modifier via flag + Total:
  • tryluck dice 3d10 --json{"rolls": [...], "total": N}
  • tryluck dice 3 --sum --json{"rolls": [...], "total": N}
  • tryluck dice 3 -d 10 → three d10 rolls, plain array (CLI flags, no notation)
  • MCP dice tool with notation parameter → total included
  • MCP dice tool with explicit count/sides only → plain array

🤖 Generated with Claude Code

fluo10 and others added 2 commits March 15, 2026 07:28
Implements `tryluck dice` for rolling dice via CLI and MCP.
- Accepts dice notation (e.g. 3d10, d6+2, 2d8-1) or plain count as a positional argument
- `-d`/`--sides` and `-m`/`--modifier` flags for explicit CLI-style control
- Modifier implies sum output: returns `{"rolls": [...], "total": N}` as JSON
- `--sum` flag to force total output even without a modifier
- Default: 1d6, plain array output (consistent with coin and tarot)
- MCP tool with `notation`, `count`, `sides`, `modifier`, `sum` parameters

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Dice notation (containing 'd', e.g. 3d10, d6+2) now always shows
the total without requiring --sum, matching TRPG conventions.
Plain count (e.g. `dice 3`) still returns individual rolls only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@fluo10 fluo10 merged commit 05a59a9 into main Mar 14, 2026
4 checks passed
@fluo10 fluo10 deleted the feat/dice branch March 14, 2026 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant