💻 システム開発
14_scale-ai-ops_分離依頼
最終更新 2026年06月24日 / 31_システム開発部/分離プロジェクト依頼書/14_scale-ai-ops_分離依頼.md
依頼書: SCALE Base から「AI Ops + Data Lake」を独立プロジェクトに分離
新しい Claude Code セッション宛て。コピペでそのまま実行可能。完了後 Slack
#system_scalebaseで大串に報告。
あなたが実行すること
SCALE Base モノリス内の AI Ops + Data Lake + Automation を scale-ai-ops プロジェクトに集約・分離。
完了後 scale-base のサイドバー「AI Ops」「Data Lake」をクリックすると新プロジェクトの該当パスを開く。
並行セッションでの開発は無いので落ち着いて作業 OK。
SCALE Base 全体情報
| 項目 | 内容 |
|---|---|
| scale-base ローカル | /Users/oogushiyuuki/Library/CloudStorage/GoogleDrive-y-ogushi@scale-group.co.jp/マイドライブ/AI/scale-base/ |
| scale-base 本番 | https://scale-base.pages.dev/ |
| Framework | Next.js 15+(App Router) |
| デプロイ | Cloudflare Pages(bash scripts/deploy.sh) |
| 共有データ Worker | https://scale-task-cron.y-ogushi.workers.dev |
| 認証 | lib/auth-context.tsx の DEMO_USERS 固定 |
進捗チェックリスト
- [ ] ローカル
~/Library/CloudStorage/.../AI/scale-ai-ops/作成 - [ ] Next.js + Tailwind 雛形
- [ ] scale-base 共通設定コピー
- [ ] ai-ops + datalake + automation 関連コード移植
- [ ] パス階層を
ai-ops / datalake / automationのサブディレクトリで保持 - [ ] レイアウト + 認証
- [ ] ローカル動作確認
- [ ] Cloudflare Pages project
scale-ai-ops作成 + デプロイ - [ ] scale-base の systems.ts で 2システムに externalUrl 設定 + 旧コード退避
- [ ] scale-base 再デプロイ
- [ ] Slack 完了報告
Step 1: 雛形
cd ~/Library/CloudStorage/GoogleDrive-y-ogushi@scale-group.co.jp/マイドライブ/AI/
npx create-next-app@latest scale-ai-ops --typescript --tailwind --app --src-dir=false --import-alias="@/*" --no-eslint
cd scale-ai-ops
Step 2: 共通設定コピー
SRC=~/Library/CloudStorage/GoogleDrive-y-ogushi@scale-group.co.jp/マイドライブ/AI/scale-base
cp "$SRC/tailwind.config.ts" ./
cp "$SRC/app/globals.css" ./app/globals.css
mkdir -p lib
cp "$SRC/lib/auth-context.tsx" ./lib/
cp "$SRC/lib/tasks-api.tsx" ./lib/ 2>/dev/null || true
Step 3: ai-ops + datalake + automation コード移植
scale-ai-ops 内の構造:
app/
├── page.tsx (AI Ops ダッシュボード)
├── ai-ops/ ← 旧 ai-ops/ の中身
├── datalake/ ← Data Lake
└── automation/ ← Automation
単純化のため、ai-ops は
app/直下に展開(メイン機能扱い)、datalake と automation はサブパス。
mkdir -p app/datalake app/automation components functions/api
# ai-ops を ルート直下に展開
cp -r "$SRC/app/(dashboard)/ai-ops/." ./app/
# datalake
cp -r "$SRC/app/(dashboard)/datalake/." ./app/datalake/
# automation
cp -r "$SRC/app/(dashboard)/automation/." ./app/automation/ 2>/dev/null || true
# components
cp -r "$SRC/components/ai-ops" ./components/ 2>/dev/null || true
cp -r "$SRC/components/datalake" ./components/ 2>/dev/null || true
cp -r "$SRC/components/automation" ./components/ 2>/dev/null || true
# lib
cp "$SRC"/lib/ai-ops-*.ts ./lib/ 2>/dev/null || true
cp "$SRC"/lib/datalake-*.ts ./lib/ 2>/dev/null || true
cp "$SRC"/lib/automation-*.ts ./lib/ 2>/dev/null || true
# functions
cp "$SRC"/functions/api/ai*.ts ./functions/api/ 2>/dev/null || true
cp "$SRC"/functions/api/datalake*.ts ./functions/api/ 2>/dev/null || true
cp "$SRC"/functions/api/automation*.ts ./functions/api/ 2>/dev/null || true
Step 4: パスをトップレベル化
旧 /ai-ops → 新 /
旧 /ai-ops/agents → 新 /agents
旧 /ai-ops/logs → 新 /logs
旧 /ai-ops/performance → 新 /performance
旧 /ai-ops/settings → 新 /settings
旧 /datalake → 新 /datalake (そのまま)
旧 /automation → 新 /automation (そのまま)
find ./app ./components ./lib -type f \( -name "*.tsx" -o -name "*.ts" \) -exec sed -i '' "s|'/ai-ops/|'/|g" {} \;
find ./app ./components ./lib -type f \( -name "*.tsx" -o -name "*.ts" \) -exec sed -i '' 's|"/ai-ops/|"/|g' {} \;
find ./app ./components ./lib -type f \( -name "*.tsx" -o -name "*.ts" \) -exec sed -i '' "s|'/ai-ops'|'/'|g" {} \;
find ./app ./components ./lib -type f \( -name "*.tsx" -o -name "*.ts" \) -exec sed -i '' 's|"/ai-ops"|"/"|g' {} \;
Step 5: ルートレイアウト
app/layout.tsx:
import './globals.css';
import { AuthProvider } from '@/lib/auth-context';
export const metadata = { title: 'SCALE AI Ops' };
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="ja">
<body className="bg-bg text-text">
<AuthProvider>
<header className="sticky top-0 z-30 bg-bg2 border-b border-border px-4 py-2 flex items-center justify-between">
<a href="https://scale-base.pages.dev/home/" className="text-xs text-text2 hover:text-text">← SCALE Base に戻る</a>
<span className="text-sm font-bold text-text">SCALE AI Ops</span>
</header>
<main className="p-4 md:p-6">{children}</main>
</AuthProvider>
</body>
</html>
);
}
Step 6: 認証ガード
'use client';
import { useEffect } from 'react';
import { useAuth } from '@/lib/auth-context';
export default function Page() {
const { user, isLoading } = useAuth();
useEffect(() => {
if (!isLoading && !user) window.location.href = 'https://scale-base.pages.dev/';
}, [user, isLoading]);
// ...
}
Step 7: ローカル確認 + deploy.sh
npm run dev
mkdir -p scripts
cat > scripts/deploy.sh <<'EOF'
#!/bin/bash
set -e
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
TS=$(date +%Y-%m-%d_%H%M%S)
mkdir -p "$ROOT/../scale-ai-ops-backups"
tar --exclude='node_modules' --exclude='.next' --exclude='out' --exclude='.wrangler' \
-czf "$ROOT/../scale-ai-ops-backups/scale-ai-ops_${TS}_pre-deploy.tar.gz" -C "$ROOT" .
rm -rf .next out
NODE_OPTIONS="--max-old-space-size=8192" npx next build
npx wrangler pages deploy out --project-name=scale-ai-ops --branch=main --commit-message="scale-ai-ops deploy"
tar --exclude='node_modules' --exclude='.next' --exclude='out' --exclude='.wrangler' \
-czf "$ROOT/../scale-ai-ops-backups/scale-ai-ops_${TS}_post-deploy.tar.gz" -C "$ROOT" .
echo "✓ Deploy complete → https://scale-ai-ops.pages.dev/"
EOF
chmod +x scripts/deploy.sh
Step 8: Cloudflare Pages 作成 + デプロイ
npx wrangler pages project create scale-ai-ops --production-branch=main
bash scripts/deploy.sh
Step 9: scale-base 側更新
scale-base/lib/systems.ts の ai-ops と datalake エントリ:
{
id: 'ai-ops',
name: 'AI Ops',
shortName: 'AI Ops',
icon: Bot,
color: '#8b5cf6',
bgColor: 'rgba(139,92,246,0.15)',
sections: [],
externalUrl: 'https://scale-ai-ops.pages.dev/',
},
{
id: 'datalake',
name: 'Data Lake',
shortName: 'Data',
icon: Database,
color: '#6395a3',
bgColor: 'rgba(99,149,163,0.15)',
sections: [],
externalUrl: 'https://scale-ai-ops.pages.dev/datalake',
},
SYSTEM_ABSORBED の automation: 'ai-ops' 行は削除(automation は scale-ai-ops 内に内包)。
旧コード退避:
cd ~/Library/CloudStorage/GoogleDrive-y-ogushi@scale-group.co.jp/マイドライブ/AI/scale-base
mkdir -p _archived_apps
mv "app/(dashboard)/ai-ops" "_archived_apps/ai-ops_$(date +%Y%m%d)"
mv "app/(dashboard)/datalake" "_archived_apps/datalake_$(date +%Y%m%d)"
mv "app/(dashboard)/automation" "_archived_apps/automation_$(date +%Y%m%d)" 2>/dev/null || true
mv "components/ai-ops" "_archived_apps/components_aiops_$(date +%Y%m%d)" 2>/dev/null || true
mv "components/datalake" "_archived_apps/components_datalake_$(date +%Y%m%d)" 2>/dev/null || true
mkdir -p _archived_apps/lib_aiops _archived_apps/functions_aiops
mv lib/ai-ops-*.ts lib/datalake-*.ts lib/automation-*.ts _archived_apps/lib_aiops/ 2>/dev/null || true
mv functions/api/ai*.ts functions/api/datalake*.ts functions/api/automation*.ts _archived_apps/functions_aiops/ 2>/dev/null || true
npx next build
bash scripts/deploy.sh
Step 10: 動作確認 + Slack 報告
#system_scalebase に:
:white_check_mark: scale-ai-ops 分離完了
URL: https://scale-ai-ops.pages.dev/
- AI Ops: /
- Data Lake: /datalake
- Automation: /automation
依頼者: 大串 / 最終更新: 2026-04-29