@jive-ai/cli 0.0.25 → 0.0.30

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/docs/sync.md DELETED
@@ -1,673 +0,0 @@
1
- # Synchronization Commands
2
-
3
- Synchronization commands help you keep your local project resources in sync with your team's shared resources on the Jive platform.
4
-
5
- ## Overview
6
-
7
- Jive provides commands to:
8
- - Synchronize all team resources (subagents and MCP servers) to your local project
9
- - Check the sync status of your project
10
- - View which team you're currently working with
11
-
12
- ## Commands
13
-
14
- ### `jive sync`
15
-
16
- Synchronize all resources between your local project and the team.
17
-
18
- **Usage:**
19
- ```bash
20
- jive sync [--dry-run]
21
- ```
22
-
23
- **Options:**
24
- - `--dry-run` - Show what would be changed without making changes (not fully implemented)
25
-
26
- **Requirements:**
27
- - Must be authenticated
28
- - Must be in a Jive-initialized project (has active team)
29
-
30
- **Process:**
31
- 1. **Pull subagents:**
32
- - Downloads all team subagents to `.claude/agents/`
33
- - Skips files that already exist locally (no overwrite)
34
- - Adds `jive-id` to frontmatter for tracking
35
-
36
- 2. **Pull MCP servers:**
37
- - Downloads all team MCP servers to `.mcp.json`
38
- - Merges with local servers (preserves local-only servers)
39
- - Creates backup at `.mcp.json.backup`
40
-
41
- 3. **Update sync metadata:**
42
- - Updates `.jive/sync.json` with sync timestamp
43
- - Records last sync time
44
-
45
- **Output:**
46
- ```bash
47
- jive sync
48
- ```
49
- ```
50
- Synchronizing with team 'My Team'...
51
-
52
- Pulling subagents...
53
- ✓ code-reviewer.md
54
- ✓ bug-fixer.md
55
- ⊘ test-writer.md (already exists)
56
-
57
- Pulling MCP servers...
58
- Creating backup: .mcp.json.backup
59
- ✓ weather-api
60
- ✓ file-system
61
- ✓ database
62
-
63
- Sync complete!
64
-
65
- Summary:
66
- - Downloaded 2 subagents, skipped 1
67
- - Merged 3 MCP servers
68
- - Last sync: 2025-01-15 10:30:00
69
-
70
- Next steps:
71
- 1. Restart Claude Code to apply changes
72
- 2. Review new subagents in .claude/agents/
73
- 3. Check updated .mcp.json configuration
74
- ```
75
-
76
- **What Gets Synced:**
77
-
78
- | Resource | Action | Notes |
79
- |----------|--------|-------|
80
- | Subagents | Pull | Skips existing files |
81
- | MCP Servers | Pull with merge | Preserves local-only servers |
82
- | jive-mcp server | Preserved | Never overwritten |
83
- | Local-only subagents | Preserved | Without `jive-id` |
84
-
85
- **Sync Metadata:**
86
-
87
- After sync, `.jive/sync.json` is updated:
88
- ```json
89
- {
90
- "lastSync": "2025-01-15T10:30:00.000Z",
91
- "subagents": {
92
- "code-reviewer": {
93
- "lastModified": "2025-01-14T15:20:00.000Z",
94
- "jiveId": "sub-123"
95
- }
96
- },
97
- "mcpServers": {
98
- "weather-api": {
99
- "lastModified": "2025-01-14T12:00:00.000Z",
100
- "jiveId": "mcp-456"
101
- }
102
- }
103
- }
104
- ```
105
-
106
- **Notes:**
107
- - Safe to run multiple times (idempotent)
108
- - Won't overwrite local changes to existing subagents
109
- - Use `jive subagents pull --overwrite` for force update
110
- - Use `jive mcp pull` (without merge) for full replacement
111
- - Restart Claude Code after sync to apply MCP server changes
112
-
113
- **Use Cases:**
114
- - Getting latest team resources after joining a project
115
- - Updating to newest versions shared by team
116
- - Daily sync to stay current with team
117
- - After switching teams to get new team's resources
118
-
119
- **Error Conditions:**
120
- - Not authenticated
121
- - Project not initialized
122
- - Network connectivity issues
123
- - File system permission errors
124
-
125
- **Implementation:** `src/commands/sync.ts` (syncCommand)
126
-
127
- ---
128
-
129
- ### `jive status`
130
-
131
- Show the sync status of your local project.
132
-
133
- **Usage:**
134
- ```bash
135
- jive status
136
- ```
137
-
138
- **Requirements:**
139
- - Must be in a Jive-initialized project
140
-
141
- **Process:**
142
- 1. Reads `.jive/config.json` for active team
143
- 2. Reads `.jive/sync.json` for sync metadata
144
- 3. Displays project status information
145
-
146
- **Output:**
147
- ```bash
148
- jive status
149
- ```
150
- ```
151
- Jive Project Status
152
-
153
- Active Team: My Team (team-abc123)
154
- Last Sync: 2025-01-15 10:30:00 (2 hours ago)
155
-
156
- To view team resources:
157
- - Subagents: jive subagents list
158
- - MCP Servers: jive mcp list
159
-
160
- To sync latest changes:
161
- - jive sync
162
- ```
163
-
164
- **Detailed Status Information:**
165
-
166
- The status command shows:
167
- - **Active Team:** Which team this project is connected to
168
- - **Team ID:** Unique identifier for the team
169
- - **Last Sync:** When resources were last synced with the team
170
- - **Time Ago:** Relative time since last sync (e.g., "2 hours ago")
171
-
172
- **Suggested Commands:**
173
-
174
- Based on status, the command suggests:
175
- - `jive subagents list` - View team subagents
176
- - `jive mcp list` - View team MCP servers
177
- - `jive sync` - Sync latest changes
178
- - `jive team switch` - Switch to different team
179
-
180
- **Notes:**
181
- - Read-only command (doesn't modify anything)
182
- - Helps you understand current project state
183
- - Quick way to check which team you're working with
184
- - Shows when you last synced
185
-
186
- **Error Conditions:**
187
- - Project not initialized (displays "Project not initialized")
188
- - Missing config files (displays "Configuration missing")
189
-
190
- **Implementation:** `src/commands/sync.ts` (statusCommand)
191
-
192
- ---
193
-
194
- ## Synchronization Workflows
195
-
196
- ### Initial Project Setup
197
-
198
- **New team member joins:**
199
-
200
- 1. **Authenticate:**
201
- ```bash
202
- jive login
203
- ```
204
-
205
- 2. **Initialize project:**
206
- ```bash
207
- cd project-directory
208
- jive init
209
- ```
210
- Select the team when prompted.
211
-
212
- 3. **Sync team resources:**
213
- ```bash
214
- jive sync
215
- ```
216
-
217
- 4. **Check status:**
218
- ```bash
219
- jive status
220
- ```
221
-
222
- 5. **Restart Claude Code**
223
-
224
- ### Daily Workflow
225
-
226
- **Start of day:**
227
-
228
- 1. **Check status:**
229
- ```bash
230
- jive status
231
- ```
232
-
233
- 2. **Sync latest changes:**
234
- ```bash
235
- jive sync
236
- ```
237
-
238
- 3. **Restart Claude Code** (if MCP servers changed)
239
-
240
- **During work:**
241
-
242
- 1. **Create/modify resources locally**
243
- 2. **Push changes to team:**
244
- ```bash
245
- jive subagents push
246
- jive mcp push
247
- ```
248
-
249
- **End of day:**
250
-
251
- 1. **Final sync:**
252
- ```bash
253
- jive sync
254
- ```
255
-
256
- ### Switching Teams
257
-
258
- **Change to different team:**
259
-
260
- 1. **Check current status:**
261
- ```bash
262
- jive status
263
- ```
264
-
265
- 2. **Switch team:**
266
- ```bash
267
- jive team switch
268
- ```
269
-
270
- 3. **Sync new team's resources:**
271
- ```bash
272
- jive sync
273
- ```
274
-
275
- 4. **Verify new status:**
276
- ```bash
277
- jive status
278
- ```
279
-
280
- 5. **Restart Claude Code**
281
-
282
- ### Handling Conflicts
283
-
284
- **Local changes vs team changes:**
285
-
286
- **Scenario:** You modified `code-reviewer.md` locally, team also updated it.
287
-
288
- **Approach 1: Keep local changes**
289
- ```bash
290
- # Don't sync (local version remains)
291
- # Push your version to team
292
- jive subagents push -m "My improvements"
293
- ```
294
-
295
- **Approach 2: Get team changes**
296
- ```bash
297
- # Backup local version
298
- cp .claude/agents/code-reviewer.md .claude/agents/code-reviewer.md.backup
299
-
300
- # Force pull team version
301
- jive subagents pull --overwrite
302
-
303
- # Manually merge changes
304
- # Edit code-reviewer.md to combine both versions
305
-
306
- # Push merged version
307
- jive subagents push -m "Merged team updates with local changes"
308
- ```
309
-
310
- **Approach 3: Keep both versions**
311
- ```bash
312
- # Rename local version
313
- mv .claude/agents/code-reviewer.md .claude/agents/code-reviewer-v2.md
314
-
315
- # Pull team version
316
- jive subagents pull
317
-
318
- # Now you have both:
319
- # - code-reviewer.md (team version)
320
- # - code-reviewer-v2.md (your version)
321
-
322
- # Push your version as new subagent
323
- jive subagents push
324
- ```
325
-
326
- ## Sync Strategies
327
-
328
- ### Conservative Sync (Preserve Local)
329
-
330
- **Goal:** Keep all local changes, get new team resources only
331
-
332
- ```bash
333
- # Sync without overwriting
334
- jive sync
335
-
336
- # Or manually:
337
- jive subagents pull # Skips existing
338
- jive mcp pull --merge # Merges with local
339
- ```
340
-
341
- **Best for:**
342
- - Active development with local changes
343
- - Testing local modifications
344
- - Paranoid about losing work
345
-
346
- ### Aggressive Sync (Match Team)
347
-
348
- **Goal:** Make local identical to team
349
-
350
- ```bash
351
- # Full overwrite
352
- jive subagents pull --overwrite
353
- jive mcp pull # Replace (no --merge)
354
-
355
- # Or detach and re-init:
356
- jive detach
357
- jive init
358
- jive sync
359
- ```
360
-
361
- **Best for:**
362
- - Fresh start with team resources
363
- - Fixing corrupted local state
364
- - New team member setup
365
-
366
- ### Selective Sync
367
-
368
- **Goal:** Sync specific resources only
369
-
370
- ```bash
371
- # Just subagents
372
- jive subagents pull
373
-
374
- # Just MCP servers
375
- jive mcp pull
376
-
377
- # Specific subagent (pull then overwrite)
378
- jive subagents pull --overwrite
379
- # (affects all subagents currently)
380
- ```
381
-
382
- **Best for:**
383
- - Updating one resource type
384
- - Bandwidth-conscious environments
385
- - Incremental updates
386
-
387
- ## Sync State Management
388
-
389
- ### .jive/sync.json
390
-
391
- **Purpose:** Tracks local sync state
392
-
393
- ```json
394
- {
395
- "lastSync": "2025-01-15T10:30:00.000Z",
396
- "subagents": {
397
- "code-reviewer": {
398
- "lastModified": "2025-01-14T15:20:00.000Z",
399
- "jiveId": "sub-123",
400
- "hash": "abc123..."
401
- },
402
- "local-only-agent": {
403
- "lastModified": "2025-01-15T09:00:00.000Z"
404
- // No jiveId - local-only
405
- }
406
- },
407
- "mcpServers": {
408
- "weather-api": {
409
- "lastModified": "2025-01-14T12:00:00.000Z",
410
- "jiveId": "mcp-456"
411
- }
412
- }
413
- }
414
- ```
415
-
416
- **Fields:**
417
- - `lastSync` - Timestamp of last successful sync
418
- - `jiveId` - Platform ID (indicates synced resource)
419
- - `lastModified` - When resource was last changed
420
- - `hash` - Content hash for change detection (future)
421
-
422
- **Notes:**
423
- - Should be in `.gitignore` (local state only)
424
- - Automatically updated by sync commands
425
- - Used to detect changes and conflicts
426
-
427
- ### Frontmatter jive-id
428
-
429
- **Subagent tracking:**
430
-
431
- ```markdown
432
- ---
433
- name: code-reviewer
434
- description: Reviews code
435
- jive-id: "sub-123"
436
- ---
437
-
438
- Prompt content...
439
- ```
440
-
441
- **Purpose:**
442
- - Links local file to team resource
443
- - Enables updates instead of duplicates
444
- - Tracks which files are synced
445
-
446
- **Behavior:**
447
- - **With `jive-id`:** `jive subagents push` updates existing
448
- - **Without `jive-id`:** `jive subagents push` creates new
449
- - Added automatically by `jive init` and `jive subagents pull`
450
-
451
- ## Automation
452
-
453
- ### Git Hooks
454
-
455
- **Pre-commit hook:**
456
- ```bash
457
- #!/bin/bash
458
- # .git/hooks/pre-commit
459
-
460
- # Check if team resources are out of sync
461
- if jive status | grep -q "Last Sync.*days ago"; then
462
- echo "Warning: Team resources not synced recently"
463
- echo "Run 'jive sync' to update"
464
- # Don't block commit, just warn
465
- fi
466
- ```
467
-
468
- **Post-merge hook:**
469
- ```bash
470
- #!/bin/bash
471
- # .git/hooks/post-merge
472
-
473
- # Auto-sync after pulling from git
474
- echo "Running jive sync..."
475
- jive sync
476
- echo "Restart Claude Code to apply changes"
477
- ```
478
-
479
- ### CI/CD Integration
480
-
481
- **Verify sync status in CI:**
482
- ```yaml
483
- # .github/workflows/check-jive.yml
484
- name: Check Jive Sync
485
-
486
- on: [push, pull_request]
487
-
488
- jobs:
489
- check-sync:
490
- runs-on: ubuntu-latest
491
- steps:
492
- - uses: actions/checkout@v2
493
- - name: Setup Node
494
- uses: actions/setup-node@v2
495
- - name: Install Jive CLI
496
- run: npm install -g jive-cli
497
- - name: Check Status
498
- run: jive status
499
- ```
500
-
501
- ### Scheduled Sync
502
-
503
- **Cron job (daily sync):**
504
- ```bash
505
- # Add to crontab
506
- 0 9 * * * cd /path/to/project && jive sync
507
- ```
508
-
509
- **Shell script:**
510
- ```bash
511
- #!/bin/bash
512
- # sync-jive-projects.sh
513
-
514
- PROJECTS=(
515
- "/path/to/project1"
516
- "/path/to/project2"
517
- )
518
-
519
- for project in "${PROJECTS[@]}"; do
520
- echo "Syncing $project..."
521
- cd "$project"
522
- jive sync
523
- done
524
- ```
525
-
526
- ## Troubleshooting
527
-
528
- ### Out of Sync
529
-
530
- **Symptoms:**
531
- - Team members have different resources
532
- - Missing subagents or MCP servers
533
-
534
- **Solutions:**
535
- ```bash
536
- # Check current status
537
- jive status
538
-
539
- # Sync to get latest
540
- jive sync
541
-
542
- # Force overwrite if needed
543
- jive subagents pull --overwrite
544
- jive mcp pull
545
-
546
- # Restart Claude Code
547
- ```
548
-
549
- ### Sync Fails
550
-
551
- **Symptoms:**
552
- - Network errors during sync
553
- - Partial sync completion
554
-
555
- **Solutions:**
556
- ```bash
557
- # Retry sync
558
- jive sync
559
-
560
- # Check authentication
561
- jive login
562
-
563
- # Verify network connectivity
564
- jive doctor
565
-
566
- # Check project initialization
567
- jive init
568
- ```
569
-
570
- ### Last Sync Unknown
571
-
572
- **Symptoms:**
573
- - Status shows no last sync time
574
- - Missing `.jive/sync.json`
575
-
576
- **Solutions:**
577
- ```bash
578
- # Re-initialize to fix
579
- jive init
580
-
581
- # Or manually sync
582
- jive sync
583
- ```
584
-
585
- ### Conflicting Changes
586
-
587
- **Symptoms:**
588
- - Local and remote versions differ
589
- - Unsure which to keep
590
-
591
- **Solutions:**
592
- 1. **Backup local:**
593
- ```bash
594
- cp -r .claude/agents .claude/agents.backup
595
- ```
596
-
597
- 2. **Pull team version:**
598
- ```bash
599
- jive subagents pull --overwrite
600
- ```
601
-
602
- 3. **Compare and merge:**
603
- ```bash
604
- diff -r .claude/agents.backup .claude/agents
605
- ```
606
-
607
- 4. **Push final version:**
608
- ```bash
609
- jive subagents push -m "Merged local and team changes"
610
- ```
611
-
612
- ## Best Practices
613
-
614
- ### Regular Syncing
615
-
616
- - Sync at least daily
617
- - Sync before starting work
618
- - Sync after team updates
619
- - Sync before pushing changes
620
-
621
- ### Communication
622
-
623
- - Notify team before major changes
624
- - Use descriptive push messages
625
- - Document breaking changes
626
- - Coordinate on sensitive updates
627
-
628
- ### Version Control
629
-
630
- - Commit `.claude/agents/*.md` to git
631
- - Commit `.mcp.json` to git
632
- - **Don't commit:**
633
- - `.jive/config.json` (team-specific)
634
- - `.jive/sync.json` (local state)
635
- - `.claude/plugins/` (generated)
636
- - `.mcp.json.backup` (temporary)
637
-
638
- ### Conflict Resolution
639
-
640
- - Pull before push
641
- - Test changes locally first
642
- - Use descriptive change messages
643
- - Keep backups of important prompts
644
-
645
- ## Related Commands
646
-
647
- - [`jive init`](./init.md#jive-init) - Initialize project (sets up sync)
648
- - [`jive subagents pull`](./subagents.md#jive-subagents-pull) - Pull subagents only
649
- - [`jive subagents push`](./subagents.md#jive-subagents-push) - Push subagents
650
- - [`jive mcp pull`](./mcp.md#jive-mcp-pull) - Pull MCP servers only
651
- - [`jive mcp push`](./mcp.md#jive-mcp-push) - Push MCP servers
652
- - [`jive team switch`](./team.md#jive-team-switch) - Change active team
653
- - [`jive doctor`](./init.md#jive-doctor) - Verify sync configuration
654
-
655
- ## Implementation Details
656
-
657
- **Source Files:**
658
- - Main implementation: `src/commands/sync.ts`
659
- - Subagent sync: `src/commands/subagents.ts`
660
- - MCP sync: `src/commands/mcp.ts`
661
- - Config helpers: `src/lib/config.ts`
662
-
663
- **Key Functions:**
664
- - `syncCommand()` - Main sync orchestration
665
- - `statusCommand()` - Display sync status
666
- - `updateSyncMetadata()` - Update `.jive/sync.json`
667
- - `getLastSyncTime()` - Read last sync timestamp
668
- - `shouldSync()` - Determine if sync needed (future)
669
-
670
- **API Integration:**
671
- - Sync uses same endpoints as pull commands
672
- - No dedicated sync endpoint (composite operation)
673
- - Pull operations are idempotent and safe to repeat