Documentation
¶
Overview ¶
Package ahoy is abcd's install/update engine for `abcd ahoy`. It follows a detect -> contract -> apply architecture: a single detection pass builds an in-memory DetectionResult (the ahoy-state shape) and every sub-verb (install, dry-run, doctor, bare status) is a thin consumer of that one pass. Idempotency is a property of detection, never a version stamp: every check compares actual on-disk/registry state.
The package performs I/O only under a caller-supplied cwd and the user-scope ~/.abcd.noindex/ store (and, on install, an owned PATH copy). It never writes to stdout, never calls os.Exit, and never imports a transport (cobra/MCP), so it is fully testable and reusable across surfaces. Interactive decisions are routed through the injected Prompter seam.
Index ¶
- Constants
- Variables
- func AcceptReleaseClaimsForTest() (restore func())
- func AskLiveSessions(cwd string, p Prompter) (string, bool, error)
- func AskSessionsWhere(p Prompter) (string, bool)
- func AssumeSetupBasicsForTest() (restore func())
- func BriefQuestion(q question.Question) question.Question
- func CheckReleaseClaim(data []byte, tag string) error
- func EnsureMarker(path string, dryRun bool) (changed bool, err error)
- func GitHubRepo(cwd string) (string, error)
- func HarnessNotice() string
- func HooksUnarmed(gaps []Gap) bool
- func HooksUnrunNotice(gaps []Gap) string
- func IsOwnedPathCopy(target string) bool
- func LegacyApprovalRefusal(id string) string
- func LiveSessions(cwd string) (string, bool, error)
- func LowerReleaseMarkCommand(tag string) string
- func Managed(root string) bool
- func ManagedContext(ctx context.Context, root string) (bool, error)
- func NoHostVersionForTest() (restore func())
- func OfferGH(guard string, confirm tools.Confirm) (notes []string, ok bool)
- func OldHostVersionForTest() (restore func())
- func ParseLiveSessions(v string) error
- func ParseReadmeParts(v string) ([]string, error)
- func PluginDataDirHazard(dataDir, cwd string) string
- func PluginRootContaining(path string) (string, bool)
- func PreviousReleaseTag(pluginRoot, cwd string) (string, bool)
- func ReadReleaseMark() (string, bool)
- func RecordReleaseMark(tag string, lower bool) error
- func RefreshPathEntryDigest(target, shaHex string)
- func ReleaseOlder(a, b string) bool
- func ResolvePluginRoot() (string, bool)
- func RetiredDocsTarget(v string) (explanation string, retired bool)
- func SavedDocsTarget(cwd string) (string, error)
- func SetCurrentVintageForTest(f func() vintage.Current) (restore func())
- func SetupAskedBeforeWriting(id string) bool
- func SetupConfirmQuestion(n int, text string) question.Question
- func SetupFixedValues(id string) (values []string, ok bool)
- func SetupHelpedQuestion(n int, h PromptHelp, choices []string, def string) question.Question
- func SetupMachineWide(id string) bool
- func SetupPlanQuestion(n int, p SetupPlan) question.Question
- func SetupValueQuestion(n int, cwd, key string, choices []string, def string) question.Question
- func SetupVersion(cwd string) (string, bool)
- func StoreLiveSessions(cwd, v string) (string, error)
- func StripMarkerBlock(content []byte) ([]byte, bool)
- func TakeUnseenUpdate(pluginRoot, cwd string) (from, to string, ok bool)
- func WalkConfigValueQuestions(cwd string, opts InstallOptions, approves func(id string) bool, ...) error
- type ApplyResult
- type BanlistHealth
- type CheckApp
- type ChoiceHelp
- type DefaultChange
- type DefaultRecorder
- type DetectionResult
- type DoctorReport
- type DogfoodReport
- type DownloadRelease
- type DownloadedRelease
- type Finding
- type FolderKind
- type Gap
- type GapCategory
- type GuardHealth
- type HelpedPrompter
- type HookState
- type HooksPathState
- type InstallConfig
- type InstallOptions
- type InstallResult
- type MarkerReceipt
- type PlanChoice
- type PlanDefault
- type PlanGroup
- type PlanPrompter
- type PromptHelp
- type Prompter
- type ProvenanceCheck
- type PublicFamilyState
- type ReadmePartLeft
- type ReadmePartView
- type ReadmeReceipt
- type ReadmeView
- type RefusingPrompter
- type RemoteMergeHygiene
- type RemoteResult
- type RemoteSecurity
- type RepoIdentity
- type ReportStep
- type SessionsView
- type SettingsAudit
- type SetupPlan
- type SetupReport
- type ShellPathReceipt
- type StatusLineReceipt
- type SummaryItem
- type SymlinkReceipt
- type TerminalPrompter
- type UninstallReceipt
- type UpdateTarget
- type UpdateTargetKind
- type VintageStatus
- type WaitingItem
- type WaitingSet
Constants ¶
const ( // ArtefactMissingGapID is the gap a repository with no declaration raises. ArtefactMissingGapID = "artefact.missing" // ArtefactInvalidGapID is the diagnostic for a declaration that is present // and wrong. It is the user's data, so install reports it and never // overwrites it. ArtefactInvalidGapID = "artefact.invalid" )
const ( GuardHookRelPath = ".githooks/pre-commit" GuardMergeHookRelPath = ".githooks/pre-merge-commit" )
The committed guard's two halves, repo-relative and slash-separated (they are os.Root paths as well as report text).
They are COMMITTED hooks, not .git/hooks copies: .git/hooks is per-clone and untracked, so a guard installed there protects one working copy and no one else's. A clone points git at this directory once (`git config core.hooksPath .githooks`) and every checkout inherits the check.
pre-merge-commit exists because git runs NO pre-commit hook for a merge commit. Without it every name the private layer bans walks into history the moment a branch carrying it is merged, and the guard reports nothing because it was never asked.
const ( MismatchGapID = "git_identity.mismatch" UnsetGapID = "git_identity.unset" CommitterGapID = "git_identity.committer" ToolIdentityGapID = "git_identity.tool" UncheckableGapID = "git_identity.uncheckable" )
The identity gap ids the detector raises and the establish step reads.
const ( // HarnessStrayHookGapPrefix keys one gap per abcd hook in the user // settings: <prefix>.<Event>, and <prefix>.<Event>.<n> for the n-th entry // on one event, so no finding hides another. HarnessStrayHookGapPrefix = "harness.stray_hook" // StatusLineUntrustedGapID is a status line running an abcd that fails // statusLineEntryTrust. A dangling line keeps its own repair gap. StatusLineUntrustedGapID = "statusline.untrusted" )
const ( // UnrecordedGapID: no record on this machine applies to the repository. UnrecordedGapID = "git_identity.unrecorded" // LegacyPinGapID: the repository still stores the identity pin itd-131 // committed (.abcd/config/identity.json). LegacyPinGapID = "git_identity.repo_pin" )
The two gaps the person's own identity record raises.
const ( // OracleRoutingMachineGapID is the offer of the machine's routing table. OracleRoutingMachineGapID = "oracle_routing.machine_offered" // OracleRoutingRepoGapID is the offer of the repository's routing table. OracleRoutingRepoGapID = "oracle_routing.repo_offered" )
const ( // ProviderAdapterGapID is the explanation, raised while no provider is // configured on this machine. ProviderAdapterGapID = "oracle_api.none_configured" // ProviderAdapterRefusedGapID names a provider configuration the adapter // refuses, so it is never silently unused. ProviderAdapterRefusedGapID = "oracle_api.config_refused" // ProviderAdapterRouteSkippedGapID names each route the configuration // read skipped, one diagnostic per line of its Detail, so a skip is never // silent at the bare board. ProviderAdapterRouteSkippedGapID = "oracle_api.route_skipped" )
const ( SessionsPromptKey = "sessions" SessionsWherePromptKey = "sessions.where" )
SessionsPromptKey keys Q1; SessionsWherePromptKey keys Q2.
const ( // WaitingQuestion is a setup question this repository never answered. WaitingQuestion = "question" // WaitingDefault is a setting whose default changed in the update and // which the repository takes from the default. WaitingDefault = "default" )
The kinds of thing that wait.
const ArmHooksCommand = "git config --local core.hooksPath " + guardHooksDirRelPath
ArmHooksCommand is the one command that points this clone's git at the committed hooks, which the report lists when the question is not answered.
const AttributionHookRelPath = guardHooksDirRelPath + "/prepare-commit-msg"
AttributionHookRelPath is the committed prepare-commit-msg hook, repo-relative and slash-separated (an os.Root path as well as report text). It sits beside the name guard's two halves, in the directory a clone points git at once.
const ConventionsOwnerFileGapID = "conventions.owner_file"
ConventionsOwnerFileGapID is a tool's own conventions file holding the owner's words: a warning, never resolvable, since abcd never touches it.
const ConventionsRetireGapID = "conventions.retire_offered"
ConventionsRetireGapID is the offer to retire a tool's own conventions file that only repeats AGENTS.md, raised once per such file.
const DocsLintRootMissingGapID = "docs_lint.root_missing"
DocsLintRootMissingGapID is a roots entry in the repository's docs-lint config that does not resolve (iss-2610100649479892). The documentation check refuses to run while one is listed, so every rule it carries, the banned names included, checks nothing until the entry is fixed. The usual cause is a retired conventions file, CLAUDE.md, still listed after setup removed it or the person did. The gap is one per such entry and report-only: the config is the person's file, and abcd does not edit it.
const DownloadQuestionID = "abcd.download"
DownloadQuestionID is the download question's id, the id an answers file answers it by.
const DrainRuleOfferGapID = "drain_rule.offered"
DrainRuleOfferGapID is the offer of the drain eligibility record.
const ExplainHint = "(? explains)"
ExplainHint closes the one line of every setup question.
const FilterRootsIgnoredGapID = "filter_roots.ignored"
FilterRootsIgnoredGapID is the note for a ~/.abcd.noindex/filter-roots file abcd ignored (iss-2610091920437492).
const HooksArmGapID = "banlist.hooks_unarmed"
HooksArmGapID is the offer to point git at the committed hooks.
const HooksElsewhereGapID = "banlist.hooks_path_elsewhere"
HooksElsewhereGapID is a clone whose own config points git at another hooks directory, so the committed hooks do not run; abcd does not replace the person's value.
const HostReachGapID = "conventions.host_reach"
HostReachGapID is a file above the project, or a personal file at its root, that keeps Claude Code from reading AGENTS.md: a warning, never resolvable.
const HostVersionGapID = "conventions.host_version"
HostVersionGapID is a Claude Code on PATH older than the release that reads AGENTS.md on its own: a warning, never resolvable.
const LiveSessionsChoices = "local|cloud|both|none"
LiveSessionsChoices is what --live-sessions takes, as a summary names it.
const LiveSessionsNone = "none"
LiveSessionsNone is the stored no.
const OutboundHookRelPath = guardHooksDirRelPath + "/commit-msg"
OutboundHookRelPath is the committed commit-msg hook that runs `abcd lint outbound` over every commit message, repo-relative and slash-separated. It sits beside the name guard's halves and the attribution prompt, in the directory a clone points git at once.
const PlanQuestionID = approvePrefix + "plan"
PlanQuestionID is the plan screen's id: the id an answers file answers it by. It replaces the approve.<category> ids of the approvals the plan asks for at once; an answers file naming one of those is refused, naming this.
const ReadmeOfferGapID = "readme.offered"
ReadmeOfferGapID is the README question, raised while it is unanswered.
const ReadmePartsChoices = "licence|links|contents|release-badge|build-badge|abcd-badge|none"
ReadmePartsChoices is what --readme-parts takes, as a summary names it.
const ReadmePromptKey = "readme"
ReadmePromptKey keys Q1; each part's question is keyed ReadmePromptKey + "." + the part's name, as the status line's elements are keyed statusline.<el>.
const RepoSettingsMirrorRelPath = ".abcd/work/rulesets/repo-settings.json"
RepoSettingsMirrorRelPath is the committed mirror of the repo-object settings abcd manages, repo-relative and slash-separated. It sits beside the branch-ruleset mirror, which covers RULESETS only: the security toggles live behind the separate repository-object API, so a settings change had no source of truth in the tree at all and every claim about it rested on a web console (iss-2608270512210664).
const SessionsOfferGapID = "sessions.offered"
SessionsOfferGapID is the live-session question, raised while it is unanswered.
const SetupInterview = "setup"
SetupInterview is the setup interview's name, as its answers records are named (interview.Write) and read (interview.Latest).
const SetupLaterValue = "later"
SetupLaterValue is the value recorded when a setup question is answered "decide later". It is never handed to the install: a door answers the prompt with no answer (""), and the install treats that as it treats every unanswered question.
const ShellPathOfferGapID = "path.shell_settings_offered"
ShellPathOfferGapID is the offer of the PATH line.
const (
StatusLineOfferGapID = "statusline.offered"
)
Gap ids. StatusLineOfferGapID is exported for the front doors, which name the optional gaps --yes leaves for an answered prompt.
const StoreWorktreeUnlinkedGapID = "store.worktree_unlinked"
StoreWorktreeUnlinkedGapID names a worktree in abcd's worktree store whose repository does not link back to it (iss-2610050728100598). git records a worktree's place in absolute form at both ends: the worktree's .git file names its admin folder in the repository, and that folder's gitdir file names the worktree. Renaming abcd's home moves every worktree without telling the repository, so until `git worktree repair` runs in it, the repository lists the worktree as prunable and a `git worktree prune` there drops its entry. The gap is one per such worktree, report-only: abcd never runs the repair, which writes into the repository's .git, outside its home (the technical facilitator's ruling of 2026-10-04 on iss-2610040147016103).
const UnverifiedCopyGapID = "symlink.unverified"
UnverifiedCopyGapID is the outstanding work an install reports when the owned PATH copy it found on a cold cache did not verify (iss-2610120955431790).
const UpToDateLine = "abcd is already set up here; nothing changed."
UpToDateLine is the one line a repository already fully set up is reported in.
const VintageSourceCheckoutTip = "checkout tip"
VintageSourceCheckoutTip is the VintageStatus.Source a dogfood comparison reports — the one reference that is ancestry-guarded and so the one whose staleness may claim a direction (see Staleness).
const YesStillAsksValues = "--yes approves each kind of change but chooses no value, so the questions below are still asked; " +
"each names the flag that answers it without asking."
YesStillAsksValues is said once, before the first value question, by a run that approved every kind of change with --yes and still has a value to ask: the approval chooses no value, so the questions below are asked all the same (iss-2609120447486547). The words are core's so every front door says the same thing.
Variables ¶
var DependencyTools = []string{"gitleaks"}
DependencyTools names the tools detectDependencies checks for, and so the tools `ahoy install --install-tool` can name: the front door refuses any other, since no gap would ever put it to the question.
var ReleaseTagShape = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$`)
ReleaseTagShape is the accepted release-tag alphabet, one definition for the updater (a tag travels into a URL path there) and for the unseen-update notice below (a tag travels onto a terminal there).
Functions ¶
func AcceptReleaseClaimsForTest ¶ added in v0.16.0
func AcceptReleaseClaimsForTest() (restore func())
AcceptReleaseClaimsForTest makes every release claim pass and returns a restore func, for a front door's tests whose cache fixtures carry no Go build metadata, as they stand in the provenance check. Production never calls it.
func AskLiveSessions ¶ added in v0.16.0
AskLiveSessions puts the open live-session question to a person at a terminal, as setup does, and stores the answer: the session verbs call it when someone tries to start a session on a project not yet set up. It asks nothing, and returns false, off a terminal, once the question is answered, and where there is no config to store the answer in.
func AskSessionsWhere ¶ added in v0.16.0
AskSessionsWhere asks Q2 alone, of a person at a terminal: `abcd session setup`, run by hand, asks it where nothing says where sessions may run. It stores nothing; false off a terminal and on deciding later.
func AssumeSetupBasicsForTest ¶ added in v0.16.0
func AssumeSetupBasicsForTest() (restore func())
AssumeSetupBasicsForTest makes the git and harness checks pass and returns a restore func: the tests run installs under a fixture home with no harness folder, many with PATH narrowed to an install directory, over fixture repositories that need no git command. Production never calls it.
func BriefQuestion ¶ added in v0.16.0
BriefQuestion is q in its one-line form: the question's one line, ending on ExplainHint, and the answers' labels, with the material, the meanings and the Now and change-later lines left for ?. The plan screen keeps its material, which is the plan itself.
func CheckReleaseClaim ¶ added in v0.16.0
CheckReleaseClaim refuses bytes whose Go build metadata does not name tag as the release they were built as. The release a build was made at is stamped into it by Go from the tag the release workflow built at, and the provenance covers those bytes, so only the release that cut a build can claim it. Read, never run.
func EnsureMarker ¶
EnsureMarker installs, refreshes, or (dryRun) predicts the CURRENT abcd marker block in the file at path. It NEVER copies foreign prose — only the canonical block travels, so an embark can re-inject the block into a target CLAUDE.md without carrying a lifeboat's authored text. With dryRun it writes nothing and reports whether a real run WOULD change the file (the embark probe path); without it, it performs the write (the embark write path) — one code path, so probe cannot mispredict. changed reports whether the file was/would be written; a symlinked or unwritable target returns a non-nil error and changed=false.
It wraps the existing unexported classify/install machinery: dryRun first asks whether the file's folder can take the files a write creates beside it (markerFolderRefusal, the write's own first check, iss-2610032202263648), then maps classifyMarker(path) → current→(false,nil), missing/outdated→ (true,nil), symlink, unplaceable or unreadable→(false, err); a real run calls installMarkerFile(path) → its error wrapped as (false, err), else (wrote, nil). An unreadable file's refusal is the write's own: the dry run reads it once more for the reason and words it as the write does, with the folder taken out (iss-2610032048280232, iss-2610032202259011).
func GitHubRepo ¶ added in v0.11.1
GitHubRepo is the owner/name this checkout's origin remote names, under the same github.com-only, plain-name rules the remote apply writes behind. Every verb that writes to the forge resolves its repository here, so there is one answer to "which repository may this write reach".
func HarnessNotice ¶ added in v0.13.1
func HarnessNotice() string
HarnessNotice is the session-start line for the harness's user settings: "" when nothing there calls abcd that should not, one line naming the finding and its remedy when there is one, and one line counting them and pointing at `abcd ahoy` when there are several. It reads the settings file, the path-entry record and the plugin's hook manifest — each bounded, none written, no network.
func HooksUnarmed ¶ added in v0.16.0
HooksUnarmed reports whether gaps say no hooks path is set in a clone that commits abcd's checks: the one state in which the checks certainly do not run.
func HooksUnrunNotice ¶ added in v0.16.0
HooksUnrunNotice is the session-start line for a clone whose committed hooks git may not run, or "" when gaps say they run (iss-2610241133284600). A clone with no hooks path set runs none of them, so no commit there passes a check and nothing else says so until a gate fails afterwards. A clone whose own config names another directory may still run them, chained from that directory's hooks, so that line says so rather than claiming they never run. The text is a constant: nothing in it is read from the repository.
func IsOwnedPathCopy ¶ added in v0.8.0
IsOwnedPathCopy reports whether target is the regular file abcd installed as this machine's PATH entry: ~/.abcd.noindex/path-entry names that very entry and the bytes still hash to the recorded value. It is the exported face of the same predicate `ahoy` classifies with, published for `abcd update`, which needs a proof of ownership that no release deletion can revoke (iss-2609012000222546, and the itd-130 fidelity audit's ac-1 concern (b): the record was re-stamped after a swap but never consulted as a proof before one). It reads two local files and touches no network.
func LegacyApprovalRefusal ¶ added in v0.16.0
LegacyApprovalRefusal is the refusal of an answers file that answers an approval of one kind of change by its old id: the plan asks for them all at once now, under PlanQuestionID. "" for any other id.
func LiveSessions ¶ added in v0.16.0
LiveSessions reads the stored answer: local, cloud, both or none, and false when nothing is stored. An unreadable config, or a stored value that is not one of those, is an error.
func LowerReleaseMarkCommand ¶ added in v0.14.1
LowerReleaseMarkCommand is the one command that lowers the mark on purpose, for a tag: naming the tag is the person's own choice of an older release.
func Managed ¶ added in v0.9.0
Managed reports whether the checkout rooted at root is one abcd manages: the exact question classify answers with ManagedRepo, exported as a cheap predicate for the two front doors that ask it on every render — the status verb the harness invokes on each refresh, and the bare board (spc-70).
It is classify's strong-signal rule and nothing more: a marker block in CLAUDE.md or AGENTS.md at the root, or registration in the user-level history index by root commit. A bare `.abcd/` is not a managed signal on its own (iss-88), and a plain git checkout is not managed. No new heuristic lives here; TestManagedAgreesWithClassify holds the two to the same answer on every fixture.
What it does NOT do is run the full detection pass. Detect walks PATH, reads the plugin root, probes guard health and the rest, and a status line that paid for that on every keystroke would be a status line people switch off. The marker is read first, because it settles the ordinary managed case with two file reads and no subprocess; git is asked for the root commit only when the marker is absent AND there is an index to look it up in. Zero network, zero writes.
It is total: a git that did not answer for the root commit reads as "not managed" here, which is safe only for a caller whose "not managed" is an omission (a board block left out, a badge not shown). A caller that refuses an act as unmanaged asks ManagedContext, which returns that failure.
func ManagedContext ¶ added in v0.13.1
ManagedContext is Managed bound to ctx, for a caller on a deadline (the status verb). The one subprocess it may start — git's root commit, asked only when no marker block answers — runs under ctx and is killed when ctx ends (gitutil.RootCommitContext). A context that ended before git answered, and a git that gave no answer for the repository (gitutil.ErrNoRootAnswer), are returned as errors, never as "not managed", so the caller does not mistake a slow or failed git for a checkout abcd does not manage.
func NoHostVersionForTest ¶ added in v0.13.0
func NoHostVersionForTest() (restore func())
NoHostVersionForTest makes the version reading find no agent tool, as on a machine with none on PATH, and returns a restore func. It is a test-only seam (in the manner of SetCurrentVintageForTest): a front-door test package runs installs in-process and calls it from its TestMain, so no unit test runs the machine's own agent tool and no test's output depends on its release. Production never calls it.
func OfferGH ¶ added in v0.12.0
OfferGH is the explain-then-install mode for gh at a remote write (itd-63 criterion 2; the product thinker's DQ3 ruling, 2026-09-29: offer to install gh on an explicit yes). With gh on PATH it says nothing. Otherwise it hands the registry's explanation to confirm, which the front door answers yes only for a person at a terminal, and runs the registry's step only on that yes.
ok is true only when gh was installed AND verified; the notes then say what ran. Every other outcome (a no, no one asked, CI, a failed or unverified step) is ok=false with the reason first, then the explanation with the exact command, so the caller refuses loudly and reaches no gh call on a half-done install.
func OldHostVersionForTest ¶ added in v0.13.0
func OldHostVersionForTest() (restore func())
OldHostVersionForTest makes the version reading report an agent tool one release below the floor, without running anything, and returns a restore func: the stub a front-door test proves the warning renders with. Production never calls it.
func ParseLiveSessions ¶ added in v0.16.0
ParseLiveSessions refuses a --live-sessions value that is not local, cloud, both or none.
func ParseReadmeParts ¶ added in v0.14.0
ParseReadmeParts reads a --readme-parts value: a comma-separated list of part names, returned once each in the fixed order, or `none`, returned as an empty, non-nil list. An unknown name, an empty one, or none beside a name is refused naming the known names.
func PluginDataDirHazard ¶ added in v0.11.1
PluginDataDirHazard is dataDirHazard for a front door that reads the harness data directory itself (the session-start skew notice): the reason dataDir cannot be trusted, or "" when it has the shape the harness always gives it. One check, so the surface and core cannot disagree about which directories are believed.
func PluginRootContaining ¶ added in v0.12.0
PluginRootContaining reports the plugin root a given path sits inside, by walking the path's ancestors for the plugin layout.
It is the executable-ancestor rung of resolvePluginRoot's ladder on its own: a front door that needs to know WHICH root served the running binary — as distinct from which root this session resolves — asks through the same walk and the same layout check, so it never grows a second notion of what a plugin root is (iss-2609020113012227). A path inside no plugin root — a PATH copy, a `go run` binary — yields false, which a caller reads as "nothing to say" rather than as a negative finding.
func PreviousReleaseTag ¶ added in v0.16.0
PreviousReleaseTag is the release the binary record says the last swap came from (previous_tag), read where TakeUnseenUpdate reads it and through the same data-directory check, whether or not that swap was seen, and without its claim: it writes nothing. A value that is not exactly a release tag is none.
func ReadReleaseMark ¶ added in v0.14.1
ReadReleaseMark returns the recorded newest release, read through the same home-scoped declaration read as the cache attestation (owned by this uid, writable by no one else, a regular file). Absent, unreadable or malformed reads as no mark.
func RecordReleaseMark ¶ added in v0.14.1
RecordReleaseMark records tag as this machine's newest release. With lower false it only RAISES the mark (a tag at or below the current one changes nothing); with lower true — an explicitly named tag, the person's own choice — it records tag whatever the mark said. The write is atomic and mode 0600 under ~/.abcd.noindex, judged and opened relative to home's descriptor like path-entry.
func RefreshPathEntryDigest ¶
func RefreshPathEntryDigest(target, shaHex string)
RefreshPathEntryDigest re-records the provenance hash for the owned PATH copy after `abcd update` swapped the file at target — the one other verb that legitimately changes those bytes, and only after proving the new content against a published release's own checksums. Without this the entry update just refreshed would classify foreign forever after. A record that does not name target, a malformed digest, or no record at all is a no-op: this refreshes provenance, it never creates it.
func ReleaseOlder ¶ added in v0.14.1
ReleaseOlder reports whether release tag a is older than tag b. Two tags of the same core are equal unless only a carries a pre-release suffix. A tag that does not parse is never older: the comparison refuses only on a fact.
func ResolvePluginRoot ¶ added in v0.7.1
ResolvePluginRoot is the exported face of resolvePluginRoot for the front doors: the same ladder (ABCD_PLUGIN_ROOT -> CLAUDE_PLUGIN_ROOT -> executable-ancestor -> recorded path-entry root), the same layout check, so a surface never grows a second notion of where the plugin lives.
func RetiredDocsTarget ¶ added in v0.13.0
RetiredDocsTarget reports whether v is a docs.target value setup reads but no longer writes (claude_md, both), and the one explanation every front door shows for it: the detection gap, the install refusal and the --docs-target flag all carry these words, so none restates them (adr-2610030814023326: AGENTS.md is the one conventions file abcd writes). A writable value, and a value abcd never accepted, is not retired and has no explanation.
func SavedDocsTarget ¶ added in v0.13.0
SavedDocsTarget reads the docs.target this project's setup saved in .abcd/config.json under cwd, through the reader setup itself uses (a guarded, size-capped read of a regular file), so another writer of abcd's block — embark — follows the same choice setup made. It returns the value as saved when it is one setup reads (agents_md, skip, or a retired value RetiredDocsTarget explains), and "" when setup reads none: no settings file, no docs.target, or a value outside the set, which detection reports as not set. err is non-nil only when the settings file cannot be read or parsed.
func SetCurrentVintageForTest ¶
SetCurrentVintageForTest overrides the build-vintage seam and returns a restore func. It is a test-only seam (in the manner of this package's history hooks): a go-test binary is itself unstamped, so without an override every install path in a front-door test package would hit the itd-111 unknown-vintage refusal. Front-door test packages, which cannot reach the unexported seam, install a deterministic vintage through this. Production never calls it — it reads the embedded build info.
func SetupAskedBeforeWriting ¶ added in v0.13.0
SetupAskedBeforeWriting reports whether the install asks the setup question id before its first write: the adoption and the approvals of each kind of change, which install asks before its first apply step. A stop at one of them leaves the repository untouched; a stop at any other question leaves what the steps before it changed.
func SetupConfirmQuestion ¶ added in v0.13.0
SetupConfirmQuestion is the n-th question of setup, Confirm(text) as the shared type: its id the approval's (setupConfirmID; "" for a text setup does not own); the text split into the material and the one plain question it ends on (the last line, or else the last sentence of a text that ends in a question, a line indented by two spaces an item of a list); and the answers yes and "No, leave it", with deciding later declining. Yes points at the material only where there is material: the approval of a kind of change says how many listed changes it writes, or which questions it goes on to (approvalYes), and an approval asked whole makes the change its question names (iss-2610071528375981).
func SetupFixedValues ¶ added in v0.13.0
SetupFixedValues returns the values an answers file may give the setup question id when that question's answers are fixed before the run, as SetupValueQuestion and SetupConfirmQuestion build them (the options, then deciding later): a config value's, the house-style question's, a status line element's, and every approval's. ok is false for a question whose answers the run decides (the artefact kind, a conventions file's retirement) or an id setup does not ask.
func SetupHelpedQuestion ¶ added in v0.14.0
SetupHelpedQuestion is the n-th question of setup, PromptHelped(h, choices, def) as the shared type: SetupValueQuestion over the help built for this run, its current setting the question's Now and its example quoted after the material. Its Default is def, so a drawn list starts on the answer an empty answer takes at the stdin door (the README pair, the one question set asked through PromptHelped, keeps its answers in one order whatever the default); no text marks it.
func SetupMachineWide ¶ added in v0.13.0
SetupMachineWide reports whether the setup question id changes the machine rather than the repository: the status line, which every repository on the machine shows, the machine's routing table, and the PATH line in the person's shell settings. Its answer is recorded in the home's interviews, the rest in the repository's local tier.
func SetupPlanQuestion ¶ added in v0.16.0
SetupPlanQuestion is the plan screen as the shared question type: the plan as its material (the changes grouped by where they land, the defaults each with where to change it, and the questions that follow), the one line, and the three answers, deciding later cancelling.
func SetupValueQuestion ¶ added in v0.13.0
SetupValueQuestion is the n-th question of setup, Prompt(key, choices, def) as the shared type: the key the id; the material the About of the help HelpIn gives for the repository at cwd (its last sentence the question, where it asks one); the choices the prompt offers as options, in its order, each labelled by its value with core's meaning beneath; the change-later line from ChangeLaterLine; and the decide-later answer, whose meaning says what the install does with no answer. For a config value (a question a flag answers) no answer leaves the value unset, so the gap stays listed; for any other question no answer takes def. A key core has no help for is asked bare.
func SetupVersion ¶ added in v0.16.0
SetupVersion is the setup version the repository at cwd recorded (.abcd/config.json meta.setup_version), handed out only when it is exactly a release tag (launch.ParseReleaseTag), so no other word of the tracked file leaves ahoy through it. A dev stamp, a missing value or a config that does not parse is none.
func StoreLiveSessions ¶ added in v0.16.0
StoreLiveSessions saves v as sessions.live under the config's lock and returns what was stored before ("" for nothing). It refuses a value ParseLiveSessions refuses, and a repository with no .abcd/config.json.
func StripMarkerBlock ¶
StripMarkerBlock returns content with every abcd marker block (a balanced BEGIN…END fence and its surrounding blank lines) removed, and reports whether anything was stripped. Content with no block is returned unchanged. It is the pure, path-free form of removeMarkerFile, exported for the lifeboat packer: carrying a stale marker block into a packed record would plant a dead rules-loader in whatever repo later embarks it, so a verbatim copy is passed through this first. Only a balanced pair is matched, so an unbalanced fence or a literal mention of the delimiter text outside a pair is left intact.
func TakeUnseenUpdate ¶ added in v0.12.0
TakeUnseenUpdate reports the one release swap nobody was told about, and marks it told. It is the ruling CJ1b's single exception to the session check's read-only rule, and the claim it creates is the only write.
An update is announced by whatever performed the swap, when the swap completes: `abcd update` prints update.UpdatedFormat, and hooks/bootstrap.sh leads its success notice with it. The one swap whose output no one reads is the bootstrap salvage the per-prompt, per-command and pre-compaction hooks run with their output discarded (hooks/hooks.json); that run records transition_unseen=yes beside previous_tag in the binary-meta it writes (the cache's, or the plugin root's .binary-meta when there is no data dir), and this is what shows it, once, at the next session start. A swap whose own line was relayed carries no flag, so this shows it never and writes nothing.
The directory the record comes from is an environment value, so it passes dataDirHazard before anything is read from it or written into it, and both tags must have ReleaseTagShape: a record an HTTP redirect filled shows nothing it cannot vouch for. Once is one exclusive create per release (O_CREATE|O_EXCL), so of any number of sessions starting together exactly one takes the claim; a claim path that already exists, or a create that fails for any other reason, reports nothing, because a notice that cannot remember it was shown would repeat every session. Claims for earlier releases are left in place: removing one would be a second write, and each is an empty file.
func WalkConfigValueQuestions ¶ added in v0.13.0
func WalkConfigValueQuestions(cwd string, opts InstallOptions, approves func(id string) bool, answer func(key string, choices []string, def string) string) error
WalkConfigValueQuestions puts to answer, writing nothing, the config value questions an install at cwd with opts would ask, in the order it asks them and exactly as far as it would ask them: a value a flag in opts.ValueOverrides gives is not put, and an answer that is not a value setup writes (deciding later included) leaves that value unset and the walk goes on to the next, as the install's collection does. It is the part of setup's questions settled before the install's first write, so a front door that answers from a file checks the file against it before Install runs, and a value the file leaves unanswered refuses with the repository untouched (iss-2610040025088395). The questions whose asking the run itself decides (the status line's elements, the offers, the artefact kind) are not walked.
Nothing is put when the install would ask no value question: cwd is not a repository, an early refusal ends the install, the adoption is declined, or the settings change (config-change) is not approved. approves answers the adoption ("adopt") where opts.Adopt is unset, and the approval ("approve.config-change") where neither opts.Yes nor opts.ApprovedCategories decides it. The error is Detect's.
Types ¶
type ApplyResult ¶
type ApplyResult struct {
Category GapCategory
GapsResolved []string
GapsSkipped []string
Notes []string
}
ApplyResult is the outcome of one apply step.
type BanlistHealth ¶
type BanlistHealth struct {
// Hook and MergeHook are the committed guard's two halves. A merge commit runs
// NO pre-commit hook, so a repo with only the first half is uncovered for exactly
// the commit that merges someone else's branch.
Hook HookState `json:"hook"`
MergeHook HookState `json:"merge_hook"`
// HooksPath is which hooks directory git runs in this clone, judged against the
// committed one: armed, unarmed, or foreign — a hooks path set outside the
// clone's local config (a global or system dispatcher) that abcd cannot see
// into. Foreign is neither verdict, and no surface may advise a local override
// for it: a local core.hooksPath shadows the dispatcher in this clone and drops
// whatever else it chains.
HooksPath HooksPathState `json:"hooks_path"`
// HooksPathArmed is HooksPath == armed, kept for readers of the boolean. False
// is not a fault — see HooksPath for whether it is unarmed or unknown — so the
// surfaces phrase it as an instruction, never as an accusation.
HooksPathArmed bool `json:"hooks_path_armed"`
// PublicFamily is the committed layer's state, including the case where it is
// present and readable but git ignores the file, so CI never sees it.
PublicFamily PublicFamilyState `json:"public_family"`
// HookEOLPinned reports whether .gitattributes keeps the committed hooks at LF.
// Meaningful only where abcd owns the hooks: pinning the EOL of a directory whose
// contents are someone else's is not abcd's call.
HookEOLPinned bool `json:"hook_eol_pinned"`
// HookRetiredVerb reports an abcd-owned pre-commit hook that still runs the
// sources refresh as `source sync-banlist`, the spelling the verb had before
// it became library (spc-2610100613109045, decision 13). A binary without
// that verb makes the hook skip the refresh with one stderr line, so the
// confidential-name block stops being refreshed with no other sign.
HookRetiredVerb bool `json:"hook_retired_verb"`
// PublicConfigIgnored is git's verdict on the config's PATH, whether or not a
// file is there yet. It is what makes the absent-family gap honest: writing a
// config into a path git ignores delivers no enforcement, so abcd does not offer
// to.
PublicConfigIgnored bool `json:"public_config_ignored"`
// PublicConfigWritable reports whether scaffolding may create the config here. It
// is NOT the negation of PublicConfigIgnored: a probe git could not answer is
// neither ignored nor safe, and it fails closed inside anything repo-shaped.
PublicConfigWritable bool `json:"public_config_writable"`
// PrivateStore reports whether THIS MACHINE has opted in. False is the honest
// "inactive here" state, never silence: an absent store checks nothing, and the
// guard says so at commit time for the same reason.
PrivateStore bool `json:"private_store"`
// PrivateStoreIgnored is git's verdict on the store's path. A present store git
// would track is one `git add -A` from committing the patterns it exists to keep
// out of history.
PrivateStoreIgnored bool `json:"private_store_ignored"`
// PrivateKeyed, PrivateEntries and PrivateUnparsed are the store's SHAPE, never
// its content: a format flag and two counts, taken from the shared parser. A line
// that does not parse stops every commit until it is fixed.
PrivateKeyed bool `json:"private_keyed"`
PrivateEntries int `json:"private_entries"`
PrivateUnparsed int `json:"private_unparsed"`
// PrivateUnreadable reports a store that exists and cannot be read for what it
// is — a damaged format declaration, an unreadable file. The guard refuses every
// commit in that state, so a status board must not render it as healthy.
PrivateUnreadable bool `json:"private_unreadable"`
// Reach is PrivateReachNote, unconditionally.
Reach string `json:"reach"`
}
BanlistHealth is the two-layer name guard's state in one repo: which of the scaffolded artefacts are there, what shape the private layer is in, and — always — how far it reaches (spc-20 AC7).
Reach is carried in the struct rather than added by a renderer because this report is read on two surfaces at once. A human sees a line; a machine consumer reads the fields. "hook: installed" beside a populated private store reads as "covered" to both of them, and it is not: the guard runs on machines that opted in, for the commits git asks a hook about, and nowhere else. The caveat travels with the state it qualifies.
type CheckApp ¶ added in v0.16.0
CheckApp is the GitHub App a required check is pinned to, by the id GitHub's check runs name, never one abcd knows in advance.
type ChoiceHelp ¶ added in v0.11.1
ChoiceHelp explains one answer to an install question in plain language: what choosing it does to the person's repository or machine, and what it asks of them (keys, tools, cost) where it asks anything.
type DefaultChange ¶ added in v0.16.0
DefaultChange is one entry: the setup key whose default changed and the record that changed it.
type DefaultRecorder ¶ added in v0.16.0
type DefaultRecorder interface {
RecordDefaultConfirm(text string, yes bool)
RecordDefaultPrompt(key string, choices []string, def, value string)
RecordDefaultHelped(h PromptHelp, choices []string, def, value string)
}
DefaultRecorder is a prompter that records the answer the plan took for a question it did not put, as the question was and as if it had been asked and answered so: a run's record then says what every answer was, the defaults the plan took included, and a replay from that record answers each question the same way.
type DetectionResult ¶
type DetectionResult struct {
FolderKind FolderKind `json:"folder_kind"`
Adopted *bool `json:"adopted"` // nil on detect/dry-run
RootSHA string `json:"root_sha"`
PluginRootStatus string `json:"plugin_root_status"` // "resolved" | "missing"
RepoIdentity RepoIdentity `json:"repo_identity"`
Signals map[string]any `json:"signals"`
// Guard is the execution-time shell guard's health. It is reported on every
// pass over a repo, healthy or not: a guard that fails open looks exactly like
// a working one from inside a session, so the state has to be legible from
// outside.
//
// A POINTER, omitted entirely for an unmanaged folder — like Banlist below and
// for the same reason: its fields are definite booleans, so a never-computed
// zero value would serialise four `false` facts (and no detail) that read as "a
// broken guard" to a consumer that never asked about a repo, in a document that
// simultaneously reports the plugin root resolved.
Guard *GuardHealth `json:"guard,omitempty"`
// Banlist is the two-layer name guard's state. Like Guard it is reported on
// every pass over a repo — and it carries its own reach, because a private layer
// that looks installed says nothing about what a pull request is checked against.
//
// A POINTER, omitted entirely for an unmanaged folder: the states it reports are
// named strings ("absent", "foreign") and its ignore flag is warning-polarity, so
// a zero value would serialise undeclared states and a false that reads as "the
// store is trackable" to a consumer that never asked about a repo.
Banlist *BanlistHealth `json:"banlist,omitempty"`
Gaps []Gap `json:"gaps"`
// Readme is the README question pair as the plugin page relays it, carried
// by DryRun while the question is open (readme.offered) and omitted
// otherwise (spc-2610031704338417).
Readme *ReadmeView `json:"readme,omitempty"`
// Sessions is the live brief session questions as the plugin page relays
// them, carried by DryRun while they are open (sessions.offered) and
// omitted otherwise (spc-2610141709430146 step 6).
Sessions *SessionsView `json:"sessions,omitempty"`
// contains filtered or unexported fields
}
DetectionResult is the canonical envelope. dry-run marshals exactly this (with Adopted=nil).
func Detect ¶
func Detect(cwd string) (DetectionResult, error)
Detect runs the full detection pass over cwd and returns the canonical envelope. Total over a normal folder: broken-plugin conditions surface as gaps, never as a hard error. An error is returned only for malformed input.
It is the pass the hooks and the status board run, so it starts no tool: a tool's copy found on the PATH counts as installed, and its version is judged only by the passes a person starts (detectJudged).
func DryRun ¶
func DryRun(cwd string) (DetectionResult, error)
DryRun runs Detect and returns the envelope (Adopted=nil). Zero writes.
While the README question is open it also carries the README view (readmeView), which the plugin page relays the question pair from, and while the live brief session question is open, its view (sessionsView); Detect alone, which the hooks and the status board call, derives no part.
type DoctorReport ¶
type DoctorReport struct {
Detection DetectionResult `json:"detection"`
AuditGaps []Gap `json:"audit_gaps"`
}
DoctorReport is the outcome of Doctor: the detection envelope plus read-only cross-machine reconciliation gaps.
func Doctor ¶
func Doctor(cwd string) (DoctorReport, error)
Doctor runs the detection pass plus a read-only cross-machine audit. Zero writes.
type DogfoodReport ¶
type DogfoodReport struct {
IsDogfood bool // cwd is abcd's own source checkout (the binary was built from it)
Outcome vintage.Outcome // Fresh (silent) / Stale / Unknown (a dirty rebuild)
Revision string // the binary's embedded revision (full)
Tip string // the checkout tip it should match (full)
}
DogfoodReport is the source-checkout-tip comparison the session-start notice consumes. It is scoped to the dogfood case on purpose: a pinned install in a user's own repo must never be nagged, so IsDogfood gates the whole notice.
func DogfoodStaleness ¶
func DogfoodStaleness(cwd string) DogfoodReport
DogfoodStaleness reports whether the running binary trails the tip of the source checkout it was built from, for the session-start notice. It reads the binary's own build vintage and compares against cwd's HEAD.
type DownloadRelease ¶ added in v0.16.0
type DownloadRelease func(tag string) (DownloadedRelease, error)
DownloadRelease fetches the release tag's binary for this platform and verifies it before returning it; any failure is an error and nothing is returned.
type DownloadedRelease ¶ added in v0.16.0
DownloadedRelease is a release binary fetched and verified: its bytes, the sha256 checksums.txt names for them, and the signer of its build provenance.
type Finding ¶ added in v0.16.0
type Finding struct {
Setting string `json:"setting"`
Current string `json:"current"`
Target string `json:"target"`
// State is one of ok | differs | advisory | owed | kept | unknown.
State string `json:"state"`
// Note says why the state is what it is, whenever it is not plain ok.
Note string `json:"note,omitempty"`
}
Finding is one baseline setting as the audit found it.
type FolderKind ¶
type FolderKind string
FolderKind is the classification of the folder ahoy runs in. There is no workspace layer: abcd manages exactly one kind of folder, a repository.
const ( // ManagedRepo is a git repo abcd already manages (a strong marker fired). ManagedRepo FolderKind = "managed-repo" // UnmanagedRepo is a git repo with no abcd markers yet (adoptable). UnmanagedRepo FolderKind = "unmanaged-repo" // UnmanagedFolder is not a git repo and has no abcd markers. UnmanagedFolder FolderKind = "unmanaged-folder" )
type Gap ¶
type Gap struct {
ID string `json:"id"`
Category GapCategory `json:"category"`
Scope string `json:"scope"` // "repo" | "machine"
Title string `json:"title"`
Detail string `json:"detail"`
FixHint string `json:"fix_hint"`
Required bool `json:"required"` // advisory gaps set false
Resolvable bool `json:"resolvable"` // false => diagnostic only
// Tool is the tool registry's explanation for a dependency gap (itd-63):
// what the tool is, whether this capability needs it, what works without
// it, and the exact install step. Absent on every other gap.
Tool *tools.Explanation `json:"tool,omitempty"`
}
Gap is one detected discrepancy between desired and actual state.
type GapCategory ¶
type GapCategory string
GapCategory groups gaps for the one-approval-per-category apply protocol.
const ( // SafeAutocreate covers artefacts written without a per-item prompt once // the category is approved (the .abcd/ skeleton, history-store dirs). SafeAutocreate GapCategory = "safe-autocreate" // ConfigChange covers transparent-confirm changes (visibility, symlink). ConfigChange GapCategory = "config-change" // PluginOwned covers the marker block and the (verify-only) hook manifest. PluginOwned GapCategory = "plugin-owned" // Dependency covers the external tools a capability uses (itd-63): each gap // carries the tool registry's explanation, and a tool is installed only on // an answer the front door's confirmation returns, never on the category // approval alone. Dependency GapCategory = "dependency" // UserState covers ~/.abcd.noindex/history registry state (guided, never auto-edited). UserState GapCategory = "user-state" // StatusLine covers the host harness's status-line wiring (spc-70). Its one // gap is advisory and is never written under --yes: the wiring rewrites a // harness-wide user setting and takes element choices, so only an answered // prompt writes it. StatusLine GapCategory = "status-line" // OracleRouting covers accepting abcd's proposed model-tier routing table, // at the machine and, offered separately, at the repository // (itd-2609170822093401). Its gaps are advisory and never written under // --yes: a routing table decides which model every delegated step asks // for, so only an answered prompt accepts one. OracleRouting GapCategory = "oracle-routing" )
const ConventionsFile GapCategory = "conventions-file"
ConventionsFile covers retiring a tool's own conventions file that only repeats AGENTS.md. Its gap is advisory and never acted on under --yes: the removal is of a file in the person's project, so only an answered question at a terminal removes one.
const DrainRule GapCategory = "drain-rule"
DrainRule covers adding the repository's drain eligibility record.
const HooksPathCategory GapCategory = "hooks-path"
HooksPathCategory covers pointing git at the committed hooks in this clone.
const MachineIdentity GapCategory = "machine-identity"
MachineIdentity (itd-2610240918547728) covers the person's own commit identity record on their machine, and moving the identity pin a repository still stores to its owner's machine. Its gaps are advisory, never written under --yes, and never behind a category approval: each is asked as its own question, only at a terminal, because it records who a person is.
const Readme GapCategory = "readme"
Readme covers the README parts abcd keeps current. It is never asked as a category: the README question is the consent (open question 5).
const Sessions GapCategory = "sessions"
Sessions covers the live brief session answer. It is never asked as a category: the question is the consent.
const ShellPath GapCategory = "shell-path"
ShellPath covers adding the PATH line to the person's shell settings.
type GuardHealth ¶
type GuardHealth struct {
// PluginRootResolved reports whether the plugin root was found at all. It
// gates the two checks below: without it the manifest is never opened and the
// binary is never looked for, so HookInstalled and BinaryReachable carry no
// information. A report that folded "not checked" into "false" would accuse a
// plugin install that may be perfectly armed — the state every dev build that
// runs from source is in.
PluginRootResolved bool `json:"plugin_root_resolved"`
// HookInstalled reports whether the plugin's hook manifest declares the
// pre-tool-use entry that runs the guard. Meaningful only when
// PluginRootResolved.
HookInstalled bool `json:"hook_installed"`
// BinaryReachable reports whether the binary that entry invokes exists and
// is executable. When it is not, the shim fails open on every command.
// Meaningful only when PluginRootResolved.
BinaryReachable bool `json:"binary_reachable"`
// RegistryLoadable reports whether ANY hazard registry is armed — the
// bundled defaults, with this repo's .abcd/guard.json merged in when it
// loads. Since the fail-safe load (iss-2608261551087492) a broken repo file
// no longer clears this: guard.Load falls back to the bundled defaults, so
// false here means no registry at all — the only genuinely-unguarded
// registry state, which the embedded defaults make unreachable in practice.
// A broken repo layer over an armed bundle is RepoOverridesDropped instead.
RegistryLoadable bool `json:"registry_loadable"`
// RepoOverridesDropped reports the fail-safe degraded state: this repo's
// .abcd/guard.json does not load, so its overrides are dropped while the
// bundled hazards stay armed. Mild and expected — commands are still
// checked — but never silent: the broken committed file needs fixing, and
// hiding it would let a repo's own tightened hazards quietly lapse.
RepoOverridesDropped bool `json:"repo_overrides_dropped,omitempty"`
// Disabled reports a deliberately switched-off registry. It is not a fault —
// .abcd/guard.json is the only route, and a switch-off takes effect only
// once HEAD carries it (iss-147), so the change is a reviewed commit. A
// disabled guard that looks armed is exactly the state this report exists
// to prevent.
Disabled bool `json:"disabled"`
// Entries is how many hazards the loaded registry holds, so "loadable" is
// backed by a number rather than a boolean nobody can check.
Entries int `json:"entries"`
// Detail is a one-line human reason when something needs attention; empty
// when there is nothing to report. It can be non-empty while Healthy() is
// true: dropped repo overrides leave commands checked but still need fixing.
Detail string `json:"detail,omitempty"`
}
GuardHealth is the answer to "is the execution-time guard actually on?", split into the three things that can independently be false. It exists because a guard that fails open is indistinguishable from a guard that is working, from inside the session — so the state has to be visible from outside it too (itd-103 AC 1, spc-16 "Fail-open-loud and health").
func (GuardHealth) Healthy ¶
func (g GuardHealth) Healthy() bool
Healthy reports whether commands in a session are actually being checked: the hook runs, the binary it calls exists, and the registry loads.
type HelpedPrompter ¶ added in v0.14.0
type HelpedPrompter interface {
Prompter
PromptHelped(h PromptHelp, choices []string, def string) string
}
HelpedPrompter is a Prompter that can ask a value question with help built for this run: the question's current setting and an example of what an answer writes here, which the static help cannot hold (PromptHelp's Now, Example and ExampleNone). The README pair asks through it where the prompter implements it, and through Prompt, by the help's key, where it does not (spc-2610031704338417).
type HookState ¶
type HookState string
HookState is what occupies one of the guard's two hook paths.
const ( HookAbsent HookState = "absent" HookInstalled HookState = "installed" // HookForeign is a hook abcd did not write. It is NOT a failure of the repo — // a maintainer's own pre-commit hook is legitimate — but it is a state in which // nothing checks the banlist, so it can never be reported as installed. HookForeign HookState = "foreign" // HookUnreadable is a path that exists and cannot be read as a hook (a symlink, // a directory, an oversize file). Like GuardHealth's unknown state it asserts // nothing it did not check. HookUnreadable HookState = "unreadable" )
type HooksPathState ¶ added in v0.13.3
type HooksPathState string
HooksPathState is which hooks directory git runs in a clone, judged against the committed one.
const ( // HooksPathStateArmed: the effective core.hooksPath resolves to the committed // hooks directory, so git runs the guard. HooksPathStateArmed HooksPathState = "armed" // HooksPathStateUnarmed: the clone's own config sets no hooks path or points it // elsewhere, and nothing outside the clone sets one. Arming it locally is the // clone's own business. HooksPathStateUnarmed HooksPathState = "unarmed" // HooksPathStateForeign: no local hooks path, and one set outside the clone's // local config (global, system) names some other directory — a dispatcher, as // often as not, that may chain to the committed hooks. Whether it does is // unknown, and a local override would shadow it. HooksPathStateForeign HooksPathState = "foreign" )
type InstallConfig ¶
type InstallConfig struct {
Visibility string // private | public
DocsTarget string // claude_md | agents_md | both | skip
OracleBackend string // host-delegated | native | cli | api | mcp
ScanDeep *bool // nil = unset (gap not emitted)
}
InstallConfig is the four configuration values collected/loaded during install.
type InstallOptions ¶
type InstallOptions struct {
Adopt *bool // --adopt / --refuse-adopt / nil
Yes bool // approve every resolvable category
ApprovedCategories map[GapCategory]bool // nil => interactive; explicit => partial subset
ValueOverrides map[string]string // visibility/docs_target/oracle_backend/scan_deep
// Dev requests the track-latest dogfood mode: the PATH entry becomes a shim
// that rebuilds abcd from the source tip on every call and execs the fresh
// binary (failing loudly on a broken build), instead of a symlink to the
// pinned built binary. --dev.
Dev bool
// BinDir is an explicit directory for the PATH entry (--bin-dir), the only
// way to reach a system-wide location. Empty means the default single-user
// location (~/.local/bin), or an existing owned install adopted in place.
// abcd NEVER escalates privileges: a BinDir it cannot write to is a loud
// error, never a silent skip and never a re-run under sudo.
BinDir string
// Attribution opts this repo into the committed prepare-commit-msg prompt that
// asks every commit to declare whether a tool assisted it. --attribution.
//
// Opt-IN, never a default: the hook stamps a convention onto every commit
// message, which is an opinion a repo adopts rather than one abcd may assume.
// The choice is PERSISTED (`attribution.hook` in config.json), so a later plain
// install keeps the hook instead of making the maintainer re-pass the flag to
// keep something they already chose.
Attribution bool
// Outbound is the one outbound switch: it opts this repo into both outbound
// checks at once, the committed commit-msg hook that runs `abcd lint
// outbound` over every commit message and the shell guard's check of the
// title, body and body file a posting gh command hands the forge. --outbound.
//
// Opt-IN, never a default: a hook that refuses a commit and a guard that
// refuses a post each change how work in the repository goes, which is the
// repository's choice (iss-2609250834251447, iss-2610142210511831). One
// switch turns on both, by the product thinker's ruling of 2026-10-15
// (iss-2610152024327989); it replaced --outbound-hook and --outbound-forge.
// The choice is PERSISTED as `outbound.hook` and `outbound.forge` in
// config.json, so a later plain install keeps both. On this explicit opt-in
// alone, install also writes this clone's `git config --local abcd.binary`
// to the PATH copy whose provenance it verified (iss-2610152024267547).
Outbound bool
// AllowStaleBinary overrides the itd-111 staleness refusal: an install run
// through a binary that is stale against its source tip, or whose vintage
// cannot be determined, otherwise refuses before any write. The override is
// the documented escape when a rebuild is not an option. --allow-stale-binary.
AllowStaleBinary bool
// ConfirmTool is asked, once per missing tool, whether to run the tool
// registry's install step (itd-63). The front door supplies it: the CLI
// asks at a terminal, or answers yes for a tool the person named with
// --install-tool. Nil is a no for every tool, so a caller that asks nothing
// installs nothing. The category approval never stands in for it.
ConfirmTool tools.Confirm
// ReadmeParts is --readme-parts as given: a comma-separated list of the
// README parts abcd keeps current, or none; "" is the flag not given. It
// answers the README question in any run, --yes included, and is stored as
// readme.parts (readme_apply.go); a value ParseReadmeParts refuses refuses
// the install before any write.
ReadmeParts string
// LiveSessions is --live-sessions as given: local, cloud, both or none;
// "" is the flag not given. It answers the live brief session questions
// in any run, --yes included, and is stored as sessions.live
// (sessions_ask.go); a value ParseLiveSessions refuses refuses the
// install before any write.
LiveSessions string
// ApproveDependency answers the dependency category's question yes without
// asking it: the front door sets it when the person named a tool to
// install (--install-tool), which is that answer given in advance. Every
// other category is still asked, or pre-answered, as before.
ApproveDependency bool
// VerifyProvenance verifies a release artefact's SLSA build provenance by
// its sha256, for the release tag the cache attestation names (the
// provenance must name the commit that tag resolves to), returning the
// verified signer identity. Promoting the
// plugin's cached release binary to the PATH copy runs it before anything
// is written, and any failure refuses (iss-2610120617515834): the cache
// was checked against checksums.txt from the same release page as the
// binary, which whoever can change that page can change too. The front
// door supplies abcd update's own in-process check
// (update.ReleaseProvenance), one primitive for both verbs; this package
// cannot import it, because update imports ahoy. Nil refuses every
// promotion: there is no unverified path.
VerifyProvenance ProvenanceCheck
// DownloadAbcd fetches and verifies a release binary for the download
// question setup asks where abcd is not on the PATH (abcd_download.go):
// the front door supplies abcd update's checked fetch, since update
// imports this package. Nil offers no download.
DownloadAbcd DownloadRelease
// OnlyWaiting is the setup the yes to the after-update offer runs
// (spc-2610170635097509, step 7): only the questions and changed
// defaults Waiting returns for this repository are put to the prompter,
// and every other question is left unanswered, as deciding later leaves
// it. The yes approved the run, so every kind of change is approved up
// front and no approval is put. With Yes no question is answered at all,
// waiting or not: --yes is never a person's answer to a value question.
// --only-waiting.
OnlyWaiting bool
}
InstallOptions encodes the non-interactive prompt-protocol flags.
type InstallResult ¶
type InstallResult struct {
Status string `json:"status"` // already_up_to_date | clean | partial | aborted | refused
// Warnings names what keeps abcd's rules from reaching an agent tool in
// this project and only the person can end: a tool's own conventions file
// holding the person's words, which that tool reads in place of AGENTS.md
// and abcd never edits or removes, then what hides AGENTS.md from outside
// the project's own files: a personal file at the root, a file in a folder
// above it, an old host (host_reach.go) (itd-2610030814013772). Each is one
// line; a front door prints them first, before the headline.
Warnings []string `json:"warnings"`
Writes []string `json:"writes"`
Changes []string `json:"changes,omitempty"` // value overwrites an explicit override forced ("visibility: private -> public")
Remaining []string `json:"remaining"` // required+resolvable gap ids left
DeclinedCategories []string `json:"declined_categories"` // sorted category wire values
// Notes carries an apply step's loud refusal — a thing abcd deliberately did
// not do, and why. A refusal that only shows up as a still-open gap reads as a
// silent failure, so the reason travels with the result.
Notes []string `json:"notes,omitempty"`
// OptionalSkipped names the optional gaps a --yes run deliberately did not
// apply: the person's own identity record (and moving a pin the
// repository still stores), the status-line offer and the two model-tier
// routing offers (which accept a table only on an answer). --yes approves
// every resolvable CATEGORY, but it never records who a person commits as,
// because that captures whatever git identity happens to be configured and
// an unattended run would record a sandbox or agent identity; and it never
// wires the status line, because that rewrites a harness-wide user setting
// and takes element choices only a prompt can carry. The exclusion is
// reported rather than assumed: a run that says "already up to date" while
// leaving optional work on the table has to say so (iss-166).
OptionalSkipped []string `json:"optional_skipped,omitempty"`
// Headline says in one plain sentence what the run amounted to, and Summary
// explains every reported item (each write, each declined kind of change,
// the required work still outstanding, the optional steps left undone) as
// what it is, why it matters and what, if anything, to do. They are for
// the person who ran the install; the fields above stay the exact record
// (iss-164).
Headline string `json:"headline"`
Summary []SummaryItem `json:"summary"`
// Report is the three-part report setup ends on (setup_report.go): done,
// needs you and next, or one line for a repository already set up.
Report SetupReport `json:"report"`
// contains filtered or unexported fields
}
InstallResult is the outcome of Install.
func Install ¶
func Install(cwd string, opts InstallOptions, p Prompter) (InstallResult, error)
Install runs detect + apply over the approved categories. It is idempotent: a re-run with zero required+resolvable gaps writes nothing and reports "already_up_to_date".
func (InstallResult) ReadmeAwaitsConfig ¶ added in v0.14.0
func (r InstallResult) ReadmeAwaitsConfig() bool
ReadmeAwaitsConfig reports whether the run left the README question unanswered with no .abcd/config.json to keep the answer in: until abcd's starter files exist, the question is not asked and --readme-parts is refused, so the way to answer it starts with creating them.
func (InstallResult) SessionsAwaitsConfig ¶ added in v0.16.0
func (r InstallResult) SessionsAwaitsConfig() bool
SessionsAwaitsConfig is ReadmeAwaitsConfig for the live brief session question, whose answer is kept in the same file and whose --live-sessions is refused there too.
type MarkerReceipt ¶
type MarkerReceipt struct {
Removed []string `json:"removed"` // relative filenames a block was stripped from
Skipped []string `json:"skipped"` // relative filenames left untouched
}
MarkerReceipt records the per-target outcome of the uninstall marker removal.
type PlanChoice ¶ added in v0.16.0
type PlanChoice string
PlanChoice is the answer to the plan screen.
const ( PlanProceed PlanChoice = "proceed" PlanCustomise PlanChoice = "customise" PlanCancel PlanChoice = "cancel" )
The plan screen's answers.
func PlanChoiceOf ¶ added in v0.16.0
func PlanChoiceOf(value string) (PlanChoice, bool)
PlanChoiceOf is the plan answer a recorded value stands for: deciding later cancels, and anything the plan does not offer is no answer.
type PlanDefault ¶ added in v0.16.0
type PlanDefault struct {
Key string `json:"key"`
What string `json:"what"`
Value string `json:"value"`
ChangeWith string `json:"change_with"`
}
PlanDefault is one default the plan takes: what it decides, the value, and where to change it.
type PlanPrompter ¶ added in v0.16.0
type PlanPrompter interface {
Prompter
Plan(p SetupPlan) (choice PlanChoice, asked bool)
}
PlanPrompter is a prompter that puts the plan screen. asked is false where it does not (a piped answer stream, whose answers line up with the approvals one by one), and the run then asks as it did before the plan.
type PromptHelp ¶ added in v0.11.1
type PromptHelp struct {
Key string `json:"key"`
About string `json:"about"`
Choices []ChoiceHelp `json:"choices"`
// Flag is the install flag that answers this question without asking it,
// or "" for a question no flag answers. A piped run cannot rely on its
// answers lining up with the questions, so the flag is the reliable route
// there, and the question and the gap both name it (iss-2609120447486547).
Flag string `json:"flag,omitempty"`
// ChangeLater says where the answer is changed later, for a question no
// flag answers (a flag's hint takes that place where one exists). It is
// the question's change-later line, so the material need not repeat it
// (iss-2610031236155833).
ChangeLater string `json:"change_later,omitempty"`
// Now is what holds now, for a question whose current setting differs
// from run to run, such as a README part (spc-2610031704338417); "" leaves
// the question's own ("not set").
Now string `json:"now,omitempty"`
// Example is the exact lines answering yes writes in this repository, or
// as many of the first of them as a question can quote within the limits
// (its rows and the style rules), ExampleLeft how many more it
// writes, and ExampleNone, where it writes none, the reason. All are per
// run, read from the project, and terminal-safe as set.
Example []string `json:"example,omitempty"`
ExampleLeft int `json:"example_left,omitempty"`
ExampleNone string `json:"example_none,omitempty"`
}
PromptHelp is the canonical explanation of one value question the install asks through Prompter.Prompt: what is being decided, and what each answer means. It lives in core so every front door renders the same words and none has to invent them (iss-163) — a front door that describes an answer on its own can describe it wrongly, or circularly ("native — uses the native backend").
The prompt itself stays key, choices and default, so a scripted answer stream lines up with the questions as before; the help is looked up by the same key and rendered beside it.
func HelpIn ¶ added in v0.13.0
func HelpIn(cwd, key string) (PromptHelp, bool)
HelpIn returns the help for the value question keyed key as the install asks it in the repository at cwd. It is helpFor, except where a fact holds only in some repositories: public visibility's caveat is shown only where .abcd/ holds tracked files, the same evidence the install narrows the public block on. The words stay core's; a front door passes the repository and renders what comes back (iss-2610031236155833). An empty cwd gives the help that is the same in every repository (helpFor).
func (PromptHelp) ChangeLaterLine ¶ added in v0.13.0
func (h PromptHelp) ChangeLaterLine() string
ChangeLaterLine is the question's change-later line: the flag hint where a flag answers the question, else ChangeLater, else "".
func (PromptHelp) ExampleIntro ¶ added in v0.14.0
func (h PromptHelp) ExampleIntro() string
ExampleIntro is the sentence a question says before its example, or in place of it: that it writes the lines that follow, how many it writes where only the first are shown or none fit, or that it writes nothing and why. "" for a help with no example. Every door says these words, so none composes its own.
func (PromptHelp) FlagHint ¶ added in v0.12.0
func (h PromptHelp) FlagHint() string
FlagHint is the sentence naming the flag that answers this question without asking it, or "" when no flag does.
func (PromptHelp) Meaning ¶ added in v0.11.1
func (h PromptHelp) Meaning(value string) string
Meaning returns what answering value means, or "" for a value the question does not offer.
type Prompter ¶
type Prompter interface {
// Confirm asks a yes/no question and returns the answer.
Confirm(question string) bool
// Prompt asks the user to pick one of choices, defaulting to def.
Prompt(key string, choices []string, def string) string
}
Prompter is the interactive seam. The CLI supplies interactive impls; non-interactive modes supply refusing impls that auto-decline rather than block on stdin.
type ProvenanceCheck ¶ added in v0.14.1
ProvenanceCheck verifies a release artefact's build provenance by its sha256 digest, as the build of release tag, and returns the verified signer identity.
type PublicFamilyState ¶
type PublicFamilyState string
PublicFamilyState classifies the public layer's config for detection.
const ( PublicFamilyPresent PublicFamilyState = "present" // PublicFamilyAbsent is no docs-lint config at all — scaffolding writes one. PublicFamilyAbsent PublicFamilyState = "absent" // PublicFamilyUnusable is a config that parses to no usable banned_tokens array. // abcd must not rewrite it: the config gates CI and a contributor owns it. PublicFamilyUnusable PublicFamilyState = "unusable" // PublicFamilyUnreadable is an I/O fault — an oversize file, a symlink, a // permission error. It is reported apart from "unusable" because "add a // banned_tokens array" is not the fix for a file nobody can open. PublicFamilyUnreadable PublicFamilyState = "unreadable" // PublicFamilyIgnored is the contradiction: a readable family in a file git // ignores. The layer's whole claim is that it is committed and CI-enforced, and // an ignored config is enforced by nobody — most sharply under // `visibility: public`, where the abcd fence ignores the whole `.abcd/` namespace // and public exposure is the risk the layer exists for. PublicFamilyIgnored PublicFamilyState = "ignored" )
type ReadmePartLeft ¶ added in v0.14.0
type ReadmePartLeft struct {
Part string `json:"part"`
Reason string `json:"reason"`
Line int `json:"line"`
}
ReadmePartLeft is one part uninstall left in README.md.
type ReadmePartView ¶ added in v0.14.0
type ReadmePartView struct {
Name string `json:"name"`
Offered bool `json:"offered"`
Now string `json:"now"`
Default string `json:"default"`
// Example is the exact lines the part would write in this project;
// Reason, where it would write none, why.
Example []string `json:"example,omitempty"`
Reason string `json:"reason,omitempty"`
// contains filtered or unexported fields
}
ReadmePartView is one part as the view carries it. Every string is terminal-safe: an example line and a reason are read from the project.
type ReadmeReceipt ¶ added in v0.14.0
type ReadmeReceipt struct {
Removed []string `json:"removed"` // parts taken out, their text matching its hash
Left []ReadmePartLeft `json:"left"` // parts left, each with its reason and line
Deleted bool `json:"deleted"` // a README.md abcd created, emptied and deleted
Note string `json:"note"` // the receipt in words, terminal-safe
}
ReadmeReceipt records what uninstall did with README.md's parts.
type ReadmeView ¶ added in v0.14.0
type ReadmeView struct {
// Public is the owner's declaration in abcd's settings (repo.visibility);
// Declaration, where it is not public, is the one line saying the badges
// go by it, said above Q2's first tab.
Public bool `json:"public"`
Declaration string `json:"declaration,omitempty"`
Parts []ReadmePartView `json:"parts"`
// Asks are Q1 alone, then the offered parts in calls of at most four
// tabs, each as the shared question type.
Asks []question.Ask `json:"asks"`
// contains filtered or unexported fields
}
ReadmeView is the README question as detection carries it while the pair is unanswered, for a front door that relays it: each part, and the questions themselves, built from the same help the terminal asks with.
type RefusingPrompter ¶
type RefusingPrompter struct{}
RefusingPrompter auto-declines every confirm and returns the default for every prompt. It is the safe default for non-interactive callers.
func (RefusingPrompter) Confirm ¶
func (RefusingPrompter) Confirm(string) bool
Confirm always declines.
type RemoteMergeHygiene ¶ added in v0.6.8
type RemoteMergeHygiene struct {
DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"`
AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"`
AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"`
AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"`
ForkPRContributorApproval string `json:"fork_pr_contributor_approval,omitempty"`
}
RemoteMergeHygiene is the repo-object settings that gate MERGE behaviour. abcd mirrors them. Of them it sets only delete_branch_on_merge, as part of the settings baseline and on a yes (itd-2610290746077716); the merge methods encode a maintainer's workflow, not a security posture, and a verb that drove them would be changing how the project merges on the strength of a default nobody chose.
They are here because they had no source of truth in the tree at all (iss-2608270512210664): the branch-ruleset mirror beside this one covers RULESETS, and these live behind the separate repository-object API — so every claim a contribution document made about them rested on a web console. Each is a pointer, omitted when the response does not carry it, because "false" and "the API did not say" are different facts.
ForkPRContributorApproval is the repository's fork pull-request approval policy: which outside contributors' pull-request workflows wait for the technical facilitator's approval before they run (first_time_contributors_new_to_github, first_time_contributors or all_external_contributors). A required check is matched by its name, so which workflows run on a pull request decides what may report that name; it is recorded for the same reason as the rest, and omitted where the repository has no such policy (the API answers 404). A read that fails otherwise is said in a note, and an apply then keeps the policy the mirror already records, so a failed request never reads as a changed policy.
type RemoteResult ¶ added in v0.6.8
type RemoteResult struct {
// Repo is the owner/name the verb resolved from this repo's origin remote, and
// the ONLY repository it acts on. It is reported so a caller can see which
// repository a write reached before believing the rest of the result.
Repo string `json:"repo"`
// Status is one of: already_up_to_date | clean | pending | aborted | refused.
// A repo that opted out of native scanning has its two toggles reported as
// kept (itd-2610290746077716) and the rest of its baseline audited. "aborted" is a confirmation the caller declined; "refused" is a gate
// abcd itself closed. They are reported apart because only one of them is a
// decision the caller can revisit by answering differently.
Status string `json:"status"`
// Observed is the state GitHub reported before anything was changed.
Observed RemoteSecurity `json:"observed"`
// Merge is the merge-hygiene snapshot read in the same request: mirrored, never
// driven.
Merge RemoteMergeHygiene `json:"merge_hygiene"`
// Desired is the state abcd holds this repo to.
Desired RemoteSecurity `json:"desired"`
// Changes are the toggles an apply changed — or, from the read, would change.
Changes []string `json:"changes,omitempty"`
// Writes are the tree paths this run wrote.
Writes []string `json:"writes,omitempty"`
// Notes carry what abcd deliberately did not do, and why. A refusal that shows
// up only as an unchanged toggle reads as a silent failure, so the reason
// travels with the result.
Notes []string `json:"notes,omitempty"`
// Audit is the whole settings baseline as the read found it
// (itd-2610290746077716); nil when a gate refused before anything was read.
Audit *SettingsAudit `json:"audit,omitempty"`
}
RemoteResult is the outcome of a remote config read or apply.
func RemoteApply ¶ added in v0.6.8
RemoteApply enables GitHub-native secret scanning and secret-scanning push protection on the managed repo this checkout points at, and mirrors the desired state into the tree so a later verify reads the same intent (itd-153).
It answers to adr-44 and invariant 10: a remote write happens only through a dedicated verb the user invokes AND CONFIRMS. Four gates stand before any change leaves the machine — the folder must be a repo abcd manages, the repository must be the one this checkout's own origin names, the config must not carry the opt-out, and the caller must say yes to the specific toggles named — and every one of them refuses or aborts rather than guesses. A nil prompter is the RefusingPrompter, so a caller that forgot the seam gets no write by omission.
The READ comes first and needs no ceremony (adr-44 rule 1: reading remote state is the default), which is also what lets the confirmation name exactly what would change. Then secret scanning, then push protection: GitHub refuses push protection on a repo whose secret scanning is off.
func RemoteRead ¶ added in v0.6.8
func RemoteRead(cwd string) (RemoteResult, error)
RemoteRead reports the managed repo's GitHub-native secret-scanning state and what an apply would change. It writes NOTHING — not to the remote, not to the tree — so the bare invocation of the verb it backs holds abcd's convention that looking is never acting.
type RemoteSecurity ¶ added in v0.6.8
type RemoteSecurity struct {
SecretScanning string `json:"secret_scanning"`
PushProtection string `json:"secret_scanning_push_protection"`
}
RemoteSecurity is the pair of GitHub-native secret-scanning toggles, as observed or as desired. A toggle GitHub did not report reads "unknown", never "disabled": the two demand opposite responses, and reporting an unread state as off would send an operator to enable something that may already be on.
type RepoIdentity ¶
type RepoIdentity struct {
Name string `json:"name"`
Github string `json:"github"`
RootSHA string `json:"root_sha"`
// contains filtered or unexported fields
}
RepoIdentity is the deterministic identity of the repo under cwd.
func (RepoIdentity) RootErr ¶ added in v0.16.0
func (id RepoIdentity) RootErr() error
RootErr reports why the root commit is unknown when git did not answer for the repository, and nil when RootSHA is git's answer — an empty RootSHA with a nil RootErr is a directory outside any repository, or one with no commits. A caller that would key, create or refuse anything on an empty RootSHA asks this first, so a failed git call is never read as "no repository" (iss-2610051434156079).
type ReportStep ¶ added in v0.16.0
ReportStep is one item of the needs-you checklist: the exact step and why.
type SessionsView ¶ added in v0.16.0
SessionsView is the live-session questions as detection carries them while they are open, for a front door that relays them: Q1 alone, then Q2 alone, each as the shared question type.
type SettingsAudit ¶ added in v0.16.0
type SettingsAudit struct {
// Visibility is what GitHub reports; DeclaredVisibility is repo.visibility
// in .abcd/config.json. Either is empty when it could not be read.
Visibility string `json:"visibility,omitempty"`
DeclaredVisibility string `json:"declared_visibility,omitempty"`
// Plan is the owner's GitHub plan, empty when the sign-in cannot see it.
Plan string `json:"plan,omitempty"`
DefaultBranch string `json:"default_branch,omitempty"`
// RequiredChecks is the check names the baseline requires on the default
// branch: github.required_checks when set, else those every pull request's
// workflows report.
RequiredChecks []string `json:"required_checks,omitempty"`
// RequiredCheckApps is the app each required check is pinned to: the one
// app whose check runs reported it on the recent commits. A check missing
// from it stays required from any source, and a note says why.
RequiredCheckApps map[string]CheckApp `json:"required_check_apps,omitempty"`
Findings []Finding `json:"findings"`
// Notes say what the audit left out of its reading, and why.
Notes []string `json:"notes,omitempty"`
}
SettingsAudit is the whole audit of one repository.
func (*SettingsAudit) Differences ¶ added in v0.16.0
func (a *SettingsAudit) Differences() []string
Differences returns the findings the apply can act on, as "setting: current -> target" lines.
type SetupPlan ¶ added in v0.16.0
type SetupPlan struct {
Changes []PlanGroup `json:"changes"`
Defaults []PlanDefault `json:"defaults"`
AsksYou []string `json:"asks_you"`
}
SetupPlan is what setup would do in one repository, as the plan screen lists it: the changes grouped by where they land, the defaults taken, and the questions that follow whatever the answer.
type SetupReport ¶ added in v0.16.0
type SetupReport struct {
Done []string `json:"done"`
NeedsYou []ReportStep `json:"needs_you"`
Next string `json:"next"`
// OneLine is the whole report of a repository already fully set up, and
// "" otherwise: a front door prints it alone.
OneLine string `json:"one_line,omitempty"`
}
SetupReport is the three parts of the report.
type ShellPathReceipt ¶ added in v0.16.0
ShellPathReceipt is what uninstall did with the PATH line abcd added to the person's shell settings.
type StatusLineReceipt ¶ added in v0.9.0
StatusLineReceipt records the outcome of the uninstall status-line restore: whether the harness's status line was handed back to the command recorded before abcd took the row, and — restored or not — why. The note is rendered for a human and carries no home path.
type SummaryItem ¶ added in v0.11.1
type SummaryItem struct {
What string `json:"what"`
Why string `json:"why"`
Action string `json:"action"`
Refs []string `json:"refs,omitempty"`
}
SummaryItem explains one thing an install reports, for the person who ran it rather than for abcd's implementers (iss-164): what it is, why it matters for their work, and what, if anything, they should do. Refs names the exact entries of the result it explains (write paths, category names, step ids), so the plain words and the precise record can always be matched up.
type SymlinkReceipt ¶
type SymlinkReceipt struct {
Target string `json:"target"`
Removed bool `json:"removed"`
Note string `json:"note"`
}
SymlinkReceipt records the outcome of the uninstall symlink removal.
type TerminalPrompter ¶ added in v0.11.1
TerminalPrompter is a Prompter that can say whether a person is answering at a terminal. A prompter that does not implement it is treated as having no one at a terminal, which is the fail-closed reading.
type UninstallReceipt ¶
type UninstallReceipt struct {
Marker MarkerReceipt `json:"marker"`
Readme ReadmeReceipt `json:"readme"`
Symlink SymlinkReceipt `json:"symlink"`
StatusLine StatusLineReceipt `json:"status_line"`
ShellPath ShellPathReceipt `json:"shell_path"`
// Tools is what became of each tool copy abcd installed and recorded in
// ~/.abcd.noindex/tools.json: removed while still the bytes abcd wrote,
// left untouched otherwise (itd-2610240918594138, criterion 4).
Tools []tools.Removal `json:"tools"`
// ToolsNote is set when the record could not be read or rewritten.
ToolsNote string `json:"tools_note,omitempty"`
}
UninstallReceipt is the outcome of Uninstall.
func Uninstall ¶
func Uninstall(cwd, binDir string) (UninstallReceipt, error)
Uninstall removes the marker block, abcd's README parts, abcd's status line (handed back to the command it replaced) and the owned PATH entry (the spc-35 owned copy plus its provenance record, or a legacy pinned symlink) only. It never mutates hooks.json, and leaves the download cache to the harness's own uninstall. Its one write in the .abcd/ namespace is clearing readme.created from .abcd/config.json once the README.md that record vouches for is gone (uninstallReadme); nothing else there is touched.
binDir names the directory to look in, for the one case detection cannot derive: an install placed by `--bin-dir` in a directory that is not on PATH is invisible to a PATH scan, so uninstall would otherwise orphan it. Empty means the derived location — an abcd-owned entry anywhere on PATH, else the default.
type UpdateTarget ¶
type UpdateTarget struct {
Path string // first `abcd` on PATH ("" when absent)
ResolvedPath string // Path with symlinked ancestors/leaf resolved
Kind UpdateTargetKind //
LaterOwned string // an abcd-owned entry shadowed behind Path ("" when none)
}
UpdateTarget names the first `abcd` PATH occupant — the binary that actually answers when the user types `abcd` — classified by the same ownership predicate detection and install use (one canonical predicate, iss-345).
func ResolveUpdateTarget ¶
func ResolveUpdateTarget() UpdateTarget
ResolveUpdateTarget classifies the entry `abcd update` would act on. It walks PATH in order — the dispatch is keyed on what actually runs, not on one blessed location — and, when PATH holds nothing, reports the plugin root as the target when the running executable lives there (the plugin-invocation case still deserves the plugin-root refusal, not a "nothing installed" one).
type UpdateTargetKind ¶
type UpdateTargetKind string
UpdateTargetKind classifies the PATH entry `abcd update` would act on. The update verb's dispatch (spc-32) keys on this: only a regular file whose provenance the verb can establish is ever swapped; every other shape is a named refusal, because another mechanism already owns it.
const ( // UpdateTargetAbsent: no `abcd` anywhere on PATH. UpdateTargetAbsent UpdateTargetKind = "absent" // UpdateTargetPluginRoot: an owned symlink resolving into the current // plugin root — the plugin update owns that binary (itd-108 one-cut // coherence), never the update verb. UpdateTargetPluginRoot UpdateTargetKind = "plugin-root" // UpdateTargetDevShim: the track-latest dev shim — a chosen install mode. UpdateTargetDevShim UpdateTargetKind = "dev-shim" // UpdateTargetDangling: an abcd-owned entry whose binary is gone (the // iss-345 stranded shape included) — `ahoy install` is the heal. UpdateTargetDangling UpdateTargetKind = "owned-dangling" // UpdateTargetSuperseded: an owned symlink into a sibling plugin-cache // vintage the harness has moved past — the binary still exists, so it is // not stranded, but it answers an older release than the plugin now holds // (iss-2609161805447092). `ahoy install` is the heal. UpdateTargetSuperseded UpdateTargetKind = "owned-superseded" // UpdateTargetFile: a regular file. Ownership is decided by the update // verb's provenance check (digest against a published release), not here. UpdateTargetFile UpdateTargetKind = "file" // UpdateTargetForeign: a symlink abcd does not own, or an entry that // cannot be classified. Never touched. UpdateTargetForeign UpdateTargetKind = "foreign" )
type VintageStatus ¶
type VintageStatus struct {
Mode string // install mode ("dev (tip build)" / "pinned" / "" / shadowed)
Report vintage.Report // outcome + current + expected
Source string // reference name: "checkout tip" / "plugin manifest pin"; "" when the current vintage is undeterminable
RepoRoot string // the source checkout root, when the tip was the reference
}
VintageStatus is the assembled vintage picture for a repo: the install mode, the comparator's report, and the human name of the reference compared against. It is the single source the `version` and `ahoy` renders, the session-start notice, and the install refusal all consume — one comparison, many renders.
func Vintage ¶
func Vintage(cwd string) VintageStatus
Vintage assembles the running binary's vintage picture for cwd. It resolves the install mode and the plugin root, reads the binary's own build vintage, and picks the applicable disk reference: the source checkout tip when cwd is abcd's own checkout (the dogfood case), otherwise the plugin-cache manifest pin. It never touches the network.
func (VintageStatus) DisplayVintage ¶
func (v VintageStatus) DisplayVintage() string
DisplayVintage renders the vintage for a one-line surface: a short revision for a checkout-tip comparison, the version verbatim for a pinned one, and "unknown" when it could not be determined.
func (VintageStatus) Staleness ¶
func (v VintageStatus) Staleness() string
Staleness renders the comparator verdict in the words a surface prints.
Every verdict names the reference it was reached against, because the comparison is disk-only by design (itd-111): a bare "up to date" read as "current" to a user several releases behind, whose binary merely matched its own install's pin (iss-2610040758303107). A fresh pinned install also names `abcd update --check`, the one verb that asks for the newest release. The checkout-tip line does not: a source build is unversioned, and the check answers it only with "nothing to compare".
type WaitingItem ¶ added in v0.16.0
type WaitingItem struct {
Kind string `json:"kind"`
Key string `json:"key"`
Title string `json:"title"`
Record string `json:"record,omitempty"`
Release string `json:"release,omitempty"`
}
WaitingItem is one thing that waits: its setup key (the id its answer is recorded under), a title in core's own words, and, for a changed default, the record that changed it and the release that shipped the record.
type WaitingSet ¶ added in v0.16.0
type WaitingSet struct {
Questions []WaitingItem `json:"questions"`
Defaults []WaitingItem `json:"defaults"`
}
WaitingSet is everything that waits, the questions in the order setup asks them, then the changed defaults, newest release first.
func Waiting ¶ added in v0.16.0
func Waiting(cwd string, det DetectionResult, from, to string) (WaitingSet, error)
Waiting returns what waits on the repository at cwd, whose detection is det, for an update from the release from to the release to: the questions det's gaps arm that this repository has no recorded answer to (a question answered with a value, or deferred with "decide later", is recorded), and the settings whose default a release after from up to to changed, which the repository's .abcd/config.json leaves unset and no waiting question already covers. A to of "" (a running build that is not a release) counts no changed default.
A category approval and the adoption are not waiting questions: they are consent to the changes the questions and gaps make, asked whenever there is a change to make, not a setting the repository answers once.
Source Files
¶
- abcd_download.go
- ahoy.go
- apply.go
- artefact.go
- attribution_hook.go
- banlist_scaffold.go
- cache_attestation.go
- category_approval.go
- citations.go
- commit_checks.go
- conventions.go
- data_dir.go
- default_changes.go
- detect.go
- docslint_roots.go
- docslint_seed.go
- drain_rule.go
- embark_marker.go
- filter_roots.go
- foreign_entry.go
- fsutil.go
- gitignore.go
- gorun_vintage.go
- guard_health.go
- harness_notice.go
- harness_strays.go
- host_reach.go
- host_version.go
- identity_establish.go
- install_summary.go
- managed.go
- marker.go
- only_waiting.go
- oracle_routing.go
- outbound_binary.go
- outbound_forge.go
- outbound_hook.go
- outbound_shim.go
- owned_copy.go
- person_only.go
- prompt_help.go
- provider_adapter.go
- readme_apply.go
- readme_ask.go
- readme_check.go
- readme_derive.go
- readme_marker.go
- receipt.go
- record_tiers.go
- refused_answer.go
- release_mark.go
- remote.go
- remote_baseline.go
- remote_baseline_apply.go
- remote_userinfo.go
- remote_workflows.go
- retired_docs_target.go
- rewritelock.go
- sessions_ask.go
- setup_basics.go
- setup_brief.go
- setup_plan.go
- setup_question.go
- setup_report.go
- shell_path.go
- statusline_apply.go
- statusline_detect.go
- statusline_guard.go
- statusline_trust.go
- store.go
- store_worktrees.go
- unseen_update.go
- update_target.go
- vintage.go
- waiting.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package worktree is the machine-scoped worktree store (itd-2609091014076309, spc-2609301811532881): a session's or an agent's worktree lives at ~/.abcd.noindex/worktrees/<root-sha>/<name>/, keyed on the repository's root commit in the full form the history and transcript stores use, and never beside the user's own projects (adr-2609091248200336, whose location adr-2610031751065746 spells under the renamed home).
|
Package worktree is the machine-scoped worktree store (itd-2609091014076309, spc-2609301811532881): a session's or an agent's worktree lives at ~/.abcd.noindex/worktrees/<root-sha>/<name>/, keyed on the repository's root commit in the full form the history and transcript stores use, and never beside the user's own projects (adr-2609091248200336, whose location adr-2610031751065746 spells under the renamed home). |