feat: add turn, a dungeon-turn tracker - #2
Merged
Conversation
Deploying dlmnwd with
|
| Latest commit: |
300bd2a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://fbc052df.dlmnwd.pages.dev |
| Branch Preview URL: | https://ptaranat-db-106-dw-turn-dung.dlmnwd.pages.dev |
There was a problem hiding this comment.
Pull request overview
Adds a new dw turn command to track dungeon turns (10 minutes each), persist session state between invocations, and provide reminders for expiring tracked items and wandering-check cadence.
Changes:
- Introduces core turn/session state logic (
parseTurns,advance, persistence helpers) and associated tests. - Adds the
turnCLI command with subcommands (track,status,check-every,end) and integrates it into the main CLI help/dispatch. - Updates documentation and shell completion to expose the new command.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
test/turn.test.ts |
Adds unit tests for parsing, advancement rules, wandering-check cadence, and persistence/corruption handling. |
src/turn.ts |
Implements turn-state model, duration parsing/formatting, advancement logic, and JSON file persistence. |
src/commands/turn.ts |
Adds the dw turn CLI subcommand implementation and user-facing output. |
src/cli.ts |
Registers turn in command dispatch and documents it in dw help. |
README.md |
Documents dw turn usage and updates the “Working” command list/roadmap. |
completions/_dw |
Adds zsh completion entries for the new turn command and its subcommands. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ptaranat
force-pushed
the
ptaranat/db-106-dw-turn-dungeon-turn-tracker
branch
from
August 28, 2026 13:45
a75cef2 to
99cc0f0
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Suppressed comments (1)
src/commands/turn.ts:90
cmdAdvanceusesparseInt, so inputs likedw turn 1hordw turn 3xwill be accepted and silently interpreted as1/3. Given this command’s docs also mentionm/hdurations (fortrack), this is especially likely to produce wrong advances. Consider requiring a pure integer string for[n]before parsing.
function cmdAdvance(arg: string | undefined): void {
const n = arg === undefined ? 1 : parseInt(arg, 10);
if (Number.isNaN(n) || n < 1) {
console.error(USAGE);
process.exit(1);
}
ptaranat
force-pushed
the
ptaranat/db-106-dw-turn-dungeon-turn-tracker
branch
from
August 28, 2026 13:49
99cc0f0 to
300bd2a
Compare
ptaranat
added a commit
that referenced
this pull request
Aug 28, 2026
Moves the dw turn session file default from the repo root to ~/.cache/dw/dw-session.json, the same machine-local home as dw.db and the extraction cache, so state survives switching or re-cloning checkouts. DW_SESSION still overrides. The repo-root gitignore entry stays as protection for old state files. Follows up the Copilot thread on #2, where my repo-root-convention claim was wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds dw turn, the dungeon clock: advance turns (10 min each), track named light sources and spells by duration (6, 30m, 1h), warn on expiry and upcoming expiry, and remind on the wandering-check cadence (configurable, default every 2 turns). State survives between invocations in dw-session.json at the repo root (already gitignored), overridable via DW_SESSION; a corrupt state file starts fresh with a note. No named light sources or book content hardcoded: the user names the thing and gives its duration. DB-106.