|
| 1 | +<!-- @format --> |
| 2 | + |
| 3 | +# Devcontainer Features Repository |
| 4 | + |
| 5 | +This repository contains a collection of devcontainer features that enhance development environments. It provides Git utilities, hooks, version management, and other development tools that can be installed individually or as a complete development setup. |
| 6 | + |
| 7 | +**Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.** |
| 8 | + |
| 9 | +## Critical Guidelines for Code Changes |
| 10 | + |
| 11 | +**MINIMAL CHANGES ONLY**: Make the smallest possible changes to address the specific request. Do NOT modify files that are not directly related to the task: |
| 12 | + |
| 13 | +- **Package files** (`package.json`, `package-lock.json`) should only be modified if explicitly required for the feature being worked on |
| 14 | +- **Build artifacts** and **symlinks** should not be committed unless they are the direct target of the request |
| 15 | +- **Repository setup** (symlinks, environment bootstrapping) should be done for development/testing only, not committed |
| 16 | +- **Infrastructure changes** should be avoided unless they are specifically requested |
| 17 | + |
| 18 | +When working on feature requests: |
| 19 | +1. Identify the **exact files** that need to be modified for the request |
| 20 | +2. Make changes **only** to those files |
| 21 | +3. Use temporary setup for development/testing but revert any unrelated changes before committing |
| 22 | +4. Focus on the **specific feature or fix** requested, not general repository improvements |
| 23 | + |
| 24 | +## Quick Reference for Copilot Agents |
| 25 | + |
| 26 | +**MINIMAL CHANGES ONLY**: Make the smallest possible changes to address the specific request. Do NOT modify files that are not directly related to the task: |
| 27 | + |
| 28 | +- **Package files** (`package.json`, `package-lock.json`) should only be modified if explicitly required for the feature being worked on |
| 29 | +- **Build artifacts** and **symlinks** should not be committed unless they are the direct target of the request |
| 30 | +- **Repository setup** (symlinks, environment bootstrapping) should be done for development/testing only, not committed |
| 31 | +- **Infrastructure changes** should be avoided unless they are specifically requested |
| 32 | + |
| 33 | +<<<<<<< HEAD |
| 34 | +When working on feature requests: |
| 35 | +======= |
| 36 | +## Essential Setup Commands (For Development/Testing Only - DO NOT COMMIT) |
| 37 | + |
| 38 | +**IMPORTANT**: These commands are for local development and testing only. Do NOT commit the resulting changes (symlinks, package modifications) unless they are specifically part of the requested feature. |
| 39 | +>>>>>>> eb404c6 (Add validate-pr.yml workflow to larasets feature stubs (#21)) |
| 40 | +
|
| 41 | +1. Identify the **exact files** that need to be modified for the request |
| 42 | +2. Make changes **only** to those files |
| 43 | +3. Use temporary setup for development/testing but revert any unrelated changes before committing |
| 44 | +4. Focus on the **specific feature or fix** requested, not general repository improvements |
| 45 | + |
| 46 | +<<<<<<< HEAD |
| 47 | +## Critical Guidelines for Commit Messages |
| 48 | + |
| 49 | +- Title and description must follow conventional commit format: start with a type followed by a colon and a brief summary starting with an imperative verb. |
| 50 | +- Type must follow configured types in root package.json or default to standard types. |
| 51 | +- Add a scope in parentheses if project structure warrants it (check for workspace, modules or package names) |
| 52 | +======= |
| 53 | +# 2. Fix known symlink issues (5 seconds) - FOR TESTING ONLY |
| 54 | +find src/common-utils/ -type f -name "_*.sh" -exec chmod +x {} \; |
| 55 | +find src/common-utils/ -type f -name "_*.sh" | while read file; do |
| 56 | + ln -sf $file src/common-utils/$(basename $file | sed 's/^_//;s/.sh$//'); |
| 57 | +done |
| 58 | + |
| 59 | +# 3. Workaround for install script typo (1 second) - FOR TESTING ONLY |
| 60 | +ln -sf src/common-utils/_zz_log.sh src/common-utils/_zz_logs.sh |
| 61 | +``` |
| 62 | +
|
| 63 | +**Set timeouts to 5+ minutes for ALL commands to prevent premature cancellation.** |
| 64 | +
|
| 65 | +## Core Development Commands |
| 66 | +
|
| 67 | +| Command | Purpose | Duration | Notes | |
| 68 | +|---------|---------|----------|-------| |
| 69 | +| `npm run lint` | Lint staged files | 1-2s (empty), 15s (with files) | Uses lint-staged, only lints staged files | |
| 70 | +| `npm test` | Run tests | <1s | Currently only shows warning - no tests exist | |
| 71 | +| `./install.sh -s` | Install stubs only | 10-15s | Creates `.devcontainer/` and `.vscode/` configs | |
| 72 | +| `./install.sh -a` | Install all features | 15-20s | Full feature installation | |
| 73 | +| `./install.sh gitutils` | Install specific feature | 5-10s | Install individual feature by name | |
| 74 | +| `npx tomgrv/devcontainer-features -h` | NPX installation | 2s (cached) | Alternative installation method | |
| 75 | +
|
| 76 | +**Validation Commands:** |
| 77 | +```bash |
| 78 | +# Quick feature test |
| 79 | +mkdir /tmp/test-features && cd /tmp/test-features |
| 80 | +git init |
| 81 | +/path/to/devcontainer-features/install.sh -s |
| 82 | +ls -la .devcontainer/ .vscode/ # Verify files created |
| 83 | +``` |
| 84 | + |
| 85 | +## Repository Architecture |
| 86 | + |
| 87 | +### 7 Devcontainer Features (`src/` directory) |
| 88 | + |
| 89 | +| Feature | Purpose | Key Files | |
| 90 | +|---------|---------|-----------| |
| 91 | +| **gitutils** | Git aliases and workflow automation | Aliases for common git operations | |
| 92 | +| **githooks** | Development environment setup | commitlint, prettier, lint-staged, husky | |
| 93 | +| **gitversion** | Semantic versioning | GitVersion tool for automated versioning | |
| 94 | +| **act** | Local GitHub Actions | Nektos/act for running actions locally | |
| 95 | +| **pecl** | PHP Extensions | PECL installer for PHP development | |
| 96 | +| **larasets** | Laravel tools | Laravel-specific development utilities | |
| 97 | +| **common-utils** | Shared utilities | Scripts used by other features | |
| 98 | + |
| 99 | +### Key Configuration Files |
| 100 | + |
| 101 | +- `package.json` - Main configuration with npm scripts, dependencies, prettier, commitlint |
| 102 | +- `install.sh` - Installation script (**has typo bug** - see workaround above) |
| 103 | +- `.github/workflows/` - CI/CD: `validate.yml`, `release.yaml` |
| 104 | +- `stubs/` - Template files for `.devcontainer/` and `.vscode/` configs |
| 105 | + |
| 106 | +## Critical Issues & Workarounds |
| 107 | + |
| 108 | +### 🐛 Install Script Typo (Line 9) |
| 109 | +**Problem**: Script references `_zz_logs.sh` but file is `_zz_log.sh` |
| 110 | +**Fix**: `ln -sf src/common-utils/_zz_log.sh src/common-utils/_zz_logs.sh` |
| 111 | + |
| 112 | +### 📦 Missing Prettier Plugin |
| 113 | +**Problem**: Linting fails without `prettier-plugin-sh` |
| 114 | +**Fix**: `npm install prettier-plugin-sh` (included in setup commands above) |
| 115 | + |
| 116 | +### 🔗 Broken Symlinks in common-utils |
| 117 | +**Problem**: Shell scripts not executable and symlinks missing |
| 118 | +**Fix**: Run the chmod and symlink commands from setup section above |
| 119 | + |
| 120 | +### 🐳 Container vs Local Behavior |
| 121 | +- Features designed for **devcontainer environments** |
| 122 | +- Local installation shows "No writeable directory found" - **this is normal** |
| 123 | +- Some features require Docker/specific dependencies not available locally |
| 124 | + |
| 125 | +## Common Workflows for Copilot Agents |
| 126 | + |
| 127 | +### 🚀 First-time Repository Setup (Development/Testing Only) |
| 128 | +```bash |
| 129 | +# Run this exactly - all commands are required FOR TESTING ONLY |
| 130 | +# DO NOT COMMIT the resulting symlinks or package changes unless specifically requested |
| 131 | +cd /home/runner/work/devcontainer-features/devcontainer-features |
| 132 | +npm install |
| 133 | +npm install prettier-plugin-sh |
| 134 | +find src/common-utils/ -type f -name "_*.sh" -exec chmod +x {} \; |
| 135 | +find src/common-utils/ -type f -name "_*.sh" | while read file; do |
| 136 | + ln -sf $file src/common-utils/$(basename $file | sed 's/^_//;s/.sh$//'); |
| 137 | +done |
| 138 | +ln -sf src/common-utils/_zz_log.sh src/common-utils/_zz_logs.sh |
| 139 | +``` |
| 140 | + |
| 141 | +### 🧪 Testing Changes |
| 142 | +```bash |
| 143 | +# 1. Create test environment |
| 144 | +mkdir /tmp/feature-test && cd /tmp/feature-test |
| 145 | +git init |
| 146 | + |
| 147 | +# 2. Test installation |
| 148 | +/home/runner/work/devcontainer-features/devcontainer-features/install.sh -s |
| 149 | + |
| 150 | +# 3. Verify results |
| 151 | +ls -la .devcontainer/ .vscode/ |
| 152 | +cat .devcontainer/devcontainer.json # Should contain features array |
| 153 | +``` |
| 154 | + |
| 155 | +### ✅ Pre-commit Validation |
| 156 | +```bash |
| 157 | +git add . # Stage your changes |
| 158 | +npm run lint # Lint staged files (1-15 seconds) |
| 159 | +# Fix any linting issues, then commit |
| 160 | +``` |
| 161 | + |
| 162 | +### 📦 NPX Alternative Testing |
| 163 | +```bash |
| 164 | +# Test the NPX installation method |
| 165 | +mkdir /tmp/npx-test && cd /tmp/npx-test |
| 166 | +git init |
| 167 | +npx tomgrv/devcontainer-features -s |
| 168 | +# Should create same files as local installation |
| 169 | +``` |
| 170 | + |
| 171 | +## Performance Expectations |
| 172 | + |
| 173 | +⚡ **Timing Reference** (all validated): |
| 174 | + |
| 175 | +| Operation | Expected Duration | Timeout Setting | |
| 176 | +|-----------|------------------|-----------------| |
| 177 | +| `npm install` | 3 seconds | 5+ minutes | |
| 178 | +| `npm install prettier-plugin-sh` | 1 second | 2+ minutes | |
| 179 | +| `npm run lint` (no files) | 1-2 seconds | 2+ minutes | |
| 180 | +| `npm run lint` (with files) | up to 15 seconds | 2+ minutes | |
| 181 | +| `./install.sh -s` | 10-15 seconds | 2+ minutes | |
| 182 | +| `./install.sh -a` | 15-20 seconds | 3+ minutes | |
| 183 | +| `./install.sh <feature>` | 5-10 seconds | 2+ minutes | |
| 184 | +| `npx tomgrv/devcontainer-features` | 2 seconds (cached) | 2+ minutes | |
| 185 | + |
| 186 | +⚠️ **CRITICAL**: Always set generous timeouts. Commands complete quickly but need buffer for system variations. |
| 187 | + |
| 188 | +## Troubleshooting Guide |
| 189 | + |
| 190 | +**❌ "No staged files found"** → Normal when running `npm run lint` with no staged changes |
| 191 | +**❌ "No writeable directory found"** → Normal for local installation, features designed for containers |
| 192 | +**❌ "_zz_logs.sh: No such file"** → Run the typo workaround: `ln -sf src/common-utils/_zz_log.sh src/common-utils/_zz_logs.sh` |
| 193 | +**❌ "prettier-plugin-sh not found"** → Run: `npm install prettier-plugin-sh` |
| 194 | +**❌ "Permission denied" on scripts** → Run: `find src/common-utils/ -type f -name "_*.sh" -exec chmod +x {} \;` |
| 195 | +>>>>>>> eb404c6 (Add validate-pr.yml workflow to larasets feature stubs (#21)) |
0 commit comments