Documentation
¶
Index ¶
- Variables
- func IsValidTagName(tag string) bool
- type ClientBehavior
- type ClientCapabilities
- type ClientInfo
- type CommitAnalysis
- type CommitGroup
- type CommitIntent
- type CommitMessage
- type CommitPlan
- type ContextRequest
- type DecisionSummary
- type Diff
- type DiffChunk
- type DiffFile
- type DiffStats
- type ExcludedFile
- type FileStatus
- type GitDecision
- type ModelSize
- type OperationPlan
- type Release
- type ReleaseIntent
- type SecretDetection
- type SecurityCheckResult
- type SecurityReason
- type SecurityResult
- type Status
- type SuspiciousFile
Constants ¶
This section is empty.
Variables ¶
var KnownClients = map[string]ClientBehavior{ "opencode": { Name: "opencode", SupportsElicitation: true, SupportsSampling: false, }, "claude-code": { Name: "claude-code", SupportsElicitation: false, SupportsSampling: false, }, "claude-desktop": { Name: "claude-desktop", SupportsElicitation: false, SupportsSampling: false, }, }
KnownClients maps client names to their behaviors
Functions ¶
func IsValidTagName ¶
IsValidTagName validates tag name is valid semver
Types ¶
type ClientBehavior ¶
ClientBehavior defines how a client handles confirmations
func GetClientBehavior ¶
func GetClientBehavior(name string) ClientBehavior
GetClientBehavior returns the behavior for a known client or default fallback
type ClientCapabilities ¶
type ClientCapabilities struct {
Sampling bool `json:"sampling"`
Elicitation bool `json:"elicitation"`
}
ClientCapabilities represents what the client supports
type ClientInfo ¶
ClientInfo represents the MCP client information from initialize handshake
type CommitAnalysis ¶
type CommitAnalysis struct {
Strategy string `json:"strategy"` // single | split
Commits []CommitGroup `json:"commits"`
Excluded []ExcludedFile `json:"excluded"`
Warnings []string `json:"warnings"`
}
CommitAnalysis represents the AI's analysis of files for commit planning
type CommitGroup ¶
type CommitGroup struct {
Files []string `json:"files"`
Message string `json:"message"`
Type string `json:"type"`
}
CommitGroup represents a logical group of files to commit together
type CommitIntent ¶
type CommitIntent struct {
// IncludeUntracked indicates whether to include new/untracked files.
IncludeUntracked bool
// Filter is a glob pattern to filter files (e.g., "internal/*", "src/**").
// Empty means no filter.
Filter string
// Reasoning explains why these files were chosen.
Reasoning string
// FilesSelected lists files that will be included.
FilesSelected []string
// FilesExcluded lists files that will NOT be included and why.
FilesExcluded []string
}
CommitIntent represents the user's intent for what to commit.
type CommitMessage ¶
type CommitMessage struct {
Type string // feat, fix, chore, docs, etc.
Subject string // Short description
Full string // Full conventional commit message
}
CommitMessage represents an AI-generated commit message
type CommitPlan ¶
type CommitPlan struct {
Files []string `json:"files"` // files for this commit
Commit string `json:"commit"` // commit message
Commands []string `json:"commands"` // git commands to execute
}
CommitPlan - individual commit plan
type ContextRequest ¶
type ContextRequest struct {
FilesNeeded []string `json:"files_needed"` // which files to read
DiffNeeded bool `json:"diff_needed"` // whether diff is needed
BranchInfo bool `json:"branch_info"` // whether branch info is needed
StatusInfo bool `json:"status_info"` // whether status is needed
LogInfo bool `json:"log_info"` // whether log is needed
Description string `json:"description"` // what Ollama will do with this context
}
ContextRequest - response from Ollama's first call (what context is needed)
type DecisionSummary ¶
type DecisionSummary struct {
Action string `json:"action"` // what will be done
Files []string `json:"files"` // files involved
Branch string `json:"branch"` // branch (if applicable)
}
DecisionSummary - summary of the decision
type Diff ¶
type Diff struct {
Files []DiffFile `json:"files"`
Stats DiffStats `json:"stats"`
Raw string `json:"raw"`
}
Diff represents git diff output
type DiffChunk ¶
type DiffChunk struct {
// Files is the list of files included in this chunk.
Files []string
// Diff is the unified diff content for these files.
Diff string
}
DiffChunk represents a logical subset of a git diff, small enough to be processed by an LLM in a single context window.
type DiffFile ¶
type DiffFile struct {
Path string `json:"path"`
Additions int `json:"additions"`
Deletions int `json:"deletions"`
Raw string `json:"raw"`
}
DiffFile represents diff for a single file
type DiffStats ¶
type DiffStats struct {
FilesChanged int `json:"files_changed"`
Additions int `json:"additions"`
Deletions int `json:"deletions"`
}
DiffStats represents summary of changes
type ExcludedFile ¶
ExcludedFile represents a file that shouldn't be committed
type FileStatus ¶
type FileStatus struct {
Path string `json:"path"`
Status string `json:"status"` // M, A, D, R, C, U, ?
Staged bool `json:"staged"`
IsNew bool `json:"is_new"`
IsDeleted bool `json:"is_deleted"`
IsRenamed bool `json:"is_renamed"`
}
FileStatus represents a single file in the repository
type GitDecision ¶
type GitDecision struct {
Type string `json:"type"` // read|write
Strategy string `json:"strategy"` // single|split
Commits []CommitPlan `json:"commits"` // commit plans
Summary DecisionSummary `json:"summary"` // summary
Secrets []SecretDetection `json:"secrets"` // detected secrets
Suspicious []SuspiciousFile `json:"suspicious"` // suspicious files
}
GitDecision - full decision JSON from Ollama's second call
type ModelSize ¶
type ModelSize string
ModelSize represents the size category of an LLM model.
func (ModelSize) IsSmall ¶
IsSmall returns true for very small models that shouldn't be used for security.
func (ModelSize) ShouldUseLLMSecurityScan ¶
ShouldUseLLMSecurityScan returns true if the model is large enough to be trusted for security scanning (14B+ parameters only).
type OperationPlan ¶
type OperationPlan struct {
Operation string `json:"operation"`
Args map[string]string `json:"args"`
Preview string `json:"preview"` // Human-readable description shown to the user
CreatedAt int64 `json:"created_at"`
// Commit-specific fields — populated only for the "commit" operation.
Messages []string `json:"messages,omitempty"`
Files []string `json:"files,omitempty"`
Chunks [][]string `json:"chunks,omitempty"` // Per-message file lists for per-chunk staging
RejectedMessage string `json:"rejected_message,omitempty"`
Reasoning string `json:"reasoning,omitempty"` // Why these files were chosen
Instruction string `json:"instruction,omitempty"` // Original user instruction
}
OperationPlan represents a pending git operation awaiting user confirmation. Persisted to disk and read back when the user approves via *_APPLY.
type Release ¶
type Release struct {
Tag string
Changelog string
Version string
IsGitHubRelease bool
CreatedAt time.Time
}
Release represents a created release.
type ReleaseIntent ¶
type ReleaseIntent struct {
TagName string // e.g., "v1.2.0"
IsRelease bool // true if "sacar version"
VersionBump string // "major", "minor", "patch"
Changelog string
BranchFrom string // current branch
MergePath []string // e.g., ["feature/xxx->develop", "develop->main"]
}
ReleaseIntent represents the user's intent to create a release.
type SecretDetection ¶
type SecretDetection struct {
File string
Line int
Type string // api_key, password, token, etc.
Content string // The detected secret (redacted)
}
SecretDetection represents a detected secret
type SecurityCheckResult ¶
type SecurityCheckResult struct {
Files []SecurityResult
Blocked bool
}
SecurityCheckResult is returned by security checks that need to report multiple findings.
func (*SecurityCheckResult) FirstBlocked ¶
func (r *SecurityCheckResult) FirstBlocked() *SecurityResult
FirstBlocked returns the first blocking result, or nil if none.
func (*SecurityCheckResult) IsBlocked ¶
func (r *SecurityCheckResult) IsBlocked() bool
IsBlocked returns true if any file was blocked.
type SecurityReason ¶
type SecurityReason string
SecurityReason categorizes why a check failed.
const ( // ReasonBlacklistedFile indicates a file is on the hard blacklist ReasonBlacklistedFile SecurityReason = "BLACKLISTED_FILE" // ReasonBlacklistedFolder indicates a file is in a blacklisted folder ReasonBlacklistedFolder SecurityReason = "BLACKLISTED_FOLDER" // ReasonBinaryFile indicates a file is a binary (detected by magic bytes) ReasonBinaryFile SecurityReason = "BINARY_FILE" // ReasonSecretDetected indicates a secret pattern was found ReasonSecretDetected SecurityReason = "SECRET_DETECTED" // ReasonSelfBinary indicates the file is git-courer's own binary ReasonSelfBinary SecurityReason = "SELF_BINARY" )
type SecurityResult ¶
type SecurityResult struct {
Safe bool
Halted bool
Reason SecurityReason
File string
Line int
Type string
Message string
}
SecurityResult holds the result of a security check. It indicates whether the operation should proceed or be halted.
func SecurityError ¶
func SecurityError(reason SecurityReason, file, fileType, message string) *SecurityResult
SecurityError creates a SecurityResult indicating a halted operation.
type Status ¶
type Status struct {
IsClean bool `json:"is_clean"`
RepoPath string `json:"repo_path"`
Branch string `json:"branch"`
Files []FileStatus `json:"files"`
Staged int `json:"staged_count"`
Modified int `json:"modified_count"`
Untracked int `json:"untracked_count"`
Conflicted int `json:"conflicted_count"`
}
Status represents the current state of a git repository This is used by the git port interface
type SuspiciousFile ¶
SuspiciousFile - file that looks suspicious