@vibescope/mcp-server 0.2.9 → 0.3.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.
Files changed (95) hide show
  1. package/CHANGELOG.md +84 -84
  2. package/README.md +194 -194
  3. package/dist/api-client.d.ts +36 -0
  4. package/dist/api-client.js +34 -0
  5. package/dist/cli.d.ts +1 -1
  6. package/dist/cli.js +30 -38
  7. package/dist/handlers/discovery.js +2 -0
  8. package/dist/handlers/session.d.ts +11 -0
  9. package/dist/handlers/session.js +101 -0
  10. package/dist/handlers/tasks.d.ts +8 -0
  11. package/dist/handlers/tasks.js +163 -3
  12. package/dist/handlers/tool-docs.js +840 -828
  13. package/dist/handlers/validation.js +45 -2
  14. package/dist/index.js +73 -73
  15. package/dist/setup.js +6 -6
  16. package/dist/templates/agent-guidelines.js +185 -185
  17. package/dist/templates/help-content.js +1622 -1544
  18. package/dist/tools.js +126 -74
  19. package/dist/utils.d.ts +15 -11
  20. package/dist/utils.js +53 -28
  21. package/docs/TOOLS.md +2406 -2053
  22. package/package.json +51 -51
  23. package/scripts/generate-docs.ts +212 -212
  24. package/scripts/version-bump.ts +203 -203
  25. package/src/api-client.test.ts +723 -723
  26. package/src/api-client.ts +2561 -2499
  27. package/src/cli.test.ts +24 -8
  28. package/src/cli.ts +204 -212
  29. package/src/handlers/__test-setup__.ts +236 -236
  30. package/src/handlers/__test-utils__.ts +87 -87
  31. package/src/handlers/blockers.test.ts +468 -468
  32. package/src/handlers/blockers.ts +163 -163
  33. package/src/handlers/bodies-of-work.test.ts +704 -704
  34. package/src/handlers/bodies-of-work.ts +526 -526
  35. package/src/handlers/connectors.test.ts +834 -834
  36. package/src/handlers/connectors.ts +229 -229
  37. package/src/handlers/cost.test.ts +462 -462
  38. package/src/handlers/cost.ts +285 -285
  39. package/src/handlers/decisions.test.ts +382 -382
  40. package/src/handlers/decisions.ts +153 -153
  41. package/src/handlers/deployment.test.ts +551 -551
  42. package/src/handlers/deployment.ts +541 -541
  43. package/src/handlers/discovery.test.ts +206 -206
  44. package/src/handlers/discovery.ts +392 -390
  45. package/src/handlers/fallback.test.ts +537 -537
  46. package/src/handlers/fallback.ts +194 -194
  47. package/src/handlers/file-checkouts.test.ts +750 -750
  48. package/src/handlers/file-checkouts.ts +185 -185
  49. package/src/handlers/findings.test.ts +633 -633
  50. package/src/handlers/findings.ts +239 -239
  51. package/src/handlers/git-issues.test.ts +631 -631
  52. package/src/handlers/git-issues.ts +136 -136
  53. package/src/handlers/ideas.test.ts +644 -644
  54. package/src/handlers/ideas.ts +207 -207
  55. package/src/handlers/index.ts +84 -84
  56. package/src/handlers/milestones.test.ts +475 -475
  57. package/src/handlers/milestones.ts +180 -180
  58. package/src/handlers/organizations.test.ts +826 -826
  59. package/src/handlers/organizations.ts +315 -315
  60. package/src/handlers/progress.test.ts +269 -269
  61. package/src/handlers/progress.ts +77 -77
  62. package/src/handlers/project.test.ts +546 -546
  63. package/src/handlers/project.ts +239 -239
  64. package/src/handlers/requests.test.ts +303 -303
  65. package/src/handlers/requests.ts +99 -99
  66. package/src/handlers/roles.test.ts +305 -305
  67. package/src/handlers/roles.ts +219 -219
  68. package/src/handlers/session.test.ts +998 -875
  69. package/src/handlers/session.ts +839 -730
  70. package/src/handlers/sprints.test.ts +732 -732
  71. package/src/handlers/sprints.ts +537 -537
  72. package/src/handlers/tasks.test.ts +931 -907
  73. package/src/handlers/tasks.ts +1121 -945
  74. package/src/handlers/tool-categories.test.ts +66 -66
  75. package/src/handlers/tool-docs.ts +1109 -1096
  76. package/src/handlers/types.test.ts +259 -259
  77. package/src/handlers/types.ts +175 -175
  78. package/src/handlers/validation.test.ts +582 -582
  79. package/src/handlers/validation.ts +159 -113
  80. package/src/index.test.ts +674 -0
  81. package/src/index.ts +792 -792
  82. package/src/setup.test.ts +233 -233
  83. package/src/setup.ts +404 -403
  84. package/src/templates/agent-guidelines.ts +210 -210
  85. package/src/templates/help-content.ts +1751 -1673
  86. package/src/token-tracking.test.ts +463 -463
  87. package/src/token-tracking.ts +166 -166
  88. package/src/tools.test.ts +416 -0
  89. package/src/tools.ts +3607 -3555
  90. package/src/utils.test.ts +785 -683
  91. package/src/utils.ts +469 -436
  92. package/src/validators.test.ts +223 -223
  93. package/src/validators.ts +249 -249
  94. package/tsconfig.json +16 -16
  95. package/vitest.config.ts +14 -14
@@ -1,210 +1,210 @@
1
- /**
2
- * Agent Guidelines Template
3
- *
4
- * This template contains the essential CLAUDE.md content that should be included
5
- * in every project using Vibescope for agent tracking. These guidelines ensure
6
- * agents follow proper workflows and maintain visibility.
7
- */
8
-
9
- export const AGENT_GUIDELINES_TEMPLATE = `# Vibescope Agent Guidelines
10
-
11
- ## Quick Start
12
-
13
- \`\`\`
14
- start_work_session(git_url: "https://github.com/YOUR/REPO", model: "opus")
15
- \`\`\`
16
-
17
- **IMPORTANT:** Always pass your model (opus/sonnet/haiku) to enable cost tracking. Check your system prompt for "You are powered by the model named..." to determine your model.
18
-
19
- This returns your persona, project info, and \`next_task\`. Start working immediately.
20
-
21
- ## CRITICAL: MCP Connection Required
22
-
23
- **If the Vibescope MCP server fails to connect, you MUST end your session immediately.**
24
-
25
- ### Why This Is Non-Negotiable
26
-
27
- Working without MCP connection causes:
28
- - **No progress visibility** - Humans can't see what you're doing
29
- - **Lost work tracking** - Tasks aren't tracked, time is wasted
30
- - **Workflow violations** - Other agents may conflict with your work
31
- - **Dashboard confusion** - Project state becomes inconsistent
32
-
33
- ### Connection Failure Handling
34
-
35
- **If \`start_work_session\` fails or returns an error:**
36
-
37
- 1. **Do NOT proceed with any work**
38
- 2. **Inform the user** that MCP connection failed
39
- 3. **End the session** - do not attempt workarounds
40
- 4. **Provide troubleshooting steps:**
41
- - Check if MCP server is configured: \`claude mcp list\`
42
- - Verify API key is set: check \`.mcp.json\` or environment
43
- - Restart Claude Code after fixing configuration
44
-
45
- **Example error responses you might see:**
46
- \`\`\`
47
- Error: Failed to start session
48
- Error: VIBESCOPE_API_KEY not set
49
- Error: Network error connecting to Vibescope API
50
- Error: MCP server 'vibescope' not found
51
- \`\`\`
52
-
53
- ### Recovery Steps
54
-
55
- If MCP connection fails, tell the user:
56
-
57
- \`\`\`
58
- MCP connection to Vibescope failed. I cannot proceed without task tracking.
59
-
60
- To fix:
61
- 1. Run: claude mcp list (verify vibescope is configured)
62
- 2. Check API key: ensure VIBESCOPE_API_KEY is set
63
- 3. Restart Claude Code
64
- 4. Try again with: start_work_session(git_url: "...")
65
-
66
- I am ending this session to prevent untracked work.
67
- \`\`\`
68
-
69
- **Never "work around" a broken MCP connection.** The whole point of Vibescope is visibility and coordination. Working without it defeats the purpose.
70
-
71
- ## Core Workflow
72
-
73
- 1. **Start session** → \`start_work_session(git_url, model)\` - Always include your model!
74
- 2. **Mark task in progress** → \`update_task(task_id, status: "in_progress")\` - Returns git workflow instructions!
75
- 3. **Set up worktree** → Create isolated worktree for this task (see Git Workflow below)
76
- 4. **Update progress** → \`update_task(task_id, progress_percentage: 50, progress_note: "...")\`
77
- 5. **Complete task** → \`complete_task(task_id, summary: "...")\` - **MANDATORY, see below!**
78
- 6. **Clean up** → Remove worktree, then start next task immediately
79
-
80
- ## CRITICAL: Always Call complete_task (MANDATORY)
81
-
82
- **You MUST call \`complete_task()\` when you finish a task.** This is not optional.
83
-
84
- ### When to Call complete_task
85
-
86
- Call \`complete_task()\` immediately after:
87
- - ✅ Creating and pushing a PR
88
- - ✅ Merging changes (for trunk-based workflow)
89
- - ✅ Finishing any unit of work, even if no code changes
90
-
91
- **Do NOT wait for:**
92
- - ❌ PR to be reviewed/merged (that's what validation is for)
93
- - ❌ User confirmation
94
- - ❌ "Perfect" summary - a brief summary is fine
95
-
96
- ### The Rule
97
-
98
- \`\`\`
99
- PR created + pushed → complete_task() → THEN worry about next steps
100
- \`\`\`
101
-
102
- **If you create a PR and don't call \`complete_task()\`, you have failed the workflow.**
103
-
104
- ## CRITICAL: Git Worktrees for Multi-Agent
105
-
106
- When multiple agents share a repository, you **MUST** use git worktrees to prevent conflicts.
107
-
108
- **Before starting ANY task:**
109
- \`\`\`bash
110
- # For git-flow: ensure you're on develop first, then create worktree
111
- git checkout develop
112
- git pull origin develop
113
- git worktree add ../worktree-<task-short-id> -b feature/<task-id>-<title>
114
- cd ../worktree-<task-short-id>
115
- \`\`\`
116
-
117
- **After task is merged:**
118
- \`\`\`bash
119
- git worktree remove ../worktree-<task-short-id>
120
- \`\`\`
121
-
122
- **Why?** Branch switching in shared repos causes file conflicts between agents. Worktrees provide isolated directories.
123
-
124
- Run \`get_help("git")\` for full worktree documentation.
125
-
126
- ## CRITICAL: Never Ask Permission
127
-
128
- **You must NEVER:**
129
- - Ask "Should I continue to the next task?" → Just continue
130
- - Ask "Should I clear my context?" → Just clear it
131
- - Ask "What should I do next?" → Check \`next_task\` or use fallback activities
132
- - Say "All tasks are done, let me know what to do" → Use \`get_next_task\` or start fallback activity
133
- - Wait for confirmation before clearing context → Just do it
134
-
135
- **You must ALWAYS:**
136
- - Call \`complete_task()\` immediately after creating/pushing a PR - this is non-negotiable
137
- - Immediately start the next task after completing one
138
- - Clear context and restart session automatically when needed
139
- - Keep working until there are genuinely no tasks and no fallback activities
140
-
141
- ## Continuous Work
142
-
143
- **IMPORTANT: Never stop working!** When you complete a task:
144
- 1. \`complete_task\` returns \`next_task\` → Start it immediately
145
- 2. No \`next_task\`? → Call \`get_next_task(project_id)\`
146
- 3. Still no tasks? → Start a \`fallback_activity\` (code_review, security_review, etc.)
147
-
148
- **When context grows large or responses slow down:**
149
- 1. Run \`/clear\` to reset conversation
150
- 2. Immediately call \`start_work_session(git_url, model)\` to reload context
151
- 3. Continue with \`next_task\` from the response
152
-
153
- **Do NOT ask the user if you should clear context. Just do it.** The dashboard tracks all your progress, so nothing is lost when you clear.
154
-
155
- ## Need Help?
156
-
157
- Use \`get_help(topic)\` for detailed guidance:
158
-
159
- | Topic | Description |
160
- |-------|-------------|
161
- | \`getting_started\` | Basic workflow overview |
162
- | \`tasks\` | Working on tasks, progress tracking |
163
- | \`validation\` | Cross-agent task validation |
164
- | \`deployment\` | Deployment coordination |
165
- | \`git\` | Git workflow configuration |
166
- | \`blockers\` | Handling blockers |
167
- | \`milestones\` | Breaking down complex tasks |
168
- | \`fallback\` | Background activities when idle |
169
- | \`session\` | Session management |
170
- | \`topics\` | List all available topics |
171
-
172
- ## MCP Server Not Connected?
173
-
174
- ### Quick Setup (Claude Code)
175
-
176
- \`\`\`bash
177
- claude mcp add vibescope npx @vibescope/mcp-server@latest \\
178
- --env VIBESCOPE_API_KEY=your_key
179
- \`\`\`
180
-
181
- ### Manual Setup
182
-
183
- 1. Copy \`.mcp.json.example\` to \`.mcp.json\`
184
- 2. Get \`VIBESCOPE_API_KEY\` from https://vibescope.dev/dashboard/settings
185
- 3. Restart Claude Code
186
- `;
187
-
188
- /**
189
- * Get the agent guidelines template
190
- * @returns The full agent guidelines markdown template
191
- */
192
- export function getAgentGuidelinesTemplate(): string {
193
- return AGENT_GUIDELINES_TEMPLATE;
194
- }
195
-
196
- /**
197
- * Get a summary of the agent guidelines for inclusion in responses
198
- * @returns A brief summary of key guidelines
199
- */
200
- export function getAgentGuidelinesSummary(): string {
201
- return `## Essential Agent Guidelines
202
-
203
- 1. **MCP Connection Required** - If start_work_session fails, END SESSION IMMEDIATELY
204
- 2. **Always call complete_task()** - After creating a PR, call complete_task() right away
205
- 3. **Use git worktrees** - Create worktrees for each task to avoid conflicts
206
- 4. **Never ask permission** - Just continue working, clear context when needed
207
- 5. **Continuous work** - Never stop; use get_next_task or fallback activities
208
-
209
- For full guidelines, create a \`.claude/CLAUDE.md\` file in your project with the agent guidelines template.`;
210
- }
1
+ /**
2
+ * Agent Guidelines Template
3
+ *
4
+ * This template contains the essential CLAUDE.md content that should be included
5
+ * in every project using Vibescope for agent tracking. These guidelines ensure
6
+ * agents follow proper workflows and maintain visibility.
7
+ */
8
+
9
+ export const AGENT_GUIDELINES_TEMPLATE = `# Vibescope Agent Guidelines
10
+
11
+ ## Quick Start
12
+
13
+ \`\`\`
14
+ start_work_session(git_url: "https://github.com/YOUR/REPO", model: "opus")
15
+ \`\`\`
16
+
17
+ **IMPORTANT:** Always pass your model (opus/sonnet/haiku) to enable cost tracking. Check your system prompt for "You are powered by the model named..." to determine your model.
18
+
19
+ This returns your persona, project info, and \`next_task\`. Start working immediately.
20
+
21
+ ## CRITICAL: MCP Connection Required
22
+
23
+ **If the Vibescope MCP server fails to connect, you MUST end your session immediately.**
24
+
25
+ ### Why This Is Non-Negotiable
26
+
27
+ Working without MCP connection causes:
28
+ - **No progress visibility** - Humans can't see what you're doing
29
+ - **Lost work tracking** - Tasks aren't tracked, time is wasted
30
+ - **Workflow violations** - Other agents may conflict with your work
31
+ - **Dashboard confusion** - Project state becomes inconsistent
32
+
33
+ ### Connection Failure Handling
34
+
35
+ **If \`start_work_session\` fails or returns an error:**
36
+
37
+ 1. **Do NOT proceed with any work**
38
+ 2. **Inform the user** that MCP connection failed
39
+ 3. **End the session** - do not attempt workarounds
40
+ 4. **Provide troubleshooting steps:**
41
+ - Check if MCP server is configured: \`claude mcp list\`
42
+ - Verify API key is set: check \`.mcp.json\` or environment
43
+ - Restart Claude Code after fixing configuration
44
+
45
+ **Example error responses you might see:**
46
+ \`\`\`
47
+ Error: Failed to start session
48
+ Error: VIBESCOPE_API_KEY not set
49
+ Error: Network error connecting to Vibescope API
50
+ Error: MCP server 'vibescope' not found
51
+ \`\`\`
52
+
53
+ ### Recovery Steps
54
+
55
+ If MCP connection fails, tell the user:
56
+
57
+ \`\`\`
58
+ MCP connection to Vibescope failed. I cannot proceed without task tracking.
59
+
60
+ To fix:
61
+ 1. Run: claude mcp list (verify vibescope is configured)
62
+ 2. Check API key: ensure VIBESCOPE_API_KEY is set
63
+ 3. Restart Claude Code
64
+ 4. Try again with: start_work_session(git_url: "...")
65
+
66
+ I am ending this session to prevent untracked work.
67
+ \`\`\`
68
+
69
+ **Never "work around" a broken MCP connection.** The whole point of Vibescope is visibility and coordination. Working without it defeats the purpose.
70
+
71
+ ## Core Workflow
72
+
73
+ 1. **Start session** → \`start_work_session(git_url, model)\` - Always include your model!
74
+ 2. **Mark task in progress** → \`update_task(task_id, status: "in_progress")\` - Returns git workflow instructions!
75
+ 3. **Set up worktree** → Create isolated worktree for this task (see Git Workflow below)
76
+ 4. **Update progress** → \`update_task(task_id, progress_percentage: 50, progress_note: "...")\`
77
+ 5. **Complete task** → \`complete_task(task_id, summary: "...")\` - **MANDATORY, see below!**
78
+ 6. **Clean up** → Remove worktree, then start next task immediately
79
+
80
+ ## CRITICAL: Always Call complete_task (MANDATORY)
81
+
82
+ **You MUST call \`complete_task()\` when you finish a task.** This is not optional.
83
+
84
+ ### When to Call complete_task
85
+
86
+ Call \`complete_task()\` immediately after:
87
+ - ✅ Creating and pushing a PR
88
+ - ✅ Merging changes (for trunk-based workflow)
89
+ - ✅ Finishing any unit of work, even if no code changes
90
+
91
+ **Do NOT wait for:**
92
+ - ❌ PR to be reviewed/merged (that's what validation is for)
93
+ - ❌ User confirmation
94
+ - ❌ "Perfect" summary - a brief summary is fine
95
+
96
+ ### The Rule
97
+
98
+ \`\`\`
99
+ PR created + pushed → complete_task() → THEN worry about next steps
100
+ \`\`\`
101
+
102
+ **If you create a PR and don't call \`complete_task()\`, you have failed the workflow.**
103
+
104
+ ## CRITICAL: Git Worktrees for Multi-Agent
105
+
106
+ When multiple agents share a repository, you **MUST** use git worktrees to prevent conflicts.
107
+
108
+ **Before starting ANY task:**
109
+ \`\`\`bash
110
+ # For git-flow: ensure you're on develop first, then create worktree
111
+ git checkout develop
112
+ git pull origin develop
113
+ git worktree add ../worktree-<task-short-id> -b feature/<task-id>-<title>
114
+ cd ../worktree-<task-short-id>
115
+ \`\`\`
116
+
117
+ **After task is merged:**
118
+ \`\`\`bash
119
+ git worktree remove ../worktree-<task-short-id>
120
+ \`\`\`
121
+
122
+ **Why?** Branch switching in shared repos causes file conflicts between agents. Worktrees provide isolated directories.
123
+
124
+ Run \`get_help("git")\` for full worktree documentation.
125
+
126
+ ## CRITICAL: Never Ask Permission
127
+
128
+ **You must NEVER:**
129
+ - Ask "Should I continue to the next task?" → Just continue
130
+ - Ask "Should I clear my context?" → Just clear it
131
+ - Ask "What should I do next?" → Check \`next_task\` or use fallback activities
132
+ - Say "All tasks are done, let me know what to do" → Use \`get_next_task\` or start fallback activity
133
+ - Wait for confirmation before clearing context → Just do it
134
+
135
+ **You must ALWAYS:**
136
+ - Call \`complete_task()\` immediately after creating/pushing a PR - this is non-negotiable
137
+ - Immediately start the next task after completing one
138
+ - Clear context and restart session automatically when needed
139
+ - Keep working until there are genuinely no tasks and no fallback activities
140
+
141
+ ## Continuous Work
142
+
143
+ **IMPORTANT: Never stop working!** When you complete a task:
144
+ 1. \`complete_task\` returns \`next_task\` → Start it immediately
145
+ 2. No \`next_task\`? → Call \`get_next_task(project_id)\`
146
+ 3. Still no tasks? → Start a \`fallback_activity\` (code_review, security_review, etc.)
147
+
148
+ **When context grows large or responses slow down:**
149
+ 1. Run \`/clear\` to reset conversation
150
+ 2. Immediately call \`start_work_session(git_url, model)\` to reload context
151
+ 3. Continue with \`next_task\` from the response
152
+
153
+ **Do NOT ask the user if you should clear context. Just do it.** The dashboard tracks all your progress, so nothing is lost when you clear.
154
+
155
+ ## Need Help?
156
+
157
+ Use \`get_help(topic)\` for detailed guidance:
158
+
159
+ | Topic | Description |
160
+ |-------|-------------|
161
+ | \`getting_started\` | Basic workflow overview |
162
+ | \`tasks\` | Working on tasks, progress tracking |
163
+ | \`validation\` | Cross-agent task validation |
164
+ | \`deployment\` | Deployment coordination |
165
+ | \`git\` | Git workflow configuration |
166
+ | \`blockers\` | Handling blockers |
167
+ | \`milestones\` | Breaking down complex tasks |
168
+ | \`fallback\` | Background activities when idle |
169
+ | \`session\` | Session management |
170
+ | \`topics\` | List all available topics |
171
+
172
+ ## MCP Server Not Connected?
173
+
174
+ ### Quick Setup (Claude Code)
175
+
176
+ \`\`\`bash
177
+ claude mcp add vibescope npx @vibescope/mcp-server@latest \\
178
+ --env VIBESCOPE_API_KEY=your_key
179
+ \`\`\`
180
+
181
+ ### Manual Setup
182
+
183
+ 1. Copy \`.mcp.json.example\` to \`.mcp.json\`
184
+ 2. Get \`VIBESCOPE_API_KEY\` from https://vibescope.dev/dashboard/settings
185
+ 3. Restart Claude Code
186
+ `;
187
+
188
+ /**
189
+ * Get the agent guidelines template
190
+ * @returns The full agent guidelines markdown template
191
+ */
192
+ export function getAgentGuidelinesTemplate(): string {
193
+ return AGENT_GUIDELINES_TEMPLATE;
194
+ }
195
+
196
+ /**
197
+ * Get a summary of the agent guidelines for inclusion in responses
198
+ * @returns A brief summary of key guidelines
199
+ */
200
+ export function getAgentGuidelinesSummary(): string {
201
+ return `## Essential Agent Guidelines
202
+
203
+ 1. **MCP Connection Required** - If start_work_session fails, END SESSION IMMEDIATELY
204
+ 2. **Always call complete_task()** - After creating a PR, call complete_task() right away
205
+ 3. **Use git worktrees** - Create worktrees for each task to avoid conflicts
206
+ 4. **Never ask permission** - Just continue working, clear context when needed
207
+ 5. **Continuous work** - Never stop; use get_next_task or fallback activities
208
+
209
+ For full guidelines, create a \`.claude/CLAUDE.md\` file in your project with the agent guidelines template.`;
210
+ }