Documentation
¶
Overview ¶
Package sync writes project memory to AI-editor context files (CLAUDE.md, .github/copilot-instructions.md, .cursor/rules, .windsurfrules). It is driven by the /sync slash command and optionally by a post-commit hook.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActiveTargets ¶
func ActiveTargets(root string, cfg config.SyncConfig) []config.SyncTargetMeta
ActiveTargets returns the SyncTargetMeta entries that should be written based on the stored SyncConfig and what's currently detected on disk.
"Everything" means every AI-editor file that ALREADY EXISTS in the repo, plus any that appear later (each run re-detects, so a newly-created .cursor/rules is adopted automatically) — NOT every possible target. Writing all four blindly would litter repos with context files for editors the user doesn't use, on every commit. An explicit target list, by contrast, is honored verbatim: if you pick Cursor before the file exists, we create it.
func InstallGitHook ¶
InstallGitHook writes a post-commit hook under root/.git/hooks/post-commit that calls `memcode sync --auto`. It is idempotent: a no-op if our hook is already present. If a hook already exists that isn't ours, it appends to it.
Types ¶
type DetectedTarget ¶
type DetectedTarget struct {
config.SyncTargetMeta
Exists bool // file is present in the repo
Managed bool // file starts with the memcode managed header
}
DetectTargets returns the subset of SyncTargetAll that already exist on disk, and whether each one is already managed by memcode.
func Detect ¶
func Detect(root string) []DetectedTarget
Detect scans root for known AI-editor context files.