cueloop 0.5.0

A Rust CLI for managing AI agent loops with a structured JSON task queue
Documentation
//! Unit tests for config resolution, merging, and path behavior.
//!
//! Purpose:
//! - Unit tests for config resolution, merging, and path behavior.
//!
//! Responsibilities:
//! - Provide shared fixtures for config integration-style unit tests.
//! - Delegate path, validation, merge, and JSONC behavior to focused modules.
//!
//! Scope:
//! - Limited to this file's owning feature boundary.
//!
//! Usage:
//! - Used through the crate module tree or integration test harness.
//!
//! Invariants/Assumptions:
//! - Keep behavior aligned with CueLoop's canonical CLI, machine-contract, and queue semantics.

use cueloop::config;
use cueloop::contracts::{
    AgentConfig, CiGateConfig, Config, GitRevertMode, Model, NotificationConfig, ProjectType,
    QueueConfig, ReasoningEffort, Runner, RunnerRetryConfig, WebhookConfig,
};
use serial_test::serial;
use std::env;
use std::fs;
use std::path::PathBuf;
use tempfile::TempDir;
use test_support::env_lock;

mod test_support;

// Helper to create a minimal current runtime directory.
fn setup_cueloop_dir(dir: &TempDir) -> PathBuf {
    let cueloop_dir = dir.path().join(".cueloop");
    fs::create_dir_all(&cueloop_dir).expect("create .cueloop dir");
    cueloop_dir
}

// Helper to create a queue.jsonc file in the current runtime directory.
fn create_queue_jsonc(dir: &TempDir, content: &str) -> PathBuf {
    let cueloop_dir = setup_cueloop_dir(dir);
    let queue_path = cueloop_dir.join("queue.jsonc");
    fs::write(&queue_path, content).expect("write queue.jsonc");
    queue_path
}

// Helper to create a done.json file
#[allow(dead_code)]
fn create_done_json(dir: &TempDir, content: &str) -> PathBuf {
    let cueloop_dir = setup_cueloop_dir(dir);
    let done_path = cueloop_dir.join("done.json");
    fs::write(&done_path, content).expect("write done.json");
    done_path
}

// Helper to create a done.jsonc file
#[allow(dead_code)]
fn create_done_jsonc(dir: &TempDir, content: &str) -> PathBuf {
    let cueloop_dir = setup_cueloop_dir(dir);
    let done_path = cueloop_dir.join("done.jsonc");
    fs::write(&done_path, content).expect("write done.jsonc");
    done_path
}

// Helper to create a config.jsonc file in the current runtime directory.
fn create_config_jsonc(dir: &TempDir, content: &str) -> PathBuf {
    let cueloop_dir = setup_cueloop_dir(dir);
    let config_path = cueloop_dir.join("config.jsonc");
    fs::write(&config_path, content).expect("write config.jsonc");
    config_path
}

#[path = "config_test/id_and_validation.rs"]
mod id_and_validation;
#[path = "config_test/jsonc_and_tilde.rs"]
mod jsonc_and_tilde;
#[path = "config_test/layer_merge.rs"]
mod layer_merge;
#[path = "config_test/repo_paths.rs"]
mod repo_paths;