Skip to content

Simon-Hostettler/dnc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

______ _   _ _____
|  _  \ \ | /  __ \
| | | |  \| | /  \/
| | | | . ` | |
| |/ /| |\  | \__/\
|___/ \_| \_/\____/

Go Latest Semver

A terminal-based TTRPG character manager built with Bubble Tea, Lip Gloss and DuckDB. It provides a TUI to create and edit various character data (stats, spells, items, etc.).

demo

Quick start

Requirements

  • Go (recommended 1.25+)
  • A terminal that supports alternate screen and UTF-8

Install and build the binary:

go install hostettler.dev/dnc@latest

If you can't run the bin, add the output of the following command to your $PATH:

go env GOBIN GOPATH

You can modify the key bindings stored at os.UserConfigDir()/dnc/config.json. Defaults can be found in util.DefaultKeyMap() or by pressing ctrl+h.

Code layout

This repository is organized as a single Go module (hostettler.dev/dnc) with the following rough layout:

├── LICENSE
├── README.md     // <-- You are here
├── command       // generic cross-package tea commands
├── db            // Driver for DuckDB, migration logic + migrations
├── demo.tape     // vhs tape to produce demo gif
├── dncapp.go     // Main command handler & coordinator, top-level bubble tea program
├── go.mod
├── go.sum
├── main.go       // Application bootstrap
├── models        // Types reflecting stored data objects & helper types
├── repository    // Interfaces + implementations for data repositories
├── ui            // Screens, editors, other tea models
└── util          // Configs & small utilities

To avoid convoluted dependencies, command, util and db are not allowed to have internal dependencies. repository can only depend on models, db and util. Only dncapp.go and packages in ui are allowed to import the others. Packages in ui should avoid depending on each other, except for screen, which brings them together.

Data

Data is currently stored in a local DuckDB database using sqlx.

  • Location (default): Given by os.UserConfigDir() (~/Library/Application Support/dnc/dnc.db on macOS)
  • Migrations: custom parser, migration files under db/migrations.

To add a migration:

  1. Create a new file in db/migrations named like 0002_add_foo.sql.
  2. Include sections:
   -- +duckUp
   -- SQL to apply
   -- +duckDown
   -- SQL to roll back

Migrations will be applied automatically at startup

Testing

Currently mostly smaller unit tests. Looking to implement larger integration tests using teatest.

License

This software is distributed under the GNU GPL v3.

This software makes use of certain game mechanics and terminology that also appear in the System Reference Document (SRD) published by Wizards of the Coast, such as concepts including “ability scores,” “proficiency bonus,” and similar rule terms. These elements are functional game mechanics and generic terminology, which are not subject to copyright protection.

This software does not reproduce, distribute, or include any text, tables, or other expressive content from the SRD or any other copyrighted work. Accordingly, this software is not a derivative work of the SRD and is not distributed under the Open Gaming License (OGL).

Contributing

Feature requests (through issues) or PRs are very welcome :) Please make sure your contribution is compatible with the above-described licensing.

About

A terminal-based TTRPG character manager

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages