diff --git a/nanobot/skills/update-setup/SKILL.md b/nanobot/skills/update-setup/SKILL.md index 104afcd5f..7e9d5cc60 100644 --- a/nanobot/skills/update-setup/SKILL.md +++ b/nanobot/skills/update-setup/SKILL.md @@ -13,21 +13,45 @@ Use `read_file` to check if `skills/update/SKILL.md` already exists in the works If it exists, use `ask_user` to ask: "An upgrade skill already exists. Reconfigure?" with options ["yes", "no"]. If no, stop here. -## Step 2: Current Version +## Step 2: Current Version and Install Clues Use `exec` to run `nanobot --version`. Tell the user the current version. -## Step 3: Ask Questions +Then collect install clues with `exec`. These commands are best-effort; if one fails, +keep going and show the useful output: -Use `ask_user` for the questions below, one question per call. +``` +command -v nanobot || true +python -m pip show nanobot-ai || true +pipx list | sed -n '/nanobot-ai/,+3p' || true +uv tool list | sed -n '/nanobot-ai/,+3p' || true +``` + +Summarize what you found in one short paragraph. Use the clues only to suggest a +likely install method. Do not treat them as confirmation. + +## Step 3: Confirm Required Inputs + +CRITICAL: Do not write `skills/update/SKILL.md` until the install method is +explicitly confirmed by the user. The install method must come from a user +answer or confirmation, not from inference alone. If you cannot get a clear +answer, stop and ask the user to rerun this setup when they know how nanobot was +installed. + +Use `ask_user` for the questions below, one question per call. If `ask_user` is +not available or cannot collect the answer, ask in normal chat and stop without +writing the skill. **Question 1 — Install method:** ``` -question: "How did you install nanobot?" -options: ["uv", "pipx", "pip", "source (git clone)"] +question: "I found these install clues: . Which update method should this workspace use?" +options: ["uv", "pipx", "pip", "source (git clone)", "not sure"] ``` +If the user selected `not sure`, explain the difference between the options and +stop. Do not generate the upgrade skill. + If the user selected `source (git clone)`, ask for the local checkout path: `question: "Where is your nanobot source checkout? Enter an absolute path or a path relative to this workspace:"`. @@ -63,6 +87,18 @@ Determine the upgrade command from the install method: For source installs, include extras in the editable install command when selected. Quote the source checkout path if it contains spaces. +Determine the preflight check from the install method: + +| Method | Preflight check | +|--------|-----------------| +| uv | `command -v uv` | +| pipx | `command -v pipx` | +| pip | `python -m pip --version` | +| source | `test -d && test -d /.git && test -f /pyproject.toml` | + +For source installs, quote the source checkout path in the preflight check if it +contains spaces. + Build the skill content. If proxy is configured, add `export http_proxy=URL` and `export https_proxy=URL` lines before the upgrade command. Use `write_file` to write `skills/update/SKILL.md` with this content: @@ -76,9 +112,10 @@ description: "Upgrade nanobot to the latest version. Triggers: upgrade nanobot, # Update Nanobot 1. (If proxy configured) Set proxy: `export http_proxy=URL && export https_proxy=URL` -2. Use `exec` to run the upgrade command: -3. Use `exec` to verify: `nanobot --version` -4. Tell the user the new version. Say: "Run `/restart` to restart nanobot and apply the update. If `/restart` is unavailable in this channel, restart the nanobot process manually." +2. Use `exec` to run the preflight check: . If it fails, stop and tell the user to rerun `update-setup` because the saved install method no longer matches this environment. +3. Use `exec` to run the upgrade command: +4. Use `exec` to verify: `nanobot --version` +5. Tell the user the new version. Say: "Run `/restart` to restart nanobot and apply the update. If `/restart` is unavailable in this channel, restart the nanobot process manually." ``` ## Step 5: Confirm