 
 ;; Data
 
-(def db {:data REPO
+(def db {:data (get REPO "tree")
          :start 0
          :editing #{}})
 

  (let [editing (querydb [:editing])]
    (updatedb [:editing] (conj editing pos))))

(defn update_field [pos key value]
  (let [item (assoc (querydb [:data pos]) key value)]
    (set! db (assoc-in db [:data pos] item))))

(defn save [item pos]
  "Save item to db :data into position"
  (let [doc (assoc item "mtime" (str (new js/Date)))
        data (querydb [:data])]
    (updatedb [:data] (assoc data pos doc))
    (println "Saved!" (get doc "path"))))

(defn close
  [pos]

(defn reporender
  "Render repository trees"
  []
  (let [tree (querydb [:data])]
    (map-indexed node tree)))


