feat: implement tool workshop - comprehensive tool system enhancement

- Add Docker Compose and Dockerfile support for tool definitions
- Implement readiness probes with configurable command, timeout, interval
- Create ConfigFolder model for reusable file collections with project overrides
- Add rich tool config fields: port_override, start_command, working_directory, env vars, volumes
- Build unified Tool Workshop UI at /tool-workshop replacing /tool-configs and /tool-types
- Update instance creation to support dockerfile builds, config folder mounting, readiness probes
- Add 3 database migrations for tool_types, tool_configs, and new config_folders table
- Create docker_build.py and readiness_probe.py services
- Add config_folders API with CRUD and project override endpoints

Quality gates: frontend build passes, Python syntax valid, all phases complete

Addresses tool-workshop OpenSpec change
This commit is contained in:
Fusion
2026-05-22 19:06:45 +02:00
parent ae377baa74
commit 8dd350286e
28 changed files with 3328 additions and 79 deletions
@@ -0,0 +1,40 @@
"""add_tool_config_fields
Revision ID: 398082499c30
Revises: af8512103d67
Create Date: 2026-05-22 18:38:20.166184
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '398082499c30'
down_revision = 'af8512103d67'
branch_labels = None
depends_on = None
def upgrade() -> None:
# Add new columns to tool_configs
op.add_column('tool_configs', sa.Column('port_override', sa.Integer(), nullable=True))
op.add_column('tool_configs', sa.Column('start_command', sa.Text(), nullable=True))
op.add_column('tool_configs', sa.Column('working_directory', sa.Text(), nullable=True))
op.add_column('tool_configs', sa.Column('environment_variables', postgresql.JSONB(astext_type=sa.Text()), nullable=True, server_default='{}'))
op.add_column('tool_configs', sa.Column('volumes', postgresql.JSONB(astext_type=sa.Text()), nullable=True, server_default='[]'))
# Add CHECK constraint for port range
op.create_check_constraint('chk_port_range', 'tool_configs', sa.text('port_override IS NULL OR (port_override >= 1 AND port_override <= 65535)'))
def downgrade() -> None:
# Drop CHECK constraint
op.drop_constraint('chk_port_range', 'tool_configs', type_='check')
# Drop columns
op.drop_column('tool_configs', 'port_override')
op.drop_column('tool_configs', 'start_command')
op.drop_column('tool_configs', 'working_directory')
op.drop_column('tool_configs', 'environment_variables')
op.drop_column('tool_configs', 'volumes')
@@ -0,0 +1,44 @@
"""create_config_folders_table
Revision ID: 8ed7dd80973d
Revises: 398082499c30
Create Date: 2026-05-22 18:38:22.133696
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '8ed7dd80973d'
down_revision = '398082499c30'
branch_labels = None
depends_on = None
def upgrade() -> None:
op.create_table(
'config_folders',
sa.Column('id', postgresql.UUID(as_uuid=True), primary_key=True, server_default=sa.text('gen_random_uuid()')),
sa.Column('user_id', postgresql.UUID(as_uuid=True), sa.ForeignKey('users.id', ondelete='CASCADE'), nullable=False),
sa.Column('name', sa.String(255), nullable=False),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('mount_path', sa.String(1024), nullable=False),
sa.Column('files', postgresql.JSONB(astext_type=sa.Text()), nullable=False, server_default='{}'),
sa.Column('project_overrides', postgresql.JSONB(astext_type=sa.Text()), nullable=True, server_default='{}'),
sa.Column('is_active', sa.Boolean(), nullable=False, server_default='true'),
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False, server_default=sa.text('NOW()')),
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False, server_default=sa.text('NOW()')),
sa.UniqueConstraint('user_id', 'name', name='uq_config_folders_user_name')
)
# Add index on user_id for filtering
op.create_index('idx_config_folders_user', 'config_folders', ['user_id'])
def downgrade() -> None:
# Drop index
op.drop_index('idx_config_folders_user', table_name='config_folders')
# Drop table
op.drop_table('config_folders')
@@ -0,0 +1,38 @@
"""add_tool_type_fields
Revision ID: af8512103d67
Revises: 0012_default_port_req
Create Date: 2026-05-22 18:37:56.607240
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'af8512103d67'
down_revision = '0012_default_port_req'
branch_labels = None
depends_on = None
def upgrade() -> None:
# Add new columns to tool_types
op.add_column('tool_types', sa.Column('definition_type', sa.String(20), nullable=False, server_default='compose'))
op.add_column('tool_types', sa.Column('dockerfile_template', sa.Text(), nullable=True))
op.add_column('tool_types', sa.Column('build_context', postgresql.JSONB(astext_type=sa.Text()), nullable=True, server_default='{}'))
op.add_column('tool_types', sa.Column('readiness_probe', postgresql.JSONB(astext_type=sa.Text()), nullable=True))
# Add CHECK constraint for definition_type
op.create_check_constraint('chk_definition_type', 'tool_types', sa.text("definition_type IN ('compose', 'dockerfile')"))
def downgrade() -> None:
# Drop CHECK constraint
op.drop_constraint('chk_definition_type', 'tool_types', type_='check')
# Drop columns
op.drop_column('tool_types', 'definition_type')
op.drop_column('tool_types', 'dockerfile_template')
op.drop_column('tool_types', 'build_context')
op.drop_column('tool_types', 'readiness_probe')