fr-init
Captures "how you work in this repo" as committed devcontainer profiles plus
host-only secrets placeholders. Interactive BY DESIGN — the interview is
operator-owned context, so this skill is exempt from autonomy contracts:
under a fr-goal run, a missing devcontainer is a blocker; pause, run this
interview, resume isolated.
Announce at start: "I'm using fr-init to set up this repo's profiles."
1. Scan first
Before asking anything, learn what the repo already says:
- Languages and toolchains: manifests (pyproject/package.json/go.mod/...),
lockfiles,
.tool-versions, CI workflows (what does CI install?).
- Existing
.devcontainer/ (profiles already present? then this is an
edit, not a green-field init). Check .devcontainer/fr-profiles.yaml
for an existing top-level backend:/host: key too.
- Which forge:
git remote get-url origin's hostname (github.com /
gitlab.com self-identify; anything else, including a literal
gitea.com, is self-hosted and needs the operator to confirm the
backend explicitly — no hostname alone distinguishes GitLab
Self-Managed / Gitea / GitHub Enterprise).
- Credential surface:
.env* patterns in .gitignore, CI secret names,
cloud/k8s configs — candidates for the profile's expected secrets.
- Working patterns: Makefile/justfile/scripts (what do humans run here?).
The interview confirms and fills gaps; it never asks what the scan answers.
2. Interview (AskUserQuestion, batched ≤4 per round)
Cover, with scan-informed recommended options:
- Backend — github (default), gitlab, or gitea? Skip asking if the
scan already resolved it unambiguously (github.com/gitlab.com remote, or
an explicit
backend: key already in fr-profiles.yaml). Confirm the
hostname too (--host) if self-hosted — drives which CLI
(gh/glab/tea) gets installed and which CI template
fr acceptance init picks.
- Profiles wanted — one
dev default, or split (e.g. readonly for
review/exploration vs admin with deploy credentials)? Profiles differ
by CREDENTIALS first, tools second — same binaries, different env-files
is the normal shape.
- Tools — confirm the scan's toolchain list; surface what CI installs
that local work also needs (kubectl, terraform, docker-in-docker...).
- Credentials per profile — which env KEYS each profile expects
(names only, never values). Do NOT ask for a host-forge token by
default: push, PR/MR creation, and every
fr-driven gh/glab/tea
call run on the authenticated HOST (fr-isolation's credential boundary)
— the container needs none for the standard pipeline. Offer it only
for an explicit in-container-writes profile (e.g. admin).
- Working patterns — test/build/run commands worth recording in the
profile's purpose/notes so future runs know the repo's verbs.
3. Scaffold per profile
fr init scaffold --repo . --profile dev --purpose "day-to-day development" \
--tool uv --tool node --default
fr init scaffold --repo . --profile admin --purpose "deploys, gh writes" \
--secret GH_TOKEN --secret KUBECONFIG_B64
For a non-GitHub repo, pass --backend/--host on EVERY profile call for
that repo (repo-level, but scaffold reads it fresh per call):
fr init scaffold ... --backend gitlab --host gitlab.mycorp.com.
Each call writes:
.devcontainer/<profile>/devcontainer.json — committed by scaffold; base
image + the backend's CLI (github-cli feature for GitHub; a versioned,
checksummed glab/tea binary install for GitLab/Gitea — no official
devcontainer feature exists for either) + mapped tool features + vk
installed in postCreate + --env-file pointing at the host secrets path.
.devcontainer/fr-profiles.yaml — committed by scaffold; default profile,
purpose, expected secret keys, notes for tools without a feature mapping,
and the repo-level backend/host keys (github is the implicit default
and not written explicitly).
~/.config/fr/secrets/<repo>/<profile>.env — host-only; commented
placeholders per secret key. Existing operator values are never
overwritten; re-runs only append missing placeholders.
Unknown tools land in the profile's notes — wire them into
postCreateCommand by editing the devcontainer.json, and say so.
4. Hand back
- Tell the operator which placeholders to fill
(
~/.config/fr/secrets/<repo>/<profile>.env) before the first
fr isolation up — an empty env-file is normal for a default profile
(the standard pipeline needs only the host's own CLI auth to be green:
gh auth status for GitHub, glab auth status for GitLab, tea login
for Gitea).
fr init scaffold already committed the .devcontainer/ files (scoped
commit on the current branch — main during bootstrap), so the profile is in
the committed tree that fr isolation up checks out. No separate commit step
— and the agent couldn't do one anyway (base-repo git commit is gate-denied).
Pass --no-commit only if you want to stage/commit them yourself (e.g. to open
a PR in a repo that blocks direct pushes to main).
- If a run was paused on this init, resume it:
fr isolation up now works.
Multi-profile principles
- The DEFAULT profile is the one autonomous runs use; keep it least-
privileged enough to be safe unattended (admin credentials belong in a
non-default profile the operator selects explicitly).
- Adding a profile later is one more
fr init scaffold call — the layout
is per-profile subfolders from day one, no migration.
1---2name: fr-init3description: Initialize a repo for isolated runs: scan it, interview the operator about working patterns, tools, and credentials, then scaffold one or more devcontainer profiles via `fr init scaffold`. Use when a repo has no devcontainer profile, when fr-isolation or fr-brainstorming hard-stops asking for one, when the operator says "init this repo", "set up the devcontainer", or wants separate read-only/admin environments.4---56# fr-init78Captures "how you work in this repo" as committed devcontainer profiles plus9host-only secrets placeholders. Interactive BY DESIGN — the interview is10operator-owned context, so this skill is exempt from autonomy contracts:11under a fr-goal run, a missing devcontainer is a blocker; pause, run this12interview, resume isolated.1314**Announce at start:** "I'm using fr-init to set up this repo's profiles."1516## 1. Scan first1718Before asking anything, learn what the repo already says:1920- Languages and toolchains: manifests (pyproject/package.json/go.mod/...),21 lockfiles, `.tool-versions`, CI workflows (what does CI install?).22- Existing `.devcontainer/` (profiles already present? then this is an23 edit, not a green-field init). Check `.devcontainer/fr-profiles.yaml`24 for an existing top-level `backend:`/`host:` key too.25- Which forge: `git remote get-url origin`'s hostname (`github.com` /26 `gitlab.com` self-identify; anything else, including a literal27 `gitea.com`, is self-hosted and needs the operator to confirm the28 backend explicitly — no hostname alone distinguishes GitLab29 Self-Managed / Gitea / GitHub Enterprise).30- Credential surface: `.env*` patterns in .gitignore, CI secret names,31 cloud/k8s configs — candidates for the profile's expected secrets.32- Working patterns: Makefile/justfile/scripts (what do humans run here?).3334The interview confirms and fills gaps; it never asks what the scan answers.3536## 2. Interview (AskUserQuestion, batched ≤4 per round)3738Cover, with scan-informed recommended options:39401. **Backend** — github (default), gitlab, or gitea? Skip asking if the41 scan already resolved it unambiguously (github.com/gitlab.com remote, or42 an explicit `backend:` key already in fr-profiles.yaml). Confirm the43 hostname too (`--host`) if self-hosted — drives which CLI44 (`gh`/`glab`/`tea`) gets installed and which CI template45 `fr acceptance init` picks.462. **Profiles wanted** — one `dev` default, or split (e.g. `readonly` for47 review/exploration vs `admin` with deploy credentials)? Profiles differ48 by CREDENTIALS first, tools second — same binaries, different env-files49 is the normal shape.503. **Tools** — confirm the scan's toolchain list; surface what CI installs51 that local work also needs (kubectl, terraform, docker-in-docker...).524. **Credentials per profile** — which env KEYS each profile expects53 (names only, never values). **Do NOT ask for a host-forge token by54 default:** push, PR/MR creation, and every `fr`-driven `gh`/`glab`/`tea`55 call run on the authenticated HOST (fr-isolation's credential boundary)56 — the container needs none for the standard pipeline. Offer it only57 for an explicit in-container-writes profile (e.g. `admin`).585. **Working patterns** — test/build/run commands worth recording in the59 profile's purpose/notes so future runs know the repo's verbs.6061## 3. Scaffold per profile6263```bash64fr init scaffold --repo . --profile dev --purpose "day-to-day development" \65 --tool uv --tool node --default66fr init scaffold --repo . --profile admin --purpose "deploys, gh writes" \67 --secret GH_TOKEN --secret KUBECONFIG_B6468```6970For a non-GitHub repo, pass `--backend`/`--host` on EVERY profile call for71that repo (repo-level, but scaffold reads it fresh per call):72`fr init scaffold ... --backend gitlab --host gitlab.mycorp.com`.7374Each call writes:7576- `.devcontainer/<profile>/devcontainer.json` — committed by scaffold; base77 image + the backend's CLI (github-cli feature for GitHub; a versioned,78 checksummed `glab`/`tea` binary install for GitLab/Gitea — no official79 devcontainer feature exists for either) + mapped tool features + vk80 installed in postCreate + `--env-file` pointing at the host secrets path.81- `.devcontainer/fr-profiles.yaml` — committed by scaffold; default profile,82 purpose, expected secret keys, notes for tools without a feature mapping,83 and the repo-level `backend`/`host` keys (github is the implicit default84 and not written explicitly).85- `~/.config/fr/secrets/<repo>/<profile>.env` — host-only; commented86 placeholders per secret key. Existing operator values are never87 overwritten; re-runs only append missing placeholders.8889Unknown tools land in the profile's notes — wire them into90`postCreateCommand` by editing the devcontainer.json, and say so.9192## 4. Hand back9394- Tell the operator which placeholders to fill95 (`~/.config/fr/secrets/<repo>/<profile>.env`) before the first96 `fr isolation up` — an empty env-file is normal for a default profile97 (the standard pipeline needs only the host's own CLI auth to be green:98 `gh auth status` for GitHub, `glab auth status` for GitLab, `tea login`99 for Gitea).100- `fr init scaffold` already **committed** the `.devcontainer/` files (scoped101 commit on the current branch — `main` during bootstrap), so the profile is in102 the committed tree that `fr isolation up` checks out. No separate commit step103 — and the agent couldn't do one anyway (base-repo `git commit` is gate-denied).104 Pass `--no-commit` only if you want to stage/commit them yourself (e.g. to open105 a PR in a repo that blocks direct pushes to `main`).106- If a run was paused on this init, resume it: `fr isolation up` now works.107108## Multi-profile principles109110- The DEFAULT profile is the one autonomous runs use; keep it least-111 privileged enough to be safe unattended (admin credentials belong in a112 non-default profile the operator selects explicitly).113- Adding a profile later is one more `fr init scaffold` call — the layout114 is per-profile subfolders from day one, no migration.