Grunt - Is it possible to have a task that only runs once ever?

There is a particular task that I want to run only once and then guarantee that it is never run again. Has anyone done this? I was looking at using grunt.event.once(...), or try and detect folders or files using a shell script on postinstall, but both ways leave a task in the gruntfile.js that could potentially be invoked at any time overwriting files.

At a very simple level it would do something like this:

grunt.registerTask('setup', [
    'mkdir' // run some setup tasks
]);

grunt.event.once('setup', function() {

    // some how do what's below here so it can't be done again 
    // so not available in config for reuse and possibly overwriting
    // modified files

    grunt.task.run([
        'bowercopy:src_codeigniter'
    ]);
});

This even possible in Grunt? I know it's just a task runner, in this case I just want it to run it once.

There are several libraries that let you access a Gruntfile's content via an API so you could use one of these to alter your setup task's configuration after it is run the first time.

There's Gruntfile Editor and Gruntfile API

While both of them don't support complete task removal you can always modify your tasks configuration this way.