Skip to content

Development

  • Go 1.26+
  • mise (optional but recommended)
  1. Clone the repository:

    Terminal window
    git clone https://github.com/zach-snell/ctk.git
    cd ctk
  2. Install tools via mise:

    Terminal window
    mise install
  3. Build:

    Terminal window
    mise run build
  4. Run tests:

    Terminal window
    mise run test
TaskDescriptionCommand
buildBuild the ctk binary to bin/ctkmise run build
devBuild and run in dev modemise run dev
lintRun golangci-lintmise run lint
testRun tests with race detectormise run test
installBuild and install to ~/.local/binmise run install
linkFast rebuild directly to ~/.local/bin/ctkmise run link
fmtFormat code with gofumptmise run fmt
checkRun fmt + lint + testmise run check
cleanRemove build artifactsmise run clean
docs:devRun docs dev servermise run docs:dev
docs:buildBuild docs for productionmise run docs:build
docs:installInstall docs dependenciesmise run docs:install

The codebase follows standard Go project layout:

  • cmd/ctk/ — Binary entry point
  • cmd/cli/ — Cobra CLI command definitions
  • internal/confluence/ — Confluence API client, types, and helpers
  • internal/mcp/ — MCP server and tool handlers
  • internal/version/ — Version string
  • docs/ — Astro Starlight documentation site
  1. Create a handler file in internal/mcp/ (e.g., widgets.go)
  2. Define the args struct with json and jsonschema tags
  3. Implement the handler function returning (*mcp.CallToolResult, any, error)
  4. Register the tool in registerTools() in server.go using addTool()
  5. Add tests
  1. Create a command file in cmd/cli/ (e.g., widgets.go)
  2. Define the cobra command and subcommands
  3. Register with RootCmd.AddCommand() in init()
  4. Use getClient() to get the Confluence client
  5. Use PrintOrJSON() for dual output (table/JSON)
Terminal window
mise run docs:install # first time only
mise run docs:dev # starts dev server at localhost:4321
  • Format with gofumpt (mise run fmt)
  • Lint with golangci-lint (mise run lint)
  • Tests use the standard testing package with -race -count=1