copilot-operator 1.0.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.
Files changed (40) hide show
  1. copilot_operator-1.0.0/LICENSE +21 -0
  2. copilot_operator-1.0.0/PKG-INFO +379 -0
  3. copilot_operator-1.0.0/README.md +339 -0
  4. copilot_operator-1.0.0/copilot_operator/__init__.py +16 -0
  5. copilot_operator-1.0.0/copilot_operator/__main__.py +4 -0
  6. copilot_operator-1.0.0/copilot_operator/adversarial.py +215 -0
  7. copilot_operator-1.0.0/copilot_operator/benchmark.py +257 -0
  8. copilot_operator-1.0.0/copilot_operator/bootstrap.py +605 -0
  9. copilot_operator-1.0.0/copilot_operator/brain.py +341 -0
  10. copilot_operator-1.0.0/copilot_operator/cli.py +526 -0
  11. copilot_operator-1.0.0/copilot_operator/config.py +248 -0
  12. copilot_operator-1.0.0/copilot_operator/cross_repo_brain.py +222 -0
  13. copilot_operator-1.0.0/copilot_operator/github_integration.py +313 -0
  14. copilot_operator-1.0.0/copilot_operator/goal_decomposer.py +398 -0
  15. copilot_operator-1.0.0/copilot_operator/intention_guard.py +302 -0
  16. copilot_operator-1.0.0/copilot_operator/llm_brain.py +728 -0
  17. copilot_operator-1.0.0/copilot_operator/logging_config.py +61 -0
  18. copilot_operator-1.0.0/copilot_operator/meta_learner.py +310 -0
  19. copilot_operator-1.0.0/copilot_operator/operator.py +930 -0
  20. copilot_operator-1.0.0/copilot_operator/planner.py +558 -0
  21. copilot_operator-1.0.0/copilot_operator/prompts.py +428 -0
  22. copilot_operator-1.0.0/copilot_operator/py.typed +0 -0
  23. copilot_operator-1.0.0/copilot_operator/reasoning.py +354 -0
  24. copilot_operator-1.0.0/copilot_operator/repo_inspector.py +190 -0
  25. copilot_operator-1.0.0/copilot_operator/repo_map.py +368 -0
  26. copilot_operator-1.0.0/copilot_operator/repo_ops.py +291 -0
  27. copilot_operator-1.0.0/copilot_operator/scheduler.py +245 -0
  28. copilot_operator-1.0.0/copilot_operator/session_store.py +160 -0
  29. copilot_operator-1.0.0/copilot_operator/snapshot.py +210 -0
  30. copilot_operator-1.0.0/copilot_operator/terminal.py +138 -0
  31. copilot_operator-1.0.0/copilot_operator/validation.py +88 -0
  32. copilot_operator-1.0.0/copilot_operator/vscode_chat.py +136 -0
  33. copilot_operator-1.0.0/copilot_operator.egg-info/PKG-INFO +379 -0
  34. copilot_operator-1.0.0/copilot_operator.egg-info/SOURCES.txt +38 -0
  35. copilot_operator-1.0.0/copilot_operator.egg-info/dependency_links.txt +1 -0
  36. copilot_operator-1.0.0/copilot_operator.egg-info/entry_points.txt +2 -0
  37. copilot_operator-1.0.0/copilot_operator.egg-info/requires.txt +15 -0
  38. copilot_operator-1.0.0/copilot_operator.egg-info/top_level.txt +1 -0
  39. copilot_operator-1.0.0/pyproject.toml +75 -0
  40. copilot_operator-1.0.0/setup.cfg +4 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025–2026 Copilot Operator Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,379 @@
1
+ Metadata-Version: 2.4
2
+ Name: copilot-operator
3
+ Version: 1.0.0
4
+ Summary: Autonomous orchestration loop for GitHub Copilot in VS Code — drives multi-iteration coding sessions with self-correction, learning, and intelligent strategy.
5
+ Author: Copilot Operator Contributors
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/copilot-operator/copilot-operator
8
+ Project-URL: Documentation, https://github.com/copilot-operator/copilot-operator#readme
9
+ Project-URL: Repository, https://github.com/copilot-operator/copilot-operator
10
+ Project-URL: Issues, https://github.com/copilot-operator/copilot-operator/issues
11
+ Keywords: copilot,operator,automation,llm,vscode,ai,autonomous-agent
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Quality Assurance
23
+ Classifier: Topic :: Software Development :: Testing
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: pyyaml>=6.0
29
+ Provides-Extra: dev
30
+ Requires-Dist: ruff>=0.4; extra == "dev"
31
+ Requires-Dist: pytest>=8.0; extra == "dev"
32
+ Provides-Extra: dotenv
33
+ Requires-Dist: python-dotenv>=1.0; extra == "dotenv"
34
+ Provides-Extra: rich
35
+ Requires-Dist: rich>=13.0; extra == "rich"
36
+ Provides-Extra: all
37
+ Requires-Dist: python-dotenv>=1.0; extra == "all"
38
+ Requires-Dist: rich>=13.0; extra == "all"
39
+ Dynamic: license-file
40
+
41
+ # Copilot Operator
42
+
43
+ **Autonomous meta-agent that drives GitHub Copilot Chat to complete coding tasks end-to-end.**
44
+
45
+ Copilot Operator doesn't write code itself — it *controls* GitHub Copilot Chat via the VS Code CLI, evaluates results, detects stuck loops, and adapts its strategy until the task is done.
46
+
47
+ ---
48
+
49
+ ## Features
50
+
51
+ | Feature | Description |
52
+ |---------|-------------|
53
+ | **Operator Loop** | Send prompt → parse response → evaluate score → decide continue/stop |
54
+ | **Intelligence Engine** | Trend analysis, loop detection, adaptive strategy hints |
55
+ | **Goal Decomposition** | Auto-classify goals (bug/feature/refactor/docs/audit/stabilize) and build milestone plans. LLM-powered when available. |
56
+ | **Validation** | Run real test/lint/build commands between iterations |
57
+ | **Meta-Learning** | Detect failure patterns, generate prompt guardrails for future runs |
58
+ | **Adversarial Review** | Coder + Critic self-review before accepting results |
59
+ | **Snapshot & Rollback** | Git stash snapshots each iteration; auto-rollback on score regression |
60
+ | **LLM Brain** | Connect to OpenAI, Anthropic, Gemini, or local models for deeper analysis |
61
+ | **Repo Map** | AST + regex codebase index injected into every prompt (15 languages) — like Aider |
62
+ | **GitHub Integration** | Auto-fetch issues, create PRs — all via REST API (stdlib only) |
63
+ | **Cross-Repo Brain** | Share learnings across repositories via `~/.copilot-operator/shared-brain/` |
64
+ | **Adaptive Guardrails** | Static + dynamic guardrails that evolve based on run history |
65
+ | **Benchmark Engine** | Run and score operator cases against keyword expectations |
66
+ | **Live Mode** | Colour-coded real-time iteration progress in the terminal (`--live`) |
67
+ | **Dry-Run Mode** | Generate prompts without VS Code interaction — safe for testing |
68
+ | **Error Recovery** | Retry on transient errors, stop on consecutive failures |
69
+ | **Circuit Breaker** | Rate-limit protection for LLM and GitHub API calls |
70
+
71
+ ---
72
+
73
+ ## Quick Start
74
+
75
+ ### Requirements
76
+
77
+ - Python 3.10+
78
+ - VS Code with GitHub Copilot extension
79
+ - `code` CLI available in PATH
80
+
81
+ ### Install
82
+
83
+ ```bash
84
+ pip install copilot-operator
85
+ ```
86
+
87
+ Or from source:
88
+
89
+ ```bash
90
+ git clone https://github.com/copilot-operator/copilot-operator
91
+ cd copilot-operator
92
+ pip install -e .
93
+ ```
94
+
95
+ ### Setup
96
+
97
+ ```bash
98
+ # Scaffold workspace config
99
+ copilot-operator init
100
+
101
+ # Pre-flight checks
102
+ copilot-operator doctor
103
+ ```
104
+
105
+ ### Run
106
+
107
+ ```bash
108
+ # Autonomous run with a goal
109
+ copilot-operator run --goal "Fix the login timeout bug in auth.py"
110
+
111
+ # Live colour-coded progress
112
+ copilot-operator run --goal "Add pagination to API" --live
113
+
114
+ # Dry-run: see the generated prompt without executing
115
+ copilot-operator run --goal "Add pagination to API" --dry-run
116
+
117
+ # Resume a stopped or blocked run
118
+ copilot-operator resume
119
+
120
+ # Fix a specific GitHub issue
121
+ copilot-operator fix-issue --issue 42 --repo owner/repo
122
+
123
+ # Watch progress live
124
+ copilot-operator watch
125
+
126
+ # Run benchmark cases
127
+ copilot-operator benchmark --file benchmark.json
128
+ ```
129
+
130
+ ---
131
+
132
+ ## LLM Brain (Optional)
133
+
134
+ Set environment variables or create `.env` in your workspace:
135
+
136
+ ```bash
137
+ # OpenAI
138
+ COPILOT_OPERATOR_LLM_PROVIDER=openai
139
+ OPENAI_API_KEY=sk-...
140
+
141
+ # Anthropic
142
+ COPILOT_OPERATOR_LLM_PROVIDER=anthropic
143
+ ANTHROPIC_API_KEY=sk-ant-...
144
+
145
+ # Gemini
146
+ COPILOT_OPERATOR_LLM_PROVIDER=gemini
147
+ GEMINI_API_KEY=...
148
+
149
+ # Local (Ollama, LM Studio, etc.)
150
+ COPILOT_OPERATOR_LLM_PROVIDER=local
151
+ ```
152
+
153
+ Check status:
154
+
155
+ ```bash
156
+ copilot-operator brain
157
+ copilot-operator brain --test "What is 2+2?"
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Benchmark
163
+
164
+ Create a `benchmark.json` to measure operator quality:
165
+
166
+ ```json
167
+ {
168
+ "name": "My project benchmark",
169
+ "cases": [
170
+ {
171
+ "id": "fix-auth-bug",
172
+ "goal": "Fix the login bug where tokens expire too early",
173
+ "goal_profile": "bug",
174
+ "expected_keywords": ["token", "expiry", "authentication"]
175
+ },
176
+ {
177
+ "id": "add-readme-docs",
178
+ "goal": "Update README with installation and usage sections",
179
+ "goal_profile": "docs",
180
+ "expected_keywords": ["README", "installation", "usage"]
181
+ }
182
+ ]
183
+ }
184
+ ```
185
+
186
+ ```bash
187
+ # Human-readable report
188
+ copilot-operator benchmark --file benchmark.json
189
+
190
+ # Machine-readable JSON output
191
+ copilot-operator benchmark --file benchmark.json --json
192
+ ```
193
+
194
+ ---
195
+
196
+ ## Architecture
197
+
198
+ ```
199
+ ┌─────────────────────────────────────────────────────┐
200
+ │ CLI (cli.py) │
201
+ ├──────────┬──────────────────────────────────────────┤
202
+ │ │ CopilotOperator (operator.py) │
203
+ │ │ ┌──────────────┐ ┌──────────────────┐ │
204
+ │ Config │ │ run() loop │ │ _decide() logic │ │
205
+ │ YAML │ │ ↓ prompt │ │ score gates │ │
206
+ │ + .env │ │ ↓ send │ │ blocker checks │ │
207
+ │ │ │ ↓ parse │ │ replan triggers │ │
208
+ │ │ │ ↓ validate │ │ rollback logic │ │
209
+ │ │ │ ↓ decide │ │ critic checks │ │
210
+ │ │ └──────────────┘ └──────────────────┘ │
211
+ ├──────────┼──────────────────────────────────────────┤
212
+ │ Intelligence Layer │
213
+ │ ┌────────────┐ ┌──────────┐ ┌──────────────────┐ │
214
+ │ │ reasoning │ │ brain │ │ meta_learner │ │
215
+ │ │ (trends, │ │ (project │ │ (pattern detect,│ │
216
+ │ │ loops) │ │ history)│ │ prompt rules) │ │
217
+ │ └────────────┘ └──────────┘ └──────────────────┘ │
218
+ ├──────────┼──────────────────────────────────────────┤
219
+ │ External Integrations │
220
+ │ ┌────────────┐ ┌──────────┐ ┌──────────────────┐ │
221
+ │ │ llm_brain │ │ snapshot │ │ github_integration│ │
222
+ │ │ (4 LLM │ │ (git │ │ (issues, PRs) │ │
223
+ │ │ providers)│ │ stash) │ │ │ │
224
+ │ └────────────┘ └──────────┘ └──────────────────┘ │
225
+ ├──────────┼──────────────────────────────────────────┤
226
+ │ VS Code Bridge │
227
+ │ ┌──────────────┐ ┌────────────┐ ┌──────────────┐ │
228
+ │ │ vscode_chat │ │ session │ │ validation │ │
229
+ │ │ (CLI bridge) │ │ store │ │ (subprocess) │ │
230
+ │ └──────────────┘ └────────────┘ └──────────────┘ │
231
+ └─────────────────────────────────────────────────────┘
232
+ ```
233
+
234
+ ---
235
+
236
+ ## Configuration
237
+
238
+ ### `copilot-operator.yml`
239
+
240
+ ```yaml
241
+ workspace: .
242
+ mode: agent
243
+ goalProfile: default # bug | feature | refactor | audit | docs | stabilize
244
+ maxIterations: 6
245
+ targetScore: 85
246
+ sessionTimeoutSeconds: 900
247
+
248
+ validation:
249
+ - name: tests
250
+ command: npm test
251
+ required: true
252
+ - name: lint
253
+ command: npm run lint
254
+ required: false
255
+
256
+ llm:
257
+ provider: openai # openai | anthropic | gemini | local
258
+ model: gpt-4o
259
+ ```
260
+
261
+ ### `.copilot-operator/repo-profile.yml`
262
+
263
+ ```yaml
264
+ repoName: my-project
265
+ summary: A Node.js REST API
266
+ standards:
267
+ - Use TypeScript strict mode
268
+ - All functions must have tests
269
+ priorities:
270
+ - Test coverage > 80%
271
+ protectedPaths:
272
+ - database/migrations/
273
+ ```
274
+
275
+ ---
276
+
277
+ ## CLI Reference
278
+
279
+ | Command | Description |
280
+ |---------|-------------|
281
+ | `copilot-operator doctor` | Pre-flight checks (VS Code, config, validations) |
282
+ | `copilot-operator init` | Scaffold config files and documentation |
283
+ | `copilot-operator run --goal "..."` | Start a new autonomous run |
284
+ | `copilot-operator run --goal "..." --live` | Run with colour-coded real-time progress |
285
+ | `copilot-operator run --goal "..." --dry-run` | Generate prompt without executing |
286
+ | `copilot-operator resume` | Resume from last checkpoint |
287
+ | `copilot-operator status` | Show current run state |
288
+ | `copilot-operator plan` | Show the current milestone plan |
289
+ | `copilot-operator focus` | Show what the operator is working on |
290
+ | `copilot-operator watch` | Live-poll run progress |
291
+ | `copilot-operator brain` | Show LLM brain status |
292
+ | `copilot-operator brain --test "..."` | Test LLM brain with a prompt |
293
+ | `copilot-operator fix-issue --issue N --repo owner/repo` | Fetch GitHub issue and run operator to fix it |
294
+ | `copilot-operator benchmark --file bench.json` | Run benchmark cases and score results |
295
+ | `copilot-operator cleanup` | Remove old run logs |
296
+ | `copilot-operator version` | Show version |
297
+ | `copilot-operator -V` | Short version flag |
298
+
299
+ ---
300
+
301
+ ## How It Works
302
+
303
+ 1. **You provide a goal** — e.g., "Fix issue #42" or "Add pagination to the API"
304
+ 2. **Operator classifies the goal** — determines it's a bug fix, feature, refactor, etc.
305
+ 3. **Operator builds a milestone plan** — heuristic-based or LLM-powered
306
+ 4. **For each iteration:**
307
+ - Takes a git stash snapshot
308
+ - Runs pre-validation (tests, lint)
309
+ - Builds a rich prompt with context, guardrails, and intelligence
310
+ - Sends the prompt to Copilot Chat via `code chat --mode agent`
311
+ - Waits for and parses the response
312
+ - Runs post-validation
313
+ - Evaluates: score, blockers, validation results, trend
314
+ - Decides: continue, replan, rollback, or stop
315
+ 5. **After the run:**
316
+ - Meta-learner extracts failure patterns as rules for future runs
317
+ - Cross-repo brain exports learnings
318
+ - Results saved for project brain analysis
319
+
320
+ ---
321
+
322
+ ## Project Structure
323
+
324
+ ```
325
+ copilot_operator/
326
+ ├── operator.py # Main orchestration loop
327
+ ├── vscode_chat.py # VS Code CLI bridge (subprocess)
328
+ ├── session_store.py # VS Code session file parser
329
+ ├── validation.py # Test/lint/build command execution
330
+ ├── config.py # YAML config + .env loading
331
+ ├── cli.py # CLI with 15+ subcommands
332
+ ├── prompts.py # Prompt templates + response parsing
333
+ ├── planner.py # Plan parsing, merging, rendering
334
+ ├── reasoning.py # Trend analysis, loop detection
335
+ ├── brain.py # Project history analysis
336
+ ├── goal_decomposer.py # Goal classification + LLM decomposition
337
+ ├── repo_map.py # AST + regex codebase map (15 languages)
338
+ ├── benchmark.py # Benchmark runner + scoring engine
339
+ ├── terminal.py # ANSI colour helpers (NO_COLOR compliant)
340
+ ├── scheduler.py # Multi-session orchestration
341
+ ├── repo_ops.py # Git operations (branch, commit, diff)
342
+ ├── meta_learner.py # Pattern detection + rule learning
343
+ ├── adversarial.py # Coder + Critic review
344
+ ├── llm_brain.py # Multi-provider LLM (circuit breaker)
345
+ ├── github_integration.py # GitHub REST API (retry + rate limit)
346
+ ├── snapshot.py # Git stash snapshots + rollback
347
+ ├── cross_repo_brain.py # Shared knowledge across repos
348
+ ├── intention_guard.py # Static + adaptive guardrails
349
+ ├── repo_inspector.py # Workspace ecosystem detection
350
+ ├── bootstrap.py # Workspace scaffolding
351
+ ├── logging_config.py # Structured logging
352
+ └── py.typed # PEP 561 type marker
353
+ ```
354
+
355
+ ---
356
+
357
+ ## License
358
+
359
+ MIT
360
+
361
+ ## Docs index
362
+
363
+ Read these first if you want a working rollout plan:
364
+
365
+ - `docs/COPILOT_OPERATOR_MASTER_PLAN.md`: the long-range architecture and phase roadmap
366
+ - `docs/COPILOT_OPERATOR_CHECKLIST.md`: the actionable checklist, with current items marked done or pending
367
+ - `docs/COPILOT_OPERATOR_RUNBOOK.md`: day-0 setup, operating steps, and unblock flow
368
+ - `docs/COPILOT_OPERATOR_BACKLOG.md`: ticket-ready engineering backlog
369
+ - `docs/COPILOT_OPERATOR_GOAL_TEMPLATES.md`: reusable goal templates for real runs
370
+ - `docs/operator/`: seeded repo-brain files attached to the operator profile
371
+
372
+ ## Validation
373
+
374
+ ```bash
375
+ npm test
376
+ npm run operator:doctor
377
+ npm run supervisor:doctor
378
+ ```
379
+