railyard/apps/rithub-export
caelum0x 784bea9880 fix(RIT-BRD): drop wordy "--" copy and raw scope walls across approvals/export/device-auth
Same Apple-design copy pass as the OAuth consent screen: "Held pushes --
all repos" -> "Held pushes, all repos", dropped redundant "so X is a
single click -- no token to copy or paste" trailers now that the consent
screen itself says that, and the device sign-in page's raw space-
separated scope list is now a one-line summary + an expandable
<details> for the full list (matching grant.tmpl's own pattern).

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

rithub-export

RIT-RET full account export (plans/railyard.md queue item 4, 2026-12-01). 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:

  • repos/<name>/repo.bundle -- a real git bundle --all (every ref). git clone <bundle> reproduces the exact commits, byte-for-byte, no history rewriting. wiki.bundle alongside it when the repo has a wiki with at least one page.
  • repos/<name>/issues.json, pulls.json, releases.json -- the engine's own public API object shape (the same one /api/swagger documents), each issue/pull carrying its full comment thread (comments_full), each release carrying its assets with a local_file pointer into repos/<name>/assets/<tag>/<filename>.
  • manifest.json -- one small index: per-repo file pointers and counts, plus account-wide totals.

Two ways in, one job underneath (src/exportJob.mjs + src/runner.mjs): the web page authenticates via a one-time real OAuth2 (PKCE) consent, same "no pasted tokens" pattern as apps/rithub-approvals (src/oauthTokenStore.mjs, AES-256-GCM at rest, own data dir/key, never shared with another service); rit export just brings its own Bearer token, no browser round trip needed. Git traffic goes loopback-to-the- engine (RITHUB_ENGINE_HOST/RITHUB_ENGINE_PORT), never the public domain -- same reasoning as the 2026-11-26 import-timeout fix.

Scope, stated plainly: every repo the signed-in account owns -- not an org repo it merely has collaborator/member access to. Account- level export defaulting to someone else's org repo would be the wrong default; an org-scoped export is a natural follow-up, not this pass's job.

One export at a time, box-wide (src/jobStore.mjs's boxTooBusy/ hasActiveJob): git clone --mirror across every repo an account owns is exactly the kind of job railyard-box's standing "no heavy jobs unless load1 < 6 and nothing else is building" rule exists for. A request while busy gets a clear 503, not a silently queued pile-up.

Nightly copy, opt-in, kept 7 days on our side (src/nightly.mjs, RITHUB_EXPORT_NIGHTLY_RETENTION_DAYS): a sweep once every 24h runs a real export for every opted-in login with a usable stored token, then prunes every archive (manual or nightly) older than the retention window. The task's other option -- an opt-in copy pushed to the user's own storage target (S3, rsync, etc.) -- needs that user's own credentials, a real secrets-handling surface this same-day pass documents but does not build; nightly.mjs's bottom comment has the exact extension point for a future pass.

A 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). That put the raw token into this job's own persisted log, served back through /export/api/jobs. Fixed in exportJob.mjs's gitAuthEnv: the token now travels via GIT_CONFIG_KEY_0/ GIT_CONFIG_VALUE_0 env vars (git >=2.31) instead of argv, so it can never appear in a thrown error's command-line text; jobStore.mjs's appendLog also redacts anything still shaped like a bearer/token value as a second, independent layer.