Skip to content

feat: simplify example server to use exact matching#16

Merged
SkPhilipp merged 2 commits intomainfrom
feat/simplify-example-server-exact-matching
Jan 19, 2026
Merged

feat: simplify example server to use exact matching#16
SkPhilipp merged 2 commits intomainfrom
feat/simplify-example-server-exact-matching

Conversation

@SkPhilipp
Copy link
Member

@SkPhilipp SkPhilipp commented Jan 18, 2026

Change example server from regex and startswith patterns to exact string matching for clarity. Remove unused middleware feature entirely.

Changes:

  • Using exact matching instead of regex for clarity, as regex doesn't reflect our approach to production-grade policies.
  • Updated README to reflect exact matching approach.
  • Added note about advanced parsing suggestions with a link back.
  • The unused 'middleware' feature has been removed entirely, which previously was used to showcase what are now antipatterns.

Closes #14

Change example server from regex/startswith patterns to exact string
matching for clarity and simplicity. This better demonstrates the
minimal complexity of the framework.

Changes:
- Use command == "terraform apply" instead of regex or startswith
- Simplified terraform_rule to only handle apply and plan
- Replaced complex uv_bundle_rule with simple pip_rule
- Removed python_test_file_post_guidance_rule for simplicity
- Updated README to reflect exact matching approach
- Added note about advanced parsing options and link to DevLeaps

Closes #14

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Remove the middleware system from the agent-policies framework to simplify
the architecture. Middleware added unnecessary complexity for the example
server and most use cases.

Changes:
- Removed bash_split_middleware from example server
- Removed MiddlewareFunction type from registry
- Removed register_middleware and get_middleware from HookRegistry
- Removed register_all_middleware helper
- Simplified executor to process handlers directly without middleware pipeline
- Updated README to remove middleware mentions
- Updated tests to reflect simplified behavior (no command chaining)
- Removed outdated tests for terraform fmt and command splitting

The framework now focuses on simple policy handlers without intermediate
transformation layers. Users needing command parsing can implement it
within their policy handlers.

Related to #14

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR simplifies the example server from regex-based and command-chaining patterns to exact string matching, while removing the unused middleware feature entirely. The changes make the example code clearer and more appropriate for demonstration purposes.

Changes:

  • Replaced regex-based command matching with exact string comparisons (command == "terraform apply")
  • Removed the bash command splitting middleware and all middleware infrastructure
  • Simplified example policies to only handle exact command matches (terraform apply/plan, pip install)

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/devleaps/policies/example/main.py Simplified policies to use exact matching; removed middleware, guidance, and bundle rules
src/devleaps/policies/server/registry.py Removed all middleware-related functionality and methods
src/devleaps/policies/server/executor.py Simplified execution pipeline by removing middleware processing
tests/test_cursor_policies.py Removed tests for command chaining, regex patterns, and middleware functionality
tests/test_claude_code_policies.py Removed tests for command chaining and argument parsing
README.md Updated documentation to reflect exact matching approach and added note about production parsing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@SkPhilipp SkPhilipp merged commit f413e33 into main Jan 19, 2026
7 checks passed
@SkPhilipp SkPhilipp deleted the feat/simplify-example-server-exact-matching branch January 19, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change example server to use exact matching

3 participants