Commit Graph

54 Commits

Author SHA1 Message Date
rob f442759344 Add Provider Install wizard to GUI
- Create ProviderInstallDialog for installing AI provider CLI tools
- Shows available providers (Claude, Codex, Gemini, OpenCode, Ollama)
- Detects which providers are already installed
- Runs installation commands with live output
- Offers to add provider variants after installation
- Add "Tools" menu with "Install AI Provider..." option
- Add "Install Provider..." button to Providers page

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 01:14:49 -04:00
rob f07f9102f6 Move tooltips to title labels instead of group boxes
Tooltips now only appear when hovering over the title text:
- "Input Variables"
- "Assertions (Optional)"
- "Output"

Rather than triggering anywhere in the group box area.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:44:00 -04:00
rob 59e4191fd1 Add contextual tooltips to TestStepDialog
- Input Variables: explains {variable} syntax and variable sources
- Assertions: lists all available assertion types with descriptions
- Provider: explains override options including mock provider
- Run Step: describes what happens when clicked
- Output: explains status, output text, variables, and assertion results

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:39:17 -04:00
rob dc23c2d1cb Reduce remove button height to match other widgets
- Fixed height 28px
- Reduced font to 14px
- Minimal padding (0px vertical, 6px horizontal)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:35:50 -04:00
rob 70e9c7b789 Increase assertion row and widget heights for proper display
- Row height: 50px
- Widget minimum heights: 34px
- Button max height constrained to 34px
- Table max height increased to 220px for taller rows

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:33:22 -04:00
rob 0548f6e3ec Let table cells manage widget sizes naturally
- Remove fixed heights, let Qt size widgets to fit cells
- Increase row height to 40px for more room
- Use padding instead of fixed size on remove button

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:24:24 -04:00
rob 0e1a5b5f62 Fix assertion row alignment and improve delete button visibility
- Set consistent fixed height (26px) on all row widgets
- Replace × with ✕ and style as red delete button
- Add hover/pressed states and tooltip
- Reduce row height to 32px for tighter alignment

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:13:43 -04:00
rob 7516a9b5ed Fix assertion table column widths in TestStepDialog
- Set fixed column widths (Type: 130px, Remove: 40px)
- Add minimum width (120px) on type combo box
- Value column stretches to fill remaining space

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:04:06 -04:00
rob 7110e82eca Fix assertion type combo box height in TestStepDialog
Set minimum height (28px) on type combo box to display selection.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:02:28 -04:00
rob 4176573e9d Fix assertion table row height in TestStepDialog
Set explicit row height (36px) and minimum input height (28px)
to prevent value input from being cut off.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:00:08 -04:00
rob 68ab329c33 Add interactive step testing to Tool Builder
- New TestStepDialog for testing individual steps from the GUI
- Test button in Tool Builder to test selected step
- Auto-detects variables from step templates
- Multiple assertion types: not_empty, contains, valid_json,
  matches_regex, min/max_length, equals, valid_python
- Background execution with timing metrics
- Provider override option for testing with mock provider
- Output variable display and assertion pass/fail results

Completes M5: Testing & Polish milestone (100%)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 13:42:20 -04:00
rob a134fb59c3 Add dark mode and simple theming support to GUI
- Add DARK_THEME stylesheet alongside existing LIGHT_THEME
- Add load_theme() function to load themes by name
- Support custom themes via ~/.cmdforge/theme.qss
- Add View menu with Theme submenu for switching themes
- Persist theme choice in QSettings across sessions
- Update META_TOOLS.md to reflect implemented dependency commands

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 13:19:26 -04:00
rob 9baddeef18 Add Help menu and contextual tooltips to GUI
- Add Help menu with quick guides: Getting Started, Create Tool,
  Install Tools, Publish Tools, Keyboard Shortcuts, About
- F1 shortcut opens Getting Started guide
- Add tooltips to Tool Builder section headings (Arguments, Steps,
  Output Template) that appear on hover over the label text
- Add tooltips to Registry page controls (search, filters, pagination)
- Enhance sidebar tooltips with keyboard shortcuts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 06:27:23 -04:00
rob 3f259449d4 Add tool composition UI with auto-dependency management
- Add ToolStepDialog for configuring tool steps (tool selection, input mapping, args)
- Add "Add Tool" button in Tool Builder alongside Add Prompt/Add Code
- Add ToolNode in flow graph visualization (purple puzzle piece icon)
- Auto-populate dependencies when adding ToolStep in GUI
- Add --auto-install flag for automatic runtime dependency installation
- Add check_dependencies() and auto_install_dependencies() functions
- Update runner to pass auto_install parameter through execution chain

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 05:27:54 -04:00
rob 85d1212c0d Add startup connection validation to GUI
- Add validate_token() method to RegistryClient
  - Returns (is_valid, error_message) tuple
  - Catches 401/UNAUTHORIZED errors and connection issues
- Add startup validation in MainWindow
  - Runs 500ms after window shows (non-blocking)
  - Clears invalid tokens automatically
  - Shows status bar message explaining what happened
- Document cmdforge config disconnect command

This prevents confusing errors when trying to publish with stale or
revoked credentials - the GUI now auto-clears bad connections on restart.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 01:59:16 -04:00
rob adefe909c2 Add fork display, version selector, and admin cleanup features
Registry Features:
- Fork tracking with forked_from/forked_version metadata
- Forked tools show "Forked from" notice on detail page
- Original tools display "Forks" section listing all forks
- Fork count in tool stats
- API: GET /api/v1/tools/<owner>/<name>/forks

GUI Improvements:
- Version selector dropdown for registry installs
- Fetch available versions via GET /api/v1/tools/<owner>/<name>/versions
- "Latest" option plus all available versions listed

Admin Features:
- POST /api/v1/admin/cleanup/rejected endpoint
- Maintenance section in admin dashboard
- "Dry Run" and "Run Cleanup" buttons for rejected version cleanup
- Configurable grace period (default 7 days)

Documentation:
- Updated CHANGELOG.md with all recent changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 23:42:32 -04:00
rob 74b5124360 Fix publish flow and consolidate My Tools view
- Make publish endpoint idempotent: return success if same content
  already exists instead of VERSION_EXISTS error (fixes retry issues)
- Always refresh tools page after publish dialog closes
- Consolidate My Tools page to group versions by tool name
- Show version count and list instead of separate rows per version
- Sum downloads across all versions for accurate totals

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 23:17:55 -04:00
rob 16de3e371c Add version display and bump buttons to publish dialog
- Show local and registry version in publish dialog
- Add +Patch/+Minor/+Major bump buttons
- Auto-fetch registry version on dialog open
- Suggest next version based on latest registry version
- Add fork detection and forked_from metadata support
- Update registry schema for forked_from/forked_version fields
- Display fork indicator when publishing forked tools

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 22:45:42 -04:00
rob 4756ea906c Replace Sync Status button with F5 keyboard shortcut
The visible button was confusing since auto-polling handles status
updates. Power users can press F5 to manually sync if needed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 21:43:37 -04:00
rob 9f60e84075 Remove local hash comparison for publish state detection
Simplified approach: just show the moderation status from the server
without trying to detect local modifications. This eliminates the
fragile hash comparison that kept breaking due to representation
differences between to_dict(), raw YAML, and server-side normalization.

States are now simply: local, pending, published, changes_requested, rejected

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 20:53:26 -04:00
rob 66c0fc77ae Fix GUI publish to save normalized config for hash consistency
The GUI was sending to_dict() output to server but only updating the
existing config file with the hash. This caused mismatches because
to_dict() adds fields like 'arguments: []' that weren't in the original.

Now saves the exact config that was published, ensuring local file
matches what was sent to server.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 20:37:29 -04:00
rob 23c42faf75 Fix hash comparison in get_tool_publish_state
Use raw config for hash comparison instead of to_dict(), which was
adding fields like 'arguments: []' that weren't in the original config.
This caused tools to show as "modified" when they weren't.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 20:22:26 -04:00
rob 64b9e8e70d Add status polling and CLI status command for tool moderation
- Add QTimer polling every 30s when tools are pending/changes_requested
- Display changes_requested (⚠) and rejected (✗) states in tool tree
- Show moderator feedback in tool info panel
- Add `cmdforge registry status <tool>` CLI command with --sync flag
- Update _sync_tool to persist registry_feedback field

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 19:50:30 -04:00
rob f22e95d119 Add automatic background sync for tool statuses
When the Tools page loads, automatically sync statuses for all published
tools in the background. This means users don't need to manually click
"Sync Status" - the indicators will update automatically.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 08:11:17 -04:00
rob 7f976d3f8c Fix hash computation to exclude version/tags metadata
The publish dialog adds version and tags fields that aren't stored in
the local config.yaml. Exclude these from hash computation so the
hash comparison works correctly.

Also use Tool.to_dict() for consistent hash computation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 08:02:42 -04:00
rob f1c462146b Fix publish state tracking and add sync status feature
- Track moderation status (pending/approved/rejected) in local tool config
- Add new "pending" state indicator (◐ yellow) distinct from "published" (✓ green)
- Add "Sync Status" button to check registry for updated moderation status
- Add /me/tools/<name>/status API endpoint for checking tool status
- Improve admin panel error handling with better error messages

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 07:52:42 -04:00
rob 3fccf854be Refresh tools list after successful publish
The tool list now refreshes after publishing to immediately show
the updated publish state indicator (✓).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 07:20:40 -04:00
rob 4b1f3cee52 Save registry_hash after publish for state tracking
- Add config_hash to publish API response
- Save registry_hash to local tool config after successful publish
- Show appropriate message based on moderation status (approved vs pending)

This enables the GUI to show publish state indicators (✓ published, ● modified)
for tools that have been published to the registry.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 07:12:20 -04:00
rob 96f7c05744 Fix publish dialog sending dict instead of YAML string
The publish_tool() API expects a YAML config string, but the dialog
was passing a dict directly, causing a 500 error on the server.

- Update PublishWorker to accept config_yaml string and readme
- Build complete tool config from Tool.to_dict()
- Convert to YAML string before sending
- Also include README.md if it exists in tool directory

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 07:06:45 -04:00
rob deddd8efbb Fix Publish button always greyed out when not connected
The _update_buttons method wasn't handling the no-token case properly.
When not connected, the Connect button should always be enabled.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 07:01:25 -04:00
rob 0216d1d77a Add disconnect command and fix GUI connection status refresh
- Add `cmdforge config disconnect` command to clear registry token
- Fix GUI connection status label not updating after connect
  - Store status as instance variable instead of local
  - Add _update_connection_status() method
  - Call update after connect dialog completes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 06:55:30 -04:00
rob 78025aac8e Implement content hash system for integrity verification
- Add hash_utils.py module for SHA256 content hashing with normalized YAML
- Store config_hash in registry database on publish
- Include hash in download response for client verification
- Verify downloaded content matches registry hash on install
- Store registry_hash in local tool config for publish state tracking
- Show publish state indicators in Tools page UI:
  - Green checkmark: Published and up to date
  - Orange dot: Modified since last publish
  - No indicator: Local tool (never published)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 01:31:08 -04:00
rob 8e6b03cade Add step type icons and inline name editing
- Add icons module with programmatically drawn icons:
  - Speech bubble for prompt steps
  - Code brackets </> for code steps
  - Arrow icons for input/output nodes
- Display icons in list view next to step names
- Display icons in flow view node headers
- Add inline name editing in flow view via property_changed signal
- Sync name changes from flow view to tool model and list view

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 01:21:20 -04:00
rob bc970fb9f7 Update help banner with link cutting shortcut
Added "Cut links: Alt+Shift+drag" to help banner.
Shortened other labels to fit.

In NodeGraphQt, connections are cut by:
- Alt+Shift+Left-drag to slice through connections
- Dragging a connection endpoint to empty space

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 23:59:35 -04:00
rob 683a8a6d8f Fix signal handling during graph rebuild
- Add _rebuilding flag to ignore signals during rebuild
- Prevents cascade of port_disconnected signals when clearing graph
- Fixes KeyError in NodeGraphQt undo stack
- Fixes false dependency warnings on view switch

The port_disconnected and nodes_deleted signals were firing during
clear_session(), causing recursive rebuilds and errors.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 23:54:48 -04:00
rob d1f0c2f893 Add flow view reordering via connection breaking
When a connection is broken in the flow view:
1. The node that lost its input moves to the end of the chain
2. The remaining nodes reconnect automatically
3. Tool model updates to reflect new order
4. Dependency validation warns about broken references

Flow: Input → A → B → C → Output
Break B's input: Input → A → C → B → Output

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 23:50:18 -04:00
rob 260ebf1b2f Fix false positives in variable dependency validation
Only parse {variable} patterns in PromptSteps, not CodeSteps.

In CodeSteps, variables are available directly as Python variables
(e.g., use `input` not `{input}`). The {var} syntax in code is
typically Python f-string or .format() syntax, not CmdForge
template substitution.

This fixes false positives like artifact-ai where Python f-strings
like f"{format_guide}" were incorrectly flagged as missing CmdForge
variable references.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 23:29:13 -04:00
rob b8760eb208 Add drag-reorder, validation, and flow-to-tool sync
List View:
- Enable drag-drop reordering of steps
- Show broken dependency warnings when reordering
- Steps with missing variable refs shown in red with tooltip

Validation:
- Parse {variable} references from prompts and code
- Track available variables at each step position
- Warn when steps reference undefined variables

Flow View Sync:
- Deleting nodes in flow view updates the tool model
- steps_deleted signal propagates changes to builder
- Both views stay in sync

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 23:13:44 -04:00
rob 8ab0fba67c Change Fit All to Fit Selection with Select All shortcut
- F key now fits to selected nodes (or all if none selected)
- A key selects all nodes
- Workflow: drag-select nodes then F to zoom, or A then F for all
- Updated help banner and context menu
- Context menu now has Select All (A) and Fit Selection (F)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 22:53:47 -04:00
rob 827f0f9eef Fix help banner visibility
- Show banner on showEvent (when flow view becomes visible)
- Show banner on mouse enter event
- Raise banner to front to ensure visibility
- Recalculate size before positioning

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 22:41:03 -04:00
rob fb879d09ea Improve flow view UX and fix step naming
- Remove Fit All button, F key shortcut is sufficient
- Add right-click context menu with "Fit All (F)" option
- Add floating help banner that appears on focus and auto-hides
- Banner stays visible when mouse hovers over it
- Fix default step naming to increment per type (Code 1, Prompt 1, Code 2)
  instead of globally (Code 1, Prompt 2, Code 3)
- List view still shows overall step number (1, 2, 3) with per-type names

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 22:36:13 -04:00
rob 4d9a0e5943 Add CmdForge welcome page to sidebar
- Create welcome_page.py with branded landing page
- Add quick action cards for common tasks (Create Tool, Registry, etc.)
- Add "CmdForge" entry at top of sidebar navigation
- Update page indices for navigation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 22:18:00 -04:00
rob 88c9a8a1e7 Add custom step names and fix F key shortcut
- Add name field to PromptStep, CodeStep, and ToolStep dataclasses
- Update step dialogs to allow editing step names
- Display custom step names in both list and flow views
- Fix F key shortcut by installing event filter on graph widget
- Steps without custom names show default "Prompt N" / "Code N"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 22:16:15 -04:00
rob 3c39cc9cda Improve flow visualization UX
- Add navigation help bar at top of flow view with instructions:
  Pan, Zoom, Select, Edit step shortcuts
- Fix zoom to fit all nodes on initial load (was only centering last node)
- Use QTimer to ensure fit happens after widget is fully rendered
- Clear selection after fitting so nodes don't appear selected

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 21:52:36 -04:00
rob 042be8b49b Add flow visualization for tool builder
Implements node-based flow visualization using NodeGraphQt-QuiltiX-fork:

New files:
- src/cmdforge/gui/widgets/flow_graph.py: FlowGraphWidget with custom node types
  - InputNode: Shows tool inputs ($input + argument variables)
  - PromptNode: AI prompt steps with provider display
  - CodeNode: Python code steps
  - OutputNode: Final output
- scripts/test_nodegraph.py: Standalone prototype for testing

Modified files:
- tool_builder_page.py: Added List/Flow view toggle with QStackedWidget
  - Lazy-loads flow widget on first use
  - Syncs between list and flow views
  - Double-click nodes to edit steps
- styles.py: Added viewToggle button styling
- widgets/__init__.py: Export FlowGraphWidget
- pyproject.toml: Added 'flow' optional dependency group

Features:
- Toggle between List and Flow views in Steps panel
- Nodes auto-connected based on step order
- Auto-layout and fit-to-view on load
- Double-click nodes opens step edit dialog
- Graceful fallback if NodeGraphQt not installed

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 17:07:35 -04:00
rob d1eb4231a7 Fix Output Template visibility and default value
- Set default value "{response}" for new tools
- Add minimum height (80px) so it's always visible
- Add stretch factors to layout so Steps expands, Output stays fixed
- Update placeholder text to be more helpful

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 14:33:07 -04:00
rob 436d6292ff Add Python syntax checking to Code Step dialog
Validates code with ast.parse() before accepting. Shows line number
and error message if syntax is invalid.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 14:27:55 -04:00
rob 2438aec831 Restore AI-assisted code generation in Code Step dialog
Feature was present in TUI but missing after GUI conversion. Now includes:
- Split layout: Code editor (left) | AI Assist panel (right)
- Provider selector dropdown for AI calls
- Prompt editor with smart default template showing available variables
- "Generate Code" button that calls AI in background thread
- Response feedback area showing success/error status
- Automatic markdown fence stripping from AI responses
- Available variables computed from tool arguments + previous step outputs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 14:20:58 -04:00
rob 9588c3f8b0 Add AI persona profiles for prompt injection
Profiles allow users to inject system instructions into prompts,
customizing the AI's behavior and persona for tool execution.

Features:
- Profile dataclass with name, description, system_prompt
- 8 built-in profiles: None, Comedian, Technical Writer, Teacher,
  Concise, Creative, Code Reviewer, Analyst
- Custom profile creation and storage in ~/.cmdforge/profiles/
- Profile selector in Prompt Step dialog
- Profile injection during tool execution
- Profiles page in GUI (Ctrl+4) for viewing and managing profiles

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 05:22:31 -04:00
rob 9d56f703cd Fix sort field values to match API
- 'newest' -> 'published_at' (valid API field)
- Remove 'rating' sort (not supported by API)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 05:03:55 -04:00