API Documentation
astwire exposes a command-line API through the astwire executable (a compiled Nuitka binary, or the astwire console script when installed from source).
On this page ▾
- Entry point
- Current command surface
- Global options
- Positional arguments
- Feature flags
- Language filtering
- Import resolution
- Change-scoped seeding
- Depth control
- Dependency graph
- Waste analysis (dry run)
- Waste stripping
- Skeleton extraction
- Token budgeting
- Output format
- Output destination
- Exit codes
- Full command reference
Entry point
astwire --helpCurrent command surface
astwire has no subcommands — every feature is a flag on the single root invocation:
astwire [-h] [-i] [--languages] [--lang NAME[,NAME]] [--targets PATH]
[--since REF] [--max-depth N] [--decay-depth N] [--graph]
[--analysis] [--strip-waste] [--skeleton]
[--max-tokens MAX_TOKENS] [-f {markdown,llm,json}]
[-o OUTPUT] [-v] [--uninstall] [targets ...]Global options
astwire --version # print version and exit
astwire --help # print usage and exit
astwire --uninstall # remove the binary + local config, exit--uninstall and -v/--version are handled before any of the heavy analysis modules are imported, and exit immediately.
Positional arguments
astwire [targets ...]One or more files or directories to process. Defaults to . (current directory) when omitted.
Feature flags
Language filtering
astwire --languages # print the capability table and exit
astwire src/ --lang python,go--languages is handled before heavy imports, like --version/--uninstall. --lang filters the discovered set (including anything pulled in by -i) to the given language names or extensions; an unrecognized name is an error.
Import resolution
astwire cli.py -iRecursively discovers and bundles local (internal) imported modules starting from each target — Python, JavaScript/TypeScript/TSX, and Go. See ../architecture/diagrams.md for the resolution algorithm.
Change-scoped seeding
astwire src/ --since mainSeeds from files changed against REF (tracked + untracked, gitignore-aware) instead of walking targets. At most one scope path; REF is never auto-detected — invalid refs or a non-git scope exit 2.
Depth control
astwire src/ -i --max-depth 2
astwire src/ -i --decay-depth 1Both require -i. --max-depth drops files beyond N import-hops from a seed; --decay-depth skeletonizes them instead of dropping. Manifests are exempt from both.
Dependency graph
astwire src/ -i --graphEmits the import edges between bundled files ahead of file contents, in whichever format is selected.
Waste analysis (dry run)
astwire src/ -i --analysisPrints a token-waste table to stdout and exits. Writes no output file.
Waste stripping
astwire src/ --strip-wasteStrips trailing whitespace, collapses consecutive blank lines, and normalizes line endings in the written output.
Skeleton extraction
astwire src/ --skeletonReplaces function/method bodies with ..., preserving docstrings, class structure, and type annotations.
Token budgeting
astwire src/ -i --max-tokens 4000Partitions output across multiple files (context_part_1.md, context_part_2.md, ...) so that no single partition exceeds the given token ceiling. A single oversized file still gets its own partition rather than being split.
Output format
astwire src/ -f json -o context.jsonOne of llm (default), markdown, or json. See ../user-guide/output-formats.md.
Output destination
astwire src/ -o bundle.mdDefaults to context.xml (or the .astwire.toml output value, if set).
Exit codes
| Code | Meaning |
|---|---|
0 |
Success (including a successful --analysis dry run, --uninstall, --version, --help) |
1 |
No matching files found under the given targets — including when every matched file was an unregistered language, or --since found changed files but all were filtered out by --lang/skip/.gitignore — or an --uninstall step that requires elevated permissions failed |
2 |
--since misuse: more than one scope path given, the scope isn't inside a git repository, or REF doesn't resolve to a real commit |
Full command reference
See ../user-guide/commands.md for every flag with usage examples, and configuration.md for the .astwire.toml contract that backs these same settings.