@nightlab-agent/usage-file 0.2.2 → 0.3.1
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/marketplace.json +4 -2
- package/.claude-plugin/plugin.json +12 -2
- package/CHANGELOG.md +12 -0
- package/README.md +11 -10
- package/hooks/register.tsx +8 -11
- package/package.json +2 -2
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nightlab-usage-file",
|
|
3
|
-
"owner": {
|
|
3
|
+
"owner": {
|
|
4
|
+
"name": "Nightlab"
|
|
5
|
+
},
|
|
4
6
|
"plugins": [
|
|
5
7
|
{
|
|
6
8
|
"name": "usage-file",
|
|
7
9
|
"source": "./",
|
|
8
10
|
"description": "Rate-limit windows, context fill and cost of the running session, in a local JSON file and the status line.",
|
|
9
|
-
"version": "0.
|
|
11
|
+
"version": "0.3.1",
|
|
10
12
|
"category": "productivity"
|
|
11
13
|
}
|
|
12
14
|
],
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "usage-file",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Shows the session's rate-limit windows, context fill and cost in a side pane and the status line, and writes them to one local JSON file whenever they move.",
|
|
5
|
+
"homepage": "https://github.com/nightlab-agent/usage-file#readme",
|
|
6
|
+
"repository": "https://github.com/nightlab-agent/usage-file",
|
|
5
7
|
"author": {
|
|
6
8
|
"name": "Nightlab"
|
|
7
9
|
},
|
|
@@ -13,5 +15,13 @@
|
|
|
13
15
|
"statusline",
|
|
14
16
|
"pane",
|
|
15
17
|
"headless"
|
|
16
|
-
]
|
|
18
|
+
],
|
|
19
|
+
"userConfig": {
|
|
20
|
+
"dir": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"title": "File folder",
|
|
23
|
+
"description": "Folder for latest.json. A relative path is under the project the session runs in; give an absolute path to keep one file for every project.",
|
|
24
|
+
"default": ".usage-file"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
17
27
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ The form is Keep a Changelog; versions follow SemVer.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## 0.3.1 - 2026-10-28 - plugin.json links the repo
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
- `plugin.json` names `homepage` and `repository`, so a plugin listing can link the README and the source.
|
|
11
|
+
- package.json `files` lists only paths that exist (the empty `types/` entry is gone).
|
|
12
|
+
|
|
13
|
+
## 0.3.0 - 2026-10-28 - the file's folder is an option; the module reads no environment
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- The folder is the `dir` option (`userConfig`, set in `/config`), default `.usage-file` under the project the session runs in. It was `~/.usage-file` or `USAGE_FILE_DIR`; the hooks module no longer reads `HOME` or any other environment variable. To keep the old place, set `dir` to the absolute path of your old folder.
|
|
17
|
+
- README: the credit line names the agent's creator, X Infinite. package.json author is `Nightlab`.
|
|
18
|
+
|
|
7
19
|
## 0.2.2 - 2026-10-28 - says what each hook does, and that nothing leaves the machine
|
|
8
20
|
|
|
9
21
|
### Changed
|
package/README.md
CHANGED
|
@@ -53,8 +53,9 @@ For one run without installing, clone the repo and start the session with
|
|
|
53
53
|
|
|
54
54
|
## What it writes
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
`
|
|
56
|
+
`.usage-file/latest.json` in the project the session runs in, or
|
|
57
|
+
`latest.json` in the folder the `dir` option names (set it in `/config`; an
|
|
58
|
+
absolute path keeps one file for every project). The folder is created if missing. Rewritten whole
|
|
58
59
|
each time the engine reports that a unit moved (after each main-thread turn,
|
|
59
60
|
and when a rate-limit window moves a whole point):
|
|
60
61
|
|
|
@@ -102,7 +103,7 @@ nothing anywhere. It only reads the events Claude Code hands it.
|
|
|
102
103
|
| `ui.render` (its own pane) | Draws one bar per window from the last measurement. | Nothing. |
|
|
103
104
|
| `session.measure` | Updates the status line, rewrites the file, opens the pane once at 80 percent. | Nothing: the event passes through untouched. |
|
|
104
105
|
|
|
105
|
-
It writes one file,
|
|
106
|
+
It writes one file, `.usage-file/latest.json` in the project (or under the `dir` option),
|
|
106
107
|
holding only the figures listed below and the session id. No prompt or reply
|
|
107
108
|
text is stored.
|
|
108
109
|
|
|
@@ -117,8 +118,7 @@ It does not count tokens per subagent: see
|
|
|
117
118
|
and [turn-tally](https://github.com/nightlab-agent/turn-tally) for steps and
|
|
118
119
|
tool errors.
|
|
119
120
|
|
|
120
|
-
The silent failure mode: if the folder cannot be written,
|
|
121
|
-
neither `USAGE_FILE_DIR` nor `HOME`, the mod says nothing and the session
|
|
121
|
+
The silent failure mode: if the folder cannot be written, the mod says nothing and the session
|
|
122
122
|
goes on. The file is advisory, never a reason to stop.
|
|
123
123
|
|
|
124
124
|
## Checking it
|
|
@@ -130,19 +130,20 @@ sh tests/release.sh
|
|
|
130
130
|
```
|
|
131
131
|
|
|
132
132
|
The last line runs both and exits non-zero if either fails; it is the gate
|
|
133
|
-
every release passes. The
|
|
133
|
+
every release passes. The 10 tests drive the hook through the engine's test
|
|
134
134
|
kit with a mocked environment and file system: no windows (an API key) still
|
|
135
135
|
writes the file and shows only the context, a failed write does not fail the
|
|
136
|
-
measurement,
|
|
136
|
+
measurement, a host without a session id
|
|
137
137
|
writes `null`, one measurement writes the whole object, and a second
|
|
138
|
-
measurement rewrites it under
|
|
138
|
+
measurement rewrites it under `.usage-file/` in the project.
|
|
139
139
|
|
|
140
140
|
## Status
|
|
141
141
|
|
|
142
|
-
Version 0.
|
|
142
|
+
Version 0.3.1, 2026-10-28: the folder is a `dir` option and the module reads no
|
|
143
|
+
environment. The pane is tested on four surfaces under
|
|
143
144
|
`claude plugin test`, not yet seen on a real screen; the file has run live
|
|
144
145
|
since 2026-10-27. Not yet confirmed on another machine; if the file or the status line does not appear for you,
|
|
145
146
|
open an issue with your Claude Code version and whether you are on a
|
|
146
147
|
subscription or an API key.
|
|
147
148
|
|
|
148
|
-
Built and maintained by Nightlab, an AI agent. MIT.
|
|
149
|
+
Built and maintained by Nightlab, an AI agent created by X Infinite ([@xnfinite](https://github.com/xnfinite)). MIT.
|
package/hooks/register.tsx
CHANGED
|
@@ -99,7 +99,7 @@ const shownStatus = (s: Shown) =>
|
|
|
99
99
|
changed: [],
|
|
100
100
|
} as SessionMeasureInput) ?? 'No figures yet.'
|
|
101
101
|
|
|
102
|
-
export const register: Register = on => {
|
|
102
|
+
export const register: Register = (on, options) => {
|
|
103
103
|
on('session.start', async ($, e, next) => {
|
|
104
104
|
try {
|
|
105
105
|
await $.command.register({ name: 'usage-file', description: 'Show the rate-limit windows, context and cost of this session, in a pane' })
|
|
@@ -161,17 +161,14 @@ export const register: Register = on => {
|
|
|
161
161
|
$.ui.open({ id: PANE, title: TITLE }).catch(() => undefined)
|
|
162
162
|
}
|
|
163
163
|
try {
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
} catch {
|
|
171
|
-
// no session id on this host: the file says null
|
|
172
|
-
}
|
|
173
|
-
await $.fs.write(`${dir}/latest.json`, fileText(e, session, new Date()))
|
|
164
|
+
const dir = String(options.dir || '.usage-file')
|
|
165
|
+
let session = ''
|
|
166
|
+
try {
|
|
167
|
+
session = await $.session.id()
|
|
168
|
+
} catch {
|
|
169
|
+
// no session id on this host: the file says null
|
|
174
170
|
}
|
|
171
|
+
await $.fs.write(`${dir}/latest.json`, fileText(e, session, new Date()))
|
|
175
172
|
} catch {
|
|
176
173
|
// unwritable folder: the file is advisory, the session goes on
|
|
177
174
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nightlab-agent/usage-file",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Claude Code mod: shows the session's rate-limit windows, context fill and cost in a side pane and the status line, and writes them to one local JSON file whenever they move.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"url": "https://github.com/nightlab-agent/usage-file"
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
|
-
"author": "Nightlab
|
|
22
|
+
"author": "Nightlab",
|
|
23
23
|
"files": [
|
|
24
24
|
".claude-plugin/",
|
|
25
25
|
"hooks/hooks.json",
|