Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .air.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#:schema https://json.schemastore.org/any.json

root = "."
tmp_dir = "tmp"

env_files = [".env"]

[build]
entrypoint = "dockify"
cmd = "go build -o ./tmp/dockify ./cmd/dockify"
delay = 1000
env = ["DOCKIFY_DATA_DIR=./data"]
exclude_dir = ["assets", "tmp", "vendor", "data", "scripts"]
exclude_regex = ["_test\\.go"]
exclude_unchanged = true
full_bin = "DOCKIFY_DATA_DIR=./data ./tmp/dockify serve"
include_dir = ["cmd", "internal"]
include_ext = ["go", "html"]
kill_delay = "500ms"
log = "build-errors.log"
send_interrupt = true
stop_on_error = false

[color]
app = ""
build = "yellow"
main = "green"
runner = "cyan"
watcher = "blue"

[log]
main_only = false
time = false

[misc]
clean_on_exit = true

[screen]
clear_on_rebuild = false
keep_scroll = true

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/data/
*.db
/dockify
/tmp/
.env
86 changes: 83 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,22 +149,102 @@ Pushing a `v*` tag triggers `.github/workflows/build.yml` which automatically:

No manual GitHub UI interaction needed. The install script auto-detects the latest release.

## Key Commands

## Development Workflow

This project uses [Air](https://github.com/air-verse/air) for live-reload during development.

### Flow
1. **User** runs `air` in terminal (keeps it running)
2. **opencode** edits code/saves files
3. **Air** auto-detects changes → rebuilds Go binary → restarts server
4. **User** refreshes browser (Cmd+Shift+R) at `http://localhost:8080` to review
5. Repeat steps 2-4 until feature is complete
6. Only then release: `./scripts/release.sh patch`

### How Air works
- Watches `.go` files in `cmd/` and `internal/` + `.html` files in `internal/http/templates/`
- On successful build: kills old process, starts new one
- On build error: **old server keeps running** (thanks to `stop_on_error = false`), error shown in terminal
- Data stored in `./data/` (SQLite DB), credentials in `.env` (both gitignored)
- Config: `.air.toml` at project root

### Key development commands
```bash
# Development
go build ./... # build all packages
go vet ./... # lint
go mod tidy # clean dependencies

# Run locally
# Run locally (auto-reload)
air # http://localhost:8080

# Run once (no auto-reload)
DOCKIFY_DATA_DIR=./data go run ./cmd/dockify serve

# Verify templates parse correctly
go test ./internal/http/... -run TestTemplates

# Build and run with Docker
docker build -t dockify .
docker run -p 8080:8080 -v $(pwd)/data:/var/lib/dockify dockify
```

## Git Workflow

### Branch Strategy
- `main` — stable, production-ready. Hanya diisi dari merge PR.
- `feat/*` — fitur baru
- `fix/*` — perbaikan bug

### Daily Flow

```
main ───── feat/new-feature
│ │
├─ buat branch ┘
│ ├─ kerja, commit (wip boleh), push
│ ├─ switch PC → pull, lanjut, push
│ │ (ulang sampai selesai)
│ │
│ selesai
│ ├─ push final
│ ├─ gh pr create --fill
│ ├─ user: "merge"
│ ├─ gh pr merge --merge --delete-branch
│ └─ git branch -d feat/x
│ │
├─ merge ──────┘
│
├─ ./scripts/release.sh patch
└─ push tag
```

### Step-by-step

1. **opencode start task:** `git checkout main && git pull && git checkout -b feat/x`
2. **opencode kerja:** edit → commit → push (bisa WIP)
3. **Switch PC:** commit + push dulu di PC lama; `git pull` di PC baru, `git checkout feat/x`
4. **Selesai:** push final → `gh pr create --fill`
5. **User review:** user bilang "merge" kalau OK
6. **opencode merge:** `gh pr merge --merge --delete-branch && git branch -d feat/x && git checkout main`
7. **Release (dari main):** `./scripts/release.sh patch`

### Commit Messages
```
feat: add dark mode toggle
fix: handle empty server list
refactor: extract deploy logic
docs: update README
wip: partial work (feature branch only, never on main)
```

### Rules
- Tidak pernah commit/amend langsung di `main`
- Tidak pernah force push
- Tidak commit `.env`, token, atau secret
- Branch remote auto-hapus setelah merge, branch local dihapus manual
- Push dulu sebelum switch PC (biar bisa lanjut di perangkat lain)

## Environment Variables

| Variable | Default | Required |
Expand Down
16 changes: 0 additions & 16 deletions TODO.md

This file was deleted.

Loading