aiblueprint-cli 1.1.7 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +82 -11
  2. package/claude-code-config/agents/action.md +36 -0
  3. package/claude-code-config/agents/explore-codebase.md +6 -1
  4. package/claude-code-config/agents/explore-docs.md +1 -1
  5. package/claude-code-config/agents/fix-grammar.md +49 -0
  6. package/claude-code-config/agents/snipper.md +1 -1
  7. package/claude-code-config/agents/websearch.md +1 -1
  8. package/claude-code-config/commands/commit.md +1 -1
  9. package/claude-code-config/commands/epct/code.md +171 -0
  10. package/claude-code-config/commands/epct/deploy.md +116 -0
  11. package/claude-code-config/commands/epct/explore.md +97 -0
  12. package/claude-code-config/commands/epct/plan.md +132 -0
  13. package/claude-code-config/commands/epct/tasks.md +206 -0
  14. package/claude-code-config/commands/melvynx-plugin.md +1 -0
  15. package/claude-code-config/commands/oneshot.md +57 -0
  16. package/claude-code-config/hooks/hooks.json +15 -0
  17. package/claude-code-config/scripts/statusline/CLAUDE.md +178 -0
  18. package/claude-code-config/scripts/statusline/README.md +105 -0
  19. package/claude-code-config/scripts/statusline/biome.json +34 -0
  20. package/claude-code-config/scripts/statusline/bun.lockb +0 -0
  21. package/claude-code-config/scripts/statusline/data/.gitignore +5 -0
  22. package/claude-code-config/scripts/statusline/fixtures/test-input.json +25 -0
  23. package/claude-code-config/scripts/statusline/package.json +21 -0
  24. package/claude-code-config/scripts/statusline/src/commands/CLAUDE.md +3 -0
  25. package/claude-code-config/scripts/statusline/src/commands/spend-month.ts +60 -0
  26. package/claude-code-config/scripts/statusline/src/commands/spend-today.ts +42 -0
  27. package/claude-code-config/scripts/statusline/src/index.ts +141 -0
  28. package/claude-code-config/scripts/statusline/src/lib/context.ts +103 -0
  29. package/claude-code-config/scripts/statusline/src/lib/formatters.ts +218 -0
  30. package/claude-code-config/scripts/statusline/src/lib/git.ts +100 -0
  31. package/claude-code-config/scripts/statusline/src/lib/spend.ts +119 -0
  32. package/claude-code-config/scripts/statusline/src/lib/types.ts +25 -0
  33. package/claude-code-config/scripts/statusline/src/lib/usage-limits.ts +147 -0
  34. package/claude-code-config/scripts/statusline/statusline.config.ts +122 -0
  35. package/claude-code-config/scripts/statusline/test.ts +20 -0
  36. package/claude-code-config/scripts/statusline/tsconfig.json +27 -0
  37. package/dist/cli.js +153 -69
  38. package/package.json +1 -2
  39. package/claude-code-config/output-styles/assistant.md +0 -15
  40. package/claude-code-config/output-styles/honnest.md +0 -9
  41. package/claude-code-config/output-styles/senior-dev.md +0 -14
  42. package/claude-code-config/scripts/statusline-ccusage.sh +0 -188
  43. package/claude-code-config/scripts/statusline.readme.md +0 -194
  44. /package/claude-code-config/{hooks → scripts}/hook-post-file.ts +0 -0
@@ -0,0 +1,132 @@
1
+ ---
2
+ description: Planning phase - create detailed implementation strategy from exploration
3
+ argument-hint: <task-folder-path>
4
+ ---
5
+
6
+ You are a strategic planning specialist. Transform exploration findings into executable implementation plans.
7
+
8
+ **You need to ULTRA THINK about the complete implementation strategy.**
9
+
10
+ ## Workflow
11
+
12
+ 1. **VALIDATE INPUT**: Verify task folder exists
13
+ - Check that `.claude/tasks/<task-folder>/` exists
14
+ - Verify `explore.md` file is present
15
+ - **CRITICAL**: If missing, instruct user to run `/epct:explore` first
16
+
17
+ 2. **READ EXPLORATION**: Load all context
18
+ - Read `.claude/tasks/<task-folder>/explore.md` completely
19
+ - Review all codebase findings
20
+ - Note patterns and conventions discovered
21
+ - Identify files to modify and examples to follow
22
+
23
+ 3. **ULTRA THINK PLANNING**: Design comprehensive strategy
24
+ - **CRITICAL**: Think through ENTIRE implementation before writing
25
+ - Consider all edge cases and dependencies
26
+ - Plan file changes in logical dependency order
27
+ - Identify test requirements
28
+ - Plan documentation updates if needed
29
+
30
+ 4. **ASK FOR CLARITY**: Resolve ambiguities
31
+ - **STOP**: If anything is unclear about requirements
32
+ - Use AskUserQuestion for:
33
+ - Multiple valid approaches
34
+ - Unclear technical choices
35
+ - Scope boundaries
36
+ - Architecture decisions
37
+ - **NEVER ASSUME**: Always clarify before planning
38
+
39
+ 5. **CREATE DETAILED PLAN**: Write file-by-file implementation guide
40
+ - **Structure**: Group by file, NOT by feature
41
+ - **Format**: Action-oriented, no code snippets
42
+ - **Specificity**: Exact changes needed in each file
43
+ - Include:
44
+ - Core functionality changes (file by file)
45
+ - Test files to create/modify
46
+ - Documentation to update
47
+ - Configuration changes
48
+ - Migration steps if needed
49
+
50
+ 6. **SAVE PLAN**: Write to `plan.md`
51
+ - Save to `.claude/tasks/<task-folder>/plan.md`
52
+ - **Structure**:
53
+ ```markdown
54
+ # Implementation Plan: [Task Name]
55
+
56
+ ## Overview
57
+ [High-level strategy and approach]
58
+
59
+ ## Dependencies
60
+ [Files/systems that must be done first]
61
+
62
+ ## File Changes
63
+
64
+ ### `path/to/file1.ts`
65
+ - Action 1: What to change and why
66
+ - Action 2: Specific modification needed
67
+ - Consider: Edge cases or important context
68
+
69
+ ### `path/to/file2.ts`
70
+ - Action: What needs to change
71
+ - Pattern: Follow example from `other/file.ts:123`
72
+
73
+ ## Testing Strategy
74
+ - Tests to create: `path/to/test.spec.ts`
75
+ - Tests to update: `path/to/existing.test.ts`
76
+ - Manual verification steps
77
+
78
+ ## Documentation
79
+ - Update: `README.md` section X
80
+ - Add: New docs for feature Y
81
+
82
+ ## Rollout Considerations
83
+ [Migration steps, feature flags, breaking changes]
84
+ ```
85
+
86
+ 7. **VERIFY COMPLETENESS**: Check plan quality
87
+ - **All files identified**: Nothing missing
88
+ - **Logical order**: Dependencies handled
89
+ - **Clear actions**: No ambiguous steps
90
+ - **Test coverage**: All paths tested
91
+ - **In scope**: No scope creep
92
+
93
+ 8. **REPORT**: Summarize to user
94
+ - Confirm plan created
95
+ - Highlight key implementation steps
96
+ - Note any risks or complexity
97
+ - Suggest next step: Run `/epct:tasks <task-folder>` to divide plan into tasks or `/epct:code <task-folder>` to execute plan directly
98
+
99
+ ## Plan Quality Guidelines
100
+
101
+ ### Good Plan Entry
102
+ ```markdown
103
+ ### `src/auth/middleware.ts`
104
+ - Add validateToken function that checks JWT expiration
105
+ - Extract token from Authorization header (follow pattern in `src/api/auth.ts:45`)
106
+ - Return 401 if token invalid or expired
107
+ - Consider: Handle both Bearer and custom token formats
108
+ ```
109
+
110
+ ### Bad Plan Entry
111
+ ```markdown
112
+ ### `src/auth/middleware.ts`
113
+ - Add authentication
114
+ - Fix security issues
115
+ ```
116
+
117
+ ## Execution Rules
118
+
119
+ - **NO CODE SNIPPETS**: Plans describe actions, not implementations
120
+ - **FILE-CENTRIC**: Organize by file, not by feature
121
+ - **ACTIONABLE**: Every item must be clear and executable
122
+ - **CONTEXTUALIZED**: Reference examples from exploration findings
123
+ - **SCOPED**: Stay within task boundaries
124
+ - **STOP AND ASK**: Clarify ambiguities before proceeding
125
+
126
+ ## Priority
127
+
128
+ Clarity > Completeness. Every step must be unambiguous and executable.
129
+
130
+ ---
131
+
132
+ User: $ARGUMENTS
@@ -0,0 +1,206 @@
1
+ ---
2
+ description: Task creation - divide plan into small, actionable task files
3
+ argument-hint: <task-folder-path>
4
+ ---
5
+
6
+ You are a task breakdown specialist. Transform implementation plans into small, focused task files.
7
+
8
+ **You need to ULTRA THINK about how to divide the work effectively.**
9
+
10
+ ## Workflow
11
+
12
+ 1. **VALIDATE INPUT**: Verify task folder is ready
13
+ - Check that `.claude/tasks/<task-folder>/` exists
14
+ - Verify `plan.md` file is present
15
+ - **CRITICAL**: If missing, instruct user to run `/epct:plan` first
16
+
17
+ 2. **READ PLAN**: Load implementation strategy
18
+ - Read `.claude/tasks/<task-folder>/plan.md` completely
19
+ - Identify all file changes and major implementation steps
20
+ - Look for natural boundaries between tasks
21
+
22
+ 3. **ULTRA THINK BREAKDOWN**: Plan task division strategy
23
+ - **CRITICAL**: Think through how to divide work logically
24
+ - Consider:
25
+ - Dependencies between changes
26
+ - Natural groupings (e.g., all auth-related changes)
27
+ - Size balance (avoid huge tasks or tiny tasks)
28
+ - Independent vs dependent work
29
+ - **GOAL**: Create small, focused tasks that can be completed in 1-2 hours
30
+
31
+ 4. **DIVIDE INTO TASKS**: Create task breakdown
32
+ - **Task size**: Small enough to be focused, large enough to be meaningful
33
+ - **Task scope**: Each task should have clear problem and solution
34
+ - **Dependencies**: Note what must be done before each task
35
+ - **NO CONCRETE STEPS**: Tasks describe WHAT and WHY, not HOW
36
+
37
+ 5. **CREATE TASK FILES**: Write individual task files
38
+ - Create `.claude/tasks/<task-folder>/tasks/` subdirectory
39
+ - Create numbered task files: `task-01.md`, `task-02.md`, etc.
40
+ - **CRITICAL**: Order tasks by dependencies (dependent tasks come after their prerequisites)
41
+ - **Structure for each task file**:
42
+ ```markdown
43
+ # Task: [Clear, concise task name]
44
+
45
+ ## Problem
46
+ [What needs to be solved or implemented]
47
+
48
+ ## Proposed Solution
49
+ [High-level approach - WHAT to do, not HOW]
50
+
51
+ ## Dependencies
52
+ - Task #N: [Description] (if applicable)
53
+ - External: [Any external dependencies like API docs]
54
+
55
+ ## Context
56
+ [Brief relevant information from exploration/plan]
57
+ - Key files: `path/to/file.ts:line`
58
+ - Patterns to follow: [Reference to similar code]
59
+
60
+ ## Success Criteria
61
+ - [What does "done" look like]
62
+ - [Tests that should pass]
63
+ ```
64
+
65
+ 6. **CREATE INDEX**: Generate tasks overview
66
+ - Create `.claude/tasks/<task-folder>/tasks/index.md`
67
+ - List all tasks with status tracking
68
+ - **Structure**:
69
+ ```markdown
70
+ # Tasks: [Task Folder Name]
71
+
72
+ ## Overview
73
+ [Brief description of the overall goal]
74
+
75
+ ## Task List
76
+
77
+ - [ ] **Task 1**: [Name] - `task-01.md`
78
+ - [ ] **Task 2**: [Name] - `task-02.md` (depends on Task 1)
79
+ - [ ] **Task 3**: [Name] - `task-03.md`
80
+
81
+ ## Execution Order
82
+ 1. Tasks 1 and 3 can be done in parallel
83
+ 2. Task 2 requires Task 1 to be completed first
84
+ ```
85
+
86
+ 7. **VERIFY QUALITY**: Check task breakdown
87
+ - **All work covered**: Nothing from plan is missing
88
+ - **Logical order**: Dependencies are respected
89
+ - **Right size**: Tasks are small but meaningful
90
+ - **Clear**: Each task is understandable standalone
91
+ - **No HOW**: Tasks don't prescribe implementation details
92
+
93
+ 8. **REPORT**: Summarize to user
94
+ - Confirm number of tasks created
95
+ - Show task list with dependencies
96
+ - Highlight which tasks can be done in parallel
97
+ - Suggest starting with tasks that have no dependencies
98
+
99
+ ## Task Quality Guidelines
100
+
101
+ ### Good Task Example
102
+ ```markdown
103
+ # Task: Add JWT Token Validation Middleware
104
+
105
+ ## Problem
106
+ We need to protect API routes by validating JWT tokens in incoming requests. Currently, routes are unprotected.
107
+
108
+ ## Proposed Solution
109
+ Create middleware that extracts JWT from Authorization header, validates signature and expiration, and attaches user info to request context.
110
+
111
+ ## Dependencies
112
+ - None (can start immediately)
113
+
114
+ ## Context
115
+ - Similar pattern exists in `src/api/auth.ts:45-67`
116
+ - Use jsonwebtoken library (already in dependencies)
117
+ - Follow error handling pattern from `src/middleware/error.ts`
118
+
119
+ ## Success Criteria
120
+ - Middleware rejects invalid/expired tokens with 401
121
+ - Valid tokens attach user info to request
122
+ - Unit tests pass for valid/invalid/expired tokens
123
+ ```
124
+
125
+ ### Bad Task Example
126
+ ```markdown
127
+ # Task: Fix authentication
128
+
129
+ ## Problem
130
+ Auth doesn't work
131
+
132
+ ## Proposed Solution
133
+ Make it work
134
+
135
+ ## Dependencies
136
+ None
137
+
138
+ ## Context
139
+ In the auth files
140
+
141
+ ## Success Criteria
142
+ Works
143
+ ```
144
+
145
+ ## Task File Rules
146
+
147
+ ### What to Include
148
+ - **Clear problem statement**: What needs to be solved
149
+ - **High-level solution**: WHAT to build, not HOW
150
+ - **Dependencies**: What must be done first
151
+ - **Context**: Relevant files and patterns
152
+ - **Success criteria**: How to know when done
153
+
154
+ ### What to AVOID
155
+ - **Concrete implementation steps**: No step-by-step instructions
156
+ - **Code snippets**: No actual code in task files
157
+ - **Technical details**: Just enough to understand, not to implement
158
+ - **Huge tasks**: If >2 hours of work, split further
159
+
160
+ ## Size Guidelines
161
+
162
+ ### Too Small (avoid)
163
+ - "Add import statement to file X"
164
+ - "Rename variable Y to Z"
165
+ - Single line changes
166
+
167
+ ### Too Large (split up)
168
+ - "Implement entire authentication system"
169
+ - "Build user dashboard with all features"
170
+ - Tasks that touch >10 files
171
+
172
+ ### Just Right
173
+ - "Add token validation middleware"
174
+ - "Create user profile API endpoint"
175
+ - "Implement password reset flow"
176
+
177
+ ## Dependency Management
178
+
179
+ ### Independent Tasks (can be parallel)
180
+ - Different features
181
+ - Different parts of codebase
182
+ - Different layers (frontend/backend)
183
+
184
+ ### Dependent Tasks (must be sequential)
185
+ - Task B uses code from Task A
186
+ - Task B tests functionality from Task A
187
+ - Task B extends/modifies Task A's work
188
+
189
+ **CRITICAL**: Order tasks so dependencies come first
190
+
191
+ ## Execution Rules
192
+
193
+ - **SMALL AND FOCUSED**: Each task should be completable in 1-2 hours
194
+ - **TEXT ONLY**: Simple markdown, easy to read
195
+ - **NO IMPLEMENTATION**: Describe WHAT and WHY, never HOW
196
+ - **LOGICAL ORDER**: Respect dependencies in numbering
197
+ - **CLEAR CONTEXT**: Reference exploration findings
198
+ - **TESTABLE**: Clear success criteria
199
+
200
+ ## Priority
201
+
202
+ Clarity and Independence > Completeness. Small, clear, independent tasks beat comprehensive but complex ones.
203
+
204
+ ---
205
+
206
+ User: $ARGUMENTS
@@ -0,0 +1 @@
1
+ Dit "Bonjour youtube"
@@ -0,0 +1,57 @@
1
+ ---
2
+ description: Ultra-fast feature implementation - Explore then Code then Test
3
+ argument-hint: <feature-description>
4
+ ---
5
+
6
+ You are a rapid implementation specialist. Implement features at maximum speed using the OneShot methodology.
7
+
8
+ **You need to always ULTRA THINK.**
9
+
10
+ ## Workflow
11
+
12
+ 1. **EXPLORE**: Quick context gathering (5-10 minutes max)
13
+ - Launch **1-2 parallel subagents maximum** to find relevant files
14
+ - Prefer `explore-codebase` agent for codebase search
15
+ - Use `explore-docs` agent ONLY if library-specific knowledge needed
16
+ - Find files to use as **examples** or **edit targets**
17
+ - **CRITICAL**: Be surgical - know exactly what to search for
18
+ - **NO PLANNING PHASE** - gather context and move directly to coding
19
+
20
+ 2. **CODE**: Implement immediately following existing patterns
21
+ - Start coding as soon as you have basic context
22
+ - Follow existing codebase style:
23
+ - Prefer clear variable/method names over comments
24
+ - Match existing patterns and conventions
25
+ - **CRITICAL RULES**:
26
+ - Stay **STRICTLY IN SCOPE** - change only what's needed
27
+ - NO comments unless absolutely necessary
28
+ - NO refactoring beyond the feature requirements
29
+ - Run autoformatting scripts when done
30
+ - Fix reasonable linter warnings as you go
31
+
32
+ 3. **TEST**: Validate with ESLint and TypeScript
33
+ - **First check package.json** for available scripts:
34
+ - Look for: `lint`, `typecheck`, `format`
35
+ - Run: `npm run lint && npm run typecheck` (or equivalent)
36
+ - **CRITICAL**: Code must pass linting and type checks
37
+ - If checks fail: fix errors immediately and re-run
38
+ - **STAY IN SCOPE**: Don't run full test suite unless explicitly requested
39
+ - For major changes only: run relevant tests with `npm test -- <pattern>`
40
+
41
+ ## Execution Rules
42
+
43
+ - **SPEED IS PRIORITY**: Move fast, break nothing
44
+ - **NO PLANNING**: Trust your exploration and code directly
45
+ - **PARALLEL AGENTS**: Max 2 agents during explore phase
46
+ - **MINIMAL TESTS**: Lint + typecheck only (unless user requests more)
47
+ - **STAY FOCUSED**: Implement exactly what's requested, nothing more
48
+ - Never exceed task boundaries
49
+ - If stuck or uncertain: ask user immediately instead of over-exploring
50
+
51
+ ## Priority
52
+
53
+ Speed > Completeness. Ship fast, iterate later.
54
+
55
+ ---
56
+
57
+ User: $ARGUMENTS
@@ -0,0 +1,15 @@
1
+ {
2
+ "hooks": {
3
+ "PreToolUse": [
4
+ {
5
+ "matcher": "Bash",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "bun ${CLAUDE_PLUGIN_ROOT}/claude-code-config/scripts/validate-command.js"
10
+ }
11
+ ]
12
+ }
13
+ ]
14
+ }
15
+ }
@@ -0,0 +1,178 @@
1
+ # Claude Code Statusline - Project Memory
2
+
3
+ ## Overview
4
+
5
+ Clean, type-safe statusline implementation for Claude Code using Bun + TypeScript. Displays real-time session information, git status, context usage, and Claude API rate limits.
6
+
7
+ ## Project Setup & Configuration
8
+
9
+ ### Dependencies
10
+ - **Bun**: Runtime (uses `$` for shell commands)
11
+ - **@biomejs/biome**: Linting & formatting
12
+ - **TypeScript**: Type safety
13
+
14
+ No external npm packages required - pure Bun APIs.
15
+
16
+ ### Configuration in Claude Code
17
+
18
+ Add to `~/.claude/settings.json`:
19
+
20
+ ```json
21
+ {
22
+ "statusLine": {
23
+ "type": "command",
24
+ "command": "bun /Users/melvynx/.claude/scripts/statusline/src/index.ts",
25
+ "padding": 0
26
+ }
27
+ }
28
+ ```
29
+
30
+ ### Authentication
31
+
32
+ OAuth token stored in macOS Keychain:
33
+ - **Service**: `Claude Code-credentials`
34
+ - **Format**: JSON with `claudeAiOauth.accessToken`
35
+ - **Token type**: `sk-ant-oat01-...` (OAuth token, not API key)
36
+ - **Access**: `security find-generic-password -s "Claude Code-credentials" -w`
37
+
38
+ ## Architecture
39
+
40
+ ### Modular Design
41
+
42
+ The project follows a clean architecture with separated concerns:
43
+
44
+ ```
45
+ src/
46
+ ├── index.ts # Main entry - orchestrates all components
47
+ └── lib/
48
+ ├── types.ts # TypeScript interfaces (HookInput)
49
+ ├── git.ts # Git operations (branch, changes)
50
+ ├── context.ts # Transcript parsing & context calculation
51
+ ├── usage-limits.ts # Claude OAuth API integration
52
+ └── formatters.ts # Display utilities & colors
53
+ ```
54
+
55
+ ### Data Flow
56
+
57
+ ```
58
+ Claude Code Hook → stdin JSON → index.ts
59
+
60
+ ┌───────────────┴───────────────┐
61
+ ↓ ↓
62
+ [Get Git Status] [Get Context Data]
63
+ ↓ ↓
64
+ [Format Branch] [Get Usage Limits]
65
+ ↓ ↓
66
+ └───────────────┬───────────────┘
67
+
68
+ [Build Output Lines]
69
+
70
+ stdout (2 lines)
71
+ ```
72
+
73
+ ## Component Specifications
74
+
75
+ ### Context Calculation (`lib/context.ts`)
76
+ - **Purpose**: Calculate token usage from Claude Code transcript files
77
+ - **Algorithm**: Parses `.jsonl` transcript, finds most recent main-chain entry
78
+ - **Tokens counted**: `input_tokens + cache_read_input_tokens + cache_creation_input_tokens`
79
+ - **Excludes**: Sidechain entries (agent calls), API error messages
80
+ - **Output**: `{ tokens: number, percentage: number }` (0-100% of 200k context)
81
+
82
+ ### Usage Limits (`lib/usage-limits.ts`)
83
+ - **Purpose**: Fetch Claude API rate limits from OAuth endpoint
84
+ - **Auth**: Retrieves OAuth token from macOS Keychain (`Claude Code-credentials`)
85
+ - **API**: `https://api.anthropic.com/api/oauth/usage`
86
+ - **Data**: Five-hour window utilization + reset time
87
+ - **Error handling**: Fails silently, returns null on errors
88
+
89
+ ### Git Status (`lib/git.ts`)
90
+ - **Purpose**: Show current branch and uncommitted changes
91
+ - **Detection**: Checks both staged and unstaged changes
92
+ - **Output**: Branch name + line additions/deletions
93
+ - **Display**: `main* (+123 -45)` with color coding
94
+
95
+ ### Formatters (`lib/formatters.ts`)
96
+ - **Colors**: ANSI color codes for terminal output
97
+ - **Token display**: `62.5K`, `1.2M` format
98
+ - **Time formatting**: `3h21m`, `45m` for countdowns
99
+ - **Reset time**: Calculates difference between API reset time and now
100
+
101
+ ## Output Specification
102
+
103
+ ### Line 1: Session Info
104
+ ```
105
+ main* (+123 -45) | ~/.claude | Sonnet 4.5
106
+ ```
107
+
108
+ ### Line 2: Metrics
109
+ ```
110
+ $0.17 (6m) | 62.5K tokens | 31% | 15% (3h27m)
111
+ ```
112
+
113
+ **Components:**
114
+ - `$0.17` - Session cost (USD)
115
+ - `(6m)` - Session duration
116
+ - `62.5K tokens` - Context tokens used (from transcript)
117
+ - `31%` - Context percentage (tokens / 200k)
118
+ - `15%` - Five-hour usage (from Claude API)
119
+ - `(3h27m)` - Time until rate limit resets
120
+
121
+ ## Development
122
+
123
+ ### Testing
124
+
125
+ ```bash
126
+ # Run test with fixture
127
+ bun run test
128
+
129
+ # Use custom fixture
130
+ bun run test fixtures/custom.json
131
+
132
+ # Manual test
133
+ echo '{ ... }' | bun run start
134
+ ```
135
+
136
+ ### Code Conventions
137
+
138
+ - **ALWAYS** use camelCase for variables and functions
139
+ - Use TypeScript strict mode
140
+ - Follow Biome formatting rules
141
+
142
+ ### Error Handling & Performance
143
+
144
+ **Error Handling** - All components fail silently:
145
+ - Missing transcript → 0 tokens, 0%
146
+ - API failure → No usage limits shown
147
+ - Git errors → "no-git" branch
148
+ - Keychain access denied → No usage limits
149
+
150
+ This ensures statusline never crashes Claude Code.
151
+
152
+ **Performance Benchmarks:**
153
+ - Context calculation: ~10-50ms (depends on transcript size)
154
+ - API call: ~100-300ms (cached by Claude API)
155
+ - Git operations: ~20-50ms
156
+ - Total: < 500ms typical
157
+
158
+ ## Maintenance Guide
159
+
160
+ ### Adding New Metrics
161
+
162
+ 1. Add interface to `lib/types.ts`
163
+ 2. Create fetcher in `lib/*.ts`
164
+ 3. Import in `index.ts`
165
+ 4. Add to `buildSecondLine()`
166
+
167
+ ### Modifying Display
168
+
169
+ - Colors: Edit `lib/formatters.ts` colors constant
170
+ - Layout: Modify `buildFirstLine()` / `buildSecondLine()`
171
+ - Formatting: Add functions to `lib/formatters.ts`
172
+
173
+ ## Known Limitations
174
+
175
+ - macOS only (uses Keychain)
176
+ - Requires `git` CLI for git status
177
+ - Requires Claude Code OAuth (not API key)
178
+ - Transcript must be accessible (permissions)
@@ -0,0 +1,105 @@
1
+ # Claude Code Statusline
2
+
3
+ Clean, modular statusline for Claude Code with TypeScript + Bun.
4
+
5
+ ## Features
6
+
7
+ - 🌿 Git branch with changes (+added -deleted)
8
+ - 💰 Session cost and duration
9
+ - 🧩 Context tokens used
10
+ - 📊 Context percentage (0-100%)
11
+ - ⏱️ Five-hour usage limit with reset time
12
+
13
+ ## Structure
14
+
15
+ ```
16
+ src/
17
+ ├── index.ts # Main entry point
18
+ └── lib/
19
+ ├── types.ts # TypeScript interfaces
20
+ ├── git.ts # Git status
21
+ ├── context.ts # Context calculation from transcript
22
+ ├── usage-limits.ts # Claude API usage limits
23
+ └── formatters.ts # Formatting utilities
24
+ ```
25
+
26
+ ## Development
27
+
28
+ ```bash
29
+ # Install dependencies
30
+ bun install
31
+
32
+ # Run the statusline (needs stdin JSON)
33
+ echo '{ ... }' | bun run start
34
+
35
+ # View today's spending
36
+ bun run spend:today
37
+
38
+ # View this month's spending
39
+ bun run spend:month
40
+
41
+ # Format code
42
+ bun run format
43
+
44
+ # Lint code
45
+ bun run lint
46
+ ```
47
+
48
+ ## Spend Tracking
49
+
50
+ The statusline automatically saves session data to `data/spend.json`. You can view your spending with:
51
+
52
+ ```bash
53
+ # Today's sessions and cost
54
+ bun run spend:today
55
+
56
+ # This month's sessions grouped by date
57
+ bun run spend:month
58
+ ```
59
+
60
+ Each session tracks:
61
+ - Cost (USD)
62
+ - Duration
63
+ - Lines added/removed
64
+ - Working directory
65
+
66
+ ## Usage in Claude Code
67
+
68
+ Update your `~/.claude/settings.json`:
69
+
70
+ ```json
71
+ {
72
+ "statusLine": {
73
+ "type": "command",
74
+ "command": "bun /Users/melvynx/.claude/scripts/statusline/src/index.ts",
75
+ "padding": 0
76
+ }
77
+ }
78
+ ```
79
+
80
+ ## Testing
81
+
82
+ ```bash
83
+ echo '{
84
+ "session_id": "test",
85
+ "transcript_path": "/path/to/transcript.jsonl",
86
+ "cwd": "/path",
87
+ "model": {
88
+ "id": "claude-sonnet-4-5",
89
+ "display_name": "Sonnet 4.5"
90
+ },
91
+ "workspace": {
92
+ "current_dir": "/path",
93
+ "project_dir": "/path"
94
+ },
95
+ "version": "2.0.31",
96
+ "output_style": { "name": "default" },
97
+ "cost": {
98
+ "total_cost_usd": 0.15,
99
+ "total_duration_ms": 300000,
100
+ "total_api_duration_ms": 200000,
101
+ "total_lines_added": 100,
102
+ "total_lines_removed": 50
103
+ }
104
+ }' | bun run start
105
+ ```