<commit_before>(ns workflo.macros.specs.command
  (:require [clojure.spec :as s]
            #?(:cljs [cljs.spec.impl.gen :as gen]
               :clj  [clojure.spec.gen :as gen])
            [workflo.macros.specs.query]))

(s/def ::command-name
  symbol?)

(s/def ::command-description
  string?)

(s/def ::command-spec
  (s/with-gen
    any?
    #(s/gen #{symbol? map? vector?})))

(s/def ::command-form-name
  (s/with-gen
    (s/and symbol?
           #(not (some #{\/} (str %))))
    #(s/gen '#{foo bar foo-bar})))

(s/def ::command-form-body
  (s/* any?))

(s/def ::command-form
  (s/spec (s/cat :form-name ::command-form-name
                 :form-body ::command-form-body)))

(s/def ::command-query-form
  (s/spec (s/cat :form-name #{'query}
                 :form-body :workflo.macros.specs.query/query)))

(s/def ::command-spec-form
  (s/spec (s/cat :form-name #{'spec}
                 :form-body ::command-spec)))

(s/def ::command-emit-form
  (s/spec (s/cat :form-name #{'emit}
                 :form-body ::command-form-body)))

(s/def ::defcommand-args
  (s/cat :name ::command-name
         :forms
         (s/spec (s/cat :description (s/? ::command-description)
                        :query (s/? ::command-query-form)
                        :spec (s/? ::command-spec-form)
                        :forms (s/* ::command-form)
                        :emit ::command-emit-form))
         :env (s/? any?)))<commit_msg>Add auth and auth-query forms to the defcommand spec<commit_after>(ns workflo.macros.specs.command
  (:require [clojure.spec :as s]
            #?(:cljs [cljs.spec.impl.gen :as gen]
               :clj  [clojure.spec.gen :as gen])
            [workflo.macros.specs.query]))

(s/def ::command-name
  symbol?)

(s/def ::command-description
  string?)

(s/def ::command-spec
  (s/with-gen
    any?
    #(s/gen #{symbol? map? vector?})))

(s/def ::command-form-name
  (s/with-gen
    (s/and symbol?
           #(not (some #{%} '[description
                              spec
                              query
                              auth-query
                              auth
                              emit]))
           #(not (some #{\/} (str %))))
    #(s/gen '#{foo bar foo-bar})))

(s/def ::command-form-body
  (s/* any?))

(s/def ::command-form
  (s/spec (s/cat :form-name ::command-form-name
                 :form-body ::command-form-body)))

(s/def ::command-spec-form
  (s/spec (s/cat :form-name #{'spec}
                 :form-body ::command-spec)))

(s/def ::command-query-form
  (s/spec (s/cat :form-name #{'query}
                 :form-body :workflo.macros.specs.query/query)))

(s/def ::command-auth-query-form
  (s/spec (s/cat :form-name #{'auth-query}
                 :form-body any?)))

(s/def ::command-auth-form
  (s/spec (s/cat :form-name #{'auth}
                 :form-body ::command-form-body)))

(s/def ::command-emit-form
  (s/spec (s/cat :form-name #{'emit}
                 :form-body ::command-form-body)))

(s/def ::defcommand-args
  (s/cat :name ::command-name
         :forms
         (s/spec (s/cat :description (s/? ::command-description)
                        :spec (s/? ::command-spec-form)
                        :query (s/? ::command-query-form)
                        :auth-query (s/? ::command-auth-query-form)
                        :auth (s/? ::command-auth-form)
                        :forms (s/* ::command-form)
                        :emit ::command-emit-form))
         :env (s/? any?)))
{'fraction_non_alphanumeric': 0.18715964459730583, 'fraction_numerical': 0.0, 'mean_word_length': 1.7117327117327117, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3389238', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1194, 'n_words': 241}