feature:attach

Attach a released (versioned) feature to the active product.


Usage

splent feature:attach <namespace>/<feature_name> <version> [--dev | --prod]
Option Description
--dev Add to features_dev (development only).
--prod Add to features_prod (production only).

If neither --dev nor --prod is given, the command auto-detects the scope from the feature’s contract. When [tool.splent.contract].env is set in the feature’s pyproject.toml (e.g. env = "dev"), the feature is automatically added to the corresponding features_dev or features_prod list. If no contract env is declared, the feature is added to features (all environments).


Examples

Attach a feature to all environments:

splent feature:attach splent-io/splent_feature_auth v1.2.7

Explicitly attach to dev only:

splent feature:attach splent-io/splent_feature_admin v0.3.1 --dev

Auto-detection from contract (feature declares env = "dev"):

$ splent feature:attach splent-io/splent_feature_admin v0.3.1
  scope    contract declares env=dev → features_dev
  admin@v0.3.1 attached (dev only)
  done.

Description

This command:

  1. Verifies that the feature version exists in the local cache.
  2. Auto-detects the environment scope from [tool.splent.contract].env in the feature’s pyproject.toml (unless --dev or --prod is explicitly passed).
  3. Adds <feature_name>@<version> to the appropriate list (features, features_dev, or features_prod) in the product’s pyproject.toml. If a previous version or bare entry exists, it is replaced.
  4. Creates a versioned symlink at <product>/features/<namespace>/<feature_name>@<version>.
  5. Records the feature in splent.manifest.json with state declared.
  6. Reinstalls the feature via pip install -e in the web container and triggers Flask reload.

The running application picks up the new feature automatically — no restart or product:derive needed.

If the feature is not in the cache yet, clone it first with splent feature:clone.


Requirements

  • A product must be selected (splent product:select).
  • SPLENT_APP must be set.
  • The feature must be published on GitHub at the specified tag.

Result

Cached snapshot:

<workspace>/.splent_cache/features/<namespace>/<feature_name>@<version>/

Symlink in product:

<product>/features/<namespace>/<feature_name>@<version>/  →  .splent_cache/features/...

State in splent.manifest.json: declared


See also


Back to top

splent. Distributed by an LGPL license v3. Contact us: drorganvidez@us.es