sswp_check_repo
Verify a repository is ready for attestation by checking directory existence, .git, package.json, and package-lock.json. Returns a status per condition and an overall READY or NOT READY verdict.
Instructions
Perform a lightweight repo health check without running the full witness pipeline. Verifies four conditions: the directory exists on disk, a .git directory is present (indicating a git repository), a package-lock.json exists (indicating locked dependencies), and a package.json exists (indicating a valid Node.js project). Returns a status line for each condition and an overall READY/NOT READY verdict. Use this as a fast pre-check in CI pipelines or before calling sswp_witness to ensure the repo is in a valid state. Does not seal an attestation or modify the registry.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repoPath | Yes | Absolute path to the project root directory to check. Must be a valid filesystem path. |
Implementation Reference
- src/mcp/server.ts:105-119 (registration)Tool registration for 'sswp_check_repo' - defines name, description, annotations, and inputSchema (requires repoPath string). Listed in the ListToolsRequestSchema handler as one of the available SSWP MCP tools.
{ name: "sswp_check_repo", description: "Perform a lightweight repo health check without running the full witness pipeline. Verifies four conditions: the directory exists on disk, a .git directory is present (indicating a git repository), a package-lock.json exists (indicating locked dependencies), and a package.json exists (indicating a valid Node.js project). Returns a status line for each condition and an overall READY/NOT READY verdict. Use this as a fast pre-check in CI pipelines or before calling sswp_witness to ensure the repo is in a valid state. Does not seal an attestation or modify the registry.", annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }, inputSchema: { type: "object", properties: { repoPath: { type: "string", description: "Absolute path to the project root directory to check. Must be a valid filesystem path." } }, required: ["repoPath"] } - src/mcp/server.ts:276-293 (handler)Handler function for 'sswp_check_repo'. Extracts repoPath from args, converts to WSL path via toWslPath(), performs four checks (exists, .git, package-lock.json, package.json), and returns a READY/NOT READY verdict based on whether the directory exists and has either package-lock.json or package.json.
if (name === "sswp_check_repo") { const rawPath = (args as any).repoPath as string; const wsl = toWslPath(rawPath); const checks = { exists: existsSync(wsl), isGit: existsSync(resolve(wsl, ".git")), hasLockfile: existsSync(resolve(wsl, "package-lock.json")), hasPackageJson: existsSync(resolve(wsl, "package.json")), }; const ok = checks.exists && (checks.hasLockfile || checks.hasPackageJson); const text = "Repo: " + wsl + "\n" + " exists: " + checks.exists + "\n" + " git: " + checks.isGit + "\n" + " package-lock.json: " + checks.hasLockfile + "\n" + " package.json: " + checks.hasPackageJson + "\n" + " status: " + (ok ? "READY" : "NOT READY"); return mkText(text, !ok); } - src/mcp/path-util.ts:4-21 (helper)toWslPath helper function used by the sswp_check_repo handler to convert Windows paths to WSL /mnt/{drive}/ format before performing filesystem checks.
export function toWslPath(winPath: string): string { // Already unix-style (no backslashes, no drive colon) const hasBackslash = winPath.includes(String.fromCharCode(92)); const hasDrive = winPath.length >= 2 && winPath[1] === ':'; if (!hasBackslash && !hasDrive) return winPath; // Replace backslashes with forward slashes let s = winPath; const bs = String.fromCharCode(92); while (s.includes(bs)) { s = s.replace(bs, "/"); } // Convert C:/ to /mnt/c/ if (s.length >= 2 && s[1] === ':' && /^[A-Za-z]/.test(s[0])) { const drive = s[0].toLowerCase(); s = '/mnt/' + drive + '/' + s.slice(2).replace(/^\/+/, ''); } return s; }