|
| 1 | +# Development Tooling Guide |
| 2 | + |
| 3 | +This document provides instructions for setting up the development tools used in the rCandle project, specifically the GitHub Copilot CLI and GitHub Spec-Kit. |
| 4 | + |
| 5 | +## GitHub Copilot CLI |
| 6 | + |
| 7 | +The GitHub Copilot CLI is an AI-powered command-line tool that helps with various development tasks including code generation, refactoring, debugging, and task automation. |
| 8 | + |
| 9 | +### Prerequisites |
| 10 | + |
| 11 | +- Active GitHub Copilot subscription |
| 12 | +- Git installed and configured |
| 13 | +- GitHub CLI (`gh`) installed |
| 14 | + |
| 15 | +### Installation |
| 16 | + |
| 17 | +#### 1. Install GitHub CLI (if not already installed) |
| 18 | + |
| 19 | +**Linux/WSL:** |
| 20 | +```bash |
| 21 | +# Debian/Ubuntu |
| 22 | +type -p curl >/dev/null || sudo apt install curl -y |
| 23 | +curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ |
| 24 | +&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ |
| 25 | +&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ |
| 26 | +&& sudo apt update \ |
| 27 | +&& sudo apt install gh -y |
| 28 | +``` |
| 29 | + |
| 30 | +**macOS:** |
| 31 | +```bash |
| 32 | +brew install gh |
| 33 | +``` |
| 34 | + |
| 35 | +**Windows:** |
| 36 | +```powershell |
| 37 | +winget install --id GitHub.cli |
| 38 | +# or |
| 39 | +choco install gh |
| 40 | +``` |
| 41 | + |
| 42 | +#### 2. Authenticate GitHub CLI |
| 43 | + |
| 44 | +```bash |
| 45 | +gh auth login |
| 46 | +``` |
| 47 | + |
| 48 | +Follow the prompts to authenticate with your GitHub account. |
| 49 | + |
| 50 | +#### 3. Install GitHub Copilot CLI Extension |
| 51 | + |
| 52 | +```bash |
| 53 | +gh extension install github/gh-copilot |
| 54 | +``` |
| 55 | + |
| 56 | +#### 4. Verify Installation |
| 57 | + |
| 58 | +```bash |
| 59 | +gh copilot --version |
| 60 | +``` |
| 61 | + |
| 62 | +### Usage |
| 63 | + |
| 64 | +The GitHub Copilot CLI provides several commands: |
| 65 | + |
| 66 | +#### General Command Suggestions |
| 67 | + |
| 68 | +```bash |
| 69 | +gh copilot suggest "how do I build a rust project" |
| 70 | +``` |
| 71 | + |
| 72 | +#### Git-Specific Suggestions |
| 73 | + |
| 74 | +```bash |
| 75 | +gh copilot suggest -t git "undo last commit" |
| 76 | +``` |
| 77 | + |
| 78 | +#### Shell Command Suggestions |
| 79 | + |
| 80 | +```bash |
| 81 | +gh copilot suggest -t shell "find all rust files modified in last week" |
| 82 | +``` |
| 83 | + |
| 84 | +#### Explain Commands |
| 85 | + |
| 86 | +```bash |
| 87 | +gh copilot explain "cargo build --release" |
| 88 | +``` |
| 89 | + |
| 90 | +### Aliases (Optional but Recommended) |
| 91 | + |
| 92 | +Add these to your shell configuration file (`~/.bashrc`, `~/.zshrc`, etc.): |
| 93 | + |
| 94 | +```bash |
| 95 | +# GitHub Copilot CLI aliases |
| 96 | +alias ghcs='gh copilot suggest' |
| 97 | +alias ghce='gh copilot explain' |
| 98 | +``` |
| 99 | + |
| 100 | +## GitHub Spec-Kit |
| 101 | + |
| 102 | +GitHub Spec-Kit is a tool for managing project specifications and breaking down complex development tasks into manageable pieces. |
| 103 | + |
| 104 | +### Prerequisites |
| 105 | + |
| 106 | +- Node.js (v18 or higher) |
| 107 | +- npm or yarn |
| 108 | +- Active GitHub account |
| 109 | + |
| 110 | +### Installation |
| 111 | + |
| 112 | +#### Using npm (Global Installation) |
| 113 | + |
| 114 | +```bash |
| 115 | +npm install -g @github/spec-kit |
| 116 | +``` |
| 117 | + |
| 118 | +#### Using yarn (Global Installation) |
| 119 | + |
| 120 | +```bash |
| 121 | +yarn global add @github/spec-kit |
| 122 | +``` |
| 123 | + |
| 124 | +#### Verify Installation |
| 125 | + |
| 126 | +```bash |
| 127 | +spec-kit --version |
| 128 | +``` |
| 129 | + |
| 130 | +### Usage |
| 131 | + |
| 132 | +#### Initialize Specification in a Project |
| 133 | + |
| 134 | +```bash |
| 135 | +cd /path/to/project |
| 136 | +spec-kit init |
| 137 | +``` |
| 138 | + |
| 139 | +This creates a `.spec` directory with your project specifications. |
| 140 | + |
| 141 | +#### Create a New Specification |
| 142 | + |
| 143 | +```bash |
| 144 | +spec-kit create "Feature Name" |
| 145 | +``` |
| 146 | + |
| 147 | +#### View Specifications |
| 148 | + |
| 149 | +```bash |
| 150 | +spec-kit list |
| 151 | +``` |
| 152 | + |
| 153 | +#### Break Down a Specification into Tasks |
| 154 | + |
| 155 | +```bash |
| 156 | +spec-kit plan <spec-id> |
| 157 | +``` |
| 158 | + |
| 159 | +#### Generate Implementation Plan |
| 160 | + |
| 161 | +```bash |
| 162 | +spec-kit implement <spec-id> |
| 163 | +``` |
| 164 | + |
| 165 | +#### Track Progress |
| 166 | + |
| 167 | +```bash |
| 168 | +spec-kit status |
| 169 | +``` |
| 170 | + |
| 171 | +### Integration with GitHub Copilot CLI |
| 172 | + |
| 173 | +The Spec-Kit and Copilot CLI work together seamlessly: |
| 174 | + |
| 175 | +1. **Create specification** with Spec-Kit |
| 176 | +2. **Generate implementation plan** with Spec-Kit |
| 177 | +3. **Use Copilot CLI** to implement individual tasks |
| 178 | +4. **Track progress** with Spec-Kit |
| 179 | + |
| 180 | +Example workflow: |
| 181 | +```bash |
| 182 | +# Create specification |
| 183 | +spec-kit create "Add GRBL connection feature" |
| 184 | + |
| 185 | +# Generate plan |
| 186 | +spec-kit plan spec-001 |
| 187 | + |
| 188 | +# Use Copilot to implement |
| 189 | +gh copilot suggest "implement serial port connection in Rust using tokio-serial" |
| 190 | + |
| 191 | +# Track progress |
| 192 | +spec-kit status |
| 193 | +``` |
| 194 | + |
| 195 | +## rCandle-Specific Workflow |
| 196 | + |
| 197 | +For the rCandle project, here's the recommended workflow: |
| 198 | + |
| 199 | +### 1. Specification Phase |
| 200 | + |
| 201 | +```bash |
| 202 | +# Create specification for new feature |
| 203 | +spec-kit create "Your Feature Name" |
| 204 | + |
| 205 | +# Add details to the specification in .spec/ directory |
| 206 | +# Edit the generated YAML/Markdown file |
| 207 | + |
| 208 | +# Generate implementation plan |
| 209 | +spec-kit plan <spec-id> |
| 210 | +``` |
| 211 | + |
| 212 | +### 2. Implementation Phase |
| 213 | + |
| 214 | +```bash |
| 215 | +# For each task in the plan |
| 216 | +gh copilot suggest "how to implement <task description> in Rust" |
| 217 | + |
| 218 | +# Get explanations for unfamiliar code |
| 219 | +gh copilot explain "<code snippet>" |
| 220 | + |
| 221 | +# Git operations |
| 222 | +gh copilot suggest -t git "create feature branch and commit changes" |
| 223 | +``` |
| 224 | + |
| 225 | +### 3. Documentation Phase |
| 226 | + |
| 227 | +```bash |
| 228 | +# Generate documentation suggestions |
| 229 | +gh copilot suggest "how to document this Rust module" |
| 230 | + |
| 231 | +# Update specs |
| 232 | +spec-kit update <spec-id> |
| 233 | +``` |
| 234 | + |
| 235 | +## Tips and Best Practices |
| 236 | + |
| 237 | +### GitHub Copilot CLI |
| 238 | + |
| 239 | +1. **Be specific in prompts**: Include context about the project (e.g., "in Rust using egui") |
| 240 | +2. **Use type flags**: `-t shell`, `-t git`, `-t gh` for targeted suggestions |
| 241 | +3. **Iterate on suggestions**: If first suggestion isn't perfect, refine your prompt |
| 242 | +4. **Explain before modifying**: Use `explain` to understand code before changing it |
| 243 | + |
| 244 | +### GitHub Spec-Kit |
| 245 | + |
| 246 | +1. **Start with high-level specs**: Break down into smaller tasks later |
| 247 | +2. **Keep specs up-to-date**: Update as implementation progresses |
| 248 | +3. **Link specs to issues**: Reference GitHub issues in specifications |
| 249 | +4. **Version control specs**: Commit `.spec` directory changes |
| 250 | + |
| 251 | +## Troubleshooting |
| 252 | + |
| 253 | +### Copilot CLI Issues |
| 254 | + |
| 255 | +**"Not authenticated"** |
| 256 | +```bash |
| 257 | +gh auth refresh |
| 258 | +gh auth status |
| 259 | +``` |
| 260 | + |
| 261 | +**Extension not found** |
| 262 | +```bash |
| 263 | +gh extension list |
| 264 | +gh extension install github/gh-copilot |
| 265 | +``` |
| 266 | + |
| 267 | +**Rate limiting** |
| 268 | +- Wait a few minutes between requests |
| 269 | +- Check your Copilot subscription status |
| 270 | + |
| 271 | +### Spec-Kit Issues |
| 272 | + |
| 273 | +**Command not found** |
| 274 | +```bash |
| 275 | +# Check installation |
| 276 | +npm list -g @github/spec-kit |
| 277 | + |
| 278 | +# Reinstall if needed |
| 279 | +npm install -g @github/spec-kit |
| 280 | +``` |
| 281 | + |
| 282 | +**Permission errors** |
| 283 | +```bash |
| 284 | +# Use sudo on Linux/macOS if needed |
| 285 | +sudo npm install -g @github/spec-kit |
| 286 | +``` |
| 287 | + |
| 288 | +## Additional Resources |
| 289 | + |
| 290 | +### GitHub Copilot CLI |
| 291 | +- [Official Documentation](https://docs.github.com/en/copilot/github-copilot-in-the-cli) |
| 292 | +- [GitHub CLI Documentation](https://cli.github.com/manual/) |
| 293 | + |
| 294 | +### GitHub Spec-Kit |
| 295 | +- [Spec-Kit Repository](https://github.com/github/spec-kit) |
| 296 | +- [Specification Format Guide](https://github.com/github/spec-kit/blob/main/docs/spec-format.md) |
| 297 | + |
| 298 | +### Rust Development |
| 299 | +- [Rust Book](https://doc.rust-lang.org/book/) |
| 300 | +- [egui Documentation](https://docs.rs/egui/) |
| 301 | +- [GRBL Documentation](https://github.com/craftweeks/grbl-1.1f.customized-for-laser/tree/master/doc/markdown) |
| 302 | + |
| 303 | +## Project-Specific Configuration |
| 304 | + |
| 305 | +### Environment Setup for rCandle |
| 306 | + |
| 307 | +```bash |
| 308 | +# Clone the repository |
| 309 | +git clone https://github.com/yourusername/rCandle.git |
| 310 | +cd rCandle |
| 311 | + |
| 312 | +# Install Rust toolchain (if not already installed) |
| 313 | +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh |
| 314 | + |
| 315 | +# Build the project |
| 316 | +cargo build |
| 317 | + |
| 318 | +# Run tests |
| 319 | +cargo test |
| 320 | + |
| 321 | +# Run the application |
| 322 | +cargo run |
| 323 | +``` |
| 324 | + |
| 325 | +### Using Copilot CLI with rCandle |
| 326 | + |
| 327 | +```bash |
| 328 | +# Get help with Rust-specific tasks |
| 329 | +gh copilot suggest "how to add a new module to a Rust project" |
| 330 | + |
| 331 | +# GRBL-related queries |
| 332 | +gh copilot suggest "how to parse GRBL responses in Rust" |
| 333 | + |
| 334 | +# egui UI questions |
| 335 | +gh copilot suggest "how to create a responsive layout in egui" |
| 336 | + |
| 337 | +# Serial communication |
| 338 | +gh copilot suggest "how to implement serial port communication in Rust" |
| 339 | +``` |
| 340 | + |
| 341 | +## Contributing |
| 342 | + |
| 343 | +When contributing to rCandle: |
| 344 | + |
| 345 | +1. Create a specification for your feature using Spec-Kit |
| 346 | +2. Use Copilot CLI to assist with implementation |
| 347 | +3. Update documentation as you go |
| 348 | +4. Commit both code and specification changes |
| 349 | + |
| 350 | +## Version History |
| 351 | + |
| 352 | +- **v1.0** (2024) - Initial tooling documentation |
| 353 | + - GitHub Copilot CLI setup |
| 354 | + - GitHub Spec-Kit integration |
| 355 | + - rCandle-specific workflows |
| 356 | + |
| 357 | +--- |
| 358 | + |
| 359 | +For questions or issues with these tools, please: |
| 360 | +- Check the official documentation links above |
| 361 | +- Open an issue in the rCandle repository |
| 362 | +- Consult the GitHub Community Forum |
0 commit comments