playthrough 0.4.1 → 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/README.md CHANGED
@@ -4,14 +4,6 @@ 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
9
  Ask your agent for a change in your app, as you would anyway, and add:
@@ -28,7 +20,15 @@ Reviews stay in `.playthrough/` in your app's repo, recordings and all; nothing
28
20
 
29
21
  ## On the example
30
22
 
31
- `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 only the overdue invoices, and to show you the change with `npx playthrough`.
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.
32
32
 
33
33
  ## In the viewer
34
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playthrough",
3
- "version": "0.4.1",
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
  }