|
| 1 | +# Local Development Guide |
| 2 | + |
| 3 | +This guide shows how to iterate on the `specify` CLI locally without publishing a release or committing to `main` first. |
| 4 | + |
| 5 | +## 1. Clone and Switch Branches |
| 6 | + |
| 7 | +```bash |
| 8 | +git clone https://github.com/github/spec-kit.git |
| 9 | +cd spec-kit |
| 10 | +# Work on a feature branch |
| 11 | +git checkout -b your-feature-branch |
| 12 | +``` |
| 13 | + |
| 14 | +## 2. Run the CLI Directly (Fastest Feedback) |
| 15 | + |
| 16 | +You can execute the CLI via the module entrypoint without installing anything: |
| 17 | + |
| 18 | +```bash |
| 19 | +# From repo root |
| 20 | +python -m src.specify_cli --help |
| 21 | +python -m src.specify_cli init demo-project --ai claude --ignore-agent-tools |
| 22 | +``` |
| 23 | + |
| 24 | +If you prefer invoking the script file style (uses shebang): |
| 25 | + |
| 26 | +```bash |
| 27 | +python src/specify_cli/__init__.py init demo-project |
| 28 | +``` |
| 29 | + |
| 30 | +## 3. Use Editable Install (Isolated Environment) |
| 31 | + |
| 32 | +Create an isolated environment using `uv` so dependencies resolve exactly like end users get them: |
| 33 | + |
| 34 | +```bash |
| 35 | +# Create & activate virtual env (uv auto-manages .venv) |
| 36 | +uv venv |
| 37 | +source .venv/bin/activate # or on Windows: .venv\\Scripts\\activate |
| 38 | + |
| 39 | +# Install project in editable mode |
| 40 | +uv pip install -e . |
| 41 | + |
| 42 | +# Now 'specify' entrypoint is available |
| 43 | +specify --help |
| 44 | +``` |
| 45 | + |
| 46 | +Re-running after code edits requires no reinstall because of editable mode. |
| 47 | + |
| 48 | +## 4. Invoke with uvx Directly From Git (Current Branch) |
| 49 | + |
| 50 | +`uvx` can run from a local path (or a Git ref) to simulate user flows: |
| 51 | + |
| 52 | +```bash |
| 53 | +uvx --from . specify init demo-uvx --ai copilot --ignore-agent-tools |
| 54 | +``` |
| 55 | + |
| 56 | +You can also point uvx at a specific branch without merging: |
| 57 | + |
| 58 | +```bash |
| 59 | +# Push your working branch first |
| 60 | +git push origin your-feature-branch |
| 61 | +uvx --from git+https://github.com/github/spec-kit.git@your-feature-branch specify init demo-branch-test |
| 62 | +``` |
| 63 | + |
| 64 | +## 5. Testing Script Permission Logic |
| 65 | +After running an `init`, check that shell scripts are executable on POSIX systems: |
| 66 | +```bash |
| 67 | +ls -l scripts | grep .sh |
| 68 | +# Expect owner execute bit (e.g. -rwxr-xr-x) |
| 69 | +``` |
| 70 | +On Windows this step is a no-op. |
| 71 | + |
| 72 | +## 6. Run Lint / Basic Checks (Add Your Own) |
| 73 | +Currently no enforced lint config is bundled, but you can quickly sanity check importability: |
| 74 | +```bash |
| 75 | +python -c "import specify_cli; print('Import OK')" |
| 76 | +``` |
| 77 | + |
| 78 | +## 7. Build a Wheel Locally (Optional) |
| 79 | +Validate packaging before publishing: |
| 80 | +```bash |
| 81 | +uv build |
| 82 | +ls dist/ |
| 83 | +``` |
| 84 | +Install the built artifact into a fresh throwaway environment if needed. |
| 85 | + |
| 86 | +## 8. Using a Temporary Workspace |
| 87 | +When testing `init --here` in a dirty directory, create a temp workspace: |
| 88 | +```bash |
| 89 | +mkdir /tmp/spec-test && cd /tmp/spec-test |
| 90 | +python -m src.specify_cli init --here --ai claude --ignore-agent-tools # if repo copied here |
| 91 | +``` |
| 92 | +Or copy only the modified CLI portion if you want a lighter sandbox. |
| 93 | + |
| 94 | +## 9. Debug Network / TLS Skips |
| 95 | +If you need to bypass TLS validation while experimenting: |
| 96 | +```bash |
| 97 | +specify check --skip-tls |
| 98 | +specify init demo --skip-tls --ai gemini --ignore-agent-tools |
| 99 | +``` |
| 100 | +(Use only for local experimentation.) |
| 101 | + |
| 102 | +## 10. Rapid Edit Loop Summary |
| 103 | +| Action | Command | |
| 104 | +|--------|---------| |
| 105 | +| Run CLI directly | `python -m src.specify_cli --help` | |
| 106 | +| Editable install | `uv pip install -e .` then `specify ...` | |
| 107 | +| Local uvx run | `uvx --from . specify ...` | |
| 108 | +| Git branch uvx | `uvx --from git+URL@branch specify ...` | |
| 109 | +| Build wheel | `uv build` | |
| 110 | + |
| 111 | +## 11. Cleaning Up |
| 112 | +Remove build artifacts / virtual env quickly: |
| 113 | +```bash |
| 114 | +rm -rf .venv dist build *.egg-info |
| 115 | +``` |
| 116 | + |
| 117 | +## 12. Common Issues |
| 118 | +| Symptom | Fix | |
| 119 | +|---------|-----| |
| 120 | +| `ModuleNotFoundError: typer` | Run `uv pip install -e .` | |
| 121 | +| Scripts not executable (Linux) | Re-run init (logic adds bits) or `chmod +x scripts/*.sh` | |
| 122 | +| Git step skipped | You passed `--no-git` or Git not installed | |
| 123 | +| TLS errors on corporate network | Try `--skip-tls` (not for production) | |
| 124 | + |
| 125 | +## 13. Next Steps |
| 126 | +- Update docs and run through Quick Start using your modified CLI |
| 127 | +- Open a PR when satisfied |
| 128 | +- (Optional) Tag a release once changes land in `main` |
| 129 | + |
| 130 | +--- |
| 131 | +Feel free to expand this guide with additional local workflows (debugging, profiling, test automation) as the project matures. |
0 commit comments