feature:add

Add a local (non-versioned) editable feature from the workspace root to the active product.


Usage

splent feature:add <namespace>/<feature_name> [--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

Add a feature to all environments:

splent feature:add splent-io/splent_feature_auth

Explicitly add to dev only:

splent feature:add splent-io/splent_feature_admin --dev

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

$ splent feature:add splent-io/splent_feature_admin
  scope    contract declares env=dev → features_dev
  admin added to features_dev (dev only)
  done.

Description

This command:

  1. Validates the <namespace>/<feature_name> format.
  2. Checks that the feature exists at the workspace root (/workspace/<feature_name>/).
  3. Auto-detects the environment scope from [tool.splent.contract].env in the feature’s pyproject.toml (unless --dev or --prod is explicitly passed).
  4. Adds the feature to the appropriate list (features, features_dev, or features_prod) in the product’s pyproject.toml.
  5. Creates a symlink at <product>/features/<namespace>/<feature_name> pointing to the workspace root.
  6. Records the feature in splent.manifest.json with state declared and mode editable.
  7. 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.


Requirements

  • A product must be selected (splent product:select).
  • The feature must already exist at the workspace root. Use splent feature:create first if needed.
  • SPLENT_APP must be set.

Result

<product>/features/<namespace>/<feature_name> → ../../../<feature_name>  (workspace root)

State in splent.manifest.json: declared, mode: editable


See also


Back to top

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