claudepod 1.1.2 → 1.2.1
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/.devcontainer/.env +18 -0
- package/.devcontainer/CHANGELOG.md +68 -0
- package/.devcontainer/CLAUDE.md +100 -0
- package/.devcontainer/README.md +220 -0
- package/.devcontainer/config/main-system-prompt.md +118 -0
- package/.devcontainer/config/settings.json +41 -0
- package/.devcontainer/devcontainer.json +71 -113
- package/.devcontainer/features/README.md +113 -0
- package/.devcontainer/features/ast-grep/README.md +24 -0
- package/.devcontainer/features/ast-grep/devcontainer-feature.json +24 -0
- package/.devcontainer/features/ast-grep/install.sh +51 -0
- package/.devcontainer/features/ccstatusline/README.md +296 -0
- package/.devcontainer/features/ccstatusline/devcontainer-feature.json +19 -0
- package/.devcontainer/features/ccstatusline/install.sh +290 -0
- package/.devcontainer/features/ccusage/README.md +205 -0
- package/.devcontainer/features/ccusage/devcontainer-feature.json +38 -0
- package/.devcontainer/features/ccusage/install.sh +132 -0
- package/.devcontainer/features/claude-code/README.md +498 -0
- package/.devcontainer/features/claude-code/config/settings.json +36 -0
- package/.devcontainer/features/claude-code/config/system-prompt.md +118 -0
- package/.devcontainer/features/claude-code/config/world-building-sp.md +1432 -0
- package/.devcontainer/features/claude-code/devcontainer-feature.json +42 -0
- package/.devcontainer/features/claude-code/install.sh +466 -0
- package/.devcontainer/features/claude-monitor/README.md +74 -0
- package/.devcontainer/features/claude-monitor/devcontainer-feature.json +38 -0
- package/.devcontainer/features/claude-monitor/install.sh +99 -0
- package/.devcontainer/features/lsp-servers/README.md +85 -0
- package/.devcontainer/features/lsp-servers/devcontainer-feature.json +34 -0
- package/.devcontainer/features/lsp-servers/install.sh +92 -0
- package/.devcontainer/features/mcp-qdrant/CHANGES.md +399 -0
- package/.devcontainer/features/mcp-qdrant/README.md +474 -0
- package/.devcontainer/features/mcp-qdrant/devcontainer-feature.json +57 -0
- package/.devcontainer/features/mcp-qdrant/install.sh +295 -0
- package/.devcontainer/features/mcp-qdrant/poststart-hook.sh +129 -0
- package/.devcontainer/features/mcp-reasoner/README.md +177 -0
- package/.devcontainer/features/mcp-reasoner/devcontainer-feature.json +20 -0
- package/.devcontainer/features/mcp-reasoner/install.sh +177 -0
- package/.devcontainer/features/mcp-reasoner/poststart-hook.sh +67 -0
- package/.devcontainer/features/splitrail/README.md +140 -0
- package/.devcontainer/features/splitrail/devcontainer-feature.json +34 -0
- package/.devcontainer/features/splitrail/install.sh +129 -0
- package/.devcontainer/features/tree-sitter/README.md +138 -0
- package/.devcontainer/features/tree-sitter/devcontainer-feature.json +52 -0
- package/.devcontainer/features/tree-sitter/install.sh +173 -0
- package/.devcontainer/scripts/setup-aliases.sh +52 -0
- package/.devcontainer/scripts/setup-config.sh +28 -0
- package/.devcontainer/scripts/setup-irie-claude.sh +32 -0
- package/.devcontainer/scripts/setup-lsp.sh +20 -0
- package/.devcontainer/scripts/setup-plugins.sh +31 -0
- package/.devcontainer/scripts/setup.sh +60 -0
- package/README.md +153 -187
- package/package.json +5 -9
- package/setup.js +2 -2
- package/.devcontainer/config/claude/mcp.json +0 -76
- package/.devcontainer/config/claude/mcp.json.template +0 -117
- package/.devcontainer/config/claude/output-styles/strict-development.md +0 -158
- package/.devcontainer/config/claude/settings.json +0 -10
- package/.devcontainer/config/claude/system-prompt.md +0 -3
- package/.devcontainer/config/searxng/ods_config.json +0 -22
- package/.devcontainer/config/searxng/searxng_env_template +0 -71
- package/.devcontainer/config/serena/serena_config.yml +0 -72
- package/.devcontainer/config/taskmaster/config.json +0 -37
- package/.devcontainer/ods_config.json +0 -21
- package/.devcontainer/post-create.sh +0 -1077
- package/.devcontainer/post-start.sh +0 -551
- package/.devcontainer/sanitize-system-prompt.sh +0 -31
- package/.devcontainer/scripts/config/claude-core.sh +0 -210
- package/.devcontainer/scripts/config/searxng.sh +0 -411
- package/.devcontainer/scripts/config/serena.sh +0 -47
- package/.devcontainer/scripts/config/taskmaster.sh +0 -41
- package/.devcontainer/scripts/generate-mcp-config.js +0 -205
- package/.devcontainer/scripts/install/claude-code.sh +0 -112
- package/.devcontainer/scripts/shell/zsh-config.sh +0 -271
- package/.devcontainer/scripts/utils.sh +0 -44
- package/.devcontainer/setup-zsh.sh +0 -234
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
# ccstatusline Feature
|
|
2
|
+
|
|
3
|
+
A DevContainer Feature that installs and configures [ccstatusline](https://github.com/sirmalloc/ccstatusline) - a compact powerline status line for Claude Code with essential metrics.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"features": {
|
|
10
|
+
"ghcr.io/devcontainers/features/node:1": {},
|
|
11
|
+
"ghcr.io/devcontainers/features/common-utils:2": {},
|
|
12
|
+
"./features/ccstatusline": {}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Note:** This feature requires Node.js and common-utils features to be installed first.
|
|
18
|
+
|
|
19
|
+
## Options
|
|
20
|
+
|
|
21
|
+
| Option | Type | Default | Description |
|
|
22
|
+
|--------|------|---------|-------------|
|
|
23
|
+
| `username` | string | `automatic` | User to install for (auto-detects: vscode, node, codespace, or root) |
|
|
24
|
+
|
|
25
|
+
## Display Format
|
|
26
|
+
|
|
27
|
+
### Line 1: Core Metrics
|
|
28
|
+
```
|
|
29
|
+
Model: Opus 4.1 ▶ Ctx: 58.5k ▶ main ▶ (+19, -2) ▶ v1.0.86
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- **Model** (maroon bg, white text, bold): Current AI model
|
|
33
|
+
- **Context** (gold bg, black text, bold): Context window size
|
|
34
|
+
- **Git Branch** (blue bg, white text): Active branch
|
|
35
|
+
- **Git Changes** (pink bg, white text): Lines added/removed
|
|
36
|
+
- **Version** (light pink bg, white text): Claude Code version
|
|
37
|
+
|
|
38
|
+
### Line 2: Location & Cost
|
|
39
|
+
```
|
|
40
|
+
cwd: .../workspaces/project ▶ Cost: $0.39
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
- **Working Directory** (gold bg, black text): Current directory path
|
|
44
|
+
- **Session Cost** (gold bg, black text, bold): Total session cost in USD
|
|
45
|
+
|
|
46
|
+
All widgets connected with powerline arrows for a seamless, professional appearance.
|
|
47
|
+
|
|
48
|
+
## What This Feature Installs
|
|
49
|
+
|
|
50
|
+
- **ccstatusline npm package**: Installed on-demand via `npx` (not globally)
|
|
51
|
+
- **Configuration file**: `~/.config/ccstatusline/settings.json` with powerline theme
|
|
52
|
+
- **Claude Code integration**: Automatically updates `.claude/settings.json`
|
|
53
|
+
- **Disk Usage**: Minimal (~2MB when cached by npx)
|
|
54
|
+
|
|
55
|
+
## Requirements
|
|
56
|
+
|
|
57
|
+
This feature has explicit dependencies that **must** be installed first:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"features": {
|
|
62
|
+
"ghcr.io/devcontainers/features/node:1": {},
|
|
63
|
+
"ghcr.io/devcontainers/features/common-utils:2": {},
|
|
64
|
+
"./features/ccstatusline": {}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Required:**
|
|
70
|
+
- **Node.js + npm/npx**: For running ccstatusline package
|
|
71
|
+
- **jq**: For safe JSON generation (from common-utils)
|
|
72
|
+
|
|
73
|
+
The feature will validate these are present and exit with an error if missing.
|
|
74
|
+
|
|
75
|
+
## Features
|
|
76
|
+
|
|
77
|
+
- ✅ **Powerline Mode**: Seamless arrow separators between widgets
|
|
78
|
+
- ✅ **Compact Layout**: 2 clean lines with essential metrics
|
|
79
|
+
- ✅ **7 Key Widgets**: Model, context, git status, version, directory, cost
|
|
80
|
+
- ✅ **Vibrant Colors**: High-contrast truecolor (24-bit hex) optimized for dark terminals
|
|
81
|
+
- ✅ **Automatic Integration**: Auto-configures `.claude/settings.json`
|
|
82
|
+
- ✅ **Idempotent**: Safe to run multiple times
|
|
83
|
+
- ✅ **Multi-user**: Automatically detects container user
|
|
84
|
+
|
|
85
|
+
## Post-Installation Steps
|
|
86
|
+
|
|
87
|
+
### ✅ Configuration is Automatic
|
|
88
|
+
|
|
89
|
+
This feature automatically:
|
|
90
|
+
1. Creates `~/.config/ccstatusline/settings.json` with powerline configuration
|
|
91
|
+
2. Configures `.claude/settings.json` to use ccstatusline
|
|
92
|
+
|
|
93
|
+
**No manual steps required!**
|
|
94
|
+
|
|
95
|
+
### Verify It Worked
|
|
96
|
+
|
|
97
|
+
**1. Check configuration:**
|
|
98
|
+
```bash
|
|
99
|
+
cat ~/.config/ccstatusline/settings.json | jq .
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**2. Test manually:**
|
|
103
|
+
```bash
|
|
104
|
+
echo '{"model":{"display_name":"Test Model"}}' | npx -y ccstatusline@latest
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
You should see formatted output with powerline styling.
|
|
108
|
+
|
|
109
|
+
**3. Check Claude Code integration:**
|
|
110
|
+
```bash
|
|
111
|
+
cat /workspaces/.claude/settings.json | jq '.statusLine'
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Should show:
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"type": "command",
|
|
118
|
+
"command": "npx -y ccstatusline@latest"
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Customization
|
|
123
|
+
|
|
124
|
+
### Modify Configuration After Installation
|
|
125
|
+
|
|
126
|
+
Edit the configuration file:
|
|
127
|
+
```bash
|
|
128
|
+
vim ~/.config/ccstatusline/settings.json
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Important:** Changes to runtime config are lost on container rebuild. To persist changes, modify the feature's `install.sh` file where the JSON is generated (lines 60-80).
|
|
132
|
+
|
|
133
|
+
### Widget Configuration Format
|
|
134
|
+
|
|
135
|
+
Widgets are configured in the `lines` array:
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"id": "unique-id",
|
|
140
|
+
"type": "widget-type",
|
|
141
|
+
"color": "#FFFFFF", // Foreground (hex)
|
|
142
|
+
"bgColor": "#000000", // Background (hex)
|
|
143
|
+
"bold": true // Optional: bold text
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Available Widget Types
|
|
148
|
+
|
|
149
|
+
**Session Metrics:**
|
|
150
|
+
- `model` - Current AI model
|
|
151
|
+
- `session-clock` - Session elapsed time
|
|
152
|
+
- `session-cost` - Total session cost (USD)
|
|
153
|
+
- `block-timer` - Block execution time
|
|
154
|
+
- `output-style` - Current output style
|
|
155
|
+
|
|
156
|
+
**Context Tracking:**
|
|
157
|
+
- `context-length` - Context window size
|
|
158
|
+
- `context-percentage` - Context usage percentage
|
|
159
|
+
- `context-percentage-usable` - Usable context percentage
|
|
160
|
+
|
|
161
|
+
**Token Metrics:**
|
|
162
|
+
- `tokens-input` - Input tokens
|
|
163
|
+
- `tokens-output` - Output tokens
|
|
164
|
+
- `tokens-cached` - Cached tokens
|
|
165
|
+
- `tokens-total` - Total tokens
|
|
166
|
+
|
|
167
|
+
**Git Integration:**
|
|
168
|
+
- `git-branch` - Current branch
|
|
169
|
+
- `git-changes` - Lines added/removed
|
|
170
|
+
- `git-worktree` - Git worktree info
|
|
171
|
+
|
|
172
|
+
**Other:**
|
|
173
|
+
- `cwd` - Current working directory
|
|
174
|
+
- `version` - Claude Code version
|
|
175
|
+
- `custom-text` - Static text
|
|
176
|
+
- `custom-command` - Command output
|
|
177
|
+
|
|
178
|
+
### Color Scheme
|
|
179
|
+
|
|
180
|
+
The default powerline theme uses:
|
|
181
|
+
|
|
182
|
+
- **Maroon** (`#9B4F5C`): Model name - bold, authoritative
|
|
183
|
+
- **Gold** (`#FFD700`): Context, directory, cost - attention-grabbing
|
|
184
|
+
- **Blue** (`#4A90E2`): Git branch - clear, standard
|
|
185
|
+
- **Pink/Magenta** (`#D888C8`, `#E8A8C8`): Git changes and version - distinctive
|
|
186
|
+
- **White** (`#FFFFFF`): Text on dark backgrounds
|
|
187
|
+
- **Black** (`#1E1E1E`): Text on gold background
|
|
188
|
+
|
|
189
|
+
All colors selected for excellent readability on dark terminal themes with proper contrast ratios.
|
|
190
|
+
|
|
191
|
+
## Troubleshooting
|
|
192
|
+
|
|
193
|
+
### Status Line Doesn't Appear
|
|
194
|
+
|
|
195
|
+
**Symptom:** Claude Code starts but no status line visible
|
|
196
|
+
|
|
197
|
+
**Solution:**
|
|
198
|
+
```bash
|
|
199
|
+
# 1. Verify config exists
|
|
200
|
+
cat ~/.config/ccstatusline/settings.json | jq .
|
|
201
|
+
|
|
202
|
+
# 2. Test manually
|
|
203
|
+
echo '{"model":{"display_name":"Test"}}' | npx -y ccstatusline@latest
|
|
204
|
+
|
|
205
|
+
# 3. Check Claude Code settings
|
|
206
|
+
cat /workspaces/.claude/settings.json | jq '.statusLine'
|
|
207
|
+
|
|
208
|
+
# 4. Manually run auto-config if needed
|
|
209
|
+
configure-ccstatusline-auto
|
|
210
|
+
|
|
211
|
+
# 5. Restart Claude Code
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Installation Fails: "npm/npx not available"
|
|
215
|
+
|
|
216
|
+
**Cause:** Node.js feature not installed first
|
|
217
|
+
|
|
218
|
+
**Solution:**
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"features": {
|
|
222
|
+
"ghcr.io/devcontainers/features/node:1": {},
|
|
223
|
+
"./features/ccstatusline": {}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Installation Fails: "jq not available"
|
|
229
|
+
|
|
230
|
+
**Cause:** common-utils feature not installed
|
|
231
|
+
|
|
232
|
+
**Solution:**
|
|
233
|
+
```json
|
|
234
|
+
{
|
|
235
|
+
"features": {
|
|
236
|
+
"ghcr.io/devcontainers/features/common-utils:2": {},
|
|
237
|
+
"./features/ccstatusline": {}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Display Issues (Broken Arrows, Colors)
|
|
243
|
+
|
|
244
|
+
**Cause:** Terminal doesn't support powerline fonts or truecolor
|
|
245
|
+
|
|
246
|
+
**Solutions:**
|
|
247
|
+
1. Install powerline fonts in your terminal
|
|
248
|
+
2. Check terminal supports 24-bit color (truecolor)
|
|
249
|
+
3. For VS Code: Ensure using a powerline-compatible font like "Cascadia Code PL" or "MesloLGS NF"
|
|
250
|
+
|
|
251
|
+
### Performance Issues (Slow Refresh)
|
|
252
|
+
|
|
253
|
+
**Cause:** `npx` downloads package on each run
|
|
254
|
+
|
|
255
|
+
**Solution:** Install globally for faster execution:
|
|
256
|
+
```bash
|
|
257
|
+
npm install -g ccstatusline@latest
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Then update `.claude/settings.json`:
|
|
261
|
+
```json
|
|
262
|
+
{
|
|
263
|
+
"statusLine": {
|
|
264
|
+
"type": "command",
|
|
265
|
+
"command": "ccstatusline"
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Permission Errors
|
|
271
|
+
|
|
272
|
+
**Symptom:** "Permission denied" on config file
|
|
273
|
+
|
|
274
|
+
**Solution:**
|
|
275
|
+
```bash
|
|
276
|
+
# Check ownership
|
|
277
|
+
ls -la ~/.config/ccstatusline/settings.json
|
|
278
|
+
|
|
279
|
+
# Fix if needed (replace 'vscode' with your username)
|
|
280
|
+
sudo chown -R vscode:vscode ~/.config/ccstatusline/
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Resources
|
|
284
|
+
|
|
285
|
+
- [ccstatusline GitHub](https://github.com/sirmalloc/ccstatusline)
|
|
286
|
+
- [ccstatusline npm package](https://www.npmjs.com/package/ccstatusline)
|
|
287
|
+
- [Claude Code Documentation](https://docs.claude.com/en/docs/claude-code/statusline)
|
|
288
|
+
- [Powerline Fonts](https://github.com/powerline/fonts)
|
|
289
|
+
|
|
290
|
+
## License
|
|
291
|
+
|
|
292
|
+
This feature configuration is MIT licensed. The ccstatusline package has its own license (see npm package).
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
**Part of your DevContainer Features collection**
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "ccstatusline",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"name": "ccstatusline",
|
|
5
|
+
"description": "Compact powerline status line for Claude Code with essential metrics",
|
|
6
|
+
"maintainer": "AnExiledDev",
|
|
7
|
+
"documentationURL": "https://github.com/sirmalloc/ccstatusline",
|
|
8
|
+
"options": {
|
|
9
|
+
"username": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Container user to install for",
|
|
12
|
+
"default": "automatic"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"installsAfter": [
|
|
16
|
+
"ghcr.io/devcontainers/features/node:1",
|
|
17
|
+
"ghcr.io/devcontainers/features/common-utils:2"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Cleanup on exit
|
|
5
|
+
cleanup() {
|
|
6
|
+
rm -f /tmp/ccstatusline-*.json 2>/dev/null || true
|
|
7
|
+
}
|
|
8
|
+
trap cleanup EXIT
|
|
9
|
+
|
|
10
|
+
# Import options from devcontainer-feature.json
|
|
11
|
+
# NOTE: DevContainer converts camelCase options to UPPERCASE without underscores
|
|
12
|
+
USERNAME="${USERNAME:-automatic}"
|
|
13
|
+
|
|
14
|
+
echo "[ccstatusline] Starting installation..."
|
|
15
|
+
|
|
16
|
+
# Source NVM (Node is installed via NVM by the node feature)
|
|
17
|
+
if [ -f /usr/local/share/nvm/nvm.sh ]; then
|
|
18
|
+
source /usr/local/share/nvm/nvm.sh
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# Validate jq is available (required for JSON generation)
|
|
22
|
+
if ! command -v jq &>/dev/null; then
|
|
23
|
+
echo "[ccstatusline] ERROR: jq is not available"
|
|
24
|
+
echo " Install common-utils feature first"
|
|
25
|
+
exit 1
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# Validate npm/npx is available
|
|
29
|
+
if ! command -v npm &>/dev/null && ! command -v npx &>/dev/null; then
|
|
30
|
+
echo "[ccstatusline] ERROR: npm/npx is not available"
|
|
31
|
+
echo " Install node feature first"
|
|
32
|
+
echo " NVM path: /usr/local/share/nvm/nvm.sh"
|
|
33
|
+
exit 1
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# Determine the user
|
|
37
|
+
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
|
|
38
|
+
USERNAME=""
|
|
39
|
+
for CURRENT_USER in vscode node codespace; do
|
|
40
|
+
if id -u "${CURRENT_USER}" >/dev/null 2>&1; then
|
|
41
|
+
USERNAME=${CURRENT_USER}
|
|
42
|
+
break
|
|
43
|
+
fi
|
|
44
|
+
done
|
|
45
|
+
[ -z "${USERNAME}" ] && USERNAME=root
|
|
46
|
+
elif [ "${USERNAME}" = "none" ] || ! id -u "${USERNAME}" >/dev/null 2>&1; then
|
|
47
|
+
USERNAME=root
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
echo "[ccstatusline] Installing for user: ${USERNAME}"
|
|
51
|
+
|
|
52
|
+
# Get user's home directory
|
|
53
|
+
USER_HOME=$(eval echo ~${USERNAME})
|
|
54
|
+
|
|
55
|
+
# Check if ccstatusline is available
|
|
56
|
+
if sudo -u "${USERNAME}" bash -c 'npx -y ccstatusline@latest --version' &>/dev/null 2>&1; then
|
|
57
|
+
echo "[ccstatusline] ccstatusline already available via npx"
|
|
58
|
+
else
|
|
59
|
+
echo "[ccstatusline] ccstatusline will be cached on first use via npx"
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
echo "[ccstatusline] Generating powerline configuration..."
|
|
63
|
+
|
|
64
|
+
# Generate powerline configuration using jq (ANSI colors - same as module)
|
|
65
|
+
CONFIG_JSON=$(jq -n '{
|
|
66
|
+
version: 3,
|
|
67
|
+
lines: [
|
|
68
|
+
[
|
|
69
|
+
{id: "1", type: "context-length", color: "cyan"},
|
|
70
|
+
{id: "3", type: "git-branch", color: "brightBlack"},
|
|
71
|
+
{id: "5", type: "tokens-input", color: "magenta"},
|
|
72
|
+
{id: "7", type: "session-clock", color: "yellow"},
|
|
73
|
+
{id: "1eafc42e-f222-4090-a463-46de6ba81849", type: "output-style", backgroundColor: "bgBrightBlack"}
|
|
74
|
+
],
|
|
75
|
+
[
|
|
76
|
+
{id: "db519d5a-80a7-4b44-8a9c-2c7d8c0a7176", type: "context-percentage-usable", backgroundColor: "bgRed"},
|
|
77
|
+
{id: "a529e50e-b9f3-4150-a812-937ab81545e8", type: "git-changes", backgroundColor: "bgBrightBlue"},
|
|
78
|
+
{id: "ac094d46-3673-4d41-84e3-dc8c5bcf639f", type: "tokens-output", backgroundColor: "bgMagenta"},
|
|
79
|
+
{id: "90aae111-3d3f-4bb0-8336-230f322cc2e8", type: "block-timer", backgroundColor: "bgYellow"},
|
|
80
|
+
{id: "d904cca6-ade8-41c1-a4f5-ddea30607a5e", type: "model", backgroundColor: "bgMagenta"}
|
|
81
|
+
],
|
|
82
|
+
[
|
|
83
|
+
{id: "9bacbdb4-2e01-45de-a0c0-ee6ec30fa3c2", type: "tokens-total", backgroundColor: "bgGreen"},
|
|
84
|
+
{id: "a9eaae3f-7f91-459c-833a-fbc9f01a09ae", type: "git-worktree", backgroundColor: "bgBrightBlue"},
|
|
85
|
+
{id: "2ad12147-05fd-45fb-8336-53ba2e7df56c", type: "tokens-cached", backgroundColor: "bgBrightRed"},
|
|
86
|
+
{id: "a4fe7f75-2f6c-49c7-88f6-ac7381142c2c", type: "session-cost", backgroundColor: "bgBrightWhite"},
|
|
87
|
+
{id: "2cdff909-8297-44a1-83f9-ad4bf024391e", type: "version", backgroundColor: "bgRed"}
|
|
88
|
+
]
|
|
89
|
+
],
|
|
90
|
+
flexMode: "full-minus-40",
|
|
91
|
+
compactThreshold: 60,
|
|
92
|
+
colorLevel: 2,
|
|
93
|
+
inheritSeparatorColors: false,
|
|
94
|
+
globalBold: false,
|
|
95
|
+
powerline: {
|
|
96
|
+
enabled: true,
|
|
97
|
+
separators: [""],
|
|
98
|
+
separatorInvertBackground: [true],
|
|
99
|
+
startCaps: [""],
|
|
100
|
+
endCaps: [""],
|
|
101
|
+
autoAlign: false,
|
|
102
|
+
theme: "monokai"
|
|
103
|
+
},
|
|
104
|
+
defaultPadding: " "
|
|
105
|
+
}')
|
|
106
|
+
|
|
107
|
+
# Validate generated config
|
|
108
|
+
if ! echo "${CONFIG_JSON}" | jq empty 2>/dev/null; then
|
|
109
|
+
echo "[ccstatusline] ERROR: Generated configuration is invalid JSON"
|
|
110
|
+
exit 1
|
|
111
|
+
fi
|
|
112
|
+
|
|
113
|
+
echo "[ccstatusline] Writing configuration..."
|
|
114
|
+
|
|
115
|
+
CONFIG_DIR="${USER_HOME}/.config/ccstatusline"
|
|
116
|
+
CONFIG_FILE="${CONFIG_DIR}/settings.json"
|
|
117
|
+
|
|
118
|
+
# Create directory
|
|
119
|
+
mkdir -p "${CONFIG_DIR}"
|
|
120
|
+
|
|
121
|
+
# Write config using secure temp file
|
|
122
|
+
TEMP_CONFIG=$(mktemp)
|
|
123
|
+
chmod 644 "${TEMP_CONFIG}"
|
|
124
|
+
echo "${CONFIG_JSON}" | jq . > "${TEMP_CONFIG}"
|
|
125
|
+
|
|
126
|
+
# Move to final location
|
|
127
|
+
mv "${TEMP_CONFIG}" "${CONFIG_FILE}"
|
|
128
|
+
|
|
129
|
+
# Set ownership
|
|
130
|
+
if ! chown "${USERNAME}:${USERNAME}" "${CONFIG_FILE}" 2>/dev/null; then
|
|
131
|
+
echo "[ccstatusline] WARNING: Could not set ownership on ${CONFIG_FILE}"
|
|
132
|
+
echo " Fix: sudo chown ${USERNAME}:${USERNAME} ${CONFIG_FILE}"
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
if ! chown "${USERNAME}:${USERNAME}" "${CONFIG_DIR}" 2>/dev/null; then
|
|
136
|
+
echo "[ccstatusline] WARNING: Could not set ownership on ${CONFIG_DIR}"
|
|
137
|
+
fi
|
|
138
|
+
|
|
139
|
+
echo "[ccstatusline] ✓ Configuration written to ${CONFIG_FILE}"
|
|
140
|
+
|
|
141
|
+
# Create template directory and save config template
|
|
142
|
+
echo "[ccstatusline] Creating configuration template..."
|
|
143
|
+
mkdir -p /usr/local/share/ccstatusline
|
|
144
|
+
TEMPLATE_FILE=/usr/local/share/ccstatusline/settings.template.json
|
|
145
|
+
echo "${CONFIG_JSON}" | jq . > "${TEMPLATE_FILE}"
|
|
146
|
+
chmod 644 "${TEMPLATE_FILE}"
|
|
147
|
+
echo "[ccstatusline] ✓ Template saved to ${TEMPLATE_FILE}"
|
|
148
|
+
|
|
149
|
+
# Create wrapper script to protect configuration
|
|
150
|
+
echo "[ccstatusline] Creating wrapper script..."
|
|
151
|
+
cat > /usr/local/bin/ccstatusline-wrapper <<'WRAPPER_EOF'
|
|
152
|
+
#!/bin/bash
|
|
153
|
+
# ccstatusline wrapper script
|
|
154
|
+
# Ensures custom powerline configuration is valid before running ccstatusline
|
|
155
|
+
|
|
156
|
+
set -euo pipefail
|
|
157
|
+
|
|
158
|
+
CONFIG_FILE="$HOME/.config/ccstatusline/settings.json"
|
|
159
|
+
TEMPLATE_FILE="/usr/local/share/ccstatusline/settings.template.json"
|
|
160
|
+
|
|
161
|
+
# Ensure config directory exists
|
|
162
|
+
mkdir -p "$HOME/.config/ccstatusline"
|
|
163
|
+
|
|
164
|
+
# Function to check if config is valid
|
|
165
|
+
is_config_valid() {
|
|
166
|
+
if [[ ! -f "$CONFIG_FILE" ]]; then
|
|
167
|
+
return 1
|
|
168
|
+
fi
|
|
169
|
+
|
|
170
|
+
# Check if powerline is enabled (key indicator of custom config)
|
|
171
|
+
if ! grep -q '"enabled"[[:space:]]*:[[:space:]]*true' "$CONFIG_FILE" 2>/dev/null; then
|
|
172
|
+
return 1
|
|
173
|
+
fi
|
|
174
|
+
|
|
175
|
+
# Check if ANSI colors are present (backgroundColor with bg prefix)
|
|
176
|
+
if ! grep -q 'bgRed\|bgMagenta\|bgGreen\|bgBrightBlue' "$CONFIG_FILE" 2>/dev/null; then
|
|
177
|
+
return 1
|
|
178
|
+
fi
|
|
179
|
+
|
|
180
|
+
# Validate JSON syntax
|
|
181
|
+
if ! jq empty "$CONFIG_FILE" 2>/dev/null; then
|
|
182
|
+
return 1
|
|
183
|
+
fi
|
|
184
|
+
|
|
185
|
+
return 0
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
# Restore config from template if missing or invalid
|
|
189
|
+
if ! is_config_valid; then
|
|
190
|
+
if [[ -f "$TEMPLATE_FILE" ]]; then
|
|
191
|
+
cp "$TEMPLATE_FILE" "$CONFIG_FILE"
|
|
192
|
+
chmod 644 "$CONFIG_FILE"
|
|
193
|
+
else
|
|
194
|
+
echo "[ccstatusline-wrapper] ERROR: Template file not found at $TEMPLATE_FILE" >&2
|
|
195
|
+
exit 1
|
|
196
|
+
fi
|
|
197
|
+
fi
|
|
198
|
+
|
|
199
|
+
# Run ccstatusline with all passed arguments
|
|
200
|
+
exec npx -y ccstatusline@latest "$@"
|
|
201
|
+
WRAPPER_EOF
|
|
202
|
+
|
|
203
|
+
chmod +x /usr/local/bin/ccstatusline-wrapper
|
|
204
|
+
echo "[ccstatusline] ✓ Wrapper installed at /usr/local/bin/ccstatusline-wrapper"
|
|
205
|
+
|
|
206
|
+
# Create post-start hook directory (standard pattern for DevContainer features)
|
|
207
|
+
mkdir -p /usr/local/devcontainer-poststart.d
|
|
208
|
+
|
|
209
|
+
# Create post-start hook script for Claude Code integration
|
|
210
|
+
# Runs on EVERY container start to ensure statusLine is always configured
|
|
211
|
+
# This handles cached images, config deletion, and corruption scenarios
|
|
212
|
+
# Note: Uses prefix 40 to run before MCP servers (50-51) to ensure settings.json exists first
|
|
213
|
+
cat > /usr/local/devcontainer-poststart.d/40-ccstatusline.sh <<'AUTOEOF'
|
|
214
|
+
#!/bin/bash
|
|
215
|
+
set -euo pipefail
|
|
216
|
+
|
|
217
|
+
echo "[ccstatusline] Auto-configuring Claude Code integration..."
|
|
218
|
+
|
|
219
|
+
# Validate prerequisites
|
|
220
|
+
if ! command -v jq &>/dev/null; then
|
|
221
|
+
echo "[ccstatusline] ERROR: jq is not available"
|
|
222
|
+
echo " Ensure common-utils feature is installed"
|
|
223
|
+
exit 1
|
|
224
|
+
fi
|
|
225
|
+
|
|
226
|
+
SETTINGS_FILE="${WORKSPACE_ROOT:-/workspaces}/.claude/settings.json"
|
|
227
|
+
# Use SUDO_USER since _REMOTE_USER isn't set in post-start hooks
|
|
228
|
+
USERNAME="${SUDO_USER:-vscode}"
|
|
229
|
+
|
|
230
|
+
# Ensure directory exists
|
|
231
|
+
mkdir -p "$(dirname "${SETTINGS_FILE}")"
|
|
232
|
+
|
|
233
|
+
# Initialize settings.json if missing
|
|
234
|
+
if [ ! -f "${SETTINGS_FILE}" ]; then
|
|
235
|
+
echo '{}' > "${SETTINGS_FILE}"
|
|
236
|
+
fi
|
|
237
|
+
|
|
238
|
+
# Add statusLine configuration (atomic) - use wrapper to protect config
|
|
239
|
+
jq '.statusLine //= {}' "${SETTINGS_FILE}" | \
|
|
240
|
+
jq '.statusLine = {
|
|
241
|
+
type: "command",
|
|
242
|
+
command: "/usr/local/bin/ccstatusline-wrapper"
|
|
243
|
+
}' > "${SETTINGS_FILE}.tmp"
|
|
244
|
+
|
|
245
|
+
# Atomic move (only if jq succeeded)
|
|
246
|
+
if [ $? -eq 0 ]; then
|
|
247
|
+
mv "${SETTINGS_FILE}.tmp" "${SETTINGS_FILE}"
|
|
248
|
+
if ! chown "${USERNAME}:${USERNAME}" "${SETTINGS_FILE}" 2>/dev/null; then
|
|
249
|
+
echo "[ccstatusline] WARNING: Could not set ownership on ${SETTINGS_FILE}"
|
|
250
|
+
fi
|
|
251
|
+
echo "[ccstatusline] ✓ Configured in ${SETTINGS_FILE}"
|
|
252
|
+
echo "[ccstatusline] Verify: cat ${SETTINGS_FILE} | jq '.statusLine'"
|
|
253
|
+
else
|
|
254
|
+
rm -f "${SETTINGS_FILE}.tmp"
|
|
255
|
+
echo "[ccstatusline] ERROR: Configuration failed"
|
|
256
|
+
exit 1
|
|
257
|
+
fi
|
|
258
|
+
AUTOEOF
|
|
259
|
+
|
|
260
|
+
chmod +x /usr/local/devcontainer-poststart.d/40-ccstatusline.sh
|
|
261
|
+
echo "[ccstatusline] ✓ Post-start hook created at /usr/local/devcontainer-poststart.d/40-ccstatusline.sh"
|
|
262
|
+
echo ""
|
|
263
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
264
|
+
echo " ccstatusline Installation Complete"
|
|
265
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
266
|
+
echo ""
|
|
267
|
+
echo "Configuration:"
|
|
268
|
+
echo " • Config file: ${CONFIG_FILE}"
|
|
269
|
+
echo " • User: ${USERNAME}"
|
|
270
|
+
echo " • Theme: Powerline (3 lines, 13 widgets, ANSI colors)"
|
|
271
|
+
echo " • Protected by: /usr/local/bin/ccstatusline-wrapper"
|
|
272
|
+
echo ""
|
|
273
|
+
echo "Display:"
|
|
274
|
+
echo " Line 1: Context | Git Branch | Tokens In | Clock | Output Style"
|
|
275
|
+
echo " Line 2: Context % | Git Changes | Tokens Out | Block Timer | Model"
|
|
276
|
+
echo " Line 3: Tokens Total | Git Worktree | Cached | Cost | Version"
|
|
277
|
+
echo ""
|
|
278
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
279
|
+
echo " Next Steps"
|
|
280
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
281
|
+
echo ""
|
|
282
|
+
echo "1. Configuration will be applied automatically on container creation"
|
|
283
|
+
echo ""
|
|
284
|
+
echo "2. Test manually:"
|
|
285
|
+
echo " echo '{\"model\":{\"display_name\":\"Test\"}}' | npx -y ccstatusline@latest"
|
|
286
|
+
echo ""
|
|
287
|
+
echo "3. View configuration:"
|
|
288
|
+
echo " cat ${CONFIG_FILE} | jq ."
|
|
289
|
+
echo ""
|
|
290
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|