Do not commit binaries to Git.
- Reason: Go binaries are compiled for a specific Operating System (Linux, Windows, macOS) and Architecture (amd64, arm64). A binary built on your machine likely won't run on another user's machine.
- Action: Add the output binary name (e.g.,
dqc) to.gitignore.
Go provides two standard ways for users to build your application from source:
-
go build- What it does: Compiles the code and creates a binary in the current directory.
- Use Case: Testing, development, or creating a binary to ship manually.
- Command:
go build -o dqc ./cmd/dqc
-
go install- What it does: Compiles the code and places the binary in
$GOPATH/bin(system path). - Use Case: End-user installation. Allows running the tool globally from any terminal window.
- Command:
go install github.com/user/repo/cmd/dqc@latest
- What it does: Compiles the code and places the binary in
- Observation: Binaries can be large (>50MB).
- Cause: Libraries like DuckDB are statically linked. This means the entire C++ library is embedded inside the Go binary.
- Benefit: The binary is self-contained. The user does not need to install DuckDB separately; it "just works."
- Strategy: Use
workflow_dispatchto allow manual triggers of the release process. - Benefits:
- Control: Release only when feature sets are stable.
- Automation: Binary compilation and GitHub Release creation are handled by CI.
- Inputs: Users can specify the version tag (e.g.,
v1.2.0) at trigger time.
- Workflow Location:
.github/workflows/release.yml
Agents must follow this Layered Architecture approach for all new features:
-
Phase 1: Core Domain Logic (
internal/)- Rule: Always implement business logic and data access here first.
- Constraint: This code must remain "pure" — it must NOT depend on
cmd/,api/, or any external interface packages. - Goal: Ensure the core logic is testable and reusable by any interface (CLI, API, etc.).
-
Phase 2: Interface Layer (
cmd/)- Rule: Build the CLI/API only after the core logic is stable.
- Constraint: The
cmdpackage is a consumer. It should only parse user input (flags, args) and callinternal/. It should contain minimal logic. - Goal: Keep entry points lightweight and swappable.
Agents must follow these standards when writing code:
-
Function Naming Pattern
- Rule: Use
VerbNounorVerbAdjective(PascalCase) for exported functions. - Pattern: Functions should describe an action or a check.
- Examples:
IsColumnUnique(Check: Is [Subject] [Condition]?)Log(Action: [Verb])createLogTable(Internal: [Verb] [Object])
- Note: Avoid generic names. Be specific about what the function does.
- Rule: Use
-
Documentation Standards
- Rule: All exported functions must have comments explaining What, Why, and How.
- Format: start with the function name.
- Example:
// IsColumnUnique checks if the column values are unique (What). // This ensures data integrity for primary keys (Why). // It uses a GROUP BY SQL query to count duplicates (How). func IsColumnUnique(...)
-
Documentation Maintenance
- Rule: Update
README.mdimmediately if you add:- New features or flags.
- New installation steps.
- New architecture components.
- Rule: Update