Documentation
¶
Overview ¶
Package explain builds compact, file-centred memory briefings for the CLI and MCP server.
Index ¶
Constants ¶
const ( DefaultLimit = 10 // MaxLimit bounds how many sessions one call returns, so an agent passing // limit=100000 can't turn a compact briefing into a transcript dump. MaxLimit = 50 )
Variables ¶
This section is empty.
Functions ¶
func NormalizePath ¶
NormalizePath puts a user-supplied path in the form file_touches stores: slash-separated, cleaned, no leading "./".
func ProjectPath ¶
ProjectPath is ResolvePath for callers whose relative paths are already project-relative (the MCP tool's documented contract): only an absolute path is rewritten, and a relative one is just normalised. Rebasing a relative path onto the server's cwd would turn a correct "internal/store/store.go" into a wrong one whenever the agent launched `ctx mcp` from a subdirectory.
func ResolvePath ¶
ResolvePath turns a path the caller typed (relative to cwd, or absolute) into the project-relative form file_touches uses. Running `ctx explain foo.go` from internal/store means internal/store/foo.go, not a file called foo.go at the project root. A path that lands outside the project root is returned normalised but otherwise untouched.
Types ¶
type Session ¶
type Session struct {
SessionID string `json:"session_id"`
Agent string `json:"agent"`
Title string `json:"title,omitempty"`
StartedAt string `json:"started_at"`
GitBranch string `json:"git_branch,omitempty"`
StartingCommit string `json:"starting_commit,omitempty"`
EndingCommit string `json:"ending_commit,omitempty"`
// CommitSource is how the commits were obtained (store.Source*), empty
// when unknown. CommitApproximate is true when they are a best guess:
// resolved from HEAD rather than the session's branch, or unverifiable.
CommitSource string `json:"commit_source,omitempty"`
CommitApproximate bool `json:"commit_approximate,omitempty"`
Actions []string `json:"actions"`
Touches int `json:"touches"`
Changes int `json:"changes"` // touches that were not plain reads
LastTouchAt string `json:"last_touch_at,omitempty"`
ChunkID *int64 `json:"chunk_id,omitempty"`
Preview string `json:"preview,omitempty"`
}