onesearch-cli 0.12.1__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.
- onesearch_cli-0.12.1/.gitignore +77 -0
- onesearch_cli-0.12.1/PKG-INFO +222 -0
- onesearch_cli-0.12.1/README.md +209 -0
- onesearch_cli-0.12.1/onesearch/__init__.py +6 -0
- onesearch_cli-0.12.1/onesearch/api.py +247 -0
- onesearch_cli-0.12.1/onesearch/banner.py +84 -0
- onesearch_cli-0.12.1/onesearch/commands/__init__.py +4 -0
- onesearch_cli-0.12.1/onesearch/commands/auth.py +64 -0
- onesearch_cli-0.12.1/onesearch/commands/config.py +166 -0
- onesearch_cli-0.12.1/onesearch/commands/search.py +142 -0
- onesearch_cli-0.12.1/onesearch/commands/source.py +232 -0
- onesearch_cli-0.12.1/onesearch/commands/status.py +221 -0
- onesearch_cli-0.12.1/onesearch/config.py +185 -0
- onesearch_cli-0.12.1/onesearch/context.py +51 -0
- onesearch_cli-0.12.1/onesearch/main.py +153 -0
- onesearch_cli-0.12.1/pyproject.toml +26 -0
- onesearch_cli-0.12.1/tests/test_api.py +55 -0
- onesearch_cli-0.12.1/tests/test_auth_commands.py +33 -0
- onesearch_cli-0.12.1/tests/test_banner.py +43 -0
- onesearch_cli-0.12.1/tests/test_config.py +17 -0
- onesearch_cli-0.12.1/tests/test_integration_auth.py +120 -0
- onesearch_cli-0.12.1/tests/test_main.py +43 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Environment
|
|
2
|
+
.env
|
|
3
|
+
.env.local
|
|
4
|
+
.env.*.local
|
|
5
|
+
|
|
6
|
+
# Python
|
|
7
|
+
__pycache__/
|
|
8
|
+
*.py[cod]
|
|
9
|
+
*$py.class
|
|
10
|
+
*.so
|
|
11
|
+
.Python
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
|
|
28
|
+
# Virtual environments
|
|
29
|
+
venv/
|
|
30
|
+
.venv/
|
|
31
|
+
env/
|
|
32
|
+
ENV/
|
|
33
|
+
|
|
34
|
+
# Database
|
|
35
|
+
*.db
|
|
36
|
+
*.db-journal
|
|
37
|
+
*.db-wal
|
|
38
|
+
*.db-shm
|
|
39
|
+
data/
|
|
40
|
+
|
|
41
|
+
# Testing
|
|
42
|
+
.pytest_cache/
|
|
43
|
+
.coverage
|
|
44
|
+
htmlcov/
|
|
45
|
+
*.cover
|
|
46
|
+
.tox/
|
|
47
|
+
|
|
48
|
+
# IDEs
|
|
49
|
+
.vscode/
|
|
50
|
+
.idea/
|
|
51
|
+
*.swp
|
|
52
|
+
*.swo
|
|
53
|
+
*~
|
|
54
|
+
.DS_Store
|
|
55
|
+
|
|
56
|
+
# Frontend
|
|
57
|
+
node_modules/
|
|
58
|
+
dist/
|
|
59
|
+
*.local
|
|
60
|
+
!frontend/src/lib/
|
|
61
|
+
|
|
62
|
+
# Logs
|
|
63
|
+
*.log
|
|
64
|
+
logs/
|
|
65
|
+
|
|
66
|
+
# Docker
|
|
67
|
+
*.env.production
|
|
68
|
+
docker-compose.override.yml
|
|
69
|
+
|
|
70
|
+
# Alembic
|
|
71
|
+
alembic/versions/*.pyc
|
|
72
|
+
|
|
73
|
+
# Local documentation (not pushed to GitHub)
|
|
74
|
+
local_docs/
|
|
75
|
+
|
|
76
|
+
# MkDocs build output
|
|
77
|
+
site/
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: onesearch-cli
|
|
3
|
+
Version: 0.12.1
|
|
4
|
+
Summary: Standalone CLI client for a running OneSearch server
|
|
5
|
+
License: AGPL-3.0-only
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Requires-Dist: click>=8.1.0
|
|
8
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
9
|
+
Requires-Dist: pyyaml>=6.0.0
|
|
10
|
+
Requires-Dist: requests>=2.31.0
|
|
11
|
+
Requires-Dist: rich>=13.0.0
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# OneSearch CLI
|
|
15
|
+
|
|
16
|
+
Command-line interface for OneSearch - Self-hosted, privacy-focused search for your homelab.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
The CLI is a standalone client for a running OneSearch server. It does not include the backend, indexer, or search data. Tagged OneSearch releases publish the Docker image and the `onesearch-cli` package together on the same shared version.
|
|
21
|
+
|
|
22
|
+
### Recommended: pipx
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pipx install onesearch-cli
|
|
26
|
+
onesearch config set backend_url http://localhost:8000
|
|
27
|
+
onesearch login
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### From Source (Development)
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
cd cli
|
|
34
|
+
python -m venv .venv
|
|
35
|
+
|
|
36
|
+
# Windows
|
|
37
|
+
.venv\Scripts\activate
|
|
38
|
+
|
|
39
|
+
# Linux/Mac
|
|
40
|
+
source .venv/bin/activate
|
|
41
|
+
|
|
42
|
+
pip install -e .
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Verify Installation
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
onesearch --version
|
|
49
|
+
onesearch --help
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Quick Start
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Check system health
|
|
56
|
+
onesearch health
|
|
57
|
+
|
|
58
|
+
# List configured sources
|
|
59
|
+
onesearch source list
|
|
60
|
+
|
|
61
|
+
# Add a source (ID is auto-generated from name as slug, e.g., "documents")
|
|
62
|
+
onesearch source add "Documents" /data/docs --include "**/*.pdf,**/*.md"
|
|
63
|
+
|
|
64
|
+
# Trigger indexing (use source ID from 'source list')
|
|
65
|
+
onesearch source reindex documents
|
|
66
|
+
|
|
67
|
+
# Search
|
|
68
|
+
onesearch search "kubernetes deployment"
|
|
69
|
+
|
|
70
|
+
# Check indexing status
|
|
71
|
+
onesearch status
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
> **Note:** Source IDs are slugified from the name (e.g., "My Documents" → "my-documents").
|
|
75
|
+
|
|
76
|
+
## Commands
|
|
77
|
+
|
|
78
|
+
### Source Management
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# List all sources
|
|
82
|
+
onesearch source list
|
|
83
|
+
|
|
84
|
+
# Add a new source
|
|
85
|
+
onesearch source add <name> <path> [--include PATTERNS] [--exclude PATTERNS]
|
|
86
|
+
|
|
87
|
+
# Show source details
|
|
88
|
+
onesearch source show <source_id>
|
|
89
|
+
|
|
90
|
+
# Reindex a source
|
|
91
|
+
onesearch source reindex <source_id>
|
|
92
|
+
|
|
93
|
+
# Delete a source
|
|
94
|
+
onesearch source delete <source_id> [--yes]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Search
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Basic search
|
|
101
|
+
onesearch search "query"
|
|
102
|
+
|
|
103
|
+
# With filters (use source ID from 'source list')
|
|
104
|
+
onesearch search "python" --source documents --type pdf --limit 10
|
|
105
|
+
|
|
106
|
+
# JSON output for scripting
|
|
107
|
+
onesearch search "error" --json | jq '.results[].path'
|
|
108
|
+
|
|
109
|
+
# Pagination
|
|
110
|
+
onesearch search "docker" --offset 20 --limit 10
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Status & Health
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Overall status
|
|
117
|
+
onesearch status
|
|
118
|
+
|
|
119
|
+
# Specific source status
|
|
120
|
+
onesearch status <source_id>
|
|
121
|
+
|
|
122
|
+
# System health check
|
|
123
|
+
onesearch health
|
|
124
|
+
|
|
125
|
+
# JSON output for monitoring
|
|
126
|
+
onesearch health --json
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Configuration
|
|
130
|
+
|
|
131
|
+
### Environment Variables
|
|
132
|
+
|
|
133
|
+
- `ONESEARCH_URL` - Backend API URL (default: `http://localhost:8000`)
|
|
134
|
+
- `ONESEARCH_TOKEN` - Bearer token for non-interactive auth
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Use a custom backend URL
|
|
138
|
+
export ONESEARCH_URL=http://onesearch.local:8000
|
|
139
|
+
onesearch search "test"
|
|
140
|
+
|
|
141
|
+
# Non-interactive auth for scripts
|
|
142
|
+
export ONESEARCH_TOKEN=xxxxx
|
|
143
|
+
onesearch search "test" --json
|
|
144
|
+
|
|
145
|
+
# Or pass the URL directly
|
|
146
|
+
onesearch --url http://onesearch.local:8000 search "test"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Global Options
|
|
150
|
+
|
|
151
|
+
- `--url URL` - Override backend API URL
|
|
152
|
+
- `-v, --verbose` - Enable verbose output
|
|
153
|
+
- `-q, --quiet` - Suppress non-essential output (headers, hints, decorations)
|
|
154
|
+
- `-h, --help` - Show help message
|
|
155
|
+
- `--version` - Show version
|
|
156
|
+
|
|
157
|
+
## Output Formats
|
|
158
|
+
|
|
159
|
+
Most commands support `--json` for machine-readable output:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# JSON for scripting
|
|
163
|
+
onesearch health --json
|
|
164
|
+
onesearch status --json
|
|
165
|
+
onesearch search "test" --json
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Examples
|
|
169
|
+
|
|
170
|
+
### Add and Index a Source
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# Add a documents source (creates ID "my-documents")
|
|
174
|
+
onesearch source add "My Documents" /mnt/nas/documents \
|
|
175
|
+
--include "**/*.pdf,**/*.md,**/*.txt" \
|
|
176
|
+
--exclude "**/archive/**"
|
|
177
|
+
|
|
178
|
+
# Start indexing (use the source ID)
|
|
179
|
+
onesearch source reindex my-documents
|
|
180
|
+
|
|
181
|
+
# Monitor progress
|
|
182
|
+
onesearch status my-documents
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
> **Docker users:** If the path only exists inside the container, use `--no-validate` to skip local path validation:
|
|
186
|
+
> ```bash
|
|
187
|
+
> onesearch source add "NAS Docs" /data/nas --no-validate
|
|
188
|
+
> ```
|
|
189
|
+
|
|
190
|
+
### Search with Filters
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# Search PDFs only
|
|
194
|
+
onesearch search "quarterly report" --type pdf
|
|
195
|
+
|
|
196
|
+
# Search specific source (use source ID)
|
|
197
|
+
onesearch search "meeting notes" --source my-documents
|
|
198
|
+
|
|
199
|
+
# Get more results
|
|
200
|
+
onesearch search "python" --limit 50
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Health Monitoring
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
# Quick health check (returns non-zero on failure)
|
|
207
|
+
onesearch health || echo "OneSearch is down!"
|
|
208
|
+
|
|
209
|
+
# JSON for monitoring systems
|
|
210
|
+
onesearch health --json | jq '.status'
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Development
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# Install CLI in development mode
|
|
217
|
+
pip install -e .
|
|
218
|
+
|
|
219
|
+
# Run tests (install pytest first)
|
|
220
|
+
pip install pytest
|
|
221
|
+
pytest
|
|
222
|
+
```
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# OneSearch CLI
|
|
2
|
+
|
|
3
|
+
Command-line interface for OneSearch - Self-hosted, privacy-focused search for your homelab.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
The CLI is a standalone client for a running OneSearch server. It does not include the backend, indexer, or search data. Tagged OneSearch releases publish the Docker image and the `onesearch-cli` package together on the same shared version.
|
|
8
|
+
|
|
9
|
+
### Recommended: pipx
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pipx install onesearch-cli
|
|
13
|
+
onesearch config set backend_url http://localhost:8000
|
|
14
|
+
onesearch login
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### From Source (Development)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
cd cli
|
|
21
|
+
python -m venv .venv
|
|
22
|
+
|
|
23
|
+
# Windows
|
|
24
|
+
.venv\Scripts\activate
|
|
25
|
+
|
|
26
|
+
# Linux/Mac
|
|
27
|
+
source .venv/bin/activate
|
|
28
|
+
|
|
29
|
+
pip install -e .
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Verify Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
onesearch --version
|
|
36
|
+
onesearch --help
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Check system health
|
|
43
|
+
onesearch health
|
|
44
|
+
|
|
45
|
+
# List configured sources
|
|
46
|
+
onesearch source list
|
|
47
|
+
|
|
48
|
+
# Add a source (ID is auto-generated from name as slug, e.g., "documents")
|
|
49
|
+
onesearch source add "Documents" /data/docs --include "**/*.pdf,**/*.md"
|
|
50
|
+
|
|
51
|
+
# Trigger indexing (use source ID from 'source list')
|
|
52
|
+
onesearch source reindex documents
|
|
53
|
+
|
|
54
|
+
# Search
|
|
55
|
+
onesearch search "kubernetes deployment"
|
|
56
|
+
|
|
57
|
+
# Check indexing status
|
|
58
|
+
onesearch status
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
> **Note:** Source IDs are slugified from the name (e.g., "My Documents" → "my-documents").
|
|
62
|
+
|
|
63
|
+
## Commands
|
|
64
|
+
|
|
65
|
+
### Source Management
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# List all sources
|
|
69
|
+
onesearch source list
|
|
70
|
+
|
|
71
|
+
# Add a new source
|
|
72
|
+
onesearch source add <name> <path> [--include PATTERNS] [--exclude PATTERNS]
|
|
73
|
+
|
|
74
|
+
# Show source details
|
|
75
|
+
onesearch source show <source_id>
|
|
76
|
+
|
|
77
|
+
# Reindex a source
|
|
78
|
+
onesearch source reindex <source_id>
|
|
79
|
+
|
|
80
|
+
# Delete a source
|
|
81
|
+
onesearch source delete <source_id> [--yes]
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Search
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Basic search
|
|
88
|
+
onesearch search "query"
|
|
89
|
+
|
|
90
|
+
# With filters (use source ID from 'source list')
|
|
91
|
+
onesearch search "python" --source documents --type pdf --limit 10
|
|
92
|
+
|
|
93
|
+
# JSON output for scripting
|
|
94
|
+
onesearch search "error" --json | jq '.results[].path'
|
|
95
|
+
|
|
96
|
+
# Pagination
|
|
97
|
+
onesearch search "docker" --offset 20 --limit 10
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Status & Health
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Overall status
|
|
104
|
+
onesearch status
|
|
105
|
+
|
|
106
|
+
# Specific source status
|
|
107
|
+
onesearch status <source_id>
|
|
108
|
+
|
|
109
|
+
# System health check
|
|
110
|
+
onesearch health
|
|
111
|
+
|
|
112
|
+
# JSON output for monitoring
|
|
113
|
+
onesearch health --json
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Configuration
|
|
117
|
+
|
|
118
|
+
### Environment Variables
|
|
119
|
+
|
|
120
|
+
- `ONESEARCH_URL` - Backend API URL (default: `http://localhost:8000`)
|
|
121
|
+
- `ONESEARCH_TOKEN` - Bearer token for non-interactive auth
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Use a custom backend URL
|
|
125
|
+
export ONESEARCH_URL=http://onesearch.local:8000
|
|
126
|
+
onesearch search "test"
|
|
127
|
+
|
|
128
|
+
# Non-interactive auth for scripts
|
|
129
|
+
export ONESEARCH_TOKEN=xxxxx
|
|
130
|
+
onesearch search "test" --json
|
|
131
|
+
|
|
132
|
+
# Or pass the URL directly
|
|
133
|
+
onesearch --url http://onesearch.local:8000 search "test"
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Global Options
|
|
137
|
+
|
|
138
|
+
- `--url URL` - Override backend API URL
|
|
139
|
+
- `-v, --verbose` - Enable verbose output
|
|
140
|
+
- `-q, --quiet` - Suppress non-essential output (headers, hints, decorations)
|
|
141
|
+
- `-h, --help` - Show help message
|
|
142
|
+
- `--version` - Show version
|
|
143
|
+
|
|
144
|
+
## Output Formats
|
|
145
|
+
|
|
146
|
+
Most commands support `--json` for machine-readable output:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# JSON for scripting
|
|
150
|
+
onesearch health --json
|
|
151
|
+
onesearch status --json
|
|
152
|
+
onesearch search "test" --json
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Examples
|
|
156
|
+
|
|
157
|
+
### Add and Index a Source
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# Add a documents source (creates ID "my-documents")
|
|
161
|
+
onesearch source add "My Documents" /mnt/nas/documents \
|
|
162
|
+
--include "**/*.pdf,**/*.md,**/*.txt" \
|
|
163
|
+
--exclude "**/archive/**"
|
|
164
|
+
|
|
165
|
+
# Start indexing (use the source ID)
|
|
166
|
+
onesearch source reindex my-documents
|
|
167
|
+
|
|
168
|
+
# Monitor progress
|
|
169
|
+
onesearch status my-documents
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
> **Docker users:** If the path only exists inside the container, use `--no-validate` to skip local path validation:
|
|
173
|
+
> ```bash
|
|
174
|
+
> onesearch source add "NAS Docs" /data/nas --no-validate
|
|
175
|
+
> ```
|
|
176
|
+
|
|
177
|
+
### Search with Filters
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# Search PDFs only
|
|
181
|
+
onesearch search "quarterly report" --type pdf
|
|
182
|
+
|
|
183
|
+
# Search specific source (use source ID)
|
|
184
|
+
onesearch search "meeting notes" --source my-documents
|
|
185
|
+
|
|
186
|
+
# Get more results
|
|
187
|
+
onesearch search "python" --limit 50
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Health Monitoring
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# Quick health check (returns non-zero on failure)
|
|
194
|
+
onesearch health || echo "OneSearch is down!"
|
|
195
|
+
|
|
196
|
+
# JSON for monitoring systems
|
|
197
|
+
onesearch health --json | jq '.status'
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Development
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# Install CLI in development mode
|
|
204
|
+
pip install -e .
|
|
205
|
+
|
|
206
|
+
# Run tests (install pytest first)
|
|
207
|
+
pip install pytest
|
|
208
|
+
pytest
|
|
209
|
+
```
|