Skip to content

patch: Define agent-specific file categories and exclusions #15

@rdwj

Description

@rdwj

Problem

FILE_CATEGORIES and NEVER_PATCH in tools/patching.py are hardcoded for MCP server directory layout. Agent projects have a completely different structure — no src/core/, no .fips-agents-cli/generators/, but they do have chart/, src/base_agent/, and deployment scripts.

Proposed change

Make FILE_CATEGORIES and NEVER_PATCH type-aware. When patching, select the right set based on template.type from .template-info.

Agent file categories

AGENT_FILE_CATEGORIES = {
    "framework": {
        "description": "Agent framework code (base_agent package)",
        "patterns": [
            "src/base_agent/**/*.py",
        ],
        "ask_before_patch": True,
    },
    "chart": {
        "description": "Helm chart templates and values",
        "patterns": [
            "chart/templates/**/*",
            "chart/Chart.yaml",
        ],
        "ask_before_patch": True,
    },
    "docs": {
        "description": "Documentation files",
        "patterns": [
            "CLAUDE.md",
            "AGENTS.md",
            "docs/**/*",
        ],
        "ask_before_patch": False,
    },
    "build": {
        "description": "Build and deployment files",
        "patterns": [
            "Makefile",
            "Containerfile",
            "deploy.sh",
            "redeploy.sh",
        ],
        "ask_before_patch": True,
    },
}

Agent never-patch list

AGENT_NEVER_PATCH = [
    "src/agent.py",         # User's agent implementation
    "agent.yaml",           # User's agent config
    "chart/values.yaml",    # User's deploy values
    "tests/**/*.py",
    ".env*",
    "README.md",
    "pyproject.toml",
]

Implementation

A function like get_categories_for_type(project_type: str) that returns the right (FILE_CATEGORIES, NEVER_PATCH) tuple. The existing MCP constants become MCP_FILE_CATEGORIES / MCP_NEVER_PATCH, and check_for_updates() / patch_category() call the function instead of referencing module-level constants.

The patch CLI subcommands (generators, core, etc.) are MCP-specific category names. Agent projects would expose different subcommands (framework, chart, etc.). The patch check and patch all commands should work for any project type. Type-specific subcommands can either be added directly or patch <category> can become a dynamic argument validated against the project's available categories.

Part of

Tracking issue: #12
Depends on: #13 (needs template.type to select the right category set)

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