fastmcp-agents-library-agent-simple-code 0.5.1__tar.gz → 0.5.8__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.
Files changed (11) hide show
  1. {fastmcp_agents_library_agent_simple_code-0.5.1 → fastmcp_agents_library_agent_simple_code-0.5.8}/PKG-INFO +6 -3
  2. {fastmcp_agents_library_agent_simple_code-0.5.1 → fastmcp_agents_library_agent_simple_code-0.5.8}/pyproject.toml +9 -8
  3. {fastmcp_agents_library_agent_simple_code-0.5.1 → fastmcp_agents_library_agent_simple_code-0.5.8/src}/fastmcp_agents/library/agent/simple_code/investigate.py +33 -3
  4. fastmcp_agents_library_agent_simple_code-0.5.1/.gitignore +0 -183
  5. {fastmcp_agents_library_agent_simple_code-0.5.1 → fastmcp_agents_library_agent_simple_code-0.5.8}/README.md +0 -0
  6. {fastmcp_agents_library_agent_simple_code-0.5.1 → fastmcp_agents_library_agent_simple_code-0.5.8/src}/fastmcp_agents/library/agent/simple_code/__init__.py +0 -0
  7. {fastmcp_agents_library_agent_simple_code-0.5.1 → fastmcp_agents_library_agent_simple_code-0.5.8/src}/fastmcp_agents/library/agent/simple_code/archive/base.py.disabled +0 -0
  8. {fastmcp_agents_library_agent_simple_code-0.5.1 → fastmcp_agents_library_agent_simple_code-0.5.8/src}/fastmcp_agents/library/agent/simple_code/archive/workspace.py.disabled +0 -0
  9. {fastmcp_agents_library_agent_simple_code-0.5.1 → fastmcp_agents_library_agent_simple_code-0.5.8/src}/fastmcp_agents/library/agent/simple_code/helpers/filesystem.py +0 -0
  10. {fastmcp_agents_library_agent_simple_code-0.5.1 → fastmcp_agents_library_agent_simple_code-0.5.8/src}/fastmcp_agents/library/agent/simple_code/helpers/git.py +0 -0
  11. {fastmcp_agents_library_agent_simple_code-0.5.1 → fastmcp_agents_library_agent_simple_code-0.5.8/src}/fastmcp_agents/library/agent/simple_code/implement.py +0 -0
@@ -1,7 +1,10 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.3
2
2
  Name: fastmcp-agents-library-agent-simple-code
3
- Version: 0.5.1
3
+ Version: 0.5.8
4
4
  Summary: Agents for Simple Code
5
- Requires-Python: >=3.13
6
5
  Requires-Dist: fastmcp-ai-agent-bridge-pydantic-ai>=0.1.2
7
6
  Requires-Dist: gitpython>=3.1.44
7
+ Requires-Dist: fastmcp-agents-library-mcp
8
+ Requires-Python: >=3.13
9
+ Description-Content-Type: text/markdown
10
+
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fastmcp-agents-library-agent-simple-code"
3
- version = "0.5.1"
3
+ version = "0.5.8"
4
4
  description = "Agents for Simple Code"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -8,10 +8,13 @@ requires-python = ">=3.13"
8
8
  dependencies = [
9
9
  "fastmcp-ai-agent-bridge-pydantic-ai>=0.1.2",
10
10
  "gitpython>=3.1.44",
11
+ "fastmcp-agents-library-mcp",
11
12
  ]
12
13
 
13
14
  [project.scripts]
14
- simple-code = "fastmcp_agents.library.agent.simple_code:main"
15
+ simple-code = "fastmcp_agents.library.agent.simple_code:run"
16
+ fastmcp-agents-library-agent-simple-code = "fastmcp_agents.library.agent.simple_code:run"
17
+
15
18
 
16
19
  [tool.uv.sources]
17
20
  fastmcp-agents-library-mcp = { workspace = true }
@@ -26,15 +29,13 @@ dev = [
26
29
  ]
27
30
 
28
31
  [build-system]
29
- requires = ["hatchling"]
30
- build-backend = "hatchling.build"
32
+ requires = ["uv_build>=0.8.2,<0.9.0"]
33
+ build-backend = "uv_build"
31
34
 
35
+ [tool.uv.build-backend]
36
+ module-name = "fastmcp_agents.library.agent.simple_code"
32
37
 
33
- [tool.hatch.build.targets.wheel]
34
- packages = ["src/fastmcp_agents"]
35
38
 
36
- [tool.hatch.build.targets.sdist]
37
- packages = ["src/fastmcp_agents"]
38
39
 
39
40
  [tool.pytest.ini_options]
40
41
  env = ["COLUMNS=120"]
@@ -11,7 +11,7 @@ from typing import Annotated, Any, Literal
11
11
  from fastmcp import FastMCP
12
12
  from fastmcp.tools.tool import Tool
13
13
  from fastmcp_ai_agent_bridge.pydantic_ai import FastMCPToolset
14
- from git import Repo
14
+ from git.repo import Repo
15
15
  from pydantic import AnyHttpUrl, BaseModel, Field, RootModel
16
16
  from pydantic_ai import Agent
17
17
 
@@ -84,6 +84,27 @@ class InvestigationRecommendation(BaseModel):
84
84
  proposed_lines: FileLines = Field(default=..., description="The proposed lines of code in the file with their line numbers.")
85
85
 
86
86
 
87
+ class BranchInfo(BaseModel):
88
+ """A repository info."""
89
+
90
+ name: str
91
+ commit_sha: str
92
+
93
+ @classmethod
94
+ def from_repo(cls, repo: Repo) -> "BranchInfo":
95
+ """Create a branch info from a repository."""
96
+ return cls(name=repo.active_branch.name, commit_sha=repo.head.commit.hexsha)
97
+
98
+ @classmethod
99
+ def from_dir(cls, directory: Path) -> "BranchInfo | None":
100
+ """Create a branch info from a directory."""
101
+ try:
102
+ repo: Repo = Repo(path=directory)
103
+ return cls.from_repo(repo)
104
+ except Exception:
105
+ return None
106
+
107
+
87
108
  class InvestigationResponse(BaseModel):
88
109
  """An investigation response."""
89
110
 
@@ -123,17 +144,20 @@ CODE_REPOSITORY_TYPE = Annotated[
123
144
  ]
124
145
 
125
146
 
126
- async def investigate_code(task: str, code_repository: CODE_REPOSITORY_TYPE) -> InvestigationResponse:
147
+ async def investigate_code(task: str, code_repository: CODE_REPOSITORY_TYPE) -> tuple[InvestigationResponse, BranchInfo | None]:
127
148
  """Perform a code investigation."""
128
149
 
129
150
  with tempfile.TemporaryDirectory(delete=False) as temp_dir:
130
151
  # We only actually use the tempdir if we are cloning a git repository
131
152
  if isinstance(code_repository, AnyHttpUrl):
132
153
  Repo.clone_from(url=str(code_repository), to_path=temp_dir, single_branch=True, depth=1)
154
+
133
155
  code_repository = Path(temp_dir)
134
156
  if code_repository is None:
135
157
  code_repository = Path.cwd()
136
158
 
159
+ branch_info: BranchInfo | None = BranchInfo.from_dir(directory=code_repository)
160
+
137
161
  directory_locked_toolset = FastMCPToolset.from_mcp_config(
138
162
  mcp_config={"filesystem": read_only_filesystem_mcp(root_dir=code_repository)}
139
163
  )
@@ -147,12 +171,18 @@ async def investigate_code(task: str, code_repository: CODE_REPOSITORY_TYPE) ->
147
171
 
148
172
  run_result = await code_investigation_agent.run(user_prompt=[task, repo_info], toolsets=[directory_locked_toolset])
149
173
 
150
- return run_result.output
174
+ return run_result.output, branch_info
151
175
 
152
176
 
153
177
  investigate_code_tool = Tool.from_function(fn=investigate_code)
154
178
 
155
179
  server.add_tool(tool=investigate_code_tool)
156
180
 
181
+
182
+ def run():
183
+ """Run the agent."""
184
+ server.run(transport="stdio")
185
+
186
+
157
187
  if __name__ == "__main__":
158
188
  server.run(transport="sse")
@@ -1,183 +0,0 @@
1
- # Byte-compiled / optimized / DLL files
2
- __pycache__/
3
- *.py[cod]
4
- *$py.class
5
-
6
- # C extensions
7
- *.so
8
-
9
- # Distribution / packaging
10
- .Python
11
- build/
12
- develop-eggs/
13
- dist/
14
- downloads/
15
- eggs/
16
- .eggs/
17
- lib/
18
- lib64/
19
- parts/
20
- sdist/
21
- var/
22
- wheels/
23
- share/python-wheels/
24
- *.egg-info/
25
- .installed.cfg
26
- *.egg
27
- MANIFEST
28
-
29
- # PyInstaller
30
- # Usually these files are written by a python script from a template
31
- # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
- *.manifest
33
- *.spec
34
-
35
- # Installer logs
36
- pip-log.txt
37
- pip-delete-this-directory.txt
38
-
39
- # Unit test / coverage reports
40
- htmlcov/
41
- .tox/
42
- .nox/
43
- .coverage
44
- .coverage.*
45
- .cache
46
- nosetests.xml
47
- coverage.xml
48
- *.cover
49
- *.py,cover
50
- .hypothesis/
51
- .pytest_cache/
52
- cover/
53
-
54
- # Translations
55
- *.mo
56
- *.pot
57
-
58
- # Django stuff:
59
- *.log
60
- local_settings.py
61
- db.sqlite3
62
- db.sqlite3-journal
63
-
64
- # Flask stuff:
65
- instance/
66
- .webassets-cache
67
-
68
- # Scrapy stuff:
69
- .scrapy
70
-
71
- # Sphinx documentation
72
- docs/_build/
73
-
74
- # PyBuilder
75
- .pybuilder/
76
- target/
77
-
78
- # Jupyter Notebook
79
- .ipynb_checkpoints
80
-
81
- # IPython
82
- profile_default/
83
- ipython_config.py
84
-
85
- # pyenv
86
- # For a library or package, you might want to ignore these files since the code is
87
- # intended to run in multiple environments; otherwise, check them in:
88
- # .python-version
89
-
90
- # pipenv
91
- # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
- # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
- # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
- # install all needed dependencies.
95
- #Pipfile.lock
96
-
97
- # UV
98
- # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
- # This is especially recommended for binary packages to ensure reproducibility, and is more
100
- # commonly ignored for libraries.
101
- #uv.lock
102
-
103
- # poetry
104
- # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
- # This is especially recommended for binary packages to ensure reproducibility, and is more
106
- # commonly ignored for libraries.
107
- # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
- #poetry.lock
109
-
110
- # pdm
111
- # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
- #pdm.lock
113
- # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
- # in version control.
115
- # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
- .pdm.toml
117
- .pdm-python
118
- .pdm-build/
119
-
120
- # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
- __pypackages__/
122
-
123
- # Celery stuff
124
- celerybeat-schedule
125
- celerybeat.pid
126
-
127
- # SageMath parsed files
128
- *.sage.py
129
-
130
- # Environments
131
- .env
132
- .env.*
133
- .venv
134
- env/
135
- venv/
136
- ENV/
137
- env.bak/
138
- venv.bak/
139
-
140
- # Spyder project settings
141
- .spyderproject
142
- .spyproject
143
-
144
- # Rope project settings
145
- .ropeproject
146
-
147
- # mkdocs documentation
148
- /site
149
-
150
- # mypy
151
- .mypy_cache/
152
- .dmypy.json
153
- dmypy.json
154
-
155
- # Pyre type checker
156
- .pyre/
157
-
158
- # pytype static type analyzer
159
- .pytype/
160
-
161
- # Cython debug symbols
162
- cython_debug/
163
-
164
- # PyCharm
165
- # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
166
- # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
167
- # and can be added to the global gitignore or merged into this file. For a more nuclear
168
- # option (not recommended) you can uncomment the following to ignore the entire idea folder.
169
- #.idea/
170
-
171
- # Ruff stuff:
172
- .ruff_cache/
173
-
174
- # PyPI configuration file
175
- .pypirc
176
- secrets
177
-
178
- prompt_suggestions
179
- agent-working-dir
180
-
181
- **/*.bak
182
-
183
- storage