1
0
Fork 0
mirror of https://github.com/imjasonh/cnotes synced 2026-07-07 00:33:04 +00:00
Commit graph

70 commits

Author SHA1 Message Date
Jason Hall
54d5cc1244
Remove git hooks and simplify notes pushing
- Remove pre-push and post-commit hooks
- Remove examples directory with hook examples
- Update README to recommend git config for automatic notes pushing
- Restructure commands from cmd/ to internal/commands/
- Git now configured to push notes automatically with:
  git config --add remote.origin.push '+refs/notes/claude-conversations:refs/notes/claude-conversations'
2025-07-21 22:29:33 -04:00
Jason Hall
32be89b76d
Add Chrome extension for viewing git notes on GitHub
- Popup-based extension that works on GitHub commit pages
- Shows badge with note count when commits have notes
- Displays all available git notes refs in tabbed interface
- Supports cnotes format with special formatting
- Works with any public GitHub repository (no auth required)
- Includes caching to minimize API calls (60 req/hour limit)
2025-07-21 22:22:32 -04:00
Jason Hall
ce24ed507f
Fix nil pointer dereference in settings test
Change t.Error to t.Fatal when settings is nil to prevent
accessing settings.Hooks on a nil pointer, fixing staticcheck
SA5011 warning.
2025-07-21 21:46:55 -04:00
Jason Hall
0991df3680
Add pre-push hook example for automatic notes pushing
- Create examples/pre-push-hook.sh with working pre-push hook
- Add documentation to README about automatic notes pushing
- Hook prevents infinite recursion with environment variable flag
2025-07-21 21:44:16 -04:00
Jason Hall
0c93712281
Test pre-push hook 2025-07-21 21:39:54 -04:00
Jason Hall
9a3d8efb89
Add GitHub Actions workflow for Go tests
- Test with latest stable Go version
- Run tests with race detector
- Check go mod tidy
- Run go vet and golangci-lint
- Add test status badge to README
2025-07-21 21:37:35 -04:00
Jason Hall
43fff30a61
Add GitHub API scripts for accessing git notes
- fetch-github-notes.sh: Fetch specific note for a commit
- fetch-all-github-notes.sh: List all commits with notes
- list-commit-notes.sh: Find all notes attached to a commit
- README documenting usage and GitHub API approach

These scripts demonstrate that git notes are fully accessible via
GitHub's API despite not being shown in the web interface.
2025-07-21 21:31:00 -04:00
Jason Hall
04e7115744
Refactor config to use default values without hard-coding
- Use DefaultNotesConfig() values instead of hard-coding defaults
- Update tests to reference default config instead of hard-coded values
- Implement table-driven test for TestDefaultNotesConfig
- Follow DRY principle by eliminating duplicate default values

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-21 18:30:15 -04:00
Jason Hall
65a010675d
Remove .claude/notes.json configuration file
Remove project-specific notes configuration file, allowing the tool
to use default settings or user-specified configuration.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-21 18:21:12 -04:00
Jason Hall
747cd49102
Increase default max_prompts to 400 and format notes.json
- Increase default MaxPrompts from 100 to 400 for more conversation context
- Format .claude/notes.json for better readability

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-21 18:19:14 -04:00
Jason Hall
cd1dd80780
Optimize hook registration and add comprehensive test suite
- Only register PostToolUse hook events instead of all event types
- Add comprehensive test coverage for all major components
- Refactor git_notes.go to use GitExecutor interface for testability
- Mock git operations in tests to avoid real git commands
- Add tests for:
  - Git notes operations with mocked git executor
  - Backup/restore functionality
  - Configuration handling and settings management
  - Context extraction and sanitization
  - Hook installation and uninstallation
- Fix settings initialization to properly handle empty Hooks map
- Fix timestamp comparison in tests using Unix() precision
- Format all code with goimports
- All tests pass including race condition detection

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-21 18:17:09 -04:00
Jason Hall
01ba9278ba
Only register PostToolUse hook during installation
Since cnotes only handles PostToolUse events (and ignores all others),
update the installation to only register for that specific event rather
than all available hook events. This reduces unnecessary hook calls.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-21 16:59:28 -04:00
Jason Hall
caa1834d58
Update README.md 2025-07-21 16:55:41 -04:00
Jason Hall
f32928189d
Fix go run detection by checking for go-build in any cache location
- Add checks for /go-build/ and /Caches/go-build/ patterns
- Clean up settings.json again to remove go-build cache entry
2025-07-21 15:29:46 -04:00
Jason Hall
bae042b031
Prevent go run install and clean up settings
- Block installation when executable contains 'go-build' in path
- Clean up .claude/settings.json to only include properly installed cnotes
- Remove changelog line from README as requested
2025-07-21 15:02:20 -04:00
Jason Hall
47abf1a0ce
Prevent cnotes installation from temporary directories
- Add check for os.TempDir() and /tmp/ prefix
- Resolve symlinks to handle macOS temp directory structure
- Guide users to use 'go install' for proper installation
2025-07-21 14:57:34 -04:00
Jason Hall
3cfe51703e
Implement proper deduplication using last event timestamp tracking 2025-07-21 14:51:00 -04:00
Jason Hall
2cc9c8c00d
Increase default max_prompts from 2 to 100 2025-07-21 14:46:46 -04:00
Jason Hall
aedefe6391
Fix missing user prompts by increasing time buffer to 60 seconds 2025-07-21 14:45:14 -04:00
Jason Hall
a5c285a894
Debug: Test commit to check user prompt capture 2025-07-21 14:44:26 -04:00
Jason Hall
839b396e1e
Document emoji configuration in CLAUDE.md 2025-07-21 14:42:04 -04:00
Jason Hall
cc4541b256
Add configurable emojis for user and assistant messages 2025-07-21 14:41:19 -04:00
Jason Hall
c2927548f9
Complete conversational flow redesign for cnotes show 2025-07-21 14:36:24 -04:00
Jason Hall
25103349f9
Test conversational format in git notes 2025-07-21 14:35:50 -04:00
Jason Hall
03ccfdb50c
Update README to mention conversational transcript format 2025-07-21 14:32:33 -04:00
Jason Hall
588abf835d
Add conversational flow to cnotes show command 2025-07-21 14:31:48 -04:00
Jason Hall
a98459ed4d
Refactor install output to use multi-line string template
- Replace multiple fmt.Printf/Println calls with single fmt.Printf
- Use Go's multi-line string literal with backticks
- Cleaner and more maintainable code structure
2025-07-21 14:05:16 -04:00
Jason Hall
def9a335f2
Add small delay to ensure transcript is written before parsing
- Add 100ms delay before reading transcript
- Ensures user prompts are captured even if transcript writing is async
- Should fix issue where user prompts weren't appearing in git notes
2025-07-21 14:03:30 -04:00
Jason Hall
f7482327c3
Fix user prompt parsing to handle string content format
- Add support for message.content as direct string (not just array format)
- Handles both old and new transcript formats from Claude
- User prompts like 'I would expect cnotes show to include my user prompt' now captured correctly
2025-07-21 14:02:53 -04:00
Jason Hall
042ee0911b
Test: debug user prompts 2025-07-21 14:00:58 -04:00
Jason Hall
66249e8b74
Test: user prompts with fixed parser 2025-07-21 14:00:23 -04:00
Jason Hall
8f5c38cb37
Test: check if user prompts are captured 2025-07-21 13:59:07 -04:00
Jason Hall
5577e350b3
Update install command output to accurately describe cnotes functionality
- Remove misleading descriptions of hook validation features
- Clearly state that cnotes monitors git commits and captures conversation context
- Add helpful commands for using cnotes (show, list, backup/restore)
- Emphasize key features: cross-session context and activity since last commit
2025-07-21 13:58:12 -04:00
Jason Hall
f5531759fd
Include context from all transcript files in project directory
- Scan all .jsonl files in the transcript directory, not just current session
- Merge conversation context from all sessions since last commit
- Ensures continuity when working across multiple Claude sessions
- Each commit captures relevant context regardless of which session it came from
2025-07-21 13:52:54 -04:00
Jason Hall
0257301ee5
Test: check multi-session debug 2025-07-21 13:51:33 -04:00
Jason Hall
cf1e91a2a4
Test: multi-session context in git notes 2025-07-21 13:50:29 -04:00
Jason Hall
a6e6602bf8
Fix duplicate content in git notes by filtering since last commit
- Add ExtractContextSince method to filter conversation by timestamp
- Get previous commit time and only include activity since then
- Change labels to 'User prompts since last commit' and 'Tool interactions since last commit'
- Each commit now only captures its own unique conversation context
- Prevents accumulation of duplicate content across commits in same session
2025-07-21 13:38:30 -04:00
Jason Hall
6b338a76be
Test: debug timestamp filtering 2025-07-21 13:37:28 -04:00
Jason Hall
8e8e2d85a6
Test: conversation context deduplication 2025-07-21 13:36:34 -04:00
Jason Hall
9d3337ee0e
Improve pronunciation guide in README
- Add star emoji for emphasis
- Link to Wikipedia article about cenotes
- Fix markdown formatting
2025-07-21 13:30:43 -04:00
Jason Hall
39e3f12ed9
Update .gitignore for cnotes binary
- Change ignored binary name from 'hooks' to 'cnotes'
- Remove tracked cnotes binary (should be built locally)
2025-07-21 13:27:43 -04:00
Jason Hall
2e7c71593b
Include user prompts in git notes conversation context
- Update JSONL parser to properly extract user messages
- Show last 3 user prompts in conversation excerpt
- Increase prompt length limit to 300 characters
- Remove debug logging
- Clean up test files
2025-07-21 13:21:30 -04:00
Jason Hall
b96c527a4f
Test with updated binary 2025-07-21 13:20:15 -04:00
Jason Hall
42206f1c36
Debug user prompt extraction 2025-07-21 13:19:50 -04:00
Jason Hall
7a8a3606db
Test user prompt extraction in git notes 2025-07-21 13:18:11 -04:00
Jason Hall
4f8189cef8
Add stdin timeout and update documentation
- Add 2-second timeout for stdin input to prevent hanging
- Update README with pronunciation guide and go install instructions
- Fix command references in documentation from ./cnotes to cnotes
- Update settings.json to use /Users/jason/go/bin/cnotes run
- Improve generated by message formatting in notes output

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-21 13:02:15 -04:00
Jason Hall
324ad33ccc
Refactor to cnotes: focused git notes tool
BREAKING CHANGE: Complete restructure from hooks to cnotes

Major Changes:
- Removed all hook handler code except git commit detection
- Simplified to focused git notes functionality only
- Renamed binary from 'hooks' to 'cnotes'
- Restructured CLI: cnotes (hook handler), cnotes show, cnotes install, etc.
- Updated module path to github.com/imjasonh/cnotes
- Rewrote README and CLAUDE.md for new focused scope

New Command Structure:
- cnotes           # Main hook handler (receives Claude Code calls)
- cnotes show      # Pretty-print conversation notes
- cnotes install   # Configure Claude Code to use cnotes
- cnotes backup    # Backup conversation notes
- cnotes restore   # Restore notes from backup
- cnotes list      # List commits with notes

This creates a much cleaner, focused tool specifically for git conversation notes.
2025-07-21 12:52:39 -04:00
Jason Hall
ad3c31ffea
Improve conversation excerpt formatting in notes show command
- Added formatConversationExcerpt function to properly unescape JSON strings
- Replaced escaped newlines (\n) with actual newlines for readability
- Unescaped quotes, backslashes, tabs, and other JSON escape sequences
- Tool interactions and conversation context now display with proper formatting
- Much more readable output with proper line breaks and structure

The conversation context is now properly formatted and easy to read instead of being one long escaped string.
2025-07-21 12:45:50 -04:00
Jason Hall
997a55970f
Add pretty-printed Markdown show command for conversation notes
- Added 'hooks notes show [commit]' command that defaults to HEAD
- Formats conversation context in readable Markdown with proper sections
- Shows commit info, session details, tools used, commit context, and conversation excerpt
- Updated documentation to recommend the show command over raw git notes
- Enhanced user experience for viewing conversation context

Usage:
  ./hooks notes show       # Show notes for latest commit
  ./hooks notes show abc123 # Show notes for specific commit
2025-07-21 12:43:34 -04:00
Jason Hall
5d9e678db8
Complete git notes preservation documentation and cleanup
- Added comprehensive documentation for notes preservation during rebasing/squashing
- Updated CLAUDE.md with backup/restore command examples
- Documented best practices for preserving conversation context during destructive git operations
- Cleaned up test files

All git notes preservation features are now complete and documented.
2025-07-21 12:40:04 -04:00