instructions

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package instructions 复刻官方 context/agent-instructions 的指令文件发现纯逻辑: 从工作目录向上定位项目根、构建根到工作目录的祖先链、并按目录对内容去重。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AncestorChain

func AncestorChain(root, cwd string) []string

AncestorChain 返回从 root 到 cwd(含两端)的目录链,顺序由宽到窄。cwd 不在 root 之下时退化为只含 root。

func FindProjectRoot

func FindProjectRoot(cwd string, markers []string) string

FindProjectRoot 从 cwd 逐级向上,返回第一个含任一 root marker(如 ".git")的 目录;一直到文件系统根都没有则返回 cwd。

Types

type LoadedFile

type LoadedFile struct {
	DisplayPath string
	Content     string
}

LoadedFile 是读到内容的指令候选。

func DedupByDirectory

func DedupByDirectory(files []LoadedFile) []LoadedFile

DedupByDirectory 对同一目录内 trim 后内容相同的候选去重,保留发现顺序最早者; 不同目录即使内容相同也保留。

Jump to

Keyboard shortcuts

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