Skip to content

patch: Make find_project_root() recognize all project types #14

@rdwj

Description

@rdwj

Problem

find_project_root() in tools/validation.py only recognizes MCP server projects by checking for a fastmcp dependency in pyproject.toml. Agent projects (which depend on fipsagents), Go-based projects (gateway/ui), and sandbox projects all return None, causing every patch subcommand to fail with "Not in a project directory."

Proposed change

Instead of detecting the project type from pyproject.toml dependencies, look for the .template-info file. Any project scaffolded by fips-agents create writes this file, so it's a universal marker.

Options (pick one):

Option A — New function for patch context: Add find_fips_project_root() that walks up the directory tree looking for .template-info. Leave the existing find_project_root() for MCP-specific commands (add, generate) that genuinely need to confirm the project is an MCP server.

Option B — Generalize find_project_root(): Add an optional project_type parameter. Default behavior checks for .template-info. Pass project_type="mcp-server" from add/generate commands to keep the fastmcp check.

Option A is simpler and avoids breaking existing callers.

Part of

Tracking issue: #12
Depends on: #13 (.template-info needs template.type for the patch system to select the right behavior, but the root-finding itself just needs the file to exist)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions