Skip to content

Commit 9fbd96f

Browse files
authored
Add DEVELOPMENT.md and doctor task for new workstation setup (#237)
Adds a development setup guide covering Homebrew-based tool installation, common tasks, and project structure. Adds a `task doctor` command to verify all required tools are installed.
1 parent b30f1de commit 9fbd96f

File tree

2 files changed

+157
-0
lines changed

2 files changed

+157
-0
lines changed

DEVELOPMENT.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Development Setup
2+
3+
This guide covers setting up a macOS workstation for TFx development from scratch.
4+
5+
## Prerequisites
6+
7+
Install [Homebrew](https://brew.sh) if you don't have it:
8+
9+
```bash
10+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
11+
```
12+
13+
## Install Dependencies
14+
15+
Install the core tools:
16+
17+
```bash
18+
brew install go goreleaser go-task
19+
```
20+
21+
| Tool | Purpose |
22+
|---|---|
23+
| `go` | Go compiler and toolchain |
24+
| `goreleaser` | Cross-platform builds and releases |
25+
| `go-task` | Task runner (provides the `task` command) |
26+
27+
### Optional
28+
29+
```bash
30+
brew install node # only needed for serving the docs site locally (task serve-docs)
31+
```
32+
33+
Verify everything is installed:
34+
35+
```bash
36+
task doctor
37+
```
38+
39+
## Clone and Build
40+
41+
```bash
42+
git clone https://github.com/straubt1/tfx.git
43+
cd tfx
44+
go mod download
45+
task go-build
46+
./tfx version
47+
```
48+
49+
## Common Tasks
50+
51+
Run `task --list` to see all available tasks. Key ones:
52+
53+
| Task | Description |
54+
|---|---|
55+
| `task doctor` | Verify all required tools are installed |
56+
| `task go-build` | Build the `tfx` binary for local development |
57+
| `task go-build-all` | Cross-platform snapshot build via goreleaser |
58+
| `task test` | Run unit tests |
59+
| `task test-all` | Run unit + integration tests |
60+
| `task go-upgrade` | Upgrade Go toolchain and all module dependencies |
61+
| `task serve-docs` | Serve the documentation site locally |
62+
| `task release-dry-run` | Simulate the full release pipeline locally |
63+
64+
## Upgrading Dependencies
65+
66+
To upgrade Go, goreleaser, and all module dependencies:
67+
68+
```bash
69+
task go-upgrade
70+
```
71+
72+
This will:
73+
1. Upgrade `go` and `goreleaser` via Homebrew
74+
2. Update `go.mod` to the installed Go version
75+
3. Upgrade all module dependencies to their latest versions
76+
4. Run `go mod tidy` to clean up
77+
78+
## Configuration for CLI / Integration Tests
79+
80+
TFx requires a TFE/HCP Terraform instance for integration tests. Create `secrets/.env-int`:
81+
82+
```bash
83+
mkdir -p secrets
84+
cat > secrets/.env-int << 'EOF'
85+
TFE_HOSTNAME=app.terraform.io
86+
TFE_TOKEN=your-api-token
87+
TFE_ORGANIZATION=your-org
88+
EOF
89+
```
90+
91+
Then run integration tests:
92+
93+
```bash
94+
task test-integration-data
95+
task test-integration-cmd
96+
```
97+
98+
## Project Structure
99+
100+
```
101+
cmd/ # Cobra command handlers
102+
flags/ # Per-command flag structs
103+
views/ # Output/rendering for each command
104+
client/ # TFE API client wrapper
105+
data/ # Data fetching layer (API calls + business logic)
106+
output/ # Output system (tables, JSON, spinner, logger)
107+
tui/ # Bubble Tea TUI
108+
integration/ # Integration tests
109+
pkg/file/ # File utilities
110+
version/ # Version info (injected at build time)
111+
```
112+
113+
## Releasing
114+
115+
See the release tasks:
116+
117+
```bash
118+
task release:patch # bugfixes (x.y.Z+1)
119+
task release:minor # new features (x.Y+1.0)
120+
task release:major # breaking changes (X+1.0.0)
121+
```
122+
123+
Always update `CHANGELOG.md` before cutting a release.

Taskfile.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,40 @@
11
version: '3'
22

33
tasks:
4+
doctor:
5+
desc: Verify all required development tools are installed
6+
silent: true
7+
cmds:
8+
- |
9+
OK=true
10+
check() {
11+
if command -v "$1" &>/dev/null; then
12+
printf " ✓ %-14s %s\n" "$1" "$($1 $2 2>&1 | head -1)"
13+
else
14+
printf " ✗ %-14s not found — install with: %s\n" "$1" "$3"
15+
OK=false
16+
fi
17+
}
18+
echo ""
19+
echo " TFx Development Environment"
20+
echo " ────────────────────────────"
21+
check go "version" "brew install go"
22+
check goreleaser "--version" "brew install goreleaser"
23+
check task "--version" "brew install go-task"
24+
echo ""
25+
if command -v node &>/dev/null; then
26+
printf " ✓ %-14s %s (optional — docs site)\n" "node" "$(node --version 2>&1)"
27+
else
28+
printf " · %-14s not installed (optional — only for: task serve-docs)\n" "node"
29+
fi
30+
echo ""
31+
if [ "$OK" = true ]; then
32+
echo " All tools installed."
33+
else
34+
echo " Install missing tools: brew install go goreleaser go-task"
35+
fi
36+
echo ""
37+
438
go-build:
539
desc: Build Go binary (development build with git metadata)
640
cmds:

0 commit comments

Comments
 (0)