Commit Graph

1296 Commits

Author SHA1 Message Date
dependabot[bot]
54990ee865 chore(deps): bump github.com/go-git/go-git/v5 from 5.16.5 to 5.17.0
Bumps [github.com/go-git/go-git/v5](https://github.com/go-git/go-git) from 5.16.5 to 5.17.0.
- [Release notes](https://github.com/go-git/go-git/releases)
- [Commits](https://github.com/go-git/go-git/compare/v5.16.5...v5.17.0)

---
updated-dependencies:
- dependency-name: github.com/go-git/go-git/v5
  dependency-version: 5.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-26 22:12:37 +00:00
Christopher Allen Lane
b8098dc1b9 chore: remove scripts/ directory, superseded by --update flag
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 08:45:45 -05:00
Christopher Allen Lane
e2aa2d3611 Merge branch 'feat/issue-552' 5.1.0 2026-02-15 19:51:44 -05:00
Christopher Allen Lane
80e0e0d3ae feat: add --update/-u flag to pull git-backed cheatpaths (#552)
Iterates over configured cheatpaths and runs git pull on each one that
is a git repository with a clean worktree. Supports SSH remotes via key
file discovery and SSH agent fallback. Works with --path filtering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 19:51:40 -05:00
Christopher Allen Lane
417b5b4e42 Merge branch 'feat/cobra' 5.0.0 2026-02-15 18:45:11 -05:00
Christopher Allen Lane
9b92261604 feat: migrate from docopt to cobra for CLI argument parsing
Replace docopt-go with spf13/cobra, giving cheat a built-in
`--completion` flag that dynamically generates shell completions for
bash, zsh, fish, and powershell. This replaces the manually-maintained
static completion scripts and resolves the root cause of multiple
completion issues (#768, #705, #633, #632, #476).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 18:19:20 -05:00
Christopher Allen Lane
ca1ec0e38d test: improve mutation coverage across 4 modules
Mutation testing (56 mutations, 10 modules) identified 7 surviving
mutations. Added 5 targeted tests to kill all actionable survivors.
Remaining 2 are logically equivalent condition reorderings in
filter.go. Overall mutation score: 96.4%.

New tests:
- TestHasMalformedYAML: YAML unmarshal error path
- TestInvalidateInvalidCheatpath: cheatpath.Validate() delegation
- TestIndentTrimsWhitespace: TrimSpace behavior
- TestColorizeDefaultSyntax: default "bash" lexer
- TestColorizeExplicitSyntax: lexer differentiation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 16:35:12 -05:00
Christopher Allen Lane
52403dbe4a fix: drop plan9 build target (#774)
The plan9/amd64 build fails because the vendored
cyphar/filepath-securejoin uses syscall.ELOOP, which doesn't
exist on plan9. Upstream fix (cyphar/filepath-securejoin#51) is
stalled. Given ~0 user demand (46 downloads total, one release),
remove the target rather than carry a local patch.

Closes #774

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 15:19:06 -05:00
Christopher Allen Lane
5ad1a3c39f chore: housekeeping and refactoring (bump to 4.7.1)
- Remove unused parameters, dead files, and inaccurate doc.go files
- Extract shared helpers, eliminate duplication
- Rename cheatpath.Cheatpath to cheatpath.Path
- Optimize filesystem walks (WalkDir, skip .git)
- Move sheet name validation to sheet.Validate
- Move integration tests to test/integration/
- Consolidate internal/mock into mocks/
- Move fuzz.sh to test/
- Inline loadSheets helper into command callers
- Extract config.New into its own file
- Fix stale references in HACKING.md and CLAUDE.md
- Restore plan9 build target
- Remove redundant and low-value tests
- Clean up project documentation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4.7.1
2026-02-15 15:11:19 -05:00
Christopher Allen Lane
d4a8a79628 chore: bump version to 4.7.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4.7.0
2026-02-15 12:24:54 -05:00
Christopher Allen Lane
007c9f9efe Merge branch 'brief-list-flag' 2026-02-15 12:24:42 -05:00
Christopher Allen Lane
f61203ac1b feat: add -b/--brief flag for compact list output (#505)
Add a --brief flag that lists cheatsheets with only title and tags,
omitting the file path column. Can be used standalone (-b) or combined
with --list (-lb), and composes with existing filters (-t, -p).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 12:21:35 -05:00
Christopher Allen Lane
f1db4ee378 Merge branch 'recursive-cheat-directory-search'
feat: walk up directory tree to find .cheat directory (#602)
4.6.0
2026-02-15 11:23:37 -05:00
Christopher Allen Lane
366d63afdc chore: bump version to 4.6.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 11:23:31 -05:00
Christopher Allen Lane
c1551683a3 feat: walk up directory tree to find .cheat directory (#602)
Previously cheat only checked the current working directory for a .cheat
subdirectory. Now it walks upward through ancestor directories, stopping
at the first .cheat directory found. This mirrors how git discovers .git
directories, so users can place .cheat at their project root and have it
work from any subdirectory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 09:30:29 -05:00
Christopher Allen Lane
09aad6f8ea docs: document supported syntax values in README
Adds a note explaining that syntax highlighting is powered by Chroma,
with a link to Chroma's supported languages list.

Closes #766

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 07:55:37 -05:00
Christopher Allen Lane
adb5a43810 chore: bump version to 4.5.2
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4.5.2
2026-02-15 07:35:59 -05:00
Christopher Allen Lane
cab039a9d8 docs: move ADRs to project root, remove boilerplate README
Move `doc/adr/` to `adr/` for discoverability. Remove the generic
ADR README — `ls adr/` serves the same purpose.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 07:32:40 -05:00
Christopher Allen Lane
97e80beceb fix: match .git as complete path component, not suffix
Searching for `.git/` in file paths incorrectly matched directory names
ending with `.git` (e.g., `personal.git/cheat/hello`), causing sheets
under such paths to be silently skipped. Fix by requiring the path
separator on both sides (`/.git/`), so `.git` is only matched as a
complete path component.

Rewrites test suite with comprehensive coverage for all six documented
edge cases, including the #711 scenario and combination cases (e.g.,
a real .git directory inside a .git-suffixed parent).

Closes #711

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 07:32:35 -05:00
Christopher Allen Lane
1969423b5c fix: respect $VISUAL and $EDITOR env vars at runtime
Previously, env vars were only consulted during config generation
and baked into conf.yml. At runtime, the config file value was
always used, making it impossible to override the editor via
environment variables.

Now the precedence is: $VISUAL > $EDITOR > conf.yml > auto-detect.

Closes #589

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 06:54:42 -05:00
Christopher Allen Lane
4497ce1b84 ci: remove dead Homebrew formula bump workflow
This workflow has been failing for years due to an expired/missing
COMMITTER_TOKEN. Homebrew maintains their own automated version
bump pipeline, making this redundant.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 06:43:01 -05:00
Christopher Allen Lane
5eee02bc40 build: produce static binaries with CGO_ENABLED=0
Eliminates glibc version mismatch errors when running release
binaries on systems with older glibc versions.

Closes #744

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 06:39:20 -05:00
Christopher Allen Lane
2d50c6a6eb chore: bump version to 4.5.1
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4.5.1
2026-02-15 06:26:17 -05:00
Christopher Allen Lane
6f919fd675 fix: comment out community cheatpath in --init output (#773)
cheat --init now comments out the community cheatpath by default and
includes a git clone instruction with the resolved path. This prevents
warnings about missing directories when users save the --init output
as their config without also cloning community cheatsheets.

Closes #773

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 06:21:48 -05:00
Christopher Allen Lane
fd1465ee38 fix: avoid stdin buffering bug in installer prompts
Prompt() created a new bufio.NewReader(os.Stdin) on each call, which
buffered all piped input on the first call and left nothing for
subsequent prompts. This made cheat un-scriptable (e.g., piping answers
via printf). Fix by reading one byte at a time from os.Stdin directly.

Also adds an end-to-end integration test for the first-run experience
(regression test for #721, #771, #730) and bumps the Dockerfile to
Go 1.26.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 21:51:30 -05:00
Christopher Allen Lane
00ec2c130d fix: resolve first-run experience errors (#721, #771, #730)
- cmdInit (--init) now substitutes EDITOR_PATH, PAGER_PATH, and
  WORK_PATH instead of leaving them as literal strings
- Installer now substitutes WORK_PATH and always creates personal
  and work directories regardless of community cheatsheet choice
- When community cheatsheets are declined, the community cheatpath
  is commented out in the generated config
- config.New() skips nonexistent cheatpaths with a warning instead
  of hard-erroring on EvalSymlinks failure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 21:32:20 -05:00
Christopher Allen Lane
8eafa5adfe fix: cross-platform CI test fixes and parse bug fix
- Add .gitattributes to force LF in mock files (Windows autocrlf)
- Fix parse.go: detect line endings from content instead of runtime.GOOS
- Add fail-fast: false to CI matrix; trigger on all branch pushes
- Skip chmod-based tests on Windows (permissions work differently)
- Use filepath.Join for expected paths in Windows path tests
- Use platform-appropriate invalid paths in error tests
- Add Windows absolute path test case for ValidateSheetName
- Skip Unix-specific integration tests on Windows

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 21:31:26 -05:00
Christopher Allen Lane
b604027205 fix: make tests pass on macOS CI runners
- Resolve symlinks in temp dir paths (macOS /var -> /private/var)
- Pre-create non-empty community dir to ensure clone fails reliably
  regardless of network access on CI runners

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 21:05:16 -05:00
Christopher Allen Lane
2a19755804 chore: modernize CI and update Go toolchain
- Bump Go from 1.19 to 1.26 and update all dependencies
- Rewrite CI workflow with matrix strategy (Linux, macOS, Windows)
- Update GitHub Actions to current versions (checkout@v4, setup-go@v5)
- Update CodeQL actions from v1 to v3
- Fix cross-platform bug in mock/path.go (path.Join -> filepath.Join)
- Clean up dependabot config (weekly schedule, remove stale ignore)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 20:58:51 -05:00
Christopher Allen Lane
cc85a4bdb1 chore: bump version to 4.5.0
Bug fixes:
- Fix inverted pager detection logic (returned error instead of path)
- Fix repo.Clone ignoring destination directory parameter
- Fix sheet loading using append on pre-sized slices
- Clean up partial files on copy failure
- Trim whitespace from editor config

Security:
- Add path traversal protection for cheatsheet names

Performance:
- Move regex compilation outside search loop
- Replace string concatenation with strings.Join in search

Build:
- Remove go:generate; embed config and usage as string literals
- Parallelize release builds
- Add fuzz testing infrastructure

Testing:
- Improve test coverage from 38.9% to 50.2%
- Add fuzz tests for search, filter, tags, and validation

Documentation:
- Fix inaccurate code examples in HACKING.md
- Add missing --conf and --all options to man page
- Add ADRs for path traversal, env parsing, and search parallelization
- Update CONTRIBUTING.md to reflect project policy

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4.5.0
2026-02-14 19:56:19 -05:00
Chris Allen Lane
7908a678df Merge pull request #742 from cheat/dependabot/go_modules/github.com/cloudflare/circl-1.3.7
chore(deps): bump github.com/cloudflare/circl from 1.3.6 to 1.3.7
2024-01-08 15:34:48 -05:00
dependabot[bot]
7c0eacb53d chore(deps): bump github.com/cloudflare/circl from 1.3.6 to 1.3.7
Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.3.6 to 1.3.7.
- [Release notes](https://github.com/cloudflare/circl/releases)
- [Commits](https://github.com/cloudflare/circl/compare/v1.3.6...v1.3.7)

---
updated-dependencies:
- dependency-name: github.com/cloudflare/circl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-08 16:53:49 +00:00
Chris Allen Lane
4bf804ac60 Merge pull request #741 from cheat/dependabot/go_modules/golang.org/x/crypto-0.17.0
chore(deps): bump golang.org/x/crypto from 0.16.0 to 0.17.0
2023-12-19 14:51:50 -05:00
dependabot[bot]
33c5918087 chore(deps): bump golang.org/x/crypto from 0.16.0 to 0.17.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.16.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.16.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-19 00:07:38 +00:00
Christopher Allen Lane
d34177729d chore: bump version to 4.4.2 4.4.2 2023-12-15 12:48:39 -05:00
Chris Allen Lane
7fa50328d7 Merge pull request #740 from chrisallenlane/chroma
chore(deps): bump chroma to v2 #735
2023-12-13 12:59:52 -05:00
Christopher Allen Lane
1790aec85d chore(deps): bump chroma to v2 #735
Bump `alecthomas/chroma` to `v2`:
https://github.com/cheat/cheat/issues/735
2023-12-13 12:54:32 -05:00
Mikel Olasagasti Uranga
6bf51e758f Use yaml.v3 rather than .v2 and .v1 2023-12-13 09:57:58 -05:00
Christopher Allen Lane
242da8c89a chore(build): remove plan9 support
Remove `plan9` support from the `Makefile` because the executable now
fails to build.
2023-12-13 09:45:21 -05:00
Chris Allen Lane
2294f40ee0 Merge pull request #739 from chrisallenlane/v4.4.1
V4.4.1
4.4.1
2023-12-13 09:17:16 -05:00
Christopher Allen Lane
fe25019b14 chore: bump version to 4.4.1 2023-12-13 09:12:14 -05:00
Christopher Allen Lane
bfb071c0b2 chore(lint): various changes to appease revive
- Add `package` comments
- Rename `opts` to `_` where unused
2023-12-13 09:10:20 -05:00
Christopher Allen Lane
95a4e31b6c chore(deps): upgrade dependencies
Upgrade all dependencies to newest versions.
2023-12-13 08:29:02 -05:00
Chris Allen Lane
0d9c92c8c0 Merge pull request #707 from chrisallenlane/v4.4.0
V4.4.0
4.4.0
2022-11-05 13:11:22 -04:00
Christopher Allen Lane
16c50bb659 chore: bump version to 4.4.0 2022-11-05 12:56:43 -04:00
Christopher Allen Lane
1a85c9e9c8 feat: platform compatibility
Add experimental support for the following platforms:

- aix
- dragonfly
- illumos
- ios
- netbsd
- openbsd
- plan9
- solaris
2022-11-05 12:00:43 -04:00
Christopher Allen Lane
c9ccefa607 chore(deps): remove yaml.v1
Remove errant `yaml.v1` dependency, and use `yaml.v2` everywhere.
2022-11-05 11:39:48 -04:00
Christopher Allen Lane
3a6b6e58f0 chore(deps): update dependencies
`make vendor-update`
2022-11-05 10:15:15 -04:00
Christopher Allen Lane
2edc0ee299 chore: add a comment
Add a small comment regarding a tricky edge-case in `gitdir.go`.
2022-08-28 06:54:29 -04:00
Chris Allen Lane
bd9fa1ba70 Merge pull request #700 from chrisallenlane/4.3.3
4.3.3
4.3.3
2022-08-27 22:07:19 -04:00