Commit Graph

178 Commits

Author SHA1 Message Date
chihlasm
ad59446332 feat: user management — admin create, password reset, archive/delete, quick invite
Phase 1: must_change_password enforcement + change password endpoint/page
Phase 2: Admin user creation (M365-style) with temp password
Phase 3: Password reset (self-service forgot + admin-triggered)
Phase 4: User archive (soft delete) + hard delete with precheck
Phase 5: Quick invite from admin Users page

Also fixes:
- Auto-create subscription for accounts missing one
- Hard delete precheck ignores sole-member personal accounts
- Seed script patches tree nodes for validation compliance

Migrations: 031 (must_change_password), 032 (password_reset_tokens), 033 (user soft delete)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 01:42:51 -05:00
chihlasm
577a2fbf2a feat: add command output capture to troubleshooting sessions (#57)
Engineers can now paste command output during action steps. Output is
stored in the session decisions JSONB, displayed in session review,
included in all 4 export formats with command context, and preserved
in session-to-tree conversions.

- Collapsible "Paste Output" textarea on action nodes with commands
- 10,000 character limit with live character count
- Works on both built-in and custom action steps
- Preloads output when revisiting a step via Go Back
- All exports show commands run alongside captured output

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 00:57:33 -05:00
chihlasm
3c47292eaf feat: add resend capability for platform and account invite codes
Revoke-and-recreate flow for both invite systems with email delivery
via Resend API. Includes account invite email template and audit logging.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 23:45:23 -05:00
Michael Chihlas
50cb0fc7f0 feat: admin invite codes with plan assignment + user detail page
- Migration 030: add email, assigned_plan, trial_duration_days, email_sent_at
  to invite_codes with CHECK constraints
- Resend email integration (graceful degradation when API key not set)
- Invite codes now support plan assignment (free/pro/team) and trial duration (1-90 days)
- Registration applies invite code plan/trial to new subscription
- Auto-downgrade expired trials on authenticated access
- Enriched GET /admin/users/{id} with account, subscription, sessions, audit logs
- New endpoints: PUT /admin/users/{id}/subscription/plan and extend-trial
- Frontend: enhanced invite codes page with email, plan, trial fields
- Frontend: new user detail page at /admin/users/:userId
- Fixed API path drift: /invite-codes -> /invites
- 11 new backend tests, 416 total passing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 21:42:58 -05:00
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
89d343d49a chore: archive 11 completed plan documents
Move completed design/implementation docs from docs/plans/ to docs/archive/
to keep the plans folder focused on active and future work.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 10:51:21 -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
d4acef5903 docs: add database migration strategy guide
Document the 31 migration files, naming conventions, revision chain,
circular FK workaround, NULL casting gotcha, and migration history table.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 17:48:38 -05:00
Michael Chihlas
4f57c84d43 docs: add comprehensive admin panel design document
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-08 01:54:09 -05:00
chihlasm
c8e7aaad1a Add foundational domain model design document
Comprehensive schema design for three critical foundational features:

1. Tree Forking Model (Issue #11)
   - Add parent_tree_id, fork_reason, parent_updated_at to trees
   - Self-referential relationship with orphaning on parent delete
   - Update detection mechanism for "parent tree updated" notifications

2. Session Custom Steps Enhancement (Issues #4-#7 partial)
   - Backward-compatible JSONB enhancement (no migration)
   - Track step source (ad-hoc, library, forked-tree)
   - Link to StepLibrary for usage analytics
   - Support "save session as tree" reconstruction

3. Session Share Tokens (Issue #15)
   - New session_shares table with token-based access
   - New session_share_views table for detailed analytics
   - Account-level policy: allow_public_shares
   - Public vs account-only visibility with permission checks

All schema changes designed for backward compatibility and minimal
migration complexity. Establishes durable domain model that future
features depend on.

Migration plan: 022 (tree forking), 023 (session sharing)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-07 17:46:32 -05:00
chihlasm
ff7894b977 Add UX enhancement design doc: notification system
Design document for Tier 1 UX enhancement implementing toast
notifications using sonner library.

- Comprehensive context on current state problems
- Phase-by-phase implementation plan
- Design patterns and best practices
- Complete verification checklist
- Risk assessment and mitigation strategies

Related: #33, #34, #35

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-07 13:53:14 -05:00
Michael Chihlas
fb84bd8144 docs: add subscription tier implementation plan
Comprehensive implementation plan for transitioning from team-based
to SaaS subscription model with Free/Pro/Team tiers:

- Phase 1 (Days 1-3): Database migration in 6 separate migrations
  - Migration 016: Create accounts, subscriptions, plan_limits, account_invites tables
  - Migration 017: Add account_id and account_role to users
  - Migration 018 (critical): Migrate users/teams to accounts
  - Migration 019: Migrate team_id FKs to account_id on content tables
  - Migration 020: Add constraints and finalize migration
  - Migration 021: Drop old team columns and teams table

- Phase 2 (Days 4-7): Backend updates
  - New models: Account, Subscription, PlanLimits, AccountInvites
  - Refactor permissions system (account_role replaces role/is_team_admin)
  - Add subscription helpers for feature gating
  - Update all 25+ endpoints to use account_id
  - Update test fixtures and fix 61+ tests

- Phase 3 (Days 8-10): Frontend updates
  - Update types (account_id, account_role)
  - New hooks: useSubscription, updated usePermissions
  - Account settings page with subscription info
  - Usage indicators and upgrade prompts
  - Stripe Checkout button (disabled until ready)

- Phase 4 (Days 11-12): Stripe preparation
  - Install Stripe SDK
  - Webhook skeleton with event handlers
  - Code ready to enable when Stripe account created

Key features:
- Build Stripe-ready but ship free-tier-only initially
- Feature branch workflow (feat/subscription-tiers)
- Comprehensive rollback plans for each phase
- All limits configurable via plan_limits table
- 10-12 day timeline with safety checks
- Test on production copy before migration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 21:36:01 -05:00
chihlasm
5d464c1287 docs: add subscription tier architecture plan
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 03:04:06 -05:00
chihlasm
36069850bc docs: add comprehensive project review report
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 03:01:25 -05:00
Michael Chihlas
fd8fab97bd docs: update permissions audit with re-audit findings
Re-audited after RBAC commit (34daa26). Key findings:
- permissions.py is dead code (no endpoint imports it)
- require_engineer_or_admin blocks team admins with viewer role
- 49 endpoints bypass get_current_active_user
- 3 critical issues still open (role field, XSS, secret key)
- Updated implementation plan with new Phase B items

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 17:53:25 -05:00
Michael Chihlas
02bd97948e docs: add permissions audit design doc and implementation plan
Full-stack RBAC audit covering frontend UX, backend architecture,
and adversarial analysis. Implementation plan phased by severity
(Critical → High → Medium → Low).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 17:42:38 -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
d7c5c8c9ce Updated documentation; added PERFORMANCE-HEALTH-CHECK.md 2026-02-04 21:46:32 -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
184e02781f docs: add session scratchpad implementation plan
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 02:55:22 -05:00
Michael Chihlas
a09f62a751 docs: Add Session Scratchpad design and update project references
- Add Session Scratchpad design doc (Idea 6 from brainstorm)
- Update CLAUDE.md production URLs to resolutionflow.com
- Update CORS lesson domain refs for rebrand
- Add .claude/settings.local.json to gitignore docs
- Add docs/plans/ to project structure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 02:34:25 -05:00
Michael Chihlas
d28fad7066 docs: Add feature ideas brainstorm (10 concepts for MSP-focused features)
Captures brainstorming session covering session scratchpad, time tracking,
command output capture, share progress/escalation, push steps, path analytics,
multi-tree sessions, recurring issue detection, tree health scores, and
AI tree intelligence. Includes suggested build order and dependency map.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 01:59:32 -05:00
Michael Chihlas
83df48291a feat: Complete backend and docs rebrand from Patherly to ResolutionFlow
Update APP_NAME, OpenAPI metadata, log messages, root endpoint response,
model docstrings, seed script comments, README heading, and CLAUDE.md
branding references. Frontend rebrand was completed in PR #26; this
covers everything else.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 00:41:22 -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
4378ec4b20 docs: Refine implementation plan and document draft feature
- Updated IMPLEMENTATION-PLAN-STEP-LIBRARY-FRONTEND.md with design decisions:
  - Custom steps persistence: separate `custom_steps` field in sessions
  - Custom step navigation: full step type support (decision/action/solution)
  - Validation warnings: inline dismissible, no confirmation modal
- Added backend migration task (B.10) for custom_steps field
- Updated file count: 10 new, 8 modified, 1 migration
- Clarified acceptance criteria for validation behavior

- Created docs/plans/2026-02-03-draft-trees-feature.md:
  - Comprehensive design for draft trees and custom steps
  - Database schema, API changes, frontend UX patterns
  - Implementation phases and success metrics
  - Related to Issue #25 (planned for Phase 3)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-03 18:51:27 -05:00
Michael Chihlas
67a98bc25c docs: Add implementation plan and project review from stale branches
Cherry-picked useful documentation from branches being cleaned up:
- IMPLEMENTATION-PLAN-STEP-LIBRARY-FRONTEND.md: Planning doc for Step Library frontend
- PROJECT-REVIEW-2026-02-02.md: Project status review from February 2026

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 18:17:44 -05:00
chihlasm
b608b0a708 docs: Reorganize project documentation
- Remove outdated documentation files
- Add ARCHITECTURE.md and BACKLOG.md
- Add docs/ folder
- Update CURRENT-STATE.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 02:24:43 -05:00