feat(legacymove): also clear raw/ leftovers from before inbox zero (#209)
PlanRaw: an original that was archived but never removed (it has a .processed marker AND a byte-identical copy under raw/processed/) is deleted with its marker; a marker without a note is deleted; an unmarked note, a note without an identical archive copy, and AutoTunnel's tunnel-candidates-* review queue are never touched. The archive key flattens the whole path so raw/x.md and wiki/sources/x.md cannot overwrite each other. Live dry run: 84 entries, 16 move, 53 delete (24 junk + 29 raw leftovers), 15 left. Mutation-checked. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
// Command legacymove clears wiki/sources/ of the retired layout (hyperguild
|
||||
// #209). Default is a dry run that prints the plan; -apply performs it after
|
||||
// archiving every page it touches; -rollback restores from an archive.
|
||||
// Command legacymove clears the leftovers of the retired layout (hyperguild
|
||||
// #209): wiki/sources/ (videos and articles move to the default wing, the
|
||||
// auto-tunnel review logs are deleted) and raw/ (originals archived before inbox
|
||||
// zero, their markers, orphan markers). Default is a dry run that prints the
|
||||
// plan; -apply performs it after archiving every page it touches; -rollback
|
||||
// restores from an archive.
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -35,15 +38,20 @@ func run(brain, wing string, apply bool, rollback string) error {
|
||||
fmt.Println("rolled back from", rollback)
|
||||
return nil
|
||||
}
|
||||
items, err := legacymove.Plan(brain, wing)
|
||||
sources, err := legacymove.Plan(brain, wing)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rawLeft, err := legacymove.PlanRaw(brain)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
items := append(sources, rawLeft...)
|
||||
counts := map[legacymove.Action]int{}
|
||||
for _, it := range items {
|
||||
counts[it.Action]++
|
||||
}
|
||||
fmt.Printf("# legacy source plan\n\n%d pages: %d move, %d delete, %d left\n\n", len(items), counts[legacymove.Move], counts[legacymove.Delete], counts[legacymove.Skip])
|
||||
fmt.Printf("# legacy plan\n\n%d entries: %d move, %d delete, %d left\n\n", len(items), counts[legacymove.Move], counts[legacymove.Delete], counts[legacymove.Skip])
|
||||
fmt.Println("| action | from | to | why |")
|
||||
fmt.Println("|---|---|---|---|")
|
||||
for _, it := range items {
|
||||
|
||||
Reference in New Issue
Block a user