feat(doc): add --omit-title flag to docs +fetch for round-trip safety#625
feat(doc): add --omit-title flag to docs +fetch for round-trip safety#625herbertliu wants to merge 1 commit intomainfrom
Conversation
Case 13 in the pitfall list: docs +fetch --format=pretty prepends '# <title>' to the output so a human reader sees the document title up top. But Lark stores the title as an independent field, and docs +update --mode=overwrite only rewrites the body. Piping pretty output into overwrite therefore accumulates a new H1 block on every round- trip — observed in practice as 6+ duplicate '# baiqing 的 lark-cli PR 贡献汇总' H1s accumulating across maintenance runs of the PR tracker doc. Fix: a --omit-title bool that skips the leading H1 line in pretty output. Default stays off so human readers still see the title; agent scripts opt in for round-trip-safe body capture. Scope kept tight: - Behavior only changes when --omit-title is set. All existing callers see identical output. - json / ndjson / csv / table formats are unaffected — those shapes never carried the synthetic H1 prefix. - renderFetchPretty was extracted from the Execute closure so the test can exercise the rendering path without mounting a runtime/MCP mock. Coverage: 6-case table-driven test on renderFetchPretty (default on, omit-title strips, empty/missing title, has_more pagination hint) plus an explicit round-trip-safety assertion that omit-title output never starts with '# <title>'. Skill doc updated with the round-trip usage pattern.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe PR adds a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #625 +/- ##
==========================================
+ Coverage 60.20% 62.07% +1.87%
==========================================
Files 407 407
Lines 43340 35804 -7536
==========================================
- Hits 26091 22225 -3866
+ Misses 15221 11551 -3670
Partials 2028 2028 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@a82dc3e08676a352f4ce08858d8af0c602f9b441🧩 Skill updatenpx skills add larksuite/cli#feat/docs-fetch-omit-title -y -g |
Summary
Addresses Case 13 in the lark-cli pitfall list: `docs +fetch --format=pretty` prepends `# <title>` for human readability, but Lark stores the document title as an independent field and `docs +update --mode=overwrite` only rewrites the body. Piping pretty output through overwrite therefore accumulates a duplicate H1 block on every round-trip — observed in practice as 6+ duplicate H1s on the PR-tracker doc before anyone noticed.
Add `--omit-title` (off by default) so round-trip callers get a clean body.
Changes
Scope notes
Test Plan
Summary by CodeRabbit
New Features
--omit-titleflag todocs +fetchcommand for--format=prettyoutput, allowing users to exclude the initial title line from rendered markdown.Documentation
--omit-titleflag examples and parameter descriptions.