@useconductor/conductor 1.0.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.
- package/.claude-plugin/marketplace.json +33 -0
- package/.claude-plugin/plugin.json +23 -0
- package/.eslintrc.json +23 -0
- package/.gitattributes +6 -0
- package/.github/FUNDING.yml +15 -0
- package/.github/ISSUE_TEMPLATE/bug_report.yml +91 -0
- package/.github/ISSUE_TEMPLATE/config.yml +8 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +63 -0
- package/.github/ISSUE_TEMPLATE/plugin_request.yml +71 -0
- package/.github/README.md +13 -0
- package/.github/workflows/README.md +22 -0
- package/.github/workflows/auto-release.yml +112 -0
- package/.github/workflows/ci.yml +49 -0
- package/.github/workflows/claude-code-review.yml +44 -0
- package/.github/workflows/claude.yml +36 -0
- package/.github/workflows/sync-install.yml +47 -0
- package/.mcp.json +9 -0
- package/.prettierrc.json +7 -0
- package/C.png +0 -0
- package/CHANGELOG.md +74 -0
- package/CLAUDE.md +118 -0
- package/CONTRIBUTING.md +231 -0
- package/LICENSE +201 -0
- package/README.md +179 -0
- package/SECURITY.md +47 -0
- package/commands/conductor-setup.md +11 -0
- package/commands/conductor-status.md +7 -0
- package/dist/ai/base.d.ts +44 -0
- package/dist/ai/base.d.ts.map +1 -0
- package/dist/ai/base.js +47 -0
- package/dist/ai/base.js.map +1 -0
- package/dist/ai/claude.d.ts +11 -0
- package/dist/ai/claude.d.ts.map +1 -0
- package/dist/ai/claude.js +149 -0
- package/dist/ai/claude.js.map +1 -0
- package/dist/ai/gemini.d.ts +15 -0
- package/dist/ai/gemini.d.ts.map +1 -0
- package/dist/ai/gemini.js +156 -0
- package/dist/ai/gemini.js.map +1 -0
- package/dist/ai/maestro.d.ts +22 -0
- package/dist/ai/maestro.d.ts.map +1 -0
- package/dist/ai/maestro.js +142 -0
- package/dist/ai/maestro.js.map +1 -0
- package/dist/ai/manager.d.ts +47 -0
- package/dist/ai/manager.d.ts.map +1 -0
- package/dist/ai/manager.js +450 -0
- package/dist/ai/manager.js.map +1 -0
- package/dist/ai/ollama.d.ts +16 -0
- package/dist/ai/ollama.d.ts.map +1 -0
- package/dist/ai/ollama.js +151 -0
- package/dist/ai/ollama.js.map +1 -0
- package/dist/ai/openai.d.ts +11 -0
- package/dist/ai/openai.d.ts.map +1 -0
- package/dist/ai/openai.js +132 -0
- package/dist/ai/openai.js.map +1 -0
- package/dist/ai/openrouter.d.ts +11 -0
- package/dist/ai/openrouter.d.ts.map +1 -0
- package/dist/ai/openrouter.js +139 -0
- package/dist/ai/openrouter.js.map +1 -0
- package/dist/bot/slack.d.ts +17 -0
- package/dist/bot/slack.d.ts.map +1 -0
- package/dist/bot/slack.js +144 -0
- package/dist/bot/slack.js.map +1 -0
- package/dist/bot/telegram.d.ts +19 -0
- package/dist/bot/telegram.d.ts.map +1 -0
- package/dist/bot/telegram.js +157 -0
- package/dist/bot/telegram.js.map +1 -0
- package/dist/cli/commands/ai.d.ts +4 -0
- package/dist/cli/commands/ai.d.ts.map +1 -0
- package/dist/cli/commands/ai.js +161 -0
- package/dist/cli/commands/ai.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +18 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +213 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/init.d.ts +15 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +281 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/install.d.ts +16 -0
- package/dist/cli/commands/install.d.ts.map +1 -0
- package/dist/cli/commands/install.js +750 -0
- package/dist/cli/commands/install.js.map +1 -0
- package/dist/cli/commands/lifecycle.d.ts +4 -0
- package/dist/cli/commands/lifecycle.d.ts.map +1 -0
- package/dist/cli/commands/lifecycle.js +84 -0
- package/dist/cli/commands/lifecycle.js.map +1 -0
- package/dist/cli/commands/marketplace.d.ts +13 -0
- package/dist/cli/commands/marketplace.d.ts.map +1 -0
- package/dist/cli/commands/marketplace.js +197 -0
- package/dist/cli/commands/marketplace.js.map +1 -0
- package/dist/cli/commands/mcp.d.ts +6 -0
- package/dist/cli/commands/mcp.d.ts.map +1 -0
- package/dist/cli/commands/mcp.js +83 -0
- package/dist/cli/commands/mcp.js.map +1 -0
- package/dist/cli/commands/onboard.d.ts +10 -0
- package/dist/cli/commands/onboard.d.ts.map +1 -0
- package/dist/cli/commands/onboard.js +207 -0
- package/dist/cli/commands/onboard.js.map +1 -0
- package/dist/cli/commands/plugin-create.d.ts +13 -0
- package/dist/cli/commands/plugin-create.d.ts.map +1 -0
- package/dist/cli/commands/plugin-create.js +122 -0
- package/dist/cli/commands/plugin-create.js.map +1 -0
- package/dist/cli/commands/plugins.d.ts +5 -0
- package/dist/cli/commands/plugins.d.ts.map +1 -0
- package/dist/cli/commands/plugins.js +30 -0
- package/dist/cli/commands/plugins.js.map +1 -0
- package/dist/cli/commands/release.d.ts +13 -0
- package/dist/cli/commands/release.d.ts.map +1 -0
- package/dist/cli/commands/release.js +243 -0
- package/dist/cli/commands/release.js.map +1 -0
- package/dist/cli/commands/telegram.d.ts +3 -0
- package/dist/cli/commands/telegram.d.ts.map +1 -0
- package/dist/cli/commands/telegram.js +20 -0
- package/dist/cli/commands/telegram.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +402 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/config/oauth.d.ts +8 -0
- package/dist/config/oauth.d.ts.map +1 -0
- package/dist/config/oauth.js +13 -0
- package/dist/config/oauth.js.map +1 -0
- package/dist/core/audit.d.ts +91 -0
- package/dist/core/audit.d.ts.map +1 -0
- package/dist/core/audit.js +233 -0
- package/dist/core/audit.js.map +1 -0
- package/dist/core/circuit-breaker.d.ts +56 -0
- package/dist/core/circuit-breaker.d.ts.map +1 -0
- package/dist/core/circuit-breaker.js +107 -0
- package/dist/core/circuit-breaker.js.map +1 -0
- package/dist/core/conductor.d.ts +44 -0
- package/dist/core/conductor.d.ts.map +1 -0
- package/dist/core/conductor.js +200 -0
- package/dist/core/conductor.js.map +1 -0
- package/dist/core/config.d.ts +66 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +86 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/database.d.ts +59 -0
- package/dist/core/database.d.ts.map +1 -0
- package/dist/core/database.js +342 -0
- package/dist/core/database.js.map +1 -0
- package/dist/core/errors.d.ts +231 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +254 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/health.d.ts +72 -0
- package/dist/core/health.d.ts.map +1 -0
- package/dist/core/health.js +116 -0
- package/dist/core/health.js.map +1 -0
- package/dist/core/interfaces.d.ts +62 -0
- package/dist/core/interfaces.d.ts.map +1 -0
- package/dist/core/interfaces.js +8 -0
- package/dist/core/interfaces.js.map +1 -0
- package/dist/core/logger.d.ts +15 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +30 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/rbac.d.ts +132 -0
- package/dist/core/rbac.d.ts.map +1 -0
- package/dist/core/rbac.js +230 -0
- package/dist/core/rbac.js.map +1 -0
- package/dist/core/retry.d.ts +22 -0
- package/dist/core/retry.d.ts.map +1 -0
- package/dist/core/retry.js +41 -0
- package/dist/core/retry.js.map +1 -0
- package/dist/core/webhooks.d.ts +92 -0
- package/dist/core/webhooks.d.ts.map +1 -0
- package/dist/core/webhooks.js +176 -0
- package/dist/core/webhooks.js.map +1 -0
- package/dist/core/zero-config.d.ts +22 -0
- package/dist/core/zero-config.d.ts.map +1 -0
- package/dist/core/zero-config.js +59 -0
- package/dist/core/zero-config.js.map +1 -0
- package/dist/dashboard/cli.d.ts +6 -0
- package/dist/dashboard/cli.d.ts.map +1 -0
- package/dist/dashboard/cli.js +42 -0
- package/dist/dashboard/cli.js.map +1 -0
- package/dist/dashboard/index.html +3426 -0
- package/dist/dashboard/server.d.ts +7 -0
- package/dist/dashboard/server.d.ts.map +1 -0
- package/dist/dashboard/server.js +1427 -0
- package/dist/dashboard/server.js.map +1 -0
- package/dist/mcp/server.d.ts +27 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +380 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools/misc.d.ts +15 -0
- package/dist/mcp/tools/misc.d.ts.map +1 -0
- package/dist/mcp/tools/misc.js +49 -0
- package/dist/mcp/tools/misc.js.map +1 -0
- package/dist/plugins/builtin/calculator.d.ts +11 -0
- package/dist/plugins/builtin/calculator.d.ts.map +1 -0
- package/dist/plugins/builtin/calculator.js +166 -0
- package/dist/plugins/builtin/calculator.js.map +1 -0
- package/dist/plugins/builtin/colors.d.ts +15 -0
- package/dist/plugins/builtin/colors.d.ts.map +1 -0
- package/dist/plugins/builtin/colors.js +193 -0
- package/dist/plugins/builtin/colors.js.map +1 -0
- package/dist/plugins/builtin/cron.d.ts +40 -0
- package/dist/plugins/builtin/cron.d.ts.map +1 -0
- package/dist/plugins/builtin/cron.js +578 -0
- package/dist/plugins/builtin/cron.js.map +1 -0
- package/dist/plugins/builtin/crypto.d.ts +11 -0
- package/dist/plugins/builtin/crypto.d.ts.map +1 -0
- package/dist/plugins/builtin/crypto.js +83 -0
- package/dist/plugins/builtin/crypto.js.map +1 -0
- package/dist/plugins/builtin/database.d.ts +29 -0
- package/dist/plugins/builtin/database.d.ts.map +1 -0
- package/dist/plugins/builtin/database.js +230 -0
- package/dist/plugins/builtin/database.js.map +1 -0
- package/dist/plugins/builtin/docker.d.ts +12 -0
- package/dist/plugins/builtin/docker.d.ts.map +1 -0
- package/dist/plugins/builtin/docker.js +436 -0
- package/dist/plugins/builtin/docker.js.map +1 -0
- package/dist/plugins/builtin/fun.d.ts +11 -0
- package/dist/plugins/builtin/fun.d.ts.map +1 -0
- package/dist/plugins/builtin/fun.js +114 -0
- package/dist/plugins/builtin/fun.js.map +1 -0
- package/dist/plugins/builtin/gcal.d.ts +38 -0
- package/dist/plugins/builtin/gcal.d.ts.map +1 -0
- package/dist/plugins/builtin/gcal.js +280 -0
- package/dist/plugins/builtin/gcal.js.map +1 -0
- package/dist/plugins/builtin/gdrive.d.ts +26 -0
- package/dist/plugins/builtin/gdrive.d.ts.map +1 -0
- package/dist/plugins/builtin/gdrive.js +295 -0
- package/dist/plugins/builtin/gdrive.js.map +1 -0
- package/dist/plugins/builtin/github-actions.d.ts +38 -0
- package/dist/plugins/builtin/github-actions.d.ts.map +1 -0
- package/dist/plugins/builtin/github-actions.js +629 -0
- package/dist/plugins/builtin/github-actions.js.map +1 -0
- package/dist/plugins/builtin/github.d.ts +26 -0
- package/dist/plugins/builtin/github.d.ts.map +1 -0
- package/dist/plugins/builtin/github.js +800 -0
- package/dist/plugins/builtin/github.js.map +1 -0
- package/dist/plugins/builtin/gmail.d.ts +50 -0
- package/dist/plugins/builtin/gmail.d.ts.map +1 -0
- package/dist/plugins/builtin/gmail.js +445 -0
- package/dist/plugins/builtin/gmail.js.map +1 -0
- package/dist/plugins/builtin/hash.d.ts +11 -0
- package/dist/plugins/builtin/hash.d.ts.map +1 -0
- package/dist/plugins/builtin/hash.js +95 -0
- package/dist/plugins/builtin/hash.js.map +1 -0
- package/dist/plugins/builtin/homekit.d.ts +53 -0
- package/dist/plugins/builtin/homekit.d.ts.map +1 -0
- package/dist/plugins/builtin/homekit.js +341 -0
- package/dist/plugins/builtin/homekit.js.map +1 -0
- package/dist/plugins/builtin/index.d.ts +4 -0
- package/dist/plugins/builtin/index.d.ts.map +1 -0
- package/dist/plugins/builtin/index.js +96 -0
- package/dist/plugins/builtin/index.js.map +1 -0
- package/dist/plugins/builtin/jira.d.ts +50 -0
- package/dist/plugins/builtin/jira.d.ts.map +1 -0
- package/dist/plugins/builtin/jira.js +353 -0
- package/dist/plugins/builtin/jira.js.map +1 -0
- package/dist/plugins/builtin/linear.d.ts +35 -0
- package/dist/plugins/builtin/linear.d.ts.map +1 -0
- package/dist/plugins/builtin/linear.js +397 -0
- package/dist/plugins/builtin/linear.js.map +1 -0
- package/dist/plugins/builtin/lumen.d.ts +21 -0
- package/dist/plugins/builtin/lumen.d.ts.map +1 -0
- package/dist/plugins/builtin/lumen.js +404 -0
- package/dist/plugins/builtin/lumen.js.map +1 -0
- package/dist/plugins/builtin/memory.d.ts +22 -0
- package/dist/plugins/builtin/memory.d.ts.map +1 -0
- package/dist/plugins/builtin/memory.js +184 -0
- package/dist/plugins/builtin/memory.js.map +1 -0
- package/dist/plugins/builtin/n8n.d.ts +60 -0
- package/dist/plugins/builtin/n8n.d.ts.map +1 -0
- package/dist/plugins/builtin/n8n.js +519 -0
- package/dist/plugins/builtin/n8n.js.map +1 -0
- package/dist/plugins/builtin/network.d.ts +11 -0
- package/dist/plugins/builtin/network.d.ts.map +1 -0
- package/dist/plugins/builtin/network.js +88 -0
- package/dist/plugins/builtin/network.js.map +1 -0
- package/dist/plugins/builtin/notes.d.ts +47 -0
- package/dist/plugins/builtin/notes.d.ts.map +1 -0
- package/dist/plugins/builtin/notes.js +641 -0
- package/dist/plugins/builtin/notes.js.map +1 -0
- package/dist/plugins/builtin/notion.d.ts +47 -0
- package/dist/plugins/builtin/notion.d.ts.map +1 -0
- package/dist/plugins/builtin/notion.js +317 -0
- package/dist/plugins/builtin/notion.js.map +1 -0
- package/dist/plugins/builtin/shell.d.ts +12 -0
- package/dist/plugins/builtin/shell.d.ts.map +1 -0
- package/dist/plugins/builtin/shell.js +310 -0
- package/dist/plugins/builtin/shell.js.map +1 -0
- package/dist/plugins/builtin/slack.d.ts +31 -0
- package/dist/plugins/builtin/slack.d.ts.map +1 -0
- package/dist/plugins/builtin/slack.js +295 -0
- package/dist/plugins/builtin/slack.js.map +1 -0
- package/dist/plugins/builtin/spotify.d.ts +55 -0
- package/dist/plugins/builtin/spotify.d.ts.map +1 -0
- package/dist/plugins/builtin/spotify.js +623 -0
- package/dist/plugins/builtin/spotify.js.map +1 -0
- package/dist/plugins/builtin/stripe.d.ts +35 -0
- package/dist/plugins/builtin/stripe.d.ts.map +1 -0
- package/dist/plugins/builtin/stripe.js +376 -0
- package/dist/plugins/builtin/stripe.js.map +1 -0
- package/dist/plugins/builtin/system.d.ts +11 -0
- package/dist/plugins/builtin/system.d.ts.map +1 -0
- package/dist/plugins/builtin/system.js +91 -0
- package/dist/plugins/builtin/system.js.map +1 -0
- package/dist/plugins/builtin/text-tools.d.ts +11 -0
- package/dist/plugins/builtin/text-tools.d.ts.map +1 -0
- package/dist/plugins/builtin/text-tools.js +146 -0
- package/dist/plugins/builtin/text-tools.js.map +1 -0
- package/dist/plugins/builtin/timezone.d.ts +13 -0
- package/dist/plugins/builtin/timezone.d.ts.map +1 -0
- package/dist/plugins/builtin/timezone.js +164 -0
- package/dist/plugins/builtin/timezone.js.map +1 -0
- package/dist/plugins/builtin/todoist.d.ts +49 -0
- package/dist/plugins/builtin/todoist.d.ts.map +1 -0
- package/dist/plugins/builtin/todoist.js +540 -0
- package/dist/plugins/builtin/todoist.js.map +1 -0
- package/dist/plugins/builtin/translate.d.ts +11 -0
- package/dist/plugins/builtin/translate.d.ts.map +1 -0
- package/dist/plugins/builtin/translate.js +42 -0
- package/dist/plugins/builtin/translate.js.map +1 -0
- package/dist/plugins/builtin/url-tools.d.ts +11 -0
- package/dist/plugins/builtin/url-tools.d.ts.map +1 -0
- package/dist/plugins/builtin/url-tools.js +70 -0
- package/dist/plugins/builtin/url-tools.js.map +1 -0
- package/dist/plugins/builtin/vercel.d.ts +55 -0
- package/dist/plugins/builtin/vercel.d.ts.map +1 -0
- package/dist/plugins/builtin/vercel.js +514 -0
- package/dist/plugins/builtin/vercel.js.map +1 -0
- package/dist/plugins/builtin/weather.d.ts +13 -0
- package/dist/plugins/builtin/weather.d.ts.map +1 -0
- package/dist/plugins/builtin/weather.js +103 -0
- package/dist/plugins/builtin/weather.js.map +1 -0
- package/dist/plugins/builtin/x.d.ts +54 -0
- package/dist/plugins/builtin/x.d.ts.map +1 -0
- package/dist/plugins/builtin/x.js +402 -0
- package/dist/plugins/builtin/x.js.map +1 -0
- package/dist/plugins/manager.d.ts +77 -0
- package/dist/plugins/manager.d.ts.map +1 -0
- package/dist/plugins/manager.js +141 -0
- package/dist/plugins/manager.js.map +1 -0
- package/dist/plugins/validation.d.ts +18 -0
- package/dist/plugins/validation.d.ts.map +1 -0
- package/dist/plugins/validation.js +81 -0
- package/dist/plugins/validation.js.map +1 -0
- package/dist/security/auth.d.ts +23 -0
- package/dist/security/auth.d.ts.map +1 -0
- package/dist/security/auth.js +56 -0
- package/dist/security/auth.js.map +1 -0
- package/dist/security/keychain.d.ts +60 -0
- package/dist/security/keychain.d.ts.map +1 -0
- package/dist/security/keychain.js +213 -0
- package/dist/security/keychain.js.map +1 -0
- package/dist/utils/google-auth.d.ts +21 -0
- package/dist/utils/google-auth.d.ts.map +1 -0
- package/dist/utils/google-auth.js +135 -0
- package/dist/utils/google-auth.js.map +1 -0
- package/dist/utils/retry.d.ts +5 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +34 -0
- package/dist/utils/retry.js.map +1 -0
- package/docs/README.md +13 -0
- package/docs/api.md +210 -0
- package/docs/getting-started.md +100 -0
- package/docs/plugins.md +306 -0
- package/docs-site/.vitepress/config.ts +59 -0
- package/docs-site/README.md +12 -0
- package/docs-site/index.md +30 -0
- package/eslint.config.js +29 -0
- package/install.ps1 +334 -0
- package/install.sh +1119 -0
- package/local-install.sh +304 -0
- package/package.json +90 -0
- package/packages/README.md +11 -0
- package/packages/plugin-sdk/README.md +12 -0
- package/packages/plugin-sdk/package.json +22 -0
- package/packages/plugin-sdk/src/README.md +11 -0
- package/packages/plugin-sdk/src/index.ts +191 -0
- package/sdks/README.md +26 -0
- package/sdks/csharp/ConductorClient.cs +65 -0
- package/sdks/csharp/README.md +11 -0
- package/sdks/go/README.md +11 -0
- package/sdks/go/conductor.go +257 -0
- package/sdks/java/ConductorClient.java +27 -0
- package/sdks/java/README.md +11 -0
- package/sdks/php/README.md +11 -0
- package/sdks/php/src/Client.php +72 -0
- package/sdks/python/README.md +12 -0
- package/sdks/python/conductor/__init__.py +227 -0
- package/sdks/python/pyproject.toml +30 -0
- package/sdks/ruby/README.md +11 -0
- package/sdks/ruby/lib/conductor.rb +46 -0
- package/sdks/rust/Cargo.toml +14 -0
- package/sdks/rust/README.md +11 -0
- package/sdks/swift/README.md +11 -0
- package/sdks/swift/Sources/Conductor/ConductorClient.swift +65 -0
- package/skills/conductor-mcp/SKILL.md +38 -0
- package/src/README.md +20 -0
- package/src/ai/README.md +18 -0
- package/src/ai/base.ts +93 -0
- package/src/ai/claude.ts +162 -0
- package/src/ai/gemini.ts +188 -0
- package/src/ai/maestro.ts +168 -0
- package/src/ai/manager.ts +537 -0
- package/src/ai/ollama.ts +186 -0
- package/src/ai/openai.ts +147 -0
- package/src/ai/openrouter.ts +152 -0
- package/src/bot/README.md +12 -0
- package/src/bot/slack.ts +164 -0
- package/src/bot/telegram.ts +185 -0
- package/src/cli/README.md +24 -0
- package/src/cli/commands/README.md +20 -0
- package/src/cli/commands/ai.ts +170 -0
- package/src/cli/commands/doctor.ts +221 -0
- package/src/cli/commands/init.ts +348 -0
- package/src/cli/commands/install.ts +792 -0
- package/src/cli/commands/lifecycle.ts +95 -0
- package/src/cli/commands/marketplace.ts +253 -0
- package/src/cli/commands/mcp.ts +92 -0
- package/src/cli/commands/onboard.ts +248 -0
- package/src/cli/commands/plugin-create.ts +130 -0
- package/src/cli/commands/plugins.ts +36 -0
- package/src/cli/commands/release.ts +251 -0
- package/src/cli/commands/telegram.ts +25 -0
- package/src/cli/index.ts +450 -0
- package/src/config/README.md +11 -0
- package/src/config/oauth.ts +26 -0
- package/src/core/README.md +22 -0
- package/src/core/audit.ts +291 -0
- package/src/core/circuit-breaker.ts +129 -0
- package/src/core/conductor.ts +240 -0
- package/src/core/config.ts +149 -0
- package/src/core/database.ts +411 -0
- package/src/core/errors.ts +275 -0
- package/src/core/health.ts +159 -0
- package/src/core/interfaces.ts +75 -0
- package/src/core/logger.ts +33 -0
- package/src/core/rbac.ts +321 -0
- package/src/core/retry.ts +61 -0
- package/src/core/webhooks.ts +234 -0
- package/src/core/zero-config.ts +72 -0
- package/src/dashboard/README.md +15 -0
- package/src/dashboard/cli.ts +48 -0
- package/src/dashboard/index.html +3426 -0
- package/src/dashboard/server.ts +1544 -0
- package/src/mcp/README.md +20 -0
- package/src/mcp/server.ts +475 -0
- package/src/mcp/tools/README.md +11 -0
- package/src/mcp/tools/misc.ts +61 -0
- package/src/plugins/README.md +28 -0
- package/src/plugins/builtin/README.md +23 -0
- package/src/plugins/builtin/calculator.ts +178 -0
- package/src/plugins/builtin/colors.ts +201 -0
- package/src/plugins/builtin/cron.ts +649 -0
- package/src/plugins/builtin/crypto.ts +85 -0
- package/src/plugins/builtin/database.ts +235 -0
- package/src/plugins/builtin/docker.ts +426 -0
- package/src/plugins/builtin/fun.ts +118 -0
- package/src/plugins/builtin/gcal.ts +305 -0
- package/src/plugins/builtin/gdrive.ts +326 -0
- package/src/plugins/builtin/github-actions.ts +666 -0
- package/src/plugins/builtin/github.ts +912 -0
- package/src/plugins/builtin/gmail.ts +492 -0
- package/src/plugins/builtin/hash.ts +98 -0
- package/src/plugins/builtin/homekit.ts +389 -0
- package/src/plugins/builtin/index.ts +116 -0
- package/src/plugins/builtin/jira.ts +380 -0
- package/src/plugins/builtin/linear.ts +448 -0
- package/src/plugins/builtin/lumen.ts +497 -0
- package/src/plugins/builtin/memory.ts +200 -0
- package/src/plugins/builtin/n8n.ts +565 -0
- package/src/plugins/builtin/network.ts +92 -0
- package/src/plugins/builtin/notes.ts +689 -0
- package/src/plugins/builtin/notion.ts +348 -0
- package/src/plugins/builtin/shell.ts +334 -0
- package/src/plugins/builtin/slack.ts +327 -0
- package/src/plugins/builtin/spotify.ts +665 -0
- package/src/plugins/builtin/stripe.ts +388 -0
- package/src/plugins/builtin/system.ts +93 -0
- package/src/plugins/builtin/text-tools.ts +150 -0
- package/src/plugins/builtin/timezone.ts +173 -0
- package/src/plugins/builtin/todoist.ts +625 -0
- package/src/plugins/builtin/translate.ts +47 -0
- package/src/plugins/builtin/url-tools.ts +73 -0
- package/src/plugins/builtin/vercel.ts +546 -0
- package/src/plugins/builtin/weather.ts +112 -0
- package/src/plugins/builtin/x.ts +440 -0
- package/src/plugins/manager.ts +213 -0
- package/src/plugins/validation.ts +94 -0
- package/src/security/README.md +12 -0
- package/src/security/auth.ts +72 -0
- package/src/security/keychain.ts +226 -0
- package/src/utils/README.md +12 -0
- package/src/utils/google-auth.ts +159 -0
- package/src/utils/retry.ts +41 -0
- package/test-all.mjs +1256 -0
- package/test.mjs +633 -0
- package/tests/README.md +19 -0
- package/tests/calculator.test.ts +54 -0
- package/tests/docker.test.ts +42 -0
- package/tests/load.test.ts +129 -0
- package/tests/mcp.test.ts +14 -0
- package/tests/shell.test.ts +42 -0
- package/tsconfig.json +21 -0
- package/vitest.config.ts +14 -0
|
@@ -0,0 +1,912 @@
|
|
|
1
|
+
import { Plugin, PluginTool } from '../manager.js';
|
|
2
|
+
import { Conductor } from '../../core/conductor.js';
|
|
3
|
+
import { Keychain } from '../../security/keychain.js';
|
|
4
|
+
|
|
5
|
+
export class GitHubPlugin implements Plugin {
|
|
6
|
+
name = 'github';
|
|
7
|
+
description =
|
|
8
|
+
'GitHub repositories, issues, PRs, releases, code search, and more (public data free, private needs token)';
|
|
9
|
+
version = '2.0.0';
|
|
10
|
+
|
|
11
|
+
configSchema = {
|
|
12
|
+
fields: [
|
|
13
|
+
{
|
|
14
|
+
key: 'token',
|
|
15
|
+
label: 'GitHub PAT (Personal Access Token)',
|
|
16
|
+
type: 'password' as const,
|
|
17
|
+
required: false,
|
|
18
|
+
secret: true,
|
|
19
|
+
service: 'github',
|
|
20
|
+
description:
|
|
21
|
+
'Create a PAT with "repo" and "workflow" scopes at GitHub Settings > Developer Settings > Personal Access Tokens.',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
setupInstructions:
|
|
25
|
+
'GitHub integration works for public data without a token. For private repos, issues, PRs and write operations, create a Personal Access Token at https://github.com/settings/tokens with "repo" and "workflow" scopes.',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
private keychain!: Keychain;
|
|
29
|
+
|
|
30
|
+
async initialize(conductor: Conductor): Promise<void> {
|
|
31
|
+
this.keychain = new Keychain(conductor.getConfig().getConfigDir());
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
isConfigured(): boolean {
|
|
35
|
+
return true; // public endpoints work without token
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private async getToken(): Promise<string | null> {
|
|
39
|
+
try {
|
|
40
|
+
return await this.keychain.get('github', 'token');
|
|
41
|
+
} catch {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private async ghFetch(
|
|
47
|
+
path: string,
|
|
48
|
+
options: { method?: string; body?: any; token?: string | null } = {},
|
|
49
|
+
): Promise<any> {
|
|
50
|
+
const headers: Record<string, string> = {
|
|
51
|
+
Accept: 'application/vnd.github+json',
|
|
52
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
53
|
+
};
|
|
54
|
+
if (options.token) headers['Authorization'] = `Bearer ${options.token}`;
|
|
55
|
+
const res = await fetch(`https://api.github.com${path}`, {
|
|
56
|
+
method: options.method ?? 'GET',
|
|
57
|
+
headers,
|
|
58
|
+
body: options.body ? JSON.stringify(options.body) : undefined,
|
|
59
|
+
});
|
|
60
|
+
if (!res.ok) {
|
|
61
|
+
const errText = await res.text().catch(() => res.statusText);
|
|
62
|
+
throw new Error(`GitHub API ${res.status}: ${errText}`);
|
|
63
|
+
}
|
|
64
|
+
if (res.status === 204) return null;
|
|
65
|
+
return res.json();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
getTools(): PluginTool[] {
|
|
69
|
+
return [
|
|
70
|
+
// ── User & repo basics ───────────────────────────────────────────────
|
|
71
|
+
|
|
72
|
+
{
|
|
73
|
+
name: 'github_user',
|
|
74
|
+
description: 'Get GitHub user profile info',
|
|
75
|
+
inputSchema: {
|
|
76
|
+
type: 'object',
|
|
77
|
+
properties: {
|
|
78
|
+
username: { type: 'string', description: 'GitHub username' },
|
|
79
|
+
},
|
|
80
|
+
required: ['username'],
|
|
81
|
+
},
|
|
82
|
+
handler: async (input: { username: string }) => {
|
|
83
|
+
const u = await this.ghFetch(`/users/${encodeURIComponent(input.username)}`);
|
|
84
|
+
return {
|
|
85
|
+
login: u.login,
|
|
86
|
+
name: u.name,
|
|
87
|
+
bio: u.bio,
|
|
88
|
+
public_repos: u.public_repos,
|
|
89
|
+
followers: u.followers,
|
|
90
|
+
following: u.following,
|
|
91
|
+
created: u.created_at,
|
|
92
|
+
url: u.html_url,
|
|
93
|
+
avatar: u.avatar_url,
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
{
|
|
99
|
+
name: 'github_repo',
|
|
100
|
+
description: 'Get repository details',
|
|
101
|
+
inputSchema: {
|
|
102
|
+
type: 'object',
|
|
103
|
+
properties: {
|
|
104
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
105
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
106
|
+
},
|
|
107
|
+
required: ['owner', 'repo'],
|
|
108
|
+
},
|
|
109
|
+
handler: async (input: { owner: string; repo: string }) => {
|
|
110
|
+
const token = await this.getToken();
|
|
111
|
+
const r = await this.ghFetch(`/repos/${encodeURIComponent(input.owner)}/${encodeURIComponent(input.repo)}`, {
|
|
112
|
+
token,
|
|
113
|
+
});
|
|
114
|
+
return {
|
|
115
|
+
name: r.full_name,
|
|
116
|
+
description: r.description,
|
|
117
|
+
language: r.language,
|
|
118
|
+
stars: r.stargazers_count,
|
|
119
|
+
forks: r.forks_count,
|
|
120
|
+
open_issues: r.open_issues_count,
|
|
121
|
+
license: r.license?.spdx_id,
|
|
122
|
+
created: r.created_at,
|
|
123
|
+
updated: r.updated_at,
|
|
124
|
+
default_branch: r.default_branch,
|
|
125
|
+
url: r.html_url,
|
|
126
|
+
topics: r.topics,
|
|
127
|
+
private: r.private,
|
|
128
|
+
};
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
{
|
|
133
|
+
name: 'github_repos',
|
|
134
|
+
description: 'List repositories for a user',
|
|
135
|
+
inputSchema: {
|
|
136
|
+
type: 'object',
|
|
137
|
+
properties: {
|
|
138
|
+
username: { type: 'string', description: 'GitHub username' },
|
|
139
|
+
sort: { type: 'string', description: 'Sort by: stars, updated, created, name', default: 'updated' },
|
|
140
|
+
per_page: { type: 'number', description: 'Results per page (max 100)', default: 30 },
|
|
141
|
+
},
|
|
142
|
+
required: ['username'],
|
|
143
|
+
},
|
|
144
|
+
handler: async (input: { username: string; sort?: string; per_page?: number }) => {
|
|
145
|
+
const token = await this.getToken();
|
|
146
|
+
const sort = input.sort ?? 'updated';
|
|
147
|
+
const perPage = Math.min(input.per_page ?? 30, 100);
|
|
148
|
+
const repos = await this.ghFetch(
|
|
149
|
+
`/users/${encodeURIComponent(input.username)}/repos?sort=${sort}&per_page=${perPage}`,
|
|
150
|
+
{ token },
|
|
151
|
+
);
|
|
152
|
+
return (repos as any[]).map((r) => ({
|
|
153
|
+
name: r.name,
|
|
154
|
+
description: r.description,
|
|
155
|
+
language: r.language,
|
|
156
|
+
stars: r.stargazers_count,
|
|
157
|
+
forks: r.forks_count,
|
|
158
|
+
updated: r.updated_at,
|
|
159
|
+
url: r.html_url,
|
|
160
|
+
private: r.private,
|
|
161
|
+
}));
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
{
|
|
166
|
+
name: 'github_trending',
|
|
167
|
+
description: 'Search trending/popular repositories by query and optional language filter',
|
|
168
|
+
inputSchema: {
|
|
169
|
+
type: 'object',
|
|
170
|
+
properties: {
|
|
171
|
+
query: { type: 'string', description: 'Search query (e.g. "machine learning", "typescript cli")' },
|
|
172
|
+
language: { type: 'string', description: 'Filter by language (e.g. typescript, python)' },
|
|
173
|
+
per_page: { type: 'number', description: 'Results per page (default 10, max 30)', default: 10 },
|
|
174
|
+
},
|
|
175
|
+
required: ['query'],
|
|
176
|
+
},
|
|
177
|
+
handler: async (input: { query: string; language?: string; per_page?: number }) => {
|
|
178
|
+
const token = await this.getToken();
|
|
179
|
+
let q = encodeURIComponent(input.query);
|
|
180
|
+
if (input.language) q += `+language:${encodeURIComponent(input.language)}`;
|
|
181
|
+
const perPage = Math.min(input.per_page ?? 10, 30);
|
|
182
|
+
const data = await this.ghFetch(`/search/repositories?q=${q}&sort=stars&per_page=${perPage}`, { token });
|
|
183
|
+
return (data.items as any[]).map((r) => ({
|
|
184
|
+
name: r.full_name,
|
|
185
|
+
description: r.description,
|
|
186
|
+
language: r.language,
|
|
187
|
+
stars: r.stargazers_count,
|
|
188
|
+
forks: r.forks_count,
|
|
189
|
+
url: r.html_url,
|
|
190
|
+
}));
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
// ── Issues ──────────────────────────────────────────────────────────
|
|
195
|
+
|
|
196
|
+
{
|
|
197
|
+
name: 'github_issues',
|
|
198
|
+
description: 'List issues for a repository with optional filters',
|
|
199
|
+
inputSchema: {
|
|
200
|
+
type: 'object',
|
|
201
|
+
properties: {
|
|
202
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
203
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
204
|
+
state: { type: 'string', enum: ['open', 'closed', 'all'], description: 'Issue state (default: open)' },
|
|
205
|
+
label: { type: 'string', description: 'Filter by label name' },
|
|
206
|
+
assignee: { type: 'string', description: 'Filter by assignee username' },
|
|
207
|
+
per_page: { type: 'number', description: 'Results per page (default 25, max 100)' },
|
|
208
|
+
},
|
|
209
|
+
required: ['owner', 'repo'],
|
|
210
|
+
},
|
|
211
|
+
handler: async (input: {
|
|
212
|
+
owner: string;
|
|
213
|
+
repo: string;
|
|
214
|
+
state?: string;
|
|
215
|
+
label?: string;
|
|
216
|
+
assignee?: string;
|
|
217
|
+
per_page?: number;
|
|
218
|
+
}) => {
|
|
219
|
+
const token = await this.getToken();
|
|
220
|
+
const params = new URLSearchParams({
|
|
221
|
+
state: input.state ?? 'open',
|
|
222
|
+
per_page: String(Math.min(input.per_page ?? 25, 100)),
|
|
223
|
+
});
|
|
224
|
+
if (input.label) params.set('labels', input.label);
|
|
225
|
+
if (input.assignee) params.set('assignee', input.assignee);
|
|
226
|
+
const issues = await this.ghFetch(
|
|
227
|
+
`/repos/${encodeURIComponent(input.owner)}/${encodeURIComponent(input.repo)}/issues?${params}`,
|
|
228
|
+
{ token },
|
|
229
|
+
);
|
|
230
|
+
return (issues as any[])
|
|
231
|
+
.filter((i) => !i.pull_request)
|
|
232
|
+
.map((i) => ({
|
|
233
|
+
number: i.number,
|
|
234
|
+
title: i.title,
|
|
235
|
+
state: i.state,
|
|
236
|
+
author: i.user?.login,
|
|
237
|
+
assignees: i.assignees?.map((a: any) => a.login),
|
|
238
|
+
labels: i.labels?.map((l: any) => l.name),
|
|
239
|
+
comments: i.comments,
|
|
240
|
+
created: i.created_at,
|
|
241
|
+
updated: i.updated_at,
|
|
242
|
+
url: i.html_url,
|
|
243
|
+
}));
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
|
|
247
|
+
{
|
|
248
|
+
name: 'github_issue',
|
|
249
|
+
description: 'Get a single issue by number',
|
|
250
|
+
inputSchema: {
|
|
251
|
+
type: 'object',
|
|
252
|
+
properties: {
|
|
253
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
254
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
255
|
+
issue_number: { type: 'number', description: 'Issue number' },
|
|
256
|
+
},
|
|
257
|
+
required: ['owner', 'repo', 'issue_number'],
|
|
258
|
+
},
|
|
259
|
+
handler: async (input: { owner: string; repo: string; issue_number: number }) => {
|
|
260
|
+
const token = await this.getToken();
|
|
261
|
+
const i = await this.ghFetch(
|
|
262
|
+
`/repos/${encodeURIComponent(input.owner)}/${encodeURIComponent(input.repo)}/issues/${input.issue_number}`,
|
|
263
|
+
{ token },
|
|
264
|
+
);
|
|
265
|
+
return {
|
|
266
|
+
number: i.number,
|
|
267
|
+
title: i.title,
|
|
268
|
+
state: i.state,
|
|
269
|
+
body: i.body,
|
|
270
|
+
author: i.user?.login,
|
|
271
|
+
assignees: i.assignees?.map((a: any) => a.login),
|
|
272
|
+
labels: i.labels?.map((l: any) => l.name),
|
|
273
|
+
milestone: i.milestone?.title,
|
|
274
|
+
comments: i.comments,
|
|
275
|
+
created: i.created_at,
|
|
276
|
+
updated: i.updated_at,
|
|
277
|
+
closed_at: i.closed_at,
|
|
278
|
+
url: i.html_url,
|
|
279
|
+
};
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
|
|
283
|
+
{
|
|
284
|
+
name: 'github_create_issue',
|
|
285
|
+
description: 'Create a new issue in a repository',
|
|
286
|
+
inputSchema: {
|
|
287
|
+
type: 'object',
|
|
288
|
+
properties: {
|
|
289
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
290
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
291
|
+
title: { type: 'string', description: 'Issue title' },
|
|
292
|
+
body: { type: 'string', description: 'Issue body (markdown)' },
|
|
293
|
+
labels: { type: 'array', items: { type: 'string' }, description: 'Label names to add' },
|
|
294
|
+
assignees: { type: 'array', items: { type: 'string' }, description: 'Usernames to assign' },
|
|
295
|
+
},
|
|
296
|
+
required: ['owner', 'repo', 'title'],
|
|
297
|
+
},
|
|
298
|
+
requiresApproval: true,
|
|
299
|
+
handler: async (input: {
|
|
300
|
+
owner: string;
|
|
301
|
+
repo: string;
|
|
302
|
+
title: string;
|
|
303
|
+
body?: string;
|
|
304
|
+
labels?: string[];
|
|
305
|
+
assignees?: string[];
|
|
306
|
+
}) => {
|
|
307
|
+
const token = await this.getToken();
|
|
308
|
+
if (!token) throw new Error('GitHub token required to create issues');
|
|
309
|
+
const issue = await this.ghFetch(
|
|
310
|
+
`/repos/${encodeURIComponent(input.owner)}/${encodeURIComponent(input.repo)}/issues`,
|
|
311
|
+
{
|
|
312
|
+
method: 'POST',
|
|
313
|
+
token,
|
|
314
|
+
body: { title: input.title, body: input.body, labels: input.labels, assignees: input.assignees },
|
|
315
|
+
},
|
|
316
|
+
);
|
|
317
|
+
return { number: issue.number, url: issue.html_url, title: issue.title };
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
|
|
321
|
+
{
|
|
322
|
+
name: 'github_close_issue',
|
|
323
|
+
description: 'Close an open issue',
|
|
324
|
+
inputSchema: {
|
|
325
|
+
type: 'object',
|
|
326
|
+
properties: {
|
|
327
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
328
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
329
|
+
issue_number: { type: 'number', description: 'Issue number to close' },
|
|
330
|
+
reason: { type: 'string', enum: ['completed', 'not_planned'], description: 'Close reason' },
|
|
331
|
+
},
|
|
332
|
+
required: ['owner', 'repo', 'issue_number'],
|
|
333
|
+
},
|
|
334
|
+
requiresApproval: true,
|
|
335
|
+
handler: async (input: { owner: string; repo: string; issue_number: number; reason?: string }) => {
|
|
336
|
+
const token = await this.getToken();
|
|
337
|
+
if (!token) throw new Error('GitHub token required to close issues');
|
|
338
|
+
await this.ghFetch(
|
|
339
|
+
`/repos/${encodeURIComponent(input.owner)}/${encodeURIComponent(input.repo)}/issues/${input.issue_number}`,
|
|
340
|
+
{
|
|
341
|
+
method: 'PATCH',
|
|
342
|
+
token,
|
|
343
|
+
body: { state: 'closed', state_reason: input.reason ?? 'completed' },
|
|
344
|
+
},
|
|
345
|
+
);
|
|
346
|
+
return { closed: true, issue_number: input.issue_number };
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
|
|
350
|
+
{
|
|
351
|
+
name: 'github_comment_issue',
|
|
352
|
+
description: 'Add a comment to an issue or pull request',
|
|
353
|
+
inputSchema: {
|
|
354
|
+
type: 'object',
|
|
355
|
+
properties: {
|
|
356
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
357
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
358
|
+
issue_number: { type: 'number', description: 'Issue or PR number' },
|
|
359
|
+
body: { type: 'string', description: 'Comment text (markdown)' },
|
|
360
|
+
},
|
|
361
|
+
required: ['owner', 'repo', 'issue_number', 'body'],
|
|
362
|
+
},
|
|
363
|
+
requiresApproval: true,
|
|
364
|
+
handler: async (input: { owner: string; repo: string; issue_number: number; body: string }) => {
|
|
365
|
+
const token = await this.getToken();
|
|
366
|
+
if (!token) throw new Error('GitHub token required to post comments');
|
|
367
|
+
const comment = await this.ghFetch(
|
|
368
|
+
`/repos/${encodeURIComponent(input.owner)}/${encodeURIComponent(input.repo)}/issues/${input.issue_number}/comments`,
|
|
369
|
+
{ method: 'POST', token, body: { body: input.body } },
|
|
370
|
+
);
|
|
371
|
+
return { comment_id: comment.id, url: comment.html_url };
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
|
|
375
|
+
// ── Pull requests ────────────────────────────────────────────────────
|
|
376
|
+
|
|
377
|
+
{
|
|
378
|
+
name: 'github_prs',
|
|
379
|
+
description: 'List pull requests for a repository',
|
|
380
|
+
inputSchema: {
|
|
381
|
+
type: 'object',
|
|
382
|
+
properties: {
|
|
383
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
384
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
385
|
+
state: { type: 'string', enum: ['open', 'closed', 'all'], description: 'PR state (default: open)' },
|
|
386
|
+
base: { type: 'string', description: 'Filter by base branch name' },
|
|
387
|
+
per_page: { type: 'number', description: 'Results per page (default 25, max 100)' },
|
|
388
|
+
},
|
|
389
|
+
required: ['owner', 'repo'],
|
|
390
|
+
},
|
|
391
|
+
handler: async (input: { owner: string; repo: string; state?: string; base?: string; per_page?: number }) => {
|
|
392
|
+
const token = await this.getToken();
|
|
393
|
+
const params = new URLSearchParams({
|
|
394
|
+
state: input.state ?? 'open',
|
|
395
|
+
per_page: String(Math.min(input.per_page ?? 25, 100)),
|
|
396
|
+
});
|
|
397
|
+
if (input.base) params.set('base', input.base);
|
|
398
|
+
const prs = await this.ghFetch(
|
|
399
|
+
`/repos/${encodeURIComponent(input.owner)}/${encodeURIComponent(input.repo)}/pulls?${params}`,
|
|
400
|
+
{ token },
|
|
401
|
+
);
|
|
402
|
+
return (prs as any[]).map((p) => ({
|
|
403
|
+
number: p.number,
|
|
404
|
+
title: p.title,
|
|
405
|
+
state: p.state,
|
|
406
|
+
author: p.user?.login,
|
|
407
|
+
head: p.head?.ref,
|
|
408
|
+
base: p.base?.ref,
|
|
409
|
+
draft: p.draft,
|
|
410
|
+
mergeable: p.mergeable,
|
|
411
|
+
reviews_requested: p.requested_reviewers?.map((r: any) => r.login),
|
|
412
|
+
created: p.created_at,
|
|
413
|
+
updated: p.updated_at,
|
|
414
|
+
url: p.html_url,
|
|
415
|
+
}));
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
|
|
419
|
+
{
|
|
420
|
+
name: 'github_pr',
|
|
421
|
+
description: 'Get detailed PR info including diff stats, reviewers, and checks',
|
|
422
|
+
inputSchema: {
|
|
423
|
+
type: 'object',
|
|
424
|
+
properties: {
|
|
425
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
426
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
427
|
+
pr_number: { type: 'number', description: 'Pull request number' },
|
|
428
|
+
},
|
|
429
|
+
required: ['owner', 'repo', 'pr_number'],
|
|
430
|
+
},
|
|
431
|
+
handler: async (input: { owner: string; repo: string; pr_number: number }) => {
|
|
432
|
+
const token = await this.getToken();
|
|
433
|
+
const base = `/repos/${encodeURIComponent(input.owner)}/${encodeURIComponent(input.repo)}`;
|
|
434
|
+
const [p, reviews] = await Promise.all([
|
|
435
|
+
this.ghFetch(`${base}/pulls/${input.pr_number}`, { token }),
|
|
436
|
+
this.ghFetch(`${base}/pulls/${input.pr_number}/reviews`, { token }).catch(() => []),
|
|
437
|
+
]);
|
|
438
|
+
return {
|
|
439
|
+
number: p.number,
|
|
440
|
+
title: p.title,
|
|
441
|
+
state: p.state,
|
|
442
|
+
author: p.user?.login,
|
|
443
|
+
body: p.body,
|
|
444
|
+
head: p.head?.ref,
|
|
445
|
+
base: p.base?.ref,
|
|
446
|
+
draft: p.draft,
|
|
447
|
+
mergeable: p.mergeable,
|
|
448
|
+
additions: p.additions,
|
|
449
|
+
deletions: p.deletions,
|
|
450
|
+
changed_files: p.changed_files,
|
|
451
|
+
commits: p.commits,
|
|
452
|
+
requested_reviewers: p.requested_reviewers?.map((r: any) => r.login),
|
|
453
|
+
reviews: (reviews as any[]).map((r: any) => ({ reviewer: r.user?.login, state: r.state })),
|
|
454
|
+
created: p.created_at,
|
|
455
|
+
updated: p.updated_at,
|
|
456
|
+
merged: p.merged,
|
|
457
|
+
merged_at: p.merged_at,
|
|
458
|
+
url: p.html_url,
|
|
459
|
+
};
|
|
460
|
+
},
|
|
461
|
+
},
|
|
462
|
+
|
|
463
|
+
{
|
|
464
|
+
name: 'github_create_pr',
|
|
465
|
+
description: 'Create a new pull request',
|
|
466
|
+
inputSchema: {
|
|
467
|
+
type: 'object',
|
|
468
|
+
properties: {
|
|
469
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
470
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
471
|
+
title: { type: 'string', description: 'PR title' },
|
|
472
|
+
body: { type: 'string', description: 'PR description (markdown)' },
|
|
473
|
+
head: { type: 'string', description: 'Head branch (source)' },
|
|
474
|
+
base: { type: 'string', description: 'Base branch (target, e.g. main)' },
|
|
475
|
+
draft: { type: 'boolean', description: 'Create as draft PR', default: false },
|
|
476
|
+
},
|
|
477
|
+
required: ['owner', 'repo', 'title', 'head', 'base'],
|
|
478
|
+
},
|
|
479
|
+
requiresApproval: true,
|
|
480
|
+
handler: async (input: {
|
|
481
|
+
owner: string;
|
|
482
|
+
repo: string;
|
|
483
|
+
title: string;
|
|
484
|
+
body?: string;
|
|
485
|
+
head: string;
|
|
486
|
+
base: string;
|
|
487
|
+
draft?: boolean;
|
|
488
|
+
}) => {
|
|
489
|
+
const token = await this.getToken();
|
|
490
|
+
if (!token) throw new Error('GitHub token required to create pull requests');
|
|
491
|
+
const pr = await this.ghFetch(
|
|
492
|
+
`/repos/${encodeURIComponent(input.owner)}/${encodeURIComponent(input.repo)}/pulls`,
|
|
493
|
+
{
|
|
494
|
+
method: 'POST',
|
|
495
|
+
token,
|
|
496
|
+
body: {
|
|
497
|
+
title: input.title,
|
|
498
|
+
body: input.body,
|
|
499
|
+
head: input.head,
|
|
500
|
+
base: input.base,
|
|
501
|
+
draft: input.draft ?? false,
|
|
502
|
+
},
|
|
503
|
+
},
|
|
504
|
+
);
|
|
505
|
+
return { number: pr.number, url: pr.html_url, title: pr.title };
|
|
506
|
+
},
|
|
507
|
+
},
|
|
508
|
+
|
|
509
|
+
{
|
|
510
|
+
name: 'github_merge_pr',
|
|
511
|
+
description: 'Merge a pull request',
|
|
512
|
+
inputSchema: {
|
|
513
|
+
type: 'object',
|
|
514
|
+
properties: {
|
|
515
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
516
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
517
|
+
pr_number: { type: 'number', description: 'Pull request number' },
|
|
518
|
+
merge_method: {
|
|
519
|
+
type: 'string',
|
|
520
|
+
enum: ['merge', 'squash', 'rebase'],
|
|
521
|
+
description: 'Merge method (default: merge)',
|
|
522
|
+
},
|
|
523
|
+
commit_message: { type: 'string', description: 'Optional commit message' },
|
|
524
|
+
},
|
|
525
|
+
required: ['owner', 'repo', 'pr_number'],
|
|
526
|
+
},
|
|
527
|
+
requiresApproval: true,
|
|
528
|
+
handler: async (input: {
|
|
529
|
+
owner: string;
|
|
530
|
+
repo: string;
|
|
531
|
+
pr_number: number;
|
|
532
|
+
merge_method?: string;
|
|
533
|
+
commit_message?: string;
|
|
534
|
+
}) => {
|
|
535
|
+
const token = await this.getToken();
|
|
536
|
+
if (!token) throw new Error('GitHub token required to merge pull requests');
|
|
537
|
+
const result = await this.ghFetch(
|
|
538
|
+
`/repos/${encodeURIComponent(input.owner)}/${encodeURIComponent(input.repo)}/pulls/${input.pr_number}/merge`,
|
|
539
|
+
{
|
|
540
|
+
method: 'PUT',
|
|
541
|
+
token,
|
|
542
|
+
body: {
|
|
543
|
+
merge_method: input.merge_method ?? 'merge',
|
|
544
|
+
commit_message: input.commit_message,
|
|
545
|
+
},
|
|
546
|
+
},
|
|
547
|
+
);
|
|
548
|
+
return { merged: result?.merged ?? true, sha: result?.sha, message: result?.message };
|
|
549
|
+
},
|
|
550
|
+
},
|
|
551
|
+
|
|
552
|
+
// ── Code & files ─────────────────────────────────────────────────────
|
|
553
|
+
|
|
554
|
+
{
|
|
555
|
+
name: 'github_search_code',
|
|
556
|
+
description: 'Search code across GitHub repositories',
|
|
557
|
+
inputSchema: {
|
|
558
|
+
type: 'object',
|
|
559
|
+
properties: {
|
|
560
|
+
query: { type: 'string', description: 'Search query (e.g. "useState repo:facebook/react")' },
|
|
561
|
+
per_page: { type: 'number', description: 'Results per page (default 10, max 30)' },
|
|
562
|
+
},
|
|
563
|
+
required: ['query'],
|
|
564
|
+
},
|
|
565
|
+
handler: async (input: { query: string; per_page?: number }) => {
|
|
566
|
+
const token = await this.getToken();
|
|
567
|
+
const perPage = Math.min(input.per_page ?? 10, 30);
|
|
568
|
+
const data = await this.ghFetch(`/search/code?q=${encodeURIComponent(input.query)}&per_page=${perPage}`, {
|
|
569
|
+
token,
|
|
570
|
+
});
|
|
571
|
+
return {
|
|
572
|
+
total_count: data.total_count,
|
|
573
|
+
results: (data.items as any[]).map((i) => ({
|
|
574
|
+
name: i.name,
|
|
575
|
+
path: i.path,
|
|
576
|
+
repo: i.repository?.full_name,
|
|
577
|
+
url: i.html_url,
|
|
578
|
+
sha: i.sha,
|
|
579
|
+
})),
|
|
580
|
+
};
|
|
581
|
+
},
|
|
582
|
+
},
|
|
583
|
+
|
|
584
|
+
{
|
|
585
|
+
name: 'github_file',
|
|
586
|
+
description: 'Get file contents from a repository',
|
|
587
|
+
inputSchema: {
|
|
588
|
+
type: 'object',
|
|
589
|
+
properties: {
|
|
590
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
591
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
592
|
+
path: { type: 'string', description: 'File path in the repository (e.g. "src/index.ts")' },
|
|
593
|
+
ref: { type: 'string', description: 'Branch, tag, or commit SHA (default: default branch)' },
|
|
594
|
+
},
|
|
595
|
+
required: ['owner', 'repo', 'path'],
|
|
596
|
+
},
|
|
597
|
+
handler: async (input: { owner: string; repo: string; path: string; ref?: string }) => {
|
|
598
|
+
const token = await this.getToken();
|
|
599
|
+
const params = input.ref ? `?ref=${encodeURIComponent(input.ref)}` : '';
|
|
600
|
+
const data = await this.ghFetch(
|
|
601
|
+
`/repos/${encodeURIComponent(input.owner)}/${encodeURIComponent(input.repo)}/contents/${input.path}${params}`,
|
|
602
|
+
{ token },
|
|
603
|
+
);
|
|
604
|
+
if (Array.isArray(data)) {
|
|
605
|
+
// It's a directory listing
|
|
606
|
+
return {
|
|
607
|
+
type: 'directory',
|
|
608
|
+
path: input.path,
|
|
609
|
+
entries: data.map((e: any) => ({ name: e.name, type: e.type, size: e.size, path: e.path })),
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
const content =
|
|
613
|
+
data.encoding === 'base64' ? Buffer.from(data.content, 'base64').toString('utf-8') : data.content;
|
|
614
|
+
return {
|
|
615
|
+
type: 'file',
|
|
616
|
+
name: data.name,
|
|
617
|
+
path: data.path,
|
|
618
|
+
size: data.size,
|
|
619
|
+
sha: data.sha,
|
|
620
|
+
content: content.slice(0, 50000), // cap at 50 KB
|
|
621
|
+
encoding: data.encoding,
|
|
622
|
+
};
|
|
623
|
+
},
|
|
624
|
+
},
|
|
625
|
+
|
|
626
|
+
// ── Commits ──────────────────────────────────────────────────────────
|
|
627
|
+
|
|
628
|
+
{
|
|
629
|
+
name: 'github_commits',
|
|
630
|
+
description: 'List commits for a repository or branch',
|
|
631
|
+
inputSchema: {
|
|
632
|
+
type: 'object',
|
|
633
|
+
properties: {
|
|
634
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
635
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
636
|
+
branch: { type: 'string', description: 'Branch name (default: default branch)' },
|
|
637
|
+
author: { type: 'string', description: 'Filter by author username or email' },
|
|
638
|
+
per_page: { type: 'number', description: 'Results per page (default 20, max 100)' },
|
|
639
|
+
},
|
|
640
|
+
required: ['owner', 'repo'],
|
|
641
|
+
},
|
|
642
|
+
handler: async (input: {
|
|
643
|
+
owner: string;
|
|
644
|
+
repo: string;
|
|
645
|
+
branch?: string;
|
|
646
|
+
author?: string;
|
|
647
|
+
per_page?: number;
|
|
648
|
+
}) => {
|
|
649
|
+
const token = await this.getToken();
|
|
650
|
+
const params = new URLSearchParams({
|
|
651
|
+
per_page: String(Math.min(input.per_page ?? 20, 100)),
|
|
652
|
+
});
|
|
653
|
+
if (input.branch) params.set('sha', input.branch);
|
|
654
|
+
if (input.author) params.set('author', input.author);
|
|
655
|
+
const commits = await this.ghFetch(
|
|
656
|
+
`/repos/${encodeURIComponent(input.owner)}/${encodeURIComponent(input.repo)}/commits?${params}`,
|
|
657
|
+
{ token },
|
|
658
|
+
);
|
|
659
|
+
return (commits as any[]).map((c) => ({
|
|
660
|
+
sha: c.sha?.slice(0, 8),
|
|
661
|
+
message: c.commit?.message?.split('\n')[0],
|
|
662
|
+
author: c.commit?.author?.name,
|
|
663
|
+
date: c.commit?.author?.date,
|
|
664
|
+
url: c.html_url,
|
|
665
|
+
}));
|
|
666
|
+
},
|
|
667
|
+
},
|
|
668
|
+
|
|
669
|
+
// ── Releases ─────────────────────────────────────────────────────────
|
|
670
|
+
|
|
671
|
+
{
|
|
672
|
+
name: 'github_releases',
|
|
673
|
+
description: 'List releases for a repository',
|
|
674
|
+
inputSchema: {
|
|
675
|
+
type: 'object',
|
|
676
|
+
properties: {
|
|
677
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
678
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
679
|
+
per_page: { type: 'number', description: 'Results per page (default 10, max 30)' },
|
|
680
|
+
},
|
|
681
|
+
required: ['owner', 'repo'],
|
|
682
|
+
},
|
|
683
|
+
handler: async (input: { owner: string; repo: string; per_page?: number }) => {
|
|
684
|
+
const token = await this.getToken();
|
|
685
|
+
const perPage = Math.min(input.per_page ?? 10, 30);
|
|
686
|
+
const releases = await this.ghFetch(
|
|
687
|
+
`/repos/${encodeURIComponent(input.owner)}/${encodeURIComponent(input.repo)}/releases?per_page=${perPage}`,
|
|
688
|
+
{ token },
|
|
689
|
+
);
|
|
690
|
+
return (releases as any[]).map((r) => ({
|
|
691
|
+
id: r.id,
|
|
692
|
+
tag: r.tag_name,
|
|
693
|
+
name: r.name,
|
|
694
|
+
prerelease: r.prerelease,
|
|
695
|
+
draft: r.draft,
|
|
696
|
+
body: r.body?.slice(0, 2000),
|
|
697
|
+
author: r.author?.login,
|
|
698
|
+
created: r.created_at,
|
|
699
|
+
published: r.published_at,
|
|
700
|
+
url: r.html_url,
|
|
701
|
+
assets: r.assets?.map((a: any) => ({ name: a.name, size: a.size, downloads: a.download_count })),
|
|
702
|
+
}));
|
|
703
|
+
},
|
|
704
|
+
},
|
|
705
|
+
|
|
706
|
+
{
|
|
707
|
+
name: 'github_create_release',
|
|
708
|
+
description: 'Create a new release/tag for a repository',
|
|
709
|
+
inputSchema: {
|
|
710
|
+
type: 'object',
|
|
711
|
+
properties: {
|
|
712
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
713
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
714
|
+
tag_name: { type: 'string', description: 'Tag name (e.g. v1.2.0)' },
|
|
715
|
+
name: { type: 'string', description: 'Release name/title' },
|
|
716
|
+
body: { type: 'string', description: 'Release notes (markdown)' },
|
|
717
|
+
draft: { type: 'boolean', description: 'Create as draft', default: false },
|
|
718
|
+
prerelease: { type: 'boolean', description: 'Mark as pre-release', default: false },
|
|
719
|
+
target_commitish: { type: 'string', description: 'Branch or SHA to tag (default: default branch)' },
|
|
720
|
+
},
|
|
721
|
+
required: ['owner', 'repo', 'tag_name'],
|
|
722
|
+
},
|
|
723
|
+
requiresApproval: true,
|
|
724
|
+
handler: async (input: {
|
|
725
|
+
owner: string;
|
|
726
|
+
repo: string;
|
|
727
|
+
tag_name: string;
|
|
728
|
+
name?: string;
|
|
729
|
+
body?: string;
|
|
730
|
+
draft?: boolean;
|
|
731
|
+
prerelease?: boolean;
|
|
732
|
+
target_commitish?: string;
|
|
733
|
+
}) => {
|
|
734
|
+
const token = await this.getToken();
|
|
735
|
+
if (!token) throw new Error('GitHub token required to create releases');
|
|
736
|
+
const release = await this.ghFetch(
|
|
737
|
+
`/repos/${encodeURIComponent(input.owner)}/${encodeURIComponent(input.repo)}/releases`,
|
|
738
|
+
{
|
|
739
|
+
method: 'POST',
|
|
740
|
+
token,
|
|
741
|
+
body: {
|
|
742
|
+
tag_name: input.tag_name,
|
|
743
|
+
name: input.name,
|
|
744
|
+
body: input.body,
|
|
745
|
+
draft: input.draft ?? false,
|
|
746
|
+
prerelease: input.prerelease ?? false,
|
|
747
|
+
target_commitish: input.target_commitish,
|
|
748
|
+
},
|
|
749
|
+
},
|
|
750
|
+
);
|
|
751
|
+
return { id: release.id, tag: release.tag_name, url: release.html_url };
|
|
752
|
+
},
|
|
753
|
+
},
|
|
754
|
+
|
|
755
|
+
// ── Social ───────────────────────────────────────────────────────────
|
|
756
|
+
|
|
757
|
+
{
|
|
758
|
+
name: 'github_star',
|
|
759
|
+
description: 'Star a GitHub repository',
|
|
760
|
+
inputSchema: {
|
|
761
|
+
type: 'object',
|
|
762
|
+
properties: {
|
|
763
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
764
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
765
|
+
},
|
|
766
|
+
required: ['owner', 'repo'],
|
|
767
|
+
},
|
|
768
|
+
requiresApproval: true,
|
|
769
|
+
handler: async (input: { owner: string; repo: string }) => {
|
|
770
|
+
const token = await this.getToken();
|
|
771
|
+
if (!token) throw new Error('GitHub token required to star repositories');
|
|
772
|
+
await this.ghFetch(`/user/starred/${encodeURIComponent(input.owner)}/${encodeURIComponent(input.repo)}`, {
|
|
773
|
+
method: 'PUT',
|
|
774
|
+
token,
|
|
775
|
+
});
|
|
776
|
+
return { starred: true, repo: `${input.owner}/${input.repo}` };
|
|
777
|
+
},
|
|
778
|
+
},
|
|
779
|
+
|
|
780
|
+
{
|
|
781
|
+
name: 'github_fork',
|
|
782
|
+
description: 'Fork a GitHub repository',
|
|
783
|
+
inputSchema: {
|
|
784
|
+
type: 'object',
|
|
785
|
+
properties: {
|
|
786
|
+
owner: { type: 'string', description: 'Repository owner' },
|
|
787
|
+
repo: { type: 'string', description: 'Repository name' },
|
|
788
|
+
organization: {
|
|
789
|
+
type: 'string',
|
|
790
|
+
description: 'Fork into this organization (optional, defaults to your account)',
|
|
791
|
+
},
|
|
792
|
+
},
|
|
793
|
+
required: ['owner', 'repo'],
|
|
794
|
+
},
|
|
795
|
+
requiresApproval: true,
|
|
796
|
+
handler: async (input: { owner: string; repo: string; organization?: string }) => {
|
|
797
|
+
const token = await this.getToken();
|
|
798
|
+
if (!token) throw new Error('GitHub token required to fork repositories');
|
|
799
|
+
const fork = await this.ghFetch(
|
|
800
|
+
`/repos/${encodeURIComponent(input.owner)}/${encodeURIComponent(input.repo)}/forks`,
|
|
801
|
+
{
|
|
802
|
+
method: 'POST',
|
|
803
|
+
token,
|
|
804
|
+
body: input.organization ? { organization: input.organization } : {},
|
|
805
|
+
},
|
|
806
|
+
);
|
|
807
|
+
return { name: fork.full_name, url: fork.html_url, cloneUrl: fork.clone_url };
|
|
808
|
+
},
|
|
809
|
+
},
|
|
810
|
+
|
|
811
|
+
// ── Authenticated user ───────────────────────────────────────────────
|
|
812
|
+
|
|
813
|
+
{
|
|
814
|
+
name: 'github_notifications',
|
|
815
|
+
description: 'List unread GitHub notifications (requires authentication)',
|
|
816
|
+
inputSchema: {
|
|
817
|
+
type: 'object',
|
|
818
|
+
properties: {
|
|
819
|
+
all: { type: 'boolean', description: 'Include read notifications', default: false },
|
|
820
|
+
per_page: { type: 'number', description: 'Results per page (default 20, max 50)' },
|
|
821
|
+
},
|
|
822
|
+
},
|
|
823
|
+
handler: async (input: { all?: boolean; per_page?: number }) => {
|
|
824
|
+
const token = await this.getToken();
|
|
825
|
+
if (!token) throw new Error('GitHub token required to read notifications');
|
|
826
|
+
const params = new URLSearchParams({
|
|
827
|
+
all: String(input.all ?? false),
|
|
828
|
+
per_page: String(Math.min(input.per_page ?? 20, 50)),
|
|
829
|
+
});
|
|
830
|
+
const notifications = await this.ghFetch(`/notifications?${params}`, { token });
|
|
831
|
+
return (notifications as any[]).map((n) => ({
|
|
832
|
+
id: n.id,
|
|
833
|
+
unread: n.unread,
|
|
834
|
+
reason: n.reason,
|
|
835
|
+
subject_type: n.subject?.type,
|
|
836
|
+
subject_title: n.subject?.title,
|
|
837
|
+
repo: n.repository?.full_name,
|
|
838
|
+
updated: n.updated_at,
|
|
839
|
+
}));
|
|
840
|
+
},
|
|
841
|
+
},
|
|
842
|
+
|
|
843
|
+
{
|
|
844
|
+
name: 'github_my_repos',
|
|
845
|
+
description: "List the authenticated user's repositories (requires authentication)",
|
|
846
|
+
inputSchema: {
|
|
847
|
+
type: 'object',
|
|
848
|
+
properties: {
|
|
849
|
+
type: {
|
|
850
|
+
type: 'string',
|
|
851
|
+
enum: ['all', 'public', 'private', 'forks', 'sources'],
|
|
852
|
+
description: 'Repository type filter (default: all)',
|
|
853
|
+
},
|
|
854
|
+
sort: { type: 'string', enum: ['created', 'updated', 'pushed', 'full_name'], description: 'Sort order' },
|
|
855
|
+
per_page: { type: 'number', description: 'Results per page (default 30, max 100)' },
|
|
856
|
+
},
|
|
857
|
+
},
|
|
858
|
+
handler: async (input: { type?: string; sort?: string; per_page?: number }) => {
|
|
859
|
+
const token = await this.getToken();
|
|
860
|
+
if (!token) throw new Error('GitHub token required to list your repositories');
|
|
861
|
+
const params = new URLSearchParams({
|
|
862
|
+
type: input.type ?? 'all',
|
|
863
|
+
sort: input.sort ?? 'updated',
|
|
864
|
+
per_page: String(Math.min(input.per_page ?? 30, 100)),
|
|
865
|
+
});
|
|
866
|
+
const repos = await this.ghFetch(`/user/repos?${params}`, { token });
|
|
867
|
+
return (repos as any[]).map((r) => ({
|
|
868
|
+
name: r.name,
|
|
869
|
+
full_name: r.full_name,
|
|
870
|
+
private: r.private,
|
|
871
|
+
description: r.description,
|
|
872
|
+
language: r.language,
|
|
873
|
+
stars: r.stargazers_count,
|
|
874
|
+
forks: r.forks_count,
|
|
875
|
+
updated: r.updated_at,
|
|
876
|
+
url: r.html_url,
|
|
877
|
+
}));
|
|
878
|
+
},
|
|
879
|
+
},
|
|
880
|
+
|
|
881
|
+
{
|
|
882
|
+
name: 'github_gists',
|
|
883
|
+
description: 'List public gists for a user',
|
|
884
|
+
inputSchema: {
|
|
885
|
+
type: 'object',
|
|
886
|
+
properties: {
|
|
887
|
+
username: { type: 'string', description: 'GitHub username (omit to list your own gists, requires auth)' },
|
|
888
|
+
per_page: { type: 'number', description: 'Results per page (default 20, max 100)' },
|
|
889
|
+
},
|
|
890
|
+
},
|
|
891
|
+
handler: async (input: { username?: string; per_page?: number }) => {
|
|
892
|
+
const token = await this.getToken();
|
|
893
|
+
const perPage = Math.min(input.per_page ?? 20, 100);
|
|
894
|
+
const path = input.username
|
|
895
|
+
? `/users/${encodeURIComponent(input.username)}/gists?per_page=${perPage}`
|
|
896
|
+
: `/gists?per_page=${perPage}`;
|
|
897
|
+
const gists = await this.ghFetch(path, { token });
|
|
898
|
+
return (gists as any[]).map((g) => ({
|
|
899
|
+
id: g.id,
|
|
900
|
+
description: g.description,
|
|
901
|
+
public: g.public,
|
|
902
|
+
files: Object.keys(g.files ?? {}),
|
|
903
|
+
owner: g.owner?.login,
|
|
904
|
+
created: g.created_at,
|
|
905
|
+
updated: g.updated_at,
|
|
906
|
+
url: g.html_url,
|
|
907
|
+
}));
|
|
908
|
+
},
|
|
909
|
+
},
|
|
910
|
+
];
|
|
911
|
+
}
|
|
912
|
+
}
|