virtualdojo 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.
Files changed (29) hide show
  1. virtualdojo-0.1.0/.gitignore +86 -0
  2. virtualdojo-0.1.0/LICENSE +21 -0
  3. virtualdojo-0.1.0/PKG-INFO +379 -0
  4. virtualdojo-0.1.0/README.md +335 -0
  5. virtualdojo-0.1.0/pyproject.toml +105 -0
  6. virtualdojo-0.1.0/src/virtualdojo/__init__.py +15 -0
  7. virtualdojo-0.1.0/src/virtualdojo/__main__.py +6 -0
  8. virtualdojo-0.1.0/src/virtualdojo/cli.py +195 -0
  9. virtualdojo-0.1.0/src/virtualdojo/client.py +293 -0
  10. virtualdojo-0.1.0/src/virtualdojo/commands/__init__.py +5 -0
  11. virtualdojo-0.1.0/src/virtualdojo/commands/ai.py +160 -0
  12. virtualdojo-0.1.0/src/virtualdojo/commands/auth.py +686 -0
  13. virtualdojo-0.1.0/src/virtualdojo/commands/config.py +221 -0
  14. virtualdojo-0.1.0/src/virtualdojo/commands/logs.py +431 -0
  15. virtualdojo-0.1.0/src/virtualdojo/commands/records.py +334 -0
  16. virtualdojo-0.1.0/src/virtualdojo/commands/schema.py +255 -0
  17. virtualdojo-0.1.0/src/virtualdojo/commands/system.py +100 -0
  18. virtualdojo-0.1.0/src/virtualdojo/config.py +333 -0
  19. virtualdojo-0.1.0/src/virtualdojo/exceptions.py +100 -0
  20. virtualdojo-0.1.0/src/virtualdojo/models/__init__.py +11 -0
  21. virtualdojo-0.1.0/src/virtualdojo/models/auth.py +45 -0
  22. virtualdojo-0.1.0/src/virtualdojo/models/records.py +61 -0
  23. virtualdojo-0.1.0/src/virtualdojo/utils/__init__.py +23 -0
  24. virtualdojo-0.1.0/src/virtualdojo/utils/filters.py +161 -0
  25. virtualdojo-0.1.0/src/virtualdojo/utils/output.py +254 -0
  26. virtualdojo-0.1.0/tests/__init__.py +1 -0
  27. virtualdojo-0.1.0/tests/conftest.py +18 -0
  28. virtualdojo-0.1.0/tests/test_cli.py +58 -0
  29. virtualdojo-0.1.0/tests/test_filters.py +81 -0
@@ -0,0 +1,86 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ *.manifest
31
+ *.spec
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .nox/
41
+ .coverage
42
+ .coverage.*
43
+ .cache
44
+ nosetests.xml
45
+ coverage.xml
46
+ *.cover
47
+ *.py,cover
48
+ .hypothesis/
49
+ .pytest_cache/
50
+ cover/
51
+
52
+ # Translations
53
+ *.mo
54
+ *.pot
55
+
56
+ # Environments
57
+ .env
58
+ .venv
59
+ env/
60
+ venv/
61
+ ENV/
62
+ env.bak/
63
+ venv.bak/
64
+
65
+ # IDE
66
+ .idea/
67
+ .vscode/
68
+ *.swp
69
+ *.swo
70
+ *~
71
+
72
+ # mypy
73
+ .mypy_cache/
74
+ .dmypy.json
75
+ dmypy.json
76
+
77
+ # Ruff
78
+ .ruff_cache/
79
+
80
+ # OS files
81
+ .DS_Store
82
+ Thumbs.db
83
+
84
+ # Project specific
85
+ credentials.toml
86
+ config.toml
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Quote-ly / VirtualDojo
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.
@@ -0,0 +1,379 @@
1
+ Metadata-Version: 2.4
2
+ Name: virtualdojo
3
+ Version: 0.1.0
4
+ Summary: Command-line interface for VirtualDojo CRM
5
+ Project-URL: Homepage, https://github.com/Quote-ly/virtualdojo_cli
6
+ Project-URL: Documentation, https://github.com/Quote-ly/virtualdojo_cli#readme
7
+ Project-URL: Repository, https://github.com/Quote-ly/virtualdojo_cli
8
+ Project-URL: Issues, https://github.com/Quote-ly/virtualdojo_cli/issues
9
+ Author-email: VirtualDojo Team <support@virtualdojo.com>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: automation,cli,crm,salesforce-alternative,virtualdojo
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: System Administrators
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Office/Business :: Groupware
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Requires-Python: >=3.10
26
+ Requires-Dist: httpx>=0.25.0
27
+ Requires-Dist: keyring>=24.0.0
28
+ Requires-Dist: platformdirs>=4.0.0
29
+ Requires-Dist: pydantic>=2.0.0
30
+ Requires-Dist: rich>=13.0.0
31
+ Requires-Dist: tomli-w>=1.0.0
32
+ Requires-Dist: tomli>=2.0.0; python_version < '3.11'
33
+ Requires-Dist: typer[all]>=0.9.0
34
+ Provides-Extra: dev
35
+ Requires-Dist: black>=23.0.0; extra == 'dev'
36
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
37
+ Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
38
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
39
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
40
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
41
+ Requires-Dist: respx>=0.20.0; extra == 'dev'
42
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
43
+ Description-Content-Type: text/markdown
44
+
45
+ # VirtualDojo CLI
46
+
47
+ Command-line interface for VirtualDojo CRM - interact with your CRM data, manage records, and automate workflows from the terminal.
48
+
49
+ ## Features
50
+
51
+ - **Authentication**: Login with email/password or API keys
52
+ - **Record Management**: Full CRUD operations on any object
53
+ - **Schema Discovery**: Explore objects, fields, and picklists
54
+ - **Multiple Profiles**: Manage connections to different servers/tenants
55
+ - **Rich Output**: Beautiful tables, JSON, and YAML formatting
56
+ - **Filter Support**: Powerful filtering with operators (contains, gte, ne, etc.)
57
+
58
+ ## Installation
59
+
60
+ ### From PyPI (recommended)
61
+
62
+ ```bash
63
+ pip install virtualdojo
64
+ ```
65
+
66
+ Or with [pipx](https://pypa.github.io/pipx/) (recommended for CLI tools):
67
+
68
+ ```bash
69
+ pipx install virtualdojo
70
+ ```
71
+
72
+ ### From Source
73
+
74
+ ```bash
75
+ git clone https://github.com/Quote-ly/virtualdojo_cli.git
76
+ cd virtualdojo_cli
77
+ pip install -e .
78
+ ```
79
+
80
+ ## Quick Start
81
+
82
+ ### 1. Login
83
+
84
+ ```bash
85
+ # Login to default production server (prompts for email, password)
86
+ vdojo login
87
+
88
+ # Login to local development server
89
+ vdojo login --local
90
+ vdojo login -l
91
+
92
+ # Login to specific server
93
+ vdojo login --server localhost:8000 --tenant my-tenant
94
+ vdojo login -s staging -t my-tenant
95
+
96
+ # Login with API key (for CI/CD - use environment variables!)
97
+ export VIRTUALDOJO_API_KEY=sk-abc123
98
+ export VIRTUALDOJO_TENANT=my-company
99
+ vdojo login
100
+ ```
101
+
102
+ ### 2. Check Connection
103
+
104
+ ```bash
105
+ vdojo whoami
106
+ ```
107
+
108
+ ### 3. List Records
109
+
110
+ ```bash
111
+ # List accounts
112
+ vdojo records list accounts
113
+
114
+ # List with filtering
115
+ vdojo records list opportunities --filter "stage_ne=closed,amount_gte=10000"
116
+
117
+ # Output as JSON
118
+ vdojo records list contacts --format json
119
+ ```
120
+
121
+ ## Commands
122
+
123
+ ### Authentication
124
+
125
+ ```bash
126
+ # Login (shortcuts available at top level)
127
+ vdojo login # Default server, prompts for details
128
+ vdojo login --local # Local development (localhost:8000)
129
+ vdojo login -s staging -t my-tenant # Staging server
130
+ vdojo login --server api.mycompany.com -t prod # Custom server
131
+
132
+ # Server shortcuts:
133
+ # --local, -l → http://localhost:8000
134
+ # --server local → http://localhost:8000
135
+ # --server staging → staging server
136
+ # --server production → production server
137
+
138
+ # Check current user
139
+ vdojo whoami
140
+
141
+ # Logout
142
+ vdojo logout
143
+
144
+ # Manage API keys
145
+ vdojo auth api-key list
146
+ vdojo auth api-key create --name "CI Pipeline" --expires 90
147
+ vdojo auth api-key revoke KEY_ID
148
+ ```
149
+
150
+ ### Records
151
+
152
+ ```bash
153
+ # List records
154
+ vdojo records list accounts
155
+ vdojo records list accounts --limit 100 --filter "status=active"
156
+
157
+ # Get single record
158
+ vdojo records get accounts acc-123
159
+
160
+ # Create record
161
+ vdojo records create accounts --data '{"name": "Acme Corp"}'
162
+ vdojo records create tasks --set "name=Follow up" --set "status=pending"
163
+
164
+ # Update record
165
+ vdojo records update accounts acc-123 --set "status=active"
166
+
167
+ # Delete record
168
+ vdojo records delete accounts acc-123
169
+
170
+ # Count records
171
+ vdojo records count opportunities --filter "stage=negotiation"
172
+ ```
173
+
174
+ ### Schema
175
+
176
+ ```bash
177
+ # List all objects
178
+ vdojo schema objects
179
+ vdojo schema objects --type custom # Only custom objects
180
+
181
+ # Describe an object
182
+ vdojo schema describe accounts
183
+
184
+ # List fields
185
+ vdojo schema fields opportunities
186
+ vdojo schema fields contacts --required # Only required fields
187
+
188
+ # View picklist values
189
+ vdojo schema picklists opportunities --field stage
190
+ ```
191
+
192
+ ### Configuration
193
+
194
+ ```bash
195
+ # Show current config
196
+ vdojo config show
197
+
198
+ # Manage profiles
199
+ vdojo config profile list
200
+ vdojo config profile add staging --server https://staging.virtualdojo.com --tenant test
201
+ vdojo config profile use staging
202
+ vdojo config profile remove old-profile
203
+
204
+ # Change settings
205
+ vdojo config set default_limit 100
206
+ vdojo config set output_format json
207
+ ```
208
+
209
+ ## Filter Operators
210
+
211
+ When using `--filter`, you can use these operators:
212
+
213
+ | Operator | Description | Example |
214
+ |----------|-------------|---------|
215
+ | (none) | Equals | `status=active` |
216
+ | `_ne` | Not equals | `stage_ne=closed` |
217
+ | `_gt` | Greater than | `amount_gt=10000` |
218
+ | `_gte` | Greater than or equal | `amount_gte=10000` |
219
+ | `_lt` | Less than | `amount_lt=1000` |
220
+ | `_lte` | Less than or equal | `amount_lte=1000` |
221
+ | `_contains` | Contains text | `name_contains=Acme` |
222
+ | `_startswith` | Starts with | `name_startswith=A` |
223
+ | `_endswith` | Ends with | `email_endswith=@corp.com` |
224
+ | `_in` | In list | `status_in=active,pending` |
225
+ | `_isnull` | Is null | `email_isnull=true` |
226
+
227
+ Combine multiple filters with commas:
228
+
229
+ ```bash
230
+ vdojo records list opportunities --filter "stage_ne=closed,amount_gte=10000,owner_contains=john"
231
+ ```
232
+
233
+ ## Output Formats
234
+
235
+ All commands support multiple output formats:
236
+
237
+ ```bash
238
+ # Table (default) - human-readable
239
+ vdojo records list accounts
240
+
241
+ # JSON - machine-readable
242
+ vdojo records list accounts --format json
243
+
244
+ # YAML - configuration-friendly
245
+ vdojo records list accounts --format yaml
246
+ ```
247
+
248
+ ## Multiple Profiles
249
+
250
+ Manage connections to different environments:
251
+
252
+ ```bash
253
+ # Add profiles
254
+ vdojo config profile add production --server https://api.virtualdojo.com --tenant prod
255
+ vdojo config profile add staging --server https://staging.virtualdojo.com --tenant staging
256
+ vdojo config profile add local --server http://localhost:8000 --tenant dev
257
+
258
+ # Switch default profile
259
+ vdojo config profile use production
260
+
261
+ # Use a specific profile for one command
262
+ vdojo records list accounts --profile staging
263
+ ```
264
+
265
+ ## Configuration
266
+
267
+ Configuration is stored in:
268
+ - **Linux/macOS**: `~/.config/virtualdojo/config.toml`
269
+ - **Windows**: `%APPDATA%\virtualdojo\config.toml`
270
+
271
+ Credentials are stored separately with restricted permissions:
272
+ - **Linux/macOS**: `~/.config/virtualdojo/credentials.toml`
273
+ - **Windows**: `%APPDATA%\virtualdojo\credentials.toml`
274
+
275
+ ## Security
276
+
277
+ ### Credential Storage
278
+
279
+ The CLI stores authentication tokens securely:
280
+
281
+ 1. **System Keyring (Recommended)**: When available, tokens are stored in your operating system's secure credential storage:
282
+ - **macOS**: Keychain
283
+ - **Linux**: Secret Service (GNOME Keyring, KWallet)
284
+ - **Windows**: Windows Credential Manager
285
+
286
+ 2. **Fallback File Storage**: If no system keyring is available, tokens are stored in `credentials.toml` with restricted file permissions (`0600` - owner read/write only).
287
+
288
+ **Recommendations:**
289
+ - Use full-disk encryption on your machine
290
+ - On shared systems, ensure your home directory is not accessible to other users
291
+ - Regularly rotate API keys via `vdojo auth api-key create` / `vdojo auth api-key revoke`
292
+
293
+ ### Environment Variables for CI/CD
294
+
295
+ For automated workflows, use environment variables instead of command-line arguments to avoid exposing credentials in shell history and process listings:
296
+
297
+ ```bash
298
+ # Set credentials via environment (secure)
299
+ export VIRTUALDOJO_API_KEY=sk-your-api-key
300
+ export VIRTUALDOJO_TENANT=your-tenant-id
301
+ export VIRTUALDOJO_SERVER=https://api.virtualdojo.com
302
+
303
+ # Run commands without exposing secrets
304
+ vdojo login
305
+ vdojo records list accounts
306
+ ```
307
+
308
+ Available environment variables:
309
+ | Variable | Description |
310
+ |----------|-------------|
311
+ | `VIRTUALDOJO_API_KEY` | API key for authentication |
312
+ | `VIRTUALDOJO_PASSWORD` | Password (for non-interactive login) |
313
+ | `VIRTUALDOJO_EMAIL` | Email address |
314
+ | `VIRTUALDOJO_TENANT` | Tenant ID or subdomain |
315
+ | `VIRTUALDOJO_SERVER` | Server URL |
316
+
317
+ ### HTTPS Connections
318
+
319
+ The CLI uses HTTPS by default for all production connections. When connecting to HTTP endpoints (like `localhost` for development), a warning is displayed:
320
+
321
+ ```
322
+ ! Using insecure HTTP connection to http://localhost:8000.
323
+ Credentials will be transmitted in plaintext.
324
+ ```
325
+
326
+ **Never use HTTP for production environments.**
327
+
328
+ ### Security Best Practices
329
+
330
+ 1. **Use API keys for automation** - Create dedicated API keys with expiration for CI/CD pipelines
331
+ 2. **Don't commit credentials** - Never commit `.env` files or credentials to version control
332
+ 3. **Rotate credentials** - Regularly rotate API keys, especially after team member departures
333
+ 4. **Use environment variables** - Prefer `VIRTUALDOJO_API_KEY` over `--api-key` in scripts
334
+ 5. **Audit access** - Review API key usage via `vdojo auth api-key list`
335
+
336
+ ## Development
337
+
338
+ ### Setup
339
+
340
+ ```bash
341
+ # Clone repository
342
+ git clone https://github.com/Quote-ly/virtualdojo_cli.git
343
+ cd virtualdojo_cli
344
+
345
+ # Install with dev dependencies
346
+ pip install -e ".[dev]"
347
+
348
+ # Run tests
349
+ pytest
350
+
351
+ # Run linting
352
+ ruff check src/
353
+ black --check src/
354
+ ```
355
+
356
+ ### Running Locally
357
+
358
+ ```bash
359
+ # Run CLI directly
360
+ python -m virtualdojo --help
361
+
362
+ # Or after installing
363
+ vdojo --help
364
+ ```
365
+
366
+ ## Requirements
367
+
368
+ - Python 3.10+
369
+ - A VirtualDojo CRM instance to connect to
370
+
371
+ ## License
372
+
373
+ MIT License - see [LICENSE](LICENSE) file.
374
+
375
+ ## Links
376
+
377
+ - [VirtualDojo CRM](https://virtualdojo.com)
378
+ - [API Documentation](https://docs.virtualdojo.com)
379
+ - [Issue Tracker](https://github.com/Quote-ly/virtualdojo_cli/issues)