Implement remote current-state discovery for the restore subcommand

This commit is contained in:
2026-05-19 21:49:19 -05:00
parent 02ab106ade
commit 128449040f
4 changed files with 456 additions and 7 deletions

View File

@@ -11,6 +11,9 @@ import (
"gitea.maximumdirect.net/eric/narratio/internal/config"
)
var newObjectStoreFromConfigFn = storage.NewObjectStoreFromConfig
var discoverRemoteCurrentStateFn = discoverRemoteCurrentState
// Restore validates restore CLI/config inputs and storage preflight for future restore phases.
func Restore(ctx context.Context, args []string, out io.Writer) error {
fs := flag.NewFlagSet("restore", flag.ContinueOnError)
@@ -63,14 +66,23 @@ func Restore(ctx context.Context, args []string, out io.Writer) error {
return fmt.Errorf("restore: %w", err)
}
_, err = storage.NewObjectStoreFromConfig(ctx, cfg)
objectStore, err := newObjectStoreFromConfigFn(ctx, cfg)
if err != nil {
return fmt.Errorf("restore: %w", err)
}
current, err := discoverRemoteCurrentStateFn(ctx, cfg, objectStore)
if err != nil {
return fmt.Errorf("restore: %w", err)
}
// Phase 2 boundary: command wiring and preflight only.
// Phase 3 boundary: discovery is implemented; planning/execution is deferred.
_ = dryRun
_ = force
_ = includeAudio
return fmt.Errorf("restore: not yet implemented (phase 3: remote current-state discovery)")
return fmt.Errorf(
"restore: discovered remote current state for %s/%s (run %s); not yet implemented (phase 3: remote current-state discovery)",
current.Campaign,
current.SessionID,
current.RunID,
)
}