devorch 0.3.0__tar.gz → 0.5.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.
- devorch-0.5.0/.github/ISSUE_TEMPLATE/bug_report.yml +60 -0
- devorch-0.5.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
- devorch-0.5.0/.github/ISSUE_TEMPLATE/feature_request.yml +25 -0
- devorch-0.5.0/.github/PULL_REQUEST_TEMPLATE.md +18 -0
- devorch-0.5.0/.github/dependabot.yml +11 -0
- {devorch-0.3.0 → devorch-0.5.0}/.github/workflows/ci.yml +0 -2
- devorch-0.5.0/CHANGELOG.md +52 -0
- devorch-0.5.0/CODE_OF_CONDUCT.md +32 -0
- devorch-0.5.0/CONTRIBUTING.md +80 -0
- devorch-0.5.0/DEVORCH.md +48 -0
- devorch-0.5.0/PKG-INFO +669 -0
- devorch-0.5.0/README.md +623 -0
- devorch-0.5.0/SECURITY.md +34 -0
- devorch-0.5.0/cli/commands/_output.py +151 -0
- {devorch-0.3.0 → devorch-0.5.0}/cli/commands/_shared.py +119 -13
- {devorch-0.3.0 → devorch-0.5.0}/cli/commands/ask.py +43 -13
- {devorch-0.3.0 → devorch-0.5.0}/cli/commands/edit.py +15 -3
- {devorch-0.3.0 → devorch-0.5.0}/cli/commands/run.py +40 -14
- devorch-0.5.0/cli/constants.py +222 -0
- {devorch-0.3.0 → devorch-0.5.0}/cli/main.py +881 -141
- devorch-0.5.0/cli/prompt_ui.py +258 -0
- devorch-0.5.0/cli/repl_commands.py +259 -0
- {devorch-0.3.0 → devorch-0.5.0}/config/permissions.py +46 -4
- devorch-0.5.0/config/project_settings.py +235 -0
- {devorch-0.3.0 → devorch-0.5.0}/config/settings.py +61 -2
- {devorch-0.3.0 → devorch-0.5.0}/core/agent.py +158 -168
- devorch-0.5.0/core/checkpoints.py +103 -0
- devorch-0.5.0/core/context.py +238 -0
- {devorch-0.3.0 → devorch-0.5.0}/core/executor.py +38 -2
- devorch-0.5.0/core/hooks.py +182 -0
- devorch-0.5.0/core/images.py +115 -0
- devorch-0.5.0/core/loop_detector.py +185 -0
- devorch-0.5.0/core/mentions.py +118 -0
- devorch-0.5.0/core/pricing.py +161 -0
- devorch-0.5.0/core/project_context.py +193 -0
- devorch-0.5.0/core/project_memory.py +317 -0
- {devorch-0.3.0 → devorch-0.5.0}/core/skills.py +81 -1
- devorch-0.5.0/providers/anthropic.py +213 -0
- devorch-0.5.0/providers/base.py +340 -0
- {devorch-0.3.0 → devorch-0.5.0}/providers/custom.py +37 -26
- {devorch-0.3.0 → devorch-0.5.0}/providers/deepseek.py +34 -26
- {devorch-0.3.0 → devorch-0.5.0}/providers/gemini.py +56 -10
- {devorch-0.3.0 → devorch-0.5.0}/providers/github_copilot.py +35 -26
- {devorch-0.3.0 → devorch-0.5.0}/providers/groq.py +15 -4
- {devorch-0.3.0 → devorch-0.5.0}/providers/kimi.py +35 -26
- {devorch-0.3.0 → devorch-0.5.0}/providers/lmstudio.py +15 -4
- {devorch-0.3.0 → devorch-0.5.0}/providers/local.py +20 -5
- {devorch-0.3.0 → devorch-0.5.0}/providers/mistral.py +15 -4
- {devorch-0.3.0 → devorch-0.5.0}/providers/openai.py +28 -5
- {devorch-0.3.0 → devorch-0.5.0}/providers/openrouter.py +51 -4
- {devorch-0.3.0 → devorch-0.5.0}/providers/together.py +15 -4
- {devorch-0.3.0 → devorch-0.5.0}/pyproject.toml +5 -2
- devorch-0.5.0/schemas/message.py +56 -0
- devorch-0.5.0/tests/_screen.py +78 -0
- devorch-0.5.0/tests/conftest.py +43 -0
- devorch-0.5.0/tests/test_anthropic_caching.py +134 -0
- devorch-0.5.0/tests/test_boxed_input.py +209 -0
- devorch-0.5.0/tests/test_checkpoints.py +85 -0
- devorch-0.5.0/tests/test_context.py +72 -0
- {devorch-0.3.0 → devorch-0.5.0}/tests/test_core.py +17 -0
- devorch-0.5.0/tests/test_custom_commands.py +68 -0
- devorch-0.5.0/tests/test_git_tool.py +87 -0
- devorch-0.5.0/tests/test_hooks.py +145 -0
- devorch-0.5.0/tests/test_images.py +209 -0
- devorch-0.5.0/tests/test_interrupt.py +195 -0
- devorch-0.5.0/tests/test_isolation.py +41 -0
- devorch-0.5.0/tests/test_json_output.py +90 -0
- devorch-0.5.0/tests/test_loop_detector.py +62 -0
- devorch-0.5.0/tests/test_mentions.py +105 -0
- devorch-0.5.0/tests/test_openrouter_caching.py +85 -0
- devorch-0.5.0/tests/test_prefix_stability.py +55 -0
- devorch-0.5.0/tests/test_pricing.py +243 -0
- devorch-0.5.0/tests/test_proc.py +107 -0
- devorch-0.5.0/tests/test_project_context.py +65 -0
- devorch-0.5.0/tests/test_project_memory.py +134 -0
- devorch-0.5.0/tests/test_project_settings.py +154 -0
- devorch-0.5.0/tests/test_prompt_ui.py +287 -0
- devorch-0.5.0/tests/test_repl_commands.py +307 -0
- devorch-0.5.0/tests/test_streaming.py +422 -0
- devorch-0.5.0/tests/test_tool_display.py +278 -0
- {devorch-0.3.0 → devorch-0.5.0}/tests/test_tools.py +48 -0
- {devorch-0.3.0 → devorch-0.5.0}/tools/__init__.py +3 -0
- {devorch-0.3.0 → devorch-0.5.0}/tools/agent.py +11 -2
- {devorch-0.3.0 → devorch-0.5.0}/tools/edit.py +30 -1
- devorch-0.5.0/tools/git.py +173 -0
- {devorch-0.3.0 → devorch-0.5.0}/tools/grep.py +10 -5
- devorch-0.5.0/tools/shell.py +103 -0
- {devorch-0.3.0 → devorch-0.5.0}/tools/terminal_session.py +1 -1
- {devorch-0.3.0 → devorch-0.5.0}/utils/logger.py +35 -14
- devorch-0.5.0/utils/proc.py +77 -0
- devorch-0.5.0/utils/streaming.py +78 -0
- devorch-0.5.0/utils/tool_display.py +210 -0
- devorch-0.3.0/PKG-INFO +0 -456
- devorch-0.3.0/README.md +0 -414
- devorch-0.3.0/cli/constants.py +0 -161
- devorch-0.3.0/core/context.py +0 -0
- devorch-0.3.0/providers/anthropic.py +0 -127
- devorch-0.3.0/providers/base.py +0 -51
- devorch-0.3.0/schemas/message.py +0 -32
- devorch-0.3.0/tools/git.py +0 -0
- devorch-0.3.0/tools/shell.py +0 -55
- {devorch-0.3.0 → devorch-0.5.0}/.github/workflows/publish.yml +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/.gitignore +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/LICENSE +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/assets/chat.png +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/assets/models.png +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/assets/providers.png +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/assets/startup.png +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/assets/terminal.png +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/assets/tools.png +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/config/profiles.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/core/mcp.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/core/memory.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/core/modes.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/core/planner.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/core/sessions.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/core/tasks.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/providers/__init__.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/schemas/task.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/schemas/tool.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/tests/__init__.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/tests/test_integration.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/tests/test_permissions.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/tests/test_schemas.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/tools/base.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/tools/filesystem.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/tools/search.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/tools/task.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/tools/tests.py +0 -0
- {devorch-0.3.0 → devorch-0.5.0}/tools/websearch.py +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Something is broken or behaves unexpectedly
|
|
3
|
+
labels: ["bug"]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
Thanks for reporting! **Remove API keys and other secrets** from anything you paste.
|
|
9
|
+
For security problems, do not open an issue: see SECURITY.md.
|
|
10
|
+
- type: textarea
|
|
11
|
+
id: what-happened
|
|
12
|
+
attributes:
|
|
13
|
+
label: What happened?
|
|
14
|
+
description: What did you do, what did you expect, and what happened instead?
|
|
15
|
+
validations:
|
|
16
|
+
required: true
|
|
17
|
+
- type: textarea
|
|
18
|
+
id: repro
|
|
19
|
+
attributes:
|
|
20
|
+
label: Steps to reproduce
|
|
21
|
+
placeholder: |
|
|
22
|
+
1. Run `devorch -p openai`
|
|
23
|
+
2. Type ...
|
|
24
|
+
3. See ...
|
|
25
|
+
validations:
|
|
26
|
+
required: true
|
|
27
|
+
- type: input
|
|
28
|
+
id: version
|
|
29
|
+
attributes:
|
|
30
|
+
label: DevOrch version
|
|
31
|
+
description: Output of `devorch --version` (or `pip show devorch`)
|
|
32
|
+
validations:
|
|
33
|
+
required: true
|
|
34
|
+
- type: input
|
|
35
|
+
id: provider
|
|
36
|
+
attributes:
|
|
37
|
+
label: Provider and model
|
|
38
|
+
placeholder: openai / gpt-4o
|
|
39
|
+
- type: dropdown
|
|
40
|
+
id: os
|
|
41
|
+
attributes:
|
|
42
|
+
label: Operating system
|
|
43
|
+
options: [Linux, macOS, Windows, Other]
|
|
44
|
+
validations:
|
|
45
|
+
required: true
|
|
46
|
+
- type: input
|
|
47
|
+
id: python
|
|
48
|
+
attributes:
|
|
49
|
+
label: Python version
|
|
50
|
+
placeholder: "3.12"
|
|
51
|
+
- type: input
|
|
52
|
+
id: terminal
|
|
53
|
+
attributes:
|
|
54
|
+
label: Terminal
|
|
55
|
+
description: For display or input problems (e.g. iTerm2, Windows Terminal, GNOME Terminal, tmux)
|
|
56
|
+
- type: textarea
|
|
57
|
+
id: logs
|
|
58
|
+
attributes:
|
|
59
|
+
label: Output / logs
|
|
60
|
+
render: shell
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Feature request
|
|
2
|
+
description: Suggest an idea or improvement
|
|
3
|
+
labels: ["enhancement"]
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: problem
|
|
7
|
+
attributes:
|
|
8
|
+
label: What problem would this solve?
|
|
9
|
+
description: Describe the use case, not just the solution.
|
|
10
|
+
validations:
|
|
11
|
+
required: true
|
|
12
|
+
- type: textarea
|
|
13
|
+
id: proposal
|
|
14
|
+
attributes:
|
|
15
|
+
label: Proposed solution
|
|
16
|
+
- type: textarea
|
|
17
|
+
id: alternatives
|
|
18
|
+
attributes:
|
|
19
|
+
label: Alternatives you considered
|
|
20
|
+
- type: checkboxes
|
|
21
|
+
id: contribute
|
|
22
|
+
attributes:
|
|
23
|
+
label: Contribution
|
|
24
|
+
options:
|
|
25
|
+
- label: I'd be willing to open a pull request for this
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
<!-- What does this change and why? Link the issue it closes (Fixes #123). -->
|
|
4
|
+
|
|
5
|
+
## Changes
|
|
6
|
+
|
|
7
|
+
-
|
|
8
|
+
|
|
9
|
+
## How it was tested
|
|
10
|
+
|
|
11
|
+
<!-- Tests added/updated, and anything you ran manually. Be explicit about what you did NOT test. -->
|
|
12
|
+
|
|
13
|
+
## Checklist
|
|
14
|
+
|
|
15
|
+
- [ ] `ruff check .` and `ruff format --check .` pass
|
|
16
|
+
- [ ] `pytest` passes, with tests for new behaviour (a bug fix has a test that fails without it)
|
|
17
|
+
- [ ] README / `CHANGELOG.md` updated for user-facing changes
|
|
18
|
+
- [ ] No secrets, personal paths or API keys in code, tests, or logs
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
A large feature release: hooks, checkpoints, project settings, image input, streaming, prompt caching,
|
|
6
|
+
cost estimates, and a much more robust terminal UI.
|
|
7
|
+
|
|
8
|
+
### Upgrade notes
|
|
9
|
+
- **Project hooks and some project settings now need `devorch trust`.** `.devorch/hooks.yaml`, a project's
|
|
10
|
+
`mcp_servers`, permission `allow` rules and `default_mode: auto` are ignored (with a warning) until you review the
|
|
11
|
+
files and run `devorch trust`. Editing either file revokes trust.
|
|
12
|
+
- **Ctrl+C no longer quits.** It cancels the current turn; press it twice at an idle prompt (or type `exit`) to quit.
|
|
13
|
+
- **`/undo` now also restores files** the agent changed with `edit` / `filesystem write` (not shell commands).
|
|
14
|
+
- **The REPL clears the visible screen on start** (scrollback is kept). Set `DEVORCH_NO_CLEAR=1` to disable.
|
|
15
|
+
- `devorch run --mode` now defaults to the project setting, falling back to `auto`.
|
|
16
|
+
- Requires `prompt_toolkit>=3.0.28`.
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
- **Hooks**: `PreToolUse` / `PostToolUse` shell hooks (`~/.devorch/hooks.yaml`, `.devorch/hooks.yaml`).
|
|
20
|
+
- **Checkpoints**: file snapshots per turn, restored by `/undo`; `/checkpoints` lists them.
|
|
21
|
+
- **Custom slash commands** from Markdown files (`~/.devorch/commands`, `.devorch/commands`) with `$ARGUMENTS`.
|
|
22
|
+
- **`@file` mentions** with line ranges, directories and tab completion.
|
|
23
|
+
- **Image input**: `@screenshot.png` for vision models across providers; large images are downscaled
|
|
24
|
+
(optional `devorch[images]`) and old images are pruned from context to save tokens.
|
|
25
|
+
- **`--output json` / `stream-json`** for `ask` and `run`, with usage, tool calls and cost.
|
|
26
|
+
- **Structured `git` tool** (status, diff, log, show, branch, switch, add, commit); no push/reset/force.
|
|
27
|
+
- **Per-project settings** (`.devorch/settings.yaml`) with a trust model.
|
|
28
|
+
- **Streaming** replies for every provider.
|
|
29
|
+
- **Prompt caching** for Anthropic (and `anthropic/*` via OpenRouter); tests guard prompt-prefix stability so
|
|
30
|
+
OpenAI/DeepSeek/Kimi/Gemini automatic caches keep hitting.
|
|
31
|
+
- **`/cost`** and cost estimates in the per-turn line, `/tokens`, the bottom bar and JSON output; prices are
|
|
32
|
+
approximate and overridable under `pricing:` in `config.yaml`.
|
|
33
|
+
- **More slash commands**, matching the CLI: `/permissions allow|deny|set|reset`, `/sessions`, `/hooks`, `/trust`,
|
|
34
|
+
`/untrust`, `/exit`.
|
|
35
|
+
- **`--mode` for `devorch` / `devorch chat`, and `--dangerously-skip-permissions`** on every entry point (same as
|
|
36
|
+
`--mode auto`: no prompts; dangerous-command blocks and deny rules still apply).
|
|
37
|
+
- **Input surface**: open input box with a coloured mode label, `Shift+Tab` mode cycling, `Ctrl+J` newline, a
|
|
38
|
+
width-aware placeholder and bottom bar, context-usage gauge.
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
- **Anthropic: the base system prompt was overwritten** by plan-mode / loop-advisory system messages.
|
|
42
|
+
- **Tool output crashed the turn** (`MarkupError`) when a command, path, result or diff contained text like `[/x]`,
|
|
43
|
+
and silently lost brackets (`app/[id]/page.tsx`, `List[int]`). Message helpers now escape their text.
|
|
44
|
+
- Reading a file that merely contained `Error:` was shown as a red failure.
|
|
45
|
+
- Ctrl+C inside a sub-agent was swallowed and the parent kept running.
|
|
46
|
+
- The bottom toolbar re-ran `git` on every keystroke; it is now cached.
|
|
47
|
+
- The bottom toolbar rendered as a bright reversed bar, and was clipped on narrow terminals, hiding the mode.
|
|
48
|
+
- Saving config no longer drops a `pricing:` section.
|
|
49
|
+
- The slash-command dropdown vanished when a command was fully typed (`/cost`, `/models`).
|
|
50
|
+
|
|
51
|
+
### Changed
|
|
52
|
+
- CI runs on pull requests only.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
We want DevOrch to be a friendly, welcoming project for everyone, whatever their background or experience.
|
|
4
|
+
|
|
5
|
+
## Our standards
|
|
6
|
+
|
|
7
|
+
Expected:
|
|
8
|
+
|
|
9
|
+
- Be respectful and patient, especially with people who are new.
|
|
10
|
+
- Give and accept constructive feedback; critique the work, not the person.
|
|
11
|
+
- Assume good faith, and ask when something is unclear.
|
|
12
|
+
- Keep discussion on topic and credit other people's work.
|
|
13
|
+
|
|
14
|
+
Not acceptable:
|
|
15
|
+
|
|
16
|
+
- Harassment, insults, personal attacks, or discriminatory language or jokes.
|
|
17
|
+
- Trolling, deliberately derailing threads, or spamming.
|
|
18
|
+
- Publishing someone else's private information.
|
|
19
|
+
- Any other conduct that would reasonably be considered inappropriate in a professional setting.
|
|
20
|
+
|
|
21
|
+
## Scope
|
|
22
|
+
|
|
23
|
+
This applies in all project spaces (issues, pull requests, discussions, commits) and when someone is
|
|
24
|
+
representing the project in public.
|
|
25
|
+
|
|
26
|
+
## Enforcement
|
|
27
|
+
|
|
28
|
+
Maintainers may edit or remove comments, close or lock threads, and ban people who do not follow these
|
|
29
|
+
standards. To report a problem privately, contact the maintainer at the address listed in the `authors`
|
|
30
|
+
field of `pyproject.toml`. Reports are treated confidentially.
|
|
31
|
+
|
|
32
|
+
This policy is inspired by the [Contributor Covenant](https://www.contributor-covenant.org).
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Contributing to DevOrch
|
|
2
|
+
|
|
3
|
+
Thanks for helping out! DevOrch is a multi-provider AI coding assistant CLI, and contributions of all sizes
|
|
4
|
+
are welcome: bug reports, docs, tests, new providers, tools and features.
|
|
5
|
+
|
|
6
|
+
By participating you agree to follow the [Code of Conduct](CODE_OF_CONDUCT.md). To report a security problem,
|
|
7
|
+
see [SECURITY.md](SECURITY.md) instead of opening a public issue.
|
|
8
|
+
|
|
9
|
+
## Getting set up
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
git clone https://github.com/Amanbig/DevOrch.git
|
|
13
|
+
cd DevOrch
|
|
14
|
+
python -m venv .venv && source .venv/bin/activate # or: uv venv && source .venv/bin/activate
|
|
15
|
+
pip install -e ".[dev]" # or: uv pip install -e ".[dev]"
|
|
16
|
+
|
|
17
|
+
pytest # the whole suite; no network or API keys needed
|
|
18
|
+
ruff check . # lint
|
|
19
|
+
ruff format . # format (CI runs `ruff format --check .`)
|
|
20
|
+
devorch # run your working copy
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Python 3.10+ is required; CI runs the tests on Linux, macOS and Windows for 3.10-3.13, so avoid
|
|
24
|
+
platform-specific assumptions (paths, shells, terminal behaviour) and keep type hints 3.10-compatible.
|
|
25
|
+
|
|
26
|
+
## Workflow
|
|
27
|
+
|
|
28
|
+
1. Open an issue first for anything large, so we can agree on the approach.
|
|
29
|
+
2. Create a branch per change (`feat/...`, `fix/...`, `docs/...`, `chore/...`).
|
|
30
|
+
3. Keep PRs focused: one feature or fix per PR.
|
|
31
|
+
4. Use clear, conventional-style commit messages (`feat(hooks): ...`, `fix(ui): ...`).
|
|
32
|
+
5. Open a PR against `main`. CI must pass (lint + tests on all platforms).
|
|
33
|
+
|
|
34
|
+
A good PR includes:
|
|
35
|
+
|
|
36
|
+
- **Tests** for new behaviour and for the bug it fixes. A regression test should fail without your fix.
|
|
37
|
+
- **Docs**: update the README for user-facing changes and add a line to `CHANGELOG.md`.
|
|
38
|
+
- An honest description: what changed, why, what you did **not** test.
|
|
39
|
+
|
|
40
|
+
## Where things live
|
|
41
|
+
|
|
42
|
+
See [`DEVORCH.md`](DEVORCH.md) and the project structure in the README. In short: `cli/` (commands, REPL, UI),
|
|
43
|
+
`core/` (agent loop, executor, hooks, memory, sessions), `providers/` (one file per LLM provider), `tools/`
|
|
44
|
+
(built-in tools), `config/` (settings, permissions, project settings), `tests/`.
|
|
45
|
+
|
|
46
|
+
### Adding a provider
|
|
47
|
+
|
|
48
|
+
Subclass `LLMProvider` in `providers/<name>.py`, implement `generate()`, and register it in
|
|
49
|
+
`providers/__init__.py`. Set the capability flags honestly: `supports_images` and `supports_streaming`
|
|
50
|
+
(`generate()` then accepts `on_text` and streams deltas). OpenAI-compatible APIs can reuse `chat_create` /
|
|
51
|
+
`post_chat` and `openai_user_content` from `providers/base.py`. Add tests with a mocked client.
|
|
52
|
+
|
|
53
|
+
### Adding a tool
|
|
54
|
+
|
|
55
|
+
Subclass `Tool` in `tools/`, give it a pydantic `args_schema`, register it in `build_tools` /
|
|
56
|
+
`start_repl`, and describe what the user sees in `utils/tool_display.py`. If it changes files, make sure
|
|
57
|
+
checkpoints can snapshot it (`core/checkpoints.py`). Tools that can do damage need permission handling in
|
|
58
|
+
`config/permissions.py`.
|
|
59
|
+
|
|
60
|
+
### Adding a slash command
|
|
61
|
+
|
|
62
|
+
Add it to `SLASH_COMMANDS` in `cli/constants.py` (that feeds the dropdown and `/help`) and handle it in the
|
|
63
|
+
REPL in `cli/main.py`; put non-trivial logic in `cli/repl_commands.py` so it can be tested. A test fails if a
|
|
64
|
+
command appears in the dropdown without a handler.
|
|
65
|
+
|
|
66
|
+
## Testing notes
|
|
67
|
+
|
|
68
|
+
- Tests must not touch your real `~/.devorch`: monkeypatch `Path.home()` and the config paths (see
|
|
69
|
+
`tests/test_repl_commands.py` for a fixture).
|
|
70
|
+
- Do not assert on `--help` text; it is colourised and wrapped differently per terminal. Inspect the
|
|
71
|
+
registered options instead.
|
|
72
|
+
- Terminal UI behaviour (layout, colours, key bindings) is tested on a virtual terminal with
|
|
73
|
+
`tests/_screen.py` (uses `pyte`), so it can be verified without a real terminal.
|
|
74
|
+
- Mock the model: provider tests use fake clients, never live APIs.
|
|
75
|
+
|
|
76
|
+
## Releasing (maintainers)
|
|
77
|
+
|
|
78
|
+
1. Bump the version in `pyproject.toml` **and** `cli/constants.py`, and add the `CHANGELOG.md` entry.
|
|
79
|
+
2. Merge to `main`, then push a `vX.Y.Z` tag. The publish workflow builds, uploads to PyPI and creates the
|
|
80
|
+
GitHub release. Published versions cannot be reused, so double-check before tagging.
|
devorch-0.5.0/DEVORCH.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# DevOrch - AI Coding Assistant CLI
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
DevOrch is an enterprise-ready, multi-provider AI coding assistant CLI with support for 13+ LLM providers, interactive REPL, persistent sessions, tool execution, MCP servers, and background terminal processes.
|
|
5
|
+
|
|
6
|
+
## Tech Stack
|
|
7
|
+
- **Language**: Python 3.10+ (tested on Python 3.10-3.13)
|
|
8
|
+
- **CLI Framework**: Typer, Questionary, Prompt Toolkit, Rich
|
|
9
|
+
- **AI / SDKs**: OpenAI, Anthropic, Google GenAI SDK, HTTPX
|
|
10
|
+
- **Data Validation**: Pydantic v2
|
|
11
|
+
- **Testing & Quality**: Pytest, Pytest-asyncio, Ruff, Mypy
|
|
12
|
+
|
|
13
|
+
## Architecture & Project Structure
|
|
14
|
+
- `cli/`: CLI entrypoints, Typer commands (`ask`, `edit`, `run`, `init`), slash command handlers, banners, and REPL.
|
|
15
|
+
- `core/`: Agent orchestration engine:
|
|
16
|
+
- `agent.py`: Main agentic loop, tool calling, execution loop, plan mode approval.
|
|
17
|
+
- `context.py`: Token estimation, context compaction, tool output pruning, token usage tracking.
|
|
18
|
+
- `loop_detector.py`: Duplicate call detection, oscillation detection, error thrashing prevention, turn advisories.
|
|
19
|
+
- `project_context.py`: Auto-discovers and loads repository instructions (`DEVORCH.md`, `CLAUDE.md`, `AGENTS.md`).
|
|
20
|
+
- `executor.py`: Tool permission enforcement and invocation.
|
|
21
|
+
- `planner.py`: Message preparation and system prompt injection.
|
|
22
|
+
- `sessions.py`: Session persistence, continuation, and summarization.
|
|
23
|
+
- `modes.py`: Agent execution modes (`ASK`, `AUTO`, `PLAN`).
|
|
24
|
+
- `memory.py` & `skills.py`: Persistent memory and skill definitions.
|
|
25
|
+
- `tools/`: Built-in tools:
|
|
26
|
+
- `filesystem.py`: File reading with pagination, writing, directory listing.
|
|
27
|
+
- `edit.py`: Surgical find/replace, line-based editing, diff generation.
|
|
28
|
+
- `grep.py`: Fast regex pattern search across text files.
|
|
29
|
+
- `search.py`: Glob-based file and directory search.
|
|
30
|
+
- `shell.py` & `terminal_session.py`: Shell execution and persistent terminal sessions.
|
|
31
|
+
- `providers/`: Unified LLM provider adapters (`openai`, `anthropic`, `gemini`, `groq`, `deepseek`, etc.).
|
|
32
|
+
- `schemas/`: Dataclasses for `Message`, `ToolCall`, `LLMResponse`, `TokenUsage`.
|
|
33
|
+
|
|
34
|
+
## Common Commands
|
|
35
|
+
- **Run Tests**: `pytest` or `python -m pytest`
|
|
36
|
+
- **Run Single Test**: `pytest tests/test_context.py`
|
|
37
|
+
- **Lint**: `ruff check .`
|
|
38
|
+
- **Format**: `ruff format .`
|
|
39
|
+
- **Type Check**: `mypy .`
|
|
40
|
+
- **Run DevOrch Locally**: `devorch` or `python -m cli.main`
|
|
41
|
+
|
|
42
|
+
## Coding Standards & Minimal Token Guidelines
|
|
43
|
+
1. **Find Before Reading**: Always use `search` (to find file paths) or `grep` (to find symbols/definitions) before reading file contents.
|
|
44
|
+
2. **Inspect Surgically**: Use `filesystem` with `action="read_lines"` or specific line ranges rather than dumping huge files.
|
|
45
|
+
3. **Edit Surgically**: Use `edit` with `action="replace"` or `action="replace_lines"` to generate clean unified diffs. Avoid full file rewrites whenever possible.
|
|
46
|
+
4. **Prevent Loops**: Never repeat identical tool calls with the same arguments. If a tool fails or finds nothing, alter the query or check file paths.
|
|
47
|
+
5. **Verify Changes**: After modifying code, always run the relevant pytest test suite to verify correctness before reporting completion.
|
|
48
|
+
6. **Preserve Compatibility**: Keep type hints compatible with Python 3.10+ (use `|` for unions or `Optional`/`Union`).
|