fix(setup-interns): clone common monorepo, not nonexistent interns-mcp repo

The interns-mcp source lives inside the `OpeItcLoc03/common` monorepo
(at ~/projects/.common/), not as a separate `interns-mcp` repo on Gitea.
The previous commit incorrectly wrote `git clone .../interns-mcp`.

Now the clone-fallback correctly:
- If ~/projects/.common/.git exists but lib/interns-mcp/ is missing:
  git -C ~/projects/.common pull --ff-only (stale clone, needs fresh subdirs)
- If ~/projects/.common/ is absent:
  git clone .../common.git ~/projects/.common (fresh clone of monorepo)
- Added "wrong repo" to Common mistakes section
- Added monorepo scope note to Out of scope section

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-07 13:24:31 +03:00
parent 54ba5caf5a
commit 90d066bb7f
2 changed files with 21 additions and 12 deletions

Binary file not shown.

View File

@@ -23,6 +23,7 @@ Reference: full design lives in this repo at `.wiki/concepts/interns-design.md`
- Running `interns-mcp` itself — the Claude Code harness spawns it on session start.
- Authoring new interns or editing `~/projects/.common/config/interns/config.yaml` — that's a content task, not a setup task.
- Any other MCP server.
- Setting up the entire `common` monorepo beyond what `interns-mcp` needs. The clone step gets the full monorepo (it also contains `projects-meta-mcp` and other shared tools), but this skill only verifies the `lib/interns-mcp/` subdirectory.
## Hard rule: don't auto-mutate config
@@ -47,17 +48,18 @@ Search, in order. Report only "found at <path>", never echo key values.
**Server source.** Check whether `~/projects/.common/lib/interns-mcp/pyproject.toml` exists.
- If present → report "found at ~/projects/.common/lib/interns-mcp/". Phase 4 will `pip install -e` (or skip if already importable).
- If absent → report "source not found — will clone from gitea". Phase 4 will `git clone https://git.kzntsv.site/OpeItcLoc03/interns-mcp ~/projects/.common/lib/interns-mcp` then `pip install -e`.
- If absent → check whether `~/projects/.common/.git` exists (the `common` monorepo).
- If the monorepo exists but the subdirectory is missing → report "source subdir absent — will git pull". Phase 4 will `git -C ~/projects/.common pull --ff-only` to fetch the latest content, then verify the subdirectory appeared.
- If the monorepo is absent → report "source not found — will clone common monorepo from gitea". Phase 4 will `git clone https://git.kzntsv.site/OpeItcLoc03/common.git ~/projects/.common`.
If `git clone` fails (no network, no Gitea PAT, repo doesn't exist yet), stop with a clear message:
If clone or pull fails (no network, no Gitea PAT), stop with a clear message:
```
Failed to clone interns-mcp source. Options:
Failed to clone/pull the common monorepo. Options:
1. Check network access to https://git.kzntsv.site
2. If you need a Gitea PAT: https://git.kzntsv.site/user/settings/applications
(scope: read:repository is sufficient)
3. If the repo doesn't exist yet on Gitea, initialize it manually
and re-run setup-interns.
3. If Gitea is unreachable, re-run setup-interns when it's back.
```
**Build artifact.** Run `python -c "import interns_mcp" 2>&1` against the candidate interpreter. If it fails with `ModuleNotFoundError`, Phase 4 will run `pip install -e ~/projects/.common/lib/interns-mcp/`. If it succeeds, capture the installed location and skip the install in Phase 4.
@@ -81,7 +83,7 @@ The first hit wins per key. **Never echo key values in chat.**
Present a single-block plan to the user:
```
Source: <found at ~/projects/.common/lib/interns-mcp/ | will clone from gitea>
Source: <found at ~/projects/.common/lib/interns-mcp/ | will clone/pull common monorepo>
Module: <interns_mcp importable | will pip install -e>
Config: <found at ~/projects/.common/config/interns/config.yaml> — endpoints: <names>
Missing keys: <list of <NAME> not yet present in interns.env | none>
@@ -108,16 +110,22 @@ Confirm both backups exist (when their source existed) before any further edit.
### Phase 4 — Clone (if needed) + Install Python module
**Clone.** If Phase 1 found the source absent:
**Clone or pull.** If Phase 1 found the source absent:
```bash
mkdir -p ~/projects/.common/lib
git clone https://git.kzntsv.site/OpeItcLoc03/interns-mcp ~/projects/.common/lib/interns-mcp
if [ -d ~/projects/.common/.git ]; then
# Monorepo exists but subdirectory missing — pull latest
git -C ~/projects/.common pull --ff-only
else
# Fresh clone of the common monorepo
mkdir -p ~/projects
git clone https://git.kzntsv.site/OpeItcLoc03/common.git ~/projects/.common
fi
```
Verify `~/projects/.common/lib/interns-mcp/pyproject.toml` exists after clone. If not — abort.
Verify `~/projects/.common/lib/interns-mcp/pyproject.toml` exists after clone/pull. If the subdirectory is still missing after pull — the interns-mcp module may not have been pushed to the monorepo yet. Abort with a clear message.
If the source was already present and Phase 1 found `interns_mcp` importable, skip both clone and install.
If the source was already present and Phase 1 found `interns_mcp` importable, skip both clone/pull and install.
**Install.** If Phase 1 found `interns_mcp` not importable:
@@ -249,4 +257,5 @@ Path forms (`~/projects/.common/...`, `~/.config/...`, `~/.claude.json`) are ide
- **Missing the gitignore rule.** Tokens commit to the repo on the next `git add .`. Always check `.gitignore` covers `.common/secrets/*.env` before writing — Phase 5 does it but it's worth double-checking.
- **Treating in-session smoke test as proof.** Same as the context7 / projects-meta caveat — the active MCP connection was bound at session start. Real verification happens after restart.
- **Auto-running on every "use interns".** This skill is intrusive. Trigger only on explicit "install / set up / configure interns", or when MCP tools are missing and the user is blocked.
- **Cloning over an existing source directory.** If `~/projects/.common/lib/interns-mcp/` already exists with `pyproject.toml`, don't clone — use what's there. Clone is only for the "source not found" case.
- **Cloning over an existing source directory.** If `~/projects/.common/lib/interns-mcp/` already exists with `pyproject.toml`, don't clone — use what's there. Clone is only for the "source not found" case.
- **Cloning the wrong repo.** `interns-mcp` lives inside the `common` monorepo at `OpeItcLoc03/common.git`, not as a separate `interns-mcp` repo. Always clone `common.git` and verify the subdirectory.