Repository navigation
fix(cli): preserve whitespace in skills JSON output - #140780
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 12:32 AM ET / 04:32 UTC. ClawSweeper reviewWhat this changesPreserves tabs and line endings in skills JSON output through shared serialization, with regression coverage and CLI documentation. Merge readiness✅ Ready for maintainer review Keep open: current main still removes meaningful whitespace from skills JSON. This focused repair remains useful, and no actionable correctness or security findings were found. Priority: P2 Review scores
Verification
How this fits togetherThe skills CLI formats inventory obtained from the Gateway or local discovery. Its formatter produces human-readable tables or JSON consumed by scripts. flowchart LR
A[Gateway inventory] --> C[Skills CLI formatter]
B[Local skill discovery] --> C
C --> D{Output format}
D --> E[Human-readable tables]
D --> F[Sanitize controls and escape JSON]
F --> G[Script-readable skill data]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -1, Tests +22, Docs +2. Total +23 across 3 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Preserve semantic whitespace through JSON escaping while retaining the existing terminal-control sanitizer and human-output behavior. Do we have a high-confidence way to reproduce the issue? Yes, from source: loaded descriptions or paths containing tabs, LF, or CR lose those characters through main's sanitizer. The added regression exercises that boundary; it was not executed during this review. Is this the best way to solve the issue? Yes. Adjusting the existing sanitizer and sharing serialization fixes the output boundary without changing discovery, configuration, or the JSON schema. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2eae7eb46e92. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Related: #140581
What Problem This Solves
Fixes an issue where users reading
skills list,skills info, orskills checkJSON would lose tabs and line endings in descriptions and paths. For example, a valid loaded description containingFirst paragraph.\nSecond\tcolumn.becameFirst paragraph.Secondcolumn..Why This Change Was Made
Preserve tabs, LF, and CR for JSON's normal escaping while retaining the existing ANSI/C1 cleanup. Build on the native JSON replacer already merged in #140581 by sharing serialization across list, info, check, and missing-skill errors. Main's lazy formatting of human-only error text remains intact. The earlier recursion removal belongs to #140581; this change has a net production delta of -1 line.
User Impact
Scripts can read descriptions and paths without silently losing meaningful whitespace. Human-readable table spacing and existing terminal escape cleanup remain unchanged.
Evidence
SKILL.md, confirms the loader preserves LF/CR/tab, and fails on the original formatter's collapsed JSON. It covers list/info descriptions and list/check paths.src/cli/skills-cli.formatting.test.tsandsrc/cli/skills-cli.test.tspassed, including existing ANSI/C1 cleanup, missing-skill JSON, and table spacing.No Gateway or provider is needed for this formatting boundary. Production net -1 line; tests +22, docs +2.