kid-git
v0.1.0
Published
A tiny git-like helper that explains code in grade-3 English, traces variables, and saves history. Supports Python, JavaScript, TypeScript, TSX.
Maintainers
Readme
kid-git 👶📦
A tiny git-like helper for beginners:
- Explain code in grade-3 English — Python, JavaScript, TypeScript, TSX → easy words.
- Find a variable — see
aand don't know where it was born?kid-git why ashows you. - Save history like git —
init / save / log / diff / back. No hard words. - Easy to use — 1 import, 1 command. Zero dependencies.
Install
npm i kid-git
# or try without install
npx kid-git helpUse in code (3 lines)
import { explain, traceVar, save, history } from 'kid-git';
console.log(explain('a = 5\nprint(a)', 'py'));
console.log(traceVar('a = 5\nprint(a)', 'a', 'py').summary);
save('my first save');
console.log(history());Use in terminal
kid-git explain app.py
kid-git explain App.tsx
kid-git why a --file app.py
kid-git init
kid-git save "it works now"
kid-git log
kid-git diff
kid-git back <id-start>What explain says
Python def hello(name): →
We make a new action called 'hello'. It needs: name.
JS const a = 5 →
We make a locked box called 'a' and put a number in it (5).
TSX <Button>hi</Button> →
We show a part on the page called 'Button' with hi.
What why does
kid-git why a --file demo.py'a' is FIRST made at line 1 with '5'. Used 3 time(s) in total. Now it looks like 'a + 1'.
Line 1: We FIRST make the box 'a' here and put '5' in it.
Line 2: We use box 'a' here.History (like git, but tiny)
- Saves live in
.kidgit/snapshots/<time-id>/ - Each save has
meta.json={ id, message, date, files } - Skips
node_modules, .git, dist, __pycache__, files >1MB diffshows+ added/- took awayper filebackcopies old files back
API
explain(code: string, lang?: 'py'|'js'|'ts'|'tsx'|'auto', fileName?: string)
// → [{ line, code, easy }]
explainText(code, lang?, fileName?) // → "Line 1: ..." string
traceVar(code: string, name: string, lang?: ..., fileName?: string)
// → { name, total, madeAt, changedAt, usedAt, lastValue, summary }
init(cwd?) // make .kidgit/
save(msg?, cwd?) // snapshot now → { id, message, date, files }
history(cwd?) // list saves oldest → newest
diffSnapshots(idA?, idB?, cwd?, file?) // easy diff string
restore(id, cwd?)Publish (for you, the owner)
npm run build
npm login
npm publish --access publicLicense
MIT — free for school, home, and work.
