dotfiles
bugabingas dorkfiles
owned by bugabinga
Add Claude and Codex dotfiles
85b240c5f7bb073a21b395b6928788da34d4dbca
Oliver Krylow <o.krylow@isp-insoft.de> ·
unsigned
Browse filesCompare with HEAD
Changed files (10)
14 14 nushell/secrets.nuon
15 +claude/.credentials.json
NB-00718.symlinks
Modified68 68 ~/AppData/Roaming/rbw
70 +claude/.credentials.json
71 +~/.claude/.credentials.json
74 +~/.claude/settings.json
77 +~/.claude/statusline.js
79 +claude/cc-statusline-hook.js
80 +~/.claude/cc-statusline-hook.js
claude/.credentials.json
Addednew file mode 100644Current version contains binary or non-UTF-8 data.
new file mode 100644 1 +#
RTK - Rust Token Killer 3 +**Usage**: Token-optimized CLI proxy (60-90% savings on dev operations)
5 +##
Meta Commands (always use rtk directly) 14 +##
Installation Verification 22 +⚠️ **Name collision**: If `rtk gain` fails, you may have reachingforthejack/rtk (Rust Type Kit) installed instead.
26 +All other commands are automatically rewritten by the Claude Code hook.
27 +Example: `git status` → `rtk git status` (transparent, 0 tokens overhead)
29 +Refer to CLAUDE.md for full command reference.
claude/cc-statusline-hook.js
Addednew file mode 100755 15 +const fs
= require(
"fs");
16 +const os
= require(
"os");
17 +const path
= require(
"path");
19 +const TTL_MS
= 120000;
20 +const MAX_LINES
= 10;
23 + const raw
= fs.readFileSync(
0,
"utf8");
24 + const h
= raw
&& raw.trim()
? JSON.
parse(raw)
: {};
26 + const claudeDir0
= process.
env.CLAUDE_CONFIG_DIR
|| path.join(os.homedir(),
".claude");
30 + if (h.hook_event_name
=== "UserPromptSubmit") {
32 + const sid
= String(h.session_id
|| "default").replace(
/[^A-Za-z0-9._-]/g,
"");
33 + fs.writeFileSync(path.join(claudeDir0,
`.cc-turn-${sid}
`),
"");
38 + if (h.hook_event_name
=== "PreToolUse" && h.tool_name
=== "Workflow") {
39 + const ti
= h.tool_input
|| {};
41 + let name
= typeof ti.name
=== "string" ? ti.name
: "";
42 + if (
!name
&& typeof ti.script
=== "string") {
43 + const m
= ti.script.match(
/name\s*:\s*['"]([^'"]+)['"]/);
46 + name
= (name
|| "workflow").replace(
/[\x00-\x1F|]/g,
"").slice(
0,
40);
48 + const claudeDir
= process.
env.CLAUDE_CONFIG_DIR
|| path.join(os.homedir(),
".claude");
49 + const f
= path.join(claudeDir,
".cc-statusline-extra");
50 + const now
= Date.
now();
56 + .readFileSync(f,
"utf8")
59 + const i
= l.indexOf(
"|");
60 + if (i
<= 0)
return false;
61 + const ts
= Number(l.slice(
0, i));
62 + return Number.
isFinite(ts)
&& now
- ts
<= TTL_MS;
66 + kept.push(
`${now}
|⚙ wf:${name}
`);
67 + if (kept.length
> MAX_LINES) kept
= kept.slice(
-MAX_LINES);
69 + const tmp
= `${f}
.${
process.
pid}
.tmp`;
70 + fs.writeFileSync(tmp, kept.join(
"\n")
+ "\n");
71 + fs.renameSync(tmp, f);
claude/settings.json
Addednew file mode 100644 3 + "defaultMode":
"bypassPermissions" 8 + "matcher":
"Workflow",
12 + "command":
"node ~/.claude/cc-statusline-hook.js" 21 + "command":
"rtk hook claude" 26 + "UserPromptSubmit": [
31 + "command":
"node ~/.claude/cc-statusline-hook.js" 39 + "command":
"node ~/.claude/statusline.js" 42 + "context7@claude-plugins-official":
true,
43 + "code-review@claude-plugins-official":
true,
44 + "code-simplifier@claude-plugins-official":
true,
45 + "github@claude-plugins-official":
false,
46 + "skill-creator@claude-plugins-official":
true,
47 + "feature-dev@claude-plugins-official":
true,
48 + "commit-commands@claude-plugins-official":
true,
49 + "atlassian@claude-plugins-official":
true,
50 + "jdtls-lsp@claude-plugins-official":
true,
51 + "remember@claude-plugins-official":
false,
52 + "caveman@caveman":
true,
53 + "superpowers@claude-plugins-official":
true,
54 + "frontend-design@claude-plugins-official":
true,
55 + "learning-output-style@claude-plugins-official":
true,
56 + "coderabbit@claude-plugins-official":
true,
57 + "desktop-commander@claude-plugins-official":
true,
58 + "code-modernization@claude-plugins-official":
true 60 + "extraKnownMarketplaces": {
61 + "claude-code-plugins": {
64 + "repo":
"anthropics/claude-code" 70 + "repo":
"JuliusBrussee/caveman" 74 + "effortLevel":
"xhigh",
75 + "advisorModel":
"opus",
76 + "promptSuggestionEnabled":
false,
77 + "tui":
"fullscreen",
78 + "skipDangerousModePermissionPrompt":
true,
80 + "editorMode":
"normal",
82 + "inputNeededNotifEnabled":
true,
83 + "agentPushNotifEnabled":
true,
84 + "skipAutoPermissionPrompt":
true claude/statusline.js
Addednew file mode 100755 15 +const fs
= require(
"fs");
16 +const os
= require(
"os");
17 +const path
= require(
"path");
18 +const crypto
= require(
"crypto");
19 +const { execFileSync }
= require(
"child_process");
31 + gitCacheTtlMs:
3000,
34 + ledgerPruneDays:
40,
36 + burnWindowMs:
10 * 60000,
37 + burnMinSpanMs:
60000,
41 +const claudeDir
= process.
env.CLAUDE_CONFIG_DIR
|| path.join(os.homedir(),
".claude");
47 + cyan: (s)
=> `${E}
[36m${s}${R}
`,
48 + magenta: (s)
=> `${E}
[35m${s}${R}
`,
49 + green: (s)
=> `${E}
[32m${s}${R}
`,
50 + yellow: (s)
=> `${E}
[33m${s}${R}
`,
51 + red: (s)
=> `${E}
[31m${s}${R}
`,
52 + blue: (s)
=> `${E}
[34m${s}${R}
`,
53 + dim: (s)
=> `${E}
[2m${s}${R}
`,
54 + white: (s)
=> `${E}
[97m${s}${R}
`,
55 + orange: (s)
=> `${E}
[38;5;172m${s}${R}
`,
57 +const pctColor = (p, warn, crit)
=> (p
>= crit
? c.red
: p
>= warn
? c.yellow
: c.green);
59 +const PARTIALS
= [
"",
"▏",
"▎",
"▍",
"▌",
"▋",
"▊",
"▉"];
60 +function bar(pct, width, color) {
61 + let p
= Math.
max(
0,
Math.
min(
100, pct));
62 + let filled
= (p
/ 100)
* width;
63 + let full
= Math.
floor(filled);
64 + let pIdx
= Math.
round((filled
- full)
* 8);
69 + if (full
> width) full
= width;
70 + const partial
= pIdx
> 0 && full
< width
? PARTIALS[pIdx]
: "";
71 + const used
= full
+ (partial
? 1 : 0);
72 + const empty
= Math.
max(
0, width
- used);
73 + return color(
"█".repeat(full)
+ partial)
+ c.dim(
"░".repeat(empty));
75 +const money = (n)
=> (n
< 1 ? n.toFixed(
3)
: n.toFixed(
2));
80 + const raw
= fs.readFileSync(
0,
"utf8");
81 + if (raw
&& raw.trim()) d
= JSON.
parse(raw);
87 +const push = (s)
=> {
88 + if (s) parts.push(s);
93 + const cwd
= d
?.workspace
?.current_dir
|| d
?.cwd;
94 + if (cwd) push(c.cyan(path.basename(cwd)
|| cwd));
99 + if (d
?.model
?.display_name) push(c.magenta(d.model.display_name));
104 + const lvl
= d
?.effort
?.level;
106 + const on
= d
?.thinking
?.enabled
!== false;
107 + const col
= lvl
=== "max" || lvl
=== "xhigh" ? c.magenta
: lvl
=== "high" ? c.blue
: c.dim;
108 + push(on
? col(
`⚡${lvl}
`)
: c.dim(
`⚡${lvl}
`));
113 +push(gitOrJjSegment(d
?.workspace
?.current_dir
|| d
?.cwd));
117 + const cw
= d
?.context_window
|| {};
118 + let pct
= cw.used_percentage;
119 + if (pct
== null && cw.context_window_size
&& cw.total_input_tokens
!= null) {
120 + pct
= (cw.total_input_tokens
/ cw.context_window_size)
* 100;
122 + const exceeds
= d
?.exceeds_200k_tokens
=== true;
123 + if (exceeds
|| (pct
!= null && pct
>= CONFIG.contextWarnPct)) {
124 + const shown
= pct
!= null ? Math.
round(pct)
: 100;
125 + const col
= exceeds
|| shown
>= CONFIG.contextCritPct
? c.red
: c.yellow;
126 + push(
`${c.dim(
"ctx")}
${bar(shown,
CONFIG.barWidth, col)}
${col(shown
+ "%")}
`);
132 + const rl
= d
?.rate_limits;
134 + const add = (label, win, withReset)
=> {
135 + if (win
&& typeof win.used_percentage
=== "number") {
136 + const p
= Math.
round(win.used_percentage);
137 + if (
CONFIG.usageAlways
|| p
>= CONFIG.usageWarnPct) {
138 + const col
= pctColor(p,
CONFIG.usageWarnPct,
CONFIG.usageCritPct);
139 + let seg
= `${c.dim(label)}
${bar(p,
CONFIG.barWidth, col)}
${col(p
+ "%")}
`;
141 + if (withReset
&& typeof win.resets_at
=== "number") {
142 + const left
= win.resets_at
* 1000 - Date.
now();
143 + if (left
> 0) seg
+= c.dim(
"·" + fmtDuration(left));
149 + add(
"5h", rl.five_hour,
true);
150 + add(
"7d", rl.seven_day,
false);
156 + const total
= d
?.cost
?.total_cost_usd;
157 + const sid
= d
?.session_id
|| "default";
158 + if (
typeof total
=== "number") {
159 + const { turn, month, burnRate }
= updateLedger(sid, total);
161 + if (burnRate
> 0) push(c.orange(
`🔥$${burnRate.toFixed(
2)}
/hr`));
163 + const fmt = (n, type, icon, color)
=> 164 + CONFIG.costStyle
=== "icon" ? color(
`${icon}
$${money(n)}
`)
: color(
`$${money(n)}
/${type}
`);
166 + if (turn
> 0) seg.push(fmt(turn,
"turn",
"⟳", c.white));
167 + seg.push(fmt(total,
"session",
"Σ", c.dim));
168 + if (month
> 0) seg.push(fmt(month,
"month",
"☾", c.dim));
169 + push(seg.join(
" "));
174 +push(cavemanBadge());
178 + const f
= path.join(claudeDir,
".cc-statusline-extra");
179 + const st
= fs.lstatSync(f);
180 + if (
!st.isSymbolicLink()
&& st.size
<= 4096) {
181 + const now
= Date.
now();
182 + for (
const line
of fs.readFileSync(f,
"utf8").split(
/\r?\n/)) {
183 + const i
= line.indexOf(
"|");
184 + if (i
<= 0)
continue;
185 + const ts
= Number(line.slice(
0, i));
186 + if (
!Number.
isFinite(ts)
|| now
- ts
> CONFIG.extraTtlMs)
continue;
187 + const text
= line.slice(i
+ 1).replace(
/[\x00-\x1F]/g,
"").slice(
0,
60);
188 + if (text) push(c.orange(text));
194 +process.
stdout.write(parts.join(
CONFIG.sep));
199 +function monthKey() {
200 + const dt
= new Date();
201 + return `${dt.getFullYear()}
-${
String(dt.getMonth()
+ 1).padStart(
2,
"0")}
`;
204 +function updateLedger(sid, total) {
205 + const file
= path.join(claudeDir,
".cc-cost-ledger.json");
206 + const now
= Date.
now();
207 + const mk
= monthKey();
208 + let L
= { month: mk, monthTotal:
0, sessions: {} };
210 + L
= JSON.
parse(fs.readFileSync(file,
"utf8"));
212 + if (
!L.sessions)
L.sessions
= {};
216 + if (
L.month
!== mk) {
222 + const cutoff
= now
- CONFIG.ledgerPruneDays
* 864e5;
223 + for (
const k
of Object.
keys(
L.sessions)) {
224 + if ((
L.sessions[k]
?.ts
?? 0)
< cutoff)
delete L.sessions[k];
227 + const s
= L.sessions[sid]
|| { total:
0, turnStart: total, ts: now };
232 + const marker
= path.join(claudeDir,
`.cc-turn-${sid}
`);
233 + if (fs.existsSync(marker)) {
234 + s.turnStart
= total;
235 + fs.unlinkSync(marker);
240 + const delta
= total
- (s.total
?? 0);
241 + if (delta
> 0)
L.monthTotal
= (
L.monthTotal
|| 0)
+ delta;
243 + const turn
= Math.
max(
0, total
- (s.turnStart
?? total));
249 + if (
!Array.
isArray(s.samples)) s.samples
= [];
250 + s.samples.push([now, total]);
251 + const wcut
= now
- CONFIG.burnWindowMs;
252 + s.samples
= s.samples.filter((p)
=> p[
0]
>= wcut);
253 + if (s.samples.length
> CONFIG.burnMaxSamples) s.samples
= s.samples.slice(
-CONFIG.burnMaxSamples);
254 + const burnRate
= computeBurnRate(s.samples);
256 + L.sessions[sid]
= s;
259 + const tmp
= `${file}
.${
process.
pid}
.tmp`;
260 + fs.writeFileSync(tmp,
JSON.
stringify(L));
261 + fs.renameSync(tmp, file);
264 + return { turn, month:
L.monthTotal
|| 0, burnRate };
275 +function computeBurnRate(samples) {
276 + if (
!Array.
isArray(samples)
|| samples.length
< 2)
return 0;
277 + const first
= samples[
0];
278 + const last
= samples[samples.length
- 1];
279 + const span
= last[
0]
- first[
0];
280 + const spend
= last[
1]
- first[
1];
281 + if (span
< CONFIG.burnMinSpanMs
|| spend
<= 0)
return 0;
282 + return (spend
/ span)
* 3600000;
286 +function fmtDuration(ms) {
287 + const m
= Math.
floor(ms
/ 60000);
288 + if (m
>= 60)
return `${
Math.
floor(m
/ 60)}
h${
String(m
% 60).padStart(
2,
"0")}
m`;
295 +function findRepo(startDir) {
297 + let dir
= startDir
&& fs.existsSync(startDir)
? startDir
: process.
cwd();
298 + for (
let i
= 0; i
< 40; i
++) {
299 + if (fs.existsSync(path.join(dir,
".jj")))
return { kind:
"jj", root: dir };
300 + if (fs.existsSync(path.join(dir,
".git")))
return { kind:
"git", root: dir };
301 + const up
= path.dirname(dir);
302 + if (up
=== dir)
break;
309 +function gitOrJjSegment(cwd) {
312 + repo
= findRepo(cwd);
316 + if (
!repo)
return "";
317 + const key
= crypto.createHash(
"sha1").update(repo.kind
+ ":" + repo.root).digest(
"hex").slice(
0,
12);
318 + const cacheFile
= path.join(os.tmpdir(),
`cc-statusline-${key}
.json`);
320 + const o
= JSON.
parse(fs.readFileSync(cacheFile,
"utf8"));
321 + if (
Date.
now()
- o.ts
< CONFIG.gitCacheTtlMs)
return o.text;
325 + text
= repo.kind
=== "jj" ? jjSegment(repo.root)
: gitSegment(repo.root);
330 + const tmp
= `${cacheFile}
.${
process.
pid}
.tmp`;
331 + fs.writeFileSync(tmp,
JSON.
stringify({ ts:
Date.
now(), text }));
332 + fs.renameSync(tmp, cacheFile);
337 +function gitSegment(root) {
338 + const out
= execFileSync(
"git", [
"-C", root,
"status",
"--porcelain=v2",
"--branch"], {
340 + timeout:
CONFIG.cmdTimeoutMs,
347 + for (
const line
of out.split(
/\r?\n/)) {
348 + if (line.startsWith(
"# branch.head ")) branch
= line.slice(
14).trim();
349 + else if (line.startsWith(
"# branch.ab ")) {
350 + const m
= line.match(
/\+(\d+)\s+-(\d+)/);
355 + }
else if (line
&& !line.startsWith(
"#")) dirty
++;
357 + if (branch
=== "(detached)") branch
= "detached";
358 + const col
= dirty
> 0 ? c.yellow
: c.green;
359 + let s
= col(
`⎇${branch}
`);
360 + if (dirty
> 0) s
+= c.yellow(
`●${dirty}
`);
361 + if (ahead) s
+= c.cyan(
`↑${ahead}
`);
362 + if (behind) s
+= c.cyan(
`↓${behind}
`);
366 +function jjSegment(root) {
367 + const tmpl
= 'change_id.shortest(8) ++ "|" ++ bookmarks ++ "|" ++ if(empty, "clean", "dirty")';
368 + const out
= execFileSync(
370 + [
"--no-pager",
"log",
"--no-graph",
"--color",
"never",
"-r",
"@",
"-T", tmpl],
371 + { cwd: root, encoding:
"utf8", timeout:
CONFIG.cmdTimeoutMs, windowsHide:
true }
373 + const [change
= "?", bookmarks
= "", state
= ""]
= out.split(
"|");
374 + const label
= bookmarks.trim()
|| change;
375 + const dirty
= state.trim()
=== "dirty";
376 + const col
= dirty
? c.yellow
: c.green;
377 + return col(
`jj:${label}
`)
+ (dirty
? c.yellow(
"✗")
: "");
383 +function cavemanBadge() {
385 + const flag
= path.join(claudeDir,
".caveman-active");
386 + const st
= fs.lstatSync(flag);
387 + if (st.isSymbolicLink()
|| st.size
> 64)
return "";
388 + let mode
= (fs.readFileSync(flag,
"utf8").split(
/\r?\n/)[
0]
?? "")
391 + .replace(
/[^a-z0-9-]/g,
"");
392 + const valid
= new Set([
393 + "off",
"lite",
"full",
"ultra",
394 + "wenyan-lite",
"wenyan",
"wenyan-full",
"wenyan-ultra",
395 + "commit",
"review",
"compress",
397 + if (
!valid.has(mode)
|| mode
=== "off")
return "";
398 + let out
= c.orange(mode
|| "full");
399 + if (
process.
env.CAVEMAN_STATUSLINE_SAVINGS
!== "0") {
401 + const sf
= path.join(claudeDir,
".caveman-statusline-suffix");
402 + const sst
= fs.lstatSync(sf);
403 + if (
!sst.isSymbolicLink()
&& sst.size
<= 64) {
404 + const sv
= fs.readFileSync(sf,
"utf8").replace(
/[\x00-\x1F]/g,
"").trimEnd();
405 + if (sv) out
+= " " + c.orange(sv);
new file mode 100644Current version contains binary or non-UTF-8 data.
58 +claude/.credentials.json
59 +~/.claude/.credentials.json
62 +~/.claude/settings.json
65 +~/.claude/statusline.js
67 +claude/cc-statusline-hook.js
68 +~/.claude/cc-statusline-hook.js