@recoder.xyz/rithub 0.2.0 → 0.2.1

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 (2) hide show
  1. package/README.md +68 -14
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,17 +1,59 @@
1
1
  # @recoder.xyz/rithub
2
2
 
3
+ Your GitHub account is a single point of failure. One flag, suspension, or
4
+ outage and every repo on it is unreachable until it's fixed. `rit` is a
5
+ `gh`-style command-line client for [Rithub](https://rithub.dev) that keeps
6
+ a live mirror there — `rit push` creates the repo on Rithub if it's
7
+ missing, then pushes, so importing your repos is one command, not a form.
8
+
3
9
  ```
4
- npx @recoder.xyz/rithub init
10
+ npm i -g @recoder.xyz/rithub
5
11
  ```
6
12
 
7
13
  (npm refuses the bare name `rithub` outright — "too similar to existing
8
- package github" — so the published package is scoped; the CLI itself is
9
- still the `rithub` command, e.g. after `npm install -g
10
- @recoder.xyz/rithub` it's just `rithub init`.)
14
+ package github" — confirmed again 2026-11-30 trying to publish under it
15
+ directly. The package stays scoped, but it installs **two** bin names:
16
+ `rit` and `rithub` — same binary, either one works.)
17
+
18
+ ```
19
+ rit login # paste a token from Settings -> Applications
20
+ rit whoami
21
+ rit clone homeplan # bare name = your own account
22
+ rit clone caelum0x/homeplan # or owner/repo, for any repo you can see
23
+ rit repo create my-app --private
24
+ rit push # creates the repo on Rithub if missing, then pushes
25
+ rit logout
26
+ ```
27
+
28
+ Rithub has no OAuth2 device-code flow to log in with (confirmed live:
29
+ `https://rithub.dev/login/device/code` is a plain 404), so `rit login`
30
+ is the fallback the task spec calls for: open
31
+ `https://rithub.dev/user/settings/applications`, generate a personal
32
+ access token, paste it (hidden input, never echoed) or pass
33
+ `--token`/`RITHUB_TOKEN`. The token is validated against the real
34
+ account (`GET /api/v1/user`) before anything is saved to
35
+ `~/.config/rithub/config.json` (written `0600`).
36
+
37
+ **Scopes:** cloning and pushing to a repo that already exists needs
38
+ `read:user` + `write:repository`. Creating one — `rit repo create` and
39
+ `rit push`'s auto-create path — additionally needs **`write:user`**:
40
+ confirmed live, 2026-11-30, that Rithub's own
41
+ `POST /api/v1/user/repos` route is gated on that scope, not
42
+ `write:repository` as the name would suggest. `rit login` tells you
43
+ this up front.
44
+
45
+ Private repos never get their token written to disk: `rit clone` and
46
+ `rit push` pass it on `-c http.extraHeader=Authorization: token <...>`
47
+ for that single `git` invocation only (plus `-c credential.helper=` so
48
+ a cached OS credential can't silently swap in a different account) —
49
+ verified live against a private repo that the resulting `.git/config`
50
+ has no token or header in it.
51
+
52
+ ## No account, no sign-in, no human: `rit init`
11
53
 
12
- No account, no sign-in, no human. One command gives an AI coding agent (or
13
- a person) a real [Rithub](https://rithub.dev) account, an access token
14
- scoped to one repo, and a first repo — then `git push` works.
54
+ One command gives an AI coding agent (or a person) a real Rithub
55
+ account, an access token scoped to one repo, and a first repo — then
56
+ `git push` works, with no login step at all:
15
57
 
16
58
  ```
17
59
  $ npx @recoder.xyz/rithub init
@@ -20,7 +62,7 @@ git remote 'origin' set to agent-lwlvjdtj/first-repo. Next: git add -A && git co
20
62
  Unclaimed: a small repo quota applies. Keep this account: rithub claim --email you@example.com
21
63
  ```
22
64
 
23
- Re-running `rithub init` in the same directory reuses the account from
65
+ Re-running `rit init` in the same directory reuses the account from
24
66
  `.rithub/agent.json` (gitignored automatically) instead of signing up again.
25
67
 
26
68
  A small repo quota applies until a human claims the account:
@@ -34,7 +76,7 @@ This sets the account's real email and lifts the quota. Afterward, open
34
76
  real password and sign in as the account in a browser — no separate
35
77
  claim-token system, just Rithub's own password-reset mail.
36
78
 
37
- ## How it works
79
+ ## How `init`/`claim` work
38
80
 
39
81
  `init` solves a small proof-of-work challenge (cheap for a machine,
40
82
  expensive for mass abuse — no CAPTCHA, since an agent cannot solve one),
@@ -48,14 +90,26 @@ POST https://rithub.dev/agent-signup/claim (Bearer <token>) { email }
48
90
  ```
49
91
 
50
92
  An agent that would rather skip the CLI and call the API directly can do
51
- exactly that — same two JSON endpoints, no SDK required.
93
+ exactly that — same two JSON endpoints, no SDK required. Everything
94
+ else (`login`/`clone`/`repo create`/`push`) talks to Rithub's own
95
+ REST API at `/api/v1` with a plain `fetch` — no SDK there either.
52
96
 
53
- ## Flags
97
+ ## Commands
54
98
 
55
99
  ```
56
- rithub init [--repo <name>] [--api-url <url>] [--json]
57
- rithub claim --email <you@example.com> [--json]
100
+ rit init [--repo <name>] [--api-url <url>] [--json]
101
+ rit claim --email <you@example.com> [--json]
102
+ rit login [--token <token>] [--api-url <url>] [--json]
103
+ rit logout [--json]
104
+ rit whoami [--json]
105
+ rit clone <owner/repo|repo> [dir] [--json]
106
+ rit repo create <name> [--private] [--description <text>] [--json]
107
+ rit push [--private] [--name <name>] [--json]
108
+ rit help, --help, -h
109
+ rit --version, -v
58
110
  ```
59
111
 
60
112
  `RITHUB_API_URL` overrides the default `https://rithub.dev` (useful for
61
- local development against this repo's own test fixtures).
113
+ local development against this repo's own test fixtures). `RITHUB_TOKEN`
114
+ overrides the saved login for one command. Zero runtime dependencies,
115
+ plain `node:fetch`/`node:child_process`/`node:fs`, Node >= 18.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@recoder.xyz/rithub",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "A gh-style CLI for Rithub: `rit login`, `rit clone`, `rit repo create`, `rit push`, plus `rit init`'s no-human agent signup. One command, zero deps.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",