package cmd import ( "flag" "fmt" "git.noodles.cam/claude-skills/marketplace/cli/internal/issue" ) func init() { register(&Command{ Name: "index", Group: GroupIssue, Short: "rebuild INDEX.md from what is on disk", Long: `A map of the local store, nothing else. The ` + "`origin`" + ` column is the only place the index acknowledges that a tracker exists: ` + "`local`" + ` means the issue has never left this machine, anything else names the tracker it also lives in. Both are ordinary issues here. ` + "`progress`" + ` counts the body's checkboxes, ticked over total, and is read off the body at build time rather than stored — a second copy of that state in a metadata field would be wrong by the next edit. An existing store with nothing in it is a legitimate thing to index and gets an "_empty_" table. A store that is not there is an error, not a directory to create.`, Examples: []Example{ {"kettle index", "rebuild the index for this project"}, }, Setup: func(fs *flag.FlagSet) func([]string) error { out := storeFlag(fs) return func(args []string) error { root, err := storeRoot(*out) if err != nil { return err } path, n, err := issue.BuildIndex(root) if err != nil { return Fail("%v — nothing was created; create an issue with `kettle new`, or pass --out", err) } fmt.Printf("%s — %d issue(s)\n", path, n) return nil } }, }) }