
# tarvena CLI command reference

This reference lists the installed `tarvena` commands, required inputs, and write behaviour.

What to do and in what order is in the installed skills: `tarvena help agent-docs` lists the shared rules to read first and each skill with the commands of its actions.

An installed CLI can reveal absolute paths to the agent docs:

```powershell
tarvena help agent-docs
```

Read the [CLI conventions](tarvena-cli-conventions.md) for output, exit codes, flags, authentication, revisions, and retries.

## Runtime and settings

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena help agent-docs` | No | Returns `readFirst` (the shared rules and these conventions), each installed skill with the commands of its actions (`null` where the CLI has none), and every installed guide, with absolute paths, version and the published index URL. Works offline and signed out. |
| `tarvena runtime ping` | No | Calls `runtime.ping()` to verify Runtime connectivity. |
| `tarvena settings get` | No | Reads Runtime settings. |
| `tarvena settings set-base-path --path <path>` | Yes | Sets the Project Folder base path used by Runtime. |

## Authentication

Use `tarvena auth login` for standalone cloud access. It opens browser sign-in and saves the resulting session through the CLI authentication owner; `--no-browser` prints the sign-in instructions instead. Use `--server <origin>` to select and save another cloud server.

With `--local`, open Tarvena and sign in there first. That mode attaches to the desktop runtime and uses its selected organization/session; organization switching and sign-out remain in the desktop app.

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena auth status` | No | Reports standalone cloud authentication and server; with `--local`, reads the desktop session, selected organization and installation state. |
| `tarvena auth login [--server <origin>] [--no-browser]` | Yes | Signs into the selected cloud server through browser confirmation. |
| `tarvena auth logout` | Yes | Ends the saved cloud session. |

## Organization features (Tarvena admin)

Only a verified Tarvena admin can list or change feature availability. Organization owners and
admins cannot use this switch. These commands work in cloud mode and with `--local`.

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena admin features list [--organization <id>]` | No | Lists enabled organization features and their grant attribution. |
| `tarvena admin features enable --organization <id> cost-estimates\|documents` | Yes | Enables Kosztorys (`cost-estimates`) or documents (`documents`) for projects currently owned by this organization. Repeated enable succeeds without changing attribution. |
| `tarvena admin features disable --organization <id> cost-estimates\|documents` | Yes | Disables the feature on the next request and event delivery, retaining estimates and documents. Repeated disable succeeds. |

Organization IDs come from the Auth admin search. Members and guests follow the switch of the organization that currently owns the project.

## Cloud projects

All commands use the authenticated Tarvena cloud project API. The CLI has no local project registration,
package import/export, snapshot sync, or compatibility command.

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena cloud-project list` | No | In cloud mode, returns all visible cloud projects and `organizations` (personal workspace and every team, with `organizationId`, `organizationName`, `organizationKind` and `organizationRole`). Filter projects by `organizationId` to list a chosen team. |
| `tarvena cloud-project get <project-id>` | No | Reads one authorized cloud project. |
| `tarvena cloud-project create --name <name> [--type <type>] [--project-folder-parent <absolute-parent-path>] [--request-id <retry-id>]` | Yes | Creates a ready project and its local Project Folder. |
| `tarvena cloud-project members list --project <project-id>` | No | Lists project members. |
| `tarvena cloud-project members upsert --project <project-id> --email <email> --role owner\|editor\|viewer --expected-revision <revision>` | Yes | Adds or changes a member with optimistic revision checking. |
| `tarvena cloud-project members remove --project <project-id> --user <user-id> --expected-revision <revision>` | Yes | Removes a member with optimistic revision checking. |

## Profile

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena profile get --project <project-id>` | No | Reads the complete cloud project profile. |
| `tarvena profile mutate --project <project-id> (--json <json> \| --file <path>)` | Yes | Applies one typed, revision-checked cloud profile workflow. |
| `tarvena profile investors reorder --project <project-id> --investor-ids <id,id,...> --expected-revision <revision>` | Yes | Reorders every investor by stable ID and returns the complete authoritative profile. |
| `tarvena profile professionals list --project <project-id>` | No | Lists the complete professional roster in authoritative position order. |
| `tarvena profile professionals add\|update --project <project-id> --expected-revision <revision> (--json <json> \| --file <path>)` | Yes | Adds or updates one professional assignment. |
| `tarvena profile professionals remove --project <project-id> --assignment-id <assignment-id> --expected-revision <revision>` | Yes | Removes an assignment by stable ID. |
| `tarvena profile professionals reorder --project <project-id> --assignment-ids <id,id,...> --expected-revision <revision>` | Yes | Reorders the complete roster and returns the derived Primary Designer. |
| `tarvena profile defaults get` | No | Reads organization profile defaults. |
| `tarvena profile defaults update (--json <json> \| --file <path>)` | Yes | Updates organization profile defaults. New projects copy the current default transactionally. |

The first ordered `Projektant` is the Primary Designer. Other roles can appear earlier. Each
successful professional mutation returns the authoritative order and `primaryDesignerAssignmentId`.
Investor reorder input must contain each current investor ID exactly once. The order controls every
consumer that selects the first investor.

`profile mutate` takes one `{expectedRevision, operation}` object. Operation kinds: `set_task_info`,
`upsert_investor`, `delete_investor`, `reorder_investors`, `set_design_office`, `add_professional`,
`update_professional`, `remove_professional`, `replace_professionals`, `reorder_professionals` and
`apply_organization_defaults`, which needs a fresh `newPrimaryDesignerAssignmentId` UUID. New
investor and assignment IDs are fresh UUIDs. A stale reorder returns `currentProfile`; retry with its
revision and IDs. Defaults updates affect future projects.

## Documents

Document commands use an explicit cloud project ID and document ID. For local body editing, request `--include-local-path true` and use only the verified path returned by the owning runtime.

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena documents blueprints list --project <project-id> [--document-kind <kind>] [--include-all-versions true\|false]` | No | Lists document blueprints. |
| `tarvena documents guide --project <project-id> (<document-id> \| --document-kind <kind>)` | No | Returns absolute paths to the shared rules, the document rules, the matching blueprint guide and the styling guide, whether the installed guide supports the blueprint version, and inspection commands. Both document selectors need `--project`. |
| `tarvena documents list --project <project-id> [--document-kind <kind>] [--include-docx-forms true\|false]` | No | Lists Markdown documents. With `--include-docx-forms true`, merges docx forms into the returned `documents` list; cannot combine with `--document-kind`. |
| `tarvena documents create --project <project-id> --blueprint <blueprint-key> --title <title> [--document-id <stable-id>] [--export-basename <name>] [--add-title-page true\|false] [--config-json <json> \| --config-file <path>]` | Yes | Creates a Markdown document. |
| `tarvena documents get --project <project-id> <document-id>` | No | Reads one document. |
| `tarvena documents update --project <project-id> <document-id> [--title <title>] [--export-basename <name>] (--precondition-json <json> \| --precondition-file <path>) (--write-json <json> \| --write-file <path>)` | Yes | Conditionally updates metadata using the observed field values and original presentation attempt. `--precondition-file` and `--write-file` are alternatives. |
| `tarvena documents delete-admission --project <project-id> <document-id>` | No | Reads the record revision required for deletion. |
| `tarvena documents delete --project <project-id> <document-id> --change-id <uuid> --expected-records-revision <revision>` | Yes | Deletes the document at the admitted records revision. |
| `tarvena documents recover-delete --project <project-id> <document-id> --change-id <uuid>` | Yes | Reconciles the original deletion after an uncertain reply. |
| `tarvena documents body-info --project <project-id> <document-id> [--include-local-path true\|false]` | No | Reads document body metadata. Local path is omitted unless explicitly requested. |
| `tarvena documents read-body --project <project-id> <document-id> [--include-local-path true\|false]` | No | Reads Markdown body content. Local path is omitted unless explicitly requested. |
| `tarvena documents write-body --project <project-id> <document-id> --change-id <uuid> --expected-revision <revision> (--markdown <text> \| --markdown-file <path>)` | Yes | Saves the full Markdown body as a new revision, based on the explicit body revision, with a caller-generated UUID as its change ID. Results are typed: `saved` with the new `bodyRevision`; `conflict` with the current body (`current.bodyRevision`, `current.markdown`) when the expected revision is no longer current; `rejected` with `reason` `invalid_content` or `too_large`. Conflict and rejection are successful command envelopes and leave the body unchanged. Retry an uncertain result by sending the same command again with the same change ID, revision and Markdown; it returns the first outcome. A changed replacement requires a new change ID. |
| `tarvena documents structure get --project <project-id> <document-id>` | No | Reads parsed document structure. |
| `tarvena documents specyfikacja templates list --project <project-id>` | No | Lists specyfikacja item templates. |
| `tarvena documents specyfikacja create --project <project-id> --title <title> --document-id <stable-id> --write-file <path> (--tasks-json <json> \| --tasks-file <path>)` | Yes | Creates a specyfikacja document from tasks. Tasks input must be a JSON array of `{ title, items }`; each item is `{ id }` or `{ title }`. |
| `tarvena documents specyfikacja renumber --project <project-id> <document-id> --expected-revision <revision> --write-file <path>` | Yes | Renumbers a specyfikacja document. |
| `tarvena documents specyfikacja items list --project <project-id> <document-id>` | No | Lists specyfikacja items. |
| `tarvena documents specyfikacja items add --project <project-id> <document-id> --task <task-section-key> (--template <template-id> \| --title <custom-title>) [--position <index> \| --after-item <item-section-key>] --expected-revision <revision> --write-file <path>` | Yes | Adds a specyfikacja item under a task. `--position` must be nonnegative. |
| `tarvena documents specyfikacja items remove --project <project-id> <document-id> --item <item-section-key> --expected-revision <revision> --write-file <path>` | Yes | Removes one specyfikacja item. |
| `tarvena documents specyfikacja items reorder --project <project-id> <document-id> --task <task-section-key> --items <item-section-key,...> --expected-revision <revision> --write-file <path>` | Yes | Reorders items under one task. |
| `tarvena documents assets admission --project <project-id> <document-id>` | No | Reads the current asset revision for an original mutation. |
| `tarvena documents assets import --project <project-id> <document-id> --source <path> --mime <mime-type> --path <relative-path> --change-id <uuid> --expected-revision <revision>` | Yes | Streams a native source to the canonical local or Drive document owner. The exact relative path and original operation identity are required. |
| `tarvena documents assets list --project <project-id> <document-id>` | No | Discovers current document images and attachments, including externally added members, with bounded traversal. Returns opaque member references. |
| `tarvena documents assets delete --project <project-id> <document-id> --path <relative-path> --member-ref <reference> --change-id <uuid> --expected-revision <revision>` | Yes | Deletes the exact member selected from discovery. A replacement at the same path cannot redirect the operation. |
| `tarvena documents assets recover --project <project-id> <document-id> --change-id <uuid>` | Yes | Reconciles the original operation after an uncertain reply; does not allocate another filename or retry publication. |
| `tarvena documents design get --project <project-id> <document-id>` | No | Reads the document's design (title page content and its own style overrides), its organization's style, the revisions and the reset values. |
| `tarvena documents design enable-title-page --project <project-id> <document-id> --change-id <uuid> --expected-revision <revision>` | Yes | Turns the title page on at the revision returned by design get. |
| `tarvena documents design disable-title-page --project <project-id> <document-id> --change-id <uuid> --expected-revision <revision>` | Yes | Turns the title page off at the revision returned by design get. |
| `tarvena documents design update --project <project-id> <document-id> --change-id <uuid> --expected-revision <revision> (--design-json <json> \| --design-file <path>)` | Yes | Saves the whole design, including the document's style overrides. A stale revision returns a conflict with the current design. |
| `tarvena documents config get --project <project-id> <document-id>` | No | Reads document config. |
| `tarvena documents config describe --project <project-id> [<document-id>]` | No | Lists canonical Operat choices and the calculation group/child tree. Without a document returns defaults; with a document includes saved selections, unavailable entries and the configuration revision. |
| `tarvena documents config preview --project <project-id> <document-id> [--config-json <json> \| --config-file <path>]` | No | Uses the document's saved config; optional JSON/file input overrides it for inspection. Returns the sections the configuration includes, what each is for, and the structure changes it would make; writing instructions appear as TODO text in the document. Use reconcile/refresh previews for their apply tokens. |
| `tarvena documents config update --project <project-id> <document-id> --expected-config-revision <revision> (--config-json <json> \| --config-file <path>)` | Yes | Replaces document config using the revision returned by config get; leaves document content unchanged. |
| `tarvena documents config patch --project <project-id> <document-id> (--config-json <json> \| --config-file <path>)` | Yes | Deep-merges a JSON object into the current document config. |
| `tarvena documents export-config get --project <project-id> <document-id>` | No | Reads export preferences and their configRevision. |
| `tarvena documents export-config update --project <project-id> <document-id> --expected-config-revision <revision> (--config-json <json> \| --config-file <path>) [--request-id <uuid>]` | Yes | Replaces preferences at the observed revision. Reuse a request ID only to retry the same intent. Requires no project files. |
| `tarvena documents refresh-section --project <project-id> <document-id> --section <section-key> [--mode section\|subtree] [--apply true\|false] [--expected-revision <revision>] [--expected-config-revision <revision>] [--review-token <token>] [--replacement-markdown <text> \| --replacement-markdown-file <path>]` | Maybe | Refreshes generated content for a section. Mutates only with `--apply true`; requires the body revision, configuration revision, and review token returned by the matching preview. |
| `tarvena documents generated-blocks list --project <project-id> <document-id> [--section <section-key>]` | No | Lists generated blocks, optionally scoped to a section. |
| `tarvena documents refresh-generated-block --project <project-id> <document-id> --section <section-key> --block <block-key> [--apply true\|false] [--expected-revision <revision>] [--expected-config-revision <revision>] [--review-token <token>] [--replacement-markdown <text> \| --replacement-markdown-file <path>]` | Maybe | Refreshes one generated block. Mutates only with `--apply true`; requires the body revision, configuration revision, and review token returned by the matching preview. |
| `tarvena documents reconcile --project <project-id> <document-id> [--apply true\|false] [--expected-revision <revision>] [--expected-config-revision <revision>] [--review-token <token>] [--confirm-removal-section <key,key>] [--confirm-removal-block <key,key>]` | Maybe | Apply requires the preview's base body/config revisions and relevantInputToken. Managed removals require the exact confirmed section keys, and removed S_6 calculation blocks their exact block keys. Custom sections and text around blocks are preserved. |
| `tarvena documents export-admission --project <project-id> <document-id>` | No | Reads the local or remote export target. |
| `tarvena documents export --project <project-id> <document-id> --format html\|pdf\|docx [--request-id <uuid>] [--output-name <name>] [--section <section-key> \| --exclude-section <section-key[,section-key]>] [--include-descendants true\|false] [--output <path> \| --output-dir <directory>]` | Yes | Creates an export using saved preferences. Remote targets require a request ID; local targets reject it. Immediate delivery can copy the primary member to `--output` or the full set to `--output-dir`. |
| `tarvena documents export-job --project <project-id> <job-id>` | No | Reads a remote export job result. |
| `tarvena documents export-download --project <project-id> <job-id> --output <new-file-path> [--filename <manifest-filename>]` | Local output | Downloads a completed remote export member. |

Save export preferences with `export-config update` before requesting an export. The export command does not accept one-off preference JSON. Send the complete `preferences` object returned by `export-config get`, with your changes applied. All eight keys are required: `format`, `headerText`, `includeNumbering`, `includePageNumbers`, `includeToc`, `numberingStartSectionKey`, `operatExportSection0Separately`, and `includeMapLink`. Set `operatExportSection0Separately` to `true` to omit section `S_0` from the main artifact and produce an additional section-0 artifact. To export one section directly, use `--section <section-key>`. For the operat non-technical summary, use `--section S_0 --include-descendants true`.

Operat configuration: `config describe` returns the catalogues, dependent questions, calculation IDs and result keys, and the defaults or saved configuration; unavailable saved choices stay listed so you remove them deliberately. Never infer IDs from prose or select all results implicitly. The configuration holds `schemaVersion`, `waterServiceIds`, `specialWaterUseIds`, `otherPermitScopeIds`, `qualifiers` and `calculationSelections` (`calculationId` with an ordered `resultKeys` array); attachment lists are written in the document. `config patch` replaces arrays in full. Saving configuration leaves the text unchanged: preview `reconcile`, review it, then apply with the returned revisions and token, confirming removed sections with `--confirm-removal-section` and removed S_6 calculation blocks with `--confirm-removal-block`. Text around blocks is kept; added sections and blocks list their text in `details.markdown`. A stale token needs a new preview, and the `config preview` token never authorises reconciliation. Unsupported development configurations are not converted: create a new Operat and move authored text through the editor or files.

### Body writes and local files

`write-body` takes the full Markdown, the body revision it was read at and a new UUID change ID.
`saved` returns the new `bodyRevision`; `conflict` returns `current.bodyRevision` and
`current.markdown` to merge and save with a new UUID; `rejected` (`invalid_content`, `too_large`)
changes nothing. After an uncertain result send the same command with the same UUID, revision and
Markdown; it returns the first outcome. Keep whole `@calculation:<calculationId>` tokens: a bare
token includes every current and future result, `@calculation:<calculationId>#catchment/ssq,catchment/snq`
exactly those keys; an invalid suffix stays unresolved.

For a local-folder document, `read-body --include-local-path true` returns `localPath`, the canonical
Markdown file: edit it with file tools, then read it again before the next edit. The desktop editor
follows the saved file. A Drive mirror is not that file. A document's own `styles.css` sits beside it;
its title page and style live in the design (`documents design get|update`), whose `style` keeps only
`theme`, `body` and `titlePage` overrides of the organization style.

### Specification tasks

`documents specyfikacja create --tasks-file` takes `[{"title":"Roboty przygotowawcze","items":[{"id":"<template-id>"},{"title":"Pozycja własna"}]}]`.

### Export delivery

`export-admission` returns `local_set` or `remote_set`. `local_set`: export with the saved preferences;
`--output` copies the primary file, `--output-dir` the whole set, and `--section S_0 --include-descendants true`
exports only the operat non-technical summary; pass no request ID. `remote_set`: export with a new
`--request-id`, read `export-job` until it settles, then `export-download` a manifest filename into a
new file.

## DOCX forms

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena docx-forms templates list --project <project-id> [--form-kind <kind>] [--include-all-versions true\|false]` | No | Lists DOCX form templates. |
| `tarvena docx-forms list --project <project-id>` | No | Lists DOCX form instances for a project. |
| `tarvena docx-forms plan --project <project-id> (--json <json> \| --file <path>)` | No | Returns fields, computed defaults, warnings, and EGiB draft IDs for an agent workflow configuration. |
| `tarvena docx-forms generate --project <project-id> (--json <json> \| --file <path>)` | Yes | Creates and exports an Operat Wniosek or EGiB batch from one JSON configuration. Returns `ok`, forms, warnings, and explicit file paths. |
| `tarvena docx-forms create --project <project-id> --template <template-key> --title <title> [--request-id <id>] [--config-json <json> \| --config-file <path>] [--fields-json <json> \| --fields-file <path>]` | Yes | Creates one DOCX form. Reuse `--request-id` to retry the same create safely. Config and field input must be JSON objects. |
| `tarvena docx-forms create-batch --project <project-id> --template <template-key> --source-fingerprint <fingerprint-from-plan> [--request-id <id>] [--title-pattern <pattern>] [--config-json <json> \| --config-file <path>] [--fields-json <json> \| --fields-file <path>]` | Yes | Creates a batch with shared field values. Reuse `--request-id` to retry the same batch safely. |
| `tarvena docx-forms get --project <project-id> <form-id> [--include values]` | No | Reads a form. Use `--include values` for computed and explicit field values. |
| `tarvena docx-forms update-fields --project <project-id> <form-id> (--fields-json <json> \| --fields-file <path>)` | Yes | Replaces/upserts field values from a JSON object. |
| `tarvena docx-forms refresh-computed --project <project-id> <form-id>` | Yes | Refreshes computed values. |
| `tarvena docx-forms preview-values --project <project-id> <form-id>` | No | Calculates preview values without exporting. |
| `tarvena docx-forms export --project <project-id> <form-id> --format docx\|pdf [--output <path>]` | Yes | Creates a DOCX or PDF export artifact and optionally saves it to a local path. |

### Agent workflow JSON

Use `plan` before `generate` to inspect computed values and EGiB draft IDs. Resolved EGiB drafts use the raw `kodTeryt`; an empty project uses `manual`; unmatched-only parcels produce no drafts. `generate` requires a stable `requestId` for an exact create attempt. Reuse it only while the JSON and project source state remain unchanged. If either changes, run `plan` again and use a new ID. After an uncertain response, list existing forms before starting a changed attempt.

Operat Wniosek:

```json
{
  "kind": "operat-wniosek",
  "requestId": "agent-run-2026-08-22-001",
  "title": "Wniosek o wydanie pozwolenia wodnoprawnego",
  "linkedOperatDocumentId": "document-id",
  "values": {
    "representative.enabled": true,
    "representative.firstName": "Anna",
    "representative.lastName": "Nowak"
  },
  "export": {
    "format": "docx",
    "outputDirectory": "C:/Exports"
  }
}
```

If the project has one Operat document, omit `linkedOperatDocumentId`. The command links it automatically. If several exist, the error lists valid IDs.

EGiB:

```json
{
  "kind": "egib",
  "requestId": "agent-run-2026-08-22-002",
  "sourceFingerprint": "source-fingerprint-from-plan",
  "titlePattern": "Wniosek EGiB {{institutionName}}",
  "sharedValues": {
    "representative.name": "Anna Nowak"
  },
  "drafts": [
    {
      "draftId": "draft-id-from-plan",
      "fieldValues": {
        "legalBasis.justification": "Projektowanie urządzenia wodnego"
      }
    }
  ],
  "export": {
    "format": "docx",
    "outputDirectory": "C:/Exports",
    "draftIds": ["draft-id-from-plan"]
  }
}
```

Copy `sourceFingerprint` from the matching `plan` result. Omit `drafts` to use all computed EGiB defaults. If `drafts` is present, include every draft returned by `plan`. Omit `export.draftIds` to export all created forms. Do not copy the previewed `request.documentId` into `fieldValues`; Runtime allocates it during creation. Supply it only when the user explicitly requests a custom identifier. With `outputDirectory`, each file has `pathKind: "local"` and an absolute `path`. Without it, each file has `pathKind: "project-folder"` and `path` equal to the relative `projectFolderPath`.

## Calculations

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena calculations types` | No | Lists available calculation types. |
| `tarvena calculations list --project <project-id>` | No | Lists project calculations. |
| `tarvena calculations get --project <project-id> --calculation <calculation-id>` | No | Reads one calculation. |
| `tarvena calculations create --project <project-id> --type catchment --title <title> --state-json <json> [--dependencies-json <json>] [--basis-json <json>]` | Yes | Creates a calculation with its state and dependencies. |
| `tarvena calculations update --project <project-id> --calculation <calculation-id> --revision <revision> [--state-json <json>] [--dependencies-json <json>] [--basis-json <json>]` | Yes | Updates a calculation at its observed revision. |
| `tarvena calculations rename --project <project-id> --calculation <calculation-id> --title <title>` | Yes | Renames a calculation. |
| `tarvena calculations delete --project <project-id> --calculation <calculation-id>` | Yes | Deletes a calculation. |
| `tarvena calculations dependencies --project <project-id> --calculation <calculation-id>` | No | Reads calculation dependencies. |
| `tarvena calculations catchment update-geometry --project <project-id> --calculation <calculation-id> --revision <revision> --geojson <path> --projection EPSG:2180\|EPSG:3857\|EPSG:4326` | Yes | Updates catchment geometry at its observed revision. |
| `tarvena calculations catchment import --project <project-id> --calculation <calculation-id> --revision <revision> --geojson <path> --projection EPSG:2180\|EPSG:3857\|EPSG:4326 --coverage-json <json>` | Yes | Imports catchment geometry with coverage at its observed revision. |

## Cost estimation

Cost commands return an envelope with `ok`, `summary`, `warnings`, and sometimes `errors`. They do not call Runtime.

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena cost library build --input <directory> --output <library.json> [--include-candidates true\|false]` | Yes | Builds a cost library JSON file from source directory data. |
| `tarvena cost source extract --input <file> [--output <json>] [--format ath\|kst]` | Maybe | Extracts ATH/KST source data. With `--output`, writes JSON; without it, returns extraction summary in stdout JSON. |
| `tarvena cost estimate export-ath --input <estimate.json> --output <estimate.ath> [--strict-totals true\|false] [--include-notes true\|false]` | Yes | Converts an estimate JSON file to draft ATH text. Invalid estimate JSON exits with validation-style failure. |

## Linked Norma catalogue

These commands use the authenticated installed runtime through `--local`. Open Tarvena first.
The public API has no catalogue actions because Norma data stays on this machine.

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena --local cost-catalogue link --data-folder <path> [--program-folder <path>]` | Yes | Persists the selected folders and opens their reference databases read-only. |
| `tarvena --local cost-catalogue status` | No | Returns `unlinked`, `linked`, `incomplete`, or `unsupported`. |
| `tarvena --local cost-catalogue browse [--node <node-id>]` | No | Lists catalogue roots or a node’s path, direct children and positions in source order. |
| `tarvena --local cost-catalogue search --query <text> [--limit <1-100>]` | No | Searches basis and description. Every word must match. The default limit is 30. |
| `tarvena --local cost-catalogue position --id <position-id>` | No | Returns a frozen RMS snapshot. Price matching is a separate batch read. |
| `tarvena --local cost-catalogue price-lists` | No | Lists raw price-list, scope, currency, date range, and overhead treatment. |
| `tarvena --local cost-catalogue prices --resources <json-file> --price-list <id> --scope <id> --currency PLN --work-kind <name>` | No | Matches up to 5,000 distinct frozen resource identities. The file is a JSON array with `priceKey`, `type`, `index`, `classification`, `unitCode`, and `name`. Conflicts have no recommendation. |
| `tarvena --local cost-catalogue work-kinds` | No | Returns published Kz, Kp, Z, and labour rates by kind of works. |

The data folder contains `katalogiS.decoded.db` or `katalogiS.db`, `kartotekiS.db`,
`bazycen_najnowsze.db`, and `bazycenS.db`. The decoded filename takes precedence.
TEXT norms retain their decimal text, including empty strings. Only BLOB norms require a supported
`XeNWin64ES.dll` in the data folder, its parent, or the selected program folder.

## AutoCAD

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena autocad extract-context --drawing <path> [--extractor <plugin-dll-path>] [--compact true\|false]` | No | Extracts drawing context through Runtime. Only `--drawing`, `--extractor`, and `--compact` are accepted; positional args are rejected. `--compact` defaults to `true`. |

## Map

### Map catalog, layers, presets, and tree

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena map catalog list --project <project-id>` | No | Reads selected catalog library and summarized dataset metadata for the project. |
| `tarvena map catalog search --project <project-id> [--query <text>] [--protocol WMS\|WMTS] [--page <n>] [--page-size <n>]` | No | Searches catalog datasets. Page and page-size default to `1` and `25`. |
| `tarvena map catalog get --project <project-id> --dataset <dataset-id>` | No | Reads one catalog dataset. |
| `tarvena map catalog get --project <project-id> --entry <entry-id>` | No | Reads one project-library catalog entry with dataset and group context. |
| `tarvena map catalog apply --project <project-id> (--source-refs-json <json> \| --source-refs-file <path>)` | Yes | Replaces selected catalog composition from typed source refs. Cannot be combined with `--entries`, `--user-source-entries`, `--query-service`, or `--render-service`. |
| `tarvena map catalog apply --project <project-id> (--entries <entry-id[,entry-id]> \| --user-source-entries <id[,id]>) [--query-service <id>] [--render-service <id>]` | Yes | Replaces selected catalog composition from shorthand refs. Service selectors apply only to shorthand catalog entries. |
| `tarvena map catalog set --project <project-id> (--source-refs-json <json> \| --source-refs-file <path>)` | Yes | Alias for catalog apply with typed source refs. Cannot be combined with shorthand flags. |
| `tarvena map catalog set --project <project-id> (--entries <entry-id[,entry-id]> \| --user-source-entries <id[,id]>) [--query-service <id>] [--render-service <id>]` | Yes | Alias for catalog apply with shorthand refs. |
| `tarvena map catalog add --project <project-id> (--source-refs-json <json> \| --source-refs-file <path>)` | Yes | Adds typed source refs to selected composition. Cannot be combined with shorthand flags. |
| `tarvena map catalog add --project <project-id> (--entries <entry-id[,entry-id]> \| --user-source-entries <id[,id]>) [--query-service <id>] [--render-service <id>]` | Yes | Adds shorthand refs to selected composition. |
| `tarvena map catalog remove --project <project-id> (--source-refs-json <json> \| --source-refs-file <path>)` | Yes | Removes typed source refs from selected composition. Cannot be combined with shorthand flags. |
| `tarvena map catalog remove --project <project-id> (--entries <entry-id[,entry-id]> \| --user-source-entries <id[,id]>) [--query-service <id>] [--render-service <id>]` | Yes | Removes shorthand refs from selected composition. Optional service selectors narrow catalog-entry removal matches. |
| `tarvena map catalog render-plan --project <project-id> --extent <minX,minY,maxX,maxY> --size <width,height> --projection EPSG:2180\|EPSG:3857\|EPSG:4326 --zoom <zoom>` | No | Returns summarized render-plan items for a map view. |
| `tarvena map view get --project <project-id>` | No | Reads the shared project map view used when no personal viewport exists. |
| `tarvena map view set --project <project-id> --center <x,y> --zoom <zoom> --expected-revision <n> --write-json <json> [--projection EPSG:2180\|EPSG:3857\|EPSG:4326]` | Yes | Replaces the shared project map view at the caller revision. Retain the write envelope for an identical retry. `--write-file` reads an envelope file. Projection defaults to EPSG:2180. |
| `tarvena map personal-viewport get --project <project-id>` | No | Reads the current user's saved viewport and revision for a project. |
| `tarvena map personal-viewport set --project <project-id> --center <x,y> --zoom <zoom> --expected-revision <revision>` | Yes | Persists the current user's viewport with optimistic revision checking. |
| `tarvena map tree --project <project-id>` | No | Lists map tree nodes. |
| `tarvena map show --project <project-id> <tree-key>...` | Yes | Sets tree keys visible. Values from `--enable`-style CSV are not used here; pass keys as positionals. |
| `tarvena map hide --project <project-id> <tree-key>...` | Yes | Sets tree keys hidden. |
| `tarvena map layers --project <project-id>` | No | Lists project map layers; equivalent to `map layers list`. |
| `tarvena map layers list --project <project-id>` | No | Lists project map layers. |
| `tarvena map layers remove --project <project-id> --layer <project-layer-id>` | Yes | Deletes a project map layer. |
| `tarvena map presets list --project <project-id>` | No | Lists map presets. |
| `tarvena map presets apply --project <project-id> --preset <preset-id>` | Yes | Applies a map preset to a project. |

### Location search and presentation

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena location search address --project <project-id> --query <text> [--limit <count>] [--offset <count>] [--present]` | Maybe | Searches addresses. With `--present`, sends normalized results to the project map UI. |
| `tarvena location search parcel --project <project-id> <query> [--limit <count>] [--present]` | Maybe | Searches parcels by query text. With `--present`, sends normalized results to the project map UI. |
| `tarvena location search coordinates --project <project-id> --x <x> --y <y> --projection EPSG:2180\|EPSG:3857\|EPSG:4326 [--present]` | Maybe | Searches parcels by coordinate. With `--present`, sends normalized results to the project map UI. |
| `tarvena location search accept --project <project-id> --request <request-id> --result <result-id>` | Yes | Accepts a previously presented search result and requests focus when the accepted result has a map target. |

### Map identify, point info, geometry, import, render, and export

Layer ids are encoded occurrence identities returned by the runtime, for example
`["project-1","layer-a"]`. Quote the complete value in the shell. For render
commands, `--layers` accepts comma-separated identities, for example
`--layers '["project-1","layer-a"],["project-1","layer-b"]'`; commas inside each tuple are preserved.

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena map identify --project <project-id> (--point <ui-x-y> \| --map-point <map-x,map-y>) [--projection EPSG:2180\|EPSG:3857\|EPSG:4326] [--enable <tree-key>...] [--present] [--include-provider-request true\|false] [--request-id <id>]` | Maybe | Identifies visible inspect targets at a coordinate. `--point` accepts UI x/y and internally flips to map coordinate order; `--map-point` uses map coordinates directly. `--enable` can include comma-separated keys and extra positionals. |
| `tarvena map point-info --project <project-id> --x <x> --y <y> --projection EPSG:2180` | No | Reads point information for a map coordinate in the point-information projection. |
| `tarvena map import-file --project <project-id> --path <path> [--layer <project-layer-id>] [--name-prefix <name>]` | Yes | Stages a local file as a map import artifact and starts import. |
| `tarvena map geometry upsert-feature --project <project-id> --layer <project-layer-id> (--geometry-json <json> \| --geometry-file <path> \| --wkt <wkt>) --projection EPSG:2180\|EPSG:3857\|EPSG:4326 --feature <feature-id> (--precondition-json <json> \| --precondition-file <path>) (--write-json <json> \| --write-file <path>) [--properties-json <json> \| --properties-file <path>] [--visible true\|false] [--focus] [--highlight true\|false] [--zoom true\|false]` | Yes | Creates or updates a vector feature. Properties must be a JSON object; `featureKind` defaults to generic. |
| `tarvena map geometry delete-feature --project <project-id> --feature <feature-id> (--precondition-json <json> \| --precondition-file <path>) (--write-json <json> \| --write-file <path>) [--focus] [--highlight true\|false] [--zoom true\|false]` | Yes | Deletes a vector feature. |
| `tarvena map geometry transform (--geometry-json <json> \| --geometry-file <path> \| --wkt <wkt>) --projection <from> --from-projection EPSG:2180\|EPSG:3857\|EPSG:4326 --to-projection EPSG:2180\|EPSG:3857\|EPSG:4326` | No | Transforms geometry between projections. The shared geometry reader still requires `--projection` even though `--from-projection` is also required. |
| `tarvena map geometry bounds (--geometry-json <json> \| --geometry-file <path> \| --wkt <wkt>) --projection EPSG:2180\|EPSG:3857\|EPSG:4326` | No | Computes geometry bounds. |
| `tarvena map geometry intersects (--a-geometry-json <json> \| --a-geometry-file <path> \| --a-wkt <wkt>) --a-projection EPSG:2180\|EPSG:3857\|EPSG:4326 (--b-geometry-json <json> \| --b-geometry-file <path> \| --b-wkt <wkt>) --b-projection EPSG:2180\|EPSG:3857\|EPSG:4326` | No | Tests intersection between two geometries. |
| `tarvena map geometry buffer (--geometry-json <json> \| --geometry-file <path> \| --wkt <wkt>) --projection EPSG:2180\|EPSG:3857\|EPSG:4326 --distance <number> --unit map-units\|meters` | No | Buffers geometry. |
| `tarvena map render image --project <project-id> --extent <minX,minY,maxX,maxY> --size <width,height> --projection EPSG:2180\|EPSG:3857\|EPSG:4326 --zoom <zoom> [--mode composition\|layer\|layers] [--layer <project-layer-id>] [--layers <id,id>] [--out <path>]` | Yes | Renders a map image artifact and includes a redacted render-plan summary. With `--out`, saves the artifact locally. |
| `tarvena map qgis-export --project <project-id> --output <path>` | Yes | Starts QGIS export, polls status up to 10 times, and saves the artifact locally. |
| `tarvena map wody-status --project <project-id>` | No | Reads Wody Polskie source status. |

## Evidence

`--profile hydro` is normalized to `hydro.evidence-parity`. Target selection uses either `--fixture <fixture-id>` or the domain triple `--domain <domain> --entity-type <type> --entity-id <id>`.

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena evidence refresh --project <project-id> --profile <profile-id> (--fixture <fixture-id> \| --domain <domain> --entity-type <type> --entity-id <id>) [--wait]` | Yes | Queues evidence refresh. With `--wait`, polls up to 120 seconds for a terminal report summary. |
| `tarvena evidence retry --project <project-id> --profile <profile-id> (--fixture <fixture-id> \| --domain <domain> --entity-type <type> --entity-id <id>) [--wait]` | Yes | Retries failed/stale evidence for a target. |
| `tarvena evidence report --project <project-id> --profile <profile-id> (--fixture <fixture-id> \| --domain <domain> --entity-type <type> --entity-id <id>)` | No | Reads evidence report for a target. |

The Operat reads water-device evidence first (`--profile hydro.water-device-evidence --domain objects --entity-type water-device --entity-id <device-id>`) and falls back to parcel evidence, which it marks for review. Parcel evidence (`--profile hydro.parcel-inspection --domain location --entity-type parcel --entity-id <external-id>`) needs an inspection point inside the parcel: check `location parcel-inspection get`, add one with `add-point` or `add-point-by-map-point`, then run `evidence refresh --wait` and `evidence report`. A successful `no-data` result is a finding; missing, stale, partial or failed evidence is not, so retry it rather than writing a conclusion.

## Objects

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena water-devices tree --project <project-id>` | No | Reads object tree. |
| `tarvena water-devices groups create --project <project-id> --label <label>` | Yes | Creates an object group. |
| `tarvena water-devices groups rename --project <project-id> --group <group-id> --label <label>` | Yes | Updates group label. |
| `tarvena water-devices groups reorder --project <project-id> --group-ids <id,id>` | Yes | Reorders groups exactly as supplied. |
| `tarvena water-devices groups move-device --project <project-id> --device <device-id> --target-group <group-id> --index <n>` | Yes | Moves a device into a group at a nonnegative index. |
| `tarvena water-devices groups delete --project <project-id> --group <group-id>` | Yes | Deletes an object group. |
| `tarvena water-devices descriptions read --project <project-id> --group <group-id> --type operat\|technical` | No | Reads the Markdown body for one group and description type. |
| `tarvena water-devices descriptions write-group --project <project-id> --type operat\|technical --group <group-id> (--markdown <text> \| --markdown-file <path>)` | Yes | Replaces the Markdown body for one group and description type. |
| `tarvena water-devices points import --project <project-id> (--points-json <json> \| --points-file <path>)` | Yes | Imports characteristic points from JSON. |
| `tarvena water-devices points create --project <project-id> --name <name> --x <x> --y <y> --projection EPSG:2176\|EPSG:2177\|EPSG:2178\|EPSG:2179\|EPSG:2180` | Yes | Creates a characteristic point. |
| `tarvena water-devices points update --project <project-id> --point <point-id> [--name <name>] [--x <x>] [--y <y>] [--projection EPSG:2176\|EPSG:2177\|EPSG:2178\|EPSG:2179\|EPSG:2180]` | Yes | Updates a characteristic point. `--x null` and `--y null` are accepted as nullable coordinate values. |
| `tarvena water-devices points list --project <project-id>` | No | Lists characteristic points. |
| `tarvena water-devices points list-with-refs --project <project-id>` | No | Lists characteristic points with object/device references. |
| `tarvena water-devices points delete --project <project-id> --point <point-id>` | Yes | Deletes a characteristic point. |
| `tarvena water-devices devices create --project <project-id> --name <name> --type <device-type> --scope <work-scope> [--point-ids <id,id>] [--parcel-ids <id,id>] [--point-style-json <json> \| --point-style-file <path>]` | Yes | Creates a water device. Point style input is JSON. |
| `tarvena water-devices devices update --project <project-id> --device <device-id> [--name <name>] [--type <device-type>] [--scope <work-scope>] [--point-ids <id,id>] [--parcel-ids <id,id>] [--point-style-json <json> \| --point-style-file <path>]` | Yes | Updates a water device. Present CSV flags replace the complete list. |
| `tarvena water-devices devices get --project <project-id> --device <device-id>` | No | Reads water device details. |
| `tarvena water-devices devices evidence-preview --project <project-id> --device <device-id> [--policy-json <json> \| --policy-file <path>]` | No | Previews evidence sampling for a device. |
| `tarvena water-devices devices evidence-policy set --project <project-id> --device <device-id> (--policy-json <json> \| --policy-file <path>)` | Yes | Sets device evidence policy. |
| `tarvena water-devices devices evidence-policy reset --project <project-id> --device <device-id>` | Yes | Resets device evidence policy. |
| `tarvena water-devices devices delete --project <project-id> --device <device-id>` | Yes | Deletes a water device. |

Device detail reads include `drawingIds`, `nameLabelId`, and `bounds2180` covering drawings and
characteristic points. The dedicated CLI create command creates a device without drawings.
For atomic device creation with drawings, use the HTTP or MCP action
`water-design/commands#create_device` with `drawings` and an explicit projection.

## Location

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena location parcels list --project <project-id>` | No | Lists project parcels. |
| `tarvena location parcels add --project <project-id> --external-ids <id,id>` | Yes | Adds parcels by external IDs. |
| `tarvena location parcels get --project <project-id> --parcel <parcel-id>` | No | Reads one parcel. |
| `tarvena location parcels remove --project <project-id> [--parcel-ids <id,id> \| --external-ids <id,id>]` | Yes | Removes parcels by internal ids and/or external ids. The implementation allows both flags, although the usage banner presents them as alternatives. |
| `tarvena location parcels update --project <project-id> --parcel <parcel-id> [--display-no <display-no>] [--name <name>] [--notes <text>]` | Yes | Updates parcel display fields. |
| `tarvena location parcel-inspection get --project <project-id> --external-id <external-id>` | No | Reads parcel-inspection state for an external parcel id. |
| `tarvena location parcel-inspection add-point --project <project-id> --external-id <external-id> --coordinate <x,y> --projection EPSG:2180\|EPSG:3857\|EPSG:4326 --source click\|manual\|point-on-surface\|region\|cli [--label <text>]` | Yes | Adds an inspection point to a specific parcel. |
| `tarvena location parcel-inspection add-point-by-map-point --project <project-id> --coordinate <x,y> --projection EPSG:2180\|EPSG:3857\|EPSG:4326 [--label <text>]` | Yes | Resolves parcel from the map point and adds an inspection point. |
| `tarvena location parcel-inspection set-points --project <project-id> --external-id <external-id> --points-json <json>` | Yes | Replaces inspection points for a parcel. `--points-json` must be a JSON array matching Runtime schema. |
| `tarvena location parcel-inspection remove-point --project <project-id> --external-id <external-id> --point-id <point-id>` | Yes | Removes one inspection point. |
| `tarvena location parcel-inspection clear-points --project <project-id> --external-id <external-id>` | Yes | Removes all inspection points for a parcel. |

## Water services

Friendly target flags (`--group-ids`, `--device-ids`) cannot be combined with target JSON input (`--targets-json`, `--targets-file`). Present target flags replace the service target list on update.

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena water-services types list [--category water-service\|special-water-use]` | No | Lists service types, optionally filtered by category. |
| `tarvena water-services list --project <project-id> [--category water-service\|special-water-use]` | No | Lists project water services. |
| `tarvena water-services create --project <project-id> --category water-service\|special-water-use --type <service-type> [--group-ids <id,id>] [--device-ids <id,id>] [--targets-json <json> \| --targets-file <path>] [--parameters-json <json> \| --parameters-file <path>]` | Yes | Creates a water service. |
| `tarvena water-services update --project <project-id> --service <service-id> [--category water-service\|special-water-use] [--type <service-type>] [--group-ids <id,id>] [--device-ids <id,id>] [--targets-json <json> \| --targets-file <path>] [--parameters-json <json> \| --parameters-file <path>]` | Yes | Patches a water service. |
| `tarvena water-services get --project <project-id> --service <service-id>` | No | Reads one water service. |
| `tarvena water-services delete --project <project-id> --service <service-id>` | Yes | Deletes a water service. |
| `tarvena water-services targets resolve --project <project-id> (--targets-json <json> \| --targets-file <path>)` | No | Resolves Runtime target references into service target details. |

## Conditional metadata attempts

Read `documents get` first and retain `configRevision`, `title`, and `exportBasename`. Supply `metadata_fields` with `observedConfigRevision` and expected values for exactly the updated fields. Supply a stable `{sessionId,lane:"project-presentation",sequence}` in `--write-json` or `--write-file`. At least one update is required. The CLI forwards this saved intent without reading a newer revision before writing.

After an uncertain answer, repeat the identical command and JSON inputs. Keep one unresolved attempt in the project presentation lane. A definitive conflict requires rereading and reconsidering before a new sequence. A settled receipt returns the original result or rejection. A definitive conflict requires a new observation and sequence. There is no CLI write-status command. When a retry cannot settle the attempt, stop and report the uncertain outcome instead of issuing another write.

## Conditional drawing writes

`map geometry upsert-feature` requires `--feature`, `--write-json` or `--write-file`, and `--precondition-json` or `--precondition-file`. `delete-feature` requires the same write and condition flags. Supply `{kind:"map-scope",features,memberships,appearances}` from the observed drawings. A new feature needs its stable ID and `expected:{kind:"absent"}` with empty memberships and appearances. For edits, retain the observed authored fields and complete child order. Distinguish an absent property from an explicit null. Sort feature conditions by ID, memberships by parent ID, and appearances by `[domainId,entityType,entityId]`. Reread if a bounded conflict omits part of the scope. Creation uses a stable caller ID with an absence condition. Keep the exact payload and attempt for retry. The CLI does not reread or allocate a replacement attempt automatically.

Specification mutations require an immutable presentation-lane write object from `--write-json` or `--write-file`. Keep the complete command for retries. `items list` returns the observed `bodyRevision`; use it as `--expected-revision` for add, remove, reorder, and renumber, including no-ops. Creation requires your saved `--document-id` and sends `precondition:{kind:"document_absent"}`. If the result is uncertain, retry the identical saved command. There is no CLI write-status command. A changed intent requires a new attempt.

## Standalone spatial commands

These commands use geographic longitude, latitude coordinates.

| Command | Mutates | Purpose |
|---|---:|---|
| `tarvena streams query (--bbox west,south,east,north \| --site parcel.geojson --buffer-m 30 \| --point longitude,latitude --radius-m 200) [--dataset ID] --out streams.geojson` | No | Queries stream geometry and saves the response. |
| `tarvena streams bounds (--site parcel.geojson [--buffer-m 30] \| --point longitude,latitude --radius-m 200) [--out bounds.json]` | No | Computes conservative search bounds locally. |
| `tarvena streams screen --input streams.geojson (--site parcel.geojson [--buffer-m 30] \| --point longitude,latitude --radius-m 200) [--bbox west,south,east,north \| --query-meta streams.geojson.query.json] --out screening.json` | No | Screens saved streams locally. |
| `tarvena catchments analyze --point longitude,latitude [--dataset ID] [--snap-radius-m 100] --out catchment.json` | No | Analyzes a selected catchment and saves the response. |
| `tarvena catchments compare --a analysis-a.json --b analysis-b.json --out comparison.json` | No | Compares two saved catchment analyses. |
| `tarvena parcels lookup (--id FULL_PARCEL_ID \| --point longitude,latitude) --out parcel.json` | No | Looks up a parcel and saves the response. |
| `tarvena coordinates from-2180 --easting-m NUMBER --northing-m NUMBER [--out point.json]` | No | Converts labelled EPSG:2180 axes to a geographic point locally. |

Use the installed `tarvena` executable and your Tarvena account. These commands use the public web origin and save received response bytes without reformatting. They do not require a desktop project. The executable bundles the projection and geometry code. You do not need Python, PROJ, or a separate JavaScript package installation.

Use `--server https://your-web-origin.example` for another deployment. Successful device login remembers the origin. If a read has no valid session, the CLI opens the existing device login and waits for account approval. Use `--no-browser` to print the approval URL without opening a browser. The CLI attempts login at most once for the command. HTTP 403 reports a permission failure. Ctrl+C cancels polling and the read.

The local `streams bounds`, `streams screen`, and `coordinates from-2180` commands do not read credentials or contact the server. The API commands require the public web connection. Do not pass `--local` to them.

### Look up a parcel and query its surroundings

Choose a new output filename for each run. The CLI preserves existing files and reports an error if an output already exists.

```sh
tarvena parcels lookup --id 141201_1.0001.6509 --out parcel.json
tarvena streams query --site parcel.json --buffer-m 30 --out streams.geojson
tarvena streams screen --input streams.geojson --site parcel.json --buffer-m 30 --out screening.json
```

The parcel identifier illustrates the full cadastral format. Replace it with the parcel you need. Lookup also accepts a geographic point:

```sh
tarvena parcels lookup --point 18.3002,51.3998 --out parcel-at-point.json
```

Use exactly one selector. A bare parcel number does not identify a cadastral precinct. A `not_found` result is saved and summarized. A provider or transport failure produces an error response, rather than `not_found`.

`--site` accepts a WGS84 Polygon, MultiPolygon, GeoJSON Feature, one-feature FeatureCollection, or a saved matched parcel lookup response. Polygon holes are supported. Every position is `[longitude, latitude]` in decimal degrees. Projected polygons must be normalized to WGS84 before using these commands. The CLI does not guess a polygon's CRS or axis order.

The query saves the untouched response fields in `streams.geojson`. It also saves `streams.geojson.query.json` with the actual bbox, returned dataset identity, server origin, and retrieval time. Both output paths must be unused. The CLI reserves both before writing and removes its new files if reservation or writing fails. Keep these two files together. Screening reads that sidecar automatically. Its dataset identity must match the stream response.

Console summaries report status, dataset identity, warnings, counts, and saved file locations. Full geometries, events, provenance, and estimates stay in the files.

### Query a point or explicit bbox

```sh
tarvena streams query --point 18.3002,51.3998 --radius-m 200 --out nearby.geojson
tarvena streams screen --input nearby.geojson --point 18.3002,51.3998 --radius-m 200 --out nearby-screening.json
tarvena streams query --bbox 18.30,51.39,18.31,51.40 --out rectangle.geojson
```

`--dataset ID` optionally pins stream discovery. Omit it to use the installed national release in discovery and analysis. An explicit release mismatch fails.

To obtain the query bbox without making an HTTP request:

```sh
tarvena streams bounds --site parcel.json --buffer-m 30 --out bounds.json
tarvena streams bounds --point 18.3002,51.3998 --radius-m 200
```

`--out` is optional for `streams bounds`. The console always includes its bbox. Query accepts either `--bbox` or the area flags, without mixing them.

For streams saved by another HTTP client, supply the original query bbox explicitly or point to a matching query sidecar:

```sh
tarvena streams screen --input external.geojson --site parcel.json --buffer-m 30 --bbox 18.30,51.39,18.31,51.40 --out external-screening.json
tarvena streams screen --input external.geojson --site parcel.json --buffer-m 30 --query-meta saved-query.json --out external-screening-with-metadata.json
```

The supplied bbox must contain the complete conservative bbox returned by `streams bounds` for the same area. Screening fails before processing segments if coverage is insufficient. Query again with the generated bounds. Changing a buffer or radius can invalidate the previous query coverage.

Explicit bboxes follow the public stream contract. They require west < east, south < north, longitude within -180..180, and latitude within -85.0511287798066..85.0511287798066. Antimeridian crossing is unsupported. HTTP query budgets still apply. A large conservative bbox can exceed the archive tile limit. Split the area and preserve each response with its own segment indexes.

### Select a boundary event and analyze its catchment

Read `screening.json` and select an event coordinate for analysis. A point event has `point`. A `boundary_overlap` has `from` and `to`. Choose the coordinate that matches the engineering question.

```sh
tarvena catchments analyze --point 18.3002,51.3998 --snap-radius-m 25 --out catchment.json
```

The example coordinate and radius are caller choices. They are not a recommended engineering tolerance. The snap radius defaults to 100 metres and accepts 0..1000. The summary includes selected outlet, displacement, `areaM2`, warnings, and unavailable-flow reasons. A `no_match` response is saved and summarized with its reason. Preserve the actual selected cell and displacement when interpreting a matched result.

Public estimates use `probabilisticPeakFlow`, `meanAnnualFlow`, `meanLowFlow`, `rainfallPeakRunoff`, and `annualRunoffVolume`. Keep the saved warnings, method identity, parameters, and unavailable reasons. Peak runoff is not a continuous supply rate. Annual runoff volume is not dependable pond yield.

### Compare two saved catchments

```sh
tarvena catchments compare --a catchment-a.json --b catchment-b.json --out comparison.json
```

Both files must be matched analysis responses with the same dataset and generation. The CLI extracts exactly `datasetId`, `generation`, `outlet.cell.row`, and `outlet.cell.column`. It never resnaps an outlet coordinate and does not send `contributingCells` as identity.

The response preserves native intersection and union cell counts and areas. Its relation is `same`, `a_contains_b`, `b_contains_a`, or `disjoint`. The basis is `native_cell_membership`. `drainageConnectivity: "not_evaluated"` remains visible. Shared catchment area does not prove physical routing or permit adding empirical flow estimates. Unsupported native grids fail explicitly.

### Enter an EPSG:2180 point with named axes

```sh
tarvena coordinates from-2180 --easting-m 450000 --northing-m 455000 --out point.json
tarvena catchments analyze --easting-m 450000 --northing-m 455000 --snap-radius-m 25 --out projected-input-catchment.json
```

`--out` is optional for conversion. The output point is WGS84 `[longitude, latitude]`. Each point-taking command also accepts both `--easting-m` and `--northing-m` instead of `--point`. Supply both named axes, in grid metres. Other CRSs and `x,y` guessing are unsupported. Preserve the original engineering coordinates separately. Numerical precision does not establish survey accuracy.

### Interpret local screening results

The area is a point with `--radius-m` or a polygon with `--buffer-m`. The supported local extent is longitude 13..25 and latitude 48..56. The generated envelope must also remain within that extent. Radius and buffer accept 0..10000 metres. Polygon inputs have at most 3000 positions. Rings must be closed, nondegenerate, and simple. Holes must lie strictly inside their shell and cannot touch or overlap other rings. MultiPolygon interiors must be disjoint. Parts may touch at shared vertices but cannot share edges. Invalid geometry fails explicitly.

`area` retains the original polygon and the separate `bufferM`. Events always refer to the original boundary. A buffer broadens candidate proximity and can include segments near a hole. It does not move polygon events or create inlet events on the buffer.

Each candidate and event uses `segmentIndex`, the zero-based position in the saved stream response's `features` array. These are collection-local references. They are not persistent stream IDs. Events follow the upstream-to-downstream endpoint order within each segment. `polygonIndex` identifies a MultiPolygon part, or 0 for a Polygon. `ringIndex` is 0 for the shell and positive for a hole. `boundary` distinguishes `shell` and `hole`.

Point events are `entry`, `exit`, or `touch`. `fraction` ranges from 0 at the upstream endpoint to 1 at the downstream endpoint. The helper distinguishes multiple entries and exits, including crossings through holes. A vertex graze or an event at a segment endpoint is a `touch`, because the saved segment does not establish a two-sided crossing there. A `boundary_overlap` carries `fromFraction` and `toFraction`. Adjacent collinear overlaps on the same ring are merged. Point events covered by that interval are omitted.

`candidates` includes segments inside or touching the polygon and segments within its buffer, or within a point radius. `nearestPoint` lies on the original WGS84 segment at `fraction`. Candidate `downstream.upstreamAreaM2` belongs only to `downstream.point`. Boundary events never carry contributing area. Analyze an interior crossing independently.

Topology uses straight returned WGS84 segments and straight polygon edges. Metric proximity uses their projected curves in EPSG:2180 grid metres. Projection subdivides edges until quarter, midpoint, and three-quarter deviations are at most 0.01 m, with at most 0.001 degree per coordinate between samples. The result reports 0.02 m distance uncertainty for two approximated edges. Candidates within that margin of a buffer or radius are retained conservatively. These are numerical screening tolerances, not surveyed ground-distance accuracy.

Bounds enclose every projected polygon edge, including holes and all parts, then expand by the radius or buffer plus 0.02 m. The inverse envelope samples all four rectangle edges at intervals of at most 25 m. An angular guard of 0.00003 degrees per grid metre times half the largest sample interval encloses the unsampled perimeter. An additional 0.01 m guard covers numerical error. Focused tests verify dense radius circles, long oblique projected edges, and the inverse angular guard across the supported extent. This intentionally conservative rectangle can include more area than the actual search shape.

The projection budget rejects an edge requiring more than 100000 samples or 24 subdivision levels. Envelope edges cannot require more than 100000 samples each. Split an area when a budget fails. The stream response still retains `discoveryCoverage: "display_archive_unqualified"`. Empty screening results do not prove absent drainage, archive completeness, or physical connectivity.

### Correct an error without losing evidence

Missing flags, invalid tuples, conflicting selectors, invalid geometry, missing input files, mismatched query metadata, and insufficient query coverage fail before authentication or an HTTP request. Error output names the flag, file, or required correction. Unknown flags fail rather than silently changing the requested operation.

HTTP errors save the received response body at `--out` and report the HTTP status and file location. Non-JSON bodies, including empty bodies, are preserved exactly and reported as invalid JSON. If the HTTP transfer fails after headers arrive, the CLI saves only the bytes received and explicitly reports an incomplete response. A normally ended HTTP transfer does not prove that an upstream service supplied its complete intended content. Connection failures before response headers arrive cannot produce a saved response body. Successful HTTP responses must still contain valid JSON matching the command schema. A second HTTP 401 after login ends the command. HTTP 403 needs account permission changes. HTTP 409 needs an explicit release choice. HTTP 422 needs a smaller query. Cancellation or login rejection stops polling without starting another login. No bearer or device token is printed.

Keep successful and error files with the investigation. Output directories must already exist. A successful process exit can still contain an analytical `no_match`, `not_found`, unavailable estimate, or an empty stream collection. Inspect status and warnings before using the result.
