docmind-cli 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,121 @@
1
- # Temporary Holding Version
1
+ # docmind-cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Check and preview your DocMind documentation **locally, before you push** — the
4
+ same checks Publish runs, against your working tree. No login, no token.
5
+
6
+ ```bash
7
+ npx docmind-cli check # run once, nothing installed
8
+ npx docmind-cli preview
9
+ ```
10
+
11
+ Or install it once and use the `docmind` command:
12
+
13
+ ```bash
14
+ npm install -g docmind-cli
15
+ docmind check
16
+ docmind preview
17
+ ```
18
+
19
+ Needs Node.js 20 or later.
20
+
21
+ Run it from your docs repository. It finds `navigation.yaml` (repo root,
22
+ `docs/`, or two levels down), builds the whole site in memory exactly the way
23
+ Publish does, and reports every problem with its file and line:
24
+
25
+ ```
26
+ docs/guides/setup/broken.md
27
+ ✕ :5 <NotAComponent> is not a DocMind component and will render as literal text. [unknown_component]
28
+ ✕ :9 <Card> is never closed. Add </Card>. [unclosed_component]
29
+
30
+ docs/guides/intro.md
31
+ ! :6 Link "nowhere.md" matches no page in this project. … [unknown_page]
32
+
33
+ ──────────────────────────────────────────────────────────────────────────────
34
+
35
+ ✕ Status: 2 errors, 6 warnings — Publish would be blocked
36
+ • Pages: 3 · API specs: 1 · Assets: 1
37
+ • Checked in 40ms
38
+ ```
39
+
40
+ **Errors** (✕) are what would make Publish fail. **Warnings** (!) still publish.
41
+
42
+ ## Preview
43
+
44
+ ```bash
45
+ npx docmind-cli preview --project acme
46
+ ```
47
+
48
+ Open `http://localhost:4000` (the next free port if 4000 is taken) and it takes
49
+ you to the docs at `/<project>/docs`. Every save rebuilds the site and the
50
+ browser reloads by itself.
51
+
52
+ It looks like your live docs because it **is** the live docs portal: the same
53
+ components (top bar, Tabs, sidebar, page layout, "On this page", prev/next,
54
+ footer, the 3-column API Reference with code samples) and the same stylesheet,
55
+ fed from your checkout instead of a published site. The problems panel and the
56
+ terminal show the same errors and warnings as `docmind check`.
57
+
58
+ - **Search:** the search box and ⌘K work, over every page and API operation in
59
+ your checkout. Ranking uses the live site's scoring, but can differ slightly
60
+ (the live site also matches word stems and typos).
61
+ - **API Reference:** overview, tags and operations, cURL / JavaScript /
62
+ TypeScript / Python / Java / Go samples, spec downloads, and **Try It** — sent
63
+ through the preview, so APIs on `localhost` work too.
64
+ - **Role simulation:** pick a role in "View as" (bottom right), add
65
+ `?as=reader-client` to any URL, or start with `--role reader-client`.
66
+ Navigation, pages and search hide what that role cannot see. The list holds
67
+ the four roles every project has — Admin, Editor, Reader (Organisation),
68
+ Reader (Client) — then every role your `navigation.yaml` restricts to and any
69
+ in `docmind.yaml` `roles:`. `?as=` goes back to everything.
70
+ - **Branding:** with `--project <slug>` and your DocMind URL (`--server`,
71
+ `DOCMIND_SERVER`, or `server:` in `docmind.yaml`) the preview fetches the
72
+ project's public theme — colours, logo, font. It is cached in
73
+ `~/.docmind/themes/`, and the default theme is used when neither is
74
+ available. No login is involved.
75
+ - **Local only:** it listens on `127.0.0.1` and serves files from your
76
+ checkout; nothing is uploaded anywhere.
77
+ - **Not in the preview** (they need your DocMind server and a login):
78
+ Discussion, "Was this helpful?" results (the buttons work but nothing is
79
+ saved), notifications, the account menu, Ask AI, and author / "Updated" dates.
80
+ A spec's custom overview settings (e.g. which code-sample languages to show)
81
+ live on the server, so the preview shows the defaults.
82
+
83
+ ## Options
84
+
85
+ | | |
86
+ |---|---|
87
+ | `docmind check [dir]` | Check the repository at `dir` (default: current directory) |
88
+ | `--docs-dir <path>` | The folder holding `navigation.yaml`, when detection guesses wrong |
89
+ | `--errors-only` | Hide warnings |
90
+ | `--format json` | Machine-readable output |
91
+ | `docmind preview [dir]` | Serve the site locally with live reload |
92
+ | `--port <n>` | Port to try first (default `4000`; `0` = any free port) |
93
+ | `--role <role>` | Preview as this role |
94
+ | `--project <slug>` / `--server <url>` | Use the project's branding |
95
+ | `--no-color` | Plain output (also `NO_COLOR=1`) |
96
+
97
+ Exit codes: `0` would publish · `1` Publish would be blocked · `2` command error.
98
+ Use it in CI to stop a broken page reaching the publishing branch.
99
+
100
+ ## docmind.yaml (optional)
101
+
102
+ ```yaml
103
+ docsDir: docs # where navigation.yaml lives
104
+ roles: [partner, reader-organisation] # custom roles your navigation.yaml uses
105
+ project: acme # preview: whose branding to use
106
+ server: https://docs.example.com # preview: your DocMind URL
107
+ ```
108
+
109
+ ## What it cannot check locally
110
+
111
+ It has no access to your project's database, so two things are taken on trust
112
+ and checked for real when you publish:
113
+
114
+ - **Custom roles.** `admin`, `editor`, `reader-organisation`, `reader-client`
115
+ and `*` are known. Any other
116
+ role in `roles:` is a warning unless listed in `docmind.yaml`.
117
+ - **`id:` values.** An entry's `id:` is assumed to name a row the project has.
118
+
119
+ Entries **without** an `id:` (a page you just added) are handled the way
120
+ Publish handles them: provisioned if the file exists, refused — and reported —
121
+ if it does not. `docmind check` never writes to your files.