kankaku-claude 1.0.1 → 1.0.2
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/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +14 -0
- package/README.md +7 -2
- package/dist/cli-core.js +32 -3
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kankaku",
|
|
3
3
|
"description": "Records how long Claude Code works on each of your prompts: wall time, waiting time, work time and cost, per prompt, in kankaku's worklog format.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "soyunninja"
|
|
7
7
|
},
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@ All notable changes to this project are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
6
|
|
|
7
|
+
## 1.0.2 — 2026-09-29
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **`/kankaku:status` promised a recovery that would not happen.** The
|
|
12
|
+
line compared the session total with the sum of ALL the session's
|
|
13
|
+
records and, when idle, called the whole difference "unrecorded, goes
|
|
14
|
+
to the next prompt". For a session that spent money before it had a
|
|
15
|
+
chained baseline (upgraded mid-way, or resumed without its state) that
|
|
16
|
+
was false: the next prompt only carries what was spent since the last
|
|
17
|
+
settle. The line now separates `this prompt so far`, `pending, goes to
|
|
18
|
+
the next prompt` and `never recorded`. Attribution itself was correct
|
|
19
|
+
in 1.0.1 and is unchanged.
|
|
20
|
+
|
|
7
21
|
## 1.0.1 — 2026-09-29
|
|
8
22
|
|
|
9
23
|
### Fixed
|
package/README.md
CHANGED
|
@@ -142,8 +142,13 @@ anything behind in whatever project happens to be open.
|
|
|
142
142
|
session id, whether its process is still alive, whether a prompt is open,
|
|
143
143
|
and the last cost the statusline reported, followed by `recorded $X of
|
|
144
144
|
$Y` (the sum of this session's record costs in this project's worklog
|
|
145
|
-
against the session total). When
|
|
146
|
-
|
|
145
|
+
against the session total). When they differ by more than a cent the line says what the
|
|
146
|
+
difference is: `(this prompt so far $R)` for the open prompt's running
|
|
147
|
+
spend, `(pending $P, goes to the next prompt)` for what was spent since
|
|
148
|
+
the last settle of a session that has a chained baseline, and
|
|
149
|
+
`(never recorded $Z)` for spend from before the session had one (a
|
|
150
|
+
session upgraded mid-way, or resumed without its state) — no later
|
|
151
|
+
prompt carries that part.
|
|
147
152
|
The resolved work target comes first (wraps `node dist/cli.js status`).
|
|
148
153
|
- `/kankaku:task` — links this session to a hub task (wraps
|
|
149
154
|
`node dist/cli.js task`); see "Linking a task" below.
|
package/dist/cli-core.js
CHANGED
|
@@ -79,9 +79,38 @@ function formatStatusLine(sessionId, stateFile, isAlive, env, recordedUsd) {
|
|
|
79
79
|
const base = `${sessionId} pid ${state.pid} (${aliveWord}) ${promptWord} cost ${costWord}`;
|
|
80
80
|
if (!cost)
|
|
81
81
|
return base;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
return `${base} recorded $${recordedUsd.toFixed(2)} of $${cost.totalUsd.toFixed(2)}${describeGap(state, cost.totalUsd, recordedUsd)}`;
|
|
83
|
+
}
|
|
84
|
+
/** Amounts of one cent or less are rounding noise, never reported. */
|
|
85
|
+
const REPORTABLE_USD = 0.01;
|
|
86
|
+
/**
|
|
87
|
+
* Splits the difference between the session's total and what its records
|
|
88
|
+
* hold into what it actually is, so the line never promises a recovery
|
|
89
|
+
* that will not happen:
|
|
90
|
+
*
|
|
91
|
+
* - `this prompt so far`: the open prompt's running spend (total − its
|
|
92
|
+
* `costAtStart`); it lands in that prompt's own record at settle.
|
|
93
|
+
* - `pending, goes to the next prompt`: only when idle AND the session has
|
|
94
|
+
* a `costBaseline` — the next prompt starts there, so it picks this up.
|
|
95
|
+
* Without a baseline the next prompt starts at the snapshot and picks up
|
|
96
|
+
* nothing, so nothing is promised.
|
|
97
|
+
* - `never recorded`: whatever is left — spent before this session had a
|
|
98
|
+
* chained baseline (a session upgraded mid-way, or resumed without its
|
|
99
|
+
* state). It is in no record and no later prompt will carry it.
|
|
100
|
+
*/
|
|
101
|
+
function describeGap(state, totalUsd, recordedUsd) {
|
|
102
|
+
const start = state.promptOpen?.costAtStart;
|
|
103
|
+
const running = state.promptOpen && typeof start === "number" ? Math.max(0, totalUsd - start) : 0;
|
|
104
|
+
const pending = !state.promptOpen && typeof state.costBaseline === "number" ? Math.max(0, totalUsd - state.costBaseline) : 0;
|
|
105
|
+
const neverRecorded = totalUsd - recordedUsd - running - pending;
|
|
106
|
+
const parts = [];
|
|
107
|
+
if (running > REPORTABLE_USD)
|
|
108
|
+
parts.push(` (this prompt so far $${running.toFixed(2)})`);
|
|
109
|
+
if (pending > REPORTABLE_USD)
|
|
110
|
+
parts.push(` (pending $${pending.toFixed(2)}, goes to the next prompt)`);
|
|
111
|
+
if (neverRecorded > REPORTABLE_USD)
|
|
112
|
+
parts.push(` (never recorded $${neverRecorded.toFixed(2)})`);
|
|
113
|
+
return parts.join("");
|
|
85
114
|
}
|
|
86
115
|
function sessionIdFromStateFile(file) {
|
|
87
116
|
return basename(file).replace(/\.state\.json$/, "");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kankaku-claude",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Claude Code plugin that records how long the agent works on each user prompt, in kankaku's worklog format.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"prepublishOnly": "npm run check"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"kankaku-pi": "^1.0.
|
|
30
|
+
"kankaku-pi": "^1.0.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^24.13.4",
|