# Change Request: CR-001

> Created: 2026-01-22
> Status: Approved
> Classification: Modification
> Related Feature: FEATURE-008

## Request Details

**Requestor:** Human User
**Date Received:** 2026-01-22
**Priority:** Medium

## Description

Add a "Copilot" button to the left side of the Edit button in the idea content view. The button should:
1. Expand the console/terminal window
2. If currently already in Copilot CLI mode, create a new terminal session
3. Run `copilot` command to initialize Copilot CLI
4. Simulate human typing, sending command to backend: `refine the idea {idea file path}`

## Business Justification

This enhancement streamlines the workflow for users who want to refine their ideas using Copilot CLI. Instead of manually opening the terminal, typing the copilot command, and then typing the refine command with the file path, users can simply click a button to automate this entire process.

## Impact Analysis

### Classification

**Type:** Modification to FEATURE-008 (Workplace/Idea Management)

**Reasoning:**
- Works within existing Workplace boundaries
- Adds capability to existing content view header (next to Edit button)
- No new screens, APIs, or data models required
- Integrates with existing FEATURE-005 (Interactive Console)
- Small scope - single button with terminal command integration

| Aspect | CR Requirement | FEATURE-008 (Existing) |
|--------|---------------|------------------------|
| Users | Same users (idea authors) | Same |
| Workflow | Extends: adds Copilot refinement action | View/edit ideas |
| Data Model | No new data models | Same |
| UI Elements | New button in existing header | Existing content view header |
| API/Backend | No new backend APIs (uses terminal) | Existing |

### Affected Components

| Component | Impact Level | Details |
|-----------|--------------|---------|
| FEATURE-008 Workplace | Medium | New button in content view header |
| FEATURE-005 Terminal | Low | Uses existing terminal functionality |
| ContentRenderer (index.html) | Medium | Add button HTML and click handler |
| TerminalManager (terminal.js) | Medium | Add sendCopilotRefineCommand method |

### Dependencies

- FEATURE-005: Interactive Console (must be functional)
- Copilot CLI must be installed on the system

## Proposed Approach

1. Add "Copilot" button to content view header (left of Edit button)
2. Button click handler:
   - Expand terminal panel via `window.terminalPanel.expand()`
   - Check if current terminal is in Copilot CLI mode
   - If in Copilot mode and space available, create new terminal
   - Send `copilot` command with typing simulation
   - Wait for CLI initialization (~1.5s)
   - Send `refine the idea {file path}` command with typing simulation

## Implementation Status

**Code Implementation:** ✅ Complete (implemented before CR workflow)

Files modified:
- `src/templates/index.html` - Added Copilot button and `_handleCopilotClick()` method
- `static/js/terminal.js` - Added `sendCopilotRefineCommand()`, `_isInCopilotMode()`, `_sendWithTypingEffect()` methods

## Approval

- [x] Classification approved by human
- [x] Approach approved by human
- [x] Ready for execution

## Links

- Feature Specification: [specification.md](x-ipe-docs/requirements/EPIC-008/FEATURE-008-A/specification.md)
- Related Feature: [FEATURE-005](../FEATURE-005/specification.md)
- Requirement Details: [requirement-details.md](../requirement-details.md)

---
