Skip to content

feat: add any-buddy preview --all gallery#26

Merged
cpaczek merged 1 commit into
cpaczek:mainfrom
Co-Messi:feat/preview-all
Apr 3, 2026
Merged

feat: add any-buddy preview --all gallery#26
cpaczek merged 1 commit into
cpaczek:mainfrom
Co-Messi:feat/preview-all

Conversation

@Co-Messi

@Co-Messi Co-Messi commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds any-buddy preview --all flag that dumps all 23 preset builds to stdout in a scrollable gallery
  • Each entry shows: name, rarity, species, star tier, eyes, hat, description, and the full ASCII sprite
  • Presets are separated by a rule; color-coded by rarity (legendary = yellow, epic = magenta, etc.)
  • No preflight or binary required — works before any-buddy has been applied
  • Also adds --all to CliFlags and help text

Example

  Preset gallery  (23 presets)

  Arcane Dragon  ·  legendary dragon  ★★★★★
  eyes: ✦   hat: wizard   "A legendary wizard dragon with starry eyes"

        /^\
      /^\  /^\
     <  ✦  ✦  >
     (   ~~   )
      `-vvvv-´

  ────────────────────────────────────────────────────────────

  Dragon King  ·  epic dragon  ★★★★
  ...all 23 presets...

  23 presets total. Run 'any-buddy --preset "<name>"' to apply one.

Test plan

  • any-buddy preview --all — prints all 23 presets with sprites and scrolls cleanly
  • Color coding matches rarity (legendary yellow, epic magenta, etc.)
  • any-buddy preview without --all — unchanged interactive behavior
  • pnpm test — all 203 tests pass

Dumps all 23 preset builds to stdout in a scrollable gallery — each
entry shows the preset name, rarity, species, star tier, eyes/hat, a
one-line description, and the full ASCII sprite, separated by rules.

  any-buddy preview --all

No preflight or binary required: the gallery is entirely static so it
works even before any-buddy is applied. Useful for picking a preset
before committing to the salt search.

Also adds --all to the CliFlags type and to the help text.
@cpaczek cpaczek merged commit 5bff302 into cpaczek:main Apr 3, 2026
7 checks passed
Co-Messi added a commit to Co-Messi/any-buddy that referenced this pull request Apr 4, 2026
Hook install gaps (from code review of PR cpaczek#31):
- apply.ts: hook was only installed in the ORIGINAL_SALT fallthrough path;
  the previousSalt and ORIGINAL_SALT early-return branches inside !oldSalt
  both returned before reaching it. Extract autoInstallHook() helper and
  call it before every successful-patch return.
- apply.ts: --no-hook flag was silently dropped — runApply() had no noHook
  param so the flag was ignored. Add noHook param and pass it from cli.ts.
- buddies.ts: runBuddies() patched the binary but never installed the hook.

Stale-snapshot write (missed in PR cpaczek#24):
- buddies.ts isDefault branch: config was the snapshot from the top of
  runBuddies(), read before saveProfile(outgoing) wrote to disk. Reload
  fresh immediately before savePetConfigV2 to avoid clobbering that write.
- buddies.ts incoming profile read: after switchToProfile() writes to disk,
  reload fresh config to read the incoming profile rather than the stale
  pre-switch snapshot.

preview.ts edge case (from code review of PR cpaczek#26):
- cols - 4 can be negative when stdout.columns < 4 (piped output, very
  narrow TTY). String.repeat throws RangeError on negative values.
  Wrap with Math.max(0, cols - 4).
Co-Messi added a commit to Co-Messi/any-buddy that referenced this pull request Apr 4, 2026
Hook install gaps (from code review of PR cpaczek#31):
- apply.ts: hook was only installed in the ORIGINAL_SALT fallthrough path;
  the previousSalt and ORIGINAL_SALT early-return branches inside !oldSalt
  both returned before reaching it. Extract autoInstallHook() helper and
  call it before every successful-patch return.
- apply.ts: --no-hook flag was silently dropped — runApply() had no noHook
  param so the flag was ignored. Add noHook param and pass it from cli.ts.
- buddies.ts: runBuddies() patched the binary but never installed the hook.

Stale-snapshot write (missed in PR cpaczek#24):
- buddies.ts isDefault branch: config was the snapshot from the top of
  runBuddies(), read before saveProfile(outgoing) wrote to disk. Reload
  fresh immediately before savePetConfigV2 to avoid clobbering that write.
- buddies.ts incoming profile read: after switchToProfile() writes to disk,
  reload fresh config to read the incoming profile rather than the stale
  pre-switch snapshot.

preview.ts edge case (from code review of PR cpaczek#26):
- cols - 4 can be negative when stdout.columns < 4 (piped output, very
  narrow TTY). String.repeat throws RangeError on negative values.
  Wrap with Math.max(0, cols - 4).
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