Command line
The astra command-line tool has 15 commands. Run it without installing anything using npx -y @attentionform/astra, or install it with npm install -g @attentionform/astra to get the short astra command.
Things that work for every command
--jsonprints machine-readable JSON instead of text. Add it when you are scripting.--helpprints usage for the command.--versionprints the version.- Commands that write a file refuse to overwrite an existing one unless you pass
--force. - Exit codes:
0success,1the operation failed (file missing or invalid, batch rolled back),2you used the command incorrectly. - In a shell pipeline such as
astra validate x.docx --json | jq, useset -o pipefailso a failure is not hidden.
Commands
inspect
Print the document as a compact outline with node IDs.
inspect <docx> [--fidelity compact|standard|full] [--section <id>] [--max-text <n>] [--width <n>] [--wrap] [--visual] [--page <n>] [--format png|jpeg] [--max-ratio <n>] [--max-uncompressed-bytes <n>]astra inspect report.docx --fidelity compactvalidate
Check the file against the Word schema without changing it. Exit code 1 means it is invalid.
validate <docx> [--max-ratio <n>] [--max-uncompressed-bytes <n>] [--style-guide <name|path>]astra validate report.docx --jsonsanitize
Remove author names, comments, revision history and other metadata, and optionally redact personal data.
sanitize <in.docx> <out.docx> [--client-safe] [--redact-pii] [--zero-retention] [--replacement-author <name>] [--accept-all-revisions] [--strip-comments] [--metadata-only]astra sanitize draft.docx clean.docx --client-safebatch
Apply edits from a JSON file, standard input, or a quick --append. All edits apply or none do.
batch <docx> [<ops.json|->] [--target-text <needle> --append <text>] [--append <text>] [--out <docx>] [--force] [--sequential|--no-sequential] [--no-validate] [--schema] [--max-ratio <n>] [--max-uncompressed-bytes <n>] [--dry-run] [--backup[=<path>]] [--matrix <vars.csv>] [--reproducible|--no-reproducible] [--author <name>] [--stream [--on-error abort|continue] [--max-errors <n>]] [--style-guide <name|path>]astra batch report.docx ops.json --out updated.docxnormalize
Repair known structural problems and tidy redundant formatting.
normalize <docx> [--out <docx>] [--dry-run] [--backup[=<path>]]astra normalize old.docx --out clean.docxexport
Export to HTML, Markdown or PDF (PDF needs LibreOffice).
export <docx> [--format html|markdown|md|pdf] [-o <outPath>] [--force]astra export report.docx --format markdown -o report.mdsearch
Find text and print the IDs of the nodes that contain it. Case is ignored.
search <docx> <query> [--limit <n>]astra search report.docx "milestones"create
Create a new document from a template, or from Markdown.
create <out.docx> [--template report|memo|blank] [--force] [--from-md <file.md>] [--allowed-dir <dir>] [--dollar-math] [--style-guide <name|path>]astra create report.docx --template reportimport
Convert a Markdown file into a .docx.
import <file.md> [-o <out.docx>] [--template report|memo|blank] [--force] [--allowed-dir <dir>] [--dollar-math] [--style-guide <name|path>]astra import notes.md -o notes.docxstats
Count words, paragraphs, tables and pages.
stats <docx>astra stats report.docxvisual
Render one page to a PNG or JPEG image (needs LibreOffice).
visual <docx> [--page <n>] --out <render.png> [--format png|jpeg] [--force] [--max-ratio <n>] [--max-uncompressed-bytes <n>] [--allow-macros] [--strip-macros]astra visual report.docx --page 1 --out page1.pnghistory
List the saved revisions of a document, newest first.
history <docx> [--init|--track]astra history report.docxpreview-revert
Show what going back a number of revisions would do, without changing the file.
preview-revert <docx> [--steps <n>]astra preview-revert report.docx --steps 1revert
Go back a number of revisions. The revert is recorded as a new revision.
revert <docx> [--steps <n>]astra revert report.docx --steps 1redo
Re-apply the revision that the last revert replaced.
redo <docx>astra redo report.docxUsage lines are copied from the tool's own help, so they are always current. In usage lines, <angle brackets> are required and [square brackets] are optional. For long-form explanations of each option, see the CLI Guide.