lakonai 1.5.1 → 1.6.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/README.md CHANGED
@@ -20,7 +20,7 @@
20
20
  <img src="https://img.shields.io/badge/node-%E2%89%A518-0F0F0F" alt="node ≥18" />
21
21
  <img src="https://img.shields.io/badge/deps-0-0F0F0F" alt="zero dependencies" />
22
22
  <img src="https://img.shields.io/badge/agents-6-0F0F0F" alt="6 AI agents" />
23
- <img src="https://img.shields.io/badge/tests-1165-0F0F0F" alt="1165 tests" />
23
+ <img src="https://img.shields.io/badge/tests-1178-0F0F0F" alt="1178 tests" />
24
24
  </p>
25
25
 
26
26
  <p align="center">
@@ -91,6 +91,7 @@ All numbers from live projects using `lakonai@1.1.1`.
91
91
  **Typical coding session:** ~53% savings from proxy alone, ~75% with graph read-guard.
92
92
 
93
93
  `lakonai gain` shows your own numbers. `/lakonai:stats` shows all layers at once.
94
+ `lakonai gain --share` turns them into a short card you can post.
94
95
 
95
96
  ---
96
97
 
@@ -318,7 +319,7 @@ After `lakonai install`, these are available in Claude Code:
318
319
  | `lakonai compress-memory <file>` | Shrink a memory file via your local AI CLI |
319
320
  | `lakonai peek [id]` | Read output parked in sandbox (`--grep/--offset/--limit`) |
320
321
  | `lakonai depth [on\|off\|status]` | Answer budget: `on` buys one long reply, `off` cancels, `status` reports |
321
- | `lakonai gain` | Token savings across all measured fronts |
322
+ | `lakonai gain [--share]` | Token savings across all measured fronts; `--share` prints a plain-text card to post (totals and command names only — no args or paths) |
322
323
  | `lakonai inspect <cmd>` | Debug what filter applies to a command |
323
324
  | `lakonai mcp [wrap\|unwrap]` | MCP catalog compression status/lifecycle |
324
325
  | `lakonai proxy [start\|stop\|restart]` | Compression proxy status/lifecycle |
@@ -377,7 +378,7 @@ Input is measured and deterministic. Output is estimated by your local AI CLI (n
377
378
 
378
379
  ## Test suite
379
380
 
380
- 1165 tests across 69 suites — all passing, no mocks on I/O boundaries.
381
+ 1178 tests across 70 suites — all passing, no mocks on I/O boundaries.
381
382
 
382
383
  | Type | Suites | Tests |
383
384
  |------|--------|-------|
package/bin/lakonai.js CHANGED
@@ -55,7 +55,9 @@ Usage:
55
55
 
56
56
  lakonai gain Show token savings - INPUT (shell output, measured)
57
57
  AND OUTPUT (how much terser the model writes; measured
58
- weekly via your local AI CLI, no API key)
58
+ weekly via your local AI CLI, no API key).
59
+ --share prints a plain-text card of your totals to
60
+ post anywhere (no paths or args included)
59
61
  lakonai mcp [cmd] MCP catalog compression: status (default) | wrap |
60
62
  unwrap. Wrapping edits ~/.claude.json, where Claude
61
63
  Code keeps per-project session state, so it is
@@ -628,6 +630,10 @@ async function main() {
628
630
  return;
629
631
  }
630
632
  if (first === 'gain' || first === 'stats') {
633
+ if (rest.includes('--share')) {
634
+ process.stdout.write(tracking.shareReport());
635
+ return;
636
+ }
631
637
  process.stdout.write(tracking.report());
632
638
  // Output side: measure how much terser the model writes (weekly, TTY-only,
633
639
  // via the local AI CLI), then show it alongside the input savings.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lakonai",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "description": "lakonai — save AI context tokens. Filters & compresses CLI output (git, ls, grep, find, test runners, lint/build, docker/kubectl/aws) before it reaches Claude Code, Codex, Cursor, Windsurf, Cline or Gemini — and learns to filter new commands automatically the more you use it.",
5
5
  "keywords": [
6
6
  "claude",
package/src/tracking.js CHANGED
@@ -221,9 +221,39 @@ function report() {
221
221
  return lines.join('\n') + '\n';
222
222
  }
223
223
 
224
+ // A plain-text card for posting your savings (`lakonai gain --share`). No
225
+ // color, no args, no paths: only totals, the command names and the agent -
226
+ // nothing from the user's projects leaves the log. Short enough for one post.
227
+ const AGENT_NAMES = { claude: 'Claude Code', codex: 'Codex', gemini: 'Gemini CLI' };
228
+ const REPO_URL = 'https://github.com/bargadev/lakonai';
229
+
230
+ function shareText(entries, now = Date.now()) {
231
+ const all = aggregate(entries);
232
+ if (!all.calls) return null;
233
+ const first = entries.reduce((m, e) => (!isSessionEntry(e) && e.t && e.t < m ? e.t : m), now);
234
+ const days = Math.max(1, Math.ceil((now - first) / DAY_MS));
235
+ const agents = byAgent(entries)
236
+ .map((a) => AGENT_NAMES[a.agent])
237
+ .filter(Boolean);
238
+ const where = agents.length ? ` in ${agents.join(' + ')}` : '';
239
+ const top = byCommand(entries).filter((c) => c.saved > 0).slice(0, 3);
240
+ const lines = [
241
+ `lakonai saved me ${tok(all.saved)} (${pct(all.saved, all.raw)}% smaller) across ` +
242
+ `${all.calls.toLocaleString('en-US')} command${all.calls === 1 ? '' : 's'}${where}, ${days} day${days === 1 ? '' : 's'}.`,
243
+ ];
244
+ if (top.length) lines.push('Top: ' + top.map((c) => `${c.cmd} ${fmt(c.saved)}`).join(' · '));
245
+ lines.push(`npm i -g lakonai → ${REPO_URL}`);
246
+ return lines.join('\n') + '\n';
247
+ }
248
+
249
+ function shareReport() {
250
+ return shareText(readEntries()) ||
251
+ 'lakonai: no usage recorded yet. Run a few commands through `lakonai` first.\n';
252
+ }
253
+
224
254
  function reset() {
225
255
  try { fs.unlinkSync(logPath()); return true; }
226
256
  catch { return false; }
227
257
  }
228
258
 
229
- module.exports = { record, report, reset, readEntries, logPath, responseStats, detectAgent, byAgent };
259
+ module.exports = { record, report, shareText, shareReport, reset, readEntries, logPath, responseStats, detectAgent, byAgent };