toldya 0.3.0 → 0.3.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/README.md CHANGED
@@ -1,90 +1,100 @@
1
- <p align="center"><img src="assets/mark.webp" width="220" height="220" alt="A round green figure sits against a wall covered in chalk tally marks, adding one more, looking straight at you."></p>
2
-
3
- <h1 align="center">toldya</h1>
4
-
5
- <p align="center"><b>Stop repeating yourself to your AI.</b></p>
6
-
7
- <p align="center">Part of <a href="https://singhlabs.dev/toldya/">Singh Labs</a>, small tools for people who code with AI.</p>
8
-
9
- <p align="center">
10
- <a href="https://www.npmjs.com/package/toldya"><img src="https://img.shields.io/npm/v/toldya?color=ffd23f&label=npm" alt="npm version"></a>
11
- <img src="https://img.shields.io/badge/dependencies-0-98a179" alt="zero dependencies">
12
- <img src="https://img.shields.io/badge/network-none-98a179" alt="no network calls">
13
- <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-ff90e8" alt="MIT"></a>
14
- </p>
15
-
16
- <p align="center"><img src="assets/demo.gif" width="100%" alt="toldya reading Claude Code history, listing the corrections said most often, then adding three of them to CLAUDE.md"></p>
17
-
18
- ```bash
19
- npx toldya --all
20
- ```
21
-
22
- You keep telling your coding agent the same things. "Keep it simple." "Don't assume."
23
- "Don't complicate it." toldya reads what you typed to Claude Code, finds what you keep
24
- repeating, and writes it into the rule file your agent reads, with your yes. Next time,
25
- it counts whether you still had to say it.
26
-
27
- ## What it found on the author's own history
28
-
29
- A real run. Not a mock-up.
30
-
31
- <p align="center"><img src="assets/report.png" width="100%" alt="toldya report: keep it simple 40 times in 36 sessions, dont complex this 29 times, dont assume 15 times, and 71 times it was told to try or check again"></p>
32
-
33
- 142 sessions. "Keep it simple" 40 times. Rewordings and typos count as one habit: "Don't
34
- complicate it" and "dont complex this" are the same thing said twice.
35
-
36
- ## Use it
37
-
38
- ```bash
39
- npx toldya # this project: offers rules for ./CLAUDE.md
40
- npx toldya --all # every project: offers rules for ~/.claude/CLAUDE.md
41
- npx toldya --dry # report only, change nothing
42
- npx toldya --to AGENTS.md # write rules somewhere else
43
- npx toldya --add 1,3 # take repeats 1 and 3 without the prompts
44
- npx toldya --min 5 # only things you said 5+ times
45
- npx toldya --json # machine-readable report
46
- npx toldya --card # an image of your top repeats, to share
47
- ```
48
-
49
- Without `--dry` or `--add`, it asks about each repeat: **y** adds it, **n** skips it,
50
- **e** lets you reword it first. Rules go under a `## Things I kept repeating` heading.
51
- Nothing is written without a yes.
52
-
53
- Run it again a week later and every rule it added shows how often you said it before,
54
- and how often since.
55
-
56
- ## Share it
57
-
58
- `npx toldya --all --card` opens your card in the browser. Save it as a PNG, then use the
59
- **Post on X** or **Share on LinkedIn** button: the post text is written for you. The card is
60
- drawn on your machine; nothing leaves it unless you click share.
61
-
62
- <p align="center"><img src="assets/card.png" width="100%" alt="toldya card: Things I keep telling my AI. keep it simple 41 times, dont complex this 29 times, dont assume 15 times"></p>
63
-
64
- ## What it reads, and what it doesn't
65
-
66
- - Only **your own messages** in Claude Code's history on this machine (`~/.claude/projects`).
67
- Not the AI's replies, not tool output, not your files.
68
- - Long messages are treated as pastes (briefs, logs) and skipped. Questions and "I don't
69
- understand" are not corrections, so they're skipped too.
70
- - A repeat counts only if it shows up in **at least two sessions**.
71
- - Short "try again" / "check again" messages are counted separately. They mean the first
72
- attempt missed, but they aren't rules you can write down.
73
- - **Sends nothing anywhere.** No account, no telemetry, no network calls.
74
-
75
- Claude Code keeps about 30 days of history by default, so on a default install toldya sees
76
- roughly a month.
77
-
78
- ## Coming next
79
-
80
- - **Team mode:** `npx toldya owner/repo` reads a repo's pull-request review comments (from
81
- people or any review bot), finds what reviewers keep writing, and opens one PR into `AGENTS.md`.
82
- - Codex history (not tested on real files yet, so not claimed).
83
-
84
- ## Requirements
85
-
86
- Node 18+. No dependencies.
87
-
88
- ## License
89
-
90
- MIT © Sevenopt Solutions Private Limited · made by [Singh Labs](https://singhlabs.dev)
1
+ <p align="center"><img src="assets/mark.webp" width="220" height="220" alt="A round green figure sits against a wall covered in chalk tally marks, adding one more, looking straight at you."></p>
2
+
3
+ <h1 align="center">toldya</h1>
4
+
5
+ <p align="center"><b>Stop repeating yourself to your AI.</b></p>
6
+
7
+ <p align="center">Part of <a href="https://singhlabs.dev/toldya/">Singh Labs</a>, small tools for people who code with AI.</p>
8
+
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/package/toldya"><img src="https://img.shields.io/npm/v/toldya?color=ffd23f&label=npm" alt="npm version"></a>
11
+ <img src="https://img.shields.io/badge/dependencies-0-98a179" alt="zero dependencies">
12
+ <img src="https://img.shields.io/badge/network-none-98a179" alt="no network calls">
13
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-ff90e8" alt="MIT"></a>
14
+ </p>
15
+
16
+ <p align="center"><img src="assets/demo.gif" width="100%" alt="toldya reading Claude Code history, listing the corrections said most often, then adding three of them to CLAUDE.md"></p>
17
+
18
+ ```bash
19
+ npx toldya --all
20
+ ```
21
+
22
+ You keep telling your coding agent the same things. "Keep it simple." "Don't assume."
23
+ "Don't complicate it." toldya reads what you typed to Claude Code, finds what you keep
24
+ repeating, and writes it into the rule file your agent reads, with your yes. Next time,
25
+ it counts whether you still had to say it.
26
+
27
+ ## What it found on the author's own history
28
+
29
+ A real run. Not a mock-up.
30
+
31
+ <p align="center"><img src="assets/report.png" width="100%" alt="toldya report: keep it simple 40 times in 36 sessions, dont complex this 29 times, dont assume 15 times, and 71 times it was told to try or check again"></p>
32
+
33
+ 142 sessions. "Keep it simple" 40 times. Rewordings and typos count as one habit: "Don't
34
+ complicate it" and "dont complex this" are the same thing said twice.
35
+
36
+ ## Use it
37
+
38
+ ```bash
39
+ npx toldya # this project: offers rules for ./CLAUDE.md
40
+ npx toldya --all # every project: offers rules for ~/.claude/CLAUDE.md
41
+ npx toldya --dry # report only, change nothing
42
+ npx toldya --to AGENTS.md # write rules somewhere else
43
+ npx toldya --add 1,3 # take repeats 1 and 3 without the prompts
44
+ npx toldya --min 5 # only things you said 5+ times
45
+ npx toldya --json # machine-readable report
46
+ npx toldya --card # an image of your top repeats, to share
47
+ ```
48
+
49
+ Without `--dry` or `--add`, it asks about each repeat: **y** adds it, **n** skips it,
50
+ **e** lets you reword it first. Rules go under a `## Things I kept repeating` heading.
51
+ Nothing is written without a yes.
52
+
53
+ Run it again a week later and every rule it added shows how often you said it before,
54
+ and how often since.
55
+
56
+ ## In Claude Code, as a plugin
57
+
58
+ ```
59
+ /plugin marketplace add singhlabsdev/toldya
60
+ /plugin install toldya@toldya
61
+ ```
62
+
63
+ Then ask Claude *"what do I keep repeating?"*. It runs toldya, shows you the list, and adds
64
+ only the ones you pick.
65
+
66
+ ## Share it
67
+
68
+ `npx toldya --all --card` opens your card in the browser. Save it as a PNG, then use the
69
+ **Post on X** or **Share on LinkedIn** button: the post text is written for you. The card is
70
+ drawn on your machine; nothing leaves it unless you click share.
71
+
72
+ Post yours in [Share your card](https://github.com/singhlabsdev/toldya/discussions/1). What's your top line?
73
+
74
+ <p align="center"><img src="assets/card.png" width="100%" alt="toldya card: I have told my AI keep it simple 42 times. Also: dont complex this 29, dont assume 15, i dont want later on 13"></p>
75
+
76
+ ## What it reads, and what it doesn't
77
+
78
+ - Only **your own messages** in Claude Code's history on this machine (`~/.claude/projects`).
79
+ Not the AI's replies, not tool output, not your files.
80
+ - Long messages are treated as pastes (briefs, logs) and skipped. Questions and "I don't
81
+ understand" are not corrections, so they're skipped too.
82
+ - A repeat counts only if it shows up in **at least two sessions**.
83
+ - Short "try again" / "check again" messages are counted separately. They mean the first
84
+ attempt missed, but they aren't rules you can write down.
85
+ - **Sends nothing anywhere.** No account, no telemetry, no network calls.
86
+
87
+ Claude Code keeps about 30 days of history by default, so on a default install toldya sees
88
+ roughly a month.
89
+
90
+ ## Coming next
91
+
92
+ - Codex history (not tested on real files yet, so not claimed).
93
+
94
+ ## Requirements
95
+
96
+ Node 18+. No dependencies.
97
+
98
+ ## License
99
+
100
+ MIT © Sevenopt Solutions Private Limited · made by [Singh Labs](https://singhlabs.dev)
package/bin/toldya.mjs CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  } from '../lib/core.mjs';
16
16
  import { cardHtml } from '../lib/card.mjs';
17
17
 
18
- const VERSION = '0.3.0';
18
+ const VERSION = '0.3.2';
19
19
  const argv = process.argv.slice(2);
20
20
  const has = (f) => argv.includes(f);
21
21
  const opt = (f, d) => { const i = argv.indexOf(f); return i >= 0 && argv[i + 1] ? argv[i + 1] : d; };
@@ -37,7 +37,7 @@ Reads Claude Code's own history on this machine. Sends nothing anywhere.`);
37
37
  }
38
38
  if (has('--version') || has('-v')) { console.log(VERSION); process.exit(0); }
39
39
  if (argv.some((a) => /^[\w.-]+\/[\w.-]+$/.test(a))) {
40
- console.log('Team mode (owner/repo) is coming next. For now: run `npx toldya` in your project.');
40
+ console.log('toldya reads your own Claude Code history, not a repo. Run `npx toldya` in your project.');
41
41
  process.exit(0);
42
42
  }
43
43
 
@@ -127,6 +127,7 @@ It opens in your browser: save it as a PNG, then post it. Nothing leaves your ma
127
127
  process.exit(0);
128
128
  }
129
129
 
130
+ const STAR = '\nFound something? A star helps other people find toldya: github.com/singhlabsdev/toldya';
130
131
  console.log('You keep telling your AI:');
131
132
  const shown = fresh.slice(0, 10);
132
133
  shown.forEach((r, n) => {
@@ -140,6 +141,7 @@ if (spanDays < 35) console.log('\nClaude Code keeps about 30 days of history by
140
141
  const picks = opt('--add', null);
141
142
  if (has('--dry') || (!picks && !process.stdin.isTTY)) {
142
143
  if (!has('--dry')) console.log('\nRun in a terminal to add these as rules, or pick them with --add 1,3.');
144
+ console.log(STAR);
143
145
  process.exit(0);
144
146
  }
145
147
 
@@ -179,3 +181,4 @@ mkdirSync(stateDir, { recursive: true });
179
181
  writeFileSync(stateFile, JSON.stringify(state, null, 2));
180
182
  const shortTarget = target.startsWith(cwd) ? target.slice(cwd.length + 1) : target.replace(homedir(), '~');
181
183
  console.log(`\nAdded ${add.length} rule${add.length > 1 ? 's' : ''} to ${shortTarget}. Run toldya again in a week to see if they stuck.`);
184
+ console.log(STAR);
package/lib/card.mjs CHANGED
@@ -1,53 +1,73 @@
1
- // toldya --card: one image of your top repeats, for when you want to show someone.
2
- // Writes a local HTML page that draws the card and saves it as a PNG. No network,
3
- // unless you click a share button: that opens X or LinkedIn with a pre-filled post.
4
- import { readFileSync } from 'node:fs';
5
-
6
- const MARK = new URL('../assets/mark.webp', import.meta.url);
7
-
8
- export function cardHtml({ repeats, sessions, from, to }) {
9
- let mark = '';
10
- try { mark = 'data:image/webp;base64,' + readFileSync(MARK).toString('base64'); } catch {}
11
- const data = { rows: repeats.slice(0, 5).map((r) => [r.count, r.phrase]), sessions, from, to, mark };
12
- // JSON inside <script>: escape "<" so a phrase like "</script>" can't end the block.
13
- const json = JSON.stringify(data).replace(/</g, '\\u003c');
14
- return `<!doctype html><meta charset="utf-8"><title>toldya card</title>
15
- <style>body{margin:0;background:#eee;font:16px system-ui;display:grid;place-items:center;min-height:100vh;gap:16px}
16
- canvas{max-width:95vw;height:auto;box-shadow:0 2px 12px #0002}.row{display:flex;gap:14px;flex-wrap:wrap;justify-content:center}p{margin:0;color:#555;max-width:60ch;text-align:center}a{font-weight:700;color:#0d0d0d;background:#ffd23f;border:3px solid #0d0d0d;padding:10px 18px;border-radius:30px;text-decoration:none;box-shadow:4px 4px 0 #0d0d0d}</style>
17
- <canvas id="c" width="1200" height="675"></canvas>
18
- <div class="row"><a id="save" download="toldya.png" href="#">1. Save as PNG</a><a id="x" target="_blank" rel="noopener" href="#">2. Post on X</a><a id="li" target="_blank" rel="noopener" href="#">2. Share on LinkedIn</a></div>
19
- <p>Save the picture first, then attach it to your post. The card is drawn on your machine; nothing leaves it unless you click a share button.</p>
20
- <script>
21
- const D = ${json}, c = document.getElementById('c'), x = c.getContext('2d'), INK = '#0d0d0d';
22
- const REPO = 'github.com/singhlabsdev/toldya';
23
- const first = D.rows[0] || [0, ''];
24
- const post = 'My AI has heard "' + first[1] + '" ' + first[0] + ' times 😅 Counted from my own Claude Code history with npx toldya';
25
- document.getElementById('x').href = 'https://x.com/intent/post?text=' + encodeURIComponent(post) + '&url=' + encodeURIComponent('https://' + REPO);
26
- document.getElementById('li').href = 'https://www.linkedin.com/feed/?shareActive=true&text=' + encodeURIComponent(post + ' https://' + REPO);
27
- const font = (w, s) => (x.font = w + ' ' + s + 'px system-ui, "Segoe UI", sans-serif');
28
- const pill = (px, py, w, h, fill) => {
29
- x.fillStyle = INK; x.beginPath(); x.roundRect(px + 5, py + 5, w, h, h / 2); x.fill();
30
- x.fillStyle = fill; x.beginPath(); x.roundRect(px, py, w, h, h / 2); x.fill();
31
- x.lineWidth = 3; x.strokeStyle = INK; x.stroke();
32
- };
33
- const fit = (s, max) => { if (x.measureText(s).width <= max) return s;
34
- while (s.length > 1 && x.measureText(s + '…').width > max) s = s.slice(0, -1); return s + '…'; };
35
- function draw(img) {
36
- x.fillStyle = '#fff'; x.fillRect(0, 0, 1200, 675);
37
- if (img) x.drawImage(img, 30, 150, 330, 330);
38
- x.fillStyle = INK; font(800, 46); x.fillText('Things I keep telling my AI', 390, 100);
39
- D.rows.forEach(([n, p], i) => {
40
- const y = 150 + i * 88;
41
- pill(390, y, 118, 58, '#ffd23f');
42
- x.fillStyle = INK; font(800, 30); x.textAlign = 'center'; x.fillText(n + '×', 449, y + 40);
43
- x.textAlign = 'left'; font(600, 32); x.fillText(fit('“' + p + '”', 640), 532, y + 41);
44
- });
45
- font(500, 22); x.fillStyle = '#6b6b6b';
46
- x.fillText(D.sessions + ' Claude Code sessions · ' + D.from + ' – ' + D.to, 390, 628);
47
- pill(990, 596, 180, 50, INK); x.fillStyle = '#fff'; font(700, 24); x.fillText('npx toldya', 1017, 629);
48
- x.fillStyle = '#6b6b6b'; font(500, 18); x.textAlign = 'right'; x.fillText(REPO, 1170, 580); x.textAlign = 'left';
49
- document.getElementById('save').href = c.toDataURL('image/png');
50
- }
51
- if (D.mark) { const i = new Image(); i.onload = () => draw(i); i.onerror = () => draw(); i.src = D.mark; } else draw();
52
- </script>`;
53
- }
1
+ // toldya --card: one image of your top repeats, for when you want to show someone.
2
+ // Writes a local HTML page that draws the card and saves it as a PNG. No network,
3
+ // unless you click a share button: that opens X or LinkedIn with a pre-filled post.
4
+ import { readFileSync } from 'node:fs';
5
+
6
+ const MARK = new URL('../assets/mark.webp', import.meta.url);
7
+
8
+ export function cardHtml({ repeats, sessions, from, to }) {
9
+ let mark = '';
10
+ try { mark = 'data:image/webp;base64,' + readFileSync(MARK).toString('base64'); } catch {}
11
+ const data = { rows: repeats.slice(0, 5).map((r) => [r.count, r.phrase]), sessions, from, to, mark };
12
+ // JSON inside <script>: escape "<" so a phrase like "</script>" can't end the block.
13
+ const json = JSON.stringify(data).replace(/</g, '\\u003c');
14
+ return `<!doctype html><meta charset="utf-8"><title>toldya card</title>
15
+ <style>body{margin:0;background:#eee;font:16px system-ui;display:grid;place-items:center;min-height:100vh;gap:16px}
16
+ canvas{max-width:95vw;height:auto;box-shadow:0 2px 12px #0002}.row{display:flex;gap:14px;flex-wrap:wrap;justify-content:center}p{margin:0;color:#555;max-width:60ch;text-align:center}a{font-weight:700;color:#0d0d0d;background:#ffd23f;border:3px solid #0d0d0d;padding:10px 18px;border-radius:30px;text-decoration:none;box-shadow:4px 4px 0 #0d0d0d}</style>
17
+ <canvas id="c" width="1200" height="675"></canvas>
18
+ <div class="row"><a id="save" download="toldya.png" href="#">1. Save as PNG</a><a id="x" target="_blank" rel="noopener" href="#">2. Post on X</a><a id="li" target="_blank" rel="noopener" href="#">2. Share on LinkedIn</a></div>
19
+ <p>Save the picture first, then attach it to your post. The card is drawn on your machine; nothing leaves it unless you click a share button. Or add it to <a style="all:revert" href="https://github.com/singhlabsdev/toldya/discussions/1" target="_blank" rel="noopener">Share your card</a> on GitHub.</p>
20
+ <script>
21
+ const D = ${json}, c = document.getElementById('c'), x = c.getContext('2d'), INK = '#0d0d0d';
22
+ const REPO = 'github.com/singhlabsdev/toldya';
23
+ const first = D.rows[0] || [0, ''];
24
+ const post = 'My AI has heard "' + first[1] + '" ' + first[0] + ' times 😅 Counted from my own Claude Code history with npx toldya';
25
+ document.getElementById('x').href = 'https://x.com/intent/post?text=' + encodeURIComponent(post) + '&url=' + encodeURIComponent('https://' + REPO);
26
+ document.getElementById('li').href = 'https://www.linkedin.com/feed/?shareActive=true&text=' + encodeURIComponent(post + ' https://' + REPO);
27
+ const font = (w, s) => (x.font = w + ' ' + s + 'px system-ui, "Segoe UI", sans-serif');
28
+ const pill = (px, py, w, h, fill) => {
29
+ x.fillStyle = INK; x.beginPath(); x.roundRect(px + 5, py + 5, w, h, h / 2); x.fill();
30
+ x.fillStyle = fill; x.beginPath(); x.roundRect(px, py, w, h, h / 2); x.fill();
31
+ x.lineWidth = 3; x.strokeStyle = INK; x.stroke();
32
+ };
33
+ const fit = (s, max) => { if (x.measureText(s).width <= max) return s;
34
+ while (s.length > 1 && x.measureText(s + '…').width > max) s = s.slice(0, -1); return s + '…'; };
35
+ // Wrap s into at most 2 lines of width max; the second line gets an ellipsis if it overflows.
36
+ const wrap = (s, max) => {
37
+ const lines = [''];
38
+ for (const w of s.split(' ')) {
39
+ const t = lines.at(-1) ? lines.at(-1) + ' ' + w : w;
40
+ if (x.measureText(t).width <= max || !lines.at(-1)) lines[lines.length - 1] = t;
41
+ else if (lines.length < 2) lines.push(w);
42
+ else { lines[1] = fit(lines[1] + ' ' + w, max); break; }
43
+ }
44
+ return lines;
45
+ };
46
+ function draw(img) {
47
+ x.fillStyle = '#fff'; x.fillRect(0, 0, 1200, 675);
48
+ if (img) x.drawImage(img, 20, 170, 330, 330);
49
+ // The headline is the top correction itself, in quotes, with its count.
50
+ x.fillStyle = '#6b6b6b'; font(600, 30); x.fillText('I have told my AI', 390, 92);
51
+ x.fillStyle = INK; font(800, 66);
52
+ const lines = wrap('“' + first[1] + '”', 760);
53
+ lines.forEach((l, i) => x.fillText(l, 390, 170 + i * 76));
54
+ const cy = 170 + (lines.length - 1) * 76 + 34;
55
+ pill(390, cy, 250, 72, '#ffd23f');
56
+ x.fillStyle = INK; font(800, 44); x.textAlign = 'center'; x.fillText(first[0] + ' times', 515, cy + 52); x.textAlign = 'left';
57
+ // The rest, smaller.
58
+ const rest = D.rows.slice(1, 4);
59
+ if (rest.length) { x.fillStyle = '#6b6b6b'; font(600, 24); x.fillText('also:', 390, cy + 128); }
60
+ rest.forEach(([n, p], i) => {
61
+ const y = cy + 128 + (i + 1) * 40;
62
+ x.fillStyle = INK; font(800, 26); x.fillText(n + '×', 390, y);
63
+ font(500, 26); x.fillText(fit(p, 640), 470, y);
64
+ });
65
+ font(500, 22); x.fillStyle = '#6b6b6b';
66
+ x.fillText(D.sessions + ' Claude Code sessions · ' + D.from + ' – ' + D.to, 390, 628);
67
+ pill(990, 596, 180, 50, INK); x.fillStyle = '#fff'; font(700, 24); x.fillText('npx toldya', 1017, 629);
68
+ x.fillStyle = '#6b6b6b'; font(500, 18); x.textAlign = 'right'; x.fillText(REPO, 1170, 580); x.textAlign = 'left';
69
+ document.getElementById('save').href = c.toDataURL('image/png');
70
+ }
71
+ if (D.mark) { const i = new Image(); i.onload = () => draw(i); i.onerror = () => draw(); i.src = D.mark; } else draw();
72
+ </script>`;
73
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toldya",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Stop repeating yourself to your AI. Finds what you keep telling your coding agent, writes it into CLAUDE.md / AGENTS.md, and counts whether it stopped.",
5
5
  "bin": {
6
6
  "toldya": "bin/toldya.mjs"