feat: Extend patch command to support agent projects - #32
Merged
Conversation
Triggered by `black src tests` during Session A; unrelated to the patch-for-agents work that follows. Assisted-by: Claude Code (Opus 4.7)
The patch flow previously only worked for MCP server projects: it sniffed for a fastmcp dependency to find the project root, hardcoded MCP-shaped file categories, and cloned templates as standalone repos. None of that fits the agent template, which lives in a monorepo subdir and has a chart/-centric layout. This change makes patch type-aware end-to-end: - `.template-info` now records `template.type` (and `template.subdir` for monorepo templates) at scaffold time. Pre-existing projects default to "mcp-server" via get_project_type(). (#13) - New find_fips_project_root() walks up to .template-info, working for any scaffolded project. The MCP-only find_project_root() stays for add/generate. (#14) - Categories split into MCP_FILE_CATEGORIES / AGENT_FILE_CATEGORIES with parallel NEVER_PATCH lists. Agent categories are chart, docs, build, claude — matching the real agent-loop layout. No "framework" category: base-agent code lives in fipsagents (PyPI or vendored) and has its own update path. (#15) - _clone_template_for_patch() resolves the template subdir for monorepo templates so glob/compare runs against templates/agent-loop/, not the monorepo root. (#16) - patch.py adds `chart` and `claude` subcommands; `patch all` enumerates the project's actual categories. Running an MCP-only subcommand (e.g. `patch generators`) inside an agent project exits with a type-aware "available: chart, docs, build, claude" message. Tests: new tests/test_patch.py with 20 cases covering helpers, root-finding, subdir cloning, agent-project drift detection, and the end-to-end patch flow including verifying user-customized files (chart/values.yaml, src/agent.py) are never touched. Closes #12, #13, #14, #15, #16. Assisted-by: Claude Code (Opus 4.7)
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes
fips-agents patchwork for agent (and workflow) projects, not just MCP servers. Closes #12, #13, #14, #15, #16..template-infonow recordstemplate.typeand (for monorepo templates)template.subdirat scaffold time; backwards-compat default ofmcp-serverfor older projects (patch: Store project type in .template-info metadata #13)find_fips_project_root()walks up to.template-info, so the patch flow works for any scaffolded project (patch: Make find_project_root() recognize all project types #14)get_categories_for_type(); agent categories arechart,docs,build,claude— matching the real agent-loop layout (patch: Define agent-specific file categories and exclusions #15)_clone_template_for_patch()resolves the monorepo subdir so glob/compare runs againsttemplates/agent-loop/, not the monorepo root (patch: Support monorepo subdirectory cloning in patch flow #16)patch chartandpatch claudesubcommands added;patch allenumerates the project's actual categories; MCP-only subcommands exit with a type-aware error inside an agent project (patch: Add support for agent projects #12)Per project convention, no "framework" language — base-agent code lives in fipsagents (PyPI or vendored) and has its own update path.
Test plan
tests/test_patch.py(unit + e2e on a fake-scaffolded agent project)fips-agents create agent test-agent --local→cd test-agent→fips-agents patch check