Repository navigation
Add host commands for First Draft hosting - #68
Draft
raghubetina wants to merge 1 commit into
Draft
raghubetina wants to merge 1 commit into
raghubetina wants to merge 1 commit into
Conversation
First Draft hosting runs one application on one DigitalOcean Droplet, and the owner's own agent operates it. The service never logs in to the Droplet and never receives a private key, so the steps that need the key or the person's GitHub login have to run on the owner's computer: the CLI generates the SSH key with ssh-keygen, sends only its public line, and stores the private key and the app's generated secrets as Actions secrets through gh's standard input. A push to the default branch deploys only when every check passes, and a freshly compiled app fails its own specs until its Behavior to write is written. So no host command deploys, and create and status end with a next sentence that says what stands between the owner and a live app: a Droplet still setting itself up, red checks, a failed deploy job, or checks that passed before the repository was connected. DEPLOY_HOST is set only after cloud-init reports done, so the deploy job cannot race the Droplet's first boot. The routes follow the service's hosting sketch, which no released API contract includes yet. The group lives in its own modules, so cli.js gains only an import, a help line, and the dispatch.
raghubetina
force-pushed
the
hosting-commands
branch
from
November 24, 2026 07:13
742f49b to
cf8cf91
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the
firstdraft hostgroup for First Draft hosting: one application on one DigitalOcean Droplet, operated by the owner's own agent. Draft: the routes follow the service's hosting sketch, which no released API contract includes yet.host create [--region] [--size]: generates an Ed25519 key withssh-keygenon the owner's computer, sends First Draft only the public line, stores the private key asSSH_PRIVATE_KEYand generatesSECRET_KEY_BASEandPOSTGRES_PASSWORD(values throughgh secret set's standard input, never printed), waits for the Droplet and its cloud-init overssh, then sets theAPP_HOSTandDEPLOY_HOSTrepository variables. Running it again resumes; it never creates a second host, and refuses a host that trusts a key this computer lacks.host status [--wait]: the host, backups, domain, the newest CI run on the default branch (gh run list/view), and/up. Itsnextsentence tells apart a Droplet still setting itself up, red checks (naming the failed jobs), a running CI, checks that passed before the repository was connected, a faileddeployjob, and a live app.host resize --size --yesandhost destroy --confirm <environment>: nothing is sent without the confirmation (confirmation_required, exit 2). Destroy also deletes the GitHub variables, the deploy key secret, and the local key.host domain [connect <hostname> | check | disconnect]: bring-your-own domain records;checksetsAPP_HOSTto the domain once its app record is right.host email [connect]: email state and allowance;connectstores new SMTP credentials withgh.No host command deploys: a push to the default branch deploys when every check passes. The owner's computer needs
ghand the OpenSSH client; no Docker, Ruby, or Kamal.The group lives in
src/commands/host-command.js,src/commands/host.js, andsrc/host-tools.js.src/cli.jsgains one import, one help line, and the dispatch, to keep the overlap with #62 small; expect a rebase after it merges.New handled errors:
host_rejected,host_unavailable,invalid_host_response,confirmation_required,deploy_files_missing,tool_unavailable,github_failed,host_key_missing,ssh_failed,host_failed,host_setup_failed.Depends on, and what a release would need
requires.api_contractinrelease/compatibility.jsonandAPI_CONTRACT_RANGEmove to it, a version andCHANGELOG.mdentry are chosen, andfirstdraft/skillsupdates its CLI pin andpackedFileAllowlist(three new files). This PR bumps nothing.deployjob inci.ymlthat is skipped untilvars.DEPLOY_HOSTis set, andconfig/deploy.ymlreadingDEPLOY_HOSTandAPP_HOST(Kamal renders it through ERB), plus theSMTP_*names.firstdraft/skills.Docs: updated docs/commands.md (intro map rows, What the CLI sends, Operate a First Draft host, Service endpoints) and docs/errors.md (Hosting recovery, Error index rows). README.md unchanged: it is at its 6,144-byte budget. CHANGELOG.md unchanged: no version is set here.
Review: not yet run. New command names, flags, and
errorvalues need the cross-review AGENTS.md names; held until the hosting package is assembled, as requested.Validation
npm audit: found 0 vulnerabilitiesnpm run check: passes (400 tests, including 17 intest/host.test.jswith a stubbed service and a fakegh/ssh-keygen/ssh; typecheck, lint, format, pack check, packed smoke with twohostcases)