robert-github-agent 0.1.0b1__py3-none-any.whl
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.
- robert_agent/__init__.py +1 -0
- robert_agent/acceptance.py +394 -0
- robert_agent/acceptance_suite.py +287 -0
- robert_agent/audit_result.py +501 -0
- robert_agent/authorize.py +117 -0
- robert_agent/board.py +538 -0
- robert_agent/chat_status.py +338 -0
- robert_agent/cli/__init__.py +1 -0
- robert_agent/cli/exit_codes.py +5 -0
- robert_agent/cli/main.py +535 -0
- robert_agent/cli/output.py +20 -0
- robert_agent/common.py +6 -0
- robert_agent/controlled_e2e_acceptance.py +394 -0
- robert_agent/daemon.py +607 -0
- robert_agent/daemon_state.py +319 -0
- robert_agent/diagnostics.py +119 -0
- robert_agent/discover.py +775 -0
- robert_agent/dispatch.py +217 -0
- robert_agent/doctor.py +94 -0
- robert_agent/github_api.py +12 -0
- robert_agent/init_config.py +126 -0
- robert_agent/integrations/__init__.py +1 -0
- robert_agent/integrations/openclaw.py +285 -0
- robert_agent/live_discovery_acceptance.py +70 -0
- robert_agent/live_worker_acceptance.py +363 -0
- robert_agent/live_worktree_acceptance.py +344 -0
- robert_agent/loop_engine.py +285 -0
- robert_agent/memory_curator.py +105 -0
- robert_agent/migrate.py +157 -0
- robert_agent/notify.py +74 -0
- robert_agent/paths.py +16 -0
- robert_agent/production_write_canary.py +254 -0
- robert_agent/project_memory.py +503 -0
- robert_agent/publish.py +743 -0
- robert_agent/publish_dedupe_acceptance.py +270 -0
- robert_agent/redaction.py +41 -0
- robert_agent/render_prompt.py +544 -0
- robert_agent/resource_files.py +8 -0
- robert_agent/resources/__init__.py +1 -0
- robert_agent/resources/acceptance-matrix.md +120 -0
- robert_agent/resources/classifier.md +19 -0
- robert_agent/resources/command-matrix.md +38 -0
- robert_agent/resources/config.example.yml +20 -0
- robert_agent/resources/db/migrations/001_legacy_dd_to_robert.sql +14 -0
- robert_agent/resources/db/schema.sql +479 -0
- robert_agent/resources/failure-modes.md +36 -0
- robert_agent/resources/fixtures/actor-permission.json +1 -0
- robert_agent/resources/fixtures/discovery.json +1 -0
- robert_agent/resources/fixtures/redaction.json +1 -0
- robert_agent/resources/fixtures/review-followup.json +1 -0
- robert_agent/resources/fixtures/worker-results.json +1 -0
- robert_agent/resources/fixtures/workstreams.json +1 -0
- robert_agent/resources/github-events.md +77 -0
- robert_agent/resources/kanban-control.md +165 -0
- robert_agent/resources/redaction.md +29 -0
- robert_agent/resources/result-contract.md +56 -0
- robert_agent/resources/routes.yml +82 -0
- robert_agent/resources/schemas/config.schema.json +123 -0
- robert_agent/resources/schemas/event.schema.json +18 -0
- robert_agent/resources/schemas/result.schema.json +99 -0
- robert_agent/resources/schemas/route.schema.json +23 -0
- robert_agent/resources/schemas/snapshot.schema.json +17 -0
- robert_agent/resources/schemas/task.schema.json +15 -0
- robert_agent/resources/trust-model.md +16 -0
- robert_agent/resources/worker-prompt.md +121 -0
- robert_agent/resources/worker-protocol.md +47 -0
- robert_agent/resources/workflow.yml +50 -0
- robert_agent/resources/workstream-model.md +17 -0
- robert_agent/route.py +232 -0
- robert_agent/route_config.py +64 -0
- robert_agent/run_once.py +5375 -0
- robert_agent/runtime_knowledge.py +392 -0
- robert_agent/service.py +161 -0
- robert_agent/skills.py +28 -0
- robert_agent/status.py +1051 -0
- robert_agent/storage.py +376 -0
- robert_agent/summarize.py +100 -0
- robert_agent/supervise.py +72 -0
- robert_agent/usage.py +192 -0
- robert_agent/validate_config.py +616 -0
- robert_agent/wakeup.py +261 -0
- robert_agent/web.py +2893 -0
- robert_agent/web_assets/board.css +255 -0
- robert_agent/web_assets/board.html +165 -0
- robert_agent/web_assets/board.js +660 -0
- robert_agent/web_assets/github-shell.css +122 -0
- robert_agent/web_assets/index.html +103 -0
- robert_agent/web_assets/operations.css +168 -0
- robert_agent/web_assets/workbench.css +131 -0
- robert_agent/web_assets/workbench.js +581 -0
- robert_agent/work_items.py +1016 -0
- robert_agent/workbench.py +701 -0
- robert_agent/worker/__init__.py +1 -0
- robert_agent/worker/heartbeat.py +190 -0
- robert_agent/worker/result.py +321 -0
- robert_agent/worker/snapshot.py +98 -0
- robert_agent/worker_adapters/__init__.py +138 -0
- robert_agent/worker_adapters/cbc.py +68 -0
- robert_agent/worker_adapters/codex.py +56 -0
- robert_agent/worker_adapters/command.py +33 -0
- robert_agent/worker_adapters/tcodex.py +56 -0
- robert_agent/worker_heartbeat.py +6 -0
- robert_agent/worker_result.py +6 -0
- robert_agent/worker_snapshot.py +6 -0
- robert_agent/workstream.py +55 -0
- robert_agent/worktree.py +297 -0
- robert_github_agent-0.1.0b1.dist-info/METADATA +217 -0
- robert_github_agent-0.1.0b1.dist-info/RECORD +111 -0
- robert_github_agent-0.1.0b1.dist-info/WHEEL +4 -0
- robert_github_agent-0.1.0b1.dist-info/entry_points.txt +2 -0
- robert_github_agent-0.1.0b1.dist-info/licenses/LICENSE +201 -0
robert_agent/dispatch.py
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import argparse
|
|
3
|
+
from contextlib import ExitStack
|
|
4
|
+
import os
|
|
5
|
+
import subprocess
|
|
6
|
+
import time
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from robert_agent import worker_adapters
|
|
10
|
+
from robert_agent.common import emit
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
_BACKGROUND_PROCESSES = {}
|
|
14
|
+
DEFAULT_WORKER_BASH_DEFAULT_TIMEOUT_MS = "300000"
|
|
15
|
+
DEFAULT_WORKER_ENV = {
|
|
16
|
+
"PATH",
|
|
17
|
+
"HOME",
|
|
18
|
+
"LANG",
|
|
19
|
+
"LC_ALL",
|
|
20
|
+
"TMPDIR",
|
|
21
|
+
"SHELL",
|
|
22
|
+
"USER",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _reap_background_processes():
|
|
27
|
+
for pid, proc in list(_BACKGROUND_PROCESSES.items()):
|
|
28
|
+
if proc.poll() is not None:
|
|
29
|
+
_BACKGROUND_PROCESSES.pop(pid, None)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _worker_environment(allowed_names=(), environ=None):
|
|
33
|
+
source = dict(os.environ if environ is None else environ)
|
|
34
|
+
names = DEFAULT_WORKER_ENV | set(allowed_names)
|
|
35
|
+
result = {
|
|
36
|
+
name: source[name]
|
|
37
|
+
for name in names
|
|
38
|
+
if name in source
|
|
39
|
+
}
|
|
40
|
+
result.setdefault(
|
|
41
|
+
"BASH_DEFAULT_TIMEOUT_MS",
|
|
42
|
+
DEFAULT_WORKER_BASH_DEFAULT_TIMEOUT_MS,
|
|
43
|
+
)
|
|
44
|
+
return result
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def build_worker_command(
|
|
48
|
+
prompt_path,
|
|
49
|
+
worktree_path=None,
|
|
50
|
+
model="gpt-5.4",
|
|
51
|
+
reasoning_effort="high",
|
|
52
|
+
worker_command="cbc",
|
|
53
|
+
worker_agent="cbc",
|
|
54
|
+
worker_agent_config=None,
|
|
55
|
+
):
|
|
56
|
+
_reap_background_processes()
|
|
57
|
+
launch = worker_adapters.build_worker_launch(
|
|
58
|
+
prompt_path=prompt_path,
|
|
59
|
+
worktree_path=worktree_path,
|
|
60
|
+
model=model,
|
|
61
|
+
reasoning_effort=reasoning_effort,
|
|
62
|
+
worker_command=worker_command,
|
|
63
|
+
worker_agent=worker_agent,
|
|
64
|
+
worker_agent_config=worker_agent_config,
|
|
65
|
+
)
|
|
66
|
+
return launch.command
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def dispatch_worker(
|
|
70
|
+
task_id,
|
|
71
|
+
attempt_id,
|
|
72
|
+
prompt_path,
|
|
73
|
+
worktree_path=None,
|
|
74
|
+
model="gpt-5.4",
|
|
75
|
+
reasoning_effort="high",
|
|
76
|
+
worker_command="cbc",
|
|
77
|
+
worker_agent="cbc",
|
|
78
|
+
worker_agent_config=None,
|
|
79
|
+
dry_run=True,
|
|
80
|
+
startup_probe_seconds=0.2,
|
|
81
|
+
):
|
|
82
|
+
prompt_path = Path(prompt_path)
|
|
83
|
+
try:
|
|
84
|
+
launch = worker_adapters.build_worker_launch(
|
|
85
|
+
prompt_path=prompt_path,
|
|
86
|
+
worktree_path=worktree_path,
|
|
87
|
+
model=model,
|
|
88
|
+
reasoning_effort=reasoning_effort,
|
|
89
|
+
worker_command=worker_command,
|
|
90
|
+
worker_agent=worker_agent,
|
|
91
|
+
worker_agent_config=worker_agent_config,
|
|
92
|
+
)
|
|
93
|
+
except Exception as exc:
|
|
94
|
+
return {
|
|
95
|
+
"ok": False,
|
|
96
|
+
"status": "failed_dispatch",
|
|
97
|
+
"task_id": task_id,
|
|
98
|
+
"attempt_id": attempt_id,
|
|
99
|
+
"pid": None,
|
|
100
|
+
"safe_error": f"worker launch config failed: {exc}",
|
|
101
|
+
"error_type": type(exc).__name__,
|
|
102
|
+
"prompt_path": str(prompt_path),
|
|
103
|
+
}
|
|
104
|
+
command = launch.command
|
|
105
|
+
if dry_run:
|
|
106
|
+
return {
|
|
107
|
+
"ok": True,
|
|
108
|
+
"status": "prepared",
|
|
109
|
+
"task_id": task_id,
|
|
110
|
+
"attempt_id": attempt_id,
|
|
111
|
+
"pid": None,
|
|
112
|
+
"command": command,
|
|
113
|
+
"prompt_path": str(prompt_path),
|
|
114
|
+
"worker_agent": launch.agent,
|
|
115
|
+
"worker_launch": launch.metadata(),
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
stdout_path = prompt_path.parent / f"{attempt_id}.stdout.log"
|
|
119
|
+
stderr_path = prompt_path.parent / f"{attempt_id}.stderr.log"
|
|
120
|
+
prompt_path.parent.mkdir(parents=True, exist_ok=True)
|
|
121
|
+
try:
|
|
122
|
+
with ExitStack() as stack:
|
|
123
|
+
prompt_file = stack.enter_context(prompt_path.open("r", encoding="utf-8"))
|
|
124
|
+
stdout_file = stack.enter_context(stdout_path.open("a", encoding="utf-8"))
|
|
125
|
+
stderr_file = stack.enter_context(stderr_path.open("a", encoding="utf-8"))
|
|
126
|
+
proc = subprocess.Popen(
|
|
127
|
+
command,
|
|
128
|
+
cwd=launch.cwd,
|
|
129
|
+
env=_worker_environment(launch.environment_allowlist),
|
|
130
|
+
stdin=prompt_file,
|
|
131
|
+
stdout=stdout_file,
|
|
132
|
+
stderr=stderr_file,
|
|
133
|
+
start_new_session=True,
|
|
134
|
+
)
|
|
135
|
+
except Exception as exc:
|
|
136
|
+
return {
|
|
137
|
+
"ok": False,
|
|
138
|
+
"status": "failed_dispatch",
|
|
139
|
+
"task_id": task_id,
|
|
140
|
+
"attempt_id": attempt_id,
|
|
141
|
+
"pid": None,
|
|
142
|
+
"safe_error": f"worker dispatch failed: {exc}",
|
|
143
|
+
"error_type": type(exc).__name__,
|
|
144
|
+
"command": command,
|
|
145
|
+
"prompt_path": str(prompt_path),
|
|
146
|
+
"stdout_path": str(stdout_path),
|
|
147
|
+
"stderr_path": str(stderr_path),
|
|
148
|
+
"worker_agent": launch.agent,
|
|
149
|
+
"worker_launch": launch.metadata(),
|
|
150
|
+
}
|
|
151
|
+
if startup_probe_seconds > 0:
|
|
152
|
+
time.sleep(startup_probe_seconds)
|
|
153
|
+
returncode = proc.poll()
|
|
154
|
+
if returncode is not None:
|
|
155
|
+
return {
|
|
156
|
+
"ok": False,
|
|
157
|
+
"status": "failed_dispatch",
|
|
158
|
+
"task_id": task_id,
|
|
159
|
+
"attempt_id": attempt_id,
|
|
160
|
+
"pid": proc.pid,
|
|
161
|
+
"returncode": returncode,
|
|
162
|
+
"safe_error": f"worker exited immediately with code {returncode}",
|
|
163
|
+
"command": command,
|
|
164
|
+
"prompt_path": str(prompt_path),
|
|
165
|
+
"stdout_path": str(stdout_path),
|
|
166
|
+
"stderr_path": str(stderr_path),
|
|
167
|
+
"worker_agent": launch.agent,
|
|
168
|
+
"worker_launch": launch.metadata(),
|
|
169
|
+
}
|
|
170
|
+
_BACKGROUND_PROCESSES[proc.pid] = proc
|
|
171
|
+
return {
|
|
172
|
+
"ok": True,
|
|
173
|
+
"status": "running",
|
|
174
|
+
"task_id": task_id,
|
|
175
|
+
"attempt_id": attempt_id,
|
|
176
|
+
"pid": proc.pid,
|
|
177
|
+
"command": command,
|
|
178
|
+
"prompt_path": str(prompt_path),
|
|
179
|
+
"stdout_path": str(stdout_path),
|
|
180
|
+
"stderr_path": str(stderr_path),
|
|
181
|
+
"worker_agent": launch.agent,
|
|
182
|
+
"worker_launch": launch.metadata(),
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def main(argv=None):
|
|
187
|
+
parser = argparse.ArgumentParser()
|
|
188
|
+
parser.add_argument("--task-id", required=True)
|
|
189
|
+
parser.add_argument("--attempt-id", required=True)
|
|
190
|
+
parser.add_argument("--prompt-path", required=True)
|
|
191
|
+
parser.add_argument("--worktree-path")
|
|
192
|
+
parser.add_argument("--model", default="gpt-5.4")
|
|
193
|
+
parser.add_argument("--reasoning-effort", default="high")
|
|
194
|
+
parser.add_argument("--worker-command", default="cbc")
|
|
195
|
+
parser.add_argument(
|
|
196
|
+
"--worker-agent",
|
|
197
|
+
default="cbc",
|
|
198
|
+
choices=worker_adapters.SUPPORTED_WORKER_AGENTS,
|
|
199
|
+
)
|
|
200
|
+
parser.add_argument("--dry-run", action="store_true")
|
|
201
|
+
args = parser.parse_args(argv)
|
|
202
|
+
result = dispatch_worker(
|
|
203
|
+
task_id=args.task_id,
|
|
204
|
+
attempt_id=args.attempt_id,
|
|
205
|
+
prompt_path=args.prompt_path,
|
|
206
|
+
worktree_path=args.worktree_path,
|
|
207
|
+
model=args.model,
|
|
208
|
+
reasoning_effort=args.reasoning_effort,
|
|
209
|
+
worker_command=args.worker_command,
|
|
210
|
+
worker_agent=args.worker_agent,
|
|
211
|
+
dry_run=args.dry_run,
|
|
212
|
+
)
|
|
213
|
+
return emit(result)
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
if __name__ == "__main__":
|
|
217
|
+
raise SystemExit(main())
|
robert_agent/doctor.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
import shutil
|
|
3
|
+
import subprocess
|
|
4
|
+
|
|
5
|
+
from robert_agent import validate_config
|
|
6
|
+
from robert_agent.route_config import (
|
|
7
|
+
load_route_policies,
|
|
8
|
+
resolve_route_config,
|
|
9
|
+
)
|
|
10
|
+
from robert_agent.skills import discover_skill_names, route_skill_status
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def doctor(config_path, skip_external=False):
|
|
14
|
+
validated = validate_config.validate_config(
|
|
15
|
+
config_path,
|
|
16
|
+
skip_external=skip_external,
|
|
17
|
+
)
|
|
18
|
+
checks = {
|
|
19
|
+
"config": {
|
|
20
|
+
"status": "passed" if validated.get("ok") else "failed",
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if not validated.get("ok"):
|
|
24
|
+
return {
|
|
25
|
+
"ok": False,
|
|
26
|
+
"status": "failed",
|
|
27
|
+
"checks": checks,
|
|
28
|
+
"safe_error": validated.get("safe_error"),
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
worker = validated["default_worker"]
|
|
32
|
+
worker_command = worker["command_argv"][0]
|
|
33
|
+
worker_ok = shutil.which(worker_command) is not None
|
|
34
|
+
checks["worker"] = {
|
|
35
|
+
"status": "passed" if worker_ok else "failed",
|
|
36
|
+
"command": worker_command,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
gh_path = shutil.which("gh")
|
|
40
|
+
gh_ok = skip_external or bool(gh_path)
|
|
41
|
+
if gh_path and not skip_external:
|
|
42
|
+
gh_ok = subprocess.run(
|
|
43
|
+
["gh", "auth", "status"],
|
|
44
|
+
stdout=subprocess.PIPE,
|
|
45
|
+
stderr=subprocess.PIPE,
|
|
46
|
+
text=True,
|
|
47
|
+
check=False,
|
|
48
|
+
).returncode == 0
|
|
49
|
+
checks["github_cli"] = {
|
|
50
|
+
"status": "passed" if gh_ok else "failed",
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
repos_ok = all(
|
|
54
|
+
Path(repo["repo_root"]).exists()
|
|
55
|
+
for repo in validated["repos"]
|
|
56
|
+
)
|
|
57
|
+
checks["repositories"] = {
|
|
58
|
+
"status": "passed" if repos_ok else "failed",
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
installed = discover_skill_names(
|
|
62
|
+
validated["skills"]["search_paths"]
|
|
63
|
+
)
|
|
64
|
+
route_checks = []
|
|
65
|
+
for repo in validated["repos"]:
|
|
66
|
+
for policy in load_route_policies():
|
|
67
|
+
route = resolve_route_config(validated, repo, policy)
|
|
68
|
+
skill_status = route_skill_status(
|
|
69
|
+
required=route["required_skills"],
|
|
70
|
+
recommended=route["recommended_skills"],
|
|
71
|
+
installed=installed,
|
|
72
|
+
)
|
|
73
|
+
route_checks.append(
|
|
74
|
+
{
|
|
75
|
+
"repo": repo["full_name"],
|
|
76
|
+
"route": route["id"],
|
|
77
|
+
**skill_status,
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
checks["skills"] = {
|
|
81
|
+
"status": (
|
|
82
|
+
"passed"
|
|
83
|
+
if all(item["runnable"] for item in route_checks)
|
|
84
|
+
else "failed"
|
|
85
|
+
),
|
|
86
|
+
"routes": route_checks,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
ok = all(check["status"] == "passed" for check in checks.values())
|
|
90
|
+
return {
|
|
91
|
+
"ok": ok,
|
|
92
|
+
"status": "ready" if ok else "failed",
|
|
93
|
+
"checks": checks,
|
|
94
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""GitHub API helpers for the rewritten DD GitHub agent.
|
|
2
|
+
|
|
3
|
+
Phase 4 is fixture-backed. Live `gh` calls are added after the event and
|
|
4
|
+
authorization contracts are covered by tests.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def collaborator_permission_from_payload(payload):
|
|
9
|
+
permission = payload.get("permission") or payload.get("role_name")
|
|
10
|
+
if not permission:
|
|
11
|
+
return "unknown"
|
|
12
|
+
return str(permission)
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import argparse
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
import shutil
|
|
5
|
+
|
|
6
|
+
import yaml
|
|
7
|
+
|
|
8
|
+
from robert_agent.common import emit
|
|
9
|
+
from robert_agent.paths import default_data_dir
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def init_config(
|
|
13
|
+
config_path,
|
|
14
|
+
values=None,
|
|
15
|
+
non_interactive=False,
|
|
16
|
+
force=False,
|
|
17
|
+
):
|
|
18
|
+
path = Path(config_path).expanduser()
|
|
19
|
+
values = dict(values or {})
|
|
20
|
+
if path.exists() and not force:
|
|
21
|
+
return {
|
|
22
|
+
"ok": False,
|
|
23
|
+
"status": "exists",
|
|
24
|
+
"config_path": str(path),
|
|
25
|
+
"safe_error": f"config already exists: {path}",
|
|
26
|
+
}
|
|
27
|
+
required = {
|
|
28
|
+
"repo",
|
|
29
|
+
"repo_path",
|
|
30
|
+
"worker",
|
|
31
|
+
"github_account",
|
|
32
|
+
"trusted_actor",
|
|
33
|
+
}
|
|
34
|
+
missing = sorted(required - set(values))
|
|
35
|
+
if missing:
|
|
36
|
+
return {
|
|
37
|
+
"ok": False,
|
|
38
|
+
"status": "failed_input",
|
|
39
|
+
"safe_error": (
|
|
40
|
+
"missing "
|
|
41
|
+
+ ("non-interactive " if non_interactive else "")
|
|
42
|
+
+ "values: "
|
|
43
|
+
+ ", ".join(missing)
|
|
44
|
+
),
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
repo_path = Path(values["repo_path"]).expanduser()
|
|
48
|
+
worker_name = str(values["worker"])
|
|
49
|
+
adapter = (
|
|
50
|
+
worker_name
|
|
51
|
+
if worker_name in {"cbc", "codex", "tcodex"}
|
|
52
|
+
else "codex"
|
|
53
|
+
)
|
|
54
|
+
config = {
|
|
55
|
+
"version": 1,
|
|
56
|
+
"data_dir": str(default_data_dir()),
|
|
57
|
+
"database": "robert.sqlite3",
|
|
58
|
+
"github": {
|
|
59
|
+
"account": values["github_account"],
|
|
60
|
+
"poll_seconds": 300,
|
|
61
|
+
},
|
|
62
|
+
"skills": {"search_paths": []},
|
|
63
|
+
"workers": {
|
|
64
|
+
"default": {
|
|
65
|
+
"adapter": adapter,
|
|
66
|
+
"command": worker_name,
|
|
67
|
+
"model": "default",
|
|
68
|
+
"effort": "default",
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"routes": {},
|
|
72
|
+
"repos": [
|
|
73
|
+
{
|
|
74
|
+
"full_name": values["repo"],
|
|
75
|
+
"checkout": str(repo_path),
|
|
76
|
+
"worktrees": str(repo_path / ".worktrees"),
|
|
77
|
+
"default_branch": "main",
|
|
78
|
+
"trusted_actors": [values["trusted_actor"]],
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
}
|
|
82
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
83
|
+
if path.exists():
|
|
84
|
+
shutil.copy2(path, path.with_suffix(path.suffix + ".bak"))
|
|
85
|
+
path.write_text(
|
|
86
|
+
yaml.safe_dump(config, sort_keys=False),
|
|
87
|
+
encoding="utf-8",
|
|
88
|
+
)
|
|
89
|
+
return {
|
|
90
|
+
"ok": True,
|
|
91
|
+
"status": "created",
|
|
92
|
+
"config_path": str(path),
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def main(argv=None):
|
|
97
|
+
parser = argparse.ArgumentParser()
|
|
98
|
+
parser.add_argument(
|
|
99
|
+
"--config",
|
|
100
|
+
default="~/.config/robert/config.yml",
|
|
101
|
+
help="Target config path to create when missing.",
|
|
102
|
+
)
|
|
103
|
+
parser.add_argument("--repo", required=True)
|
|
104
|
+
parser.add_argument("--repo-path", required=True)
|
|
105
|
+
parser.add_argument("--worker", required=True)
|
|
106
|
+
parser.add_argument("--github-account", required=True)
|
|
107
|
+
parser.add_argument("--trusted-actor", required=True)
|
|
108
|
+
parser.add_argument("--force", action="store_true")
|
|
109
|
+
args = parser.parse_args(argv)
|
|
110
|
+
result = init_config(
|
|
111
|
+
args.config,
|
|
112
|
+
{
|
|
113
|
+
"repo": args.repo,
|
|
114
|
+
"repo_path": args.repo_path,
|
|
115
|
+
"worker": args.worker,
|
|
116
|
+
"github_account": args.github_account,
|
|
117
|
+
"trusted_actor": args.trusted_actor,
|
|
118
|
+
},
|
|
119
|
+
non_interactive=True,
|
|
120
|
+
force=args.force,
|
|
121
|
+
)
|
|
122
|
+
return emit(result, 0 if result["ok"] else 3)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
if __name__ == "__main__":
|
|
126
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|