Add local collections support with GUI, CLI, and publishing workflow

Features:
- Local collection definitions stored in ~/.cmdforge/collections/
- CLI commands: create, show, add, remove, delete, publish, status
- GUI Collections page with local and registry tabs
- Collection publishing with tool resolution and visibility checks
- New API endpoints: GET /api/v1/me, GET /api/v1/tools/.../approved,
  POST /api/v1/collections
- RegistryClient methods: get_me(), has_approved_public_tool(),
  publish_collection()

Implementation:
- collection.py: Collection dataclass, resolve_tool_references(),
  classify_tool_reference(), ToolResolutionResult
- collections_page.py: GUI with background workers for install/publish
- collections_commands.py: Full CLI command implementations
- registry/app.py: New authenticated endpoints with validation

Tests:
- test_collection.py: 27 unit tests for collection module
- test_collection_api.py: 20 tests (8 client, 12 API with Flask skip)

Documentation updated: README, CHANGELOG, CLAUDE.md, tests/README

Co-Authored-By: Claude Opus 4.5 <[email protected]>
This commit is contained in:
rob
2026-01-26 16:50:19 -04:00
co-authored by Claude Opus 4.5
parent 37e74bf339
commit 29869ef59f
14 changed files with 2917 additions and 27 deletions
+27 -1
View File
@@ -2,7 +2,7 @@
## Overview
The test suite covers the core CmdForge modules with **158 unit tests** organized into four main test files:
The test suite covers the core CmdForge modules with **205 unit tests** organized into test files:
| Test File | Module Tested | Test Count | Description |
|-----------|---------------|------------|-------------|
@@ -10,6 +10,8 @@ The test suite covers the core CmdForge modules with **158 unit tests** organize
| `test_runner.py` | `runner.py` | 31 | Variable substitution, step execution |
| `test_providers.py` | `providers.py` | 35 | Provider management, AI calls |
| `test_cli.py` | `cli/` | 20 | CLI commands and arguments |
| `test_collection.py` | `collection.py` | 27 | Collection CRUD, tool resolution |
| `test_collection_api.py` | Registry API | 20 | Collection API endpoints, client methods |
| `test_registry_integration.py` | Registry | 37 | Registry client, resolution (12 require server) |
## Running Tests
@@ -73,6 +75,30 @@ pytest tests/ --cov=cmdforge --cov-report=html
- `TestRefreshCommand` - Regenerate wrapper scripts
- `TestDocsCommand` - View/edit documentation
**test_collection.py** - Collection management
- `TestCollection` - Collection dataclass and CRUD operations
- Create, save, load, delete collections
- Registry URL generation
- YAML serialization roundtrip
- `TestListCollections` - List local collections
- `TestGetCollection` - Get collection by name
- `TestClassifyToolReference` - Classify local vs registry tool refs
- `TestResolveToolReferences` - Transform tool refs for publishing
- Local tool name expansion (name → user/name)
- Visibility issue detection
- Registry tool validation
- Pinned version transformation
- `TestToolResolutionResult` - Resolution result dataclass
**test_collection_api.py** - Collection API and client
- `TestGetMeEndpoint` - GET /api/v1/me endpoint (requires Flask)
- `TestToolApprovedEndpoint` - GET /api/v1/tools/.../approved (requires Flask)
- `TestPostCollectionsEndpoint` - POST /api/v1/collections (requires Flask)
- `TestRegistryClientMethods` - Client methods with mocked requests
- `get_me()` - Get authenticated user info
- `has_approved_public_tool()` - Check tool approval status
- `publish_collection()` - Publish collection to registry
### Integration Tests (require running server)
**test_registry_integration.py** - Registry API tests (marked with `@pytest.mark.integration`)