spl:add-feature
Table of contents
- Introduction
- What it detects
- Editing a model that only exists in the cache
- How it edits the model
- Reference
- Requirements
- See also
Introduction
spl:add-feature adds a feature to your product line’s model, with the constraints its code implies, so you never edit the UVL by hand.
splent spl:add-feature my_spl splent_feature_reports
Detected dependencies:
reports => notes
Add 'reports' to my_spl? [Y/n]: y
✅ Feature 'reports' added to my_spl.
Model: splent_spl_my/my_spl.uvl
Constraints: reports => notes
The feature must be at the workspace root. Its name in the model is the package without splent_feature_.
What it detects
| Source | Example |
|---|---|
| Refinement | refines under [tool.splent.refinement] in its pyproject.toml |
| Python imports | from splent_io.splent_feature_notes import ... |
| Foreign keys | db.ForeignKey("notes.id"), matched to the feature owning notes |
| Templates | url_for('notes.index') in an .html file |
Only features already in the model count. Answer n at the prompt and nothing is written.
Editing a model that only exists in the cache
my_spl came from the cache (.splent_cache/spls/my_spl@v3/my_spl.uvl), which is never edited.
Created your working copy at splent_spl_my/ and changed it there. It now wins over the cache for every product that uses this line.
A later download would undo an edit in the cache, so the model and its metadata.toml are copied to a working copy first. Publish it with spl:publish.
How it edits the model
The feature joins the last optional group directly under the root, never a mandatory one, so it is never compulsory.
optional
cache {org 'splent-io', package 'splent_feature_cache'}
reports {org 'splent-io', package 'splent_feature_reports'}
mandatory
session_type
With no such group, a new one opens at the end of the features. A constraints section is created only when there is one to add.
The previous model is kept as my_spl.uvl.bak. If the new one does not parse, or lacks the feature, the backup is restored and the command exits 1.
Groups are found by the tab indentation
spl:createwrites. A model indented with spaces gets a newoptionalgroup.
Reference
Arguments and options
| Argument / Option | Default | Description |
|---|---|---|
<spl_name> |
The product line to change | |
<feature_package> |
The feature’s package, such as splent_feature_reports |
|
--org |
splent-io |
The organisation written in the declaration |
Results
| Message | Exit | What to do |
|---|---|---|
<feature> is already declared in <spl>. |
0 | Nothing |
'<name>' is not a valid UVL feature name. ... |
1 | Use letters, digits and underscores after splent_feature_, not starting with a digit |
Feature not found at workspace root: <path> |
1 | Clone or create it there |
Cancelled. |
0 | You answered no |
UVL did not validate after editing (...) |
1 | Add the feature by hand |
Requirements
- Detached mode, with no product selected. A leading
SPLENT_APP=runs one command detached and keeps your selection.
See also
spl:add-constraintsadds missing constraints between features already in the model.spl:remove-featureundoes this command.spl:depsshows what a feature requires.