this adds:
- prereqs for migrations; object format negotiation and background imports for knot2
- create repo rpc gets a source kind; so it can either be a fork or an import
- describeRepo gets a content field for expressing what state a repo is in (fetching, partial (lfs missing), etc)
- the migrator service; which does the actual repo create rpc + repo declaration record
- web client server apis for connecting to github
- the web UI for github onboarding + single URL anonymous repo migration
how it works:
- user authenticates to github, the session is stored on web client server side
- their profile gets filled in, emails get added to deliberi and ssh keys are imported
- onboarding finishes; user can choose "migrate repos" in the finish step
- they get redirected to the import / migrate repo page
- user authenticates the migrator service (this creates an oauth token scoped to create repo rpc + create repo record, the oauth token is stored on migrator)
- user chooses repos, blabla, they can start import
- each repo gets made into a task and is sent to the migrator via createTask rpc
- currently since every repo is public, migrator just passes on the url to the source field of create repo rpc
- if private, migrator would first clone down the repo using the github token that the user authenticated for, and then expose a secret url, which gets passed onto the knot via source field again. once the repo is polled to be fetched by the knot, the repo is wiped from disk
- this is also the step where we would do issue / pr migration by writing COBs. i was thinking we can just do this migrator side without having to add more oauth scopes and make calls to the knot, not exactly sure if this is possible but it seemed so, and knot should just be able to import the cobs alongside the repo?
- repo gets imported yadayada, with listTasks to migrator you get the state of the task and such.
- ...and thats it. the repos are migrated now!
the choices:
- why migrator service? because embedding application logic inside knot is bad, and the xrpc surface would suck. plus knot should not be holding secrets.
- why have the user oauth against the migrator? because even if we did some token grant surface between knot and migrator, we still need to be able to write to the PDS. plus its the cleaner way anyway, why add a separate auth thing...
- we could potentially hook up our tngl.sh pds here and skip the oauth screen mayhaps...
- why the secret url? because then we reuse knot rpc. is it a security risk, no, at least i havent thought of anyway it could be. knot will be able to see it but the knot has to clone it and the knot owner is your host so that part is unavoidable. it has to be public so other knots can clone it. but this part should get more checking.
- thats all i think? can bikeshed on the migrator lexicons...
- its missing progress bar thing rn. we could add a streaming xrpc for this to the migrator maybe... i havent bothered for this pr though
i didnt test it against real github, still have to do that since it needs app and deploy of migrator and knot2, localinfra has a stub server that mocks github apis. unfortunately knot upgrade is mandatory here because of the new lexicon surface in repo.create and describeRepo