There's already a dfhack plugin called diggingInvaders that lets invaders dig. Dunno if it's works on the current version, though. The last activity on
its thread was in June of 2014.
[DFHack]# help diggingInvaders
diggingInvaders: Makes invaders dig to your dwarves.
Usage:
diggingInvaders 0
disables the plugin
diggingInvaders 1
enables the plugin
diggingInvaders enable
enables the plugin
diggingInvaders disable
disables the plugin
diggingInvaders add GOBLIN
registers the race GOBLIN as a digging invader. Case-sensitive.
diggingInvaders remove GOBLIN
unregisters the race GOBLIN as a digging invader. Case-sensitive.
diggingInvaders setCost GOBLIN walk n
sets the walk cost in the path algorithm for the race GOBLIN
diggingInvaders setCost GOBLIN destroyBuilding n
diggingInvaders setCost GOBLIN dig n
diggingInvaders setCost GOBLIN destroyRoughConstruction n
rough constructions are made from boulders
diggingInvaders setCost GOBLIN destroySmoothConstruction n
smooth constructions are made from blocks or bars instead of boulders
diggingInvaders setDelay GOBLIN destroyBuilding n
adds to the job_completion_timer of destroy building jobs that are assigned to invaders
diggingInvaders setDelay GOBLIN dig n
diggingInvaders setDelay GOBLIN destroyRoughConstruction n
diggingInvaders setDelay GOBLIN destroySmoothConstruction n
diggingInvaders now
makes invaders try to dig now, if plugin is enabled
diggingInvaders clear
clears all digging invader races
diggingInvaders edgesPerTick n
makes the pathfinding algorithm work on at most n edges per tick. Set to 0 or lower to make it unlimited.