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:
- Verifies that the feature version exists in the local cache.
- Auto-detects the environment scope from
[tool.splent.contract].envin the feature’spyproject.toml(unless--devor--prodis explicitly passed). - Adds
<feature_name>@<version>to the appropriate list (features,features_dev, orfeatures_prod) in the product’spyproject.toml. If a previous version or bare entry exists, it is replaced. - Creates a versioned symlink at
<product>/features/<namespace>/<feature_name>@<version>. - Records the feature in
splent.manifest.jsonwith statedeclared. - Reinstalls the feature via
pip install -ein 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_APPmust 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
feature:add— add a non-versioned (editable) feature insteadfeature:detach— undo this operationfeature:status— verify the feature stateproduct:resolve— install all declared features