Docs: guides for using the factory on your repository and on itself #25
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "dario/sandbox-guides"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Two step-by-step guides, so that someone can get from an empty machine to factory runs without piecing it together from the README, the deploy guide and
sandbox/README.md.docs/using-the-factory.md: using the factory on your own repository.AGENTS.md, tests that run in the sandbox, CI, issues written as tasks).~/.config/factory/projects/<name>/), copied fromsandbox/and kept out of the repository.factory.json.docs/developing-the-factory.md: entering thefactory-devsandbox and the loop for improving the factory with the factory. This covers issue,implement-issue, human review and merge, then loading the merged code back into the sandbox (the skills and prompts are built into the binary, so a merge changes nothing in the sandbox until the binary is rebuilt). It also coversimprove-factoryand working by hand in the sandbox.justfile:just sandbox-kittakes an optional kit directory, so it can build the factory into a project's own kit. The default (sandbox/factory-dev) is unchanged.README.md,AGENTS.md,docs/deploy-microvm.mdandsandbox/README.md.Evidence
This PR changes
AGENTS.mdby one sentence: the pointer to the two new guides. It changes no rule. The reason: the setup was spread overREADME.md,docs/deploy-microvm.mdandsandbox/README.md. None of those described how to enter thefactory-devsandbox for development, how merged changes reach it, or how to make a sandbox for another repository. The guides were requested directly by the maintainer; there are no failed runs or reviews behind this change.Tests
just checkpasses. Only docs and thejustfilechanged.just sandbox-kit <dir>builtfactory-amd64andfactory-arm64into a scratch directory (static Linux ELF binaries for x86-64 and aarch64).Needs human attention
Neither guide has been followed end to end in a real sandbox. Please check these points in particular:
using-the-factory.mdstep 4 renames the kit's directory,.yamland.dockerfiletogether (factory-dev→app). I assumedsbxmatches them by name, as the template's layout suggests. That assumption is not verified.credential@1block (Authorization: token %s) is for Forgejo, Gitea and Codeberg. For GitHub the guide refers to the manual setup instead, per ADR 0013.git -c http.extraHeader="Authorization: token $FACTORY_FORGE_TOKEN", relying on the proxy replacing the placeholder, as it does for the factory's own git calls.#tests, but the heading is "Tests and static analysis".🤖 Generated with Claude Code
@ -0,0 +8,4 @@You need `sbx` 0.45 or later, Go and `just`, and a checkout of this repository.1. **Store the forge token** in your OS keychain. Use a token limited to the repositories the factory works on ([docs/tokens.md](tokens.md)):why in the OS keychain? It should not matter where we store it, only that we set it as a sandbox secret
@ -0,0 +21,4 @@sbx env run sandbox/````sbx` shows a plan: the kit's network rules and its request to use the `factory-forge` credential on `git.darioveltri.de`. Approve it. You land in a bash shell inside the sandbox.4. **Sign in to Claude**, if this machine hasn't yet: run `claude`, then `/login`, then exit Claude Code. The login stays on the host.this is a too specific instruction. I might not want to use claude, I could also work on it using opencode+a local model.
@ -0,0 +46,4 @@1. **Describe the change as a forge issue** in `dario/factory`, in the forge's web UI. Say what is wrong, what done looks like and how to verify it.2. **Implement it in the sandbox:**```shfactory run implement-issue -repo dario/factory -item 14 -interactiveuse a placeholder for the issue number
@ -0,0 +50,4 @@```- `-interactive` opens Claude Code with the task, so you can watch and steer. Leave it out for a headless run with the `implement` role's timeout and budget.- Add `-review` (headless) to get a separate read-only review of the pull request it opens, or run it later with `factory run review-pr -repo dario/factory -pr <n>`.- The agent may run `just check`, `go test`, `go vet`, `gofmt` and `go build` (`allowed_shell` in [`sandbox/factory-dev/factory.json`](../sandbox/factory-dev/factory.json)).since we are in a development sandbox, why are we even this strict about which commands the agent can run?
@ -0,0 +35,4 @@Then:1. **Create a token** for that account, limited to the repositories the factory works on, with only the scopes in [tokens.md](tokens.md): on Forgejo `write:repository` and `write:issue`; on GitHub a fine-grained token with Contents, Pull requests and Issues read/write, Commit statuses and Metadata read. Give it a short lifetime. Keep it at hand for step 6; don't store it in a file.move the forge specific info into the tokens.md
@ -0,0 +52,4 @@Copy the template, then rename the kit after your project. Keep the kit's directory, its `.yaml` and its `.dockerfile` named alike, as in the template:```shmkdir -p ~/.config/factory/projectsthis sounds super tedious. Could add a command to the factory tool that is meant to set up the profile via prompts? Maybe create an issue for that.
@ -0,0 +67,4 @@|---|---|| `sbxenv.yaml` | The sandbox: the built-in `claude` workload, the kit, no host mount, a shell as entry point || `app/app.yaml` | The kit: tool versions, network rules, the forge credential, a setup hook || `app/app.dockerfile` | What the kit installs: your toolchain, OpenCode, `factory` and its config |there should probably be some sort of template for this, or users might be very lost
@ -0,0 +68,4 @@| `sbxenv.yaml` | The sandbox: the built-in `claude` workload, the kit, no host mount, a shell as entry point || `app/app.yaml` | The kit: tool versions, network rules, the forge credential, a setup hook || `app/app.dockerfile` | What the kit installs: your toolchain, OpenCode, `factory` and its config || `app/factory.json` | The factory configuration (no secrets) |the factory json content could also be prompted
@ -0,0 +196,4 @@sbx env run ~/.config/factory/projects/app````sbx` builds the kit and shows a plan: the network rules and the request to use the `app-forge` credential on `git.example.com`. Read it and approve. You land in a bash shell inside the sandbox.2. **Sign in to Claude** (subscription only, once per machine): run `claude`, then `/login`, then exit Claude Code. The login stays on the host.this is too specific and may not be what the user needs