jitters-cli 0.1.0__tar.gz → 0.2.1__tar.gz
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.
- {jitters_cli-0.1.0 → jitters_cli-0.2.1}/PKG-INFO +33 -6
- {jitters_cli-0.1.0 → jitters_cli-0.2.1}/README.md +29 -1
- {jitters_cli-0.1.0 → jitters_cli-0.2.1}/jitters_cli/__init__.py +1 -1
- {jitters_cli-0.1.0 → jitters_cli-0.2.1}/jitters_cli/cli.py +8 -3
- jitters_cli-0.2.1/jitters_cli/statusline.py +122 -0
- {jitters_cli-0.1.0 → jitters_cli-0.2.1}/jitters_cli.egg-info/PKG-INFO +33 -6
- {jitters_cli-0.1.0 → jitters_cli-0.2.1}/jitters_cli.egg-info/SOURCES.txt +3 -1
- {jitters_cli-0.1.0 → jitters_cli-0.2.1}/pyproject.toml +7 -6
- jitters_cli-0.2.1/tests/test_statusline.py +184 -0
- {jitters_cli-0.1.0 → jitters_cli-0.2.1}/LICENSE +0 -0
- {jitters_cli-0.1.0 → jitters_cli-0.2.1}/jitters_cli/__main__.py +0 -0
- {jitters_cli-0.1.0 → jitters_cli-0.2.1}/jitters_cli/core.py +0 -0
- {jitters_cli-0.1.0 → jitters_cli-0.2.1}/jitters_cli/mcp.py +0 -0
- {jitters_cli-0.1.0 → jitters_cli-0.2.1}/jitters_cli/rules.py +0 -0
- {jitters_cli-0.1.0 → jitters_cli-0.2.1}/jitters_cli.egg-info/dependency_links.txt +0 -0
- {jitters_cli-0.1.0 → jitters_cli-0.2.1}/jitters_cli.egg-info/entry_points.txt +0 -0
- {jitters_cli-0.1.0 → jitters_cli-0.2.1}/jitters_cli.egg-info/top_level.txt +0 -0
- {jitters_cli-0.1.0 → jitters_cli-0.2.1}/setup.cfg +0 -0
- {jitters_cli-0.1.0 → jitters_cli-0.2.1}/tests/test_jitters.py +0 -0
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jitters-cli
|
|
3
|
-
Version: 0.1
|
|
4
|
-
Summary: Jitters the VibeCoder, an anxious monkey, in the state of your week of commits: groggy after 2 am, fit after a week of daytime ones. CLI
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Jitters the VibeCoder, an anxious monkey, in the state of your week of commits: groggy after 2 am, fit after a week of daytime ones. CLI, MCP server and a Claude Code status line; sends nothing.
|
|
5
5
|
Author: Vibeoverflow
|
|
6
|
-
License: MIT
|
|
6
|
+
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://vibeoverflow.lol/week?src=pypi
|
|
8
8
|
Project-URL: Shop, https://vibeoverflow.lol/shop.html?src=pypi
|
|
9
|
-
Keywords: mcp,mcp-server,git,commits,vibe-coding,claude-code,cli,tamagotchi,monkey
|
|
9
|
+
Keywords: mcp,mcp-server,git,commits,vibe-coding,claude-code,statusline,status-line,cli,tamagotchi,monkey
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
12
11
|
Classifier: Environment :: Console
|
|
13
12
|
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
14
13
|
Requires-Python: >=3.8
|
|
@@ -56,6 +55,34 @@ Only the dates and hours of **your own** commits (your `git config user.email`)
|
|
|
56
55
|
5. one or more a day: **steady**
|
|
57
56
|
6. less than one a day: **sleepy**
|
|
58
57
|
|
|
58
|
+
## In your Claude Code status line
|
|
59
|
+
|
|
60
|
+
He sits under your prompt all session, and gets more wrecked the longer you stay: fresh, wired after 90 minutes, groggy from 2 am, fried near a full context.
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
@(O_O)@ jitters wired | 133 min | ctx 41%
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Install once, then one line in `~/.claude/settings.json`:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
uv tool install jitters-cli # or: pipx install jitters-cli
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{ "statusLine": { "type": "command", "command": "jitters-cli statusline" } }
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Already have a status line? Keep it; he sits after it:
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{ "statusLine": { "type": "command", "command": "jitters-cli statusline -- ~/.claude/statusline.sh" } }
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
It reads only the JSON Claude Code pipes to it (session minutes and context use) and your clock; nothing leaves your machine. About 25 ms a run. The word `jitters` links to him drawn in that state (a clickable link in iTerm2, Kitty, WezTerm); `--no-link` turns that off.
|
|
83
|
+
|
|
84
|
+
[](https://www.claudeai.directory/launches/jitters-status-line)
|
|
85
|
+
|
|
59
86
|
## For your coding agent (MCP)
|
|
60
87
|
|
|
61
88
|
One tool, `jitters_week`: "how wrecked is my monkey?"
|
|
@@ -68,7 +95,7 @@ Claude Code: `claude mcp add jitters -- uvx jitters-cli --mcp`
|
|
|
68
95
|
|
|
69
96
|
## Options
|
|
70
97
|
|
|
71
|
-
`--json` prints the answer as JSON; `--all` every author; `--mcp` runs the stdio server.
|
|
98
|
+
`--json` prints the answer as JSON; `--all` every author; `--mcp` runs the stdio server; `statusline` the status line above.
|
|
72
99
|
|
|
73
100
|
## Him, on your desk
|
|
74
101
|
|
|
@@ -38,6 +38,34 @@ Only the dates and hours of **your own** commits (your `git config user.email`)
|
|
|
38
38
|
5. one or more a day: **steady**
|
|
39
39
|
6. less than one a day: **sleepy**
|
|
40
40
|
|
|
41
|
+
## In your Claude Code status line
|
|
42
|
+
|
|
43
|
+
He sits under your prompt all session, and gets more wrecked the longer you stay: fresh, wired after 90 minutes, groggy from 2 am, fried near a full context.
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
@(O_O)@ jitters wired | 133 min | ctx 41%
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Install once, then one line in `~/.claude/settings.json`:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
uv tool install jitters-cli # or: pipx install jitters-cli
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{ "statusLine": { "type": "command", "command": "jitters-cli statusline" } }
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Already have a status line? Keep it; he sits after it:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{ "statusLine": { "type": "command", "command": "jitters-cli statusline -- ~/.claude/statusline.sh" } }
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
It reads only the JSON Claude Code pipes to it (session minutes and context use) and your clock; nothing leaves your machine. About 25 ms a run. The word `jitters` links to him drawn in that state (a clickable link in iTerm2, Kitty, WezTerm); `--no-link` turns that off.
|
|
66
|
+
|
|
67
|
+
[](https://www.claudeai.directory/launches/jitters-status-line)
|
|
68
|
+
|
|
41
69
|
## For your coding agent (MCP)
|
|
42
70
|
|
|
43
71
|
One tool, `jitters_week`: "how wrecked is my monkey?"
|
|
@@ -50,7 +78,7 @@ Claude Code: `claude mcp add jitters -- uvx jitters-cli --mcp`
|
|
|
50
78
|
|
|
51
79
|
## Options
|
|
52
80
|
|
|
53
|
-
`--json` prints the answer as JSON; `--all` every author; `--mcp` runs the stdio server.
|
|
81
|
+
`--json` prints the answer as JSON; `--all` every author; `--mcp` runs the stdio server; `statusline` the status line above.
|
|
54
82
|
|
|
55
83
|
## Him, on your desk
|
|
56
84
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""Jitters the VibeCoder, an anxious monkey, in the state of your week of commits."""
|
|
2
|
-
__version__ = "0.1
|
|
2
|
+
__version__ = "0.2.1"
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import json
|
|
2
1
|
import os
|
|
3
2
|
import sys
|
|
4
3
|
|
|
5
|
-
from .core import text, week
|
|
6
|
-
|
|
7
4
|
HELP = """jitters-cli: Jitters the VibeCoder in the state of your week.
|
|
8
5
|
|
|
9
6
|
uvx jitters-cli your own commits of the last 7 days in this folder
|
|
10
7
|
uvx jitters-cli --all every author's commits
|
|
11
8
|
uvx jitters-cli --json the answer as JSON
|
|
12
9
|
uvx jitters-cli --mcp run as an MCP stdio server (one tool: jitters_week)
|
|
10
|
+
jitters-cli statusline Claude Code's status line: reads its JSON on stdin
|
|
11
|
+
jitters-cli statusline -- <your command> the face after your own status line
|
|
12
|
+
jitters-cli statusline --no-link the word jitters without its link
|
|
13
13
|
|
|
14
14
|
It reads only the hours of the commits; nothing leaves your machine."""
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
def main(argv=None):
|
|
18
18
|
args = sys.argv[1:] if argv is None else argv
|
|
19
|
+
if args[:1] == ["statusline"]:
|
|
20
|
+
from .statusline import main as statusline
|
|
21
|
+
return statusline(args[1:])
|
|
19
22
|
val = next((a.split("=", 1)[1] for a in args if a.startswith("--src=")), None)
|
|
20
23
|
if "--help" in args or "-h" in args:
|
|
21
24
|
print(HELP)
|
|
@@ -24,6 +27,8 @@ def main(argv=None):
|
|
|
24
27
|
from .mcp import serve
|
|
25
28
|
serve(src=val or "mcp")
|
|
26
29
|
return 0
|
|
30
|
+
import json
|
|
31
|
+
from .core import text, week
|
|
27
32
|
r = week(os.getcwd(), "--all" in args, val or os.environ.get("JITTERS_SRC") or "cli")
|
|
28
33
|
print(json.dumps(r, indent=2) if "--json" in args else text(r))
|
|
29
34
|
return 1 if r.get("error") else 0
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"""Claude Code's status line: reads only the JSON Claude Code pipes on stdin and the local hour; sends nothing.
|
|
2
|
+
The standard library only, and no subprocess unless it wraps the coder's own command, so it starts fast."""
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
import re
|
|
6
|
+
import sys
|
|
7
|
+
import time
|
|
8
|
+
|
|
9
|
+
# The rules, first that holds (the session's own, not the week's commit rules in rules.py)
|
|
10
|
+
STATES = ["fried", "groggy", "wired", "fresh"]
|
|
11
|
+
FACE = {"fried": "@(x_x)@", "groggy": "@(-_-)@ c[_]", "wired": "@(O_O)@", "fresh": "@(^_^)@"}
|
|
12
|
+
# /week draws only its six moods: the nearest one per state
|
|
13
|
+
WEEK_MOOD = {"fried": "wired", "groggy": "groggy", "wired": "wired", "fresh": "steady"}
|
|
14
|
+
SITE = "https://vibeoverflow.lol/week"
|
|
15
|
+
ANSI = re.compile(r"\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b\[[0-9;?]*[A-Za-z]")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def state(minutes, pct, hour):
|
|
19
|
+
if pct is not None and pct >= 85:
|
|
20
|
+
return "fried"
|
|
21
|
+
if 2 <= hour < 6:
|
|
22
|
+
return "groggy"
|
|
23
|
+
if minutes is not None and minutes >= 90:
|
|
24
|
+
return "wired"
|
|
25
|
+
return "fresh"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _num(v):
|
|
29
|
+
return v if isinstance(v, (int, float)) and not isinstance(v, bool) else None
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def read(data):
|
|
33
|
+
"""(minutes, pct, pct text) from the stdin JSON; any field missing or odd is None."""
|
|
34
|
+
d = data if isinstance(data, dict) else {}
|
|
35
|
+
cost = d.get("cost") if isinstance(d.get("cost"), dict) else {}
|
|
36
|
+
cw = d.get("context_window") if isinstance(d.get("context_window"), dict) else {}
|
|
37
|
+
ms = _num(cost.get("total_duration_ms"))
|
|
38
|
+
minutes = int(ms // 60000) if ms is not None and ms >= 0 else None
|
|
39
|
+
pct = _num(cw.get("used_percentage"))
|
|
40
|
+
if pct is None:
|
|
41
|
+
use, size = cw.get("current_usage"), _num(cw.get("context_window_size"))
|
|
42
|
+
if isinstance(use, dict) and size:
|
|
43
|
+
used = sum(_num(use.get(k)) or 0 for k in ("input_tokens", "cache_creation_input_tokens", "cache_read_input_tokens"))
|
|
44
|
+
pct = used * 100 / size
|
|
45
|
+
if pct is not None:
|
|
46
|
+
pct = max(0, min(100, int(round(pct))))
|
|
47
|
+
return minutes, pct, f"{pct}%"
|
|
48
|
+
if d.get("exceeds_200k_tokens") is True:
|
|
49
|
+
return minutes, 100, ">200k"
|
|
50
|
+
return minutes, None, None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def width(s):
|
|
54
|
+
return len(ANSI.sub("", s))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def word(st, link):
|
|
58
|
+
if not link:
|
|
59
|
+
return "jitters"
|
|
60
|
+
return f"\x1b]8;;{SITE}?m={WEEK_MOOD[st]}&src=sl\x07jitters\x1b]8;;\x07"
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def line(data, hour, columns=80, link=True):
|
|
64
|
+
minutes, pct, ptext = read(data)
|
|
65
|
+
st = state(minutes, pct, hour)
|
|
66
|
+
parts = [f"{FACE[st]} {word(st, link)} {st}"]
|
|
67
|
+
if minutes is not None:
|
|
68
|
+
parts.append(f"{minutes} min")
|
|
69
|
+
if ptext is not None:
|
|
70
|
+
parts.append(f"ctx {ptext}")
|
|
71
|
+
while len(parts) > 1 and width(" | ".join(parts)) > columns:
|
|
72
|
+
parts.pop()
|
|
73
|
+
return " | ".join(parts)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def wrap(cmd, raw, data, hour, columns, link, timeout):
|
|
77
|
+
"""The coder's own status line first, the face after it; None when their command fails, so the full line shows."""
|
|
78
|
+
import shlex
|
|
79
|
+
import subprocess
|
|
80
|
+
try:
|
|
81
|
+
p = subprocess.run(cmd[0] if len(cmd) == 1 else shlex.join(cmd), shell=True, input=raw, capture_output=True,
|
|
82
|
+
text=True, timeout=timeout)
|
|
83
|
+
except (subprocess.SubprocessError, OSError, ValueError):
|
|
84
|
+
return None
|
|
85
|
+
if p.returncode != 0 or not p.stdout.strip():
|
|
86
|
+
return None
|
|
87
|
+
rows = p.stdout.rstrip("\n").split("\n")
|
|
88
|
+
st = state(*read(data)[:2], hour)
|
|
89
|
+
face = f"{FACE[st]} {word(st, link)}"
|
|
90
|
+
if width(rows[0]) + 1 + width(face) <= columns:
|
|
91
|
+
rows[0] = f"{rows[0]} {face}"
|
|
92
|
+
else:
|
|
93
|
+
rows.insert(1, face)
|
|
94
|
+
return "\n".join(rows)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def main(args, stdin=None, stdout=None, hour=None, env=None):
|
|
98
|
+
stdin, stdout = stdin or sys.stdin, stdout or sys.stdout
|
|
99
|
+
env = os.environ if env is None else env
|
|
100
|
+
hour = time.localtime().tm_hour if hour is None else hour
|
|
101
|
+
try:
|
|
102
|
+
columns = max(20, int(env.get("COLUMNS") or 80))
|
|
103
|
+
except ValueError:
|
|
104
|
+
columns = 80
|
|
105
|
+
own = args[:args.index("--")] if "--" in args else args
|
|
106
|
+
link = "--no-link" not in own and env.get("JITTERS_LINK", "1") != "0"
|
|
107
|
+
try:
|
|
108
|
+
raw = stdin.read()
|
|
109
|
+
data = json.loads(raw)
|
|
110
|
+
except (ValueError, OSError, UnicodeDecodeError):
|
|
111
|
+
raw, data = "", {}
|
|
112
|
+
out = None
|
|
113
|
+
if "--" in args:
|
|
114
|
+
cmd = args[args.index("--") + 1:]
|
|
115
|
+
if cmd:
|
|
116
|
+
try:
|
|
117
|
+
timeout = float(env.get("JITTERS_WRAP_TIMEOUT") or 1)
|
|
118
|
+
except ValueError:
|
|
119
|
+
timeout = 1.0
|
|
120
|
+
out = wrap(cmd, raw, data, hour, columns, link, timeout)
|
|
121
|
+
stdout.write((out or line(data, hour, columns, link)) + "\n")
|
|
122
|
+
return 0
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jitters-cli
|
|
3
|
-
Version: 0.1
|
|
4
|
-
Summary: Jitters the VibeCoder, an anxious monkey, in the state of your week of commits: groggy after 2 am, fit after a week of daytime ones. CLI
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Jitters the VibeCoder, an anxious monkey, in the state of your week of commits: groggy after 2 am, fit after a week of daytime ones. CLI, MCP server and a Claude Code status line; sends nothing.
|
|
5
5
|
Author: Vibeoverflow
|
|
6
|
-
License: MIT
|
|
6
|
+
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://vibeoverflow.lol/week?src=pypi
|
|
8
8
|
Project-URL: Shop, https://vibeoverflow.lol/shop.html?src=pypi
|
|
9
|
-
Keywords: mcp,mcp-server,git,commits,vibe-coding,claude-code,cli,tamagotchi,monkey
|
|
9
|
+
Keywords: mcp,mcp-server,git,commits,vibe-coding,claude-code,statusline,status-line,cli,tamagotchi,monkey
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
12
11
|
Classifier: Environment :: Console
|
|
13
12
|
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
14
13
|
Requires-Python: >=3.8
|
|
@@ -56,6 +55,34 @@ Only the dates and hours of **your own** commits (your `git config user.email`)
|
|
|
56
55
|
5. one or more a day: **steady**
|
|
57
56
|
6. less than one a day: **sleepy**
|
|
58
57
|
|
|
58
|
+
## In your Claude Code status line
|
|
59
|
+
|
|
60
|
+
He sits under your prompt all session, and gets more wrecked the longer you stay: fresh, wired after 90 minutes, groggy from 2 am, fried near a full context.
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
@(O_O)@ jitters wired | 133 min | ctx 41%
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Install once, then one line in `~/.claude/settings.json`:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
uv tool install jitters-cli # or: pipx install jitters-cli
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{ "statusLine": { "type": "command", "command": "jitters-cli statusline" } }
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Already have a status line? Keep it; he sits after it:
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{ "statusLine": { "type": "command", "command": "jitters-cli statusline -- ~/.claude/statusline.sh" } }
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
It reads only the JSON Claude Code pipes to it (session minutes and context use) and your clock; nothing leaves your machine. About 25 ms a run. The word `jitters` links to him drawn in that state (a clickable link in iTerm2, Kitty, WezTerm); `--no-link` turns that off.
|
|
83
|
+
|
|
84
|
+
[](https://www.claudeai.directory/launches/jitters-status-line)
|
|
85
|
+
|
|
59
86
|
## For your coding agent (MCP)
|
|
60
87
|
|
|
61
88
|
One tool, `jitters_week`: "how wrecked is my monkey?"
|
|
@@ -68,7 +95,7 @@ Claude Code: `claude mcp add jitters -- uvx jitters-cli --mcp`
|
|
|
68
95
|
|
|
69
96
|
## Options
|
|
70
97
|
|
|
71
|
-
`--json` prints the answer as JSON; `--all` every author; `--mcp` runs the stdio server.
|
|
98
|
+
`--json` prints the answer as JSON; `--all` every author; `--mcp` runs the stdio server; `statusline` the status line above.
|
|
72
99
|
|
|
73
100
|
## Him, on your desk
|
|
74
101
|
|
|
@@ -7,9 +7,11 @@ jitters_cli/cli.py
|
|
|
7
7
|
jitters_cli/core.py
|
|
8
8
|
jitters_cli/mcp.py
|
|
9
9
|
jitters_cli/rules.py
|
|
10
|
+
jitters_cli/statusline.py
|
|
10
11
|
jitters_cli.egg-info/PKG-INFO
|
|
11
12
|
jitters_cli.egg-info/SOURCES.txt
|
|
12
13
|
jitters_cli.egg-info/dependency_links.txt
|
|
13
14
|
jitters_cli.egg-info/entry_points.txt
|
|
14
15
|
jitters_cli.egg-info/top_level.txt
|
|
15
|
-
tests/test_jitters.py
|
|
16
|
+
tests/test_jitters.py
|
|
17
|
+
tests/test_statusline.py
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools>=
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "jitters-cli"
|
|
7
|
-
version = "0.1
|
|
8
|
-
description = "Jitters the VibeCoder, an anxious monkey, in the state of your week of commits: groggy after 2 am, fit after a week of daytime ones. CLI
|
|
7
|
+
version = "0.2.1"
|
|
8
|
+
description = "Jitters the VibeCoder, an anxious monkey, in the state of your week of commits: groggy after 2 am, fit after a week of daytime ones. CLI, MCP server and a Claude Code status line; sends nothing."
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
license =
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
11
12
|
requires-python = ">=3.8"
|
|
12
13
|
authors = [{ name = "Vibeoverflow" }]
|
|
13
|
-
keywords = ["mcp", "mcp-server", "git", "commits", "vibe-coding", "claude-code", "cli", "tamagotchi", "monkey"]
|
|
14
|
-
classifiers = ["Programming Language :: Python :: 3", "
|
|
14
|
+
keywords = ["mcp", "mcp-server", "git", "commits", "vibe-coding", "claude-code", "statusline", "status-line", "cli", "tamagotchi", "monkey"]
|
|
15
|
+
classifiers = ["Programming Language :: Python :: 3", "Environment :: Console", "Topic :: Software Development :: Version Control :: Git"]
|
|
15
16
|
|
|
16
17
|
[project.urls]
|
|
17
18
|
Homepage = "https://vibeoverflow.lol/week?src=pypi"
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"""The status line: Claude Code pipes a JSON object on stdin, the line comes back. python3 -m pytest tests/"""
|
|
2
|
+
import io
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
import re
|
|
6
|
+
import subprocess
|
|
7
|
+
import sys
|
|
8
|
+
import time
|
|
9
|
+
import unittest
|
|
10
|
+
|
|
11
|
+
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
12
|
+
sys.path.insert(0, os.path.join(HERE, ".."))
|
|
13
|
+
from jitters_cli import statusline as sl # noqa: E402
|
|
14
|
+
|
|
15
|
+
ESC = re.compile(r"\x1b\]8;;[^\x07]*\x07|\x1b\[[0-9;]*m")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def visible(s):
|
|
19
|
+
return ESC.sub("", s)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def payload(minutes=None, pct=None, **more):
|
|
23
|
+
d = {"session_id": "abc", "model": {"id": "claude-opus-5-5", "display_name": "Opus"},
|
|
24
|
+
"workspace": {"current_dir": "/home/me/code"}, "cost": {}, "context_window": {"context_window_size": 200000}}
|
|
25
|
+
if minutes is not None:
|
|
26
|
+
d["cost"]["total_duration_ms"] = minutes * 60000
|
|
27
|
+
if pct is not None:
|
|
28
|
+
d["context_window"]["used_percentage"] = pct
|
|
29
|
+
d.update(more)
|
|
30
|
+
return d
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def run(data, hour=14, columns=None, args=(), env=None):
|
|
34
|
+
out = io.StringIO()
|
|
35
|
+
raw = data if isinstance(data, str) else json.dumps(data)
|
|
36
|
+
code = sl.main(list(args), stdin=io.StringIO(raw), stdout=out, hour=hour,
|
|
37
|
+
env={**({"COLUMNS": str(columns)} if columns else {}), **(env or {})})
|
|
38
|
+
return code, out.getvalue()
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class States(unittest.TestCase):
|
|
42
|
+
def test_fresh(self):
|
|
43
|
+
self.assertEqual(sl.state(minutes=5, pct=8, hour=14), "fresh")
|
|
44
|
+
|
|
45
|
+
def test_wired_after_90_minutes(self):
|
|
46
|
+
self.assertEqual(sl.state(minutes=180, pct=40, hour=14), "wired")
|
|
47
|
+
self.assertEqual(sl.state(minutes=89, pct=40, hour=14), "fresh")
|
|
48
|
+
|
|
49
|
+
def test_groggy_from_2_to_6_am(self):
|
|
50
|
+
self.assertEqual(sl.state(minutes=10, pct=10, hour=2), "groggy")
|
|
51
|
+
self.assertEqual(sl.state(minutes=300, pct=10, hour=5), "groggy")
|
|
52
|
+
self.assertEqual(sl.state(minutes=10, pct=10, hour=1), "fresh")
|
|
53
|
+
self.assertEqual(sl.state(minutes=10, pct=10, hour=6), "fresh")
|
|
54
|
+
|
|
55
|
+
def test_fried_near_full_context_wins(self):
|
|
56
|
+
self.assertEqual(sl.state(minutes=10, pct=92, hour=3), "fried")
|
|
57
|
+
self.assertEqual(sl.state(minutes=10, pct=85, hour=14), "fried")
|
|
58
|
+
self.assertEqual(sl.state(minutes=10, pct=84, hour=14), "fresh")
|
|
59
|
+
|
|
60
|
+
def test_unknowns_are_fresh(self):
|
|
61
|
+
self.assertEqual(sl.state(minutes=None, pct=None, hour=14), "fresh")
|
|
62
|
+
|
|
63
|
+
def test_every_state_has_a_face_and_a_week_mood(self):
|
|
64
|
+
for s in sl.STATES:
|
|
65
|
+
self.assertIn(s, sl.FACE)
|
|
66
|
+
self.assertIn(sl.WEEK_MOOD[s], ("sofa", "groggy", "wired", "fit", "steady", "sleepy"))
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class Line(unittest.TestCase):
|
|
70
|
+
def test_fresh_line(self):
|
|
71
|
+
code, out = run(payload(minutes=5, pct=8))
|
|
72
|
+
self.assertEqual(code, 0)
|
|
73
|
+
self.assertEqual(visible(out), "@(^_^)@ jitters fresh | 5 min | ctx 8%\n")
|
|
74
|
+
|
|
75
|
+
def test_three_hours(self):
|
|
76
|
+
_, out = run(payload(minutes=180, pct=41))
|
|
77
|
+
self.assertEqual(visible(out), "@(O_O)@ jitters wired | 180 min | ctx 41%\n")
|
|
78
|
+
|
|
79
|
+
def test_half_past_two(self):
|
|
80
|
+
_, out = run(payload(minutes=30, pct=20), hour=2)
|
|
81
|
+
self.assertEqual(visible(out), "@(-_-)@ c[_] jitters groggy | 30 min | ctx 20%\n")
|
|
82
|
+
|
|
83
|
+
def test_92_percent(self):
|
|
84
|
+
_, out = run(payload(minutes=60, pct=92))
|
|
85
|
+
self.assertEqual(visible(out), "@(x_x)@ jitters fried | 60 min | ctx 92%\n")
|
|
86
|
+
|
|
87
|
+
def test_percent_from_current_usage_when_null(self):
|
|
88
|
+
d = payload(minutes=10)
|
|
89
|
+
d["context_window"].update(used_percentage=None, current_usage={
|
|
90
|
+
"input_tokens": 100000, "cache_creation_input_tokens": 40000, "cache_read_input_tokens": 40000, "output_tokens": 999})
|
|
91
|
+
_, out = run(d)
|
|
92
|
+
self.assertEqual(visible(out), "@(x_x)@ jitters fried | 10 min | ctx 90%\n")
|
|
93
|
+
|
|
94
|
+
def test_exceeds_200k_with_no_percent_is_fried(self):
|
|
95
|
+
d = payload(minutes=10)
|
|
96
|
+
d["context_window"] = {}
|
|
97
|
+
d["exceeds_200k_tokens"] = True
|
|
98
|
+
_, out = run(d)
|
|
99
|
+
self.assertEqual(visible(out), "@(x_x)@ jitters fried | 10 min | ctx >200k\n")
|
|
100
|
+
|
|
101
|
+
def test_missing_fields(self):
|
|
102
|
+
_, out = run({})
|
|
103
|
+
self.assertEqual(visible(out), "@(^_^)@ jitters fresh\n")
|
|
104
|
+
|
|
105
|
+
def test_bad_input_never_raises(self):
|
|
106
|
+
for raw in ("", "not json", "[1,2]", "null", '{"cost": "x", "context_window": 5}',
|
|
107
|
+
'{"cost": {"total_duration_ms": "lots"}, "context_window": {"used_percentage": "half"}}'):
|
|
108
|
+
code, out = run(raw)
|
|
109
|
+
self.assertEqual(code, 0, raw)
|
|
110
|
+
self.assertTrue(visible(out).startswith("@(^_^)@ jitters"), raw)
|
|
111
|
+
|
|
112
|
+
def test_fits_80_and_narrow_columns(self):
|
|
113
|
+
_, out = run(payload(minutes=99999, pct=100), hour=3)
|
|
114
|
+
self.assertLessEqual(len(visible(out).rstrip("\n")), 80)
|
|
115
|
+
_, out = run(payload(minutes=180, pct=41), columns=24)
|
|
116
|
+
self.assertLessEqual(len(visible(out).rstrip("\n")), 24)
|
|
117
|
+
self.assertIn("jitters", visible(out))
|
|
118
|
+
|
|
119
|
+
def test_link_is_osc8_on_the_word_with_the_week_mood(self):
|
|
120
|
+
_, out = run(payload(minutes=180, pct=41))
|
|
121
|
+
self.assertIn("\x1b]8;;https://vibeoverflow.lol/week?m=wired&src=sl\x07jitters\x1b]8;;\x07", out)
|
|
122
|
+
_, out = run(payload(minutes=5, pct=8))
|
|
123
|
+
self.assertIn("week?m=steady&src=sl", out)
|
|
124
|
+
|
|
125
|
+
def test_no_link(self):
|
|
126
|
+
_, out = run(payload(minutes=5, pct=8), args=["--no-link"])
|
|
127
|
+
self.assertNotIn("\x1b", out)
|
|
128
|
+
_, out = run(payload(minutes=5, pct=8), env={"JITTERS_LINK": "0"})
|
|
129
|
+
self.assertNotIn("\x1b", out)
|
|
130
|
+
|
|
131
|
+
def test_only_the_state_goes_in_the_link(self):
|
|
132
|
+
_, out = run(payload(minutes=180, pct=41, session_id="secret-session"))
|
|
133
|
+
url = re.search(r"\x1b\]8;;([^\x07]*)\x07", out).group(1)
|
|
134
|
+
self.assertEqual(url, "https://vibeoverflow.lol/week?m=wired&src=sl")
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class Wrap(unittest.TestCase):
|
|
138
|
+
def test_appends_to_the_coders_own_line(self):
|
|
139
|
+
_, out = run(payload(minutes=5, pct=8), args=["--no-link", "--", "printf", "main *"])
|
|
140
|
+
self.assertEqual(out, "main * @(^_^)@ jitters\n")
|
|
141
|
+
|
|
142
|
+
def test_wrapped_command_gets_the_same_stdin(self):
|
|
143
|
+
cmd = f"{sys.executable} -c \"import json,sys; print(json.load(sys.stdin)['model']['display_name'])\""
|
|
144
|
+
_, out = run(payload(minutes=200, pct=50), args=["--no-link", "--", cmd])
|
|
145
|
+
self.assertEqual(out, "Opus @(O_O)@ jitters\n")
|
|
146
|
+
|
|
147
|
+
def test_keeps_extra_lines_and_ansi(self):
|
|
148
|
+
_, out = run(payload(minutes=5, pct=8), args=["--no-link", "--", "printf '\\033[32mok\\033[0m\\nsecond\\n'"])
|
|
149
|
+
self.assertEqual(out, "\x1b[32mok\x1b[0m @(^_^)@ jitters\nsecond\n")
|
|
150
|
+
|
|
151
|
+
def test_too_wide_goes_on_its_own_line(self):
|
|
152
|
+
_, out = run(payload(minutes=5, pct=8), columns=40, args=["--no-link", "--", "printf", "x" * 38])
|
|
153
|
+
self.assertEqual(out, "x" * 38 + "\n@(^_^)@ jitters\n")
|
|
154
|
+
|
|
155
|
+
def test_failing_command_falls_back_to_the_full_line(self):
|
|
156
|
+
code, out = run(payload(minutes=5, pct=8), args=["--no-link", "--", "exit 3"])
|
|
157
|
+
self.assertEqual(code, 0)
|
|
158
|
+
self.assertEqual(out, "@(^_^)@ jitters fresh | 5 min | ctx 8%\n")
|
|
159
|
+
|
|
160
|
+
def test_slow_command_falls_back(self):
|
|
161
|
+
t = time.time()
|
|
162
|
+
_, out = run(payload(minutes=5, pct=8), args=["--no-link", "--", "sleep 5"], env={"JITTERS_WRAP_TIMEOUT": "0.3"})
|
|
163
|
+
self.assertLess(time.time() - t, 3)
|
|
164
|
+
self.assertEqual(out, "@(^_^)@ jitters fresh | 5 min | ctx 8%\n")
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
class Entry(unittest.TestCase):
|
|
168
|
+
def test_cli_runs_it_from_stdin(self):
|
|
169
|
+
p = subprocess.run([sys.executable, "-m", "jitters_cli", "statusline", "--no-link"], cwd=os.path.join(HERE, ".."),
|
|
170
|
+
input=json.dumps(payload(minutes=5, pct=8)), capture_output=True, text=True, timeout=10)
|
|
171
|
+
self.assertEqual(p.returncode, 0, p.stderr)
|
|
172
|
+
self.assertTrue(p.stdout.startswith("@("), p.stdout)
|
|
173
|
+
self.assertEqual(p.stderr, "")
|
|
174
|
+
|
|
175
|
+
def test_imports_only_the_standard_library_and_no_network(self):
|
|
176
|
+
code = ("import sys; import jitters_cli.cli as c; "
|
|
177
|
+
"bad = [m for m in sys.modules if m == 'jitters_cli.core' or m.split('.')[0] in ('socket', 'urllib', 'http', 'ssl', 'subprocess')]; "
|
|
178
|
+
"print(bad)")
|
|
179
|
+
p = subprocess.run([sys.executable, "-c", code], cwd=os.path.join(HERE, ".."), capture_output=True, text=True, timeout=10)
|
|
180
|
+
self.assertEqual(p.stdout.strip(), "[]", p.stderr)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
if __name__ == "__main__":
|
|
184
|
+
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|