Skip to content

Commit 1d59c7b

Browse files
committed
Merge branch 'develop'
2 parents ce1dd5d + 4da8bc4 commit 1d59c7b

4 files changed

Lines changed: 19 additions & 10 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ select = ["E", "F", "W", "I", "UP", "B", "SIM"]
130130
"src/specsmith/context_orchestrator.py" = ["E501"]
131131
# Skills module: skill body strings contain markdown content with long lines
132132
"src/specsmith/skills/*.py" = ["E501"]
133+
# MCP server module: tool schema description strings are long but cannot be split
134+
"src/specsmith/mcp_server.py" = ["E501"]
133135
# Migration files: rule description strings and template content
134136
"src/specsmith/migrations/m001_governance_yaml.py" = ["E501"]
135137
"src/specsmith/migrations/m004_ledger_esdb.py" = ["E501"]

src/specsmith/cli.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9041,9 +9041,9 @@ def mcp_serve_cmd(project_dir: str) -> None:
90419041
{"specsmith-governance": {"command": "specsmith", "args": ["mcp", "serve"]}}
90429042
90439043
\b
9044-
Or pass inline to oz::
9044+
Or pass inline to oz (use ``specsmith mcp install-warp`` for the full snippet)::
90459045
9046-
oz agent run --mcp '{"specsmith-governance": {"command": "specsmith", "args": ["mcp", "serve"]}}' ...
9046+
oz agent run --mcp "$(specsmith mcp install-warp --json)" --prompt "..."
90479047
"""
90489048
from specsmith.mcp_server import run_server
90499049

@@ -9065,7 +9065,9 @@ def mcp_install_warp_cmd(project_dir: str, as_json: bool) -> None:
90659065

90669066
config = {
90679067
"specsmith-governance": {
9068-
"command": sys.executable if os.environ.get("SPECSMITH_ALLOW_NON_PIPX") else "specsmith",
9068+
"command": (
9069+
sys.executable if os.environ.get("SPECSMITH_ALLOW_NON_PIPX") else "specsmith"
9070+
),
90699071
"args": ["mcp", "serve", "--project-dir", str(Path(project_dir).resolve())],
90709072
}
90719073
}

src/specsmith/mcp_server.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
from __future__ import annotations
3737

38+
import contextlib
3839
import json
3940
import sys
4041
import time
@@ -229,9 +230,10 @@ def _handle_governance_checkpoint(args: dict[str, Any]) -> dict[str, Any]:
229230
# Project name
230231
project_name = root.name
231232
try:
232-
from specsmith.paths import find_scaffold
233233
import yaml as _yaml
234234

235+
from specsmith.paths import find_scaffold
236+
235237
sp = find_scaffold(root)
236238
if sp:
237239
raw = _yaml.safe_load(sp.read_text(encoding="utf-8")) or {}
@@ -243,7 +245,12 @@ def _handle_governance_checkpoint(args: dict[str, Any]) -> dict[str, Any]:
243245
phase_key, phase_label, phase_emoji, phase_pct = "unknown", "Unknown", "", 0
244246
failing_phase_checks: list[str] = []
245247
try:
246-
from specsmith.phase import PHASE_MAP, phase_progress_pct, read_phase, phase_failing_checks
248+
from specsmith.phase import ( # noqa: PLC0415
249+
PHASE_MAP,
250+
phase_failing_checks,
251+
phase_progress_pct,
252+
read_phase,
253+
)
247254

248255
phase_key = read_phase(root)
249256
phase = PHASE_MAP.get(phase_key)
@@ -573,10 +580,8 @@ def run_server(project_dir: str = ".") -> None:
573580

574581
# Set working directory so relative paths in tool calls resolve correctly
575582
if project_dir and project_dir != ".":
576-
try:
583+
with contextlib.suppress(OSError):
577584
os.chdir(project_dir)
578-
except OSError:
579-
pass
580585

581586
for raw_line in sys.stdin:
582587
raw_line = raw_line.strip()

tests/test_mcp_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from pathlib import Path
2020
from typing import Any
2121

22-
import pytest
22+
import pytest # noqa: I001
2323

2424

2525
# ---------------------------------------------------------------------------
@@ -386,7 +386,7 @@ def test_tools_list_via_subprocess(self) -> None:
386386
except subprocess.TimeoutExpired:
387387
pytest.skip("mcp serve subprocess timed out (slow CI env)")
388388

389-
lines = [l for l in proc.stdout.strip().splitlines() if l.strip()]
389+
lines = [ln for ln in proc.stdout.strip().splitlines() if ln.strip()]
390390
assert len(lines) >= 2, f"Expected ≥2 responses, got: {lines}"
391391
# Last response should be tools/list result
392392
tools_resp = json.loads(lines[-1])

0 commit comments

Comments
 (0)