@jive-ai/cli 0.0.26 → 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/subagents.md DELETED
@@ -1,702 +0,0 @@
1
- # Subagent Commands
2
-
3
- Subagents are custom AI agents defined by markdown files with YAML frontmatter. They provide specialized prompts and behaviors for specific tasks, enabling teams to share and collaborate on AI agents.
4
-
5
- ## Overview
6
-
7
- Subagent management in Jive allows you to:
8
- - Create and share custom AI agents with your team
9
- - Pull team subagents to your local project
10
- - Push local subagents to share with your team
11
- - Track changes with version history
12
- - Delete subagents when no longer needed
13
-
14
- ## Subagent File Format
15
-
16
- Subagents are markdown files stored in `.claude/agents/` with YAML frontmatter:
17
-
18
- ```markdown
19
- ---
20
- name: code-reviewer
21
- description: Reviews code for best practices and potential issues
22
- jive-id: "sub-123"
23
- ---
24
-
25
- You are a code reviewer. Analyze the provided code and:
26
-
27
- 1. Identify potential bugs or issues
28
- 2. Suggest improvements for readability
29
- 3. Check for security vulnerabilities
30
- 4. Recommend best practices
31
-
32
- Be thorough but concise in your feedback.
33
- ```
34
-
35
- **Frontmatter Fields:**
36
- - `name` (required) - Unique identifier for the subagent
37
- - `description` (required) - Brief description of the subagent's purpose
38
- - `jive-id` (optional) - Jive platform ID (added automatically when synced)
39
-
40
- **Content:**
41
- - The markdown content after frontmatter is the subagent's system prompt
42
- - Can include instructions, examples, formatting guidelines, etc.
43
-
44
- ## Commands
45
-
46
- ### `jive subagents list`
47
-
48
- List all subagents for the active team.
49
-
50
- **Usage:**
51
- ```bash
52
- jive subagents list
53
- ```
54
-
55
- **Requirements:**
56
- - Must be authenticated
57
- - Must be in a Jive-initialized project (has active team)
58
-
59
- **Process:**
60
- 1. Gets active team ID from `.jive/config.json`
61
- 2. Fetches team subagents from API (`GET /api/teams/{teamId}/subagents`)
62
- 3. Displays formatted list
63
-
64
- **Output:**
65
- ```
66
- Team subagents:
67
-
68
- code-reviewer (sub-123)
69
- Reviews code for best practices and potential issues
70
-
71
- bug-fixer (sub-456)
72
- Analyzes code to identify and fix bugs
73
-
74
- test-writer (sub-789)
75
- Generates comprehensive test cases for code
76
- ```
77
-
78
- **Notes:**
79
- - Shows name, ID, and description
80
- - Only shows subagents for the active team
81
- - Use `jive team switch` to view different team's subagents
82
-
83
- **Error Conditions:**
84
- - Not authenticated
85
- - Project not initialized
86
- - Network connectivity issues
87
-
88
- **Implementation:** `src/commands/subagents.ts` (subagentCommands.list)
89
-
90
- ---
91
-
92
- ### `jive subagents pull`
93
-
94
- Download team subagents to local `.claude/agents/` directory.
95
-
96
- **Usage:**
97
- ```bash
98
- jive subagents pull [--overwrite]
99
- ```
100
-
101
- **Options:**
102
- - `--overwrite` - Overwrite existing local files (default: skip existing)
103
-
104
- **Requirements:**
105
- - Must be authenticated
106
- - Must be in a Jive-initialized project
107
-
108
- **Process:**
109
- 1. Fetches remote subagents from team API
110
- 2. For each remote subagent:
111
- - Checks if local file exists
112
- - If exists and no `--overwrite`: skips
113
- - If doesn't exist or `--overwrite`: saves file
114
- - Adds `jive-id` to frontmatter for tracking
115
- 3. Creates `.claude/agents/` directory if needed
116
-
117
- **Output:**
118
- ```
119
- Pulling subagents from team...
120
-
121
- ✓ code-reviewer.md
122
- ✓ bug-fixer.md
123
- ⊘ test-writer.md (already exists, use --overwrite to update)
124
-
125
- Downloaded 2 subagents, skipped 1
126
- ```
127
-
128
- **Output with --overwrite:**
129
- ```bash
130
- jive subagents pull --overwrite
131
- ```
132
- ```
133
- Pulling subagents from team...
134
-
135
- ✓ code-reviewer.md
136
- ✓ bug-fixer.md
137
- ✓ test-writer.md (overwritten)
138
-
139
- Downloaded 3 subagents
140
- ```
141
-
142
- **File Created:**
143
-
144
- `.claude/agents/code-reviewer.md`:
145
- ```markdown
146
- ---
147
- name: code-reviewer
148
- description: Reviews code for best practices
149
- jive-id: "sub-123"
150
- ---
151
-
152
- You are a code reviewer...
153
- ```
154
-
155
- **Notes:**
156
- - Creates directory if `.claude/agents/` doesn't exist
157
- - Preserves existing local changes unless `--overwrite` is used
158
- - Updates `jive-id` field to track sync state
159
-
160
- **Use Cases:**
161
- - Getting team subagents in a new project
162
- - Updating to latest versions from team
163
- - Syncing after team members add new subagents
164
-
165
- **Error Conditions:**
166
- - Not authenticated
167
- - Project not initialized
168
- - Network connectivity issues
169
- - File system permission errors
170
-
171
- **Implementation:** `src/commands/subagents.ts` (subagentCommands.pull)
172
-
173
- ---
174
-
175
- ### `jive subagents push`
176
-
177
- Upload local subagents to the team.
178
-
179
- **Usage:**
180
- ```bash
181
- jive subagents push [-m <message>] [--force]
182
- ```
183
-
184
- **Options:**
185
- - `-m, --message <text>` - Change description for version history
186
- - `--force` - Force push without conflict checks (not fully implemented)
187
-
188
- **Requirements:**
189
- - Must be authenticated
190
- - Must be in a Jive-initialized project
191
-
192
- **Process:**
193
- 1. Scans `.claude/agents/*.md` files (excludes `subagent-runner.md`)
194
- 2. Parses each file's frontmatter and content
195
- 3. For each subagent:
196
- - **If has `jive-id`:** Updates existing subagent via `PUT /api/subagents/{id}`
197
- - Prompts for change message if not provided via `-m`
198
- - **If no `jive-id`:** Creates new subagent via `POST /api/teams/{teamId}/subagents`
199
- - Adds `jive-id` to file frontmatter
200
- 4. Saves updated files with `jive-id` added
201
-
202
- **Output:**
203
- ```
204
- Pushing subagents to team...
205
-
206
- ✓ code-reviewer.md (updated)
207
- ✓ new-agent.md (created)
208
-
209
- Pushed 2 subagents
210
- ```
211
-
212
- **With Change Message:**
213
- ```bash
214
- jive subagents push -m "Added error handling checks"
215
- ```
216
- ```
217
- Pushing subagents to team...
218
-
219
- ✓ code-reviewer.md (updated: "Added error handling checks")
220
-
221
- Pushed 1 subagent
222
- ```
223
-
224
- **Interactive Prompt (when updating without -m):**
225
- ```
226
- ? Describe your changes to code-reviewer: (optional)
227
- > Improved code review criteria
228
- ```
229
-
230
- **File Updates:**
231
-
232
- Before push (new subagent):
233
- ```markdown
234
- ---
235
- name: new-agent
236
- description: Does something useful
237
- ---
238
-
239
- Prompt content...
240
- ```
241
-
242
- After push:
243
- ```markdown
244
- ---
245
- name: new-agent
246
- description: Does something useful
247
- jive-id: "sub-999"
248
- ---
249
-
250
- Prompt content...
251
- ```
252
-
253
- **Notes:**
254
- - Automatically tracks which subagents are synced via `jive-id`
255
- - Version history maintained on server (via change messages)
256
- - Skips `subagent-runner.md` (reserved by Jive)
257
-
258
- **Use Cases:**
259
- - Sharing new subagents with team
260
- - Publishing updates to existing subagents
261
- - Initial upload of local subagents
262
-
263
- **Error Conditions:**
264
- - Not authenticated
265
- - Project not initialized
266
- - Invalid frontmatter format
267
- - Network connectivity issues
268
- - Subagent name conflicts
269
-
270
- **Implementation:** `src/commands/subagents.ts` (subagentCommands.push)
271
-
272
- ---
273
-
274
- ### `jive subagents create`
275
-
276
- Create a new subagent interactively.
277
-
278
- **Usage:**
279
- ```bash
280
- jive subagents create
281
- ```
282
-
283
- **Requirements:**
284
- - Must be authenticated
285
- - Must be in a Jive-initialized project
286
-
287
- **Interactive Prompts:**
288
- - **Name:** Unique identifier for the subagent (e.g., `code-reviewer`)
289
- - **Description:** Brief description of purpose
290
- - **Prompt:** System prompt for the subagent (multi-line, Ctrl+D to finish)
291
-
292
- **Process:**
293
- 1. Prompts for name, description, and prompt
294
- 2. Creates subagent on server via `POST /api/teams/{teamId}/subagents`
295
- 3. Saves to `.claude/agents/{name}.md` with `jive-id` in frontmatter
296
- 4. Creates directory if needed
297
-
298
- **Output:**
299
- ```
300
- Create a new subagent
301
-
302
- ? Name: security-checker
303
- ? Description: Analyzes code for security vulnerabilities
304
- ? Prompt: (Ctrl+D when done)
305
- You are a security expert. Review code for:
306
- - SQL injection risks
307
- - XSS vulnerabilities
308
- - Authentication issues
309
- - Data exposure risks
310
-
311
- Provide specific, actionable recommendations.
312
- ^D
313
-
314
- ✓ Subagent created: security-checker
315
- Saved to .claude/agents/security-checker.md
316
- ```
317
-
318
- **File Created:**
319
-
320
- `.claude/agents/security-checker.md`:
321
- ```markdown
322
- ---
323
- name: security-checker
324
- description: Analyzes code for security vulnerabilities
325
- jive-id: "sub-999"
326
- ---
327
-
328
- You are a security expert. Review code for:
329
- - SQL injection risks
330
- - XSS vulnerabilities
331
- - Authentication issues
332
- - Data exposure risks
333
-
334
- Provide specific, actionable recommendations.
335
- ```
336
-
337
- **Notes:**
338
- - Subagent is immediately available to team members
339
- - Automatically synced (has `jive-id` from creation)
340
- - Can be edited locally and pushed with `jive subagents push`
341
-
342
- **Error Conditions:**
343
- - Not authenticated
344
- - Project not initialized
345
- - Name already exists
346
- - Network connectivity issues
347
-
348
- **Implementation:** `src/commands/subagents.ts` (subagentCommands.create)
349
-
350
- ---
351
-
352
- ### `jive subagents delete <name-or-id>`
353
-
354
- Delete a subagent from the team.
355
-
356
- **Usage:**
357
- ```bash
358
- jive subagents delete <name-or-id>
359
- ```
360
-
361
- **Arguments:**
362
- - `<name-or-id>` (required) - Name or ID of subagent to delete
363
-
364
- **Requirements:**
365
- - Must be authenticated
366
- - Must be in a Jive-initialized project
367
-
368
- **Interactive Prompts:**
369
- - **Confirmation:** "Are you sure you want to delete {name}?" (Y/n)
370
-
371
- **Process:**
372
- 1. Fetches team subagents to find match by name or ID
373
- 2. Displays subagent details
374
- 3. Prompts for confirmation
375
- 4. Deletes from server via `DELETE /api/subagents/{id}`
376
- 5. Deletes local `.md` file if it exists
377
-
378
- **Output:**
379
- ```bash
380
- jive subagents delete code-reviewer
381
- ```
382
- ```
383
- Found subagent: code-reviewer
384
- Description: Reviews code for best practices
385
- ID: sub-123
386
-
387
- ? Are you sure you want to delete code-reviewer? (Y/n) Yes
388
-
389
- ✓ Deleted from team
390
- ✓ Deleted local file: .claude/agents/code-reviewer.md
391
- ```
392
-
393
- **By ID:**
394
- ```bash
395
- jive subagents delete sub-123
396
- ```
397
-
398
- **Notes:**
399
- - Deletes from team (affects all team members)
400
- - Also deletes local file if present
401
- - Cannot be undone (creates backup if file exists)
402
- - Other team members will still have local copy until they run `jive sync`
403
-
404
- **Error Conditions:**
405
- - Not authenticated
406
- - Project not initialized
407
- - Subagent not found
408
- - User cancels confirmation
409
- - Network connectivity issues
410
-
411
- **Implementation:** `src/commands/subagents.ts` (subagentCommands.delete)
412
-
413
- ---
414
-
415
- ## Subagent Workflows
416
-
417
- ### Creating and Sharing a New Subagent
418
-
419
- 1. **Create the subagent:**
420
- ```bash
421
- jive subagents create
422
- ```
423
-
424
- 2. **Or create manually:**
425
- ```bash
426
- # Create file
427
- touch .claude/agents/my-agent.md
428
- ```
429
-
430
- ```markdown
431
- ---
432
- name: my-agent
433
- description: Does something useful
434
- ---
435
-
436
- System prompt here...
437
- ```
438
-
439
- 3. **Push to team:**
440
- ```bash
441
- jive subagents push
442
- ```
443
-
444
- 4. **Team members pull:**
445
- ```bash
446
- jive subagents pull
447
- ```
448
-
449
- ### Updating an Existing Subagent
450
-
451
- 1. **Edit the local file:**
452
- ```bash
453
- # Edit .claude/agents/code-reviewer.md
454
- # Update the prompt content
455
- ```
456
-
457
- 2. **Push changes:**
458
- ```bash
459
- jive subagents push -m "Improved error detection logic"
460
- ```
461
-
462
- 3. **Team members update:**
463
- ```bash
464
- jive subagents pull --overwrite
465
- ```
466
-
467
- ### Collaborating on Subagents
468
-
469
- **Team Member A creates:**
470
- ```bash
471
- jive subagents create
472
- # Creates api-designer
473
- ```
474
-
475
- **Team Member B pulls:**
476
- ```bash
477
- jive subagents pull
478
- # Downloads api-designer.md
479
- ```
480
-
481
- **Team Member B improves:**
482
- ```bash
483
- # Edit .claude/agents/api-designer.md
484
- jive subagents push -m "Added REST best practices"
485
- ```
486
-
487
- **Team Member A updates:**
488
- ```bash
489
- jive subagents pull --overwrite
490
- # Gets latest version
491
- ```
492
-
493
- ### Using Subagents in Claude Code
494
-
495
- Once pulled, subagents can be used in Claude Code:
496
-
497
- 1. **Via Task tool:**
498
- ```
499
- User: "Review this code for security issues"
500
- Claude: Uses Task tool with subagent_type="security-checker"
501
- ```
502
-
503
- 2. **Via subagent-runner:**
504
- The `subagent-runner.md` enables dynamic loading of team subagents
505
-
506
- 3. **Via jive-mcp server:**
507
- - `search_subagents` - Find subagents by name/description
508
- - `call_subagent` - Execute a subagent with input
509
-
510
- ## Subagent Best Practices
511
-
512
- ### Naming Conventions
513
-
514
- - Use kebab-case: `code-reviewer`, `api-designer`
515
- - Be descriptive: `security-checker` not `checker`
516
- - Avoid conflicts with built-in agents
517
-
518
- ### Writing Effective Prompts
519
-
520
- **Good prompt structure:**
521
- ```markdown
522
- ---
523
- name: code-reviewer
524
- description: Reviews code for quality and best practices
525
- ---
526
-
527
- You are an expert code reviewer.
528
-
529
- ## Your Role
530
- Review code submissions for:
531
- 1. Bugs and logic errors
532
- 2. Code quality and readability
533
- 3. Performance issues
534
- 4. Security vulnerabilities
535
- 5. Best practice violations
536
-
537
- ## Review Process
538
- 1. Analyze the code thoroughly
539
- 2. Identify specific issues with line numbers
540
- 3. Suggest concrete improvements
541
- 4. Explain the reasoning behind each suggestion
542
-
543
- ## Output Format
544
- - Use markdown formatting
545
- - Group issues by category
546
- - Prioritize by severity (Critical, High, Medium, Low)
547
- - Provide code examples for fixes
548
-
549
- Be constructive and educational in your feedback.
550
- ```
551
-
552
- **Tips:**
553
- - Be specific about the subagent's role and expertise
554
- - Provide clear instructions and structure
555
- - Include examples when helpful
556
- - Define expected output format
557
- - Keep prompts focused on a single purpose
558
-
559
- ### Version Control
560
-
561
- **Track changes with messages:**
562
- ```bash
563
- # Good messages
564
- jive subagents push -m "Added TypeScript-specific checks"
565
- jive subagents push -m "Fixed edge case in error detection"
566
- jive subagents push -m "Updated to use latest coding standards"
567
-
568
- # Less helpful messages
569
- jive subagents push -m "updated"
570
- jive subagents push -m "changes"
571
- ```
572
-
573
- **Use git for local versioning:**
574
- ```bash
575
- # .gitignore should NOT ignore .claude/agents/*.md
576
- git add .claude/agents/code-reviewer.md
577
- git commit -m "Improve code reviewer prompt"
578
- ```
579
-
580
- ### Team Collaboration
581
-
582
- 1. **Communicate changes:**
583
- - Notify team when creating new subagents
584
- - Describe major updates in change messages
585
- - Document breaking changes
586
-
587
- 2. **Test before pushing:**
588
- - Test subagent locally with Claude Code
589
- - Verify prompt produces expected behavior
590
- - Check for edge cases
591
-
592
- 3. **Review together:**
593
- - Share prompts for feedback before pushing
594
- - Collaborate on improvements
595
- - Establish team conventions
596
-
597
- ## Troubleshooting
598
-
599
- ### Subagent Not Showing in Claude Code
600
-
601
- **Symptoms:**
602
- - Subagent file exists but Claude doesn't use it
603
- - Task tool doesn't recognize subagent
604
-
605
- **Solutions:**
606
- 1. Restart Claude Code
607
- 2. Check frontmatter format:
608
- ```markdown
609
- ---
610
- name: my-agent
611
- description: Something
612
- ---
613
- ```
614
- 3. Verify file location: `.claude/agents/my-agent.md`
615
- 4. Check file isn't excluded (like `subagent-runner.md`)
616
-
617
- ### Push/Pull Conflicts
618
-
619
- **Symptoms:**
620
- - Local changes overwritten by pull
621
- - Push fails with conflict error
622
-
623
- **Solutions:**
624
- 1. **Before pulling, backup local changes:**
625
- ```bash
626
- cp .claude/agents/my-agent.md .claude/agents/my-agent.md.backup
627
- jive subagents pull --overwrite
628
- # Merge changes manually
629
- ```
630
-
631
- 2. **Push local version:**
632
- ```bash
633
- jive subagents push -m "Merged local improvements"
634
- ```
635
-
636
- ### Missing jive-id
637
-
638
- **Symptoms:**
639
- - Subagent pushed multiple times creates duplicates
640
- - Cannot update existing subagent
641
-
642
- **Solutions:**
643
- 1. Delete duplicate from team:
644
- ```bash
645
- jive subagents delete duplicate-name
646
- ```
647
-
648
- 2. Pull from team to get correct `jive-id`:
649
- ```bash
650
- jive subagents pull --overwrite
651
- ```
652
-
653
- ### File Permission Errors
654
-
655
- **Symptoms:**
656
- - Cannot create `.claude/agents/` directory
657
- - Cannot write subagent files
658
-
659
- **Solutions:**
660
- ```bash
661
- # Check permissions
662
- ls -la .claude/
663
-
664
- # Fix permissions
665
- chmod 755 .claude/
666
- chmod 755 .claude/agents/
667
- chmod 644 .claude/agents/*.md
668
- ```
669
-
670
- ## Related Commands
671
-
672
- - [`jive init`](./init.md#jive-init) - Creates `subagent-runner.md`
673
- - [`jive sync`](./sync.md#jive-sync) - Pulls all team resources including subagents
674
- - [`jive team switch`](./team.md#jive-team-switch) - Change active team (affects which subagents you see)
675
-
676
- ## API Endpoints
677
-
678
- **Subagent Management:**
679
- - `GET /api/teams/{teamId}/subagents` - List team subagents
680
- - `POST /api/teams/{teamId}/subagents` - Create subagent
681
- - `GET /api/subagents/{id}` - Get subagent details
682
- - `PUT /api/subagents/{id}` - Update subagent
683
- - `DELETE /api/subagents/{id}` - Delete subagent
684
-
685
- ## Implementation Details
686
-
687
- **Source Files:**
688
- - Main implementation: `src/commands/subagents.ts`
689
- - File utilities: `src/lib/fs-utils.ts`
690
- - Config helpers: `src/lib/config.ts`
691
-
692
- **Key Functions:**
693
- - `subagentCommands.list()` - Lists team subagents
694
- - `subagentCommands.pull()` - Downloads subagents
695
- - `subagentCommands.push()` - Uploads subagents
696
- - `subagentCommands.create()` - Creates new subagent
697
- - `subagentCommands.delete()` - Deletes subagent
698
- - `parseSubagentFile()` - Parses markdown with frontmatter
699
- - `saveSubagentFile()` - Writes subagent file with frontmatter
700
-
701
- **Frontmatter Parsing:**
702
- Uses `gray-matter` library to parse YAML frontmatter from markdown files.