playthrough 0.4.2 → 0.5.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.
@@ -1,4 +1,4 @@
1
- import { d as waitsFor } from "./flows-BkG0TgHA.js";
1
+ import { f as waitsFor } from "./flows-DDB6AdQ-.js";
2
2
  import { availableParallelism } from "node:os";
3
3
  import { defineConfig } from "@playwright/test";
4
4
  import { fileURLToPath } from "node:url";
@@ -4,6 +4,7 @@ import { createHash } from "node:crypto";
4
4
  import { join, relative } from "node:path";
5
5
  // ../review/src/model.ts
6
6
  const text = (error) => z.string({ error }).refine((value) => value.trim() !== "", { error });
7
+ const id = (error) => z.string({ error }).regex(/^[\w-]+$/, { error });
7
8
  const seconds$1 = (error) => z.number({ error }).min(0, { error });
8
9
  const share = (error) => z.number({ error }).min(0, { error }).max(1, { error });
9
10
  const fileName = (error) => z.string({ error }).regex(/^[\w.-]+(\/[\w.-]+)*$/, { error }).refine((name) => !name.split("/").some((part) => part === "." || part === ".."), { error });
@@ -95,7 +96,7 @@ const Reply = z.strictObject({
95
96
  watch: text("needs a step's title").optional().describe("For an answer that moves: the step of its flow it's seen in, which the note then plays")
96
97
  });
97
98
  const Note = z.strictObject({
98
- id: text("needs an id"),
99
+ id: id("needs an id of letters, digits and dashes"),
99
100
  on: Place.optional().describe("Without it, about the work in general"),
100
101
  words: text("needs words")
101
102
  });
@@ -115,7 +116,7 @@ const Verdict = z.strictObject({
115
116
  words: z.string().optional()
116
117
  }).refine((verdict) => verdict.verdict !== "not quite" || verdict.words?.trim(), { error: "is not quite, so it needs words saying what's still wrong" });
117
118
  const Send = z.strictObject({
118
- id: text("needs an id").describe("Chosen by the sender, so sending twice sends once"),
119
+ id: id("needs an id of letters, digits and dashes").describe("Chosen by the sender, so sending twice sends once"),
119
120
  round: z.number().int().min(0),
120
121
  by: text("needs to say who sent it"),
121
122
  sent: z.iso.datetime({ error: "needs to say when it was sent, as an ISO date" }),
@@ -485,7 +486,10 @@ var Reviews = class {
485
486
  async get(id) {
486
487
  if (problemsWithId(id).length) throw new Refused(problemsWithId(id));
487
488
  const about = await this.#readJson(`${id}/review.json`);
488
- if (!about) throw new Refused([`There's no review called “${id}”.`]);
489
+ if (!about) {
490
+ const others = await this.list();
491
+ throw new Refused([`There's no review called “${id}”.${others.length ? ` The reviews here: ${list(others.map(quote))}.` : ""}`]);
492
+ }
489
493
  const numbers = (await this.storage.list(`${id}/rounds`)).map(Number).filter(Number.isInteger).sort((a, b) => a - b);
490
494
  const rounds = await Promise.all(numbers.map((n) => this.#readJson(`${id}/rounds/${n}/round.json`)));
491
495
  const comparisons = await Promise.all(numbers.map(async (n) => {
@@ -673,7 +677,12 @@ var Reviews = class {
673
677
  }
674
678
  async #readJson(path) {
675
679
  const bytes = await this.storage.read(path);
676
- return bytes && JSON.parse(new TextDecoder().decode(bytes));
680
+ if (!bytes) return void 0;
681
+ try {
682
+ return JSON.parse(new TextDecoder().decode(bytes));
683
+ } catch (error) {
684
+ throw new Refused([`The review's file ${path} isn't JSON: ${error.message}. Put it right, then run this again.`]);
685
+ }
677
686
  }
678
687
  #writeJson(path, value) {
679
688
  return this.storage.write(path, new TextEncoder().encode(`${JSON.stringify(value, null, 2)}\n`));
@@ -918,4 +927,4 @@ var Flows = class {
918
927
  }
919
928
  };
920
929
  const seconds = (ms) => Math.round(Math.max(0, ms)) / 1e3;
921
- export { list as A, conversation as C, problemsFinishing as D, notesToAnswer as E, time as M, roundInProgress as O, allNotes as S, lastSeen as T, readingsOn as _, GLIMPSES as a, Refused as b, PERSON as c, RECORDING as d, WROTE as f, readingsOf as g, hashOf as h, Flows as i, quote as j, toAccountFor as k, PICTURE as l, glimpsesOf as m, ASSETS as n, HANDS as o, firstLine as p, DONE_ON as r, HOLD as s, ACTIONS as t, READINGS as u, seconds as v, inOrderJoined as w, Reviews as x, keepAssets as y };
930
+ export { quote as A, inOrderJoined as C, roundInProgress as D, problemsFinishing as E, toAccountFor as O, conversation as S, notesToAnswer as T, seconds as _, GLIMPSES as a, Reviews as b, PERSON as c, RECORDING as d, WROTE as f, readingsOn as g, readingsOf as h, Flows as i, time as j, list as k, PICTURE as l, glimpsesOf as m, ASSETS as n, HANDS as o, firstLine as p, DONE_ON as r, HOLD as s, ACTIONS as t, READINGS as u, keepAssets as v, lastSeen as w, allNotes as x, Refused as y };
package/src/reporter.js CHANGED
@@ -1 +1 @@
1
- export { t as ACTIONS, n as ASSETS, r as DONE_ON, a as GLIMPSES, o as HANDS, s as HOLD, c as PERSON, l as PICTURE, u as READINGS, d as RECORDING, f as WROTE, i as default, p as firstLine, m as glimpsesOf, h as hashOf, g as readingsOf, _ as readingsOn, v as seconds } from "./reporter-DE8aueAO.js";
1
+ export { t as ACTIONS, n as ASSETS, r as DONE_ON, a as GLIMPSES, o as HANDS, s as HOLD, c as PERSON, l as PICTURE, u as READINGS, d as RECORDING, f as WROTE, i as default, p as firstLine, m as glimpsesOf, h as readingsOf, g as readingsOn, _ as seconds } from "./reporter-Dr7dWwSf.js";
package/src/test.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a as GLIMPSES, c as PERSON, d as RECORDING, f as WROTE, l as PICTURE, n as ASSETS, o as HANDS, p as firstLine, r as DONE_ON, s as HOLD, t as ACTIONS, u as READINGS, v as seconds, y as keepAssets } from "./reporter-DE8aueAO.js";
2
- import { C as firstOf, D as setupIn, E as personIn, O as repo, S as changes, T as make, n as REACHES_OUTSIDE, r as WALKED, t as ALONGSIDE } from "./flows-BkG0TgHA.js";
1
+ import { _ as seconds, a as GLIMPSES, c as PERSON, d as RECORDING, f as WROTE, l as PICTURE, n as ASSETS, o as HANDS, p as firstLine, r as DONE_ON, s as HOLD, t as ACTIONS, u as READINGS, v as keepAssets } from "./reporter-Dr7dWwSf.js";
2
+ import { A as repo, C as changes, D as personIn, E as make, O as setupIn, n as REACHES_OUTSIDE, r as WALKED, t as ALONGSIDE, w as firstOf } from "./flows-DDB6AdQ-.js";
3
3
  import { n as readPage, r as unhovered } from "./read-Bg9XVTtn.js";
4
4
  import { readFileSync, writeFileSync } from "node:fs";
5
5
  import { join } from "node:path";
@@ -1,6 +1,7 @@
1
1
  import { type Did, type Flow } from "../../review/src/index.js";
2
2
  import { type Failed, type Written } from "./reporter.js";
3
3
  import { type App, type Repo } from "./repo.js";
4
+ export declare const recorder: string;
4
5
  export type Run = {
5
6
  flows: string;
6
7
  only?: string[];
@@ -3,6 +3,7 @@ export type App = {
3
3
  start: string;
4
4
  url: string;
5
5
  oneAtATime?: boolean;
6
+ port?: number;
6
7
  };
7
8
  export type Repo = ReturnType<typeof repo>;
8
9
  export declare function repo(root?: string): {
@@ -21,3 +22,6 @@ export declare function repo(root?: string): {
21
22
  keepOutOfGit(): Promise<void>;
22
23
  app(): Promise<App>;
23
24
  };
25
+ export declare const PORTED = "{ \"start\": \"npm run dev -- --port {port}\", \"url\": \"http://localhost:{port}\" }";
26
+ export declare function copies(root: string): string[];
27
+ export declare const inWorktree: (root: string) => boolean;
@@ -37,7 +37,6 @@ export type Written = {
37
37
  file: string;
38
38
  hash: string;
39
39
  };
40
- export declare const hashOf: (file: string) => string | undefined;
41
40
  export default class Flows implements Reporter {
42
41
  #private;
43
42
  constructor({ folder, flows, before, taken }: {