Git
Every organization has its own git service, at http://git.space from any of its
machines. It is Forgejo: git hosting with pull requests and issues.
People reach it from their browser and their own computer (Git: your org’s
repositories). In a machine there is nothing to sign in to: the
platform knows which machine is asking and signs it in as the user it works for
(space-env whoami), so pushes and pull requests are that user’s. A commit carries the
name and email in git’s config, as anywhere: space-env git setup (below)
sets them where they aren’t set and keeps any that are. No credential is stored in the
machine.
What a machine reaches
| Repo | Address | Short form |
|---|---|---|
| Its project’s | http://git.space/<org>/<project> | space:<project> |
| Its user’s own | http://git.space/~/home | space:~/home |
| The organization’s own | http://git.space/<org>/<name> | space:<name> |
The organization’s own repositories are the ones that belong to no project, for what several projects share (a library, shared tooling). Each is shared with the whole organization or with chosen projects (an owner or admin sets it in the portal), and a machine reaches the ones shared with its project, with its user’s rights; the others don’t exist for it, not even one its user made. A machine pushes to the ones its user made and only reads the others, as its user would in the browser. An agent’s machine also pushes to the ones the agent made (below).
That is all: other projects’ repos don’t exist for the machine, and neither do other organizations’ (each organization’s service is its own). A machine that works for nobody (one an operator made) has none. The project’s repo is made when a machine of the project first uses it, the user’s own repo likewise.
space-env git repos lists them, with their addresses and the short form to clone them
with; the organization’s as org:
$ space-env git repos
project http://git.space/acme/web git clone space:web
yours http://git.space/~/home git clone space:~/home
org http://git.space/acme/shared-lib git clone space:shared-lib
Clone, commit, push
space-env git setup, once per machine, makes the short forms work (two URL rewrites in
the global git config) and fills in your commit name and email where they aren’t set (the
machine’s name, and the user’s address at the git service). It prints what it set. After
that it is plain git:
space-env git setup
git clone space:web
cd web
git switch -c fix
sed -i 's/teh/the/' README.md
git commit -am "Fix a typo"
git push -u origin fixA refused push means the user may only read the repo, or someone pushed first: fetch,
rebase and push again. A push is at most 64 MB, and a repo stops taking pushes once it,
or all the organization’s repos together, hold the plan’s limit (10 GiB each by default):
git then says remote error: push refused: ... with the sizes.
Pull requests and issues
space-env git pr, issue and repo run Forgejo’s command-line tool fj with the host set
to http://git.space, signed in the same way. Their arguments are fj’s (space-env git pr --help shows them). A pull request comes from a branch of the repo itself (forks are off):
space-env git issue create --repo <org>/web --body "The README says nothing" "How do I run it?"
space-env git pr create --base main --head fix --body "fixes #1" "Fix the thing"
space-env git pr view 2
space-env git pr merge 2A picture in an issue or a comment (a Spacebar report’s screenshot, an image someone pasted
or attached) is /attachments/<uuid> in its body. An agent’s machine fetches it from the
git service as the agent, which gets the pictures of its project’s repo, its owner’s home
and the organization’s repos, and no other project’s:
curl -so screenshot.png http://git.space/attachments/<uuid>More of the same:
$ space-env git pr comment 2 "Rebased on main."
$ space-env git issue search --repo acme/web slow
$ space-env git repo view acme/web
- “fixes #1” in a pull request’s body closes issue 1 when the pull request is merged.
- An agent merges only when its owner said it may.
What works: for pr, search, create, view, status, checkout, comment,
assign, unassign, depend, block, edit, close, merge and review; for
issue, create, edit, comment, assign, unassign, close, search, view,
templates, depend and block; for repo, view, readme and clone. The rest is
refused with the reason, before it reaches the service.
space-env git whoami
Who the git service signs this machine in as: the name it knows the user by.
$ space-env git whoami
An agent’s machine: its layers
An agent’s machine works as the agent, not as its owner: commits are the agent’s own. It
reads and writes the project’s repo, its owner’s own repo (~/home from that machine too, as
on every machine of its owner’s) and the agent’s repo, a repo of the agent’s own that holds
its memory and skills (/space/agent; its owner reaches it too). Work for its owner goes to
the project’s repo or ~/home, which they see, never to the agent’s own. Beyond these it
reaches only the organization’s own repositories (below), and no other person’s repo.
/space/project and /space/user follow the project’s and the owner’s repo and are reset
to them after every turn: to change either, the agent clones the repo elsewhere and pushes
from there.
git clone http://git.space/<org>/<project>.git ~/work/<project>An agent also reaches the organization’s own repositories, the ones people and agents
make for work that isn’t one project’s: it writes the ones it or its owner made and reads
the others.
space-env git create <name> makes one (3 to 40 of a-z, 0-9 and -, not a project’s
name) and prints its address; space-env git repos lists them as org. Only people
delete them, in the portal, with a code from their authenticator app or a passkey. Other
machines reach them too, but make none (see What a machine reaches).
$ space-env git create site
http://git.space/acme/site.git
$ space-env git repos
project http://git.space/acme/web git clone space:web
owner http://git.space/u-3f2a…/home git clone space:~/home
org http://git.space/acme/site git clone space:site
The three are checked out in /space (project, user and agent) and laid out as the
agent’s instructions, skills and memory, each from an AGENTS.md, skills/<name>/SKILL.md
and memory/*.md in its repo. The project’s come first and the agent’s last, and a later one
wins. That happens when the agent starts, before its session opens, and after every turn:
what the agent wrote in /space/agent is committed and pushed, and the others are fetched.
space-env layers showspace-env layers syncA change to the agent’s repo made elsewhere in the same lines is a conflict: the agent’s commits stay on its machine, and its owner’s root agent is asked to resolve it, twice. After that the owner gets an email.
What’s off
Forks, actions (CI), wikis, releases and packages are off. A project’s repo and the
personal ones come and go with projects and members; only an agent makes the
organization’s repos (space-env git create), and nobody deletes, renames, shares, forks
or changes the settings of one from a machine (fj repo create and repo delete are refused too). There
is no browser to browse with. The service’s web pages are for people, in their
browser; a machine uses git and space-env git.
How it works
git.space resolves, in every machine, to an address the platform answers itself. The
platform decides who may use which repo before a request reaches the service, sets the user
the service sees, and forwards it to the organization’s git service, a small machine of its
own that is suspended when nobody uses it and resumes on the next request. Members don’t see that
machine in their lists.