source

package
v0.4.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectTargetFromSource

func DetectTargetFromSource(sourcePath string) string

DetectTargetFromSource attempts to infer the running URL of a web application from its source code directory. It checks (in priority order):

  1. docker-compose.yml port mappings
  2. .env / .env.example files for PORT variables
  3. Common server entry files for listen() calls
  4. 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

func ShouldSkipDir(name string) bool

ShouldSkipDir returns true if the directory name should be skipped during source walks.

func ShouldSkipFile

func ShouldSkipFile(name string) bool

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL