feat: FlowPilot message bar + AI Script Builder + Library reorg #118

Merged
chihlasm merged 22 commits from feat/flowpilot-message-bar-and-script-builder into main 2026-03-22 02:07:27 +00:00
chihlasm commented 2026-03-21 21:23:19 +00:00 (Migrated from github.com)

Summary

  • AI Script Builder — new chat-style page (/script-builder) for generating PowerShell, Bash, and Python scripts from natural language. Fullscreen preview modal with syntax highlighting, save-to-library flow with category and team sharing.
  • FlowPilot message bar — always-visible chat input at bottom of guided sessions, replacing the hidden "None of these — let me describe" escape hatch.
  • FlowPilot → Script Builder handoff — FlowPilot detects custom script needs and shows "Open Script Builder" button with context pre-filled via sessionStorage.
  • Script Library reorganization — "My Scripts" / "Team Scripts" tabs, prominent "Build a New Script" button, new language column on templates, mine/shared query filters.
  • Session close/abandon — "Close" button in FlowPilot action bar sets status to abandoned, redirects to Active Sessions.
  • Unified session history — merged Flow Sessions and AI Sessions into single view.
  • FlowPilot prompt improvement — asks user preference (GUI vs script) before suggesting scripted solutions.
  • Eng review fixes — normalized messages table, typed content helpers, 6 edge case tests, date filter end-of-day fix.

New Backend Components

  • ScriptBuilderSession + ScriptBuilderMessage models with 3 migrations (062-064)
  • script_builder_service.py with language-specific AI prompts (PowerShell, Bash, Python)
  • 6 API endpoints under /scripts/builder/
  • POST /ai-sessions/{id}/abandon endpoint
  • 19 integration tests (13 happy path + 6 edge cases)

New Frontend Components

  • FlowPilotMessageBar — persistent input bar
  • ScriptBuilderPage — main chat page with language selector
  • ScriptBuilderChat, ScriptBuilderInput, ScriptCodeBlock — chat UI
  • ScriptPreviewModal — fullscreen script viewer
  • SaveToLibraryDialog — save with category/team options
  • Sidebar + mobile nav entries for Script Builder
  • Typed content helpers (isScriptGenerationAction, isScriptBuilderAction)

Test Coverage

  • Backend: 19 tests covering CRUD, AI message flow, save-to-library, max sessions, max messages, slug collision, mine/shared filters
  • Frontend: TypeScript compilation passes (no test framework)

Pre-Landing Review

  • Eng review completed with 3 issues found — all implemented:
    1. Normalized JSONB messages into script_builder_messages table
    2. Added typed content helpers for FlowPilot step card
    3. Added 6 edge case tests

Test plan

  • Open FlowPilot session — verify message bar visible at bottom, can type and submit
  • Close/abandon a FlowPilot session → verify redirect to Active Sessions
  • Navigate to Script Builder — verify language selector and chat UI
  • Type a script request — verify AI responds with code block
  • Click "View Full Script" — verify fullscreen modal with syntax highlighting
  • Click "Save to Library" — verify dialog with name/category/share fields
  • Navigate to Scripts library — verify "My Scripts" / "Team Scripts" tabs
  • Verify "Build a New Script" button routes to Script Builder
  • In FlowPilot, trigger custom script need — verify "Open Script Builder" button
  • Verify Active Sessions shows both Flow and AI sessions in unified view
  • Verify date range filter includes items created on the end date

🤖 Generated with Claude Code

## Summary - **AI Script Builder** — new chat-style page (`/script-builder`) for generating PowerShell, Bash, and Python scripts from natural language. Fullscreen preview modal with syntax highlighting, save-to-library flow with category and team sharing. - **FlowPilot message bar** — always-visible chat input at bottom of guided sessions, replacing the hidden "None of these — let me describe" escape hatch. - **FlowPilot → Script Builder handoff** — FlowPilot detects custom script needs and shows "Open Script Builder" button with context pre-filled via sessionStorage. - **Script Library reorganization** — "My Scripts" / "Team Scripts" tabs, prominent "Build a New Script" button, new `language` column on templates, `mine`/`shared` query filters. - **Session close/abandon** — "Close" button in FlowPilot action bar sets status to `abandoned`, redirects to Active Sessions. - **Unified session history** — merged Flow Sessions and AI Sessions into single view. - **FlowPilot prompt improvement** — asks user preference (GUI vs script) before suggesting scripted solutions. - **Eng review fixes** — normalized messages table, typed content helpers, 6 edge case tests, date filter end-of-day fix. ## New Backend Components - `ScriptBuilderSession` + `ScriptBuilderMessage` models with 3 migrations (062-064) - `script_builder_service.py` with language-specific AI prompts (PowerShell, Bash, Python) - 6 API endpoints under `/scripts/builder/` - `POST /ai-sessions/{id}/abandon` endpoint - 19 integration tests (13 happy path + 6 edge cases) ## New Frontend Components - `FlowPilotMessageBar` — persistent input bar - `ScriptBuilderPage` — main chat page with language selector - `ScriptBuilderChat`, `ScriptBuilderInput`, `ScriptCodeBlock` — chat UI - `ScriptPreviewModal` — fullscreen script viewer - `SaveToLibraryDialog` — save with category/team options - Sidebar + mobile nav entries for Script Builder - Typed content helpers (`isScriptGenerationAction`, `isScriptBuilderAction`) ## Test Coverage - Backend: 19 tests covering CRUD, AI message flow, save-to-library, max sessions, max messages, slug collision, mine/shared filters - Frontend: TypeScript compilation passes (no test framework) ## Pre-Landing Review - Eng review completed with 3 issues found — all implemented: 1. Normalized JSONB messages into `script_builder_messages` table 2. Added typed content helpers for FlowPilot step card 3. Added 6 edge case tests ## Test plan - [ ] Open FlowPilot session — verify message bar visible at bottom, can type and submit - [ ] Close/abandon a FlowPilot session → verify redirect to Active Sessions - [ ] Navigate to Script Builder — verify language selector and chat UI - [ ] Type a script request — verify AI responds with code block - [ ] Click "View Full Script" — verify fullscreen modal with syntax highlighting - [ ] Click "Save to Library" — verify dialog with name/category/share fields - [ ] Navigate to Scripts library — verify "My Scripts" / "Team Scripts" tabs - [ ] Verify "Build a New Script" button routes to Script Builder - [ ] In FlowPilot, trigger custom script need — verify "Open Script Builder" button - [ ] Verify Active Sessions shows both Flow and AI sessions in unified view - [ ] Verify date range filter includes items created on the end date 🤖 Generated with [Claude Code](https://claude.com/claude-code)
railway-app[bot] commented 2026-03-21 21:23:35 +00:00 (Migrated from github.com)

🚅 Deployed to the patherly-pr-118 environment in selfless-grace

Service Status Web Updated (UTC)
patherly Success (View Logs) Web Mar 22, 2026 at 1:49 am
hopeful-liberation Success (View Logs) Web Mar 22, 2026 at 1:49 am
<!-- railway-bot-comment-version=2 --> <!-- railway-project-id="22b9b58c-271b-42e5-a10e-6fdec8d00134" railway-project-name="selfless-grace" --> 🚅 Deployed to the [patherly-pr-118](https://railway.com/project/22b9b58c-271b-42e5-a10e-6fdec8d00134?environmentId=36fe3167-5c8a-4076-83aa-65a699691286) environment in **[selfless-grace](https://railway.com/project/22b9b58c-271b-42e5-a10e-6fdec8d00134)** | **Service** | **Status** | **Web** | **Updated** (UTC) | | :--- | :--- | :--- | :--- | | patherly | ✅ Success ([View Logs](https://railway.com/project/22b9b58c-271b-42e5-a10e-6fdec8d00134/service/95f556ff-5264-4116-a0c2-618a2fc53ba4?id=5a7e9c38-6d93-4f60-a5e8-ccf731cd099a&environmentId=36fe3167-5c8a-4076-83aa-65a699691286)) | [Web](https://patherly-patherly-pr-118.up.railway.app) | Mar 22, 2026 at 1:49 am | | hopeful-liberation | ✅ Success ([View Logs](https://railway.com/project/22b9b58c-271b-42e5-a10e-6fdec8d00134/service/e1db2ee3-d241-4f45-abe4-c9c5fdf483d5?id=aed4988a-dc27-46d7-ba00-3a3befb2280c&environmentId=36fe3167-5c8a-4076-83aa-65a699691286)) | [Web](https://hopeful-liberation-patherly-pr-118.up.railway.app) | Mar 22, 2026 at 1:49 am |
Sign in to join this conversation.