Repository navigation
Add kitaru setup to wire skills and the MCP server into detected coding agents - #977
Conversation
…ng agents The one-line installer detected coding agents in bash and ran once, so a client installed after Kitaru got no skills and no MCP server until the installer was re-run. `kitaru setup` owns that now: it installs the skills from the zenml-io/kitaru-skills tarball into ~/.agents/skills (plus ~/.claude/skills and ~/.codex/skills when present) and registers kitaru-mcp with Claude Code and Codex through their CLIs, and with Cursor and Windsurf through their JSON files. A project install launches through `uv run --directory <project>` and uses Claude Code's project scope; a tool install points at the absolute kitaru-mcp path. Every write replaces the previous entry, so re-running updates instead of duplicating. The installer hands off to it when the installed version has the command and keeps the bash path for older releases. Closes #953 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UrD7eCgTu11F6qsYMS5JMP
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
@strickvl this is #953, the |
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UrD7eCgTu11F6qsYMS5JMP
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UrD7eCgTu11F6qsYMS5JMP
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
…tor wording A fresh install in a shell whose PATH lacks ~/.local/bin printed plain `kitaru login --local`, which fails until a new terminal is opened. `uvx kitaru` reuses the environment the installer just made, so print that prefix in that case. Also fix the "Kitaru is needs attention" headline and point doctor's missing-skills hint at `kitaru setup`. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UrD7eCgTu11F6qsYMS5JMP
|
Two small additions from a colleague's fresh install today (ee6f367):
|
Review: reliability / bug risksReviewed the diff and ran the new command for real (project install, 1.
|
# Conflicts: # CHANGELOG.md
- Resolve the MCP launch only when MCP registration is wanted, and turn a missing kitaru-mcp into a failed step instead of aborting before skills. - Track detected clients separately from registered ones: "no client detected" only when none was found; every detected client failing exits 1. - JSON client configs are rewritten through a uniquely named temp file that keeps the original mode, so a 0600 mcp.json stays 0600 and no .tmp is left. - Skills install per destination through a staging dir and atomic rename; a failure leaves the previous skill in place and reports that destination only. Destinations are a Sequence. Oversized archive members are skipped and named; the archive size limit is enforced while streaming. - Server resolution goes through resolve_target (KITARU_API_URL, stored server), then KITARU_LOCAL_URL as the installer always honored. - Claude Code registration reads the entry back after the add and fails with a hint when another scope still shadows it. - --mode validated inside setup() too; --no-skills --no-mcp warns. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UrD7eCgTu11F6qsYMS5JMP
|
Thanks for the review, all six were real. Addressed in the latest commit:
Smaller: |
|
Re-reviewed at 1919919. All six numbered findings are addressed, and I verified each one against the new code rather than just reading it (fault-injected probes plus
Three small things the rewrite introduced, none blocking:
Micro-nit, take it or leave it: in the Also worth updating before merge: the PR description still documents the old contract ("One failing client is a warning, not a failure; the command only fails when every step failed", and I have not run the full |
# Conflicts: # CHANGELOG.md
strickvl
left a comment
There was a problem hiding this comment.
I found four actionable issues in PR #977 at 04b0c1d. All four passed independent validation.
Testing passed: 703 tests, 1 skipped, 13 expected failures. I also exercised real skill downloads, Cursor config preservation, real Codex registration, Claude scope handling, custom uv environments, JSON output, and terminal output using temporary configurations. GitHub checks are green. Testing used isolated temporary client configurations; no source changes were made.
I recommend fixing these before merging:
-
P1: Setup can report read-only while Claude remains destructive. setup.py:538 checks only the executable, not its arguments. With the real Claude CLI, an older local entry kept its old server and destructive mode while setup reported success. Verify the complete effective command and arguments, and reject failed readback.
-
P2: Custom uv environments overwrite global configuration. setup.py:268 recognizes only environments named
.venv. A real project usingUV_PROJECT_ENVIRONMENT=…/envwrote Cursor’s global configuration instead of its project configuration. Honor the configured environment and retain project scope. -
P2: Failed Claude replacement removes the working registration. setup.py:521 removes the existing entry before adding its replacement. If addition fails, the old entry stays deleted. Restore it on failure, as the previous installer did.
-
P2: Failed skill replacement leaves the skill unavailable. setup.py:410 moves the old skill aside but never restores it if the final rename fails. Fault injection confirmed the active skill disappeared into a hidden
.olddirectory. Roll back the rename on failure.
The full installer flow and Windows behavior were not exercised locally. Add regression tests for these four cases alongside the fixes.
# Conflicts: # CHANGELOG.md
macOS ships bash 3.2, where expanding an empty array under `set -u`
is an unbound-variable error. `SETUP_SERVER_ARGS` is empty unless the
user passed --server, so the installer died right before running
`kitaru setup` on every default macOS install. Use the same
`${arr[@]:+${arr[@]}}` idiom the script already uses for EXTRA_PKGS.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QAUAys8r9ZkczYYGnnJ5ae
Summary
Closes #953. The one-line installer (#952) detects coding agents in bash and runs once, so anyone who installs Claude Code, Cursor, or Codex the day after installing Kitaru gets no skills and no MCP server until they re-run the installer.
kitaru setupmoves that wiring into the CLI so it can be re-run any time, and the installer now calls it instead of carrying its own detection.What changed
src/kitaru/cli/setup.py(new): the command. Skills come from thezenml-io/kitaru-skillstarball, read member by member (noextractall, no symlinks, no path escapes) into~/.agents/skills, plus~/.claude/skillsand~/.codex/skillswhen that CLI is on PATH or its home dir exists. MCP registration per client: Claude Code (claude mcp get/remove/add --scope user|project), Codex (codex mcp add, which overwrites), Cursor (.cursor/mcp.json, in the repo for a project install, in~otherwise), Windsurf (~/.codeium/windsurf/mcp_config.json). JSON clients are merged, keeping other servers and replacing onlykitaru. With no client found it prints the snippet to paste.sys.prefixis a.venvunder apyproject.toml, cwd inside it) the entry isuv run --directory <project> kitaru-mcpwith Claude Code project scope, matching what the installer already wrote. Otherwise the absolutekitaru-mcpnext to the interpreter, so a client that does not share the user's PATH still finds it. A missingkitaru-mcpis aninvalid_configurationerror with the install hint.--mode read-only|standard|destructive(defaultstandard),--no-skills,--no-mcp; the global--serverpicks the target URL, defaulting to the CLI's selected server, thenhttp://localhost:8000.src/kitaru/cli/output.py_emit_setup), the usual JSON envelope otherwise, withsteps,skills, andmcp_snippet. One failing client is a warning, not a failure; the command only fails when every step failed.install.sh: after installing the package it probeskitaru schema setup(offline) and, if present, runskitaru setupwith the same--server,--mode,--no-skills,--no-mcpit was given. Releases before this command fall through to the previous bash implementation, unchanged, so--version 0.24.0keeps working. Closing message gains a "New editor? kitaru setup" line.installation.mdsteps 2 and 3 now say the installer runskitaru setupand name Cursor and Windsurf; the by-hand block usesuv run kitaru setupinstead ofnpx skills add;agent-native/setup.mdhint explains re-running after a new editor. README step 1 and CHANGELOG updated.tests/cli/test_setup.py: 12 tests covering skills install and re-run cleanup, tarball path filtering, Claude and Codex command sequences, JSON merge idempotency, project vs user launch resolution, stored-server default, invalid server, download failure.test_schema.pyaddssetupto the top-level command set.What reviewers should focus on
~/.cursorgets a config written. I think that is the right trade (harmless file, and the skills dirs already use the same rule) but it is a judgement call.claude mcp get kitarusucceeding in another scope than the one we register in makes theremovefail; we ignore that and letadddecide. Ifaddfails because the name is taken elsewhere, that surfaces as a warning with the CLI's last output line.resolve_mcp_launchrequires cwd inside the project for project mode. Runningkitaru setupfrom a tool install while standing in a repo stays user mode; the next_actions line tells the user to add Kitaru to the project and re-run.schema setuprather than a version compare, so the handoff is keyed on capability. Tested against 0.25.0 from PyPI (probe exits 2, bash fallback runs) and a locally built 0.26.0.dev0 (handoff runs).Validation
Docker, Ubuntu 24.04, from the built wheel:
uv tool installthenkitaru setup: 6 skills downloaded from GitHub into~/.agents/skills, no client, snippet printed; with~/.cursorpresent and--server http://localhost:9000 --mode read-only:~/.cursor/mcp.jsonwritten;kitaru doctorreports the 6 skills;--mode yolorejected asinvalid_arguments.uv init+uv addthe wheel + fakeclaudeon PATH:uv run kitaru setupranclaude mcp add --scope project kitaru -- /root/.local/bin/uv run --directory /work/agent kitaru-mcp --server ... --mode standard, wrote.cursor/mcp.jsonin the repo, copied skills into~/.claude/skillstoo.install.shend to end withUV_FIND_LINKSpointing at a 0.26.0.dev0 build: handoff step runskitaru setup, same results;--quiet --no-mcpexits 0 with skills installed. Rich table checked on a pty.Not exercised: real
claude/codexbinaries (faked), Windows paths.Follow-ups
install.shcan be deleted after the last supported pre-setupversion drops out of use.kitaru doctorcould list registered MCP clients; today it only reports skills.🤖 Generated with Claude Code
https://claude.ai/code/session_01UrD7eCgTu11F6qsYMS5JMP