agentleFS
StripeKnown publisherstripe/hark/.claude/CLAUDE.md

hark

CLAUDE.md2 starsChanged 2 months agoMITView on GitHub

A Go CLI that validates and compiles markdown changefiles (.change.md) into a unified changelog. Used across Stripe SDK repos, both as a standalone CLI and as a Go dependency. Module: github.com/stripe/hark changefile/ and releases/ are the public API — other Go code imports them, so treat their names and signatures as a compatibility surface. cmd/ is not: the CLI is not meant to be embedded, and exports only Execute. The paths hark uses are hardcoded, not configurable: .hark/releases.json, .hark/changes/*.change.md, .hark/intros/intro-<version>.md,…

The file

We split this CLAUDE.md into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Avoid stutter in the public API (releases.ReadFile, not releases.ReadVersionsFile)

    line 67
  2. Very specific:

    Every function doing file I/O takes afero.Fs as a parameter for testability

    line 71
  3. Very specific:

    Use testify (assert/require) for test assertions

    line 73

≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

hark

A Go CLI that validates and compiles markdown changefiles (.change.md) into a unified changelog. Used across Stripe SDK repos, both as a standalone CLI and as a Go dependency.

Module: github.com/stripe/hark

Quick Reference

just test          # run all tests with race detector
just build         # build dev binary to bin/hark
just lint          # run golangci-lint
just format        # gofmt -s -w .
just format-check  # verify formatting (CI mode)
just prepare       # format + lint + test

Project Layout

changefile/ and releases/ are the public API — other Go code imports them, so treat their names and signatures as a compatibility surface. cmd/ is not: the CLI is not meant to be embedded, and exports only Execute.

  • main.go — entrypoint, version injection via ldflags
  • cmd/ — cobra commands (thin shells that parse args and delegate)
  • changefile/ — public: changefile struct, frontmatter parsing, validation, serialization, recursive/parallel reading, filename generation (Name/ValidateName)
  • releases/ — public: releases.json read/write, release comparison (Compare), version validity (IsVersionValid), date-ordered Insert, semver-order Predecessors, duplicate detection (FirstDuplicate), and release channel (Channel) derived from version suffixes
  • internal/changelog/ — high-level operations behind each CLI command (build, validate, release, new)

Fixed layout

The paths hark uses are hardcoded, not configurable: .hark/releases.json, .hark/changes/*.change.md, .hark/intros/intro-<version>.md, .hark/migration-guides/v<major>.md, and CHANGELOG.md at the repo root. Only Options.Root moves them, and it has no CLI flag — it exists so a programmatic caller holding several checkouts can work through them one at a time. Don't add path flags.

Migration guides are the one thing under .hark/ that hark writes but never reads: release seeds the next major's guide and the require-migration-guide action watches the directory. So the name is a convention two places have to agree on, not something a lookup would catch — MigrationGuideName and the action's .hark/migration-guides/ glob have to match.

A release's intro is a file, never a field: it exists if and only if .hark/intros/intro-<version>.md does, so nothing can record it inconsistently. Because it is found purely by name, validate is what catches a misnamed one — but an intro for an unreleased version is valid and ignored until that version is cut, so intros can be drafted ahead of the release.

Changefile names ({date}_{user}_{slug}.change.md, where {date} is YYYY-MM-DD) must lead with the date: the changelog orders changes within a release by filename, oldest first — except that a change marked is_stripe_api_change sorts last whatever it is named. Release dates in releases.json use that same format. The {slug} is letters, numbers, and hyphens only (changefile.ValidateSlug) — an underscore in it would read as a fourth segment, and a space makes the file a chore to type.

How big a change is lives in one field, semver_level. A changefile that leaves it off is a patch, so read it through Changefile.Level() rather than the field: major is what earns the ⚠️ in the changelog and what the migration-guide check looks for.

Conventions

  • Go version: whatever go.mod declares (CI reads go-version-file: go.mod)
  • Exported identifiers get doc comments; every package has a package comment
  • Comments should be CONCISE and SPECIFIC.
  • Avoid stutter in the public API (releases.ReadFile, not releases.ReadVersionsFile)
  • CLI commands only parse args and call into internal/changelog; no business logic in cmd/
  • Build the command tree with a constructor instead of package-level vars, so tests get independent trees and flag state can't leak
  • Operations take an Options struct carrying their dependencies (afero.Fs, io.Writer, paths) — nothing reaches for globals, os.Stdout, or the real filesystem directly
  • Every function doing file I/O takes afero.Fs as a parameter for testability
  • Tests use afero.NewMemMapFs() — no temp files, no cleanup
  • Use testify (assert/require) for test assertions
  • Errors are returned, never panicked
  • Validation methods return []error to report all issues at once

Dependencies

PackagePurpose
github.com/spf13/cobraCLI framework
github.com/goccy/go-yamlYAML deserialization
github.com/spf13/aferoFilesystem abstraction (testing)
github.com/stretchr/testifyTest assertions
golang.org/x/sync/errgroupParallel file reading

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.