refactor(contrib): inline provision steps per-provider, drop shared apply module
Each AgentProvider now owns its skills / prompt / provision / supervise_mcp end-to-end. The base ABC declares all four as abstract; ClaudeAgentProvider and CodexAgentProvider each carry their own copy loop. Per PR review feedback (review #128): the shared _provision_apply.py abstraction was weak — Claude and Codex harnesses already diverge (codex's dummy-auth + login-status verify has no claude analogue) and forcing both onto one helper just postpones the split. Duplication is intentional. Deletes bot_bottle/_provision_apply.py and consolidates testing under tests/unit/test_contrib_{claude,codex}_provider.py (one file per provider, covering all four methods).
This commit is contained in:
@@ -142,35 +142,27 @@ class AgentProvider(ABC):
|
||||
Backends call this during `prepare` and consume the result as
|
||||
before."""
|
||||
|
||||
@abstractmethod
|
||||
def provision_skills(self, plan: "BottlePlan", bottle: "Bottle") -> None:
|
||||
"""Copy each of the agent's named skills from
|
||||
~/.claude/skills/<name>/ on the host into
|
||||
/home/node/.claude/skills/<name>/ in the guest. No-op when
|
||||
the agent has no skills.
|
||||
|
||||
Default implementation matches the legacy backend-side
|
||||
modules; providers override only if the in-guest layout
|
||||
differs."""
|
||||
from . import _provision_apply
|
||||
_provision_apply.apply_skills(plan, bottle)
|
||||
"""Copy each of the agent's named skills from the host into
|
||||
the guest. No-op when the agent has no skills. The in-guest
|
||||
layout is provider-specific (claude-code's
|
||||
`~/.claude/skills/` today; future providers may differ)."""
|
||||
|
||||
@abstractmethod
|
||||
def provision_prompt(self, plan: "BottlePlan", bottle: "Bottle") -> str | None:
|
||||
"""Copy the prompt file into the guest, fix ownership/mode,
|
||||
and return the in-guest path iff the agent has a non-empty
|
||||
prompt (drives the `--append-system-prompt-file` flag).
|
||||
|
||||
The file is copied either way so the path always exists."""
|
||||
from . import _provision_apply
|
||||
return _provision_apply.apply_prompt(plan, bottle)
|
||||
|
||||
@abstractmethod
|
||||
def provision(self, plan: "BottlePlan", bottle: "Bottle") -> None:
|
||||
"""Apply the declarative `dirs`/`pre_copy`/`files`/`verify`
|
||||
steps from `plan.agent_provision`. Default implementation
|
||||
works for any provider that produces a standard plan; was
|
||||
called `provision_provider_auth` on `BottleBackend` before
|
||||
PRD 0050."""
|
||||
from . import _provision_apply
|
||||
_provision_apply.apply_provision(plan, bottle)
|
||||
"""Apply the provider's declarative
|
||||
`dirs`/`pre_copy`/`files`/`verify` steps from
|
||||
`plan.agent_provision`. Was called `provision_provider_auth`
|
||||
on `BottleBackend` before PRD 0050."""
|
||||
|
||||
@abstractmethod
|
||||
def provision_supervise_mcp(
|
||||
|
||||
Reference in New Issue
Block a user