   compile: ->
     result =
       targets: []
-
-    compiler = (prop)-> (target)-> target[prop]
-
-    for rule in @rootMist.rules
+      commands: {}
+
+    for rule in @rootMist.rules
+      result.commands[rule.command.hash] =
+        command: rule.command.command
+
       if rule.src.foreach
         for input, target of rule.targets
           result.targets.push
+            command: rule.command.hash
             inputs: [input]
             dependenies: target.dependencies.compile()
             orderDependencies: target.orderDependencies.compile()

    dict = @[pathname]
  else
    dict['f'] = pathname
    dict['b'] = path.basename pathname
    dict['B'] = dict['b'].replace /\..+$/, ''

  template.replace MistResolver.delimiterPattern, (m, p, c)->
    if c of dict then p + dict[c]
    else throw "unknown file delimiter: #{c}"

MistResolver.delimitPath = MistResolver.delimitPath.bind {}

          auxOutputs:
            (v.auxOutputs for k, v of rule.targets).compile()

    return result
###
# Make sure to always include `$1` in the replacement
###
MistResolver.delimiterPattern = /((?!\%).)?%([fbBo])/g

###
# Returns whether or not a string has filename delimiters present
