Skip to content
Draft
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
122 changes: 62 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<img src="docs/icon-readme.png" width="32" height="32" alt="CodePilot" style="vertical-align: middle; margin-right: 8px;" /> CodePilot
===

**A native desktop GUI for Claude Code** -- chat, code, and manage projects through a polished visual interface instead of the terminal.
**An iPad-friendly toolbox for developers and power users** -- clean up text, format and validate JSON, copy/share results instantly, and more. Built with an iPad-first UX philosophy so every tool works beautifully on a touchscreen as well as a desktop.

[![GitHub release](https://img.shields.io/github/v/release/op7418/CodePilot)](https://github.com/op7418/CodePilot/releases)
[![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Windows-lightgrey)](https://github.com/op7418/CodePilot/releases)
Expand All @@ -11,21 +11,15 @@

---

## Features

- **💬 Conversational coding** -- Stream responses from Claude in real time with full Markdown rendering, syntax-highlighted code blocks, and tool-call visualization.
- **📂 Session management** -- Create, rename, archive, and resume chat sessions. Conversations are persisted locally in SQLite so nothing is lost between restarts.
- **🎯 Project-aware context** -- Pick a working directory per session. The right panel shows a live file tree and file previews so you always know what Claude is looking at.
- **🔒 Permission controls** -- Approve, deny, or auto-allow tool use on a per-action basis. Choose between permission modes to match your comfort level.
- **🎭 Multiple interaction modes** -- Switch between *Code*, *Plan*, and *Ask* modes to control how Claude behaves in each session.
- **🤖 Model selector** -- Switch between Claude models (Opus, Sonnet, Haiku) mid-conversation.
- **🔌 MCP server management** -- Add, configure, and remove Model Context Protocol servers directly from the Extensions page. Supports `stdio`, `sse`, and `http` transport types.
- **⚡ Custom skills** -- Define reusable prompt-based skills (global or per-project) that can be invoked as slash commands during chat.
- **⚙️ Settings editor** -- Visual and JSON editors for your `~/.claude/settings.json`, including permissions and environment variables.
- **📊 Token usage tracking** -- See input/output token counts and estimated cost after every assistant response.
- **🌗 Dark / Light theme** -- One-click theme toggle in the navigation rail.
- **⌨️ Slash commands** -- Built-in commands like `/help`, `/clear`, `/cost`, `/compact`, `/doctor`, `/review`, and more.
- **🖥️ Electron packaging** -- Ships as a native desktop app with a hidden title bar, bundled Next.js server, and automatic port allocation.
## MVP Features

1. **🏠 Toolbox Home** -- A clean launchpad that lists all available tools. Tap or click any tile to open a tool instantly.
2. **✏️ Text Cleanup Tool** -- Trim whitespace, normalise line endings, remove duplicate lines, and apply common text transforms with a single tap.
3. **📋 JSON Formatter + Validator** -- Paste raw JSON, get it pretty-printed and validated in real time; errors are highlighted with clear messages.
4. **⚡ Copy / Share Quick Actions** -- One-tap copy to clipboard and native share sheet integration so results flow straight to other apps.
5. **📖 Basic Docs and Roadmap** -- In-app documentation and a visible roadmap so users always know what is coming next.

> See [`docs/roadmap.md`](docs/roadmap.md) for the full phased plan.

---

Expand Down Expand Up @@ -60,24 +54,45 @@ Pre-built releases are available on the [**Releases**](https://github.com/op7418

---

## Quick Start
## Getting Started

```bash
# Clone the repository
git clone https://github.com/op7418/CodePilot.git
cd codepilot
# 1. Clone the repository
git clone https://github.com/paulthanson082-glitch/CodePilot.git
cd CodePilot

# Install dependencies
# 2. Install dependencies
npm install

# Start in development mode (browser)
# 3. Start in development mode (browser)
npm run dev

# -- or start the full Electron app in dev mode --
# 4. Or start the full Electron app in dev mode
npm run electron:dev
```

Then open [http://localhost:3000](http://localhost:3000) (browser mode) or wait for the Electron window to appear.
Then open [http://localhost:3000](http://localhost:3000) in your browser (dev mode) or wait for the Electron window to appear.

### Git Workflow

We follow a simple feature-branch workflow:

1. **Create a feature branch** from `main`:
```bash
git checkout main && git pull
git checkout -b feature/your-feature-name
```
2. **Make focused commits** using [Conventional Commits](https://www.conventionalcommits.org/) style:
- `feat:` for new features
- `fix:` for bug fixes
- `docs:` for documentation changes
- `chore:` for maintenance tasks
3. **Push and open a PR** against `main`. Keep PRs small and focused -- one feature or fix per PR.
4. **Lint before pushing**: `npm run lint`

### iPad Setup

For tips on using CodePilot and running an iPad-focused development workflow, see [`docs/ipad-setup.md`](docs/ipad-setup.md).

---

Expand Down Expand Up @@ -148,39 +163,26 @@ Windows SmartScreen will block the installer or executable.
## Project Structure

```
codepilot/
├── electron/ # Electron main process & preload
│ ├── main.ts # Window creation, embedded server lifecycle
│ └── preload.ts # Context bridge
CodePilot/
├── docs/ # Documentation
│ ├── roadmap.md # Phased development roadmap
│ └── ipad-setup.md # iPad productivity setup guide
├── src/
│ ├── app/ # Next.js App Router pages & API routes
│ │ ├── chat/ # New-chat page & [id] session page
│ │ ├── extensions/ # Skills + MCP server management
│ │ ├── settings/ # Settings editor
│ │ └── api/ # REST + SSE endpoints
│ │ ├── chat/ # Sessions, messages, streaming, permissions
│ │ ├── files/ # File tree & preview
│ │ ├── plugins/ # Plugin & MCP CRUD
│ │ ├── settings/ # Settings read/write
│ │ ├── skills/ # Skill CRUD
│ │ └── tasks/ # Task tracking
│ ├── components/
│ │ ├── ai-elements/ # Message bubbles, code blocks, tool calls, etc.
│ │ ├── chat/ # ChatView, MessageList, MessageInput, streaming
│ │ ├── layout/ # AppShell, NavRail, Header, RightPanel
│ │ ├── plugins/ # MCP server list & editor
│ │ ├── project/ # FileTree, FilePreview, TaskList
│ │ ├── skills/ # SkillsManager, SkillEditor
│ │ └── ui/ # Radix-based primitives (button, dialog, tabs, ...)
│ ├── hooks/ # Custom React hooks (usePanel, ...)
│ ├── lib/ # Core logic
│ │ ├── claude-client.ts # Agent SDK streaming wrapper
│ │ ├── db.ts # SQLite schema, migrations, CRUD
│ │ ├── files.ts # File system helpers
│ │ ├── permission-registry.ts # Permission request/response bridge
│ │ └── utils.ts # Shared utilities
│ └── types/ # TypeScript interfaces & API contracts
├── electron-builder.yml # Packaging configuration
│ ├── core/ # Shared utilities, helpers, and core logic
│ ├── ui/ # Reusable UI components (iPad-first)
│ ├── tools/
│ │ ├── text/ # Text Cleanup Tool
│ │ ├── dev/ # Developer tools (JSON formatter, etc.)
│ │ └── productivity/ # Productivity-focused tools
│ ├── app/ # Next.js App Router pages & API routes
│ ├── components/ # Shared React components
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Core library code
│ └── types/ # TypeScript interfaces & contracts
├── tests/ # Unit and integration tests
├── electron/ # Electron main process & preload
├── public/ # Static assets
├── scripts/ # Build and packaging scripts
├── package.json
└── tsconfig.json
```
Expand Down Expand Up @@ -217,15 +219,15 @@ npm run electron:pack

## Contributing

Contributions are welcome. To get started:
Contributions are welcome! To get started:

1. Fork the repository and create a feature branch.
1. Fork the repository and create a feature branch off `main`.
2. Install dependencies with `npm install`.
3. Run `npm run electron:dev` to test your changes locally.
3. Run `npm run electron:dev` (or `npm run dev`) to test your changes locally.
4. Make sure `npm run lint` passes before opening a pull request.
5. Open a PR against `main` with a clear description of what changed and why.

Please keep PRs focused -- one feature or fix per pull request.
See the [roadmap](docs/roadmap.md) for planned features -- feel free to pick up anything in Phase 2 or Phase 3.

---

Expand Down
109 changes: 109 additions & 0 deletions docs/ipad-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# iPad Productivity Setup for CodePilot

This guide covers how to set up your iPad for a focused, productive development and toolbox workflow with CodePilot.

---

## Focus Modes

Use iPadOS **Focus** modes to minimise distractions while working.

1. **Create a "Dev" Focus** (`Settings → Focus → +`).
2. Allow only the apps you need: CodePilot, Files, Safari (docs), and your terminal app (e.g. Working Copy or SSH client).
3. Enable **Focus Status** so messaging apps show "Do Not Disturb" automatically.
4. Assign the Focus to a **Home Screen page** dedicated to development tools — only your dev apps appear on that page.
5. Set up an **automation**: turn the Focus on automatically when you open CodePilot (`Shortcuts → Automation → App → Open`).

---

## Core Apps

| App | Purpose |
|-----|---------|
| **CodePilot** | Main toolbox |
| **Working Copy** | Git client with Files.app integration |
| **Runestone** | Lightweight code/text editor |
| **Safari** | Documentation and web research |
| **Toolbox for Git** (optional) | Visual branch/history browser |
| **Scriptable** | JavaScript automation and quick scripts |
| **Shortcuts** | Glue between apps; invoke CodePilot tools from anywhere |

---

## Essential Shortcuts

### System shortcuts (iPad)

| Shortcut | Action |
|----------|--------|
| `⌘ Space` | Spotlight Search — open any app instantly |
| `⌘ Tab` | App switcher |
| `⌘ H` | Go to Home Screen |
| `⌘ .` | Cancel / dismiss |
| `Globe + ↓` | Show / hide keyboard |

### Inside CodePilot

| Shortcut | Action |
|----------|--------|
| `⌘ V` | Paste into active tool input |
| `⌘ C` | Copy tool output |
| `⌘ K` | Clear / reset current tool |
| `⌘ F` | Focus search on Toolbox Home |
| `⌘ ,` | Open Settings |

> **Tip**: Pair a Magic Keyboard or Smart Keyboard Folio to unlock all keyboard shortcuts. Most tap actions have a keyboard equivalent.

---

## Multitasking Setup

iPadOS Split View and Slide Over let you run CodePilot alongside other apps without switching.

- **Split View** (50/50 or 70/30): drag CodePilot and your editor/terminal side by side.
- **Slide Over**: pin a lightweight reference app (e.g. a browser with docs) as a Slide Over panel on top of CodePilot.
- **Stage Manager** (iPad Pro / Air M1+): arrange CodePilot and up to three other windows on screen simultaneously.

---

## Workflow

### Typical text-cleanup workflow

1. Copy text from any app (email, note, document).
2. Switch to CodePilot → **Text Cleanup Tool**.
3. `⌘ V` to paste.
4. Tap the desired transform (e.g. *Trim whitespace*, *Remove duplicate lines*).
5. `⌘ C` or tap **Copy** to copy the result back to clipboard.
6. Switch back to the source app and paste.

### Typical JSON workflow

1. Copy raw JSON from a browser, API response, or log file.
2. Switch to CodePilot → **JSON Formatter**.
3. `⌘ V` to paste.
4. Errors are highlighted immediately; fix them inline or in your source.
5. Tap **Format** to pretty-print.
6. Use **Share** to send the formatted JSON to Files, Mail, or another app.

### Git workflow with Working Copy

1. Clone your repository in Working Copy.
2. Create a feature branch (`feature/your-change`).
3. Edit files in Runestone or another editor via the Files integration.
4. Switch to CodePilot to validate or clean up any JSON / text files your change touches.
5. Commit and push from Working Copy.
6. Open a PR in Safari (GitHub mobile site or desktop mode).

---

## Tips and Tricks

- **Back Tap**: assign *Copy* or *Paste* to a double or triple back-tap (`Settings → Accessibility → Touch → Back Tap`) for even faster clipboard access.
- **Text Replacement**: add common JSON snippets or boilerplate in `Settings → General → Keyboard → Text Replacement` so you can type short abbreviations and get a full template.
- **Drag and Drop**: on iPadOS you can drag text from any app directly into a CodePilot tool input — no clipboard step needed.
- **Quick Note**: use the system Quick Note (swipe from bottom-right corner with Apple Pencil or four-finger swipe) to jot down ideas without leaving CodePilot.

---

*For the full feature roadmap see [`roadmap.md`](roadmap.md).*
54 changes: 54 additions & 0 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# CodePilot Roadmap

This document outlines the planned development phases for CodePilot. Checked items are complete or in progress; unchecked items are planned.

---

## Phase 1 — MVP (current focus)

> Goal: ship a lean, polished toolbox that works flawlessly on iPad and desktop.

- [ ] **Toolbox Home** — clean grid/list of all available tools with search/filter
- [ ] **Text Cleanup Tool** — trim whitespace, normalise line endings, remove duplicate lines, change case
- [ ] **JSON Formatter + Validator** — pretty-print JSON, validate structure, highlight errors inline
- [ ] **Copy / Share quick actions** — one-tap copy to clipboard and native share sheet on every tool output
- [ ] **Unit tests** for core transform functions (`tests/`)
- [x] **Docs and roadmap** — README, roadmap, iPad setup guide (`docs/`)

### Quality targets for Phase 1

- **Speed**: every tool transform completes in < 100 ms on a 1 MB input.
- **Predictable transforms**: given the same input the output is always identical (pure functions, no hidden state).
- **iPad-first UX**: tap targets ≥ 44 × 44 pt, no hover-only interactions, keyboard toolbar support on iPadOS.

---

## Phase 2 — Growth

> Goal: expand the toolset and improve sharing / collaboration.

- [ ] **Base64 encode / decode**
- [ ] **URL encode / decode**
- [ ] **Markdown preview** — live render with copy-as-HTML output
- [ ] **Diff viewer** — side-by-side or inline diff between two text inputs
- [ ] **Colour picker** — hex/RGB/HSL converter with clipboard integration
- [ ] **History** — remember the last N inputs per tool across app restarts (local storage)
- [ ] **Favourites / pinning** — let users pin their most-used tools to the top of the home grid
- [ ] **Dark / Light theme toggle**

---

## Phase 3 — Power Features

> Goal: power-user and developer-focused additions.

- [ ] **Custom transforms** — let users write simple JavaScript snippets as personal tools
- [ ] **Batch processing** — drag-and-drop multiple files and apply a tool to all of them
- [ ] **iCloud / Files integration** — open from and save to Files.app on iPadOS
- [ ] **Shortcuts (Siri/Shortcuts app) actions** — expose tools as Shortcuts actions for automation
- [ ] **Accessibility audit pass** — VoiceOver, Dynamic Type, and Reduce Motion compliance
- [ ] **Localisation** — at least English and Simplified Chinese (`i18n`)

---

*Last updated: 2026-03-07*
10 changes: 10 additions & 0 deletions src/core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# src/core

Shared utilities, helpers, and core business logic used across all tools.

## Planned contents

- `transforms.ts` — pure transform functions (text normalisation, JSON formatting, etc.)
- `clipboard.ts` — cross-platform clipboard read/write helpers
- `share.ts` — native share sheet abstraction
- `storage.ts` — local persistence helpers (history, favourites)
11 changes: 11 additions & 0 deletions src/tools/dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# src/tools/dev

Developer-focused tools.

## Planned tools

- **JSON Formatter + Validator** — pretty-print, validate, and highlight JSON errors
- **Base64 encode / decode** (Phase 2)
- **URL encode / decode** (Phase 2)
- **Markdown preview** (Phase 2)
- **Diff viewer** (Phase 2)
9 changes: 9 additions & 0 deletions src/tools/productivity/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# src/tools/productivity

Productivity-focused tools.

## Planned tools

- **Colour picker** — hex / RGB / HSL converter (Phase 2)
- **Custom transforms** — user-defined JavaScript snippets (Phase 3)
- **Batch processing** — apply a tool to multiple files at once (Phase 3)
12 changes: 12 additions & 0 deletions src/tools/text/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# src/tools/text

The **Text Cleanup Tool** implementation.

## Planned transforms

- Trim leading / trailing whitespace per line
- Normalise line endings (CRLF → LF)
- Remove blank / duplicate lines
- Change case (UPPER, lower, Title, Sentence)
- Strip HTML tags
- Count words, characters, lines
Loading