[CLI] Fix changelog output format#905
Conversation
WalkthroughRemoved the CLI subsection from the root DEVELOPMENT.md and added tools/cli/DEVELOPMENT.md with CLI build and changelog tasks. Bumped cli version from 1.1.0 to 1.1.1 in gradle/cli.versions.toml. Added a 1.1.1 Unreleased entry to tools/cli/CHANGELOG.md. ChangelogCommand now strips the "## Unreleased" header, uses the filtered changelog for both full and truncated outputs, and detects release headers by lines starting with "## ". Tests were updated to assert the output does not contain "## Unreleased". 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tools/cli/DEVELOPMENT.md (1)
3-5: Optional docs clarity: specify execution context.Consider explicitly stating these commands are run from the repository root to avoid confusion when reading this file inside
tools/cli/.✍️ Suggested doc tweak
## CLI -Build CLI: `./gradlew buildCLI` +Run from repository root: + +- Build CLI: `./gradlew buildCLI` -Changelog: `./gradlew patchChangelog` +- Changelog: `./gradlew patchChangelog`🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tools/cli/DEVELOPMENT.md` around lines 3 - 5, The two CLI commands listed (Build CLI: `./gradlew buildCLI` and Changelog: `./gradlew patchChangelog`) lack context about where to run them; update DEVELOPMENT.md to explicitly state these commands must be executed from the repository root (e.g., add a short note like "Run from the repository root:" before the commands or prefix each command with "(from repo root) ./gradlew ...") so readers viewing tools/cli/ know the correct execution context.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@tools/cli/src/main/kotlin/io/github/composegears/valkyrie/cli/command/ChangelogCommand.kt`:
- Line 30: The logic that detects release headers uses
lines[index].trimStart().startsWith("## "), which also matches "## Unreleased"
and causes an off-by-one in release counting; update the predicate in the
header-detection logic (the spot using lines[index].trimStart().startsWith("##
")) to only treat headers as releases when they are a real version header (e.g.,
match a version pattern like semantic versioning) or explicitly exclude
"Unreleased" (and apply the same stricter check in the related block handling
lines 37-41), so the count only includes actual versioned releases.
---
Nitpick comments:
In `@tools/cli/DEVELOPMENT.md`:
- Around line 3-5: The two CLI commands listed (Build CLI: `./gradlew buildCLI`
and Changelog: `./gradlew patchChangelog`) lack context about where to run them;
update DEVELOPMENT.md to explicitly state these commands must be executed from
the repository root (e.g., add a short note like "Run from the repository root:"
before the commands or prefix each command with "(from repo root) ./gradlew
...") so readers viewing tools/cli/ know the correct execution context.
ℹ️ Review info
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
DEVELOPMENT.mdgradle/cli.versions.tomltools/cli/CHANGELOG.mdtools/cli/DEVELOPMENT.mdtools/cli/src/main/kotlin/io/github/composegears/valkyrie/cli/command/ChangelogCommand.kt
💤 Files with no reviewable changes (1)
- DEVELOPMENT.md
5be36aa to
2f370a6
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@tools/cli/src/main/kotlin/io/github/composegears/valkyrie/cli/command/ChangelogCommand.kt`:
- Line 17: The code in ChangelogCommand.kt currently only strips the "##
Unreleased" header via changelog.replace("## Unreleased\n", ""), leaving the
Unreleased content in place; change the logic that builds filteredChangelog to
remove the entire Unreleased section by replacing the range from the "##
Unreleased" header up to (but not including) the next "## " header or
end-of-file. Use a Regex replacement on the changelog string (e.g., matching
"(?s)## Unreleased\\b.*?(?=(\\n##\\s)|\\z)") or equivalent substring indexing so
filteredChangelog contains no Unreleased entries. Ensure you update the
reference to filteredChangelog in the rest of the function accordingly.
ℹ️ Review info
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
tools/cli/CHANGELOG.mdtools/cli/src/main/kotlin/io/github/composegears/valkyrie/cli/command/ChangelogCommand.kttools/cli/src/test/kotlin/io/github/composegears/valkyrie/cli/command/ChangelogCommandTest.kt
🚧 Files skipped from review as they are similar to previous changes (2)
- tools/cli/CHANGELOG.md
- tools/cli/src/test/kotlin/io/github/composegears/valkyrie/cli/command/ChangelogCommandTest.kt
📝 Changelog
If this PR introduces user-facing changes, please update the relevant Unreleased section in changelogs: