diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4803fc5b..fd28417b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,11 @@ jobs: go-version-file: go.mod cache: true + - name: Check for typos + uses: crate-ci/typos@631208b7aac2daa8b707f55e7331f9112b0e062d # v1.44.0 + with: + config: .github/workflows/typos.toml + - name: Lint run: make lint diff --git a/.github/workflows/typos.toml b/.github/workflows/typos.toml new file mode 100644 index 00000000..ad751753 --- /dev/null +++ b/.github/workflows/typos.toml @@ -0,0 +1,15 @@ +[default] +extend-ignore-re = ["(#|//)\\s*spellchecker:ignore-next-line\\n.*"] + +[default.extend-words] +trialer = "trialer" + +[files] +extend-exclude = [ + "go.sum", + "go.mod", + # Fixtures contain truncated streaming chunks that look like typos + "fixtures/**", + # Test files contain hashes and redacted values that look like typos + "**/*_test.go", +] diff --git a/.gitignore b/.gitignore index 3208facd..aff78ef6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ # Project specific example/aibridge.db +build/ diff --git a/Makefile b/Makefile index dcf974ff..07a57940 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ SHELL_SRC_FILES := $(shell find . -type f -name '*.sh' -not -path '*/.git/*') GOLANGCI_LINT_VERSION ?= 1.64.8 PARALLELTESTCTX_VERSION ?= 0.0.1 -lint: lint/shellcheck lint/go +lint: lint/shellcheck lint/go lint/typos .PHONY: lint lint/go: @@ -25,6 +25,24 @@ lint/go: go run github.com/coder/paralleltestctx/cmd/paralleltestctx@v$(PARALLELTESTCTX_VERSION) -custom-funcs="testutil.Context" ./... .PHONY: lint/go +TYPOS_VERSION := $(shell grep -oP 'crate-ci/typos@\S+\s+\#\s+v\K[0-9.]+' .github/workflows/ci.yml) +TYPOS_ARCH := $(shell uname -m) +ifeq ($(shell uname -s),Darwin) +TYPOS_OS := apple-darwin +else +TYPOS_OS := unknown-linux-musl +endif + +build/typos-$(TYPOS_VERSION): + mkdir -p build/ + curl -sSfL "https://github.com/crate-ci/typos/releases/download/v$(TYPOS_VERSION)/typos-v$(TYPOS_VERSION)-$(TYPOS_ARCH)-$(TYPOS_OS).tar.gz" \ + | tar -xzf - -C build/ ./typos + mv build/typos "$@" + +lint/typos: build/typos-$(TYPOS_VERSION) + build/typos-$(TYPOS_VERSION) --config .github/workflows/typos.toml +.PHONY: lint/typos + lint/shellcheck: if test -n "$(strip $(SHELL_SRC_FILES))"; then \ echo "--- shellcheck"; \ diff --git a/README.md b/README.md index 9308b257..4762e00c 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ See [example/](example/) for a complete runnable example with SQLite persistence 5. **Test with Claude Code**: Claude Code allows a base URL override via `ANTHROPIC_BASE_URL`. - ![image with cloude code example](example/claude-code.png) + ![image with claude code example](example/claude-code.png) ## Supported Routes diff --git a/intercept/apidump/apidump.go b/intercept/apidump/apidump.go index c6543bc0..9f6f5ec3 100644 --- a/intercept/apidump/apidump.go +++ b/intercept/apidump/apidump.go @@ -152,7 +152,7 @@ func (d *dumper) dumpResponse(resp *http.Response) error { // writeRedactedHeaders writes HTTP headers in wire format (Key: Value\r\n) to w, // redacting sensitive values and applying any overrides. Headers are sorted by key // for deterministic output. -// `sensitive` and `overrides` must both supply keys in canoncialized form. +// `sensitive` and `overrides` must both supply keys in canonicalized form. // See [textproto.MIMEHeader]. func (*dumper) writeRedactedHeaders(w io.Writer, headers http.Header, sensitive map[string]struct{}, overrides map[string]string) error { // Collect all header keys including overrides.