Files
xmwork/scripts/enter.sh
gongzhiyong e5e5f939ee feat: 13 specialist agents + 3 team orchestration commands + az CLI + read-everywhere perms
Agents (10 new, total 13):
- python-fastapi-expert   — chat-gw / xiaoshou / CloudCost / kb-chat-python
- nestjs-expert           — gongdan backend
- react-frontend-expert   — xiaoshou/gongdan/casdoor web
- mcp-tools-architect     — chat-gw tool registry + auth pipeline
- celery-worker-expert    — CloudCost async tasks + beat
- security-auditor        — OWASP + secrets + auth (read-only)
- test-engineer           — coverage + flaky + e2e
- ci-cd-engineer          — 6 repos GitHub Actions
- azure-aca-expert        — ACA + Bicep + Key Vault
- docs-writer             — README / API / runbook

Team orchestration commands:
- /team-feature   — brainstorm → architect → split → parallel impl → QA
- /team-bug-fix   — triage → RCA → fix → regression test → review
- /team-refactor  — scope → test-first → batch → verify

Infrastructure:
- Dockerfile: add Azure CLI (native apt package)
- docker-compose.yml: mount ~/.azure and ~/.config/gh (read-only)
- scripts/enter.sh: banner showing agents/commands on start
- scripts/install-plugins.sh: helper to install superpowers/OMC/agent-browser

Permissions (.claude/settings.json):
- Full read access: az, gh, kubectl, psql SELECT, redis GET/KEYS/INFO
- Controlled write: gh pr create/comment, git push origin (not main)
- Hard deny: az */update|create|delete, gh pr merge, git push --force,
  alembic downgrade, kubectl apply/delete, sudo, rm -rf /

Docs:
- CLAUDE.md: new 'Agent 团队' + '权限模型' sections
- README.md: full agent roster + permission summary

Note: Dockerfile changed — run 'docker compose build' to install Azure CLI
2026-04-24 22:20:13 +08:00

70 lines
3.8 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
# .env 可选(订阅模式下完全无需 key)
if [[ ! -f .env ]]; then
cp .env.example .env
echo "已创建 .env(订阅模式无需填 key,直接继续)"
fi
# 首次构建提示
if ! docker image inspect claude-agent-6repos:latest >/dev/null 2>&1; then
echo ">>> 首次构建镜像(约 5 分钟,下载 Node/Python/Go/Bun 工具链)"
docker compose build
fi
# 检查容器内是否已登录(claude-home 卷里有 .credentials.json)
LOGGED_IN=$(docker volume inspect ai-ops_claude-home >/dev/null 2>&1 \
&& docker run --rm -v ai-ops_claude-home:/h alpine \
sh -c 'test -f /h/.credentials.json && echo yes || echo no' 2>/dev/null || echo no)
if [[ "$LOGGED_IN" != "yes" && -z "${ANTHROPIC_API_KEY:-$(grep -E '^ANTHROPIC_API_KEY=sk-' .env 2>/dev/null || true)}" ]]; then
cat <<'LOGIN_HINT'
>>> 首次登录提示:
进入容器后执行 /login,用浏览器完成 Claude Max 订阅 OAuth。
凭证会持久化到 docker volume,下次直接复用。
LOGIN_HINT
fi
# 统计 agent / command 数量(供 banner 显示)
AGENT_COUNT=$(ls .claude/agents/*.md 2>/dev/null | wc -l | tr -d ' ')
CMD_COUNT=$(ls .claude/commands/*.md 2>/dev/null | wc -l | tr -d ' ')
PLAYBOOK_COUNT=$(ls playbooks/*.md 2>/dev/null | wc -l | tr -d ' ')
cat <<BANNER
╔══════════════════════════════════════════════════════════════════╗
║ 6-Repo Enterprise Matrix — Agent Workstation ║
╠══════════════════════════════════════════════════════════════════╣
║ 已加载: $AGENT_COUNT 个 subagent · $CMD_COUNT 个 slash command · $PLAYBOOK_COUNT 个 playbook ║
║ ║
║ Team 编排命令(任选其一): ║
║ /team-feature <desc> 功能开发(brainstorm→split→impl→QA)║
║ /team-bug-fix <desc> Bug 修复(triage→RCA→fix→test) ║
║ /team-refactor <desc> 重构(test-first→batch→verify) ║
║ ║
║ 快速命令: ║
║ /audit-deps [repo|all] 依赖 + CVE 审计 ║
║ /add-ci <repo> 补 GitHub Actions CI ║
║ /review-pr <pr> 深度 PR 审查 ║
║ /sync-upstream [--dry] casdoor upstream 同步 ║
║ /check-migrations Alembic/Prisma 一致性巡检 ║
║ ║
║ 专家 Subagent 自动派遣(无需手动调用): ║
║ python-fastapi-expert · nestjs-expert · react-frontend-expert║
║ casdoor-specialist · lobechat-brand-guardian · docs-writer ║
║ mcp-tools-architect · celery-worker-expert · migration- ║
║ reviewer · security-auditor · test-engineer · ci-cd-engineer ║
║ · azure-aca-expert ║
║ ║
║ 首次使用请:/login 然后 /plugin install superpowers ║
╚══════════════════════════════════════════════════════════════════╝
BANNER
exec docker compose run --rm claude-agent "$@"