codee-agent 0.9.3__tar.gz → 0.9.5__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.
- {codee_agent-0.9.3 → codee_agent-0.9.5}/PKG-INFO +12 -1
- {codee_agent-0.9.3 → codee_agent-0.9.5}/README.md +11 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/pyproject.toml +1 -1
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/admin.py +108 -9
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/admin_service.py +77 -6
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/setup_wizard.py +25 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/test_admin_service.py +97 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/test_agent_cli.py +22 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/test_setup_wizard.py +70 -2
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_claude_code/account.py +16 -4
- codee_agent-0.9.5/src/codee_agent_claude_code/credentials.py +300 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_claude_code/test.py +103 -0
- codee_agent-0.9.3/src/codee_agent_claude_code/credentials.py +0 -133
- {codee_agent-0.9.3 → codee_agent-0.9.5}/LICENSE +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/.gitignore +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/__init__.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/admin_api.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/admin_cli.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/agent_cli.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/coding_agents.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/executor.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/init_cli.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/lib/__init__.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/lib/claude_key_rotation.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/lib/cron_describe.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/lib/mcp_config.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/lib/runs_db.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/lib/runtime_control.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/lib/test_claude_key_rotation.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/lib/test_mcp_config.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/lib/test_runs_db.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/lib/test_trigger_cron_skills.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/lib/test_trigger_email_skills.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/lib/test_trigger_issue_skills.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/lib/trigger_aws_sqs_skills.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/lib/trigger_cron_skills.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/lib/trigger_email_skills.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/lib/trigger_issue_skills.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/mail_server.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/start_cli.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/tasks_providers.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/templates/AGENTS.md +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/templates/CLAUDE.md +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/templates/skills/aws-sqs-alarm-response/SKILL.md +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/templates/skills/cron-research-5xx-errors/SKILL.md +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/templates/skills/story-code-reviewer/SKILL.md +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/templates/skills/story-developer/SKILL.md +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/templates/skills/story-planner/SKILL.md +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/templates/skills/story-planner/assets/readme-template.md +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/templates/skills/story-qa/SKILL.md +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/templates/skills/story-security-reviewer/SKILL.md +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/templates/skills/task-code-reviewer/SKILL.md +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/templates/skills/task-developer/SKILL.md +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/templates/skills/task-qa/SKILL.md +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/templates/skills/task-security-reviewer/SKILL.md +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/test_admin.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/test_admin_api.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/test_admin_cli.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/test_coding_agents.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/test_executor.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/test_init_cli.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/test_memory_index.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/test_start_cli.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee/workflow_graph.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_admin/__init__.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_admin/codee_admin.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_abstract/__init__.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_abstract/acp.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_abstract/provider.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_abstract/test.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_abstract/transcript.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_claude_code/__init__.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_claude_code/oauth.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_claude_code/provider.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_claude_code/usage.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_codex/__init__.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_codex/provider.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_codex/test.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_github_copilot/__init__.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_github_copilot/provider.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_github_copilot/test.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_opencode/__init__.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_opencode/provider.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_agent_opencode/test.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_database/__init__.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_database/claude_code_accounts.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_database/database.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_database/oauth_tokens.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_main_context/__init__.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_main_context/context.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_main_context/logging.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_main_context/test_context.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_main_context/test_logging.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_tasks_abstract/__init__.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_tasks_abstract/provider.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_tasks_azure_devops/__init__.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_tasks_azure_devops/oauth.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_tasks_azure_devops/provider.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_tasks_azure_devops/test.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_tasks_jira/__init__.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_tasks_jira/provider.py +0 -0
- {codee_agent-0.9.3 → codee_agent-0.9.5}/src/codee_tasks_jira/test.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codee-agent
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.5
|
|
4
4
|
Summary: A virtual co-worker that picks up Jira and Azure DevOps tasks and solves them with coding agents.
|
|
5
5
|
Keywords: ai,agent,jira,azure-devops,claude-code,github-copilot,codex,opencode,automation
|
|
6
6
|
Author: Denis Kibalko
|
|
@@ -48,6 +48,17 @@ installation, configuration and tutorials for working on tasks in Jira and Azure
|
|
|
48
48
|
[click-through demo of the admin UI](https://fusebase-dev.github.io/codee/demo/) that runs without installing
|
|
49
49
|
anything.
|
|
50
50
|
|
|
51
|
+
## Prerequisites
|
|
52
|
+
|
|
53
|
+
Codee is installed and run with [uv](https://docs.astral.sh/uv/). Install it first:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh # macOS / Linux
|
|
57
|
+
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" # Windows
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
uv downloads Python 3.12+ for you if it isn't already on the machine.
|
|
61
|
+
|
|
51
62
|
## Run Codee
|
|
52
63
|
|
|
53
64
|
Codee lives in its own directory, where it keeps skills, memory, temp files and config.
|
|
@@ -13,6 +13,17 @@ installation, configuration and tutorials for working on tasks in Jira and Azure
|
|
|
13
13
|
[click-through demo of the admin UI](https://fusebase-dev.github.io/codee/demo/) that runs without installing
|
|
14
14
|
anything.
|
|
15
15
|
|
|
16
|
+
## Prerequisites
|
|
17
|
+
|
|
18
|
+
Codee is installed and run with [uv](https://docs.astral.sh/uv/). Install it first:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh # macOS / Linux
|
|
22
|
+
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" # Windows
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
uv downloads Python 3.12+ for you if it isn't already on the machine.
|
|
26
|
+
|
|
16
27
|
## Run Codee
|
|
17
28
|
|
|
18
29
|
Codee lives in its own directory, where it keeps skills, memory, temp files and config.
|
|
@@ -11,7 +11,7 @@ from pydantic import BaseModel
|
|
|
11
11
|
from codee.admin_api import api_app
|
|
12
12
|
from codee.admin_service import (
|
|
13
13
|
AGENTS_FILE, TASKS_CHECKS, WORKFLOW_HIGHLIGHT_GROUPS, AdminService,
|
|
14
|
-
SKILL_TYPES, WorkflowGeneration, normalize_work_items)
|
|
14
|
+
SKILL_TYPES, WorkflowGeneration, context_tier_label, normalize_work_items)
|
|
15
15
|
from codee.workflow_graph import workflow_graph
|
|
16
16
|
from codee_main_context.context import (
|
|
17
17
|
DEFAULT_ISSUE_TYPES, TasksProvider, credential_field)
|
|
@@ -50,7 +50,8 @@ def _skill_summary(skill: dict[str, str]) -> SkillSummary:
|
|
|
50
50
|
"""One listing row, with its agent named the way the editor's picker does."""
|
|
51
51
|
return SkillSummary(**{
|
|
52
52
|
**skill,
|
|
53
|
-
"agent": AGENT_NAMES.get(skill["agent"], DEFAULT_AGENT_OPTION)
|
|
53
|
+
"agent": AGENT_NAMES.get(skill["agent"], DEFAULT_AGENT_OPTION),
|
|
54
|
+
"context_tier": context_tier_label(skill["context_tier"])})
|
|
54
55
|
|
|
55
56
|
|
|
56
57
|
def _model_option(models: list["ModelOption"],
|
|
@@ -114,6 +115,9 @@ class SkillSummary(BaseModel):
|
|
|
114
115
|
agent: str = ""
|
|
115
116
|
model: str = ""
|
|
116
117
|
effort: str = ""
|
|
118
|
+
# The skill's `x-codee-context-tier:` as a person reads it, empty for the
|
|
119
|
+
# model's default window.
|
|
120
|
+
context_tier: str = ""
|
|
117
121
|
issue_status: str = ""
|
|
118
122
|
issue_type: str = ""
|
|
119
123
|
|
|
@@ -466,6 +470,9 @@ class AdminState(rx.State):
|
|
|
466
470
|
# slow loop of its own.
|
|
467
471
|
claude_account_usage: list[ClaudeAccount] = []
|
|
468
472
|
claude_usage_loading: bool = False
|
|
473
|
+
# The account a "Set current" click is switching to, or 0. One at a time:
|
|
474
|
+
# two switches racing would leave the CLI on whichever wrote last.
|
|
475
|
+
claude_switching_account: int = 0
|
|
469
476
|
|
|
470
477
|
runs: list[RunRecord] = []
|
|
471
478
|
runs_has_more: bool = False
|
|
@@ -1171,6 +1178,36 @@ class AdminState(rx.State):
|
|
|
1171
1178
|
for account in measured]
|
|
1172
1179
|
await asyncio.sleep(USAGE_POLL_INTERVAL)
|
|
1173
1180
|
|
|
1181
|
+
@rx.event(background=True)
|
|
1182
|
+
async def use_claude_code_account(self, account_id: int) -> Any:
|
|
1183
|
+
"""Make one account current and sign Claude Code in as it.
|
|
1184
|
+
|
|
1185
|
+
In the background because it can be two network round trips — renewing
|
|
1186
|
+
the token, then reading the profile — and the dashboard redraws every
|
|
1187
|
+
second meanwhile. The usage rows are redrawn as soon as it lands, so
|
|
1188
|
+
the "in use" badge moves without waiting out the slow usage loop.
|
|
1189
|
+
"""
|
|
1190
|
+
async with self:
|
|
1191
|
+
if self.claude_switching_account:
|
|
1192
|
+
return
|
|
1193
|
+
self.claude_switching_account = account_id
|
|
1194
|
+
|
|
1195
|
+
try:
|
|
1196
|
+
switched, message = await asyncio.to_thread(
|
|
1197
|
+
SERVICE.use_claude_code_account, account_id)
|
|
1198
|
+
measured = await asyncio.to_thread(
|
|
1199
|
+
SERVICE.claude_code_account_usage)
|
|
1200
|
+
except Exception as error: # noqa: BLE001 - never leave the row spinning
|
|
1201
|
+
switched, message = False, f"{type(error).__name__}: {error}"
|
|
1202
|
+
measured = None
|
|
1203
|
+
|
|
1204
|
+
async with self:
|
|
1205
|
+
self.claude_switching_account = 0
|
|
1206
|
+
if measured is not None:
|
|
1207
|
+
self.claude_account_usage = [_usage_row(account)
|
|
1208
|
+
for account in measured]
|
|
1209
|
+
yield rx.toast.success(message) if switched else rx.toast.error(message)
|
|
1210
|
+
|
|
1174
1211
|
def _fetch_runs_page(self, offset: int,
|
|
1175
1212
|
limit: int = RUNS_PAGE_SIZE) -> list[RunRecord]:
|
|
1176
1213
|
"""One page of runs. Reads one row past the page to learn whether more exist."""
|
|
@@ -2032,13 +2069,34 @@ SUBTLE_ICON = "var(--codee-subtle-icon)"
|
|
|
2032
2069
|
RUNNING_BACKGROUND = "var(--codee-running-background)"
|
|
2033
2070
|
RUNNING_GLOW = "var(--codee-running-glow)"
|
|
2034
2071
|
MONO = "IBM Plex Mono, monospace"
|
|
2035
|
-
|
|
2036
|
-
#
|
|
2072
|
+
# Corner brackets with an open palm and a spark; fills use currentColor so the
|
|
2073
|
+
# mark takes the colour of the badge it sits in.
|
|
2074
|
+
LOGO = (
|
|
2075
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" style="display:block" aria-hidden="true" fill="none" viewBox="6 6 36 36"><path fill="currentColor" d="M7.5 14.9V7.5H14.9V10.5H10.5V14.9Z"></path><path fill="currentColor" d="M40.5 14.9V7.5H33.1V10.5H37.5V14.9Z"></path><path fill="currentColor" d="M7.5 33.1V40.5H14.9V37.5H10.5V33.1Z"></path><path fill="currentColor" d="M40.5 33.1V40.5H33.1V37.5H37.5V33.1Z"></path><g fill="currentColor"><rect x="19.9" y="16.4" width="2.85" height="10" rx="1.425"></rect><rect x="23.3" y="14.75" width="2.85" height="11" rx="1.425"></rect><rect x="26.7" y="15.6" width="2.85" height="10.5" rx="1.425"></rect><rect x="30.1" y="17.9" width="2.85" height="9" rx="1.425"></rect><path d="M32.95 24.6V28C32.95 31 30.6 33.25 27.6 33.25H25.6C23 33.25 18.71 28.21 17.29 26.52Q16.2 25.22 15.11 23.92A1.425 1.425 0 0 1 17.29 22.08Q18.6 23.64 19.9 25.19V24.6Z"></path></g><path fill="currentColor" d="M16 15.3Q16.69 16.91 18.3 17.6Q16.69 18.29 16 19.9Q15.31 18.29 13.7 17.6Q15.31 16.91 16 15.3Z"></path></svg>'
|
|
2076
|
+
)
|
|
2077
|
+
# The logo on the accent-blue badge, inline so the favicon needs no binary asset.
|
|
2037
2078
|
FAVICON = (
|
|
2038
2079
|
"data:image/svg+xml;base64,"
|
|
2039
|
-
"
|
|
2040
|
-
"
|
|
2041
|
-
"
|
|
2080
|
+
"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAz"
|
|
2081
|
+
"MiAzMiI+PHJlY3Qgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIiByeD0iNiIgZmlsbD0iIzJmNmZk"
|
|
2082
|
+
"NiIvPjxzdmcgeD0iMyIgeT0iMyIgd2lkdGg9IjI2IiBoZWlnaHQ9IjI2IiB2aWV3Qm94PSI2"
|
|
2083
|
+
"IDYgMzYgMzYiPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik03LjUgMTQuOVY3LjVIMTQuOVYxMC41"
|
|
2084
|
+
"SDEwLjVWMTQuOVoiPjwvcGF0aD48cGF0aCBmaWxsPSIjZmZmIiBkPSJNNDAuNSAxNC45Vjcu"
|
|
2085
|
+
"NUgzMy4xVjEwLjVIMzcuNVYxNC45WiI+PC9wYXRoPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik03"
|
|
2086
|
+
"LjUgMzMuMVY0MC41SDE0LjlWMzcuNUgxMC41VjMzLjFaIj48L3BhdGg+PHBhdGggZmlsbD0i"
|
|
2087
|
+
"I2ZmZiIgZD0iTTQwLjUgMzMuMVY0MC41SDMzLjFWMzcuNUgzNy41VjMzLjFaIj48L3BhdGg+"
|
|
2088
|
+
"PGcgZmlsbD0iI2ZmZiI+PHJlY3QgeD0iMTkuOSIgeT0iMTYuNCIgd2lkdGg9IjIuODUiIGhl"
|
|
2089
|
+
"aWdodD0iMTAiIHJ4PSIxLjQyNSI+PC9yZWN0PjxyZWN0IHg9IjIzLjMiIHk9IjE0Ljc1IiB3"
|
|
2090
|
+
"aWR0aD0iMi44NSIgaGVpZ2h0PSIxMSIgcng9IjEuNDI1Ij48L3JlY3Q+PHJlY3QgeD0iMjYu"
|
|
2091
|
+
"NyIgeT0iMTUuNiIgd2lkdGg9IjIuODUiIGhlaWdodD0iMTAuNSIgcng9IjEuNDI1Ij48L3Jl"
|
|
2092
|
+
"Y3Q+PHJlY3QgeD0iMzAuMSIgeT0iMTcuOSIgd2lkdGg9IjIuODUiIGhlaWdodD0iOSIgcng9"
|
|
2093
|
+
"IjEuNDI1Ij48L3JlY3Q+PHBhdGggZD0iTTMyLjk1IDI0LjZWMjhDMzIuOTUgMzEgMzAuNiAz"
|
|
2094
|
+
"My4yNSAyNy42IDMzLjI1SDI1LjZDMjMgMzMuMjUgMTguNzEgMjguMjEgMTcuMjkgMjYuNTJR"
|
|
2095
|
+
"MTYuMiAyNS4yMiAxNS4xMSAyMy45MkExLjQyNSAxLjQyNSAwIDAgMSAxNy4yOSAyMi4wOFEx"
|
|
2096
|
+
"OC42IDIzLjY0IDE5LjkgMjUuMTlWMjQuNloiPjwvcGF0aD48L2c+PHBhdGggZmlsbD0iI2Zm"
|
|
2097
|
+
"ZiIgZD0iTTE2IDE1LjNRMTYuNjkgMTYuOTEgMTguMyAxNy42UTE2LjY5IDE4LjI5IDE2IDE5"
|
|
2098
|
+
"LjlRMTUuMzEgMTguMjkgMTMuNyAxNy42UTE1LjMxIDE2LjkxIDE2IDE1LjNaIj48L3BhdGg+"
|
|
2099
|
+
"PC9zdmc+PC9zdmc+"
|
|
2042
2100
|
)
|
|
2043
2101
|
|
|
2044
2102
|
|
|
@@ -2063,13 +2121,35 @@ def nav_link(label: str, icon: str, href: str) -> rx.Component:
|
|
|
2063
2121
|
)
|
|
2064
2122
|
|
|
2065
2123
|
|
|
2124
|
+
def footer_link(label: str, href: str) -> rx.Component:
|
|
2125
|
+
return rx.link(label, href=href, is_external=True, color=MUTED,
|
|
2126
|
+
text_decoration="underline", text_underline_offset="2px",
|
|
2127
|
+
_hover={"color": ACCENT})
|
|
2128
|
+
|
|
2129
|
+
|
|
2130
|
+
def footer() -> rx.Component:
|
|
2131
|
+
return rx.flex(
|
|
2132
|
+
rx.text("Codee is developed by ",
|
|
2133
|
+
footer_link("FuseBase", "https://thefusebase.com")),
|
|
2134
|
+
rx.text("·", aria_hidden="true"),
|
|
2135
|
+
footer_link("Source code on GitHub", "https://github.com/fusebase-dev/codee"),
|
|
2136
|
+
gap="0.5rem",
|
|
2137
|
+
wrap="wrap",
|
|
2138
|
+
align="center",
|
|
2139
|
+
color=MUTED,
|
|
2140
|
+
font_size="0.8rem",
|
|
2141
|
+
padding_top="1rem",
|
|
2142
|
+
border_top=BORDER,
|
|
2143
|
+
)
|
|
2144
|
+
|
|
2145
|
+
|
|
2066
2146
|
def shell(content: rx.Component) -> rx.Component:
|
|
2067
2147
|
return rx.box(
|
|
2068
2148
|
rx.grid(
|
|
2069
2149
|
rx.box(
|
|
2070
2150
|
rx.vstack(
|
|
2071
2151
|
rx.hstack(
|
|
2072
|
-
rx.box(LOGO, color="white", background=ACCENT, width="2rem",
|
|
2152
|
+
rx.box(rx.html(LOGO), color="white", background=ACCENT, width="2rem",
|
|
2073
2153
|
height="2rem", display="grid", place_items="center",
|
|
2074
2154
|
border_radius="6px", font_weight="700",
|
|
2075
2155
|
font_size="1.1rem", line_height="1"),
|
|
@@ -2116,7 +2196,9 @@ def shell(content: rx.Component) -> rx.Component:
|
|
|
2116
2196
|
background=NAV_BACKGROUND,
|
|
2117
2197
|
min_height=rx.breakpoints(initial="auto", lg="100vh"),
|
|
2118
2198
|
),
|
|
2119
|
-
rx.box(content,
|
|
2199
|
+
rx.box(rx.box(content, flex="1", width="100%"), footer(),
|
|
2200
|
+
padding=rx.breakpoints(initial="1.25rem", md="2rem", xl="3rem"),
|
|
2201
|
+
display="flex", flex_direction="column", gap="3rem",
|
|
2120
2202
|
min_width="0", max_width="1440px", width="100%"),
|
|
2121
2203
|
columns=rx.breakpoints(initial="1fr", lg="230px minmax(0, 1fr)"),
|
|
2122
2204
|
min_height="100vh",
|
|
@@ -2515,6 +2597,20 @@ def claude_account_usage_row(account: ClaudeAccount) -> rx.Component:
|
|
|
2515
2597
|
variant="soft", flex_shrink="0"),
|
|
2516
2598
|
rx.fragment()),
|
|
2517
2599
|
rx.spacer(),
|
|
2600
|
+
# Not on the live one, and not on one that cannot be signed in
|
|
2601
|
+
# with: there is nothing to switch to in either case.
|
|
2602
|
+
rx.cond(
|
|
2603
|
+
account.in_use | account.needs_reconnect,
|
|
2604
|
+
rx.fragment(),
|
|
2605
|
+
rx.button(
|
|
2606
|
+
"Set current", type="button", size="1", variant="soft",
|
|
2607
|
+
flex_shrink="0",
|
|
2608
|
+
loading=AdminState.claude_switching_account == account.id,
|
|
2609
|
+
disabled=AdminState.claude_switching_account != 0,
|
|
2610
|
+
title="Make this the account Claude Code runs on, and "
|
|
2611
|
+
"write its credentials into Claude Code's config",
|
|
2612
|
+
on_click=lambda: AdminState.use_claude_code_account(
|
|
2613
|
+
account.id))),
|
|
2518
2614
|
spacing="2", align="center", width="100%",
|
|
2519
2615
|
margin_bottom="0.6rem"),
|
|
2520
2616
|
rx.cond(
|
|
@@ -2615,6 +2711,9 @@ def skill_card(skill: SkillSummary) -> rx.Component:
|
|
|
2615
2711
|
rx.cond(skill.effort != "",
|
|
2616
2712
|
rx.code(skill.effort, font_size="0.72rem",
|
|
2617
2713
|
color_scheme="gray")),
|
|
2714
|
+
rx.cond(skill.context_tier != "",
|
|
2715
|
+
rx.code(skill.context_tier, font_size="0.72rem",
|
|
2716
|
+
color_scheme="gray", title="Context window")),
|
|
2618
2717
|
spacing="2", align="center", width="100%",
|
|
2619
2718
|
class_name="skill-card-meta"),
|
|
2620
2719
|
rx.cond(
|
|
@@ -20,8 +20,10 @@ from dotenv import load_dotenv
|
|
|
20
20
|
from codee_database import claude_code_accounts, oauth_tokens
|
|
21
21
|
from codee_tasks_azure_devops import oauth as azure_oauth
|
|
22
22
|
from codee_agent_abstract.provider import AbstractCodingAgent, AgentModel
|
|
23
|
+
from codee_agent_claude_code import credentials as claude_credentials
|
|
23
24
|
from codee_agent_claude_code import oauth as claude_oauth
|
|
24
|
-
from codee_agent_claude_code.account import
|
|
25
|
+
from codee_agent_claude_code.account import (
|
|
26
|
+
AccountUnavailable, fetch_account, fetch_profile)
|
|
25
27
|
from codee_agent_claude_code.provider import ClaudeCodeAgent
|
|
26
28
|
from codee_agent_claude_code.usage import (
|
|
27
29
|
SESSION_WINDOW, WEEKLY_WINDOW, UsageRateLimited, UsageUnavailable,
|
|
@@ -640,11 +642,29 @@ def _skill_run_summary(
|
|
|
640
642
|
if skill.effort:
|
|
641
643
|
lines.append(f"Effort: {skill.effort}")
|
|
642
644
|
if skill.context_tier:
|
|
643
|
-
lines.append(f"Context: {skill.context_tier}")
|
|
645
|
+
lines.append(f"Context: {context_tier_label(skill.context_tier)}")
|
|
644
646
|
lines.append(f"Skill: {skill.name}")
|
|
645
647
|
return lines
|
|
646
648
|
|
|
647
649
|
|
|
650
|
+
def context_tier_label(tier: str) -> str:
|
|
651
|
+
"""A skill's ``x-codee-context-tier:`` as a person reads it.
|
|
652
|
+
|
|
653
|
+
The window's own size ("1M") is only known from the agent's model catalog,
|
|
654
|
+
which takes a CLI run to read, so places that list skills say the tier.
|
|
655
|
+
"""
|
|
656
|
+
return tier.replace("_", " ")
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
def _skill_model_line(skill: IssueTriggeredSkill) -> str:
|
|
660
|
+
"""The model a skill runs on, with its effort and context tier when set."""
|
|
661
|
+
return " \u00b7 ".join(filter(None, [
|
|
662
|
+
skill.model or WORKFLOW_DEFAULT_MODEL_LABEL,
|
|
663
|
+
skill.effort,
|
|
664
|
+
context_tier_label(skill.context_tier),
|
|
665
|
+
]))
|
|
666
|
+
|
|
667
|
+
|
|
648
668
|
def _with_agent_tooltips(
|
|
649
669
|
workflow: dict[str, Any],
|
|
650
670
|
skills: list[IssueTriggeredSkill],
|
|
@@ -696,10 +716,10 @@ def _node_with_agent_tooltip(
|
|
|
696
716
|
if lines:
|
|
697
717
|
lines.append("")
|
|
698
718
|
lines.extend(_skill_run_summary(skill, default_agent))
|
|
699
|
-
# The models named under the status name on the node itself
|
|
700
|
-
# an entry status often ask for the
|
|
701
|
-
|
|
702
|
-
|
|
719
|
+
# The models named under the status name on the node itself, each with its
|
|
720
|
+
# effort and context tier. Skills sharing an entry status often ask for the
|
|
721
|
+
# same one, so it is said once.
|
|
722
|
+
models = list(dict.fromkeys(_skill_model_line(skill) for skill in handled))
|
|
703
723
|
return {
|
|
704
724
|
**node,
|
|
705
725
|
"className": " ".join(
|
|
@@ -2462,6 +2482,57 @@ class AdminService:
|
|
|
2462
2482
|
claude_code_accounts.remove_account(account_id, self.context)
|
|
2463
2483
|
self._reconcile_claude_code_account()
|
|
2464
2484
|
|
|
2485
|
+
def use_claude_code_account(self, account_id: int) -> tuple[bool, str]:
|
|
2486
|
+
"""Make one account the one in use, and sign the CLI in as it now.
|
|
2487
|
+
|
|
2488
|
+
Returns whether it worked and a sentence to show either way. Both
|
|
2489
|
+
halves are done here rather than left to the next rotation check: the
|
|
2490
|
+
pointer alone would only take effect up to five minutes later, and only
|
|
2491
|
+
in a running executor.
|
|
2492
|
+
|
|
2493
|
+
The token is renewed first, because an account waiting its turn holds
|
|
2494
|
+
one that may have expired hours ago. Its profile goes into
|
|
2495
|
+
``.claude.json`` too, so the CLI names the account it is now running
|
|
2496
|
+
as instead of the previous one. That part is best-effort: the
|
|
2497
|
+
credentials are what makes the switch, and a profile that could not be
|
|
2498
|
+
read is fetched by the CLI itself on its next run.
|
|
2499
|
+
"""
|
|
2500
|
+
try:
|
|
2501
|
+
stored = {account.id: account for account
|
|
2502
|
+
in claude_code_accounts.accounts(self.context)}
|
|
2503
|
+
except Exception as error: # noqa: BLE001 - the UI must never see a traceback
|
|
2504
|
+
return False, f"Could not read the connected accounts: {error}"
|
|
2505
|
+
account = stored.get(account_id)
|
|
2506
|
+
if account is None:
|
|
2507
|
+
return False, "That account is no longer connected"
|
|
2508
|
+
name = account.label or f"account {account.id}"
|
|
2509
|
+
now = int(datetime.now(timezone.utc).timestamp() * 1000)
|
|
2510
|
+
if account.needs_reconnect(now):
|
|
2511
|
+
return False, f"{name} has to be connected again first"
|
|
2512
|
+
|
|
2513
|
+
try:
|
|
2514
|
+
account = ensure_fresh(account, self.context)
|
|
2515
|
+
# A renewal the API refused retires the account rather than
|
|
2516
|
+
# raising, so the only way to hear about it is to look again.
|
|
2517
|
+
renewed = {row.id: row for row
|
|
2518
|
+
in claude_code_accounts.accounts(self.context)}
|
|
2519
|
+
if renewed[account.id].needs_reconnect(now):
|
|
2520
|
+
return False, f"{name} has to be connected again first"
|
|
2521
|
+
claude_credentials.write_credentials(
|
|
2522
|
+
account.access_token, account.refresh_token,
|
|
2523
|
+
account.expires_at, account.scopes, account.subscription_type)
|
|
2524
|
+
claude_code_accounts.set_current_account(account.id, self.context)
|
|
2525
|
+
except Exception as error: # noqa: BLE001
|
|
2526
|
+
return False, f"Could not switch to {name}: {error}"
|
|
2527
|
+
|
|
2528
|
+
try:
|
|
2529
|
+
claude_credentials.write_oauth_account(
|
|
2530
|
+
fetch_profile(account.access_token))
|
|
2531
|
+
except Exception as error: # noqa: BLE001 - the switch itself landed
|
|
2532
|
+
print(f"[admin] Switched Claude Code to {name} but could not "
|
|
2533
|
+
f"record its profile: {error}")
|
|
2534
|
+
return True, f"Claude Code is now running as {name}"
|
|
2535
|
+
|
|
2465
2536
|
def _reconcile_claude_code_account(self) -> None:
|
|
2466
2537
|
"""Point the current account at a connected one.
|
|
2467
2538
|
|
|
@@ -132,6 +132,27 @@ def wrapped(text: str, indent: str = INDENT, style: str = "") -> None:
|
|
|
132
132
|
print(f"{indent}{_style(style, row[len(indent):])}")
|
|
133
133
|
|
|
134
134
|
|
|
135
|
+
def describe_guides(provider: TasksProvider | None = None) -> None:
|
|
136
|
+
docs_url = "https://fusebase-dev.github.io/codee"
|
|
137
|
+
guides = [
|
|
138
|
+
("Configuration", f"{docs_url}/configuration"),
|
|
139
|
+
("Updating skills through Git",
|
|
140
|
+
f"{docs_url}/tutorials/updating-skills-through-git"),
|
|
141
|
+
]
|
|
142
|
+
if provider == TasksProvider.JIRA:
|
|
143
|
+
guides.append(("Working on tasks in Jira",
|
|
144
|
+
f"{docs_url}/tutorials/working-on-tasks-in-jira"))
|
|
145
|
+
elif provider == TasksProvider.AZURE_DEVOPS:
|
|
146
|
+
guides.append(("Working on tasks in Azure DevOps",
|
|
147
|
+
f"{docs_url}/tutorials/working-on-tasks-in-azure-devops"))
|
|
148
|
+
|
|
149
|
+
heading("Continue with these guides")
|
|
150
|
+
for title, url in guides:
|
|
151
|
+
line(title)
|
|
152
|
+
wrapped(url)
|
|
153
|
+
line()
|
|
154
|
+
|
|
155
|
+
|
|
135
156
|
def ask(label: str, secret: bool = False) -> str:
|
|
136
157
|
"""Read one answer at the wizard's margin."""
|
|
137
158
|
return (getpass if secret else input)(f"{INDENT}{label}").strip()
|
|
@@ -417,6 +438,8 @@ def hand_off_to_admin_ui(service: "AdminService", provider: TasksProvider,
|
|
|
417
438
|
for field in TASKS_PROVIDER_FIELDS[provider]:
|
|
418
439
|
line(f" \u00b7 {field.label}")
|
|
419
440
|
|
|
441
|
+
describe_guides(provider)
|
|
442
|
+
|
|
420
443
|
url = f"http://localhost:{port}{SETTINGS_ROUTE}"
|
|
421
444
|
line()
|
|
422
445
|
wrapped("Starting Codee. This can take a few minutes the first time, "
|
|
@@ -466,6 +489,7 @@ def run(destination: Path, port: int) -> int:
|
|
|
466
489
|
else:
|
|
467
490
|
wrapped("Codee is set up but not connected yet. Run "
|
|
468
491
|
"`uv run codee-start` and finish on the Settings page.")
|
|
492
|
+
describe_guides(provider)
|
|
469
493
|
return 0
|
|
470
494
|
|
|
471
495
|
return hand_off_to_admin_ui(service, provider, coding_agent, port)
|
|
@@ -478,3 +502,4 @@ def describe_manual_setup(port: int) -> None:
|
|
|
478
502
|
"`uv run codee-start` and open "
|
|
479
503
|
f"http://localhost:{port}{SETTINGS_ROUTE} to choose a coding "
|
|
480
504
|
"agent and a tasks provider.")
|
|
505
|
+
describe_guides()
|
|
@@ -519,6 +519,84 @@ class AdminServiceClaudeCodeAccountsTest(unittest.TestCase):
|
|
|
519
519
|
["one@example.com"])
|
|
520
520
|
self.assertTrue(accounts[0].in_use)
|
|
521
521
|
|
|
522
|
+
# A refresh window that will not have closed by the time the test runs.
|
|
523
|
+
NEVER_EXPIRES = 4102444800000 # 2100-01-01
|
|
524
|
+
|
|
525
|
+
def _claude_home(self) -> Path:
|
|
526
|
+
"""Point the CLI's config at a temp dir, so nothing real is written."""
|
|
527
|
+
home = self.directory / "claude-home"
|
|
528
|
+
home.mkdir()
|
|
529
|
+
environment = patch.dict(os.environ, {"CLAUDE_CONFIG_DIR": str(home)})
|
|
530
|
+
environment.start()
|
|
531
|
+
self.addCleanup(environment.stop)
|
|
532
|
+
return home
|
|
533
|
+
|
|
534
|
+
def test_setting_an_account_current_signs_the_cli_in_as_it(self) -> None:
|
|
535
|
+
home = self._claude_home()
|
|
536
|
+
(home / ".claude.json").write_text(json.dumps(
|
|
537
|
+
{"oauthAccount": {"emailAddress": "one@example.com"}}))
|
|
538
|
+
self._connect("one@example.com")
|
|
539
|
+
second_tokens = claude_oauth.Tokens(
|
|
540
|
+
"access-2", "refresh-2", expires_at=1789300823639,
|
|
541
|
+
refresh_expires_at=self.NEVER_EXPIRES, scopes=("user:profile",),
|
|
542
|
+
subscription_type="pro")
|
|
543
|
+
self._connect("two@example.com", tokens=second_tokens)
|
|
544
|
+
second = self.service.claude_code_accounts()[1]
|
|
545
|
+
|
|
546
|
+
with patch("codee.admin_service.ensure_fresh",
|
|
547
|
+
side_effect=lambda a, c: a), \
|
|
548
|
+
patch("codee.admin_service.fetch_profile", return_value={
|
|
549
|
+
"account": {"uuid": "acc-2",
|
|
550
|
+
"email": "two@example.com"}}):
|
|
551
|
+
switched, message = self.service.use_claude_code_account(second.id)
|
|
552
|
+
|
|
553
|
+
self.assertTrue(switched, message)
|
|
554
|
+
self.assertTrue(self.service.claude_code_accounts()[1].in_use)
|
|
555
|
+
oauth = json.loads((home / ".credentials.json").read_text())[
|
|
556
|
+
"claudeAiOauth"]
|
|
557
|
+
self.assertEqual(oauth["accessToken"], "access-2")
|
|
558
|
+
self.assertEqual(oauth["refreshToken"], "refresh-2")
|
|
559
|
+
self.assertEqual(oauth["subscriptionType"], "pro")
|
|
560
|
+
self.assertEqual(
|
|
561
|
+
json.loads((home / ".claude.json").read_text())["oauthAccount"],
|
|
562
|
+
{"accountUuid": "acc-2", "emailAddress": "two@example.com"})
|
|
563
|
+
|
|
564
|
+
def test_an_unreadable_profile_does_not_undo_the_switch(self) -> None:
|
|
565
|
+
home = self._claude_home()
|
|
566
|
+
self._connect("one@example.com", tokens=claude_oauth.Tokens(
|
|
567
|
+
"access-1", "refresh-1", expires_at=1789300823639,
|
|
568
|
+
refresh_expires_at=self.NEVER_EXPIRES))
|
|
569
|
+
|
|
570
|
+
with patch("codee.admin_service.ensure_fresh",
|
|
571
|
+
side_effect=lambda a, c: a), \
|
|
572
|
+
patch("codee.admin_service.fetch_profile",
|
|
573
|
+
side_effect=AccountUnavailable("no route")):
|
|
574
|
+
switched, _ = self.service.use_claude_code_account(
|
|
575
|
+
self.service.claude_code_accounts()[0].id)
|
|
576
|
+
|
|
577
|
+
self.assertTrue(switched)
|
|
578
|
+
self.assertTrue((home / ".credentials.json").exists())
|
|
579
|
+
|
|
580
|
+
def test_an_account_that_needs_signing_in_again_is_not_switched_to(self) -> None:
|
|
581
|
+
home = self._claude_home()
|
|
582
|
+
expired = claude_oauth.Tokens(
|
|
583
|
+
"access-1", "refresh-1", expires_at=1, refresh_expires_at=1)
|
|
584
|
+
self._connect("one@example.com", tokens=expired)
|
|
585
|
+
|
|
586
|
+
switched, message = self.service.use_claude_code_account(
|
|
587
|
+
self.service.claude_code_accounts()[0].id)
|
|
588
|
+
|
|
589
|
+
self.assertFalse(switched)
|
|
590
|
+
self.assertIn("connected again", message)
|
|
591
|
+
self.assertFalse((home / ".credentials.json").exists())
|
|
592
|
+
|
|
593
|
+
def test_a_disconnected_account_is_not_switched_to(self) -> None:
|
|
594
|
+
self._claude_home()
|
|
595
|
+
|
|
596
|
+
switched, _ = self.service.use_claude_code_account(42)
|
|
597
|
+
|
|
598
|
+
self.assertFalse(switched)
|
|
599
|
+
|
|
522
600
|
def test_disconnecting_an_account_forgets_its_tokens(self) -> None:
|
|
523
601
|
self._connect()
|
|
524
602
|
account = self.service.claude_code_accounts()[0]
|
|
@@ -2235,6 +2313,25 @@ class AdminServiceWorkflowAgentTest(unittest.TestCase):
|
|
|
2235
2313
|
"'claude-opus-5'",
|
|
2236
2314
|
)
|
|
2237
2315
|
|
|
2316
|
+
def test_the_effort_and_context_tier_follow_the_model_on_the_node(
|
|
2317
|
+
self) -> None:
|
|
2318
|
+
with tempfile.TemporaryDirectory() as temporary_directory:
|
|
2319
|
+
service = self._service(
|
|
2320
|
+
Path(temporary_directory),
|
|
2321
|
+
"model: claude-opus-5\neffort: high\n"
|
|
2322
|
+
"x-codee-context-tier: long_context\nx-codee-agent: codex\n")
|
|
2323
|
+
|
|
2324
|
+
nodes = self._story_nodes(service)
|
|
2325
|
+
|
|
2326
|
+
self.assertEqual(
|
|
2327
|
+
nodes["Ready"]["style"]["--codee-node-model"],
|
|
2328
|
+
"'claude-opus-5 \u00b7 high \u00b7 long context'",
|
|
2329
|
+
)
|
|
2330
|
+
self.assertIn(
|
|
2331
|
+
"Context: long context",
|
|
2332
|
+
nodes["Ready"]["style"]["--codee-agent-run"],
|
|
2333
|
+
)
|
|
2334
|
+
|
|
2238
2335
|
def test_a_skill_that_names_neither_falls_back_to_what_runs_it(self) -> None:
|
|
2239
2336
|
with tempfile.TemporaryDirectory() as temporary_directory:
|
|
2240
2337
|
root = Path(temporary_directory)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import io
|
|
1
2
|
import os
|
|
2
3
|
import tempfile
|
|
3
4
|
import unittest
|
|
5
|
+
from contextlib import redirect_stdout
|
|
4
6
|
from pathlib import Path
|
|
5
7
|
from unittest.mock import patch
|
|
6
8
|
|
|
@@ -41,6 +43,26 @@ class AgentCliTest(unittest.TestCase):
|
|
|
41
43
|
finally:
|
|
42
44
|
os.chdir(original_directory)
|
|
43
45
|
|
|
46
|
+
def test_manual_setup_shows_only_the_common_guides(self) -> None:
|
|
47
|
+
for argv, interactive in ((["init", "--scaffold-only"], True),
|
|
48
|
+
(["init"], False)):
|
|
49
|
+
with self.subTest(argv=argv, interactive=interactive):
|
|
50
|
+
output = io.StringIO()
|
|
51
|
+
with redirect_stdout(output), \
|
|
52
|
+
patch.object(agent_cli, "scaffold", return_value=[]), \
|
|
53
|
+
patch.object(agent_cli, "confirm_overwrite",
|
|
54
|
+
return_value=True), \
|
|
55
|
+
patch("sys.stdin.isatty", return_value=interactive):
|
|
56
|
+
self.assertEqual(self._init(argv), 0)
|
|
57
|
+
text = output.getvalue()
|
|
58
|
+
self.assertIn(
|
|
59
|
+
"https://fusebase-dev.github.io/codee/configuration", text)
|
|
60
|
+
self.assertIn(
|
|
61
|
+
"https://fusebase-dev.github.io/codee/tutorials/updating-skills-through-git",
|
|
62
|
+
text)
|
|
63
|
+
self.assertNotIn("working-on-tasks-in-jira", text)
|
|
64
|
+
self.assertNotIn("working-on-tasks-in-azure-devops", text)
|
|
65
|
+
|
|
44
66
|
def test_a_pipe_still_scaffolds_but_asks_nothing(self) -> None:
|
|
45
67
|
original_directory = Path.cwd()
|
|
46
68
|
with tempfile.TemporaryDirectory() as temporary_directory:
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import io
|
|
1
2
|
import unittest
|
|
3
|
+
from contextlib import redirect_stdout
|
|
2
4
|
from unittest.mock import MagicMock, patch
|
|
3
5
|
|
|
4
6
|
from codee_main_context.context import CodingAgent, Settings, TasksProvider
|
|
@@ -6,6 +8,31 @@ from codee_main_context.context import CodingAgent, Settings, TasksProvider
|
|
|
6
8
|
from codee import setup_wizard
|
|
7
9
|
|
|
8
10
|
|
|
11
|
+
class DescribeGuidesTest(unittest.TestCase):
|
|
12
|
+
def test_shows_common_guides_and_only_the_selected_provider_tutorial(self) -> None:
|
|
13
|
+
docs_url = "https://fusebase-dev.github.io/codee"
|
|
14
|
+
provider_guides = {
|
|
15
|
+
TasksProvider.JIRA: f"{docs_url}/tutorials/working-on-tasks-in-jira",
|
|
16
|
+
TasksProvider.AZURE_DEVOPS:
|
|
17
|
+
f"{docs_url}/tutorials/working-on-tasks-in-azure-devops",
|
|
18
|
+
}
|
|
19
|
+
for provider in (None, *TasksProvider):
|
|
20
|
+
with self.subTest(provider=provider):
|
|
21
|
+
output = io.StringIO()
|
|
22
|
+
with redirect_stdout(output), \
|
|
23
|
+
patch.object(setup_wizard, "_width", return_value=40):
|
|
24
|
+
setup_wizard.describe_guides(provider)
|
|
25
|
+
text = output.getvalue()
|
|
26
|
+
self.assertIn(f"{docs_url}/configuration", text)
|
|
27
|
+
self.assertIn(
|
|
28
|
+
f"{docs_url}/tutorials/updating-skills-through-git", text)
|
|
29
|
+
for source, url in provider_guides.items():
|
|
30
|
+
if source == provider:
|
|
31
|
+
self.assertIn(url, text)
|
|
32
|
+
else:
|
|
33
|
+
self.assertNotIn(url, text)
|
|
34
|
+
|
|
35
|
+
|
|
9
36
|
class ChooseCodingAgentTest(unittest.TestCase):
|
|
10
37
|
def test_single_detected_agent_is_used_without_asking(self) -> None:
|
|
11
38
|
with patch.object(setup_wizard, "installed_coding_agents",
|
|
@@ -153,9 +180,24 @@ class HandOffToAdminUiTest(unittest.TestCase):
|
|
|
153
180
|
process = MagicMock()
|
|
154
181
|
process.wait.return_value = 0
|
|
155
182
|
process.poll.return_value = 0
|
|
156
|
-
|
|
183
|
+
|
|
184
|
+
def start_process(*args, **kwargs):
|
|
185
|
+
text = output.getvalue()
|
|
186
|
+
self.assertIn("https://fusebase-dev.github.io/codee/configuration", text)
|
|
187
|
+
self.assertIn(
|
|
188
|
+
"https://fusebase-dev.github.io/codee/tutorials/updating-skills-through-git",
|
|
189
|
+
text)
|
|
190
|
+
self.assertIn(
|
|
191
|
+
"https://fusebase-dev.github.io/codee/tutorials/working-on-tasks-in-azure-devops",
|
|
192
|
+
text)
|
|
193
|
+
self.assertNotIn("working-on-tasks-in-jira", text)
|
|
194
|
+
return process
|
|
195
|
+
|
|
196
|
+
output = io.StringIO()
|
|
197
|
+
with redirect_stdout(output), \
|
|
198
|
+
patch("builtins.input", return_value=""), \
|
|
157
199
|
patch.object(setup_wizard.subprocess, "Popen",
|
|
158
|
-
|
|
200
|
+
side_effect=start_process) as popen, \
|
|
159
201
|
patch.object(setup_wizard, "wait_for_admin_ui",
|
|
160
202
|
return_value=True), \
|
|
161
203
|
patch.object(setup_wizard.webbrowser, "open") as browser:
|
|
@@ -204,6 +246,32 @@ class WaitForAdminUiTest(unittest.TestCase):
|
|
|
204
246
|
|
|
205
247
|
|
|
206
248
|
class RunTest(unittest.TestCase):
|
|
249
|
+
def test_terminal_setup_shows_guides_even_if_not_connected(self) -> None:
|
|
250
|
+
for configured in (True, False):
|
|
251
|
+
with self.subTest(configured=configured):
|
|
252
|
+
output = io.StringIO()
|
|
253
|
+
with redirect_stdout(output), \
|
|
254
|
+
patch("codee.admin_service.AdminService",
|
|
255
|
+
return_value=_service()), \
|
|
256
|
+
patch.object(setup_wizard, "choose_coding_agent",
|
|
257
|
+
return_value=CodingAgent.CLAUDE_CODE), \
|
|
258
|
+
patch.object(setup_wizard, "choose_tasks_provider",
|
|
259
|
+
return_value=TasksProvider.JIRA), \
|
|
260
|
+
patch.object(setup_wizard, "setup_in_terminal",
|
|
261
|
+
return_value=configured):
|
|
262
|
+
self.assertEqual(
|
|
263
|
+
setup_wizard.run(setup_wizard.Path("."), 8501), 0)
|
|
264
|
+
text = output.getvalue()
|
|
265
|
+
self.assertIn(
|
|
266
|
+
"https://fusebase-dev.github.io/codee/configuration", text)
|
|
267
|
+
self.assertIn(
|
|
268
|
+
"https://fusebase-dev.github.io/codee/tutorials/updating-skills-through-git",
|
|
269
|
+
text)
|
|
270
|
+
self.assertIn(
|
|
271
|
+
"https://fusebase-dev.github.io/codee/tutorials/working-on-tasks-in-jira",
|
|
272
|
+
text)
|
|
273
|
+
self.assertNotIn("working-on-tasks-in-azure-devops", text)
|
|
274
|
+
|
|
207
275
|
def test_a_terminal_provider_never_starts_the_admin_ui(self) -> None:
|
|
208
276
|
service = _service()
|
|
209
277
|
service.verify_tasks_connection.return_value = iter([
|