diff --git a/.cursor/commands/scaffold.md b/.cursor/commands/scaffold.md index 110ce7f7b..e7a0f63d9 100644 --- a/.cursor/commands/scaffold.md +++ b/.cursor/commands/scaffold.md @@ -26,9 +26,19 @@ Read `ramp-kit/conventions/rules.yaml`. Blocking ids for this contribution: SCHED001, SCHED002, SCHED003, REPRO001, DEVICE001, DEPR001, MUT001, TEST001, TEST002. -Read root `AGENTS.md` (and `.ai/` only as that guide directs). The templates -already satisfy the overlay registry. Library CI (`make style` / `make quality` -/ copies / dummies) is also required before the PR. +Read root `AGENTS.md` and `.ai/` (library guide / review-rules / skills). Do +not overwrite them. Also read the reference source those files name. Optional +keyword search of this checkout's docs: + +```bash +python3 ramp-kit/tools/docs_mcp_server.py --query "set_timesteps" +``` + +That CLI is a fallback, not a deliverable. Default `.cursor/mcp.json` has no +servers. + +The templates already satisfy the overlay registry. Library CI (`make style` / +`make quality` / copies / dummies) is also required before the PR. Stay inside `.cursorignore`. Do not read or copy `ramp-kit/examples/candidate_scheduler/`. diff --git a/.cursor/commands/search-docs.md b/.cursor/commands/search-docs.md index 92b618bbf..f8ed8cc88 100644 --- a/.cursor/commands/search-docs.md +++ b/.cursor/commands/search-docs.md @@ -1,9 +1,9 @@ -# /search-docs — library docs in THIS checkout (optional) +# /search-docs — optional keyword search of THIS checkout's docs Usage: `/search-docs ` -Prefer `ramp-kit/conventions/rules.yaml` + the gate. MCP is stdio -`diffusers-docs` (Cloud dropdown: `diffusers-docs-mcp`). No Hub HTTP. +Prefer `ramp-kit/conventions/rules.yaml`, root `AGENTS.md`, `.ai/`, and the +reference source those files name. Default `.cursor/mcp.json` has no servers. ```bash python3 ramp-kit/tools/docs_mcp_server.py --query $1 @@ -14,5 +14,3 @@ If `$1` is empty: ```bash python3 ramp-kit/tools/docs_mcp_server.py --query "scheduler set_timesteps step SchedulerMixin register_to_config" ``` - -If the MCP tool `search_docs` is in your list, call that instead. diff --git a/.cursor/environment.json b/.cursor/environment.json index 6c58945fa..8b5a0d140 100644 --- a/.cursor/environment.json +++ b/.cursor/environment.json @@ -1,13 +1,6 @@ { "install": "if [ ! -d ramp-kit/.git ]; then git clone --depth 1 https://github.com/alex-16moro/diffuser_agent.git ramp-kit; fi && bash ramp-kit/.cursor/cloud-install.sh", - "start": "bash ramp-kit/.cursor/install-docs-mcp.sh", "repositoryDependencies": [ "github.com/alex-16moro/diffuser_agent" - ], - "mcpServerAllowlist": [ - { - "name": "diffusers-docs", - "command": "diffusers-docs-mcp" - } ] } diff --git a/.cursor/mcp-diffusers-docs.py b/.cursor/mcp-diffusers-docs.py deleted file mode 100755 index 9da6c2916..000000000 --- a/.cursor/mcp-diffusers-docs.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python3 -"""Launch diffusers-docs MCP from any cwd. - -Cloud Agent stdio cannot set `cwd` and does not expand `${workspaceFolder}`. -The dashboard command is often `python3 -u .cursor/mcp-diffusers-docs.py`, -spawned from the workspace root (e.g. `/agent`), not the git repo. This -launcher walks cwd, git root, `/agent/repos/*`, `/workspace`, and its own -path until it finds `tools/docs_mcp_server.py`, then execs it. - -Desktop and Cloud share: `python3 -u .cursor/mcp-diffusers-docs.py`. -Cloud PATH fallback after install: `diffusers-docs-mcp`. -""" -from __future__ import annotations - -import os -import subprocess -import sys -from pathlib import Path - - -def _children(base: Path): - try: - if not base.is_dir(): - return - for child in base.iterdir(): - if child.is_dir(): - yield child - except OSError: - return - - -def _candidates(): - out: list[Path] = [] - here = Path(__file__).resolve().parent - out.append(here.parent) # repo root when this file lives in .cursor/ - out.append(here.parent / "ramp-kit") - cwd = Path.cwd().resolve() - out.extend([cwd, cwd / "ramp-kit", *cwd.parents]) - for key in ("CURSOR_PROJECT_DIR", "CURSOR_WORKSPACE", "WORKSPACE"): - val = os.environ.get(key) - if val: - out.append(Path(val)) - out.append(Path(val) / "ramp-kit") - for base in ( - Path("/agent"), - Path("/agent/repos"), - Path("/workspace"), - Path("/workspace/repos"), - here.parent / "repos", - cwd / "repos", - ): - out.append(base) - for child in _children(base): - out.append(child) - out.append(child / "ramp-kit") - try: - top = subprocess.check_output( - ["git", "rev-parse", "--show-toplevel"], - stderr=subprocess.DEVNULL, - text=True, - ).strip() - if top: - out.append(Path(top)) - out.append(Path(top) / "ramp-kit") - except (OSError, subprocess.CalledProcessError): - pass - seen: set[Path] = set() - for raw in out: - try: - path = raw.resolve() - except OSError: - continue - if path in seen: - continue - seen.add(path) - yield path - - -def main(argv: list[str] | None = None) -> int: - extra = [a for a in (argv if argv is not None else sys.argv[1:]) if a != "--serve"] - for root in _candidates(): - script = root / "tools" / "docs_mcp_server.py" - if script.is_file(): - os.chdir(root) - sys.argv = [str(script), "--serve", *extra] - os.execv(sys.executable, [sys.executable, "-u", str(script), "--serve", *extra]) - sys.stderr.write( - "diffusers-docs MCP: could not find tools/docs_mcp_server.py " - f"(cwd={Path.cwd()} file={Path(__file__).resolve()}). " - "Install the PATH shim: bash .cursor/install-docs-mcp.sh " - "then spawn `diffusers-docs-mcp`.\n" - ) - return 1 - - -if __name__ == "__main__": - raise SystemExit(main()) diff --git a/.cursor/mcp-diffusers-docs.sh b/.cursor/mcp-diffusers-docs.sh deleted file mode 100755 index 852a35067..000000000 --- a/.cursor/mcp-diffusers-docs.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Thin wrapper around the Python launcher (Cloud dashboard can use either). -set -euo pipefail -DIR="$(cd "$(dirname "$0")" && pwd)" -exec python3 -u "$DIR/mcp-diffusers-docs.py" --serve "$@" diff --git a/.cursor/mcp.json b/.cursor/mcp.json index cbf2bc837..8c3bf0d26 100644 --- a/.cursor/mcp.json +++ b/.cursor/mcp.json @@ -1,12 +1 @@ -{ - "mcpServers": { - "diffusers-docs": { - "type": "stdio", - "command": "python3", - "args": ["-u", ".cursor/mcp-diffusers-docs.py"], - "env": { - "PYTHONUNBUFFERED": "1" - } - } - } -} +{"mcpServers":{}} diff --git a/.cursor/mcp.optional.json b/.cursor/mcp.optional.json deleted file mode 100644 index 9080a649d..000000000 --- a/.cursor/mcp.optional.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "mcpServers": { - "diffusers-docs": { - "type": "stdio", - "command": "python3", - "args": ["-u", ".cursor/mcp-diffusers-docs.py"], - "env": { - "PYTHONUNBUFFERED": "1" - } - }, - "huggingface": { - "url": "https://huggingface.co/mcp" - } - } -} diff --git a/.cursor/rules/00-conventions.mdc b/.cursor/rules/00-conventions.mdc index 83d8b8f7b..de6ad125e 100644 --- a/.cursor/rules/00-conventions.mdc +++ b/.cursor/rules/00-conventions.mdc @@ -14,8 +14,9 @@ code that violates a **block** rule will fail the build. The first contribution is what `conventions/rules.yaml` checks. Copy the templates (`/scaffold`) and stop at 0 blocking findings from `tools/convention_check.py` on the new files. Do not add files the -registry does not scan. Docs search (`search_docs` / `/search-docs`) is -optional and is not a deliverable. +registry does not scan. Ground in this registry and, on the library, +`.ai/` plus reference source. Optional: +`python3 tools/docs_mcp_server.py --query "..."` — not a deliverable. Do not pull in code or context from outside this repo's approved boundaries (see `.cursorignore`). diff --git a/.cursor/skills/search-docs/SKILL.md b/.cursor/skills/search-docs/SKILL.md index ebcd8c2e3..a776a8ecb 100644 --- a/.cursor/skills/search-docs/SKILL.md +++ b/.cursor/skills/search-docs/SKILL.md @@ -1,6 +1,6 @@ --- name: search-docs -description: Optional docs CLI for this diffusers checkout. Prefer the gate; MCP is stdio search_docs. +description: Optional docs CLI for this diffusers checkout. Prefer AGENTS.md, .ai/, and the gate. Default mcp.json has no servers. --- # Search this library's docs @@ -10,6 +10,5 @@ python3 ramp-kit/tools/docs_mcp_server.py --query "" ``` Cite provenance (`diffusers checkout` vs bundled snapshot). -`ramp-kit/conventions/rules.yaml` is the gate. -`.cursor/mcp.json` is stdio `diffusers-docs` only (no Hub HTTP). -Cloud dropdown: `diffusers-docs-mcp`. +`ramp-kit/conventions/rules.yaml` is the gate. Root `AGENTS.md` and `.ai/` +are the library guide. Default `.cursor/mcp.json` has no servers. diff --git a/OVERLAY.md b/OVERLAY.md index e1bfa6f29..e9c00cdbf 100644 --- a/OVERLAY.md +++ b/OVERLAY.md @@ -31,13 +31,12 @@ The first contribution: Do not copy `ramp-kit/examples/candidate_scheduler/`. -`.cursor/mcp.json` ships **stdio `diffusers-docs` only** (`python3 -u -.cursor/mcp-diffusers-docs.py`). Do not enable Hub HTTP MCP (OAuth). Cloud -dropdown: `diffusers-docs-mcp` (PATH shim from `install-docs-mcp.sh`) or the -same python3 command. The launcher finds `ramp-kit/tools/docs_mcp_server.py` -from `/agent` as well as the repo root. +Default `.cursor/mcp.json` is `{"mcpServers":{}}`. Ground in root `AGENTS.md`, +`.ai/`, and the reference source those files name. Optional keyword search: -Hub HTTP and extra servers stay in `.cursor/mcp.optional.json`. +```bash +python3 ramp-kit/tools/docs_mcp_server.py --query "set_timesteps" +``` ## Demo (Cloud Agent)