|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# / Context: https://ctx.ist |
| 4 | +# ,'`./ do you remember? |
| 5 | +# `.,'\ |
| 6 | +# \ Copyright 2026-present Context contributors. |
| 7 | +# SPDX-License-Identifier: Apache-2.0 |
| 8 | + |
| 9 | +# |
| 10 | +# Release script for Context CLI |
| 11 | +# |
| 12 | +# This script prepares and creates a new release. It: |
| 13 | +# 1. Builds binaries for all platforms |
| 14 | +# 2. Generates release notes |
| 15 | +# 3. Creates a signed git tag |
| 16 | +# |
| 17 | +# Usage: ./hack/release.sh |
| 18 | +# |
| 19 | +# ============================================================================= |
| 20 | +# RELEASE CHECKLIST - Update these for each release: |
| 21 | +# ============================================================================= |
| 22 | +# |
| 23 | +# Before running this script: |
| 24 | +# |
| 25 | +# 1. UPDATE THE VERSION below (currently hardcoded as v0.1.0) |
| 26 | +# |
| 27 | +# 2. UPDATE DOCUMENTATION with new version: |
| 28 | +# - docs/index.md: Change download URLs from "latest" to "v0.1.0" |
| 29 | +# (lines with: releases/latest/download/ -> releases/download/v0.1.0/) |
| 30 | +# |
| 31 | +# 3. ENSURE all tests pass: |
| 32 | +# make test |
| 33 | +# make smoke |
| 34 | +# |
| 35 | +# 4. ENSURE working tree is clean: |
| 36 | +# git status (should show "nothing to commit") |
| 37 | +# |
| 38 | +# 5. COMMIT any version-related changes before running this script |
| 39 | +# |
| 40 | +# After running this script: |
| 41 | +# |
| 42 | +# 1. PUSH the tag: |
| 43 | +# git push origin v0.1.0 |
| 44 | +# |
| 45 | +# 2. CREATE GitHub release: |
| 46 | +# - Go to https://github.com/ActiveMemory/ctx/releases/new |
| 47 | +# - Select the tag v0.1.0 |
| 48 | +# - Copy release notes from dist/RELEASE_NOTES.md |
| 49 | +# - Upload all binaries from dist/ |
| 50 | +# - Upload dist/checksums.txt |
| 51 | +# |
| 52 | +# 3. UPDATE the "latest" tag (optional, for docs compatibility): |
| 53 | +# git tag -d latest 2>/dev/null || true |
| 54 | +# git push origin :refs/tags/latest 2>/dev/null || true |
| 55 | +# git tag latest v0.1.0 |
| 56 | +# git push origin latest |
| 57 | +# |
| 58 | +# ============================================================================= |
| 59 | + |
| 60 | +set -e |
| 61 | + |
| 62 | +# ----------------------------------------------------------------------------- |
| 63 | +# CONFIGURATION - Update this for each release |
| 64 | +# ----------------------------------------------------------------------------- |
| 65 | +VERSION="v0.1.0" |
| 66 | +# ----------------------------------------------------------------------------- |
| 67 | + |
| 68 | +# Derived values |
| 69 | +TAG_NAME="${VERSION}" |
| 70 | +RELEASE_NOTES="dist/RELEASE_NOTES.md" |
| 71 | + |
| 72 | +echo "==============================================" |
| 73 | +echo " Context CLI Release: ${VERSION}" |
| 74 | +echo "==============================================" |
| 75 | +echo "" |
| 76 | + |
| 77 | +# Check for clean working tree |
| 78 | +if [ -n "$(git status --porcelain)" ]; then |
| 79 | + echo "ERROR: Working tree is not clean." |
| 80 | + echo "Please commit or stash your changes before releasing." |
| 81 | + echo "" |
| 82 | + git status --short |
| 83 | + exit 1 |
| 84 | +fi |
| 85 | + |
| 86 | +# Check if tag already exists |
| 87 | +if git rev-parse "${TAG_NAME}" >/dev/null 2>&1; then |
| 88 | + echo "ERROR: Tag ${TAG_NAME} already exists." |
| 89 | + echo "If you need to recreate it, delete it first:" |
| 90 | + echo " git tag -d ${TAG_NAME}" |
| 91 | + echo " git push origin :refs/tags/${TAG_NAME}" |
| 92 | + exit 1 |
| 93 | +fi |
| 94 | + |
| 95 | +# Run tests |
| 96 | +echo "Running tests..." |
| 97 | +make test |
| 98 | +echo "" |
| 99 | + |
| 100 | +# Run smoke tests |
| 101 | +echo "Running smoke tests..." |
| 102 | +make smoke |
| 103 | +echo "" |
| 104 | + |
| 105 | +# Build binaries |
| 106 | +echo "Building binaries for all platforms..." |
| 107 | +./hack/build-all.sh "${VERSION#v}" # Remove 'v' prefix for build script |
| 108 | +echo "" |
| 109 | + |
| 110 | +# Generate release notes |
| 111 | +echo "Generating release notes..." |
| 112 | +cat > "${RELEASE_NOTES}" << 'NOTES_HEADER' |
| 113 | +# Context CLI v0.1.0 |
| 114 | +
|
| 115 | +Initial release of the Context CLI (`ctx`) - a tool for persistent AI context management. |
| 116 | +
|
| 117 | +## What's New |
| 118 | +
|
| 119 | +This is the first stable release of `ctx`, providing: |
| 120 | +
|
| 121 | +- **Context Management**: Create and maintain `.context/` directories with structured markdown files |
| 122 | +- **AI Integration**: Built-in support for Claude Code with hooks and slash commands |
| 123 | +- **Session Persistence**: Automatic session saving and transcript management |
| 124 | +- **Drift Detection**: Track staleness of context files |
| 125 | +- **Multi-tool Support**: Integration guides for Claude Code, Cursor, Aider, Copilot, and Windsurf |
| 126 | +
|
| 127 | +## Installation |
| 128 | +
|
| 129 | +### Linux (x86_64) |
| 130 | +```bash |
| 131 | +curl -LO https://github.com/ActiveMemory/ctx/releases/download/v0.1.0/ctx-linux-amd64 |
| 132 | +chmod +x ctx-linux-amd64 |
| 133 | +sudo mv ctx-linux-amd64 /usr/local/bin/ctx |
| 134 | +``` |
| 135 | +
|
| 136 | +### Linux (ARM64) |
| 137 | +```bash |
| 138 | +curl -LO https://github.com/ActiveMemory/ctx/releases/download/v0.1.0/ctx-linux-arm64 |
| 139 | +chmod +x ctx-linux-arm64 |
| 140 | +sudo mv ctx-linux-arm64 /usr/local/bin/ctx |
| 141 | +``` |
| 142 | +
|
| 143 | +### macOS (Apple Silicon) |
| 144 | +```bash |
| 145 | +curl -LO https://github.com/ActiveMemory/ctx/releases/download/v0.1.0/ctx-darwin-arm64 |
| 146 | +chmod +x ctx-darwin-arm64 |
| 147 | +sudo mv ctx-darwin-arm64 /usr/local/bin/ctx |
| 148 | +``` |
| 149 | +
|
| 150 | +### macOS (Intel) |
| 151 | +```bash |
| 152 | +curl -LO https://github.com/ActiveMemory/ctx/releases/download/v0.1.0/ctx-darwin-amd64 |
| 153 | +chmod +x ctx-darwin-amd64 |
| 154 | +sudo mv ctx-darwin-amd64 /usr/local/bin/ctx |
| 155 | +``` |
| 156 | +
|
| 157 | +### Windows |
| 158 | +Download `ctx-windows-amd64.exe` or `ctx-windows-arm64.exe` and add to your PATH. |
| 159 | +
|
| 160 | +## Quick Start |
| 161 | +
|
| 162 | +```bash |
| 163 | +# Initialize context in your project |
| 164 | +ctx init |
| 165 | +
|
| 166 | +# Check context status |
| 167 | +ctx status |
| 168 | +
|
| 169 | +# Get AI-ready context packet |
| 170 | +ctx agent --budget 4000 |
| 171 | +``` |
| 172 | +
|
| 173 | +## Documentation |
| 174 | +
|
| 175 | +Full documentation available at [ctx.ist](https://ctx.ist) |
| 176 | +
|
| 177 | +## Checksums |
| 178 | +
|
| 179 | +See `checksums.txt` for SHA256 checksums of all binaries. |
| 180 | +NOTES_HEADER |
| 181 | + |
| 182 | +echo "Release notes written to ${RELEASE_NOTES}" |
| 183 | +echo "" |
| 184 | + |
| 185 | +# Create signed tag |
| 186 | +echo "Creating signed tag ${TAG_NAME}..." |
| 187 | +git tag -s "${TAG_NAME}" -m "Release ${VERSION} |
| 188 | +
|
| 189 | +Context CLI ${VERSION} - Initial release |
| 190 | +
|
| 191 | +See RELEASE_NOTES.md for details." |
| 192 | + |
| 193 | +echo "" |
| 194 | +echo "==============================================" |
| 195 | +echo " Release preparation complete!" |
| 196 | +echo "==============================================" |
| 197 | +echo "" |
| 198 | +echo "Created:" |
| 199 | +echo " - Binaries in dist/" |
| 200 | +echo " - Checksums in dist/checksums.txt" |
| 201 | +echo " - Release notes in dist/RELEASE_NOTES.md" |
| 202 | +echo " - Signed tag: ${TAG_NAME}" |
| 203 | +echo "" |
| 204 | +echo "Next steps:" |
| 205 | +echo "" |
| 206 | +echo " 1. Verify the tag:" |
| 207 | +echo " git show ${TAG_NAME}" |
| 208 | +echo "" |
| 209 | +echo " 2. Push the tag:" |
| 210 | +echo " git push origin ${TAG_NAME}" |
| 211 | +echo "" |
| 212 | +echo " 3. Create GitHub release at:" |
| 213 | +echo " https://github.com/ActiveMemory/ctx/releases/new" |
| 214 | +echo "" |
| 215 | +echo " 4. Upload these files to the release:" |
| 216 | +ls -1 dist/ctx-* dist/checksums.txt 2>/dev/null | sed 's/^/ /' |
| 217 | +echo "" |
| 218 | +echo " 5. (Optional) Update 'latest' tag:" |
| 219 | +echo " git tag -d latest 2>/dev/null || true" |
| 220 | +echo " git push origin :refs/tags/latest 2>/dev/null || true" |
| 221 | +echo " git tag latest ${TAG_NAME}" |
| 222 | +echo " git push origin latest" |
| 223 | +echo "" |
0 commit comments