Skip to content

feat: add init platform selected summary#125

Merged
benym merged 3 commits into
rpamis:masterfrom
Ninzero:feature/add-init-platform-selected-summary
Jun 22, 2026
Merged

feat: add init platform selected summary#125
benym merged 3 commits into
rpamis:masterfrom
Ninzero:feature/add-init-platform-selected-summary

Conversation

@Ninzero

@Ninzero Ninzero commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Show the active platform selection outside the options list so detected platform labels stay concise while users still see what will be configured.

✨ Summary

Add display of currently selected platforms to the platform selection interface for comet init. The main reason for this change is that the current selection interface requires scrolling through all platforms to fully confirm which ones are selected , especially when some platforms are auto-checked because they were detected, this maks it hard to know which platforms are currently selected.

The effect of the current change is shown in the red-boxed area of the screenshot:
Comet init change

🎯 Scope

  • CLI commands (init, status, doctor, update)
  • Core installer / platform detection
  • Comet skills (assets/skills/, assets/skills-zh/)
  • Comet shell scripts (assets/skills/comet/scripts/)
  • Tests / CI
  • Documentation / changelog
  • Other:

🧪 Testing

  • pnpm build
  • pnpm lint
  • pnpm format:check
  • pnpm test
  • pnpm test -- test/ts/comet-scripts.test.ts
  • pnpm test:shell
  • Not run:

✅ Checklist

  • PR title follows Conventional Commits, for example fix: handle project-scope init
  • User-facing behavior is documented in README.md, README-zh.md, or CONTRIBUTING.md
  • CHANGELOG.md is updated when behavior changes
  • Skill changes were made in Chinese first when applicable, then synced to English
  • New scripts are included in assets/manifest.json and relevant tests
  • Shell scripts remain portable across macOS, Linux, and Windows Git Bash
  • No unrelated generated files or local artifacts are included

👀 Notes for Reviewers

Summary by CodeRabbit

  • New Features
    • Enhanced platform selection prompt with improved keyboard controls (Up/Down navigation, Space toggle, select all, invert selection).
    • Updated multilingual platform selection summary text for both English and Chinese.
    • Added new translation keys to support “selected platforms” messaging.
  • Dependencies
    • Added additional Inquirer UI packages to support the enhanced terminal experience.
  • Tests
    • Added unit tests for platform selection prompt helpers and rendering.
    • Expanded end-to-end init command coverage for English and Chinese flows.
  • Chores
    • Bumped package version to 0.3.10.

Ninzero and others added 2 commits June 20, 2026 00:09
Show the active platform selection outside the options list so detected platform labels stay
concise while users still see what will be configured.

Co-Authored-By: Codex <noreply@openai.com>
Apply formatter output to keep the platform prompt source consistent with project style.

Co-Authored-By: Codex <noreply@openai.com>
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3e27e4aa-25aa-490e-8aeb-c579122c8c65

📥 Commits

Reviewing files that changed from the base of the PR and between 72dcda0 and c7be568.

📒 Files selected for processing (4)
  • src/commands/i18n.ts
  • src/commands/init.ts
  • src/commands/platform-select-prompt.ts
  • test/ts/init-e2e.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • test/ts/init-e2e.test.ts
  • src/commands/platform-select-prompt.ts
  • src/commands/init.ts

📝 Walkthrough

Walkthrough

Adds a custom Inquirer-based multi-select terminal prompt (platformSelectPrompt) with theming, keyboard navigation, pagination, and selection helpers. Extends TranslationKey with selectedPlatforms, noneSelected, and selectPlatformsRequired keys with corresponding English and Chinese strings. Wires the new prompt into init.ts, replacing the inline checkbox call. Adds unit tests for helpers and e2e tests for localized prompt invocation.

Changes

Platform Select Prompt Feature

Layer / File(s) Summary
Dependencies and i18n contracts
package.json, src/commands/i18n.ts
Bumps version to 0.3.10, adds @inquirer/ansi, @inquirer/core, @inquirer/figures, @inquirer/type as explicit dependencies, and extends TranslationKey with selectedPlatforms, noneSelected, and selectPlatformsRequired keys plus English and Chinese translations.
platformSelectPrompt implementation
src/commands/platform-select-prompt.ts
Defines prompt theming (icons, colors, prefix/status/answer/error/highlight/help-key styling), exports PlatformSelectChoice/PlatformSelectPromptConfig types, implements getSelectedChoiceNames, formatSelectedSummary, renderSelectedSummaryLine, toggleChoice, selectAllChoices, invertChoices, the createPrompt-based interactive loop with keyboard handling and pagination, and the async platformSelectPrompt wrapper.
init.ts wiring
src/commands/init.ts
Imports platformSelectPrompt, adds summaryName to each platform choice, and replaces the inline checkbox(...) call with platformSelectPrompt(...) wired to localized selectedLabel, emptyLabel, requiredErrorLabel, and required.
Unit and e2e tests
test/ts/platform-select-prompt.test.ts, test/ts/init-e2e.test.ts
Adds unit tests for selection state helpers and summary-line rendering; adds e2e tests asserting platformSelectPrompt is invoked with correct localized labels and codex marked checked in both English and Chinese language modes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • rpamis/comet#109: Refactors init to pass lang into platform-selection prompts and localized labels — directly overlaps with this PR's addition of selectedPlatforms/noneSelected i18n keys and the localized platformSelectPrompt wiring.

Poem

🐇 Hop hop, a new prompt appears,
With checkboxes, cursors, and themed frontiers!
Space to toggle, a to grab all,
i to invert — never miss a call.
In English and Chinese the labels shine,
A multi-select prompt, oh so fine! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add init platform selected summary' clearly and concisely describes the main feature addition—a platform selected summary display for the init command.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 19, 2026

Copy link
Copy Markdown

Greptile Summary

This PR replaces the plain checkbox prompt in comet init's platform selection step with a custom platformSelectPrompt that renders a live "Selected: …" summary line above the choices list, so users can confirm their selections without scrolling. All new UI labels are fully threaded through the existing i18n system for English and Chinese.

  • New platform-select-prompt.ts: A self-contained @inquirer/core-based prompt with keyboard shortcuts (↑↓ navigate, space toggle, a all, i invert), a configurable selection summary, and localized required-validation error via requiredErrorLabel.
  • init.ts / i18n.ts: selectPlatforms now calls platformSelectPrompt with selectedLabel, emptyLabel, and requiredErrorLabel resolved from the active locale; summaryName is added to each choice so the "(detected)" suffix is stripped in the summary.
  • Tests: New unit tests cover all exported state helpers; two new e2e tests verify correct English and Chinese label wiring.

Confidence Score: 5/5

Safe to merge — the change is additive, all state helper logic is unit-tested, and the i18n wiring is verified end-to-end for both locales.

The custom prompt correctly calls all @inquirer/core hooks unconditionally, handles empty-list edge cases with explicit guards, and the i18n substitution for labels is complete and tested. The only gap is that the keyboard hint action strings are hardcoded in English, which is a cosmetic inconsistency rather than a functional defect.

No files require special attention.

Important Files Changed

Filename Overview
src/commands/platform-select-prompt.ts New custom inquirer prompt with live selection summary; hooks usage is correct (usePagination always called unconditionally); keyboard hint action strings not localizable despite rest of UI being fully i18n-plumbed
src/commands/i18n.ts Adds three new translation keys (selectedPlatforms, noneSelected, selectPlatformsRequired) with correct English and Chinese strings
src/commands/init.ts Swaps checkbox for platformSelectPrompt and threads all i18n labels through correctly; adds summaryName to strip the (detected) suffix in the summary line
test/ts/platform-select-prompt.test.ts New unit tests covering all exported state helpers (toggle, selectAll, invert, getSelectedChoiceNames, formatSelectedSummary, renderSelectedSummaryLine)
test/ts/init-e2e.test.ts Adds two e2e tests verifying that platformSelectPrompt is called with correct English and Chinese i18n labels including summaryName on choices

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant User
    participant initCommand
    participant selectPlatforms
    participant platformSelectPrompt
    participant i18n

    User->>initCommand: comet init --language zh
    initCommand->>selectPlatforms: detected platforms
    selectPlatforms->>i18n: t(lang, 'selectPlatforms') / t(lang, 'selectedPlatforms') / t(lang, 'noneSelected') / t(lang, 'selectPlatformsRequired')
    i18n-->>selectPlatforms: localized strings
    selectPlatforms->>platformSelectPrompt: "{ message, choices, selectedLabel, emptyLabel, requiredErrorLabel, required }"
    loop Keypress
        User->>platformSelectPrompt: up/down / space / a / i
        platformSelectPrompt-->>User: re-render with updated summary line
    end
    User->>platformSelectPrompt: Enter
    platformSelectPrompt-->>selectPlatforms: string[] of selected platform IDs
    selectPlatforms-->>initCommand: selected IDs
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant User
    participant initCommand
    participant selectPlatforms
    participant platformSelectPrompt
    participant i18n

    User->>initCommand: comet init --language zh
    initCommand->>selectPlatforms: detected platforms
    selectPlatforms->>i18n: t(lang, 'selectPlatforms') / t(lang, 'selectedPlatforms') / t(lang, 'noneSelected') / t(lang, 'selectPlatformsRequired')
    i18n-->>selectPlatforms: localized strings
    selectPlatforms->>platformSelectPrompt: "{ message, choices, selectedLabel, emptyLabel, requiredErrorLabel, required }"
    loop Keypress
        User->>platformSelectPrompt: up/down / space / a / i
        platformSelectPrompt-->>User: re-render with updated summary line
    end
    User->>platformSelectPrompt: Enter
    platformSelectPrompt-->>selectPlatforms: string[] of selected platform IDs
    selectPlatforms-->>initCommand: selected IDs
Loading

Reviews (2): Last reviewed commit: "fix(init): Localize platform select vali..." | Re-trigger Greptile

Comment thread src/commands/platform-select-prompt.ts Outdated
Comment thread src/commands/platform-select-prompt.ts Outdated
Comment thread src/commands/platform-select-prompt.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/commands/platform-select-prompt.ts`:
- Around line 138-140: The hardcoded English error message "At least one choice
must be selected" in the required validation check of the
platform-select-prompt.ts file prevents proper localization for Chinese mode.
Remove the hardcoded string from the setError call in the if block that checks
required && selected.length === 0, add a new field to PlatformSelectPromptConfig
to accept a localized error message for required field validation, update the
setError call to use the passed-in localized message from config, and then pass
the appropriate localized error message when initializing
PlatformSelectPromptConfig from init.ts based on the current language mode.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8fefc772-9993-4c1e-b686-0b557598c73b

📥 Commits

Reviewing files that changed from the base of the PR and between e180a39 and 72dcda0.

⛔ Files ignored due to path filters (2)
  • package-lock.json is excluded by !**/package-lock.json
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • package.json
  • src/commands/i18n.ts
  • src/commands/init.ts
  • src/commands/platform-select-prompt.ts
  • test/ts/init-e2e.test.ts
  • test/ts/platform-select-prompt.test.ts

Comment thread src/commands/platform-select-prompt.ts
@benym

benym commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Please fix the AI ​​Review issues first.

Pass the required-selection error through the init translation table so Chinese mode no longer falls back to English.

Keep the custom prompt pagination hook in a stable render order to match Inquirer prompt behavior.

Co-Authored-By: Codex <noreply@openai.com>
@Ninzero

Ninzero commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the issues raised by AI Review, except for CHANGELOG.md

@benym

benym commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

LGTM

@benym benym merged commit 6b2e14a into rpamis:master Jun 22, 2026
15 checks passed
benym added a commit that referenced this pull request Jun 22, 2026
- Merge master commit 6b2e14a (feat: add init platform selected summary #125)
- Resolve package.json/package-lock.json version and dependency conflicts
- Keep version at 0.4.0-beta.1 (feat-workflow)
- Combine dependencies from both branches (yaml + @inquirer/type)
- Add platform-select-prompt feature from master
@Ninzero Ninzero deleted the feature/add-init-platform-selected-summary branch June 22, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants