/luna-setup:luna-setupfrom luna-setup
Set Luna up on the current repository, or fix the setup it has. Drafts the repo's luna.yaml (checks, services, toolchains, how the browser check starts the app, the sandbox's egress hosts) with the person, checks it against the machine, proves every check in the machine's sandbox, and opens it as a PR. Use when the person asks to set up, onboard, configure or connect Luna (or "the machine", "hardness") on a repo, to write or fix a luna.yaml, or when Luna's runs on a repo fail for setup reasons (a check that cannot run, a host the sandbox refused, an e2e app that never starts).
Ships in luna-setup. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Luna runs a repository from one file at its root, luna.yaml: how to check it, what runs beside it, how to start its app for the
browser check, which hosts its sandbox may reach, and how the pipeline should behave. You write that file with the person, the machine
checks and proves it, and it lands as a PR. references/luna-yaml.md (next to this file) lists the keys; read it before you draft.
Work in this order and keep the person posted in one line per step. Never put a secret value in the file: it is committed. A credential
is a reference (env:NAME), a service's env holds throwaway local values.
The machine's API is ${LUNA_MACHINE_URL:-http://127.0.0.1:4318}, its token in ~/.config/hardness/machine-api-token:
LUNA="${LUNA_MACHINE_URL:-http://127.0.0.1:4318}"
AUTH="Authorization: Bearer $(tr -d '[:space:]' < ~/.config/hardness/machine-api-token)"
case "$(curl -s -o /dev/null -w '%{http_code}' -H "$AUTH" "$LUNA/health")" in 200|503) echo up ;; *) echo down ;; esac # 503 is up with problems: /health lists them
pnpm start in the Luna checkout.LUNA_REPOS_DIR (~/Developer by default). If this repo is elsewhere, say so before step 5.If a luna.yaml exists, check it first (step 4) and treat this run as fixing it: keep what works, ask before removing anything.
Read, do not build or install:
find . -name package.json -o -name Cargo.lock -o -name go.mod -o -name pyproject.toml -o -name Gemfile.lock | grep -v node_modules), workspace files..github/workflows/*): the commands CI runs are the best list of checks, and its services: blocks the best list of services.compose.yaml/docker-compose.yml, .env.example, test setup files: databases, caches, brokers, and the env the code reads.docs/."test": "vitest" is a watcher; the check is vitest run.Draft from what you read:
paths when a check only matters for part of the tree.ready and the exports the code reads.engines, .nvmrc, rust-toolchain, go.mod, .python-version, CI matrices.dev or start script, bound to 0.0.0.0 with the framework's
flag (--hostname, --host, -H), its port and a ready path. The browser runs in another container, so localhost binding never works.
No pages (a library, a CLI, an API with no UI): leave it out and set policy.qa: none.registry.npmjs.org), fonts or assets fetched at build time (fonts.googleapis.com, fonts.gstatic.com), an API the tests call.Use the AskUserQuestion tool, at most two rounds of up to four questions, each option with what it does; put your suggestion first. Ask only what the tree cannot answer:
policy.monthly_budget_usd, policy.max_concurrent.policy.auto_approve_plan_minutes (off, or minutes), ship.auto_merge (off, low,
medium_when_review_required, medium), plan.approvers.policy.qa: none; a deployed target (qa_targets) only if
the person names one.Leave every other section at its default unless the person asks for it.
Write luna.yaml at the repository root: the sections in the reference's order, a comment on every entry that is not obvious (why a
host is allowed, why a check is scoped). Then check it:
jq -Rs '{text: .}' luna.yaml | curl -sf -X POST -H "$AUTH" -H 'content-type: application/json' --data @- "$LUNA/repos/config/check"
The answer is {ok, problems[], warnings[], unknownKeys[]}. Fix every problem. An unknown key is ignored by the machine, so it is almost
always a typo: fix it or remove it. Read the warnings to the person. Check again until ok is true and unknownKeys is empty.
The proof runs in a throwaway clone of the repository, made as a card's workspace is (never in this checkout): every check once in the
machine's sandbox, with the file's services beside it and its egress list, exactly as a card's checks run; then, when the file has
verify.e2e.start, the app is started the way the browser check starts it and must answer its ready path. It reads the file from disk,
so write it first. It is a job:
JOB=$(curl -sf -X POST -H "$AUTH" -H 'content-type: application/json' -d "{\"repoPath\":\"$(pwd -P)\"}" "$LUNA/repos/config/prove" | jq -r .id)
until [ "$(curl -sf -H "$AUTH" "$LUNA/repos/config/prove/$JOB" | jq -r .state)" != running ]; do sleep 15; done
curl -sf -H "$AUTH" "$LUNA/repos/config/prove/$JOB" | jq '{state, error, check, proof: (.proof | {proof: [.proof[] | {name, ok, tail}], app, refused}), suggestedAllow}'
A proof installs the dependencies in the clone and runs every check, so it can take a while (up to 30 minutes, plus the app's
ready_timeout_s); poll in the background and tell the person it is running. Then, for each result:
tail. A wrong command or folder is yours to fix. A missing service or env is yours to add. A host in
refused explains most "fetch failed" and "could not resolve" errors.suggestedAllow names the hosts a check was refused, as entries for sandbox.egress.allow. Do not add them silently: show each with
the check that wanted it, and add the ones the person agrees a check needs. A host nobody expected is worth a question, not an entry.checks, with a comment.app is the app start: ok with the seconds it took to answer, or the reason it did not and its logTail. Not answering is
usually a localhost binding (bind 0.0.0.0), the wrong port or ready path, a ready_timeout_s too short for a first build, an env
var the app reads (a service's exports, or a secret in verify.e2e.start.secrets), or a host in refused (fonts, an API).Prove again after every change, until every check passes and the app answers, or the person accepts what still fails.
Ask before pushing. Then:
git switch -c luna/setup
git add luna.yaml
git commit -m "chore: set Luna up on this repository"
git push -u origin luna/setup
gh pr create --fill
Follow the repository's own PR template when it has one (.github/pull_request_template.md and the other places GitHub reads). Otherwise
keep the body short: what the file sets up, which checks passed in the sandbox, which hosts it allows and why, and anything still open.
Credit no AI in the commit or the PR.
End with one line for the person: the PR link, how many checks passed, and what to do next (merge it, then create the first card).
Everything but steps 4 and 5 still works. Write the file, tell the person the check and the proof are still owed, and give them the two calls to run once the machine is up.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub higoralves/luna-tui --plugin luna-setup