Add paragraph-number addressing (5d, 3s/.*/text/, $a/text/) and
`docs structure` / `docs cat -N` commands for paragraph-level
document manipulation.
New commands:
- `docs structure` — numbered paragraph list with types (text + JSON)
- `docs cat -N` — cat with [N] paragraph prefixes
Address syntax for `docs sed`:
- Nd (delete paragraph N), N,Md (range delete), $d (last)
- Ns/pat/repl/ (substitute within paragraph N)
- Na/text/ (append after N), Ni/text/ (insert before N)
- --tab flag for multi-tab document support
Testing:
- 24 new unit tests covering parseAddress (13 cases),
parseFullExpr_Addressed (10 cases), resolveAddress (6 cases),
and buildParagraphMap (8 cases). All pass.
- Manual testing against live Google Docs verified: structure,
cat -N, addressed substitute, delete, append, insert, dollar
addressing, and range delete.
- Bug found and fixed during manual testing: addressed a/text/
and i/text/ were parsed by parseAICommand (expects a/pat/text/)
which put text in the pattern field instead of replacement,
producing empty paragraphs. Added parseAddressedAICommand for
the single-field addressed form.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>