# docs

> Every coline docs command, with its flags and the action it runs.

Source: https://docs.coline.app/cli/reference/docs

{/* Generated by apps/docs/scripts/cli-reference.ts from coline's command tree and the cli action catalog. Don't edit it: run `pnpm --filter @colineapp/docs cli:reference`. */}

Docs: cat, edit and every docs action. Every `coline docs` command, 9 in all.

## docs cat

Print a doc as markdown: its title as a # heading, then headings, paragraphs, lists, quotes, code, tables, links and images. Name it by its link or its id.

What markdown can't show (underline, colors, fonts, videos) is left out, and the command says what on stderr.

```text
coline docs cat <doc> [flags]
```

**Built into coline.** · **Calls** `docs.get` · **Effect** read, changes nothing · **Can wait for your approval** no

```bash
coline docs cat https://coline.app/acme/docs/3b1f…
coline docs cat 3b1f… > doc.md
coline docs cat 3b1f… --json --fields title,body
```

## docs edit

Open a doc in your editor as markdown: the first line `# Title` is its title, the rest its text. Save and close to save it in Coline; leave it unchanged or empty to cancel. --from takes the text from a file or stdin instead.

Only what you changed is saved. Blocks you didn't touch stay exactly as they are, with their styles, videos and anything else markdown can't show. If it changed in Coline since you opened it and the two can't be put together, nothing is saved and it says to open it again.

When a block you changed had something markdown can't keep (underline, text colors, a video), it says what and saves only with --confirm.

The editor is the one set with `coline config set editor`, else $VISUAL, then $EDITOR, then vi.

```text
coline docs edit <doc> [flags]
```

**Built into coline.** · **Calls** `docs.get`, `docs.save` · **Effect** write · **Can wait for your approval** no

| Flag            | What it does                                     |
| --------------- | ------------------------------------------------ |
| `--from <file>` | Take the new text from this file; - reads stdin. |

```bash
coline docs edit https://coline.app/acme/docs/3b1f…
coline docs edit 3b1f… --from doc.md
coline docs cat 3b1f… | sed 's/Q3/Q4/g' | coline docs edit 3b1f… --from -
```

## docs generate

The doc editor's "write this for me", streamed to stdout. Nothing is written into the doc: pipe the text where you want it, like coline docs edit. The doc is its link or id; you need to be able to edit it. Text piped in is what to work on.

```text
coline docs generate <doc> <what to write…> [flags]
```

**Built into coline.** · **Calls** `POST /api/v1/docs/ai/generate` · **Effect** write · **Can wait for your approval** no

| Flag                      | What it does                                                                    |
| ------------------------- | ------------------------------------------------------------------------------- |
| `--selection-file <file>` | The doc's text to work on, from a file; - reads stdin (piped stdin is read too) |
| `--title <text>`          | The doc's title, for context.                                                   |

```bash
coline docs generate https://coline.app/acme/docs/3b1f… "An intro for the launch plan"
coline docs cat 3b1f… | coline docs generate 3b1f… "Summarize this in three bullets"
coline docs generate 3b1f… "A closing paragraph" --json
```

## docs create

Creates a paged document (a proposal, brief, report, letter). Write plain text or markdown-like text.

```text
coline docs create [flags]
```

**Action** `docs.create` · **Effect** write · **Can wait for your approval** no · **Scope** `files.write` · **Workspace** yes, `-w`

| Flag               | What it does                                                      |
| ------------------ | ----------------------------------------------------------------- |
| `--title <text>`   |                                                                   |
| `--content <text>` | Default .                                                         |
| `--drive-id <id>`  | Drive to put it in; default: the person's default writable drive. |
| `--parent-id <id>` | Folder to put it in, in that drive.                               |
| `--input <file>`   | Read the input as JSON from a file; - reads stdin.                |

```bash
coline docs create -w acme
coline docs create -w acme --json '{}' --fields id
```

## docs get

Reads a doc's title, text and revision. Pass the revision as baseRevision when rewriting it.

It changes nothing.

```text
coline docs get [flags]
```

**Action** `docs.get` · **Effect** read, changes nothing · **Can wait for your approval** no · **Scope** `files.read` · **Workspace** yes, `-w`

| Flag             | What it does                                        |
| ---------------- | --------------------------------------------------- |
| `--doc-id <id>`  | Doc id from search, fetch or create\_doc. Required. |
| `--input <file>` | Read the input as JSON from a file; - reads stdin.  |

```bash
coline docs get -w acme --doc-id <doc-id>
coline docs get -w acme --json '{"docId":"<doc-id>"}' --fields id
```

## docs save

Saves the person's edits from the doc editor in the chat against the revision they started from.

Set content, layout with --json '\{…}' or --input.

```text
coline docs save [flags]
```

**Action** `docs.save` · **Effect** write · **Can wait for your approval** no · **Scope** `files.write` · **Workspace** yes, `-w`

| Flag                     | What it does                                        |
| ------------------------ | --------------------------------------------------- |
| `--doc-id <id>`          | Doc id from search, fetch or create\_doc. Required. |
| `--title <text>`         | Required.                                           |
| `--base-revision <text>` | Required.                                           |
| `--mutation-id <id>`     | Required.                                           |
| `--input <file>`         | Read the input as JSON from a file; - reads stdin.  |

```bash
coline docs save -w acme --doc-id <doc-id> --title "…" --base-revision "…" --mutation-id <mutation-id>
coline docs save -w acme --json '{"docId":"<doc-id>","title":"…","content":"…","layout":"…","baseRevision":"…","mutationId":"<mutation-id>"}' --fields id
```

## docs update

Replaces a doc's title and text. Pass the revision from get\_doc as baseRevision and a new UUID as mutationId, and reuse both on a retry; a conflict means the person changed it since, so read it again and keep their work.

Set layout with --json '\{…}' or --input.

```text
coline docs update [flags]
```

**Action** `docs.update` · **Effect** write · **Can wait for your approval** no · **Scope** `files.write` · **Workspace** yes, `-w`

| Flag                     | What it does                                        |
| ------------------------ | --------------------------------------------------- |
| `--doc-id <id>`          | Doc id from search, fetch or create\_doc. Required. |
| `--title <text>`         | Required.                                           |
| `--content <text>`       | Required.                                           |
| `--base-revision <text>` | Required.                                           |
| `--mutation-id <id>`     | Required.                                           |
| `--input <file>`         | Read the input as JSON from a file; - reads stdin.  |

```bash
coline docs update -w acme --doc-id <doc-id> --title "…" --content "…" --base-revision "…" --mutation-id <mutation-id>
coline docs update -w acme --json '{"docId":"<doc-id>","title":"…","content":"…","baseRevision":"…","mutationId":"<mutation-id>"}' --fields id
```

## docs word list

Word documents across every drive the person can read, newest first, to open in Docs.

It changes nothing.

```text
coline docs word list [flags]
```

**Action** `docs.word.list` · **Effect** read, changes nothing · **Can wait for your approval** no · **Scope** `files.read` · **Workspace** yes, `-w`

| Flag               | What it does                                       |
| ------------------ | -------------------------------------------------- |
| `--q <text>`       |                                                    |
| `--limit <number>` | Default 50.                                        |
| `--input <file>`   | Read the input as JSON from a file; - reads stdin. |

```bash
coline docs word list -w acme
coline docs word list -w acme --json '{}' --fields id
```

## docs word open

Makes a doc from a Word document in Drive, leaving the Word file as it is.

```text
coline docs word open [flags]
```

**Action** `docs.word.open` · **Effect** write · **Can wait for your approval** no · **Scope** `files.write` · **Workspace** yes, `-w`

| Flag             | What it does                                       |
| ---------------- | -------------------------------------------------- |
| `--file-id <id>` | Required.                                          |
| `--input <file>` | Read the input as JSON from a file; - reads stdin. |

```bash
coline docs word open -w acme --file-id <file-id>
coline docs word open -w acme --json '{"fileId":"<file-id>"}' --fields id
```
