mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-25 03:32:32 +00:00
refactor(naming): switch binaries and artifacts from 'coder' to 'code'; keep 'coder' as fallback alias only. Update workflows, scripts, and postinstall.
This commit is contained in:
@@ -73,27 +73,27 @@ jobs:
|
||||
# Linux builds
|
||||
- os: ubuntu-24.04
|
||||
target: x86_64-unknown-linux-musl
|
||||
artifact: coder-x86_64-unknown-linux-musl
|
||||
artifact: code-x86_64-unknown-linux-musl
|
||||
- os: ubuntu-24.04
|
||||
target: x86_64-unknown-linux-gnu
|
||||
artifact: coder-x86_64-unknown-linux-gnu
|
||||
artifact: code-x86_64-unknown-linux-gnu
|
||||
- os: ubuntu-24.04-arm
|
||||
target: aarch64-unknown-linux-musl
|
||||
artifact: coder-aarch64-unknown-linux-musl
|
||||
artifact: code-aarch64-unknown-linux-musl
|
||||
- os: ubuntu-24.04-arm
|
||||
target: aarch64-unknown-linux-gnu
|
||||
artifact: coder-aarch64-unknown-linux-gnu
|
||||
artifact: code-aarch64-unknown-linux-gnu
|
||||
# macOS builds
|
||||
- os: macos-14 # ARM Mac for both targets
|
||||
target: x86_64-apple-darwin
|
||||
artifact: coder-x86_64-apple-darwin
|
||||
artifact: code-x86_64-apple-darwin
|
||||
- os: macos-14
|
||||
target: aarch64-apple-darwin
|
||||
artifact: coder-aarch64-apple-darwin
|
||||
artifact: code-aarch64-apple-darwin
|
||||
# Windows build
|
||||
- os: windows-latest
|
||||
target: x86_64-pc-windows-msvc
|
||||
artifact: coder-x86_64-pc-windows-msvc.exe
|
||||
artifact: code-x86_64-pc-windows-msvc.exe
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@@ -163,19 +163,19 @@ jobs:
|
||||
fi
|
||||
echo "Building with $CARGO_BUILD_JOBS parallel jobs"
|
||||
# Use --locked to ensure reproducible builds
|
||||
cargo build --release --locked --target ${{ matrix.target }} --bin coder --bin coder-tui --bin coder-exec
|
||||
cargo build --release --locked --target ${{ matrix.target }} --bin code --bin code-tui --bin code-exec
|
||||
|
||||
- name: Prepare artifacts
|
||||
run: |
|
||||
mkdir -p artifacts
|
||||
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
|
||||
cp codex-rs/target/${{ matrix.target }}/release/coder.exe artifacts/${{ matrix.artifact }}
|
||||
cp codex-rs/target/${{ matrix.target }}/release/coder-tui.exe artifacts/coder-tui-${{ matrix.target }}.exe
|
||||
cp codex-rs/target/${{ matrix.target }}/release/coder-exec.exe artifacts/coder-exec-${{ matrix.target }}.exe
|
||||
cp codex-rs/target/${{ matrix.target }}/release/code.exe artifacts/${{ matrix.artifact }}
|
||||
cp codex-rs/target/${{ matrix.target }}/release/code-tui.exe artifacts/code-tui-${{ matrix.target }}.exe
|
||||
cp codex-rs/target/${{ matrix.target }}/release/code-exec.exe artifacts/code-exec-${{ matrix.target }}.exe
|
||||
else
|
||||
cp codex-rs/target/${{ matrix.target }}/release/coder artifacts/${{ matrix.artifact }}
|
||||
cp codex-rs/target/${{ matrix.target }}/release/coder-tui artifacts/coder-tui-${{ matrix.target }}
|
||||
cp codex-rs/target/${{ matrix.target }}/release/coder-exec artifacts/coder-exec-${{ matrix.target }}
|
||||
cp codex-rs/target/${{ matrix.target }}/release/code artifacts/${{ matrix.artifact }}
|
||||
cp codex-rs/target/${{ matrix.target }}/release/code-tui artifacts/code-tui-${{ matrix.target }}
|
||||
cp codex-rs/target/${{ matrix.target }}/release/code-exec artifacts/code-exec-${{ matrix.target }}
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
|
||||
@@ -92,3 +92,4 @@ branches/
|
||||
|
||||
# coder directories
|
||||
.coder/
|
||||
.code/
|
||||
|
||||
@@ -239,7 +239,7 @@ npm install
|
||||
./build-fast.sh
|
||||
|
||||
# Run locally
|
||||
./codex-rs/target/dev-fast/coder
|
||||
./codex-rs/target/dev-fast/code
|
||||
```
|
||||
|
||||
### Opening a pull request
|
||||
|
||||
+17
-16
@@ -11,14 +11,14 @@ PROFILE="${PROFILE:-dev-fast}"
|
||||
|
||||
# Determine the correct binary path based on profile
|
||||
if [ "$PROFILE" = "dev-fast" ]; then
|
||||
BIN_PATH="./target/dev-fast/coder"
|
||||
BIN_PATH="./target/dev-fast/code"
|
||||
elif [ "$PROFILE" = "dev" ]; then
|
||||
BIN_PATH="./target/debug/coder"
|
||||
BIN_PATH="./target/debug/code"
|
||||
else
|
||||
BIN_PATH="./target/${PROFILE}/coder"
|
||||
BIN_PATH="./target/${PROFILE}/code"
|
||||
fi
|
||||
|
||||
echo "Building coder binary (${PROFILE} mode)..."
|
||||
echo "Building code binary (${PROFILE} mode)..."
|
||||
|
||||
# Build for native target (no --target flag) for maximum speed
|
||||
# This reuses the host stdlib and normal cache
|
||||
@@ -29,7 +29,7 @@ if [ "$PROFILE" = "dev-fast" ]; then
|
||||
export RUSTFLAGS="${RUSTFLAGS:-} -Awarnings"
|
||||
fi
|
||||
|
||||
cargo build --profile "${PROFILE}" --bin coder
|
||||
cargo build --profile "${PROFILE}" --bin code --bin code-tui --bin code-exec
|
||||
|
||||
# Check if build succeeded
|
||||
if [ $? -eq 0 ]; then
|
||||
@@ -39,23 +39,24 @@ if [ $? -eq 0 ]; then
|
||||
# Keep old symlink locations working for compatibility
|
||||
# Create symlink in target/release for npm wrapper expectations
|
||||
mkdir -p ./target/release
|
||||
if [ -e "./target/release/coder" ]; then
|
||||
rm -f ./target/release/coder
|
||||
if [ -e "./target/release/code" ]; then
|
||||
rm -f ./target/release/code
|
||||
fi
|
||||
ln -sf "../${PROFILE}/coder" "./target/release/coder"
|
||||
ln -sf "../${PROFILE}/code" "./target/release/code"
|
||||
|
||||
# Update the symlink in codex-cli/bin for npm wrapper
|
||||
CODEX_CLI_BIN="../codex-cli/bin/coder-aarch64-apple-darwin"
|
||||
mkdir -p "$(dirname "$CODEX_CLI_BIN")"
|
||||
if [ -e "$CODEX_CLI_BIN" ]; then
|
||||
rm -f "$CODEX_CLI_BIN"
|
||||
fi
|
||||
# Create relative symlink from codex-cli/bin to the actual binary
|
||||
ln -sf "../../codex-rs/target/${PROFILE}/coder" "$CODEX_CLI_BIN"
|
||||
CODEX_CLI_BIN_CODE="../codex-cli/bin/code-aarch64-apple-darwin"
|
||||
mkdir -p "$(dirname "$CODEX_CLI_BIN_CODE")"
|
||||
# Update symlinks for code (primary) and coder (fallback)
|
||||
for LINK in code-aarch64-apple-darwin coder-aarch64-apple-darwin; do
|
||||
DEST="../codex-cli/bin/$LINK"
|
||||
[ -e "$DEST" ] && rm -f "$DEST"
|
||||
ln -sf "../../codex-rs/target/${PROFILE}/code" "$DEST"
|
||||
done
|
||||
|
||||
echo "✅ Symlinks updated"
|
||||
echo ""
|
||||
echo "You can now run: coder"
|
||||
echo "You can now run: code"
|
||||
echo "Binary size: $(du -h ${BIN_PATH} | cut -f1)"
|
||||
echo ""
|
||||
echo "Build profile: ${PROFILE}"
|
||||
|
||||
+13
-13
@@ -4,35 +4,35 @@ set -euo pipefail
|
||||
|
||||
cd codex-rs
|
||||
|
||||
echo "Building coder binary (production release mode)..."
|
||||
echo "Building code binary (production release mode)..."
|
||||
echo "This will take longer but produce the most optimized binary."
|
||||
|
||||
# Build with the release-prod profile for maximum optimization
|
||||
cargo build --profile release-prod --bin coder --target aarch64-apple-darwin
|
||||
cargo build --profile release-prod --bin code --target aarch64-apple-darwin
|
||||
|
||||
# Check if build succeeded
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ Production build successful!"
|
||||
echo "Binary location: ./target/aarch64-apple-darwin/release-prod/coder"
|
||||
echo "Binary location: ./target/aarch64-apple-darwin/release-prod/code"
|
||||
|
||||
# Update symlinks for production binary
|
||||
mkdir -p ./target/release
|
||||
if [ -e "./target/release/coder" ]; then
|
||||
rm -f ./target/release/coder
|
||||
if [ -e "./target/release/code" ]; then
|
||||
rm -f ./target/release/code
|
||||
fi
|
||||
ln -sf ./aarch64-apple-darwin/release-prod/coder ./target/release/coder
|
||||
ln -sf ./aarch64-apple-darwin/release-prod/code ./target/release/code
|
||||
|
||||
# Update the symlink in codex-cli/bin for npm wrapper
|
||||
CODEX_CLI_BIN="../codex-cli/bin/coder-aarch64-apple-darwin"
|
||||
if [ -e "$CODEX_CLI_BIN" ]; then
|
||||
rm -f "$CODEX_CLI_BIN"
|
||||
CODEX_CLI_BIN_CODE="../codex-cli/bin/code-aarch64-apple-darwin"
|
||||
if [ -e "$CODEX_CLI_BIN_CODE" ]; then
|
||||
rm -f "$CODEX_CLI_BIN_CODE"
|
||||
fi
|
||||
ln -sf ../../codex-rs/target/aarch64-apple-darwin/release-prod/coder "$CODEX_CLI_BIN"
|
||||
ln -sf ../../codex-rs/target/aarch64-apple-darwin/release-prod/code "$CODEX_CLI_BIN_CODE"
|
||||
|
||||
echo "✅ Symlinks updated"
|
||||
echo ""
|
||||
echo "Production binary ready: coder"
|
||||
echo "Binary size: $(du -h ./target/aarch64-apple-darwin/release-prod/coder | cut -f1)"
|
||||
echo "Production binary ready: code"
|
||||
echo "Binary size: $(du -h ./target/aarch64-apple-darwin/release-prod/code | cut -f1)"
|
||||
echo ""
|
||||
echo "This build is optimized for distribution with:"
|
||||
echo " → Maximum link-time optimization (LTO=fat)"
|
||||
@@ -41,4 +41,4 @@ if [ $? -eq 0 ]; then
|
||||
else
|
||||
echo "❌ Build failed"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -56,7 +56,11 @@ if (!targetTriple) {
|
||||
throw new Error(`Unsupported platform: ${platform} (${arch})`);
|
||||
}
|
||||
|
||||
const binaryPath = path.join(__dirname, "..", "bin", `coder-${targetTriple}`);
|
||||
// Prefer new 'code-*' binary names; fall back to legacy 'coder-*' if missing.
|
||||
let binaryPath = path.join(__dirname, "..", "bin", `code-${targetTriple}`);
|
||||
if (!existsSync(binaryPath)) {
|
||||
binaryPath = path.join(__dirname, "..", "bin", `coder-${targetTriple}`);
|
||||
}
|
||||
|
||||
// Check if binary exists and try to fix permissions if needed
|
||||
import { existsSync, chmodSync } from "fs";
|
||||
|
||||
@@ -94,8 +94,8 @@ async function main() {
|
||||
const packageJson = JSON.parse(readFileSync(join(__dirname, 'package.json'), 'utf8'));
|
||||
const version = packageJson.version;
|
||||
|
||||
// Binary names to download (Rust artifacts remain named 'coder*')
|
||||
const binaries = ['coder', 'coder-tui', 'coder-exec'];
|
||||
// Binary names to download (new naming is 'code*')
|
||||
const binaries = ['code', 'code-tui', 'code-exec'];
|
||||
|
||||
console.log(`Installing @just-every/code v${version} for ${targetTriple}...`);
|
||||
|
||||
@@ -139,17 +139,17 @@ async function main() {
|
||||
}
|
||||
|
||||
// Create platform-specific symlink/copy for main binary
|
||||
const mainBinary = `coder-${targetTriple}${binaryExt}`;
|
||||
const mainBinary = `code-${targetTriple}${binaryExt}`;
|
||||
const mainBinaryPath = join(binDir, mainBinary);
|
||||
|
||||
if (existsSync(mainBinaryPath)) {
|
||||
console.log('Setting up main coder binary...');
|
||||
console.log('Setting up main code binary...');
|
||||
|
||||
// On Windows, we can't use symlinks easily, so update the JS wrapper
|
||||
// On Unix, the JS wrapper will find the correct binary
|
||||
console.log('✓ Installation complete!');
|
||||
} else {
|
||||
console.warn('⚠ Main coder binary not found. You may need to build from source.');
|
||||
console.warn('⚠ Main code binary not found. You may need to build from source.');
|
||||
}
|
||||
|
||||
// With bin name = 'code', handle collisions with existing 'code' (e.g., VS Code)
|
||||
|
||||
@@ -619,7 +619,7 @@ impl BrowserManager {
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap_or_default()
|
||||
.as_millis();
|
||||
let temp_path = format!("/tmp/coder-browser-{}-{}", std::process::id(), timestamp);
|
||||
let temp_path = format!("/tmp/code-browser-{}-{}", std::process::id(), timestamp);
|
||||
if tokio::fs::metadata(&temp_path).await.is_ok() {
|
||||
let _ = tokio::fs::remove_dir_all(&temp_path).await;
|
||||
}
|
||||
@@ -652,7 +652,7 @@ impl BrowserManager {
|
||||
.arg("--enable-logging")
|
||||
.arg("--log-level=1") // 0 = INFO, 1 = WARNING, 2 = ERROR, 3 = FATAL (1 to reduce verbosity)
|
||||
.arg(format!(
|
||||
"--log-file={}/coder-chrome.log",
|
||||
"--log-file={}/code-chrome.log",
|
||||
std::env::temp_dir().display()
|
||||
))
|
||||
// Suppress console output
|
||||
|
||||
+11
-11
@@ -8,18 +8,18 @@ PROFILE="${PROFILE:-dev-fast}"
|
||||
|
||||
# Determine the correct binary path based on profile
|
||||
if [ "$PROFILE" = "dev-fast" ]; then
|
||||
BIN_PATH="./target/dev-fast/coder"
|
||||
BIN_PATH="./target/dev-fast/code"
|
||||
elif [ "$PROFILE" = "dev" ]; then
|
||||
BIN_PATH="./target/debug/coder"
|
||||
BIN_PATH="./target/debug/code"
|
||||
else
|
||||
BIN_PATH="./target/${PROFILE}/coder"
|
||||
BIN_PATH="./target/${PROFILE}/code"
|
||||
fi
|
||||
|
||||
echo "Building coder binary (${PROFILE} mode)..."
|
||||
echo "Building code binary (${PROFILE} mode)..."
|
||||
|
||||
# Build for native target (no --target flag) for maximum speed
|
||||
# This reuses the host stdlib and normal cache
|
||||
cargo build --profile "${PROFILE}" --bin coder
|
||||
cargo build --profile "${PROFILE}" --bin code
|
||||
|
||||
# Check if build succeeded
|
||||
if [ $? -eq 0 ]; then
|
||||
@@ -29,23 +29,23 @@ if [ $? -eq 0 ]; then
|
||||
# Keep old symlink locations working for compatibility
|
||||
# Create symlink in target/release for npm wrapper expectations
|
||||
mkdir -p ./target/release
|
||||
if [ -e "./target/release/coder" ]; then
|
||||
rm -f ./target/release/coder
|
||||
if [ -e "./target/release/code" ]; then
|
||||
rm -f ./target/release/code
|
||||
fi
|
||||
ln -sf "../${PROFILE}/coder" "./target/release/coder"
|
||||
ln -sf "../${PROFILE}/code" "./target/release/code"
|
||||
|
||||
# Update the symlink in codex-cli/bin for npm wrapper
|
||||
CODEX_CLI_BIN="./codex-cli/bin/coder-aarch64-apple-darwin"
|
||||
CODEX_CLI_BIN="./codex-cli/bin/code-aarch64-apple-darwin"
|
||||
mkdir -p "$(dirname "$CODEX_CLI_BIN")"
|
||||
if [ -e "$CODEX_CLI_BIN" ]; then
|
||||
rm -f "$CODEX_CLI_BIN"
|
||||
fi
|
||||
# Create relative symlink from codex-cli/bin to the actual binary
|
||||
ln -sf "../../target/${PROFILE}/coder" "$CODEX_CLI_BIN"
|
||||
ln -sf "../../target/${PROFILE}/code" "$CODEX_CLI_BIN"
|
||||
|
||||
echo "✅ Symlinks updated"
|
||||
echo ""
|
||||
echo "You can now run: coder"
|
||||
echo "You can now run: code"
|
||||
echo "Binary size: $(du -h ${BIN_PATH} | cut -f1)"
|
||||
echo ""
|
||||
echo "Build profile: ${PROFILE}"
|
||||
|
||||
@@ -23,7 +23,7 @@ pub(crate) async fn chatgpt_get_request<T: DeserializeOwned>(
|
||||
get_chatgpt_token_data().ok_or_else(|| anyhow::anyhow!("ChatGPT token not available"))?;
|
||||
|
||||
let account_id = token.account_id.ok_or_else(|| {
|
||||
anyhow::anyhow!("ChatGPT account ID not available, please re-run `coder login`")
|
||||
anyhow::anyhow!("ChatGPT account ID not available, please re-run `code login`")
|
||||
});
|
||||
|
||||
let response = client
|
||||
|
||||
@@ -4,7 +4,7 @@ name = "codex-cli"
|
||||
version = { workspace = true }
|
||||
|
||||
[[bin]]
|
||||
name = "coder"
|
||||
name = "code"
|
||||
path = "src/main.rs"
|
||||
|
||||
[lib]
|
||||
|
||||
@@ -25,14 +25,14 @@ use crate::proto::ProtoCli;
|
||||
#[derive(Debug, Parser)]
|
||||
#[clap(
|
||||
author,
|
||||
name = "coder",
|
||||
name = "code",
|
||||
version = env!("CARGO_PKG_VERSION"),
|
||||
// If a sub‑command is given, ignore requirements of the default args.
|
||||
subcommand_negates_reqs = true,
|
||||
// The executable is sometimes invoked via a platform‑specific name like
|
||||
// `codex-x86_64-unknown-linux-musl`, but the help output should always use
|
||||
// the generic `codex` command name that users run.
|
||||
bin_name = "coder"
|
||||
bin_name = "code"
|
||||
)]
|
||||
struct MultitoolCli {
|
||||
#[clap(flatten)]
|
||||
|
||||
@@ -385,18 +385,18 @@ fn generate_branch_id(model: &str, agent: &str) -> String {
|
||||
words.join("-").to_lowercase()
|
||||
};
|
||||
|
||||
format!("coder-{}-{}", model, agent_suffix)
|
||||
format!("code-{}-{}", model, agent_suffix)
|
||||
}
|
||||
|
||||
async fn setup_worktree(git_root: &Path, branch_id: &str) -> Result<PathBuf, String> {
|
||||
// Create .coder/branches directory if it doesn't exist
|
||||
let coder_dir = git_root.join(".coder").join("branches");
|
||||
tokio::fs::create_dir_all(&coder_dir)
|
||||
// Create .code/branches directory if it doesn't exist
|
||||
let code_dir = git_root.join(".code").join("branches");
|
||||
tokio::fs::create_dir_all(&code_dir)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to create .coder/branches directory: {}", e))?;
|
||||
.map_err(|e| format!("Failed to create .code/branches directory: {}", e))?;
|
||||
|
||||
// Path for this model's worktree
|
||||
let worktree_path = coder_dir.join(branch_id);
|
||||
let worktree_path = code_dir.join(branch_id);
|
||||
|
||||
// Remove existing worktree if it exists (cleanup from previous runs)
|
||||
if worktree_path.exists() {
|
||||
|
||||
@@ -2296,7 +2296,7 @@ async fn handle_response_item(
|
||||
|
||||
// Helper utilities for agent output/progress management
|
||||
fn ensure_agent_dir(cwd: &Path, agent_id: &str) -> Result<PathBuf, String> {
|
||||
let dir = cwd.join(".coder").join("agents").join(agent_id);
|
||||
let dir = cwd.join(".code").join("agents").join(agent_id);
|
||||
std::fs::create_dir_all(&dir)
|
||||
.map_err(|e| format!("Failed to create agent dir {}: {}", dir.display(), e))?;
|
||||
Ok(dir)
|
||||
|
||||
@@ -147,7 +147,7 @@ impl McpConnectionManager {
|
||||
elicitation: Some(json!({})),
|
||||
},
|
||||
client_info: Implementation {
|
||||
name: "coder-mcp-client".to_owned(),
|
||||
name: "code-mcp-client".to_owned(),
|
||||
version: env!("CARGO_PKG_VERSION").to_owned(),
|
||||
title: Some("Codex".into()),
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ name = "codex-exec"
|
||||
version = { workspace = true }
|
||||
|
||||
[[bin]]
|
||||
name = "coder-exec"
|
||||
name = "code-exec"
|
||||
path = "src/main.rs"
|
||||
|
||||
[lib]
|
||||
|
||||
@@ -61,7 +61,7 @@ async fn main() -> Result<()> {
|
||||
elicitation: None,
|
||||
},
|
||||
client_info: Implementation {
|
||||
name: "coder-mcp-client".to_owned(),
|
||||
name: "code-mcp-client".to_owned(),
|
||||
version: env!("CARGO_PKG_VERSION").to_owned(),
|
||||
title: Some("Code".to_string()),
|
||||
},
|
||||
|
||||
@@ -87,6 +87,9 @@ impl CodexMessageProcessor {
|
||||
ClientRequest::RemoveConversationListener { request_id, params } => {
|
||||
self.remove_conversation_listener(request_id, params).await;
|
||||
}
|
||||
ClientRequest::SendUserTurn { request_id, params } => {
|
||||
self.send_user_turn_compat(request_id, params).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,6 +300,63 @@ impl CodexMessageProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
impl CodexMessageProcessor {
|
||||
// Minimal compatibility layer: translate SendUserTurn into our current
|
||||
// flow by submitting only the user items. We intentionally do not attempt
|
||||
// per‑turn reconfiguration here (model, cwd, approval, sandbox) to avoid
|
||||
// destabilizing the session. This preserves behavior and acks the request
|
||||
// so clients using the new method continue to function.
|
||||
async fn send_user_turn_compat(
|
||||
&self,
|
||||
request_id: RequestId,
|
||||
params: crate::wire_format::SendUserTurnParams,
|
||||
) {
|
||||
use crate::wire_format::SendUserTurnResponse;
|
||||
|
||||
let crate::wire_format::SendUserTurnParams {
|
||||
conversation_id,
|
||||
items,
|
||||
..
|
||||
} = params;
|
||||
|
||||
let Ok(conversation) = self
|
||||
.conversation_manager
|
||||
.get_conversation(conversation_id.0)
|
||||
.await
|
||||
else {
|
||||
let error = JSONRPCErrorError {
|
||||
code: INVALID_REQUEST_ERROR_CODE,
|
||||
message: format!("conversation not found: {conversation_id}"),
|
||||
data: None,
|
||||
};
|
||||
self.outgoing.send_error(request_id, error).await;
|
||||
return;
|
||||
};
|
||||
|
||||
// Map wire input items into core protocol items.
|
||||
let mapped_items: Vec<CoreInputItem> = items
|
||||
.into_iter()
|
||||
.map(|item| match item {
|
||||
WireInputItem::Text { text } => CoreInputItem::Text { text },
|
||||
WireInputItem::Image { image_url } => CoreInputItem::Image { image_url },
|
||||
WireInputItem::LocalImage { path } => CoreInputItem::LocalImage { path },
|
||||
})
|
||||
.collect();
|
||||
|
||||
// Submit user input to the conversation.
|
||||
let _ = conversation
|
||||
.submit(Op::UserInput {
|
||||
items: mapped_items,
|
||||
})
|
||||
.await;
|
||||
|
||||
// Acknowledge.
|
||||
self.outgoing
|
||||
.send_response(request_id, SendUserTurnResponse {})
|
||||
.await;
|
||||
}
|
||||
}
|
||||
|
||||
async fn apply_bespoke_event_handling(
|
||||
event: Event,
|
||||
conversation_id: ConversationId,
|
||||
@@ -367,6 +427,7 @@ fn derive_config_from_params(
|
||||
config: cli_overrides,
|
||||
base_instructions,
|
||||
include_plan_tool,
|
||||
..
|
||||
} = params;
|
||||
let overrides = ConfigOverrides {
|
||||
model,
|
||||
|
||||
@@ -239,7 +239,7 @@ impl MessageProcessor {
|
||||
instructions: None,
|
||||
protocol_version: params.protocol_version.clone(),
|
||||
server_info: mcp_types::Implementation {
|
||||
name: "coder-mcp-server".to_string(),
|
||||
name: "code-mcp-server".to_string(),
|
||||
version: env!("CARGO_PKG_VERSION").to_string(),
|
||||
title: Some("Code".to_string()),
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ name = "codex-tui"
|
||||
version = { workspace = true }
|
||||
|
||||
[[bin]]
|
||||
name = "coder-tui"
|
||||
name = "code-tui"
|
||||
path = "src/main.rs"
|
||||
|
||||
[lib]
|
||||
|
||||
@@ -447,7 +447,7 @@ impl App<'_> {
|
||||
break;
|
||||
}
|
||||
SlashCommand::Diff => {
|
||||
let (is_git_repo, diff_text) = match get_git_diff() {
|
||||
let (is_git_repo, diff_text) = match tokio::runtime::Handle::current().block_on(get_git_diff()) {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
let msg = format!("Failed to compute diff: {e}");
|
||||
@@ -580,6 +580,11 @@ impl App<'_> {
|
||||
widget.set_text_verbosity(new_verbosity);
|
||||
}
|
||||
}
|
||||
AppEvent::DiffResult(text) => {
|
||||
if let AppState::Chat { widget } = &mut self.app_state {
|
||||
widget.add_diff_output(text);
|
||||
}
|
||||
}
|
||||
AppEvent::UpdateTheme(new_theme) => {
|
||||
// Switch the theme immediately
|
||||
crate::theme::switch_theme(new_theme);
|
||||
|
||||
@@ -61,12 +61,21 @@ impl ChatComposerHistory {
|
||||
/// Record a message submitted by the user in the current session so it can
|
||||
/// be recalled later.
|
||||
pub fn record_local_submission(&mut self, text: &str) {
|
||||
if !text.is_empty() {
|
||||
self.local_history.push(text.to_string());
|
||||
self.history_cursor = None;
|
||||
self.last_history_text = None;
|
||||
self.original_text = None;
|
||||
if text.is_empty() {
|
||||
return;
|
||||
}
|
||||
// Avoid inserting a duplicate if identical to the previous entry.
|
||||
if self
|
||||
.local_history
|
||||
.last()
|
||||
.is_some_and(|prev| prev == text)
|
||||
{
|
||||
return;
|
||||
}
|
||||
self.local_history.push(text.to_string());
|
||||
self.history_cursor = None;
|
||||
self.last_history_text = None;
|
||||
self.original_text = None;
|
||||
}
|
||||
|
||||
/// Reset navigation state (used when clearing input with double-Esc or when text is edited)
|
||||
|
||||
@@ -152,7 +152,7 @@ impl<'a> BottomPaneView<'a> for ReasoningSelectionView {
|
||||
Span::styled(
|
||||
format!("{}", self.current_effort),
|
||||
Style::default()
|
||||
.fg(Color::Yellow)
|
||||
.fg(crate::colors::warning())
|
||||
.add_modifier(Modifier::BOLD),
|
||||
),
|
||||
]),
|
||||
@@ -166,10 +166,10 @@ impl<'a> BottomPaneView<'a> for ReasoningSelectionView {
|
||||
|
||||
let mut style = Style::default();
|
||||
if is_selected {
|
||||
style = style.bg(Color::DarkGray).add_modifier(Modifier::BOLD);
|
||||
style = style.bg(crate::colors::selection()).add_modifier(Modifier::BOLD);
|
||||
}
|
||||
if is_current {
|
||||
style = style.fg(Color::Yellow);
|
||||
style = style.fg(crate::colors::warning());
|
||||
}
|
||||
|
||||
let prefix = if is_selected { "▶ " } else { " " };
|
||||
@@ -186,9 +186,9 @@ impl<'a> BottomPaneView<'a> for ReasoningSelectionView {
|
||||
lines.push(Line::from(vec![
|
||||
Span::styled("↑↓", Style::default().fg(crate::colors::light_blue())),
|
||||
Span::raw(" Navigate "),
|
||||
Span::styled("Enter", Style::default().fg(Color::Green)),
|
||||
Span::styled("Enter", Style::default().fg(crate::colors::success())),
|
||||
Span::raw(" Select "),
|
||||
Span::styled("Esc", Style::default().fg(Color::Red)),
|
||||
Span::styled("Esc", Style::default().fg(crate::colors::error())),
|
||||
Span::raw(" Cancel"),
|
||||
]));
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ impl<'a> BottomPaneView<'a> for VerbositySelectionView {
|
||||
Span::styled(
|
||||
format!("{}", self.current_verbosity),
|
||||
Style::default()
|
||||
.fg(Color::Yellow)
|
||||
.fg(crate::colors::warning())
|
||||
.add_modifier(Modifier::BOLD),
|
||||
),
|
||||
]),
|
||||
@@ -164,10 +164,10 @@ impl<'a> BottomPaneView<'a> for VerbositySelectionView {
|
||||
|
||||
let mut style = Style::default();
|
||||
if is_selected {
|
||||
style = style.bg(Color::DarkGray).add_modifier(Modifier::BOLD);
|
||||
style = style.bg(crate::colors::selection()).add_modifier(Modifier::BOLD);
|
||||
}
|
||||
if is_current {
|
||||
style = style.fg(Color::Yellow);
|
||||
style = style.fg(crate::colors::warning());
|
||||
}
|
||||
|
||||
let prefix = if is_selected { "▶ " } else { " " };
|
||||
@@ -184,13 +184,13 @@ impl<'a> BottomPaneView<'a> for VerbositySelectionView {
|
||||
lines.push(Line::from(vec![
|
||||
Span::styled("↑↓", Style::default().fg(crate::colors::light_blue())),
|
||||
Span::raw(" Navigate "),
|
||||
Span::styled("Enter", Style::default().fg(Color::Green)),
|
||||
Span::styled("Enter", Style::default().fg(crate::colors::success())),
|
||||
Span::raw(" Select "),
|
||||
Span::styled("Esc", Style::default().fg(Color::Red)),
|
||||
Span::styled("Esc", Style::default().fg(crate::colors::error())),
|
||||
Span::raw(" Cancel"),
|
||||
]));
|
||||
|
||||
let paragraph = Paragraph::new(lines).alignment(Alignment::Left);
|
||||
paragraph.render(inner_area, buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2778,7 +2778,7 @@ impl ChatWidget<'_> {
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
let log_path = format!("{}/coder-chrome.log", std::env::temp_dir().display());
|
||||
let log_path = format!("{}/code-chrome.log", std::env::temp_dir().display());
|
||||
let mut cmd = std::process::Command::new(
|
||||
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
|
||||
);
|
||||
@@ -2803,7 +2803,7 @@ impl ChatWidget<'_> {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
let log_path = format!("{}/coder-chrome.log", std::env::temp_dir().display());
|
||||
let log_path = format!("{}/code-chrome.log", std::env::temp_dir().display());
|
||||
let mut cmd = std::process::Command::new("google-chrome");
|
||||
cmd.arg(format!("--remote-debugging-port={}", port))
|
||||
.arg("--no-first-run")
|
||||
@@ -2826,7 +2826,7 @@ impl ChatWidget<'_> {
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
let log_path = format!("{}\\coder-chrome.log", std::env::temp_dir().display());
|
||||
let log_path = format!("{}\\code-chrome.log", std::env::temp_dir().display());
|
||||
let chrome_paths = vec![
|
||||
"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe".to_string(),
|
||||
"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe".to_string(),
|
||||
@@ -3090,11 +3090,11 @@ impl ChatWidget<'_> {
|
||||
use std::process::Stdio;
|
||||
|
||||
let temp_dir = std::env::temp_dir();
|
||||
let profile_dir = temp_dir.join(format!("coder-chrome-temp-{}", port));
|
||||
let profile_dir = temp_dir.join(format!("code-chrome-temp-{}", port));
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
let log_path = format!("{}/coder-chrome.log", std::env::temp_dir().display());
|
||||
let log_path = format!("{}/code-chrome.log", std::env::temp_dir().display());
|
||||
let mut cmd = std::process::Command::new(
|
||||
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
|
||||
);
|
||||
@@ -3120,7 +3120,7 @@ impl ChatWidget<'_> {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
let log_path = format!("{}/coder-chrome.log", std::env::temp_dir().display());
|
||||
let log_path = format!("{}/code-chrome.log", std::env::temp_dir().display());
|
||||
let mut cmd = std::process::Command::new("google-chrome");
|
||||
cmd.arg(format!("--remote-debugging-port={}", port))
|
||||
.arg(format!("--user-data-dir={}", profile_dir.display()))
|
||||
@@ -3144,7 +3144,7 @@ impl ChatWidget<'_> {
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
let log_path = format!("{}\\coder-chrome.log", std::env::temp_dir().display());
|
||||
let log_path = format!("{}\\code-chrome.log", std::env::temp_dir().display());
|
||||
let chrome_paths = vec![
|
||||
"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe".to_string(),
|
||||
"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe".to_string(),
|
||||
|
||||
@@ -12,7 +12,7 @@ use codex_core::protocol::FileChange;
|
||||
use crate::history_cell::PatchEventType;
|
||||
|
||||
#[allow(dead_code)]
|
||||
const SPACES_AFTER_LINE_NUMBER: usize = 4;
|
||||
const SPACES_AFTER_LINE_NUMBER: usize = 6;
|
||||
|
||||
// Internal representation for diff line rendering
|
||||
#[allow(dead_code)]
|
||||
@@ -290,15 +290,14 @@ fn push_wrapped_diff_line(
|
||||
let mut remaining_text: &str = text;
|
||||
|
||||
// Reserve a fixed number of spaces after the line number so that content starts
|
||||
// at a consistent column. The sign ("+"/"-") is rendered as part of the content
|
||||
// and colored with the same foreground as the edited text, not as a separate
|
||||
// dimmed column.
|
||||
// at a consistent column. Always include a 1‑char diff sign ("+"/"-" or space)
|
||||
// at the start of the content so gutters align across wrapped lines.
|
||||
let gap_after_ln = SPACES_AFTER_LINE_NUMBER.saturating_sub(ln_str.len());
|
||||
let first_prefix_cols = indent.len() + ln_str.len() + gap_after_ln;
|
||||
let cont_prefix_cols = indent.len() + ln_str.len() + gap_after_ln;
|
||||
|
||||
let mut first = true;
|
||||
let (sign_opt, line_style) = match kind {
|
||||
let (sign_opt, line_style) = match kind {
|
||||
DiffLineType::Insert => (Some('+'), Some(style_add())),
|
||||
DiffLineType::Delete => (Some('-'), Some(style_del())),
|
||||
DiffLineType::Context => (None, None),
|
||||
@@ -328,12 +327,9 @@ fn push_wrapped_diff_line(
|
||||
spans.push(RtSpan::styled(ln_str.clone(), style_dim()));
|
||||
spans.push(RtSpan::raw(" ".repeat(gap_after_ln)));
|
||||
|
||||
// Prefix the content with the sign if it is an insertion or deletion, and color
|
||||
// the sign and content with the same foreground as the edited text.
|
||||
let display_chunk = match sign_opt {
|
||||
Some(sign_char) => format!("{sign_char}{chunk}"),
|
||||
None => chunk.to_string(),
|
||||
};
|
||||
// Always prefix the content with a sign char for consistent gutters
|
||||
let sign_char = sign_opt.unwrap_or(' ');
|
||||
let display_chunk = format!("{sign_char}{chunk}");
|
||||
|
||||
let content_span = match line_style {
|
||||
Some(style) => RtSpan::styled(display_chunk, style),
|
||||
@@ -344,7 +340,7 @@ fn push_wrapped_diff_line(
|
||||
if let Some(style) = line_style {
|
||||
line.style = line.style.patch(style);
|
||||
}
|
||||
// Apply a very light background tint for added/removed lines for readability
|
||||
// Apply themed tinted background for added/removed lines
|
||||
if matches!(kind, DiffLineType::Insert | DiffLineType::Delete) {
|
||||
let tint = match kind {
|
||||
DiffLineType::Insert => success_tint(),
|
||||
@@ -356,8 +352,9 @@ fn push_wrapped_diff_line(
|
||||
lines.push(line);
|
||||
first = false;
|
||||
} else {
|
||||
// Continuation lines keep a space for the sign column so content aligns
|
||||
let hang_prefix = format!(
|
||||
"{indent}{}{}",
|
||||
"{indent}{}{} ",
|
||||
" ".repeat(ln_str.len()),
|
||||
" ".repeat(gap_after_ln)
|
||||
);
|
||||
|
||||
@@ -495,7 +495,7 @@ impl HistoryCell for LoadingCell {
|
||||
vec![
|
||||
Line::from(""),
|
||||
Line::from(vec![
|
||||
Span::styled("⟳ ", Style::default().fg(Color::Cyan)),
|
||||
Span::styled("⟳ ", Style::default().fg(crate::colors::info())),
|
||||
Span::from("Loading..."),
|
||||
]),
|
||||
Line::from(""),
|
||||
@@ -852,7 +852,7 @@ fn output_lines(
|
||||
"> ",
|
||||
Style::default()
|
||||
.add_modifier(Modifier::DIM)
|
||||
.fg(Color::Gray),
|
||||
.fg(crate::colors::text_dim()),
|
||||
),
|
||||
];
|
||||
let escaped_line = ansi_escape_line(line);
|
||||
|
||||
@@ -238,7 +238,7 @@ pub async fn run_main(
|
||||
} else if cfg!(target_os = "macos")
|
||||
&& (exe.starts_with("/opt/homebrew") || exe.starts_with("/usr/local"))
|
||||
{
|
||||
let brew_cmd = "brew upgrade coder";
|
||||
let brew_cmd = "brew upgrade code";
|
||||
eprintln!("Run {} to update.", brew_cmd.cyan().on_black());
|
||||
} else {
|
||||
eprintln!(
|
||||
|
||||
+5
-5
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "coder-monorepo",
|
||||
"name": "code-monorepo",
|
||||
"private": true,
|
||||
"description": "Tools for repo-wide maintenance.",
|
||||
"scripts": {
|
||||
"format": "prettier --check *.json *.md .github/workflows/*.yml **/*.js",
|
||||
"format:fix": "prettier --write *.json *.md .github/workflows/*.yml **/*.js",
|
||||
"build": "cd codex-rs && cargo build --release --bin coder --bin coder-tui --bin coder-exec",
|
||||
"build:dev": "cd codex-rs && cargo build --bin coder --bin coder-tui --bin coder-exec",
|
||||
"build:quick": "cd codex-rs && cargo build --release --bin coder",
|
||||
"test:local": "cd codex-cli && npm link && coder --version"
|
||||
"build": "cd codex-rs && cargo build --release --bin code --bin code-tui --bin code-exec",
|
||||
"build:dev": "cd codex-rs && cargo build --bin code --bin code-tui --bin code-exec",
|
||||
"build:quick": "cd codex-rs && cargo build --release --bin code",
|
||||
"test:local": "cd codex-cli && npm link && code --version"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^3.5.3"
|
||||
|
||||
Reference in New Issue
Block a user