Documentation
¶
Overview ¶
Package project owns the private, versioned machine protocol between the portable Ridu CLI and an application's compiled project entry.
Index ¶
Constants ¶
const ( // ProtocolVersion changes when the CLI/project framing or request contract is incompatible. ProtocolVersion = 1 // Command is the private application argument that enters machine mode. Command = "__ridu" // MigrationDatabaseURLEnvironment carries a selected network database into // the short-lived compiled project process without exposing credentials in // command-line arguments. Project.Run removes it before resolving config or // invoking application callbacks. MigrationDatabaseURLEnvironment = "RIDU_INTERNAL_PROJECT_MIGRATION_DATABASE_URL" // ResponsePrefix makes the frame recoverable even if application initialization writes stdout. ResponsePrefix = "RIDU_PROJECT_RESPONSE " // MaxGeneratedArtifacts and MaxGeneratedArtifactBytes bound decoded plugin // output at both sides of the project protocol. MaxGeneratedArtifacts = 128 MaxGeneratedArtifactBytes = 64 << 20 // MaxResponseBytes bounds the complete framed JSON line, including base64 // expansion and the canonical manifest. MaxResponseBytes = 128 << 20 )
Variables ¶
This section is empty.
Functions ¶
func EncodeResponse ¶
EncodeResponse returns one newline-terminated framed response.
func Run ¶
func Run(args []string, stdout, stderr io.Writer, frameworkVersion string, resolveManifest ManifestResolver, resolveGeneration GenerationResolver, migrationDriver migration.ProjectDriver) error
Run handles application-side project commands. Migration execution is available only when the application explicitly registers a compiled driver; manifest and generation commands still never open a database.
Types ¶
type Artifact ¶
type Artifact struct {
Plugin string `json:"plugin"`
Name string `json:"name"`
Content []byte `json:"content"`
}
Artifact is one deterministic generated file returned by a compiled plugin. The CLI maps the namespaced identity to an application-owned destination.
type ArtifactRequest ¶
ArtifactRequest identifies one configured plugin artifact the CLI needs.
type GenerationResolver ¶
type GenerationResolver func([]ArtifactRequest) (schema.Manifest, []Artifact, error)
GenerationResolver resolves the same canonical manifest plus deterministic artifacts that require executable plugin configuration.
type ManifestResolver ¶
ManifestResolver delays config resolution until a valid machine request has been checked, keeping ordinary command parsing free of config side effects.
type Response ¶
type Response struct {
ProtocolVersion int `json:"protocolVersion"`
FrameworkVersion string `json:"frameworkVersion"`
ManifestVersion uint32 `json:"manifestVersion"`
Manifest json.RawMessage `json:"manifest"`
Artifacts []Artifact `json:"artifacts,omitempty"`
DataTransforms []migration.DataTransformDescriptor `json:"dataTransforms,omitempty"`
}
Response is the successful manifest handshake returned by a project entry.
func DecodeResponse ¶
DecodeResponse finds and validates exactly one response frame in project stdout.