@toon-protocol/rig 4.5.0 → 4.7.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.
package/README.md CHANGED
@@ -212,7 +212,7 @@ rig pr status <event-id> applied
212
212
  | `rig issue list` / `rig issue show <id>` | free | the repo's issues + comments from the terminal |
213
213
  | `rig pr list` / `rig pr show <id>` | free | the repo's patches/PRs; `show` prints the full patch text (pipe to `git am`) |
214
214
  | `rig issue create` | **paid** | file an issue (kind:1621) |
215
- | `rig comment <root-event-id>` | **paid** | comment (kind:1622) on an issue/patch |
215
+ | `rig comment <target-event-id>` | **paid** | comment (NIP-22 kind:1111) on an issue/patch, or reply to a comment |
216
216
  | `rig pr create` | **paid** | publish a patch (kind:1617) from real `git format-patch` |
217
217
  | `rig pr status <event-id> <state>` | **paid** | set issue/patch status (kind:1630–1633) |
218
218
  | `rig site publish [ref]` | **paid** | deploy a pushed repo as a permaweb site: build the ar.io path manifest (repo paths → Arweave txids) and upload it as one paid store write; prints the gateway URL |
@@ -459,10 +459,58 @@ rig ci serve --relay wss://<relay> --repo <owner-npub>/<repo-id> [--repo …]
459
459
  | `--gateway <url>` | `RIG_ARWEAVE_GATEWAY`, else rig's preferred Arweave gateway | the gateway that serves the store's raw bytes: prefix for log/artifact URLs (`<gateway>/raw/<txId>`) **and** the first gateway the coordinator reads a commit's objects from (same `/raw/` route), ahead of the shared public list — name a private or local gateway (the sandbox's) and the coordinator needs nothing else to read |
460
460
  | `--act-bin <path>` | `act` on PATH (or `RIG_ACT_BIN`) | the act binary |
461
461
  | `--platform <label>=<image>` | `ubuntu-latest=catthehacker/ubuntu:act-latest` | `runs-on` label → Docker image (repeatable) |
462
+ | `--pull` / `--no-pull` | act's default (pull before each run) | whether act pulls the runner image named by `--platform` before each run |
462
463
  | `--workdir <dir>` | `<state-dir>/work` | where commits are materialized |
463
464
  | `--once` | | stop after the first run concludes (its 9842 and final 39842 are on the relay) — one `rig ci trigger` answered by one bounded serve; ignored or refused triggers do not count |
464
465
  | `--json` | | one JSON document with the coordinator, relay, repos and state dir on start |
465
466
 
467
+ **Two act behaviours decide whether a real workflow passes**, and a workflow
468
+ whose steps only `echo` hides both:
469
+
470
+ - **Write `actions/checkout@v4`, exactly as you would on GitHub.** act copies
471
+ the materialized tree into the job container *at that step*, not when the
472
+ container starts, and short-circuits it to a local `docker cp` — so the step
473
+ needs no network and no node in the image. A workflow without it
474
+ runs its tools against an **empty** container — the steps execute, the files
475
+ are not there:
476
+
477
+ ```
478
+ error: could not find `Cargo.toml` in `/…/work/<repo>-<sha>-1` or any parent directory
479
+ ```
480
+
481
+ That path is the checkout the coordinator materialized under `--workdir`
482
+ (`<repo-id>-<short sha>-<n>`), as the job container sees it.
483
+ - **The default image is not GitHub's hosted runner.** `ubuntu-latest` maps to
484
+ `catthehacker/ubuntu:act-latest`, which carries no language toolchain, so a
485
+ workflow that expects a preinstalled `cargo`, `go` or JDK fails at its first
486
+ step. Either point `--platform` at an image that has one
487
+ (`--platform ubuntu-latest=rust:1-bookworm`) or install it in a step. The
488
+ official `rust` images ship neither rustfmt nor clippy —
489
+ `rustup component add rustfmt clippy` is a step, not a given — and an image
490
+ you built locally needs `--no-pull` (below).
491
+
492
+ A workflow that survives both, run by a coordinator started with
493
+ `--platform ubuntu-latest=rust:1-bookworm`:
494
+
495
+ ```yaml
496
+ # .github/workflows/ci.yml
497
+ name: ci
498
+ on: [push]
499
+ jobs:
500
+ test:
501
+ runs-on: ubuntu-latest
502
+ steps:
503
+ - uses: actions/checkout@v4 # act resolves this to the local copy
504
+ - run: rustup component add rustfmt clippy
505
+ - run: cargo fmt --check
506
+ - run: cargo clippy -- -D warnings
507
+ - run: cargo test
508
+ ```
509
+
510
+ A runner image built or loaded on the coordinator host and never pushed to a
511
+ registry needs `--no-pull`: without it act force-pulls the image named by
512
+ `--platform` and every run fails in *Set up job* with `pull access denied`.
513
+
466
514
  On start the coordinator publishes an **Advertisement** (19843: runner family
467
515
  `act`, its selectors, admission `maintainer-request`, execution
468
516
  `request-required`, billing `out-of-band`, and a fresh `secrets-key`) and renews
@@ -510,9 +558,10 @@ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v rig-ci-state:/st
510
558
  The entrypoint is `rig`, so every verb works (`docker run --rm rig-ci --version`),
511
559
  and every environment variable rig honours means the same inside the image
512
560
  (`TOON_CLIENT_HOME` is `/state`). act launches each job as a container on the
513
- daemon behind the mounted socket and copies the checkout in, so no host path
514
- has to match. Against the [sandbox](#dogfooding-rigs-own-ciyml-on-the-sandbox)
515
- on the same host, run on the host network with the sandbox's own `localhost`
561
+ daemon behind the mounted socket and copies the checkout in at the
562
+ `actions/checkout` step, so no host path has to match. Against the
563
+ [sandbox](#dogfooding-rigs-own-ciyml-on-the-sandbox) on the same host, run on
564
+ the host network with the sandbox's own `localhost`
516
565
  addresses — a client dials the endpoint a node **advertises**, and the sandbox
517
566
  hub advertises `http://127.0.0.1:3200/ilp` so host-run smokes can reach it
518
567
  (sandbox-only; a real connector advertises its public URL, which the default
@@ -565,6 +614,11 @@ git commit --allow-empty -m 'ci: dogfood' && rig push --yes
565
614
  rig ci status HEAD --json | jq .summary
566
615
  ```
567
616
 
617
+ `RIG_ARWEAVE_GATEWAY` in that common env also steers the READ path: `rig clone`
618
+ and `rig fetch` try `http://localhost:3000/raw/<txId>` first, so a repo pushed to
619
+ the sandbox clones back out of it even though the public gateways never see those
620
+ objects (see [Reading through your own gateway](#reading-through-your-own-gateway)).
621
+
568
622
  The same flow, end to end and asserted, is
569
623
  `src/__integration__/ci-sandbox.integration.test.ts`; it runs only with
570
624
  `RIG_CI_SANDBOX=1` and skips itself unless the sandbox's relay, hub, store edge
@@ -744,7 +798,12 @@ per-event fee is quoted and confirmed before publishing; `--yes` skips, `--json`
744
798
  without `--yes` is a free estimate:
745
799
 
746
800
  - `rig issue create --title <t> [--body <b> | --body-file <f> | stdin] [--label <l>]…` — kind:1621.
747
- - `rig comment <root-event-id> --body <b> [--parent-author <pubkey>] [--marker root|reply]` — kind:1622.
801
+ - `rig comment <target-event-id> --body <b>` — NIP-22 kind:1111. The target is the
802
+ kind:1621 issue / kind:1617 patch (a top-level comment) or an existing kind:1111
803
+ comment (a reply). rig reads the target off the relay first, for free, so the
804
+ thread root's kind and author come from the wire: root scope is uppercase
805
+ `E`/`K`/`P`, the parent lowercase `e`/`k`/`p`, plus the repo `a` tag. Comments
806
+ published this way are invisible to rig releases older than 4.6.
748
807
  - `rig pr create --title <t> (--range <A..B> | --patch-file <f>) [--body <b> | --body-file <f>] [--branch <name>]` —
749
808
  kind:1617; `--range` runs real `git format-patch --stdout` locally and derives the
750
809
  `commit`/`parent-commit` tags. A multi-commit range publishes ONE event carrying
@@ -769,9 +828,41 @@ clone never leaves a partial repo. `rig fetch [remote]` is the same pipeline as
769
828
  delta: only locally-missing objects are downloaded, and `refs/remotes/<remote>/*`
770
829
  (tags → `refs/tags/*`) move with a `git fetch`-style report.
771
830
 
831
+ ### Reading through your own gateway
832
+
833
+ By default both commands read from rig's shared public gateway list. A repository
834
+ whose objects live only on a **private, local or air-gapped** gateway is invisible
835
+ there — so `--gateway <url>` (or `RIG_ARWEAVE_GATEWAY`, the same variable `rig push`,
836
+ `rig site` and `rig ci serve` honour) puts that gateway **first**, on the store's
837
+ raw-bytes route `<url>/raw/<txId>`, with the public list kept behind it as the
838
+ fallback. It is the read-path twin of `rig ci serve --gateway`.
839
+
840
+ ```sh
841
+ export RIG_ARWEAVE_GATEWAY=http://localhost:3000 # the dev sandbox's gateway
842
+ rig clone ws://localhost:7100 <owner-npub>/<repo-id>
843
+ rig fetch # or: rig fetch --gateway http://localhost:3000
844
+ ```
845
+
846
+ `/raw/` and not `/<txId>`: an ar.io node serves raw transaction bytes there whether
847
+ or not it does sandboxed-subdomain redirects, and the TOON store's own gateway
848
+ answers on that route alone. Public gateways serve the same bytes on both, so with
849
+ nothing configured the list is exactly as it always was.
850
+
851
+ The **`Git-SHA` lookup follows the gateway too**. A kind:30618 object map is capped,
852
+ so a SHA it does not carry is resolved by asking a gateway's GraphQL endpoint which
853
+ transaction carries that object — and a configured gateway is asked at
854
+ `<url>/graphql`, never `arweave.net` (which would answer about a *different*
855
+ network, or leak the query off an air-gapped stack). Object bytes are
856
+ content-addressed and SHA-verified, so any mirror may serve them; a tag query is a
857
+ statement about one network, so it goes only to the network you named. Configure
858
+ nothing and it is the shared `arweave.net` resolver, unchanged. A gateway that does
859
+ not serve GraphQL therefore resolves nothing — name one that does (every ar.io node
860
+ does), or leave the variable unset.
861
+
772
862
  `rig issue list|show` and `rig pr list|show` are pure relay reads (kind:1621/1617 by
773
- the repo `#a` tag; state from kind:1630-1633, latest wins; kind:1622 comments under
774
- `show`).
863
+ the repo `#a` tag; state from kind:1630-1633, latest wins; comments under `show` —
864
+ NIP-22 kind:1111 matched on the uppercase `E` root tag, merged with legacy kind:1622
865
+ by `created_at`).
775
866
 
776
867
  ## Library
777
868
 
@@ -784,7 +875,9 @@ it — that stays behind the `Publisher` seam:
784
875
  a deprecated alias; it is no longer a cap).
785
876
  - `nip34-events.ts` — NIP-34 event builders returning `UnsignedEvent`:
786
877
  `buildRepoAnnouncement` (30617), `buildRepoRefs` (30618), `buildIssue` (1621),
787
- `buildComment` (1622), `buildPatch` (1617), `buildStatus` (1630–1633).
878
+ `buildComment` (NIP-22 1111; `LEGACY_COMMENT_KIND` = 1622 stays exported for
879
+ READING old threads and is never written), `buildPatch` (1617),
880
+ `buildStatus` (1630–1633).
788
881
  - `repo-reader.ts` — `GitRepoReader`, read-only local-repo access via injection-safe
789
882
  `execFile` git plumbing.
790
883
  - `remote-state.ts` — `fetchRemoteState`, the "what does the remote have?" reader.