fix: strip ANSI codes from JSON output in skills list (#27530)#27557
fix: strip ANSI codes from JSON output in skills list (#27530)#27557Jimmy-xuzimo wants to merge 5 commits intoopenclaw:mainfrom
Conversation
- Add 'google' to the list of reasoning tag providers in provider-utils.ts - This fixes issue openclaw#26551 where google provider (used by gemini-api-key auth) was not being recognized for reasoning tag filtering - Add corresponding test case for google provider
- Fix issue openclaw#26643 where cache hit rate shows >100% (e.g., 1142%) - Use Math.min(100, ...) to cap the percentage display - This is a display-only fix for edge cases where cacheRead exceeds tokens used
- Fix issue openclaw#27533 where xAI grok thinking output leaks to users - Add 'xai' to the list of reasoning tag providers in provider-utils.ts - Add test case for xai provider
- Fix issue openclaw#27530 where openclaw skills list --json outputs malformed JSON - The emoji field contained raw ANSI terminal escape sequences - Added regex to strip ANSI codes from emoji field when JSON output is requested - Disabled eslint rule for the regex pattern (intentional control char match)
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Greptile SummaryThis PR fixes malformed JSON output from Key Changes:
Issues Found:
Confidence Score: 3/5
Last reviewed commit: a3365a4 |
| `#!/usr/bin/env bash | ||
| if [[ "$3" == "DVTDeveloperAccountManagerAppleIDLists" ]]; then | ||
| echo '(identifier = "[email protected]";)' | ||
| echo '(identifier = "[email protected]";)' |
There was a problem hiding this comment.
Remove trailing whitespace
| echo '(identifier = "[email protected]";)' | |
| echo '(identifier = "[email protected]";)' |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: test/scripts/ios-team-id.test.ts
Line: 87
Comment:
Remove trailing whitespace
```suggestion
echo '(identifier = "[email protected]";)'
```
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.| `#!/usr/bin/env bash | ||
| if [[ "$3" == "DVTDeveloperAccountManagerAppleIDLists" ]]; then | ||
| echo '(identifier = "[email protected]";)' | ||
| echo '(identifier = "[email protected]";)' |
There was a problem hiding this comment.
Remove trailing whitespace
| echo '(identifier = "[email protected]";)' | |
| echo '(identifier = "[email protected]";)' |
Prompt To Fix With AI
This is a comment left during a code review.
Path: test/scripts/ios-team-id.test.ts
Line: 187
Comment:
Remove trailing whitespace
```suggestion
echo '(identifier = "[email protected]";)'
```
How can I resolve this? If you propose a fix, please make it concise.| `#!/usr/bin/env bash | ||
| if [[ "$3" == "DVTDeveloperAccountManagerAppleIDLists" ]]; then | ||
| echo '(identifier = "[email protected]";)' | ||
| echo '(identifier = "[email protected]";)' |
There was a problem hiding this comment.
Remove trailing whitespace
| echo '(identifier = "[email protected]";)' | |
| echo '(identifier = "[email protected]";)' |
Prompt To Fix With AI
This is a comment left during a code review.
Path: test/scripts/ios-team-id.test.ts
Line: 239
Comment:
Remove trailing whitespace
```suggestion
echo '(identifier = "[email protected]";)'
```
How can I resolve this? If you propose a fix, please make it concise.
Additional Comments (1)
Prompt To Fix With AIThis is a comment left during a code review.
Path: src/cli/skills-cli.format.ts
Line: 155-157
Comment:
ANSI codes should also be stripped from emoji field here for consistency with `formatSkillsList`. The same issue that affects `skills list --json` also affects `skills info --json`.
```suggestion
if (opts.json) {
// eslint-disable-next-line no-control-regex
const ANSI_PATTERN = /\x1b\[[0-9;]*m/g;
const jsonSkill = {
...skill,
emoji: skill.emoji ? skill.emoji.replace(ANSI_PATTERN, "") : skill.emoji,
};
return JSON.stringify(jsonSkill, null, 2);
}
```
How can I resolve this? If you propose a fix, please make it concise. |
- Add ANSI escape code stripping to formatSkillInfo for JSON output - Remove trailing whitespace in ios-team-id.test.ts - Fix RuntimeEnv.warn usage to use .log instead
|
This pull request has been automatically marked as stale due to inactivity. |
Following up on this PRThis PR fixes an issue where Summary
The fix is straightforward and low-risk - it only affects JSON output formatting when the Could a maintainer please review this PR? It's been marked as stale but the fix is still relevant and needed. Thank you! |
|
Fixed in #43520 |
Summary
Fixes issue #27530 -
openclaw skills list --jsonoutputs malformed JSON containing raw ANSI terminal escape sequences.Root Cause
The
skills list --jsoncommand was including emoji fields that contained ANSI terminal escape sequences (from chalk styling). These control characters are not valid in JSON strings and caused parsing errors with tools likejq.Example of broken output:
{ "name": "himalaya", "emoji": "📧M-^_M-^S📧" }Fix
Added a regex pattern to strip ANSI escape codes from the emoji field when JSON output is requested.
Changes
src/cli/skills-cli.format.ts: Added ANSI pattern matching to strip escape sequences from emoji field in JSON outputTesting
Before/After
Before:
{ "emoji": "📧M-^_M-^S📧" }After:
{ "emoji": "📧" }Impact
This fix enables proper JSON parsing for
openclaw skills list --jsonoutput, making it compatible withjqand other JSON tools.