Update CLAUDE.md and AGENTS.md to reflect current codebase

- Add missing CLI subcommands (ui, docs, check, providers, deps, install, lock, verify, add, remove, init, config)
- Document new core modules (config.py, system_deps.py, dependency_graph.py, hash_utils.py)
- Update GUI structure (Welcome page, widgets/, expanded dialogs list)
- Add missing web modules (auth.py, sessions.py, email.py, seo.py)
- Add missing registry modules (categorize.py, rate_limit.py, scrutiny.py, similarity.py, stats.py, settings.py)
- Streamline AGENTS.md as quick reference that defers to CLAUDE.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
rob 2026-02-27 03:54:16 -04:00
parent 71c6358b9d
commit 1087b65c50
2 changed files with 64 additions and 39 deletions

View File

@ -1,42 +1,52 @@
# Repository Guidelines # Repository Guidelines
## Project Structure & Module Organization > **Note**: See CLAUDE.md for comprehensive project documentation. This file provides a quick reference for common patterns.
- `src/cmdforge/` contains the core Python package (CLI entry point, tool model, runner, providers, UI backends).
- `tests/` holds pytest suites.
- `docs/` includes installation, provider setup, examples, and design notes.
- `examples/` provides sample tools and an installer script.
- `wiki/` contains additional reference material.
## Architecture Overview ## Project Structure
- `cli/` directory routes subcommands like `list`, `create`, `run`, `test`, and `refresh`.
- `tool.py` defines tool/step models and handles YAML config loading and wrapper generation.
- `runner.py` executes steps and performs `{input}`/argument variable substitution.
- `providers.py` shells out to configured AI provider CLIs (or the `mock` provider).
- `gui/` provides the PySide6 desktop GUI with pages for tools, registry, and providers.
## Build, Test, and Development Commands - `src/cmdforge/` - Core Python package (CLI, tool model, runner, providers, GUI)
- `pip install -e ".[dev]"` installs CmdForge in editable mode with dev dependencies. - `tests/` - Pytest test suites
- `pytest` runs the full test suite. - `docs/` - Infrastructure and deployment documentation
- `pytest tests/test.py::test_name` runs a focused test.
- `python -m cmdforge.cli` runs the CLI module directly.
- `cmdforge` launches the desktop GUI (requires PySide6).
- `docker-compose build` builds the dev container image.
- `docker-compose run --rm test` runs tests inside Docker.
## Coding Style & Naming Conventions ## Development Commands
- Python code uses 4-space indentation and module/variable names in `snake_case`.
- Keep CLI command names and tool IDs lowercase with hyphens (e.g., `fix-grammar`, `json-extract`).
- Prefer small, composable functions that mirror the Unix pipe flow described in `README.md`.
## Testing Guidelines ```bash
- Framework: `pytest` (configured in `pyproject.toml`). pip install -e ".[dev]" # Install in dev mode
- Place new tests under `tests/` and name files `test_*.py`. pytest tests/ -m "not integration" # Run unit tests
- For provider-dependent logic, prefer the built-in `mock` provider to avoid network calls. cmdforge # Launch GUI
cf # Interactive tool picker
```
## Commit & Pull Request Guidelines ## Architecture Quick Reference
- Commit messages follow short, imperative, sentence-case subjects (e.g., "Improve provider error messages").
- PRs should include a clear summary, test results (or rationale if tests are skipped), and screenshots when UI behavior changes.
## Security & Configuration Tips - `cli/` - Routes all subcommands (list, create, run, test, providers, registry, collections, deps, install, etc.)
- Provider credentials live in `~/.cmdforge/providers.yaml`; avoid committing secrets. - `tool.py` - Tool/step dataclasses, YAML loading, wrapper generation
- User tool configs live in `~/.cmdforge/<toolname>/config.yaml` and should not be added to the repo. - `runner.py` - Step execution, variable substitution (`{input}`, `{varname}`)
- `providers.py` - AI provider abstraction (calls CLI tools via subprocess)
- `gui/` - PySide6 desktop GUI with page-based navigation
- `web/` - Flask web UI and forum
- `registry/` - Flask registry API (search, publish, moderation)
## Coding Style
- Python: 4-space indentation, `snake_case` for modules/variables
- CLI tools: lowercase with hyphens (e.g., `fix-grammar`, `json-extract`)
- Follow Unix pipe philosophy: composable tools with stdin/stdout
## Testing
- Framework: `pytest` (see `pyproject.toml`)
- Test files: `tests/test_*.py`
- Use `mock` provider or `--dry-run` to avoid network calls
- Integration tests require `@pytest.mark.integration` decorator
## Commit Guidelines
- Short, imperative, sentence-case subjects (e.g., "Add provider validation")
- Include test results or rationale if skipped
- Add screenshots for UI changes
## Security
- Provider configs: `~/.cmdforge/providers.yaml` (never commit)
- Tool configs: `~/.cmdforge/<toolname>/config.yaml` (user data, never commit)

View File

@ -39,7 +39,7 @@ python -m cmdforge.cli # Alternative CLI invocation
### Core Modules (`src/cmdforge/`) ### Core Modules (`src/cmdforge/`)
- **cli/**: CLI commands entry points (`cmdforge` command). Routes subcommands: list, create, edit, delete, test, run, refresh, collections, registry, settings, system-deps - **cli/**: CLI commands entry points (`cmdforge` command). Routes subcommands: list, create, edit, delete, test, run, ui, docs, check, refresh, providers, registry, collections, deps, install, lock, verify, add, remove, init, config, settings, system-deps
- **tool.py**: Tool definition dataclasses (`Tool`, `ToolArgument`, `PromptStep`, `CodeStep`, `ToolStep`), YAML config loading/saving, wrapper script generation - **tool.py**: Tool definition dataclasses (`Tool`, `ToolArgument`, `PromptStep`, `CodeStep`, `ToolStep`), YAML config loading/saving, wrapper script generation
- **runner.py**: Execution engine. Runs tool steps sequentially, handles variable substitution (`{input}`, `{varname}`), executes Python code steps via `exec()`, handles nested tool calls with depth limit (MAX_TOOL_DEPTH=10) - **runner.py**: Execution engine. Runs tool steps sequentially, handles variable substitution (`{input}`, `{varname}`), executes Python code steps via `exec()`, handles nested tool calls with depth limit (MAX_TOOL_DEPTH=10)
- **resolver.py**: Tool resolution. `resolve_tool()` searches: project manifest → local tools → owner/name → registry. Returns `ResolvedTool` with path info - **resolver.py**: Tool resolution. `resolve_tool()` searches: project manifest → local tools → owner/name → registry. Returns `ResolvedTool` with path info
@ -49,10 +49,15 @@ python -m cmdforge.cli # Alternative CLI invocation
- **manifest.py**: Project manifest (`cmdforge.yaml`) for declaring tool dependencies with version constraints - **manifest.py**: Project manifest (`cmdforge.yaml`) for declaring tool dependencies with version constraints
- **lockfile.py**: Lock file support for reproducible installs (`cmdforge.lock`) - **lockfile.py**: Lock file support for reproducible installs (`cmdforge.lock`)
- **registry_client.py**: Client for registry API (search, publish, download, authentication) - **registry_client.py**: Client for registry API (search, publish, download, authentication)
- **config.py**: Global configuration management (registry URL, auth tokens)
- **system_deps.py**: System package dependency management (apt/dnf/pacman detection and installation)
- **dependency_graph.py**: Dependency graph resolution for meta-tools
- **hash_utils.py**: Hash verification utilities for tool integrity
- **gui/**: PySide6 desktop GUI - **gui/**: PySide6 desktop GUI
- **main_window.py**: Main application window with sidebar navigation - **main_window.py**: Main application window with sidebar navigation
- **pages/**: Tools page, Tool Builder, Registry browser, Collections page, Providers management, Profiles - **pages/**: Welcome page, Tools page, Tool Builder, Registry browser, Collections page, Providers management, Profiles
- **dialogs/**: Step editors, Argument editor, Provider dialog, Connect/Publish dialogs - **dialogs/**: Step editors (prompt/code/tool), Argument editor, Provider dialog, Connect/Publish dialogs, Test Step dialog, Settings dialog, System Dep dialog, Help dialogs, Review/Issue dialogs
- **widgets/**: Flow graph visualization (`flow_graph.py`), Icon utilities (`icons.py`)
### Key Paths ### Key Paths
@ -113,11 +118,15 @@ CmdForge includes a web interface and tool registry:
- **app.py**: Flask app factory, registers blueprints - **app.py**: Flask app factory, registers blueprints
- **routes.py**: Main web routes (docs, tutorials, tools, etc.) - **routes.py**: Main web routes (docs, tutorials, tools, etc.)
- **auth.py**: Authentication middleware and decorators
- **sessions.py**: Session management
- **email.py**: Email utilities (password reset, notifications)
- **seo.py**: SEO utilities (sitemap, meta tags)
- **filters.py**: Jinja2 filters (timeago, markdown, etc.)
- **docs_content.py**: Documentation and tutorial content
- **forum/**: Community forum blueprint - **forum/**: Community forum blueprint
- **models.py**: Forum database schema (categories, topics, replies) - **models.py**: Forum database schema (categories, topics, replies)
- **routes.py**: Forum routes (/forum, /forum/c/<slug>, /forum/t/<id>) - **routes.py**: Forum routes (/forum, /forum/c/<slug>, /forum/t/<id>)
- **filters.py**: Jinja2 filters (timeago, markdown, etc.)
- **docs_content.py**: Documentation and tutorial content
### Registry Modules (`src/cmdforge/registry/`) ### Registry Modules (`src/cmdforge/registry/`)
@ -125,6 +134,12 @@ CmdForge includes a web interface and tool registry:
- **db.py**: SQLite schema and queries (`connect_db()`, `query_one()`, `query_all()`) - **db.py**: SQLite schema and queries (`connect_db()`, `query_one()`, `query_all()`)
- **embeddings.py**: Semantic search with vector embeddings for tool discovery - **embeddings.py**: Semantic search with vector embeddings for tool discovery
- **sync.py**: Git-based tool sync from Gitea repository - **sync.py**: Git-based tool sync from Gitea repository
- **categorize.py**: Auto-categorization of tools based on content
- **rate_limit.py**: Rate limiting for API endpoints
- **scrutiny.py**: Tool vetting (honesty, transparency, scope, efficiency checks)
- **similarity.py**: Duplicate detection via embedding similarity
- **stats.py**: Registry statistics and metrics
- **settings.py**: Server-side settings management
### Key URLs ### Key URLs