Files
headquarter/openspec/changes/archive/2026-05-24-terminal-startup-and-container-tools/tasks.md
T
OpenCode Agent 01a0ef46c9 feat: terminal startup command and container tools
- Add startup_command field to ToolType model and API
- Execute startup command before interactive shell in terminal sessions
- Add tmux and ranger to OpenCode container spec
- Update Tool Workshop UI with startup_command input for terminal types
- Add backend tests for startup_command CRUD operations
- Sync specs: tool-terminal, tool-types-definition, opencode-web-server
- New spec: tool-terminal-startup-command

Quality gates: Frontend typecheck/lint passed. Backend tests blocked by environment (Python/Docker not available).

OpenSpec: terminal-startup-and-container-tools
2026-05-24 22:21:55 +00:00

2.3 KiB

1. Database and Model

  • 1.1 Create Alembic migration to add startup_command text column to tool_types table
  • 1.2 Add startup_command field to ToolType SQLAlchemy model

2. Backend API

  • 2.1 Add startup_command to ToolTypeCreate Pydantic schema
  • 2.2 Add startup_command to ToolTypeUpdate Pydantic schema
  • 2.3 Add startup_command to ToolTypeResponse Pydantic schema
  • 2.4 Update POST /tool-types endpoint to handle startup_command
  • 2.5 Update PUT /tool-types/{id} endpoint to handle startup_command

3. Terminal Session Execution

  • 3.1 Update TerminalSession.start() to accept optional startup_command parameter
  • 3.2 Implement startup command execution using bash -c "<cmd>" || true; exec bash -il pattern
  • 3.3 Update TerminalManager.get_or_create_session() to accept and pass startup_command
  • 3.4 Update TerminalManager.reset_session() to accept and pass startup_command
  • 3.5 Update terminal WebSocket endpoint to fetch tool type via instance and pass startup_command
  • 3.6 Update terminal reset HTTP endpoint to pass startup_command

4. Frontend

  • 4.1 Add startup_command field to ToolType form state in Tool Workshop
  • 4.2 Add startup_command input to Tool Workshop UI (shown for terminal interface types)
  • 4.3 Update tool type submission to include startup_command
  • 4.4 Update ToolType type definition to include startup_command

5. OpenCode Container Tools

  • 5.1 Update OpenCode built-in tool type compose template to install tmux and ranger
  • 5.2 Ensure tmux and ranger are available in the container PATH

6. Tests and Verification

  • 6.1 Add backend tests for tool type create/update with startup_command
  • 6.2 Add backend tests for terminal session startup command execution (covered by implementation tests)
  • 6.3 Run pytest and ensure all tests pass — BLOCKED: Python/Docker not available in environment
  • 6.4 Run mypy . and fix any type errors — BLOCKED: Python/Docker not available in environment
  • 6.5 Run ruff check . and fix any lint errors — BLOCKED: Python/Docker not available in environment
  • 6.6 Run frontend npm run typecheck and fix any errors — PASSED
  • 6.7 Run frontend npm run lint and fix any errors — PASSED (no new errors introduced)