Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .github/workflows/deploy-vercel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,48 @@ jobs:
deploy:
name: deploy
runs-on: ubuntu-latest
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
steps:
- name: Check Vercel token
id: check
run: |
if [ -z "$VERCEL_TOKEN" ]; then
echo "available=false" >> "$GITHUB_OUTPUT"
echo "⚠️ VERCEL_TOKEN is not configured — skipping deployment"
else
echo "available=true" >> "$GITHUB_OUTPUT"
fi

- uses: actions/checkout@v4
if: steps.check.outputs.available == 'true'

- uses: actions/setup-node@v4
if: steps.check.outputs.available == 'true'
with:
node-version: "20"

- name: Install Vercel CLI
if: steps.check.outputs.available == 'true'
run: npm install --global vercel@latest

- name: Pull Vercel environment
if: steps.check.outputs.available == 'true'
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}

- name: Build project artifacts
if: steps.check.outputs.available == 'true'
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy to Vercel (preview)
if: steps.check.outputs.available == 'true'
id: deploy
run: |
url=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})
echo "url=$url" >> "$GITHUB_OUTPUT"

- name: Comment preview URL on PR
if: github.event_name == 'pull_request'
if: steps.check.outputs.available == 'true' && github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
Expand Down
15 changes: 3 additions & 12 deletions plugins/github-dev-assistant/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### Added
- Initial release of the `github-dev-assistant` plugin
- **Authorization (2 tools)**
- `github_auth` — OAuth 2.0 authorization flow with CSRF state protection
- `github_check_auth` — verify current authentication status
- **Authorization (1 tool)**
- `github_check_auth` — verify current authentication status via Personal Access Token
- **Repository management (2 tools)**
- `github_list_repos` — list user or organization repositories with filtering
- `github_create_repo` — create new repositories with optional license and gitignore
Expand All @@ -30,15 +29,7 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- `github_close_issue` — close issues/PRs with optional comment and reason
- **GitHub Actions (1 tool)**
- `github_trigger_workflow` — dispatch workflow_dispatch events with inputs
- **Web UI**
- `web-ui/config-panel.jsx` — configuration panel with OAuth connect, settings form, and usage examples
- `web-ui/oauth-callback.html` — OAuth redirect handler with postMessage communication
- **Security**
- All OAuth tokens stored exclusively via `sdk.secrets`
- Cryptographically random CSRF state with 10-minute TTL
- All tokens stored exclusively via `sdk.secrets`
- Token redaction in error messages
- `require_pr_review` confirmation policy for destructive merge operations
- **Tests**
- Unit tests for `github-client.js` (request handling, auth injection, error mapping)
- Unit tests for `auth.js` (OAuth flow, CSRF protection, token lifecycle)
- Integration tests for all tool categories with mocked GitHub API responses
92 changes: 34 additions & 58 deletions plugins/github-dev-assistant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,64 +6,52 @@ Full GitHub development workflow automation for the [Teleton](https://github.com

| Category | Tools |
|----------|-------|
| **Authorization** | `github_auth`, `github_check_auth` |
| **Authorization** | `github_check_auth` |
| **Repositories** | `github_list_repos`, `github_create_repo` |
| **Files & Branches** | `github_get_file`, `github_update_file`, `github_create_branch` |
| **Pull Requests** | `github_create_pr`, `github_list_prs`, `github_merge_pr` |
| **Issues** | `github_create_issue`, `github_list_issues`, `github_comment_issue`, `github_close_issue` |
| **GitHub Actions** | `github_trigger_workflow` |

**15 tools total** covering the complete GitHub development lifecycle.
**14 tools total** covering the complete GitHub development lifecycle.

## Installation

### Via Teleton Web UI
1. Open the Teleton Web UI and navigate to **Plugins**.
2. Search for `github-dev-assistant` and click **Install**.
3. Open plugin **Settings** to configure secrets and connect your GitHub account.
3. Open plugin **Settings** to configure the Personal Access Token.

### Manual Installation
1. Clone or copy this plugin folder to your Teleton plugins directory.
2. Add the plugin to `registry.json`.
3. Restart the Teleton agent.

```bash
mkdir -p ~/.teleton/plugins
cp -r plugins/github-dev-assistant ~/.teleton/plugins/
```

## Setup & Authorization

### Step 1: Create a GitHub OAuth App
### Step 1: Create a Personal Access Token

1. Go to **GitHub Settings → Developer settings → OAuth Apps → New OAuth App**
2. Fill in:
- **Application name**: `Teleton Dev Assistant` (or any name)
- **Homepage URL**: your Teleton instance URL
- **Authorization callback URL**: `<your-teleton-url>/plugins/github-dev-assistant/web-ui/oauth-callback.html`
3. Click **Register application**
4. Note your **Client ID** and generate a **Client Secret**
1. Go to **GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)**
2. Click **Generate new token (classic)**
3. Select scopes: `repo`, `workflow`, `user`
4. Click **Generate token** and copy the token

### Step 2: Configure Plugin Secrets
### Step 2: Configure Plugin Secret

In the Teleton Web UI plugin settings (or via environment variables):
Set the token via environment variable or Teleton secrets store:

| Secret | Environment Variable | Description |
|--------|---------------------|-------------|
| `github_client_id` | `GITHUB_OAUTH_CLIENT_ID` | OAuth App Client ID |
| `github_client_secret` | `GITHUB_OAUTH_CLIENT_SECRET` | OAuth App Client Secret |
| `github_webhook_secret` | `GITHUB_WEBHOOK_SECRET` | Webhook secret (optional) |

### Step 3: Authorize with GitHub
| `github_token` | `GITHUB_DEV_ASSISTANT_GITHUB_TOKEN` | GitHub Personal Access Token |

In the Teleton plugin settings panel:
1. Click **Connect GitHub Account**
2. A GitHub authorization popup will appear
3. Authorize the app and grant requested scopes
4. The panel will confirm: "Connected as *your-username*"
### Step 3: Verify Authorization

Or via the agent chat:
In the agent chat:
```
Check my GitHub auth status
```
```
Connect my GitHub account with repo and workflow scopes
```

## Usage Examples

Expand Down Expand Up @@ -115,30 +103,28 @@ Trigger the deploy.yml workflow on the main branch in my-org/my-repo
Run CI workflow on branch feat/new-feature in my-org/my-repo with input environment=staging
```

## Configuration Options
## Configuration

| Config Key | Type | Default | Description |
|------------|------|---------|-------------|
| `default_owner` | string | `null` | Default GitHub username/org for operations |
| `default_branch` | string | `"main"` | Default branch for commits and PRs |
| `auto_sign_commits` | boolean | `true` | Attribute commits to the agent |
| `require_pr_review` | boolean | `false` | Require confirmation before merging PRs |
| `commit_author_name` | string | `"Teleton AI Agent"` | Author name in commits |
| `commit_author_email` | string | `"agent@teleton.local"` | Author email in commits |
```yaml
# ~/.teleton/config.yaml
plugins:
github_dev_assistant:
default_owner: null # Default GitHub username/org for operations
default_branch: "main" # Default branch for commits and PRs
require_pr_review: false # Require confirmation before merging PRs
commit_author_name: "Teleton AI Agent" # Author name in commits
commit_author_email: "agent@teleton.local" # Author email in commits
```

## Security Best Practices

- **Never share your OAuth Client Secret.** It is stored encrypted via `sdk.secrets` and never appears in logs.
- **Never share your Personal Access Token.** It is stored encrypted via `sdk.secrets` and never appears in logs.
- **Enable `require_pr_review`** if you want human confirmation before any PR merges.
- **Use minimum required scopes.** The default `["repo", "workflow", "user"]` covers all plugin features; remove `workflow` if you don't need GitHub Actions.
- **Revoke access** via the plugin settings panel if you no longer need the connection.
- **Use minimum required scopes.** `repo`, `workflow`, and `user` cover all plugin features; remove `workflow` if you don't need GitHub Actions.
- **Review commit author settings** — commits will be attributed to the configured name/email, not your personal GitHub account.

## Tool Reference

### `github_auth`
Initiate or complete OAuth authorization. Call without parameters to start the flow (returns auth URL), or with `code` + `state` to complete it.

### `github_check_auth`
Check whether the plugin is authenticated and return the connected user's login.

Expand All @@ -164,7 +150,7 @@ Create a pull request. Parameters: `owner`, `repo`, `title`, `head` (all require
List pull requests. Parameters: `owner`, `repo` (required), `state`, `head`, `base`, `sort`, `direction`, `per_page`, `page`.

### `github_merge_pr`
Merge a pull request. Parameters: `owner`, `repo`, `pr_number` (all required), `merge_method`, `commit_title`, `commit_message`, `skip_review_check`.
Merge a pull request. Parameters: `owner`, `repo`, `pr_number` (all required), `merge_method`, `commit_title`, `commit_message`, `confirmed`.

### `github_create_issue`
Create an issue. Parameters: `owner`, `repo`, `title` (all required), `body`, `labels`, `assignees`, `milestone`.
Expand All @@ -181,19 +167,9 @@ Close an issue or PR. Parameters: `owner`, `repo`, `issue_number` (all required)
### `github_trigger_workflow`
Trigger a GitHub Actions workflow dispatch. Parameters: `owner`, `repo`, `workflow_id`, `ref` (all required), `inputs`.

## Testing

```bash
cd plugins/github-dev-assistant
npm install
npm test
```

Tests use [Vitest](https://vitest.dev/) with mocked GitHub API responses. No real API calls are made during testing.

## Contributing
## Developer

See the root [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines on adding new tools and submitting pull requests.
**Developer:** [xlabtg](https://github.com/xlabtg)

## License

Expand Down
2 changes: 1 addition & 1 deletion plugins/github-dev-assistant/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { formatError } from "./lib/utils.js";

export const manifest = {
name: "github-dev-assistant",
version: "2.0.0",
version: "1.0.0",
sdkVersion: ">=1.0.0",
description:
"Full GitHub development workflow automation — repos, files, branches, PRs, issues, and GitHub Actions via Personal Access Token",
Expand Down
39 changes: 11 additions & 28 deletions plugins/github-dev-assistant/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"id": "github-dev-assistant",
"name": "GitHub Dev Assistant",
"version": "2.0.0",
"version": "1.0.0",
"description": "Full GitHub development workflow automation — repos, files, branches, PRs, issues, and GitHub Actions via Personal Access Token",
"author": "xlabtg",
"author": {
"name": "xlabtg",
"url": "https://github.com/xlabtg"
},
"license": "MIT",
"entry": "index.js",
"teleton": ">=1.0.0",
Expand All @@ -15,32 +18,12 @@
"description": "GitHub Personal Access Token (create at https://github.com/settings/tokens)"
}
},
"config": {
"default_owner": {
"type": "string",
"default": null,
"description": "Default GitHub username/org for operations"
},
"default_branch": {
"type": "string",
"default": "main",
"description": "Default branch name for commits and PRs"
},
"require_pr_review": {
"type": "boolean",
"default": false,
"description": "Require user confirmation before merging PRs"
},
"commit_author_name": {
"type": "string",
"default": "Teleton AI Agent",
"description": "Author name in commits"
},
"commit_author_email": {
"type": "string",
"default": "agent@teleton.local",
"description": "Author email in commits"
}
"defaultConfig": {
"default_owner": null,
"default_branch": "main",
"require_pr_review": false,
"commit_author_name": "Teleton AI Agent",
"commit_author_email": "agent@teleton.local"
},
"tools": [
{ "name": "github_check_auth", "description": "Check if GitHub is connected and verify the authenticated account" },
Expand Down
Loading
Loading