migration

package
v0.81.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package migration handles one-time migration of legacy sidecar state files to the centralized XDG-compliant locations introduced in the feature/centralized-project-storage PR.

Legacy layout (before centralization):

<project-root>/.sidecar/shells.json      → project shell manifest
<project-root>/.sidecar/config.json      → project prompt config
<project-root>/.td-root                  → td database root pointer
<worktree>/.sidecar-task                 → linked task ID
<worktree>/.sidecar-agent                → agent type
<worktree>/.sidecar-pr                   → PR URL
<worktree>/.sidecar-base                 → base branch
<worktree>/.sidecar-start.sh             → agent launcher script

New layout (after centralization):

~/.local/state/sidecar/projects/<slug>/shells.json
~/.local/state/sidecar/projects/<slug>/config.json
~/.local/state/sidecar/projects/<slug>/td-root
~/.local/state/sidecar/projects/<slug>/worktrees/<wt-slug>/task
~/.local/state/sidecar/projects/<slug>/worktrees/<wt-slug>/agent
~/.local/state/sidecar/projects/<slug>/worktrees/<wt-slug>/pr
~/.local/state/sidecar/projects/<slug>/worktrees/<wt-slug>/base
~/.local/state/sidecar/projects/<slug>/worktrees/<wt-slug>/start.sh

Migration is:

  • Automatic: called on first use of a project directory
  • Idempotent: safe to call multiple times, will not overwrite existing data
  • Non-destructive: legacy files are never deleted
  • Logged: each migrated file is reported via slog.Info

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MigrateProject

func MigrateProject(projectRoot string, worktrees []string) error

MigrateProject migrates legacy project-level files from projectRoot to the centralized state directory. The worktrees slice lists all worktree paths that belong to this project (including the main worktree / projectRoot itself). Passing an empty worktrees slice skips worktree migration.

Each file is only copied if the destination does not already exist. The originals are never removed.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL