toldya 0.2.0 โ 0.3.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 +5 -2
- package/bin/toldya.mjs +2 -2
- package/lib/card.mjs +12 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
<p align="center"><b>Stop repeating yourself to your AI.</b></p>
|
|
6
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
|
+
|
|
7
9
|
<p align="center">
|
|
8
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>
|
|
9
11
|
<img src="https://img.shields.io/badge/dependencies-0-98a179" alt="zero dependencies">
|
|
@@ -53,8 +55,9 @@ and how often since.
|
|
|
53
55
|
|
|
54
56
|
## Share it
|
|
55
57
|
|
|
56
|
-
`npx toldya --all --card` opens your card in the browser.
|
|
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.
|
|
58
61
|
|
|
59
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>
|
|
60
63
|
|
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.
|
|
18
|
+
const VERSION = '0.3.0';
|
|
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; };
|
|
@@ -123,7 +123,7 @@ if (has('--card')) {
|
|
|
123
123
|
: [process.platform === 'darwin' ? 'open' : 'xdg-open', [file]];
|
|
124
124
|
try { spawn(open[0], open[1], { detached: true, stdio: 'ignore' }).on('error', () => {}).unref(); } catch {}
|
|
125
125
|
console.log(`Your card: ${file}
|
|
126
|
-
It opens in your browser
|
|
126
|
+
It opens in your browser: save it as a PNG, then post it. Nothing leaves your machine unless you click share.`);
|
|
127
127
|
process.exit(0);
|
|
128
128
|
}
|
|
129
129
|
|
package/lib/card.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
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
|
|
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.
|
|
3
4
|
import { readFileSync } from 'node:fs';
|
|
4
5
|
|
|
5
6
|
const MARK = new URL('../assets/mark.webp', import.meta.url);
|
|
@@ -12,10 +13,17 @@ export function cardHtml({ repeats, sessions, from, to }) {
|
|
|
12
13
|
const json = JSON.stringify(data).replace(/</g, '\\u003c');
|
|
13
14
|
return `<!doctype html><meta charset="utf-8"><title>toldya card</title>
|
|
14
15
|
<style>body{margin:0;background:#eee;font:16px system-ui;display:grid;place-items:center;min-height:100vh;gap:16px}
|
|
15
|
-
canvas{max-width:95vw;height:auto;box-shadow:0 2px 12px #0002}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>
|
|
16
|
-
<canvas id="c" width="1200" height="675"></canvas
|
|
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>
|
|
17
20
|
<script>
|
|
18
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);
|
|
19
27
|
const font = (w, s) => (x.font = w + ' ' + s + 'px system-ui, "Segoe UI", sans-serif');
|
|
20
28
|
const pill = (px, py, w, h, fill) => {
|
|
21
29
|
x.fillStyle = INK; x.beginPath(); x.roundRect(px + 5, py + 5, w, h, h / 2); x.fill();
|
|
@@ -37,6 +45,7 @@ function draw(img) {
|
|
|
37
45
|
font(500, 22); x.fillStyle = '#6b6b6b';
|
|
38
46
|
x.fillText(D.sessions + ' Claude Code sessions ยท ' + D.from + ' โ ' + D.to, 390, 628);
|
|
39
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';
|
|
40
49
|
document.getElementById('save').href = c.toDataURL('image/png');
|
|
41
50
|
}
|
|
42
51
|
if (D.mark) { const i = new Image(); i.onload = () => draw(i); i.onerror = () => draw(); i.src = D.mark; } else draw();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toldya",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
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"
|