model

package
v1.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package model detects which plugin distribution model is in effect for a given plugin in the current project: Model A (Docker compose-managed, source under plugins-pro-src/) or Model B (single-binary, installed under ~/.nself/plugins/<name>/).

The detector is the foundation for any command that must apply a plugin operation correctly across both models — most importantly enable/disable, which must edit compose files for Model A but only flip the .disabled marker for Model B.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model int

Model identifies the distribution model of a plugin.

const (
	// ModelUnknown means the plugin was not found by any detection step.
	ModelUnknown Model = iota
	// ModelB means the plugin is installed as a single binary in ~/.nself/plugins/<name>/.
	ModelB
	// ModelA means the plugin is compose-managed (source dir present, OR running compose service).
	ModelA
	// ModelMixed means both Model A and Model B artifacts were detected.
	// This is unexpected and the caller should surface a warning.
	ModelMixed
)

func DetectModel

func DetectModel(pluginName string) (Model, error)

DetectModel returns the distribution model for the named plugin in the current working project, using the environment-driven defaults. The result is informational: ModelUnknown is returned with a nil error when no artifacts are found.

Detection order (first match wins, but a Mixed result is returned when both A and B are detected):

  1. ~/.nself/plugins/<name>/ exists → ModelB
  2. <project>/plugins-pro-src/paid/<name>/ exists → ModelA
  3. docker compose ps shows service plugin-<name> → ModelA

func (Model) String

func (m Model) String() string

String returns a human-readable name for the model.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL