llm-tool-maker 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- llm_tool_maker-0.1.0/.env.example +5 -0
- llm_tool_maker-0.1.0/.github/workflows/ci.yml +51 -0
- llm_tool_maker-0.1.0/.github/workflows/release.yml +83 -0
- llm_tool_maker-0.1.0/.gitignore +64 -0
- llm_tool_maker-0.1.0/.python-version +1 -0
- llm_tool_maker-0.1.0/DEVELOPMENT.md +139 -0
- llm_tool_maker-0.1.0/IMPLEMENTATION_PLAN.md +249 -0
- llm_tool_maker-0.1.0/PKG-INFO +199 -0
- llm_tool_maker-0.1.0/PLAN.md +146 -0
- llm_tool_maker-0.1.0/README.md +164 -0
- llm_tool_maker-0.1.0/examples/basic_usage.py +70 -0
- llm_tool_maker-0.1.0/examples/flask_integration.py +76 -0
- llm_tool_maker-0.1.0/modules.db +0 -0
- llm_tool_maker-0.1.0/pyproject.toml +68 -0
- llm_tool_maker-0.1.0/requirements.txt +18 -0
- llm_tool_maker-0.1.0/src/tool_maker/__init__.py +31 -0
- llm_tool_maker-0.1.0/src/tool_maker/analyzer/__init__.py +7 -0
- llm_tool_maker-0.1.0/src/tool_maker/analyzer/project_scanner.py +202 -0
- llm_tool_maker-0.1.0/src/tool_maker/cli/__init__.py +7 -0
- llm_tool_maker-0.1.0/src/tool_maker/cli/main.py +306 -0
- llm_tool_maker-0.1.0/src/tool_maker/config.py +57 -0
- llm_tool_maker-0.1.0/src/tool_maker/db/__init__.py +17 -0
- llm_tool_maker-0.1.0/src/tool_maker/db/config.py +31 -0
- llm_tool_maker-0.1.0/src/tool_maker/db/connection.py +157 -0
- llm_tool_maker-0.1.0/src/tool_maker/db/migrations/001_initial.sql +60 -0
- llm_tool_maker-0.1.0/src/tool_maker/db/migrator.py +121 -0
- llm_tool_maker-0.1.0/src/tool_maker/db/models.py +226 -0
- llm_tool_maker-0.1.0/src/tool_maker/db/pipeline.py +340 -0
- llm_tool_maker-0.1.0/src/tool_maker/dotenv.py +75 -0
- llm_tool_maker-0.1.0/src/tool_maker/flask/__init__.py +7 -0
- llm_tool_maker-0.1.0/src/tool_maker/flask/extension.py +165 -0
- llm_tool_maker-0.1.0/src/tool_maker/llm/__init__.py +7 -0
- llm_tool_maker-0.1.0/src/tool_maker/llm/provider.py +227 -0
- llm_tool_maker-0.1.0/src/tool_maker/planner/__init__.py +22 -0
- llm_tool_maker-0.1.0/src/tool_maker/planner/executor.py +87 -0
- llm_tool_maker-0.1.0/src/tool_maker/planner/models.py +61 -0
- llm_tool_maker-0.1.0/src/tool_maker/planner/planner.py +112 -0
- llm_tool_maker-0.1.0/src/tool_maker/planner/reviewer.py +73 -0
- llm_tool_maker-0.1.0/src/tool_maker/planner/validator.py +109 -0
- llm_tool_maker-0.1.0/src/tool_maker/planner/writer.py +34 -0
- llm_tool_maker-0.1.0/src/tool_maker/tool/__init__.py +15 -0
- llm_tool_maker-0.1.0/src/tool_maker/tool/executor.py +183 -0
- llm_tool_maker-0.1.0/src/tool_maker/tool/generator.py +197 -0
- llm_tool_maker-0.1.0/src/tool_maker/tool/sandbox.py +269 -0
- llm_tool_maker-0.1.0/src/tool_maker/tool_fixer.py +134 -0
- llm_tool_maker-0.1.0/src/tool_maker/tool_maker.py +385 -0
- llm_tool_maker-0.1.0/src/tool_maker/ui/__init__.py +5 -0
- llm_tool_maker-0.1.0/src/tool_maker/ui/app.py +62 -0
- llm_tool_maker-0.1.0/src/tool_maker/ui/log_handler.py +61 -0
- llm_tool_maker-0.1.0/src/tool_maker/ui/routes.py +552 -0
- llm_tool_maker-0.1.0/src/tool_maker/ui/static/style.css +394 -0
- llm_tool_maker-0.1.0/src/tool_maker/ui/templates/analyze.html +65 -0
- llm_tool_maker-0.1.0/src/tool_maker/ui/templates/base.html +27 -0
- llm_tool_maker-0.1.0/src/tool_maker/ui/templates/config.html +132 -0
- llm_tool_maker-0.1.0/src/tool_maker/ui/templates/execute.html +289 -0
- llm_tool_maker-0.1.0/src/tool_maker/ui/templates/generate.html +38 -0
- llm_tool_maker-0.1.0/src/tool_maker/ui/templates/index.html +60 -0
- llm_tool_maker-0.1.0/src/tool_maker/ui/templates/pipeline.html +377 -0
- llm_tool_maker-0.1.0/src/tool_maker/ui/templates/provider.html +60 -0
- llm_tool_maker-0.1.0/tests/__init__.py +0 -0
- llm_tool_maker-0.1.0/tests/test_config_and_fixer.py +65 -0
- llm_tool_maker-0.1.0/tests/test_executor.py +91 -0
- llm_tool_maker-0.1.0/tests/test_generator.py +138 -0
- llm_tool_maker-0.1.0/tests/test_planner.py +193 -0
- llm_tool_maker-0.1.0/tests/test_project_scanner.py +135 -0
- llm_tool_maker-0.1.0/tests/test_provider.py +112 -0
- llm_tool_maker-0.1.0/tests/test_sandbox.py +89 -0
- llm_tool_maker-0.1.0/tests/test_tool_maker.py +146 -0
- llm_tool_maker-0.1.0/uv.lock +941 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["*"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["*"]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- uses: astral-sh/setup-uv@v5
|
|
20
|
+
|
|
21
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
+
run: uv python pin ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: uv sync --group dev
|
|
26
|
+
|
|
27
|
+
- name: Ruff lint
|
|
28
|
+
run: uv run ruff check src/
|
|
29
|
+
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: uv run pytest
|
|
32
|
+
|
|
33
|
+
build:
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
needs: test
|
|
36
|
+
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v4
|
|
39
|
+
|
|
40
|
+
- uses: astral-sh/setup-uv@v5
|
|
41
|
+
|
|
42
|
+
- name: Set up Python
|
|
43
|
+
run: uv python pin 3.12
|
|
44
|
+
|
|
45
|
+
- name: Build package
|
|
46
|
+
run: uv build
|
|
47
|
+
|
|
48
|
+
- uses: actions/upload-artifact@v4
|
|
49
|
+
with:
|
|
50
|
+
name: dist
|
|
51
|
+
path: dist/
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
version:
|
|
10
|
+
description: "Version to publish (e.g. 0.2.0)"
|
|
11
|
+
required: true
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
id-token: write
|
|
15
|
+
contents: write
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
with:
|
|
24
|
+
fetch-depth: 0
|
|
25
|
+
|
|
26
|
+
- uses: astral-sh/setup-uv@v5
|
|
27
|
+
|
|
28
|
+
- name: Set up Python
|
|
29
|
+
run: uv python pin 3.12
|
|
30
|
+
|
|
31
|
+
- name: Build package
|
|
32
|
+
run: uv build
|
|
33
|
+
|
|
34
|
+
- uses: actions/upload-artifact@v4
|
|
35
|
+
with:
|
|
36
|
+
name: dist
|
|
37
|
+
path: dist/
|
|
38
|
+
|
|
39
|
+
publish:
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
needs: build
|
|
42
|
+
environment: pypi
|
|
43
|
+
|
|
44
|
+
steps:
|
|
45
|
+
- uses: actions/download-artifact@v4
|
|
46
|
+
with:
|
|
47
|
+
name: dist
|
|
48
|
+
path: dist/
|
|
49
|
+
|
|
50
|
+
- name: Publish to PyPI
|
|
51
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
52
|
+
|
|
53
|
+
github-release:
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
needs: build
|
|
56
|
+
|
|
57
|
+
steps:
|
|
58
|
+
- uses: actions/checkout@v4
|
|
59
|
+
with:
|
|
60
|
+
fetch-depth: 0
|
|
61
|
+
|
|
62
|
+
- uses: actions/download-artifact@v4
|
|
63
|
+
with:
|
|
64
|
+
name: dist
|
|
65
|
+
path: dist/
|
|
66
|
+
|
|
67
|
+
- name: Generate changelog
|
|
68
|
+
id: changelog
|
|
69
|
+
run: |
|
|
70
|
+
echo "changelog<<EOF" >> $GITHUB_OUTPUT
|
|
71
|
+
git log --oneline "$(git tag --sort=-creatordate | head -1)..HEAD" 2>/dev/null \
|
|
72
|
+
|| echo "Initial release"
|
|
73
|
+
echo "EOF" >> $GITHUB_OUTPUT
|
|
74
|
+
|
|
75
|
+
- name: Create Release
|
|
76
|
+
uses: softprops/action-gh-release@v2
|
|
77
|
+
with:
|
|
78
|
+
files: dist/*
|
|
79
|
+
body: |
|
|
80
|
+
## tool-maker ${{ github.ref_name }}
|
|
81
|
+
|
|
82
|
+
${{ steps.changelog.outputs.changelog }}
|
|
83
|
+
generate_release_notes: true
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
|
|
23
|
+
# Virtual environments
|
|
24
|
+
.venv/
|
|
25
|
+
venv/
|
|
26
|
+
ENV/
|
|
27
|
+
env/
|
|
28
|
+
|
|
29
|
+
# IDE
|
|
30
|
+
.idea/
|
|
31
|
+
.vscode/
|
|
32
|
+
*.swp
|
|
33
|
+
*.swo
|
|
34
|
+
*~
|
|
35
|
+
|
|
36
|
+
# Testing
|
|
37
|
+
.pytest_cache/
|
|
38
|
+
.coverage
|
|
39
|
+
htmlcov/
|
|
40
|
+
.tox/
|
|
41
|
+
|
|
42
|
+
# Linting
|
|
43
|
+
.mypy_cache/
|
|
44
|
+
.ruff_cache/
|
|
45
|
+
|
|
46
|
+
# Generated files
|
|
47
|
+
generated_tools/
|
|
48
|
+
*.generated.py
|
|
49
|
+
|
|
50
|
+
# Environment variables
|
|
51
|
+
.env
|
|
52
|
+
.env.local
|
|
53
|
+
|
|
54
|
+
# OS
|
|
55
|
+
.DS_Store
|
|
56
|
+
Thumbs.db
|
|
57
|
+
|
|
58
|
+
# Documentation
|
|
59
|
+
docs/_build/
|
|
60
|
+
|
|
61
|
+
# Distribution
|
|
62
|
+
dist/
|
|
63
|
+
build/
|
|
64
|
+
*.whl
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Tool Maker - Development Setup
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
- Python 3.10 or higher
|
|
6
|
+
- [uv](https://github.com/astral-sh/uv) package manager
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
### 1. Clone the repository
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
git clone https://github.com/yourusername/tool_maker.git
|
|
14
|
+
cd tool_maker
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### 2. Set up the development environment with uv
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Initialize uv project (if not already done)
|
|
21
|
+
uv init
|
|
22
|
+
|
|
23
|
+
# Sync dependencies
|
|
24
|
+
uv sync
|
|
25
|
+
|
|
26
|
+
# Activate the virtual environment
|
|
27
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 3. Install development dependencies
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
uv add --dev pytest black ruff
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Development Commands
|
|
37
|
+
|
|
38
|
+
### Running Tests
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
uv run pytest
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Running Linter
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
uv run ruff check .
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Formatting Code
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
uv run black .
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Running Type Checker
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
uv run mypy src/tool_maker
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Building the Package
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Build the package
|
|
66
|
+
uv build
|
|
67
|
+
|
|
68
|
+
# Install locally for testing
|
|
69
|
+
uv pip install dist/tool_maker-*.whl
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Testing the CLI
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Run the CLI
|
|
76
|
+
uv run tool-maker --help
|
|
77
|
+
|
|
78
|
+
# Analyze a project
|
|
79
|
+
uv run tool-maker analyze /path/to/project
|
|
80
|
+
|
|
81
|
+
# Generate a tool
|
|
82
|
+
uv run tool-maker generate "create a CSV parser" --project .
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Project Structure
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
tool_maker/
|
|
89
|
+
├── src/
|
|
90
|
+
│ └── tool_maker/ # Main package
|
|
91
|
+
│ ├── analyzer/ # Project analysis
|
|
92
|
+
│ ├── llm/ # LLM integration
|
|
93
|
+
│ ├── tool/ # Tool generation
|
|
94
|
+
│ ├── flask/ # Flask integration
|
|
95
|
+
│ └── cli/ # CLI interface
|
|
96
|
+
├── tests/ # Test files
|
|
97
|
+
├── examples/ # Usage examples
|
|
98
|
+
├── pyproject.toml # uv project configuration
|
|
99
|
+
└── requirements.txt # Python dependencies
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Adding New Features
|
|
103
|
+
|
|
104
|
+
1. Create a new branch: `git checkout -b feature/your-feature`
|
|
105
|
+
2. Implement your feature
|
|
106
|
+
3. Add tests for your feature
|
|
107
|
+
4. Run linting and tests: `uv run ruff check . && uv run pytest`
|
|
108
|
+
5. Format code: `uv run black .`
|
|
109
|
+
6. Commit and push: `git commit -m 'Add some feature' && git push origin feature/your-feature`
|
|
110
|
+
|
|
111
|
+
## LLM Provider Setup
|
|
112
|
+
|
|
113
|
+
### OpenAI
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
export OPENAI_API_KEY="sk-..."
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Anthropic (Claude)
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
export ANTHROPIC_API_KEY="sk-..."
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Documentation
|
|
126
|
+
|
|
127
|
+
Generate documentation:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
uv run pdoc --html --output-dir docs src/tool_maker
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Contributing
|
|
134
|
+
|
|
135
|
+
1. Fork the repository
|
|
136
|
+
2. Create a feature branch
|
|
137
|
+
3. Make your changes
|
|
138
|
+
4. Run tests and linting
|
|
139
|
+
5. Submit a pull request
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# Tool Maker - Implementation Plan
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
This document outlines the implementation plan for the Tool Maker package - a Python package using `uv` that acts as an intelligent tool-making assistant leveraging LLMs.
|
|
5
|
+
|
|
6
|
+
## Current Status
|
|
7
|
+
✅ Project structure created
|
|
8
|
+
✅ Core modules designed
|
|
9
|
+
✅ pyproject.toml configured
|
|
10
|
+
✅ README and documentation started
|
|
11
|
+
|
|
12
|
+
## Implementation Tasks
|
|
13
|
+
|
|
14
|
+
### Phase 1: Core Infrastructure (Priority: High)
|
|
15
|
+
- [ ] Complete `__init__.py` with proper imports
|
|
16
|
+
- [ ] Implement main `ToolMaker` class that orchestrates all components
|
|
17
|
+
- [ ] Add proper error handling and logging
|
|
18
|
+
- [ ] Create unit tests for core modules
|
|
19
|
+
|
|
20
|
+
### Phase 2: Project Analyzer Enhancements (Priority: High)
|
|
21
|
+
- [ ] Add support for more file types (JavaScript, TypeScript, etc.)
|
|
22
|
+
- [ ] Implement dependency parsing for pyproject.toml and requirements.txt
|
|
23
|
+
- [ ] Add module dependency graph generation
|
|
24
|
+
- [ ] Create project profiling capabilities
|
|
25
|
+
|
|
26
|
+
### Phase 3: LLM Integration (Priority: High)
|
|
27
|
+
- [ ] Implement additional LLM providers (Ollama, local models)
|
|
28
|
+
- [ ] Add conversation history management
|
|
29
|
+
- [ ] Implement prompt templates and management
|
|
30
|
+
- [ ] Add token usage tracking and limits
|
|
31
|
+
- [ ] Create LLM provider abstraction layer
|
|
32
|
+
|
|
33
|
+
### Phase 4: Tool Generation (Priority: High)
|
|
34
|
+
- [ ] Implement more sophisticated tool templates
|
|
35
|
+
- [ ] Add code generation using LLM
|
|
36
|
+
- [ ] Create tool validation and testing
|
|
37
|
+
- [ ] Implement tool versioning and management
|
|
38
|
+
- [ ] Add tool documentation generation
|
|
39
|
+
|
|
40
|
+
### Phase 5: Tool Execution (Priority: High)
|
|
41
|
+
- [ ] Implement tool sandboxing for security
|
|
42
|
+
- [ ] Add tool execution logging
|
|
43
|
+
- [ ] Create tool result caching
|
|
44
|
+
- [ ] Implement tool execution monitoring
|
|
45
|
+
|
|
46
|
+
### Phase 6: Flask Integration (Priority: Medium)
|
|
47
|
+
- [ ] Complete Flask extension implementation
|
|
48
|
+
- [ ] Add API endpoints documentation
|
|
49
|
+
- [ ] Create Flask example applications
|
|
50
|
+
- [ ] Implement authentication and security
|
|
51
|
+
|
|
52
|
+
### Phase 7: CLI Enhancements (Priority: Medium)
|
|
53
|
+
- [ ] Add interactive mode
|
|
54
|
+
- [ ] Implement configuration file support
|
|
55
|
+
- [ ] Add progress indicators for long operations
|
|
56
|
+
- [ ] Create configuration management
|
|
57
|
+
|
|
58
|
+
### Phase 8: Testing & Documentation (Priority: High)
|
|
59
|
+
- [ ] Write comprehensive unit tests
|
|
60
|
+
- [ ] Create integration tests
|
|
61
|
+
- [ ] Add example projects for testing
|
|
62
|
+
- [ ] Write detailed documentation
|
|
63
|
+
- [ ] Create video tutorials or demos
|
|
64
|
+
|
|
65
|
+
### Phase 9: Package Distribution (Priority: Medium)
|
|
66
|
+
- [ ] Set up CI/CD pipeline
|
|
67
|
+
- [ ] Configure package publishing
|
|
68
|
+
- [ ] Create setup scripts
|
|
69
|
+
- [ ] Add auto-update capabilities
|
|
70
|
+
|
|
71
|
+
## Technical Decisions
|
|
72
|
+
|
|
73
|
+
### Package Management
|
|
74
|
+
- **Tool**: `uv` for fast Python package management
|
|
75
|
+
- **Build System**: `hatchling` for modern Python packaging
|
|
76
|
+
- **Dependency Management**: `pyproject.toml` with uv
|
|
77
|
+
|
|
78
|
+
### LLM Integration Strategy
|
|
79
|
+
- **Abstract Interface**: Create a base `LLMProvider` class
|
|
80
|
+
- **Multiple Providers**: Support OpenAI, Anthropic, and local models
|
|
81
|
+
- **Configuration**: Environment variables and explicit configuration
|
|
82
|
+
- **Fallback Mechanisms**: Graceful degradation if primary provider fails
|
|
83
|
+
|
|
84
|
+
### Tool Generation Approach
|
|
85
|
+
- **Template-based**: Use templates for common tool types
|
|
86
|
+
- **LLM-assisted**: Use LLM for complex tool generation
|
|
87
|
+
- **Hybrid**: Combine template and LLM generation
|
|
88
|
+
- **Validation**: Validate generated tools before execution
|
|
89
|
+
|
|
90
|
+
### Security Considerations
|
|
91
|
+
- **Sandboxing**: Execute tools in isolated environments
|
|
92
|
+
- **Input Validation**: Validate all user inputs
|
|
93
|
+
- **Access Control**: Implement permission checks
|
|
94
|
+
- **Audit Logging**: Log all tool executions
|
|
95
|
+
|
|
96
|
+
## File Structure
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
tool_maker/
|
|
100
|
+
├── src/
|
|
101
|
+
│ └── tool_maker/
|
|
102
|
+
│ ├── __init__.py # Main package init
|
|
103
|
+
│ ├── tool_maker.py # Main ToolMaker class
|
|
104
|
+
│ ├── analyzer/
|
|
105
|
+
│ │ ├── __init__.py
|
|
106
|
+
│ │ ├── project_scanner.py # Project analysis
|
|
107
|
+
│ │ └── dependency_parser.py # Dependency analysis
|
|
108
|
+
│ ├── llm/
|
|
109
|
+
│ │ ├── __init__.py
|
|
110
|
+
│ │ ├── provider.py # LLM providers
|
|
111
|
+
│ │ ├── prompt_manager.py # Prompt templates
|
|
112
|
+
│ │ └── conversation.py # Conversation history
|
|
113
|
+
│ ├── tool/
|
|
114
|
+
│ │ ├── __init__.py
|
|
115
|
+
│ │ ├── generator.py # Tool generation
|
|
116
|
+
│ │ ├── executor.py # Tool execution
|
|
117
|
+
│ │ ├── validator.py # Tool validation
|
|
118
|
+
│ │ └── sandbox.py # Tool sandboxing
|
|
119
|
+
│ ├── flask/
|
|
120
|
+
│ │ ├── __init__.py
|
|
121
|
+
│ │ └── extension.py # Flask extension
|
|
122
|
+
│ └── cli/
|
|
123
|
+
│ ├── __init__.py
|
|
124
|
+
│ └── main.py # CLI entry point
|
|
125
|
+
├── tests/
|
|
126
|
+
│ ├── __init__.py
|
|
127
|
+
│ ├── test_analyzer.py
|
|
128
|
+
│ ├── test_llm.py
|
|
129
|
+
│ ├── test_tool_generation.py
|
|
130
|
+
│ └── test_integration.py
|
|
131
|
+
├── examples/
|
|
132
|
+
│ ├── basic_usage.py
|
|
133
|
+
│ ├── flask_integration.py
|
|
134
|
+
│ └── custom_analyzer.py
|
|
135
|
+
├── pyproject.toml
|
|
136
|
+
├── requirements.txt
|
|
137
|
+
├── README.md
|
|
138
|
+
├── DEVELOPMENT.md
|
|
139
|
+
└── PLAN.md # This file
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Dependencies
|
|
143
|
+
|
|
144
|
+
### Core Dependencies
|
|
145
|
+
- `requests` or `httpx` for HTTP requests
|
|
146
|
+
- `pathlib` for file operations
|
|
147
|
+
- `ast` for Python code analysis
|
|
148
|
+
|
|
149
|
+
### Optional Dependencies
|
|
150
|
+
- `openai` for OpenAI integration
|
|
151
|
+
- `anthropic` for Claude integration
|
|
152
|
+
- `flask` for Flask integration
|
|
153
|
+
- `tomli` for TOML parsing (Python < 3.11)
|
|
154
|
+
|
|
155
|
+
### Development Dependencies
|
|
156
|
+
- `pytest` for testing
|
|
157
|
+
- `black` for code formatting
|
|
158
|
+
- `ruff` for linting
|
|
159
|
+
- `mypy` for type checking
|
|
160
|
+
|
|
161
|
+
## API Design
|
|
162
|
+
|
|
163
|
+
### Main ToolMaker Class
|
|
164
|
+
```python
|
|
165
|
+
class ToolMaker:
|
|
166
|
+
def __init__(self, llm_provider: LLMProvider):
|
|
167
|
+
self.llm_provider = llm_provider
|
|
168
|
+
self.project_scanner = ProjectScanner()
|
|
169
|
+
self.tool_generator = ToolGenerator()
|
|
170
|
+
self.tool_executor = ToolExecutor()
|
|
171
|
+
|
|
172
|
+
def analyze_project(self, project_path: str) -> Dict[str, Any]:
|
|
173
|
+
pass
|
|
174
|
+
|
|
175
|
+
def create_tool(self, query: str, project_path: str = ".") -> Tool:
|
|
176
|
+
pass
|
|
177
|
+
|
|
178
|
+
def execute_tool(self, tool: Tool, **kwargs) -> ToolResult:
|
|
179
|
+
pass
|
|
180
|
+
|
|
181
|
+
def create_and_execute_tool(self, query: str, project_path: str = ".") -> ToolResult:
|
|
182
|
+
pass
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### LLM Provider Interface
|
|
186
|
+
```python
|
|
187
|
+
class LLMProvider(ABC):
|
|
188
|
+
@abstractmethod
|
|
189
|
+
async def generate(self, prompt: str, **kwargs) -> str:
|
|
190
|
+
pass
|
|
191
|
+
|
|
192
|
+
@abstractmethod
|
|
193
|
+
async def analyze_project(self, project_info: Dict[str, Any]) -> Dict[str, Any]:
|
|
194
|
+
pass
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Tool Class
|
|
198
|
+
```python
|
|
199
|
+
@dataclass
|
|
200
|
+
class Tool:
|
|
201
|
+
name: str
|
|
202
|
+
description: str
|
|
203
|
+
parameters: Dict[str, Any]
|
|
204
|
+
code: str
|
|
205
|
+
module: str = "generated_tools"
|
|
206
|
+
function_name: str = ""
|
|
207
|
+
dependencies: List[str] = field(default_factory=list)
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Next Steps
|
|
211
|
+
|
|
212
|
+
1. **Implement ToolMaker class** - Create the main orchestrator class
|
|
213
|
+
2. **Add unit tests** - Test core functionality
|
|
214
|
+
3. **Implement LLM provider** - Add OpenAI integration
|
|
215
|
+
4. **Create example projects** - Test with real projects
|
|
216
|
+
5. **Documentation** - Write comprehensive docs
|
|
217
|
+
|
|
218
|
+
## Timeline Estimate
|
|
219
|
+
|
|
220
|
+
- **Phase 1**: 2-3 days
|
|
221
|
+
- **Phase 2**: 3-4 days
|
|
222
|
+
- **Phase 3**: 4-5 days
|
|
223
|
+
- **Phase 4**: 3-4 days
|
|
224
|
+
- **Phase 5**: 2-3 days
|
|
225
|
+
- **Phase 6**: 2-3 days
|
|
226
|
+
- **Phase 7**: 1-2 days
|
|
227
|
+
- **Phase 8**: 3-4 days
|
|
228
|
+
- **Phase 9**: 2-3 days
|
|
229
|
+
|
|
230
|
+
**Total**: ~20-30 days for a functional package
|
|
231
|
+
|
|
232
|
+
## Success Criteria
|
|
233
|
+
|
|
234
|
+
- [ ] Package can be installed with `uv add tool-maker`
|
|
235
|
+
- [ ] Package can be used standalone or with Flask
|
|
236
|
+
- [ ] Project analysis works for common Python projects
|
|
237
|
+
- [ ] LLM integration supports at least one provider
|
|
238
|
+
- [ ] Tool generation creates functional code
|
|
239
|
+
- [ ] CLI interface works for basic operations
|
|
240
|
+
- [ ] All tests pass
|
|
241
|
+
- [ ] Documentation is complete
|
|
242
|
+
|
|
243
|
+
## Notes
|
|
244
|
+
|
|
245
|
+
- Keep the package lightweight and focused
|
|
246
|
+
- Prioritize core functionality over features
|
|
247
|
+
- Make it easy to extend with new LLM providers
|
|
248
|
+
- Ensure security in tool execution
|
|
249
|
+
- Provide clear examples for users
|