Merge branch 'main' into sentry

This commit is contained in:
Tomasz Stefaniak 2025-08-05 22:55:33 -07:00
commit f55cba4e43
6 changed files with 244 additions and 24 deletions

87
.github/workflows/beta-release.yml vendored Normal file
View file

@ -0,0 +1,87 @@
name: Beta Release
on:
schedule:
# Run every day at 9am UTC
- cron: "0 9 * * *"
workflow_dispatch:
# Allow manual triggering
permissions:
contents: write
issues: write
pull-requests: write
jobs:
beta-release:
name: Beta Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
always-auth: true
- name: Install dependencies
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Get current version
id: get_version
run: |
# Get the latest version from package.json or npm registry
CURRENT_VERSION=$(node -p "require('./package.json').version")
if [[ "$CURRENT_VERSION" == "0.0.0-dev" ]]; then
# If it's dev version, get latest from npm registry
LATEST_VERSION=$(npm view @continuedev/cli version --silent 2>/dev/null || echo "0.0.0")
echo "Using latest npm version: $LATEST_VERSION"
CURRENT_VERSION=$LATEST_VERSION
fi
# Create beta version with current date
DATE_SUFFIX=$(date -u +%Y%m%d)
BETA_VERSION="${CURRENT_VERSION}-beta.${DATE_SUFFIX}"
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "beta_version=$BETA_VERSION" >> $GITHUB_OUTPUT
echo "date_suffix=$DATE_SUFFIX" >> $GITHUB_OUTPUT
- name: Update package.json for beta
run: |
# Update version in package.json
npm version ${{ steps.get_version.outputs.beta_version }} --no-git-tag-version
- name: Build
run: npm run build
- name: Publish beta to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm publish --tag beta
echo "Published beta version: ${{ steps.get_version.outputs.beta_version }}"
- name: Create beta release on GitHub
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
run: |
# Create a git tag for the beta
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git tag "v${{ steps.get_version.outputs.beta_version }}"
git push origin "v${{ steps.get_version.outputs.beta_version }}"
# Create GitHub release
gh release create "v${{ steps.get_version.outputs.beta_version }}" \
--title "Beta Release v${{ steps.get_version.outputs.beta_version }}" \
--notes "Daily beta release for testing. This version will be promoted to stable after 7 days if no critical issues are found." \
--prerelease

View file

@ -1,11 +1,11 @@
name: Release
name: Legacy Release (Deprecated)
on:
# schedule:
# # Run every day at 9am UTC
# - cron: "0 9 * * *"
workflow_dispatch:
# Allow manual triggering
# Keep manual triggering for emergencies
permissions:
contents: write

137
.github/workflows/stable-release.yml vendored Normal file
View file

@ -0,0 +1,137 @@
name: Stable Release
on:
schedule:
# Run every Monday at 10am UTC (1 hour after beta release)
- cron: "0 10 * * 1"
workflow_dispatch:
inputs:
beta_version:
description: 'Specific beta version to promote (e.g., 1.2.3-beta.20240115)'
required: false
type: string
permissions:
contents: write
issues: write
pull-requests: write
jobs:
stable-release:
name: Stable Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
always-auth: true
- name: Find beta version to promote
id: find_beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [[ -n "${{ inputs.beta_version }}" ]]; then
# Manual input provided
BETA_VERSION="${{ inputs.beta_version }}"
echo "Using manually specified beta version: $BETA_VERSION"
else
# Find beta version that's at least 7 days old
SEVEN_DAYS_AGO=$(date -u -d '7 days ago' +%Y%m%d)
echo "Looking for beta versions from $SEVEN_DAYS_AGO or earlier"
# Get all beta versions from npm
BETA_VERSIONS=$(npm view @continuedev/cli versions --json | jq -r '.[] | select(contains("-beta."))' | sort -V)
CANDIDATE_VERSION=""
for version in $BETA_VERSIONS; do
# Extract date from beta version (format: x.y.z-beta.YYYYMMDD)
if [[ $version =~ -beta\.([0-9]{8}) ]]; then
BETA_DATE="${BASH_REMATCH[1]}"
if [[ $BETA_DATE -le $SEVEN_DAYS_AGO ]]; then
CANDIDATE_VERSION=$version
fi
fi
done
if [[ -z "$CANDIDATE_VERSION" ]]; then
echo "No beta version found that is at least 7 days old"
exit 1
fi
BETA_VERSION=$CANDIDATE_VERSION
echo "Selected beta version for promotion: $BETA_VERSION"
fi
# Extract base version (remove -beta.YYYYMMDD suffix)
STABLE_VERSION=$(echo "$BETA_VERSION" | sed 's/-beta\.[0-9]\{8\}//')
echo "beta_version=$BETA_VERSION" >> $GITHUB_OUTPUT
echo "stable_version=$STABLE_VERSION" >> $GITHUB_OUTPUT
- name: Download and verify beta package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# Download the specific beta version
npm pack @continuedev/cli@${{ steps.find_beta.outputs.beta_version }}
# Extract and verify the package
PACKAGE_FILE=$(ls continuedev-cli-*.tgz)
tar -xzf "$PACKAGE_FILE"
echo "Beta package contents verified"
ls -la package/
- name: Update package.json for stable release
run: |
# Copy the beta package contents
cp -r package/* .
# Update version to stable (remove beta suffix)
npm version ${{ steps.find_beta.outputs.stable_version }} --no-git-tag-version
- name: Build (verification step)
run: npm run build
- name: Run tests (verification step)
run: npm test
- name: Publish stable to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm publish --tag latest
echo "Published stable version: ${{ steps.find_beta.outputs.stable_version }}"
- name: Create stable release on GitHub
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
run: |
# Create a git tag for the stable release
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git tag "v${{ steps.find_beta.outputs.stable_version }}"
git push origin "v${{ steps.find_beta.outputs.stable_version }}"
# Create GitHub release
gh release create "v${{ steps.find_beta.outputs.stable_version }}" \
--title "Stable Release v${{ steps.find_beta.outputs.stable_version }}" \
--notes "Stable release promoted from tested beta version ${{ steps.find_beta.outputs.beta_version }}. This version has been thoroughly tested in beta for at least 7 days." \
--latest
- name: Update GitHub release notes
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
run: |
# Mark the original beta release as superseded
gh release edit "v${{ steps.find_beta.outputs.beta_version }}" \
--notes "This beta version has been promoted to stable as v${{ steps.find_beta.outputs.stable_version }}."

View file

@ -1,14 +1,6 @@
// Import after mocking
import { AssistantUnrolled } from "@continuedev/config-yaml";
import {
afterEach,
beforeEach,
describe,
expect,
vi,
test,
} from "vitest";
import { afterEach, beforeEach, describe, expect, vi, test } from "vitest";
import * as workos from "./auth/workos.js";
import * as commands from "./commands/commands.js";
@ -39,10 +31,12 @@ describe("handleSlashCommands", () => {
// Since the mock already returns the required value, we don't need to set it
// Just verify it returns what we expect
expect(commands.getAllSlashCommands(mockAssistant)).toEqual(expect.arrayContaining([
expect.objectContaining({ name: "help" }),
expect.objectContaining({ name: "login" }),
]));
expect(commands.getAllSlashCommands(mockAssistant)).toEqual(
expect.arrayContaining([
expect.objectContaining({ name: "help" }),
expect.objectContaining({ name: "login" }),
])
);
});
afterEach(() => {
@ -114,7 +108,9 @@ describe("handleSlashCommands", () => {
{ id: "org2", name: "Organization 2" },
];
(services.auth.getAvailableOrganizations as any).mockResolvedValue(mockOrgs);
(services.auth.getAvailableOrganizations as any).mockResolvedValue(
mockOrgs
);
const result = await handleSlashCommands("/org list", mockAssistant);
@ -164,9 +160,9 @@ describe("handleSlashCommands", () => {
const result = await handleSlashCommands("/help", mockAssistant);
expect(result).not.toBeNull();
expect(result?.output).toContain("Available commands:");
expect(result?.output).toContain("/help - Show help");
expect(result?.output).toContain("/login - Authenticate");
expect(result?.output).toContain("Slash commands:");
expect(result?.output).toContain("/help: Show help");
expect(result?.output).toContain("/login: Authenticate");
});
test.skip("logout command should exit", async () => {

View file

@ -29,8 +29,8 @@ export async function handleSlashCommands(
case "help":
const allCommands = getAllSlashCommands(assistant);
const helpMessage = [
"Available commands:",
...allCommands.map((cmd) => `/${cmd.name} - ${cmd.description}`),
chalk.cyan("Slash commands:"),
...allCommands.map((cmd) => `- ${chalk.white(`/${cmd.name}:`)} ${chalk.gray(cmd.description)}`),
].join("\n");
posthogService.capture("useSlashCommand", {
name: "help",

View file

@ -105,13 +105,13 @@ const UserInput: React.FC<UserInputProps> = ({
const allCommands = getSlashCommands();
const exactMatch = allCommands.find((cmd) => cmd.name === afterSlash);
// Hide selector if we have an exact match and there's more content after the cursor
// Hide selector if we have an exact match and there's a space after cursor
if (exactMatch) {
const restOfText = text.slice(cursor);
// If there's a space immediately after cursor, or we're at end of line/text, hide selector
// Only hide if there's a space or newline immediately after cursor
// Don't hide just because we're at the end - user might want to see the suggestion
if (
restOfText.startsWith(" ") ||
restOfText === "" ||
restOfText.startsWith("\n")
) {
setShowSlashCommands(false);