Needs["xAct`xTras`"]

DefManifold[M,4,IndexRange[a,q]]

DefMetric[-1,met[-a,-b],CD,PrintAs->"g"]

DefTensor[A[a,b],M]

MarioExpr=RicciCD[a,c] CD[-c]@CD[-e]@CD[-g]@CD[g]@CD[-f]@CD[f]@CD[-a]@CD[e]@CD[-b]@CD[-d]@A[d,b]

MoveCovDHelper[CD_?CovDQ,{inds__?AIndexQ},Left,postFunction_:Identity][expr_]:=postFunction[expr/.{
bigexpr:CD[notInList_]@CD[inList_][inner_]
/;MemberQ[{inds},inList]&&!MemberQ[{inds},notInList]
:>CommuteCovDs[bigexpr,CD,{inList,notInList}]
}]
MoveCovDHelper[CD_?CovDQ,{inds__?AIndexQ},Right,postFunction_:Identity][expr_]:=postFunction[expr/.{
bigexpr:CD[inList_]@CD[notInList_][inner_]
/;MemberQ[{inds},inList]&&!MemberQ[{inds},notInList]
:>CommuteCovDs[bigexpr,CD,{notInList,inList}]
}]

MoveCovDs[expr_,CD_?CovDQ,{inds__?AIndexQ},dir:(Left|Right),postFunction_:Identity]:=FixedPoint[MoveCovDHelper[CD,{inds},dir,postFunction],expr]

DefConstantSymbol[ϵ]

MyCurvatureTensors={RicciScalarCD,RicciCD,TFRicciCD,EinsteinCD,RiemannCD,WeylCD};

KeepCurvN[n_][expr_]:=With[{CurvReplacements=(#[inds___]:>ϵ #[inds])&/@MyCurvatureTensors},
(Series[Expand[expr]/.CurvReplacements,{ϵ,0,n}]//Normal)/.ϵ->1
];

SortCovDsToBox

MoveCovDs[MarioExpr,CD,{-c,-a},Left,KeepCurvN[2]];
MoveCovDs[%,CD,{-c,-a,-b},Left,KeepCurvN[2]];
MoveCovDs[%,CD,{-c,-a,-b,-d},Left,KeepCurvN[2]]