Skip to content

Commit 3d56f22

Browse files
sugyanclaude
andauthored
docs: add Permission Mode feature documentation (#239)
* docs: add Permission Mode feature documentation - Add Permission Mode section to CLAUDE.md explaining UI-driven implementation - Update README.md with Permission Mode in feature comparison and Key Features - Document PlanPermissionInputPanel approach that works around SDK limitations Closes #138 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * fix: remove inaccurate CLI limitation from README comparison --------- Co-authored-by: Claude <[email protected]>
1 parent 863c7c4 commit 3d56f22

File tree

2 files changed

+68
-9
lines changed

2 files changed

+68
-9
lines changed

CLAUDE.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,8 @@ cd frontend && npm run dev # Configures proxy to localhost:9000
524524

525525
21. **Enter Key Behavior**: Configurable Enter key behavior with persistent user preferences, supporting both traditional (Enter=Send) and modern (Enter=Newline) interaction patterns.
526526

527+
22. **Permission Mode Switching**: UI-driven plan mode functionality that allows users to toggle between normal execution and plan mode. When plan mode is selected, users can review and approve Claude's planned actions before execution through an intuitive interface.
528+
527529
## Claude Code SDK Types Reference
528530

529531
**SDK Types**: `frontend/node_modules/@anthropic-ai/claude-code/sdk.d.ts`
@@ -590,6 +592,48 @@ The modular frontend architecture provides several key benefits:
590592
- **Code Splitting**: Easier to implement lazy loading for large features
591593
- **Memory Efficiency**: Reduced memory footprint with focused hooks
592594

595+
## Permission Mode Switching
596+
597+
This project implements a permission mode switching feature that allows users to toggle between normal execution and plan mode before sending messages to Claude.
598+
599+
### Features
600+
601+
- **Normal Mode**: Direct execution (default behavior)
602+
- **Plan Mode**: Claude presents a plan for user review and approval before execution
603+
- **UI Toggle**: Permission mode selector integrated into the chat input interface
604+
- **Session Persistence**: Permission mode choice is maintained during the browser session
605+
606+
### Implementation Approach
607+
608+
The implementation uses a **UI-driven approach** with the `PlanPermissionInputPanel` component, providing:
609+
610+
- **Three-Option Interface**: "Accept with Edits", "Accept Default", or "Keep Planning"
611+
- **Seamless Integration**: Built into the existing chat input component
612+
- **Type Safety**: Full TypeScript support with comprehensive type definitions
613+
- **State Management**: Uses the `usePermissionMode` hook for state tracking
614+
615+
### Technical Architecture
616+
617+
- **Frontend**: Permission mode state management via `usePermissionMode` hook
618+
- **Backend**: `permissionMode` parameter passed to Claude Code SDK via the chat API
619+
- **Types**: Shared type definitions in `shared/types.ts` with frontend extensions
620+
- **UI Components**: `PlanPermissionInputPanel` for plan approval workflow
621+
622+
### Usage
623+
624+
1. Toggle permission mode using the cycle button in the chat input area
625+
2. Send message in plan mode to activate plan review workflow
626+
3. Review plan options in the permission input panel
627+
4. Choose your preferred action: Accept with Edits, Accept Default, or Keep Planning
628+
629+
### Files Involved
630+
631+
- **Shared Types**: `shared/types.ts` - `ChatRequest.permissionMode` field
632+
- **Backend API**: `backend/handlers/chat.ts` - Permission mode parameter handling
633+
- **Frontend State**: `frontend/src/hooks/chat/usePermissionMode.ts` - State management
634+
- **UI Components**: `frontend/src/components/chat/PlanPermissionInputPanel.tsx` - Plan approval interface
635+
- **Integration**: `frontend/src/components/chat/ChatInput.tsx` - Mode toggle and panel integration
636+
593637
## Testing
594638

595639
The project includes comprehensive test suites for both frontend and backend components:

README.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
<div align="center">
1616

17-
| Desktop Interface | Mobile Experience |
18-
| --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
17+
| Desktop Interface | Mobile Experience |
18+
| -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
1919
| <img src="https://github.com/sugyan/claude-code-webui/raw/main/docs/images/screenshot-desktop-basic-dark.png" alt="Desktop Interface" width="600"> | <img src="https://github.com/sugyan/claude-code-webui/raw/main/docs/images/screenshot-mobile-basic-dark.png" alt="Mobile Interface" width="250"> |
20-
| _Chat-based coding interface with instant responses and ready input field_ | _Mobile-optimized chat experience with touch-friendly design_ |
20+
| _Chat-based coding interface with instant responses and ready input field_ | _Mobile-optimized chat experience with touch-friendly design_ |
2121

2222
</div>
2323

@@ -26,10 +26,10 @@
2626

2727
<div align="center">
2828

29-
| Desktop (Light) | Mobile (Light) |
30-
| ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------- |
29+
| Desktop (Light) | Mobile (Light) |
30+
| ----------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
3131
| <img src="https://github.com/sugyan/claude-code-webui/raw/main/docs/images/screenshot-desktop-basic.png" alt="Desktop Light Theme" width="600"> | <img src="https://github.com/sugyan/claude-code-webui/raw/main/docs/images/screenshot-mobile-basic.png" alt="Mobile Light Theme" width="250"> |
32-
| _Clean light interface for daytime coding sessions_ | _iPhone SE optimized light theme interface_ |
32+
| _Clean light interface for daytime coding sessions_ | _iPhone SE optimized light theme interface_ |
3333

3434
</div>
3535

@@ -40,10 +40,10 @@
4040

4141
<div align="center">
4242

43-
| Desktop Permission Dialog | Mobile Permission Dialog |
44-
| ------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
43+
| Desktop Permission Dialog | Mobile Permission Dialog |
44+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
4545
| <img src="https://github.com/sugyan/claude-code-webui/raw/main/docs/images/screenshot-desktop-fileOperations-dark.png" alt="Permission Dialog" width="600"> | <img src="https://github.com/sugyan/claude-code-webui/raw/main/docs/images/screenshot-mobile-fileOperations-dark.png" alt="Mobile Permission" width="250"> |
46-
| _Secure tool access with granular permission controls and clear approval workflow_ | _Touch-optimized permission interface for mobile devices_ |
46+
| _Secure tool access with granular permission controls and clear approval workflow_ | _Touch-optimized permission interface for mobile devices_ |
4747

4848
</div>
4949

@@ -79,6 +79,16 @@ Instead of being limited to command-line interactions, Claude Code Web UI brings
7979
| 📝 Plain text output | 🎨 Rich formatted responses |
8080
| 🗂️ Manual directory switching | 📁 Visual project selection |
8181

82+
### 🎯 Key Features
83+
84+
- **📋 Permission Mode Switching** - Toggle between normal and plan mode execution
85+
- **🔄 Real-time streaming responses** - Live Claude Code output in chat interface
86+
- **📁 Project directory selection** - Visual project picker for context-aware sessions
87+
- **💬 Conversation history** - Browse and restore previous chat sessions
88+
- **🛠️ Tool permission management** - Granular control over Claude's tool access
89+
- **🎨 Dark/light theme support** - Automatic system preference detection
90+
- **📱 Mobile-responsive design** - Touch-optimized interface for any device
91+
8292
---
8393

8494
## 🚀 Quick Start
@@ -179,16 +189,19 @@ PORT=9000 DEBUG=true claude-code-webui
179189
If you encounter "Claude Code process exited with code 1" or similar errors, this typically indicates Claude CLI path detection failure.
180190

181191
**Quick Solution:**
192+
182193
```bash
183194
claude-code-webui --claude-path "$(which claude)"
184195
```
185196

186197
**Common scenarios requiring explicit path specification:**
198+
187199
- **Node.js environment managers** (Volta, asdf, nvm, etc.)
188200
- **Custom installation locations**
189201
- **Shell aliases or wrapper scripts**
190202

191203
**Environment-specific commands:**
204+
192205
```bash
193206
# For Volta users
194207
claude-code-webui --claude-path "$(volta which claude)"
@@ -199,12 +212,14 @@ claude-code-webui --claude-path "$(asdf which claude)"
199212

200213
**Native Binary Installation:**
201214
Currently **not supported** due to TypeScript SDK limitations. Please use npm/yarn installation:
215+
202216
```bash
203217
npm install -g @anthropic-ai/claude-code
204218
```
205219

206220
**Debug Mode:**
207221
Use `--debug` flag for detailed error information:
222+
208223
```bash
209224
claude-code-webui --debug
210225
```

0 commit comments

Comments
 (0)