Liking cljdoc? Tell your friends :D

pebblestream.directives.check

Checks a PSOSF archive against everything Pebble Stream can verify without compiling it, and reports the results in one place, for people, pipelines and AI agents:

  1. structure and compatibility, from psosf.core (escaping, manifest, function allow-list, references outside the spreadsheet);
  2. every directive line: that it parses, names a known directive, and matches that directive's signature;
  3. the worksheet rules from the PebbleScript Reference: repetition, exclusions, requirements, header arguments, formulas in transformed columns, cycles, ignore, allowed-values.

(check-archive archive) -> Clojure data (check-entries entries) -> JSON-shaped report (string keys) (check-json text) -> the same report, as JSON text

Every finding names the worksheet, and where it applies the column and directive, with a fix when one is known.

Checks a PSOSF archive against everything Pebble Stream can verify without
compiling it, and reports the results in one place, for people, pipelines
and AI agents:

  1. structure and compatibility, from psosf.core (escaping, manifest,
     function allow-list, references outside the spreadsheet);
  2. every directive line: that it parses, names a known directive, and
     matches that directive's signature;
  3. the worksheet rules from the PebbleScript Reference: repetition,
     exclusions, requirements, header arguments, formulas in transformed
     columns, cycles, ignore, allowed-values.

(check-archive archive)  -> Clojure data
(check-entries entries)  -> JSON-shaped report (string keys)
(check-json text)        -> the same report, as JSON text

Every finding names the worksheet, and where it applies the column and
directive, with a fix when one is known.
raw docstring

pebblestream.directives.cli

Command-line check for PSOSF archives, for people, scripts and AI agents.

bb check account-balances.psosf a report for people bb check account-balances.psosf --json the report as JSON, for scripts and agents bb check account-balances.psosf --allow SUM,IF,ROUND clojure -M -m pebblestream.directives.cli account-balances.psosf

Prints the report from pebblestream.directives.check, as text or as JSON, and exits 0 when the archive passed, 1 when it did not, 2 on a usage error.

Command-line check for PSOSF archives, for people, scripts and AI agents.

  bb check account-balances.psosf                   a report for people
  bb check account-balances.psosf --json            the report as JSON, for scripts and agents
  bb check account-balances.psosf --allow SUM,IF,ROUND
  clojure -M -m pebblestream.directives.cli account-balances.psosf

Prints the report from pebblestream.directives.check, as text or as JSON,
and exits 0 when the archive passed, 1 when it did not, 2 on a usage error.
raw docstring

pebblestream.directives.parse

Parses a line of textual PebbleScript into a directive:

pebblestream:join("Rates", "id", "rate-id") => {:directive :join :syntax :paren :args ["Rates" "id" "rate-id"]}

Accepted forms: bare (pebblestream:unique), parentheses (pebblestream:sum("amount", "total")) and the deprecated colon form (pebblestream:hint:key:value, pebblestream:allowed-values:a:b), whose arguments are separated by colons only.

Arguments parse to: "text" or Name a string (quoted strings use the escape rules in pebblestream.parse-str; unquoted names have no spaces) 'Sheet Name' a string, Excel's single-quoted sheet notation 12, -0.5 a number :latest a keyword (flags) Inputs!B2, 'Rates'!$C$4 {:ref "Inputs!B2"}, a cell reference; it must name its worksheet, so B2 alone is a name "Date":desc {:column "Date" :order :desc}, a sort column "<="&"Balance" {:operator "<=" :column "Balance"} "<"&Inputs!B2 {:operator "<" :ref "Inputs!B2"}

Parses a line of textual PebbleScript into a directive:

  pebblestream:join("Rates", "id", "rate-id")
  => {:directive :join :syntax :paren :args ["Rates" "id" "rate-id"]}

Accepted forms: bare (pebblestream:unique), parentheses
(pebblestream:sum("amount", "total")) and the deprecated colon form
(pebblestream:hint:key:value, pebblestream:allowed-values:a:b), whose
arguments are separated by colons only.

Arguments parse to:
  "text" or Name           a string (quoted strings use the escape rules
                           in pebblestream.parse-str; unquoted names have
                           no spaces)
  'Sheet Name'             a string, Excel's single-quoted sheet notation
  12, -0.5                 a number
  :latest                  a keyword (flags)
  Inputs!B2, 'Rates'!$C$4  {:ref "Inputs!B2"}, a cell reference; it must
                           name its worksheet, so B2 alone is a name
  "Date":desc              {:column "Date" :order :desc}, a sort column
  "<="&"Balance"           {:operator "<=" :column "Balance"}
  "<"&Inputs!B2            {:operator "<" :ref "Inputs!B2"}
raw docstring

pebblestream.directives.schema

Malli schemas for PebbleScript directives.

Three layers:

  1. param-registry — one Malli schema per parameter type.
  2. directives — one entry per directive: its type, accepted syntax, requires/excludes and an argument schema written as a Malli sequence schema (:cat, :+, :*, :?).
  3. parsed-directive — a :multi schema validating a parsed directive of the form {:directive :from, :syntax :paren, :args ["Accounts"]}.

Markers (Malli properties):

:pebblestream/ambiguous A string explaining what is unclear. Wherever the source was unclear the accepted type defaults to :string. Run ambiguities to list every marker. :pebblestream/unique-class Parameters sharing a class number are believed to require distinct values (from the source's :classes {:unique n}). Not enforced by Malli. :pebblestream/sheet-ref The column belongs to the sheet named by the parameter at this index (from the source's :tags {:sheet-id n}). Not enforced by Malli. :pebblestream/source :supplied-spec for directives taken from the editor's specs; :not-in-supplied-spec for directives known to exist but absent from them.

Syntax:

A directive whose source :style is :colon accepts both forms, pebblestream:name:a:b (:colon, deprecated; colons separate arguments) pebblestream:name(a, b) (:paren) A directive whose source :style is :paren accepts only :paren.

Any directive that takes no arguments, or whose arguments are all optional, may also be written bare: pebblestream:unique (:bare, not deprecated) pebblestream:unique() (:paren) pebblestream:expand (:bare) The bare form is valid only with no arguments.

Quoting: a quoted string is accepted for every string argument. A worksheet or column name that contains no space may also be written unquoted. Parsed arguments are the same either way; JSON Notation renders every string quoted. Inside quotes, a quote is written doubled ("") or escaped ("), and a backslash escapes the next character, so a literal backslash is doubled. A backslash before any other character is removed and draws an :ambiguous-backslash warning (see pebblestream.parse-str).

Exclusions are written on both directives: if A excludes B, B excludes A. excludes-errors reports any one-way pair.

Malli schemas for PebbleScript directives.

Three layers:

1. `param-registry` — one Malli schema per parameter type.
2. `directives`     — one entry per directive: its type, accepted syntax,
                      requires/excludes and an argument schema written as a
                      Malli sequence schema (:cat, :+, :*, :?).
3. `parsed-directive` — a :multi schema validating a parsed directive of the
                      form {:directive :from, :syntax :paren, :args ["Accounts"]}.

Markers (Malli properties):

:pebblestream/ambiguous     A string explaining what is unclear. Wherever the
                            source was unclear the accepted type defaults to
                            :string. Run `ambiguities` to list every marker.
:pebblestream/unique-class  Parameters sharing a class number are believed to
                            require distinct values (from the source's
                            :classes {:unique n}). Not enforced by Malli.
:pebblestream/sheet-ref     The column belongs to the sheet named by the
                            parameter at this index (from the source's
                            :tags {:sheet-id n}). Not enforced by Malli.
:pebblestream/source        :supplied-spec for directives taken from the
                            editor's specs; :not-in-supplied-spec for
                            directives known to exist but absent from them.

Syntax:

A directive whose source :style is :colon accepts both forms,
  pebblestream:name:a:b        (:colon, deprecated; colons separate arguments)
  pebblestream:name(a, b)      (:paren)
A directive whose source :style is :paren accepts only :paren.

Any directive that takes no arguments, or whose arguments are all optional,
may also be written bare:
  pebblestream:unique          (:bare, not deprecated)
  pebblestream:unique()        (:paren)
  pebblestream:expand          (:bare)
The bare form is valid only with no arguments.

Quoting: a quoted string is accepted for every string argument. A worksheet
or column name that contains no space may also be written unquoted. Parsed
arguments are the same either way; JSON Notation renders every string quoted.
Inside quotes, a quote is written doubled ("") or escaped (\"), and a
backslash escapes the next character, so a literal backslash is doubled. A
backslash before any other character is removed and draws an
:ambiguous-backslash warning (see pebblestream.parse-str).

Exclusions are written on both directives: if A excludes B, B excludes A.
`excludes-errors` reports any one-way pair.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close