workspace

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalRoot

func CanonicalRoot(path string) (string, error)

func WalkFiles

func WalkFiles(root string, fn func(path string, entry fs.DirEntry) error) error

Types

type Content

type Content struct {
	Path      string `json:"path"`
	Content   string `json:"content"`
	Size      int64  `json:"size"`
	Language  string `json:"language"`
	Truncated bool   `json:"truncated"`
}

type Entry

type Entry struct {
	Name       string    `json:"name"`
	Path       string    `json:"path"`
	Directory  bool      `json:"directory"`
	Size       int64     `json:"size"`
	ModifiedAt time.Time `json:"modifiedAt"`
}

type FileCandidate

type FileCandidate struct {
	Type        string `json:"type"`
	Value       string `json:"value"`
	Label       string `json:"label"`
	Description string `json:"description,omitempty"`
}

type Guard

type Guard struct {
	// contains filtered or unexported fields
}

func New

func New(roots []string) (*Guard, error)

func (*Guard) AuthorizeRoot

func (g *Guard) AuthorizeRoot(path string) (string, error)

func (*Guard) List

func (g *Guard) List(root, relative string) ([]Entry, error)

func (*Guard) Read

func (g *Guard) Read(root, relative string, maxBytes int64) (Content, error)

func (*Guard) Resolve

func (g *Guard) Resolve(root, relative string) (string, error)

func (*Guard) ResolveForCreate

func (g *Guard) ResolveForCreate(root, relative string) (string, error)

func (*Guard) Search

func (g *Guard) Search(root, query string, limit int) ([]FileCandidate, error)

type ProjectCandidate

type ProjectCandidate struct {
	Name          string    `json:"name"`
	Path          string    `json:"path"`
	GitRepository bool      `json:"gitRepository"`
	ModifiedAt    time.Time `json:"modifiedAt"`
}

ProjectCandidate 是 Runner 在本机发现的项目目录。结果只通过实时命令返回, 不写入 Runner 工作区状态;真正授权时仍需再次通过 CanonicalRoot 校验。

func DiscoverProjects

func DiscoverProjects(ctx context.Context, roots []string, limit, maxDepth int) ([]ProjectCandidate, error)

DiscoverProjects 在有限深度和目录数内寻找常见项目标记,不跟随符号链接, 也不会返回 Home、系统根目录或敏感配置目录。

Jump to

Keyboard shortcuts

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