feature:create
Table of contents
- Introduction
- Choosing a type
- A feature that runs a server
- A feature with JavaScript of its own
- The git repository
- Naming
- The licence
- Reference
- Requirements
- See also
Introduction
feature:create scaffolds a new feature at the workspace root, with only the files its type needs, as a git repository whose first commit is the scaffold. It joins no product until you run feature:add.
splent feature:create splent-io/splent_feature_billing
✅ Feature 'splent-io/splent_feature_billing' created (full)
/workspace/splent_feature_billing
git a repository on main, the scaffold its first commit (3f9c2ab)
Choosing a type
splent feature:create splent-io/splent_feature_sidebar --type light
| Type | For | You get |
|---|---|---|
full (default) |
Domain features with CRUD, UI and tables | Models, repositories, services, routes, forms, hooks, signals, commands, config, seeders, templates, migrations, translations, every test level |
light |
UI without tables | Routes, hooks, a template, functional tests |
config |
Infrastructure, such as Redis | config.py with inject_config() |
service |
Backend services without UI | Services, config, signals, commands |
Every type also gets pyproject.toml, README.md, MANIFEST.in, .gitignore, the licence and unit tests. See Feature archetypes and Feature anatomy.
A feature that runs a server
splent feature:create splent-io/splent_feature_rabbitmq --type service --docker
--docker adds docker/ with docker-compose.dev.yml, docker-compose.prod.yml and .env.example. Every product that installs the feature gets its own instance of that stack. Replace every CHANGEME, then run check:infra (see Feature Docker services).
A feature with JavaScript of its own
splent feature:create splent-io/splent_feature_charts --frontend
--frontend writes frontend/package.json, frontend/.npmrc and assets/js/scripts.js, a frontend/ the SPLENT toolchain builds, with no webpack.config.js. Add packages with feature:npm and build with feature:compile.
splent feature:npm charts install chart.js@4.5.1
splent feature:compile charts
The legacy webpack mode
splent feature:create splent-io/splent_feature_charts --js
--js writes assets/js/scripts.js and a webpack.config.js of its own, built against the product’s node_modules. Prefer --frontend, and never pass both.
Without either flag there is no bundle, so no watcher and no build step. A plain stylesheet or a vendored library needs none, only
register_asset(see Assets per shell).
The git repository
A release commits, tags and pushes, so the feature needs a repository. The commit uses your configured identity (user.name and user.email, or GIT_AUTHOR_* and GIT_COMMITTER_*), never a guessed one. Add the forge repository as origin before your first release.
| Situation | Result |
|---|---|
| Git has an identity | The scaffold committed on main |
| No identity, or the commit fails | The scaffold staged. The output shows the commit to run |
| The workspace is inside a git repository | No repository of its own |
No git, or --no-git |
No repository |
Naming
Name a feature for what it does, never for a product. A name that ends in a product’s brand is refused. The brand is a workspace product’s name without app, splent, product, site or web, so acme for acme_app.
splent_feature_notes_acme is refused, splent_feature_acme is not. What one product wants goes in the product, and what several want goes in the base feature as a slot or a setting.
The licence
A new feature starts under LGPL-3.0-or-later, in COPYING.LESSER and COPYING. A product that uses it can carry any licence. For another licence, replace both files and the license and license-files keys before the first release.
Reference
Options
| Option | Description |
|---|---|
--type TYPE |
full (default), light, config or service |
--docker |
Also scaffold docker/, with any type |
--frontend |
Also scaffold frontend/ and assets/js/scripts.js |
--js |
Also scaffold assets/js/ with a webpack.config.js, the legacy mode |
--no-git |
Leave the feature without a git repository |
Errors
| Message | What to do |
|---|---|
Invalid format. Use: <namespace>/<feature_name> |
Add the namespace |
Invalid namespace '...' |
Letters, digits, - and _, starting with a letter or digit |
Invalid feature name '...' |
splent_feature_<name>, lowercase letters, digits and _, starting with a letter |
... is named after the product ... |
See Naming |
The feature '...' already exists at ... |
Pick another name, or remove the directory |
Each exits 1 before any file is written. --js with --frontend is a usage error.
Requirements
- No directory of that name at the workspace root. No product needs to be selected.
See also
feature:addlinks the new feature to the selected product.feature:cleanremoves the scaffold you did not use.feature:releasepublishes the feature.