Skip to content

fix: add pin toggle to board view and fix terminal CWD switching#7

Merged
eyelock merged 1 commit into
mainfrom
fix/pin-toggle-and-cwd-bug
Jan 9, 2026
Merged

fix: add pin toggle to board view and fix terminal CWD switching#7
eyelock merged 1 commit into
mainfrom
fix/pin-toggle-and-cwd-bug

Conversation

@eyelock
Copy link
Copy Markdown
Owner

@eyelock eyelock commented Jan 9, 2026

Summary

Pin toggle on board view

  • Add clickable star button to terminal card header in board view
  • Star appears on hover or when already pinned
  • Add Pin/Unpin option to right-click context menu
  • Allows quick reorganization of pinned terminals without opening each one

Fix CWD bug when switching terminals

  • Add .id(card.id) to TerminalHostView to force view recreation when switching
  • Previously, SwiftUI would reuse the view and show the wrong terminal session
  • Now each terminal correctly displays its own session

Test plan

  • Build and run the app
  • Hover over a terminal card - star should appear
  • Click star to pin/unpin terminal
  • Right-click card and use Pin/Unpin menu option
  • Open multiple terminals with different working directories
  • Switch between them using pinned tabs - each should show correct CWD

🤖 Generated with Claude Code

Pin toggle on board view:
- Add clickable star button to TerminalCardView header
- Star appears on hover or when pinned
- Add Pin/Unpin option to context menu
- Wire up onTogglePin callback through ColumnView and KanbanBoardView

Fix CWD bug when switching terminals:
- Add .id(card.id) to TerminalHostView to force view recreation
- This ensures the correct terminal session is displayed when switching

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@eyelock eyelock merged commit 8fbe239 into main Jan 9, 2026
4 checks passed
@eyelock eyelock deleted the fix/pin-toggle-and-cwd-bug branch January 9, 2026 11:21
eyelock pushed a commit that referenced this pull request Jan 15, 2026
- Create Constants.swift with Shell, Terminal, Columns, ColorPalette,
  LLMTokens, and Activity configuration constants
- Update TerminalSessionManager to use Terminal and Activity constants
- Update ColumnEditorView to use ColorPalette constants
- Update ContentView to use Columns.fallbackName constant

Addresses Issue #7 from forensic code review.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
eyelock added a commit that referenced this pull request Jan 15, 2026
* refactor(shared): Extract shared models and generic installer (#phase1)

- Create TermQShared target with Sendable domain models (Tag, Column, Card, Board)
- Add shared OutputTypes (TerminalOutput, ColumnOutput, PendingOutput, ErrorOutput)
- Add shared BoardLoader for consistent board loading/writing across CLI and MCP
- Extract generic ComponentInstaller protocol to eliminate CLI/MCP installer duplication
- Migrate termq-cli to use TermQShared (remove ~200 lines of duplicate models)
- Migrate MCPServerLib to use TermQShared with type aliases for compatibility
- Add TermQSharedTests for shared model coverage

Net reduction: ~1000 lines of duplicated code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(viewmodel): Extract TabManager and BoardPersistence (#phase2)

Split BoardViewModel from 768 to 441 lines by extracting:

- TabManager: Session tab state, navigation, attention indicators, transient cards
- BoardPersistence: Save/load operations, file monitoring for external changes
- FileMonitor: Helper class for dispatch source-based file monitoring

BoardViewModel now coordinates these managers while maintaining backwards
compatible API through proxy properties and methods.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor: Extract TerminalThemeManager from TerminalSessionManager

Phase 3 of tech debt cleanup - split the TerminalSessionManager god object
by extracting theme management into a dedicated TerminalThemeManager class.

Changes:
- Create TerminalThemeManager for theme state and application logic
- TerminalSessionManager now delegates theme operations to themeManager
- Proxy properties maintain API compatibility (themeId, currentTheme)
- Theme callback mechanism for applying changes to all sessions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test: Add resource and prompt handler tests, coverage target

Improve test coverage from 66% to 78%:
- Add testResource* tests for all MCP resource handlers (terminals, columns, pending, context)
- Add testPrompt* tests for all MCP prompt handlers (session_start, workflow_guide, terminal_summary)
- Add test.coverage Makefile target for easy coverage reporting

Coverage improvements:
- ResourceHandlers.swift: 0% → 95%
- PromptHandlers.swift: 0% → 94%

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: Add code style guide from tech debt cleanup

Create .claude/commands/code-style.md capturing patterns learned:
- Swift 6 Sendable conformance patterns
- Actor-isolated class with dispatch source helpers
- God object decomposition strategy
- Init order with callback configure() pattern
- Generic type extraction for code deduplication
- Observable vs Sendable model separation
- MCP testing patterns with type extraction helpers
- Refactoring checklist for future upgrades

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor: Extract reusable components from large view files

- Extract MCPStatusView from ContentView (23 lines)
- Extract SafePasteAnalyzer from TerminalHostView (63 lines)
- Extract LLMVendor enum from CardEditorView (54 lines)

Addresses Issue #6 from forensic code review.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor: Add Constants file to consolidate magic values

- Create Constants.swift with Shell, Terminal, Columns, ColorPalette,
  LLMTokens, and Activity configuration constants
- Update TerminalSessionManager to use Terminal and Activity constants
- Update ColumnEditorView to use ColorPalette constants
- Update ContentView to use Columns.fallbackName constant

Addresses Issue #7 from forensic code review.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: Add error handling guidelines to code style guide

- Define context-specific patterns for CLI, MCP, ViewModels, and file ops
- Document when to use try?, throw, or return isError
- Add typed error definition examples
- List errors that should never be silently ignored
- Update refactoring checklist with error handling items

Addresses Issue #9 from forensic code review.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(mcp): Add type-safe JSON Schema builder DSL

- Create SchemaBuilder enum with type-safe property definitions
- Add convenience methods: string(), bool(), int() for common types
- Refactor SchemaDefinitions to use builder pattern
- Replace verbose nested dictionary literals with clean DSL syntax

Example:
  inputSchema: S.objectSchema([
      S.string("identifier", "Terminal name or UUID", required: true),
      S.string("column", "Target column name", required: true),
  ])

Addresses forensic review Issue #10.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(mcp): Add centralized input validation layer

- Create InputValidator enum with type-safe parameter extraction
- Add validation methods: requireString, requireNonEmptyString, requireUUID
- Add optional extractors: optionalString, optionalBool, optionalUUID, optionalPath
- Define ValidationError enum with descriptive error messages
- Refactor all MCP tool handlers to use centralized validation
- Consistent error handling: return isError:true instead of throwing

Benefits:
- Type-safe parameter extraction reduces runtime errors
- Consistent error messages improve LLM experience
- Path validation with tilde expansion
- UUID format validation with clear error messages

Addresses forensic review Issue #11.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: Add memory management patterns to code style guide

Audit findings:
- No actual memory leaks found in codebase
- All closures properly use [weak self] where needed
- Event monitors have cleanup in onDisappear
- Timers and dispatch sources cleaned up in deinit
- Callback-based coordination avoids retain cycles

Documentation added:
- Closure capture rules for classes vs structs
- Event monitor cleanup pattern
- Timer/dispatch source cleanup
- Callback-based coordination guidance
- Checklist item for memory management

Addresses forensic review Issue #12.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test: Improve test coverage for shared models and validation

- Add comprehensive InputValidator tests (93% line coverage)
- Add TermQError error description tests (100% coverage)
- Add ColumnOutput, PendingOutput, PendingSummary tests
- Add SetResponse and MoveResponse tests
- Fix test assertions for order-independent badge comparisons
- Fix path validation tests for trailing slash normalization

Total coverage improved from ~75% to ~80% lines.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* chore: Add missing build artifacts to gitignore

Add termqcli and TermQ_TermQ.bundle to gitignore - these are
generated during the build process and shouldn't be tracked.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: Add @mainactor to showWarningDialog for Swift 6 concurrency

NSAlert requires main actor isolation in Xcode 16.4+ with stricter
Swift concurrency checking. Add @mainactor annotation to satisfy
the compiler's concurrency requirements.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: David Collie <support@eyelock.net>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
eyelock pushed a commit that referenced this pull request Jan 18, 2026
**SharedToggle Component**
- Create reusable toggle that respects global settings
- Show disabled state with optional clickable message
- Support help text and custom disabled messages

**Settings Reorganization**
- Reorganize General tab: Terminal, Bin, Updates, Language, Uninstall, About
- Reorganize Data & Security tab: Security, Data Storage, Data Protection
- Move Uninstall section from Data & Security to General

**Security Settings Updates**
- Add allowTerminalsToRunAgentPrompts global setting (default: false)
- Rename confirmExternalLLMModifications → allowExternalLLMModifications
- Change all security defaults to FALSE (more secure by default)

**Implementation Note**: Proper localization for new strings will be added in PR #7.
Expected warnings: file_length (535 lines) and type_body_length (409 lines) in
SettingsView.swift - will be addressed in PR #7 via view extraction.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
eyelock added a commit that referenced this pull request Jan 18, 2026
…#70)

* feat: add SharedToggle component and reorganize settings tabs

**SharedToggle Component**
- Create reusable toggle that respects global settings
- Show disabled state with optional clickable message
- Support help text and custom disabled messages

**Settings Reorganization**
- Reorganize General tab: Terminal, Bin, Updates, Language, Uninstall, About
- Reorganize Data & Security tab: Security, Data Storage, Data Protection
- Move Uninstall section from Data & Security to General

**Security Settings Updates**
- Add allowTerminalsToRunAgentPrompts global setting (default: false)
- Rename confirmExternalLLMModifications → allowExternalLLMModifications
- Change all security defaults to FALSE (more secure by default)

**Implementation Note**: Proper localization for new strings will be added in PR #7.
Expected warnings: file_length (535 lines) and type_body_length (409 lines) in
SettingsView.swift - will be addressed in PR #7 via view extraction.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fixup: improve TermQ Data Folder layout to match PathInputField pattern

Changes:
- Use two-line layout: label + Browse button on line 1, full-width text field on line 2
- Matches PathInputField visual pattern for consistency
- Full PathInputField component integration deferred to PR #5

Updated implementation plan to include TermQ Data Folder in PR #5 scope.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: David Collie <support@eyelock.net>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
eyelock pushed a commit that referenced this pull request Jan 18, 2026
Apply shared KeyValueEditor component to both Settings > Environment
and Terminal Details > Environment tabs for consistent UI and behavior.

Changes:
- Settings Environment tab: Replace inline form with KeyValueEditor
- Terminal Details Environment tab: Replace inline editor with KeyValueEditor
- Both tabs now use identical shared component with full-width inputs
- Consistent styling with Form .formStyle(.grouped)
- Proper state synchronization between KeyValueItem and EnvironmentVariable

Addresses feedback #4, #7, #8, #9, #11 from implementation plan

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
eyelock pushed a commit that referenced this pull request Jan 18, 2026
Apply shared KeyValueEditor component to both Settings > Environment
and Terminal Details > Environment tabs for consistent UI and behavior.

Changes:
- Settings Environment tab: Replace inline form with KeyValueEditor
- Terminal Details Environment tab: Replace inline editor with KeyValueEditor
- Both tabs now use identical shared component with full-width inputs
- Consistent styling with Form .formStyle(.grouped)
- Proper state synchronization between KeyValueItem and EnvironmentVariable

Addresses feedback #4, #7, #8, #9, #11 from implementation plan

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
eyelock pushed a commit that referenced this pull request Jan 18, 2026
Apply shared KeyValueEditor component to both Settings > Environment
and Terminal Details > Environment tabs for consistent UI and behavior.

Changes:
- Settings Environment tab: Replace inline form with KeyValueEditor
- Terminal Details Environment tab: Replace inline editor with KeyValueEditor
- Both tabs now use identical shared component with full-width inputs
- Consistent styling with Form .formStyle(.grouped)
- Proper state synchronization between KeyValueItem and EnvironmentVariable

Addresses feedback #4, #7, #8, #9, #11 from implementation plan

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
eyelock added a commit that referenced this pull request Jan 18, 2026
* feat: integrate KeyValueEditor in environment tabs

Apply shared KeyValueEditor component to both Settings > Environment
and Terminal Details > Environment tabs for consistent UI and behavior.

Changes:
- Settings Environment tab: Replace inline form with KeyValueEditor
- Terminal Details Environment tab: Replace inline editor with KeyValueEditor
- Both tabs now use identical shared component with full-width inputs
- Consistent styling with Form .formStyle(.grouped)
- Proper state synchronization between KeyValueItem and EnvironmentVariable

Addresses feedback #4, #7, #8, #9, #11 from implementation plan

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* feat: improve environment settings UI with component split and fixes

Split KeyValueEditor into focused components (KeyValueList + KeyValueAddForm)
for better UX with separate sections for viewing and adding items.

Changes:
- Split KeyValueEditor.swift into 3 components:
  * KeyValueList - display existing items with delete
  * KeyValueAddForm - add new items with validation
  * KeyValueEditor - legacy wrapper (deprecated)

- SettingsEnvironmentView improvements:
  * Use split components in separate sections
  * Add proper error handling with user-visible alerts
  * Fix encryption key status race condition
  * Remove nested Form wrapper

- CardEditorEnvironmentTab improvements:
  * Use split components in separate sections
  * Add secret visibility toggle for inherited globals
  * Add proper error handling with alerts
  * Store secret values in memory for display

- Add localized section headers:
  * "Global Environment Variables"
  * "Add Environment Variable" (Settings)
  * "Add Environment Variable" (Terminal Details)

Fixes:
- Secrets not being added (silent error swallowing with try?)
- Encryption key status not updating after operations
- Secret values not viewable in Terminal Details inherited list

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: David Collie <support@eyelock.net>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
eyelock added a commit that referenced this pull request Jan 18, 2026
…d tags editor (#72)

* feat: integrate KeyValueEditor in environment tabs

Apply shared KeyValueEditor component to both Settings > Environment
and Terminal Details > Environment tabs for consistent UI and behavior.

Changes:
- Settings Environment tab: Replace inline form with KeyValueEditor
- Terminal Details Environment tab: Replace inline editor with KeyValueEditor
- Both tabs now use identical shared component with full-width inputs
- Consistent styling with Form .formStyle(.grouped)
- Proper state synchronization between KeyValueItem and EnvironmentVariable

Addresses feedback #4, #7, #8, #9, #11 from implementation plan

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* feat: improve environment settings UI with component split and fixes

Split KeyValueEditor into focused components (KeyValueList + KeyValueAddForm)
for better UX with separate sections for viewing and adding items.

Changes:
- Split KeyValueEditor.swift into 3 components:
  * KeyValueList - display existing items with delete
  * KeyValueAddForm - add new items with validation
  * KeyValueEditor - legacy wrapper (deprecated)

- SettingsEnvironmentView improvements:
  * Use split components in separate sections
  * Add proper error handling with user-visible alerts
  * Fix encryption key status race condition
  * Remove nested Form wrapper

- CardEditorEnvironmentTab improvements:
  * Use split components in separate sections
  * Add secret visibility toggle for inherited globals
  * Add proper error handling with alerts
  * Store secret values in memory for display

- Add localized section headers:
  * "Global Environment Variables"
  * "Add Environment Variable" (Settings)
  * "Add Environment Variable" (Terminal Details)

Fixes:
- Secrets not being added (silent error swallowing with try?)
- Encryption key status not updating after operations
- Secret values not viewable in Terminal Details inherited list

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* feat: complete Settings UI improvements with tab navigation and tags editor

This PR completes the Settings UI improvement series by:

1. Fix "Edit Global Settings" button to properly open Settings window
   - Replace problematic sheet/NSWindow approaches with SettingsLink
   - Add SettingsCoordinator for tab pre-selection
   - Settings now opens with Environment tab selected when accessed from Terminal Details

2. Replace custom tags editor with KeyValueEditor components
   - Use KeyValueList for displaying tags
   - Use KeyValueAddForm for adding new tags
   - Consistent UX with Environment variables editor
   - Remove obsolete state variables (newTagKey, newTagValue)

3. Complete localization for "Add Tag" string across all 40 languages

Technical changes:
- Created SettingsCoordinator singleton for Settings navigation coordination
- Updated SettingsView to observe coordinator and respond to tab requests
- Updated CardEditorEnvironmentTab to use SettingsLink with simultaneousGesture
- Updated CardEditorView metadata tab to use KeyValueEditor pattern
- Added sectionAddTag localization key in all 40 language files

All tests passing (521 tests, 0 failures)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: David Collie <support@eyelock.net>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
eyelock pushed a commit that referenced this pull request Jan 19, 2026
This PR reorganizes and improves the terminal card editor with better
component usage and clearer organization.

## New Components

### LargeTextInput
- Created new reusable component for multi-line text input
- Uses TextEditor (not TextField) for stable, non-jumping layout
- Fixed height prevents layout shifts during typing
- Custom placeholder implementation
- Solves form width issues - now uses full available width
- Consistent styling with PathInputField and SharedToggle

## Terminal Editor Changes

### Agent Tab → Prompts Tab
- Renamed for clearer terminology (agent prompts vs agent tab)
- Improved visual hierarchy with status indicators at top

### Status Indicators (Prompts Tab)
- Applied StatusIndicator component for MCP Server status
- Applied StatusIndicator for Agent Prompts status
- Applied StatusIndicator for Confirm External Modifications
- Fixed logic: "Terminal allows commands" now shows "Enabled/Disabled"
  instead of "Installed" (proper semantic distinction)

### Terminal Tab Reorganization
- Moved Command Generator from Agent/Prompts tab to Terminal tab
- New section: Automation (contains Init Command + Command Generator)
- Reordered sections: Terminal → Security → Automation (logical flow)
- Command Generator now conditional (only shows when agent prompts enabled)

## Component Improvements

### StatusIndicator Spacing
- Increased HStack spacing: 6 → 8
- Increased vertical padding: 4 → 8
- Reduces "squished" appearance, better visual breathing room

## Localization

- Added: common.enabled, common.disabled
- Added: editor.section.prompts
- Updated all 40 language files with translations

## Files Changed

New:
- Sources/TermQ/Views/Components/LargeTextInput.swift

Modified:
- Sources/TermQ/Views/CardEditorView.swift (tab reorganization)
- Sources/TermQ/Views/Components/StatusIndicator.swift (spacing)
- Sources/TermQ/Utilities/Strings.swift
- Sources/TermQ/Resources/*/Localizable.strings (40 files)

## Testing

- All 521 tests pass
- Manual testing verified:
  - LargeTextInput stable (no jumping during typing)
  - Full width usage in forms
  - StatusIndicator spacing improved
  - Command Generator conditional display works
  - Terminal tab section order logical
  - All status messages semantically correct

## Notes

- Global Settings > Tools tab will receive StatusIndicator in PR #7
- This maintains PR #6 focus on Terminal Details editor
- PR #7 will achieve full consistency across both views

Addresses feedback items #17, #18, #20, #21 from parent plan
Part of Settings UI Improvements series (PR #6 of 8)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
eyelock added a commit that referenced this pull request Jan 19, 2026
…74)

This PR reorganizes and improves the terminal card editor with better
component usage and clearer organization.

## New Components

### LargeTextInput
- Created new reusable component for multi-line text input
- Uses TextEditor (not TextField) for stable, non-jumping layout
- Fixed height prevents layout shifts during typing
- Custom placeholder implementation
- Solves form width issues - now uses full available width
- Consistent styling with PathInputField and SharedToggle

## Terminal Editor Changes

### Agent Tab → Prompts Tab
- Renamed for clearer terminology (agent prompts vs agent tab)
- Improved visual hierarchy with status indicators at top

### Status Indicators (Prompts Tab)
- Applied StatusIndicator component for MCP Server status
- Applied StatusIndicator for Agent Prompts status
- Applied StatusIndicator for Confirm External Modifications
- Fixed logic: "Terminal allows commands" now shows "Enabled/Disabled"
  instead of "Installed" (proper semantic distinction)

### Terminal Tab Reorganization
- Moved Command Generator from Agent/Prompts tab to Terminal tab
- New section: Automation (contains Init Command + Command Generator)
- Reordered sections: Terminal → Security → Automation (logical flow)
- Command Generator now conditional (only shows when agent prompts enabled)

## Component Improvements

### StatusIndicator Spacing
- Increased HStack spacing: 6 → 8
- Increased vertical padding: 4 → 8
- Reduces "squished" appearance, better visual breathing room

## Localization

- Added: common.enabled, common.disabled
- Added: editor.section.prompts
- Updated all 40 language files with translations

## Files Changed

New:
- Sources/TermQ/Views/Components/LargeTextInput.swift

Modified:
- Sources/TermQ/Views/CardEditorView.swift (tab reorganization)
- Sources/TermQ/Views/Components/StatusIndicator.swift (spacing)
- Sources/TermQ/Utilities/Strings.swift
- Sources/TermQ/Resources/*/Localizable.strings (40 files)

## Testing

- All 521 tests pass
- Manual testing verified:
  - LargeTextInput stable (no jumping during typing)
  - Full width usage in forms
  - StatusIndicator spacing improved
  - Command Generator conditional display works
  - Terminal tab section order logical
  - All status messages semantically correct

## Notes

- Global Settings > Tools tab will receive StatusIndicator in PR #7
- This maintains PR #6 focus on Terminal Details editor
- PR #7 will achieve full consistency across both views

Addresses feedback items #17, #18, #20, #21 from parent plan
Part of Settings UI Improvements series (PR #6 of 8)

Co-authored-by: David Collie <support@eyelock.net>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
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