feat(commands): add /agent-factory:deploy command

This commit is contained in:
Kjell Tore Guttormsen 2026-04-12 06:44:49 +02:00
commit cd74a4e8b0

102
commands/deploy.md Normal file
View file

@ -0,0 +1,102 @@
---
description: Configure deployment for your agent system. Supports /schedule (cloud), Desktop scheduled tasks, cron/launchd, systemd, and Docker.
argument-hint: "Optional: deployment target (schedule, desktop, local, vps, docker)"
allowed-tools: ["Read", "Write", "Edit", "Glob", "Grep", "Bash", "Agent", "AskUserQuestion"]
---
You are running `/agent-factory:deploy` — a guided deployment configuration for autonomous agent systems.
If $ARGUMENTS specifies a target, skip to that target's section. Otherwise, ask the user to choose.
---
## Step 1: Scan existing system
Read the user's agent system:
- Glob for `.claude/agents/*.md` — list all agents with names and models
- Glob for `.claude/skills/*/SKILL.md` and `.claude/skills/*.md` — list all skills
- Read `.claude/settings.json` if it exists — check hook configuration
- Check for existing automation: `automation/`, `HEARTBEAT.md`, `docker-compose.yml`
- Read `CLAUDE.md` for project context
Summarize what was found before proceeding.
---
## Step 2: Choose deployment target
Ask using AskUserQuestion:
"Where should your agents run? Choose a deployment target:
1. **Cloud (/schedule)** — Runs on Anthropic's cloud. Needs GitHub repo. No local file access. 1-hour minimum interval. Best for: PR reviews, CI triage, repo maintenance.
2. **Desktop scheduled tasks** — Runs on your machine via Claude Code Desktop app. Local file access. 1-minute minimum interval. Best for: local automation, file processing.
3. **Local (cron/launchd)** — Traditional scheduler. Runs headless via `claude -p`. Full local access. Best for: personal daily pipelines, development.
4. **VPS (systemd)** — Linux server with systemd service/timer. Always-on. Best for: team pipelines, production workloads.
5. **Docker** — Containerized agent. Portable, isolated. Best for: reproducible deployments, security isolation."
If `$ARGUMENTS` matches a target name, skip this question.
---
## Step 3: Configure chosen target
### Cloud (/schedule)
1. Check GitHub connection: suggest `/web-setup` if not connected
2. Explain: "Cloud tasks clone your repo on each run. Local files are not accessible. MCP connectors provide external service access."
3. Generate a task prompt from the user's pipeline skills
4. Guide the user through `/schedule` to create the task
5. Note minimum 1-hour interval
### Desktop scheduled tasks
1. Explain: "Desktop tasks run on your machine with full local file access."
2. Guide through the Desktop app's Schedule page
3. Configure permission mode for unattended operation
### Local (cron/launchd)
1. Read `${CLAUDE_PLUGIN_ROOT}/scripts/templates/automation.sh`
2. Copy and customize to `automation/run-pipeline.sh`
3. Replace SKILL_NAME with the user's pipeline name
4. Ask: "What schedule? (e.g., daily at 07:00, every 2 hours)"
5. For macOS: read `${CLAUDE_PLUGIN_ROOT}/scripts/templates/launchd.plist`, customize, save to `automation/`
6. For Linux: generate cron entry
7. Provide exact activation commands
### VPS (systemd)
1. Read `${CLAUDE_PLUGIN_ROOT}/scripts/templates/systemd-service.unit`
2. Ask: "What Linux user runs the agent?" and "Absolute path to project?"
3. Customize and save service + timer units to `automation/`
4. Copy automation.sh template to `automation/run-pipeline.sh`
5. Provide setup instructions including `systemctl enable/start`
### Docker
1. Read `${CLAUDE_PLUGIN_ROOT}/scripts/templates/docker/` templates (created in Session 6)
2. If templates don't exist yet: generate basic Dockerfile + docker-compose.yml inline
3. Customize with project-specific values
4. Save to project root
5. Provide `docker compose up -d` instructions
---
## Step 4: Verify deployment
For each target, provide a verification command:
- Cloud: `/schedule list` → task visible
- Desktop: Check Schedule page in Desktop app
- Local: `crontab -l | grep claude` or `launchctl list | grep claude`
- VPS: `systemctl status claude-agent`
- Docker: `docker compose ps`
Use the `deployment-advisor` agent when the user needs guidance choosing between targets.
---
## Step 5: Next steps
Tell the user:
- "Run `/agent-factory:status` to check your deployment"
- "Run `/agent-factory:evaluate` to assess your system's capability coverage"