packages/core/refactor
Refactor capability — mechanical, LLM-free structural moves within a Construct project.
Core engine, v0.8. Source: packages/core/refactor.mjs.
Functions#
moveLayerFile()#
moveLayerFile(
root,feature,name,fromLayer,toLayer,options?):any
Defined in: packages/core/refactor.mjs:197
Move a file from one layer to another within the same feature, keeping
its base name. Naming convention (e.g. a hook's use prefix) is applied
for the target layer — whether the result still makes sense (does the
export name match? is the content still pure enough for its new layer?) is
for construct validate to say, not this function.
Parameters#
root
string
Project root.
feature
string
Feature that owns the file.
name
string
Base name of the file.
fromLayer
string
Layer it is in now.
toLayer
string
Layer to move it to; must differ from fromLayer.
options?
any = {}
Options for the relocation (for example dryRun).
Returns#
any
The relocation result (files changed, engine used).
Throws#
Usage error when both layers are the same.
renameLayerFile()#
renameLayerFile(
root,feature,name,newName,layer,options?):any
Defined in: packages/core/refactor.mjs:218
Rename a file within the same layer, keeping its layer.
Parameters#
root
string
Project root.
feature
string
Feature that owns the file.
name
string
Current base name.
newName
string
New base name.
layer
string
Layer the file is in.
options?
any = {}
Options for the relocation (for example dryRun).
Returns#
any
The relocation result.