claudekit-terminal 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +100 -2
- package/bin/claudekit-terminal.js +56 -0
- package/lib/cli.js +703 -0
- package/lib/docs.js +120 -0
- package/lib/format.js +51 -0
- package/lib/insights.js +196 -0
- package/lib/packs.json +205 -0
- package/lib/paths.js +46 -0
- package/lib/settings.js +82 -0
- package/lib/setup.js +172 -0
- package/lib/skills.js +116 -0
- package/lib/state.js +133 -0
- package/lib/statusline.js +206 -0
- package/lib/tokens.js +52 -0
- package/lib/transcripts.js +296 -0
- package/package.json +32 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Avish Shah
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,101 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ClaudeKit for the terminal
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Your Claude limits, chats and prompts in the terminal. One command sets it up.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
Opus 5.5 · ctx 45% │ 5h 62% +3% · resets 3:10 PM · out ~2:40 PM · ~6 replies left │ week 41% · Thu 9:00 AM · ~13%/day
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx claudekit-terminal setup
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
That's it. Send a message in Claude Code and the status line appears after the first reply. Undo it all with `npx claudekit-terminal remove`.
|
|
14
|
+
|
|
15
|
+
Free, no account, zero dependencies, no network calls. Needs Node.js 18 or newer. It's the terminal companion to the [ClaudeKit browser extension](https://claudekit.app/get?utm_source=terminal&utm_medium=readme) and has the same features wherever a terminal can.
|
|
16
|
+
|
|
17
|
+
## What setup does
|
|
18
|
+
|
|
19
|
+
- Adds the status line to Claude Code's `~/.claude/settings.json`. Your old file is saved as `settings.json.claudekit-backup`. If you already have your own status line, it's kept unless you add `--force`, and `remove` puts it back.
|
|
20
|
+
- Adds `/ck-` commands to Claude Code (`~/.claude/skills/ck-*`). They run only when you type them.
|
|
21
|
+
- Run it again any time. It only updates what it added and never touches a `ck-` command you made yourself.
|
|
22
|
+
|
|
23
|
+
Options: `--packs developers,agents,marketing` (default: developers), `--no-packs`, `--auto-backup`, `--force`.
|
|
24
|
+
|
|
25
|
+
Faster status line: `npm install -g claudekit-terminal`, then `claudekit-terminal setup`. With a global install, `npx` no longer checks npm on every start.
|
|
26
|
+
|
|
27
|
+
## The status line
|
|
28
|
+
|
|
29
|
+
| Part | What it means |
|
|
30
|
+
| --- | --- |
|
|
31
|
+
| `ctx 45%` | How full this chat's context window is |
|
|
32
|
+
| `5h 62%` | Your 5-hour session limit used: green, yellow from 70%, red from 90% |
|
|
33
|
+
| `+3%` | What your current prompt has cost of the session so far |
|
|
34
|
+
| `resets 3:10 PM` | When the session resets, in your time. At 100% it says `back 3:10 PM` |
|
|
35
|
+
| `out ~2:40 PM` | When you run out at your pace over the last hour (from 20% used) |
|
|
36
|
+
| `~6 replies left` | About how many prompts are left at your pace on this model (from 50% used) |
|
|
37
|
+
| `week 41% · Thu 9:00 AM · ~13%/day` | Your weekly limit, when it resets, and a daily budget |
|
|
38
|
+
| `use it: resets in 10h` | In the last day before the weekly reset with 25% or more left: unused limit doesn't roll over |
|
|
39
|
+
| `spend 63% of $500` | A spend limit, when your plan has one |
|
|
40
|
+
| `near limit: /ck-handoff` | At 90%: save your context before you're cut off |
|
|
41
|
+
|
|
42
|
+
Limits show for Claude Pro, Max and Ultra plans, after the first reply in a session. With an API key you see the model and context only.
|
|
43
|
+
|
|
44
|
+
Options: `--no-color` (or `NO_COLOR`), `--no-history` (or `CLAUDEKIT_NO_HISTORY=1`) to keep no numbers. Without them the forecast, prompt cost and replies left can't be worked out.
|
|
45
|
+
|
|
46
|
+
## Commands in Claude Code
|
|
47
|
+
|
|
48
|
+
| Type | What it does |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| `/ck-handoff` | A Handoff Brief: goal, decisions, done, what's left, key facts and files, saved in `~/.claudekit/briefs`. Continue later with `claudekit-terminal brief --start` |
|
|
51
|
+
| `/ck-optimize <draft>` | Rewrites a draft prompt for a clearer result and shows the token change |
|
|
52
|
+
| `/ck-pin [text]` | Pins your last answer's key point, or what you name, for this folder |
|
|
53
|
+
| Limit Saver | `/ck-compress-and-restart`, `/ck-plan-before-building`, `/ck-short-answers-mode`, `/ck-only-what-changed` make your limit last longer |
|
|
54
|
+
| Prompt packs | The extension's free packs as commands, such as `/ck-review-a-diff`, `/ck-find-the-root-cause` and `/ck-tests-first`. Add more with `claudekit-terminal prompts pack agents` or `marketing` |
|
|
55
|
+
| Your prompts | `claudekit-terminal prompts add "Weekly report" "Summarize…"` gives you `/ck-weekly-report` |
|
|
56
|
+
|
|
57
|
+
## Commands in your terminal
|
|
58
|
+
|
|
59
|
+
Run them as `claudekit-terminal <command>` (or `npx claudekit-terminal <command>`).
|
|
60
|
+
|
|
61
|
+
**Your limits**
|
|
62
|
+
|
|
63
|
+
- `usage`: every limit with bars and reset times, the run-out forecast, replies left, what your last prompt and this chat cost, cost per model, and days without a limit.
|
|
64
|
+
- `week`: your Claude week, with weekly % used, busiest day, days active, limit hits, and a by-day chart.
|
|
65
|
+
- `notify`: at a limit, waits and sends a desktop notification when Claude is back. `--test` sends one now.
|
|
66
|
+
|
|
67
|
+
**Your chats.** Claude Code keeps every chat in `~/.claude/projects` and deletes them after 30 days by default. These commands read those files and never change them.
|
|
68
|
+
|
|
69
|
+
- `search <words>`: every chat with all the words, the matching lines, and how to reopen it.
|
|
70
|
+
- `map [chat]`: a numbered outline of a chat, one line per prompt.
|
|
71
|
+
- `export [chat]`: Markdown by default. Use `--format json` or `txt`, `--turns 3-5` (or `2,4`) for some prompts, and `--out file.md`, or `--out -` to print.
|
|
72
|
+
- `backup [folder]`: one Markdown file per chat, by project, in `~/claudekit-backup`, writing only new and changed chats. `--auto` backs up after every session; `--auto off` stops it.
|
|
73
|
+
- `fork [chat]`: opens a copy of a chat in Claude Code to try another direction, keeping the original.
|
|
74
|
+
- `reference [chat]`: saves a chat in `~/.claudekit/references`. Type `@<path>` in Claude Code to use it as context in another chat.
|
|
75
|
+
- `brief`: your last Handoff Brief for this folder. `--start` opens a new session from it.
|
|
76
|
+
- `pins`: this folder's pins (`--all` for every folder). `pin "text"` adds one.
|
|
77
|
+
|
|
78
|
+
`[chat]` is the newest chat in this folder, a session id (or its first 4+ characters), or words from its title.
|
|
79
|
+
|
|
80
|
+
**Prompts and tokens**
|
|
81
|
+
|
|
82
|
+
- `prompts`: your `/ck-` commands, with `add`, `remove`, `show`, `packs` and `pack <name>`.
|
|
83
|
+
- `tokens [file]`: words and estimated tokens of files or piped text (`pbpaste | claudekit-terminal tokens`).
|
|
84
|
+
|
|
85
|
+
`docs` prints all of this; `help` prints the short list.
|
|
86
|
+
|
|
87
|
+
## Privacy
|
|
88
|
+
|
|
89
|
+
- It makes no network calls. (`npx` itself may check npm for a newer version; a global install avoids that.)
|
|
90
|
+
- It reads the JSON Claude Code passes to the status line, and Claude Code's chat files on your computer when you run a chat command.
|
|
91
|
+
- It keeps a few usage numbers in `~/.claudekit/usage.json` for 8 days: percent used, reset times, when each reading was taken, the model family, and short numbers standing for the session and prompt. No chat text. It also keeps what you save (pins, briefs, references).
|
|
92
|
+
- Nothing is sent anywhere. The status line never shows ads.
|
|
93
|
+
- `claudekit-terminal remove --all` deletes `~/.claudekit`. Backups you made stay where you put them.
|
|
94
|
+
|
|
95
|
+
## Moving from claudekit-statusline
|
|
96
|
+
|
|
97
|
+
This package replaces `claudekit-statusline`. Run `npx claudekit-terminal setup` and it swaps the old status line for the new one.
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
MIT
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// ClaudeKit for the terminal. With no command and JSON piped in (that's how Claude Code runs a
|
|
3
|
+
// status line), it prints the status line and always exits 0 so it can never break Claude Code.
|
|
4
|
+
// Every other command: `claudekit-terminal help`.
|
|
5
|
+
|
|
6
|
+
import { FALLBACK } from '../lib/statusline.js';
|
|
7
|
+
|
|
8
|
+
const argv = process.argv.slice(2);
|
|
9
|
+
const first = argv[0];
|
|
10
|
+
const isStatusLine = first === 'statusline' || ((!first || first.startsWith('--')) && !process.stdin.isTTY && !['--help', '-h', '--version', '-v'].includes(first));
|
|
11
|
+
|
|
12
|
+
if (isStatusLine) {
|
|
13
|
+
runStatusLine();
|
|
14
|
+
} else {
|
|
15
|
+
const { run } = await import('../lib/cli.js');
|
|
16
|
+
process.exitCode = await run(argv);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function runStatusLine() {
|
|
20
|
+
const STDIN_TIMEOUT_MS = 1000;
|
|
21
|
+
let finished = false;
|
|
22
|
+
const flags = first === 'statusline' ? argv.slice(1) : argv;
|
|
23
|
+
|
|
24
|
+
async function finish(raw) {
|
|
25
|
+
if (finished) return;
|
|
26
|
+
finished = true;
|
|
27
|
+
let line = FALLBACK;
|
|
28
|
+
try {
|
|
29
|
+
const [{ statusLineFor, defaultIo }] = await Promise.all([import('../lib/cli.js')]);
|
|
30
|
+
line = statusLineFor(raw, flags, defaultIo());
|
|
31
|
+
} catch {
|
|
32
|
+
line = FALLBACK;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
process.stdout.write(`${line}\n`, () => process.exit(0));
|
|
36
|
+
} catch {
|
|
37
|
+
process.exit(0);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
process.on('uncaughtException', () => (finished ? process.exit(0) : finish('')));
|
|
42
|
+
process.stdout.on('error', () => process.exit(0));
|
|
43
|
+
|
|
44
|
+
if (process.stdin.isTTY) {
|
|
45
|
+
finish('');
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const chunks = [];
|
|
49
|
+
const done = () => finish(chunks.join(''));
|
|
50
|
+
process.stdin.setEncoding('utf8');
|
|
51
|
+
process.stdin.on('data', (chunk) => chunks.push(chunk));
|
|
52
|
+
process.stdin.on('end', done);
|
|
53
|
+
process.stdin.on('error', done);
|
|
54
|
+
// Never hang if stdin stays open.
|
|
55
|
+
setTimeout(done, STDIN_TIMEOUT_MS).unref();
|
|
56
|
+
}
|