# `jadpo domain`

Rename or reshape a domain.

Move a domain's files and update every call into them (areas 1, 14 and 18). `rename` moves the domain's folder and every place code names the domain; the identity registry (database/identities.jadpo_record) gets one line, which its types, functions and constants follow, so stored data, deliveries and the review still know each thing. `merge` moves every file of one domain to the same place in another, a call between the two losing its qualifier. `split` moves the declarations named, with their tests, templates and prompts, to a new domain, only along a seam: a reference across it is refused, naming the command that moves all it reaches. The records the move changes are written again, and `jadpo check` asks for the acceptance a renamed or new domain needs. A name that is taken or isn't one, two private names or files at one place, and a split across references are refused before anything changes; a move whose result would have an error the project didn't have changes nothing and shows that error.

```text
jadpo domain <action> <domain> <to> [names]
```

## Arguments

- `action`: Which move to make
- `domain`: The domain to move
- `to`: The new name, the new domain or the one to join
- `names` (optional): For split, the declarations that move

## On every command

- `--json`: Print data for tools instead of text
- `--full`: Show everything a report shortens
- `--help`: Show every flag, with examples
- `--color <when>`: Choose when to use colour

`jadpo domain --json` writes one JSON document to standard output instead of text, with the same exit code. The document has `schemaVersion`, `command` (`"domain"`), `ok`, `data` (what the command produced, `null` when it failed) and `diagnostics` (each error with its `rule`, `reason`, `next` and `help`). A command that needs a terminal refuses `--json` and names the flags that do the same job.

## Examples

```text
# Give a domain a new name, keeping every key
jadpo domain rename planning plans
# Move the notes part of a domain to a new one
jadpo domain split planning notes Note add_note list_notes
# Move one domain into another
jadpo domain merge notes planning
```

## Errors

- [`cli.domain_arguments`](/docs/errors/cli.domain_arguments.md): A `jadpo domain` command names a move it doesn't make, a domain the project doesn't have, a new name that is taken or isn't one, or a split or merge the domains can't take
- [`toolchain.artifact_write_failed`](/docs/errors/toolchain.artifact_write_failed.md): A file Jadpo writes for you, such as a record, couldn't be written, usually because it or its folder is read-only
- [`toolchain.project_not_found`](/docs/errors/toolchain.project_not_found.md): You ran a command that works on a project in a folder with no `app.jadpo`, in it or in any folder above it
