bookstack-cli 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,227 @@
1
+ Metadata-Version: 2.4
2
+ Name: bookstack-cli
3
+ Version: 0.1.0
4
+ Summary: CLI for coding agents to interact with a BookStack wiki via its REST API
5
+ Author: Michael Zehrer
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/mzehrer/bookstack-cli
8
+ Project-URL: Source, https://github.com/mzehrer/bookstack-cli
9
+ Project-URL: Issues, https://github.com/mzehrer/bookstack-cli/issues
10
+ Project-URL: Documentation, https://github.com/mzehrer/bookstack-cli#readme
11
+ Keywords: bookstack,wiki,cli,api,documentation
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Topic :: Documentation
17
+ Classifier: Topic :: Utilities
18
+ Requires-Python: >=3.14
19
+ Description-Content-Type: text/markdown
20
+ Requires-Dist: httpx>=0.28
21
+ Requires-Dist: pydantic>=2.0
22
+ Requires-Dist: typer>=0.15
23
+ Requires-Dist: rich>=13.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=9.1.1; extra == "dev"
26
+ Requires-Dist: pytest-asyncio>=1.4.0; extra == "dev"
27
+ Requires-Dist: pytest-cov>=7.1.0; extra == "dev"
28
+ Requires-Dist: pytest-httpx>=0.36.2; extra == "dev"
29
+ Requires-Dist: ruff>=0.15.19; extra == "dev"
30
+
31
+ # bookstack-cli
32
+
33
+ [![Python](https://img.shields.io/badge/python-≥3.14-blue)]()
34
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green)]()
35
+
36
+ CLI for coding agents to interact with a [BookStack](https://www.bookstackapp.com/) wiki via its REST API. All output is JSON — built for LLM pipelines, not humans.
37
+
38
+ ```bash
39
+ bookstack books list | jq '. | length'
40
+ bookstack pages get 42 | jq '.html[:200]'
41
+ bookstack search query "api docs" | jq '.[] | {name, type, score}'
42
+ bookstack test
43
+ ```
44
+
45
+ ## Install
46
+
47
+ ```bash
48
+ # One-liner (no clone needed)
49
+ uv tool install bookstack-cli # from PyPI, once published
50
+ # or from source:
51
+ # uv tool install git+https://github.com/mzehrer/bookstack-cli.git
52
+
53
+ # Or clone for development
54
+ cd bookstack-cli
55
+ make init # or: uv sync
56
+ ```
57
+
58
+ ## Setup
59
+
60
+ ```bash
61
+ bookstack auth # interactive — prompts for URL, token, secret
62
+
63
+ # If public web URL differs from API (e.g. behind OAuth proxy):
64
+ bookstack auth --resolve-url https://wiki.public.example.com
65
+ ```
66
+
67
+ ### Config File
68
+
69
+ Saved to `~/.config/bookstack-cli/config.toml`:
70
+
71
+ ```toml
72
+ [connection]
73
+ url = "http://10.0.0.1:8080" # API endpoint (internal)
74
+ resolve_url = "https://wiki.public.example.com" # public web URL (optional)
75
+ token_id = "<your-token-id>"
76
+ token_secret = "<your-token-secret>"
77
+ ```
78
+
79
+ `resolve_url` is optional — defaults to `url` if not set.
80
+
81
+ ### Env Vars (override file)
82
+
83
+ ```bash
84
+ export BOOKSTACK_URL=http://10.0.0.1:8080
85
+ export BOOKSTACK_RESOLVE_URL=https://wiki.example.com
86
+ export BOOKSTACK_TOKEN_ID=<your-token-id>
87
+ export BOOKSTACK_TOKEN_SECRET=<your-token-secret>
88
+ ```
89
+
90
+ Precedence: env vars > config file > error.
91
+
92
+ [See auth docs →](docs/authentication.md)
93
+
94
+ ## Usage
95
+
96
+ ```
97
+ $ bookstack --help
98
+
99
+ ╭─ Commands ───────────────────────────────────────╮
100
+ │ auth Save connection credentials. │
101
+ │ config Manage connection config. │
102
+ │ test Test connection to BookStack. │
103
+ │ shelves Manage bookshelves. │
104
+ │ books Manage books. │
105
+ │ chapters Manage chapters. │
106
+ │ pages Manage pages. │
107
+ │ attachments Manage attachments. │
108
+ │ users Manage users (admin). │
109
+ │ roles Manage roles (admin). │
110
+ │ search Search content. │
111
+ ╰───────────────────────────────────────────────────╯
112
+ ```
113
+
114
+ ### Common Workflows
115
+
116
+ ```bash
117
+ # Test connection
118
+ bookstack test
119
+
120
+ # List all books
121
+ bookstack books list
122
+
123
+ # Get a specific page
124
+ bookstack pages get 42
125
+
126
+ # Create a page from file
127
+ bookstack pages create "My Page" --book-id 1 --markdown-file content.md
128
+
129
+ # Pipe multi-line content
130
+ cat content.md | bookstack pages create "Piped Page" --book-id 1
131
+
132
+ # Append text to existing page
133
+ bookstack pages update 42 --append "New section at the end"
134
+
135
+ # Resolve web URL to page
136
+ bookstack pages resolve-url "https://wiki/books/my-book/page/my-page"
137
+
138
+ # Import markdown with images
139
+ bookstack pages import --file article.md --book-id 1 --name "Article"
140
+
141
+ # Search across all content
142
+ bookstack search query "installation guide"
143
+
144
+ # List attachments on a page
145
+ bookstack attachments list --page-id 10
146
+
147
+ # Upload a file attachment
148
+ bookstack attachments upload --name "Report" --page-id 42 --file report.pdf
149
+
150
+ # Create a shelf and assign books
151
+ bookstack shelves create "Dev Docs"
152
+ bookstack shelves update 1 "Dev Docs" --books "10,20,30"
153
+
154
+ # Update entity
155
+ bookstack books update 1 "New Title"
156
+ ```
157
+
158
+ ## Features
159
+
160
+ | Feature | Status |
161
+ |---|---|
162
+ | Shelves CRUD (+ book assignment) | ✅ |
163
+ | Books CRUD | ✅ |
164
+ | Chapters CRUD | ✅ |
165
+ | Pages CRUD (partial update, append, move) | ✅ |
166
+ | Markdown import with image handling | ✅ |
167
+ | Web URL → API ID resolution | ✅ |
168
+ | Attachments (link + file upload) | ✅ |
169
+ | Search across content | ✅ |
170
+ | Users/Roles (admin) | ✅ |
171
+ | Async HTTP with retry/backoff | ✅ |
172
+ | Auto-pagination (client-side filtering) | ✅ |
173
+ | Config test / connection check | ✅ |
174
+ | JSON-only output | ✅ |
175
+
176
+ ## Project Layout
177
+
178
+ ```
179
+ bookstack-cli/
180
+ ├── bookstack_cli/
181
+ │ ├── client.py # HTTP client, auth, rate-limit, pagination
182
+ │ ├── config.py # Env vars → ~/.config/bookstack-cli/config.toml
183
+ │ ├── exceptions.py # Typed error hierarchy
184
+ │ ├── models.py # Pydantic models for all entities
185
+ │ ├── main.py # Typer CLI entry point
186
+ │ └── resources/ # One module per entity
187
+ │ ├── books.py
188
+ │ ├── chapters.py
189
+ │ ├── pages.py
190
+ │ ├── shelves.py
191
+ │ ├── attachments.py
192
+ │ ├── search.py
193
+ │ ├── users.py
194
+ │ ├── roles.py
195
+ │ ├── revisions.py
196
+ │ └── tags.py
197
+ ├── tests/ # 130+ tests
198
+ ├── docs/ # Detailed docs
199
+ ├── skill/ # Pi agent skill
200
+ ├── Makefile # init/test/lint/format/run
201
+ └── pyproject.toml
202
+ ```
203
+
204
+ ## Documentation
205
+
206
+ | File | What |
207
+ |---|---|
208
+ | [docs/overview.md](docs/overview.md) | Architecture, goals, scope |
209
+ | [docs/authentication.md](docs/authentication.md) | Token setup, env config, security |
210
+ | [docs/api-reference.md](docs/api-reference.md) | All endpoints, schemas, pagination |
211
+ | [docs/integration-guide.md](docs/integration-guide.md) | Hacking BookStack, injections, webhooks |
212
+ | [docs/research.md](docs/research.md) | Raw API research findings |
213
+ | [skill/SKILL.md](skill/SKILL.md) | Agent skill for pi/coding agents |
214
+ | [AGENT.md](AGENT.md) | TDD protocol for this project |
215
+
216
+ ## Design
217
+
218
+ - **Async from day one** — `httpx.AsyncClient` with retry + exponential backoff on 429s
219
+ - **Pydantic v2** — typed models for every entity, validated responses
220
+ - **Agent-friendly output** — everything is JSON via stdout, no interactive prompts
221
+ - **Resource-per-file** — one module per entity, consistent `list/get/create/update/delete` signatures
222
+ - **Config cascade** — env vars > `~/.config/bookstack-cli/config.toml` > error
223
+ - **TDD** — 130 tests, red/green/refactor cycle (see [AGENT.md](AGENT.md))
224
+
225
+ ## License
226
+
227
+ MIT
@@ -0,0 +1,22 @@
1
+ bookstack_cli/__init__.py,sha256=ur3yl7JmqmkVCIQPKSnRZDK_mi-xDrf53SILXSWSb_Q,104
2
+ bookstack_cli/client.py,sha256=RzIr8nh52yEzEit7is6sacizYrOTLVW7eRBdc5BsqOw,6963
3
+ bookstack_cli/config.py,sha256=n5wB1f66MzZDt_KcCjj9P8GG3AMXVsQXyWZTKUkWKZw,3780
4
+ bookstack_cli/exceptions.py,sha256=EHeCf0d_uZAltR94-au3EfnqOYKPu_s1tUfw_bH3aL8,1146
5
+ bookstack_cli/main.py,sha256=n-Ss8eta47Ey1VZiguFO79sF_n0xXrr95G6Z0P6WbeM,28577
6
+ bookstack_cli/models.py,sha256=-dy_iElFF25FeTK-ott4GG7XWJGlguBaLL4c6i3jUKU,6651
7
+ bookstack_cli/resources/__init__.py,sha256=5Sf-wWATnfShJclo4rctFXuBeMoi9IIPC3QcZB57yaA,51
8
+ bookstack_cli/resources/attachments.py,sha256=tVX2AcMzRqV3_t8Ebd6GHh2SZ0T7FgpFiBQz6JxAjGI,2746
9
+ bookstack_cli/resources/books.py,sha256=EjBYoptKrDBrqIQ-WZHhi2yH6fCGy1ZbLEeQ8-mvDV0,1934
10
+ bookstack_cli/resources/chapters.py,sha256=WQHF2s-P9NyZOivvlABqG_IiSkQ9tE_dkWxD5He7qic,1481
11
+ bookstack_cli/resources/pages.py,sha256=5yOfi0l5eDdm20XsxcuU1BDc0YCoTFpRfP2cwmLzg2A,13119
12
+ bookstack_cli/resources/revisions.py,sha256=J5iaeqV0oD7a_21NryemN5tXVS1Cwj_3kvmyOYEkuxU,895
13
+ bookstack_cli/resources/roles.py,sha256=QCe5aLKrjV_-StyDtSbO1RshuJfKFYpItRj2ozAZVTM,989
14
+ bookstack_cli/resources/search.py,sha256=wSZr5xA-ko2GgfOaOz-SN5kZtK_Vy0CSgQse4oNF1ao,575
15
+ bookstack_cli/resources/shelves.py,sha256=dS6I4FLqpfEZktsGFXQwR9S1kGdjREeLpSByGqkrqCE,1777
16
+ bookstack_cli/resources/tags.py,sha256=_yzOtvGD5XabkDeUteLlsAzxqo2cyuiwRjq_Y5jFGw0,401
17
+ bookstack_cli/resources/users.py,sha256=eOO2ZBIyvOP2WuUfgShUdlYTqSKsjzjIB81FhH0Aq1M,1179
18
+ bookstack_cli-0.1.0.dist-info/METADATA,sha256=4icOXetFu8jU9FuEFehamvV2w7D6gAzZp8q7ggfpWLQ,7573
19
+ bookstack_cli-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
20
+ bookstack_cli-0.1.0.dist-info/entry_points.txt,sha256=vZkvtx0avoCMBXvVIEgcfdSC_HHKcSaL9wfLIXbwAHI,53
21
+ bookstack_cli-0.1.0.dist-info/top_level.txt,sha256=nAnl3On-KzJVLYmvdsmyV4kW5fjB4nPKyQk6JFfFCSY,14
22
+ bookstack_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ bookstack = bookstack_cli.main:app
@@ -0,0 +1 @@
1
+ bookstack_cli