Skip to content

Command-line mode: The Command Sigils (:wq) + The Great Substitution (:%s)#8

Merged
StrangeNoob merged 2 commits into
mainfrom
feature/command-line-mode
Jul 3, 2026
Merged

Command-line mode: The Command Sigils (:wq) + The Great Substitution (:%s)#8
StrangeNoob merged 2 commits into
mainfrom
feature/command-line-mode

Conversation

@StrangeNoob

Copy link
Copy Markdown
Owner

Summary

The medium engine feature the gap analysis ranked highest — command-line mode — plus the two lessons it unlocks. This game now teaches you how to exit vim. With it, Acts I–III cover the vimtutor consensus core completely; everything remaining is Act IV power tools (visual mode, ., text objects, marks, registers, macros).

New lessons (22/29 shipped)

Act Lesson Teaches
III · 20 The Command Sigils :w :wq :q!
III · 21 The Great Substitution :s/old/new:%s/g flag

Engine

  • ModeCmdline via : — typing, backspace, esc-cancel, enter-execute, mirroring search mode; the HUD echoes the pending command
  • New commandRun goal type: met when the player executes exactly :command; :w/:q/:wq/:q! are recorded no-ops (there's no file to write) — validated by the content integrity test
  • :s/old/new[/g] and :%s/old/new[/g]: current-line or whole-buffer, first-match or global, undoable, cursor clamped when lines shorten. Plain-text patterns (no regex) — documented simplification
  • 16 new engine test cases + a UI test that the HUD echoes :w (TDD throughout)

Placement note

The plan had these in Act IV, but the content invariant "every act's final lesson carries the act's boss" means Act IV can't start boss-less. They live in Act III instead (where :%s sat in the original roadmap); Power Surge slides to order 22 (id frozen — saves survive). Act IV stays the pure automation world.

Test plan

  • go test ./... green (incl. all 22 lessons solvable at par)
  • go vet, gofmt -l clean
  • Binary builds; version smoke run

…titution (:%s)

The game now teaches you how to exit vim. Closes the last consensus-core
gap: Acts I-III are a complete vimtutor equivalent.

Engine:
- ModeCmdline entered via ':', with typing, backspace, esc-cancel, and
  enter-execute — mirroring search mode
- Executed commands are recorded (lastCommand) for the new commandRun
  goal type; :w/:q/:wq/:q! are recorded no-ops (no file to write)
- :s/old/new[/g] and :%s/old/new[/g] substitution: current line or whole
  buffer, first-match or global, undoable, cursor clamped when a line
  shortens. Plain-text patterns only (no regex) — noted in the code
- HUD echoes the pending command (":wq") like it echoes a search

Content:
- The Command Sigils (Act III, 20): :w, :wq, :q! via commandRun goals
- The Great Substitution (Act III, 21): :s → :%s → /g flag progression
- Placed in Act III, not Act IV as planned: every act's final lesson
  must carry the act's boss, and starting Act IV boss-less broke that
  invariant. Power Surge slides to order 22; ':' added to its keys
- 22 of 29 curriculum lessons shipped

Docs: LESSONS.md (placement note, commandRun goal row), lessons.csv,
README, gap analysis — the meme gap is marked closed.
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@StrangeNoob, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 7 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1e867728-f58a-47d4-9f26-e31759af3d29

📥 Commits

Reviewing files that changed from the base of the PR and between 71ecbf6 and 9ed189c.

⛔ Files ignored due to path filters (1)
  • docs/lessons.csv is excluded by !**/*.csv
📒 Files selected for processing (15)
  • README.md
  • assets/lessons/act3-20-the-command-sigils.json
  • assets/lessons/act3-21-the-great-substitution.json
  • assets/lessons/act3-22-power-surge.json
  • docs/LESSON-GAP-ANALYSIS.md
  • docs/LESSONS.md
  • internal/content/loader_test.go
  • internal/content/solvable_test.go
  • internal/engine/cmdline.go
  • internal/engine/cmdline_test.go
  • internal/engine/engine.go
  • internal/engine/goal.go
  • internal/engine/search.go
  • internal/ui/cmdline_hud_test.go
  • internal/ui/room.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/command-line-mode

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.

A multi-byte character (é, 日) typed into /search or a :command left a
corrupt byte behind on backspace. Shared trimLastRune fixes both paths;
regression test covers each.
@StrangeNoob

Copy link
Copy Markdown
Owner Author

CodeRabbit CLI review disposition (3 findings):

  • Rune-unsafe backspace (minor): fixed at the root. The same byte-slicing bug pre-existed in search input, so both : and / now share trimLastRune, with a regression test proving é + backspace leaves no corrupt byte behind.
  • Power Surge stale id (critical): intentionally skipped — frozen-id design (saves key on ids), documented in LESSONS.md and enforced unique by the loader test added in PR Five new lessons: the consensus pack (A/I/^, e, r/~/J, */N, f/;/,) #6. No collision exists; the suite is green.
  • README boss annotation (minor): skipped — no act row in that table annotates its boss (Acts I/II included); adding it to one row would create the inconsistency the finding claims to fix. Boss info lives in the table's footer text and the ASCII map above.

@StrangeNoob StrangeNoob merged commit e72a1a3 into main Jul 3, 2026
2 checks passed
@StrangeNoob StrangeNoob deleted the feature/command-line-mode branch July 3, 2026 13:35
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.

1 participant