Commit Graph

159 Commits

Author SHA1 Message Date
Richard Osborne
2990e47059 Bug fixes on git 2026-02-18 21:03:36 +01:00
Richard Osborne
ade2afee85 feat(uba): UBA-008/009 panel registration + health indicator
UBA-008: Register UBAPanel in editor sidebar (router.setup.ts)
UBA-009: Health indicator widget in Configure tab
  - useUBAHealth hook polling UBAClient.health() every 30s
  - HealthBadge component: 4 states (unknown/checking/healthy/unhealthy)
  - Pulsing animation on checking; design token colours with fallbacks
  - Shown only when schema.backend.endpoints.health is present

Test fix: UBASchemaParser.test.ts
  - isFailure<T>() type guard for webpack ts-loader friendly narrowing
  - eslint-disable for destructuring discard patterns
2026-02-18 20:43:03 +01:00
Richard Osborne
6403341bcc docs(sprint-2): update PROGRESS-richard.md + add TS async IIFE union narrowing learning 2026-02-18 20:20:49 +01:00
Richard Osborne
ed16302812 feat(sprint-2): UBA-006 UBAPanel + UBA-007 DebugStreamView
UBA-006 — UBAPanel (views/panels/UBAPanel):
- useUBASchema hook: loads schema URL from project metadata, fetches + parses
- SchemaLoader UI: URL input with Enter/click + error banner
- ConfigPanel wired with onSave: stores in project metadata + UBAClient.configure()
- useEventListener for importComplete/instanceHasChanged

UBA-007 — DebugStreamView:
- SSE viewer via UBAClient.openDebugStream()
- Connect/Disconnect toggle, Clear, auto-scroll + manual override
- Max 500 events (oldest dropped), per-type colour coding
- Jump to latest sticky button

UBAPanel.module.scss: all design tokens, no hardcoded colors

Tech note: TS doesn't narrow ParseResult<T> discriminated unions inside
async IIFEs — explicit cast with inline FailResult type as workaround.
2026-02-18 20:12:33 +01:00
Richard Osborne
7bd9b4c3e6 feat(sprint-2): STYLE-005 StyleAnalyzer tests + UBA-005 UBAClient HTTP service
- STYLE-005: 19 unit tests for StyleAnalyzer (toSuggestions, analyzeProject, analyzeNode)
  - toSuggestions: ordering, message format, id format, acceptLabel variants
  - analyzeProject: repeated color/spacing detection, threshold enforcement, var() skip, tokenModel matching
  - analyzeNode: variant candidate detection, threshold, var() reference exclusion
- STYLE-005: Wire tests into test index (new tests/models/ and tests/services/ indexes)
- UBA-005: UBAClient static class with configure(), health(), openDebugStream()
  - Full auth support: bearer, api_key (custom header), basic
  - Timeout via AbortController (10s default)
  - health() never throws — always returns HealthResult
  - openDebugStream() returns DebugStreamHandle; handles named SSE event types
  - UBAClientError with status + body for non-2xx responses
2026-02-18 19:58:30 +01:00
Richard Osborne
c04bf2e6cb feat(uba): UBA-003/004 field renderers + ConfigPanel + Conditions 2026-02-18 18:23:10 +01:00
Richard Osborne
ab34ee4d50 docs(uba): sprint-1 session-2 progress — STYLE-005 + UBA-001/002 done 2026-02-18 17:38:55 +01:00
Richard Osborne
6e0ad689ae feat(styles+uba): STYLE-005 wiring + UBA-001/002
STYLE-005: ElementStyleSectionHost wraps ElementStyleSection with
SuggestionBanner. Uses useStyleSuggestions + executeSuggestionAction.
propertyeditor.ts updated to use host (drop-in, zero API change).

UBA-001: types.ts — Field discriminated union (8 types), BackendMetadata,
Section, Condition, ParseResult<T>. Zero external deps.

UBA-002: SchemaParser.ts validates pre-parsed objects against UBA v1.
Forward-compat: unknown field types/versions produce warnings not errors.
22 unit tests in tests/models/UBASchemaParser.test.ts.
2026-02-18 17:38:55 +01:00
Richard Osborne
1e350aebee docs(infra): document Jest/webpack test runner gotchas 2026-02-18 17:22:21 +01:00
Richard Osborne
64e565f00f test(styles): STYLE-005 StyleAnalyzer unit tests (17 cases)
Covers: hex/rgb color detection, spacing detection, variant candidate
threshold logic, toSuggestions ordering, stable IDs, edge cases.

Infra note: tests in tests/models/ — use 'npm run test:editor' not
'npx jest' directly (webpack build required by test-editor.ts script).
'npx jest' alone hangs on webpack. Move tests to tests/models/ not
tests/services/ — transform config only covers models/ path.
2026-02-18 17:14:52 +01:00
Richard Osborne
05379c967f feat(styles): STYLE-005 smart style suggestion engine
- StyleAnalyzer: scans project for repeated raw colors/spacing (3+ occurrences)
  and nodes with 3+ non-token overrides (variant candidates)
- StyleAnalyzer.toSuggestions() converts analysis to ordered StyleSuggestion[]
- StyleAnalyzer.analyzeNode() for per-node suggestions from property panel
- SuggestionActionHandler: creates tokens from repeated values + replaces
  all occurrences; sets _variant param for variant candidates
- SuggestionBanner: compact inline UI component with accept/dismiss/never
- useStyleSuggestions: hook with localStorage persist for dismissed state
- TokenModelLike interface keeps analyzer decoupled from StyleTokensModel singleton
- StyleAnalysisOptions allows injecting tokenModel for existing-token matching
2026-02-18 17:05:17 +01:00
Richard Osborne
d3c9ef27b9 docs(phase-9): mark WIZARD-001 complete, document Jest infra gotcha 2026-02-18 16:46:06 +01:00
Richard Osborne
d9acb41d2f feat(launcher): add ProjectCreationWizard multi-step flow
Replaces CreateProjectModal with a guided wizard supporting:
- Quick Start (name + location, direct creation)
- Guided Setup (basics → style preset → review → create)
- AI Builder stub (V2, same flow as Guided for now)

Files added:
- WizardContext.tsx — state machine with step sequencing + canProceed validation
- EntryModeStep — card-based mode selector
- ProjectBasicsStep — name/description/location picker
- StylePresetStep — preset card grid
- ReviewStep — summary before creation
- ProjectCreationWizard.tsx — drop-in replacement for CreateProjectModal
- SCSS + index.ts barrel

Integration:
- ProjectsPage.tsx imports ProjectCreationWizard (API-identical swap)

Tests:
- tests/models/ProjectCreationWizard.test.ts — 17 pure logic tests
  (infra note: npm run test:editor required, not npx jest directly)

Pre-existing broken tests in tests/components/ and tests/git/ are
unrelated and not modified.
2026-02-18 16:45:12 +01:00
Richard Osborne
c425769633 docs(sprint-1): update PROGRESS-richard.md — session 1 complete 2026-02-18 16:24:33 +01:00
Richard Osborne
5827d33d6b fix(styles): CLEANUP-000H — Migration Wizard SCSS polish
Replace all hardcoded colors with design tokens across:
- MigrationWizard.module.scss (shell: header/body/footer layout)
- WizardProgress.module.scss (step indicator, active/complete/error states)
- ConfirmStep.module.scss (info card, warning banner)
- ScanningStep.module.scss (spinner, progress bar, file display)
- MigratingStep.module.scss (same loading pattern + migration log)
- ReportStep.module.scss (summary grid, issue list with severity icons)
- CompleteStep.module.scss (success banner, stats, what's next)
- FailedStep.module.scss (error banner, scrollable error details)

All states use semantic tokens with sensible hardcoded fallbacks.
2026-02-18 16:23:17 +01:00
Richard Osborne
8ee374d21e feat(styles): STYLE-001 Phase 3+4 — TokenPicker component and preview CSS injection
- TokenPicker: searchable grouped dropdown for selecting design tokens
  with colour swatch previews, clear button, category filtering, custom
  group override support (noodl-core-ui)
- PreviewTokenInjector: singleton service that injects project design
  tokens as a <style id='noodl-design-tokens'> into the preview webview
  via executeJavaScript on every dom-ready and tokensChanged event
- CanvasView: calls notifyDomReady() after valid dom-ready sessions and
  clearWebview() on dispose
- ProjectDesignTokenContext: attaches PreviewTokenInjector to the
  StyleTokensModel on mount
2026-02-18 16:20:13 +01:00
Richard Osborne
297dfe0269 Added sprint protocol 2026-02-18 15:59:52 +01:00
Richard Osborne
bf07f1cb4a Added new github integration tasks 2026-01-18 14:38:32 +01:00
Richard Osborne
addd4d9c4a Fixed Logic Builder node bugs, expression field bugs, code editor bugs, property panel bugs 2026-01-16 17:23:31 +01:00
Richard Osborne
32a0a0885f Finished prototype local backends and expression editor 2026-01-16 12:00:31 +01:00
Richard Osborne
94c870e5d7 docs: mark TASK-007 Integrated Backend as complete
Phase 5 BYOB now at 43% (3/7 tasks complete):
- TASK-007A: LocalSQL Adapter 
- TASK-007B: Local Backend Server 
- TASK-007C: WorkflowRunner 
- TASK-007D: Launcher UI 

Schema viewer/editor will be developed separately.
2026-01-15 21:06:54 +01:00
Richard Osborne
dac5330d4c fix(editor): use correct IPC transport pattern in useLocalBackends
Use window.require('electron').ipcRenderer.invoke() pattern which is
consistent with how GitHubOAuthService and other IPC calls work.

This fixes 'No IPC transport available' error when using local backends.
2026-01-15 18:47:20 +01:00
Richard Osborne
9181d5d83c fix(editor): replace prompt/confirm with proper dialogs in BackendServicesPanel
Electron doesn't support browser prompt()/confirm() APIs.
Replaced with:
- Inline TextInput form for creating local backends
- useConfirmationDialog hook for delete confirmations

Fixes console error when clicking + button on Local Backends section.
2026-01-15 18:43:01 +01:00
Richard Osborne
1c40f45195 docs: update TASK-007 progress (4/6 subtasks complete) 2026-01-15 18:31:40 +01:00
Richard Osborne
83e41e439f Merge feature/task-007d-launcher-ui into cline-dev
TASK-007D: Local Backends UI Integration
- useLocalBackends hook for IPC communication
- LocalBackendCard component for backend management
- Enhanced BackendServicesPanel with Local Backends section
2026-01-15 18:30:56 +01:00
Richard Osborne
5f61317ca4 feat(editor): add local backends UI to BackendServicesPanel
- Add useLocalBackends hook for IPC communication with local backend server
- Create LocalBackendCard component for managing local SQLite backends
- Add 'Local Backends' section to BackendServicesPanel
- Support start/stop/delete operations for local backends
- Display status, endpoint URL, and port information

Part of TASK-007D: Launcher Integration
2026-01-15 18:30:42 +01:00
Richard Osborne
98fa779548 feat(local-backend): add WorkflowRunner for visual workflow execution
TASK-007C: Workflow Runtime Integration

- Add WorkflowRunner class to manage CloudRunner instances
- Integrate WorkflowRunner with LocalBackendServer
- Add workflow IPC handlers to BackendManager:
  - backend:update-workflow - Deploy/update a workflow
  - backend:reload-workflows - Hot reload all workflows
  - backend:workflow-status - Get workflow status
- LocalBackendServer now handles /functions/:name endpoints via WorkflowRunner
- WorkflowRunner loads .workflow.json files from backends/{id}/workflows/
2026-01-15 17:44:11 +01:00
Richard Osborne
ddcb9cd02e feat: Phase 5 BYOB foundation + Phase 3 GitHub integration
Phase 5 - BYOB Backend (TASK-007A/B):
- LocalSQL Adapter with full CloudStore API compatibility
- QueryBuilder translates Parse-style queries to SQL
- SchemaManager with PostgreSQL/Supabase export
- LocalBackendServer with REST endpoints
- BackendManager with IPC handlers for Electron
- In-memory fallback when better-sqlite3 unavailable

Phase 3 - GitHub Panel (GIT-004):
- Issues tab with list/detail views
- Pull Requests tab with list/detail views
- GitHub API client with OAuth support
- Repository info hook integration

Phase 3 - Editor UX Bugfixes (TASK-013):
- Legacy runtime detection banners
- Read-only enforcement for legacy projects
- Code editor modal close improvements
- Property panel stuck state fix
- Blockly node deletion and UI polish

Phase 11 - Cloud Functions Planning:
- Architecture documentation for workflow automation
- Execution history storage schema design
- Canvas overlay concept for debugging

Docs: Updated LEARNINGS.md and COMMON-ISSUES.md
2026-01-15 17:37:15 +01:00
Richard Osborne
dd73b1339b docs: update progress for TASK-007A/B and CF11-004/005
- Phase 11 PROGRESS.md: Mark CF11-004/005 complete, TASK-007B complete
- TASK-007 README: Update testing checklist with completion status
- Both docs now accurately reflect current implementation state
2026-01-15 17:34:30 +01:00
Richard Osborne
8e49cbedc9 feat(adapter): add in-memory fallback when better-sqlite3 unavailable
When better-sqlite3 native module isn't installed/buildable, the adapter
now falls back to an in-memory mock implementation. This allows development
and testing without native compilation.
2026-01-15 17:19:23 +01:00
Richard Osborne
5badf8a8e3 fix(backend): use absolute path for adapter import
Fix module resolution when Electron runs from different cwd
2026-01-15 17:15:12 +01:00
Richard Osborne
c2e9f37129 feat(editor): integrate local backend IPC handlers
- Add setupBackendIPC() call in app.on('ready')
- Add backendManager.stopAll() cleanup on app before-quit
- Backend IPC now available for renderer process

Test with DevTools:
  await require('@electron/remote').ipcRenderer.invoke('backend:list')
  await require('@electron/remote').ipcRenderer.invoke('backend:create', 'Test')
  await require('@electron/remote').ipcRenderer.invoke('backend:start', backendId)
2026-01-15 16:37:21 +01:00
Richard Osborne
8c0f0c6797 feat(editor): add LocalBackendServer and BackendManager
TASK-007B: Local Backend Server (Phase 5 BYOB)

- Add LocalBackendServer with REST API for database CRUD
- Support /api/:table endpoints for query, create, update, delete
- Support /api/:table/:id for single record operations
- Support /api/_schema for schema management
- Support /api/_batch for batch operations
- Add placeholder for /functions/:name (CloudRunner integration)
- Add BackendManager for backend lifecycle (create, start, stop, delete)
- Add IPC handlers for renderer process communication
- Backends stored in ~/.noodl/backends/{id}/

Next: Integration with main process, UI for backend management
2026-01-15 16:34:42 +01:00
Richard Osborne
95bf2f363c feat(viewer-cloud): add ExecutionLogger for workflow execution tracking
CF11-005: Execution Logger Integration (Part 1 - Logger Class)

- Add ExecutionLogger class wrapping ExecutionStore
- Implement execution lifecycle: startExecution, completeExecution
- Implement node lifecycle: startNode, completeNode, skipNode
- Add configurable settings (enabled, captureInputs, captureOutputs)
- Add automatic data truncation for large payloads
- Add retention cleanup utility
- Add comprehensive unit tests with MockExecutionStore

CloudRunner integration (Part 2) deferred until Phase 5 TASK-007C
creates the workflow runtime engine.
2026-01-15 16:21:41 +01:00
Richard Osborne
8938fa6885 feat(viewer-cloud): add ExecutionStore for workflow execution history
CF11-004: Execution Storage Schema (Phase 11)

- Add TypeScript types for executions, steps, queries, and stats
- Add SQLite schema with workflow_executions and execution_steps tables
- Implement ExecutionStore class with full CRUD operations
- Support query filtering by workflow, status, trigger type, date range
- Support pagination with limit/offset
- Add retention utilities (cleanup by age, count, total)
- Add aggregated statistics (success rate, avg duration)
- Add unit tests with MockDatabase for all operations

Uses synchronous SQLite (better-sqlite3 compatible interface) for
performant local storage of execution history data.
2026-01-15 16:13:19 +01:00
Richard Osborne
72c9989a68 feat(runtime): add LocalSQL adapter for CloudStore interface
TASK-007A: LocalSQL Adapter (Phase 5/Phase 11 shared foundation)

- Add LocalSQLAdapter implementing CloudStore interface with SQLite backend
- Add QueryBuilder for Parse-style query to SQL translation
- Add SchemaManager for table creation, migrations, and exports
- Support all CloudStore methods: query, fetch, create, save, delete
- Support aggregate, distinct, increment, count operations
- Support relations via junction tables
- Add schema export to PostgreSQL and Supabase formats
- Add comprehensive unit tests for QueryBuilder

This adapter enables:
- Local offline database for development
- Foundation for Phase 11 execution history storage
- Schema migration path to production databases
2026-01-15 16:04:24 +01:00
Richard Osborne
dd3ac95299 Merge task/012-blockly-logic-builder into cline-dev 2026-01-12 13:24:52 +01:00
Richard Osborne
39fe8fba27 Finished Blockly prototype, updated project template json 2026-01-12 13:23:12 +01:00
Richard Osborne
a64e113189 docs(blockly): Document integration bugs and create TASK-012B
Session 3: Bug Investigation & Documentation

Discovered critical issues during user testing:
- Canvas rendering broken (DOM conflict with React)
- Logic Builder button crashes (model API error)
- CSS positioning issues

Root Cause:
- Attempted to wrap legacy canvas in React tabs
- Canvas is vanilla JS/jQuery, not React-compatible
- Created duplicate DOM containers causing conflicts

Resolution:
- Created TASK-012B with detailed fix plan
- Approach: Separate canvas and Logic Builder completely
- Use visibility toggle instead of tab replacement
- Canvas = Desktop, Logic Builder = Windows overlay

Files Created:
- TASK-012B-integration-bugfixes.md (complete task doc)

Files Updated:
- CHANGELOG.md (Session 3, status update)

Key Learning: Don't try to wrap legacy jQuery/vanilla JS in React.
Keep them completely separate with event coordination.

Next: Implement TASK-012B fixes (~1 hour)
2026-01-11 14:51:35 +01:00
Richard Osborne
d601386d0d docs(blockly): Phase C documentation complete
- Created PHASE-C-COMPLETE.md with full architecture overview
- Updated CHANGELOG with Session 2 details
- Complete feature summary and testing checklist
- Ready for manual testing and user feedback

Phase A-C Status: COMPLETE 
Next: Phase D (Testing & Polish)
2026-01-11 14:11:31 +01:00
Richard Osborne
9b3b2991f5 feat(blockly): Phase C Step 7 COMPLETE - Code generation & port detection
Wired up complete code generation and I/O detection pipeline:
- Created BlocklyEditorGlobals to expose detectIO and generateCode
- Runtime node accesses detectIO via window.NoodlEditor
- Dynamic port updates based on workspace changes
- Full integration between editor and runtime
- Auto-initialization via side-effect import

Complete flow now works:
1. User edits blocks in BlocklyWorkspace
2. Workspace JSON saved to node parameter
3. IODetector scans workspace for inputs/outputs/signals
4. Dynamic ports created automatically
5. Code generated for runtime execution

Next: Testing and verification
2026-01-11 14:09:54 +01:00
Richard Osborne
4960f43df5 feat(blockly): Phase C Step 6 COMPLETE - Property panel Edit Blocks button
Implemented custom property editor for Logic Builder workspace:
- Created LogicBuilderWorkspaceType with styled button UI
- Added editorType='logic-builder-workspace' to node definition
- Registered LogicBuilderWorkspaceType in Ports.ts mapping
- Button emits LogicBuilder.OpenTab event with node details
- Integrated with existing property panel system

Next: Step 7 - Code generation and port detection
2026-01-11 14:07:32 +01:00
Richard Osborne
fbf01bf0f7 feat(blockly): Phase C Step 5 COMPLETE - NodeGraphEditor tab integration
Full integration of canvas tabs into NodeGraphEditor:
- Added renderCanvasTabs() method to render React tab system
- Added handleBlocklyWorkspaceChange() for workspace persistence
- Added cleanup in dispose() for React roots
- Added event listener for LogicBuilder.OpenTab events
- Tabs now render above canvas with provider wrapping

Ready for Phase C Steps 6-7 (property panel + code generation)
2026-01-11 14:00:51 +01:00
Richard Osborne
f861184b96 feat(blockly): Phase C Step 5 WIP - Add imports and template for tabs
- Updated nodegrapheditor.html template with canvas-tabs-root
- Added imports for CanvasTabsProvider and CanvasTabs
- Added canvasTabsRoot property to NodeGraphEditor class

Next: Add render logic and event handlers
2026-01-11 13:59:44 +01:00
Richard Osborne
30a70a4eb3 feat(blockly): Phase C Steps 1-4 - Core tab system components
Created complete tab system foundation:
- CanvasTabsContext: React Context for tab state management
- CanvasTabs component: Tab UI with canvas/Blockly switching
- Theme-aware SCSS styling using design tokens
- Full TypeScript types and exports

Next: Integrate into NodeGraphEditor, add property panel button
2026-01-11 13:55:04 +01:00
Richard Osborne
c2f1ba320c docs(blockly): Complete Phase B1 documentation
- Updated PHASE-B1-COMPLETE.md with test results and bugfix info
- Updated CHANGELOG.md with testing confirmation
- Added color scheme learning to LEARNINGS.md
- Phase B1 is complete and tested successfully
2026-01-11 13:48:38 +01:00
Richard Osborne
8039791d7e fix(blockly): Fix Logic Builder node color scheme crash
Changed category from 'Logic' to 'CustomCode' and color from 'purple' to 'javascript' to match Expression node pattern. This ensures the node picker can find the correct color scheme.

Fixes: EditorNode crash 'Cannot read properties of undefined (reading text)'
Issue: colors prop was undefined because color scheme 'purple' doesn't exist
2026-01-11 13:42:25 +01:00
Richard Osborne
45b458c192 docs(blockly): Add Phase B1 completion document
Documents successful node registration and provides manual testing checklist
2026-01-11 13:38:13 +01:00
Richard Osborne
5dc704d3d5 feat(blockly): Phase B1 - Register Logic Builder node
- Created IODetector utility to scan workspaces for I/O blocks
- Implemented Logic Builder runtime node with:
  - Dynamic port detection from workspace
  - Code execution context with Noodl API access
  - Signal input triggers for logic execution
  - Error handling and reporting
- Registered node in runtime and added to Custom Code category

The node should now appear in the node picker under Custom Code.
Next: Phase C - Tab system prototype

Part of TASK-012: Blockly Visual Logic Integration
2026-01-11 13:37:19 +01:00
Richard Osborne
df4ec4459a docs(blockly): Update CHANGELOG for Phase A completion 2026-01-11 13:30:49 +01:00