feat: Script Generator Phase 1 — backend models, engine, API, and AD templates #105

Merged
chihlasm merged 78 commits from feat/script-generator into main 2026-03-15 00:19:00 +00:00
chihlasm commented 2026-03-13 04:32:57 +00:00 (Migrated from github.com)

Summary

Phase 1 — Backend (original PR scope):

  • Adds ScriptCategory, ScriptTemplate, ScriptGeneration SQLAlchemy models with UUID PKs and timezone-aware datetimes
  • Implements ScriptTemplateEngine — a Jinja2-style PowerShell template engine with parameter substitution, as_secure_string/as_array/as_bool filters, {% if %} conditionals, and PowerShell-safe string escaping
  • 8 REST endpoints under /scripts/: categories, template CRUD (team_admin+), generation, generation history
  • Migration 057 creates tables + seeds 1 Active Directory category with 6 AD User Management templates
  • 15 unit tests for the template engine + 12 integration tests for the API (all passing)

Phase 2 — Frontend Script Library:

  • Script Library page at /scripts with filter bar (category tabs + debounced search), template list, and script preview
  • All 7 field types: text, number, boolean, select, multi-select, password, textarea
  • Live parameter substitution preview via ScriptPreview + PowerShellHighlighter

Phase 2.5 — Left Pane Takeover UX Redesign:

  • Browse mode: template list with "Configure →" button on each card; filter bar inside left pane column
  • Configure mode: full left-pane takeover with template header, param form, and action bar (Generate, Download .ps1, Copy)
  • Right pane is now read-only ScriptPreview — always visible, no form or buttons
  • Filter/search state preserved across Browse ↔ Configure transitions
  • ScriptGeneratorPanel deleted; replaced by ScriptConfigurePane + right-pane simplification

Test Plan

  • Run pytest tests/test_script_template_engine.py tests/test_scripts.py -v — all 27 tests pass
  • Navigate to /scripts — Script Library loads with category filter tabs and template list
  • Click "Configure →" on a template — left pane transitions to configure mode, filter bar hides, template header appears
  • Fill in params — right pane preview updates live with substituted values
  • Click "Generate Script" — generated script appears in right pane
  • Download .ps1 and Copy buttons activate after generation
  • "← Back to library" returns to browse mode with search/filter state preserved
  • Viewer-role user sees disabled Generate/Download/Copy buttons (engineer access required)

🤖 Generated with Claude Code

## Summary **Phase 1 — Backend (original PR scope):** - Adds `ScriptCategory`, `ScriptTemplate`, `ScriptGeneration` SQLAlchemy models with UUID PKs and timezone-aware datetimes - Implements `ScriptTemplateEngine` — a Jinja2-style PowerShell template engine with parameter substitution, `as_secure_string`/`as_array`/`as_bool` filters, `{% if %}` conditionals, and PowerShell-safe string escaping - 8 REST endpoints under `/scripts/`: categories, template CRUD (team_admin+), generation, generation history - Migration 057 creates tables + seeds 1 Active Directory category with 6 AD User Management templates - 15 unit tests for the template engine + 12 integration tests for the API (all passing) **Phase 2 — Frontend Script Library:** - Script Library page at `/scripts` with filter bar (category tabs + debounced search), template list, and script preview - All 7 field types: text, number, boolean, select, multi-select, password, textarea - Live parameter substitution preview via `ScriptPreview` + `PowerShellHighlighter` **Phase 2.5 — Left Pane Takeover UX Redesign:** - Browse mode: template list with "Configure →" button on each card; filter bar inside left pane column - Configure mode: full left-pane takeover with template header, param form, and action bar (Generate, Download .ps1, Copy) - Right pane is now read-only `ScriptPreview` — always visible, no form or buttons - Filter/search state preserved across Browse ↔ Configure transitions - `ScriptGeneratorPanel` deleted; replaced by `ScriptConfigurePane` + right-pane simplification ## Test Plan - [ ] Run `pytest tests/test_script_template_engine.py tests/test_scripts.py -v` — all 27 tests pass - [ ] Navigate to `/scripts` — Script Library loads with category filter tabs and template list - [ ] Click "Configure →" on a template — left pane transitions to configure mode, filter bar hides, template header appears - [ ] Fill in params — right pane preview updates live with substituted values - [ ] Click "Generate Script" — generated script appears in right pane - [ ] Download .ps1 and Copy buttons activate after generation - [ ] "← Back to library" returns to browse mode with search/filter state preserved - [ ] Viewer-role user sees disabled Generate/Download/Copy buttons (engineer access required) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
railway-app[bot] commented 2026-03-13 04:33:17 +00:00 (Migrated from github.com)

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

Service Status Web Updated (UTC)
hopeful-liberation Success (View Logs) Web Mar 14, 2026 at 11:43 pm
patherly Success (View Logs) Web Mar 14, 2026 at 11:42 pm
<!-- railway-bot-comment-version=2 --> <!-- railway-project-id="22b9b58c-271b-42e5-a10e-6fdec8d00134" railway-project-name="selfless-grace" --> 🚅 Deployed to the [patherly-pr-105](https://railway.com/project/22b9b58c-271b-42e5-a10e-6fdec8d00134?environmentId=669580f6-1f68-4ecc-9728-9f3fceb36693) environment in **[selfless-grace](https://railway.com/project/22b9b58c-271b-42e5-a10e-6fdec8d00134)** | **Service** | **Status** | **Web** | **Updated** (UTC) | | :--- | :--- | :--- | :--- | | hopeful-liberation | ✅ Success ([View Logs](https://railway.com/project/22b9b58c-271b-42e5-a10e-6fdec8d00134/service/e1db2ee3-d241-4f45-abe4-c9c5fdf483d5?id=44127aad-a953-4ffa-a7b5-77c22c0f4f87&environmentId=669580f6-1f68-4ecc-9728-9f3fceb36693)) | [Web](https://hopeful-liberation-patherly-pr-105.up.railway.app) | Mar 14, 2026 at 11:43 pm | | patherly | ✅ Success ([View Logs](https://railway.com/project/22b9b58c-271b-42e5-a10e-6fdec8d00134/service/95f556ff-5264-4116-a0c2-618a2fc53ba4?id=0963760b-94e5-4fcf-8cba-44f4178fd608&environmentId=669580f6-1f68-4ecc-9728-9f3fceb36693)) | [Web](https://patherly-patherly-pr-105.up.railway.app) | Mar 14, 2026 at 11:42 pm |
Sign in to join this conversation.