2.3 KiB
2.3 KiB
Repository Guidelines
Project Structure & Module Organization
src/smarttools/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
cli.pyroutes subcommands likelist,create,run,test,ui, andrefresh.tool.pydefines tool/step models and handles YAML config loading and wrapper generation.runner.pyexecutes steps and performs{input}/argument variable substitution.providers.pyshells out to configured AI provider CLIs (or themockprovider).ui_urwid.pyandui_snack.pyprovide the TUI implementations, selected byui.py.
Build, Test, and Development Commands
pip install -e ".[dev]"installs SmartTools in editable mode with dev dependencies.pytestruns the full test suite.pytest tests/test.py::test_nameruns a focused test.python -m smarttools.cliruns the CLI module directly.smarttools uilaunches the TUI (requiresurwidorpython-newt).docker-compose buildbuilds the dev container image.docker-compose run --rm testruns tests inside Docker.
Coding Style & Naming Conventions
- 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
- Framework:
pytest(configured inpyproject.toml). - Place new tests under
tests/and name filestest_*.py. - For provider-dependent logic, prefer the built-in
mockprovider to avoid network calls.
Commit & Pull Request Guidelines
- 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
- Provider credentials live in
~/.smarttools/providers.yaml; avoid committing secrets. - User tool configs live in
~/.smarttools/<toolname>/config.yamland should not be added to the repo.