GitHub and GitLab

Woolshed works with GitHub and GitLab through their own tools: clone or create a repo, follow a pull request's checks, and add a deploy workflow.

A project in a GitHub or GitLab repo is backed up, can be shared, and GitHub Actions or GitLab CI can deploy it. Woolshed works through the hosts' own tools, gh and glab: they keep the sign-in (the keychain, their own config), never Woolshed's files.

  • repos (a dialog: mod.open {name: "repos"}, Settings → Accounts, the start screen's folder list, the status bar's repo) has views, by props {view, host?, pick?, folder?, remote?}: hub (the default: both accounts, Clone, New repository), connect (host: github or gitlab; installs the tool with Homebrew when it's missing, then the host's device sign-in: gh auth login --web … --scopes workflow, glab auth login --device; the code goes on the clipboard and the page opens; then gh auth setup-git, or glab as git's credential helper for gitlab.com, so plain git push works), clone (the account's and its organizations' repos, newest push first, with search; into ~/Code or the first usual code folder that exists, changeable, remembered in shared "repos.dir"), create (owner: the account or one of its organizations or groups, name, private or public; made with a README, then cloned), and deploy (below). A clone or a new repo opens as a space, or with pick: true (the start screen) becomes that screen's folder (shared "repos.picked"). Shared "repos.accounts" is who each host is signed in as ({login}, {login: null}, {tool: false}), as Settings last saw.
  • The status bar shows the shown space's repo (git remote get-url origin), the branch's open pull request (gh pr view --json number,title,url,state,isDraft,statusCheckRollup, else on origin's repo with --repo, for a fork whose gh default is the upstream; GitLab: glab mr view -F json, its head pipeline as the checks) and its checks, every minute and when the space or branch changes; clicking opens them in the browser. The repo's menu also opens a pull request for the branch and Add a deploy workflow. This computer's spaces only.
  • Add a deploy workflow writes .github/workflows/deploy.yml (or .gitlab-ci.yml) for one of: your server over SSH (build, rsync, then a command there), a Docker image (pushed to ghcr.io or the project's GitLab registry, optionally run on your server), or a static site (GitHub Pages, GitLab Pages). It names secrets (SSH_HOST, SSH_USER, SSH_PRIVATE_KEY, SSH_KNOWN_HOSTS) and never holds a value: they go in with gh secret set NAME / glab variable set NAME (Add them in a terminal asks for each there, makes a deploy key of the repo's own, ~/.ssh/woolshed_deploy_<repo>, and can put it on the server). Then Commit and push.

When you work in a space with such a repo (the person asked you to change something):

  • Check first: git remote get-url origin (github.com: gh; gitlab: glab), and gh auth status / glab auth status. Signed out or missing: ask the person to connect it (woolshed do app.settings --section accounts); never ask for a token or put one in a file, a remote URL or a command line.
  • Work on a branch, not the default one: git switch -c fix-login, commit in small steps with clear messages, then git push -u origin HEAD.
  • The person may ship from Changes instead (Ship). Either way, Woolshed then sends you the request's failed checks and new review comments as messages: fix, push, and say what you did.
  • Open the pull request yourself: gh pr create --fill (or --title … --body …, --draft while unfinished); GitLab: glab mr create --fill --yes. Its link and checks show in the status bar. Follow the checks with gh pr checks --watch (glab ci status); read a failure with gh run view --log-failed (glab ci trace <job>), fix it, push again.
  • Merge only when the person says so (gh pr merge --squash, glab mr merge). Pushing to the default branch runs the deploy workflow, if there is one.
  • A new project with no repo yet: gh repo create <name> --private --source . --push (glab repo create <name> --private, then git push -u origin HEAD), after asking the person which account or organization and private or public. A secret the app needs at deploy goes in with gh secret set NAME typed by the person, never in the repo.

Your agents read these same words: Woolshed writes this guide to ~/.config/woolshed/AGENTS.md on every start. In it, “you” is the agent and “the person” is you.