Introduce capability extension system for provisioning#22
Merged
Conversation
- Add capability types (CapabilityDef, ProvisionContext, etc.) to @clawctl/types - Create @clawctl/capabilities package with: - Helper modules (apt, node, systemd, homebrew, openclaw, tailscale, op-cli, skills) - Capability definitions (system-base, homebrew, openclaw, checkpoint, tailscale, one-password) - Registry with dependency resolution and pre/main/post hook timing - State tracking with sequential migration support - Runner (runPhase) replacing runStage - VM-side AGENTS.md writer - Wire VM-side: ProvisionContext SDK, provision command, doctor command - Add backwards-compatible provision config translation https://claude.ai/code/session_01Mz4WN3iXvqi7hddiMjAkLx
- Wire host-side: provision.ts writes capabilities map, headless.ts maps config, bootstrap.ts removes patchAgentsMd, create.ts removes patchAgentsMd - Delete old stage files (stages.ts, system.ts, tools.ts, openclaw.ts, workspace.ts) - Delete old tool wrappers (apt, node, homebrew, tailscale, skills, op-cli) - Delete host-side agents-md.ts (replaced by VM-side capability runner) - Add registry tests (21 tests) and state tests (10 tests) - Fix formatting across capability package files - All 275 tests pass, lint clean, build succeeds https://claude.ai/code/session_01Mz4WN3iXvqi7hddiMjAkLx
Remove stale task directory from failed plan mode session. Create new task with full scope covering all PR review feedback. https://claude.ai/code/session_01Mz4WN3iXvqi7hddiMjAkLx
- Rename ProvisionContext → CapabilityContext across all packages - Add apt, systemd, agentsMd facets to CapabilityContext SDK - Move registry (application wiring) from capabilities to vm-cli - Colocate capability helpers into capability directories - Inline skill content in checkpoint and one-password capabilities - Replace agentsMdSection field with ctx.agentsMd.update() SDK action - Update runner to receive resolved hooks (decouple from registry) - Extract basePhase/hookTiming utilities to capabilities/util.ts - Delete shared helpers/ directory, agents-md.ts, and registry.ts All 275 tests pass. Lint and format clean. Binary builds. https://claude.ai/code/session_01Mz4WN3iXvqi7hddiMjAkLx
The bootstrap prompt (openclaw agent --message) populates the base AGENTS.md. Capability-contributed sections must be appended after that, not during provision-workspace which runs before onboard. - Move agents-md-checkpoint step from provision-workspace to bootstrap hook - Move agents-md-one-password step from provision-workspace to bootstrap hook - Add `claw provision bootstrap` subcommand - Wire host to call `claw provision bootstrap` after the bootstrap prompt - Remove stale comment about AGENTS.md in bootstrap.ts https://claude.ai/code/session_01Mz4WN3iXvqi7hddiMjAkLx
New docs/capabilities.md covering the extension system: lifecycle phases, hook timing, CapabilityContext SDK, writing capabilities, the runner, state tracking, migrations, and AGENTS.md managed sections. Updated vm-cli.md and vm-provisioning.md to reference the capabilities system and include the bootstrap provision phase. https://claude.ai/code/session_01Mz4WN3iXvqi7hddiMjAkLx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactor the hardcoded provisioning stages into a capability-focused extension system. Each feature (system packages, Homebrew, 1Password, Tailscale, OpenClaw, etc.) is now a self-contained, versioned capability module with lifecycle hooks, sequential migrations, config schema contributions, and an injected toolkit SDK.
Key Changes
New
@clawctl/capabilitiespackage: Centralized capability definitions with atomic, reusable modulesregistry.ts: Static registry of all capabilities with enable/disable logicrunner.ts: Phase runner that collects and executes hooks from enabled capabilitiesstate.ts: Capability state tracking for version-based migrationsagents-md.ts: Moved from host-core, now VM-side and capability-drivenNew
ProvisionContextSDK (@clawctl/types): Injected into all capability stepsCapability modules in
packages/capabilities/src/capabilities/:system-base.ts: APT packages, Node.js, systemd-linger (core)homebrew.ts: Homebrew installation and shell profile (core)openclaw.ts: OpenClaw install, env vars, gateway stub (core)checkpoint.ts: Checkpoint skill (core)tailscale.ts: Tailscale installation (optional)one-password.ts: 1Password CLI, wrapper, exec-approvals, skills (optional)Helper modules in
packages/capabilities/src/helpers/:vm-cli/src/tools/(apt, node, homebrew, tailscale, op-cli, openclaw, systemd, skills)ProvisionContextinstead of direct exec/fs importsVM-side integration:
vm-cli/src/capabilities/context.ts: RealProvisionContextimplementation wiring SDK to vm-cli primitivesvm-cli/src/commands/provision/index.ts: Refactored to userunPhase()from capabilities registrystages.ts,system.ts,tools.ts,openclaw.ts,workspace.tsHost-side updates:
host-core/src/agents-md.ts(moved to capabilities)provision.tsto write capability-aware configpatchAgentsMdexport (now VM-side responsibility)Type system:
@clawctl/types/src/capability.ts:CapabilityDef,CapabilityHook,ProvisionContext,ProvisionResult, etc.ProvisionConfigmoved fromtypes.tstocapability.tswith backwards-compat fields (onePassword,tailscale)types/src/schemas/index.tsTesting: Added comprehensive tests for registry and state modules
Notable Implementation Details
onePassword,tailscale) still work via capabilityenabled()functionshttps://claude.ai/code/session_01Mz4WN3iXvqi7hddiMjAkLx