feature:clean

Detect and remove scaffold stubs from a feature.


Table of contents

  1. Usage
  2. Description
  3. Example
  4. How archetype detection works
  5. What gets removed
  6. When to use
  7. See also

Usage

splent feature:clean <feature_ref> [--apply]

Description

Analyzes a feature’s source files to detect which archetype it really is (full, light, config, or service), then identifies files that are:

  • Not needed by the detected archetype (e.g., models.py in a config feature)
  • Empty stubs with no real content (scaffold placeholders with only comments or pass)

By default this is a dry-run — it shows what would be removed without touching anything. Use --apply to actually delete the files.


Example

$ splent feature:clean splent_feature_redis

  feature:clean — splent_feature_redis
  ────────────────────────────────────────────────────────────
  Detected archetype: config
  Infrastructure feature (config.py only)

  Will remove (15 items):

       models.py  (not needed)
       routes.py  (not needed)
       services.py  (not needed)
       repositories.py  (not needed)
       hooks.py  (not needed)
       signals.py  (not needed)
       seeders.py  (not needed)
       forms.py  (not needed)
       commands.py  (not needed)
    📁 templates  (empty)
    📁 assets  (empty)
    📁 migrations  (no migrations)
    📁 tests/integration  (not needed)
    📁 tests/functional  (not needed)
    📁 tests/e2e  (not needed)

  Dry-run — run with --apply to remove these files.

Then to actually clean:

$ splent feature:clean splent_feature_redis --apply

  Proceed? [Y/n]: y

  ✅ Removed 15 item(s).
  Run splent feature:contract --write to update the contract.

How archetype detection works

The command reads actual file contents (not metadata) to determine the real archetype:

Check Result
models.py has db.Column full
routes.py has @bp.route(...) light
services.py has real methods service
None of the above config

What gets removed

File/Directory Removed when
models.py No db.Column definitions
routes.py No route decorators
services.py Only pass in methods
repositories.py Only pass in methods
hooks.py No register_template_hook calls
signals.py No define_signal or connect_signal
seeders.py Empty run() method
forms.py No form fields
commands.py No @click.command
config.py Empty inject_config()
templates/ Empty directory
assets/ Empty directory
migrations/ No migration versions
translations/ Empty directory
tests/integration/ Not needed by archetype
tests/functional/ Not needed by archetype
tests/e2e/ Not needed by archetype
tests/load/ Not needed by archetype

Files that are never removed: __init__.py, pyproject.toml, .gitignore, MANIFEST.in, tests/conftest.py, tests/unit/.


When to use

  • After scaffolding a full feature and realizing you don’t need most of it
  • When auditing features for unnecessary files
  • Before a release to reduce package size

See also


Back to top

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