caelum0x 44f9f21329
Some checks failed
ci / cargo test (abacus) (push) Has been cancelled
ci / cargo test (agent-runtime) (push) Has been cancelled
ci / cargo test (context-passport) (push) Has been cancelled
ci / cargo test (game-economy) (push) Has been cancelled
ci / cargo test (ledgerline) (push) Has been cancelled
ci / cargo test (mint) (push) Has been cancelled
ci / cargo test (rago) (push) Has been cancelled
ci / cargo test (relay) (push) Has been cancelled
ci / cargo test (toolgate) (push) Has been cancelled
ci / cargo test (turnstile) (push) Has been cancelled
ci / cargo test (vend) (push) Has been cancelled
ci / node suites (push) Has been cancelled
feat(RIT-RET): full account export, one click or rit export
New apps/rithub-export: one click at https://rithub.dev/export, or
`rit export` from the CLI, produces a downloadable .tar.gz of every repo
the signed-in account owns -- real `git bundle --all` per repo (+ wiki
if any; `git clone <bundle>` reproduces the exact commits, no history
rewriting), plus issues/pulls/releases+assets as documented JSON (the
engine's own public API object shape, each issue/pull carrying its full
comment thread). manifest.json indexes per-repo files + counts.

- Two ways in, one job underneath: the web page authenticates via a
  one-time real OAuth2 (PKCE) consent, same "no pasted tokens" pattern as
  apps/rithub-approvals (own encrypted-at-rest token store, own data
  dir/key); `rit export` brings its own Bearer token, no browser round
  trip. Git traffic goes loopback-to-the-engine, never the public domain
  (same reasoning as the 2026-11-26 import-timeout fix).
- One export at a time, box-wide (jobStore.mjs's boxTooBusy/
  hasActiveJob, os.loadavg() read directly) -- a request while busy gets
  a clear 503, matching railyard-box's own "no heavy job unless load1<6"
  rule instead of silently queuing a pile-up.
- Opt-in nightly copy, kept 7 days on our side (nightly.mjs): a sweep
  every 24h exports every opted-in login with a stored token, then prunes
  every archive past the retention window. An opt-in copy to the user's
  OWN storage target needs their own credentials -- documented as a real,
  separate follow-up, not built this pass (nightly.mjs's own comment has
  the exact extension point).
- Scope stated plainly: every repo the account *owns*, not an org repo
  it merely has access to -- org export is a natural follow-up.

Real bug found live while building this, fixed before shipping: the
token used to travel to `git clone` as a `-c http.extraHeader=...` argv
element, which Node's own child_process error message echoes back
verbatim the moment a clone legitimately fails (e.g. a repo with no wiki
yet) -- putting the raw token into this job's own persisted log, served
back through /export/api/jobs. Fixed via GIT_CONFIG_KEY_0/VALUE_0 env
vars instead of argv (git >=2.31); jobStore.mjs's appendLog also redacts
any token-shaped substring as an independent second layer. Confirmed live
after the fix: the exact same failing clone (nonexistent wiki) no longer
has the token anywhere in its error text or the on-disk index.

`rit export` added (packages/rithub-cli/src/export.mjs); CLI bumped
0.3.2 -> 0.3.5 across this pass and the sibling RIT-ACT commit
(--agent/export flags + README), published, confirmed live.

Live-verified on rithub.dev with a throwaway mail.tm test account, 2
repos, an issue+comment, a PR+comment, and a release+asset: `rit export`
produced an archive whose manifest counts (2 repos, 1 issue, 1 pull, 1
release, 1 asset) matched the live API exactly; `git clone` from both
repo bundles reproduced byte-for-byte the real branch SHAs (including a
non-default branch carrying an open PR); the issue/PR JSON carried the
real comment bodies; the release asset's downloaded bytes matched the
uploaded file exactly. Re-ran the same flow from the web UI (gstack):
one-time Authorize, "Export now" click, Download -- same result. A
different account's /export/api/jobs correctly saw an empty list (no
cross-account leak). Test account and all artifacts purged after.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-12-01 15:39:46 +03:00
..