Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

refactor(config): drop `.new` migration files; migrate in-memory on demand (#2184)

Maximilian Roos5790df6d454a
diff --git a/src/cli/config.rs b/src/cli/config.rs
index e09606d3a..b47e3e83d 100644
--- a/src/cli/config.rs
+++ b/src/cli/config.rs
@@ -400,6 +400,10 @@ This tests:
after_long_help = r#"Updates deprecated settings in user and project config files
to their current equivalents. Shows a diff and asks for confirmation.
+Migrations are computed in memory on demand — worktrunk no longer writes
+`.new` files as a side effect of loading config. Use `--print` to see the
+migrated TOML without touching any file.
+
## Examples
Preview and apply updates:
@@ -410,12 +414,21 @@ $ wt config update
Apply without confirmation:
```console
$ wt config update --yes
+```
+
+Print the migrated config to stdout (no changes written):
+```console
+$ wt config update --print
```"#
)]
Update {
/// Skip confirmation prompt
#[arg(short, long)]
yes: bool,
+
+ /// Print the migrated config to stdout instead of writing it
+ #[arg(long, conflicts_with = "yes")]
+ print: bool,
},
/// Plugin management
diff --git a/src/commands/config/show.rs b/src/commands/config/show.rs
index 76e207b94..79a9afa0b 100644
--- a/src/commands/config/show.rs
+++ b/src/commands/config/show.rs
@@ -520,7 +520,9 @@ fn render_user_config(out: &mut String, has_system_config: bool) -> anyhow::Resu
false, // silent mode - we'll format the output ourselves
) {
if let Some(info) = result.info {
- out.push_str(&worktrunk::config::format_deprecation_details(&info));
+ out.push_str(&worktrunk::config::format_deprecation_details(
+ &info, &contents,
+ ));
true
} else {
false
@@ -669,7 +671,9 @@ fn render_project_config(out: &mut String) -> anyhow::Result<()> {
false, // silent mode - we'll format the output ourselves
) {
if let Some(info) = result.info {
- out.push_str(&worktrunk::config::format_deprecation_details(&info));
+ out.push_str(&worktrunk::config::format_deprecation_details(
+ &info, &contents,
+ ));
true
} else {
false
diff --git a/src/commands/config/update.rs b/src/commands/config/update.rs
index 074dd7ad3..2fb644517 100644
--- a/src/commands/config/update.rs
+++ b/src/commands/config/update.rs
@@ -1,13 +1,16 @@
//! Config update command.
//!
-//! Updates deprecated settings in user and project config files.
+//! Updates deprecated settings in user and project config files by
+//! re-migrating in memory and overwriting the file. The previous `.new` file
+//! flow was removed — nothing writes to disk outside this command.
use std::fmt::Write as _;
use std::path::PathBuf;
use anyhow::Context;
use worktrunk::config::{
- DeprecationInfo, config_path, format_deprecation_warnings, format_migration_diff,
+ DeprecationInfo, compute_migrated_content, config_path,
+ copy_approved_commands_to_approvals_file, format_deprecation_warnings, format_migration_diff,
};
use worktrunk::git::Repository;
use worktrunk::styling::{
@@ -19,42 +22,64 @@ use crate::output::prompt::{PromptResponse, prompt_yes_no_preview};
/// A config file that needs updating.
struct UpdateCandidate {
- /// Path to the original config file
+ /// Path to the config file
config_path: PathBuf,
- /// Path to the generated .new file
- new_path: PathBuf,
- /// Deprecation info for display
+ /// Current on-disk content
+ original: String,
+ /// Migrated content to write
+ migrated: String,
+ /// Detected deprecations for display
info: DeprecationInfo,
}
/// Handle the `wt config update` command.
-pub fn handle_config_update(yes: bool) -> anyhow::Result<()> {
+pub fn handle_config_update(yes: bool, print: bool) -> anyhow::Result<()> {
let mut candidates = Vec::new();
- // Check user config
if let Some(candidate) = check_user_config()? {
candidates.push(candidate);
}
-
- // Check project config (if in a git repo)
if let Some(candidate) = check_project_config()? {
candidates.push(candidate);
}
if candidates.is_empty() {
+ if print {
+ // --print on a clean config is a no-op; stay quiet on stdout.
+ return Ok(());
+ }
eprintln!("{}", info_message("No deprecated settings found"));
return Ok(());
}
- // Show what will be updated (warnings + diffs)
+ if print {
+ // Emit migrated content to stdout. Multiple configs → separate with a
+ // labeled header so the output is still parseable. Warnings still go
+ // to stderr so stdout stays clean for piping.
+ let multi = candidates.len() > 1;
+ for (idx, candidate) in candidates.iter().enumerate() {
+ eprint!("{}", format_deprecation_warnings(&candidate.info));
+ if multi {
+ if idx > 0 {
+ println!();
+ }
+ println!(
+ "# {} ({})",
+ candidate.info.label,
+ candidate.config_path.display()
+ );
+ }
+ print!("{}", candidate.migrated);
+ }
+ return Ok(());
+ }
+
for candidate in &candidates {
- eprint!("{}", format_update_preview(&candidate.info));
+ eprint!("{}", format_update_preview(candidate));
}
- // Confirm unless --yes
if !yes {
- let prompt_text = "Apply updates?".to_string();
- match prompt_yes_no_preview(&prompt_text, || {})? {
+ match prompt_yes_no_preview("Apply updates?", || {})? {
PromptResponse::Accepted => {}
PromptResponse::Declined => {
eprintln!("{}", info_message("Update cancelled"));
@@ -63,9 +88,24 @@ pub fn handle_config_update(yes: bool) -> anyhow::Result<()> {
}
}
- // Apply updates
for candidate in &candidates {
- std::fs::rename(&candidate.new_path, &candidate.config_path)
+ // Preserve approved-commands before rewriting config (migrated content
+ // drops them; approvals.toml becomes the authoritative source).
+ if candidate.info.deprecations.approved_commands
+ && let Some(approvals_path) =
+ copy_approved_commands_to_approvals_file(&candidate.config_path)
+ {
+ let filename = approvals_path
+ .file_name()
+ .map(|n| n.to_string_lossy().into_owned())
+ .unwrap_or_default();
+ eprintln!(
+ "{}",
+ info_message(format!("Copied approved commands to {filename}"))
+ );
+ }
+
+ std::fs::write(&candidate.config_path, &candidate.migrated)
.with_context(|| format!("Failed to update {}", candidate.info.label))?;
eprintln!(
"{}",
@@ -73,33 +113,28 @@ pub fn handle_config_update(yes: bool) -> anyhow::Result<()> {
);
}
- // Clear deprecation hint if we're in a repo
- if let Ok(repo) = Repository::current() {
- let _ = repo.clear_hint("deprecated-config");
- }
-
Ok(())
}
/// Format update preview for display.
///
-/// Shows deprecation warnings and diff, but omits the "mv" apply hint
+/// Shows deprecation warnings and diff, but omits the "To apply" hint
/// since `config update` will apply automatically.
-fn format_update_preview(info: &DeprecationInfo) -> String {
- let mut out = format_deprecation_warnings(info);
-
- // Show diff (without the "To apply" hint that format_deprecation_details adds)
- if let Some(new_path) = &info.migration_path
- && let Some(diff) = format_migration_diff(&info.config_path, new_path)
- {
+fn format_update_preview(candidate: &UpdateCandidate) -> String {
+ let mut out = format_deprecation_warnings(&candidate.info);
+
+ let label = candidate
+ .config_path
+ .file_name()
+ .map(|n| n.to_string_lossy().into_owned())
+ .unwrap_or_else(|| "config".to_string());
+ if let Some(diff) = format_migration_diff(&candidate.original, &candidate.migrated, &label) {
let _ = writeln!(out, "{}", info_message("Proposed diff:"));
let _ = writeln!(out, "{diff}");
}
-
out
}
-/// Check user config for deprecations and generate .new file if needed.
fn check_user_config() -> anyhow::Result<Option<UpdateCandidate>> {
let config_path = match config_path() {
Some(path) => path,
@@ -109,44 +144,30 @@ fn check_user_config() -> anyhow::Result<Option<UpdateCandidate>> {
return Ok(None);
}
- let content = std::fs::read_to_string(&config_path).context("Failed to read user config")?;
+ let original = std::fs::read_to_string(&config_path).context("Failed to read user config")?;
- // Use check_and_migrate in silent mode (emit_inline_warnings=false) which:
- // - Detects deprecations
- // - Copies approved-commands to approvals.toml
- // - Writes the .new migration file
- let info = match worktrunk::config::check_and_migrate(
+ let result = worktrunk::config::check_and_migrate(
&config_path,
- &content,
- true, // warn_and_migrate (write .new file)
+ &original,
+ true, // warn_and_migrate — user config always actionable
"User config",
None, // no repo context for user config
- false, // silent mode
- )? {
- result
- if result
- .info
- .as_ref()
- .is_some_and(DeprecationInfo::has_deprecations) =>
- {
- result.info.unwrap()
- }
- _ => return Ok(None),
- };
+ false, // emit_inline_warnings — we render the diff ourselves
+ )?;
- let new_path = match &info.migration_path {
- Some(path) => path.clone(),
- None => anyhow::bail!("Failed to write migration file for user config"),
+ let Some(info) = result.info.filter(DeprecationInfo::has_deprecations) else {
+ return Ok(None);
};
+ let migrated = compute_migrated_content(&original);
Ok(Some(UpdateCandidate {
config_path,
- new_path,
+ original,
+ migrated,
info,
}))
}
-/// Check project config for deprecations and generate .new file if needed.
fn check_project_config() -> anyhow::Result<Option<UpdateCandidate>> {
let repo = match Repository::current() {
Ok(repo) => repo,
@@ -163,28 +184,22 @@ fn check_project_config() -> anyhow::Result<Option<UpdateCandidate>> {
let is_linked = repo.current_worktree().is_linked().unwrap_or(true);
- let content = std::fs::read_to_string(&config_path).context("Failed to read project config")?;
+ let original =
+ std::fs::read_to_string(&config_path).context("Failed to read project config")?;
- let info = match worktrunk::config::check_and_migrate(
+ let result = worktrunk::config::check_and_migrate(
&config_path,
- &content,
- !is_linked, // only write .new file from main worktree
+ &original,
+ !is_linked, // only actionable from main worktree
"Project config",
Some(&repo),
- false, // silent mode
- )? {
- result
- if result
- .info
- .as_ref()
- .is_some_and(DeprecationInfo::has_deprecations) =>
- {
- result.info.unwrap()
- }
- _ => return Ok(None),
+ false,
+ )?;
+
+ let Some(info) = result.info.filter(DeprecationInfo::has_deprecations) else {
+ return Ok(None);
};
- // Linked worktrees can't apply the update — suggest -C to main worktree
if is_linked {
let cmd = suggest_command_in_dir(repo.repo_path()?, "config", &["update"], &[]);
eprintln!("{}", hint_message("To update project config:"));
@@ -192,14 +207,11 @@ fn check_project_config() -> anyhow::Result<Option<UpdateCandidate>> {
return Ok(None);
}
- let new_path = match &info.migration_path {
- Some(path) => path.clone(),
- None => anyhow::bail!("Failed to write migration file for project config"),
- };
-
+ let migrated = compute_migrated_content(&original);
Ok(Some(UpdateCandidate {
config_path,
- new_path,
+ original,
+ migrated,
info,
}))
}
diff --git a/src/config/deprecation.rs b/src/config/deprecation.rs
index ba24e85f2..57321b3fc 100644
--- a/src/config/deprecation.rs
+++ b/src/config/deprecation.rs
@@ -1,19 +1,20 @@
-//! Deprecation detection and migration
+//! Deprecation detection and migration.
//!
-//! Scans config files for deprecated patterns and generates migration files:
+//! Scans config files for deprecated patterns and surfaces them to the user:
//! - Deprecated template variables (repo_root → repo_path, etc.)
//! - Deprecated config sections (\[commit-generation\] → \[commit.generation\])
//! - Deprecated fields (args merged into command)
//! - Deprecated approved-commands in \[projects\] (moved to approvals.toml)
//!
-//! Migration file write behavior:
-//! - First time a deprecation is detected: file is written automatically
-//! - Subsequent runs (for commands other than `wt config show`): brief warning only
-//! - `wt config show`: always writes/regenerates the migration file with full details
+//! Detection is purely in-memory — nothing writes to the filesystem from a
+//! config load path. `check_and_migrate` returns the structurally migrated
+//! content (for serde) and a `DeprecationInfo` describing what needs fixing.
+//! Users materialize migrations explicitly via `wt config update` (which
+//! overwrites the config file and copies approved-commands to `approvals.toml`)
+//! or inspect them via `wt config show` / `wt config update --print`.
//!
-//! The hint system (`worktrunk.hints.deprecated-config` in git config) tracks whether
-//! a deprecation has been warned about before. User config (no repo context) always
-//! writes the migration file since there's no persistent hint tracking.
+//! Per-path warning dedup still applies within a process so `wt list` doesn't
+//! spam the same deprecation message from multiple config layers.
use std::borrow::Cow;
use std::collections::{HashMap, HashSet};
@@ -23,7 +24,6 @@ use std::sync::{LazyLock, Mutex, OnceLock};
use color_print::cformat;
use minijinja::Environment;
-use path_slash::PathExt as _;
use regex::Regex;
use shell_escape::unix::escape;
@@ -76,9 +76,6 @@ static DEPRECATED_VAR_REGEXES: LazyLock<Vec<(Regex, &'static str)>> = LazyLock::
static WARNED_UNKNOWN_PATHS: LazyLock<Mutex<HashSet<PathBuf>>> =
LazyLock::new(|| Mutex::new(HashSet::new()));
-/// Hint name for config deprecation warnings
-const HINT_DEPRECATED_CONFIG: &str = "deprecated-config";
-
/// Mapping from deprecated variable name to its replacement
const DEPRECATED_VARS: &[(&str, &str)] = &[
("repo_root", "repo_path"),
@@ -994,13 +991,13 @@ pub fn migrate_content(content: &str) -> String {
/// Copy approved-commands from config.toml to approvals.toml.
///
-/// Called during migration to ensure approved-commands are preserved before
-/// the migration file removes them from config.toml. Without this, applying
-/// `mv config.toml.new config.toml` would lose approval data.
+/// Called by `wt config update` before overwriting the config with migrated
+/// content, so the approvals data survives the rewrite. No-op if
+/// `approvals.toml` already exists (already authoritative) or the config has
+/// no approved-commands entries.
///
-/// Returns `Some(path)` if approvals.toml was created, `None` if it already
-/// existed or there was nothing to copy.
-fn copy_approved_commands_to_approvals_file(config_path: &Path) -> Option<PathBuf> {
+/// Returns `Some(path)` if approvals.toml was created, `None` otherwise.
+pub fn copy_approved_commands_to_approvals_file(config_path: &Path) -> Option<PathBuf> {
let approvals_path = config_path.with_file_name("approvals.toml");
if approvals_path.exists() {
return None; // Already authoritative, don't overwrite
@@ -1066,22 +1063,19 @@ fn shell_join(args: &[&str]) -> String {
/// Information about deprecated config patterns that were found.
///
-/// Used by `wt config show` to display full deprecation details including inline diff.
-/// This struct combines detection results with context (paths, labels) for display.
+/// Detection result plus display context (paths, labels). No filesystem side
+/// effects — `check_and_migrate` never writes `.new` files or copies
+/// approvals; `wt config update` does those under an explicit user action.
#[derive(Debug)]
pub struct DeprecationInfo {
/// Path to the config file with deprecations
pub config_path: PathBuf,
- /// Path to the generated migration file (if written)
- pub migration_path: Option<PathBuf>,
/// All detected deprecations
pub deprecations: Deprecations,
/// Label for this config (e.g., "User config", "Project config")
pub label: String,
/// Main worktree path when viewing from a linked worktree (for `-C` in hints)
pub main_worktree_path: Option<PathBuf>,
- /// Path to approvals.toml if approved-commands were copied there during migration
- pub approvals_copied_to: Option<PathBuf>,
}
impl DeprecationInfo {
@@ -1101,35 +1095,27 @@ pub struct CheckAndMigrateResult {
pub migrated_content: String,
}
-fn migration_path(path: &Path) -> PathBuf {
- // config.toml -> config.toml.new
- // config -> config.new
- match path.extension() {
- Some(ext) => path.with_extension(format!("{}.new", ext.to_string_lossy())),
- None => path.with_extension("new"),
- }
-}
-
-/// Check config content for deprecated patterns and optionally create migration file
+/// Check config content for deprecated patterns.
///
-/// Detects and migrates:
+/// Detects:
/// - Deprecated template variables (repo_root → repo_path, etc.)
/// - Deprecated [commit-generation] sections → [commit.generation]
/// - Deprecated args field (merged into command)
/// - Deprecated approved-commands in \[projects\] (moved to approvals.toml)
///
-/// If deprecations are found and `warn_and_migrate` is true:
-/// 1. Emits warnings listing the deprecated patterns
-/// 2. Creates a single `.new` file with all migrations applied
+/// Pure with respect to the filesystem — never writes `.new` files and never
+/// copies approvals. The user materializes migrations by running `wt config
+/// update` (or `wt config update --print`). Deprecation warnings still go to
+/// stderr when `emit_inline_warnings` is set.
///
-/// Set `warn_and_migrate` to false for project config on feature worktrees - the warning
-/// is only actionable from the main worktree where the migration file can be applied.
+/// Set `warn_and_migrate` to false for project config on feature worktrees —
+/// the warning is only actionable from the main worktree where the user would
+/// run `wt config update`.
///
/// The `label` is used in the warning message (e.g., "User config" or "Project config").
///
-/// `repo` should be provided for project config to use the hint system. For user config
-/// (global, not repo-specific), pass `None` and the function will check if the `.new`
-/// file already exists instead.
+/// `repo` is used to resolve the primary worktree path for the "run this from
+/// the main worktree" hint when viewing project config from a linked worktree.
///
/// When `emit_inline_warnings` is true, per-kind deprecation warnings are printed to stderr
/// with a hint pointing at `wt config show`/`wt config update`. When false, nothing is
@@ -1148,44 +1134,25 @@ pub fn check_and_migrate(
emit_inline_warnings: bool,
) -> anyhow::Result<CheckAndMigrateResult> {
// Parse once — shared by detection and migration
- let (deprecations, migrated_content, template_strings) =
- match content.parse::<toml_edit::DocumentMut>() {
- Ok(doc) => {
- let template_strings = extract_template_strings_from_doc(&doc);
- let deprecations = detect_deprecations_from_doc(&doc, &template_strings);
- let migrated_content = migrate_content_from_doc(content, doc);
- (deprecations, migrated_content, template_strings)
- }
- Err(_) => (Deprecations::default(), content.to_string(), vec![]),
- };
+ let (deprecations, migrated_content) = match content.parse::<toml_edit::DocumentMut>() {
+ Ok(doc) => {
+ let template_strings = extract_template_strings_from_doc(&doc);
+ let deprecations = detect_deprecations_from_doc(&doc, &template_strings);
+ let migrated_content = migrate_content_from_doc(content, doc);
+ (deprecations, migrated_content)
+ }
+ Err(_) => (Deprecations::default(), content.to_string()),
+ };
if deprecations.is_empty() {
- // Config is clean - clear hint so future deprecations get full treatment.
- // This handles the case where a user fixes their config today, then months
- // later a new deprecation is introduced - they should get the full warning.
- // TODO: We want to avoid gunking up config loading with too many checks,
- // but a single git config --unset seems acceptable for now.
- if let Some(repo) = repo {
- let _ = repo.clear_hint(HINT_DEPRECATED_CONFIG);
- }
return Ok(CheckAndMigrateResult {
info: None,
migrated_content,
});
}
- let new_path = migration_path(path);
-
- // Skip writing if: (a) caller emits inline (not `wt config show`), AND
- // (b) migration file already exists
- // This means first-time deprecation gets automatic file write, after that
- // users run `wt config show` to get/update the migration file.
- let should_skip_write = emit_inline_warnings && new_path.exists();
-
- // Build deprecation info for return
- let mut info = DeprecationInfo {
+ let info = DeprecationInfo {
config_path: path.to_path_buf(),
- migration_path: None,
deprecations,
label: label.to_string(),
main_worktree_path: if !warn_and_migrate {
@@ -1194,7 +1161,6 @@ pub fn check_and_migrate(
} else {
None
},
- approvals_copied_to: None,
};
// Skip warning entirely if not in main worktree (for project config)
@@ -1212,79 +1178,27 @@ pub fn check_and_migrate(
.lock()
.map_err(|e| anyhow::anyhow!("failed to lock deprecation warning tracker: {e}"))?;
if guard.contains(&canonical_path) {
- // Already warned, but still set migration_path if file exists
- if new_path.exists() {
- info.migration_path = Some(new_path);
- }
return Ok(CheckAndMigrateResult {
info: Some(info),
migrated_content,
});
}
- guard.insert(canonical_path.clone());
- }
-
- // Copy approved-commands to approvals.toml before generating the migration
- // file that removes them from config.toml. Without this, applying the
- // migration (`mv config.toml.new config.toml`) would lose approval data.
- // Skip when warnings are suppressed — help/completion/picker surfaces
- // must not mutate the filesystem.
- if info.deprecations.approved_commands && !warnings_suppressed() {
- info.approvals_copied_to = copy_approved_commands_to_approvals_file(path);
+ guard.insert(canonical_path);
}
- // Writes are suppressed alongside warnings on passive display surfaces
- // (help, completion, picker, statusline). The next config-modifying
- // command will re-detect and write the migration file.
- let should_write = !should_skip_write && !warnings_suppressed();
-
// For non-config-show commands, emit per-kind warnings but skip the diff.
// The diff is reserved for `wt config show`, where the user has opted into details.
- if emit_inline_warnings {
- if !warnings_suppressed() {
- eprint!("{}", format_deprecation_warnings(&info));
- if DEPRECATION_HINT_EMITTED.set(()).is_ok() {
- eprintln!(
- "{}",
- hint_message(cformat!(
- "To see details, run <underline>wt config show</>; to apply updates, run <underline>wt config update</>"
- ))
- );
- }
-
- if let Some(approvals_path) = &info.approvals_copied_to {
- let approvals_filename = approvals_path
- .file_name()
- .map(|n| n.to_string_lossy())
- .unwrap_or_default();
- eprintln!(
- "{}",
- hint_message(cformat!(
- "Copied approved commands to <underline>{approvals_filename}</>"
- ))
- );
- }
- }
-
- // Still write migration file if needed (first time only)
- // The file is needed for `wt config update` / `wt config show` to work
- if should_write {
- info.migration_path =
- write_migration_file(path, content, &info.deprecations, repo, &template_strings);
+ if emit_inline_warnings && !warnings_suppressed() {
+ eprint!("{}", format_deprecation_warnings(&info));
+ if DEPRECATION_HINT_EMITTED.set(()).is_ok() {
+ eprintln!(
+ "{}",
+ hint_message(cformat!(
+ "To see details, run <underline>wt config show</>; to apply updates, run <underline>wt config update</>"
+ ))
+ );
}
-
std::io::stderr().flush().ok();
- return Ok(CheckAndMigrateResult {
- info: Some(info),
- migrated_content,
- });
- }
-
- // Silent mode for `wt config show` - just write migration file and return info
- // The caller will use format_deprecation_details() to add output to its buffer
- if should_write {
- info.migration_path =
- write_migration_file(path, content, &info.deprecations, repo, &template_strings);
}
Ok(CheckAndMigrateResult {
@@ -1293,85 +1207,78 @@ pub fn check_and_migrate(
})
}
-/// Write migration file with all fixes applied.
+/// Apply all deprecation fixes to `content` in memory and return the migrated
+/// TOML string.
///
-/// Applies all deprecation fixes (variable renames, section migrations) and writes
-/// the result to a `.new` file alongside the original config.
+/// Applies variable renames (cosmetic, string-level), structural section and
+/// field migrations, and removes `approved-commands` under `[projects]` (which
+/// `wt config update` copies to `approvals.toml` before overwriting).
///
-/// Returns `Some(path)` if file was written successfully, `None` otherwise.
-///
-/// # Arguments
-/// * `path` - Path to the original config file
-/// * `content` - Content of the config file
-/// * `deprecations` - Detected deprecations to fix
-/// * `repo` - Optional repository for hint tracking (project config only)
-/// * `template_strings` - Pre-extracted template strings from detection (avoids re-parsing)
-pub fn write_migration_file(
- path: &Path,
- content: &str,
- deprecations: &Deprecations,
- repo: Option<&crate::git::Repository>,
- template_strings: &[String],
-) -> Option<PathBuf> {
- let new_path = migration_path(path);
+/// Pure function — no filesystem access. Idempotent: feeding its own output
+/// back in is a no-op. Callers materialize the result via `wt config update`
+/// or display it via `wt config show`.
+pub fn compute_migrated_content(content: &str) -> String {
+ // Parse once to extract template strings and detect what needs migrating.
+ let Ok(doc) = content.parse::<toml_edit::DocumentMut>() else {
+ return content.to_string();
+ };
+ let template_strings = extract_template_strings_from_doc(&doc);
+ let deprecations = detect_deprecations_from_doc(&doc, &template_strings);
// Apply string-level var replacement first (cosmetic, operates on raw content)
- let new_content = if !deprecations.vars.is_empty() {
- replace_deprecated_vars_from_strings(content, template_strings)
+ let after_vars = if !deprecations.vars.is_empty() {
+ replace_deprecated_vars_from_strings(content, &template_strings)
} else {
content.to_string()
};
- // Parse once for all structural migrations
- let new_content = match new_content.parse::<toml_edit::DocumentMut>() {
- Ok(mut doc) => {
- let mut modified = migrate_content_doc(&mut doc);
- // Additionally remove approved-commands for the .new file (not part of
- // migrate_content because approved-commands is still a valid serde field)
- if deprecations.approved_commands {
- modified |= remove_approved_commands_doc(&mut doc);
- }
- if modified {
- doc.to_string()
- } else {
- new_content
- }
- }
- Err(_) => new_content,
+ // Re-parse for structural migrations (which operate on toml_edit::DocumentMut)
+ let Ok(mut doc) = after_vars.parse::<toml_edit::DocumentMut>() else {
+ return after_vars;
};
-
- if let Err(e) = std::fs::write(&new_path, &new_content) {
- // Log write failure but don't block config loading
- log::warn!("Could not write migration file: {}", e);
- return None;
+ let mut modified = migrate_content_doc(&mut doc);
+ // Additionally remove approved-commands (not part of migrate_content because
+ // approved-commands is still a valid serde field at runtime).
+ if deprecations.approved_commands {
+ modified |= remove_approved_commands_doc(&mut doc);
}
-
- // Mark hint as shown for project config
- if let Some(repo) = repo {
- let _ = repo.mark_hint_shown(HINT_DEPRECATED_CONFIG);
+ if modified {
+ doc.to_string()
+ } else {
+ after_vars
}
-
- Some(new_path)
}
-/// Format the diff between original and migrated config files as a string
-pub fn format_migration_diff(original_path: &Path, new_path: &Path) -> Option<String> {
- // Run git diff and return the formatted output
- // -U3: Show 3 lines of context (git default)
- // Use -- to separate options from file paths (guards against filenames starting with -)
- if let Ok(output) = Cmd::new("git")
+/// Render a colored unified diff between `original` and `migrated`, with
+/// `label` shown as the file name in the diff header (e.g. `config.toml`).
+///
+/// Uses a private tempdir containing two files named `<label>/current` and
+/// `<label>/migrated`; `git diff --no-index` is invoked from inside that
+/// tempdir so the diff header shows clean relative paths. The tempdir is
+/// dropped on return. Returns `None` when the contents match.
+pub fn format_migration_diff(original: &str, migrated: &str, label: &str) -> Option<String> {
+ let dir = tempfile::tempdir().ok()?;
+ let subdir = dir.path().join(label);
+ std::fs::create_dir(&subdir).ok()?;
+ let current = subdir.join("current");
+ let migrated_path = subdir.join("migrated");
+ std::fs::write(&current, original).ok()?;
+ std::fs::write(&migrated_path, migrated).ok()?;
+
+ let output = Cmd::new("git")
.args(["diff", "--no-index", "--color=always", "-U3", "--"])
- .arg(original_path.to_slash_lossy().into_owned())
- .arg(new_path.to_slash_lossy().into_owned())
+ .arg(format!("{label}/current"))
+ .arg(format!("{label}/migrated"))
+ .current_dir(dir.path())
.run()
- {
- // git diff --no-index exits 1 when files differ, which is expected
- let diff_output = String::from_utf8_lossy(&output.stdout);
- if !diff_output.is_empty() {
- return Some(format_with_gutter(diff_output.trim_end(), None));
- }
+ .ok()?;
+
+ // git diff --no-index exits 1 when files differ, which is expected.
+ let diff_output = String::from_utf8_lossy(&output.stdout);
+ if diff_output.is_empty() {
+ return None;
}
- None
+ Some(format_with_gutter(diff_output.trim_end(), None))
}
/// Format deprecation warning lines (without apply hints or diff).
@@ -1425,19 +1332,6 @@ pub fn format_deprecation_warnings(info: &DeprecationInfo) -> String {
info.label
))
);
- if let Some(approvals_path) = &info.approvals_copied_to {
- let approvals_filename = approvals_path
- .file_name()
- .map(|n| n.to_string_lossy())
- .unwrap_or_default();
- let _ = writeln!(
- out,
- "{}",
- hint_message(cformat!(
- "Copied approved commands to <underline>{approvals_filename}</>"
- ))
- );
- }
}
if info.deprecations.select {
@@ -1526,31 +1420,40 @@ pub fn format_deprecation_warnings(info: &DeprecationInfo) -> String {
/// - Warning message listing deprecated patterns
/// - Migration hint with apply command
/// - Inline diff showing the changes
-pub fn format_deprecation_details(info: &DeprecationInfo) -> String {
+///
+/// `original_content` is the current on-disk config; the migrated content is
+/// derived in memory via [`compute_migrated_content`] so this function has no
+/// filesystem side effects other than the tempdir used briefly for `git diff`.
+pub fn format_deprecation_details(info: &DeprecationInfo, original_content: &str) -> String {
use std::fmt::Write;
let mut out = format_deprecation_warnings(info);
- // Migration hint with apply command
- if let Some(new_path) = &info.migration_path {
- let _ = writeln!(
- out,
- "{}",
- hint_message(cformat!("To apply: <underline>wt config update</>"))
- );
-
- // Inline diff — git diff header shows the file paths
- if let Some(diff) = format_migration_diff(&info.config_path, new_path) {
- let _ = writeln!(out, "{}", info_message("Proposed diff:"));
- let _ = writeln!(out, "{diff}");
- }
- } else if let Some(main_path) = &info.main_worktree_path {
- // In linked worktree — include -C so the command works from here
+ if let Some(main_path) = &info.main_worktree_path {
+ // In a linked worktree — the user needs to run update from the primary.
let cmd = suggest_command_in_dir(main_path, "config", &["update"], &[]);
let _ = writeln!(
out,
"{}",
hint_message(cformat!("To apply: <underline>{cmd}</>"))
);
+ return out;
+ }
+
+ let _ = writeln!(
+ out,
+ "{}",
+ hint_message(cformat!("To apply: <underline>wt config update</>"))
+ );
+
+ let migrated = compute_migrated_content(original_content);
+ let label = info
+ .config_path
+ .file_name()
+ .map(|n| n.to_string_lossy().into_owned())
+ .unwrap_or_else(|| "config".to_string());
+ if let Some(diff) = format_migration_diff(original_content, &migrated, &label) {
+ let _ = writeln!(out, "{}", info_message("Proposed diff:"));
+ let _ = writeln!(out, "{diff}");
}
out
@@ -1663,7 +1566,7 @@ mod tests {
// Test helpers that parse from string and delegate to the internal functions.
// These mirror the former pub wrappers that were inlined into
- // `detect_deprecations` and `write_migration_file`.
+ // `detect_deprecations` and `compute_migrated_content`.
fn extract_template_strings(content: &str) -> Vec<String> {
let Ok(doc) = content.parse::<toml_edit::DocumentMut>() else {
@@ -2093,31 +1996,6 @@ pager = "delta"
assert!(result.info.is_some());
}
- #[test]
- fn test_migration_path_with_extension() {
- // config.toml -> config.toml.new
- let path = std::path::Path::new("/tmp/config.toml");
- let new_path = migration_path(path);
- assert_eq!(new_path.to_str().unwrap(), "/tmp/config.toml.new");
- }
-
- #[test]
- fn test_migration_path_without_extension() {
- // config -> config.new (not config..new)
- let path = std::path::Path::new("/tmp/config");
- let new_path = migration_path(path);
- assert_eq!(new_path.to_str().unwrap(), "/tmp/config.new");
- }
-
- #[test]
- fn test_migration_path_hidden_file() {
- // .hidden -> .hidden.new (not .hidden..new)
- // Note: .hidden has no extension (the dot is part of the filename)
- let path = std::path::Path::new("/tmp/.hidden");
- let new_path = migration_path(path);
- assert_eq!(new_path.to_str().unwrap(), "/tmp/.hidden.new");
- }
-
// Tests for commit-generation section migration
#[test]
@@ -2714,9 +2592,12 @@ approved-commands = ["npm install"]
#[test]
fn test_format_deprecation_details_approved_commands() {
+ let content = r#"
+[projects."github.com/user/repo"]
+approved-commands = ["npm install"]
+"#;
let info = DeprecationInfo {
config_path: std::path::PathBuf::from("/tmp/test-config.toml"),
- migration_path: None,
deprecations: Deprecations {
vars: vec![],
commit_gen: CommitGenerationDeprecations::default(),
@@ -2730,9 +2611,8 @@ approved-commands = ["npm install"]
},
label: "User config".to_string(),
main_worktree_path: None,
- approvals_copied_to: None,
};
- let output = format_deprecation_details(&info);
+ let output = format_deprecation_details(&info, content);
assert!(
output.contains("approved-commands"),
"Should mention approved-commands in output: {}",
@@ -2746,62 +2626,13 @@ approved-commands = ["npm install"]
}
#[test]
- fn test_format_deprecation_details_approvals_copied() {
- let info = DeprecationInfo {
- config_path: std::path::PathBuf::from("/tmp/test-config.toml"),
- migration_path: None,
- deprecations: Deprecations {
- vars: vec![],
- commit_gen: CommitGenerationDeprecations::default(),
- approved_commands: true,
- select: false,
- post_create: false,
- ci_section: false,
- no_ff: false,
- no_cd: false,
- pre_hook_table_form: vec![],
- },
- label: "User config".to_string(),
- main_worktree_path: None,
- approvals_copied_to: Some(std::path::PathBuf::from("/tmp/approvals.toml")),
- };
- let output = format_deprecation_details(&info);
- assert!(
- output.contains("Copied approved commands"),
- "Should mention approvals were copied: {}",
- output
- );
- }
-
- #[test]
- fn test_write_migration_file_with_approved_commands() {
- let temp_dir = tempfile::TempDir::new().unwrap();
- let config_path = temp_dir.path().join("config.toml");
+ fn test_compute_migrated_content_removes_approved_commands() {
let content = r#"worktree-path = "../{{ repo }}.{{ branch | sanitize }}"
[projects."github.com/user/repo"]
approved-commands = ["npm install"]
"#;
- std::fs::write(&config_path, content).unwrap();
-
- let deprecations = Deprecations {
- vars: vec![],
- commit_gen: CommitGenerationDeprecations::default(),
- approved_commands: true,
- select: false,
- post_create: false,
- ci_section: false,
- no_ff: false,
- no_cd: false,
- pre_hook_table_form: vec![],
- };
- let result = write_migration_file(&config_path, content, &deprecations, None, &[]);
- assert!(
- result.is_some(),
- "Should write migration file for approved-commands"
- );
- let migration_path = result.unwrap();
- let migrated = std::fs::read_to_string(&migration_path).unwrap();
+ let migrated = compute_migrated_content(content);
assert!(!migrated.contains("approved-commands"));
}
@@ -3044,9 +2875,11 @@ branches = true
#[test]
fn test_format_deprecation_details_select() {
+ let content = r#"[select]
+pager = "delta --paging=never"
+"#;
let info = DeprecationInfo {
config_path: std::path::PathBuf::from("/tmp/test-config.toml"),
- migration_path: None,
deprecations: Deprecations {
vars: vec![],
commit_gen: CommitGenerationDeprecations::default(),
@@ -3060,9 +2893,8 @@ branches = true
},
label: "User config".to_string(),
main_worktree_path: None,
- approvals_copied_to: None,
};
- let output = format_deprecation_details(&info);
+ let output = format_deprecation_details(&info, content);
assert!(
output.contains("[select]"),
"Should mention [select] in output: {output}"
@@ -3074,31 +2906,13 @@ branches = true
}
#[test]
- fn test_write_migration_file_with_select() {
- let temp_dir = tempfile::TempDir::new().unwrap();
- let config_path = temp_dir.path().join("config.toml");
+ fn test_compute_migrated_content_renames_select() {
let content = r#"worktree-path = "../{{ repo }}.{{ branch | sanitize }}"
[select]
pager = "delta --paging=never"
"#;
- std::fs::write(&config_path, content).unwrap();
-
- let deprecations = Deprecations {
- vars: vec![],
- commit_gen: CommitGenerationDeprecations::default(),
- approved_commands: false,
- select: true,
- post_create: false,
- ci_section: false,
- no_ff: false,
- no_cd: false,
- pre_hook_table_form: vec![],
- };
- let result = write_migration_file(&config_path, content, &deprecations, None, &[]);
- assert!(result.is_some(), "Should write migration file for select");
- let migration_path = result.unwrap();
- let migrated = std::fs::read_to_string(&migration_path).unwrap();
+ let migrated = compute_migrated_content(content);
assert!(
migrated.contains("[switch.picker]"),
"Migrated content should have [switch.picker]: {migrated}"
@@ -3294,9 +3108,10 @@ server = "npm run dev"
#[test]
fn test_format_deprecation_details_post_create() {
+ let content = r#"post-create = "npm install"
+"#;
let info = DeprecationInfo {
config_path: std::path::PathBuf::from("/tmp/test-config.toml"),
- migration_path: None,
deprecations: Deprecations {
vars: vec![],
commit_gen: CommitGenerationDeprecations::default(),
@@ -3310,9 +3125,8 @@ server = "npm run dev"
},
label: "Project config".to_string(),
main_worktree_path: None,
- approvals_copied_to: None,
};
- let output = format_deprecation_details(&info);
+ let output = format_deprecation_details(&info, content);
assert!(
output.contains("post-create"),
"Should mention post-create: {output}"
@@ -3324,34 +3138,13 @@ server = "npm run dev"
}
#[test]
- fn test_write_migration_file_with_post_create() {
- let temp_dir = tempfile::TempDir::new().unwrap();
- let config_path = temp_dir.path().join("wt.toml");
+ fn test_compute_migrated_content_renames_post_create() {
let content = r#"post-create = "npm install"
[post-start]
server = "npm run dev"
"#;
- std::fs::write(&config_path, content).unwrap();
-
- let deprecations = Deprecations {
- vars: vec![],
- commit_gen: CommitGenerationDeprecations::default(),
- approved_commands: false,
- select: false,
- post_create: true,
- ci_section: false,
- no_ff: false,
- no_cd: false,
- pre_hook_table_form: vec![],
- };
- let result = write_migration_file(&config_path, content, &deprecations, None, &[]);
- assert!(
- result.is_some(),
- "Should write migration file for post_create"
- );
- let migration_path = result.unwrap();
- let migrated = std::fs::read_to_string(&migration_path).unwrap();
+ let migrated = compute_migrated_content(content);
assert!(
migrated.contains("pre-start"),
"Migrated content should have pre-start: {migrated}"
@@ -3368,7 +3161,6 @@ server = "npm run dev"
fn test_format_deprecation_warnings_no_ff_and_no_cd() {
let info = DeprecationInfo {
config_path: std::path::PathBuf::from("/tmp/test-config.toml"),
- migration_path: None,
deprecations: Deprecations {
vars: vec![],
commit_gen: CommitGenerationDeprecations::default(),
@@ -3382,7 +3174,6 @@ server = "npm run dev"
},
label: "User config".to_string(),
main_worktree_path: None,
- approvals_copied_to: None,
};
let output = format_deprecation_warnings(&info);
assert!(output.contains("no-ff"), "Should mention no-ff: {output}");
diff --git a/src/config/mod.rs b/src/config/mod.rs
index 7da1c1bc9..e85821a9d 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -100,6 +100,8 @@ pub use deprecation::CheckAndMigrateResult;
pub use deprecation::DeprecationInfo;
pub use deprecation::Deprecations;
pub use deprecation::check_and_migrate;
+pub use deprecation::compute_migrated_content;
+pub use deprecation::copy_approved_commands_to_approvals_file;
pub use deprecation::detect_deprecations;
pub use deprecation::format_deprecation_details;
pub use deprecation::format_deprecation_warnings;
@@ -107,7 +109,6 @@ pub use deprecation::format_migration_diff;
pub use deprecation::migrate_content;
pub use deprecation::normalize_template_vars;
pub use deprecation::suppress_warnings;
-pub use deprecation::write_migration_file;
pub use deprecation::{
DEPRECATED_SECTION_KEYS, DeprecatedSection, UnknownKeyKind, classify_unknown_key,
key_belongs_in, warn_unknown_fields,
diff --git a/src/main.rs b/src/main.rs
index ceaee2b55..c463d38d6 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -500,7 +500,7 @@ fn handle_config_command(action: ConfigCommand) -> anyhow::Result<()> {
ConfigCommand::Shell { action } => handle_config_shell_command(action),
ConfigCommand::Create { project } => handle_config_create(project),
ConfigCommand::Show { full, format } => handle_config_show(full, format),
- ConfigCommand::Update { yes } => handle_config_update(yes),
+ ConfigCommand::Update { yes, print } => handle_config_update(yes, print),
ConfigCommand::Plugins { action } => handle_plugins_command(action),
ConfigCommand::State { action } => handle_state_command(action),
}
diff --git a/tests/integration_tests/config_show.rs b/tests/integration_tests/config_show.rs
index 8814f0935..b31e4ed74 100644
--- a/tests/integration_tests/config_show.rs
+++ b/tests/integration_tests/config_show.rs
@@ -1553,9 +1553,8 @@ alias wt="git worktree"
}
/// When a config uses deprecated variables (repo_root, worktree, main_worktree),
-/// the CLI should:
-/// 1. Show a warning pointing to `wt config show` and `wt config update`
-/// 2. Create a .new migration file with replacements
+/// the CLI should warn and `wt config update` should apply the variable
+/// renames in place.
#[rstest]
fn test_deprecated_template_variables_show_warning(repo: TestRepo, temp_home: TempDir) {
// Write config with deprecated variables to the test config path
@@ -1583,27 +1582,23 @@ post-create = "ln -sf {{ repo_root }}/node_modules {{ worktree }}/node_modules"
assert_cmd_snapshot!(cmd);
});
- // Verify migration file was created (config.toml -> config.toml.new)
- let migration_file = config_path.with_extension("toml.new");
- assert!(
- migration_file.exists(),
- "Migration file should be created at {:?}",
- migration_file
- );
+ // `wt list` emits warnings but never writes a .new file — that's
+ // `wt config update`'s job. Drive an update explicitly and verify the
+ // in-place migration applies all three variable renames.
+ let mut cmd = repo.wt_command();
+ cmd.args(["config", "update", "--yes"])
+ .current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+ cmd.env("WORKTRUNK_CONFIG_PATH", config_path);
+ assert!(cmd.output().unwrap().status.success());
- // Verify migration file has replacements
- let migrated_content = fs::read_to_string(&migration_file).unwrap();
+ let migrated = fs::read_to_string(config_path).unwrap();
+ assert!(migrated.contains("{{ repo }}"));
+ assert!(migrated.contains("{{ repo_path }}"));
+ assert!(migrated.contains("{{ worktree_path }}"));
assert!(
- migrated_content.contains("{{ repo }}"),
- "Migration should replace main_worktree with repo"
- );
- assert!(
- migrated_content.contains("{{ repo_path }}"),
- "Migration should replace repo_root with repo_path"
- );
- assert!(
- migrated_content.contains("{{ worktree_path }}"),
- "Migration should replace worktree with worktree_path"
+ !config_path.with_extension("toml.new").exists(),
+ "config update must not leave a .new file"
);
}
@@ -1639,222 +1634,72 @@ post-create = "ln -sf {{ repo_root }}/node_modules {{ worktree }}/node_modules"
///
/// The file remains available for the user. If they want a fresh one, `wt config show` regenerates.
#[rstest]
-fn test_deprecated_template_variables_hint_deduplication(repo: TestRepo, temp_home: TempDir) {
+fn test_wt_list_never_writes_migration_file(repo: TestRepo, temp_home: TempDir) {
// Write project config with deprecated variables
let project_config_dir = repo.root_path().join(".config");
fs::create_dir_all(&project_config_dir).unwrap();
let project_config_path = project_config_dir.join("wt.toml");
- fs::write(
- &project_config_path,
- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"
-"#,
- )
- .unwrap();
+ let original = r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"
+"#;
+ fs::write(&project_config_path, original).unwrap();
- // First run - should create migration file and set hint
- {
+ // `wt list` should emit a deprecation warning but never write a .new file
+ // or modify the config. Materializing migrations is `wt config update`'s job.
+ for _ in 0..2 {
let mut cmd = repo.wt_command();
cmd.arg("list").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
let output = cmd.output().unwrap();
assert!(
output.status.success(),
- "First run should succeed: {:?}",
+ "wt list should succeed: {:?}",
String::from_utf8_lossy(&output.stderr)
);
}
- let migration_file = project_config_path.with_extension("toml.new");
assert!(
- migration_file.exists(),
- "First run should create migration file"
+ !project_config_path.with_extension("toml.new").exists(),
+ "wt list must not write a .new migration file"
);
-
- let original_content = fs::read_to_string(&migration_file).unwrap();
-
- // Second run - hint is set, so wt list shows brief warning and skips writing
- {
- let mut cmd = repo.wt_command();
- cmd.arg("list").current_dir(repo.root_path());
- set_temp_home_env(&mut cmd, temp_home.path());
- let output = cmd.output().unwrap();
- let stderr = String::from_utf8_lossy(&output.stderr);
- assert!(
- output.status.success(),
- "Second run should succeed: {:?}",
- stderr
- );
- assert!(
- stderr.contains("is deprecated"),
- "Second run should show deprecation warning, got: {stderr}"
- );
- assert!(
- !stderr.contains("Wrote migrated"),
- "Second run should NOT write migration file (hint is set), got: {stderr}"
- );
- }
-
- // Content should be unchanged (wt list didn't touch it)
- let current_content = fs::read_to_string(&migration_file).unwrap();
assert_eq!(
- original_content, current_content,
- "Migration file should be unchanged by second wt list run"
- );
-}
-
-/// This tests the skip-write path for project config with non-config-show commands.
-///
-/// Migration file write is deduplicated based on file existence:
-/// - First run: file doesn't exist → write it
-/// - Second run: file exists → skip write, show brief warning only
-/// Users can run `wt config show` to force regeneration.
-#[rstest]
-fn test_wt_list_skips_migration_file_after_first_write(repo: TestRepo, temp_home: TempDir) {
- // Write project config with deprecated variables
- // Use deprecated variable main_worktree (should be repo) in a valid project config field
- let project_config_dir = repo.root_path().join(".config");
- fs::create_dir_all(&project_config_dir).unwrap();
- let project_config_path = project_config_dir.join("wt.toml");
- fs::write(
- &project_config_path,
- r#"post-create = "ln -sf {{ main_worktree }}/node_modules"
-"#,
- )
- .unwrap();
-
- // First run - creates migration file
- {
- let mut cmd = repo.wt_command();
- cmd.arg("list").current_dir(repo.root_path());
- set_temp_home_env(&mut cmd, temp_home.path());
- let output = cmd.output().unwrap();
- assert!(
- output.status.success(),
- "First run should succeed: {:?}",
- String::from_utf8_lossy(&output.stderr)
- );
- }
-
- let migration_file = project_config_path.with_extension("toml.new");
- assert!(migration_file.exists());
-
- // Second run - file exists → skip write, show brief warning only
- let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
- settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- cmd.arg("list").current_dir(repo.root_path());
- set_temp_home_env(&mut cmd, temp_home.path());
-
- assert_cmd_snapshot!(cmd);
- });
-
- // Migration file still exists (not deleted or overwritten)
- assert!(
- migration_file.exists(),
- "Migration file should still exist after second run"
+ fs::read_to_string(&project_config_path).unwrap(),
+ original,
+ "wt list must not modify the config"
);
}
-/// Migration file is regenerated when deleted (file-existence based deduplication).
+/// Fixing a deprecated config and later introducing a new one still shows a
+/// warning on the new deprecation — no stale state persists across process
+/// runs now that `.new` files are gone, so this just exercises the plain
+/// per-process warning path.
#[rstest]
-fn test_deleted_migration_file_regenerated(repo: TestRepo, temp_home: TempDir) {
- // Write project config with deprecated variables
- let project_config_dir = repo.root_path().join(".config");
- fs::create_dir_all(&project_config_dir).unwrap();
- let project_config_path = project_config_dir.join("wt.toml");
- fs::write(
- &project_config_path,
- r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"
-"#,
- )
- .unwrap();
-
- // First run - creates migration file
- {
- let mut cmd = repo.wt_command();
- cmd.arg("list").current_dir(repo.root_path());
- set_temp_home_env(&mut cmd, temp_home.path());
- let output = cmd.output().unwrap();
- assert!(
- output.status.success(),
- "First run should succeed: {:?}",
- String::from_utf8_lossy(&output.stderr)
- );
- }
-
- let migration_file = project_config_path.with_extension("toml.new");
- assert!(migration_file.exists());
-
- // Delete the migration file to simulate user having applied and removed it
- fs::remove_file(&migration_file).unwrap();
-
- // Second run - should recreate migration file since it doesn't exist
- {
- let mut cmd = repo.wt_command();
- cmd.arg("list").current_dir(repo.root_path());
- set_temp_home_env(&mut cmd, temp_home.path());
- let output = cmd.output().unwrap();
- assert!(
- output.status.success(),
- "Second run should succeed: {:?}",
- String::from_utf8_lossy(&output.stderr)
- );
- }
-
- // Migration file should exist again
- assert!(
- migration_file.exists(),
- "Migration file should be regenerated after deletion"
- );
-}
-
-/// When a user fixes their deprecated config, the hint should be cleared automatically.
-/// This ensures that future deprecations (introduced months later) get full treatment.
-#[rstest]
-fn test_fixing_deprecated_config_clears_hint_for_future_deprecations(
+fn test_fixing_deprecated_config_then_reintroducing_still_warns(
repo: TestRepo,
temp_home: TempDir,
) {
- // Write project config with deprecated variable
let project_config_dir = repo.root_path().join(".config");
fs::create_dir_all(&project_config_dir).unwrap();
let project_config_path = project_config_dir.join("wt.toml");
+
fs::write(
&project_config_path,
r#"post-create = "ln -sf {{ main_worktree }}/node_modules"
"#,
)
.unwrap();
-
- // First run - creates migration file and sets hint
{
let mut cmd = repo.wt_command();
cmd.arg("list").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
- let output = cmd.output().unwrap();
- assert!(output.status.success());
+ assert!(cmd.output().unwrap().status.success());
}
- assert!(
- project_config_path.with_extension("toml.new").exists(),
- "First run should create migration file"
- );
- // User fixes the config (removes deprecation)
fs::write(
&project_config_path,
r#"pre-start = "ln -sf {{ repo }}/node_modules"
"#,
)
.unwrap();
-
- // Clean up migration file
- let migration_file = project_config_path.with_extension("toml.new");
- if migration_file.exists() {
- fs::remove_file(&migration_file).unwrap();
- }
-
- // Second run with fixed config - hint should be cleared
{
let mut cmd = repo.wt_command();
cmd.arg("list").current_dir(repo.root_path());
@@ -1864,20 +1709,16 @@ fn test_fixing_deprecated_config_clears_hint_for_future_deprecations(
let stderr = String::from_utf8_lossy(&output.stderr);
assert!(
!stderr.contains("deprecated"),
- "No deprecation warning for fixed config"
+ "No deprecation warning for clean config"
);
}
- // Months later, a NEW deprecation is introduced - user adds a different deprecated variable
fs::write(
&project_config_path,
r#"post-create = "cd {{ worktree }} && npm install"
"#,
)
.unwrap();
-
- // Third run with new deprecation - should get full treatment
- // because hint was cleared when config was clean
{
let mut cmd = repo.wt_command();
cmd.arg("list").current_dir(repo.root_path());
@@ -1891,10 +1732,9 @@ fn test_fixing_deprecated_config_clears_hint_for_future_deprecations(
);
}
- // Migration file should exist for the new deprecation
assert!(
- migration_file.exists(),
- "Migration file should be created for new deprecation"
+ !project_config_path.with_extension("toml.new").exists(),
+ "wt list must never write a .new file"
);
}
@@ -1957,66 +1797,39 @@ fn test_deprecated_project_config_silent_in_feature_worktree(repo: TestRepo, tem
}
}
-/// User config migration file write is deduplicated based on file existence.
-/// First run creates the migration file. Subsequent runs skip the write
-/// if the file already exists (brief warning only).
+/// `wt list` emits a user-config deprecation warning but never writes a
+/// `.new` file. Materializing migrations is `wt config update`'s job; passive
+/// commands stay side-effect-free on disk.
#[rstest]
-fn test_user_config_deprecated_variables_deduplication(repo: TestRepo, temp_home: TempDir) {
- // Write user config with deprecated variables using the test config path
- // (WORKTRUNK_CONFIG_PATH is set by repo.wt_command(), not .config/worktrunk/config.toml)
+fn test_user_config_deprecation_warns_without_writing(repo: TestRepo, temp_home: TempDir) {
repo.write_test_config(
r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"
"#,
);
let user_config_path = repo.test_config_path().to_path_buf();
+ let original = fs::read_to_string(&user_config_path).unwrap();
- // First run - should create migration file
- {
- let mut cmd = repo.wt_command();
- cmd.arg("list").current_dir(repo.root_path());
- set_temp_home_env(&mut cmd, temp_home.path());
- cmd.env("WORKTRUNK_CONFIG_PATH", &user_config_path);
- let output = cmd.output().unwrap();
- assert!(
- output.status.success(),
- "First run should succeed: {:?}",
- String::from_utf8_lossy(&output.stderr)
- );
- }
+ let mut cmd = repo.wt_command();
+ cmd.arg("list").current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+ cmd.env("WORKTRUNK_CONFIG_PATH", &user_config_path);
+ let output = cmd.output().unwrap();
+ let stderr = String::from_utf8_lossy(&output.stderr);
- let migration_file = user_config_path.with_extension("toml.new");
+ assert!(output.status.success(), "wt list should succeed: {stderr}");
assert!(
- migration_file.exists(),
- "First run should create migration file"
+ stderr.contains("User config:") && stderr.contains("is deprecated"),
+ "Should emit user-config deprecation warning, got: {stderr}"
+ );
+ assert!(
+ !user_config_path.with_extension("toml.new").exists(),
+ "wt list must not write a .new migration file"
+ );
+ assert_eq!(
+ fs::read_to_string(&user_config_path).unwrap(),
+ original,
+ "wt list must not modify user config"
);
-
- // Second run - hint is already marked shown, skip file write
- // Should show brief warning only, NOT regenerate the file
- {
- let mut cmd = repo.wt_command();
- cmd.arg("list").current_dir(repo.root_path());
- set_temp_home_env(&mut cmd, temp_home.path());
- cmd.env("WORKTRUNK_CONFIG_PATH", &user_config_path);
- let output = cmd.output().unwrap();
- let stderr = String::from_utf8_lossy(&output.stderr);
- assert!(
- output.status.success(),
- "Second run should succeed: {:?}",
- stderr
- );
- // Should still show deprecation warning but NOT write file
- assert!(
- stderr.contains("User config:") && stderr.contains("is deprecated"),
- "Second run should show deprecation warning, got: {stderr}"
- );
- assert!(
- !stderr.contains("Wrote migrated"),
- "Second run should NOT regenerate migration file (hint already shown), got: {stderr}"
- );
- }
-
- // Verify migration file still exists (from first run)
- assert!(migration_file.exists());
}
#[rstest]
@@ -2571,32 +2384,25 @@ args = ["-m", "haiku"]
assert_cmd_snapshot!(cmd);
});
- // Verify migration file was created (config.toml -> config.toml.new)
- let migration_file = config_path.with_extension("toml.new");
- assert!(
- migration_file.exists(),
- "Migration file should be created at {:?}",
- migration_file
- );
+ // Drive the migration explicitly via `wt config update`; `wt list` only warns.
+ let mut cmd = repo.wt_command();
+ cmd.args(["config", "update", "--yes"])
+ .current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+ cmd.env("WORKTRUNK_CONFIG_PATH", config_path);
+ assert!(cmd.output().unwrap().status.success());
- // Verify migration file has correct transformations
- let migrated_content = fs::read_to_string(&migration_file).unwrap();
- assert!(
- migrated_content.contains("[commit.generation]"),
- "Migration should rename [commit-generation] to [commit.generation]"
- );
- assert!(
- migrated_content.contains("command = \"llm -m haiku\""),
- "Migration should merge args into command"
- );
+ let migrated = fs::read_to_string(config_path).unwrap();
assert!(
- !migrated_content.contains("[commit-generation]"),
- "Migration should remove old section name"
+ migrated.contains("[commit.generation]"),
+ "Should rename [commit-generation] to [commit.generation]"
);
assert!(
- !migrated_content.contains("args ="),
- "Migration should remove args field"
+ migrated.contains("command = \"llm -m haiku\""),
+ "Should merge args into command"
);
+ assert!(!migrated.contains("[commit-generation]"));
+ assert!(!migrated.contains("args ="));
}
/// Test that deprecated project-level [projects."...".commit-generation] shows warning
@@ -2629,18 +2435,18 @@ command = "llm -m gpt-4"
assert_cmd_snapshot!(cmd);
});
- // Verify migration file was created and has correct transformations
- let migration_file = config_path.with_extension("toml.new");
- assert!(
- migration_file.exists(),
- "Migration file should be created at {:?}",
- migration_file
- );
+ // Drive the migration explicitly via `wt config update`; `wt list` only warns.
+ let mut cmd = repo.wt_command();
+ cmd.args(["config", "update", "--yes"])
+ .current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+ cmd.env("WORKTRUNK_CONFIG_PATH", config_path);
+ assert!(cmd.output().unwrap().status.success());
- let migrated_content = fs::read_to_string(&migration_file).unwrap();
+ let migrated = fs::read_to_string(config_path).unwrap();
assert!(
- migrated_content.contains("[projects.\"github.com/example/repo\".commit.generation]"),
- "Migration should rename project-level section"
+ migrated.contains("[projects.\"github.com/example/repo\".commit.generation]"),
+ "Should rename project-level section"
);
}
@@ -2673,78 +2479,10 @@ post-create = "ln -sf {{ repo_root }}/node_modules"
assert_cmd_snapshot!(cmd);
});
- // Verify migration file was created
- let migration_file = config_path.with_extension("toml.new");
+ // `wt config show` renders the diff in memory — nothing persists on disk.
assert!(
- migration_file.exists(),
- "Migration file should be created at {:?}",
- migration_file
- );
-}
-
-/// Test that `wt config show` always regenerates migration file
-///
-/// Even if the user deleted the migration file previously, `wt config show`
-/// should always regenerate it (unlike other commands which skip after first write).
-#[rstest]
-fn test_config_show_always_regenerates_migration_file(mut repo: TestRepo, temp_home: TempDir) {
- // Setup mock gh/glab/claude for deterministic output
- repo.setup_mock_ci_tools_unauthenticated();
-
- // Write project config with deprecated variables
- let project_config_dir = repo.root_path().join(".config");
- fs::create_dir_all(&project_config_dir).unwrap();
- let project_config_path = project_config_dir.join("wt.toml");
- fs::write(
- &project_config_path,
- r#"post-create = "ln -sf {{ main_worktree }}/node_modules"
-"#,
- )
- .unwrap();
-
- // First run with wt list - creates migration file and sets hint
- {
- let mut cmd = repo.wt_command();
- cmd.arg("list").current_dir(repo.root_path());
- set_temp_home_env(&mut cmd, temp_home.path());
- let output = cmd.output().unwrap();
- assert!(
- output.status.success(),
- "First run should succeed: {:?}",
- String::from_utf8_lossy(&output.stderr)
- );
- }
-
- let migration_file = project_config_path.with_extension("toml.new");
- assert!(migration_file.exists(), "Migration file should be created");
-
- // Delete the migration file (simulating user applied it or doesn't want it)
- fs::remove_file(&migration_file).unwrap();
-
- // Run wt config show - should regenerate migration file
- let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
- settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
- repo.configure_mock_commands(&mut cmd);
- cmd.arg("config").arg("show").current_dir(repo.root_path());
- set_temp_home_env(&mut cmd, temp_home.path());
- set_xdg_config_path(&mut cmd, temp_home.path());
-
- assert_cmd_snapshot!(cmd);
- });
-
- // Migration file SHOULD be regenerated by wt config show
- assert!(
- migration_file.exists(),
- "Migration file should be regenerated by wt config show"
- );
-
- // Verify the regenerated file has the correct content
- let migrated_content = fs::read_to_string(&migration_file).unwrap();
- assert!(
- migrated_content.contains("{{ repo }}"),
- "Migration should replace main_worktree with repo"
+ !config_path.with_extension("toml.new").exists(),
+ "wt config show must not leave a .new file behind"
);
}
@@ -2829,19 +2567,19 @@ command = "llm -m gpt-4"
assert_cmd_snapshot!(cmd);
});
- // Verify migration file was created
- let migration_file = config_path.with_extension("toml.new");
+ // `wt config show` renders the diff in memory — nothing persists on disk.
assert!(
- migration_file.exists(),
- "Migration file should be created at {:?}",
- migration_file
+ !config_path.with_extension("toml.new").exists(),
+ "wt config show must not leave a .new file behind"
);
}
/// Test that deprecated approved-commands in [projects] sections are copied to approvals.toml
#[rstest]
-fn test_deprecated_approved_commands_copies_to_approvals_file(repo: TestRepo, temp_home: TempDir) {
- // Write user config with approved-commands in [projects] section
+fn test_config_update_copies_approved_commands_to_approvals_file(
+ repo: TestRepo,
+ temp_home: TempDir,
+) {
let config_path = repo.test_config_path();
fs::write(
config_path,
@@ -2853,52 +2591,239 @@ approved-commands = ["npm install", "npm test"]
)
.unwrap();
- // Use `wt list` which loads config and triggers deprecation check
- let settings = setup_snapshot_settings_with_home(&repo, &temp_home);
- settings.bind(|| {
- let mut cmd = wt_command();
- repo.configure_wt_cmd(&mut cmd);
+ // Passive load must NOT copy approvals or modify the config.
+ {
+ let mut cmd = repo.wt_command();
cmd.arg("list").current_dir(repo.root_path());
set_temp_home_env(&mut cmd, temp_home.path());
cmd.env("WORKTRUNK_CONFIG_PATH", config_path);
+ assert!(cmd.output().unwrap().status.success());
+ }
+ assert!(
+ !config_path.with_file_name("approvals.toml").exists(),
+ "wt list must not copy approvals"
+ );
+ assert!(
+ !config_path.with_extension("toml.new").exists(),
+ "wt list must not write .new file"
+ );
- assert_cmd_snapshot!(cmd);
- });
+ // `wt config update --yes` migrates in place: config.toml is rewritten
+ // without approved-commands, and approvals.toml is created alongside it.
+ let mut cmd = repo.wt_command();
+ cmd.args(["config", "update", "--yes"])
+ .current_dir(repo.root_path());
+ set_temp_home_env(&mut cmd, temp_home.path());
+ cmd.env("WORKTRUNK_CONFIG_PATH", config_path);
+ let output = cmd.output().unwrap();
+ assert!(
+ output.status.success(),
+ "config update should succeed: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
- // Verify migration file removes approved-commands
- let migration_file = config_path.with_extension("toml.new");
+ let migrated = fs::read_to_string(config_path).unwrap();
assert!(
- migration_file.exists(),
- "Migration file should be created at {:?}",
- migration_file
+ !migrated.contains("approved-commands"),
+ "config.toml should no longer contain approved-commands: {migrated}"
);
- let migrated_content = fs::read_to_string(&migration_file).unwrap();
assert!(
- !migrated_content.contains("approved-commands"),
- "Migration should remove approved-commands"
+ !config_path.with_extension("toml.new").exists(),
+ "config update must not leave a .new file behind"
);
- // Verify approvals were copied to approvals.toml (sibling of config file)
let approvals_file = config_path.with_file_name("approvals.toml");
+ assert!(approvals_file.exists(), "approvals.toml should be created");
+ let approvals = fs::read_to_string(&approvals_file).unwrap();
+ assert!(
+ approvals.contains("npm install") && approvals.contains("npm test"),
+ "approvals.toml should carry both commands: {approvals}"
+ );
+}
+
+// ==================== config update tests ====================
+
+/// `wt config update` migrates project config in place (from the main
+/// worktree). Covers the project-config path in `check_project_config`.
+#[rstest]
+fn test_config_update_applies_project_config_migration(repo: TestRepo) {
+ repo.write_project_config(
+ r#"post-create = "ln -sf {{ main_worktree }}/node_modules"
+"#,
+ );
+ repo.commit("Add deprecated project config");
+ let project_config_path = repo.root_path().join(".config").join("wt.toml");
+
+ let output = repo
+ .wt_command()
+ .args(["config", "update", "--yes"])
+ .output()
+ .unwrap();
assert!(
- approvals_file.exists(),
- "Approvals should be copied to {:?}",
- approvals_file
+ output.status.success(),
+ "config update should succeed: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+
+ let updated = fs::read_to_string(&project_config_path).unwrap();
+ assert!(updated.contains("pre-start"));
+ assert!(updated.contains("{{ repo }}"));
+ assert!(!updated.contains("post-create"));
+}
+
+/// `wt config update` with a clean project config (no deprecations) treats
+/// the repo as nothing-to-do — covers the project-config path through
+/// `check_and_migrate` when it returns `info == None`.
+#[rstest]
+fn test_config_update_clean_project_config_is_noop(repo: TestRepo) {
+ repo.write_project_config(
+ r#"pre-start = "echo ready"
+"#,
);
- let approvals_content = fs::read_to_string(&approvals_file).unwrap();
+ repo.commit("Add clean project config");
+
+ let output = repo
+ .wt_command()
+ .args(["config", "update"])
+ .output()
+ .unwrap();
+ assert!(output.status.success());
+ let stderr = String::from_utf8_lossy(&output.stderr);
assert!(
- approvals_content.contains("npm install"),
- "Approvals file should contain npm install: {}",
- approvals_content
+ stderr.contains("No deprecated settings found"),
+ "Expected no-op message, got: {stderr}"
+ );
+}
+
+/// `wt config update` from a linked worktree declines to mutate project
+/// config and instead points at the main worktree. Covers the `is_linked`
+/// branch in `check_project_config`.
+#[rstest]
+fn test_config_update_project_config_from_linked_worktree_shows_hint(repo: TestRepo) {
+ repo.write_project_config(
+ r#"post-create = "ln -sf {{ main_worktree }}/node_modules"
+"#,
);
+ repo.commit("Add deprecated project config");
+ let project_config_path = repo.root_path().join(".config").join("wt.toml");
+ let before = fs::read_to_string(&project_config_path).unwrap();
+
+ let feature_path = repo.root_path().parent().unwrap().join("feature-test");
+ repo.run_git(&[
+ "worktree",
+ "add",
+ feature_path.to_str().unwrap(),
+ "-b",
+ "feature-test",
+ ]);
+
+ let output = repo
+ .wt_command()
+ .args(["config", "update", "--yes"])
+ .current_dir(&feature_path)
+ .output()
+ .unwrap();
+ assert!(output.status.success());
+ let stderr = String::from_utf8_lossy(&output.stderr);
assert!(
- approvals_content.contains("npm test"),
- "Approvals file should contain npm test: {}",
- approvals_content
+ stderr.contains("To update project config:"),
+ "Should hint at main worktree, got: {stderr}"
+ );
+ assert_eq!(
+ fs::read_to_string(&project_config_path).unwrap(),
+ before,
+ "Project config must not change when run from linked worktree"
);
}
-// ==================== config update tests ====================
+/// `wt config update --print` with both user- and project-config deprecations
+/// emits both, separated by labeled headers on stdout.
+#[rstest]
+fn test_config_update_print_emits_both_configs(repo: TestRepo) {
+ let user_config_path = repo.test_config_path();
+ fs::write(
+ user_config_path,
+ r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"
+"#,
+ )
+ .unwrap();
+ repo.write_project_config(
+ r#"post-create = "ln -sf {{ main_worktree }}/node_modules"
+"#,
+ );
+ repo.commit("Add deprecated project config");
+
+ let output = repo
+ .wt_command()
+ .args(["config", "update", "--print"])
+ .output()
+ .unwrap();
+ assert!(output.status.success());
+ let stdout = String::from_utf8_lossy(&output.stdout);
+ assert!(stdout.contains("# User config"));
+ assert!(stdout.contains("# Project config"));
+ assert!(stdout.contains("{{ repo }}"));
+ assert!(stdout.contains("pre-start"));
+}
+
+/// `wt config update --print` on a clean config exits silently with empty
+/// stdout — no "nothing to do" noise to corrupt a pipe.
+#[rstest]
+fn test_config_update_print_on_clean_config_is_silent(repo: TestRepo) {
+ fs::write(
+ repo.test_config_path(),
+ r#"worktree-path = "../{{ repo }}.{{ branch }}"
+"#,
+ )
+ .unwrap();
+
+ let output = repo
+ .wt_command()
+ .args(["config", "update", "--print"])
+ .output()
+ .unwrap();
+ assert!(output.status.success());
+ assert!(
+ output.stdout.is_empty(),
+ "stdout must be empty on clean config"
+ );
+}
+
+/// `wt config update --print` emits the migrated TOML to stdout without
+/// touching the config file. Warnings still go to stderr.
+#[rstest]
+fn test_config_update_print_emits_migrated_without_writing(repo: TestRepo) {
+ let config_path = repo.test_config_path();
+ let original = r#"worktree-path = "../{{ main_worktree }}.{{ branch }}"
+"#;
+ fs::write(config_path, original).unwrap();
+
+ let output = repo
+ .wt_command()
+ .args(["config", "update", "--print"])
+ .output()
+ .unwrap();
+
+ assert!(
+ output.status.success(),
+ "config update --print should succeed: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+ let stdout = String::from_utf8_lossy(&output.stdout);
+ assert!(
+ stdout.contains("{{ repo }}") && !stdout.contains("{{ main_worktree }}"),
+ "stdout should contain migrated content, got: {stdout}"
+ );
+ assert_eq!(
+ fs::read_to_string(config_path).unwrap(),
+ original,
+ "--print must not modify the config file"
+ );
+ assert!(
+ !config_path.with_extension("toml.new").exists(),
+ "--print must not write a .new file"
+ );
+}
/// `wt config update` with no deprecated settings reports nothing to do
#[rstest]
diff --git a/tests/integration_tests/output_system_guard.rs b/tests/integration_tests/output_system_guard.rs
index 29a1070f0..38a3b4c3d 100644
--- a/tests/integration_tests/output_system_guard.rs
+++ b/tests/integration_tests/output_system_guard.rs
@@ -46,6 +46,8 @@ const STDOUT_ALLOWED_PATHS: &[&str] = &[
"handle_switch.rs",
// JSON output for wt config show --format=json
"config/show.rs",
+ // Migrated TOML output for wt config update --print (pipeable)
+ "config/update.rs",
// JSON output for wt step for-each --format=json
"for_each.rs",
// JSON output for wt merge --format=json
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snap
deleted file mode 100644
index 07157d209..000000000
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_always_regenerates_migration_file.snap
+++ /dev/null
@@ -1,75 +0,0 @@
----
-source: tests/integration_tests/config_show.rs
-info:
- program: wt
- args:
- - config
- - show
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- GIT_EDITOR: ""
- GIT_TERMINAL_PROMPT: "0"
- HOME: "[TEST_HOME]"
- LANG: C
- LC_ALL: C
- MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
- NO_COLOR: ""
- OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
- PATH: "[PATH]"
- PSModulePath: ""
- RUST_LOG: warn
- SHELL: ""
- TERM: alacritty
- USERPROFILE: "[TEST_HOME]"
- WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
- WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
- WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
- WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
- WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
- WORKTRUNK_TEST_EPOCH: "1735776000"
- WORKTRUNK_TEST_NUSHELL_ENV: "0"
- WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
- WORKTRUNK_TEST_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
-USER CONFIG @ ~/.config/worktrunk/config.toml
-↳ Not found; to create one, run wt config create
-
-PROJECT CONFIG @ _REPO_/.config/wt.toml
-▲ Project config: template variable main_worktree is deprecated in favor of repo
-▲ Project config: post-create hook is deprecated in favor of pre-start
-↳ To apply: wt config update
-○ Proposed diff:
-  diff --git a_REPO_/.config/wt.toml b_REPO_/.config/wt.toml.new
-  index 8fcdb47..7792aac 100644
-  --- a_REPO_/.config/wt.toml
-  +++ b_REPO_/.config/wt.toml.new
-  @@ -1 +1 @@
-  -post-create = "ln -sf {{ main_worktree }}/node_modules"
-  +pre-start = "ln -sf {{ repo }}/node_modules"
-
-SHELL INTEGRATION
-▲ Shell integration not active
-  Invoked as: [PROJECT_ROOT]/target/debug/wt
-
-○ bash: Skipped; ~/.bashrc not found
-○ zsh: Skipped; ~/.zshrc not found
-○ fish: Skipped; ~/.config/fish/functions not found
-○ nu: Skipped; ~/.config/nushell/vendor/autoload not found
-
-OTHER
-○ wt: [VERSION]
-○ git: [VERSION]
-○ Hyperlinks: inactive
-
------ stderr -----
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap
index 0e90950da..6c7eb3c1f 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_deprecation_details.snap
@@ -48,10 +48,10 @@ exit_code: 0
▲ User config: post-create hook is deprecated in favor of pre-start
↳ To apply: wt config update
○ Proposed diff:
-  diff --git a[TEMP_HOME]/.config/worktrunk/config.toml b[TEMP_HOME]/.config/worktrunk/config.toml.new
+  diff --git a/config.toml/current b/config.toml/migrated
  index d95d100..5eef8a6 100644
-  --- a[TEMP_HOME]/.config/worktrunk/config.toml
-  +++ b[TEMP_HOME]/.config/worktrunk/config.toml.new
+  --- a/config.toml/current
+  +++ b/config.toml/migrated
  @@ -1,2 +1,2 @@
  -worktree-path = "../{{ main_worktree }}.{{ branch }}"
  -post-create = "ln -sf {{ repo_root }}/node_modules"
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_no_cd_deprecation.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_no_cd_deprecation.snap
index 0dc122f2d..0bb9412a5 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_no_cd_deprecation.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_no_cd_deprecation.snap
@@ -46,10 +46,10 @@ exit_code: 0
▲ User config: switch.no-cd is deprecated in favor of switch.cd (inverted)
↳ To apply: wt config update
○ Proposed diff:
-  diff --git a[TEMP_HOME]/.config/worktrunk/config.toml b[TEMP_HOME]/.config/worktrunk/config.toml.new
+  diff --git a/config.toml/current b/config.toml/migrated
  index ec5c19e..2c6162a 100644
-  --- a[TEMP_HOME]/.config/worktrunk/config.toml
-  +++ b[TEMP_HOME]/.config/worktrunk/config.toml.new
+  --- a/config.toml/current
+  +++ b/config.toml/migrated
  @@ -1,2 +1,2 @@
  [switch]
  -no-cd = true
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_no_ff_deprecation.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_no_ff_deprecation.snap
index 78c4b3ff5..5d3fd01ea 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_no_ff_deprecation.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_no_ff_deprecation.snap
@@ -46,10 +46,10 @@ exit_code: 0
▲ User config: merge.no-ff is deprecated in favor of merge.ff (inverted)
↳ To apply: wt config update
○ Proposed diff:
-  diff --git a[TEMP_HOME]/.config/worktrunk/config.toml b[TEMP_HOME]/.config/worktrunk/config.toml.new
+  diff --git a/config.toml/current b/config.toml/migrated
  index f4de629..27f3868 100644
-  --- a[TEMP_HOME]/.config/worktrunk/config.toml
-  +++ b[TEMP_HOME]/.config/worktrunk/config.toml.new
+  --- a/config.toml/current
+  +++ b/config.toml/migrated
  @@ -1,2 +1,2 @@
  [merge]
  -no-ff = true
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_pre_hook_table_form_deprecation.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_pre_hook_table_form_deprecation.snap
index 3533462cc..aea587b9c 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_pre_hook_table_form_deprecation.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_pre_hook_table_form_deprecation.snap
@@ -49,10 +49,10 @@ exit_code: 0
▲ Project config: table form for pre-start, pre-merge is deprecated in favor of the pipeline form. We're unifying pre-hooks, post-hooks, and aliases so that list form always runs serially and table form always runs in parallel — migrate now to keep the current serial behavior once the table form is repurposed.
↳ To apply: wt config update
○ Proposed diff:
-  diff --git a_REPO_/.config/wt.toml b_REPO_/.config/wt.toml.new
+  diff --git a/wt.toml/current b/wt.toml/migrated
  index 3a61835..dc2a222 100644
-  --- a_REPO_/.config/wt.toml
-  +++ b_REPO_/.config/wt.toml.new
+  --- a/wt.toml/current
+  +++ b/wt.toml/migrated
  @@ -1,7 +1,11 @@
  -[pre-merge]
  +[[pre-merge]]
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_project_commit_generation_deprecations.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_project_commit_generation_deprecations.snap
index df2046864..e1081e6d4 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_project_commit_generation_deprecations.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_project_commit_generation_deprecations.snap
@@ -46,10 +46,10 @@ exit_code: 0
▲ User config: [projects."github.com/example/repo".commit-generation] is deprecated in favor of [projects."github.com/example/repo".commit.generation]
↳ To apply: wt config update
○ Proposed diff:
-  diff --git a[TEMP_HOME]/.config/worktrunk/config.toml b[TEMP_HOME]/.config/worktrunk/config.toml.new
+  diff --git a/config.toml/current b/config.toml/migrated
  index de80729..131a2fd 100644
-  --- a[TEMP_HOME]/.config/worktrunk/config.toml
-  +++ b[TEMP_HOME]/.config/worktrunk/config.toml.new
+  --- a/config.toml/current
+  +++ b/config.toml/migrated
  @@ -1,4 +1,4 @@
  worktree-path = "../{{ repo }}.{{ branch }}"
  
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_select_section_deprecation.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_select_section_deprecation.snap
index e4e8ba97c..c9bde7213 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_displays_select_section_deprecation.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_displays_select_section_deprecation.snap
@@ -46,10 +46,10 @@ exit_code: 0
▲ User config: [select] is deprecated in favor of [switch.picker]
↳ To apply: wt config update
○ Proposed diff:
-  diff --git a[TEMP_HOME]/.config/worktrunk/config.toml b[TEMP_HOME]/.config/worktrunk/config.toml.new
+  diff --git a/config.toml/current b/config.toml/migrated
  index 0d6352a..3e94895 100644
-  --- a[TEMP_HOME]/.config/worktrunk/config.toml
-  +++ b[TEMP_HOME]/.config/worktrunk/config.toml.new
+  --- a/config.toml/current
+  +++ b/config.toml/migrated
  @@ -1,2 +1,2 @@
  -[select]
  +[switch.picker]
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_project_config_for_ci.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_project_config_for_ci.snap
index f518d67d5..0016d9427 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_project_config_for_ci.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_project_config_for_ci.snap
@@ -46,10 +46,10 @@ exit_code: 0
▲ User config: [ci] is deprecated in favor of [forge]
↳ To apply: wt config update
○ Proposed diff:
-  diff --git a[TEMP_HOME]/.config/worktrunk/config.toml b[TEMP_HOME]/.config/worktrunk/config.toml.new
+  diff --git a/config.toml/current b/config.toml/migrated
  index 2e0e0bb..9d78d51 100644
-  --- a[TEMP_HOME]/.config/worktrunk/config.toml
-  +++ b[TEMP_HOME]/.config/worktrunk/config.toml.new
+  --- a/config.toml/current
+  +++ b/config.toml/migrated
  @@ -1,4 +1,4 @@
  worktree-path = "../{{ repo }}.{{ branch }}"
  
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_user_config_for_commit_generation.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_user_config_for_commit_generation.snap
index fd801ee8a..af1a178a7 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_user_config_for_commit_generation.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_suggests_user_config_for_commit_generation.snap
@@ -50,10 +50,10 @@ exit_code: 0
▲ Project config: [commit-generation] is deprecated in favor of [commit.generation]
↳ To apply: wt config update
○ Proposed diff:
-  diff --git a_REPO_/.config/wt.toml b_REPO_/.config/wt.toml.new
+  diff --git a/wt.toml/current b/wt.toml/migrated
  index 074c30f..bcaf404 100644
-  --- a_REPO_/.config/wt.toml
-  +++ b_REPO_/.config/wt.toml.new
+  --- a/wt.toml/current
+  +++ b/wt.toml/migrated
  @@ -1,2 +1,2 @@
  -[commit-generation]
  -command = "claude"
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_with_project_config.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_with_project_config.snap
index e9839fff4..293d308ef 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_show_with_project_config.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_with_project_config.snap
@@ -50,10 +50,10 @@ exit_code: 0
▲ Project config: post-create hook is deprecated in favor of pre-start
↳ To apply: wt config update
○ Proposed diff:
-  diff --git a_REPO_/.config/wt.toml b_REPO_/.config/wt.toml.new
+  diff --git a/wt.toml/current b/wt.toml/migrated
  index 13d6ba3..6ccc26d 100644
-  --- a_REPO_/.config/wt.toml
-  +++ b_REPO_/.config/wt.toml.new
+  --- a/wt.toml/current
+  +++ b/wt.toml/migrated
  @@ -1,4 +1,4 @@
  -post-create = "npm install"
  +pre-start = "npm install"
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_approved_commands_migration.snap b/tests/snapshots/integration__integration_tests__config_show__config_update_applies_approved_commands_migration.snap
index 06d03d93d..60abec451 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_approved_commands_migration.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_update_applies_approved_commands_migration.snap
@@ -46,15 +46,15 @@ exit_code: 0
----- stderr -----
▲ User config: approved-commands under [projects] is deprecated in favor of approvals.toml
-↳ Copied approved commands to approvals.toml
○ Proposed diff:
-  diff --git a[TEST_CONFIG] b[TEST_CONFIG_NEW]
+  diff --git a/test-config.toml/current b/test-config.toml/migrated
  index 51f8ab1..a30ca31 100644
-  --- a[TEST_CONFIG]
-  +++ b[TEST_CONFIG_NEW]
+  --- a/test-config.toml/current
+  +++ b/test-config.toml/migrated
  @@ -1,4 +1 @@
  worktree-path = "../{{ repo }}.{{ branch }}"
  -
  -[projects."github.com/user/repo"]
  -approved-commands = ["npm install", "npm test"]
+○ Copied approved commands to approvals.toml
✓ Updated user config
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_commit_generation_migration.snap b/tests/snapshots/integration__integration_tests__config_show__config_update_applies_commit_generation_migration.snap
index c907ad890..746cdf466 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_commit_generation_migration.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_update_applies_commit_generation_migration.snap
@@ -47,10 +47,10 @@ exit_code: 0
----- stderr -----
▲ User config: [commit-generation] is deprecated in favor of [commit.generation]
○ Proposed diff:
-  diff --git a[TEST_CONFIG] b[TEST_CONFIG_NEW]
+  diff --git a/test-config.toml/current b/test-config.toml/migrated
  index 40d0385..bc7273c 100644
-  --- a[TEST_CONFIG]
-  +++ b[TEST_CONFIG_NEW]
+  --- a/test-config.toml/current
+  +++ b/test-config.toml/migrated
  @@ -1,5 +1,4 @@
  worktree-path = "../{{ repo }}.{{ branch }}"
  
diff --git a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_template_var_migration.snap b/tests/snapshots/integration__integration_tests__config_show__config_update_applies_template_var_migration.snap
index 408b0db63..99166f016 100644
--- a/tests/snapshots/integration__integration_tests__config_show__config_update_applies_template_var_migration.snap
+++ b/tests/snapshots/integration__integration_tests__config_show__config_update_applies_template_var_migration.snap
@@ -50,10 +50,10 @@ exit_code: 0
▲ User config: template variable main_worktree is deprecated in favor of repo
▲ User config: post-create hook is deprecated in favor of pre-start
○ Proposed diff:
-  diff --git a[TEST_CONFIG] b[TEST_CONFIG_NEW]
+  diff --git a/test-config.toml/current b/test-config.toml/migrated
  index 89b3165..b3535c5 100644
-  --- a[TEST_CONFIG]
-  +++ b[TEST_CONFIG_NEW]
+  --- a/test-config.toml/current
+  +++ b/test-config.toml/migrated
  @@ -1,2 +1,2 @@
  -worktree-path = "../{{ main_worktree }}.{{ branch }}"
  -post-create = "ln -sf {{ repo_root }}/node_modules {{ worktree }}/node_modules"
diff --git a/tests/snapshots/integration__integration_tests__config_show__deprecated_approved_commands_copies_to_approvals_file.snap b/tests/snapshots/integration__integration_tests__config_show__deprecated_approved_commands_copies_to_approvals_file.snap
deleted file mode 100644
index b96baa7f8..000000000
--- a/tests/snapshots/integration__integration_tests__config_show__deprecated_approved_commands_copies_to_approvals_file.snap
+++ /dev/null
@@ -1,56 +0,0 @@
----
-source: tests/integration_tests/config_show.rs
-info:
- program: wt
- args:
- - list
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- GIT_EDITOR: ""
- GIT_TERMINAL_PROMPT: "0"
- HOME: "[TEST_HOME]"
- LANG: C
- LC_ALL: C
- MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
- NO_COLOR: ""
- OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
- PATH: "[PATH]"
- PSModulePath: ""
- RUST_LOG: warn
- SHELL: ""
- TERM: alacritty
- USERPROFILE: "[TEST_HOME]"
- WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
- WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
- WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
- WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
- WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
- WORKTRUNK_TEST_EPOCH: "1735776000"
- WORKTRUNK_TEST_NUSHELL_ENV: "0"
- WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
- WORKTRUNK_TEST_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
- Branch Status HEAD± main↕ Remote⇅ Path Commit Age Message
-@ main ^| | . 05a4a45d 16h Initial commit
-+ feature-a ↑ ↑1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑ ↑1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑ ↑1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
-○ Showing 4 worktrees, 3 ahead
-
------ stderr -----
-▲ User config: approved-commands under [projects] is deprecated in favor of approvals.toml
-↳ Copied approved commands to approvals.toml
-↳ To see details, run wt config show; to apply updates, run wt config update
-↳ Copied approved commands to approvals.toml
diff --git a/tests/snapshots/integration__integration_tests__config_show__wt_list_skips_migration_file_after_first_write.snap b/tests/snapshots/integration__integration_tests__config_show__wt_list_skips_migration_file_after_first_write.snap
deleted file mode 100644
index 6c243ac4b..000000000
--- a/tests/snapshots/integration__integration_tests__config_show__wt_list_skips_migration_file_after_first_write.snap
+++ /dev/null
@@ -1,55 +0,0 @@
----
-source: tests/integration_tests/config_show.rs
-info:
- program: wt
- args:
- - list
- env:
- APPDATA: "[TEST_CONFIG_HOME]"
- CLICOLOR_FORCE: "1"
- COLUMNS: "500"
- GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
- GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
- GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
- GIT_CONFIG_SYSTEM: /dev/null
- GIT_EDITOR: ""
- GIT_TERMINAL_PROMPT: "0"
- HOME: "[TEST_HOME]"
- LANG: C
- LC_ALL: C
- MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
- NO_COLOR: ""
- OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
- PATH: "[PATH]"
- PSModulePath: ""
- RUST_LOG: warn
- SHELL: ""
- TERM: alacritty
- USERPROFILE: "[TEST_HOME]"
- WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
- WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
- WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
- WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
- WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
- WORKTRUNK_TEST_EPOCH: "1735776000"
- WORKTRUNK_TEST_NUSHELL_ENV: "0"
- WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
- WORKTRUNK_TEST_POWERSHELL_ENV: "0"
- WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
- XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
----
-success: true
-exit_code: 0
------ stdout -----
- Branch Status HEAD± main↕ Remote⇅ Path Commit Age Message
-@ main ? ^| | . 05a4a45d 16h Initial commit
-+ feature-a ↑ ↑1 ../repo.feature-a 1b87d473 16h Add feature-a file
-+ feature-b ↑ ↑1 ../repo.feature-b f62940fc 16h Add feature-b file
-+ feature-c ↑ ↑1 ../repo.feature-c 345c7c93 16h Add feature-c file
-
-○ Showing 4 worktrees, 1 with changes, 3 ahead
-
------ stderr -----
-▲ Project config: template variable main_worktree is deprecated in favor of repo
-▲ Project config: post-create hook is deprecated in favor of pre-start
-↳ To see details, run wt config show; to apply updates, run wt config update
diff --git a/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_accept.snap b/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_accept.snap
index 22e0b81dd..961b8f020 100644
--- a/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_accept.snap
+++ b/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_accept.snap
@@ -6,10 +6,10 @@ expression: "&output"
▲ User config: template variable main_worktree is deprecated in favor of repo
▲ User config: post-create hook is deprecated in favor of pre-start
○ Proposed diff:
-  diff --git a[TEST_CONFIG] b[TEST_CONFIG_NEW]
+  diff --git a/test-config.toml/current b/test-config.toml/migrated
  index d95d100..5eef8a6 100644
-  --- a[TEST_CONFIG]
-  +++ b[TEST_CONFIG_NEW]
+  --- a/test-config.toml/current
+  +++ b/test-config.toml/migrated
  @@ -1,2 +1,2 @@
  -worktree-path = "../{{ main_worktree }}.{{ branch }}"
  -post-create = "ln -sf {{ repo_root }}/node_modules"
diff --git a/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_decline.snap b/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_decline.snap
index 27336407a..c9aa2c965 100644
--- a/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_decline.snap
+++ b/tests/snapshots/integration__integration_tests__config_update_pty__config_update_prompt_decline.snap
@@ -6,10 +6,10 @@ expression: "&output"
▲ User config: template variable main_worktree is deprecated in favor of repo
▲ User config: post-create hook is deprecated in favor of pre-start
○ Proposed diff:
-  diff --git a[TEST_CONFIG] b[TEST_CONFIG_NEW]
+  diff --git a/test-config.toml/current b/test-config.toml/migrated
  index d95d100..5eef8a6 100644
-  --- a[TEST_CONFIG]
-  +++ b[TEST_CONFIG_NEW]
+  --- a/test-config.toml/current
+  +++ b/test-config.toml/migrated
  @@ -1,2 +1,2 @@
  -worktree-path = "../{{ main_worktree }}.{{ branch }}"
  -post-create = "ln -sf {{ repo_root }}/node_modules"