Documentation
¶
Overview ¶
Package docs implements AI-powered documentation maintenance for cloop projects. It collects existing documentation, computes a coverage score, and produces AI-refreshed content via RefreshPrompt.
Index ¶
- func CoverageScore(projectDir string) (score int, missing []string)
- func Refresh(ctx context.Context, p provider.Provider, model string, timeout time.Duration, ...) (string, error)
- func RefreshPrompt(existing *DocFile, taskHistory, codeSignature string) string
- func TaskHistory(tasks []*pm.Task) string
- type DocFile
- type ProjectDocs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CoverageScore ¶
CoverageScore checks for key documentation files in projectDir and returns a 0–100 score together with the list of missing file labels.
func Refresh ¶
func Refresh(ctx context.Context, p provider.Provider, model string, timeout time.Duration, df *DocFile, pd *ProjectDocs) (string, error)
Refresh calls the AI provider to produce updated content for a single doc file and returns the refreshed Markdown string.
func RefreshPrompt ¶
RefreshPrompt builds the AI prompt that asks the provider to produce an updated version of the documentation file described by existing. taskHistory is the output of TaskHistory; codeSignature is pd.CodeSignature.
func TaskHistory ¶
TaskHistory builds a compact Markdown summary of completed tasks suitable for inclusion in an AI prompt.
Types ¶
type DocFile ¶
type DocFile struct {
// RelPath is the path relative to projectDir (e.g. "README.md", "docs/API.md").
RelPath string
// AbsPath is the absolute filesystem path.
AbsPath string
// Content is the file's current text, empty when Exists is false.
Content string
// Exists reports whether the file was found on disk.
Exists bool
// IsStale is true when the file was last modified before the most recent
// completed task — a heuristic for "potentially outdated".
IsStale bool
}
DocFile describes a single documentation file tracked by cloop docs.
type ProjectDocs ¶
type ProjectDocs struct {
WorkDir string
ProjectDir string
// Files is the ordered list of tracked documentation files.
Files []*DocFile
// GitLog is the recent git commit history (last 20 lines, oneline).
GitLog string
// CompletedTasks holds tasks in done/skipped status for context.
CompletedTasks []*pm.Task
// CodeSignature is a compact representation of the project structure
// (directory tree + manifest content).
CodeSignature string
}
ProjectDocs is the result of Collect and carries all context needed to refresh or score documentation.
func Collect ¶
func Collect(workDir, projectDir string) (*ProjectDocs, error)
Collect gathers existing docs, git log summary, and completed task history from workDir (the cloop project root, containing .cloop/) and projectDir (where documentation files are located; often the same as workDir).