diff --git a/README.md b/README.md index 1b7357e..e060dd7 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,20 @@ diagnose) and returns a single verdict. No other verbs, no MCP server, and ### 1. The `predictable` CLI -Install it with the command the hosted Control Center shows under -**Settings › Connected machines**: +Follow **https://predictablecode.com/install.md**, or install this plugin first and +ask Claude to "install Predictable Code": its `install` skill walks through the same +steps. The installer is one command: ```sh -curl -fsSLO https:///i//predictable-install.sh && bash predictable-install.sh +curl -fsSL https://predictablecode.com/install.sh -o predictable-install.sh && bash predictable-install.sh ``` +It asks you to approve a GitHub sign-in in your browser (it prints the address and a +code), because Predictable Code is in private beta: an account in the beta is +installed and signed in by that one approval; one that is not is given the Request +access link and nothing is installed. A signed-in Control Center also shows a personal +command under **Settings › Connected machines** that skips the sign-in. + It installs Predictable Code and puts `predictable` on your `PATH` (open a new shell, and start Claude Code from it, so the session sees it). With no runtime bundle of its own, the plugin runs that `predictable` — `bin/predictable` falls diff --git a/bin/predictable b/bin/predictable index f7318a6..c67d17b 100755 --- a/bin/predictable +++ b/bin/predictable @@ -40,5 +40,5 @@ fi # One line: the hooks quote the last line of a failed sync's stderr, so the whole # reason has to fit in it. -printf 'predictable: no runtime bundle in %s and no predictable on PATH; install it with the command under Settings > Connected machines in the Control Center, or set PREDICTABLE_DIST_TOKEN and start a session to fetch the runtime bundle.\n' "$runtime" >&2 +printf 'predictable: no runtime bundle in %s and no predictable on PATH; install it by following https://predictablecode.com/install.md (or ask Claude to "install Predictable Code"), then start Claude Code from a new shell.\n' "$runtime" >&2 exit 127 diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 288f3c6..bf4c1db 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -73,7 +73,7 @@ if [ -z "$token" ]; then pc_log SessionStart bootstrap dev-path exit 0 fi - fail_advisory "Predictable Code: \`predictable\` is not installed — install it with the command under Settings › Connected machines in the Control Center (or set PREDICTABLE_DIST_TOKEN to fetch the runtime bundle)." + fail_advisory "Predictable Code: \`predictable\` is not installed. Ask me to \"install Predictable Code\" and I will guide you (it needs your approval of a GitHub sign-in, and a beta invitation), or follow https://predictablecode.com/install.md." fi for tool in curl tar; do diff --git a/scripts/doctor.sh b/scripts/doctor.sh index fde1e25..2d0edc5 100755 --- a/scripts/doctor.sh +++ b/scripts/doctor.sh @@ -62,7 +62,7 @@ fi if "$wrapper" --version >/dev/null 2>&1; then ok "predictable is invokable through the wrapper" else - warn "predictable not invokable yet (no runtime bundle and no predictable on PATH — install it with the command under Settings › Connected machines in the Control Center)" + warn "predictable not invokable yet (no runtime bundle and no predictable on PATH — install it by following https://predictablecode.com/install.md, or ask Claude to \"install Predictable Code\")" fi printf '\n' diff --git a/skills/install/SKILL.md b/skills/install/SKILL.md new file mode 100644 index 0000000..30c9b59 --- /dev/null +++ b/skills/install/SKILL.md @@ -0,0 +1,60 @@ +--- +name: install +description: Install or set up Predictable Code (the `predictable` CLI) on this machine, guiding the user through the private-beta approval. Use when the user asks to install, set up, get started with or sign in to Predictable Code, or when a `predictable` command fails because it is not installed ("no predictable on PATH", "command not found"). +--- + +# Predictable Code — install + +The full, current steps are at **https://predictablecode.com/install.md** (a +staging or preview Control Center serves its own at `/install.md`). +Read that page and follow it. If it cannot be fetched, the steps below are the same. + +Rules: + +- Ask the user before each command and say what it does. +- Never ask for, read or store a password, a GitHub token or any secret: the user + approves a GitHub sign-in in their own browser. +- Never pipe a download into a shell; the command below downloads to a file first. +- Predictable Code is in private beta. If the user is not admitted, give them the + Request access link the installer prints and stop. Never look for the software + anywhere else. + +## 1. Check + +`predictable --version` already printing a version means it is installed: skip to 4. +It runs on macOS on Apple Silicon and Linux x86_64 (WSL on Windows); check `uname -sm`. + +## 2. Run the installer + +```sh +curl -fsSL https://predictablecode.com/install.sh -o predictable-install.sh && bash predictable-install.sh +``` + +Run it in the background (or with `PREDICTABLE_INSTALL_SIGN_IN_WAIT=60` in front of +`bash`, so one run waits at most a minute) and read its output. It first prints a +GitHub address and a code: + +``` + Open: https://github.com/login/device + and enter code: ABCD-1234 +``` + +Show the user both exactly as printed and ask them to approve in their browser. + +## 3. Its exit status + +| Status | Meaning | Do | +| --- | --- | --- | +| 0 | Installed, and this machine is signed in. | Continue to 4. | +| 75 | Not approved yet. | Run the SAME command again: it waits on the same code. | +| 77 | The user's GitHub account is not in the beta. | Show the Request access link it printed (sign in with GitHub, then a short form; they are told by email once admitted), then stop. | +| 1 | Anything else; the output says why. | Read it to the user. An expired or cancelled code: run it again for a new one. | + +## 4. Use it here + +Claude Code must see the new `predictable`: the installer put `~/.local/bin` on the +PATH in the shell profile, so the user restarts Claude Code from a new shell. Then +`predictable whoami` names their GitHub account, and the `sync` skill +(`/predictable-code:sync`) checks this repository. To analyse on GitHub too, the user +opens their Control Center, installs the Predictable Code GitHub App and presses +**Turn on analysis** on the repository. diff --git a/tests/validate-plugin.sh b/tests/validate-plugin.sh index a2262a0..ec7c8e4 100755 --- a/tests/validate-plugin.sh +++ b/tests/validate-plugin.sh @@ -59,8 +59,16 @@ if [ "$noncmd" = "0" ]; then ok "all hooks are type=command"; else bad "non-comm echo "== single skill ==" skills=$(find "$ROOT/skills" -name SKILL.md 2>/dev/null | wc -l | tr -d ' ') -if [ "$skills" = "1" ]; then ok "exactly one skill (sync)"; else bad "expected 1 skill, found $skills"; fi -if [ -f "$ROOT/skills/sync/SKILL.md" ]; then ok "skill is skills/sync"; else bad "skills/sync/SKILL.md missing"; fi +if [ "$skills" = "2" ]; then ok "exactly two skills (sync, install)"; else bad "expected 2 skills, found $skills"; fi +if [ -f "$ROOT/skills/sync/SKILL.md" ]; then ok "skill: skills/sync"; else bad "skills/sync/SKILL.md missing"; fi +if [ -f "$ROOT/skills/install/SKILL.md" ]; then ok "skill: skills/install"; else bad "skills/install/SKILL.md missing"; fi +# The install skill follows the public guide and never a way around the beta (#3256). +if grep -q 'predictablecode.com/install.md' "$ROOT/skills/install/SKILL.md" 2>/dev/null \ + && ! grep -qE 'curl [^|]*\| *(ba)?sh' "$ROOT/skills/install/SKILL.md"; then + ok "install skill follows install.md and pipes nothing into a shell" +else + bad "install skill must follow install.md and never pipe a download into a shell" +fi echo "== slash commands ==" if [ -f "$ROOT/commands/report.md" ]; then ok "command: /predictable-code:report"; else bad "commands/report.md missing"; fi