             [storages.util :as fs]
             [uxbox.config]
             [uxbox.db :as db]
-            [uxbox.cli.sql :as sql]
             [uxbox.migrations]
             [uxbox.media :as media]
+            [uxbox.cli.sql :as sql]
+            [uxbox.util.spec :as us]
+            [uxbox.util.cli :as cli]
             [uxbox.util.uuid :as uuid]
             [uxbox.util.data :as data])
   (:import [java.io Reader PushbackReader]
            [javax.imageio ImageIO]))
 
-;; --- Constants
+;; --- Constants & Specs
 
 (def ^:const +imates-uuid-ns+ #uuid "3642a582-565f-4070-beba-af797ab27a6e")
 
+(s/def ::name string?)
+(s/def ::type keyword?)
+(s/def ::path string?)
+(s/def ::regex us/regex?)
+
+(s/def ::import-entry
+  (s/keys :req-un [::name ::type ::path ::regex]))
+
 ;; --- CLI Helpers
 
-(defn exit
-  ([] (exit 0))
-  ([code]
-   (System/exit code)))
 
 (defn printerr
   [& args]

        sqlv (sql/create-image params)]
    (sc/execute conn sqlv)))

(defn- import-image-from-path
  [conn id fpath]
  {:pre [(uuid? id)
         (fs/path? fpath)]}
  (let [imageid (uuid/namespaced +imates-uuid-ns+ (str id fpath))]
    (if-let [image (retrieve-image conn imageid)]
      (do

  (mount/stop))

(defn- run-importer
  [directory data]
  (println "Running importer on:")
  (pprint data))

(defn main
  [& [path]]
  (let [[directory data] (read-import-file path)]
    (start-system)
    (try
      (run-importer directory data)
      (finally
        (stop-system)))))
