Skip to content

A peer-to-peer stack for code collaboration

661 B
Raw Blame
(load! (find-module-file! "monadic/issue.rad"))

(import prelude/chain :unqualified)

;; This is a script that migrates the issue chain. It is used when there is a
;; breaking change.
;; Example:
;; (migrate-issues! "machines.radicle.xyz/chains/radicle-issues"
;;                  "machines.radicle.xyz/chains/new-radicle-issues")

(def input-pat
  (list (/member ['create-issue 'edit-issue 'add-comment 'edit-comment]) _))

(def input?
  (fn [i]
    (match i
           input-pat #t
           _         #f)))

(def migrate-issues!
  (fn [old new]
    (def is (nth 1 (receive! old :nothing)))
    (create-issue-chain! new)
    (send! new (filter input? is))))