chore: finish rename

This commit is contained in:
INX "Xenon" 2026-01-28 21:50:08 +08:00
parent 9a16f9a22e
commit ae33fab9c1
Signed by: inx
SSH key fingerprint: SHA256:oEFbclBdeqw4M09C3hfnDej0ioZdzZW6BKxsZH6quX8
12 changed files with 72 additions and 72 deletions

View file

@ -8,7 +8,7 @@ license = "BSD-2-Clause"
readme = "README.md" readme = "README.md"
homepage = "https://github.com/dotinx/naj" homepage = "https://github.com/dotinx/naj"
repository = "https://github.com/dotinx/naj" repository = "https://github.com/dotinx/naj"
categories = ["command-line-utilities", "development-tools::cargo-plugins"] categories = ["command-line-utilities"]
exclude = ["tests/", "scripts/",] exclude = ["tests/", "scripts/",]

View file

@ -88,8 +88,8 @@ On the first run, Naj will automatically create these directories and a default
### Environment Variables ### Environment Variables
* `GOSH_CONFIG_PATH`: Override the config directory (Useful for NixOS or testing). * `NAJ_CONFIG_PATH`: Override the config directory (Useful for NixOS or testing).
* `GOSH_MOCKING=1`: Dry-run mode. Prints the constructed `git` command to stderr instead of executing it. * `NAJ_MOCKING=1`: Dry-run mode. Prints the constructed `git` command to stderr instead of executing it.
## 🔒 Security Design: Blind Injection ## 🔒 Security Design: Blind Injection

View file

@ -21,7 +21,7 @@ The tests in this directory focus on end-to-end (E2E) validation, ensuring that
To run these tests locally, ensure you have the following installed: To run these tests locally, ensure you have the following installed:
- **Bash**: Most scripts use standard Bash features. - **Bash**: Most scripts use standard Bash features.
- **Git**: Version 2.34+ is required for SSH signing tests. - **Git**: Version 2.34+ is required for SSH signing tests.
- **Naj**: The `naj` binary must be available in your PATH or accessible via the `GOSH_CMD` environment variable. - **Naj**: The `naj` binary must be available in your PATH or accessible via the `NAJ_CMD` environment variable.
## Running Tests ## Running Tests
@ -46,7 +46,7 @@ Each script initializes a sandbox in `/tmp/naj_test_*` or similar, ensuring that
## Design Principles ## Design Principles
1. **Isolation**: All tests use a dedicated `GOSH_CONFIG_PATH` and temporary directories to ensure side-effect-free execution. 1. **Isolation**: All tests use a dedicated `NAJ_CONFIG_PATH` and temporary directories to ensure side-effect-free execution.
2. **Assertions**: Scripts use exit codes and explicit checks to verify expected outcomes (e.g., checking `git cat-file` for signatures). 2. **Assertions**: Scripts use exit codes and explicit checks to verify expected outcomes (e.g., checking `git cat-file` for signatures).
3. **Readability**: Log levels (STEP, INFO, ERROR) are used to provide clear feedback during execution. 3. **Readability**: Log levels (STEP, INFO, ERROR) are used to provide clear feedback during execution.
@ -55,5 +55,5 @@ Each script initializes a sandbox in `/tmp/naj_test_*` or similar, ensuring that
When adding a new test script: When adding a new test script:
- Use `set -e` to ensure the script fails on the first error. - Use `set -e` to ensure the script fails on the first error.
- Use a dedicated sandbox directory for all temporary files. - Use a dedicated sandbox directory for all temporary files.
- Export `GOSH_CONFIG_PATH` to point into your sandbox. - Export `NAJ_CONFIG_PATH` to point into your sandbox.
- Document the scenario and expected results in the script header. - Document the scenario and expected results in the script header.

View file

@ -2,11 +2,11 @@
set -e set -e
# --- 0. 环境与工具准备 --- # --- 0. 环境与工具准备 ---
GOSH_CMD="naj" # 确保已编译或 alias 到 cargo run NAJ_CMD="naj" # 确保已编译或 alias 到 cargo run
BASE_DIR="/tmp/alice_demo_signed" BASE_DIR="/tmp/alice_demo_signed"
# 隔离 Naj 配置 # 隔离 Naj 配置
export GOSH_CONFIG_PATH="$BASE_DIR/config" export NAJ_CONFIG_PATH="$BASE_DIR/config"
# 隔离 SSH 密钥目录 # 隔离 SSH 密钥目录
SSH_DIR="$BASE_DIR/ssh_keys" SSH_DIR="$BASE_DIR/ssh_keys"
# 模拟仓库目录 # 模拟仓库目录
@ -29,7 +29,7 @@ info "Git Version: $GIT_VERSION (SSH Signing requires 2.34+)"
# --- 1. 清理与沙盒初始化 --- # --- 1. 清理与沙盒初始化 ---
log "Initializing Sandbox at $BASE_DIR..." log "Initializing Sandbox at $BASE_DIR..."
rm -rf "$BASE_DIR" rm -rf "$BASE_DIR"
mkdir -p "$GOSH_CONFIG_PATH" mkdir -p "$NAJ_CONFIG_PATH"
mkdir -p "$SSH_DIR" mkdir -p "$SSH_DIR"
mkdir -p "$REPO_DIR" mkdir -p "$REPO_DIR"
@ -48,11 +48,11 @@ info "Generated Personal Key: $SSH_DIR/id_personal"
log "Creating Naj Profiles..." log "Creating Naj Profiles..."
# 3.1 创建基础 Work Profile # 3.1 创建基础 Work Profile
$GOSH_CMD -c "Alice Work" "alice@contoso.com" "work" $NAJ_CMD -c "Alice Work" "alice@contoso.com" "work"
# 3.2 手动追加 SSH 签名配置到 Work Profile # 3.2 手动追加 SSH 签名配置到 Work Profile
# 这里演示了 Naj 的灵活性:你可以手动编辑生成的 .gitconfig # 这里演示了 Naj 的灵活性:你可以手动编辑生成的 .gitconfig
WORK_PROFILE="$GOSH_CONFIG_PATH/profiles/work.gitconfig" WORK_PROFILE="$NAJ_CONFIG_PATH/profiles/work.gitconfig"
cat >> "$WORK_PROFILE" <<EOF cat >> "$WORK_PROFILE" <<EOF
[gpg] [gpg]
format = ssh format = ssh
@ -67,8 +67,8 @@ EOF
info "Configured Work Profile with SSH Signing" info "Configured Work Profile with SSH Signing"
# 3.3 创建并配置 Personal Profile # 3.3 创建并配置 Personal Profile
$GOSH_CMD -c "Alice Personal" "alice@alice.com" "personal" $NAJ_CMD -c "Alice Personal" "alice@alice.com" "personal"
PERSONAL_PROFILE="$GOSH_CONFIG_PATH/profiles/personal.gitconfig" PERSONAL_PROFILE="$NAJ_CONFIG_PATH/profiles/personal.gitconfig"
cat >> "$PERSONAL_PROFILE" <<EOF cat >> "$PERSONAL_PROFILE" <<EOF
[gpg] [gpg]
format = ssh format = ssh
@ -92,7 +92,7 @@ git init --bare --quiet "backend.git"
# 使用 Naj 克隆 (Clone -> Infer -> Switch) # 使用 Naj 克隆 (Clone -> Infer -> Switch)
# 注意:这里我们 Clone 本地路径,但 core.sshCommand 依然会被配置进去,这是符合预期的 # 注意:这里我们 Clone 本地路径,但 core.sshCommand 依然会被配置进去,这是符合预期的
$GOSH_CMD work clone "$REPO_DIR/backend.git" work-backend $NAJ_CMD work clone "$REPO_DIR/backend.git" work-backend
cd work-backend cd work-backend
# 提交代码 # 提交代码
@ -123,7 +123,7 @@ git init --quiet "oss-project"
cd oss-project cd oss-project
# 切换到 Personal # 切换到 Personal
$GOSH_CMD personal $NAJ_CMD personal
# 提交 # 提交
touch fun.txt touch fun.txt
@ -149,7 +149,7 @@ log "Scenario C: Ephemeral Execution (Security Check)"
# 当前在 oss-project (Personal),我们想用 Work 身份签个名 # 当前在 oss-project (Personal),我们想用 Work 身份签个名
# 执行 naj work commit # 执行 naj work commit
$GOSH_CMD work commit --allow-empty -m "Hotfix via Exec" > /dev/null $NAJ_CMD work commit --allow-empty -m "Hotfix via Exec" > /dev/null
# 验证最后一次提交的签名 # 验证最后一次提交的签名
# 注意Exec 模式下Naj 会通过 -c user.signingkey="" 先清空,再注入 work profile # 注意Exec 模式下Naj 会通过 -c user.signingkey="" 先清空,再注入 work profile

View file

@ -2,11 +2,11 @@
set -e set -e
# --- 0. 环境与工具准备 --- # --- 0. 环境与工具准备 ---
GOSH_CMD="naj" # 确保已编译或 alias 到 cargo run NAJ_CMD="naj" # 确保已编译或 alias 到 cargo run
BASE_DIR="/tmp/alice_demo_debug" BASE_DIR="/tmp/alice_demo_debug"
# 隔离 Naj 配置 # 隔离 Naj 配置
export GOSH_CONFIG_PATH="$BASE_DIR/config" export NAJ_CONFIG_PATH="$BASE_DIR/config"
# 隔离 SSH 密钥目录 # 隔离 SSH 密钥目录
SSH_DIR="$BASE_DIR/ssh_keys" SSH_DIR="$BASE_DIR/ssh_keys"
# 模拟仓库目录 # 模拟仓库目录
@ -43,7 +43,7 @@ info "Git Version: $GIT_VERSION (SSH Signing requires 2.34+)"
# --- 1. 清理与沙盒初始化 --- # --- 1. 清理与沙盒初始化 ---
log "Initializing Sandbox at $BASE_DIR..." log "Initializing Sandbox at $BASE_DIR..."
rm -rf "$BASE_DIR" rm -rf "$BASE_DIR"
mkdir -p "$GOSH_CONFIG_PATH" mkdir -p "$NAJ_CONFIG_PATH"
mkdir -p "$SSH_DIR" mkdir -p "$SSH_DIR"
mkdir -p "$REPO_DIR" mkdir -p "$REPO_DIR"
@ -58,8 +58,8 @@ info "Generated Personal Key: .../id_personal"
log "Creating Naj Profiles..." log "Creating Naj Profiles..."
# 3.1 Work Profile # 3.1 Work Profile
$GOSH_CMD -c "Alice Work" "alice@contoso.com" "work" $NAJ_CMD -c "Alice Work" "alice@contoso.com" "work"
WORK_PROFILE="$GOSH_CONFIG_PATH/profiles/work.gitconfig" WORK_PROFILE="$NAJ_CONFIG_PATH/profiles/work.gitconfig"
cat >> "$WORK_PROFILE" <<EOF cat >> "$WORK_PROFILE" <<EOF
[gpg] [gpg]
format = ssh format = ssh
@ -73,8 +73,8 @@ EOF
info "Configured Work Profile (SSH Signing Enabled)" info "Configured Work Profile (SSH Signing Enabled)"
# 3.2 Personal Profile # 3.2 Personal Profile
$GOSH_CMD -c "Alice Personal" "alice@alice.com" "personal" $NAJ_CMD -c "Alice Personal" "alice@alice.com" "personal"
PERSONAL_PROFILE="$GOSH_CONFIG_PATH/profiles/personal.gitconfig" PERSONAL_PROFILE="$NAJ_CONFIG_PATH/profiles/personal.gitconfig"
cat >> "$PERSONAL_PROFILE" <<EOF cat >> "$PERSONAL_PROFILE" <<EOF
[gpg] [gpg]
format = ssh format = ssh
@ -96,7 +96,7 @@ git init --bare --quiet "backend.git"
# 使用 Naj 克隆 # 使用 Naj 克隆
info "Running: naj work clone ..." info "Running: naj work clone ..."
$GOSH_CMD work clone "$REPO_DIR/backend.git" work-backend $NAJ_CMD work clone "$REPO_DIR/backend.git" work-backend
cd work-backend cd work-backend
# 提交代码 # 提交代码
@ -115,7 +115,7 @@ cd oss-project
# 切换到 Personal # 切换到 Personal
info "Running: naj personal (Switching...)" info "Running: naj personal (Switching...)"
$GOSH_CMD personal $NAJ_CMD personal
# 提交 # 提交
touch fun.txt touch fun.txt
@ -132,7 +132,7 @@ info "Executing 'naj work commit' (Should use Work Identity temporarily)..."
# 执行 naj work commit # 执行 naj work commit
# 注意:这里我们不再重定向到 /dev/null我们要看 git 的原生输出 # 注意:这里我们不再重定向到 /dev/null我们要看 git 的原生输出
$GOSH_CMD work commit --allow-empty -m "Hotfix via Exec (Scenario C)" $NAJ_CMD work commit --allow-empty -m "Hotfix via Exec (Scenario C)"
# 🔍 查看日志 # 🔍 查看日志
# 这里的重点是: # 这里的重点是:

View file

@ -2,11 +2,11 @@
set -e set -e
# --- 0. 全局配置 --- # --- 0. 全局配置 ---
GOSH_CMD="naj" NAJ_CMD="naj"
BASE_DIR="/tmp/naj_collab_demo" BASE_DIR="/tmp/naj_collab_demo"
# 隔离 Naj 配置 # 隔离 Naj 配置
export GOSH_CONFIG_PATH="$BASE_DIR/config" export NAJ_CONFIG_PATH="$BASE_DIR/config"
# 隔离 SSH 密钥目录 # 隔离 SSH 密钥目录
SSH_DIR="$BASE_DIR/ssh_keys" SSH_DIR="$BASE_DIR/ssh_keys"
# 模拟仓库目录 # 模拟仓库目录
@ -58,7 +58,7 @@ verify_last_commit() {
# --- 1. 初始化沙盒 --- # --- 1. 初始化沙盒 ---
log "Initializing Sandbox..." log "Initializing Sandbox..."
rm -rf "$BASE_DIR" rm -rf "$BASE_DIR"
mkdir -p "$GOSH_CONFIG_PATH/profiles" mkdir -p "$NAJ_CONFIG_PATH/profiles"
mkdir -p "$SSH_DIR" mkdir -p "$SSH_DIR"
mkdir -p "$REPO_DIR" mkdir -p "$REPO_DIR"
@ -83,8 +83,8 @@ ok "Generated Bob's Key & Added to Trust Store"
log "Configuring Naj Profiles..." log "Configuring Naj Profiles..."
# --> Alice Profile # --> Alice Profile
$GOSH_CMD -c "Alice Work" "alice@contoso.com" "alice_work" $NAJ_CMD -c "Alice Work" "alice@contoso.com" "alice_work"
cat >> "$GOSH_CONFIG_PATH/profiles/alice_work.gitconfig" <<EOF cat >> "$NAJ_CONFIG_PATH/profiles/alice_work.gitconfig" <<EOF
[gpg] [gpg]
format = ssh format = ssh
[user] [user]
@ -97,8 +97,8 @@ EOF
ok "Profile 'alice_work' created" ok "Profile 'alice_work' created"
# --> Bob Profile # --> Bob Profile
$GOSH_CMD -c "Bob Partner" "bob@partner.org" "bob_partner" $NAJ_CMD -c "Bob Partner" "bob@partner.org" "bob_partner"
cat >> "$GOSH_CONFIG_PATH/profiles/bob_partner.gitconfig" <<EOF cat >> "$NAJ_CONFIG_PATH/profiles/bob_partner.gitconfig" <<EOF
[gpg] [gpg]
format = ssh format = ssh
[user] [user]
@ -121,7 +121,7 @@ cd project-alpha
# 1. Alice 初始化项目 # 1. Alice 初始化项目
echo ">>> [Commit 1] Alice starts the project" echo ">>> [Commit 1] Alice starts the project"
$GOSH_CMD alice_work $NAJ_CMD alice_work
touch README.md touch README.md
git add README.md git add README.md
git commit -m "Init Project Alpha" > /dev/null git commit -m "Init Project Alpha" > /dev/null
@ -129,14 +129,14 @@ verify_last_commit "alice@contoso.com" "alice_work"
# 2. Bob 进来修改 (模拟同一台机器切换身份) # 2. Bob 进来修改 (模拟同一台机器切换身份)
echo ">>> [Commit 2] Bob adds features" echo ">>> [Commit 2] Bob adds features"
$GOSH_CMD bob_partner $NAJ_CMD bob_partner
echo "Feature by Bob" >> README.md echo "Feature by Bob" >> README.md
git commit -am "Bob adds feature" > /dev/null git commit -am "Bob adds feature" > /dev/null
verify_last_commit "bob@partner.org" "bob_partner" verify_last_commit "bob@partner.org" "bob_partner"
# 3. Alice 审查并修改 # 3. Alice 审查并修改
echo ">>> [Commit 3] Alice reviews and updates" echo ">>> [Commit 3] Alice reviews and updates"
$GOSH_CMD alice_work $NAJ_CMD alice_work
echo "Reviewed by Alice" >> README.md echo "Reviewed by Alice" >> README.md
git commit -am "Alice review" > /dev/null git commit -am "Alice review" > /dev/null
verify_last_commit "alice@contoso.com" "alice_work" verify_last_commit "alice@contoso.com" "alice_work"
@ -149,7 +149,7 @@ git init --quiet project-beta
cd project-beta cd project-beta
# 1. Bob 拥有这个项目 # 1. Bob 拥有这个项目
$GOSH_CMD bob_partner $NAJ_CMD bob_partner
touch main.rs touch main.rs
git add main.rs git add main.rs
git commit -m "Bob starts Beta" > /dev/null git commit -m "Bob starts Beta" > /dev/null
@ -163,7 +163,7 @@ echo "// Hotfix" >> main.rs
git add main.rs git add main.rs
# 这里是关键测试Exec 模式下的签名注入 # 这里是关键测试Exec 模式下的签名注入
$GOSH_CMD alice_work commit -m "Alice hotfix" > /dev/null $NAJ_CMD alice_work commit -m "Alice hotfix" > /dev/null
# 验证:虽然此时 .git/config 指向 Bob但这个 Commit 必须是 Alice 签名的 # 验证:虽然此时 .git/config 指向 Bob但这个 Commit 必须是 Alice 签名的
verify_last_commit "alice@contoso.com" "alice_work" verify_last_commit "alice@contoso.com" "alice_work"

View file

@ -2,9 +2,9 @@
set -e set -e
# --- 配置 --- # --- 配置 ---
GOSH_CMD="naj" NAJ_CMD="naj"
BASE_DIR="/tmp/naj_edge_test" BASE_DIR="/tmp/naj_edge_test"
export GOSH_CONFIG_PATH="$BASE_DIR/config" export NAJ_CONFIG_PATH="$BASE_DIR/config"
REPO_DIR="$BASE_DIR/repos" REPO_DIR="$BASE_DIR/repos"
# 颜色 # 颜色
@ -15,11 +15,11 @@ log() { echo -e "\n\033[0;34m[TEST] $1\033[0m"; }
# --- 初始化 --- # --- 初始化 ---
rm -rf "$BASE_DIR" rm -rf "$BASE_DIR"
mkdir -p "$GOSH_CONFIG_PATH" "$REPO_DIR" mkdir -p "$NAJ_CONFIG_PATH" "$REPO_DIR"
# 创建一个 Profile # 创建一个 Profile
log "Creating Profile..." log "Creating Profile..."
$GOSH_CMD -c "Edge User" "edge@test.com" "edge" $NAJ_CMD -c "Edge User" "edge@test.com" "edge"
# --- 测试 1: 子目录执行 --- # --- 测试 1: 子目录执行 ---
log "Scenario 1: Running from a deep subdirectory" log "Scenario 1: Running from a deep subdirectory"
@ -33,7 +33,7 @@ echo "Current dir: $(pwd)"
echo "Executing 'naj edge' from subdirectory..." echo "Executing 'naj edge' from subdirectory..."
# 执行 switch # 执行 switch
$GOSH_CMD edge $NAJ_CMD edge
# 验证 # 验证
# 我们需要回到根目录看 config或者直接用 git config # 我们需要回到根目录看 config或者直接用 git config
@ -57,7 +57,7 @@ git init --quiet
echo "Current dir: $(pwd)" echo "Current dir: $(pwd)"
echo "Executing 'naj edge'..." echo "Executing 'naj edge'..."
$GOSH_CMD edge $NAJ_CMD edge
# 验证 # 验证
CONFIG_EMAIL=$(git config user.email) CONFIG_EMAIL=$(git config user.email)

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# --- 准备 --- # --- 准备 ---
GOSH_CMD="naj" # 确保已编译或 alias NAJ_CMD="naj" # 确保已编译或 alias
BASE_DIR="/tmp/naj_security_test" BASE_DIR="/tmp/naj_security_test"
UNSAFE_REPO="$BASE_DIR/root_owned_repo" UNSAFE_REPO="$BASE_DIR/root_owned_repo"
@ -21,7 +21,7 @@ echo "[TEST] Running 'naj' in a dubious ownership repo..."
cd "$UNSAFE_REPO" cd "$UNSAFE_REPO"
# 2. 尝试运行 naj (期望失败) # 2. 尝试运行 naj (期望失败)
if $GOSH_CMD -l > /dev/null 2>&1; then if $NAJ_CMD -l > /dev/null 2>&1; then
# 注意naj -l 不需要 git 仓库,所以应该成功。 # 注意naj -l 不需要 git 仓库,所以应该成功。
# 我们需要测 switch 或 exec这需要 git 上下文 # 我们需要测 switch 或 exec这需要 git 上下文
echo " (naj list works, which is fine)" echo " (naj list works, which is fine)"
@ -29,7 +29,7 @@ fi
echo "Attempting to switch profile..." echo "Attempting to switch profile..."
# 捕获输出 # 捕获输出
OUTPUT=$($GOSH_CMD testprofile 2>&1 || true) OUTPUT=$($NAJ_CMD testprofile 2>&1 || true)
# 3. 验证结果 # 3. 验证结果
if echo "$OUTPUT" | grep -q "fatal: detected dubious ownership"; then if echo "$OUTPUT" | grep -q "fatal: detected dubious ownership"; then

View file

@ -29,7 +29,7 @@ impl Default for NajConfig {
} }
pub fn get_config_root() -> Result<PathBuf> { pub fn get_config_root() -> Result<PathBuf> {
if let Ok(path) = std::env::var("GOSH_CONFIG_PATH") { if let Ok(path) = std::env::var("NAJ_CONFIG_PATH") {
return Ok(PathBuf::from(path)); return Ok(PathBuf::from(path));
} }
let config_dir = dirs::config_dir().ok_or_else(|| anyhow::anyhow!("Could not find config directory"))?; let config_dir = dirs::config_dir().ok_or_else(|| anyhow::anyhow!("Could not find config directory"))?;
@ -54,8 +54,8 @@ fn initialize_config(root: &Path, config_path: &Path) -> Result<NajConfig> {
fs::create_dir_all(root).context("Failed to create config root")?; fs::create_dir_all(root).context("Failed to create config root")?;
// Determine default profile_dir based on environment to support testing isolation // Determine default profile_dir based on environment to support testing isolation
let profile_dir_str = if let Ok(env_path) = std::env::var("GOSH_CONFIG_PATH") { let profile_dir_str = if let Ok(env_path) = std::env::var("NAJ_CONFIG_PATH") {
// If GOSH_CONFIG_PATH is set, default profile dir should be inside it for isolation // If NAJ_CONFIG_PATH is set, default profile dir should be inside it for isolation
let p = PathBuf::from(env_path).join("profiles"); let p = PathBuf::from(env_path).join("profiles");
// Use forward slashes for TOML consistency if possible, though PathBuf handles it. // Use forward slashes for TOML consistency if possible, though PathBuf handles it.
// On Windows, replace backslashes to avoid escape issues in TOML string if not raw // On Windows, replace backslashes to avoid escape issues in TOML string if not raw

View file

@ -38,7 +38,7 @@ fn get_profile_path(config: &NajConfig, id: &str) -> Result<PathBuf> {
} }
fn is_mocking() -> bool { fn is_mocking() -> bool {
std::env::var("GOSH_MOCKING").is_ok() std::env::var("NAJ_MOCKING").is_ok()
} }
fn run_command(cmd: &mut Command) -> Result<()> { fn run_command(cmd: &mut Command) -> Result<()> {

View file

@ -7,9 +7,9 @@ fn test_config_initialization() -> Result<(), Box<dyn std::error::Error>> {
let temp_dir = TempDir::new()?; let temp_dir = TempDir::new()?;
let config_path = temp_dir.path().join("config"); let config_path = temp_dir.path().join("config");
// Run naj with GOSH_CONFIG_PATH set to temp dir // Run naj with NAJ_CONFIG_PATH set to temp dir
let mut cmd = Command::new(env!("CARGO_BIN_EXE_naj")); let mut cmd = Command::new(env!("CARGO_BIN_EXE_naj"));
cmd.env("GOSH_CONFIG_PATH", &config_path) cmd.env("NAJ_CONFIG_PATH", &config_path)
.arg("-l") // Trigger config load using list flag (not positional "list" profile) .arg("-l") // Trigger config load using list flag (not positional "list" profile)
.assert() .assert()
.success(); .success();
@ -27,7 +27,7 @@ fn test_profile_creation_and_listing() -> Result<(), Box<dyn std::error::Error>>
let config_path = temp_dir.path(); let config_path = temp_dir.path();
let mut cmd = Command::new(env!("CARGO_BIN_EXE_naj")); let mut cmd = Command::new(env!("CARGO_BIN_EXE_naj"));
cmd.env("GOSH_CONFIG_PATH", config_path) cmd.env("NAJ_CONFIG_PATH", config_path)
.args(&["-c", "Test User", "test@example.com", "test_user"]) .args(&["-c", "Test User", "test@example.com", "test_user"])
.assert() .assert()
.success(); .success();
@ -41,7 +41,7 @@ fn test_profile_creation_and_listing() -> Result<(), Box<dyn std::error::Error>>
// Verify list // Verify list
let mut cmd_list = Command::new(env!("CARGO_BIN_EXE_naj")); let mut cmd_list = Command::new(env!("CARGO_BIN_EXE_naj"));
cmd_list.env("GOSH_CONFIG_PATH", config_path) cmd_list.env("NAJ_CONFIG_PATH", config_path)
.arg("-l") .arg("-l")
.assert() .assert()
.success() .success()
@ -57,14 +57,14 @@ fn test_duplicate_creation_failure() -> Result<(), Box<dyn std::error::Error>> {
// Create first // Create first
Command::new(env!("CARGO_BIN_EXE_naj")) Command::new(env!("CARGO_BIN_EXE_naj"))
.env("GOSH_CONFIG_PATH", config_path) .env("NAJ_CONFIG_PATH", config_path)
.args(&["-c", "User", "u@e.com", "dup_test"]) .args(&["-c", "User", "u@e.com", "dup_test"])
.assert() .assert()
.success(); .success();
// Create duplicate // Create duplicate
Command::new(env!("CARGO_BIN_EXE_naj")) Command::new(env!("CARGO_BIN_EXE_naj"))
.env("GOSH_CONFIG_PATH", config_path) .env("NAJ_CONFIG_PATH", config_path)
.args(&["-c", "User2", "u2@e.com", "dup_test"]) .args(&["-c", "User2", "u2@e.com", "dup_test"])
.assert() .assert()
.failure(); // Should fail .failure(); // Should fail
@ -80,7 +80,7 @@ fn test_remove_profile() -> Result<(), Box<dyn std::error::Error>> {
// Create // Create
Command::new(env!("CARGO_BIN_EXE_naj")) Command::new(env!("CARGO_BIN_EXE_naj"))
.env("GOSH_CONFIG_PATH", config_path) .env("NAJ_CONFIG_PATH", config_path)
.args(&["-c", "User", "u@e.com", "rem_test"]) .args(&["-c", "User", "u@e.com", "rem_test"])
.assert() .assert()
.success(); .success();
@ -88,7 +88,7 @@ fn test_remove_profile() -> Result<(), Box<dyn std::error::Error>> {
// Remove // Remove
Command::new(env!("CARGO_BIN_EXE_naj")) Command::new(env!("CARGO_BIN_EXE_naj"))
.env("GOSH_CONFIG_PATH", config_path) .env("NAJ_CONFIG_PATH", config_path)
.args(&["-r", "rem_test"]) .args(&["-r", "rem_test"])
.assert() .assert()
.success(); .success();
@ -96,7 +96,7 @@ fn test_remove_profile() -> Result<(), Box<dyn std::error::Error>> {
// Remove non-existent // Remove non-existent
Command::new(env!("CARGO_BIN_EXE_naj")) Command::new(env!("CARGO_BIN_EXE_naj"))
.env("GOSH_CONFIG_PATH", config_path) .env("NAJ_CONFIG_PATH", config_path)
.args(&["-r", "rem_test"]) .args(&["-r", "rem_test"])
.assert() .assert()
.failure(); .failure();
@ -111,15 +111,15 @@ fn test_exec_dry_run_injection_strict() -> Result<(), Box<dyn std::error::Error>
// Create a profile first // Create a profile first
Command::new(env!("CARGO_BIN_EXE_naj")) Command::new(env!("CARGO_BIN_EXE_naj"))
.env("GOSH_CONFIG_PATH", config_path) .env("NAJ_CONFIG_PATH", config_path)
.args(&["-c", "Test", "test@e.com", "p1"]) .args(&["-c", "Test", "test@e.com", "p1"])
.assert() .assert()
.success(); .success();
// Run exec with mocking // Run exec with mocking
let mut cmd = Command::new(env!("CARGO_BIN_EXE_naj")); let mut cmd = Command::new(env!("CARGO_BIN_EXE_naj"));
cmd.env("GOSH_CONFIG_PATH", config_path) cmd.env("NAJ_CONFIG_PATH", config_path)
.env("GOSH_MOCKING", "1") .env("NAJ_MOCKING", "1")
.args(&["p1", "commit", "-m", "foo"]) .args(&["p1", "commit", "-m", "foo"])
.assert() .assert()
.success() .success()
@ -151,14 +151,14 @@ fn test_switch_mode_persistent() -> Result<(), Box<dyn std::error::Error>> {
// Create profile // Create profile
Command::new(env!("CARGO_BIN_EXE_naj")) Command::new(env!("CARGO_BIN_EXE_naj"))
.env("GOSH_CONFIG_PATH", &config_path) .env("NAJ_CONFIG_PATH", &config_path)
.args(&["-c", "Switch User", "s@e.com", "switch_test"]) .args(&["-c", "Switch User", "s@e.com", "switch_test"])
.assert() .assert()
.success(); .success();
// Switch // Switch
Command::new(env!("CARGO_BIN_EXE_naj")) Command::new(env!("CARGO_BIN_EXE_naj"))
.env("GOSH_CONFIG_PATH", &config_path) .env("NAJ_CONFIG_PATH", &config_path)
.current_dir(&repo_dir) .current_dir(&repo_dir)
.arg("switch_test") .arg("switch_test")
.assert() .assert()
@ -198,14 +198,14 @@ fn test_switch_force_mode_sanitization() -> Result<(), Box<dyn std::error::Error
// Create profile // Create profile
Command::new(env!("CARGO_BIN_EXE_naj")) Command::new(env!("CARGO_BIN_EXE_naj"))
.env("GOSH_CONFIG_PATH", &config_path) .env("NAJ_CONFIG_PATH", &config_path)
.args(&["-c", "Force User", "f@e.com", "force_test"]) .args(&["-c", "Force User", "f@e.com", "force_test"])
.assert() .assert()
.success(); .success();
// Force Switch // Force Switch
Command::new(env!("CARGO_BIN_EXE_naj")) Command::new(env!("CARGO_BIN_EXE_naj"))
.env("GOSH_CONFIG_PATH", &config_path) .env("NAJ_CONFIG_PATH", &config_path)
.current_dir(&repo_dir) .current_dir(&repo_dir)
.args(&["force_test", "-f"]) .args(&["force_test", "-f"])
.assert() .assert()
@ -241,7 +241,7 @@ fn test_setup_mode_local_clone() -> Result<(), Box<dyn std::error::Error>> {
// 2. Create Profile // 2. Create Profile
Command::new(env!("CARGO_BIN_EXE_naj")) Command::new(env!("CARGO_BIN_EXE_naj"))
.env("GOSH_CONFIG_PATH", &config_path) .env("NAJ_CONFIG_PATH", &config_path)
.args(&["-c", "CloneUser", "c@e.com", "clone_test"]) .args(&["-c", "CloneUser", "c@e.com", "clone_test"])
.assert() .assert()
.success(); .success();
@ -255,7 +255,7 @@ fn test_setup_mode_local_clone() -> Result<(), Box<dyn std::error::Error>> {
let dest_repo_name = "dest_repo"; let dest_repo_name = "dest_repo";
Command::new(env!("CARGO_BIN_EXE_naj")) Command::new(env!("CARGO_BIN_EXE_naj"))
.env("GOSH_CONFIG_PATH", &config_path) .env("NAJ_CONFIG_PATH", &config_path)
.current_dir(temp_dir.path()) // Execute in temp root .current_dir(temp_dir.path()) // Execute in temp root
.args(&["clone_test", "clone", source_repo.to_str().unwrap(), dest_repo_name]) .args(&["clone_test", "clone", source_repo.to_str().unwrap(), dest_repo_name])
.assert() .assert()

View file

@ -16,15 +16,15 @@ fn test_switch_force_mocking() -> Result<(), Box<dyn std::error::Error>> {
// Create profile // Create profile
Command::new(env!("CARGO_BIN_EXE_naj")) Command::new(env!("CARGO_BIN_EXE_naj"))
.env("GOSH_CONFIG_PATH", &config_path) .env("NAJ_CONFIG_PATH", &config_path)
.args(&["-c", "User", "u@e.com", "mock_test"]) .args(&["-c", "User", "u@e.com", "mock_test"])
.assert() .assert()
.success(); .success();
// Run force switch with mocking // Run force switch with mocking
Command::new(env!("CARGO_BIN_EXE_naj")) Command::new(env!("CARGO_BIN_EXE_naj"))
.env("GOSH_CONFIG_PATH", &config_path) .env("NAJ_CONFIG_PATH", &config_path)
.env("GOSH_MOCKING", "1") .env("NAJ_MOCKING", "1")
.current_dir(&repo_dir) .current_dir(&repo_dir)
.args(&["mock_test", "-f"]) .args(&["mock_test", "-f"])
.assert() .assert()