Skip to content

Add Environment Config tab to dev TUI#947

Merged
Soner (shyim) merged 6 commits intonextfrom
claude/add-env-config-tab-RoAa8
Apr 2, 2026
Merged

Add Environment Config tab to dev TUI#947
Soner (shyim) merged 6 commits intonextfrom
claude/add-env-config-tab-RoAa8

Conversation

@shyim
Copy link
Copy Markdown
Member

Summary

This PR adds a new "Config" tab to the development TUI that allows users to configure Docker environment settings (PHP version, Node.js version, and profiler selection) with support for profiler-specific credentials.

Key Changes

  • New Config Tab UI (internal/devtui/tab_config.go):

    • Created ConfigModel to manage environment configuration state
    • Supports selecting PHP versions (8.2, 8.3, 8.4), Node.js versions (22, 24), and profilers (none, xdebug, blackfire, tideways, pcov, spx)
    • Implements conditional field visibility based on selected profiler (e.g., Blackfire Server ID/Token only shown when Blackfire is selected)
    • Handles text input for sensitive credentials (Blackfire Server ID/Token, Tideways API Key)
    • Tracks modified state and provides visual feedback for unsaved changes and successful saves
  • Configuration Persistence:

    • Added WriteLocalConfig() in internal/shop/config.go to write credentials to .shopware-project.local.yml (excluded from version control)
    • Main config values (versions, profiler choice) written to standard config file
    • Credentials separated from main config to keep secrets out of version control
  • Tab Navigation:

    • Added Config tab as third tab (accessible via 3 key or Tab navigation)
    • Updated tab cycling logic to support three tabs
    • Added keyboard shortcuts for tab switching (1=General, 2=Logs, 3=Config)
  • User Interaction:

    • Arrow keys (↑/↓) and vim keys (j/k) for navigation
    • Left/Right arrows (h/l) to cycle through select field values
    • Enter to activate/edit fields, Esc to exit editing mode
    • Visual indicators for selected fields, unsaved changes, and saved state
    • Cursor automatically skips hidden credential fields based on profiler selection
  • Comprehensive Tests (internal/devtui/tab_config_test.go):

    • Tests for config initialization with and without existing configuration
    • Tests for applying config changes and credential separation
    • Tests for field visibility based on profiler selection
    • Tests for cursor navigation with hidden fields
    • Tests for value cycling and helper functions

Notable Implementation Details

  • Credentials are stored separately in a local config file to prevent accidental commits of secrets
  • Field visibility is dynamically managed—credential input fields only appear when their corresponding profiler is selected
  • Cursor navigation intelligently skips hidden fields when moving up/down
  • The model maintains both a "modified" flag (for unsaved changes) and a "saved" flag (for visual feedback)
  • Text inputs are properly focused/blurred to enable editing mode without interfering with global keyboard shortcuts

https://claude.ai/code/session_01U7yvsUhc6vAv349PveRYxx

Adds a third "Config" tab to the development TUI that allows users to
configure Docker environment settings without leaving the terminal:
- PHP version selection (8.2, 8.3, 8.4)
- Node.js version selection (22, 24)
- PHP profiler selection (none, xdebug, blackfire, tideways, pcov, spx)
- Profiler-specific credential inputs (Blackfire server ID/token, Tideways API key)
- Save & Regenerate action that persists to .shopware-project.yml

The tab uses arrow keys to navigate fields, left/right to cycle select
values, and enter to edit text inputs or save. Credential fields are
conditionally shown based on the selected profiler.

https://claude.ai/code/session_01U7yvsUhc6vAv349PveRYxx
Credentials (Blackfire server ID/token, Tideways API key) are now
written to the local config file instead of the main project config.
This keeps secrets out of version control while still being merged
at read time via the existing config override mechanism.

- Add WriteLocalConfig() to shop package
- Split ApplyToConfig into non-sensitive (main) and LocalConfig (local)
- Update save handler to write both files

https://claude.ai/code/session_01U7yvsUhc6vAv349PveRYxx
The %-20s format specifier doesn't account for ANSI escape codes in
styled strings, causing labels and values to run together. Switch to
lipgloss Width-based alignment (matching kvKeyStyle in tui/labels.go)
for correct visual spacing.

https://claude.ai/code/session_01U7yvsUhc6vAv349PveRYxx
- Extract repeated string literals into constants (profilerBlackfire,
  profilerTideways, keyLeft, keyRight)
- Add exhaustive switch cases or nolint directives where appropriate
- Ensure import grouping follows gci Standard/Default/Prefix convention

https://claude.ai/code/session_01U7yvsUhc6vAv349PveRYxx
- Extract updateDashboardKeys and updateConfigTab from updateKeyPress
  to reduce cyclomatic complexity below the gocyclo threshold of 30
- Convert if-else chain in config tab View to switch statement (gocritic)

https://claude.ai/code/session_01U7yvsUhc6vAv349PveRYxx
@shyim Soner (shyim) merged commit aafc1fe into next Apr 2, 2026
2 checks passed
@shyim Soner (shyim) deleted the claude/add-env-config-tab-RoAa8 branch April 2, 2026 15:02
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