       (#(assoc % :context (-> % :context normalize-context)))
       ))
 
-(apply dissoc {:x 5} [:x])
+;(apply dissoc {:x 5} [:x])
 
 ;### Debug ####################################################################
 ;(logging-config/set-logger! :level :debug)

;### Debug ####################################################################


(def CONTEXT-KEYS [:tasks :task-defaults :script-defaults :subcontexts])

(defn- normalize-to-top-level-context [spec]
  (if (:context spec)


;### Debug ####################################################################

(defn- normalize-string-value-to-body-map [v]
  (if (string? v)
    {:body v}
    v))

;### normalize task ###########################################################

(defn seq-to-strin-bool-map [sq]
  (->> sq
       (map (fn [s] [(str s) true]))
       (into {})))

(defn- normalize-traits-in-task [task-map]
  (if-let [traits (:traits task-map)]
    (cond (map? traits) task-map
          (seqable? traits) (assoc task-map :traits (seq-to-strin-bool-map traits))
          :else (throw (IllegalStateException. "Traits must be a map or a seqable.")))
    (assoc task-map :traits {})))

(defn- normalize-task-with-body-to-scripts-task [task-map]
  (cond (:scripts task-map) task-map
        (:body task-map) (-> task-map
                             (assoc :scripts {:main {:body (:body task-map)}})
                             (dissoc :body))
        :else  task-map))


(defn- normalize-task [task]
  (-> task
      normalize-string-value-to-body-map
      normalize-task-with-body-to-scripts-task
      normalize-traits-in-task
      ))



;### normalize tasks ##########################################################

(defn- normalize-seq-with-string-value-to-body-map [d]
  (cond (map? d)
