reindex

package
v0.199.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: BSD-2-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package reindex detects and resolves duplicate numeric prefixes across multiple lifecycle directories for prompt and spec files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileMover

type FileMover interface {
	MoveFile(ctx context.Context, oldPath string, newPath string) error
}

FileMover handles file move operations with git awareness.

type PromptManager added in v0.135.18

type PromptManager interface {
	Load(ctx context.Context, path string) (*prompt.PromptFile, error)
}

PromptManager is the subset of prompt.Manager that the reindex package uses.

type Reindexer

type Reindexer interface {
	Reindex(ctx context.Context) ([]Rename, error)
}

Reindexer detects and resolves duplicate numeric prefixes across multiple directories.

func NewReindexer

func NewReindexer(dirs []string, mover FileMover) Reindexer

NewReindexer creates a Reindexer that scans the given dirs for NNN-slug.md files with duplicate numeric prefixes and renames conflicting files.

type Rename

type Rename struct {
	OldPath string
	NewPath string
}

Rename represents a file rename performed by the reindexer.

func UpdateSpecRefs added in v0.76.0

func UpdateSpecRefs(
	ctx context.Context,
	specRenames []Rename,
	promptDirs []string,
	mover FileMover,
	pm PromptManager,
) ([]Rename, error)

UpdateSpecRefs propagates spec file renames to prompt files.

For each spec rename (old→new), it:

  1. Updates the frontmatter `spec:` field in any prompt file that references the old spec number.
  2. Renames any prompt file whose filename contains `spec-NNN` where NNN matches the old spec number.

promptDirs are scanned for .md files. mover is used for file renames. pm is used to load prompt files. Returns the list of prompt file renames performed.

Jump to

Keyboard shortcuts

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