@muid-io/smart-doc
v1.0.0
Published
SRK-based document section retrieval tool for extracting text using Smart Resource Keys from smart-toc JSON output
Downloads
99
Maintainers
Readme
@muid-io/smart-doc
SRK-based document section retrieval tool
Overview
smart-doc retrieves text sections from documents using Structural Reference Keys (SRK) generated by smart-toc.
Part of the vibrary document processing pipeline.
Installation
npm install -g @muid-io/smart-docUsage
Retrieve by SRK
# Base SRK (section level)
smart-doc document.md --srk "srk://v1/markdown/section-001/section-003"
# Full SRK (with chunking params)
smart-doc document.md --srk "srk://v1/markdown/flexible:1500:300/section-001/0"Stats Only
smart-doc document.md --srk "srk://v1/markdown/section-001" --stats-onlyBatch Retrieval
# Create file with SRKs (one per line)
echo "srk://v1/markdown/section-001" > srks.txt
echo "srk://v1/markdown/section-002" >> srks.txt
# Retrieve all
smart-doc document.md --srk-list srks.txtWith TOC JSON
# Auto-detect TOC file (looks for .json or .toc.json)
smart-doc document.md --srk "srk://v1/markdown/section-001"
# Explicit TOC file
smart-doc document.md --srk "srk://v1/markdown/section-001" --toc document.toc.jsonSRK Format
Base SRK (from smart-toc)
srk://v1/{format}/{path}Example: srk://v1/markdown/section-001/section-003
Full SRK (from vibrary-chunk)
srk://v1/{format}/{strategy}:{target}:{overlap}/{path}/{chunk_index}Example: srk://v1/markdown/flexible:1500:300/section-001/section-003/0
Output
Default (with text)
{
"srk": "srk://v1/markdown/section-001/section-002",
"section_id": "section-002",
"title": "Quick Stats",
"text": "## Quick Stats\n...",
"stats": {
"char_count": 568,
"word_count": 63,
"estimated_tokens": 81
}
}Stats Only
{
"srk": "srk://v1/markdown/section-001",
"section_id": "section-001",
"title": "Introduction",
"stats": {
"char_count": 1234,
"word_count": 180,
"estimated_tokens": 234
}
}Options
| Option | Description |
|--------|-------------|
| --srk <srk> | SRK to retrieve (base or full) |
| --srk-list <file> | File with SRKs (one per line) |
| --toc <file> | Explicit TOC JSON file |
| --stats-only | Return stats without text |
| --pretty | Pretty-print JSON output |
| --help | Show help |
| --version | Show version |
Requirements
- Node.js >= 14.0.0
- Python >= 3.6.0
Related
- @muid-io/smart-toc - Structure detection and SRK generation
- vibrary - Content registry with hierarchical summarization
License
MIT
