Documentation
¶
Overview ¶
Package share links a provider's *authored* assets — skills, sub-agents, slash commands, hooks, instructions, settings — from the CLI's own config directory into each account's isolated directory.
Why this exists: a profile launcher (`claude-work`) runs the CLI with its config dir pointed somewhere else, and every asset the CLI discovers lives under that dir. Without linking, an account launched by aiacc starts with no skills, no sub-agents and no slash commands — the same binary, a different and much emptier tool. Sharing makes every profile equal to the bare CLI.
A symlink, not a copy, so the assets stay in one place: edit a skill once and every profile has it. Only authoring surfaces are shared. Credentials, transcripts, and usage counters stay per-account — isolating those is the whole point of a profile.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackupName ¶ added in v0.21.0
BackupName returns dst suffixed with ".aiacc-bak", or ".aiacc-bak2", ".aiacc-bak3", ... — the first suffix nothing occupies. Renaming over an existing backup would destroy the only copy of an earlier original. Lstat, not Stat, so a backup that is itself a symlink still counts as taken.
The probe and the caller's rename are not atomic: a backup created in this window is replaced — accepted: single-user CLI, serial runs.
Types ¶
type Entry ¶
type Entry struct {
Name string
Status Status
Err error
// Backup is where Link moved the account's own copy before replacing it —
// the path the user undoes by hand. Empty when nothing was backed up.
Backup string
}
Entry is the outcome for one shared name.
type Result ¶
type Result struct {
Base string // source directory
Dir string // account directory
Entries []Entry
}
Result is the outcome of linking one account.
func Check ¶ added in v0.20.0
Check reports what Link would find, changing nothing on disk. A diagnosis must never repair as a side effect: `aiacc doctor` has to be safe to put in a shell startup file, and a command that silently fixed what it measured would hide the drift it exists to show.
func Link ¶
Link symlinks each of entries from baseDir into dir.
Poka-yoke: an entry the account already owns is never silently destroyed. With replace false it is left exactly as it is; with replace true it is renamed to "<name>.aiacc-bak" first — or ".aiacc-bak2", ".aiacc-bak3", ... when a backup of an earlier take-over is already there — so the take-over is always undoable by hand and no earlier backup is ever overwritten. Linking the base directory into itself is a no-op — the base profile already has the originals.
func Prune ¶ added in v0.20.0
Prune removes the dangling symlinks among entries.
Poka-yoke: only a symlink whose target no longer resolves is removed. A real file, a directory, and a live symlink are never touched — so the worst a mistaken prune can cost is a link `aiacc link` puts straight back.
type Status ¶
type Status string
Status is what happened to one shared entry.
const ( Linked Status = "linked" // a new symlink was created Already Status = "already" // the correct symlink was already there Absent Status = "not in base" // nothing to share — the source doesn't exist Taken Status = "own copy" // the account has its own file/dir; left alone Foreign Status = "linked away" // a symlink pointing somewhere else; left alone Failed Status = "failed" // the link could not be created // Dangling is a symlink in the account dir whose target no longer exists. // It is reported apart from Absent because the two look identical from the // base dir and are opposites in the account: Absent means there is nothing // to share, Dangling means the profile is holding a dead link and hands it // to the CLI as if it were real. Dangling Status = "dangling" // Missing is a shareable entry with no link yet — what Link would create. // Only Check reports it; Link creates the link instead. Missing Status = "not linked" // Pruned is a dangling link Prune removed. Pruned Status = "pruned" )