Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ All strategies implement:
| **manual-commit** (default) | Unchanged (no commits) | `entire/<HEAD-hash>` branches + `entire/sessions` | Recommended for most workflows |
| **auto-commit** | Creates clean commits | Orphan `entire/sessions` branch | Teams that want code commits from sessions |

Legacy names `shadow` and `dual` are only recognized when reading settings or checkpoint metadata.

#### Strategy Details

**Manual-Commit Strategy** (`manual_commit*.go`) - Default
Expand Down
1 change: 0 additions & 1 deletion cmd/entire/cli/checkpoint/committed.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,6 @@ func (s *GitStore) ReadCommitted(ctx context.Context, checkpointID id.Checkpoint
if content, contentErr := metadataFile.Contents(); contentErr == nil {
//nolint:errcheck,gosec // Best-effort parsing, defaults are fine
json.Unmarshal([]byte(content), &result.Metadata)
result.Metadata.Strategy = trailers.NormalizeStrategyName(result.Metadata.Strategy)
}
}

Expand Down
1 change: 0 additions & 1 deletion cmd/entire/cli/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ func applyDefaultStrategy(settings *EntireSettings) {
if settings.Strategy == "" {
settings.Strategy = strategy.DefaultStrategyName
}
settings.Strategy = strategy.NormalizeStrategyName(settings.Strategy)
}

func saveSettingsToFile(settings *EntireSettings, filePath string) error {
Expand Down
34 changes: 0 additions & 34 deletions cmd/entire/cli/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,40 +76,6 @@ func TestLoadEntireSettings_EnabledDefaultsToTrue(t *testing.T) {
}
}

func TestLoadEntireSettings_LegacyStrategyNames(t *testing.T) {
tmpDir := t.TempDir()
t.Chdir(tmpDir)

settingsDir := filepath.Dir(EntireSettingsFile)
if err := os.MkdirAll(settingsDir, 0o755); err != nil {
t.Fatalf("Failed to create settings dir: %v", err)
}

if err := os.WriteFile(EntireSettingsFile, []byte(`{"strategy": "shadow"}`), 0o644); err != nil {
t.Fatalf("Failed to write settings file: %v", err)
}

settings, err := LoadEntireSettings()
if err != nil {
t.Fatalf("LoadEntireSettings() error = %v", err)
}
if settings.Strategy != strategy.StrategyNameManualCommit {
t.Errorf("Strategy = %q, want %q", settings.Strategy, strategy.StrategyNameManualCommit)
}

if err := os.WriteFile(EntireSettingsLocalFile, []byte(`{"strategy": "dual"}`), 0o644); err != nil {
t.Fatalf("Failed to write local settings file: %v", err)
}

settings, err = LoadEntireSettings()
if err != nil {
t.Fatalf("LoadEntireSettings() error = %v", err)
}
if settings.Strategy != strategy.StrategyNameAutoCommit {
t.Errorf("Strategy = %q, want %q", settings.Strategy, strategy.StrategyNameAutoCommit)
}
}

func TestSaveEntireSettings_PreservesEnabled(t *testing.T) {
tmpDir := t.TempDir()
t.Chdir(tmpDir)
Expand Down
2 changes: 1 addition & 1 deletion cmd/entire/cli/resume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func TestResumeFromCurrentBranch_WithEntireCheckpointTrailer(t *testing.T) {
_, _, _ = setupResumeTestRepo(t, tmpDir, false)

// Set up the auto-commit strategy and create checkpoint metadata on entire/sessions branch
strat := strategy.NewDualStrategy()
strat := strategy.NewAutoCommitStrategy()
if err := strat.EnsureSetup(); err != nil {
t.Fatalf("Failed to ensure setup: %v", err)
}
Expand Down
10 changes: 1 addition & 9 deletions cmd/entire/cli/strategy/auto_commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,6 @@ func NewAutoCommitStrategy() Strategy {
return &AutoCommitStrategy{}
}

// NewDualStrategy creates a new auto-commit strategy instance.
// This legacy constructor delegates to NewAutoCommitStrategy.
//

func NewDualStrategy() Strategy {
return NewAutoCommitStrategy()
}

func (s *AutoCommitStrategy) Name() string {
return StrategyNameAutoCommit
}
Expand Down Expand Up @@ -995,7 +987,7 @@ func (s *AutoCommitStrategy) ListOrphanedItems() ([]CleanupItem, error) {
continue
}
// Only consider checkpoints created by this strategy
if result.Metadata.Strategy == StrategyNameAutoCommit || result.Metadata.Strategy == StrategyNameDual {
if result.Metadata.Strategy == StrategyNameAutoCommit {
autoCommitCheckpoints[cp.CheckpointID.String()] = true
}
}
Expand Down
5 changes: 0 additions & 5 deletions cmd/entire/cli/strategy/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,6 @@ func ListAllCleanupItems() ([]CleanupItem, error) {

// Iterate over all registered strategies
for _, name := range List() {
// Skip legacy names to avoid duplicates
if IsLegacyStrategyName(name) {
continue
}

strat, err := Get(name)
if err != nil {
if firstErr == nil {
Expand Down
21 changes: 0 additions & 21 deletions cmd/entire/cli/strategy/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ func List() []string {

// Strategy name constants
const (
StrategyNameDual = "dual" // Legacy name (auto-commit)
StrategyNameShadow = "shadow" // Legacy name (manual-commit)
StrategyNameManualCommit = "manual-commit"
StrategyNameAutoCommit = "auto-commit"
)
Expand All @@ -74,22 +72,3 @@ func Default() Strategy {
}
return s
}

// NormalizeStrategyName maps legacy strategy names to current names.
// These are the strategy names used during initial development and are kept for backwards
// compatibility
func NormalizeStrategyName(name string) string {
switch name {
case StrategyNameDual:
return StrategyNameAutoCommit
case StrategyNameShadow:
return StrategyNameManualCommit
default:
return name
}
}

// IsLegacyStrategyName returns true for names that should be mapped.
func IsLegacyStrategyName(name string) bool {
return name == StrategyNameDual || name == StrategyNameShadow
}
16 changes: 1 addition & 15 deletions cmd/entire/cli/trailers/trailers.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ var (
func ParseStrategy(commitMessage string) (string, bool) {
matches := strategyTrailerRegex.FindStringSubmatch(commitMessage)
if len(matches) > 1 {
return NormalizeStrategyName(strings.TrimSpace(matches[1])), true
return strings.TrimSpace(matches[1]), true
}
return "", false
}
Expand Down Expand Up @@ -162,20 +162,6 @@ func ParseAllSessions(commitMessage string) []string {
return sessionIDs
}

// NormalizeStrategyName maps legacy strategy names to current names.
// These are the strategy names used during initial development and are kept for backwards
// compatibility.
func NormalizeStrategyName(name string) string {
switch name {
case "dual":
return "auto-commit"
case "shadow":
return "manual-commit"
default:
return name
}
}

// FormatStrategy creates a commit message with just the strategy trailer.
func FormatStrategy(message, strategy string) string {
return fmt.Sprintf("%s\n\n%s: %s\n", message, StrategyTrailerKey, strategy)
Expand Down