Commit Graph

18 Commits

Author SHA1 Message Date
rob 0ee21f27f7 Add admin publish-as-official, hash-based status sync, and GUI fixes
Registry:
- Add admin owner override for publishing tools as "official"
- Add POST /api/v1/tools/status-by-hash batch endpoint for status lookup
  scoped to publisher_id (works for tools published under any owner)

GUI:
- Add "Publish as" dropdown in publish dialog for admin users
- Add "installed" tool state (teal with arrow indicator) for registry-installed tools
- Fix tool editing for official/* qualified tool names (_get_qualified_name helper)
- Fix cancel navigation returning to wrong page (Welcome instead of Tools)
- Fix collections tab not refreshing after publish
- Refactor StatusSyncWorker to use batch hash lookup (1 request instead of N)
  with chunking (100 max) and hash collision handling

CLI:
- Switch registry status sync to hash-based lookup
- Add collection dependency checking and unpublished dep detection

Publish dialog cleanup:
- Move yaml import to module level, remove duplicate _bump_patch_version
- Fix owner combo using currentText() for reliable selection

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 17:18:37 -04:00
rob 071ade0ffb Add system dependencies support for tools
Tools can now declare system-level package dependencies (apt, brew, pacman, dnf)
that get checked and optionally installed when the tool is installed or run.

Features:
- SystemDependency dataclass with short form (string) and long form (dict)
- New system_deps.py module with platform detection and installation
- `cmdforge system-deps <tool>` command to check/install system packages
- `cmdforge check` now shows both CmdForge and system dependencies
- `cmdforge registry install` prompts for system dep installation
- GUI: System Dependencies section in Tool Builder with add/edit dialog
- Runner warns about missing system deps before execution
- Integration with project install (manifest and lock-based)

Also includes:
- Quote paths in wrapper scripts for spaces support
- Tests for value type preservation in code steps
- Unskip invalid tool name test

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 16:31:37 -04:00
rob 8eff55ed1e Add tool settings files for configurable tool defaults
Tools can now ship with defaults.yaml containing configurable settings
that users can customize via settings.yaml (auto-created from defaults).

Features:
- ensure_settings() helper copies defaults to settings on first use
- Settings available as {settings.key} in templates (scalars only)
- Full dict access via settings['key'] in code steps
- CLI: cmdforge settings <tool> show/edit/reset/diff
- GUI: Defaults editor in Tool Builder, Configure button on Tools page
- Registry: defaults.yaml published with tools, included in downloads
- Secret detection warning on publish (api_key, password, token, etc.)

Fully backward compatible - tools without defaults work unchanged.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 11:56:07 -04:00
rob be712ddc2e Improve Dependencies section layout in Tool Builder
- Make section compact (doesn't stretch to fill space)
- Add stretch at bottom of left panel to push content up
- Reduce list height slightly (80px max, 60px min)
- Tighter margins and spacing
- Simplified tooltip: "Declare tools called via subprocess in code steps.
  Tool steps are automatically included when saved."

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 00:43:19 -04:00
rob b0e8bb3e65 Add Dependencies section to Tool Builder GUI
- Add Dependencies group box with dropdown to select installed tools
- Dropdown is editable for typing tool references (e.g., official/summarize)
- Add/Remove buttons to manage dependency list
- Dependencies are loaded when editing existing tools
- Dependencies are saved with the tool

This allows users to declare dependencies for tools that call other tools
via subprocess in code steps, making them visible to the dependency system.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 00:25:27 -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 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 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 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 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 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 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 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 4fe2d26244 Convert TUI to PySide6 desktop GUI
Major UI overhaul replacing the urwid-based Terminal UI with a modern
PySide6 desktop application.

New GUI features:
- Sidebar navigation (My Tools, Registry, Providers)
- Tool Builder with visual form for creating/editing tools
- Registry browser with search and one-click install
- Provider management page
- Connect dialog for account pairing
- Publish dialog for sharing tools

- Keyboard shortcuts (Ctrl+N, Ctrl+S, Ctrl+R, Ctrl+1/2/3, Escape, Ctrl+Q)
- Window geometry persistence (remembers size/position)
- Modern clean stylesheet

Removed:
- ui.py, ui_snack.py, ui_registry.py, ui_urwid.py
- ui_urwid/ directory (urwid TUI implementation)

Updated:
- pyproject.toml: PySide6 now required, removed urwid
- CLI entry points to launch GUI
- All documentation (README, CLAUDE.md, AGENTS.md, wiki)

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