project

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package project derives a path-independent project identity from a working directory (the directory the agent was started in): the normalized Git remote of the repository containing it, unless that repository ignores it, otherwise the directory name. It reads .git directly instead of shelling out to git, because it runs inside agent hooks where latency matters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeRemote

func NormalizeRemote(url string) string

NormalizeRemote maps the many spellings of a remote to host/path:

git@github.com:Org/Repo.git        → github.com/org/repo
https://user@github.com/Org/Repo   → github.com/org/repo
ssh://git@host:2222/org/repo.git   → host/org/repo

Types

type Hint

type Hint struct {
	// Root is the absolute repository root (or the cwd outside Git).
	Root string `json:"root"`
	// Name is a human-readable project name (repository directory name).
	Name string `json:"name"`
	// GitIdentity is the normalized origin remote, e.g. "github.com/org/repo".
	GitIdentity string `json:"git_identity,omitempty"`
	GitBranch   string `json:"git_branch,omitempty"`
	GitHead     string `json:"git_head,omitempty"`
}

Hint describes the project an event was observed in. It is resolved to a server project_id at upload time, so hooks work offline.

func Detect

func Detect(cwd string) Hint

Detect inspects cwd. It never fails: without Git it falls back to cwd.

func (Hint) Key

func (h Hint) Key() string

Key identifies the project for client-side caching.

Jump to

Keyboard shortcuts

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