limitcast 0.10.0 → 0.10.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/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Stretch your Claude Code plan. Every session starts with ~100k tokens of context before you type, re-sent on every turn and to every subagent. limitcast measures what's in it, names what you never use, and stops runaway subagents before they burn the rest of your window.
4
4
 
5
+ ![limitcast status, trim and results running in a terminal](https://limitcast.dev/demo.gif)
6
+
5
7
  ```
6
8
  $ limitcast trim
7
9
  Every Claude Code session starts at 102.7k tokens before your first message.
package/bin/limitcast.mjs CHANGED
@@ -33,6 +33,7 @@ import { loadBlocks, resultsReport, resultsShare, resultsStats, weeklyDue, weekl
33
33
  import { claudeSamples, readCodex } from '../src/sources.mjs';
34
34
  import { countInteractiveSince, latestInteractiveTranscript } from '../src/startup.mjs';
35
35
  import { KEEP_MS, load, record, stateDir } from '../src/store.mjs';
36
+ import { forTerminal } from '../src/term.mjs';
36
37
  import { baseline, contributors, measuredSavings, shareSummary, startupReport, trimReport } from '../src/trim.mjs';
37
38
  import { claudeRoot, grokRoot, readUsage } from '../src/usage.mjs';
38
39
  import { dailyDue, foldEvents, loadValue, saveValue, scanSessions, valueSection, valueTotals } from '../src/value.mjs';
@@ -254,7 +255,7 @@ if (cmd === 'status') {
254
255
  ? `✓ Turned off ${changed.length} Codex MCP servers (enabled = false in ${codexConfigPath()}): ${changed.map((s) => s.name).join(', ')}\nTakes effect in your next Codex session. Undo: limitcast trim --codex --undo`
255
256
  : 'Nothing to turn off: every server that is on was used.',
256
257
  );
257
- } else console.log(r.text);
258
+ } else console.log(forTerminal(r.text));
258
259
  process.exit(0);
259
260
  }
260
261
  /** @type {import('../src/trim.mjs').Activity} */
@@ -298,7 +299,7 @@ if (cmd === 'status') {
298
299
  if (out) {
299
300
  writeFileSync(out, `${text}\n`);
300
301
  console.log(`Wrote ${out}`);
301
- } else console.log(text);
302
+ } else console.log(forTerminal(text));
302
303
  } else if (cmd === 'drift') {
303
304
  // SessionStart hook: tells the user (systemMessage, never the model's context) when starting context grew.
304
305
  const hook = args.includes('--hook');
@@ -335,7 +336,7 @@ if (cmd === 'status') {
335
336
  if (lines.length) console.log(JSON.stringify({ systemMessage: lines.join('\n') }));
336
337
  } else if (!latest) console.log('No interactive Claude Code session found yet.');
337
338
  else if (!d) console.log('Starting context recorded. limitcast will tell you when it grows.');
338
- else console.log(d.alert ? driftMessage(d) : 'No meaningful change in your starting context since the last session.');
339
+ else console.log(d.alert ? forTerminal(driftMessage(d)) : 'No meaningful change in your starting context since the last session.');
339
340
  } catch (e) {
340
341
  if (!hook) throw e; // a hook must never break session start
341
342
  }
@@ -347,7 +348,9 @@ if (cmd === 'status') {
347
348
  const latest = await latestInteractiveTranscript(claudeRoot());
348
349
  if (latest) recordOverhead(snapshot(latest));
349
350
  const s = loadOverhead();
350
- console.log(s ? savedSummary(s, await countInteractiveSince(claudeRoot(), s.first.at)) : 'Nothing measured yet. Run `limitcast trim` first.');
351
+ console.log(
352
+ forTerminal(s ? savedSummary(s, await countInteractiveSince(claudeRoot(), s.first.at)) : 'Nothing measured yet. Run `limitcast trim` first.'),
353
+ );
351
354
  } else if (cmd === 'results') {
352
355
  // Free shows limits reached, how far ahead limitcast warned, and the guard preview; Pro adds real blocks and savings.
353
356
  const pro = isPro();
@@ -400,7 +403,7 @@ if (cmd === 'status') {
400
403
  opener.on('error', () => {});
401
404
  opener.unref();
402
405
  }
403
- } else console.log(resultsReport({ now, days: days(), samples, blocks, pro, saved, value: valueSection(totals, { now, pro }) }));
406
+ } else console.log(forTerminal(resultsReport({ now, days: days(), samples, blocks, pro, saved, value: valueSection(totals, { now, pro }) })));
404
407
  } else if (cmd === 'notify') {
405
408
  // Desktop notifications from the status line (Pro, opt-in).
406
409
  if (!isPro()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "limitcast",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
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/term.mjs ADDED
@@ -0,0 +1,13 @@
1
+ // @ts-check
2
+
3
+ /**
4
+ * The Markdown reports for a person at a terminal: headings and **bold** in bold, markers gone.
5
+ * Piped or written to a file, the Markdown is left as is. NO_COLOR drops the styling, not the cleanup.
6
+ * @param {string} md
7
+ * @param {{tty?: boolean, color?: boolean}} [o]
8
+ */
9
+ export function forTerminal(md, { tty = process.stdout.isTTY === true, color = !process.env.NO_COLOR } = {}) {
10
+ if (!tty) return md;
11
+ const b = color ? (/** @type {string} */ s) => `\x1b[1m${s}\x1b[22m` : (/** @type {string} */ s) => s;
12
+ return md.replace(/^#{1,6} (.+)$/gm, (_, h) => b(h)).replace(/\*\*(.+?)\*\*/g, (_, s) => b(s));
13
+ }