Skip to content

Commit 2641e10

Browse files
committed
✨ add Claude Code default settings
1 parent 5dff287 commit 2641e10

3 files changed

Lines changed: 119 additions & 1 deletion

File tree

.claude/settings.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"model": "opus",
3+
"env": {
4+
"CLAUDE_CODE_DISABLE_1M_CONTEXT": "1"
5+
},
6+
"permissions": {
7+
"allow": [
8+
"Bash(cat *)",
9+
"Bash(cd *)",
10+
"Bash(cp *)",
11+
"Bash(diff *)",
12+
"Bash(echo *)",
13+
"Bash(find *)",
14+
"Bash(grep *)",
15+
"Bash(head *)",
16+
"Bash(ls *)",
17+
"Bash(make *)",
18+
"Bash(mkdir *)",
19+
"Bash(mise *)",
20+
"Bash(pwd)",
21+
"Bash(touch *)",
22+
"Bash(sed *)",
23+
"Bash(tail *)",
24+
"Bash(wc *)",
25+
"Read",
26+
"Edit",
27+
"Write"
28+
],
29+
"ask": [
30+
"Bash(curl *)",
31+
"Bash(mv *)",
32+
"Bash(rm *)",
33+
"Bash(wget *)",
34+
"Bash(git push *)",
35+
"Bash(git rebase *)",
36+
"Bash(git reset *)",
37+
"Bash(git revert *)",
38+
"WebFetch"
39+
],
40+
"deny": [
41+
"Bash(chmod *)",
42+
"Bash(chown *)",
43+
"Bash(find * -delete*)",
44+
"Bash(find * -exec rm *)",
45+
"Bash(reboot *)",
46+
"Bash(shutdown *)",
47+
"Bash(ssh *)",
48+
"Bash(su *)",
49+
"Bash(sudo *)",
50+
"Read(**/.env*)",
51+
"Edit(**/.env*)"
52+
]
53+
},
54+
"statusLine": {
55+
"type": "command",
56+
"command": "~/.claude/statusline.py"
57+
}
58+
}

.claude/statusline.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env python3
2+
3+
import json
4+
import sys
5+
6+
if sys.platform == "win32":
7+
sys.stdout.reconfigure(encoding="utf-8")
8+
9+
data = json.load(sys.stdin)
10+
11+
BLOCKS = " ▏▎▍▌▋▊▉█"
12+
R = "\033[0m"
13+
DIM = "\033[2m"
14+
15+
16+
def gradient(pct):
17+
if pct < 50:
18+
r = int(pct * 5.1)
19+
return f"\033[38;2;{r};200;80m"
20+
else:
21+
g = int(200 - (pct - 50) * 4)
22+
return f"\033[38;2;255;{max(g, 0)};60m"
23+
24+
25+
def bar(pct, width=10):
26+
pct = min(max(pct, 0), 100)
27+
filled = pct * width / 100
28+
full = int(filled)
29+
frac = int((filled - full) * 8)
30+
b = "█" * full
31+
if full < width:
32+
b += BLOCKS[frac]
33+
b += "░" * (width - full - 1)
34+
return b
35+
36+
37+
def fmt(label, pct):
38+
p = round(pct)
39+
return f"{label} {gradient(pct)}{bar(pct)} {p}%{R}"
40+
41+
42+
model = data.get("model", {}).get("display_name", "Claude")
43+
parts = [model]
44+
45+
ctx = data.get("context_window", {}).get("used_percentage")
46+
if ctx is not None:
47+
parts.append(fmt("ctx", ctx))
48+
49+
five = data.get("rate_limits", {}).get("five_hour", {}).get("used_percentage")
50+
if five is not None:
51+
parts.append(fmt("5h", five))
52+
53+
week = data.get("rate_limits", {}).get("seven_day", {}).get("used_percentage")
54+
if week is not None:
55+
parts.append(fmt("7d", week))
56+
57+
print(f"{DIM}{R}".join(f" {p} " for p in parts), end="")

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
XDG_CONFIG_FILES := bat git mise nvim yamllint
2-
EXCLUDE_FILES := .DS_Store .git .github .gitignore .gitmodules
2+
EXCLUDE_FILES := .DS_Store .git .github .gitignore .gitmodules .claude
3+
CLAUDE_FILES := .claude/settings.json .claude/statusline.py
34
DOT_FILES := $(filter-out $(EXCLUDE_FILES), $(wildcard .??*))
45
DOT_FILES_ALL := $(DOT_FILES) $(XDG_CONFIG_FILES)
56

@@ -58,6 +59,8 @@ init:
5859
mkdir -p $(HOME)/.config
5960
@-$(foreach f, $(DOT_FILES), ln -sf "$(PWD)/$(f)" "$(HOME)";)
6061
@-$(foreach f, $(XDG_CONFIG_FILES), ln -sf "$(PWD)/$(f)" "$(HOME)/.config";)
62+
mkdir -p $(HOME)/.claude
63+
@-$(foreach f, $(CLAUDE_FILES), ln -sf "$(PWD)/$(f)" "$(HOME)/$(f)";)
6164
@printf "$(COLOR_SUCCESS)✔ init が完了しました$(COLOR_RESET)\n"
6265

6366
.PHONY: list

0 commit comments

Comments
 (0)