@lifestreamdynamics/vault-cli 1.0.0
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/LICENSE +21 -0
- package/README.md +759 -0
- package/dist/client.d.ts +12 -0
- package/dist/client.js +79 -0
- package/dist/commands/admin.d.ts +2 -0
- package/dist/commands/admin.js +263 -0
- package/dist/commands/audit.d.ts +2 -0
- package/dist/commands/audit.js +119 -0
- package/dist/commands/auth.d.ts +2 -0
- package/dist/commands/auth.js +256 -0
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.js +130 -0
- package/dist/commands/connectors.d.ts +2 -0
- package/dist/commands/connectors.js +224 -0
- package/dist/commands/docs.d.ts +2 -0
- package/dist/commands/docs.js +194 -0
- package/dist/commands/hooks.d.ts +2 -0
- package/dist/commands/hooks.js +159 -0
- package/dist/commands/keys.d.ts +2 -0
- package/dist/commands/keys.js +165 -0
- package/dist/commands/publish.d.ts +2 -0
- package/dist/commands/publish.js +138 -0
- package/dist/commands/search.d.ts +2 -0
- package/dist/commands/search.js +61 -0
- package/dist/commands/shares.d.ts +2 -0
- package/dist/commands/shares.js +121 -0
- package/dist/commands/subscription.d.ts +2 -0
- package/dist/commands/subscription.js +166 -0
- package/dist/commands/sync.d.ts +2 -0
- package/dist/commands/sync.js +565 -0
- package/dist/commands/teams.d.ts +2 -0
- package/dist/commands/teams.js +322 -0
- package/dist/commands/user.d.ts +2 -0
- package/dist/commands/user.js +48 -0
- package/dist/commands/vaults.d.ts +2 -0
- package/dist/commands/vaults.js +157 -0
- package/dist/commands/versions.d.ts +2 -0
- package/dist/commands/versions.js +219 -0
- package/dist/commands/webhooks.d.ts +2 -0
- package/dist/commands/webhooks.js +181 -0
- package/dist/config.d.ts +24 -0
- package/dist/config.js +88 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +63 -0
- package/dist/lib/credential-manager.d.ts +48 -0
- package/dist/lib/credential-manager.js +101 -0
- package/dist/lib/encrypted-config.d.ts +20 -0
- package/dist/lib/encrypted-config.js +102 -0
- package/dist/lib/keychain.d.ts +8 -0
- package/dist/lib/keychain.js +82 -0
- package/dist/lib/migration.d.ts +31 -0
- package/dist/lib/migration.js +92 -0
- package/dist/lib/profiles.d.ts +43 -0
- package/dist/lib/profiles.js +104 -0
- package/dist/sync/config.d.ts +32 -0
- package/dist/sync/config.js +100 -0
- package/dist/sync/conflict.d.ts +30 -0
- package/dist/sync/conflict.js +60 -0
- package/dist/sync/daemon-worker.d.ts +1 -0
- package/dist/sync/daemon-worker.js +128 -0
- package/dist/sync/daemon.d.ts +44 -0
- package/dist/sync/daemon.js +174 -0
- package/dist/sync/diff.d.ts +43 -0
- package/dist/sync/diff.js +166 -0
- package/dist/sync/engine.d.ts +41 -0
- package/dist/sync/engine.js +233 -0
- package/dist/sync/ignore.d.ts +16 -0
- package/dist/sync/ignore.js +72 -0
- package/dist/sync/remote-poller.d.ts +23 -0
- package/dist/sync/remote-poller.js +145 -0
- package/dist/sync/state.d.ts +32 -0
- package/dist/sync/state.js +98 -0
- package/dist/sync/types.d.ts +68 -0
- package/dist/sync/types.js +4 -0
- package/dist/sync/watcher.d.ts +23 -0
- package/dist/sync/watcher.js +207 -0
- package/dist/utils/flags.d.ts +18 -0
- package/dist/utils/flags.js +31 -0
- package/dist/utils/format.d.ts +2 -0
- package/dist/utils/format.js +22 -0
- package/dist/utils/output.d.ts +87 -0
- package/dist/utils/output.js +229 -0
- package/package.json +62 -0
package/README.md
ADDED
|
@@ -0,0 +1,759 @@
|
|
|
1
|
+
# Lifestream Vault CLI
|
|
2
|
+
|
|
3
|
+
A powerful command-line interface for Lifestream Vault - the multi-user Markdown document storage service with WebDAV sync, search, and collaboration features.
|
|
4
|
+
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://www.npmjs.com/package/@lifestream-vault/cli)
|
|
7
|
+
|
|
8
|
+
## 📖 Table of Contents
|
|
9
|
+
|
|
10
|
+
- [Features](#-features)
|
|
11
|
+
- [Installation](#-installation)
|
|
12
|
+
- [Quick Start](#-quick-start)
|
|
13
|
+
- [Authentication](#-authentication)
|
|
14
|
+
- [Commands Reference](#-commands-reference)
|
|
15
|
+
- [Authentication Commands](#authentication-commands)
|
|
16
|
+
- [Vault Commands](#vault-commands)
|
|
17
|
+
- [Document Commands](#document-commands)
|
|
18
|
+
- [Sync Commands](#sync-commands)
|
|
19
|
+
- [Search Commands](#search-commands)
|
|
20
|
+
- [Team Commands](#team-commands)
|
|
21
|
+
- [Sharing & Publishing](#sharing--publishing)
|
|
22
|
+
- [Hooks & Webhooks](#hooks--webhooks)
|
|
23
|
+
- [Admin Commands](#admin-commands)
|
|
24
|
+
- [Sync & Watch Mode](#-sync--watch-mode)
|
|
25
|
+
- [Configuration](#️-configuration)
|
|
26
|
+
- [Environment Variables](#-environment-variables)
|
|
27
|
+
- [Credential Storage](#-credential-storage)
|
|
28
|
+
- [Examples](#-examples)
|
|
29
|
+
- [Troubleshooting](#-troubleshooting)
|
|
30
|
+
- [Related Packages](#-related-packages)
|
|
31
|
+
- [Documentation](#-documentation)
|
|
32
|
+
- [Support](#-support)
|
|
33
|
+
- [License](#-license)
|
|
34
|
+
|
|
35
|
+
## ✨ Features
|
|
36
|
+
|
|
37
|
+
- **🔐 Secure Authentication** - API key or email/password login with secure credential storage (system keychain with encrypted fallback)
|
|
38
|
+
- **📁 Vault Management** - Create, list, update, and delete vaults with full CRUD operations
|
|
39
|
+
- **📄 Document Operations** - Read, write, update, and delete Markdown documents with metadata support
|
|
40
|
+
- **🔄 Bidirectional Sync** - Clone vaults locally and sync changes in both directions (pull, push, or bidirectional)
|
|
41
|
+
- **👁️ Watch Mode** - Real-time file watching with automatic sync on local changes
|
|
42
|
+
- **🔍 Full-Text Search** - Search across all documents with advanced filtering and semantic search
|
|
43
|
+
- **👥 Team Collaboration** - Manage teams, invitations, and shared vaults
|
|
44
|
+
- **🔗 Sharing & Publishing** - Create share links and publish documents publicly
|
|
45
|
+
- **🪝 Hooks & Webhooks** - Configure event hooks and webhook integrations
|
|
46
|
+
- **🔌 Connector Management** - Integrate with external services (Google Drive, etc.)
|
|
47
|
+
- **🎯 Conflict Resolution** - Smart conflict detection with configurable resolution strategies
|
|
48
|
+
- **📊 Subscription Management** - View and manage subscription tiers and usage
|
|
49
|
+
- **🛡️ Admin Tools** - User management, system stats, and audit logs (admin only)
|
|
50
|
+
- **⚙️ Flexible Configuration** - Multiple profiles, environment variable support, and configurable sync behavior
|
|
51
|
+
- **🌐 Offline Support** - Work offline and sync when reconnected
|
|
52
|
+
- **📦 TypeScript SDK** - Built on `@lifestream-vault/sdk` with full type safety
|
|
53
|
+
|
|
54
|
+
## 📦 Installation
|
|
55
|
+
|
|
56
|
+
### Global Installation (Recommended)
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm install -g @lifestream-vault/cli
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
After installation, the `lsvault` command will be available globally:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
lsvault --help
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Local Installation (Project-Specific)
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm install @lifestream-vault/cli
|
|
72
|
+
|
|
73
|
+
# Run with npx
|
|
74
|
+
npx lsvault --help
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Build from Source
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
git clone https://github.com/lifestreamdynamics/lifestream-vault-cli.git
|
|
81
|
+
cd lifestream-vault-cli
|
|
82
|
+
npm install
|
|
83
|
+
npm run build
|
|
84
|
+
|
|
85
|
+
# Link globally
|
|
86
|
+
npm link
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 🚀 Quick Start
|
|
90
|
+
|
|
91
|
+
### 1. Authenticate
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Login with API key
|
|
95
|
+
lsvault auth login --api-key lsv_k_your_api_key_here
|
|
96
|
+
|
|
97
|
+
# Or login with email/password
|
|
98
|
+
lsvault auth login --email user@example.com
|
|
99
|
+
|
|
100
|
+
# Set a custom API URL (optional)
|
|
101
|
+
lsvault auth login --api-key lsv_k_your_key --api-url https://vault.example.com
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 2. List Your Vaults
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
lsvault vaults list
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 3. Clone a Vault Locally
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Initialize sync for a vault
|
|
114
|
+
lsvault sync init <vaultId> ~/Documents/my-vault
|
|
115
|
+
|
|
116
|
+
# Perform initial pull
|
|
117
|
+
lsvault sync pull <syncId>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 4. Enable Watch Mode
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Start daemon for automatic sync
|
|
124
|
+
lsvault sync daemon start
|
|
125
|
+
|
|
126
|
+
# Or watch manually with auto-sync enabled
|
|
127
|
+
lsvault sync watch <syncId>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 5. Search Documents
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Full-text search
|
|
134
|
+
lsvault search "project notes"
|
|
135
|
+
|
|
136
|
+
# Semantic search (AI-powered)
|
|
137
|
+
lsvault search semantic "how to deploy the app"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## 🔐 Authentication
|
|
141
|
+
|
|
142
|
+
The CLI supports two authentication methods:
|
|
143
|
+
|
|
144
|
+
### API Key Authentication
|
|
145
|
+
|
|
146
|
+
API keys are ideal for automation, scripts, and CI/CD pipelines:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
lsvault auth login --api-key lsv_k_your_api_key_here
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Create an API Key:**
|
|
153
|
+
```bash
|
|
154
|
+
lsvault keys create --name "CI/CD Pipeline" --scopes vaults:read,documents:read
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Email/Password Authentication
|
|
158
|
+
|
|
159
|
+
Email/password login provides access to all features and automatically manages JWT tokens:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
lsvault auth login --email user@example.com
|
|
163
|
+
# (prompts for password interactively)
|
|
164
|
+
|
|
165
|
+
# Or provide password inline (less secure)
|
|
166
|
+
lsvault auth login --email user@example.com --password your_password
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**Token Refresh:**
|
|
170
|
+
```bash
|
|
171
|
+
lsvault auth refresh
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Check Authentication Status
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
lsvault auth status
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Logout
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
lsvault auth logout
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## 📚 Commands Reference
|
|
187
|
+
|
|
188
|
+
### Authentication Commands
|
|
189
|
+
|
|
190
|
+
| Command | Description |
|
|
191
|
+
|---------|-------------|
|
|
192
|
+
| `lsvault auth login` | Authenticate with API key or email/password |
|
|
193
|
+
| `lsvault auth logout` | Clear all stored credentials |
|
|
194
|
+
| `lsvault auth refresh` | Refresh JWT access token |
|
|
195
|
+
| `lsvault auth status` | Show current authentication status |
|
|
196
|
+
| `lsvault auth whoami` | Display current user information |
|
|
197
|
+
| `lsvault auth migrate` | Migrate plaintext credentials to secure storage |
|
|
198
|
+
|
|
199
|
+
### Vault Commands
|
|
200
|
+
|
|
201
|
+
| Command | Description |
|
|
202
|
+
|---------|-------------|
|
|
203
|
+
| `lsvault vaults list` | List all accessible vaults |
|
|
204
|
+
| `lsvault vaults create` | Create a new vault |
|
|
205
|
+
| `lsvault vaults get <vaultId>` | Get vault details |
|
|
206
|
+
| `lsvault vaults update <vaultId>` | Update vault settings |
|
|
207
|
+
| `lsvault vaults delete <vaultId>` | Delete a vault |
|
|
208
|
+
| `lsvault vaults tree <vaultId>` | Display vault directory tree |
|
|
209
|
+
|
|
210
|
+
**Example:**
|
|
211
|
+
```bash
|
|
212
|
+
# Create a vault
|
|
213
|
+
lsvault vaults create --name "Work Notes" --description "Professional documentation"
|
|
214
|
+
|
|
215
|
+
# Get vault details
|
|
216
|
+
lsvault vaults get vault_abc123
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Document Commands
|
|
220
|
+
|
|
221
|
+
| Command | Description |
|
|
222
|
+
|---------|-------------|
|
|
223
|
+
| `lsvault docs list <vaultId>` | List all documents in a vault |
|
|
224
|
+
| `lsvault docs get <vaultId> <path>` | Get document content |
|
|
225
|
+
| `lsvault docs create <vaultId> <path>` | Create a new document |
|
|
226
|
+
| `lsvault docs update <vaultId> <path>` | Update a document |
|
|
227
|
+
| `lsvault docs delete <vaultId> <path>` | Delete a document |
|
|
228
|
+
|
|
229
|
+
**Example:**
|
|
230
|
+
```bash
|
|
231
|
+
# List documents
|
|
232
|
+
lsvault docs list vault_abc123
|
|
233
|
+
|
|
234
|
+
# Read a document (outputs to stdout)
|
|
235
|
+
lsvault docs get vault_abc123 /notes/meeting.md
|
|
236
|
+
|
|
237
|
+
# Create a document from file
|
|
238
|
+
lsvault docs create vault_abc123 /notes/new.md --file ~/draft.md
|
|
239
|
+
|
|
240
|
+
# Create with inline content
|
|
241
|
+
lsvault docs create vault_abc123 /notes/quick.md --content "# Quick Note\n\nThis is a test."
|
|
242
|
+
|
|
243
|
+
# Update a document
|
|
244
|
+
lsvault docs update vault_abc123 /notes/meeting.md --file ~/updated.md
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Sync Commands
|
|
248
|
+
|
|
249
|
+
| Command | Description |
|
|
250
|
+
|---------|-------------|
|
|
251
|
+
| `lsvault sync init <vaultId> <localPath>` | Initialize sync configuration |
|
|
252
|
+
| `lsvault sync list` | List all sync configurations |
|
|
253
|
+
| `lsvault sync status <syncId>` | Show sync status and statistics |
|
|
254
|
+
| `lsvault sync pull <syncId>` | Pull remote changes to local |
|
|
255
|
+
| `lsvault sync push <syncId>` | Push local changes to remote |
|
|
256
|
+
| `lsvault sync watch <syncId>` | Watch for changes and auto-sync |
|
|
257
|
+
| `lsvault sync daemon start` | Start background sync daemon |
|
|
258
|
+
| `lsvault sync daemon stop` | Stop background sync daemon |
|
|
259
|
+
| `lsvault sync daemon status` | Check daemon status |
|
|
260
|
+
| `lsvault sync delete <syncId>` | Remove sync configuration |
|
|
261
|
+
|
|
262
|
+
**Example:**
|
|
263
|
+
```bash
|
|
264
|
+
# Initialize sync with custom options
|
|
265
|
+
lsvault sync init vault_abc123 ~/my-vault \
|
|
266
|
+
--mode sync \
|
|
267
|
+
--on-conflict newer \
|
|
268
|
+
--ignore ".git/**" "*.tmp" \
|
|
269
|
+
--auto-sync \
|
|
270
|
+
--interval 5m
|
|
271
|
+
|
|
272
|
+
# Perform one-time pull
|
|
273
|
+
lsvault sync pull sync_xyz789
|
|
274
|
+
|
|
275
|
+
# Watch and sync automatically
|
|
276
|
+
lsvault sync watch sync_xyz789
|
|
277
|
+
|
|
278
|
+
# Start daemon for all syncs
|
|
279
|
+
lsvault sync daemon start
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Search Commands
|
|
283
|
+
|
|
284
|
+
| Command | Description |
|
|
285
|
+
|---------|-------------|
|
|
286
|
+
| `lsvault search <query>` | Full-text search across all documents |
|
|
287
|
+
| `lsvault search semantic <query>` | Semantic search using AI embeddings |
|
|
288
|
+
|
|
289
|
+
**Example:**
|
|
290
|
+
```bash
|
|
291
|
+
# Full-text search
|
|
292
|
+
lsvault search "project timeline" --vault vault_abc123
|
|
293
|
+
|
|
294
|
+
# Semantic search
|
|
295
|
+
lsvault search semantic "explain the deployment process"
|
|
296
|
+
|
|
297
|
+
# Search with filters
|
|
298
|
+
lsvault search "meeting" --tags work,urgent --limit 10
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Team Commands
|
|
302
|
+
|
|
303
|
+
| Command | Description |
|
|
304
|
+
|---------|-------------|
|
|
305
|
+
| `lsvault teams list` | List all teams |
|
|
306
|
+
| `lsvault teams create` | Create a new team |
|
|
307
|
+
| `lsvault teams get <teamId>` | Get team details |
|
|
308
|
+
| `lsvault teams update <teamId>` | Update team settings |
|
|
309
|
+
| `lsvault teams delete <teamId>` | Delete a team |
|
|
310
|
+
| `lsvault teams members <teamId>` | List team members |
|
|
311
|
+
| `lsvault teams invite <teamId>` | Invite user to team |
|
|
312
|
+
| `lsvault teams remove <teamId> <userId>` | Remove member from team |
|
|
313
|
+
|
|
314
|
+
**Example:**
|
|
315
|
+
```bash
|
|
316
|
+
# Create a team
|
|
317
|
+
lsvault teams create --name "Engineering" --description "Dev team workspace"
|
|
318
|
+
|
|
319
|
+
# Invite a member
|
|
320
|
+
lsvault teams invite team_abc123 --email engineer@example.com --role member
|
|
321
|
+
|
|
322
|
+
# List members
|
|
323
|
+
lsvault teams members team_abc123
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Sharing & Publishing
|
|
327
|
+
|
|
328
|
+
| Command | Description |
|
|
329
|
+
|---------|-------------|
|
|
330
|
+
| `lsvault shares list` | List all share links |
|
|
331
|
+
| `lsvault shares create <vaultId> <path>` | Create a share link for a document |
|
|
332
|
+
| `lsvault shares revoke <shareId>` | Revoke a share link |
|
|
333
|
+
| `lsvault publish list` | List published documents |
|
|
334
|
+
| `lsvault publish create <vaultId> <path>` | Publish a document publicly |
|
|
335
|
+
| `lsvault publish unpublish <publishId>` | Unpublish a document |
|
|
336
|
+
|
|
337
|
+
**Example:**
|
|
338
|
+
```bash
|
|
339
|
+
# Create a password-protected share link
|
|
340
|
+
lsvault shares create vault_abc123 /reports/Q1.md \
|
|
341
|
+
--password secret123 \
|
|
342
|
+
--expires-in 7d
|
|
343
|
+
|
|
344
|
+
# Publish a document
|
|
345
|
+
lsvault publish create vault_abc123 /blog/post.md --slug my-first-post
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### Hooks & Webhooks
|
|
349
|
+
|
|
350
|
+
| Command | Description |
|
|
351
|
+
|---------|-------------|
|
|
352
|
+
| `lsvault hooks list <vaultId>` | List vault hooks |
|
|
353
|
+
| `lsvault hooks create <vaultId>` | Create a new hook |
|
|
354
|
+
| `lsvault hooks update <hookId>` | Update hook configuration |
|
|
355
|
+
| `lsvault hooks delete <hookId>` | Delete a hook |
|
|
356
|
+
| `lsvault webhooks list` | List all webhooks |
|
|
357
|
+
| `lsvault webhooks create` | Create a new webhook |
|
|
358
|
+
| `lsvault webhooks update <webhookId>` | Update webhook configuration |
|
|
359
|
+
| `lsvault webhooks delete <webhookId>` | Delete a webhook |
|
|
360
|
+
|
|
361
|
+
**Example:**
|
|
362
|
+
```bash
|
|
363
|
+
# Create an auto-tag hook
|
|
364
|
+
lsvault hooks create vault_abc123 \
|
|
365
|
+
--type auto-tag \
|
|
366
|
+
--config '{"patterns":{"meeting":"#meeting"}}'
|
|
367
|
+
|
|
368
|
+
# Create a webhook for document updates
|
|
369
|
+
lsvault webhooks create \
|
|
370
|
+
--url https://api.example.com/webhook \
|
|
371
|
+
--events document.created,document.updated \
|
|
372
|
+
--secret webhook_secret_key
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### Admin Commands
|
|
376
|
+
|
|
377
|
+
**Note:** Admin commands require admin role.
|
|
378
|
+
|
|
379
|
+
| Command | Description |
|
|
380
|
+
|---------|-------------|
|
|
381
|
+
| `lsvault admin users list` | List all users |
|
|
382
|
+
| `lsvault admin users get <userId>` | Get user details |
|
|
383
|
+
| `lsvault admin users update <userId>` | Update user settings |
|
|
384
|
+
| `lsvault admin users delete <userId>` | Delete a user |
|
|
385
|
+
| `lsvault admin stats` | View system statistics |
|
|
386
|
+
| `lsvault audit logs` | View audit logs |
|
|
387
|
+
|
|
388
|
+
**Example:**
|
|
389
|
+
```bash
|
|
390
|
+
# List all users (admin only)
|
|
391
|
+
lsvault admin users list
|
|
392
|
+
|
|
393
|
+
# View system stats
|
|
394
|
+
lsvault admin stats
|
|
395
|
+
|
|
396
|
+
# View audit logs
|
|
397
|
+
lsvault audit logs --limit 100 --filter-action document.created
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
## 🔄 Sync & Watch Mode
|
|
401
|
+
|
|
402
|
+
The CLI provides powerful sync capabilities with real-time file watching.
|
|
403
|
+
|
|
404
|
+
### Sync Modes
|
|
405
|
+
|
|
406
|
+
- **`pull`** - Only download remote changes (one-way from server)
|
|
407
|
+
- **`push`** - Only upload local changes (one-way to server)
|
|
408
|
+
- **`sync`** - Bidirectional sync (default)
|
|
409
|
+
|
|
410
|
+
### Conflict Resolution Strategies
|
|
411
|
+
|
|
412
|
+
When the same file is modified both locally and remotely, the CLI uses a conflict resolution strategy:
|
|
413
|
+
|
|
414
|
+
- **`newer`** - Keep the newer version (based on modification time) - **default**
|
|
415
|
+
- **`local`** - Always prefer local version
|
|
416
|
+
- **`remote`** - Always prefer remote version
|
|
417
|
+
- **`ask`** - Prompt the user to choose (interactive mode)
|
|
418
|
+
|
|
419
|
+
### Watch Mode
|
|
420
|
+
|
|
421
|
+
Watch mode continuously monitors the local directory for changes and automatically syncs:
|
|
422
|
+
|
|
423
|
+
```bash
|
|
424
|
+
# Watch with default settings
|
|
425
|
+
lsvault sync watch sync_xyz789
|
|
426
|
+
|
|
427
|
+
# Watch with custom interval
|
|
428
|
+
lsvault sync init vault_abc123 ~/my-vault \
|
|
429
|
+
--auto-sync \
|
|
430
|
+
--interval 2m
|
|
431
|
+
lsvault sync watch sync_xyz789
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
**How it works:**
|
|
435
|
+
1. Monitors local file changes using `chokidar`
|
|
436
|
+
2. Debounces changes (500ms) to avoid excessive syncs
|
|
437
|
+
3. Automatically syncs when changes are detected
|
|
438
|
+
4. Polls remote for changes at configurable intervals
|
|
439
|
+
5. Handles conflicts using the configured strategy
|
|
440
|
+
|
|
441
|
+
### Background Daemon
|
|
442
|
+
|
|
443
|
+
Run sync in the background across all configured vaults:
|
|
444
|
+
|
|
445
|
+
```bash
|
|
446
|
+
# Start daemon
|
|
447
|
+
lsvault sync daemon start
|
|
448
|
+
|
|
449
|
+
# Check daemon status
|
|
450
|
+
lsvault sync daemon status
|
|
451
|
+
|
|
452
|
+
# Stop daemon
|
|
453
|
+
lsvault sync daemon stop
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
The daemon runs as a background process and syncs all configured vaults with `autoSync` enabled.
|
|
457
|
+
|
|
458
|
+
### Ignore Patterns
|
|
459
|
+
|
|
460
|
+
Exclude files from sync using glob patterns:
|
|
461
|
+
|
|
462
|
+
```bash
|
|
463
|
+
lsvault sync init vault_abc123 ~/my-vault \
|
|
464
|
+
--ignore ".git/**" "*.tmp" "node_modules/**" ".DS_Store"
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
Patterns use [minimatch](https://github.com/isaacs/minimatch) syntax.
|
|
468
|
+
|
|
469
|
+
## ⚙️ Configuration
|
|
470
|
+
|
|
471
|
+
### Configuration File
|
|
472
|
+
|
|
473
|
+
The CLI stores configuration in `~/.lsvault/config.json`:
|
|
474
|
+
|
|
475
|
+
```json
|
|
476
|
+
{
|
|
477
|
+
"apiUrl": "http://localhost:4660"
|
|
478
|
+
}
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
**Note:** Credentials are stored securely in the system keychain (or encrypted file fallback), not in the plaintext config file.
|
|
482
|
+
|
|
483
|
+
### Configuration Profiles
|
|
484
|
+
|
|
485
|
+
Manage multiple configurations with profiles:
|
|
486
|
+
|
|
487
|
+
```bash
|
|
488
|
+
# List profiles
|
|
489
|
+
lsvault config profiles
|
|
490
|
+
|
|
491
|
+
# Create a profile
|
|
492
|
+
lsvault config create-profile production --api-url https://vault.example.com
|
|
493
|
+
|
|
494
|
+
# Switch profiles
|
|
495
|
+
lsvault config use production
|
|
496
|
+
|
|
497
|
+
# Set config values
|
|
498
|
+
lsvault config set apiUrl https://vault.example.com
|
|
499
|
+
|
|
500
|
+
# Get config values
|
|
501
|
+
lsvault config get apiUrl
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
### Sync Configuration
|
|
505
|
+
|
|
506
|
+
Sync configurations are stored per vault in `~/.lsvault/sync/`:
|
|
507
|
+
|
|
508
|
+
```json
|
|
509
|
+
{
|
|
510
|
+
"id": "sync_abc123",
|
|
511
|
+
"vaultId": "vault_xyz789",
|
|
512
|
+
"localPath": "/home/user/my-vault",
|
|
513
|
+
"mode": "sync",
|
|
514
|
+
"onConflict": "newer",
|
|
515
|
+
"ignore": [".git/**", "*.tmp"],
|
|
516
|
+
"autoSync": true,
|
|
517
|
+
"syncInterval": "5m"
|
|
518
|
+
}
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
## 🌍 Environment Variables
|
|
522
|
+
|
|
523
|
+
| Variable | Description | Default |
|
|
524
|
+
|----------|-------------|---------|
|
|
525
|
+
| `LSVAULT_API_URL` | API server base URL | `http://localhost:4660` |
|
|
526
|
+
| `LSVAULT_API_KEY` | API key for authentication | - |
|
|
527
|
+
| `LSVAULT_CONFIG_DIR` | Configuration directory | `~/.lsvault` |
|
|
528
|
+
| `LSVAULT_PROFILE` | Active configuration profile | `default` |
|
|
529
|
+
|
|
530
|
+
**Example:**
|
|
531
|
+
```bash
|
|
532
|
+
export LSVAULT_API_URL=https://vault.example.com
|
|
533
|
+
export LSVAULT_API_KEY=lsv_k_your_key_here
|
|
534
|
+
lsvault vaults list
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
## 🔒 Credential Storage
|
|
538
|
+
|
|
539
|
+
The CLI uses secure credential storage with automatic fallback:
|
|
540
|
+
|
|
541
|
+
### Storage Methods (Priority Order)
|
|
542
|
+
|
|
543
|
+
1. **System Keychain** (macOS Keychain, Windows Credential Manager, Linux Secret Service)
|
|
544
|
+
- Most secure option
|
|
545
|
+
- Requires optional `keytar` dependency
|
|
546
|
+
- Used automatically if available
|
|
547
|
+
|
|
548
|
+
2. **Encrypted Config File** (`~/.lsvault/encrypted-config.json`)
|
|
549
|
+
- AES-256-GCM encryption
|
|
550
|
+
- Password-protected
|
|
551
|
+
- Fallback when keychain unavailable
|
|
552
|
+
|
|
553
|
+
3. **Plaintext Config** (`~/.lsvault/config.json`) - **Deprecated**
|
|
554
|
+
- Legacy storage method
|
|
555
|
+
- Automatically migrated to secure storage
|
|
556
|
+
- Not recommended for production use
|
|
557
|
+
|
|
558
|
+
### Migration
|
|
559
|
+
|
|
560
|
+
Migrate existing plaintext credentials to secure storage:
|
|
561
|
+
|
|
562
|
+
```bash
|
|
563
|
+
lsvault auth migrate
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
The CLI will automatically prompt for migration when plaintext credentials are detected.
|
|
567
|
+
|
|
568
|
+
### Check Storage Method
|
|
569
|
+
|
|
570
|
+
```bash
|
|
571
|
+
lsvault auth status
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
Output includes current storage method:
|
|
575
|
+
```
|
|
576
|
+
Storage Method: keychain (macOS Keychain)
|
|
577
|
+
Auth Type: JWT Token
|
|
578
|
+
Status: ✓ Authenticated
|
|
579
|
+
User: user@example.com
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
## 📖 Examples
|
|
583
|
+
|
|
584
|
+
### Complete Workflow: Clone and Sync a Vault
|
|
585
|
+
|
|
586
|
+
```bash
|
|
587
|
+
# 1. Login
|
|
588
|
+
lsvault auth login --email user@example.com
|
|
589
|
+
|
|
590
|
+
# 2. List available vaults
|
|
591
|
+
lsvault vaults list
|
|
592
|
+
|
|
593
|
+
# 3. Initialize sync
|
|
594
|
+
lsvault sync init vault_abc123 ~/Documents/work-notes \
|
|
595
|
+
--mode sync \
|
|
596
|
+
--on-conflict newer \
|
|
597
|
+
--auto-sync \
|
|
598
|
+
--interval 5m
|
|
599
|
+
|
|
600
|
+
# 4. Perform initial sync
|
|
601
|
+
lsvault sync pull sync_xyz789
|
|
602
|
+
|
|
603
|
+
# 5. Start watching for changes
|
|
604
|
+
lsvault sync watch sync_xyz789
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
### Search and Share Workflow
|
|
608
|
+
|
|
609
|
+
```bash
|
|
610
|
+
# Search for documents
|
|
611
|
+
lsvault search "quarterly report" --vault vault_abc123 --json
|
|
612
|
+
|
|
613
|
+
# Create a share link for the found document
|
|
614
|
+
lsvault shares create vault_abc123 /reports/Q4-2025.md \
|
|
615
|
+
--password secure123 \
|
|
616
|
+
--expires-in 30d
|
|
617
|
+
|
|
618
|
+
# Publish a document publicly
|
|
619
|
+
lsvault publish create vault_abc123 /blog/announcement.md \
|
|
620
|
+
--slug new-features-2026
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
### Team Collaboration Workflow
|
|
624
|
+
|
|
625
|
+
```bash
|
|
626
|
+
# Create a team
|
|
627
|
+
lsvault teams create --name "Product Team" --description "Product docs"
|
|
628
|
+
|
|
629
|
+
# Create a shared vault
|
|
630
|
+
lsvault vaults create --name "Product Docs" --team team_abc123
|
|
631
|
+
|
|
632
|
+
# Invite team members
|
|
633
|
+
lsvault teams invite team_abc123 --email pm@example.com --role admin
|
|
634
|
+
lsvault teams invite team_abc123 --email dev@example.com --role member
|
|
635
|
+
|
|
636
|
+
# Configure webhook for team updates
|
|
637
|
+
lsvault webhooks create \
|
|
638
|
+
--url https://slack.example.com/webhook \
|
|
639
|
+
--events document.created,document.updated \
|
|
640
|
+
--filter '{"vaultId":"vault_xyz789"}'
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
### Automation with API Keys
|
|
644
|
+
|
|
645
|
+
```bash
|
|
646
|
+
# Create a read-only API key for monitoring
|
|
647
|
+
lsvault keys create \
|
|
648
|
+
--name "Monitoring Script" \
|
|
649
|
+
--scopes vaults:read,documents:read \
|
|
650
|
+
--expires-in 90d
|
|
651
|
+
|
|
652
|
+
# Use API key in scripts
|
|
653
|
+
export LSVAULT_API_KEY=lsv_k_generated_key
|
|
654
|
+
lsvault vaults list --json | jq '.[] | .name'
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
## 🐛 Troubleshooting
|
|
658
|
+
|
|
659
|
+
### Authentication Issues
|
|
660
|
+
|
|
661
|
+
**Problem:** `Authentication failed` error
|
|
662
|
+
|
|
663
|
+
**Solutions:**
|
|
664
|
+
1. Verify credentials are correct
|
|
665
|
+
2. Check API URL is accessible: `curl <API_URL>/api/v1/health`
|
|
666
|
+
3. Refresh JWT token: `lsvault auth refresh`
|
|
667
|
+
4. Re-login: `lsvault auth logout && lsvault auth login --email user@example.com`
|
|
668
|
+
|
|
669
|
+
### Sync Issues
|
|
670
|
+
|
|
671
|
+
**Problem:** Sync not detecting changes
|
|
672
|
+
|
|
673
|
+
**Solutions:**
|
|
674
|
+
1. Check sync status: `lsvault sync status <syncId>`
|
|
675
|
+
2. Verify file paths are correct
|
|
676
|
+
3. Check ignore patterns aren't excluding files
|
|
677
|
+
4. Manually trigger sync: `lsvault sync pull <syncId>`
|
|
678
|
+
5. Restart watch mode
|
|
679
|
+
|
|
680
|
+
**Problem:** Sync conflicts
|
|
681
|
+
|
|
682
|
+
**Solutions:**
|
|
683
|
+
1. Review conflict strategy: `lsvault sync status <syncId>`
|
|
684
|
+
2. Change conflict resolution: `lsvault sync init <vaultId> <path> --on-conflict ask`
|
|
685
|
+
3. Manually resolve conflicts and re-sync
|
|
686
|
+
|
|
687
|
+
### Credential Storage Issues
|
|
688
|
+
|
|
689
|
+
**Problem:** `keytar` not available
|
|
690
|
+
|
|
691
|
+
**Solution:** The CLI automatically falls back to encrypted config. Install optional dependency for keychain support:
|
|
692
|
+
```bash
|
|
693
|
+
npm install -g keytar
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
**Problem:** Need to migrate plaintext credentials
|
|
697
|
+
|
|
698
|
+
**Solution:**
|
|
699
|
+
```bash
|
|
700
|
+
lsvault auth migrate
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
### Daemon Issues
|
|
704
|
+
|
|
705
|
+
**Problem:** Daemon won't start
|
|
706
|
+
|
|
707
|
+
**Solutions:**
|
|
708
|
+
1. Check if daemon is already running: `lsvault sync daemon status`
|
|
709
|
+
2. Stop existing daemon: `lsvault sync daemon stop`
|
|
710
|
+
3. Check logs: `cat ~/.lsvault/daemon/daemon.log`
|
|
711
|
+
4. Verify sync configs have `autoSync: true`
|
|
712
|
+
|
|
713
|
+
### Network Issues
|
|
714
|
+
|
|
715
|
+
**Problem:** Connection timeouts
|
|
716
|
+
|
|
717
|
+
**Solutions:**
|
|
718
|
+
1. Verify API URL is correct: `lsvault config get apiUrl`
|
|
719
|
+
2. Test connectivity: `curl <API_URL>/api/v1/health`
|
|
720
|
+
3. Check firewall/proxy settings
|
|
721
|
+
4. Use custom API URL: `lsvault auth login --api-url https://vault.example.com`
|
|
722
|
+
|
|
723
|
+
### Output Format Issues
|
|
724
|
+
|
|
725
|
+
**Problem:** Need machine-readable output
|
|
726
|
+
|
|
727
|
+
**Solution:** Use `--json` or `--quiet` flags:
|
|
728
|
+
```bash
|
|
729
|
+
lsvault vaults list --json
|
|
730
|
+
lsvault search "query" --json | jq '.[] | .path'
|
|
731
|
+
lsvault docs get vault_abc123 /path.md --quiet > output.md
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
## 🔗 Related Packages
|
|
735
|
+
|
|
736
|
+
- **[@lifestream-vault/sdk](https://npmjs.com/package/@lifestream-vault/sdk)** - TypeScript SDK for Lifestream Vault API
|
|
737
|
+
- **[@lifestream-vault/api](https://github.com/lifestreamdynamics/lifestream-vault)** - Backend API server
|
|
738
|
+
- **[@lifestream-vault/web](https://github.com/lifestreamdynamics/lifestream-vault)** - Web frontend
|
|
739
|
+
|
|
740
|
+
## 📄 Documentation
|
|
741
|
+
|
|
742
|
+
- **Full Documentation**: [vault.lifestreamdynamics.com/docs](https://vault.lifestreamdynamics.com/docs)
|
|
743
|
+
- **API Reference**: [vault.lifestreamdynamics.com/docs/api](https://vault.lifestreamdynamics.com/docs/api)
|
|
744
|
+
- **SDK Documentation**: [vault.lifestreamdynamics.com/docs/sdk](https://vault.lifestreamdynamics.com/docs/sdk)
|
|
745
|
+
- **WebDAV Setup**: [vault.lifestreamdynamics.com/docs/webdav](https://vault.lifestreamdynamics.com/docs/webdav)
|
|
746
|
+
|
|
747
|
+
## 💬 Support
|
|
748
|
+
|
|
749
|
+
- **GitHub Issues**: [Report bugs or request features](https://github.com/lifestreamdynamics/lifestream-vault-cli/issues)
|
|
750
|
+
- **Documentation**: [vault.lifestreamdynamics.com/docs](https://vault.lifestreamdynamics.com/docs)
|
|
751
|
+
- **Email**: eric@lifestreamdynamics.com
|
|
752
|
+
|
|
753
|
+
## 📄 License
|
|
754
|
+
|
|
755
|
+
MIT License - see [LICENSE](./LICENSE) file for details.
|
|
756
|
+
|
|
757
|
+
---
|
|
758
|
+
|
|
759
|
+
**Built with ❤️ by [Lifestream Dynamics](https://lifestreamdynamics.com)**
|