{"modulePath":"github.com/Agent-Field/codeaf","version":"v0.8.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package gitidentity\n\nPackage gitidentity holds what a run's commits carry and leave out: the signature shared by codeaf's own commits and the commands a program runs on its behalf, the identity senior-dev's engine commits under, and the caches a run's own tests leave behind.\n\nIT BUILDS ON EVERY PLATFORM. internal/seniordev does not build on Windows (its own law says so), and codeaf's side of a run still has to know these facts there, so they live here rather than in the engine.\n\n## Constants\n\n```go\nconst (\n\tName  = \"codeaf\"\n\tEmail = \"agentfield-bot@users.noreply.github.com\"\n)\n```\n\n```go\nconst (\n\tEngineName  = \"senior-dev\"\n\tEngineEmail = \"senior-dev@localhost\"\n)\n```\nThe identity senior-dev's engine commits under: its starting tree, every write it checkpoints and the candidate it submits (internal/seniordev/util says why it carries one of its own).\n\n```go\nconst GeneratedRunPaths = \"__pycache__/,.pytest_cache/,*.pyc\"\n```\nGeneratedRunPaths is the one narrow list of test droppings a run is known to create. A general guess would hide a person's actual deliverable.\n\n```go\nconst InputsEnv = \"SENIOR_DEV_INPUTS_AT_START\"\n```\nInputsEnv names, in the program's environment, the file listing its copy's inputs and their fingerprints ([WriteInputs](#WriteInputs)). It is senior-dev's name beside SENIOR\\_DEV\\_IGNORED\\_AT\\_START, which codeaf sets the same way.\n\n## Functions\n\n```go\nfunc Environment() []string\n```\nEnvironment makes Git attribute a model-written commit to the run even when the repository carries the person's user.name and user.email.\n\n```go\nfunc Fingerprint(path string) (string, bool)\n```\nFingerprint is a file's fingerprint: the SHA-256 of its bytes, or of its target for a symbolic link, and false when there is no file there.\n\n```go\nfunc GeneratedRunPath(path string) bool\n```\nGeneratedRunPath reports whether a path is one of [GeneratedRunPaths](#GeneratedRunPaths).\n\n```go\nfunc NormalizeRemoteURL(raw string) string\n```\nNormalizeRemoteURL folds the spellings of one repository down to one name. These are the same repository and must key the same owner:\n\n\tgit@github.com:owner/repo.git\n\tssh://git@github.com/owner/repo\n\thttps://github.com/owner/repo\n\thttp://github.com/owner/repo/\n\tgithub.com/owner/repo\n\nThe scheme and the credentials are dropped, a trailing .git is dropped, the host is lower-cased (GitHub's own rule, and the only host this normalization claims to speak for), and the result is scheme-less. Two checkouts — one cloned over SSH on one machine, one over HTTPS on another — are one project to the memory, which is the whole point.\n\n```go\nfunc ProjectKey(workspace string) (string, error)\n```\nProjectKey answers the stable project key of a workspace: the normalized origin remote's hash when the workspace is a git repository with an origin, and the canonical path's hash otherwise. The second answer is also the error-free answer for a workspace that is not a repository at all.\n\nThe key is opaque by design and the same length either way — 16 bytes of SHA-256 — so nothing that reads an owner string can tell a remote-keyed project from a path-keyed one and start treating them differently.\n\n```go\nfunc WriteInputs(file string, in Inputs) error\n```\nWriteInputs writes the inputs to file as NUL-separated fingerprint and path pairs, readable by [ReadInputs](#ReadInputs); a path may hold any byte but NUL.\n\n## Types\n\n```go\ntype Inputs map[string]string\n```\nInputs is a copy's inputs: each path, relative to the copy's top and slash-separated, with its fingerprint when it was copied in. An empty fingerprint is an input whose copying had not finished, which is kept out.\n\n```go\nfunc ReadInputs(file string) (Inputs, error)\n```\nReadInputs reads what [WriteInputs](#WriteInputs) wrote. An empty name is no list at all, which is every run codeaf did not start in a copy.\n\n```go\nfunc (in Inputs) Changed(root string) []string\n```\nChanged is the inputs the run changed in the copy at root, in no order.\n\n```go\nfunc (in Inputs) LeftAlone(root, path string) bool\n```\nLeftAlone says path is one of the inputs and the run has not changed it in the copy at root: it still has the fingerprint it was copied in with, it is gone (an untracked file's deletion is nothing a branch can hold), or its fingerprint was never taken. A path that is not an input is never left alone in this sense — it is the run's, or the repository's.\n\n","path":"github.com/Agent-Field/codeaf/internal/gitidentity","name":"gitidentity","synopsis":"Package gitidentity holds what a run's commits carry and leave out: the signature shared by codeaf's own commits and the commands a program runs on its behalf, the identity senior-dev's engine commits under, and the caches a run's own tests leave behind.","isRedistributable":true}
