cc-sidebar 0.1.5 → 0.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.
package/README.md CHANGED
@@ -90,11 +90,37 @@ Data is stored in `~/.claude-sidebar/`:
90
90
 
91
91
  ## Claude Code Setup
92
92
 
93
- Two optional integrations to make Claude aware of the sidebar:
93
+ Three optional integrations to make Claude aware of the sidebar:
94
94
 
95
- ### 1. Auto-completion (Recommended)
95
+ ### 1. TodoWrite Sync Hook (Recommended)
96
96
 
97
- Add this to your `~/.claude/CLAUDE.md` so Claude automatically marks sidebar tasks as done:
97
+ This hook syncs Claude's TodoWrite output to the sidebar, so you can see Claude's progress in real-time.
98
+
99
+ Add to your `~/.claude/settings.json`:
100
+
101
+ ```json
102
+ {
103
+ "hooks": {
104
+ "PostToolUse": [
105
+ {
106
+ "matcher": "TodoWrite",
107
+ "hooks": [
108
+ {
109
+ "type": "command",
110
+ "command": "bun ~/.bun/install/global/node_modules/cc-sidebar/src/sync-todos.ts"
111
+ }
112
+ ]
113
+ }
114
+ ]
115
+ }
116
+ }
117
+ ```
118
+
119
+ If you already have other hooks, merge the `PostToolUse` array with your existing hooks.
120
+
121
+ ### 2. Auto-completion (Optional)
122
+
123
+ Add this to your `~/.claude/CLAUDE.md` so Claude automatically marks sidebar tasks as done when it finishes work:
98
124
 
99
125
  ```markdown
100
126
  ## Sidebar Integration
@@ -122,13 +148,13 @@ Keep it simple - if no clear match, don't move anything. User can manually mark
122
148
  ```
123
149
  ```
124
150
 
125
- ### 2. Install Skills (Recommended)
151
+ ### 3. Install Skills
126
152
 
127
153
  cc-sidebar includes skills that integrate with Claude Code:
128
154
 
129
155
  | Skill | Trigger | What it does |
130
156
  |-------|---------|--------------|
131
- | `/brain-dump` | `/brain-dump` | Interview to extract tasks from messy thoughts, creates plan + todos |
157
+ | `/clarify` | `/clarify` | Interview to clarify tasks, creates plan + todos (works for new or existing tasks) |
132
158
  | `/prioritize` | `/prioritize` | Re-prioritize all sidebar tasks as a staff engineer |
133
159
  | `sidebar-awareness` | (always on) | Gives Claude context about sidebar data files |
134
160
 
@@ -142,7 +168,7 @@ cp -r ~/.bun/install/global/node_modules/cc-sidebar/skills/* ~/.claude/skills/
142
168
  Or install individually:
143
169
 
144
170
  ```bash
145
- cp -r ~/.bun/install/global/node_modules/cc-sidebar/skills/brain-dump ~/.claude/skills/
171
+ cp -r ~/.bun/install/global/node_modules/cc-sidebar/skills/clarify ~/.claude/skills/
146
172
  cp -r ~/.bun/install/global/node_modules/cc-sidebar/skills/prioritize ~/.claude/skills/
147
173
  ```
148
174
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-sidebar",
3
- "version": "0.1.5",
3
+ "version": "0.1.8",
4
4
  "description": "Visual sidebar for managing todos, tasks, and context alongside Claude Code",
5
5
  "author": "Tyler Nishida",
6
6
  "license": "MIT",
@@ -24,7 +24,8 @@
24
24
  "files": [
25
25
  "src",
26
26
  "skills",
27
- "commands"
27
+ "commands",
28
+ "scripts"
28
29
  ],
29
30
  "scripts": {
30
31
  "start": "bun run src/cli.ts",
@@ -0,0 +1,61 @@
1
+ #!/bin/bash
2
+ # Claude Code statusline script for claude-sidebar
3
+ # Receives JSON from Claude Code via stdin, extracts key metrics, writes to shared file
4
+ #
5
+ # Install: Add to ~/.claude/settings.json:
6
+ # { "statusline": { "script": "/path/to/claude-sidebar/scripts/statusline.sh" } }
7
+
8
+ set -e
9
+
10
+ # Read JSON from stdin
11
+ input=$(cat)
12
+
13
+ # Extract context window data
14
+ CTX_SIZE=$(echo "$input" | jq -r '.context_window.context_window_size // 200000')
15
+ USAGE=$(echo "$input" | jq -r '.context_window.current_usage // {}')
16
+ INPUT_TOKENS=$(echo "$USAGE" | jq -r '(.input_tokens // 0) + (.cache_creation_input_tokens // 0) + (.cache_read_input_tokens // 0)')
17
+ OUTPUT_TOKENS=$(echo "$input" | jq -r '.context_window.current_usage.output_tokens // 0')
18
+
19
+ # Calculate context percentage (input + output tokens)
20
+ TOTAL_TOKENS=$((INPUT_TOKENS + OUTPUT_TOKENS))
21
+ if [ "$CTX_SIZE" -gt 0 ]; then
22
+ CTX_PERCENT=$((TOTAL_TOKENS * 100 / CTX_SIZE))
23
+ else
24
+ CTX_PERCENT=0
25
+ fi
26
+
27
+ # Extract cost and duration
28
+ COST=$(echo "$input" | jq -r '.cost.total_cost_usd // 0')
29
+ DURATION_MS=$(echo "$input" | jq -r '.cost.total_duration_ms // 0')
30
+ DURATION_MIN=$((DURATION_MS / 60000))
31
+
32
+ # Extract model
33
+ MODEL=$(echo "$input" | jq -r '.model.display_name // "Unknown"')
34
+
35
+ # Get project directory and git info
36
+ PROJECT_DIR=$(echo "$input" | jq -r '.workspace.project_dir // ""')
37
+ BRANCH=""
38
+ REPO=""
39
+ if [ -n "$PROJECT_DIR" ] && [ -d "$PROJECT_DIR" ]; then
40
+ cd "$PROJECT_DIR" 2>/dev/null || true
41
+ BRANCH=$(git branch --show-current 2>/dev/null || echo "")
42
+ REPO=$(basename "$PROJECT_DIR")
43
+ fi
44
+
45
+ # Ensure directory exists
46
+ mkdir -p ~/.claude-sidebar
47
+
48
+ # Write processed data
49
+ cat > ~/.claude-sidebar/statusline.json << EOF
50
+ {
51
+ "contextPercent": $CTX_PERCENT,
52
+ "contextTokens": $TOTAL_TOKENS,
53
+ "contextSize": $CTX_SIZE,
54
+ "costUsd": $COST,
55
+ "durationMin": $DURATION_MIN,
56
+ "model": "$MODEL",
57
+ "branch": "$BRANCH",
58
+ "repo": "$REPO",
59
+ "updatedAt": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
60
+ }
61
+ EOF
@@ -0,0 +1,247 @@
1
+ ---
2
+ name: clarify
3
+ description: |
4
+ Clarify tasks through deep conversation - works for new ideas or existing sidebar tasks.
5
+
6
+ Use when: (1) You have thoughts/ideas that need clarification before becoming actionable,
7
+ (2) You want to clarify a single task through conversation,
8
+ (3) The sidebar sends a task for clarification (via `c` key).
9
+
10
+ Triggers: "/clarify", "clarify this", "let me explain this task".
11
+
12
+ Requires: Claude Code sidebar for todo integration.
13
+ ---
14
+
15
+ # Clarify Skill
16
+
17
+ Clarify tasks through structured, in-depth conversation. Creates a **spec for each todo** (not a shared plan).
18
+
19
+ ## Invocation
20
+
21
+ - `/clarify` - Start interviewing from scratch
22
+ - `/clarify [text]` - Clarify provided text (single task or many)
23
+ - `/clarify --task-id <id> [task content]` - Clarify existing sidebar task (sent by sidebar `c` key)
24
+
25
+ ## Process
26
+
27
+ ### 1. Detect Mode
28
+
29
+ Check if invoked with `--task-id`:
30
+ - **With task ID**: Updating an existing sidebar task
31
+ - **Without task ID**: Creating new todo(s) from scratch
32
+
33
+ ### 2. Interview Phase
34
+
35
+ **Interview me in detail using AskUserQuestion about literally anything:**
36
+ - Technical implementation details
37
+ - UI & UX considerations
38
+ - Concerns and risks
39
+ - Tradeoffs between approaches
40
+ - Edge cases and error handling
41
+ - Dependencies and blockers
42
+ - Success criteria
43
+
44
+ **CRITICAL RULES:**
45
+ - Make sure questions are NOT obvious - don't ask things that are clear from context
46
+ - Be very in-depth - continue interviewing continually until complete
47
+ - Multiple rounds of questions are expected and encouraged
48
+ - Always end with "Anything else I should know?" as a final question
49
+
50
+ **If the user provided text** (`/clarify [text]`):
51
+ - Skip opening invitation - go straight to clarifying questions
52
+
53
+ **If no text was provided** (`/clarify` alone):
54
+ - Start with: "What's on your mind? Tell me everything - tasks, concerns, ideas, whatever's floating around."
55
+ - Let them ramble, then ask clarifying questions
56
+
57
+ ### 3. Write Spec for Each Todo
58
+
59
+ After interviewing, create a **spec for each todo**. The spec is stored directly on the task (in the `spec` field), not in a separate plan file.
60
+
61
+ **Spec format:**
62
+ ```
63
+ ## [Task Title]
64
+
65
+ ### What
66
+ [Clear description of what needs to be done]
67
+
68
+ ### Why
69
+ [The purpose/motivation]
70
+
71
+ ### How
72
+ [Implementation approach based on interview]
73
+
74
+ ### Acceptance Criteria
75
+ - [ ] Criterion 1
76
+ - [ ] Criterion 2
77
+
78
+ ### Notes
79
+ [Any constraints, risks, or considerations from interview]
80
+ ```
81
+
82
+ ### 4. Update or Create Todos
83
+
84
+ **If updating existing task** (has `--task-id`):
85
+
86
+ ```bash
87
+ node << 'SCRIPT'
88
+ const fs = require('fs');
89
+ const crypto = require('crypto');
90
+ const path = require('path');
91
+ const sidebarDir = path.join(require('os').homedir(), '.claude-sidebar');
92
+ const hash = crypto.createHash('sha256').update(process.cwd()).digest('hex').slice(0, 12);
93
+ const tasksPath = path.join(sidebarDir, 'projects', hash, 'tasks.json');
94
+ let tasks = JSON.parse(fs.readFileSync(tasksPath, 'utf-8'));
95
+ const task = tasks.find(t => t.id === 'TASK_ID_HERE'); // REPLACE with actual task ID
96
+ if (task) {
97
+ task.clarified = true;
98
+ task.section = 'clarified';
99
+ task.spec = `SPEC_CONTENT_HERE`; // REPLACE with actual spec
100
+ fs.writeFileSync(tasksPath, JSON.stringify(tasks, null, 2));
101
+ console.log('Task clarified with spec');
102
+ }
103
+ SCRIPT
104
+ ```
105
+
106
+ **If creating new todos** (no `--task-id`):
107
+
108
+ Extract discrete, actionable tasks. Each todo should be:
109
+ - **Specific**: Clear what needs to be done
110
+ - **Actionable**: Can be worked on independently
111
+ - **Has a spec**: Detailed specification from interview
112
+
113
+ **Prioritization (act as staff engineer):**
114
+ - Dependencies first (blockers)
115
+ - Urgency (bugs, deadlines)
116
+ - Impact (high-value over nice-to-have)
117
+ - Quick wins for momentum
118
+
119
+ Mark top 3 as "recommended".
120
+
121
+ ```bash
122
+ node << 'SCRIPT'
123
+ const fs = require('fs');
124
+ const crypto = require('crypto');
125
+ const path = require('path');
126
+
127
+ const sidebarDir = path.join(require('os').homedir(), '.claude-sidebar');
128
+ const hash = crypto.createHash('sha256').update(process.cwd()).digest('hex').slice(0, 12);
129
+ const projectDir = path.join(sidebarDir, 'projects', hash);
130
+ const tasksPath = path.join(projectDir, 'tasks.json');
131
+
132
+ fs.mkdirSync(projectDir, { recursive: true });
133
+
134
+ let existing = [];
135
+ try { existing = JSON.parse(fs.readFileSync(tasksPath, 'utf-8')); } catch {}
136
+
137
+ // REPLACE with extracted tasks - each has its own spec
138
+ const newTodos = [
139
+ {
140
+ content: "Task 1 here",
141
+ priority: 1,
142
+ recommended: true,
143
+ spec: `## Task 1\n\n### What\n...\n\n### Why\n...\n\n### How\n...\n\n### Acceptance Criteria\n- [ ] ...`
144
+ },
145
+ // ... more tasks
146
+ ].map(task => ({
147
+ id: crypto.randomUUID(),
148
+ content: task.content,
149
+ createdAt: new Date().toISOString(),
150
+ section: 'clarified',
151
+ clarified: true,
152
+ priority: task.priority,
153
+ recommended: task.recommended,
154
+ spec: task.spec
155
+ }));
156
+
157
+ const combined = [...existing, ...newTodos];
158
+ fs.writeFileSync(tasksPath, JSON.stringify(combined, null, 2));
159
+ console.log('Added ' + newTodos.length + ' clarified todos to sidebar');
160
+ SCRIPT
161
+ ```
162
+
163
+ ### 5. Present and Prompt
164
+
165
+ After creating/updating todos:
166
+
167
+ 1. Show summary of what was clarified
168
+ 2. Show the spec for each task
169
+ 3. Ask: **"Execute this task now, or save for later?"**
170
+ - Execute → start working immediately
171
+ - Save → confirm clarified and stop
172
+
173
+ **Example output:**
174
+ ```
175
+ Clarified 2 todos:
176
+
177
+ 1. ★ Implement user authentication
178
+ Spec: JWT-based auth with 24hr expiry, refresh tokens...
179
+
180
+ 2. ★ Add rate limiting to API
181
+ Spec: 100 req/min per user, 429 response, Redis backend...
182
+
183
+ Execute the first task now, or save for later?
184
+ ```
185
+
186
+ ## Relationship to Other Skills
187
+
188
+ | Skill | Purpose |
189
+ |-------|---------|
190
+ | `/clarify` | Interview and write spec for task(s) |
191
+ | `/prioritize` | Re-evaluate all tasks as staff engineer |
192
+ | Atomic Plans | Track execution progress when working on task |
193
+
194
+ **Flow:**
195
+ 1. **Clarify** creates specs (the "what")
196
+ 2. **Prioritize** decides what's next
197
+ 3. **Atomic Plans** tracks execution (the "how/progress")
198
+
199
+ ## Example Session
200
+
201
+ ```
202
+ User: /clarify I need to add dark mode support
203
+
204
+ Claude: [AskUserQuestion]
205
+ - Should this affect the entire app or just certain components?
206
+ - Do you want system preference detection (prefers-color-scheme)?
207
+ - Are there specific colors/themes you want, or should I design them?
208
+ - Should the preference persist across sessions (localStorage)?
209
+
210
+ User: [Answers each question]
211
+
212
+ Claude: [AskUserQuestion - follow-up]
213
+ - For the color palette, do you have brand colors to work with?
214
+ - Should transitions be animated when switching themes?
215
+ - Any components that should NOT support dark mode?
216
+ - Anything else I should know?
217
+
218
+ User: [Answers]
219
+
220
+ Claude: [Creates todo with spec]
221
+
222
+ Clarified 1 todo:
223
+
224
+ ★ Add dark mode support
225
+ Spec:
226
+ ## Dark Mode Support
227
+
228
+ ### What
229
+ Add system-wide dark mode toggle with OS preference detection
230
+
231
+ ### Why
232
+ User requested for better nighttime usability
233
+
234
+ ### How
235
+ - CSS custom properties for colors
236
+ - React context for theme state
237
+ - localStorage for persistence
238
+ - prefers-color-scheme media query for initial
239
+
240
+ ### Acceptance Criteria
241
+ - [ ] Toggle switches between light/dark
242
+ - [ ] Respects OS preference on first visit
243
+ - [ ] Persists choice in localStorage
244
+ - [ ] Smooth transition animation
245
+
246
+ Execute this task now, or save for later?
247
+ ```
@@ -51,6 +51,8 @@ As a staff engineer, evaluate each task considering:
51
51
  - **Impact**: High-value features over nice-to-haves.
52
52
  - **Effort**: Quick wins can build momentum; large tasks may need breakdown.
53
53
  - **Context**: If user provided context, weight it heavily.
54
+ - **Specs**: Read the `spec` field of clarified tasks for detailed requirements.
55
+ - **Section**: Clarified tasks (with specs) are generally ready to execute.
54
56
 
55
57
  Assign each task:
56
58
  - `priority`: Numeric (1 = most important, higher = less important)
@@ -124,9 +126,18 @@ Other tasks:
124
126
  Tasks have been re-prioritized in your sidebar.
125
127
  ```
126
128
 
129
+ ## Skill Flow
130
+
131
+ This skill is part of a chain:
132
+
133
+ 1. **Clarify** → Creates specs for each task (the "what")
134
+ 2. **Prioritize** → Staff engineer decides what's next (this skill)
135
+ 3. **Atomic Plans** → Track execution progress when working
136
+
127
137
  ## Notes
128
138
 
129
139
  - This skill reads and modifies the sidebar's tasks.json directly
130
- - It preserves all existing task fields (id, content, clarified, planPath, etc.)
140
+ - It preserves all existing task fields (id, content, clarified, spec, etc.)
131
141
  - Only updates `priority` and `recommended` fields
132
142
  - Can be run anytime - safe to run multiple times
143
+ - Read specs to understand task complexity when prioritizing