@patchgg/cli 0.1.3 → 0.3.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.
Files changed (3) hide show
  1. package/README.md +21 -30
  2. package/dist/cli.js +1212 -800
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -23,8 +23,7 @@ pch agent install # gives your coding agent Patch's tools
23
23
  pch search "grappling hook" # something to start from: then pch remix or pch clone it, and change it
24
24
  pch new your-name/my-game # a repo with a patch.json; or pch init in a folder you have
25
25
  pch validate
26
- pch publish # a browser game or mod stops here as a private draft
27
- pch test start your-name/my-game@0.1.0 # played on your PC in Patch Desktop, which it takes to go live
26
+ pch publish # upload, test on your PC, your review of the footage, then live
28
27
  pch media add your-name/my-game cover.png --kind cover
29
28
  pch project update your-name/my-game --summary "One line about it"
30
29
  ```
@@ -337,37 +336,28 @@ It's advice. Nothing reads its result, nothing stops you publishing, and it does
337
336
 
338
337
  ### From upload to live
339
338
 
340
- A release stays a private draft until you say it's ready. `pch publish` uploads it as a private draft, and a browser game or a mod Patch installs (a recipe's `mode` of `browser`, `installed` or `standalone`) stops there until it has passed a test on your PC. Patch Desktop plays it as players get it and records it, then someone looks at the footage, and you decide when it goes out:
339
+ `pch publish` takes a release from upload to live, saying where it is in one line: **Uploading**, **Testing on your PC**, **In review**, **Live**. Running it is your yes. A browser game or a mod Patch installs (a recipe's `mode` of `browser`, `installed` or `standalone`) is played on your PC by Patch Desktop and recorded, and the flow stops once for its review: look at the footage it saved, then send the review it prints, which sends it on to Patch's review and follows it until it's live.
341
340
 
342
341
  ```sh
343
- pch publish # a private draft, and says what's next
344
- pch test start patch/lantern@0.1.0 # waits for you to press Start in Patch Desktop
345
- pch test view patch/lantern@0.1.0 --wait # follows it until it's been played
346
- pch test footage patch/lantern@0.1.0 # saves its pictures, and prints where
347
- pch test review patch/lantern@0.1.0 --verdict pass --plays yes --harmful no \
348
- --summary "It starts and plays" \
349
- --moment "1 00:04 the title screen draws" --moment "1 00:10 a round of play"
350
- pch release submit patch/lantern@0.1.0 # your yes: Patch reviews it, and it goes live
342
+ pch publish # upload, test on your PC, save the footage
343
+ pch publish patch/lantern@0.1.0 --review pass --summary "It starts and plays" --moment "1 00:04 the title screen draws" --moment "1 00:10 a round of play"
351
344
  ```
352
345
 
353
- - Patch's review after `pch release submit` can take several minutes, and nothing tells you when it's over: `pch status` says, and `--wait 50` holds its answer until something changes, for up to that many seconds.
354
- - Only your team can find a release published on the `private` channel, and they play it signed in. It isn't locked: anyone who has a browser game's or a block demo's game address could load it, so don't put anything secret in it. The same goes for one in a private repo, though its source stays private. A mod's files aren't on the game host. Once a project that isn't private has a public release, only a public release changes what's played, so a newer private one can't be played yet. `pch status` and `pch project view` say which it is, and where. `pch release promote` puts it out for everyone.
355
- - A passed test shows it starts and runs, not that it plays well. So before a game's first public release, `pch test review`, `pch test view` and `pch status` ask you to play it yourself, as `ask` with `--json`, in words for an agent to pass on. `pch guide` says how. Asking is all they do: nothing checks you played, and a later public release, a private one or a block's demo isn't asked.
356
- - Nothing starts a test but `pch test start`, and nothing publishes but `pch release submit`. Each command says what comes next, as `next` with `--json`, and `pch status` does too.
357
- - Patch Desktop has to be open and signed in on your PC. A test started from pch waits there until you press Start or Not now: only one asked for from a chat in Patch Desktop starts by itself. If it isn't open, the test says so, as `ask` with `--json`, in words for an agent to pass on.
358
- - `--wait` with no number follows it to the end for someone at a terminal, and for 100 seconds with nobody there, since an agent's shell commands get about 2 minutes. If it isn't over by then, it says so and exits 0: run the next command to keep following.
359
- - With a test open, `pch test start` follows that one, since starting another would cancel it. `pch test cancel` first to start over.
360
- - A review needs a verdict, whether it plays, whether it does anything harmful, a summary, and at least two moments you saw, with at least one from each run: `"<run> <mm:ss> <what you saw>"`, with the time on a frame.
361
- - A second `pch publish` of a version that's past draft submits nothing: a release never changes, so it says how to finish that one, or to move the version on.
362
- - A mod players install some other way (`workshop` or `manual`) has no test, so `pch publish` submits it from its draft. A staff key publishes directly.
363
-
364
- | Exit code | `pch test` |
365
- | --------- | ------------------------------------------------------------------------------------------------------- |
366
- | 0 | Passed, still going, or waiting for its review: `state` says which, and `next` what to run |
367
- | 1 | Couldn't run, or was cancelled: `outcome` says why, and it needs starting again |
368
- | 3 | Failed, on a check on the PC or in its review. A version that failed can't be tested or published again |
369
-
370
- `pch publish` and `pch release promote` exit 0 when they leave a private draft that needs its test, since that's the usual first stop: with `--json`, `release.status` is `draft` and `next` says what to run. So a 0 from them doesn't mean published, as a release in review doesn't either. `pch release submit` exits 5 with `test_first` or `test_not_passed` until it has passed, and `pch publish` with `test_not_passed` for a draft whose test hasn't. Both exit 3 with `files_failed` when the file checks stop it, as `pch test start` does. Each error has what to run in `details.next`.
346
+ - A review needs `pass` or `fail`, a summary, and at least two moments you saw, with at least one from each run: `"<run> <mm:ss> <what you saw>"`, with the time on a frame. Add `--harmful` if it does anything harmful, which fails it.
347
+ - Patch Desktop has to be open and signed in on your PC. A test started from pch asks you to press Start wherever you are in Patch Desktop, unless you've turned on "Start my agents' tests by themselves"; only one asked for from a chat in Patch Desktop starts by itself either way. What only you can do is printed as it comes up, as `needs_person` with `--json`.
348
+ - At a terminal it follows the release until it stops; with nobody there, for 100 seconds, since an agent's shell commands get about 2 minutes. If it isn't over by then, it says so and exits 0: run `pch publish <owner/slug@version>`, as it prints, to keep following.
349
+ - After a test that couldn't run, `pch publish <owner/slug@version> --test-again` starts another.
350
+ - `pch test start` tries a build on your PC without publishing it, and `pch test view`, `pch test footage` and `pch test review` look at it. `pch publish <owner/slug@version>` carries it on from there once you want it out.
351
+ - Who can see a release is said once a project, the first time it comes up, and always in `--json` as `who_can_see`. Only your team can find a release on the `private` channel, and they play it signed in. It isn't locked: anyone who has a browser game's or a block demo's game address could load it, so don't put anything secret in it.
352
+ - A passed test shows it starts and runs, not that it plays well, so play a game yourself before its first public release. `pch guide` says how.
353
+ - A second `pch publish` of a version that's past draft uploads nothing: a release never changes, so it says how to finish that one, or to move the version on.
354
+ - A mod players install some other way (`workshop` or `manual`) has no test, so it goes straight to Patch's review. A staff key publishes directly.
355
+
356
+ | Exit code | `pch publish` |
357
+ | --------- | ------------------------------------------------------------------------------------------------------------- |
358
+ | 0 | Live, waiting for your review of the footage, ready for a press in a chat, or still going: `stage` says which |
359
+ | 1 | Its test couldn't run, or its repo is private: `code` and the message say what to do |
360
+ | 3 | It failed its test or its checks. A version that failed can't be tested or published again |
371
361
 
372
362
  ### Blocks
373
363
 
@@ -528,7 +518,7 @@ CI runs both on Windows, macOS and Linux. pch knows it's the executable through
528
518
 
529
519
  ### Releasing
530
520
 
531
- **Release with the button:** [Actions, Release pch](https://github.com/patch-gg/pch/actions/workflows/release.yml), **Run workflow** on `main`, then pick `patch` (fixes), `minor` (new things) or `major` (breaking). It tags `main` with the next version and releases it to npm and the one-line installers together. Patch-gg/patch's `product/design/cli.md`, Releasing pch, says what each step does and what to do when one fails.
521
+ **Release with the button:** [Actions, Release pch](https://github.com/patch-gg/pch/actions/workflows/release.yml), **Run workflow** on `main`, then pick `patch` (fixes), `minor` (new things) or `major` (breaking). It tags `main` with the next version and releases it to npm and the one-line installers together, then opens Patch Desktop's PR to ship it. Patch-gg/patch's `product/design/cli.md`, Releasing pch, says what each step does and what to do when one fails.
532
522
 
533
523
  `package.json` stays `"private": true`, so npm and pnpm refuse to publish pch from a checkout, and a test keeps it that way. [`publish.yml`](.github/workflows/publish.yml) is the only way out. It runs on a `v<version>` tag on `main`, which is the version, and stops unless production has repos. It publishes with npm's trusted publishing, so no npm key is kept anywhere: npm takes `@patchgg/cli` only from this repo's `publish.yml`, as the package's settings on npmjs.com say. One build per version: its `pack` job runs every check, builds once, takes `private` out of its own copy, packs, tries the tarball installed, and keeps it as the run's artifact `npm-package`. Every other way of installing pch is made from that tarball's `dist/`, never rebuilt from source. Then, in order:
534
524
  - `executable` makes the six executables, each on its own runner (Linux, macOS and Windows, x64 and arm64), and runs the smoke test against each, and on Linux the tests too.
@@ -537,6 +527,7 @@ CI runs both on Windows, macOS and Linux. pch knows it's the executable through
537
527
  - `try-installers` installs it from staging.patch.gg on a clean Debian container, Linux on Arm, both kinds of Mac and both kinds of Windows, and checks it runs, says its version, and on Windows, its signature.
538
528
  - `publish` sends the tarball to npm, with provenance once this repo is public.
539
529
  - `production` puts the same files on cdn.patch.gg and moves production's `latest.json`.
530
+ - `desktop` opens the PR in patch-gg/patch that ships the version in Patch Desktop (`feat(desktop): ship pch <version> from npm` for a minor or major, `fix(desktop)` for a patch, as Desktop's version comes from its PR titles). It signs in as the `patch-gg-releases` GitHub App, so patch's CI runs on the PR. The app is installed on patch-gg/patch alone, and its client ID and key are in the `production` environment. A patch or minor release merges itself once that CI passes, which publishes a staging build of Patch Desktop. A major waits for a person to merge it. The release is out before this job starts, so if it fails, re-run it alone.
540
531
 
541
532
  Nothing reaches npm or production unless every platform got through. A version's files never change: a version that's on the CDN already with other files stops the release. `latest.json` only moves forward, and it's the one version check: the installers read it, and so do `pch update` and the notice. The `staging` and `production` environments take `v*` tags only, and hold R2 keys for their own public bucket alone (`infra/scripts/create-pch-release-keys.mjs` in patch-gg/patch makes them).
542
533
  To release what's on `main`: