feature:clean

Table of contents

  1. Introduction
  2. Removing the files
  3. How the archetype is detected
  4. What it removes and what it keeps
  5. Reference
  6. Requirements
  7. See also

Introduction

feature:clean removes the scaffold your feature does not use. It reads your code to find the feature’s real archetype, then lists what feature:create wrote and you never filled in. Run it after you scaffold, or before a release.

splent feature:clean splent_feature_cache
  feature:clean — splent_feature_cache
  ────────────────────────────────────────────────────────

  Detected archetype: config
  Infrastructure feature (config.py only)

  Will remove (8 items):

    📁 assets  (not needed)
       commands.py  (not needed)
       forms.py  (not needed)
       hooks.py  (not needed)
    📁 migrations  (no migrations)
    📁 templates  (not needed)
    📁 tests/functional  (not needed)
    📁 tests/integration  (not needed)

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

Nothing is deleted until you pass --apply.


Removing the files

splent feature:clean splent_feature_cache --apply

It lists the same files and asks first, defaulting to No.

  Proceed? [y/N]: y

  ✅ Removed 8 item(s).
  ✅ Contract updated.

The contract is written again after, as feature:contract --write does.


How the archetype is detected

Your code has Archetype
A db.Column in models.py, or a migration in migrations/versions/ full
A @<bp>.route(...) or add_url_rule(...) in routes.py light
A method in services.py that does something service
None of these config

The first row that matches decides.


What it removes and what it keeps

Only what feature:create writes is a candidate. A file goes when it is an empty stub, or when the archetype does not need it and it is still as the scaffold wrote it. A file with your code stays, and so does a module another module imports.

__init__.py, tests/conftest.py and tests/unit/ always stay, and so does the migrations/ of a full feature. Anything outside the package is never read. Test folders follow the archetype, so full keeps them all, light keeps unit and functional, and the others keep unit.

A stub holds nothing but docstrings, imports, pass, empty values such as cli_commands = [] and undecorated functions that do nothing. Any call, class or decorated function is code.


Reference

Argument or option Description
FEATURE_REF splent_feature_cache or splent-io/splent_feature_cache, at the workspace root
--apply Delete the listed files, after a confirmation
Message Exit What to do
Feature is already clean. 0 Nothing to do
Feature not found: <path> 1 Clean an editable copy at the workspace root
Refusing to remove a path outside the feature package 1 Nothing was removed. Check the symlinks in the package
Could not update contract 0 Run splent feature:contract --write

Requirements

  • A selected product (SPLENT_APP).
  • The feature as an editable copy at the workspace root.

See also


Back to top

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