playthrough 0.4.0 → 0.4.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/INSTRUCTIONS.md CHANGED
@@ -35,6 +35,9 @@ The person can only judge what the flows show, so keep them true to how a person
35
35
 
36
36
  THE APP
37
37
 
38
+ The first time, add playthrough to the app's devDependencies with the app's own package manager, and run
39
+ npx playwright install chromium: flows import from it, and record in that browser.
40
+
38
41
  playthrough/app.json says how to start the app, and is committed so every review uses it:
39
42
 
40
43
  { "start": "npm run dev", "url": "http://localhost:3000" }
package/README.md CHANGED
@@ -1,43 +1,34 @@
1
- # Playthrough
1
+ # <img src="https://raw.githubusercontent.com/itmostlyworks/playthrough/main/packages/viewer/public/logo.svg" alt="" height="28"> Playthrough
2
2
 
3
3
  The agent says it's done. You decide if it's good.
4
4
 
5
5
  Playthrough records your coding agent's change the way a person would use it, before and after, so you can watch it instead of setting it up by hand. Point at what's wrong, right on the recording, and the next round answers it there. Take over any moment and carry on in the real app. It runs on your machine, with any coding agent that has a shell.
6
6
 
7
- ## How a review goes
8
-
9
- 1. You ask your agent for a change, and to show it to you with Playthrough.
10
- 2. Before it touches the code, the agent writes a flow for each thing a person does that the change touches, and Playthrough keeps the app as it is: Before.
11
- 3. The agent makes the change, and Playthrough records every flow, on the app as it is now and on Before, as far as the app went before. It finds what changed itself, including what the agent didn't mention, and the agent says why each change is there.
12
- 4. You watch. Leave a note on what's wrong, where it's wrong; compare with Before; take over and try it yourself. Then send.
13
- 5. The agent answers each note in the next round, on the spot the note is on. You check its answers, and accept once every flow looks good.
14
-
15
7
  ## Try it
16
8
 
17
- Playthrough needs Node 24 or later. In your app's repo:
18
-
19
- ```bash
20
- npm install --save-dev playthrough
21
- npx playwright install chromium
22
- ```
9
+ Ask your agent for a change in your app, as you would anyway, and add:
23
10
 
24
- Then ask your agent for a change, and to show it to you:
11
+ > Show me this change with `npx playthrough`.
25
12
 
26
- > Show only the overdue invoices. Use Playthrough to show me the change: run `npx playthrough` and follow what it says.
27
-
28
- The agent starts a review, records it, and hands it to you with `playthrough wait`. Open it:
13
+ The agent does the rest. The first time, it adds Playthrough to your app and writes down how to start it and sign in, to commit with your app. Each time, it records the change and hands it to you. Open it:
29
14
 
30
15
  ```bash
31
16
  npx playthrough open
32
17
  ```
33
18
 
34
- The first time, the agent writes `playthrough/app.json`, which says how to start your app, and `playthrough/setup.ts` if flows need something first: a signed-in user, an account with data in it, or the people who use the app. Both are committed with your app, so every review after uses them.
35
-
36
- Reviews are kept in `.playthrough/` in your app's repo, recordings and all. Nothing is uploaded anywhere.
19
+ Reviews stay in `.playthrough/` in your app's repo, recordings and all; nothing is uploaded. Playthrough needs Node 24 or later.
37
20
 
38
21
  ## On the example
39
22
 
40
- `example/` in this repo is a small invoices app to try it on before your own. Clone the repo, run `npm install`, `npx playwright install chromium` and `npm run build`, and ask your agent for the same change from `example/`.
23
+ `example/` in this repo is a small invoices app to try it on before your own. Clone the repo, run `npm install`, `npx playwright install chromium` and `npm run build`, and from `example/`, ask your agent to show how much is overdue in total under the Invoices heading, and to show you the change with `npx playthrough`.
24
+
25
+ ## How a review goes
26
+
27
+ 1. You ask your agent for a change, and to show it to you with Playthrough.
28
+ 2. Before it touches the code, the agent writes a flow for each thing a person does that the change touches, and Playthrough keeps the app as it is: Before.
29
+ 3. The agent makes the change, and Playthrough records every flow, on the app as it is now and on Before, as far as the app went before. It finds what changed itself, including what the agent didn't mention, and the agent says why each change is there.
30
+ 4. You watch. Leave a note on what's wrong, where it's wrong; compare with Before; take over and try it yourself. Then send.
31
+ 5. The agent answers each note in the next round, on the spot the note is on. You check its answers, and accept once every flow looks good.
41
32
 
42
33
  ## In the viewer
43
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playthrough",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Review an AI agent's work on a web app by watching recordings of it.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -1717,31 +1717,38 @@ function done({ does, with: given, what }) {
1717
1717
  const share = (fraction) => `${Math.round(fraction * 100)}%`;
1718
1718
  // src/playthrough.ts
1719
1719
  const HELP = readFileSync(new URL("../INSTRUCTIONS.md", import.meta.url), "utf8").trimEnd();
1720
- const [command, review, ...words] = process.argv.slice(2);
1720
+ const given = process.argv.slice(2);
1721
+ const [command, review, ...words] = given;
1721
1722
  const needs = (usage) => new Refused([`That needs more: ${usage}`]);
1723
+ const takes = {
1724
+ start: [2, `playthrough start <review> "<title>" "<what was asked>"`],
1725
+ record: [0, "playthrough record <review>"],
1726
+ wait: [0, "playthrough wait <review>"],
1727
+ walk: [0, "playthrough walk <review>"],
1728
+ open: [0, "playthrough open [<review>]"],
1729
+ "take-over": [2, `playthrough take-over <review> "<flow>" ["<step>"]`]
1730
+ };
1731
+ const limit = Object.hasOwn(takes, command ?? "") ? takes[command] : void 0;
1722
1732
  try {
1723
- if (!command || [
1724
- "help",
1725
- "--help",
1726
- "-h"
1727
- ].includes(command)) console.log(HELP);
1733
+ if (!command || command === "help" || given.some((word) => ["--help", "-h"].includes(word))) console.log(HELP);
1734
+ else if (limit && words.length > limit[0]) throw new Refused([`That's more than it takes: ${limit[1]}`]);
1728
1735
  else {
1729
1736
  await putBack(repo());
1730
1737
  if (command === "start") {
1731
- if (!review) throw needs(`playthrough start <review> "<title>" "<what was asked>"`);
1738
+ if (!review) throw needs(takes.start[1]);
1732
1739
  await start(repo(), review, words[0], words[1]);
1733
1740
  } else if (command === "record") {
1734
- if (!review) throw needs("playthrough record <review>");
1741
+ if (!review) throw needs(takes.record[1]);
1735
1742
  await record(repo(), review);
1736
1743
  } else if (command === "wait") {
1737
- if (!review) throw needs("playthrough wait <review>");
1744
+ if (!review) throw needs(takes.wait[1]);
1738
1745
  await wait(repo(), review);
1739
1746
  } else if (command === "walk") {
1740
- if (!review) throw needs("playthrough walk <review>");
1747
+ if (!review) throw needs(takes.walk[1]);
1741
1748
  await walk(repo(), review);
1742
1749
  } else if (command === "open") await open(repo(), review);
1743
1750
  else if (command === "take-over") {
1744
- if (!review) throw needs(`playthrough take-over <review> "<flow>" ["<step>"]`);
1751
+ if (!review) throw needs(takes["take-over"][1]);
1745
1752
  await takeOver$1(repo(), review, words[0], words[1]);
1746
1753
  } else throw new Refused([`There's no command “${command}”. Run playthrough alone for what each one does.`]);
1747
1754
  }