-
Notifications
You must be signed in to change notification settings - Fork 1
Add Claude Code usage tracking #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| lint: | ||
| name: Lint | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.25.0" | ||
|
|
||
| - name: Run golangci-lint | ||
| uses: golangci/golangci-lint-action@v6 | ||
| with: | ||
| version: latest | ||
|
|
||
| format: | ||
| name: Format | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.25.0" | ||
|
|
||
| - name: Check formatting | ||
| run: | | ||
| if [ -n "$(gofmt -l .)" ]; then | ||
| echo "The following files are not formatted:" | ||
| gofmt -l . | ||
| exit 1 | ||
| fi | ||
|
|
||
| test: | ||
| name: Test | ||
| runs-on: ubuntu-latest | ||
| needs: [lint, format] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.25.0" | ||
|
|
||
| - name: Run tests | ||
| run: go test -v ./... | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: Release Dispatch | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: "Semantic version (e.g., v1.0.0)" | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| dispatch: | ||
| name: Trigger Release | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Validate version format | ||
| run: | | ||
| if [[ ! "${{ inputs.version }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
| echo "Error: Version must be in format v*.*.* (e.g., v1.0.0)" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Trigger release workflow | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| await github.rest.actions.createWorkflowDispatch({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| workflow_id: 'release.yml', | ||
| ref: 'main', | ||
| inputs: { | ||
| version: '${{ inputs.version }}' | ||
| } | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: "Semantic version (e.g., v1.0.0)" | ||
| required: true | ||
| type: string | ||
| push: | ||
| tags: | ||
| - "v*" | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - goos: linux | ||
| goarch: amd64 | ||
| - goos: linux | ||
| goarch: arm64 | ||
| - goos: darwin | ||
| goarch: amd64 | ||
| - goos: darwin | ||
| goarch: arm64 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.25.0" | ||
|
|
||
| - name: Determine version | ||
| id: version | ||
| run: | | ||
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | ||
| echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Build binary | ||
| env: | ||
| GOOS: ${{ matrix.goos }} | ||
| GOARCH: ${{ matrix.goarch }} | ||
| CGO_ENABLED: 0 | ||
| run: | | ||
| BINARY_NAME="ccmanager-${{ matrix.goos }}-${{ matrix.goarch }}" | ||
| go build -ldflags="-s -w -X main.version=${{ steps.version.outputs.version }}" -o "$BINARY_NAME" . | ||
|
|
||
| - name: Compress binary | ||
| run: | | ||
| BINARY_NAME="ccmanager-${{ matrix.goos }}-${{ matrix.goarch }}" | ||
| tar -czvf "${BINARY_NAME}.tar.gz" "$BINARY_NAME" | ||
|
|
||
| - name: Generate checksum | ||
| run: | | ||
| BINARY_NAME="ccmanager-${{ matrix.goos }}-${{ matrix.goarch }}" | ||
| sha256sum "${BINARY_NAME}.tar.gz" > "${BINARY_NAME}.tar.gz.sha256" | ||
|
|
||
| - name: Upload artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ccmanager-${{ matrix.goos }}-${{ matrix.goarch }} | ||
| path: | | ||
| ccmanager-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz | ||
| ccmanager-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz.sha256 | ||
|
|
||
| release: | ||
| name: Release | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Determine version | ||
| id: version | ||
| run: | | ||
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | ||
| echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: artifacts | ||
|
|
||
| - name: Collect release files | ||
| run: | | ||
| mkdir -p release | ||
| find artifacts -type f \( -name "*.tar.gz" -o -name "*.sha256" \) -exec mv {} release/ \; | ||
|
|
||
| - name: Generate changelog | ||
| id: changelog | ||
| run: | | ||
| PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") | ||
| if [ -n "$PREVIOUS_TAG" ]; then | ||
| CHANGELOG=$(git log --pretty=format:"- %s" "$PREVIOUS_TAG"..HEAD) | ||
| else | ||
| CHANGELOG=$(git log --pretty=format:"- %s" HEAD~10..HEAD 2>/dev/null || git log --pretty=format:"- %s") | ||
| fi | ||
| echo "changelog<<EOF" >> $GITHUB_OUTPUT | ||
| echo "$CHANGELOG" >> $GITHUB_OUTPUT | ||
| echo "EOF" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ steps.version.outputs.version }} | ||
| name: Release ${{ steps.version.outputs.version }} | ||
| body: | | ||
| ## Changelog | ||
| ${{ steps.changelog.outputs.changelog }} | ||
|
|
||
| ## Checksums | ||
| ``` | ||
| $(cat release/*.sha256) | ||
| ``` | ||
| files: release/* | ||
| draft: false | ||
| prerelease: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # CCManager - Claude Code Session Manager | ||
|
|
||
| Go CLI application with Bubble Tea TUI for managing Claude Code sessions with gamification features. | ||
|
|
||
| ## Development Commands | ||
|
|
||
| ```bash | ||
| make build # Build binary to bin/ccmanager | ||
| make test # Run all tests | ||
| make lint # Run golangci-lint | ||
| make deps # Run go mod tidy | ||
| make dev # Build and run | ||
| make run-debug # Run with CCMANAGER_DEBUG=1 | ||
| ``` | ||
|
|
||
| ## Code Style | ||
|
|
||
| - Follow Go conventions and existing patterns in the codebase | ||
| - Use standard library where possible | ||
| - Keep functions focused and small | ||
| - Error handling: return errors, don't panic | ||
|
|
||
| ## Project Structure | ||
|
|
||
| ``` | ||
| cmd/ccmanager/ # Main entry point | ||
| internal/ | ||
| app/ # Application orchestration | ||
| claude/ # Claude Code process detection | ||
| config/ # Configuration management | ||
| daemon/ # Background monitoring | ||
| game/ # Gamification (streaks, pomodoro, control groups) | ||
| store/ # SQLite persistence | ||
| tmux/ # Tmux integration | ||
| tui/ # Bubble Tea UI components | ||
| usage/ # Usage tracking and parsing | ||
| workspace/ # Workspace/project detection (git, jj) | ||
| ``` | ||
|
|
||
| ## Before Committing | ||
|
|
||
| 1. Run tests: `make test` | ||
| 2. Run linter: `make lint` | ||
| 3. Ensure build passes: `make build` | ||
|
|
||
| ## Testing | ||
|
|
||
| - Tests are in `*_test.go` files alongside source | ||
| - Run specific package: `go test -v ./internal/game/...` | ||
| - Run with coverage: `go test -coverprofile=coverage.out ./...` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: Go 1.25.0 has not been released. Latest stable is 1.23.x. Change to
"1.23"or"stable"Prompt To Fix With AI