diff --git a/README.md b/README.md index 221468b..db3b8df 100644 --- a/README.md +++ b/README.md @@ -49,10 +49,7 @@ Pick **one** install method — mixing channels can leave stale binaries on your | **Pre-built binaries** | Manual download from [Releases](https://github.com/codecoradev/cora-code/releases) | ```bash -# Recommended: Cora only (standalone) -curl -fsSL https://raw.githubusercontent.com/codecoradev/cora-code/main/install.sh | sh - -# Or install both Cora + Uteke (code review with memory) +# Install with the quick installer curl -fsSL https://raw.githubusercontent.com/codecoradev/cora-code/main/install-bundle.sh | sh # Or build from source with cargo @@ -211,30 +208,6 @@ Works on **all CI platforms** — [Gitea, GitLab, Bitbucket →](https://codecor See **[CLI Reference →](https://codecora.dev/cli-reference.html)** for all flags and examples. -## Uteke Memory Integration - -Cora works 100% standalone. Install [Uteke](https://github.com/codecoradev/uteke) to unlock **memory-powered reviews** that learn from your codebase history. - -| Mode | Command | What it does | -|------|---------|-------------| -| Standalone (default) | `cora review` | AI review, zero deps | -| Memory recall | `cora review --memory` | Recall project patterns before review | -| Learning | `cora review --memory --learn` | Recall + save findings after review | - -```bash -# Install Uteke separately -curl -fsSL https://raw.githubusercontent.com/codecoradev/uteke/main/install.sh | sh - -# Or install both at once -curl -fsSL https://raw.githubusercontent.com/codecoradev/cora-code/main/install-bundle.sh | sh - -# Enable memory -export PATH="$HOME/.local/bin:$PATH" -cora review --staged --memory --learn -``` - -Your code review gets smarter every sprint. - ## Environment Variables | Variable | Description | diff --git a/docs/cli-reference.md b/docs/cli-reference.md index 13cfef8..0f4fe16 100644 --- a/docs/cli-reference.md +++ b/docs/cli-reference.md @@ -31,8 +31,6 @@ Complete command reference for the cora CLI. | `cora commit --edit` | Always open `$EDITOR` to edit message | | `cora review` | Review code changes (default: staged files) | | `cora review --staged` | Review staged git changes explicitly | -| `cora review --memory` | Recall project patterns from Uteke before review | -| `cora review --learn` | Recall + save findings to Uteke (implies --memory) | | `cora review --unstaged` | Review unstaged working changes | | `cora review --unpushed` | Review unpushed commits | | `cora review --base` `` | Compare current branch against target | @@ -101,14 +99,6 @@ $ cora commit $ cora commit --yolo ``` -```bash -# Install both Cora + Uteke (code review with memory) -$ curl -fsSL https://raw.githubusercontent.com/codecoradev/cora-code/main/install-bundle.sh | sh - -# Then review with memory: -$ cora review --staged --memory --learn -``` - ```bash # Index your project and search with Brain Mode $ cora index diff --git a/docs/configuration.md b/docs/configuration.md index a23337f..234ad2c 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -407,30 +407,6 @@ cora debt --branch develop # Filter by branch Snapshots are auto-saved after every review (best-effort, never fails the review). -## Uteke Memory Integration - -cora can optionally integrate with [Uteke](https://github.com/codecoradev/uteke) — a local-first memory engine for AI agents. - -### Prerequisites - -Install Uteke: `curl -fsSL https://raw.githubusercontent.com/codecoradev/uteke/main/install.sh | sh` - -### Usage - -```bash -cora review # Standalone review (default, no memory) -cora review --memory # Recall project patterns before review -cora review --memory --learn # Recall + save findings after review -``` - -### How It Works - -1. **`--memory`**: Cora calls `uteke recall` to fetch project-specific patterns from previous reviews, enriching the LLM prompt with historical context. - -2. **`--learn`**: After review, Cora calls `uteke remember` to save findings, patterns, and stats for future recall. - -3. **Graceful degradation**: If Uteke is not installed, Cora warns and continues without memory. Reviews never fail due to memory issues. - ## MCP Server cora includes a built-in MCP (Model Context Protocol) server that exposes rules and config to AI coding agents like Claude Code, Cursor, Copilot, and Windsurf. diff --git a/docs/getting-started.md b/docs/getting-started.md index 55c454b..74799c8 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -150,28 +150,6 @@ Or skip the prompt in CI/trusted workflows: cora commit --yolo # auto-commit, no prompts ``` -### Memory-Powered Reviews (Optional) - -Install [Uteke](https://github.com/codecoradev/uteke) to give Cora a memory: - -```bash -# Install both tools -curl -fsSL https://raw.githubusercontent.com/codecoradev/cora-code/main/install-bundle.sh | sh -``` - -Then enable memory in reviews: - -```bash -cora review --staged --memory # recall project patterns -cora review --staged --memory --learn # recall + save findings -``` - -- `--memory` — Cora recalls past review findings and code patterns from Uteke before reviewing -- `--learn` — After review, Cora saves findings to Uteke for future recall -- Works with any review mode (staged, unpushed, branch) - -Your code review gets smarter every sprint. - ## AI Agent Integration cora includes a built-in MCP server for AI coding agents. After installation: diff --git a/docs/usage.md b/docs/usage.md index 8ab9e4c..f51e297 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -175,47 +175,6 @@ $ cora review --staged --exclude "**/*.test.ts" --exclude "**/generated/**" Alternatively, set include/exclude patterns in `.cora.yaml` for persistent configuration. -## Uteke Memory Integration - -Cora works standalone. Install [Uteke](https://github.com/codecoradev/uteke) to unlock reviews that learn from your codebase history. - -### Three Levels - -| Level | Command | Uteke Required | What It Does | -|-------|---------|:---:|-------------| -| **Standalone** | `cora review` | No | AI review, zero deps | -| **Recall** | `cora review --memory` | Yes | Recall project patterns before review | -| **Learning** | `cora review --memory --learn` | Yes | Recall + save findings after review | - -### Install Both - -```bash -curl -fsSL https://raw.githubusercontent.com/codecoradev/cora-code/main/install-bundle.sh | sh -``` - -### Usage - -```bash -# Review with memory recall -cora review --staged --memory - -# Review + save to memory (reviews improve over time) -cora review --staged --memory --learn - -# Works with all review modes -cora review --base main --memory --learn -cora commit --memory # Note: --memory only on review, not commit -``` - -### How It Works - -1. Before review, Cora calls `uteke recall` to find relevant memories (past findings, code patterns) -2. These memories are injected into the LLM prompt as context -3. After review (with `--learn`), findings are saved to Uteke via `uteke remember` -4. Next review benefits from accumulated knowledge - -Cora auto-detects Uteke on PATH. If not installed, memory features are silently disabled. - ## Exit Codes cora uses standard exit codes for scripting and CI integration: diff --git a/install-bundle.sh b/install-bundle.sh index b7889a8..5d9ee4a 100755 --- a/install-bundle.sh +++ b/install-bundle.sh @@ -1,146 +1,115 @@ #!/usr/bin/env sh # -# cora + uteke bundle installer -# Installs both Cora (AI code review) and Uteke (AI memory) in one command. +# cora code review — standalone installer +# Installs Cora (AI code review) in one command. # # Usage: # curl -fsSL https://raw.githubusercontent.com/codecoradev/cora-code/main/install-bundle.sh | sh # -# With version pinning: -# CORA_VERSION=v0.5.1 UTEKE_VERSION=v0.1.0 curl -fsSL ... | sh - -set -e - -# Colors -if [ -t 1 ]; then - RED='\033[0;31m' - GREEN='\033[0;32m' - YELLOW='\033[0;33m' - CYAN='\033[0;36m' - BOLD='\033[1m' - DIM='\033[2m' - NC='\033[0m' -else - RED='' GREEN='' YELLOW='' CYAN='' BOLD='' DIM='' NC='' -fi - -info() { printf "${CYAN}[INFO]${NC} %s\n" "$1"; } -ok() { printf "${GREEN}[OK]${NC} %s\n" "$1"; } -warn() { printf "${YELLOW}[WARN]${NC} %s\n" "$1"; } -error() { printf "${RED}[ERROR]${NC} %s\n" "$1"; exit 1; } - -BINARY_DIR="${HOME}/.local/bin" - -# Ensure binary dir exists -mkdir -p "$BINARY_DIR" - -# ─── Install Cora ─── -install_cora() { - info "Installing Cora — AI code review CLI..." - - if command -v cora >/dev/null 2>&1; then - EXISTING=$(cora --version 2>/dev/null | head -1 || echo "unknown") - info "Cora already installed: $EXISTING" - if [ -z "${CORA_FORCE:-}" ]; then - info "Skipping (set CORA_FORCE=1 to reinstall)" - return 0 - fi - fi +set -eu + +# ── Config ────────────────────────────────────────────────────────── +REPO_OWNER="codecoradev" +REPO_NAME="cora-code" +BINARY_NAME="cora" +INSTALL_DIR="$HOME/.local/bin" + +# Detect platform +detect_platform() { + OS="$(uname -s)" + ARCH="$(uname -m)" + + case "$OS" in + Linux*) OS="linux" ;; + Darwin*) OS="macos" ;; + *) echo "Unsupported OS: $OS"; exit 1 ;; + esac - curl -fsSL "https://raw.githubusercontent.com/codecoradev/cora-code/main/install.sh" | sh - ok "Cora installed: $(cora --version 2>/dev/null | head -1)" -} + case "$ARCH" in + x86_64|amd64) ARCH="x86_64" ;; + aarch64|arm64) ARCH="aarch64" ;; + *) echo "Unsupported architecture: $ARCH"; exit 1 ;; + esac -# ─── Install Uteke ─── -install_uteke() { - info "Installing Uteke — AI memory engine..." + PLATFORM="${OS}-${ARCH}" +} - if command -v uteke >/dev/null 2>&1; then - EXISTING=$(uteke --version 2>/dev/null | head -1 || echo "unknown") - info "Uteke already installed: $EXISTING" - if [ -z "${UTEKE_FORCE:-}" ]; then - info "Skipping (set UTEKE_FORCE=1 to reinstall)" - return 0 +# Get latest release tag from GitHub +get_latest_version() { + VERSION="$(curl -fsSL "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/releases/latest" \ + | grep '"tag_name"' \ + | head -1 \ + | sed -E 's/.*"([^"]+)".*/\1/')" + + if [ -z "$VERSION" ]; then + # Fallback: try CORA_VERSION env var + VERSION="${CORA_VERSION:-}" + if [ -z "$VERSION" ]; then + echo "Error: Could not determine latest version." + echo "Set CORA_VERSION env var to install a specific version:" + echo " CORA_VERSION=v0.6.1 $0" + exit 1 fi fi - - curl -fsSL "https://raw.githubusercontent.com/codecoradev/uteke/main/install.sh" | sh - ok "Uteke installed: $(uteke --version 2>/dev/null | head -1)" + echo "$VERSION" } -# ─── Verify ─── -verify() { - info "Verifying installation..." +# Download and install +install_binary() { + VERSION="$1" - CORA_OK="no" - UTEKE_OK="no" + echo "cora installer" + echo " Version: ${VERSION}" + echo " Platform: ${PLATFORM}" + echo " Install to: ${INSTALL_DIR}/${BINARY_NAME}" + echo "" - if command -v cora >/dev/null 2>&1; then - CORA_VER=$(cora --version 2>/dev/null | head -1) - CORA_OK="yes" - ok "Cora: $CORA_VER" - else - warn "Cora not found in PATH" - fi + # Create install directory + mkdir -p "$INSTALL_DIR" - if command -v uteke >/dev/null 2>&1; then - UTEKE_VER=$(uteke --version 2>/dev/null | head -1) - UTEKE_OK="yes" - ok "Uteke: $UTEKE_VER" - else - warn "Uteke not found in PATH" + # Download URL + URL="https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/download/${VERSION}/${BINARY_NAME}-${PLATFORM}" + + echo "Downloading ${BINARY_NAME} ${VERSION}..." + curl -fsSL "$URL" -o "${INSTALL_DIR}/${BINARY_NAME}" + + # Make executable + chmod +x "${INSTALL_DIR}/${BINARY_NAME}" + + # Strip quarantine attributes on macOS + if [ "$(uname -s)" = "Darwin" ]; then + xattr -dr com.apple.quarantine "${INSTALL_DIR}/${BINARY_NAME}" 2>/dev/null || true + xattr -dr com.apple.provenance "${INSTALL_DIR}/${BINARY_NAME}" 2>/dev/null || true fi echo "" - printf "${BOLD}━━━ Setup Complete ━━━${NC}\n" + echo "✅ ${BINARY_NAME} ${VERSION} installed to ${INSTALL_DIR}/${BINARY_NAME}" echo "" + echo "Verify:" + echo " ${INSTALL_DIR}/${BINARY_NAME} --version" + echo "" +} - if [ "$CORA_OK" = "yes" ] && [ "$UTEKE_OK" = "yes" ]; then - printf "${GREEN}Both tools installed!${NC} You now have AI code review with memory.\n\n" - echo " ${BOLD}Quick start:${NC}" - echo " cora auth login # Set your API key" - echo " cora review --staged # Review staged changes" - echo " cora review --memory # Review with project memory" - echo " cora commit # Review + auto commit message" +# Verify installation +verify_install() { + if ! command -v "$BINARY_NAME" >/dev/null 2>&1; then + echo "⚠️ ${BINARY_NAME} installed but not on PATH." + echo " Add this to your shell profile:" echo "" - echo " ${BOLD}Memory workflow:${NC}" - echo " cora review --memory --learn # Review + save to memory" - echo " uteke stats # Check memory stats" + echo " export PATH=\"${INSTALL_DIR}:\$PATH\"" echo "" - printf " ${DIM}Your code review gets smarter every sprint.${NC}\n" - elif [ "$CORA_OK" = "yes" ]; then - printf "${YELLOW}Cora installed.${NC} Install Uteke separately for memory features:\n" - echo " curl -fsSL https://raw.githubusercontent.com/codecoradev/uteke/main/install.sh | sh" - elif [ "$UTEKE_OK" = "yes" ]; then - printf "${YELLOW}Uteke installed.${NC} Install Cora separately for code review:\n" - echo " curl -fsSL https://raw.githubusercontent.com/codecoradev/cora-code/main/install.sh | sh" else - error "Neither tool was installed successfully." + VERSION="$("${BINARY_NAME}" --version 2>/dev/null || echo "unknown")" + echo "✅ $(which "$BINARY_NAME") — ${VERSION}" fi +} - # PATH check - case ":$PATH:" in - *":$BINARY_DIR:"*) ;; - *) - echo "" - warn "Add $BINARY_DIR to your PATH:" - echo " echo 'export PATH=\"$BINARY_DIR:\$PATH\"' >> ~/.bashrc" - echo " source ~/.bashrc" - ;; - esac +# ── Main ─────────────────────────────────────────────────────────── +main() { + detect_platform + VERSION="$(get_latest_version)" + install_binary "$VERSION" + verify_install } -# ─── Main ─── -echo "" -printf "${BOLD}${CYAN}╔══════════════════════════════════════════════╗${NC}\n" -printf "${BOLD}${CYAN}║ CodeCoraDev Bundle — Cora + Uteke ║${NC}\n" -printf "${BOLD}${CYAN}║ AI code review that remembers and learns ║${NC}\n" -printf "${BOLD}${CYAN}╚══════════════════════════════════════════════╝${NC}\n" -echo "" - -install_cora -echo "" -install_uteke -echo "" -verify -echo "" +main "$@"