I played a little bit more around with a small program, that creates a
packageversion-module for me.
e.g.

module colored.packageversion;
const PACKAGE_VERSION = "v0.0.10-dirty";
static this()
{
    import packageversion;
    packageversion.registerPackageVersion("colored", "v0.0.10-dirty");
}

What really comes in handy (imho) is if every dub package would provide
such a thing. Then you could print an exact version of your code, as
well as of the code of all dub-dependencies.

e.g.
import asciitable;
import packageversion;
auto table =
packageversion

.getPackages
.keys
.sort
.fold!((table, key) =>
  table.add(key, packageversion.getPackages[key]))

(AsciiTable(0, 0));
"Versions:\n%s".format(table.toString(" ", " ")).writeln;

could produce something like this:
Versions:

androidlogger v0.0.6
asciitable    v0.0.2-4-gb6a99a6
colored       v0.0.10-dirty
worker        v0.0.2-11-g09440eb-dirty

what do you think?

christian koestlin