weaveback — combined tool
Runs macro expansion and chunk extraction in one pass.
Options
| Flag | Default | Description |
|---|---|---|
|
|
Base directory prepended to every input path |
|
|
Macro invocation character |
|
|
Include search paths for |
|
|
Base directory for generated output files |
|
|
Chunk-open delimiter |
|
|
Chunk-close delimiter |
|
|
End-of-chunk marker |
|
|
Comment prefixes recognised before chunk delimiters (comma-separated) |
|
Run a formatter after writing each file, e.g. |
|
|
off |
Print macro-expanded text to stderr before noweb processing |
|
Auto-discover driver files; mutually exclusive with positional inputs |
|
|
|
File extension to scan in |
|
Write a Makefile depfile listing every source file read |
|
|
Touch this file on success (build-system stamp) |
|
|
|
Path to the source-map database |
|
off |
Enable |
|
off |
Allow |
|
off |
Print output paths without writing anything |
Directory mode
--dir scans a directory tree recursively for files matching --ext,
determines which are drivers (top-level files) vs fragments (included by
another file), and processes each driver. No changes needed when new files are
added.
--dump-expanded is the first thing to check when a chunk can’t be found or
expands unexpectedly — it prints the macro-expanded intermediate text that
weaveback-tangle receives.
Build-system integration
--depfile and --stamp together let a single build rule cover an entire
directory of literate sources:
custom_target('gen',
output : ['gen.stamp'],
depfile : 'gen.d',
command : [weaveback,
'--dir', meson.current_source_dir() / 'src',
'--ext', 'adoc',
'--include', meson.current_source_dir(),
'--stamp', '@OUTPUT0@',
'--depfile', '@DEPFILE@'],
)
|
Note
|
List only the stamp in |
Subcommands
apply-back
When you edit a file in gen/ directly, the next weaveback run refuses to
overwrite it (ModifiedExternally). apply-back closes the loop: it diffs
the modified gen/ file against the stored baseline, traces each changed line
back to its literate source, and patches the source file.
Macro-generated content (%def, %rhaidef bodies) is traced back through
the two-level source map to the original definition or call-site argument
and patched automatically where unambiguous.
apply-back supports size-changing edits (insertions and deletions) by
attributing new lines to the chunk of the preceding or succeeding line.
impact
Shows every chunk and output file transitively affected if a given chunk changes. Outputs a JSON object.
graph
Exports the chunk-dependency graph in DOT (Graphviz) format for visualization.
|
|
lsp
Provides semantic navigation and intelligence by bridging language-specific
LSPs (like rust-analyzer) with Weaveback source maps.
| Command | Description |
|---|---|
|
Find symbol definition and map back to |
|
Find all references and map back to |
| Flag | Default | Description |
|---|---|---|
|
(auto) |
Manual override for LSP command (e.g. |
|
(auto) |
Manual override for language ID (e.g. |
serve
Starts a local HTTP server at http://127.0.0.1:<port>/ that serves
docs/html/, pushes live-reload events to connected browsers when HTML files
change, and provides the inline chunk editor for literate source files.
| Flag | Default | Description |
|---|---|---|
|
|
TCP port to listen on |
|
|
Directory to serve |
|
|
Chunk-open delimiter for the tangle oracle |
|
|
Chunk-close delimiter for the tangle oracle |
|
|
Chunk-end marker for the tangle oracle |
|
|
Comment prefixes for the oracle (comma-separated) |
|
|
AI backend for |
|
(default) |
AI model name (e.g. |
|
(default) |
Base URL for |
The tangle-oracle flags must match the delimiters used by the project being
served. They are only needed if you use non-default chunk syntax and intend
to use the /__apply inline editor endpoint.
AI Backend Modes
-
claude-cli(default) -
Shells out to
claude -p --output-format stream-json, using the authenticated Claude Code session already on the machine — no extra credentials required. -
anthropic -
Calls the Anthropic Messages API directly. Requires the
ANTHROPIC_API_KEYenvironment variable. -
gemini -
Calls the Google Gemini API. Requires the
GOOGLE_API_KEYenvironment variable. -
ollama -
Calls a local Ollama instance. Uses
--ai-endpoint(default:http://localhost:11434) and--ai-model(default:llama3). -
openai -
Calls an OpenAI-compatible API. Requires
OPENAI_API_KEY(unless using a local provider) and--ai-endpoint.
See architecture.adoc for the full design, HTTP endpoint reference, and inline editor documentation.
weaveback-macro — macro expander only
| Flag | Default | Description |
|---|---|---|
|
|
Output file ( |
|
|
Macro invocation character |
|
|
Include search paths |
|
|
Path separator (platform default) |
|
|
Base directory prepended to each input path |
|
off |
Enable |
|
Auto-discover driver files |
|
|
|
File extension to scan in |
weaveback-tangle — chunk extractor only
| Flag | Default | Description |
|---|---|---|
|
|
Base directory for generated output files |
|
stdout |
Output for |
|
Comma-separated chunk names to extract to stdout |
|
|
|
Chunk-open delimiter |
|
|
Chunk-close delimiter |
|
|
End-of-chunk marker |
|
|
Comment prefixes (comma-separated) |
|
Run a formatter after writing each file |
|
|
off |
Allow |
|
off |
Print output paths without writing anything |
weaveback-docgen — documentation generator
Renders AsciiDoc sources to HTML, post-processes them with chunk IDs and a literate-source index, and optionally injects cross-reference data.
| Flag | Default | Description |
|---|---|---|
|
|
Directory for rendered HTML output |
|
Directory with |
|
|
De-duplicate CHAR (repeatable) |
|
|
External command for cross-reference analysis |
|
|
off |
Skip cross-reference analysis entirely |
|
off |
Use LSP (rust-analyzer) for precise semantic links |
See architecture.adoc for the full documentation pipeline details.