oikb 0.1.0__tar.gz

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.
oikb-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Open WebUI Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
oikb-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,242 @@
1
+ Metadata-Version: 2.3
2
+ Name: oikb
3
+ Version: 0.1.0
4
+ Summary: CLI tool for syncing content to Open WebUI Knowledge Bases
5
+ Author: Tim Baek
6
+ Author-email: Tim Baek <tim@openwebui.com>
7
+ License: MIT License
8
+
9
+ Copyright (c) 2026 Open WebUI Inc.
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+ Requires-Dist: click>=8.1
29
+ Requires-Dist: httpx>=0.27
30
+ Requires-Dist: pyyaml>=6.0
31
+ Requires-Dist: watchdog>=4.0
32
+ Requires-Dist: boto3>=1.34 ; extra == 'all'
33
+ Requires-Dist: pytest>=8.0 ; extra == 'dev'
34
+ Requires-Dist: pytest-asyncio>=0.23 ; extra == 'dev'
35
+ Requires-Dist: respx>=0.21 ; extra == 'dev'
36
+ Requires-Dist: httpx ; extra == 'github'
37
+ Requires-Dist: boto3>=1.34 ; extra == 's3'
38
+ Requires-Python: >=3.11
39
+ Provides-Extra: all
40
+ Provides-Extra: dev
41
+ Provides-Extra: github
42
+ Provides-Extra: s3
43
+ Description-Content-Type: text/markdown
44
+
45
+ # 📚 oikb
46
+
47
+ A CLI tool that syncs content to [Open WebUI](https://github.com/open-webui/open-webui) Knowledge Bases. Supports local directories, GitHub repos, and S3 buckets.
48
+
49
+ ## Why oikb?
50
+
51
+ Manually uploading files to Knowledge Bases is tedious. oikb automates it with incremental SHA-256 diffing, so only new and modified files are uploaded. Directory structure is mirrored automatically. Run it once, run it in CI, or leave it watching for changes.
52
+
53
+ ## Getting Started
54
+
55
+ ### Docker (recommended)
56
+
57
+ ```bash
58
+ docker run --rm \
59
+ -e OPEN_WEBUI_URL=http://host.docker.internal:3000 \
60
+ -e OPEN_WEBUI_API_KEY=sk-your-key \
61
+ -v ./docs:/data \
62
+ ghcr.io/open-webui/oikb sync /data --kb your-kb-id
63
+ ```
64
+
65
+ ### pip
66
+
67
+ ```bash
68
+ pip install oikb
69
+ ```
70
+
71
+ Then set your env vars and sync:
72
+
73
+ ```bash
74
+ export OPEN_WEBUI_URL=http://localhost:3000
75
+ export OPEN_WEBUI_API_KEY=sk-your-api-key
76
+
77
+ oikb sync ./docs --kb your-kb-id
78
+ ```
79
+
80
+ > [!TIP]
81
+ > No config file needed. Env vars are enough. You can also use `oikb config set url ...` and `oikb config set token ...` to save them to `~/.config/oikb/config.yaml`.
82
+
83
+ ## Commands
84
+
85
+ ```bash
86
+ # Sync a local directory
87
+ oikb sync ./docs --kb your-kb-id
88
+
89
+ # Sync a GitHub repo (no clone needed)
90
+ oikb sync github:owner/repo --kb your-kb-id
91
+
92
+ # Sync an S3 bucket
93
+ oikb sync s3://bucket/prefix --kb your-kb-id
94
+
95
+ # Preview changes without uploading
96
+ oikb diff ./docs --kb your-kb-id
97
+
98
+ # Watch for changes and auto-sync
99
+ oikb watch ./docs --kb your-kb-id
100
+
101
+ # List files in a KB
102
+ oikb ls --kb your-kb-id
103
+
104
+ # Show KB info
105
+ oikb status --kb your-kb-id
106
+
107
+ # Reset a KB
108
+ oikb reset --kb your-kb-id
109
+ ```
110
+
111
+ ### Sources
112
+
113
+ | Source | Syntax | Install |
114
+ |---|---|---|
115
+ | Local directory | `./docs`, `/path/to/dir` | included |
116
+ | GitHub repo | `github:owner/repo` | included |
117
+ | S3 bucket | `s3://bucket/prefix` | `pip install oikb[s3]` |
118
+
119
+ GitHub sources support `--branch` and `--path` filtering:
120
+
121
+ ```bash
122
+ oikb sync github:owner/repo --kb your-kb-id --branch main --path docs/
123
+ ```
124
+
125
+ ## Configuration
126
+
127
+ Settings are resolved in this order (highest priority wins):
128
+
129
+ 1. **CLI flags** (`--url`, `--token`)
130
+ 2. **Environment variables** (`OPEN_WEBUI_URL`, `OPEN_WEBUI_API_KEY`)
131
+ 3. **Config file** (`~/.config/oikb/config.yaml`)
132
+
133
+ ```bash
134
+ oikb config set url http://localhost:3000
135
+ oikb config set token sk-your-api-key
136
+ oikb config get
137
+ ```
138
+
139
+ ## Declarative Config (`.oikb.yaml`)
140
+
141
+ For recurring multi-source syncs, place a `.oikb.yaml` in your project root:
142
+
143
+ ```yaml
144
+ sync:
145
+ - source: ./docs
146
+ kb: project-docs
147
+
148
+ - source: github:owner/wiki
149
+ kb: team-wiki
150
+ branch: main
151
+
152
+ - source: s3://company-docs/engineering
153
+ kb: eng-handbook
154
+ ```
155
+
156
+ ```bash
157
+ # Sync all entries
158
+ oikb sync
159
+
160
+ # Sync a specific entry
161
+ oikb sync --name project-docs
162
+ ```
163
+
164
+ ## `.oikbignore`
165
+
166
+ Place a `.oikbignore` file in your source directory to exclude files (gitignore-style):
167
+
168
+ ```
169
+ dist/
170
+ build/
171
+ *.pyc
172
+ *.draft.*
173
+ *.zip
174
+ ```
175
+
176
+ ## Docker
177
+
178
+ The published image is available at `ghcr.io/open-webui/oikb`.
179
+
180
+ ```bash
181
+ # One-shot sync
182
+ docker run --rm \
183
+ -e OPEN_WEBUI_URL=http://host.docker.internal:3000 \
184
+ -e OPEN_WEBUI_API_KEY=sk-your-key \
185
+ -v ./docs:/data \
186
+ ghcr.io/open-webui/oikb sync /data --kb your-kb-id
187
+
188
+ # Watch mode (keep running)
189
+ docker run --rm -d \
190
+ -e OPEN_WEBUI_URL=http://host.docker.internal:3000 \
191
+ -e OPEN_WEBUI_API_KEY=sk-your-key \
192
+ -v ./docs:/data \
193
+ ghcr.io/open-webui/oikb watch /data --kb your-kb-id
194
+ ```
195
+
196
+ ### Docker Compose
197
+
198
+ Run as a sidecar alongside Open WebUI. Watches a mounted directory and auto-syncs:
199
+
200
+ ```yaml
201
+ services:
202
+ open-webui:
203
+ image: ghcr.io/open-webui/open-webui:main
204
+ ports:
205
+ - "3000:8080"
206
+
207
+ oikb:
208
+ image: ghcr.io/open-webui/oikb:latest
209
+ environment:
210
+ - OPEN_WEBUI_URL=http://open-webui:8080
211
+ - OPEN_WEBUI_API_KEY=${OPEN_WEBUI_API_KEY}
212
+ volumes:
213
+ - ./docs:/data
214
+ command: watch /data --kb ${KB_ID}
215
+ depends_on:
216
+ - open-webui
217
+ restart: unless-stopped
218
+ ```
219
+
220
+ ### GitHub Actions
221
+
222
+ ```yaml
223
+ - name: Sync docs to Open WebUI
224
+ uses: docker://ghcr.io/open-webui/oikb:latest
225
+ with:
226
+ args: sync /github/workspace/docs --kb ${{ secrets.KB_ID }}
227
+ env:
228
+ OPEN_WEBUI_URL: ${{ secrets.OPEN_WEBUI_URL }}
229
+ OPEN_WEBUI_API_KEY: ${{ secrets.OPEN_WEBUI_API_KEY }}
230
+ ```
231
+
232
+ ## How It Works
233
+
234
+ 1. Scan source (local dir, GitHub, S3), compute SHA-256 checksums
235
+ 2. Send manifest to Open WebUI's `/sync/diff` endpoint
236
+ 3. Server diffs against stored file hashes
237
+ 4. Delete stale files, create missing directories
238
+ 5. Upload only new and modified files
239
+
240
+ ## License
241
+
242
+ MIT. See [LICENSE](LICENSE) for details.
oikb-0.1.0/README.md ADDED
@@ -0,0 +1,198 @@
1
+ # 📚 oikb
2
+
3
+ A CLI tool that syncs content to [Open WebUI](https://github.com/open-webui/open-webui) Knowledge Bases. Supports local directories, GitHub repos, and S3 buckets.
4
+
5
+ ## Why oikb?
6
+
7
+ Manually uploading files to Knowledge Bases is tedious. oikb automates it with incremental SHA-256 diffing, so only new and modified files are uploaded. Directory structure is mirrored automatically. Run it once, run it in CI, or leave it watching for changes.
8
+
9
+ ## Getting Started
10
+
11
+ ### Docker (recommended)
12
+
13
+ ```bash
14
+ docker run --rm \
15
+ -e OPEN_WEBUI_URL=http://host.docker.internal:3000 \
16
+ -e OPEN_WEBUI_API_KEY=sk-your-key \
17
+ -v ./docs:/data \
18
+ ghcr.io/open-webui/oikb sync /data --kb your-kb-id
19
+ ```
20
+
21
+ ### pip
22
+
23
+ ```bash
24
+ pip install oikb
25
+ ```
26
+
27
+ Then set your env vars and sync:
28
+
29
+ ```bash
30
+ export OPEN_WEBUI_URL=http://localhost:3000
31
+ export OPEN_WEBUI_API_KEY=sk-your-api-key
32
+
33
+ oikb sync ./docs --kb your-kb-id
34
+ ```
35
+
36
+ > [!TIP]
37
+ > No config file needed. Env vars are enough. You can also use `oikb config set url ...` and `oikb config set token ...` to save them to `~/.config/oikb/config.yaml`.
38
+
39
+ ## Commands
40
+
41
+ ```bash
42
+ # Sync a local directory
43
+ oikb sync ./docs --kb your-kb-id
44
+
45
+ # Sync a GitHub repo (no clone needed)
46
+ oikb sync github:owner/repo --kb your-kb-id
47
+
48
+ # Sync an S3 bucket
49
+ oikb sync s3://bucket/prefix --kb your-kb-id
50
+
51
+ # Preview changes without uploading
52
+ oikb diff ./docs --kb your-kb-id
53
+
54
+ # Watch for changes and auto-sync
55
+ oikb watch ./docs --kb your-kb-id
56
+
57
+ # List files in a KB
58
+ oikb ls --kb your-kb-id
59
+
60
+ # Show KB info
61
+ oikb status --kb your-kb-id
62
+
63
+ # Reset a KB
64
+ oikb reset --kb your-kb-id
65
+ ```
66
+
67
+ ### Sources
68
+
69
+ | Source | Syntax | Install |
70
+ |---|---|---|
71
+ | Local directory | `./docs`, `/path/to/dir` | included |
72
+ | GitHub repo | `github:owner/repo` | included |
73
+ | S3 bucket | `s3://bucket/prefix` | `pip install oikb[s3]` |
74
+
75
+ GitHub sources support `--branch` and `--path` filtering:
76
+
77
+ ```bash
78
+ oikb sync github:owner/repo --kb your-kb-id --branch main --path docs/
79
+ ```
80
+
81
+ ## Configuration
82
+
83
+ Settings are resolved in this order (highest priority wins):
84
+
85
+ 1. **CLI flags** (`--url`, `--token`)
86
+ 2. **Environment variables** (`OPEN_WEBUI_URL`, `OPEN_WEBUI_API_KEY`)
87
+ 3. **Config file** (`~/.config/oikb/config.yaml`)
88
+
89
+ ```bash
90
+ oikb config set url http://localhost:3000
91
+ oikb config set token sk-your-api-key
92
+ oikb config get
93
+ ```
94
+
95
+ ## Declarative Config (`.oikb.yaml`)
96
+
97
+ For recurring multi-source syncs, place a `.oikb.yaml` in your project root:
98
+
99
+ ```yaml
100
+ sync:
101
+ - source: ./docs
102
+ kb: project-docs
103
+
104
+ - source: github:owner/wiki
105
+ kb: team-wiki
106
+ branch: main
107
+
108
+ - source: s3://company-docs/engineering
109
+ kb: eng-handbook
110
+ ```
111
+
112
+ ```bash
113
+ # Sync all entries
114
+ oikb sync
115
+
116
+ # Sync a specific entry
117
+ oikb sync --name project-docs
118
+ ```
119
+
120
+ ## `.oikbignore`
121
+
122
+ Place a `.oikbignore` file in your source directory to exclude files (gitignore-style):
123
+
124
+ ```
125
+ dist/
126
+ build/
127
+ *.pyc
128
+ *.draft.*
129
+ *.zip
130
+ ```
131
+
132
+ ## Docker
133
+
134
+ The published image is available at `ghcr.io/open-webui/oikb`.
135
+
136
+ ```bash
137
+ # One-shot sync
138
+ docker run --rm \
139
+ -e OPEN_WEBUI_URL=http://host.docker.internal:3000 \
140
+ -e OPEN_WEBUI_API_KEY=sk-your-key \
141
+ -v ./docs:/data \
142
+ ghcr.io/open-webui/oikb sync /data --kb your-kb-id
143
+
144
+ # Watch mode (keep running)
145
+ docker run --rm -d \
146
+ -e OPEN_WEBUI_URL=http://host.docker.internal:3000 \
147
+ -e OPEN_WEBUI_API_KEY=sk-your-key \
148
+ -v ./docs:/data \
149
+ ghcr.io/open-webui/oikb watch /data --kb your-kb-id
150
+ ```
151
+
152
+ ### Docker Compose
153
+
154
+ Run as a sidecar alongside Open WebUI. Watches a mounted directory and auto-syncs:
155
+
156
+ ```yaml
157
+ services:
158
+ open-webui:
159
+ image: ghcr.io/open-webui/open-webui:main
160
+ ports:
161
+ - "3000:8080"
162
+
163
+ oikb:
164
+ image: ghcr.io/open-webui/oikb:latest
165
+ environment:
166
+ - OPEN_WEBUI_URL=http://open-webui:8080
167
+ - OPEN_WEBUI_API_KEY=${OPEN_WEBUI_API_KEY}
168
+ volumes:
169
+ - ./docs:/data
170
+ command: watch /data --kb ${KB_ID}
171
+ depends_on:
172
+ - open-webui
173
+ restart: unless-stopped
174
+ ```
175
+
176
+ ### GitHub Actions
177
+
178
+ ```yaml
179
+ - name: Sync docs to Open WebUI
180
+ uses: docker://ghcr.io/open-webui/oikb:latest
181
+ with:
182
+ args: sync /github/workspace/docs --kb ${{ secrets.KB_ID }}
183
+ env:
184
+ OPEN_WEBUI_URL: ${{ secrets.OPEN_WEBUI_URL }}
185
+ OPEN_WEBUI_API_KEY: ${{ secrets.OPEN_WEBUI_API_KEY }}
186
+ ```
187
+
188
+ ## How It Works
189
+
190
+ 1. Scan source (local dir, GitHub, S3), compute SHA-256 checksums
191
+ 2. Send manifest to Open WebUI's `/sync/diff` endpoint
192
+ 3. Server diffs against stored file hashes
193
+ 4. Delete stale files, create missing directories
194
+ 5. Upload only new and modified files
195
+
196
+ ## License
197
+
198
+ MIT. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,29 @@
1
+ [project]
2
+ name = "oikb"
3
+ version = "0.1.0"
4
+ description = "CLI tool for syncing content to Open WebUI Knowledge Bases"
5
+ readme = "README.md"
6
+ authors = [
7
+ { name = "Tim Baek", email = "tim@openwebui.com" }
8
+ ]
9
+ requires-python = ">=3.11"
10
+ license = {file = "LICENSE"}
11
+ dependencies = [
12
+ "click>=8.1",
13
+ "httpx>=0.27",
14
+ "pyyaml>=6.0",
15
+ "watchdog>=4.0",
16
+ ]
17
+
18
+ [project.optional-dependencies]
19
+ github = ["httpx"]
20
+ s3 = ["boto3>=1.34"]
21
+ all = ["boto3>=1.34"]
22
+ dev = ["pytest>=8.0", "pytest-asyncio>=0.23", "respx>=0.21"]
23
+
24
+ [project.scripts]
25
+ oikb = "oikb.cli:cli"
26
+
27
+ [build-system]
28
+ requires = ["uv_build>=0.8.0,<0.9"]
29
+ build-backend = "uv_build"
@@ -0,0 +1,3 @@
1
+ """oikb — Open WebUI Knowledge Base CLI."""
2
+
3
+ __version__ = "0.1.0"