Commit Graph

189 Commits

Author SHA1 Message Date
Michael Chihlas
5f7a85db03 feat: add script template permission checks to usePermissions hook
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:44:07 -04:00
Michael Chihlas
f408be29e6 feat: add CRUD and share methods to scriptsApi client
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:44:04 -04:00
Michael Chihlas
0092b15237 feat: add created_by and create/update request types for script templates
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:44:01 -04:00
chihlasm
1d280a5c78 fix: address code review feedback on pane takeover
- Remove leftover text-left on TemplateCard div (was from button era)
- Use warning text as React key instead of array index

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 12:41:48 -04:00
chihlasm
87a5988fc3 chore: update stale comment in scriptGeneratorStore
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 12:39:15 -04:00
chihlasm
bcca095bdf feat: delete ScriptGeneratorPanel — superseded by ScriptConfigurePane
The right pane is now ScriptPreview-only. Generate/Download/Copy controls
moved to ScriptConfigurePane in the left pane (configure mode).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 12:38:31 -04:00
chihlasm
16c0132b02 feat: rewrite ScriptLibraryPage with Browse/Configure pane modes
- Add paneMode state ('browse' | 'configure') local to page
- Move ScriptFilterBar inside left pane column (hidden in configure mode)
- inputValue owned at page level to survive mode transitions
- Left pane: ScriptFilterBar + ScriptTemplateList in browse; ScriptConfigurePane in configure
- Right pane: ScriptPreview only (read-only); empty state when no template selected
- canGenerate derived from usePermissions().isEngineer (matching ScriptGeneratorPanel pattern)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 12:38:05 -04:00
chihlasm
da86136ef3 fix: update ScriptConfigurePane elevation badge and separator per spec
- Replace unicode ⚠ with ShieldAlert icon in elevation badge
- Fix separator spacing: mb-4 → mt-3 pt-3 per spec

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 12:35:44 -04:00
chihlasm
93f332e027 feat: add ScriptConfigurePane — configure mode layout
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 12:32:39 -04:00
chihlasm
cad9dc83bd refactor: ScriptTemplateList — add onConfigure prop threading
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 12:30:13 -04:00
chihlasm
40ebd2b200 refactor: TemplateCard — remove store subscription, add Configure button
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 12:29:45 -04:00
chihlasm
844b792bc2 fix: remove redundant wrapper div in password field
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:48:30 -04:00
chihlasm
64b02159e0 fix: wire error prop to Input/Textarea components and eliminate duplicate loadTemplates on mount
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:47:23 -04:00
chihlasm
f988d70bca feat: add /scripts route and Script Library nav entry
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:41:19 -04:00
chihlasm
a5d7d56199 feat: add ScriptLibraryPage shell
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:40:38 -04:00
chihlasm
361ffabe57 fix: attach anchor to document before click for Firefox download compatibility
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:39:57 -04:00
chihlasm
8cadc5b1b3 feat: add ScriptGeneratorPanel with permission gating
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:37:15 -04:00
chihlasm
2548a81549 fix: replace non-standard Tailwind opacity /12 with rgba in ScriptFilterBar
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:35:48 -04:00
chihlasm
4269aea015 fix: loadCategories error handling and invalid Tailwind opacity fractions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:34:03 -04:00
chihlasm
69404e0e12 fix: help_text ordering and Input component usage in scripts components
- ScriptParameterField: extract error <p> from select/boolean input blocks and remove error prop from Input/Textarea components so all types render help_text before error via unified bottom rendering
- ScriptFilterBar: replace native <input> with shared <Input> component from @/components/ui/Input, preserving search icon via absolute positioning wrapper

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:18:13 -04:00
chihlasm
43bccf9af1 feat: add ScriptFilterBar with category tabs and debounced search
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:11:11 -04:00
chihlasm
dd36f335de feat: add ScriptTemplateList with skeleton and empty states
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:10:46 -04:00
chihlasm
19fde445fe feat: add TemplateCard component
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:10:25 -04:00
chihlasm
20fabe48a5 feat: add ScriptParameterForm with parameter grouping
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:09:59 -04:00
chihlasm
cb51940cdb feat: add ScriptParameterField — all 7 field types
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:09:35 -04:00
chihlasm
86a9d3b977 feat: add ScriptPreview with live substitution and copy
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:09:15 -04:00
chihlasm
a88b9c5483 feat: add PowerShellHighlighter syntax highlighter
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:09:01 -04:00
chihlasm
054f3acd67 fix: reset loading flags on error in scriptGeneratorStore
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:06:06 -04:00
chihlasm
9d10aa90ad feat: add scriptGeneratorStore Zustand store
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:01:02 -04:00
chihlasm
b1c39f52be feat: add scriptsApi client
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 01:56:53 -04:00
chihlasm
9631f6f474 feat: add script generator TypeScript types
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 01:53:26 -04:00
chihlasm
83b13fcd26 polish: use 'step' instead of 'node' in procedural editor validation hints
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 23:32:52 -04:00
chihlasm
45fb468db3 feat: add validation summary and Fix with AI to procedural editor
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 23:32:52 -04:00
chihlasm
f9315d2f60 feat: add data-step-id anchor to StepList for validation scroll-to
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 23:32:52 -04:00
chihlasm
b89d0859d4 feat: add validation state and validate() to proceduralEditorStore
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 23:32:52 -04:00
chihlasm
b804c63754 fix: validation summary click-to-select now opens node editor panel
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 23:32:52 -04:00
Michael Chihlas
cfe112ac43 docs: add landing page assets and polish landing CSS
Add landing page .docx export, HTML mockup, docx generator script,
and refine landing page CSS formatting/spacing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 17:28:49 -04:00
chihlasm
042a12b190 feat: add landing page with beta signup + raise KB node limit to 100
Landing page at /landing with full marketing content: hero, features,
pricing, testimonials, and beta email signup form. Beta signups email
beta@resolutionflow.com via new public endpoint. Unauthenticated users
redirect to landing instead of login. Also raises KB Accelerator node
limit from 50 to 100 to accommodate dense troubleshooting articles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 00:23:29 -04:00
chihlasm
92c86cab80 fix: handle object-shaped validation errors in KB commit error toast
The commit endpoint returns {message, validation_errors} when
validation fails, but the error handler was passing the whole object
to toast.error(), crashing React with "Objects are not valid as a
React child".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 23:56:45 -04:00
chihlasm
fe3c651115 fix: remove "Let AI Decide" option from KB Accelerator upload
The uploader should know their content type — auto-detection adds
complexity and currently just defaults to troubleshooting anyway.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 22:56:40 -04:00
Michael Chihlas
c920e825c6 fix: auto-reload on chunk load errors in ErrorBoundary
RouteError already handled stale chunk errors, but the Sentry ErrorBoundary
didn't — so errors from React lazy() imports hit the generic error UI.
Now auto-reloads with loop prevention (10s cooldown via sessionStorage).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 03:17:24 -04:00
Michael Chihlas
a976f16575 fix: session closure popover z-index — bypass stagger-item stacking context
The StaggerList wrapper creates per-item stacking contexts via CSS animation,
causing the absolute-positioned close popover to render behind sibling cards.
Replace StaggerList with inline stagger-item rendering so we can apply z-50
directly to the stagger-item wrapper when its popover is open.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 03:09:17 -04:00
Michael Chihlas
8b3033ca9d fix: tree navigation root ID + session closure popover z-index
- TreeNavigationPage: initialize currentNodeId from tree_structure.id
  instead of hardcoded 'root' — fixes "Invalid tree structure" for trees
  with non-'root' root IDs (KB Accelerator, AI Flow Builder)
- SessionHistoryPage: add relative z-10 to session card when close
  popover is open so it renders above sibling cards

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 02:54:00 -04:00
Michael Chihlas
416bb230e3 feat: close sessions from history page with inline popover
Add ability to close active sessions directly from the Session History
page via an inline popover with outcome selection and optional notes.
Adds two new outcomes: cancelled and resolved_externally.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 01:59:12 -04:00
Michael Chihlas
91d2bc6df3 fix: KB Accelerator tree builder, approve all, canvas delete button
- Fix _build_troubleshooting_tree() to handle deep nesting, warning nodes,
  and DAG deduplication (placed set prevents duplicate IDs)
- Fix step_sync VARCHAR(255) overflow on publish by truncating title
- Add "Approve All" button to KB review screen
- Add delete button (hover-reveal) to flow canvas nodes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 01:59:03 -04:00
Michael Chihlas
71ff4a8c35 feat: KB Accelerator — convert KB articles into interactive flows
Full-stack implementation of the KB Accelerator feature that converts
static MSP knowledge base articles into interactive troubleshooting
and procedural flows using AI.

Backend:
- Migrations 054/055: kb_imports, kb_import_nodes tables + plan_limits KB columns
- SQLAlchemy models with relationships and self-referential node hierarchy
- Text extraction service (txt, paste, docx with structural metadata)
- AI conversion service with MSP-specialist prompts for both flow types
- 8 API endpoints: upload, get, list, convert, edit node, commit, delete, quota
- Tier-gated access via plan_limits (free: 3 lifetime, pro/team: unlimited)
- 8 integration tests covering upload, get/list, quota, commit, delete

Frontend:
- TypeScript types and API client for all KB Accelerator endpoints
- Multi-step wizard page: upload → processing → review → success
- Upload screen with paste/file tabs, drag-drop, target type selector
- Two-panel review screen with source highlighting and node cards
- Per-node actions: approve, edit, regenerate, insert, delete
- Confidence color indicators (green/amber/red)
- Sidebar navigation with Sparkles icon
- Code-split lazy-loaded route at /kb-accelerator

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 20:56:28 -04:00
Michael Chihlas
9eed8ab848 chore: remove Sentry verification error from frontend
The test error was firing on every production page load — no longer needed
now that Sentry is confirmed working.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 09:57:41 -04:00
chihlasm
ccd06c9ed4 feat: flexible intake — deferred variables + prepared sessions (#103)
* feat: flexible intake — deferred variables + prepared sessions

Remove blocking intake form modal. Variables are now filled inline during
flow execution or pre-filled via prepared sessions. Adds PATCH /sessions/{id}/variables
endpoint, POST /sessions/prepare for session pre-staging, inline variable prompts
in StepDetail, editable Session Variables panel, and "Prepared for You" dashboard section.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: pass treeData directly to startSession to avoid stale state

setTree(treeData) hasn't committed when startSession runs immediately
after, so tree is still null and getStepsFromTree returns []. This
caused the step detail area to render empty on new session start.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: wire PrepareSessionModal entry point in Flow Library

Add "Prepare session" button (clipboard icon) to grid, list, and table
views for procedural/maintenance flows. Clicking fetches tree intake
fields and account members, then opens PrepareSessionModal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 09:49:51 -04:00
chihlasm
4727106141 fix: race condition hardening across auth, counters, and data fetching (#102)
* fix: prevent race conditions in token operations and auth flows

Backend:
- Refresh token rotation: use atomic UPDATE...WHERE revoked_at IS NULL
  to prevent concurrent refresh requests from both succeeding
- Account invite codes: SELECT FOR UPDATE to prevent double-spend
- Platform invite codes: SELECT FOR UPDATE to prevent double-spend
- Password reset tokens: SELECT FOR UPDATE to prevent double-use
- Email verification tokens: SELECT FOR UPDATE to prevent double-use

Frontend:
- Token refresh subscriber arrays: swap before iterating so a throwing
  callback doesn't leave the queue in a dirty state

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: atomic counters, plan limit re-check, and double-submit guard

Backend:
- Tree usage_count: use SQL-level UPDATE (Tree.usage_count + 1) instead
  of Python-level increment to prevent lost updates under concurrency
- Tag usage_count: same SQL-level atomic increment/decrement in both
  create_tree and update_tree (delete_tree already used this pattern)
- Plan tree limit: re-check count after db.flush() to close the TOCTOU
  window where two concurrent creates could both pass the pre-check

Frontend:
- TreeEditorPage: add isSaving early-return guard inside handleSaveDraft
  and handlePublish callbacks so Ctrl+S can't bypass the button disabled
  prop and fire duplicate save requests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: prevent stale API responses from overwriting newer data

- SessionHistoryPage: move loadSessions into effect with cancelled flag
  so rapid filter/tab changes discard outdated responses
- TreeLibraryPage: add request ID ref to loadTrees so stale responses
  from previous filter selections are discarded
- QuickStartPage: add request ID ref to debounced search so out-of-order
  responses don't overwrite newer search results

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add flexible intake design — deferred variables + prepared sessions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 01:57:22 -04:00
chihlasm
5095b0d8df refactor: adopt shared Input/Textarea components (#101)
* refactor: adopt shared Input/Textarea components across 15 files

Replace 42 raw <input>/<textarea> elements with <Input>/<Textarea>
from components/ui/. Consistent focus states, error handling, and
styling across all form fields.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: replace hardcoded rgba/hex colors with Tailwind tokens

- rgba(255,255,255,0.xx) → bg-white/[0.xx], border-white/[0.xx]
- rgba(6,182,212,0.3) → border-primary/30 (focus states)
- #0a0a0a → bg-background
- Inline style hex colors → var(--color-primary), var(--color-brand-gradient-to)
- 28 files updated, zero hardcoded rgba() patterns remaining

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: add PageMeta to 16 pages for SEO and proper browser tab titles

Public pages (Login, Register, Forgot/Reset Password, Verify Email,
Survey Thank You) get descriptions for SEO. Authenticated pages
(Dashboard, Flow Library, My Flows, Session History, AI Assistant,
Account Settings, Step Library, My Shares, Feedback, Guides) get
proper tab titles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: add page transitions and staggered list animations

- ViewTransitionOutlet: wraps Outlet with fade-in-up animation keyed
  to route path. Sidebar/topbar stay still, only content area animates.
- StaggerList: reusable component that cascades children with
  incremental delay (50ms default). Pure CSS via @utility stagger-item.
- Applied stagger to TreeGridView, MyTreesPage cards, SessionHistoryPage.
- New stagger-fade-in keyframe in @theme block.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: ViewTransitionOutlet needs h-full for React Flow canvas

The wrapper div broke the height chain needed by TreeEditorPage's
h-full layout, causing React Flow canvas to collapse to zero height.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: main-content flex layout for tree editor + scrollable pages

Main content area is now flex-col so the ViewTransitionOutlet wrapper
gets an explicit computed height via flex-1 min-h-0. This makes h-full
resolve correctly in the tree editor (React Flow canvas) while still
allowing overflow-y-auto scrolling for normal pages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: resolve ESLint errors in Button and Skeleton components

- Button: suppress react-refresh/only-export-components for buttonVariants re-export
- Skeleton: replace empty interface with type alias, replace Math.random() with static widths array

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: add PageMeta, animation classes, and layout fixes to remaining pages

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 16:12:21 -04:00