|
| 1 | +#!/bin/bash |
| 2 | +# ═══════════════════════════════════════════════════════ |
| 3 | +# CORTEX LAUNCH SCRIPT |
| 4 | +# Run this once to publish everything and go live. |
| 5 | +# ═══════════════════════════════════════════════════════ |
| 6 | + |
| 7 | +set -e |
| 8 | + |
| 9 | +GREEN='\033[0;32m' |
| 10 | +RED='\033[0;31m' |
| 11 | +YELLOW='\033[0;33m' |
| 12 | +DIM='\033[0;90m' |
| 13 | +NC='\033[0m' |
| 14 | + |
| 15 | +pass() { echo -e "${GREEN}✓${NC} $1"; } |
| 16 | +fail() { echo -e "${RED}✗${NC} $1"; exit 1; } |
| 17 | +info() { echo -e "${DIM}·${NC} $1"; } |
| 18 | +warn() { echo -e "${YELLOW}⚡${NC} $1"; } |
| 19 | +header() { echo -e "\n${YELLOW}═══ $1 ═══${NC}\n"; } |
| 20 | + |
| 21 | +REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" |
| 22 | +cd "$REPO_ROOT" |
| 23 | + |
| 24 | +echo "" |
| 25 | +echo " ╔═══════════════════════════════════════╗" |
| 26 | +echo " ║ CORTEX v1.0.0 — LAUNCH SCRIPT ║" |
| 27 | +echo " ╚═══════════════════════════════════════╝" |
| 28 | +echo "" |
| 29 | + |
| 30 | +# ── Pre-flight checks ── |
| 31 | +header "PRE-FLIGHT CHECKS" |
| 32 | + |
| 33 | +# Check npm login |
| 34 | +if npm whoami 2>/dev/null; then |
| 35 | + pass "npm: logged in as $(npm whoami)" |
| 36 | +else |
| 37 | + warn "npm: not logged in" |
| 38 | + echo " Run: npm login" |
| 39 | + echo " Then re-run this script." |
| 40 | + exit 1 |
| 41 | +fi |
| 42 | + |
| 43 | +# Check gh CLI |
| 44 | +if gh auth status 2>/dev/null | grep -q "Logged in"; then |
| 45 | + pass "GitHub CLI: authenticated" |
| 46 | +else |
| 47 | + warn "GitHub CLI: not authenticated" |
| 48 | + echo " Run: gh auth login" |
| 49 | + exit 1 |
| 50 | +fi |
| 51 | + |
| 52 | +# Check build |
| 53 | +header "BUILD" |
| 54 | +info "Building all packages..." |
| 55 | +pnpm install --no-frozen-lockfile 2>&1 | tail -1 |
| 56 | +pnpm --filter @cortex/shared build 2>&1 | tail -1 |
| 57 | +pnpm --filter @cortex/server build 2>&1 | tail -1 |
| 58 | +pnpm --filter @cortex/cli build 2>&1 | tail -1 |
| 59 | +pass "All packages built" |
| 60 | + |
| 61 | +# ── Step 1: Publish to npm ── |
| 62 | +header "STEP 1: NPM PUBLISH" |
| 63 | + |
| 64 | +info "Publishing @cortex-memory/shared..." |
| 65 | +cd packages/shared |
| 66 | +npm publish --access public 2>&1 | tail -3 |
| 67 | +pass "@cortex-memory/shared published" |
| 68 | +cd "$REPO_ROOT" |
| 69 | + |
| 70 | +info "Publishing @cortex-memory/server..." |
| 71 | +cd packages/server |
| 72 | +npm publish --access public 2>&1 | tail -3 |
| 73 | +pass "@cortex-memory/server published" |
| 74 | +cd "$REPO_ROOT" |
| 75 | + |
| 76 | +info "Publishing @cortex-memory/cli..." |
| 77 | +cd packages/cli |
| 78 | +npm publish --access public 2>&1 | tail -3 |
| 79 | +pass "@cortex-memory/cli published" |
| 80 | +cd "$REPO_ROOT" |
| 81 | + |
| 82 | +# ── Step 2: Verify npm install works ── |
| 83 | +header "STEP 2: VERIFY NPM INSTALL" |
| 84 | +info "Testing: npx @cortex-memory/cli --version" |
| 85 | +NPM_VERSION=$(npx --yes @cortex-memory/cli --version 2>/dev/null || echo "FAILED") |
| 86 | +if [ "$NPM_VERSION" = "FAILED" ]; then |
| 87 | + fail "npx install failed — check npm publish output above" |
| 88 | +else |
| 89 | + pass "npx works: v${NPM_VERSION}" |
| 90 | +fi |
| 91 | + |
| 92 | +# ── Step 3: Compute Homebrew SHA ── |
| 93 | +header "STEP 3: HOMEBREW SHA" |
| 94 | +info "Downloading tarball from npm..." |
| 95 | +TARBALL_URL=$(npm view @cortex-memory/cli dist.tarball 2>/dev/null) |
| 96 | +if [ -n "$TARBALL_URL" ]; then |
| 97 | + curl -sO "$TARBALL_URL" |
| 98 | + TARBALL_FILE=$(basename "$TARBALL_URL") |
| 99 | + SHA=$(shasum -a 256 "$TARBALL_FILE" | cut -d' ' -f1) |
| 100 | + rm -f "$TARBALL_FILE" |
| 101 | + pass "SHA256: $SHA" |
| 102 | + |
| 103 | + # Update formula |
| 104 | + sed -i '' "s/PLACEHOLDER_SHA256_COMPUTE_AFTER_NPM_PUBLISH/$SHA/" packages/installer/homebrew/cortex.rb |
| 105 | + pass "Homebrew formula updated with SHA256" |
| 106 | +else |
| 107 | + warn "Could not get tarball URL — update SHA manually later" |
| 108 | +fi |
| 109 | + |
| 110 | +# ── Step 4: Create GitHub Release ── |
| 111 | +header "STEP 4: GITHUB RELEASE" |
| 112 | +info "Creating v1.0.0 release..." |
| 113 | +gh release create v1.0.0 \ |
| 114 | + --repo ProductionLineHQ/cortex \ |
| 115 | + --title "Cortex v1.0.0 — Persistent Memory for Claude Code" \ |
| 116 | + --notes "$(cat <<'NOTES' |
| 117 | +## 🧠 Cortex v1.0.0 |
| 118 | +
|
| 119 | +The first release of Cortex — persistent memory for Claude Code. |
| 120 | +
|
| 121 | +### Install |
| 122 | +
|
| 123 | +```bash |
| 124 | +npx @cortex-memory/cli init |
| 125 | +``` |
| 126 | +
|
| 127 | +### What's included |
| 128 | +
|
| 129 | +- **MCP Server** — 7 tools for Claude Code integration |
| 130 | +- **CLI** — 30+ commands for memory management |
| 131 | +- **Dashboard** — Next.js web UI at localhost:7434 |
| 132 | +- **VS Code Extension** — Save memories from your editor |
| 133 | +- **Native Mac App** — SwiftUI desktop application |
| 134 | +- **Electron App** — Cross-platform desktop wrapper |
| 135 | +- **Multi-machine Sync** — Turso-powered, you own the database |
| 136 | +- **Quality Gate** — 6-rule engine for memory quality |
| 137 | +- **Session Summarizer** — AI reviews what you missed |
| 138 | +- **85+ tests** across 15 test files |
| 139 | +
|
| 140 | +### Security |
| 141 | +
|
| 142 | +- AES-256-GCM encrypted credentials |
| 143 | +- Zod validation on all API inputs |
| 144 | +- Rate limiting (100/min global) |
| 145 | +- SQL injection protection |
| 146 | +- Localhost-only binding |
| 147 | +
|
| 148 | +### Docs |
| 149 | +
|
| 150 | +- [Architecture](docs/ARCHITECTURE.md) |
| 151 | +- [CLI Reference](docs/CLI.md) |
| 152 | +- [API Reference](docs/API.md) |
| 153 | +- [Sync Guide](docs/SYNC.md) |
| 154 | +- [Security Model](docs/SECURITY-MODEL.md) |
| 155 | +- [FAQ](docs/FAQ.md) |
| 156 | +
|
| 157 | +MIT Licensed — The Production Line |
| 158 | +NOTES |
| 159 | +)" 2>&1 |
| 160 | +pass "GitHub release v1.0.0 created" |
| 161 | + |
| 162 | +# ── Step 5: Commit SHA update ── |
| 163 | +header "STEP 5: COMMIT & PUSH" |
| 164 | +if git diff --quiet packages/installer/homebrew/cortex.rb 2>/dev/null; then |
| 165 | + info "No SHA changes to commit" |
| 166 | +else |
| 167 | + git add packages/installer/homebrew/cortex.rb |
| 168 | + git commit -m "Update Homebrew SHA256 after npm publish" 2>&1 | tail -1 |
| 169 | + git push origin main 2>&1 | tail -1 |
| 170 | + pass "SHA256 committed and pushed" |
| 171 | +fi |
| 172 | + |
| 173 | +# ── Step 6: Set GitHub repo topics ── |
| 174 | +header "STEP 6: REPO OPTIMIZATION" |
| 175 | +gh repo edit ProductionLineHQ/cortex \ |
| 176 | + --add-topic claude --add-topic claude-code --add-topic mcp \ |
| 177 | + --add-topic persistent-memory --add-topic ai-memory \ |
| 178 | + --add-topic developer-tools --add-topic typescript \ |
| 179 | + --add-topic sqlite --add-topic open-source 2>/dev/null |
| 180 | +pass "GitHub topics set" |
| 181 | + |
| 182 | +# ── Done ── |
| 183 | +header "LAUNCH COMPLETE" |
| 184 | +echo "" |
| 185 | +echo " ╔═══════════════════════════════════════════════════╗" |
| 186 | +echo " ║ ║" |
| 187 | +echo " ║ Cortex v1.0.0 is LIVE ║" |
| 188 | +echo " ║ ║" |
| 189 | +echo " ║ npm: @cortex-memory/cli ║" |
| 190 | +echo " ║ repo: github.com/ProductionLineHQ/cortex ║" |
| 191 | +echo " ║ install: npx @cortex-memory/cli init ║" |
| 192 | +echo " ║ ║" |
| 193 | +echo " ╚═══════════════════════════════════════════════════╝" |
| 194 | +echo "" |
| 195 | +echo " Next steps:" |
| 196 | +echo " 1. Deploy cortex.sh (Vercel: cd packages/web && vercel)" |
| 197 | +echo " 2. Publish VS Code extension (cd packages/vscode && vsce publish)" |
| 198 | +echo " 3. Send Newsletter Issue #3 (see NEWSLETTER_ISSUE_3.md)" |
| 199 | +echo " 4. Post to HN, Reddit, X (see LAUNCH.md)" |
| 200 | +echo "" |
0 commit comments