Documentation
¶
Index ¶
- func DetectTargetFromSource(sourcePath string) string
- func ResolveDiff(diffArg string, lastCommits int, sourcePath, sessionDir string, ...) (resolvedSourcePath string, dc *agenttypes.DiffContext, err error)
- func ResolveSource(sourcePath, sessionDir string, opts ...SourceResolveOption) (*agenttypes.ResolvedSource, error)
- func ResolveSourceAndDiff(source, diff string, lastCommits int, files []string, sessionDir string, ...) (resolvedSource string, resolvedFiles []string, diffCtx *agenttypes.DiffContext, ...)
- func ShouldSkipDir(name string) bool
- func ShouldSkipFile(name string) bool
- type SourceResolveOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectTargetFromSource ¶
DetectTargetFromSource attempts to infer the running URL of a web application from its source code directory. It checks (in priority order):
- docker-compose.yml port mappings
- .env / .env.example files for PORT variables
- Common server entry files for listen() calls
- Framework defaults as last resort
Returns empty string if no target can be determined.
func ResolveDiff ¶
func ResolveDiff(diffArg string, lastCommits int, sourcePath, sessionDir string, opts ...SourceResolveOption) (resolvedSourcePath string, dc *agenttypes.DiffContext, err error)
ResolveDiff resolves a --diff argument into changed files and patch content. Handles: GitHub PR URLs, GitLab MR URLs, git ref ranges, HEAD~N. When diffArg is a PR/MR URL and sourcePath is empty, the repo is auto-cloned. Returns the resolved source path (may differ from input if auto-cloned) and the diff context.
func ResolveSource ¶
func ResolveSource(sourcePath, sessionDir string, opts ...SourceResolveOption) (*agenttypes.ResolvedSource, error)
ResolveSource detects the source type and returns a local path.
func ResolveSourceAndDiff ¶
func ResolveSourceAndDiff(source, diff string, lastCommits int, files []string, sessionDir string, opts ...SourceResolveOption) (resolvedSource string, resolvedFiles []string, diffCtx *agenttypes.DiffContext, err error)
ResolveSourceAndDiff is a convenience that resolves both source and diff in one call. It handles git URLs, archives, PR/MR URLs, git refs, and HEAD~N. Returns the resolved local source path, files list (auto-populated from diff if empty), and diff context.
func ShouldSkipDir ¶
ShouldSkipDir returns true if the directory name should be skipped during source walks.
func ShouldSkipFile ¶
ShouldSkipFile returns true if the file should be excluded from tree listings and source file collection. Checks extension and multi-part suffixes.
Types ¶
type SourceResolveOption ¶
type SourceResolveOption func(*sourceResolveOpts)
SourceResolveOption configures source resolution behavior.
func WithCloneDepth ¶
func WithCloneDepth(d int) SourceResolveOption
WithCloneDepth sets the --depth value used when cloning a git URL. A value <= 0 falls back to gitutil's default (1).