Skip to content

Commit 62ffb1a

Browse files
echobtfactorydroid
andauthored
refactor: rename Fabric to Cortex throughout the codebase (#187)
- Rename all FABRIC_* environment variables to CORTEX_* - Rename FabricPaths, FabricFeedback, etc. structs to Cortex* - Update all comments, documentation, and help text - Update shell integration scripts - Update TypeScript/JavaScript code and CSS files - Update configuration file references (.fabric -> .cortex) - Update service names and identifiers - Update test assertions and mock data Co-authored-by: Droid Agent <droid@factory.ai>
1 parent eae1165 commit 62ffb1a

391 files changed

Lines changed: 2182 additions & 2451 deletions

File tree

Some content is hidden

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

CORTEX_CLI_ANALYSIS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ cortex-cli/src/
8080

8181
```rust
8282
// run_cmd.rs:455
83-
// TODO: Implement full server attachment when fabric SDK client is available
83+
// TODO: Implement full server attachment when cortex SDK client is available
8484

8585
// run_cmd.rs:793
8686
// TODO: Implement session sharing when API is available
@@ -664,7 +664,7 @@ let mut stats = UsageStats::default();
664664
Loads all sessions into memory even when filtering:
665665

666666
```rust
667-
let sessions = cortex_engine::list_sessions(&config.fabric_home)?;
667+
let sessions = cortex_engine::list_sessions(&config.cortex_home)?;
668668
// Then filters...
669669
```
670670

@@ -825,7 +825,7 @@ No explicit offline mode or cached operation support.
825825
### 1. Naming Conventions
826826

827827
```rust
828-
fabric_home // Uses "fabric" internally
828+
cortex_home // Uses "cortex" internally
829829
cortex_home // Also used
830830
.cortex // Directory name
831831
```
@@ -916,7 +916,7 @@ Inconsistent use of short flags:
916916
3. Use tokio::fs for async file operations
917917
4. Implement retry logic for network operations
918918
5. Add caching for agent loading
919-
6. Standardize naming (fabric vs cortex)
919+
6. Standardize naming (cortex naming)
920920

921921
### 🟢 Low Priority (Nice to Have)
922922

IMPROVEMENTS_STATUS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ This document analyzes which improvements from previously merged PRs are already
171171
| PR | Description | Status |
172172
|----|-------------|--------|
173173
| PR 30 | Show alternative workflow when removing built-in agent | `agent_cmd.rs` - bails on builtin, no alternative shown |
174-
| PR 16 | Use uppercase CORTEX_HOME env var | `debug_cmd.rs` shows FABRIC_HOME, may need CORTEX_HOME |
174+
| PR 16 | Use uppercase CORTEX_HOME env var | `debug_cmd.rs` shows CORTEX_HOME |
175175

176176
---
177177

cortex-app-server/src/api.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ pub struct DiscoverResponse {
365365
/// "servers": [
366366
/// {
367367
/// "name": "cortex-8080",
368-
/// "fullname": "cortex-8080._fabric._tcp.local.",
368+
/// "fullname": "cortex-8080._cortex._tcp.local.",
369369
/// "host": "mycomputer.local.",
370370
/// "port": 8080,
371371
/// "addresses": ["192.168.1.100"],
@@ -810,7 +810,7 @@ pub struct ChatUsage {
810810

811811
/// Handle chat completions by calling the actual LLM provider.
812812
/// NOTE: This endpoint is temporarily disabled as the providers module was removed.
813-
/// Use the TUI (cargo run --bin fabric) for LLM completions instead.
813+
/// Use the TUI (cargo run --bin cortex) for LLM completions instead.
814814
async fn chat_completions(
815815
State(_state): State<Arc<AppState>>,
816816
Json(req): Json<ChatCompletionRequest>,
@@ -829,7 +829,7 @@ async fn chat_completions(
829829
index: 0,
830830
message: ChatMessage {
831831
role: "assistant".to_string(),
832-
content: "Chat completions API endpoint is temporarily disabled. The providers module was removed during dead code cleanup. Please use the TUI (cargo run --bin fabric) for LLM interactions.".to_string(),
832+
content: "Chat completions API endpoint is temporarily disabled. The providers module was removed during dead code cleanup. Please use the TUI (cargo run --bin cortex) for LLM interactions.".to_string(),
833833
tool_call_id: None,
834834
tool_calls: None,
835835
},
@@ -1680,7 +1680,7 @@ pub struct GeneratePromptResponse {
16801680
pub permission_mode: String,
16811681
}
16821682

1683-
/// Generate an agent prompt using AI via fabric-core.
1683+
/// Generate an agent prompt using AI via cortex-core.
16841684
/// NOTE: This endpoint is temporarily disabled as the providers module was removed.
16851685
async fn generate_agent_prompt(
16861686
State(_state): State<Arc<AppState>>,

cortex-app-server/src/auth.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl Claims {
5353
exp: now + expiry_seconds,
5454
iat: now,
5555
iss: "Cortex".to_string(),
56-
aud: vec!["fabric-api".to_string()],
56+
aud: vec!["cortex-api".to_string()],
5757
roles: vec![],
5858
metadata: HashMap::new(),
5959
}
@@ -304,7 +304,7 @@ pub async fn auth_middleware(
304304
// Configure validation
305305
let mut validation = Validation::default();
306306
validation.set_issuer(&["Cortex"]);
307-
validation.set_audience(&["fabric-api"]);
307+
validation.set_audience(&["cortex-api"]);
308308
validation.validate_exp = true;
309309
validation.validate_nbf = false;
310310

cortex-app-server/src/config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ impl ServerConfig {
114114
pub fn from_env() -> anyhow::Result<Self> {
115115
let mut config = Self::default();
116116

117-
if let Ok(addr) = std::env::var("FABRIC_LISTEN_ADDR") {
117+
if let Ok(addr) = std::env::var("CORTEX_LISTEN_ADDR") {
118118
config.listen_addr = addr;
119119
}
120120

121121
if let Ok(key) = std::env::var("CORTEX_API_KEY") {
122122
config.auth.api_keys.push(key);
123123
}
124124

125-
if let Ok(secret) = std::env::var("FABRIC_JWT_SECRET") {
125+
if let Ok(secret) = std::env::var("CORTEX_JWT_SECRET") {
126126
config.auth.jwt_secret = Some(secret);
127127
}
128128

@@ -135,11 +135,11 @@ impl ServerConfig {
135135
}
136136

137137
// mDNS configuration from environment
138-
if let Ok(mdns_enabled) = std::env::var("FABRIC_MDNS_ENABLED") {
138+
if let Ok(mdns_enabled) = std::env::var("CORTEX_MDNS_ENABLED") {
139139
config.mdns.enabled = mdns_enabled.parse().unwrap_or(false);
140140
}
141141

142-
if let Ok(mdns_name) = std::env::var("FABRIC_MDNS_SERVICE_NAME") {
142+
if let Ok(mdns_name) = std::env::var("CORTEX_MDNS_SERVICE_NAME") {
143143
config.mdns.service_name = Some(mdns_name);
144144
}
145145

cortex-app-server/src/handlers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate::tools::ToolExecutor;
2323

2424
/// Streaming completion handler.
2525
/// NOTE: This endpoint is temporarily disabled as the providers module was removed.
26-
/// Use the TUI (cargo run --bin fabric) for LLM completions instead.
26+
/// Use the TUI (cargo run --bin cortex) for LLM completions instead.
2727
pub async fn stream_completion(
2828
State(_state): State<Arc<AppState>>,
2929
Json(_req): Json<StreamCompletionRequest>,
@@ -32,7 +32,7 @@ pub async fn stream_completion(
3232
// Return a stream with a single error message
3333
let stream = async_stream::stream! {
3434
let error_event = StreamEvent::Error {
35-
message: "Streaming completions API endpoint is temporarily disabled. The providers module was removed during dead code cleanup. Please use the TUI (cargo run --bin fabric) for LLM interactions.".to_string()
35+
message: "Streaming completions API endpoint is temporarily disabled. The providers module was removed during dead code cleanup. Please use the TUI (cargo run --bin cortex) for LLM interactions.".to_string()
3636
};
3737
let data = serde_json::to_string(&error_event).unwrap_or_default();
3838
yield Ok(axum::response::sse::Event::default().data(data));

cortex-app-server/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
//!
33
//! This crate provides:
44
//! - REST API for managing sessions and conversations
5-
//! - WebSocket API for real-time streaming using real fabric-core Sessions
5+
//! - WebSocket API for real-time streaming using real cortex-core Sessions
66
//! - Authentication and authorization
77
//! - Rate limiting and request validation
88
//! - Health checks and metrics
99
//! - Static file serving for web UI
1010
//! - mDNS/Bonjour service discovery for automatic server discovery
1111
//!
12-
//! The server uses fabric-core's Session system to provide the same
12+
//! The server uses cortex-core's Session system to provide the same
1313
//! tool execution capabilities as the CLI (Execute, Read, Create, Edit, etc.)
1414
1515
#![deny(clippy::print_stdout, clippy::print_stderr)]

cortex-app-server/src/mdns.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! - `MdnsPublisher`: Publishes the Cortex server as a discoverable service on the local network
55
//! - `MdnsDiscovery`: Discovers other Cortex servers on the local network
66
//!
7-
//! The service is published under the `_fabric._tcp.local.` service type.
7+
//! The service is published under the `_cortex._tcp.local.` service type.
88
99
use std::collections::HashMap;
1010
use std::net::IpAddr;
@@ -18,7 +18,7 @@ use tracing::{debug, error, info, warn};
1818
use crate::error::{AppError, AppResult};
1919

2020
/// The mDNS service type for Cortex servers.
21-
pub const SERVICE_TYPE: &str = "_fabric._tcp.local.";
21+
pub const SERVICE_TYPE: &str = "_cortex._tcp.local.";
2222

2323
/// mDNS publisher for advertising the Cortex server on the local network.
2424
pub struct MdnsPublisher {
@@ -160,7 +160,7 @@ impl Drop for MdnsPublisher {
160160
pub struct DiscoveredServer {
161161
/// The instance name of the service.
162162
pub name: String,
163-
/// The full service name (e.g., "cortex-8080._fabric._tcp.local.").
163+
/// The full service name (e.g., "cortex-8080._cortex._tcp.local.").
164164
pub fullname: String,
165165
/// The hostname of the server.
166166
pub host: String,
@@ -527,7 +527,7 @@ mod tests {
527527
fn test_discovered_server_url() {
528528
let server = DiscoveredServer {
529529
name: "test-server".to_string(),
530-
fullname: "test-server._fabric._tcp.local.".to_string(),
530+
fullname: "test-server._cortex._tcp.local.".to_string(),
531531
host: "myhost.local.".to_string(),
532532
port: 8080,
533533
addresses: vec!["192.168.1.100".parse().unwrap(), "::1".parse().unwrap()],
@@ -548,7 +548,7 @@ mod tests {
548548
fn test_discovered_server_url_ipv6_only() {
549549
let server = DiscoveredServer {
550550
name: "test-server".to_string(),
551-
fullname: "test-server._fabric._tcp.local.".to_string(),
551+
fullname: "test-server._cortex._tcp.local.".to_string(),
552552
host: "myhost.local.".to_string(),
553553
port: 8080,
554554
addresses: vec!["2001:db8::1".parse().unwrap()],
@@ -563,7 +563,7 @@ mod tests {
563563
fn test_discovered_server_url_hostname_fallback() {
564564
let server = DiscoveredServer {
565565
name: "test-server".to_string(),
566-
fullname: "test-server._fabric._tcp.local.".to_string(),
566+
fullname: "test-server._cortex._tcp.local.".to_string(),
567567
host: "myhost.local.".to_string(),
568568
port: 8080,
569569
addresses: vec![],

cortex-app-server/src/session_manager.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
//! Session manager - bridges WebSocket clients to fabric-core Sessions.
1+
//! Session manager - bridges WebSocket clients to cortex-core Sessions.
22
//!
3-
//! This module creates real fabric-core Sessions and routes WebSocket messages
3+
//! This module creates real cortex-core Sessions and routes WebSocket messages
44
//! to the CLI's SQ/EQ (Submission Queue / Event Queue) system.
55
66
use std::collections::HashMap;
@@ -37,7 +37,7 @@ impl std::fmt::Debug for SessionManager {
3737
pub struct ManagedSession {
3838
/// Session ID.
3939
pub id: String,
40-
/// Conversation ID from fabric-core.
40+
/// Conversation ID from cortex-core.
4141
pub conversation_id: ConversationId,
4242
/// Handle to interact with the session.
4343
pub handle: SessionHandle,
@@ -90,7 +90,7 @@ impl SessionManager {
9090
) -> Result<SessionInfo, SessionError> {
9191
let session_id = Uuid::new_v4().to_string();
9292

93-
// Build fabric-core Config
93+
// Build cortex-core Config
9494
let mut config = CoreConfig::default();
9595

9696
// In cloud/server mode, never ask for approval - auto-approve everything
@@ -492,7 +492,7 @@ impl SessionManager {
492492

493493
let new_session_id = Uuid::new_v4().to_string();
494494

495-
// Build fabric-core Config from original
495+
// Build cortex-core Config from original
496496
let mut config = CoreConfig::default();
497497
config.model = model;
498498
config.cwd = cwd;
@@ -767,7 +767,7 @@ async fn forward_events_shared(
767767
debug!(session_id = %sid, "Event forwarder (shared) finished");
768768
}
769769

770-
/// Convert a fabric-protocol Event to a WebSocket message.
770+
/// Convert a cortex-protocol Event to a WebSocket message.
771771
fn convert_event_to_ws(event: &Event) -> Option<WsMessage> {
772772
match &event.msg {
773773
// Streaming content

cortex-app-server/src/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct AppState {
2121
pub config: ServerConfig,
2222
/// Active sessions (legacy API state).
2323
sessions: RwLock<HashMap<String, SessionState>>,
24-
/// CLI session manager - manages real fabric-core Sessions (WebSocket).
24+
/// CLI session manager - manages real cortex-core Sessions (WebSocket).
2525
pub cli_sessions: SessionManager,
2626
/// CLI session manager for HTTP streaming.
2727
pub cli_session_manager: CliSessionManager,

0 commit comments

Comments
 (0)