@bridge_gpt/mcp-server 0.1.16 → 0.2.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 (50) hide show
  1. package/README.md +333 -162
  2. package/build/agent-capabilities/cli.js +152 -0
  3. package/build/agent-capabilities/default-deps.js +45 -0
  4. package/build/agent-capabilities/probe-context.js +111 -0
  5. package/build/agent-capabilities/probes.js +278 -0
  6. package/build/agent-capabilities/reporter.js +50 -0
  7. package/build/agent-capabilities/runner.js +56 -0
  8. package/build/agent-capabilities/types.js +10 -0
  9. package/build/agent-launchers/claude.js +85 -0
  10. package/build/agent-launchers/index.js +17 -0
  11. package/build/agent-launchers/types.js +1 -0
  12. package/build/agents.generated.js +1 -1
  13. package/build/brainstorm-files.js +89 -0
  14. package/build/bridge-config.js +404 -0
  15. package/build/chain-orchestrator.js +1364 -0
  16. package/build/chain-utils.js +68 -0
  17. package/build/commands.generated.js +5 -3
  18. package/build/credential-materialization.js +128 -0
  19. package/build/credential-store.js +232 -0
  20. package/build/decision-page-schema.js +39 -6
  21. package/build/decision-page-template.js +54 -18
  22. package/build/doctor.js +18 -2
  23. package/build/fetch-stub.js +139 -0
  24. package/build/git-ignore-utils.js +63 -0
  25. package/build/index.js +1623 -546
  26. package/build/mcp-invoke.js +417 -0
  27. package/build/mcp-provisioning.js +249 -0
  28. package/build/mcp-registration-doctor.js +96 -0
  29. package/build/pipeline-orchestrator.js +66 -1
  30. package/build/pipeline-utils.js +33 -0
  31. package/build/pipelines.generated.js +165 -5
  32. package/build/schedule-run.js +951 -0
  33. package/build/schedule-store.js +132 -0
  34. package/build/scheduler-backends/at-fallback.js +144 -0
  35. package/build/scheduler-backends/escaping.js +113 -0
  36. package/build/scheduler-backends/index.js +72 -0
  37. package/build/scheduler-backends/launchd.js +216 -0
  38. package/build/scheduler-backends/systemd-user.js +237 -0
  39. package/build/scheduler-backends/task-scheduler.js +219 -0
  40. package/build/scheduler-backends/types.js +23 -0
  41. package/build/start-tickets-prereqs.js +90 -1
  42. package/build/start-tickets.js +222 -70
  43. package/build/third-party-mcp-targets.js +75 -0
  44. package/build/version.generated.js +1 -1
  45. package/package.json +8 -8
  46. package/pipelines/full-automation.json +49 -0
  47. package/pipelines/idea-to-ticket.json +71 -0
  48. package/pipelines/implement-ticket.json +28 -2
  49. package/smoke-test/SMOKE-TEST.md +511 -0
  50. package/smoke-test/smoke-test-mcp.md +23 -0
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  MCP server for [Bridge API](https://bridgegpt-api.com) — exposes Jira integration endpoints as MCP tools for AI coding agents. Works with Claude Code, VS Code/Copilot, Cursor, Windsurf, and OpenAI Codex.
4
4
 
5
+ > **New here?** Jump to [Usage Documentation](#usage-documentation) for what you can actually do with Bridge, grouped by how often you'll reach for it.
6
+
5
7
  ## Getting Started
6
8
 
7
9
  ### 1. Install the Package
@@ -21,60 +23,6 @@ npx -y @bridge_gpt/mcp-server --init
21
23
 
22
24
  Re-run `--init` after upgrading the package to get updated commands.
23
25
 
24
- ### Upgrading
25
-
26
- To upgrade to the latest version and refresh all scaffolded artifacts in one step:
27
-
28
- ```bash
29
- npx -y @bridge_gpt/mcp-server --upgrade
30
- ```
31
-
32
- This runs `npm i @bridge_gpt/mcp-server@latest`, prints a before/after version summary, then re-runs the full `--init` scaffolding flow to update your slash commands, agents, and pipeline definitions.
33
-
34
- The MCP server also checks for updates automatically on startup. If a newer version is available, you'll see a notice in your editor's MCP output logs with the upgrade command to run. This check is cached for 24 hours and never blocks server startup.
35
-
36
- ### CLI subcommand: `start-tickets`
37
-
38
- Beyond `--init` / `--upgrade`, the package ships a `start-tickets` subcommand that spawns one Worktrunk worktree + selected-agent session per Jira ticket. The agent defaults to **Claude Code** (`claude`) and is configurable via `--agent`. It is part of the **existing `bridge-api-mcp-server` bin** — not a separate binary — so it travels with the package to every consumer. It also backs the `/start-tickets` slash command.
39
-
40
- ```
41
- npx -y @bridge_gpt/mcp-server start-tickets [flags] KEY [KEY ...]
42
- ```
43
-
44
- | Flag | Default | Meaning |
45
- |---|---|---|
46
- | `--agent claude\|cursor-agent` | `claude` | Agent command to launch in each worktree |
47
- | `--terminal terminal\|iterm` | auto-detect via `$TERM_PROGRAM` | Override the macOS terminal app (honored on macOS only) |
48
- | `--dry-run` | off | Print intended actions; create no worktrees, open no tabs (any OS) |
49
- | `--branch KEY=BRANCH` | `feature/<KEY>` | Use a custom branch for that ticket (repeatable) |
50
- | `--no-refresh-main` | off | Skip `git fetch origin main` + fast-forward of local `main` |
51
- | `--max-parallel N` | `3` | Max worktrees created concurrently |
52
- | `-h`, `--help` | — | Show usage |
53
-
54
- Each `KEY` must match `[A-Z]+-[0-9]+` (e.g., `BAPI-248`). The CLI creates/switches each worktree up front (throttled by `--max-parallel`), then opens one tab/session per successful worktree running the selected agent's `'/implement-ticket <KEY>'` — `claude '/implement-ticket <KEY>'` by default, or `cursor-agent '/implement-ticket <KEY>'` with `--agent cursor-agent`. The `/implement-ticket <KEY>` prompt is unchanged for both agents. To launch Cursor Agent instead of Claude Code:
55
-
56
- ```
57
- npx -y @bridge_gpt/mcp-server start-tickets --agent cursor-agent BAPI-248
58
- ```
59
-
60
- **Cross-platform spawning.** The CLI routes spawning per platform; `--dry-run` previews the platform-correct command form on any OS. An unsupported `process.platform` (not `darwin`/`win32`/`linux`) fails fast with a clear "unsupported platform" message.
61
-
62
- - **macOS** — opens a Terminal.app or iTerm tab via `osascript`.
63
- - **Windows** — creates worktrees with **`git-wt`** (Worktrunk's winget alias) and opens a tab via **Windows Terminal (`wt.exe new-tab`)**, falling back to **`Start-Process powershell.exe`** when Windows Terminal is absent. Requires **Git for Windows / Git Bash** (Worktrunk runs its `pre-start` / `post-start` hooks via Git Bash). The Worktrunk binary (`git-wt`) and the tab launcher (`wt.exe`) are resolved independently and never conflated.
64
- - **Linux** — creates one detached **tmux** session per ticket (pane kept open after the agent exits); attach with `tmux attach -t <session>`. A missing `tmux` produces a clear, actionable error.
65
-
66
- Per-OS prerequisites: macOS `wt`, `git`, `osascript`; Windows `git-wt`, Git for Windows / Git Bash, Windows Terminal or PowerShell; Linux `wt`, `git`, `tmux`. Set `BAPI_WORKTRUNK_BIN` to override the Worktrunk executable name/path for nonstandard installs (`doctor` honors it too). The read-only `doctor` subcommand (below) additionally surfaces a missing `uv` — Worktrunk's `pre-start` hook runs `uv`, but live preflight does not check it — and the selected agent's command; run `doctor --agent cursor-agent` to also check `cursor-agent` (it prints `cursor-agent login` as an informational auth reminder).
67
-
68
- ### CLI subcommand: `doctor`
69
-
70
- The package also ships a strictly **read-only** `doctor` subcommand that diagnoses the `start-tickets` prerequisites for the current OS without changing anything:
71
-
72
- ```
73
- npx -y @bridge_gpt/mcp-server doctor [--agent <name>]
74
- ```
75
-
76
- It is **read-only**: it never installs anything, modifies your system, adds an npm `postinstall`, spawns a terminal, or starts the MCP server, and there is no `--fix`. For each prerequisite it prints found/missing and, when missing, the exact per-OS install command **as a manual instruction you run yourself**. The checked set is the `start-tickets` preflight prerequisites **plus `uv`** **plus the selected agent's command** (`claude` by default, or `cursor-agent` with `--agent cursor-agent`). The Worktrunk binary is probed via the resolved name (honoring `BAPI_WORKTRUNK_BIN`), not a hard-coded one. **Exit code:** `0` when all required prerequisites are present, non-zero when any is missing or the platform is unsupported. A failing `start-tickets` preflight now hints you to run `doctor` for an actionable diagnostics report.
77
-
78
26
  ### 2. Generate an API Key
79
27
 
80
28
  1. Log in to [Bridge API](https://bridgegpt-api.com) and navigate to your project's **Security** page
@@ -197,150 +145,250 @@ BAPI_DOCS_DIR = "docs/tmp"
197
145
 
198
146
  After saving the config, restart your editor or reload the MCP server connection. Verify connectivity by asking your AI assistant to call the `ping` tool.
199
147
 
200
- ### First-Time Setup: Teach Bridge Your Codebase
148
+ ### 4. First-Time Setup: Teach Bridge Your Codebase
201
149
 
202
150
  If you're the first person to install Bridge API on your project, run the `/learn-repository` slash command after completing setup. This analyzes your codebase's architecture, testing patterns, code review standards, and documentation conventions, then uploads the findings to Bridge API. This gives Bridge the context it needs to generate implementation plans, ticket critiques, and code reviews that are consistent with your project's actual architecture and conventions.
203
151
 
204
152
  You only need to do this once per project — the learned standards persist for all team members.
205
153
 
206
- ## Pipelines
154
+ ### Upgrading
207
155
 
208
- Pipelines are declarative, multi-step workflows that your AI agent executes step-by-step. Each pipeline is a JSON recipe that chains MCP tool calls and free-form agent tasks, with variable substitution, per-step error handling, and optional approval gates. Bridge ships with built-in pipelines; you can also write your own (see [Custom Pipelines](#custom-pipelines)).
156
+ To upgrade to the latest version and refresh all scaffolded artifacts in one step:
209
157
 
210
- | Pipeline | Description | Invoke with |
211
- |---|---|---|
212
- | `implement-ticket` | Generate a plan, execute the implementation, commit, open a PR, and monitor CI | `/implement-ticket PROJ-123` |
213
- | `review-ticket` | Two-round ticket quality review: clarifying questions and critique from multiple providers | `/review-ticket PROJ-123` |
214
- | `learn-repository` | Analyze codebase architecture, testing patterns, review standards, and documentation conventions, then upload to Bridge | `/learn-repository` |
215
- | `pr-ticket` | Commit changes and open a pull request | `/create-pr PROJ-123` |
216
- | `check-ci-ticket` | Commit, open a PR, then monitor CI checks until they pass or fail | `/check-ci PROJ-123` |
158
+ ```bash
159
+ npx -y @bridge_gpt/mcp-server --upgrade
160
+ ```
217
161
 
218
- ## Commands
162
+ This runs `npm i @bridge_gpt/mcp-server@latest`, prints a before/after version summary, then re-runs the full `--init` scaffolding flow to update your slash commands, agents, and pipeline definitions.
219
163
 
220
- Commands are slash commands you invoke from your AI assistant's chat. Most orchestrate multi-step workflows; some are simple single-action utilities. Run `--init` to scaffold them into your project.
164
+ The MCP server also checks for updates automatically on startup. If a newer version is available, you'll see a notice in your editor's MCP output logs with the upgrade command to run. This check is cached for 24 hours and never blocks server startup.
221
165
 
222
- | Command | Description |
166
+ ## Usage Documentation
167
+
168
+ This is the Bridge API tooling worth knowing about as a software engineer — the things you'd ask an agent to do — grouped by how often you would use them. Each entry covers **what it does**, **when it's useful** and **how to use it**. The behind-the-scenes plumbing is summarized at the end under [Extra Capabilities](#extra-capabilities), and a full enumeration lives in [Reference](#reference).
169
+
170
+ For invocation, prefer the slash command — it's deterministic. A free-text example is shown only where natural-language phrasing reliably maps to the right automation; high-consequence or easily-misread automations show only the slash command on purpose.
171
+
172
+ ### Tier 1 — Regularly useful
173
+
174
+ These features are useful for most tickets.
175
+
176
+ **1. Review Ticket**
177
+ - **What it does:** Runs a two-round quality review of a ticket (clarifying questions + critique, plus an alternate-model second opinion) and produces a decision page to accept/reject findings.
178
+ - **When it's useful:** (Refinement) Right after a ticket is drafted, before anyone starts building — to surface gaps and tighten it.
179
+ - **How to use it:** `/review-ticket BAPI-123` (command only — "review" as free text is easily mistaken for a freehand agent review).
180
+ - **Flags:** `--auto` auto-accept findings / skip the approval gates.
181
+
182
+ **2. Start Tickets**
183
+ - **What it does:** Creates one git worktree per ticket and spawns an agent session in each to implement them in parallel.
184
+ - **When it's useful:** (Implementation | Automation) When you're ready to start building one or more refined tickets concurrently.
185
+ - **How to use it:** `/start-tickets BAPI-248 BAPI-250` (see [CLI Subcommands](#cli-subcommands) for the full flag table and cross-platform behavior).
186
+ - **Flags:** `--auto` skip the approval gates · `--base-branch <branch>` branch off something other than the default.
187
+
188
+ **3. Brainstorm**
189
+ - **What it does:** Fans your problem out to two different LLMs and synthesizes their approaches into one set of options. Runs in one of two modes: a **standard** brainstorm (implementation/architecture approaches) or a **design** brainstorm (UI/UX and visual direction).
190
+ - **When it's useful:** (Architecture | Refinement) Early, when you want a spread of approaches — standard for *how to build it*, design for *how it should look*.
191
+ - **How to use it:** ask your agent to brainstorm — *"Brainstorm approaches for adding rate limiting to the LLM client; fan it out to multiple models and synthesize."* For a design pass: *"Run a design brainstorm for the evidence-freshness dashboard UI."*
192
+
193
+ **4. Deep Research**
194
+ - **What it does:** Runs multi-source, fact-checked web research on a technical topic and returns a cited report.
195
+ - **When it's useful:** (Architecture | Refinement) When a decision hinges on outside knowledge (libraries, best practices, standards) you don't already have.
196
+ - **How to use it:** `/deep-research <question>`
197
+
198
+ **5. Jira Ticket Writer**
199
+ - **What it does:** An agent that drafts a well-structured Jira ticket from a plain description, applying your project's standards.
200
+ - **When it's useful:** (Refinement) When you have an idea in your head and want a properly-formatted ticket draft without writing it by hand.
201
+ - **How to use it:** `/write-ticket <description>` (or ask your agent) — *"Use the jira ticket writer to turn our conversation into a ticket."*
202
+ - **Flags:** `--standards <path>` apply a specific standards file when drafting.
203
+
204
+ **6. Upload Ticket**
205
+ - **What it does:** Pushes a drafted ticket up to Jira as a real issue (the `create_ticket` capability); handles markdown and child tickets under an Epic.
206
+ - **When it's useful:** (Refinement) The final step after drafting — to get the ticket into Jira so it can be tracked and worked.
207
+ - **How to use it:** Ask your agent to create the ticket, and it should confirm before creating the live Jira issue.
208
+ - **Options:** Describe the issue type (Bug / Story / Task / Epic) and, for a child under an Epic, the parent key.
209
+
210
+ ### Tier 2 — Occasionally useful
211
+
212
+ These features are good to know, but you probably won't use them every day.
213
+
214
+ **1. Second Opinion**
215
+ - **What it does:** Gets an immediate critique of any text from a different model family — no artifact saved, just the reply.
216
+ - **When it's useful:** (Architecture | Refinement | Implementation) Any time you want a quick sanity check on a plan, draft, or decision from a fresh perspective.
217
+ - **How to use it:** ask your agent — *"Get a second opinion from Gemini on whether the BAPI-123 plan's migration step is safe to run against prod."*
218
+ - **Options:** pick the provider (anthropic / openai / gemini) and the tier (cheap / basic / premium).
219
+
220
+ **2. Idea to Ticket**
221
+ - **What it does:** Turns a one-line idea into a Jira Task/Spike (or an Epic plus child tickets), with research, duplicate detection, and a critique pass built in.
222
+ - **When it's useful:** (Refinement | Automation) When you have a rough idea and want a fully-formed, uploaded ticket without the manual draft-and-refine loop.
223
+ - **How to use it:** `/idea-to-ticket <idea>`
224
+
225
+ **3. Explore Ticket**
226
+ - **What it does:** Explores the codebase for a task and recommends implementation options or surfaces clarifying questions, with optional research.
227
+ - **When it's useful:** (Architecture | Refinement) Before writing a ticket or plan, when you're unsure how a change would fit the existing code.
228
+ - **How to use it:** `/explore-ticket <task>` — *"Explore the codebase for how we'd add a Mistral LLM provider and recommend 2–3 implementation options."*
229
+
230
+ **4. Plan Ticket**
231
+ - **What it does:** Generates a step-by-step implementation plan for a ticket, with references to real code files, and saves it locally.
232
+ - **When it's useful:** (Refinement | Implementation) Once a ticket is solid and you want a concrete build plan before (or instead of) auto-implementing.
233
+ - **How to use it:** `/plan-ticket BAPI-123`
234
+ - **Flags:** `--provider <name>` choose the model provider · `--second-opinion <provider>` cross-check the plan with a second provider.
235
+
236
+ **5. Clarify Ticket**
237
+ - **What it does:** Generates clarifying questions for a ticket (or debugging guidance for bugs) and saves them locally.
238
+ - **When it's useful:** (Refinement) When a ticket feels under-specified and you want the open questions made explicit.
239
+ - **How to use it:** `/clarify-ticket BAPI-123` — *"Generate clarifying questions for BAPI-123"*
240
+ - **Flags:** `--provider <name>` choose the model provider · `--second-opinion <provider>` cross-check with a second provider.
241
+
242
+ **6. Critique Ticket**
243
+ - **What it does:** Critiques a ticket's quality against your project standards and lists deviations + improvements.
244
+ - **When it's useful:** (Refinement) When you want a quality gate on a ticket before it's worked.
245
+ - **How to use it:** `/critique-ticket BAPI-123` — *"Critique BAPI-123 against our project standards and list what's missing or deviating."*
246
+ - **Flags:** `--provider <name>` choose the model provider · `--second-opinion <provider>` cross-check with a second provider.
247
+
248
+ **7. Full Automation**
249
+ - **What it does:** Drives the whole chain end-to-end: idea → ticket(s) → review each → spawn worktrees to implement.
250
+ - **When it's useful:** (Automation) When you want to go from a raw idea to in-progress implementation with minimal hands-on steps.
251
+ - **How to use it:** `/full-automation <idea>` (command only — creates tickets, spawns worktrees, and carries scheduling/`--max-children` flags that free text can't).
252
+ - **Flags:** `--require-approval` toggle the approval gates, full automation runs end to end by default.
253
+
254
+ **8. Implement Ticket**
255
+ - **What it does:** Full build for one ticket: generate a plan, write the code, commit, open a PR, and monitor CI.
256
+ - **When it's useful:** (Implementation) When a ticket is ready and you want it taken from plan to open PR in one go.
257
+ - **How to use it:** `/implement-ticket BAPI-123` (command only — "implement X" as free text almost always triggers a freehand build instead of the Bridge plan→code→PR→CI pipeline).
258
+ - **Flags:** `--auto` skip the approval gates (e.g. auto-commit/push).
259
+
260
+ **9. Generate Image**
261
+ - **What it does:** Generates an image from a text prompt using a provider image model (OpenAI `gpt-image-2` by default, or Google Imagen) and returns the image directly. Spends provider credits on every call.
262
+ - **When it's useful:** (Architecture | Refinement) When you want a quick visual — a UI mockup, diagram, or illustration — to anchor a design discussion or attach to a ticket.
263
+ - **How to use it:** ask your agent — *"Generate an image of a dashboard showing SOC2 evidence freshness as a traffic-light grid."*
264
+ - **Options:** `provider` openai (`gpt-image-2`) / gemini (Imagen — adds an invisible SynthID watermark) · `quality` low (default, cheapest) / medium / high · `size` 1024x1024 / 1024x1536 / 1536x1024 · `save_locally` write the image to `docs/images`.
265
+
266
+ ### Tier 3 — Now and then
267
+
268
+ These features are useful once in a while, but you probably won't need them everyday.
269
+
270
+ **1. Reimplement Ticket**
271
+ - **What it does:** Pulls in new context/attachments since the last pass and implements small follow-up changes on an already-built ticket.
272
+ - **When it's useful:** (Implementation) After review feedback or new screenshots, when you need a targeted second pass rather than a fresh build.
273
+ - **How to use it:** `/reimplement-ticket BAPI-123`
274
+
275
+ **2. Run Tests**
276
+ - **What it does:** Runs the unit and E2E suites and autonomously triages/fixes failures (via the test-correction agent).
277
+ - **When it's useful:** (Implementation) After making changes, to confirm everything passes and auto-fix straightforward breakages.
278
+ - **How to use it:** `/run-tests` (`--unit-only`, `--skip-e2e`)
279
+
280
+ **3. Learn Repository**
281
+ - **What it does:** Researches and documents the repo's architecture, testing, review, and correctness standards, then saves them to Bridge for future agents.
282
+ - **When it's useful:** (Setup/Learning) When onboarding a new repo, or after big changes, so Bridge's agents follow your conventions.
283
+ - **How to use it:** `/learn-repository`
284
+
285
+ **4. Teach Bridge**
286
+ - **What it does:** Takes a plain-English instruction, figures out which standards field it belongs to, and merges it in (admin only).
287
+ - **When it's useful:** (Setup/Learning) When you notice the agents missing a convention and want to correct it in one sentence.
288
+ - **How to use it:** `/teach-bridge <teaching>` — *"Teach Bridge: always use data-testid selectors in E2E tests."*
289
+
290
+ **5. Update Ticket**
291
+ - **What it does:** Synthesizes a ticket's clarifying answers and critique into a rewritten description and pushes it to Jira.
292
+ - **When it's useful:** (Refinement) After review, to fold the resolved questions and fixes back into the ticket itself.
293
+ - **How to use it:** `/update-ticket BAPI-123` (command only — does a full overwrite of the live Jira description; "update" as free text is both vague and hard to reverse).
294
+
295
+ **6. Plan Epic**
296
+ - **What it does:** Decomposes a large epic into sub-tasks with a structured exploration doc for each.
297
+ - **When it's useful:** (Architecture | Refinement) When a feature is too big for one ticket and you need it broken down and scoped.
298
+ - **How to use it:** `/plan-epic <epic>` — *"Decompose the epic 'migrate PayPal token storage off Custom Objects' into sub-tasks with an exploration doc for each."*
299
+
300
+ **7. Download / Upload Attachment**
301
+ - **What it does:** Pulls files off a Jira ticket to disk, or attaches a local file to a ticket.
302
+ - **When it's useful:** (Refinement | Implementation) When a ticket has design files/logs you need locally, or you want to attach output back to it.
303
+ - **How to use it:** ask your agent — *"Download the design mockups attached to BAPI-123 into my docs folder."* / *"Attach build-log.txt to BAPI-123."*
304
+
305
+ **8. Write Comment**
306
+ - **What it does:** Posts a comment on a Jira ticket (markdown; long ones can attach as a file).
307
+ - **When it's useful:** (Refinement | Implementation) To leave context, status, or a decision trail on the ticket.
308
+ - **How to use it:** ask your agent — *"Post a comment on BAPI-123: blocked on the expired Atlassian token — will retry after it's rotated."*
309
+
310
+ **9. Get Ticket**
311
+ - **What it does:** Retrieves the full details of a Jira ticket (summary, status, description, etc.).
312
+ - **When it's useful:** (Refinement | Implementation) Any time you want the agent to read a ticket before acting on it.
313
+ - **How to use it:** ask your agent — *"Pull up BAPI-123 and show me its description, status, and acceptance criteria."*
314
+
315
+ ### Operational commands
316
+
317
+ Workflow commands you'll reach for during implementation and CI, beyond the tiers above:
318
+
319
+ | Command | What it does |
223
320
  |---|---|
224
- | `/check-ci [PROJ-123]` | Monitor CI checks for the current branch, triage failures, apply fixes, and report results |
225
- | `/check-parse-status` | Check whether a background repository parse job is still running |
226
- | `/clarify-ticket PROJ-123` | Generate clarifying questions for a ticket and save them locally |
227
321
  | `/code-ticket PROJ-123` | Download the implementation plan and questions, then execute the plan inline |
228
322
  | `/commit-ticket PROJ-123` | Stage, commit, and push changes; transition Jira status; post a smoke-test comment |
229
323
  | `/create-pr PROJ-123` | Commit staged changes and open a pull request |
230
- | `/critique-ticket PROJ-123` | Generate a ticket quality critique and save it locally |
231
- | `/explore-ticket [PROJ-123]` | Free-form codebase exploration — searches code, surfaces implementation options and questions |
232
- | `/implement-ticket PROJ-123` | Full end-to-end implementation: plan → code → commit → PR → CI |
233
- | `/learn-repository` | Teach Bridge API about your codebase (architecture, testing, review patterns) |
324
+ | `/check-ci [PROJ-123]` | Monitor CI checks for the current branch, triage failures, apply fixes, and report results |
234
325
  | `/parse-repository` | Queue a background job to index the repository for Bridge AI agents |
235
- | `/plan-ticket PROJ-123` | Generate an AI implementation plan and save it locally |
236
- | `/reimplement-ticket PROJ-123` | Follow-up implementation pass using previous implementation context |
237
- | `/review-ticket PROJ-123` | Two-round ticket quality review with critiques from multiple LLM providers |
238
- | `/run-tests` | Run the full test suite, triage failures, and classify issues as test bugs vs. implementation bugs |
326
+ | `/check-parse-status` | Check whether a background repository parse job is still running |
239
327
  | `/scan-tickets` | Sync recently-updated Jira tickets and backfill workflow timestamps |
240
- | `/start-tickets KEY [KEY ...]` | Spawn one Worktrunk worktree + selected-agent session per ticket via the packaged `start-tickets` CLI (Claude Code by default, `--agent cursor-agent` for Cursor; macOS Terminal/iTerm, Windows Terminal/PowerShell, or Linux tmux) |
241
- | `/teach-bridge` | Update a Bridge API configuration field via natural-language instructions |
242
- | `/update-ticket PROJ-123` | Fetch clarifying questions and critique, then rewrite the ticket description and push to Jira |
243
- | `/write-ticket` | Draft a new Jira ticket from a prompt and upload it |
244
328
 
245
329
  > Commands are designed for Claude Code. Other editors may support slash commands differently — check your editor's documentation for how to invoke prompt files.
246
330
 
247
- ## Available Tools
248
-
249
- MCP tools are the low-level primitives Bridge exposes to your AI assistant. You don't call them directly — ask your AI assistant to perform the task you need, or compose them into a custom pipeline.
250
-
251
- ### Connectivity
252
-
253
- | Tool | Description |
254
- |---|---|
255
- | `ping` | Verify connectivity and confirm your API key is valid |
331
+ ### Extra Capabilities
256
332
 
257
- ### Jira Tickets
333
+ Behind-the-scenes capabilities an agent gains from the MCP tools — mostly invoked automatically by the commands above, rarely requested by name:
258
334
 
259
- | Tool | Description |
260
- |---|---|
261
- | `get_tickets` | Search and list Jira tickets by query, status, or date |
262
- | `get_ticket` | Get full details for a single ticket |
263
- | `create_ticket` | Create a new Jira ticket |
264
- | `add_comment` | Post a comment on a ticket |
265
- | `update_ticket_description` | Replace a ticket's description |
266
- | `upload_attachment` | Upload a file as a ticket attachment |
335
+ - **Ship a PR end-to-end:** commit & push, open a pull request, transition the Jira status, and discover/poll CI checks (powers `commit-ticket`, `create-pr`, `check-ci`, `implement-ticket`).
336
+ - **Architecture plan** for a ticket (design-level guidance, separate from the implementation plan).
337
+ - **Index the codebase** so Bridge's agents can reason about it: queue/parse the repo, check parse status, regenerate the directory map.
338
+ - **Read & tune project config/standards:** list/read/update config fields, fetch project standards, and the per-topic `learn-*` commands that populate them.
339
+ - **Ticket lifecycle bookkeeping:** track tickets and backfill workflow-state timestamps (`scan-tickets`), search across tickets, read comments, list attachments.
340
+ - **Pipeline machinery:** list/inspect pipeline recipes and run/resume/list/delete pipeline runs (the engine under the orchestration commands).
341
+ - **Decision page** generation for capturing human review decisions as structured data.
342
+ - **Connectivity & identity checks:** ping Bridge, check your role, resolve the local docs directory.
343
+ - **Retrieve any generated artifact** (`get_*` for plans, critiques, questions, brainstorms, research, architecture) without regenerating it.
344
+ - **Tiered-section execution telemetry** recording (internal measurement).
267
345
 
268
- ### AI Generation
346
+ ## CLI Subcommands
269
347
 
270
- Async tools follow a request/get pattern: call the `request_*` tool to kick off generation, then call the matching `get_*` tool to retrieve the result (or pass `wait_for_result: true` to poll automatically).
348
+ Beyond `--init` / `--upgrade`, the package ships operational subcommands of the **single `bridge-api-mcp-server` bin** (not separate binaries) so they travel with the package to every consumer. See [Usage Documentation → Start Tickets](#tier-1--regularly-useful) for *when* to use `start-tickets`; this section is the full CLI reference.
271
349
 
272
- | Tool | Description |
273
- |---|---|
274
- | `request_plan_generation` | Request an AI-generated implementation plan |
275
- | `get_plan` | Retrieve a generated implementation plan |
276
- | `request_architecture` | Request an AI-generated architecture plan |
277
- | `get_architecture` | Retrieve a generated architecture plan |
278
- | `request_clarifying_questions` | Request clarifying questions for a ticket |
279
- | `get_clarifying_questions` | Retrieve generated clarifying questions |
280
- | `request_ticket_critique` | Request a ticket quality critique |
281
- | `get_ticket_critique` | Retrieve a generated ticket critique |
282
- | `request_reimplement_context` | Request context assembly for a follow-up implementation |
283
- | `get_reimplement_context` | Retrieve assembled reimplementation context |
284
- | `request_deep_research` | Submit a deep research query |
285
- | `get_deep_research` | Retrieve deep research results |
286
-
287
- ### Ticket Lifecycle
288
-
289
- | Tool | Description |
290
- |---|---|
291
- | `track_ticket` | Register a ticket for lifecycle tracking |
292
- | `update_ticket_state` | Update workflow timestamps for a tracked ticket |
293
- | `get_ticket_state` | Get workflow state and timestamps for a tracked ticket |
350
+ ### `start-tickets`
294
351
 
295
- ### Jira Status
352
+ Spawns one Worktrunk worktree + selected-agent session per Jira ticket and backs the `/start-tickets` slash command. The agent defaults to **Claude Code** (`claude`) and is configurable via `--agent`.
296
353
 
297
- | Tool | Description |
298
- |---|---|
299
- | `get_jira_transitions` | List available status transitions for a ticket |
300
- | `update_jira_status` | Transition a ticket to a new Jira status |
301
- | `resolve_target_status` | Resolve the post-PR target status for a project |
354
+ ```
355
+ npx -y @bridge_gpt/mcp-server start-tickets [flags] KEY [KEY ...]
356
+ ```
302
357
 
303
- ### Configuration
358
+ | Flag | Default | Meaning |
359
+ |---|---|---|
360
+ | `--agent claude\|cursor-agent` | `claude` | Agent command to launch in each worktree |
361
+ | `--terminal terminal\|iterm` | auto-detect via `$TERM_PROGRAM` | Override the macOS terminal app (honored on macOS only) |
362
+ | `--dry-run` | off | Print intended actions; create no worktrees, open no tabs (any OS) |
363
+ | `--branch KEY=BRANCH` | `feature/<KEY>` | Use a custom branch for that ticket (repeatable) |
364
+ | `--base-branch <BRANCH>` | `main` | Cut new worktrees from `<BRANCH>` and refresh `origin/<BRANCH>` instead of `main` |
365
+ | `--no-refresh-main` | off (the configured base branch is refreshed) | Skip refresh of the configured base branch (default `main`). Historical flag name preserved for backward compatibility — despite the name, it now skips refresh of whatever `--base-branch` resolves to. |
366
+ | `--max-parallel N` | `3` | Max worktrees created concurrently |
367
+ | `-h`, `--help` | — | Show usage |
304
368
 
305
- | Tool | Description |
306
- |---|---|
307
- | `get_project_standards` | Retrieve configured coding standards and architecture guidelines |
308
- | `list_config_fields` | List all available configuration fields |
309
- | `get_config_field` | Read the current value of a configuration field |
310
- | `update_config_field` | Update a configuration field |
311
- | `get_my_role` | Check the role and permissions for the current API key |
369
+ Each `KEY` must match `[A-Z]+-[0-9]+` (e.g., `BAPI-248`). The CLI creates/switches each worktree up front (throttled by `--max-parallel`), then opens one tab/session per successful worktree running the selected agent's `'/implement-ticket <KEY>'` — `claude '/implement-ticket <KEY>'` by default, or `cursor-agent '/implement-ticket <KEY>'` with `--agent cursor-agent`. The `/implement-ticket <KEY>` prompt is unchanged for both agents. To launch Cursor Agent instead of Claude Code:
312
370
 
313
- ### Repository & CI
371
+ ```
372
+ npx -y @bridge_gpt/mcp-server start-tickets --agent cursor-agent BAPI-248
373
+ ```
314
374
 
315
- | Tool | Description |
316
- |---|---|
317
- | `parse_repository` | Queue a background job to parse and index the repository |
318
- | `get_parse_status` | Check whether a repository parse is in progress |
319
- | `regenerate_directory_map` | Regenerate the repository directory map |
320
- | `create_pull_request` | Create a pull request on GitHub or Bitbucket |
321
- | `resolve_ci_checks` | Discover and classify CI checks for a commit |
322
- | `poll_ci_checks` | Poll the current status of CI checks |
375
+ **Cross-platform spawning.** The CLI routes spawning per platform; `--dry-run` previews the platform-correct command form on any OS. An unsupported `process.platform` (not `darwin`/`win32`/`linux`) fails fast with a clear "unsupported platform" message.
323
376
 
324
- ### Pipelines
377
+ - **macOS** — opens a Terminal.app or iTerm tab via `osascript`.
378
+ - **Windows** — creates worktrees with **`git-wt`** (Worktrunk's winget alias) and opens a tab via **Windows Terminal (`wt.exe new-tab`)**, falling back to **`Start-Process powershell.exe`** when Windows Terminal is absent. Requires **Git for Windows / Git Bash** (Worktrunk runs its `pre-start` / `post-start` hooks via Git Bash). The Worktrunk binary (`git-wt`) and the tab launcher (`wt.exe`) are resolved independently and never conflated.
379
+ - **Linux** — creates one detached **tmux** session per ticket (pane kept open after the agent exits); attach with `tmux attach -t <session>`. A missing `tmux` produces a clear, actionable error.
325
380
 
326
- | Tool | Description |
327
- |---|---|
328
- | `get_docs_dir` | Return the configured local docs directory path |
329
- | `list_pipelines` | List available pipeline recipes with names and descriptions |
330
- | `get_pipeline_recipe` | Retrieve a fully resolved pipeline recipe with variables substituted |
331
- | `run_pipeline` | Execute a pipeline end-to-end; pauses on `agent_task` steps with a `needs_agent_task` envelope |
332
- | `resume_pipeline` | Resume a paused run with the agent's result string |
333
- | `list_pipeline_runs` | List recent pipeline runs (metadata only) — useful for recovering a `pipeline_run_id` after compaction |
381
+ Per-OS prerequisites: macOS `wt`, `git`, `osascript`; Windows `git-wt`, Git for Windows / Git Bash, Windows Terminal or PowerShell; Linux `wt`, `git`, `tmux`. Set `BAPI_WORKTRUNK_BIN` to override the Worktrunk executable name/path for nonstandard installs (`doctor` honors it too). The read-only `doctor` subcommand (below) additionally surfaces a missing `uv` — Worktrunk's `pre-start` hook runs `uv`, but live preflight does not check it — and the selected agent's command; run `doctor --agent cursor-agent` to also check `cursor-agent` (it prints `cursor-agent login` as an informational auth reminder).
334
382
 
335
- ### Pipeline Response Envelope
383
+ ### `doctor`
336
384
 
337
- `run_pipeline`, `resume_pipeline`, and `list_pipeline_runs` share a unified envelope keyed on `status`:
385
+ The package also ships a strictly **read-only** `doctor` subcommand that diagnoses the `start-tickets` prerequisites for the current OS without changing anything:
338
386
 
339
- - `completed` — terminal success; `results` holds per-step output.
340
- - `needs_agent_task` the orchestrator paused. Read `instruction`, perform the task, then call `resume_pipeline` with `pipeline_run_id` and a string `agent_result`.
341
- - `failed` — terminal failure. `error_code` is one of `VALIDATION`, `NOT_FOUND`, `EXPIRED`, `REPO_MISMATCH`, `TOOL_ERROR`.
387
+ ```
388
+ npx -y @bridge_gpt/mcp-server doctor [--agent <name>]
389
+ ```
342
390
 
343
- Paused runs auto-expire after an idle TTL (default 24 hours; override with `ttl_seconds`). The TTL is reset on every state transition. List output is metadata-only it never includes resolved recipes, params, instructions, results, or agent outputs.
391
+ It is **read-only**: it never installs anything, modifies your system, adds an npm `postinstall`, spawns a terminal, or starts the MCP server, and there is no `--fix`. For each prerequisite it prints found/missing and, when missing, the exact per-OS install command **as a manual instruction you run yourself**. The checked set is the `start-tickets` preflight prerequisites **plus `uv`** **plus the selected agent's command** (`claude` by default, or `cursor-agent` with `--agent cursor-agent`). The Worktrunk binary is probed via the resolved name (honoring `BAPI_WORKTRUNK_BIN`), not a hard-coded one. **Exit code:** `0` when all required prerequisites are present, non-zero when any is missing or the platform is unsupported. A failing `start-tickets` preflight now hints you to run `doctor` for an actionable diagnostics report.
344
392
 
345
393
  ## Custom Pipelines
346
394
 
@@ -383,6 +431,40 @@ See `.bridge/pipelines/README.md` for the full schema reference.
383
431
 
384
432
  If a custom pipeline has the same key as a built-in pipeline, the custom version takes precedence (a warning is logged at startup).
385
433
 
434
+ ## Smoke testing
435
+
436
+ The package ships a canonical, **opt-in** in-host smoke-test runbook at
437
+ `smoke-test/SMOKE-TEST.md`. An AI agent running inside your host (Claude Code,
438
+ Cursor, Codex, Windsurf, or VS Code/Copilot) executes it to verify that the MCP
439
+ server actually works end-to-end *inside that host* — it calls the real tools and
440
+ records a PASS/FAIL verdict for each one in a markdown report.
441
+
442
+ - `smoke-test/SMOKE-TEST.md` **ships with the npm package** and is the
443
+ **canonical** source of truth for the smoke test.
444
+ - The smoke test **adds no MCP tool** and **does not change the registered
445
+ tool surface** (the server still registers its existing 55 tools).
446
+ - It is **opt-in**: default `--init` **does not scaffold `/smoke-test-mcp`**, so
447
+ consumer command palettes are not polluted.
448
+
449
+ ### Running it
450
+
451
+ You have two options:
452
+
453
+ 1. **Copy the opt-in command manually.** Copy the packaged command stub into your
454
+ host's command directory, then invoke `/smoke-test-mcp`:
455
+
456
+ ```bash
457
+ # Claude Code
458
+ cp node_modules/@bridge_gpt/mcp-server/smoke-test/smoke-test-mcp.md .claude/commands/smoke-test-mcp.md
459
+ # Cursor
460
+ cp node_modules/@bridge_gpt/mcp-server/smoke-test/smoke-test-mcp.md .cursor/commands/smoke-test-mcp.md
461
+ ```
462
+
463
+ 2. **Open the runbook directly.** Alternatively, open
464
+ `smoke-test/SMOKE-TEST.md` and ask the host agent to execute it.
465
+
466
+ Reports are written to `<BAPI_DOCS_DIR>/smoke-test/REPORT-<host>-<timestamp>.md`.
467
+
386
468
  ## Environment Variables
387
469
 
388
470
  | Variable | Required | Default | Description |
@@ -395,3 +477,92 @@ If a custom pipeline has the same key as a built-in pipeline, the custom version
395
477
  | `BAPI_PIPELINES_DIR` | No | `.bridge/pipelines` | Directory for user-defined custom pipeline JSON files |
396
478
  | `BAPI_WORKTRUNK_BIN` | No | `wt` (`git-wt` on Windows) | Override the Worktrunk executable name/path used by `start-tickets` for nonstandard installs |
397
479
  | `BAPI_TMUX_SESSION` | No | `bridge-start-tickets` | Override the tmux session-name prefix used by `start-tickets` on Linux |
480
+
481
+ ## Worktree credentials and the `mcp-invoke` shim
482
+
483
+ When `start-tickets` creates a git worktree, it provisions a Bridge API MCP
484
+ registration into that worktree so Claude Code (`.mcp.json`) and Cursor
485
+ (`.cursor/mcp.json`) can reach the server immediately. These registrations are
486
+ **secret-free**: they contain no `env` block and no API key. Instead they point
487
+ at an internal subcommand of the published single CLI bin, `mcp-invoke`:
488
+
489
+ ```bash
490
+ npx -y @bridge_gpt/mcp-server@<VERSION> mcp-invoke --target bapi --project-root <ABS_WORKTREE_PATH>
491
+ ```
492
+
493
+ `mcp-invoke` is not a separate binary — it is a positional subcommand of
494
+ `bridge-api-mcp-server`. It resolves the repo identity from the absolute
495
+ `--project-root` (the committed `.bridge/config` manifest, falling back to the
496
+ git common dir), resolves credentials from the home-directory credential store,
497
+ and then spawns the real MCP server with that environment.
498
+
499
+ ### Credential store
500
+
501
+ Credentials live outside the repository, keyed by `bapi:<repo_name>`:
502
+
503
+ ```json
504
+ {
505
+ "bapi:<repo_name>": {
506
+ "BAPI_API_KEY": "..."
507
+ }
508
+ }
509
+ ```
510
+
511
+ Resolution order:
512
+
513
+ 1. `BAPI_API_KEY` in the parent environment (overrides the file entirely).
514
+ 2. `$XDG_CONFIG_HOME/bridge/credentials.json`, else `~/.config/bridge/credentials.json`.
515
+ 3. `~/.bridge/credentials.json` (only when the primary path is absent).
516
+
517
+ On POSIX systems, lock the file down so only you can read it:
518
+
519
+ ```bash
520
+ chmod 600 ~/.config/bridge/credentials.json
521
+ ```
522
+
523
+ `mcp-invoke` warns (but continues) if the file is group/world-readable, and it
524
+ never creates or initializes the credential file for you.
525
+
526
+ ## Reference
527
+
528
+ The full surface, for when you need the complete enumeration. Day-to-day, use [Usage Documentation](#usage-documentation) instead — you don't call MCP tools directly; you ask your AI assistant to perform a task, or compose tools into a pipeline.
529
+
530
+ ### MCP tools
531
+
532
+ The server registers **55 tools**. Async AI tools follow a request/get pattern: call the `request_*` tool to kick off generation, then the matching `get_*` tool to retrieve the result (or pass `wait_for_result: true` to poll automatically).
533
+
534
+ - **Connectivity & identity** — `ping`, `get_my_role`, `get_docs_dir`
535
+ - **Jira tickets** — `get_tickets`, `get_ticket`, `create_ticket`, `update_ticket_description`, `add_comment`, `get_comments`
536
+ - **Attachments** — `list_attachments`, `upload_attachment`, `download_attachment`
537
+ - **AI generation (request/get)** — `request_plan_generation`/`get_plan`, `request_architecture`/`get_architecture`, `request_clarifying_questions`/`get_clarifying_questions`, `request_ticket_critique`/`get_ticket_critique`, `request_ticket_review`, `request_reimplement_context`/`get_reimplement_context`, `request_brainstorm`/`get_brainstorm`, `request_deep_research`/`get_deep_research`
538
+ - **Other AI** — `second_opinion`, `generate_image`, `generate_decision_page`
539
+ - **Ticket lifecycle** — `track_ticket`, `update_ticket_state`, `get_ticket_state`
540
+ - **Jira status** — `get_jira_transitions`, `update_jira_status`, `resolve_target_status`
541
+ - **Repository & CI** — `parse_repository`, `get_parse_status`, `regenerate_directory_map`, `create_pull_request`, `resolve_ci_checks`, `poll_ci_checks`
542
+ - **Pipelines & automation** — `list_pipelines`, `get_pipeline_recipe`, `run_pipeline`, `resume_pipeline`, `list_pipeline_runs`, `delete_pipeline_run`, `run_full_automation`, `resume_full_automation`
543
+ - **Config & telemetry** — `get_project_standards`, `list_config_fields`, `get_config_field`, `update_config_field`, `record_tiered_section_metric`
544
+
545
+ ### Bundled pipelines
546
+
547
+ Pipelines are declarative, multi-step workflows your AI agent executes step-by-step — each a JSON recipe chaining MCP tool calls and free-form agent tasks, with variable substitution, per-step error handling, and optional approval gates. You can also write your own (see [Custom Pipelines](#custom-pipelines)).
548
+
549
+ | Pipeline | Description | Invoke with |
550
+ |---|---|---|
551
+ | `implement-ticket` | Generate a plan, execute the implementation, commit, open a PR, and monitor CI | `/implement-ticket PROJ-123` |
552
+ | `review-ticket` | Two-round ticket quality review: clarifying questions and critique from multiple providers | `/review-ticket PROJ-123` |
553
+ | `idea-to-ticket` | Turn an idea into a Jira Task/Spike (or Epic + children) with research, dedup, and critique | `/idea-to-ticket "<idea>"` |
554
+ | `plan-epic` | Decompose an epic into sub-tasks with a structured exploration doc for each | `/plan-epic "<epic>"` |
555
+ | `full-automation` | Chain: idea → ticket(s) → review each → spawn worktrees to implement | `/full-automation "<idea>"` |
556
+ | `pr-ticket` | Commit changes and open a pull request | `/create-pr PROJ-123` |
557
+ | `check-ci-ticket` | Commit, open a PR, then monitor CI checks until they pass or fail | `/check-ci PROJ-123` |
558
+ | `learn-repository` | Analyze codebase architecture, testing, review, and documentation standards, then upload to Bridge | `/learn-repository` |
559
+
560
+ ### Pipeline response envelope
561
+
562
+ `run_pipeline`, `resume_pipeline`, and `list_pipeline_runs` share a unified envelope keyed on `status`:
563
+
564
+ - `completed` — terminal success; `results` holds per-step output.
565
+ - `needs_agent_task` — the orchestrator paused. Read `instruction`, perform the task, then call `resume_pipeline` with `pipeline_run_id` and a string `agent_result`.
566
+ - `failed` — terminal failure. `error_code` is one of `VALIDATION`, `NOT_FOUND`, `EXPIRED`, `REPO_MISMATCH`, `TOOL_ERROR`.
567
+
568
+ Paused runs auto-expire after an idle TTL (default 24 hours; override with `ttl_seconds`). The TTL is reset on every state transition. List output is metadata-only — it never includes resolved recipes, params, instructions, results, or agent outputs.