Skip to content

Support custom commands and workspace launches in the command palette#20

Closed
khoi wants to merge 2 commits intomainfrom
khoiracle/sup-43-support-custom-commands-and-workspace-launches-in-the
Closed

Support custom commands and workspace launches in the command palette#20
khoi wants to merge 2 commits intomainfrom
khoiracle/sup-43-support-custom-commands-and-workspace-launches-in-the

Conversation

@khoi
Copy link
Copy Markdown
Contributor

@khoi khoi commented Apr 9, 2026

Summary

  • Problem: the command palette had no path for user-defined commands or repeatable workspace launches from supaterm.json
  • Why it matters: users could not define reusable project commands or recreate named terminal layouts from the palette
  • What changed: added shared custom-command models and schema generation, global plus nearest-local command loading and merge rules, palette integration for resolved custom rows, and host-owned execution for simple commands plus workspace launches
  • What did NOT change (scope boundary): no browser panes, no mixed surface layouts, and no new socket-facing workspace request surface

Rationale

This keeps config discovery, path resolution, merge precedence, environment validation, and workspace sequencing inside one terminal-owned boundary instead of leaking those rules into the palette reducer. The host already had the right space and split-tree primitives, so the cleanest forward path was to compose those directly rather than add another orchestration layer.

User-visible / Behavior Changes

  • Users can define custom command palette entries in supaterm.json
  • Simple custom commands run in the focused pane
  • Workspace commands can create or focus a named space and materialize tabs plus panes with titles, cwd, startup commands, and environment variables
  • The palette now shows custom-command load problems without breaking built-in actions

Diagram (if applicable)

Before:
[cmd-p] -> [built-in rows only] -> [no user-defined execution path]

After:
[cmd-p] -> [built-ins + resolved custom rows]
         -> [select custom command]
         -> [host loads/merges config]
         -> [run in focused pane OR recreate/focus workspace]

Human Verification

  • Verified scenarios:
    • ran focused mac tests for the custom-command catalog and palette reducer paths
    • push hooks passed make web-check and the full mac xcodebuild test suite after rebasing onto main
  • Edge cases checked:
    • nearest-local config overrides global by id
    • reserved environment keys are rejected
    • recreate confirmation flow still routes through the existing confirmation path
  • What you did not verify:
    • no live manual app run of cmd-p with a hand-authored supaterm.json in this rebased pass
  • How can a human manually verify this:
    • create a supaterm.json with one simple command and one workspace command in a project directory
    • launch the app, focus a pane in that directory, press cmd-p, and run the custom entries
    • confirm the simple command writes into the focused pane and the workspace command recreates or focuses the named space with the expected layout

khoi added 2 commits April 9, 2026 16:12
Summary:
- add shared supaterm custom-command models, schema generation, and
  committed schema output
- load and merge global plus nearest-local supaterm.json commands into
  the command palette
- execute simple commands and workspace launches through host-owned
  custom command orchestration with focused tests

Rationale:
- move config discovery, merge rules, env validation, and workspace
  sequencing behind a single terminal-owned boundary
- keep the palette reducer focused on UI state while reusing the host's
  existing split-tree and space-management primitives

Tests:
- xcodebuild test -workspace apps/mac/supaterm.xcworkspace -scheme
  supaterm -destination "platform=macOS"
  -only-testing:supatermTests/SPCommandTests
  -only-testing:supatermTests/SPHelpTests
  -only-testing:supatermTests/SupatermCustomCommandsSchemaTests
  -only-testing:supatermTests/TerminalCustomCommandCatalogTests
  -only-testing:supatermTests/TerminalWindowFeatureTests
  -only-testing:supatermTests/GhosttySurfaceViewEnvironmentTests
  -only-testing:supatermTests/TerminalCustomCommandExecutionTests
  CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO
  CODE_SIGN_IDENTITY="" -skipMacroValidation
- make mac-check (fails due pre-existing trailing-comma violations in
  apps/mac/supatermTests/AppDelegateTests.swift and
  apps/mac/supatermTests/PiSettingsInstallerTests.swift)
Summary:
- remove the unused problem accumulator from workspace pane
  resolution
- resolve environment variables directly from sorted key-value pairs
- rename the custom palette row builder to match what it builds

Rationale:
- keep the new SUP-43 paths easier to read without changing behavior
- reduce misleading names and redundant plumbing in the catalog path

Tests:
- mise exec -- swiftlint lint --quiet --config .swiftlint.yml
  supaterm/Features/Terminal/CustomCommands/TerminalCustomCommandCatalog.swift
  supaterm/Features/Terminal/TerminalCommandPalette.swift
- xcodebuild test -workspace apps/mac/supaterm.xcworkspace -scheme
  supaterm -destination "platform=macOS"
  -only-testing:supatermTests/TerminalCustomCommandCatalogTests
  -only-testing:supatermTests/TerminalWindowFeatureTests
  CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO
  CODE_SIGN_IDENTITY="" -skipMacroValidation
@khoi khoi force-pushed the khoiracle/sup-43-support-custom-commands-and-workspace-launches-in-the branch from 923eabf to 54b3a66 Compare April 9, 2026 15:15
@khoi
Copy link
Copy Markdown
Contributor Author

khoi commented Apr 11, 2026

Closing all open PRs per request.

@khoi khoi closed this Apr 11, 2026
@khoi khoi deleted the khoiracle/sup-43-support-custom-commands-and-workspace-launches-in-the branch April 11, 2026 13:09
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