Overview
Perform style adjustments, component modifications, and interaction/layout adjustments on existing React/TSX/JSX source code; supports multiple rounds of iteration, and can automatically chain the most recent text-code generated in the context code_url. Does not handle: generation from scratch (no existing source code), non-React/HTML frameworks, backend code, pixel-perfect reproduction.
API Mapping
| Scenario | Backend API |
|---|---|
| React/TSX source code editing | text_code_edit |
model mapping:
auto(default) / not provided → decide according to routing rulespretzel_pro/pretzel_lite→ specify directly- model fallback chain:
pretzel_pro→pretzel_lite
Dependencies
- meitu-cli:
>=2.0.6 - Credentials:CONFIG AKSK →
meitu tools update; EXEC AKSK → run command (see rootCONFIG.md) - Environment Variables:
MEITU_OPENAPI_TOOL_TASK_MODE=command
Core Workflow
Preflight → Execute → Deliver
Preflight
meitu --version≥ 2.0.6meitu auth verify --json- Confirm registry contains
text-code-edit - Resolve output_dir:
openclaw.yaml→./output/;else →~/.openclaw/workspace/visual/output/text-code-edit/ - Resolve source_code_url:
- Provided by user → use directly
- Not provided by user + context has the most recently generated
code_url→ automatically take from context - Neither available → prompt "Please provide the source code link"
Execute
Trigger signals / routing rules
| Scenario | Determination keywords | Route |
|---|---|---|
| Modify existing source code | change code, adjust styles, add component, delete component, change color, change layout | text_code_edit |
| Context has code_url | modify the code from just now | automatically take from context code_url |
| User says "redo it / start over" | -- | Does not belong to this tool (use text-code) |
| Non-React/HTML source code | .py/.java etc. |
Return "Only React/HTML code modification is supported" |
Parameter definitions
| Parameter | Type | Required | Range | Default value | Description |
|---|---|---|---|---|---|
prompt |
STRING | Yes | -- | -- | Modification description. Missing → follow up |
source_code_url |
STRING | Yes | -- | -- | .tsx/.jsx source code URL. When missing, take the most recent from context code_url, if still none → follow up |
model |
ENUM | No | auto / pretzel_pro / pretzel_lite | pretzel_pro | Model selection |
image_list |
ARRAY | No | -- | [] | List of reference image URLs |
video_list |
ARRAY | No | -- | [] | List of reference video URLs |
prompt_name |
STRING | No | -- | -- | System prompt name |
Tool invocation
Basic editing:
meitu text-code-edit \
--skill_name skill_text-code-edit \
--prompt "{modification_description}" \
--source_code_url "{code_url}" \
--json --download-dir {output_dir}
With reference image + specified model:
meitu text-code-edit \
--skill_name skill_text-code-edit \
--prompt "{modification_description}" \
--source_code_url "{code_url}" \
--model pretzel_pro \
--image_list "{ref_url}" \
--json --download-dir {output_dir}
Error fallback
| Scenario | Handling method |
|---|---|
prompt missing |
Prompt "Please describe what you want to modify" |
source_code_url missing + context has |
automatically take from context code_url |
source_code_url missing + context does not have |
Prompt "Please provide the source code link" |
model invalid value |
Fall back to pretzel_pro |
| Modification intent is vague | Prompt the user to clarify the modification content |
source_code_url non-React/HTML |
Return "Only React/HTML code modifications are supported" |
source_code_url Inaccessible |
Retry once → return error |
| Timeout | Along pretzel_pro → pretzel_lite retry |
| Incomplete code | Original model retries once |
| Content compliance interception | Directly return compliance prompt |
Deliver
Parse --json:
ok: true→downloaded_files[0].saved_pathas modified.tsx- Update context
code_urlto point to the new version, so as to continue multi-round iteration
Write to disk:mv {file} {output_dir}/{YYYY-MM-DD}_{descriptive-name}_v{n}.tsx
Output
- Format:
.tsx/.jsxmodified source code - Naming:
{YYYY-MM-DD}_{descriptive-name}_v{n}.tsx - Location: project →
./output/; one-time →~/.openclaw/workspace/visual/output/text-code-edit/
Baseline Task ID
See root directory references/task-id-baseline.md in text-code-edit entry.