Skip to content

Commit 9089a9a

Browse files
committed
docs: replace Copilot instructions with agent guidelines
Removes GitHub Copilot-specific instructions and replaces with generic agent documentation for better AI assistant compatibility - Reorganizes content into setup, build, and development sections - Adds explicit PR/commit guidelines and security considerations - Maintains all technical information while improving accessibility - Removes tool-specific references for broader AI assistant usage
1 parent 825e061 commit 9089a9a

2 files changed

Lines changed: 65 additions & 93 deletions

File tree

.github/copilot-instructions.md

Lines changed: 0 additions & 93 deletions
This file was deleted.

AGENTS.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# AGENTS.md
2+
3+
## Setup commands
4+
5+
- Enter development shell: `nix develop` (or let direnv activate automatically)
6+
- Download FFmpeg libraries: `go run ./cmd/download-lib`
7+
- Initialise submodules: `git submodule update --init --recursive`
8+
9+
## Build and test commands
10+
11+
- **Full build:** `just build` — builds FFmpeg from source, regenerates bindings, compiles all
12+
- **Build FFmpeg only:** `just build-static ffmpeg --clean`
13+
- **Build static libraries:** `just build-static` (uses current GOOS/GOARCH)
14+
- **Regenerate bindings:** `just generate` or `go run ./internal/generator`
15+
- **Build examples:** `just build-examples`
16+
- **Run tests:** `just test`
17+
- **Download libraries:** `go run ./cmd/download-lib`
18+
19+
## Code style
20+
21+
- **Auto-generated files:** Never edit `*.gen.go` files (constants, enums, structs, functions, callbacks) — regenerate with `just generate`
22+
- **C string handling:** Use `CStr` type with `.Free()` for cleanup
23+
- **Error handling:** Wrap FFmpeg return codes with `WrapErr()` function
24+
- **Stream processing:** Check `AVErrorEOF` and `EAgain` in processing loops
25+
- **Type naming:** All FFmpeg types prefixed with `AV*` (e.g., `AVCodecContext`, `AVFrame`)
26+
- **CGO required:** All builds need `CGO_ENABLED=1`
27+
28+
## Testing instructions
29+
30+
- Run `just test` before committing
31+
- Tests require downloaded libraries (`go run ./cmd/download-lib` first)
32+
- See `ffmpeg_test.go` for version validation patterns
33+
34+
## PR/commit guidelines
35+
36+
- **Submodule workflow:** Configure git for fast-forward pulls only: `git config pull.ff only && git config submodule.recurse true`
37+
- **Version schemes:** Two distinct versions — library releases (`lib-X.Y.Z.N`) and module releases (`v-X.Y.Z.N`)
38+
- **Release tags:** Library releases use `lib-` prefix; Go module releases use `v` prefix
39+
40+
## Development workflow
41+
42+
- **Never run `go build` directly** — always use `just build` for proper CGO flags and build sequencing
43+
- **Cross-compilation:** Set `GOOS` and `GOARCH` before downloading: `GOOS=darwin GOARCH=arm64 go run ./cmd/download-lib`
44+
- **Platform-specific builds:** Justfile auto-detects current platform, outputs to `lib/<os>_<arch>/`
45+
- **Binding regeneration:** Required after FFmpeg header changes — run `just generate`
46+
47+
## Key architecture
48+
49+
- **Core:** `ffmpeg.go` contains CGO directives, platform linker flags, helper types
50+
- **Generated bindings:** `*.gen.go` files in root directory
51+
- **Headers:** `include/` contains FFmpeg C headers
52+
- **Libraries:** `lib/<os>_<arch>/` contains platform-specific static libraries (gitignored)
53+
- **Builder:** `internal/builder/` compiles FFmpeg + 20 dependencies from source
54+
- **Generator:** `internal/generator/` parses headers using libclang, outputs Go bindings
55+
- **Downloader:** `cmd/download-lib/` fetches pre-built libraries from GitHub Releases
56+
57+
## Hardware acceleration
58+
59+
Supported: NVENC/NVDEC (Linux), QuickSync (Linux), VideoToolbox (macOS), Vulkan Video (cross-platform). See `README.md` and `docs/CODECS.md` for codec matrix.
60+
61+
## Security considerations
62+
63+
- **GPL licensing:** Combined work inherits GPL requirements from FFmpeg/x264/x265
64+
- **Static libraries gitignored:** Only submodule reference committed, not ~100MB binaries
65+
- **Library distribution:** Use GitHub Releases for pre-built binaries, not git

0 commit comments

Comments
 (0)