Documentation
¶
Index ¶
Constants ¶
const DefaultRuleContent = `` /* 2164-byte string literal not displayed */
DefaultRuleContent is the default restrictive project rule template written by /rule.
const RuleFile = config.ProjectDirName + "/rule.md"
RuleFile is the path to the project-level rule file relative to the working directory.
Variables ¶
This section is empty.
Functions ¶
func BuildContextString ¶
func BuildContextString(result *LoadResult) string
BuildContextString concatenates all context files into a single string suitable for appending to the system prompt. Order: global -> parent (root to cwd) -> project (current dir)
func EnsureRuleFile ¶ added in v1.1.59
func EnsureRuleFile(cwd string, overwrite bool) (path string, content string, written bool, err error)
EnsureRuleFile creates .mothx/rule.md with DefaultRuleContent. Existing files are preserved unless overwrite is true.
func LoadRuleFile ¶ added in v1.1.59
LoadRuleFile loads .mothx/rule.md from the given working directory. Missing or unreadable files are ignored.
func RuleFilePath ¶ added in v1.1.59
RuleFilePath returns the rule file path for cwd.
Types ¶
type FileContent ¶
type FileContent struct {
Path string // absolute path
Name string // file name
Content string // file content
}
FileContent represents a loaded context file.
type LoadResult ¶
type LoadResult struct {
GlobalFiles []FileContent // files from ~/.mothx/
ParentFiles []FileContent // files from parent directories
ProjectFiles []FileContent // files from current directory
}
LoadResult contains the loaded context files.
func LoadContextFiles ¶
func LoadContextFiles(cwd string, globalConfigDir string, extraFiles []string) *LoadResult
LoadContextFiles discovers and loads context files from all relevant locations. It walks up from cwd to the root, then checks the global config directory.