# CLI reference

Every dunjii command and flag, from the command's own help.

## Commands

The `dunjii` command comes with the Dunjii desktop app. [Download the app](https://dunjii.com/download) to install it, and see [Local agents](https://dunjii.com/docs/agents/local-agents.md) for a first sync. `dj` is a shorter name for the same command.

| Command | What it does |
| --- | --- |
| `dunjii agents` | Add instruction files for AI coding agents (AGENTS.md, CLAUDE.md) |
| `dunjii app` | Launch Dunjii menu bar app with background sync |
| `dunjii app install` | Install Dunjii for the current user (Windows) |
| `dunjii app remove-folder [path]` | Stop syncing a folder in the background |
| `dunjii app uninstall` | Remove Dunjii from login items, PATH, and the CLI symlink |
| `dunjii backlinks <path>` | What links to this file |
| `dunjii clone <workspace|@owner/workspace> [directory]` | Clone a workspace from Dunjii |
| `dunjii copy <source>... <dest>` | Copy files within the workspace, fixing the copy's own links |
| `dunjii diff <path> [version1] [version2]` | Compare file versions |
| `dunjii filter <key:value>...` | Find files by type, tag, or any declared property |
| `dunjii history [path]` | Show version history for files |
| `dunjii image` | Wire image files into your markdown |
| `dunjii image attach` | Insert or replace an image link in a markdown section |
| `dunjii init` | Set up the current directory as your Dunjii workspace |
| `dunjii link [workspace]` | Connect this folder to an existing Dunjii workspace |
| `dunjii login` | Log in to Dunjii |
| `dunjii logout` | Sign this computer out of Dunjii |
| `dunjii move <src> <dest>` | Move or rename a file and rewrite all references to it |
| `dunjii new` | Start a campaign or a session |
| `dunjii new campaign <name>` | Start a campaign in the current workspace |
| `dunjii new session [campaign]` | Start a session in a campaign |
| `dunjii preview <map.svg>` | A link that draws a map as Dunjii will, without syncing it |
| `dunjii random [table]` | Roll on a random table |
| `dunjii restore <path> --to <version|timespec>` | Restore a file to a previous version |
| `dunjii shape [type]` | What a document of a given type looks like in source |
| `dunjii shared` | List workspaces other people have shared with you |
| `dunjii show <path>` | Show the content of a file version |
| `dunjii skill` | List and describe available skills for AI agents |
| `dunjii skill describe <skill>` | Print full instructions for a skill |
| `dunjii skill list` | List available skills |
| `dunjii sourcebook` | The bundled reference content: read it, search it, copy from it |
| `dunjii sourcebook copy <path>... <dest>` | Copy Sourcebook pages into this workspace |
| `dunjii sourcebook search <query> [key:value]...` | Search the Sourcebook |
| `dunjii sourcebook show <path>` | Print a Sourcebook page |
| `dunjii statblock <creature>` | Print a creature's stat block, ready to paste |
| `dunjii sync` | Sync all files with Dunjii server |
| `dunjii sync status` | What is being synced in the background, and how it is going |
| `dunjii trash` | Manage locally-deleted files held in .dunjii/trash |
| `dunjii trash list` | List trash batches in this workspace, newest first |
| `dunjii trash restore <batch-id> [<path>...]` | Restore files from a trash batch back to their original locations |
| `dunjii trust` | Use the sign-in saved in this folder's .dunjii/config.json |
| `dunjii url <path>` | The web address of a file in this workspace |
| `dunjii validate [path]` | Validate your markdown files |

Run `dunjii <command> --help` for a command's arguments and examples.

## Flags

Every command also takes `--help`. Flags with no default listed are off or empty until you set them.

| Command | Flag | What it does |
| --- | --- | --- |
| `dunjii agents` | `--force` | Change existing files without asking: replace AGENTS.md, add the import to CLAUDE.md |
| `dunjii app` | `--no-sync` | Start without auto-syncing (manual start/stop only) |
| `dunjii app install` | `--no-autostart` | Don't register the app to start at login |
| `dunjii backlinks` | `--json` | Emit JSON (for tools and agents) |
| `dunjii copy` | `--force` | Overwrite the destination if it exists |
| `dunjii copy` | `--rename` | Name the copy (only valid with a single source into a directory) |
| `dunjii diff` | `--no-color` | Disable colored output |
| `dunjii filter` | `--json` | Emit JSON (for tools and agents) |
| `dunjii filter` | `--keys` | List every filterable property and its values |
| `dunjii history` | `--limit, -l` | Maximum number of versions/files to show (default 20) |
| `dunjii image attach` | `--alt` | Alt text for the image (default: H1 from markdown) |
| `dunjii image attach` | `--image` | Image file to reference |
| `dunjii image attach` | `--level` | Heading level for new sections (default 2) |
| `dunjii image attach` | `--md` | Markdown file to update |
| `dunjii image attach` | `--section` | Heading text (e.g. 'Portrait', 'Illustration') |
| `dunjii link` | `--force` | Skip the confirmation, and re-link a folder that is already linked |
| `dunjii login` | `--local` | Save credentials to .dunjii/config.json in the current directory instead of ~/.dunjii/ |
| `dunjii login` | `--no-browser` | Don't open a browser; print a code to enter at /device on any computer instead |
| `dunjii move` | `--dry-run, -n` | Print the move and every rewrite without changing anything |
| `dunjii move` | `--force, -f` | Overwrite the destination if it exists |
| `dunjii new session` | `--number` | Session number (default: next available) |
| `dunjii new session` | `--title` | Optional session title (written into the Session.md heading) |
| `dunjii preview` | `--open` | Also open the link in the default browser |
| `dunjii random` | `--n, -n` | Draw this many (default 1) |
| `dunjii restore` | `--to` | Version number or time spec (3h, 1d, yesterday, 1w) |
| `dunjii restore` | `--yes, -y` | Skip confirmation prompt |
| `dunjii shape` | `--json` | Emit JSON (for tools and agents) |
| `dunjii shape` | `--ruleset` | Describe this ruleset's types (default: the current folder's) |
| `dunjii show` | `--version, -v` | Version number to show |
| `dunjii sourcebook copy` | `--dry-run, -n` | Print what would be copied without writing anything |
| `dunjii sourcebook search` | `--json` | Emit JSON (for tools and agents) |
| `dunjii sourcebook search` | `--limit` | Stop after this many hits (0 for all) (default 20) |
| `dunjii statblock` | `--local` | Only look in this workspace |
| `dunjii statblock` | `--name` | Title the block with this name instead of the one you searched for |
| `dunjii statblock` | `--sourcebook` | Only look in your Sourcebooks |
| `dunjii sync` | `--watch, -w` | Watch for changes and sync continuously |
| `dunjii validate` | `--fix` | Resolve wikilinks to relative paths and link Sourcebook pages by URL |
| `dunjii validate` | `--strict` | Treat warnings as errors (exit 1 on warnings) |
