reposcan

package
v1.0.40468-pre Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package reposcan detects the language stack, container image, and setup commands for a local repository. It backs the `circleci repo scan` command and is also reusable by other commands that need detection.

Index

Constants

View Source
const StackUnknown = "unknown"

StackUnknown is the sentinel value used by scan backends when no supported stack is detected.

Variables

This section is empty.

Functions

func Render

func Render(ctx context.Context, r *Result)

Render writes a human-readable summary of the scan Result to the streams in ctx. On an empty result it prints a friendly fallback so the caller can continue.

Types

type EnvBuilderScanner

type EnvBuilderScanner struct{}

EnvBuilderScanner detects the stack and setup commands for a repository using chunk-cli's env-builder library. It may make network calls (e.g. to Docker Hub) while resolving image versions, so callers should pass a context with a timeout if they need to bound the operation.

func NewDefaultScanner

func NewDefaultScanner() *EnvBuilderScanner

NewDefaultScanner returns an EnvBuilderScanner ready for use.

func (*EnvBuilderScanner) Scan

func (s *EnvBuilderScanner) Scan(ctx context.Context, dir string) (*Result, error)

type Result

type Result struct {
	Stack        string      `json:"stack"`
	Image        string      `json:"image"`
	ImageVersion string      `json:"image_version"`
	Setup        []SetupStep `json:"setup"`
}

Result is the outcome of a repo scan. It is intentionally decoupled from any specific scan backend so the CLI can render and reason about it without importing the backend's types.

func (*Result) IsEmpty

func (r *Result) IsEmpty() bool

IsEmpty reports whether the scan failed to identify a supported stack. A nil receiver counts as empty so callers can render the fallback path without an extra nil-guard.

func (*Result) SetupCommand

func (r *Result) SetupCommand(name string) string

SetupCommand returns the command for the named setup step, or an empty string if the scan did not produce that step.

type SetupStep

type SetupStep struct {
	Name    string `json:"name"`
	Command string `json:"command"`
}

SetupStep is a single named provisioning command (e.g. "install", "test", "system") that the scan determined should run before the user's tests.

Jump to

Keyboard shortcuts

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