@docld/cli
v1.0.0
Published
CLI for DocLD document processing - parse, extract, edit, and split documents from the command line
Maintainers
Readme
DocLD CLI
Parse, extract, and edit documents from the command line.
Installation
npm install -g docld-cliAuthentication
Before using the CLI, authenticate by running:
docld loginThis opens your browser to DocLD where you can securely authenticate. Alternatively, provide an API key directly:
docld login --key your_api_key_hereCommands
Parse
Convert documents into structured markdown output.
# Parse a single file
docld parse document.pdf
# Parse an entire folder
docld parse ./documents
# Parse with AI enhancement (more accurate but slower)
docld parse document.pdf --agentic
# Include document metadata
docld parse document.pdf --hyperlinks --comments --highlightsOutput: Creates <filename>.parse.md files containing:
- YAML frontmatter with job ID, page count, and studio link
- Structured markdown content
Extract
Extract structured data from documents using JSON schemas.
# Extract with a schema file
docld extract invoice.pdf -s schemas/invoice.json
# Extract from multiple files
docld extract ./invoices -s schemas/invoice.json
# Include source citations
docld extract invoice.pdf -s schema.json --citationsOutput: Creates <filename>.extract.json files containing the extracted data.
Extraction automatically reuses existing .parse.md files when available to speed up processing.
Edit
Modify documents with natural language instructions.
# Fill a form
docld edit form.pdf -i "Fill the client name as 'Acme Corp' and date as 'January 15, 2024'"
# Edit multiple documents
docld edit ./contracts -i "Replace 'OLD COMPANY' with 'NEW COMPANY' throughout"Output: Creates <filename>.edited.<ext> files with the modifications applied.
Options
Global Options
--help- Show help for any command--version- Show CLI version
Parse Options
| Flag | Description |
|------|-------------|
| --agentic | Enable AI enhancement for text, tables, and figures |
| --change-tracking | Enable change tracking for document revisions |
| --hyperlinks | Include hyperlinks in output |
| --comments | Include document comments in output |
| --highlights | Include highlighted text in output |
| -o, --output <dir> | Output directory |
Extract Options
| Flag | Description |
|------|-------------|
| -s, --schema <path> | Path to JSON schema file (required) |
| --citations | Include source citations in output |
| -o, --output <dir> | Output directory |
Edit Options
| Flag | Description |
|------|-------------|
| -i, --instructions <text> | Natural language editing instructions (required) |
| -o, --output <dir> | Output directory |
Schema Format
Extraction schemas must be valid JSON Schema documents with type: "object":
{
"type": "object",
"properties": {
"invoice_number": { "type": "string" },
"total_amount": { "type": "number" },
"line_items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"description": { "type": "string" },
"quantity": { "type": "number" },
"price": { "type": "number" }
}
}
}
},
"required": ["invoice_number", "total_amount"]
}Supported File Types
| Format | Extensions |
|--------|------------|
| PDF | .pdf |
| Images | .png, .jpg, .jpeg |
| Office documents | .doc, .docx, .ppt, .pptx |
| Spreadsheets | .xls, .xlsx |
Environment Variables
| Variable | Description |
|----------|-------------|
| DOCLD_API_KEY | API key (alternative to docld login) |
| DOCLD_API_URL | Custom API URL for self-hosted instances |
Configuration
Configuration is stored in ~/.config/docld/config.json (Linux/macOS) or %APPDATA%/docld/config.json (Windows).
Examples
Invoice Processing Pipeline
# Parse all invoices
docld parse ./invoices --agentic
# Extract data from each
docld extract ./invoices -s schemas/invoice.json
# Results are in .extract.json filesContract Editing
# Update company name across all contracts
docld edit ./contracts -i "Replace 'Old Corp' with 'New Corp' throughout the document"Batch Processing
# Process entire document folder
docld parse ./documents -o ./parsed
docld extract ./documents -s schema.json -o ./extractedLicense
MIT
