Metadata-Version: 2.4
Name: ndi-cli
Version: 0.7.0
Summary: NDI platform CLI: document operations, jobs, workspaces, and the agent workspace tools
Keywords: ndi,cli,document-intelligence,coding-agents
Author: Nace AI
Author-email: Nace AI <engineering@nace.ai>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Dist: ndi-sdk>=0.22,<1
Requires-Dist: truststore>=0.10.4,<1
Requires-Python: >=3.11
Project-URL: Homepage, https://ndi-api.nace.ai
Description-Content-Type: text/markdown

# ndi-cli

`ndi` — the NDI platform CLI. Document operations, jobs, and workspace
lifecycle wrap the same `/v1` methods as `ndi-sdk`. The six workspace tools
also run inside an agent sandbox; every other verb is refused there.

## Setup

```bash
ndi login                                          # browser device-code; writes ~/.ndi/config.toml
export NDI_BASE_URL="https://ndi-api.nace.ai"      # optional; default shown
export NDI_WORKSPACE_ID="<workspace uuid>"         # or: ndi workspace use <id>
```

`$NDI_API_KEY` still wins over the file. `$NDI_CONFIG_PATH` overrides the
config location. Workspace-scoped verbs also take `--workspace ID`.

## Commands

| Command | Use |
|---|---|
| `ndi login` | Authorize and save the API key |
| `ndi version` | CLI + SDK versions |
| `ndi upload FILE` | Stage bytes; prints `ndi://upload/<id>` |
| `ndi parse SOURCE` | Markdown / text / blocks |
| `ndi extract SOURCE -s SCHEMA` | Structured extract (`--validate` checks a schema with no job) |
| `ndi split SOURCE --class id:label` | Logical sections |
| `ndi classify SOURCE --class id:label` | Labels (refuses `jobid://`) |
| `ndi ground SOURCE --target id=TEXT` | Locate quoted text |
| `ndi job ID` / `ndi jobs` / `ndi cancel ID` | Inspect or cancel jobs |
| `ndi workspace create\|list\|get\|stats\|delete\|use` | Workspace lifecycle |
| `ndi files upload\|list\|get\|delete` | Workspace files (`--ingest` uploads then queues ingestion) |
| `ndi ingest` | Queue ingestion |
| `ndi deep-search QUERY` / `ndi fact-search QUERY` | Agentic / single-shot search |
| `ndi je-testing QUERY` | Journal-entry testing over a ledger package (`--path` to scope it, `--effort` for the level) |
| `ndi folder-metadata` / `file-metadata` / `read-file` / `ask-file` / `run-sql` / `hybrid-search` | Read-only workspace tools (the sandbox surface) |

## Sources

`SOURCE` for document ops:

- local file — uploaded, then the handle is used
- directory — supported files, one job each (`-j N`, default 4)
- `https://...` — fetched by the server
- `ndi://upload/<uuid>` — a prior `ndi upload`
- `jobid://<uuid>` or a bare UUID — reuse a parse job (not classify)
- `ws://<file_id>` — a workspace file (needs a workspace)
- `-` — a `jobid://` / UUID line, or raw bytes with `--file-name`

```bash
ndi parse a.pdf -o id | ndi extract - -s schema.json
```

## Output

Result content goes to **stdout**; status (`job <id> queued`, `saved …`) goes
to **stderr**. `-o auto|md|json|payload|id` picks the shape. `--json` is an
alias for `-o json`. `--save PATH` / `--out-dir DIR` write files. `--async`
submits and prints the job id.

API failures exit 1. Usage / config errors exit 2. Schema-validation
failures also show up to five field constraints, each limited to 500
characters; request input and unrelated error-detail fields are omitted.

See the [CLI guide](https://docs.ndi.nace.ai/guides/cli) for the full command
reference. `SKILL.md` is the agent-facing guide to the six workspace tools.
