@zibby/skills 0.1.24 → 0.1.26

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.
@@ -0,0 +1,176 @@
1
+ ---
2
+ sidebar_position: 7
3
+ title: "@zibby/mcp-cli"
4
+ ---
5
+
6
+ # @zibby/mcp-cli
7
+
8
+ A Model Context Protocol (MCP) server that exposes the Zibby CLI surface — deploy, run, debug, trigger — to any MCP-aware AI agent. Install once, drive Zibby from Claude Code / Cursor / OpenAI Codex / Gemini CLI / Continue / Cline / Aider / Goose without leaving chat.
9
+
10
+ ```bash
11
+ # Not installed manually — the agent's `npx` invocation handles it.
12
+ # See "Install" below for per-agent config.
13
+ ```
14
+
15
+ ## What it exposes
16
+
17
+ 13 MCP tools, all wrapping the underlying `@zibby/cli`:
18
+
19
+ | Tool | What it does |
20
+ |---|---|
21
+ | `zibby_login` | Opens the user's browser for device-code OAuth. Saves session to `~/.zibby/config.json`. |
22
+ | `zibby_logout` | Clears the saved session. |
23
+ | `zibby_status` | Who is logged in, how many projects are cached, whether the session is still valid. |
24
+ | `zibby_list_projects` | List the Zibby projects the user has access to. |
25
+ | `zibby_list_templates` | List official workflow templates (browser-test-automation, code-analysis, generate-test-cases, …). |
26
+ | `zibby_scaffold_workflow` | Scaffold `.zibby/workflows/<name>/` from an official template. |
27
+ | `zibby_validate_workflow` | Static-check a local workflow (~30 ms, no API call). |
28
+ | `zibby_list_workflows` | List workflows: local, remote, or both. |
29
+ | `zibby_deploy_workflow` | Deploy a local workflow to a project. |
30
+ | `zibby_trigger_workflow` | Trigger a deployed workflow by UUID. Returns `jobId`. |
31
+ | `zibby_workflow_logs` | Fetch the latest N log lines from a run (one-shot — call again for newer lines). |
32
+ | `zibby_run_workflow_local` | Run a workflow on the user's machine one-shot, for debugging. No cloud. |
33
+ | `zibby_download_workflow` | Pull a deployed workflow back to local. Requires explicit `confirm: true` from the agent. |
34
+
35
+ **Destructive operations are intentionally not exposed.** Workflow deletion, env-var mutation, schedule changes, and credential management stay in the `zibby` CLI directly. The agent has to involve the user out-of-band for those.
36
+
37
+ ## Install
38
+
39
+ `@zibby/mcp-cli` ships as a stdio MCP server. The agent's host process spawns it via `npx -y` — no global install needed. The user just needs **Node.js ≥ 18** on their machine.
40
+
41
+ ### Claude Code
42
+
43
+ `~/.claude/settings.json`:
44
+
45
+ ```json
46
+ {
47
+ "mcpServers": {
48
+ "zibby": {
49
+ "command": "npx",
50
+ "args": ["-y", "@zibby/mcp-cli"]
51
+ }
52
+ }
53
+ }
54
+ ```
55
+
56
+ ### Cursor
57
+
58
+ `~/.cursor/mcp.json`:
59
+
60
+ ```json
61
+ {
62
+ "mcpServers": {
63
+ "zibby": {
64
+ "command": "npx",
65
+ "args": ["-y", "@zibby/mcp-cli"]
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ ### OpenAI Codex CLI
72
+
73
+ `~/.codex/config.toml`:
74
+
75
+ ```toml
76
+ [mcp_servers.zibby]
77
+ command = "npx"
78
+ args = ["-y", "@zibby/mcp-cli"]
79
+ ```
80
+
81
+ ### Gemini CLI
82
+
83
+ `~/.gemini/settings.json`:
84
+
85
+ ```json
86
+ {
87
+ "mcpServers": {
88
+ "zibby": {
89
+ "command": "npx",
90
+ "args": ["-y", "@zibby/mcp-cli"]
91
+ }
92
+ }
93
+ }
94
+ ```
95
+
96
+ ### Claude Desktop (macOS)
97
+
98
+ `~/Library/Application Support/Claude/claude_desktop_config.json`:
99
+
100
+ ```json
101
+ {
102
+ "mcpServers": {
103
+ "zibby": {
104
+ "command": "npx",
105
+ "args": ["-y", "@zibby/mcp-cli"]
106
+ }
107
+ }
108
+ }
109
+ ```
110
+
111
+ ### Windows
112
+
113
+ If your agent on Windows can't find `npx`, wrap with `cmd /c`:
114
+
115
+ ```json
116
+ {
117
+ "mcpServers": {
118
+ "zibby": {
119
+ "command": "cmd",
120
+ "args": ["/c", "npx", "-y", "@zibby/mcp-cli"]
121
+ }
122
+ }
123
+ }
124
+ ```
125
+
126
+ ## A typical agent chat
127
+
128
+ ```
129
+ User: Deploy the browser-test template to my "playhouse" project.
130
+ Agent: → zibby_list_projects
131
+ → zibby_scaffold_workflow (browser-test-automation → .zibby/workflows/playhouse-tests/)
132
+ → zibby_validate_workflow
133
+ → zibby_deploy_workflow
134
+ → "Deployed v1 of playhouse-tests. UUID 988…"
135
+
136
+ User: Run it against staging.zibby.dev.
137
+ Agent: → zibby_trigger_workflow (input: { url: "https://staging.zibby.dev" })
138
+ → zibby_workflow_logs (lines: 200, jobId: "abc-123")
139
+ → "Run completed. Found 0 errors."
140
+ ```
141
+
142
+ ## Auth model
143
+
144
+ Two-stage by design (mirrors how the `zibby` CLI works):
145
+
146
+ 1. **Session token** (`zibby_login`) — device-code OAuth via browser. Identifies the user.
147
+ 2. **Per-project API tokens** — fetched at login time and cached locally. The MCP server picks the right token automatically when you call a project-scoped tool like `zibby_deploy_workflow`.
148
+
149
+ All credentials live in `~/.zibby/config.json` (mode `0600`). The same file `zibby login` writes — so if you've already done `zibby login` from a terminal, the MCP server picks up that session.
150
+
151
+ The user's password never touches the MCP server: login is OAuth in the browser, and only the resulting session token comes back to the local file.
152
+
153
+ ## Security guarantees
154
+
155
+ - **No shell interpolation** — every CLI invocation uses `execFile` with argv arrays.
156
+ - **Minimum env passthrough** — only `HOME`, `USER`, `PATH`, and the project-scoped `ZIBBY_API_KEY` reach the child CLI process.
157
+ - **API tokens never returned to the agent** — they live in `~/.zibby/config.json` only, read server-side per call.
158
+ - **Destructive ops excluded** — see the table above.
159
+ - **`zibby_download_workflow` requires `confirm: true`** — the schema rejects calls without it. Agents must explicitly opt in after confirming the destination path with the user.
160
+
161
+ ## Troubleshooting
162
+
163
+ | Problem | Likely cause |
164
+ |---|---|
165
+ | `Not logged in` on every call | `~/.zibby/config.json` missing or corrupted. Call `zibby_login`. |
166
+ | `No API token cached for project` | Project list out of date. Call `zibby_list_projects` to refresh. |
167
+ | `npx -y` hangs on first install | First-time download. Subsequent invocations are cached by npm. |
168
+ | Tool times out on long deploys | The wrapped CLI command exceeded 10 min. Re-run from a terminal to see live output. |
169
+
170
+ ## Versioning
171
+
172
+ `@zibby/mcp-cli` pins a specific `@zibby/cli` version in its `dependencies`. Upgrading the MCP package upgrades the bundled CLI in lockstep. Users get the right CLI automatically — no need to coordinate two installs.
173
+
174
+ ## Source
175
+
176
+ [github.com/ZibbyHQ/zibby-agent → packages/mcps/cli](https://github.com/ZibbyHQ/zibby-agent/tree/main/packages/mcps/cli)
@@ -5,6 +5,8 @@ title: "@zibby/skills"
5
5
 
6
6
  # @zibby/skills
7
7
 
8
+ > Looking for skill-specific docs and examples? See [Skills reference](../skills/index.md).
9
+
8
10
  Built-in skill definitions for Zibby's test automation framework.
9
11
 
10
12
  ```bash
@@ -185,6 +185,6 @@ For workflows triggered remotely (rather than per-CI-run), use [`workflow trigge
185
185
 
186
186
  ## See also
187
187
 
188
- - [Recipes overview](./index)
188
+ - [Recipes overview](./)
189
189
  - [Concepts: graph](../concepts/graph) — the primitives this recipe uses
190
190
  - [Cloud triggering](../cloud/triggering) — fire workflows from CI/CD
@@ -0,0 +1,97 @@
1
+ ---
2
+ sidebar_position: 1
3
+ title: Browser
4
+ ---
5
+
6
+ # Browser skill
7
+
8
+ Playwright-driven browser automation. Click, type, navigate, snapshot, record video. Used by `zibby test` and by any workflow node that needs to drive a web UI.
9
+
10
+ - **ID:** `browser`
11
+ - **MCP server:** `playwright` (tools exposed as `mcp__playwright__*`)
12
+
13
+ ## Tools provided
14
+
15
+ The Playwright MCP server exposes the full Playwright tool surface. Common tools:
16
+
17
+ | Tool | What it does |
18
+ |---|---|
19
+ | `browser_navigate` | Open a URL in the active tab |
20
+ | `browser_click` | Click an element by stable id or selector |
21
+ | `browser_type` | Type text into an input |
22
+ | `browser_press_key` | Press a key (Enter, Tab, etc.) |
23
+ | `browser_snapshot` | Accessibility snapshot of the current page (returns stable ids) |
24
+ | `browser_take_screenshot` | PNG screenshot saved to the session output dir |
25
+ | `browser_wait_for` | Wait for text, time, or selector |
26
+ | `browser_evaluate` | Run JS in the page context |
27
+ | `browser_fill_form` | Fill multiple fields in one call |
28
+ | `browser_select_option` | Pick a `<select>` option |
29
+ | `browser_hover` | Hover over an element |
30
+ | `browser_drag` | Drag from one element to another |
31
+ | `browser_tabs` | List, switch, or close tabs |
32
+ | `browser_close` | Close the browser |
33
+
34
+ Refer to `@zibby/mcp-browser` for the full list. All tools are gated by the `mcp__playwright__*` allowlist.
35
+
36
+ ## Setup
37
+
38
+ No setup needed beyond a working `@zibby/cli` install — the cloud runner image and the global CLI install both pull `@zibby/mcp-browser` automatically.
39
+
40
+ For local dev outside the CLI, install it explicitly:
41
+
42
+ ```bash
43
+ npm install @zibby/mcp-browser
44
+ ```
45
+
46
+ Override the bin path with `MCP_BROWSER_PATH` if you need to point at a local checkout.
47
+
48
+ ## Use in a workflow
49
+
50
+ ```js
51
+ import { WorkflowAgent, WorkflowGraph } from '@zibby/core';
52
+ import { SKILLS } from '@zibby/skills';
53
+
54
+ export class LoginCheck extends WorkflowAgent {
55
+ buildGraph() {
56
+ const graph = new WorkflowGraph();
57
+ graph.addNode('login', {
58
+ agent: 'claude',
59
+ skills: [SKILLS.BROWSER],
60
+ prompt: (state) => `Go to ${state.appUrl}, sign in as test@example.com / hunter2,
61
+ then snapshot the dashboard and report whether the welcome banner is visible.`,
62
+ });
63
+ return graph;
64
+ }
65
+ }
66
+ ```
67
+
68
+ ### Config knobs
69
+
70
+ Passed via the node's skill config or env:
71
+
72
+ | Knob | Where | Effect |
73
+ |---|---|---|
74
+ | `headless: true` | per-skill config or `ZIBBY_HEADLESS=1` | Launch headless instead of headed |
75
+ | `sessionPath` | passed by the runner | Output dir for videos + screenshots |
76
+ | Viewport / video | fixed | 1280x720 |
77
+
78
+ ## Output example
79
+
80
+ `browser_snapshot` returns an accessibility tree with stable ids the agent can pass back to `browser_click`:
81
+
82
+ ```json
83
+ {
84
+ "url": "https://app.example.com/dashboard",
85
+ "title": "Dashboard",
86
+ "snapshot": [
87
+ { "id": "e7a1", "role": "button", "name": "New project" },
88
+ { "id": "e7b2", "role": "link", "name": "Settings" }
89
+ ]
90
+ }
91
+ ```
92
+
93
+ ## Implementation notes
94
+
95
+ Resolves to `@zibby/mcp-browser/dist/bin/mcp-browser-zibby.js` via `require.resolve`. There is no fallback to `@playwright/mcp` — the upstream Microsoft binary lacks stable IDs and event recording, and silently looks for Chrome instead of Chromium, which broke cloud runs. If the bin can't be resolved, `skill.resolve()` throws with installation instructions.
96
+
97
+ The MCP server is spawned with `--isolated --save-video=1280x720 --viewport-size=1280x720 --output-dir=<sessionPath>`. Videos and screenshots land under the run's session directory and are uploaded with the rest of the artifacts.
@@ -0,0 +1,93 @@
1
+ ---
2
+ sidebar_position: 8
3
+ title: Chat memory
4
+ ---
5
+
6
+ # Chat memory skill
7
+
8
+ Persistent agent memory across sessions — facts, decisions, preferences, task history. Dolt-backed by default; pluggable to mem0 for embedding-based recall.
9
+
10
+ - **ID:** `chat-memory`
11
+ - **Runs in-process** — no MCP spawn
12
+
13
+ For test-run history (selectors, page models, prior runs) see [Memory](./memory.md).
14
+
15
+ ## Tools provided
16
+
17
+ | Tool | What it does |
18
+ |---|---|
19
+ | `memory_store` | Save a fact/decision/preference. Categories: `fact`, `decision`, `context`, `insight`, `preference`, `credential`, `url`, `error`, `workaround`. Tiers: `short` (24h), `mid` (default), `long` (permanent). Optional `memoryKey` for upserts |
20
+ | `memory_recall` | Search by `query`, `category`, `ticketKey`, or `tier`. Ranked by relevance × recency |
21
+ | `memory_brief` | Compact briefing — recent sessions + top long/mid-tier memories. Call at conversation start |
22
+ | `memory_end_session` | Save a session summary + key facts (semicolon-separated) for future recall |
23
+ | `task_log` | Record a completed task (`test_run`/`generate`/`analysis`/`research`/`other`) with status |
24
+ | `task_history` | Query past tasks by `ticketKey`, `type`, `status` |
25
+
26
+ ## Setup
27
+
28
+ **Dolt (default).** Install Dolt; the skill auto-creates `.zibby/memory/` on first use.
29
+
30
+ ```bash
31
+ brew install dolt
32
+ ```
33
+
34
+ **mem0 (optional).** Set `ZIBBY_MEMORY_BACKEND=mem0` (or `memory.backend: 'mem0'` in `.zibby.config.mjs`) and `npm install mem0ai` in your workspace. Configure with:
35
+
36
+ ```bash
37
+ ZIBBY_MEM0_OPENAI_BASE_URL=https://api.openai.com/v1
38
+ ZIBBY_MEM0_API_KEY=sk-...
39
+ ZIBBY_MEM0_LLM_MODEL=gpt-4.1-mini
40
+ ZIBBY_MEM0_EMBEDDER_MODEL=text-embedding-3-small
41
+ ZIBBY_MEM0_EMBEDDING_DIMS=1536
42
+ ```
43
+
44
+ mem0 mode skips Dolt session/task tables and relies on embedding search; `memory_end_session`, `task_log`, and `task_history` still write to Dolt for cross-session continuity.
45
+
46
+ ## Use in a workflow
47
+
48
+ ```js
49
+ import { WorkflowAgent, WorkflowGraph } from '@zibby/core';
50
+ import { SKILLS } from '@zibby/skills';
51
+
52
+ export class ChatAgent extends WorkflowAgent {
53
+ buildGraph() {
54
+ const graph = new WorkflowGraph();
55
+ graph.addNode('respond', {
56
+ agent: 'claude',
57
+ skills: [SKILLS.CHAT_MEMORY, SKILLS.JIRA],
58
+ prompt: (state) => `At the start of this turn, call memory_brief to load
59
+ context. If you learn anything durable about the user's setup (e.g. their
60
+ default Jira project), call memory_store with category="preference", tier="long".
61
+ When the task is done, call memory_end_session with a 1-sentence summary.`,
62
+ });
63
+ return graph;
64
+ }
65
+ }
66
+ ```
67
+
68
+ The `memory_store` tool dedupes by normalized content — re-storing the same fact promotes its tier/relevance instead of inserting a duplicate. Long-tier rows decay 2%/session, mid-tier 10%, short-tier 30%, and short-tier rows older than 24h are deleted on next `memory_brief`.
69
+
70
+ ## Output example
71
+
72
+ `memory_brief`:
73
+
74
+ ```json
75
+ {
76
+ "recentSessions": [
77
+ { "session_id": "session_a1b2", "summary": "Reviewed SCRUM-123, added tests", "tickets": "SCRUM-123" }
78
+ ],
79
+ "topMemories": [
80
+ { "category": "preference", "tier": "long", "content": "Default Jira board: SCRUM" },
81
+ { "category": "fact", "tier": "mid", "content": "Auth login page is at /auth/login" }
82
+ ],
83
+ "taskStats": [
84
+ { "type": "test_run", "status": "passed", "cnt": 14 }
85
+ ]
86
+ }
87
+ ```
88
+
89
+ ## Implementation notes
90
+
91
+ `resolve()` returns `null` — this skill never spawns an MCP server. Tool calls are dispatched in-process via `handleToolCall(name, args, context)`, where `context.options.workspace` controls the Dolt directory.
92
+
93
+ The skill also implements `buildPromptContext(context, args)`, which the strategy calls at node start. It runs `memory_brief` internally and returns a markdown-formatted "Memory Context" block that gets prepended to the system prompt — so the model sees recent sessions and durable facts on every turn without needing an explicit tool call. The same call returns `debugPreview` for transcript logging.
@@ -0,0 +1,80 @@
1
+ ---
2
+ sidebar_position: 9
3
+ title: Core tools
4
+ ---
5
+
6
+ # Core tools skill
7
+
8
+ Baseline local capabilities — file read/write, directory listing, shell execution, URL opening, async wait. The equivalent of what Cursor or Claude Code gets natively.
9
+
10
+ - **ID:** `core-tools`
11
+ - **Runs in-process** — no MCP spawn
12
+
13
+ Most Claude/Cursor/Codex nodes get these tools by default from their agent strategy — you usually don't need to opt in explicitly. Add it to the `skills` array only if you're running a node where the strategy hasn't already wired them up (e.g. some custom strategies).
14
+
15
+ ## Tools provided
16
+
17
+ | Tool | What it does |
18
+ |---|---|
19
+ | `read_file` | Read a UTF-8 file. Max 256 KB; larger files return an error |
20
+ | `write_file` | Write content to a file, creating parent directories as needed |
21
+ | `list_directory` | List entries in a directory; directories suffixed with `/` |
22
+ | `run_command` | `execSync` a shell command. 30s timeout, 64 KB stdout cap, captures stderr |
23
+ | `open_url` | Open a URL in the default browser (uses `open`/`start`/`xdg-open`). Rejects non-http(s) URLs |
24
+ | `wait` | Sleep for N seconds (1–300). Respects `context.options.signal` for cancellation |
25
+
26
+ ## Setup
27
+
28
+ None. The skill has no env keys, no auth, no external dependencies.
29
+
30
+ ## Use in a workflow
31
+
32
+ ```js
33
+ import { WorkflowAgent, WorkflowGraph } from '@zibby/core';
34
+ import { SKILLS } from '@zibby/skills';
35
+
36
+ export class RepoInspector extends WorkflowAgent {
37
+ buildGraph() {
38
+ const graph = new WorkflowGraph();
39
+ graph.addNode('inspect', {
40
+ agent: 'claude',
41
+ skills: [SKILLS.CORE_TOOLS],
42
+ prompt: (state) => `cd into ${state.repoPath}. List the top-level directory,
43
+ then read package.json and report the dependency graph at one level deep.`,
44
+ });
45
+ return graph;
46
+ }
47
+ }
48
+ ```
49
+
50
+ All paths are resolved against `context.options.workspace` (the node's working directory) — relative paths are safe to pass.
51
+
52
+ ## Output example
53
+
54
+ `list_directory` returns a newline-separated string:
55
+
56
+ ```
57
+ package.json
58
+ node_modules/
59
+ src/
60
+ README.md
61
+ ```
62
+
63
+ `run_command`:
64
+
65
+ ```
66
+ on main
67
+ nothing to commit, working tree clean
68
+ ```
69
+
70
+ `open_url`:
71
+
72
+ ```json
73
+ { "ok": true, "opened": "https://zibby.dev" }
74
+ ```
75
+
76
+ ## Implementation notes
77
+
78
+ `resolve()` returns `null` — there is no MCP server. The strategy dispatches tool calls in-process via `handleToolCall(name, args, context)`. `wait` is the only async handler and polls the abort signal every 500 ms so the run can cancel mid-sleep.
79
+
80
+ `run_command` shells out with `execSync` and captures stdout. Long-running commands hit the 30s timeout — for builds or test runs use the dedicated `runner` or `test-runner` skills instead.
@@ -0,0 +1,93 @@
1
+ ---
2
+ sidebar_position: 10
3
+ title: Function skill
4
+ ---
5
+
6
+ # Function skill
7
+
8
+ Author a custom skill as a single async function. No MCP server to write, no spawn config, no glue — just a `handler({ args })` that returns a JSON-serializable result. Zibby auto-bridges it through MCP at runtime so any Claude/Cursor/Codex node can call it.
9
+
10
+ For wrapping a full external MCP server, use the same `skill()` factory with a `resolve()` instead of a `handler` — see the MCP skill example at the bottom.
11
+
12
+ ## API
13
+
14
+ ```js
15
+ import { skill } from '@zibby/skills';
16
+
17
+ export const myTool = skill('my_tool', {
18
+ description: 'One-line description shown to the model',
19
+ input: {
20
+ foo: 'string',
21
+ bar: { type: 'number', description: 'Optional knob', required: false },
22
+ },
23
+ handler: async ({ foo, bar = 0 }) => {
24
+ return { result: foo.repeat(bar) };
25
+ },
26
+ });
27
+ ```
28
+
29
+ | Field | Type | Notes |
30
+ |---|---|---|
31
+ | `description` | `string` | Shown to the LLM as the tool description |
32
+ | `input` | `Record<string, string \| { type, description?, required? }>` | Shorthand schema. String values mean `{ type: <string>, required: true }` |
33
+ | `handler` | `async (args) => any` | Return value is `JSON.stringify`'d back to the model |
34
+
35
+ Calling `skill()` both creates and **registers** the skill in the global registry, so just importing the module is enough to make it available.
36
+
37
+ ## Use in a workflow
38
+
39
+ Once registered, reference by id:
40
+
41
+ ```js
42
+ import { WorkflowAgent, WorkflowGraph } from '@zibby/core';
43
+ import './skills/my-tool.js'; // import for the side effect
44
+
45
+ graph.addNode('process', {
46
+ agent: 'claude',
47
+ skills: ['my_tool'],
48
+ prompt: (state) => `Call my_tool with foo="hello", bar=3 and report what you got back.`,
49
+ });
50
+ ```
51
+
52
+ The tool surfaces to the model as `my_tool` (and to MCP-aware strategies as `mcp__my_tool__my_tool`).
53
+
54
+ ## Output example
55
+
56
+ For the example above:
57
+
58
+ ```json
59
+ { "result": "hellohellohello" }
60
+ ```
61
+
62
+ If `handler` throws, the error message is returned to the model as the tool result so it can recover or retry.
63
+
64
+ ## Wrapping an external MCP server
65
+
66
+ Same factory, different shape — provide `resolve()` instead of `handler`:
67
+
68
+ ```js
69
+ import { skill } from '@zibby/skills';
70
+
71
+ export const linear = skill('linear', {
72
+ description: 'Linear issue tracker',
73
+ serverName: 'linear',
74
+ allowedTools: ['mcp__linear__*'],
75
+ envKeys: ['LINEAR_API_KEY'],
76
+ resolve() {
77
+ if (!process.env.LINEAR_API_KEY) return null;
78
+ return {
79
+ command: 'npx',
80
+ args: ['-y', '@anthropic/linear-mcp-server'],
81
+ env: { LINEAR_API_KEY: process.env.LINEAR_API_KEY },
82
+ };
83
+ },
84
+ });
85
+ ```
86
+
87
+ Return `null` from `resolve()` to silently disable the skill when its prerequisites aren't met (no env var, no bin, etc.) — the node still runs, the model just doesn't see those tools.
88
+
89
+ ## Implementation notes
90
+
91
+ Function skills route through a tiny stdio MCP bridge (`@zibby/core/function-bridge.js`) that the strategy spawns. The bridge imports your skill module, runs the handler in-process, and proxies the result back via MCP — so the agent SDK sees a real MCP server even though you didn't write one.
92
+
93
+ When you ship a skill in a published package, derive bin/module paths from `import.meta.url`, **not** `require.resolve('@your/pkg/...')`. esbuild emits a `dist/package.json` that makes package self-references resolve to `dist/...` instead of the package root, which silently breaks the lookup. Every Zibby-shipped skill (sentry, lark, jira) uses the `import.meta.url` pattern for this reason.
@@ -0,0 +1,91 @@
1
+ ---
2
+ sidebar_position: 4
3
+ title: GitHub
4
+ ---
5
+
6
+ # GitHub skill
7
+
8
+ Read repos, list and inspect PRs, search code and issues, read files, clone repositories, create issues.
9
+
10
+ - **ID:** `github`
11
+ - **MCP server:** `github` (tools exposed as `mcp__github__*`)
12
+ - **Underlying server:** `npx @modelcontextprotocol/server-github@latest`
13
+
14
+ ## Tools provided
15
+
16
+ | Tool | What it does |
17
+ |---|---|
18
+ | `github_list_repos` | List accessible repos (private + public). Defaults to all installation repos when no `owner` given |
19
+ | `github_search_repos` | Substring search across accessible repo names and descriptions |
20
+ | `github_get_user` | Authenticated user (or GitHub App installation owner) |
21
+ | `github_list_orgs` | Organizations with accessible repos |
22
+ | `github_clone` | `git clone` a repo locally, defaulting to `~/zibby-repos/<repo>`; accepts `destination` |
23
+ | `github_get_file` | Read a file's content (or list a directory) at a `ref` |
24
+ | `github_list_commits` | Recent commits on a branch, optionally filtered by `path` |
25
+ | `github_get_commit` | Full commit details + per-file patches |
26
+ | `github_search_issues` | GitHub search-syntax across issues and PRs |
27
+ | `github_search_code` | Code search, optionally scoped to `repo` or `language` |
28
+ | `github_get_pr` | PR metadata (title, branch, stats) |
29
+ | `github_get_pr_diff` | Unified diff (capped at 15 KB) |
30
+ | `github_list_pr_files` | Files changed in a PR with per-file patches |
31
+ | `github_list_pr_comments` | Review + issue comments combined, sorted ascending |
32
+ | `github_create_issue` | Create a new issue |
33
+
34
+ ## Setup
35
+
36
+ Two options:
37
+
38
+ **GitHub App (recommended).** In **Settings → Integrations**, click **Connect GitHub**, install the Zibby GitHub App on the orgs/repos you want, and authorize. Tokens auto-refresh; you don't manage them. See the [GitHub Integration page](../integrations/github.md) for the full app permissions list.
39
+
40
+ **Personal access token.** Set `GITHUB_TOKEN` in your workflow's env (locally) or via **Cloud → Env vars** (cloud runs). Scope `repo` for private read+write, `public_repo` for public-only.
41
+
42
+ The skill reads `envKeys: ['GITHUB_TOKEN']` and the official `@modelcontextprotocol/server-github` consumes it directly.
43
+
44
+ ## Use in a workflow
45
+
46
+ ```js
47
+ import { WorkflowAgent, WorkflowGraph } from '@zibby/core';
48
+ import { SKILLS } from '@zibby/skills';
49
+
50
+ export class PrSummarizer extends WorkflowAgent {
51
+ buildGraph() {
52
+ const graph = new WorkflowGraph();
53
+ graph.addNode('summarize_pr', {
54
+ agent: 'claude',
55
+ skills: [SKILLS.GITHUB],
56
+ prompt: (state) => `Get PR #${state.prNumber} on ${state.owner}/${state.repo}.
57
+ Read the diff with github_get_pr_diff and list reviewer comments with
58
+ github_list_pr_comments. Produce a 4-bullet summary of what changed and any
59
+ open review threads.`,
60
+ });
61
+ return graph;
62
+ }
63
+ }
64
+ ```
65
+
66
+ ## Output example
67
+
68
+ `github_get_pr`:
69
+
70
+ ```json
71
+ {
72
+ "number": 142,
73
+ "title": "fix(auth): refresh token on 401",
74
+ "state": "open",
75
+ "merged": false,
76
+ "user": "alice",
77
+ "branch": "fix-auth-refresh",
78
+ "base": "main",
79
+ "changedFiles": 3,
80
+ "additions": 47,
81
+ "deletions": 12,
82
+ "url": "https://github.com/acme/app/pull/142",
83
+ "labels": ["bug", "auth"]
84
+ }
85
+ ```
86
+
87
+ ## Implementation notes
88
+
89
+ `skill.resolve()` returns `{ command: 'npx', args: ['-y', '@modelcontextprotocol/server-github@latest'], env }` — the official upstream MCP server. The skill's `handleToolCall` implementation (with GitHub App-aware behavior for `/user` and `/user/orgs`) is used by the `assistant` agent strategy and by any caller that bypasses MCP.
90
+
91
+ For GitHub App installation tokens, `/user` and `/user/orgs` are server-to-server-forbidden; the in-process handlers transparently fall back to `/installation/repositories` and derive the owner/orgs from there.