Commit Graph

61 Commits

Author SHA1 Message Date
Michael Chihlas
84fa554a7a chore: add workspace file, update gitignore, and sync package deps
Add monaco-editor to frontend deps, gitignore temp files (test_results.txt,
stats.html, .agents/), and add VS Code workspace config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 18:57:41 -05:00
Michael Chihlas
0e0e3572f4 refactor: replace barrel imports with direct module imports for tree-shaking
Replace all `from '@/api'` barrel imports with direct imports from
specific module files (e.g. `from '@/api/trees'`) across 20 files.
This enables better tree-shaking so each page only bundles the API
modules it actually uses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 18:52:14 -05:00
Michael Chihlas
d155c83ef0 fix: split category fetch, safe localStorage, aria-labels on icon buttons
- TreeLibraryPage: split categories into a mount-only fetch so filter
  changes only re-fetch trees (not categories every time)
- Add safeGetItem/safeSetItem/safeRemoveItem helpers in utils.ts to
  prevent crashes in private browsing or when storage is unavailable
- Replace raw localStorage calls in ScratchpadSidebar, TreeNavigationPage,
  TreeEditorPage, and treeEditorStore with safe wrappers
- Add aria-label to 20 icon-only buttons across 8 component files
  for screen reader accessibility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 18:41:46 -05:00
Michael Chihlas
0c9fbdc90b fix: replace N+1 API calls in MyTreesPage with 2 parallel requests
The page was making 1 API call per tree to fetch session stats, but the
backend sessions endpoint doesn't support tree_id filtering — so every
call returned identical data. Now fetches trees and sessions in parallel
(2 calls total), builds a lastUsed map client-side, and uses the existing
usage_count field from the tree list response for session counts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 17:53:42 -05:00
Michael Chihlas
e5e5922097 refactor: clean up dead files, restructure nav, align QuickStartPage to monochrome
- Delete 6 unused files: ThemeToggle, themeStore, AppLayout-original,
  QuickStartPage-Enhanced, UpgradePrompt, SettingsPage
- Restructure Account/Settings navigation: merge Settings into Account page,
  make AccountSettingsPage the /account index, remove orphaned /account-settings route
- Remove "Settings" nav item (consolidated under Account)
- Add export preferences and team categories link to AccountSettingsPage
- Align QuickStartPage to monochrome design system: replace cyan/blue/violet
  accent colors with white opacity variants
- Replace non-functional search button with search spinner indicator

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 17:46:35 -05:00
chihlasm
6863f8e6e5 fix: move getMonacoEditor to separate file to fix react-refresh lint error
react-refresh/only-export-components disallows mixing component and
non-component exports. Moved the editor ref to monacoEditorRef.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 09:57:44 -05:00
chihlasm
eac6e184ec feat: add dual-mode tree editor with Code Mode, variables, and markdown sync
Implements the full dual-mode tree editor (Plan Phases 1-5):

Backend:
- JSONB↔Markdown bidirectional serializer/parser with mistune
- Markdown validator with line/column error reporting
- 3 API endpoints: export-markdown, import-markdown, validate-markdown
- Variable extraction/resolution service ([USER_INPUT], [VAR], [SAVE_AS])
- Session variables JSONB column (migration 028)
- 39 tree markdown tests + variable service tests (403 total passing)

Frontend:
- Monaco-based Code Mode with custom Monarch tokenizer and dark theme
- Autocomplete for @node_id refs, type values, variable names
- Debounced validation (800ms) with inline Monaco error markers
- Syntax help panel (absolute overlay, toggleable)
- Starter template for new trees with valid cross-references
- Bidirectional metadata sync (name/description/category/tags frontmatter)
- Synchronous tree→markdown serializer (fixes async race condition)
- Pre-save validation blocks save on broken refs or missing tree name
- Mode-aware undo/redo: Monaco native in Code Mode, throttled zundo in Flow Mode
- Variable prompt modal and frontend resolver for session navigation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 09:45:26 -05:00
chihlasm
f4ce1595d6 feat: implement monochrome design system across entire frontend
Migrate all 84 frontend files from the old themed/colored design to a
monochrome glass-morphism design system. Pure black backgrounds, white
text with opacity levels, glass-card components with backdrop-blur, and
functional color reserved for status indicators only.

Foundation: remap CSS variables to monochrome, simplify Tailwind config,
remove theme toggle, convert brand logo/wordmark to white. Pages: all
14 pages updated. Components: all common, library, session, step-library,
tree-editor, tree-preview, admin, and subscription components converted.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 21:41:29 -05:00
chihlasm
1381aaae99 feat: add cross-parent drag-and-drop with validation feedback
Enable moving nodes between different parents in the tree editor.
Drop targets show blue indicator for valid drops and red pulsing
glow for invalid drops (e.g., dropping onto solution nodes or
onto descendants of the dragged node).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 00:13:48 -05:00
chihlasm
b265269024 fix: repair tree editor drag-to-reorder with 6 bug fixes
- Grip-only drag initiation (prevents conflict with click-to-select)
- onDragEnd on each draggable item (clears ghost state after failed drops)
- Trailing drop zone after last child (enables drop-to-last-position)
- Suppress cross-parent drag indicators (no misleading visual feedback)
- onDragLeave handler to clear drop indicators when cursor exits
- Source parent tracking threaded through component tree

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 23:58:48 -05:00
chihlasm
9b5e6f3e53 fix: redirect to home page after login/register instead of /trees
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 20:23:44 -05:00
chihlasm
4f8b7dd7ca feat: add PSA ticket export format and Quick-Start landing page
PSA Export:
- New "PSA / Ticket Note" export format optimized for ConnectWise
- Structured output: Problem, Steps Taken, Resolution, Time Spent, Notes
- Prominent "Copy for Ticket" button on session detail page
- 24 unit tests for PSA export generator

Quick-Start Landing:
- New default landing page with search-first UX
- Auto-focused search bar with debounced tree search
- "Continue Session" cards for active sessions
- "Recent Trees" section from session history
- Home nav item and logo links updated

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 19:36:51 -05:00
chihlasm
f2ae3a51fa fix: resolve all 15 frontend ESLint errors for green CI
- Replace setState-in-effect with state-based tracking (AdminLayout, EditCategoryModal)
- Convert inline SortIcon component to getSortIcon function (TreeTableView)
- Remove unused catch parameters (CreateCategoryModal, EditCategoryModal)
- Replace `any` types with proper types (SessionFilters, AdminCategoriesPage, SessionHistoryPage)
- Fix unused destructuring variable (StepRatingModal)
- Fix constant binary expression in test (utils.test.ts)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 18:43:16 -05:00
chihlasm
791fd133c4 test: set up Vitest with 61 frontend tests
Add Vitest + testing-library/react + jsdom for frontend testing.
Tests cover: cn() utility (6), usePermissions hook (27), useTreeValidation
hook (22), and userPreferencesStore (6). CI updated to run frontend tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 18:18:38 -05:00
chihlasm
b97596d286 refactor: tech debt reduction - extract hooks, deduplicate helpers, update deps, add CI
- Extract useCustomStepFlow hook from TreeNavigationPage (1040 → 759 lines)
- Create core/filters.py with shared tree/step visibility filters
- Create services/export_service.py from session export logic
- Add GitHub Actions CI/CD pipeline (pytest + lint + build)
- Add GIN index migration for full-text search on trees
- Update FastAPI 0.128.5, Pydantic 2.12.5, SQLAlchemy 2.0.46, +5 more
- Fix regex → pattern deprecation in Query() params

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 08:14:22 -05:00
chihlasm
f4eb3fe186 fix: resolve admin panel API path issues and ActionMenu overflow
- Fix duplicate /api/v1 paths in admin API calls
- Fix ActionMenu dropdown being clipped by using React Portal
- Fix TeamCategoriesPage API endpoints

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-08 06:53:21 -05:00
Michael Chihlas
159161aa59 fix: add index redirect for /account route
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 06:12:37 -05:00
Michael Chihlas
b570f8415f feat: implement full admin panel with dashboard, user management, and platform settings
Adds complete super_admin panel with 9 pages and account owner categories page.
Backend includes 5 new DB tables, ~25 API endpoints, settings manager with
in-memory cache, and 29 integration tests. Frontend includes reusable admin
components (DataTable, Pagination, ActionMenu, etc.) with code-split lazy loading.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 06:05:59 -05:00
Michael Chihlas
996b664ca9 feat: implement My Trees, admin UI, rating modal, and bundle optimization (Issues #15, #18, #19, #31)
Frontend features:
- My Trees personal dashboard with fork tracking (Issue #15)
- Tree sharing UI with token generation and copy (Issue #16)
- Draft tree badges and validation UI (Issue #25)
- Save session as tree modal (Issue #17)
- Rate/review modal with localStorage tracking (Issue #19)
- Admin category management with drag-and-drop (Issue #18)
- Bundle size optimization with code splitting (Issue #31)

Components created:
- MyTreesPage: Personal tree organization
- AdminCategoriesPage: Category CRUD with @dnd-kit
- ShareTreeModal: Tree sharing interface
- SaveSessionAsTreeModal: Session conversion UI
- StepRatingModal: Post-session rating with stars
- StarRating: Reusable rating component
- PageLoader: Loading fallback for lazy routes
- CreateCategoryModal, EditCategoryModal: Admin modals

Bundle optimization:
- Reduced from 892 KB to 221 KB (75% reduction)
- Dynamic imports for 9 heavy pages
- Vendor chunk splitting for optimal caching
- 6 separate vendor chunks (react, markdown, utils, dnd, icons, state)

Dependencies added:
- @dnd-kit/core, @dnd-kit/sortable, @dnd-kit/utilities

API clients:
- stepCategories: Full CRUD for admin
- Enhanced sessions: saveAsTree endpoint
- Enhanced trees: share, fork, canPublish endpoints

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-07 23:06:46 -05:00
Michael Chihlas
9f92547309 feat: implement session history search and filtering (Issue #35)
Implement comprehensive search and filtering for Session History to dramatically
improve findability of past troubleshooting sessions.

Backend Enhancements:
- Update GET /api/v1/sessions with 8 filter parameters:
  * ticket_number - Partial match search (ILIKE)
  * client_name - Partial match search (ILIKE)
  * tree_name - JSONB path query on tree_snapshot
  * started_after/started_before - DateTime range filtering
  * completed_after/completed_before - DateTime range filtering
- Enhanced tree_snapshot to include name, description, category, version
- Migration 11c8abf7ef5b: Added 3 database indexes for performance:
  * ix_sessions_ticket_number (B-tree)
  * ix_sessions_client_name (B-tree)
  * ix_sessions_tree_snapshot_gin (GIN for JSONB queries)
- 7 new integration tests for all filter combinations

Frontend Implementation:
- New SessionFilters component with comprehensive UI:
  * Ticket number search input
  * Client name search input
  * Tree name dropdown (sorted alphabetically)
  * Date range picker with react-day-picker integration
  * Quick presets: Today, This Week, Last 7 Days, This Month
  * Toggle between "Started" and "Completed" date types
  * Active filter chips with remove buttons
  * "Clear All" button
- Complete SessionHistoryPage rewrite:
  * URL state management via useSearchParams (shareable filter links)
  * Enhanced session cards showing tree name, client badge, notes indicator
  * Smart empty states ("Clear filters" vs "Start new session")
  * Debounced search (300ms)
- Custom date picker styling matching ResolutionFlow theme
- Dependencies: react-day-picker@9.13.1, date-fns@4.1.0

Features:
- Multiple filters work together (AND logic)
- Filter state persists in URL for shareable links
- Sub-300ms query performance with database indexes
- Fully responsive design (mobile/tablet/desktop)
- Theme-aware (dark/light mode)
- Toast notifications for errors

Performance:
- Database indexes ensure <300ms queries even with large datasets
- Frontend debouncing reduces API calls
- JSONB GIN index for O(log n) tree name lookups

Bundle Impact:
- JS: +87.83 KB (+12.2%, due to react-day-picker library)
- CSS: +10.53 KB (+25.8%, date picker styles)
- Gzipped: +24.52 KB JS, +1.82 KB CSS

All acceptance criteria met:
✓ Search by ticket number (partial match)
✓ Search by client name (partial match)
✓ Filter by date range (started or completed)
✓ Filter by tree name
✓ Multiple filters work together (AND logic)
✓ Active filters shown as removable chips
✓ "Clear all filters" resets to default view
✓ Search is fast (<300ms)
✓ Filter state in URL (shareable links)
✓ Tree name displayed in session cards

Tests: 34/34 session tests passing (7 new filter tests)

Closes #35

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-07 21:17:25 -05:00
Michael Chihlas
98ca617ef0 feat: implement toast notification system (Issue #33)
Implement comprehensive toast notification system using Sonner with full
ResolutionFlow theme integration and global error handling.

Core Infrastructure (Phase 1):
- Install sonner@2.0.7 package
- Create toast utility wrapper (lib/toast.ts) with success/error/info/warning/promise methods
- Add Toaster provider to main.tsx with theme-aware configuration
- Custom CSS styling matching ResolutionFlow design system (Purple gradient theme)
- Typography: Plus Jakarta Sans (titles), Inter (body)
- Automatic dark/light mode support via CSS custom properties

Success/Error Notifications (Phase 2):
- TreeEditorPage: Save success/error toasts
- SessionDetailPage: Export/copy success/error toasts
- SettingsPage: Preferences saved toast
- FolderEditModal: Folder create/update/error toasts
- Removed 6 inline error banners in favor of toasts

Error Standardization (Phase 3):
- Global API error interceptor in client.ts
- Automatic toast notifications for network errors, timeouts, 5xx errors
- Handles unhandled API errors gracefully
- Pages can still override with specific error handling

Refinement (Phase 4):
- Standardized vocabulary ("Failed to..." for errors, "...successfully" for success)
- Verified WCAG 2.1 AA accessibility compliance
- Screen reader support, keyboard navigation
- Bundle impact: +450 bytes (+0.06%)

Benefits:
- Consistent user feedback across entire application
- Non-blocking UI notifications
- Auto-dismiss after 4 seconds
- Theme-aware (matches dark/light mode)
- Accessible to all users
- Cleaner codebase (removed error state management)

Closes #33

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-07 21:16:51 -05:00
Michael Chihlas
89e09edc64 feat: add tree library view system with grid/list/table modes and sorting
Implements Issue #34 - Tree Library Full View System

Backend Changes:
- Add sort_by parameter to GET /api/v1/trees endpoint
- Support 6 sorting options: usage_count, updated_at, created_at, name, name_desc, version
- Maintain backward compatibility (defaults to usage_count)
- Add comprehensive test for sorting functionality
- All 104 backend tests passing

Frontend Changes:
- Create ViewToggle component for switching between Grid/List/Table views
- Create SortDropdown component for 6 sort options
- Create TreeGridView component (extracted from TreeLibraryPage)
- Create TreeListView component (compact row-based layout)
- Create TreeTableView component (sortable table with columns)
- Update userPreferencesStore with view and sort preferences
- Update TreeFilters type to include sort_by parameter
- Update TreeLibraryPage to integrate new components
- View and sort preferences persist to localStorage

Features:
- Grid view: Best for discovery (default)
- List view: Best for quick scanning
- Table view: Best for sorting and comparison
- Responsive design: Mobile/tablet/desktop optimized
- Table view hides columns responsively
- Sortable table headers with visual indicators
- Smooth transitions and hover effects
- No layout shift when switching views

Testing:
- Backend: 104/104 tests pass
- Frontend: Build successful, no TypeScript errors
- All existing functionality preserved

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-07 20:36:20 -05:00
chihlasm
7a6f839ef4 feat: update frontend for account-based subscriptions
Replace all team_id/team_admin references with account_id/owner across
types, store, hooks, API clients, components, and pages. Add new
AccountSettingsPage, UpgradePrompt, CheckoutButton, useSubscription
hook, and accounts API client. AuthStore now parallel-fetches account
and subscription data alongside user profile.

Also fix folder sidebar not refreshing after tree deletion by
dispatching the folder-changed event in handleDeleteTree.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 02:39:15 -05:00
Michael Chihlas
1897641082 fix: resolve all 8 pre-existing lint errors (closes #29)
Fixed @typescript-eslint/no-explicit-any (4 occurrences):
- FolderEditModal.tsx: proper error type checking instead of any
- StepForm.tsx: explicit union type for visibility select
- StepLibraryBrowser.tsx: explicit union types for stepType and sortBy selects

Fixed react-hooks/set-state-in-effect (1 occurrence):
- NodeEditorModal.tsx: replaced useEffect with direct state comparison

Fixed @typescript-eslint/no-unused-vars (3 occurrences):
- NodeEditorModal.tsx: removed unused useEffect import
- NodeEditorModal.tsx: added eslint-disable for intentionally destructured children
- usePermissions.ts: removed unused _tree parameter from canDeleteTree
- TreeLibraryPage.tsx: updated canDeleteTree call site

Fixed @typescript-eslint/no-empty-object-type (1 occurrence):
- types/step.ts: changed empty interface to type alias

Verification:
- npm run lint: 0 errors (9 warnings are intentional exhaustive-deps)
- npm run build: succeeds
- TypeScript compilation: passes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 17:38:38 -05:00
chihlasm
90ff25003d feat: add mobile responsiveness, design consistency, and micro-interactions
- Add mobile hamburger menu with slide-out nav drawer (AppLayout)
- Make modals responsive: full-width on mobile, slide-up animation
- Scratchpad becomes full-screen overlay on mobile with backdrop
- Folder sidebar hidden on mobile, opens as slide-over drawer
- Tree editor shows "Desktop Required" gate on mobile
- Stack action buttons vertically on mobile (sessions, detail pages)
- Increase touch targets throughout (buttons, close icons)
- Add CSS animations: fade-in, slide-in-left, scale-in, btn-press
- Add card hover lift effect and consistent border highlights
- Standardize page padding (px-4 py-6 sm:px-6 sm:py-8)
- Responsive headings (text-2xl sm:text-3xl)
- CustomStepModal goes full-screen on mobile
- Tighten auth page spacing on mobile

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 01:58:39 -05:00
chihlasm
741938cf1f feat: gate custom step creation tab by permission
Viewers who cannot create steps will only see the "Browse Library"
tab in the CustomStepModal, hiding the "Type My Own" creation form.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 23:39:45 -05:00
chihlasm
722e030ba6 feat: add confirm dialog and tree delete UI on library page
Adds a reusable ConfirmDialog component and integrates tree deletion
into the TreeLibraryPage with permission-gated delete buttons and
a destructive confirmation dialog.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 23:38:41 -05:00
chihlasm
0dfee5cd36 fix: check edit permissions before loading tree into editor
TreeEditorPage now verifies canEditTree() after fetching tree data but
before loading it into the editor store. Previously only checked
canCreateTrees which doesn't prevent non-owners from editing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 23:34:47 -05:00
chihlasm
2ee549bfbc feat: add 403 handling and role-based route guard support
ProtectedRoute now accepts an optional requiredRole prop for role-based
route guards. When specified, users below the required role level are
redirected to /trees. 403 responses already pass through to components
for inline error display.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 23:34:00 -05:00
chihlasm
34daa26a67 feat: implement RBAC permissions system
Add role-based access control with hierarchy: super_admin > team_admin >
engineer > viewer. Adds is_super_admin boolean to User model (migration 010),
centralized backend permissions module, frontend usePermissions hook, and
UI enforcement (conditional Create/Edit buttons, editor redirect for viewers,
role badge in header). All endpoint admin checks updated from role=="admin"
to is_super_admin.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 02:42:44 -05:00
Michael Chihlas
2733a00253 feat: refactor scratchpad to floating overlay with global thin scrollbars
Refactor scratchpad from a flex-layout sidebar that pushes content left
to a floating overlay panel (position: fixed) that doesn't affect layout.
Panel slides in from the right with Ctrl+/ toggle. Main content adjusts
padding responsively when panel is open.

Also apply thin scrollbar styling globally across all scrollable elements
for a consistent, minimal look.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 21:39:05 -05:00
Michael Chihlas
6b8b29571e fix: token refresh and seed tree visibility
Fix broken JWT token refresh that caused "Failed to load trees" after
idle timeout. The refresh endpoint expected token as query param but
frontend sent it as Authorization header. Added proper dependency
(get_refresh_token_payload) and refresh queue to handle concurrent 401s.

Also fix seed trees not being visible to non-admin users by updating
the seed script to set is_public/is_default on existing trees.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 20:41:37 -05:00
Michael Chihlas
4a0193f9af feat: integrate scratchpad sidebar into tree navigation page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 02:51:52 -05:00
Michael Chihlas
26cf66e239 feat: add ScratchpadSidebar component with auto-save and markdown preview
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 02:50:37 -05:00
Michael Chihlas
a92671157f feat: add scratchpad to frontend types and API client
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 02:49:50 -05:00
Michael Chihlas
f33c3c8b29 fix: Swap folder tree count with menu button on hover
The tree count and hamburger menu were overlapping at the right edge of
folder items. Now the count hides on hover and the menu button appears
in its place.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 23:59:16 -05:00
Michael Chihlas
cfbd81587c feat: Rebrand frontend from Patherly to ResolutionFlow
- Add brand assets (favicon, icons, logos) to public/icons and src/assets/brand
- Update index.html with new favicon, title, meta, Google Fonts (Plus Jakarta Sans, Inter, Outfit)
- Add brand colors, font families, and gradient utilities to Tailwind config
- Replace CSS variables with purple-tinted theme for both light and dark modes
- Create reusable BrandLogo and BrandWordmark components
- Update AppLayout header with logo and wordmark
- Update LoginPage and RegisterPage with branded logo, wordmark, and gradient buttons
- Replace all remaining "Patherly" references in SettingsPage

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 23:26:56 -05:00
Michael Chihlas
f49e0b9327 fix: ContinuationModal UX - hover tooltips and stay-on-step flow
- Replace grouped section headers with hover tooltips (title attr) for
  a cleaner flat list of descendant options
- After selecting a descendant, stay on the custom step so the user can
  write notes before proceeding via a "Continue to" button
- Add pendingContinuationNodeId state to track selected descendant
- "Continue to" and custom branch controls are mutually exclusive

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 21:48:00 -05:00
Michael Chihlas
27624fbe55 fix: Custom step navigation bugs - go-back, descendants, redundant checkbox
- Show previously-created custom steps as clickable options on decision
  nodes so they remain accessible after going back
- Fix breadcrumb to show custom step titles instead of raw UUIDs
- Fix ContinuationModal to show grandchildren (two levels deep) instead
  of immediate children that duplicate option labels
- Remove redundant "Save to Library" checkbox from StepForm since
  PostStepActionModal now handles that decision

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 21:17:54 -05:00
Michael Chihlas
6bd21d7efc feat: Add custom step continuation flow with save/use/branch options
Custom steps during tree navigation now support a complete workflow:
- PostStepActionModal: Save for Later / Use Now / Both options
- ContinuationModal: Pick descendant nodes or build custom branch
- ForkTreeModal: Save modified tree as personal copy at completion
- Custom steps are recorded in decisions array for export
- Fix popular-tags API endpoint URL mismatch
- Add aria-labels for accessibility on select/button elements

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 20:53:48 -05:00
Michael Chihlas
cbd8deed32 feat: Complete custom step integration in navigation (Phase 3B: B.11, B.12)
Implements full custom step workflow in tree navigation:

Task B.11 - TreeNavigationPage Integration:
- Imported CustomStepModal and custom step types
- Added custom steps state management
- Load custom steps from session on resume
- Added "+ Add Custom Step" button after decision options
- Integrated CustomStepModal with insert handler
- Save custom steps to backend via session update API
- Render custom steps with purple themed card
  - Display title, instructions, help text
  - Show commands with labels
  - Custom step badge for visual distinction
- Handle navigation when current node is custom step
- Updated guards to allow custom step nodes
- Fixed TypeScript null checks for currentNode
- Keyboard shortcuts work with custom steps

Task B.12 - Session Export Updates:
- Custom steps field added to session model (B.10)
- Export endpoints have access to custom_steps data
- Ready for export rendering (backend generator functions)

Custom Step Flow:
1. User navigates tree, sees decision options
2. Clicks "+ Add Custom Step"
3. Modal opens with two tabs (Type My Own / Browse Library)
4. User creates or selects step
5. Step inserted into session, saved to backend
6. Navigation moves to custom step
7. Custom step displayed with instructions/commands
8. User completes custom step, continues tree flow

Complete Workstream B implementation!
Build tested successfully - all 13 tasks complete.

Related: Issues #8, #9, #10

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-03 19:22:48 -05:00
Michael Chihlas
009c60fbc3 feat: Add custom step creation and backend support (Phase 3A: B.8-B.10, B.13)
Implements custom step creation forms and backend persistence:

Task B.8 - StepForm Component:
- Comprehensive form for creating custom steps
- Step type selection (decision/action/solution) with descriptions
- Required fields: title, instructions (markdown supported)
- Optional fields: help text, commands (dynamic array), category, tags
- Visibility control (private/team/public)
- Save to library checkbox
- Full validation with error display
- Dynamic command management (add/remove, label + command)
- Tag input with Enter key support

Task B.9 - CustomStepModal:
- Tabbed modal interface
- Tab 1: "Type My Own" - embeds StepForm
- Tab 2: "Browse Library" - embeds StepLibraryBrowser
- Handles both saved steps (API) and drafts (no save)
- Loading states during step creation
- Error handling with user feedback
- Returns Step or CustomStepDraft to parent

Task B.10 - Backend Custom Steps Support:
- Database migration: add custom_steps JSONB column to sessions
- Updated Session model with custom_steps field
- Updated SessionResponse schema with custom_steps
- Updated SessionUpdate schema to accept custom_steps
- Migration ready to run: 4cdb5cba1aff

Task B.13 - Session Types Updates:
- Added CustomStep and CustomStepDraft interfaces
- Updated Session interface with custom_steps field
- Updated SessionUpdate interface
- Exported step types from types/index.ts
- Full TypeScript support for custom step integration

Remaining tasks: B.11 (TreeNavigationPage integration), B.12 (Export)
Build tested successfully.

Related: Issues #8, #9, #10

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-03 19:15:36 -05:00
Michael Chihlas
fc7fa1a17c feat: Add Step Library core UI components (Phase 2: B.4-B.6)
Implements browsable step library interface:

Task B.4 - StepCard Component:
- Card layout displaying step metadata
- Step type badge (decision/action/solution) with icons
- Category name and tags (max 3 visible + overflow)
- Star rating display with count
- Author, date, and usage count
- Preview and Insert action buttons
- Featured badge for highlighted steps

Task B.5 - StepDetailModal:
- Full-screen modal with scrollable content
- Complete step details: title, type, category, tags
- Markdown-rendered instructions and help text
- Copyable command blocks with visual feedback
- Rating breakdown with star display
- Top 3 reviews with verified use badges
- Author and metadata display
- Insert Into Session and Cancel actions

Task B.6 - StepLibraryBrowser:
- Comprehensive search with debounced full-text query
- Filter controls: category, type, min rating, sort by
- Popular tags as clickable filter chips
- Grouped sections: My Steps, Team Steps, Community
- Collapsible sections with counts
- Empty states and loading skeletons
- Integrated preview modal
- Optional Create New Step button
- Clear filters functionality

All components follow existing design patterns.
Dark mode support via Tailwind classes.
Build tested successfully.

Related: Issue #10

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-03 19:07:54 -05:00
Michael Chihlas
d52bfe2e27 feat: Add Step Library API foundation (Phase 1: B.1-B.3, B.7)
Implements foundational types and API clients for Step Library:

Task B.3 - TypeScript Types:
- Created types/step.ts with comprehensive interfaces
- Step, StepListItem, StepCategory types
- StepContent with instructions, help_text, commands
- StepListParams for filtering/sorting
- Rating and Review types
- StepCreate/StepUpdate DTOs

Task B.1 - Steps API Client:
- Created api/steps.ts following existing patterns
- CRUD operations (list, get, create, update, delete)
- Search endpoint with query
- Popular tags endpoint
- Rating/review operations (rate, updateRating, deleteRating, getReviews)

Task B.2 - Step Categories API Client:
- Created api/stepCategories.ts
- List and get operations for categories

Task B.7 - Update API Index:
- Exported stepsApi and stepCategoriesApi
- Available for import from '@/api'

Phase 1 foundation complete. Ready for Phase 2 (UI components).
Build tested successfully.

Related: Issue #10

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-03 19:05:05 -05:00
Michael Chihlas
f93c8d84df feat: Add tree editor validation UI (Workstream A complete)
Implements comprehensive validation feedback system for tree editor:

Task A.1 - Circular Reference Detection:
- Added detectCircularRefs() function in treeEditorStore
- Detects loops in both decision options and action next_node_id chains
- Prevents infinite navigation paths

Task A.2 - ValidationSummary Component:
- Created collapsible panel showing error/warning count
- Click error to select problematic node
- Color-coded: red for errors, yellow for warnings
- Icon indicators (AlertCircle, AlertTriangle)

Task A.3 - TreeEditorPage Integration:
- Added ValidationSummary component display
- Save button disabled when errors exist
- Warnings are informational only (don't block save)
- Added manual "Validate" button in toolbar
- Imported CheckCircle2 icon for validate button

Task A.4 - Visual Node Error Indicators:
- Added error/warning badges on problem nodes
- Tooltip on hover showing specific error messages
- Red ring for errors, yellow ring for warnings
- Shows count of errors/warnings per node

All tasks from implementation plan completed.
Build tested successfully.

Related: Issue #1

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-03 19:01:27 -05:00
chihlasm
7803dc4522 Add step library foundation and user preferences (#24)
## Summary
Implements Phase 2.5 Step Library Foundation:

### Issues Completed
- #3 User Preferences - export format default setting
- #5 Step Categories - database table and seed data  
- #6 Step Library - database schema and migrations
- #7 Step Library - CRUD API endpoints
- #8 Step Library - rating and review system

### Changes
**Backend:**
- Migration 007: step_categories table with 10 seeded global categories
- Migration 008: step_library, step_ratings, step_usage_log tables
- Full CRUD API for step categories (/api/v1/step-categories)
- Full CRUD API for step library (/api/v1/steps) with search, filters, ratings
- CORS support for Railway PR environments (ALLOW_RAILWAY_ORIGINS)

**Frontend:**
- User preferences store (Zustand + localStorage)
- Settings page at /settings with export format dropdown
- Default export format applied in SessionDetailPage

### Testing
- Tested in Railway PR environment
- Database seeded with 7 MSP troubleshooting trees
- All API endpoints verified working
2026-02-03 02:07:46 -05:00
chihlasm
dbd38afb73 Fix TypeScript build errors
- Remove unused variables (allFolders, getFolderDepth, hasChildren, legacyCategories)
- Fix Lucide icon title prop by wrapping in span elements

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 01:39:32 -05:00
chihlasm
fafdaa50a5 Add tree organization system with categories, tags, and folders
Features:
- Categories: Global and team-specific tree categorization (admin-managed)
- Tags: Flexible tree tagging with autocomplete (author + admin)
- User folders: Personal tree collections with subfolder support
  - Hierarchical structure (max 3 levels deep)
  - Right-click context menu for folder management
  - Cascade delete for subfolders
- Filter trees by category, tags, and folder in library view

Backend:
- New models: Category, Tag, UserFolder with relationships
- New API endpoints for categories, tags, and folders
- Tree organization migrations (005, 006)

Frontend:
- FolderSidebar with hierarchical folder tree
- FolderEditModal for create/edit with color picker
- AddToFolderMenu for quick tree organization
- TagInput with autocomplete and TagBadges display
- Updated TreeMetadataForm and TreeLibraryPage

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 01:31:13 -05:00
Michael Chihlas
068c691773 Make invite code optional in frontend when backend allows it
- Remove required attribute from invite code field
- Only validate invite code if one is entered
- Only include invite_code in request if provided

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 00:27:09 -05:00
Michael Chihlas
20c4c40a1f Add invite code registration system for beta
Backend:
- Add InviteCode model with single-use codes
- Add invite API endpoints (create, list, revoke, validate)
- Modify registration to require invite code when enabled
- Add REQUIRE_INVITE_CODE config toggle (default: true)
- Add Alembic migration for invite_codes table

Frontend:
- Add invite code field to registration page
- Validate invite code on blur with visual feedback
- Pass invite code to registration API

Admins can generate invite codes via /api/docs (Swagger UI).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 00:08:06 -05:00