Something like this? Take a look at https://developer.sketch.com/reference/api for the reference
const sketch = require('sketch/dom')
const ShapePath = sketch.ShapePath
let document = sketch.getSelectedDocument()
// Uses the first selected layer, replace with your selection
let selection = document.selectedLayers.layers[0]
// Replace with the layer you want to create
let replacement = new ShapePath({
name: 'Oval',
shapeType: ShapePath.ShapeType.Oval,
})
replacement.parent = selection.parent
replacement.index = selection.index
selection.remove()