bdmigrate

package
v0.169.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package bdmigrate moves a repository from bd (beads) to the gofer tracker: issues and memories, the managed instruction blocks, the agent hooks and core.hooksPath. It is a plan-then-apply pipeline: everything is read and computed first (a dry run stops there), the apply step writes backups and then the files, and the result is verified against the plan. .beads/ is never modified or removed, and bd is only ever invoked read-only.

DEPRECATED(v0.115): remove in v0.130, once every workspace has migrated off bd (TRK-01).

Index

Constants

View Source
const DefaultActivityWindow = 5 * time.Minute

DefaultActivityWindow is how recent a write to .beads counts as "in use".

Variables

View Source
var ErrActive = errors.New("bd looks active in this repository")

ErrActive is returned when bd looks in use and --force was not given.

Functions

This section is empty.

Types

type BlockPlan

type BlockPlan struct {
	File    string `json:"file"`
	Action  string `json:"action"` // none | replace | remove | append | create
	Removed int    `json:"removed_bd_blocks"`
	Gofer   bool   `json:"gofer_block"`
	New     string `json:"-"`
	Old     string `json:"-"`
}

BlockPlan is the planned edit of one instruction file.

type GitPlan

type GitPlan struct {
	HooksPath     string   `json:"core_hooks_path,omitempty"`
	PointsAtBeads bool     `json:"points_at_beads_hooks"`
	Custom        []string `json:"custom_hooks,omitempty"`    // .beads/hooks files with content besides bd's block
	GitDirShims   []string `json:"gitdir_bd_shims,omitempty"` // $GIT_DIR/hooks files that also call bd
	Action        string   `json:"action"`                    // none | unset | keep
	Reason        string   `json:"reason,omitempty"`
}

GitPlan covers core.hooksPath and the hook scripts bd keeps in .beads/hooks.

type HookPlan

type HookPlan struct {
	Agent   string   `json:"agent"`
	Path    string   `json:"path"`
	Exists  bool     `json:"exists"`
	Changes []string `json:"changes,omitempty"`
	Manual  []string `json:"manual,omitempty"` // bd commands left in place that need a human
	New     []byte   `json:"-"`                // full new file content; nil when nothing changes
}

HookPlan is the planned rewrite of one agent hook config file.

type Mapping

type Mapping struct {
	StatusRemapped   map[string]int `json:"status_remapped,omitempty"` // bd status -> count (kept as tag bd:<status>, status open)
	ParentFromDep    int            `json:"parent_from_parent_child_dep"`
	ParentFromDotID  int            `json:"parent_from_dotted_id"`
	ExtraParentDeps  int            `json:"extra_parent_child_deps_kept"`
	DepTypes         map[string]int `json:"dep_types,omitempty"`
	DanglingDeps     int            `json:"dangling_deps"`
	LeasesDropped    int            `json:"lease_fields_dropped"`
	DepMetaDropped   int            `json:"dep_created_fields_dropped"`
	NotesConverted   int            `json:"notes_converted"`
	CommentsImported int            `json:"comments"`
}

Conversion statistics, reported so a human can see what the mapping did.

type Options

type Options struct {
	Root           string
	Apply          bool
	Force          bool          // go ahead although bd looks active
	BDPath         string        // bd executable; "" = look up "bd" on PATH
	ActivityWindow time.Duration // 0 = DefaultActivityWindow
	ExportTimeout  time.Duration // 0 = 2 minutes
	Now            func() time.Time
}

Options configure one migration run.

type Report

type Report struct {
	Root       string         `json:"root"`
	Mode       string         `json:"mode"` // dry-run | apply
	Source     SourceReport   `json:"source"`
	Issues     int            `json:"issues"`
	Memories   int            `json:"memories"`
	Prefix     string         `json:"prefix"`
	Mapping    Mapping        `json:"mapping"`
	Activity   []string       `json:"activity,omitempty"`
	Blocks     []BlockPlan    `json:"blocks"`
	Hooks      []HookPlan     `json:"hooks"`
	Git        GitPlan        `json:"git"`
	Manual     []string       `json:"manual,omitempty"`
	Notes      []string       `json:"notes,omitempty"`
	Written    []string       `json:"written,omitempty"`
	BackupDir  string         `json:"backup_dir,omitempty"`
	Verified   *Verification  `json:"verified,omitempty"`
	SkippedMem int            `json:"memories_already_present,omitempty"`
	KeptIssues int            `json:"issues_kept_newer_local,omitempty"`
	PrimeLimit int            `json:"prime_memory_summary_limit,omitempty"`
	Skipped    map[string]int `json:"skipped_record_types,omitempty"`
}

Report is everything the run found and did; Format renders it for humans.

func Run

func Run(opts Options) (Report, error)

Run executes the migration. Dry runs (Apply=false) never write anything.

func (Report) Format

func (r Report) Format() string

Format renders the report as the text `gofer repo migrate` prints.

type SourceReport

type SourceReport struct {
	Used         string   `json:"used"` // "bd export" | "issues.jsonl"
	LiveIssues   int      `json:"live_issues"`
	LiveMemories int      `json:"live_memories"`
	JSONLIssues  int      `json:"jsonl_issues"`
	JSONLPresent bool     `json:"jsonl_present"`
	OnlyLive     []string `json:"only_in_live,omitempty"`
	OnlyJSONL    []string `json:"only_in_jsonl,omitempty"`
	NewerLive    []string `json:"newer_in_live,omitempty"` // same id, different updated_at
	Stale        bool     `json:"jsonl_stale"`
}

SourceReport says where the data came from and how the two bd views differ.

type Verification

type Verification struct {
	Issues         int      `json:"issues"`
	IssuesMatching int      `json:"issues_matching_source"`
	Memories       int      `json:"memories"`
	MemoriesMatch  int      `json:"memories_matching_source"`
	BeadsUntouched bool     `json:"beads_issues_jsonl_unchanged"`
	Mismatched     []string `json:"mismatched_ids,omitempty"`
}

Verification compares the written tracker with the plan.

Jump to

Keyboard shortcuts

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