Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 47 additions & 47 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ members = [
[workspace.package]
# CLI version - kept in sync with VERSION_CLI and src/cortex-cli/VERSION
# Run `scripts/check-cli-version.sh` to verify consistency
version = "0.1.9"
version = "0.1.10"
edition = "2024"
rust-version = "1.98"
authors = ["Cortex Team <team@cortex.foundation>"]
Expand Down
2 changes: 1 addition & 1 deletion VERSION_CLI
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.9
0.1.10
Comment thread
cursor[bot] marked this conversation as resolved.
2 changes: 1 addition & 1 deletion docs/reference/app-server.openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@
"info": {
"description": "Supported local session/health contract. Message POST stores a message; it does not generate a model response. Other development endpoints are not part of this stable contract.",
"title": "Cortex local session API",
"version": "0.1.9"
"version": "0.1.10"
},
"openapi": "3.1.0",
"paths": {
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cortexlm/sdk",
"version": "0.1.9",
"version": "0.1.10",
"description": "Typed, local Cortex CLI subprocess client",
"license": "Apache-2.0",
"private": true,
Expand Down
26 changes: 26 additions & 0 deletions scripts/bump-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,32 @@ else
echo -e " ${GREEN}✓ Updated Cargo.toml${NC}"
fi

# Keep the private SDK package version on VERSION_CLI (packages/sdk tests require it).
SDK_PKG="$REPO_ROOT/packages/sdk/package.json"
echo -e "${BLUE}Updating packages/sdk/package.json...${NC}"
if [ "$DRY_RUN" = true ]; then
echo " Would update version to \"$NEW_VERSION\" in $SDK_PKG"
elif [ -f "$SDK_PKG" ]; then
SDK_PKG_TMP=$(mktemp "${SDK_PKG}.tmp.XXXXXX")
awk -v new_ver="$NEW_VERSION" '
BEGIN { done = 0 }
!done && /"version"[[:space:]]*:/ {
sub(/"[0-9][^"]*"/, "\"" new_ver "\"")
done = 1
}
{ print }
' "$SDK_PKG" > "$SDK_PKG_TMP"
if ! grep -q "\"version\": \"$NEW_VERSION\"" "$SDK_PKG_TMP"; then
rm -f "$SDK_PKG_TMP"
echo -e "${RED}ERROR: Failed to update version in packages/sdk/package.json${NC}"
exit 1
fi
mv "$SDK_PKG_TMP" "$SDK_PKG"
echo -e " ${GREEN}✓ Updated packages/sdk/package.json${NC}"
else
echo -e " ${YELLOW}⚠ packages/sdk/package.json not found — skipped${NC}"
fi

echo ""

# Verify consistency
Expand Down
13 changes: 13 additions & 0 deletions scripts/check-cli-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ elif [ -n "$CLI_FILE_VERSION" ]; then
echo -e "${GREEN}✓ VERSION_CLI matches src/cortex-cli/VERSION${NC}"
fi

SDK_PKG="$REPO_ROOT/packages/sdk/package.json"
if [ -f "$SDK_PKG" ]; then
SDK_VERSION=$(grep -m1 '"version"' "$SDK_PKG" | sed 's/.*"\([^"]*\)".*/\1/')
echo "packages/sdk/package.json: $SDK_VERSION"
if [ "$VERSION_CLI" != "$SDK_VERSION" ]; then
echo -e "${RED}ERROR: VERSION_CLI ($VERSION_CLI) does not match packages/sdk/package.json ($SDK_VERSION)${NC}"
ERRORS=$((ERRORS + 1))
else
echo -e "${GREEN}✓ VERSION_CLI matches packages/sdk/package.json${NC}"
fi
fi

# Check against release version if provided (used in CI)
if [ -n "$CLI_RELEASE_VERSION" ]; then
echo ""
Expand All @@ -116,6 +128,7 @@ if [ $ERRORS -gt 0 ]; then
echo "1. Update VERSION_CLI with the correct version"
echo "2. Update [workspace.package] version in Cargo.toml to match"
echo "3. Ensure cortex-cli/Cargo.toml uses 'version.workspace = true'"
echo "4. Update packages/sdk/package.json to the same version"
exit 1
fi

Expand Down
2 changes: 1 addition & 1 deletion src/cortex-cli/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.9
0.1.10
1 change: 1 addition & 0 deletions src/cortex-tui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ pub mod lock_proof;
pub mod lock_v2;
pub mod readme_hero;
pub mod readme_hero_boards;
pub mod splash_chrome;

// Backtracking system for conversation history navigation
pub mod backtrack;
Expand Down
19 changes: 5 additions & 14 deletions src/cortex-tui/src/lock_boards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use ratatui::style::{Color, Modifier, Style};
use ratatui::text::{Line, Span};
use ratatui::widgets::{Paragraph, Widget};

use crate::splash_chrome::splash_legend;
use crate::ui::text_utils::{
first_fitting_line, fit_line, trim_dangling_separator, wrap_keep_indent, wrap_or_drop,
};
Expand All @@ -36,9 +37,6 @@ const GHOST_RUNNING: &str = crate::views::minimal_session::PLACEHOLDER_RUNNING;
/// Right-hand footer hint, and its narrow form — the live footer's copy.
const FOOTER_HINT: &str = crate::widgets::key_hints::FOOTER_HINT_IDLE;
const FOOTER_HINT_SHORT: &str = "shift+tab modes";
/// Keystroke hints under the splash, and the form that fits 40 columns.
const LAUNCH_HINTS: &str = crate::views::minimal_session::EMPTY_SESSION_HINTS;
const LAUNCH_HINTS_NARROW: &str = "/ commands · @ files · ! shell";
/// Rows the composer takes: hairline, prompt, hairline.
const COMPOSER_ROWS: u16 = crate::views::minimal_session::COMPOSER_ROWS;

Expand Down Expand Up @@ -788,7 +786,9 @@ fn bar(filled: u16, total: u16) -> String {
/// Launch header: `Welcome to Cortex, the coding agent CLI` then
/// `v{version} · / commands · …`. No fake `> cortex` or painted cwd.
fn paint_launch_header(area: Rect, buf: &mut Buffer, full: bool) -> u16 {
let w = inner_width(area);
// Full terminal width so the 40-col lock can hold the mid legend; a
// longer version is ellipsized instead of dropping `@ files · ! shell`.
let w = area.width.max(1) as usize;
let mut y = area.y;
let dim = Style::default().fg(TEXT_DIM);
let bold = Style::default().fg(TEXT).add_modifier(Modifier::BOLD);
Expand All @@ -797,16 +797,7 @@ fn paint_launch_header(area: Rect, buf: &mut Buffer, full: bool) -> u16 {
buf.set_string(area.x + 17, y, ", the coding agent CLI", dim);
y += 1;
if full {
let version = env!("CARGO_PKG_VERSION");
let full_h = format!("v{version} · {LAUNCH_HINTS}");
let mid_h = format!("v{version} · {LAUNCH_HINTS_NARROW}");
let hints = if full_h.chars().count() <= w {
full_h
} else if mid_h.chars().count() <= w {
mid_h
} else {
format!("v{version} · / commands")
};
let hints = splash_legend(env!("CARGO_PKG_VERSION"), w);
buf.set_string(
area.x,
y,
Expand Down
102 changes: 102 additions & 0 deletions src/cortex-tui/src/splash_chrome.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
//! Splash legend + version-width helpers.
//!
//! Split out of [`crate::lock_boards`] so a longer package version can
//! ellipsis without growing that file past the source-policy line-count
//! gate. At 40 columns the mid keystroke legend is kept; `& cloud` is
//! added when it fits. The version shortens — the legend does not.

/// Full empty-session hints, including the cloud slot when width allows.
const LAUNCH_HINTS: &str = crate::views::minimal_session::EMPTY_SESSION_HINTS;
/// Form that fits a 40-column lock (`& cloud` dropped).
const LAUNCH_HINTS_NARROW: &str = "/ commands · @ files · ! shell";

/// Join `v{version}` to a hint legend, ellipsizing the version — never the
/// legend — when the pair is wider than `width`.
pub(crate) fn splash_legend(version: &str, width: usize) -> String {
let ver = format!("v{version}");
for legend in [LAUNCH_HINTS, LAUNCH_HINTS_NARROW] {
let line = format!("{ver} · {legend}");
if line.chars().count() <= width {
return line;
}
}
// Keep `/ commands · @ files · ! shell` (and `& cloud` when it fits).
// A longer package version is shortened; the keystroke legend is not.
for legend in [LAUNCH_HINTS, LAUNCH_HINTS_NARROW] {
let suffix = format!(" · {legend}");
let suffix_len = suffix.chars().count();
if suffix_len >= width {
continue;
}
let shown = ellipsis_prefix(&ver, width - suffix_len);
if shown.is_empty() {
continue;
}
return format!("{shown}{suffix}");
}
LAUNCH_HINTS_NARROW.to_string()
}

fn ellipsis_prefix(text: &str, budget: usize) -> String {
if text.chars().count() <= budget {
return text.to_string();
}
if budget == 0 {
return String::new();
}
if budget == 1 {
return "…".to_string();
}
format!("{}…", text.chars().take(budget - 1).collect::<String>())
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn splash_legend_keeps_mid_hints_when_version_grows() {
for version in [env!("CARGO_PKG_VERSION"), "0.1.10", "10.20.30-rc.1"] {
let legend = splash_legend(version, 40);
assert!(
legend.contains("/ commands · @ files · ! shell"),
"40-col splash must keep mid hints for v{version}: {legend}"
);
assert!(
!legend.contains("& cloud"),
"40-col splash shortens before & cloud: {legend}"
);
}
}

#[test]
fn splash_legend_adds_cloud_when_width_allows() {
let legend = splash_legend("0.1.10", 120);
assert!(
legend.contains("/ commands · @ files · ! shell · & cloud"),
"wide splash keeps the cloud slot: {legend}"
);
assert!(
legend.starts_with("v0.1.10 · "),
"wide splash keeps the full version: {legend}"
);
}

#[test]
fn splash_legend_ellipsizes_version_not_legend() {
let exact = splash_legend("0.1.10", 40);
assert_eq!(exact, "v0.1.10 · / commands · @ files · ! shell");
assert_eq!(exact.chars().count(), 40);

let overflow = splash_legend("10.20.30-rc.1", 40);
assert!(
overflow.contains("/ commands · @ files · ! shell"),
"overflow must keep the mid legend: {overflow}"
);
assert!(
overflow.contains('…'),
"a longer version ellipsizes: {overflow}"
);
assert!(overflow.chars().count() <= 40, "{overflow}");
}
}
Loading