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
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI

on:
push:
branches: [master, main]
pull_request:
branches: [master, main]

permissions:
contents: read

jobs:
check:
name: Lint, typecheck, test, build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Typecheck
run: npm run typecheck

- name: Lint
run: npm run lint

- name: Format check
run: npm run format:check

- name: Test
run: npm test

- name: Build
run: npm run build

- name: Upload extension artifact
uses: actions/upload-artifact@v4
with:
name: github-conductor-extension
path: dist/
retention-days: 14
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
node_modules/
dist/
coverage/
.DS_Store
*.log
.env
.env.*
!.env.example
.vite/
.crx-cache/
*.zip
.claude/
.context/
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
dist/
coverage/
*.lock
package-lock.json
.claude/
.context/
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100,
"tabWidth": 2,
"arrowParens": "always"
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Sarth Frey

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
157 changes: 157 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# GitHub Conductor

> One click from any GitHub PR to a Conductor workspace with your prompt
> already running.

A lightweight Chrome extension that injects a button on every GitHub Pull
Request page. Click it and your configured prompt — populated with the PR's
metadata — opens in a fresh [Conductor](https://conductor.build) workspace via
the `conductor://` deep link.

![screenshot placeholder](public/icons/icon-128.png)

## Why

Rotating through PRs is the most repeatable part of a senior engineer's day.
This extension collapses "open PR → copy URL → switch apps → paste into
Conductor → write the same `gh pr view ...` boilerplate again" into a single
keystroke. Every PR becomes a one-click into a working Conductor session.

## Install (developer mode)

The extension isn't on the Chrome Web Store yet. To install from source:

```bash
git clone https://github.com/sarth6/github-conductor.git
cd github-conductor
npm install
npm run build
```

Then in Chrome:

1. Visit `chrome://extensions`
2. Toggle **Developer mode** on (top right)
3. Click **Load unpacked**
4. Pick the `dist/` directory

You should see the **GitHub Conductor** icon in your toolbar. Visit any GitHub
PR — a Conductor button appears in the header next to GitHub's actions.

## Configuration

Right-click the toolbar icon → **Options** (or use the gear in the popup).

### URL template

Sets the `conductor://` URL opened on click. The default is:

```
conductor://new?prompt={prompt}
```

`{prompt}` is replaced with the URL-encoded rendered prompt. You can also use
PR metadata placeholders directly in the URL (e.g. to set the workspace path):

```
conductor://new?prompt={prompt}&path=/Users/me/code/{repoName}
```

### Prompt presets

Each preset has a **name** and a **template**. Templates use
`{placeholderName}` syntax, replaced with metadata from the PR at click time.

Default presets that ship with the extension:

- **Review PR** — code-review oriented prompt
- **Address PR comments** — pulls in `gh pr view --comments` workflow

Mark any preset as the **default** (radio button) — that's the one the inline
GitHub button runs. All presets are accessible from the toolbar popup.

### Placeholders

| Placeholder | Source |
| ----------------- | ----------------------- |
| `{prUrl}` | Canonical PR URL |
| `{prNumber}` | PR number |
| `{prTitle}` | PR title |
| `{prDescription}` | PR body (markdown text) |
| `{prAuthor}` | Author login |
| `{prBranch}` | Head branch |
| `{prBaseBranch}` | Base branch |
| `{repo}` | `owner/repo` |
| `{repoOwner}` | `owner` |
| `{repoName}` | `repo` |
| `{prDiffUrl}` | `…/pull/N.diff` URL |
| `{prPatchUrl}` | `…/pull/N.patch` URL |

## Architecture

Five small, separately testable modules:

```
src/
├── types.ts ← shared TypeScript types
├── storage.ts ← chrome.storage.sync adapter + in-memory fallback
├── template.ts ← {placeholder} substitution engine
├── conductor-url.ts ← builds conductor:// URLs with safe encoding
├── pr-scraper.ts ← extracts PR metadata from the DOM
├── content/ ← content script: button injection on PR pages
├── options/ ← settings page
└── popup/ ← toolbar popup with preset list
```

Side effects live at the boundary (`storage`, `content`, `popup`). Everything
else is pure functions, which is why **34 unit tests** run in under a second.

## Development

```bash
npm install
npm run dev # Vite dev server with HMR for the options/popup pages
npm run build # production build → dist/
npm test # run all unit tests
npm run typecheck # tsc --noEmit
npm run lint # eslint
npm run check # typecheck + lint + format-check + test
```

### Tech stack

- **TypeScript** with strict mode + `exactOptionalPropertyTypes`
- **Vite 6** + **@crxjs/vite-plugin** for Manifest V3 bundling and HMR
- **Vitest** with **jsdom** for unit + DOM tests
- **ESLint 9** (flat config) + **Prettier**
- **GitHub Actions** CI: typecheck, lint, format-check, test, build

### Permissions

Minimal: only `storage` (to save your presets) and a single host permission
for `*://github.com/*`. The extension does **not** read any other site, make
network requests, or run on background tabs — it's a pure content script that
fires on a button click.

## How the deep link works

When you click the button:

1. The content script reads PR metadata from the DOM (title, branches,
author, etc.) and the URL (`/owner/repo/pull/N`).
2. Your chosen preset template is rendered — `{placeholder}` tokens are
substituted with the metadata.
3. The rendered prompt is URL-encoded and dropped into your URL template's
`{prompt}` slot.
4. The final `conductor://` URL is fired through a hidden iframe. macOS's
LaunchServices routes it to `Conductor.app`, which opens with the prompt
ready to go.

Substitution is a plain string replace — placeholder values are **never**
interpreted as templates, code, or shell input. The URL is built with
`encodeURIComponent`, so PR titles containing `&`, `=`, `#`, newlines, or
unicode are handled safely.

## License

MIT — see [LICENSE](LICENSE).
64 changes: 64 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import tseslint from '@typescript-eslint/eslint-plugin';
import tsparser from '@typescript-eslint/parser';
import prettier from 'eslint-config-prettier';

export default [
{
ignores: [
'dist/**',
'node_modules/**',
'coverage/**',
'*.config.js',
'.claude/**',
'.context/**',
],
},
{
files: ['**/*.ts'],
languageOptions: {
parser: tsparser,
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
globals: {
chrome: 'readonly',
window: 'readonly',
document: 'readonly',
console: 'readonly',
URL: 'readonly',
URLSearchParams: 'readonly',
MutationObserver: 'readonly',
HTMLElement: 'readonly',
HTMLButtonElement: 'readonly',
HTMLAnchorElement: 'readonly',
HTMLTextAreaElement: 'readonly',
HTMLInputElement: 'readonly',
HTMLSelectElement: 'readonly',
HTMLDivElement: 'readonly',
Element: 'readonly',
Event: 'readonly',
CustomEvent: 'readonly',
location: 'readonly',
navigator: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
Node: 'readonly',
},
},
plugins: {
'@typescript-eslint': tseslint,
},
rules: {
...tseslint.configs.recommended.rules,
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'no-console': ['warn', { allow: ['warn', 'error'] }],
},
},
prettier,
];
Loading
Loading