Development
Prerequisites
Section titled “Prerequisites”- Go 1.26+
- mise (optional but recommended)
Getting Started
Section titled “Getting Started”-
Clone the repository:
Terminal window git clone https://github.com/zach-snell/ctk.gitcd ctk -
Install tools via mise:
Terminal window mise install -
Build:
Terminal window mise run build -
Run tests:
Terminal window mise run test
Mise Tasks
Section titled “Mise Tasks”| Task | Description | Command |
|---|---|---|
build | Build the ctk binary to bin/ctk | mise run build |
dev | Build and run in dev mode | mise run dev |
lint | Run golangci-lint | mise run lint |
test | Run tests with race detector | mise run test |
install | Build and install to ~/.local/bin | mise run install |
link | Fast rebuild directly to ~/.local/bin/ctk | mise run link |
fmt | Format code with gofumpt | mise run fmt |
check | Run fmt + lint + test | mise run check |
clean | Remove build artifacts | mise run clean |
docs:dev | Run docs dev server | mise run docs:dev |
docs:build | Build docs for production | mise run docs:build |
docs:install | Install docs dependencies | mise run docs:install |
Project Structure
Section titled “Project Structure”The codebase follows standard Go project layout:
cmd/ctk/— Binary entry pointcmd/cli/— Cobra CLI command definitionsinternal/confluence/— Confluence API client, types, and helpersinternal/mcp/— MCP server and tool handlersinternal/version/— Version stringdocs/— Astro Starlight documentation site
Adding a New MCP Tool
Section titled “Adding a New MCP Tool”- Create a handler file in
internal/mcp/(e.g.,widgets.go) - Define the args struct with
jsonandjsonschematags - Implement the handler function returning
(*mcp.CallToolResult, any, error) - Register the tool in
registerTools()inserver.gousingaddTool() - Add tests
Adding a New CLI Command
Section titled “Adding a New CLI Command”- Create a command file in
cmd/cli/(e.g.,widgets.go) - Define the cobra command and subcommands
- Register with
RootCmd.AddCommand()ininit() - Use
getClient()to get the Confluence client - Use
PrintOrJSON()for dual output (table/JSON)
Running the Docs Site
Section titled “Running the Docs Site”mise run docs:install # first time onlymise run docs:dev # starts dev server at localhost:4321Code Style
Section titled “Code Style”- Format with
gofumpt(mise run fmt) - Lint with
golangci-lint(mise run lint) - Tests use the standard
testingpackage with-race -count=1