wrap_change
Generate language-specific code snippets to wrap changes with feature flags. Ensure flags are runtime controllable by placing checks inside execution paths.
Instructions
Generate code snippets and guidance for wrapping changes with feature flags.
⚠️ CRITICAL: This tool enforces RUNTIME-CONTROLLABLE feature flags. You MUST place flag checks INSIDE execution paths (handlers, functions), NOT wrapping route registrations, middleware mounting, or controller registration.
This tool provides language-specific templates and instructions for protecting code changes with feature flags. It helps you:
Find existing feature flag patterns in your codebase
Match detected conventions (imports, method names, wrapping styles)
Generate appropriate code snippets for your language/framework
Follow Unleash SDK best practices
Ensure flags are runtime controllable (toggle without redeploy)
Supported languages:
TypeScript/JavaScript (Node, React, Vue, Angular)
Python (FastAPI, Django, Flask)
Go
Ruby (Rails)
PHP
C# (.NET)
Java (Spring Boot)
Rust
The tool uses a prompt-based approach: it provides detailed instructions for searching your codebase for existing patterns and matching their conventions. If no patterns are found, it provides sensible defaults based on Unleash SDK documentation.
Usage:
Call this tool with the flag name after creating a flag
Follow the search instructions to find existing patterns
Use the recommended template or match detected patterns
Test your implementation
Best suited for use after evaluate_change recommends a flag and create_flag creates it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fileName | No | File name being modified (helps detect language, e.g., "checkout.ts") | |
| flagName | Yes | Feature flag name to wrap the code with (e.g., "new-checkout-flow") | |
| language | No | Programming language (optional, auto-detected from fileName). Supported: typescript, javascript, python, go, ruby, php, csharp, java, rust | |
| codeContext | No | Optional: surrounding code to help detect existing patterns | |
| frameworkHint | No | Optional: framework hint for specialized templates (React, Express, Django, Rails, etc.) |