Documentation
¶
Overview ¶
Package opencodeplugin plans placement of one global OpenCode local JS plugin. It has no filesystem or process effects. The caller owns observation and the compare-and-swap transaction that applies or removes the planned file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConflictReason ¶
type ConflictReason string
const ( ForeignFile ConflictReason = "foreign_file" ChangedFile ConflictReason = "changed_file" WrongKind ConflictReason = "wrong_kind" )
type Existing ¶
Existing is the caller's snapshot of the target. Nil means it was absent. Path must be the exact path returned by this planner, and SHA256 is required for a regular file.
type FileKind ¶
type FileKind string
FileKind describes the object at the target path, observed without following its final symlink. A regular file's SHA256 is the lowercase hex digest of its bytes. A symlink or other object is always a conflict.
type Input ¶
type Input struct {
HomeDir string
XDGConfigHome string
Override string
FileName string
DesiredSHA256 string
OwnedSHA256 string
Existing *Existing
}
Input supplies explicit environment values; Plan never reads process env. Override is the OpenCode config root itself. XDGConfigHome is its parent. OwnedSHA256 is the digest from the product's trusted ownership record; empty means no ownership claim. DesiredSHA256 is the proposed JS bundle's digest.
type Placement ¶
type Placement struct {
Root string
Target string
DesiredSHA256 string
Existing *Existing
Action Action
ConflictReason ConflictReason
}
Placement is a snapshot-based proposal, never authority to mutate the host. Existing is copied into the result so the caller can compare it again during its transaction. ConflictReason is nonempty only for Action == Conflict.