version: 2

project_name: dir2mcp

builds:
  - id: dir2mcp
    env:
      - CGO_ENABLED=0
    goos:
      - darwin
      - linux
    goarch:
      - amd64
      - arm64
    main: ./cmd/dir2mcp
    binary: dir2mcp
    # Inject the version into the symbol the runtime actually reads
    # (internal/buildinfo.Version). The earlier `internal/cli.Version`
    # path targeted a declared-but-unused variable, so released
    # binaries always printed v0.0.0-dev. Commit/Date were similarly
    # injected into unused symbols and have been dropped — re-add when
    # the runtime actually reads them.
    ldflags:
      - -s -w -X github.com/dirstral/dir2mcp/internal/buildinfo.Version={{.Version}}


archives:
  - id: dir2mcp-archive
    ids:
      - dir2mcp
    formats: [tar.gz]
    name_template: "{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"


checksum:
  name_template: checksums.txt

release:
  github:
    owner: dirstral
    name: dir2mcp
  name_template: "{{.ProjectName}} {{.Tag}}"

brews:
  - name: dir2mcp
    ids:
      - dir2mcp-archive
    repository:
      owner: dirstral
      name: homebrew-tap
      token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
    directory: Formula
    homepage: https://github.com/dirstral/dir2mcp
    description: Deploy any local directory as an MCP knowledge server with indexing, retrieval, and citations.
    license: MIT
    # Symmetric conflict with dir2mcp-full (which already declares the
    # reverse). brew audit on the tap requires conflicts to be declared
    # on both sides; without this, every regenerated dir2mcp.rb fails
    # audit until manually patched.
    conflicts:
      - dir2mcp-full
    install: |
      bin.install "dir2mcp"
    test: |
      system "#{bin}/dir2mcp", "version"
    # Surface the most common upgrade pitfall: zsh/bash cache the path to
    # `dir2mcp` per shell session. After `brew upgrade dir2mcp`, an
    # already-open terminal can keep running the previous binary until
    # the cache is cleared.
    caveats: |
      If `dir2mcp version` reports an older version after upgrading,
      run `hash -r` (bash/zsh) in any open shells to refresh the
      command cache, or open a new terminal.


# Nix flake publisher (lean dir2mcp binary only; docling-full is out of
# scope and ships via container/Homebrew). GoReleaser regenerates a versioned
# flake derivation on every tag and pushes it to dirstral/nix-user-repository,
# mirroring how the Homebrew `brews` block above pushes to homebrew-tap.
#
# REQUIRED before the first release with this block on `main`:
# set NIX_USER_REPOSITORY_GITHUB_TOKEN (a PAT with `repo` scope on
# dirstral/nix-user-repository) as a repository secret on dir2mcp, exactly like
# HOMEBREW_TAP_GITHUB_TOKEN. Without it, the nix publish step fails the release.
nix:
  - name: dir2mcp
    ids:
      - dir2mcp-archive
    repository:
      owner: dirstral
      name: nix-user-repository
      token: "{{ .Env.NIX_USER_REPOSITORY_GITHUB_TOKEN }}"
    homepage: https://github.com/dirstral/dir2mcp
    description: Deploy any local directory as an MCP knowledge server with indexing, retrieval, and citations (lean binary).
    license: mit
    # Lean binary install; no docling runtime bundled.
    install: |
      mkdir -p $out/bin
      cp -vr ./dir2mcp $out/bin/dir2mcp


changelog:
  sort: asc
  filters:
    exclude:
      - "^docs:"
      - "^test:"
      - "^ci:"
      - "^chore:"
      - "Merge pull request"
      - "Merge branch"
