Skip to content

fix(config): allow Catppuccin custom theme bases#365

Merged
benvinegar merged 1 commit into
mainfrom
fix/custom-theme-catppuccin-base
May 24, 2026
Merged

fix(config): allow Catppuccin custom theme bases#365
benvinegar merged 1 commit into
mainfrom
fix/custom-theme-catppuccin-base

Conversation

@benvinegar
Copy link
Copy Markdown
Member

@benvinegar benvinegar commented May 24, 2026

Summary

  • Allow custom_theme.base to use catppuccin-latte and catppuccin-mocha
  • Cover accepted/rejected custom theme base id config resolution
  • Add an Unreleased changelog entry

Closes #364.

Test plan

  • bun test src/core/config.test.ts
  • bun run typecheck
  • bun run format:check
  • bun run lint

@benvinegar benvinegar force-pushed the fix/custom-theme-catppuccin-base branch from 102d060 to 2a98e47 Compare May 24, 2026 19:54
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 24, 2026

Greptile Summary

This PR extends custom_theme.base config validation to accept catppuccin-latte and catppuccin-mocha, which were already registered as built-in themes but were previously blocked at the config-parsing layer.

  • src/core/config.ts: Adds both Catppuccin IDs to BUILT_IN_THEME_IDS; validation and error messages update automatically since they derive from that array.
  • src/core/config.test.ts: Adds an acceptance test for catppuccin-mocha and updates the rejection error-message assertion; catppuccin-latte has no dedicated acceptance test.
  • CHANGELOG.md: Records the fix under the [Unreleased] section.

Confidence Score: 4/5

The change is minimal and surgical — a two-element addition to a constant array — with the Catppuccin themes already fully implemented in the rendering layer, so there is no risk of a broken lookup at runtime.

The config fix correctly connects the validation layer to themes that already exist in the UI. The only gap is that the new test only exercises catppuccin-mocha, leaving catppuccin-latte untested at the acceptance level, which is a minor coverage omission.

src/core/config.test.ts — missing a catppuccin-latte acceptance test.

Important Files Changed

Filename Overview
src/core/config.ts Adds catppuccin-latte and catppuccin-mocha to BUILT_IN_THEME_IDS so they can be used as custom_theme.base values; validation and error messages update automatically via the array.
src/core/config.test.ts Adds a happy-path test for catppuccin-mocha as a base theme and updates the error-message assertion; catppuccin-latte has no dedicated acceptance test.
CHANGELOG.md Adds an Unreleased changelog entry under ### Fixed describing the Catppuccin custom-theme-base fix.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["config.toml\n[custom_theme]\nbase = 'catppuccin-mocha'"] --> B["normalizeCustomThemeBase(value)"]
    B --> C{value in\nBUILT_IN_THEME_IDS?}
    C -- "yes (now includes catppuccin-latte / catppuccin-mocha)" --> D["return value"]
    C -- no --> E["throw Error(…)"]
    D --> F["CustomThemeConfig\n{ base: 'catppuccin-mocha' }"]
    F --> G["buildCustomTheme()"]
    G --> H["builtInThemeById('catppuccin-mocha')\n→ CATPPUCCIN_MOCHA_THEME"]
    H --> I["Merged AppTheme\n(id: 'custom')"]
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
src/core/config.test.ts:147-161
The new acceptance test only exercises `catppuccin-mocha`. Since both `catppuccin-latte` and `catppuccin-mocha` were blocked by the same validation and are now allowed, covering `catppuccin-latte` as well would ensure both IDs were wired up correctly end-to-end.

```suggestion
  test.each(["catppuccin-mocha", "catppuccin-latte"])(
    "accepts %s as a custom theme base",
    (themeBase) => {
      const home = createTempDir("hunk-config-home-");
      mkdirSync(join(home, ".config", "hunk"), { recursive: true });
      writeFileSync(
        join(home, ".config", "hunk", "config.toml"),
        ["[custom_theme]", `base = "${themeBase}"`].join("\n"),
      );

      const resolved = resolveConfiguredCliInput(createPatchPagerInput(), {
        cwd: createTempDir("hunk-config-cwd-"),
        env: { HOME: home },
      });

      expect(resolved.customTheme).toEqual({ base: themeBase });
    },
  );
```

Reviews (1): Last reviewed commit: "fix(config): allow Catppuccin custom the..." | Re-trigger Greptile

Comment thread src/core/config.test.ts
@benvinegar benvinegar merged commit 10e1ff8 into main May 24, 2026
5 checks passed
@benvinegar benvinegar deleted the fix/custom-theme-catppuccin-base branch May 24, 2026 20:00
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.

Custom themes reject Catppuccin base themes

1 participant