Expand description
Google Docs API (v1) integration — reading the structural model of a Google Doc, which the Drive API structurally cannot expose (issue #1615, ADR-0071 §9).
Drive treats a Doc as an opaque native document: files.export renders it
to a foreign format and a media files.update replaces the whole document
by re-importing one. Neither has any notion of a paragraph, a table cell
or an index — which is why ADR-0071 §9 has
drive edit refuse Google-native documents outright, and why
drive read --content can only hand back a one-way markdown rendering
with no path back to the document model.
That model is the whole point of this module. Every Docs mutation is
addressed by {tabId, segmentId, index}, so an export — however faithful
its prose — cannot tell you where to edit. drive read --content stays
the prose channel; drive docs read is the model channel.
Lives under src/drive/ rather than a top-level src/docs/ for the same
two reasons crate::drive::sheets does, one of them load-bearing: it
shares the account store, DriveCredentials, token refresh and the
drive commit scope; and FilesApi’s mutating methods are
pub(in crate::drive) — the visibility fence that makes “no gate bypass”
true by construction rather than by convention. A sibling top-level module
could not call them without widening that fence.
Modules§
- anchor
- Content anchors resolved against the same inline snapshot as the write lease.
- api
- Docs v1 API façade — typed wrappers over the endpoints the CLI needs,
mirroring
crate::drive::sheets::api::SheetsApi’s shape. - client
- Docs v1 REST API client.
- create
drive docs createengine — creates a Google Doc, optionally seeded with text (issue #1615, ADR-0076 §9).- named_
range - Bounded named-range mutations resolved against the revision-controlled snapshot.
- read
drive docs readengine — onedocuments.get, flattened into an index-ordered element list per tab.- structure
- Flattening a document’s structural tree into an index-ordered list.
- style
- Bounded style patches: field masks are derived, never supplied by callers.
- table
- Bounded table edits resolved from the revision-pinned inline snapshot. One request per invocation prevents index shifts from request ordering.
- target
- Classifying a Drive file id for the Docs commands, and wording the refusal when it is not a Google Doc.
- types
- Wire types for the Docs v1 REST API.
- write
drive docs replace/appendengines — text mutation gated by the ADR-0071 write-permission rules and leased against a document revision (issue #1615, ADR-0076).- write_
types - Request and response types for
documents.batchUpdate.