limitcast 0.17.1 → 0.17.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/package.json +1 -1
- package/src/formats.mjs +15 -4
- package/src/memory.mjs +8 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "limitcast",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.2",
|
|
4
4
|
"description": "Stretch your Claude Code plan: measure what every session loads before you type, cut what you never use, and stop runaway subagents before they burn your window.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/formats.mjs
CHANGED
|
@@ -16,16 +16,25 @@ export async function formatChecks() {
|
|
|
16
16
|
|
|
17
17
|
const feedPath = join(stateDir(), 'last-feed.json');
|
|
18
18
|
if (existsSync(feedPath)) {
|
|
19
|
-
let
|
|
19
|
+
let feed;
|
|
20
20
|
try {
|
|
21
|
-
|
|
21
|
+
feed = JSON.parse(readFileSync(feedPath, 'utf8'));
|
|
22
22
|
} catch {
|
|
23
23
|
/* unreadable: reported below */
|
|
24
24
|
}
|
|
25
|
+
const rl = feed?.rate_limits;
|
|
26
|
+
// Claude omits subscription windows before a response, after reset, or without a supported subscription.
|
|
27
|
+
const noWindows = rl == null || (typeof rl === 'object' && !Array.isArray(rl) && !('five_hour' in rl) && !('seven_day' in rl));
|
|
28
|
+
const validFeed = feed && typeof feed === 'object' && !Array.isArray(feed);
|
|
25
29
|
out.push(
|
|
26
30
|
Number.isFinite(rl?.five_hour?.used_percentage ?? rl?.seven_day?.used_percentage)
|
|
27
31
|
? { ok: true, line: 'Claude Code status-line feed: limit readings present' }
|
|
28
|
-
:
|
|
32
|
+
: validFeed && noWindows
|
|
33
|
+
? {
|
|
34
|
+
ok: true,
|
|
35
|
+
line: 'Claude Code status-line feed: no subscription limit readings available yet (normal before a response or without a supported subscription)',
|
|
36
|
+
}
|
|
37
|
+
: { ok: false, line: 'Claude Code status-line feed has unreadable rate_limits: the format may have changed, update limitcast' },
|
|
29
38
|
);
|
|
30
39
|
}
|
|
31
40
|
|
|
@@ -35,7 +44,9 @@ export async function formatChecks() {
|
|
|
35
44
|
out.push(
|
|
36
45
|
found
|
|
37
46
|
? { ok: true, line: 'Claude Code transcripts: usage records readable' }
|
|
38
|
-
:
|
|
47
|
+
: !(await findLine(claude, '"assistant"', (ev) => ev?.type === 'assistant'))
|
|
48
|
+
? { ok: true, line: 'Claude Code: latest session has no assistant usage yet (normal before its first response)' }
|
|
49
|
+
: { ok: false, line: `Claude Code transcript has no readable usage records (${claude}): the format may have changed, update limitcast` },
|
|
39
50
|
);
|
|
40
51
|
}
|
|
41
52
|
|
package/src/memory.mjs
CHANGED
|
@@ -28,7 +28,7 @@ const slug = (s) => s.toLowerCase().replace(/\.md$/, '').replace(/[_\s]/g, '-');
|
|
|
28
28
|
export function scanMemory(dir) {
|
|
29
29
|
const indexPath = join(dir, 'MEMORY.md');
|
|
30
30
|
if (!existsSync(indexPath)) return null;
|
|
31
|
-
const names = readdirSync(dir).filter((f) => f.endsWith('.md'));
|
|
31
|
+
const names = readdirSync(dir).filter((f) => f.endsWith('.md') && !['CLAUDE.md', 'AGENTS.md', 'CODEX.md'].includes(f));
|
|
32
32
|
/** @type {Map<string, string>} */
|
|
33
33
|
const text = new Map(names.map((f) => [f, readFileSync(join(dir, f), 'utf8')]));
|
|
34
34
|
const index = /** @type {string} */ (text.get('MEMORY.md'));
|
|
@@ -49,6 +49,8 @@ export function scanMemory(dir) {
|
|
|
49
49
|
}),
|
|
50
50
|
// [[name]] links; one with no file yet is allowed (a note worth writing later), so never "broken".
|
|
51
51
|
...[...body.matchAll(/\[\[([^\]|#]+)/g)].map((m) => bySlug.get(slug(m[1].trim())) ?? ''),
|
|
52
|
+
// Catalogs also route to local notes by plain or backticked filename.
|
|
53
|
+
...[...body.matchAll(/(?<![\w/.-])([A-Za-z0-9_-]+\.md)\b/g)].map((m) => (text.has(m[1]) ? m[1] : '')),
|
|
52
54
|
];
|
|
53
55
|
for (const t of targets) {
|
|
54
56
|
if (!text.has(t) || reached.has(t)) continue;
|
|
@@ -94,7 +96,7 @@ export function memoryCheck(s) {
|
|
|
94
96
|
};
|
|
95
97
|
const parts = [
|
|
96
98
|
s.index.lines >= INDEX_LINES * 0.8 || s.index.bytes >= INDEX_BYTES * 0.8 ? 'index close to the cap' : '',
|
|
97
|
-
s.orphans.length ? `${s.orphans.length} not linked from the index` : '',
|
|
99
|
+
s.orphans.length ? `${s.orphans.length} not linked from the local index (may be externally indexed)` : '',
|
|
98
100
|
s.broken.length ? `${s.broken.length} broken link${s.broken.length === 1 ? '' : 's'}` : '',
|
|
99
101
|
s.big.length ? `${s.big.length} file${s.big.length === 1 ? '' : 's'} over ${BIG_LINES} lines` : '',
|
|
100
102
|
].filter(Boolean);
|
|
@@ -112,7 +114,10 @@ export function memoryReport(s, dir = '') {
|
|
|
112
114
|
`Index: MEMORY.md ${s.index.lines} / ${INDEX_LINES} lines, ${(s.index.bytes / 1000).toFixed(1)} / 25 KB${overCap(s) ? ' (OVER: what is past the cap is never loaded)' : ''}`,
|
|
113
115
|
`Topic files: ${s.files}`,
|
|
114
116
|
];
|
|
115
|
-
if (s.orphans.length)
|
|
117
|
+
if (s.orphans.length)
|
|
118
|
+
out.push(
|
|
119
|
+
`Not linked from the local index (${s.orphans.length}; check external catalogs before treating these as orphans): ${s.orphans.join(', ')}`,
|
|
120
|
+
);
|
|
116
121
|
if (s.broken.length) out.push(`Broken links (${s.broken.length}): ${s.broken.map((b) => `${b.from} -> ${b.target}`).join(', ')}`);
|
|
117
122
|
if (s.big.length)
|
|
118
123
|
out.push(
|