Skip to content

Commit 9efbc3e

Browse files
committed
feat(cli): add Cortex CLI agent-native development tool (#1)
Complete implementation of the Cortex CLI including: - TUI framework with reactive components and terminal rendering - Multi-provider AI integration (Anthropic, OpenAI, Groq, Google, etc.) - MCP (Model Context Protocol) client and server support - Plugin architecture for extensibility - Session management and persistence - File operations and shell execution tools - LSP integration for code intelligence - Background task execution system - Network proxy capabilities - Comprehensive agent system with custom agent support Technical highlights: - Rust workspace with modular crate architecture - Cross-platform support (Linux, macOS, Windows) - GitHub Actions CI/CD workflows - Multi-distribution publishing (Homebrew, Winget, R2)
1 parent e62758c commit 9efbc3e

File tree

1,297 files changed

+412527
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,297 files changed

+412527
-0
lines changed

.cargo/audit.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# audit.toml - cargo-audit configuration for security audit
2+
# https://github.com/rustsec/rustsec/blob/main/cargo-audit/audit.toml.example
3+
#
4+
# This file consolidates all RUSTSEC advisory exceptions in one place.
5+
# These are known vulnerabilities in transitive dependencies that cannot be
6+
# easily upgraded, typically due to deep dependency chains (e.g., wasmtime).
7+
8+
[advisories]
9+
# No longer needed - wasmtime updated to v41, ratatui to v0.30
10+
ignore = []
11+
12+
# Warn on informational advisories (unmaintained, unsound, etc.)
13+
informational_warnings = ["unmaintained", "unsound", "notice"]

.cargo/config.toml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Cargo configuration for static linking with musl targets
2+
# This enables building portable, statically-linked Linux binaries
3+
4+
# =============================================================================
5+
# x86_64 musl target (static linking)
6+
# =============================================================================
7+
[target.x86_64-unknown-linux-musl]
8+
# Use the musl-cross toolchain linker for cross-compilation
9+
# If building on a musl-based system, this can be simplified to just "musl-gcc"
10+
rustflags = [
11+
"-C", "target-feature=+crt-static",
12+
"-C", "link-self-contained=yes"
13+
]
14+
15+
# =============================================================================
16+
# aarch64 musl target (static linking)
17+
# =============================================================================
18+
[target.aarch64-unknown-linux-musl]
19+
rustflags = [
20+
"-C", "target-feature=+crt-static",
21+
"-C", "link-self-contained=yes"
22+
]
23+
24+
# =============================================================================
25+
# Build configuration
26+
# =============================================================================
27+
[build]
28+
# Use nightly for multithreaded compilation (set via RUSTFLAGS in CI)
29+
# rustflags = ["-Zthreads=32"]
30+
31+
# =============================================================================
32+
# Net configuration (for faster crate downloads)
33+
# =============================================================================
34+
[net]
35+
retry = 3
36+
git-fetch-with-cli = true
37+
38+
# =============================================================================
39+
# Registry configuration (sparse protocol for faster index updates)
40+
# =============================================================================
41+
[registries.crates-io]
42+
protocol = "sparse"

.github/hooks/pre-commit

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/sh
2+
# Pre-commit hook for Cortex CLI (OPTIMIZED)
3+
# Only formats and checks CHANGED Rust files
4+
5+
set -e
6+
7+
echo "=== Pre-commit Hook (Optimized) ==="
8+
9+
# Get list of staged Rust files
10+
STAGED_RS_FILES=$(git diff --cached --name-only --diff-filter=ACMR | grep '\.rs$' || true)
11+
12+
if [ -z "$STAGED_RS_FILES" ]; then
13+
echo "No Rust files staged, skipping checks."
14+
exit 0
15+
fi
16+
17+
echo "Checking $(echo "$STAGED_RS_FILES" | wc -l | tr -d ' ') Rust file(s)..."
18+
19+
# Format only staged files with rustfmt directly (faster than cargo fmt)
20+
echo "Running rustfmt on staged files..."
21+
echo "$STAGED_RS_FILES" | xargs rustfmt --edition 2024 2>/dev/null || true
22+
23+
# Re-add formatted files
24+
echo "$STAGED_RS_FILES" | xargs git add
25+
26+
# Quick clippy on changed crates only (find unique crate directories)
27+
CHANGED_CRATES=$(echo "$STAGED_RS_FILES" | sed 's|/src/.*||' | sort -u | grep -v '^\.' || true)
28+
29+
if [ -n "$CHANGED_CRATES" ]; then
30+
echo "Running clippy --fix on changed crates..."
31+
for crate in $CHANGED_CRATES; do
32+
if [ -f "$crate/Cargo.toml" ]; then
33+
crate_name=$(basename "$crate")
34+
cargo clippy -p "$crate_name" --fix --allow-dirty --allow-staged 2>/dev/null || true
35+
fi
36+
done
37+
38+
# Re-add any clippy fixes
39+
echo "$STAGED_RS_FILES" | xargs git add 2>/dev/null || true
40+
fi
41+
42+
echo "=== Pre-commit passed! ==="

.github/hooks/pre-push

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/sh
2+
# Pre-push hook for Cortex CLI (OPTIMIZED)
3+
# Only checks crates with changes since origin
4+
5+
set -e
6+
7+
echo "=== Pre-push Hook (Optimized) ==="
8+
9+
# Get the remote branch we're pushing to
10+
REMOTE=${1:-origin}
11+
REMOTE_REF=$(git rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo "$REMOTE/master")
12+
13+
# Get changed Rust files since remote
14+
CHANGED_RS_FILES=$(git diff --name-only "$REMOTE_REF"...HEAD | grep '\.rs$' || true)
15+
16+
if [ -z "$CHANGED_RS_FILES" ]; then
17+
echo "No Rust files changed since $REMOTE_REF, skipping checks."
18+
exit 0
19+
fi
20+
21+
echo "Checking changes since $REMOTE_REF..."
22+
23+
# Find changed crates
24+
CHANGED_CRATES=$(echo "$CHANGED_RS_FILES" | sed 's|/src/.*||' | sort -u | grep -v '^\.' || true)
25+
26+
# Format check on changed files only
27+
echo "Running rustfmt --check on changed files..."
28+
echo "$CHANGED_RS_FILES" | xargs rustfmt --edition 2024 --check 2>/dev/null || {
29+
echo "ERROR: Format check failed. Run 'cargo fmt' to fix."
30+
exit 1
31+
}
32+
33+
# Clippy only on changed crates
34+
if [ -n "$CHANGED_CRATES" ]; then
35+
echo "Running clippy on changed crates..."
36+
CLIPPY_ARGS=""
37+
for crate in $CHANGED_CRATES; do
38+
if [ -f "$crate/Cargo.toml" ]; then
39+
crate_name=$(basename "$crate")
40+
# Skip cortex-gui (needs frontend built)
41+
if [ "$crate_name" != "cortex-gui" ] && [ "$crate_name" != "src-tauri" ]; then
42+
CLIPPY_ARGS="$CLIPPY_ARGS -p $crate_name"
43+
fi
44+
fi
45+
done
46+
47+
if [ -n "$CLIPPY_ARGS" ]; then
48+
cargo clippy $CLIPPY_ARGS --lib 2>&1 | head -50 || true
49+
fi
50+
fi
51+
52+
# Check only changed crates
53+
echo "Running cargo check on changed crates..."
54+
for crate in $CHANGED_CRATES; do
55+
if [ -f "$crate/Cargo.toml" ]; then
56+
crate_name=$(basename "$crate")
57+
if [ "$crate_name" != "cortex-gui" ] && [ "$crate_name" != "src-tauri" ]; then
58+
cargo check -p "$crate_name" 2>/dev/null || {
59+
echo "ERROR: cargo check failed for $crate_name"
60+
exit 1
61+
}
62+
fi
63+
fi
64+
done
65+
66+
# Run tests only on changed crates
67+
echo "Running tests on changed crates..."
68+
for crate in $CHANGED_CRATES; do
69+
if [ -f "$crate/Cargo.toml" ]; then
70+
crate_name=$(basename "$crate")
71+
if [ "$crate_name" != "cortex-gui" ] && [ "$crate_name" != "src-tauri" ]; then
72+
cargo test -p "$crate_name" --lib 2>/dev/null || {
73+
echo "WARNING: Tests failed for $crate_name (continuing)"
74+
}
75+
fi
76+
fi
77+
done
78+
79+
echo "=== Pre-push passed! ==="

0 commit comments

Comments
 (0)