magic-building/.claude/commands/update.md

87 lines
4.9 KiB
Markdown

---
description: Edit/update an existing image using Gemini Flash via Nano Banana MCP with professional prompting
argument-hint: <image_path> <edit_description>
allowed-tools: [Read, Write, Glob, Grep, Bash, mcp__nano-banana-mcp__edit_image, mcp__nano-banana-mcp__continue_editing, mcp__nano-banana-mcp__get_last_image_info, mcp__nano-banana-mcp__get_configuration_status]
---
Edit/update an existing image based on the provided image path and edit description.
**Usage**: `/update <image_path> <edit_description>`
**Example**: `/update /heroes/camelot/photos/portrait.jpg add a mystical staff in his hand`
Follow these steps:
1. **Configuration Check**: First verify that Gemini API is properly configured using `mcp__nano-banana-mcp__get_configuration_status`
2. **Image Path Validation**:
- Parse the first argument as the image path
- Verify the image file exists and is accessible
- Extract the remaining arguments as the edit description
- If no image path provided, check if there's a recent image using `mcp__nano-banana-mcp__get_last_image_info`
3. **Context Discovery**: Based on the image location and edit description, gather relevant context:
- If image is in `/heroes/` directory, load character description
- If in `/locations/` or `/cities/`, load location context
- If in `/items/`, load item specifications
- If in `/creatures/`, load creature details
- Search for applicable settings in `/settings/` directory
- Load world information from `/worlds/` directory if applicable
4. **Entity Analysis**: Parse the edit description to identify:
- Changes requested (add, remove, modify elements)
- New elements to be introduced
- Style preferences or requirements
- Lighting or mood adjustments
- Technical specifications needed
5. **Edit Prompt Generation**: Create a professional edit prompt following `@docs/prompting-guide.md` editing templates:
- **Adding/Removing Elements**: "Using the provided image of [subject], please [add/remove/modify] [element] to/from the scene. Ensure the change is [integration description]."
- **Inpainting**: "Using the provided image, change only the [specific element] to [new element]. Keep everything else exactly the same, preserving the original style, lighting, and composition."
- **Style Transfer**: "Transform the provided image into [artistic style]. Preserve the original composition but render it with [stylistic elements]."
- **Detail Preservation**: "Using the provided image, [edit request]. Ensure that [critical details] remain completely unchanged. The modification should [integration requirements]."
6. **Settings Integration**: Apply appropriate settings for consistency:
- Maintain character clothing styles if character is present
- Preserve world-specific aesthetic elements
- Apply environmental settings for background consistency
- Include weapon/item styling if applicable
- Maintain magical effects consistency
7. **Reference Image Handling**: Determine editing approach:
- If editing a specific image file: use `mcp__nano-banana-mcp__edit_image` with the image path
- If continuing work on the last generated image: use `mcp__nano-banana-mcp__continue_editing`
- Include additional reference images if needed for style transfer or element addition
8. **Image Generation**: Execute the edit using the appropriate MCP tool:
- `mcp__nano-banana-mcp__edit_image` for specific file edits
- `mcp__nano-banana-mcp__continue_editing` for iterative improvements
9. **File Management**: Upon successful generation:
- Save updated image in the same directory structure
- Create versioned filename if preserving original
- Archive the successful edit prompt in corresponding `/prompts/` directory
- Update any cross-references if relationships changed
10. **Documentation**: Create a markdown file in `/prepared_prompts/` directory documenting:
- Original image path and edit description
- Final edit prompt used
- Applied settings and context
- Generated image path
- Edit type and template used
- Validation results
**Edit Types Supported**:
- **Element Addition**: Adding objects, characters, effects to existing image
- **Element Removal**: Removing unwanted elements while maintaining scene integrity
- **Modification**: Changing colors, expressions, poses, clothing, etc.
- **Style Transfer**: Converting image to different artistic style
- **Inpainting**: Replacing specific parts while preserving the rest
- **Composition Changes**: Adjusting framing, perspective, lighting
**Important**:
- The edit prompt must be in English regardless of input language
- Follow exact editing templates from `docs/prompting-guide.md`
- Preserve critical details mentioned in project files
- Maintain consistency with established character/location features
- Use appropriate MCP tool based on editing scenario
- Ensure proper file versioning to preserve original if needed