init-bazel-config
Use when Bazel has never been built on this machine, or when a build fails for a reason the workspace cannot explain — no such target '//:ZGV2…', every action…
от ocx-sh★ 20 звёзд на GitHub
Установить init-bazel-config в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
init-bazel-config
.bazelrc and MODULE.bazel are committed, so every checkout arrives with the
workspace half of a working build already correct. The other half lives on the
host — output root, RAM envelope, the remote cache
reader credential — is committed nowhere, and is what a first build gets wrong.
No gate in this repository can see it.
This skill is the prompting. scripts/bazel_doctor.py is the checks, and
task bazel:doctor runs the same script with no questions. Never re-implement a
check here: two answers to "is this host ready" drift inside one release.
Idempotent. Re-run it any time; every write is a replace between markers.
Step 0 — read the host
task bazel:doctor --force
Every check prints PASS, WARN or FAIL with its fix beside it, and the
failing codes are listed at the end. Route on the code, never on the prose.
Exit 0 means no FAIL; a WARN is a standing decision, not a defect.
--check-only was passed → stop here and report. Otherwise work the codes below
in order; each fix changes what the next check sees, so re-run Step 0 after each.
Step 1 — toolchain (toolchain-*)
| Code | Fix |
|---|---|
toolchain-pin |
ocx.toml has no [tools] bazel line. Add it, then ocx lock. |
toolchain-lock |
ocx lock, and commit ocx.lock. |
toolchain-drift |
.bazelversion and the binary disagree — reconcile, then ocx pull. |
toolchain-pin-drift |
The running binary is not the ocx.toml pin. Same fix. |
toolchain-bazelisk |
bazelisk on PATH resolves its own version. Take it off PATH. |
Never bazel bare: every call in this repository is ocx exec bazel -- <cmd>.
Step 2 — the host block (hostrc-*, userrc-host-state)
Host state goes in ~/.bazelrc, never .bazelrc.user. This machine carries
four fixed worktrees plus one per agent task; .bazelrc.user is per-checkout, so
a credential there has to be re-created in every one of them, and the checkout
that misses it fails in a way that reads as a cache outage.
Show the block before writing it, then ask:
python3 scripts/bazel_doctor.py --print-host-block
AskUserQuestion — "Write this block to ~/.bazelrc?" / Write it · Show me the
file first · Skip. On Write it:
python3 scripts/bazel_doctor.py --write-host-block
It replaces only what is between its two marker comments. Anything a human put in that file outside them survives, and a second run is a no-op.
userrc-host-state means .bazelrc.user carries host state: move those lines
into ~/.bazelrc yourself and say which ones you moved.
Step 3 — the cache reader credential (cache-credential-*)
Reads only. Refuse to place a writer credential on a developer machine — the write lane is CI's, and the org secret exists so no laptop needs one. If asked, say no and point at Step 5.
credential-unquoted first, before anything else: the rc tokenizer splits on
whitespace, so --remote_header=authorization=Basic <b64> makes Bazel read the
base64 as a build target (no such target '//:ZGV2…') and every command in the
workspace dies. The doctor names the line. --set-reader-credential below
rewrites it; a hand-fix is wrapping the whole value in double quotes.
cache-credential-absent or cache-credential-401 → ask for the password.
AskUserQuestion, free text: "Password for the dev-read realm on
bazel-cache.ocx.sh (ask the maintainer if you do not have it)". Then, stdin,
never argv — argv is world-readable through ps -eo args:
python3 scripts/bazel_doctor.py --set-reader-credential <<'OCXPW'
<the password>
OCXPW
Then re-run Step 0 for the verdict. Say nothing about the value afterwards — not its length, not a prefix, not "it looks right". The tool prints only that a quoted line was written.
Offer the alternative in the same breath: a password typed into an
AskUserQuestion is in the transcript by construction, so anyone who would
rather not put it there runs that heredoc themselves and you re-run Step 0.
cache-credential-blocked (HTTP 403) is not an auth failure — the edge
refused before the realm saw the request. Do not touch the credential; retry
from another network.
Step 4 — caches (disk-cache-*, output-root-*)
Nothing under /tmp: it is a tmpfs on this host and an hourly reaper walks it,
so a cache there is RAM that vanishes mid-build. --write-host-block fixes the
output root; --disk_cache comes from the committed .bazelrc, so a red there
means you are not running from the repository root.
disk-cache-gc-parked (WARN) is a decision, not a defect: .bazelrc explains
why the GC flags are off on this pin, and the doctor turns it into a FAIL by
itself once the pin crosses 9.3.0. Do not "fix" it.
Step 5 — maintainer path (maintainer-secrets) — opt-in only
Only when the doctor reports org admin on ocx-sh. Never automatic: rotating an
org secret is a decision. AskUserQuestion — "Set the org cache write secret
now?" / Set it ·
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл init-bazel-config?
Use when Bazel has never been built on this machine, or when a build fails for a reason the workspace cannot explain — no such target '//:ZGV2…', every action missing the remote cache, the output root under /tmp. Checks the same host preconditions `task bazel:doctor` does, then asks for the one thing a check cannot supply (the dev-read cache password, the maintainer opt-in) and writes the answer to ~/.bazelrc.
Как установить скилл init-bazel-config?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл init-bazel-config запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
patterns
AnthropicFind patterns worth sharing from recent PRs and repo history, both repeats to fix and good practices worth spreading. Use when a champion wants to know what…
copilot-cli-quickstart
GitHubUse this skill when someone wants to learn GitHub Copilot CLI from scratch. Offers interactive step-by-step tutorials with separate Developer and…
vardoger-analyze
GitHubUse when the user asks to personalize the GitHub Copilot CLI assistant, adapt Copilot to their style, use vardoger, or analyze their Copilot CLI conversation…
policy-lookup
AnthropicFind and explain company policies in plain language. Trigger with "what's our PTO policy", "can I work remotely from another country", "how do expenses work"…