craftkit 0.3.1__tar.gz → 0.3.3__tar.gz

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.
Files changed (31) hide show
  1. craftkit-0.3.3/PKG-INFO +384 -0
  2. craftkit-0.3.3/README.md +360 -0
  3. {craftkit-0.3.1 → craftkit-0.3.3}/craft_kit/__init__.py +1 -1
  4. {craftkit-0.3.1 → craftkit-0.3.3}/craft_kit/workspace.py +3 -1
  5. craftkit-0.3.3/craftkit.egg-info/PKG-INFO +384 -0
  6. {craftkit-0.3.1 → craftkit-0.3.3}/pyproject.toml +7 -1
  7. craftkit-0.3.1/PKG-INFO +0 -188
  8. craftkit-0.3.1/README.md +0 -168
  9. craftkit-0.3.1/craftkit.egg-info/PKG-INFO +0 -188
  10. {craftkit-0.3.1 → craftkit-0.3.3}/LICENSE-APACHE +0 -0
  11. {craftkit-0.3.1 → craftkit-0.3.3}/LICENSE-MIT +0 -0
  12. {craftkit-0.3.1 → craftkit-0.3.3}/craft_kit/SKILL.md +0 -0
  13. {craftkit-0.3.1 → craftkit-0.3.3}/craft_kit/__main__.py +0 -0
  14. {craftkit-0.3.1 → craftkit-0.3.3}/craft_kit/agent.py +0 -0
  15. {craftkit-0.3.1 → craftkit-0.3.3}/craft_kit/banner.py +0 -0
  16. {craftkit-0.3.1 → craftkit-0.3.3}/craft_kit/brief.py +0 -0
  17. {craftkit-0.3.1 → craftkit-0.3.3}/craft_kit/browser.py +0 -0
  18. {craftkit-0.3.1 → craftkit-0.3.3}/craft_kit/checks.py +0 -0
  19. {craftkit-0.3.1 → craftkit-0.3.3}/craft_kit/cli.py +0 -0
  20. {craftkit-0.3.1 → craftkit-0.3.3}/craft_kit/home.py +0 -0
  21. {craftkit-0.3.1 → craftkit-0.3.3}/craft_kit/png.py +0 -0
  22. {craftkit-0.3.1 → craftkit-0.3.3}/craft_kit/proc.py +0 -0
  23. {craftkit-0.3.1 → craftkit-0.3.3}/craft_kit/study.py +0 -0
  24. {craftkit-0.3.1 → craftkit-0.3.3}/craft_kit/tables.py +0 -0
  25. {craftkit-0.3.1 → craftkit-0.3.3}/craft_kit/ui.py +0 -0
  26. {craftkit-0.3.1 → craftkit-0.3.3}/craftkit.egg-info/SOURCES.txt +0 -0
  27. {craftkit-0.3.1 → craftkit-0.3.3}/craftkit.egg-info/dependency_links.txt +0 -0
  28. {craftkit-0.3.1 → craftkit-0.3.3}/craftkit.egg-info/entry_points.txt +0 -0
  29. {craftkit-0.3.1 → craftkit-0.3.3}/craftkit.egg-info/requires.txt +0 -0
  30. {craftkit-0.3.1 → craftkit-0.3.3}/craftkit.egg-info/top_level.txt +0 -0
  31. {craftkit-0.3.1 → craftkit-0.3.3}/setup.cfg +0 -0
@@ -0,0 +1,384 @@
1
+ Metadata-Version: 2.4
2
+ Name: craftkit
3
+ Version: 0.3.3
4
+ Summary: Study → build → check → refine any software, from the terminal, with your coding agent.
5
+ License-Expression: MIT OR Apache-2.0
6
+ Project-URL: Homepage, https://github.com/lix033/craft-kit
7
+ Project-URL: Repository, https://github.com/lix033/craft-kit
8
+ Project-URL: Issues, https://github.com/lix033/craft-kit/issues
9
+ Project-URL: Documentation, https://github.com/lix033/craft-kit#readme
10
+ Keywords: cli,coding-agent,claude-code,codex,gemini,rebuild,skill
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Software Development :: Code Generators
17
+ Requires-Python: >=3.9
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE-MIT
20
+ License-File: LICENSE-APACHE
21
+ Provides-Extra: browser
22
+ Requires-Dist: playwright>=1.40; extra == "browser"
23
+ Dynamic: license-file
24
+
25
+ # craftkit
26
+
27
+ **Rebuild any software with the coding agent you already use, and prove the result is right.**
28
+
29
+ [![npm](https://img.shields.io/npm/v/craftkit-cli?label=npm)](https://www.npmjs.com/package/craftkit-cli)
30
+ [![PyPI](https://img.shields.io/pypi/v/craftkit?label=PyPI)](https://pypi.org/project/craftkit/)
31
+ ![Python](https://img.shields.io/badge/python-3.9%2B-blue)
32
+ ![License](https://img.shields.io/badge/license-MIT%20or%20Apache--2.0-green)
33
+
34
+ [Français](https://github.com/lix033/craft-kit/blob/HEAD/README.fr.md)
35
+
36
+ `craft` is a free command-line tool. Point it at a website, a command-line program or an app (or
37
+ just describe what you want), and it has your coding agent (Claude Code, Codex or Gemini CLI) build
38
+ your own version. It then **checks the result against the original with real measurements** and
39
+ sends the differences back to the agent until every check passes.
40
+
41
+ ```sh
42
+ npm install -g craftkit-cli # or: pipx install craftkit
43
+ craft new https://example.com "recreate this landing page in React"
44
+ cd recreate-this-landing-page-in-react && craft run
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Why craft?
50
+
51
+ Coding agents write code fast, but on their own they don't know **when they're done**. Ask one to
52
+ "make a site like this one" and you get something that *looks* finished. You then spend the
53
+ afternoon comparing screenshots and pasting differences back by hand.
54
+
55
+ `craft` does that loop for you:
56
+
57
+ | Without craft | With craft |
58
+ |---------------|------------|
59
+ | You describe the original in words | `craft` captures it: screenshots at 3 screen widths, visible fonts and colours, what a program prints |
60
+ | The agent decides when it's "done" | The work is done when **measured checks pass**: it builds, it looks the same, it prints the same, its tests pass |
61
+ | You compare by eye and paste feedback | Each difference goes back to the agent automatically, up to a set budget |
62
+ | A long prompt, then you hope | A project folder with evidence, the brief, every check and every turn on disk, ready to resume anytime |
63
+ | Locked to one tool | Works with Claude Code, Codex, Gemini CLI, or any assistant (copy-paste mode) |
64
+
65
+ ### What people use it for
66
+
67
+ - **Recreate a website** you like as a starting point: same layout on desktop, tablet and phone,
68
+ built from scratch in your stack.
69
+ - **Rebuild a command-line tool** in another language, for example a Python script rewritten in
70
+ Rust that prints the same output for the same inputs.
71
+ - **Make a game or desktop app** from a description or from your own screenshots, with a
72
+ self-test that proves the core loop works.
73
+ - **Build a new tool from a plain request** ("a pomodoro timer CLI in Go"), verified by tests the
74
+ agent must write and pass.
75
+
76
+ ## How it works
77
+
78
+ ```mermaid
79
+ flowchart LR
80
+ A[1 · Study<br/>capture the original] --> B[2 · Build<br/>your agent writes app/]
81
+ B --> C[3 · Check<br/>measure the differences]
82
+ C -- not there yet --> D[4 · Refine<br/>send the differences back]
83
+ D --> B
84
+ C -- every check passes --> E[✓ Ready]
85
+ ```
86
+
87
+ 1. **Study.** `craft` gathers evidence into `capture/`. For a website, it takes full-page
88
+ screenshots at 1440, 768 and 390 px and records visible facts (title, headings, fonts,
89
+ colours). For a program, it records what it prints for a few inputs (only if you allow running
90
+ it). Pictures you add to `reference/` are included.
91
+ 2. **Build.** Your coding agent receives a clear brief and works only inside `app/`. You watch
92
+ it live: every file read, edit and command appears as it happens.
93
+ 3. **Check.** The same checks run every round: does it build? Does it look like the original at
94
+ each width? Does it print the same thing? Do its tests pass?
95
+ 4. **Refine.** Anything that fails goes back to the agent with the exact differences. This repeats
96
+ until every check passes, with a budget of 6 refinements per request. It also stops if the
97
+ agent changes nothing twice in a row.
98
+
99
+ What you see in your terminal while it works:
100
+
101
+ ```text
102
+ craft · pomodoro cli · Rust · clean room
103
+ ▍study ./pomodoro ─────────────────────────────────────────────────
104
+ ✓ runs 4 runs recorded
105
+ ▍build building · turn 1 ──────────────────────────────────────────
106
+ 0:03 ◇ read BRIEF.md
107
+ 0:05 ☰ plan 2/5 · Writing the timer
108
+ 0:41 ✚ write app/src/main.rs
109
+ 1:02 ❯ run cargo build
110
+ 1:20 ✗ failed error[E0425]: cannot find value `paused`
111
+ 1:31 ✎ edit app/src/main.rs
112
+ └ 2m14s · 14 actions: 6 edit, 4 run, 3 read, 1 plan · 1 failed
113
+ ✓ build I built the timer with pause and resume.
114
+ ▍check round 1 ────────────────────────────────────────────────────
115
+ ✗ runs 6 of 8 claims hold; output 71% alike.
116
+ │ With --help, it prints what the original prints: 52% of the words match
117
+ ▍refine refining 1/6 · turn 2 ─────────────────────────────────────
118
+ ⠼ refining 1/6 · claude · 0m48s · 3 · Edit app/src/main.rs
119
+ ```
120
+
121
+ Each stage has its own colour in the terminal.
122
+
123
+ ---
124
+
125
+ ## Installation
126
+
127
+ ### What you need
128
+
129
+ | | Required? | Why |
130
+ |---|---|---|
131
+ | **Python 3.9+** | yes | `craft` is written in Python, with no dependencies |
132
+ | **A coding agent** | yes | it writes the code: [Claude Code, Codex or Gemini CLI](#install-a-coding-agent) |
133
+ | **Node.js** | only for `npm install` | npm comes with Node.js ([nodejs.org](https://nodejs.org)) |
134
+ | **A browser** | only for websites | for screenshots: installed Chrome/Edge works; Playwright adds visible-style measurements |
135
+
136
+ Python is already installed on macOS and most Linux systems; check with `python3 --version`. On
137
+ Windows, install it from [python.org](https://www.python.org/downloads/) or with
138
+ `winget install Python.Python.3.12`.
139
+
140
+ ### Install craft (pick one)
141
+
142
+ ```sh
143
+ npm install -g craftkit-cli # with Node.js
144
+ pipx install craftkit # with pipx
145
+ uv tool install craftkit # with uv
146
+ ```
147
+
148
+ All three install the same program and the same commands: `craft` (plus the aliases `craftkit`,
149
+ `craft-new`, `craft-run`).
150
+
151
+ To try it without installing anything: `npx craftkit-cli` or `uvx craftkit`.
152
+
153
+ Check that it works:
154
+
155
+ ```sh
156
+ craft --version # craft 0.3.3
157
+ craft agents # shows which coding agents craft can find
158
+ ```
159
+
160
+ ### Install a coding agent
161
+
162
+ `craft` doesn't write code itself; your coding agent does. Install at least one, then **run it
163
+ once to sign in**:
164
+
165
+ | Agent | Install | Then |
166
+ |-------|---------|------|
167
+ | **Claude Code** | `npm install -g @anthropic-ai/claude-code`<br/>or `curl -fsSL https://claude.ai/install.sh \| bash` | run `claude` and sign in |
168
+ | **Codex** | `npm install -g @openai/codex` | run `codex` and sign in |
169
+ | **Gemini CLI** | `npm install -g @google/gemini-cli`<br/>or `brew install gemini-cli` | run `gemini` and sign in (free tier with a Google account) |
170
+
171
+ If none is installed, `craft` says so right away (on the home screen, at `craft new` and before
172
+ `craft run` starts) and prints these exact commands.
173
+
174
+ **No agent at all?** `craft brief` prints the task. Paste it into any coding assistant (Cursor,
175
+ Copilot, …) opened in the project folder, then run `craft check`.
176
+
177
+ ### Optional: better website screenshots
178
+
179
+ ```sh
180
+ pip install playwright && playwright install chromium
181
+ ```
182
+
183
+ Without it, `craft` uses an installed Chrome or Edge in headless mode, and otherwise falls back to
184
+ Playwright through `npx`.
185
+
186
+ ### Update and uninstall
187
+
188
+ | Installed with | Update | Uninstall |
189
+ |----------------|--------|-----------|
190
+ | npm | `npm update -g craftkit-cli` | `npm uninstall -g craftkit-cli` |
191
+ | pipx | `pipx upgrade craftkit` | `pipx uninstall craftkit` |
192
+ | uv | `uv tool upgrade craftkit` | `uv tool uninstall craftkit` |
193
+
194
+ Uninstalling leaves your projects alone.
195
+
196
+ ---
197
+
198
+ ## Usage
199
+
200
+ ### The easy way: the home screen
201
+
202
+ Type **`craft`**. You get your past projects and a **+ New project** entry, which asks a few
203
+ questions and creates the project in `~/craft-projects`.
204
+
205
+ | Key | Action |
206
+ |-----|--------|
207
+ | ↑ ↓ (or j k) | move |
208
+ | Enter | open a project: continue, ask for a change, open the result, re-check, show the folder |
209
+ | n | new project |
210
+ | x | remove from the list (the folder is kept) |
211
+ | q / Esc | back, or quit |
212
+
213
+ ### From the command line
214
+
215
+ ```sh
216
+ craft new https://example.com "recreate this site in React" # creates ./recreate-this-site-in-react/
217
+ cd recreate-this-site-in-react
218
+ craft run # the whole loop: study → build → check → refine
219
+ craft run "make the header sticky" # ask for a change (starts a new refinement budget)
220
+ craft open # open the result (serves a site, or runs the app)
221
+ ```
222
+
223
+ More examples:
224
+
225
+ ```sh
226
+ craft new "a pomodoro timer CLI in Go" # no original: build from the request
227
+ craft new ./my-tool "the same tool in Rust" --allow-run # record what it prints, then match it
228
+ craft new "a snake game in Python" --kind game
229
+
230
+ craft new "a todo app in Electron" # from your own mockups:
231
+ cp ~/Pictures/mockups/*.png a-todo-app-in-electron/reference/ # put them in reference/
232
+ cd a-todo-app-in-electron && craft run
233
+ ```
234
+
235
+ ### All commands
236
+
237
+ | Command | What it does |
238
+ |---------|--------------|
239
+ | `craft` | home screen: past projects, new project |
240
+ | `craft new [TARGET] [REQUEST…]` | create a project. TARGET is a web address, a file, a folder, a command, or nothing |
241
+ | `craft run [MESSAGE…]` | the whole loop; with a message, a change to the build |
242
+ | `craft study` · `build` · `check` | one step at a time |
243
+ | `craft status` | where the project is |
244
+ | `craft answer` | answer the agent's questions |
245
+ | `craft open` | open the result |
246
+ | `craft agents` | which coding agents are installed, and how to get one |
247
+ | `craft brief` | print the agent's task, to paste into any assistant |
248
+ | `craft skill [--install DIR]` | print or install the SKILL.md (see below) |
249
+
250
+ Options for `craft new`:
251
+
252
+ | Option | Meaning |
253
+ |--------|---------|
254
+ | `--kind website\|cli\|app\|game\|tool` | what you're making (guessed from your words otherwise) |
255
+ | `--stack rust\|python\|react\|html\|go\|…` | the language or framework (guessed from your words otherwise) |
256
+ | `--allow-run` | allow running the original program to record what it prints |
257
+ | `--deep` | allow looking inside the original (see [Clean room and Deep](#clean-room-and-deep)) |
258
+ | `--dir DIR` | where to create the project |
259
+
260
+ Options for `craft run` and `craft build`: `--agent claude|codex|gemini`.
261
+
262
+ ### What gets checked
263
+
264
+ | You're making | Checks |
265
+ |---------------|--------|
266
+ | website | it builds · it looks like the original at 1440, 768 and 390 px · its tests pass |
267
+ | cli | it builds · same exit code and ≥ 80% of the same words for each recorded input · tests |
268
+ | app | it builds · it starts and draws a window (`--screenshot`) · tests |
269
+ | game | it builds · a scripted self-test plays the core loop (`--self-test`) · a screenshot |
270
+ | tool / library | it builds · tests that prove each feature you asked for |
271
+
272
+ A round passes when no check fails and every score reaches 90%.
273
+
274
+ ### The project folder
275
+
276
+ ```text
277
+ my-project/
278
+ craft.json the request, target, kind, stack, mode and counters
279
+ BRIEF.md the task as given to the agent
280
+ capture/ evidence from Study (read-only for the agent)
281
+ reference/ your own pictures or files (read-only for the agent)
282
+ app/ the build: the only folder the agent changes
283
+ checks/ every check round and every agent turn, with logs
284
+ unknowns.md open questions about the original
285
+ questions.json the agent's questions, with your answers
286
+ ```
287
+
288
+ Everything is plain files, so you can stop at any time (Ctrl-C), close the terminal and carry on
289
+ later with `craft run`.
290
+
291
+ ---
292
+
293
+ ## Clean room and Deep
294
+
295
+ By default `craft` works in **clean room** mode: it uses only what a visitor or user can see
296
+ (screenshots, visible text, what a program prints). It never opens the original's source, files or
297
+ code.
298
+
299
+ With `--deep`, the agent may also look inside the original (a page's HTML, a folder's files, a
300
+ program's strings). Use it for your own software or private study.
301
+
302
+ **Use it responsibly.** Rebuilding something for learning or as a starting point is fine; shipping
303
+ someone else's brand, logos, images or text is not. The brief tells the agent to use neutral
304
+ placeholders and never to copy the original's code or assets. Respect copyrights and the terms of
305
+ the sites and programs you study.
306
+
307
+ ## Use it as a skill (Claude Code and other agents)
308
+
309
+ The method behind `craft` is also written as a standalone skill that any agent can follow, with or
310
+ without the CLI:
311
+
312
+ ```sh
313
+ craft skill --install ~/.claude/skills # Claude Code, all projects
314
+ craft skill > SKILL.md # or print it for another agent
315
+ ```
316
+
317
+ Then ask your agent: *"recreate example.com in React"*, and it follows the same
318
+ study → build → check → refine steps.
319
+
320
+ ## Configuration
321
+
322
+ Environment variables:
323
+
324
+ | Variable | Effect |
325
+ |----------|--------|
326
+ | `CRAFT_AGENT=codex` | the agent to use (default: the first installed of claude, codex, gemini) |
327
+ | `CRAFT_PROJECTS_DIR` | where the home screen creates projects (default `~/craft-projects`) |
328
+ | `CRAFT_FEED=0` | hide the live action feed and keep only the progress line |
329
+ | `NO_COLOR=1` | no colours |
330
+ | `CRAFT_TURN_TIMEOUT` / `CRAFT_IDLE_TIMEOUT` | seconds per agent turn (3 h) / without output (20 min) |
331
+ | `CRAFT_BROWSER=python\|chrome\|npx\|none` | how screenshots are taken |
332
+ | `CRAFT_CHROME` | path to Chrome or Edge |
333
+ | `CRAFT_PYTHON` | (npm install only) the Python to use |
334
+
335
+ **Add or change an agent** in `~/.config/craft/agents.json`. Any command-line agent that reads its
336
+ task from standard input works:
337
+
338
+ ```json
339
+ {"my-agent": {"argv": ["my-agent", "--non-interactive"], "stream": "text"}}
340
+ ```
341
+
342
+ Claude Code runs with `--permission-mode acceptEdits` and a fixed list of allowed tools (file
343
+ edits, npm, cargo, go, python, make…). Permissions are never bypassed.
344
+
345
+ ---
346
+
347
+ ## Troubleshooting
348
+
349
+ **"No coding agent found"**: install one of the [agents above](#install-a-coding-agent), sign in
350
+ once, then run `craft agents` to confirm it's found.
351
+
352
+ **"craft needs Python 3.9 or newer"** (npm install): install Python (see
353
+ [What you need](#what-you-need)), or point to one with `CRAFT_PYTHON=/path/to/python3`.
354
+
355
+ **`craft: command not found` after installing**:
356
+ - npm: your npm global folder isn't on your PATH. `npm prefix -g` shows it; add its `bin` folder
357
+ to PATH. Or use `npx craftkit-cli`.
358
+ - pipx: run `pipx ensurepath`, then open a new terminal.
359
+
360
+ **The agent stops and asks to sign in**: run the agent once by itself (`claude`, `codex` or
361
+ `gemini`), sign in, then `craft run` carries on where it stopped.
362
+
363
+ **No screenshots for a website**: install Chrome, or `pip install playwright && playwright install
364
+ chromium`.
365
+
366
+ **Stopped half-way?** Nothing is lost: `craft run` resumes from the project folder.
367
+
368
+ ## Limitations
369
+
370
+ - Visual comparison works on a colour grid. It catches layout and colour differences, not fine
371
+ details.
372
+ - With headless Chrome, screenshots are 2400 px tall rather than the full page; visible-style
373
+ measurements need Playwright for Python.
374
+ - The Codex and Gemini adapters haven't been tested against the real tools yet. Tested on macOS;
375
+ Linux and Windows aren't tested yet.
376
+
377
+ ## Credits and license
378
+
379
+ `craft` distils the study → build → check → refine method of
380
+ [Craft Anything](https://github.com/storytold/craft-anything) into a small terminal tool with no
381
+ dependencies.
382
+
383
+ Free and open source, under your choice of the [MIT](https://github.com/lix033/craft-kit/blob/HEAD/LICENSE-MIT) or
384
+ [Apache 2.0](https://github.com/lix033/craft-kit/blob/HEAD/LICENSE-APACHE) license.