0.1.4 • Published 2 years ago

psqr v0.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

psqr

CLI client for the Public Square project

oclif Version Downloads/week License

Usage

$ npm install -g psqr
$ psqr COMMAND
running command...
$ psqr (-v|--version|version)
psqr/0.1.4 linux-x64 node-v16.14.2
$ psqr --help [COMMAND]
USAGE
  $ psqr COMMAND
...

Commands

psqr config:export [DID]

Export the full configuration for a specified DID

USAGE
  $ psqr config:export [DID]

ARGUMENTS
  DID  DID of the identity that you want to export

OPTIONS
  -e, --encode           encode the configuration so that it can be imported via the
                         /config/settings-import?config=[encoded-string] path in the web app

  -h, --help             show CLI help

  -n, --network=network  domain of network to export instead of using default

See code: src/commands/config/export.ts

psqr config:import [PATH]

Import a config and set as default if specified

USAGE
  $ psqr config:import [PATH]

ARGUMENTS
  PATH  path to file containing the config you want to import

OPTIONS
  -d, --default  Set config values as the default in all cases
  -d, --key=key  Key name to use as default, if not specified the first available key will be used
  -h, --help     show CLI help

See code: src/commands/config/import.ts

psqr crawl [TYPE] [DID]

Crawl new Posts from feeds and publish them.

USAGE
  $ psqr crawl [TYPE] [DID]

ARGUMENTS
  TYPE  (rss|twitter|webhose|sitemap) The type of crawl you want to use
  DID   DID of the identity that you want to crawl

OPTIONS
  -b, --broadcasters=broadcasters  Comma (,) separated list of domains of Broadcaster(s) to publish to instead of the
                                   defaults

  -h, --help                       show CLI help

  -p, --proxy                      Use a proxy for each request

  -s, --stdin                      Use STDIN input as a list of newline separated DIDs. They are assumed to all be the
                                   same type.

DESCRIPTION
  Don't specify any arguments in order to use the defaults.
  If you want to crawl multiple configs use stdin or set them as the defaults.

See code: src/commands/crawl.ts

psqr crawl:add:rss [KID] [URL]

Create a new RSS Crawl config

USAGE
  $ psqr crawl:add:rss [KID] [URL]

ARGUMENTS
  KID  DID and Key to be used for posts
  URL  Url to RSS feed

OPTIONS
  -g, --geo=geo                                    Specify the default geo value
  -h, --help                                       show CLI help
  -i, --image=image                                Specify the default image value
  -l, --lang=lang                                  Specify the default lang value
  -p, --politicalSubdivision=politicalSubdivision  Specify the default politicalSubdivision value

See code: src/commands/crawl/add/rss.ts

psqr crawl:add:sitemap [KID] [URL]

Create or update a Sitemap crawl config

USAGE
  $ psqr crawl:add:sitemap [KID] [URL]

ARGUMENTS
  KID  DID and Key to be used for posts
  URL  url for sitemap

OPTIONS
  -d, --filterDescription=filterDescription        List of descriptions to never use divided by the pipe symbol (|).
  -e, --filterImage=filterImage                    List of images to never use divided by the pipe symbol (|).
  -g, --geo=geo                                    Specify the default geo value
  -h, --help                                       show CLI help
  -i, --image=image                                Specify the default image value
  -l, --lang=lang                                  Specify the default lang value

  -m, --markupInclude=markupInclude                List of markup tags divided by the pipe symbol (|). Include only
                                                   these markup tags

  -n, --markupExclude=markupExclude                List of markup tags divided by the pipe symbol (|). Include
                                                   everything but these markup tags

  -p, --politicalSubdivision=politicalSubdivision  Specify the default politicalSubdivision value

  -q, --pathInclude=pathInclude                    List of paths divided by the pipe symbol (|). Include only urls with
                                                   this path

  -r, --pathExclude=pathExclude                    List of paths divided by the pipe symbol (|). Include every url
                                                   except for those with this path

  -s, --since=since                                [default: 1d] Include all posts that have been created since now -
                                                   this flag. This filters based on lastmod and defaults to 1d. Set to 0
                                                   to skip.

  -t, --filterTitle=filterTitle                    List of titles to never use divided by the pipe symbol (|).

See code: src/commands/crawl/add/sitemap.ts

psqr crawl:add:twitter [KID] [USERNAME]

Create a new Twitter Crawl config

USAGE
  $ psqr crawl:add:twitter [KID] [USERNAME]

ARGUMENTS
  KID       DID and Key to be used for posts
  USERNAME  @ username for Twitter user

OPTIONS
  -g, --geo=geo                                    Specify the default geo value
  -h, --help                                       show CLI help
  -i, --image=image                                Specify the default image value
  -l, --lang=lang                                  Specify the default lang value
  -p, --politicalSubdivision=politicalSubdivision  Specify the default politicalSubdivision value

See code: src/commands/crawl/add/twitter.ts

psqr crawl:add:webhose [KID] [USERNAME]

Create a new Webhose Crawl config

USAGE
  $ psqr crawl:add:webhose [KID] [USERNAME]

ARGUMENTS
  KID       DID and Key to be used for posts
  USERNAME  @ username for Webhose user

OPTIONS
  -d, --domain=domain                              (required) Specify the domain for the webhose url
  -g, --geo=geo                                    Specify the default geo value
  -h, --help                                       show CLI help
  -i, --image=image                                Specify the default image value
  -l, --lang=lang                                  Specify the default lang value
  -p, --politicalSubdivision=politicalSubdivision  Specify the default politicalSubdivision value

See code: src/commands/crawl/add/webhose.ts

psqr crawl:default [TYPE] [DID]

Set the default Crawl(s)

USAGE
  $ psqr crawl:default [TYPE] [DID]

ARGUMENTS
  TYPE  (rss|twitter|webhose|sitemap) The type of crawl you want to use
  DID   DID of the identity that you want to crawl

OPTIONS
  -h, --help       show CLI help
  -o, --overwrite  Overwrite the current defaults with specified Crawl(s)
  -s, --stdin      Use STDIN input as a list of newline separated DIDs.

DESCRIPTION
  Default behavior is to add specified Crawl(s) to defaults.

See code: src/commands/crawl/default.ts

psqr crawl:publish [TYPE] [DID]

Publish posts stored with a Crawler.

USAGE
  $ psqr crawl:publish [TYPE] [DID]

ARGUMENTS
  TYPE  (rss|twitter|webhose|sitemap) The type of crawl you want to use
  DID   DID of the identity that you want to crawl

OPTIONS
  -b, --broadcasters=broadcasters  Colon (:) separated list of domains of Broadcaster(s) to publish to instead of the
                                   defaults

  -h, --help                       show CLI help

  -k, --keep                       Keep the posts stored with the crawler once they have been published

  -s, --stdin                      Use STDIN input as a list of newline separated DIDs.

DESCRIPTION
  All posts that are in the posts dir of the Crawler will be signed,
  published to the broadcasters, and then deleted unless otherwise specified.

See code: src/commands/crawl/publish.ts

psqr crawl:pull [TYPE] [DID]

Crawl new Posts from feeds.

USAGE
  $ psqr crawl:pull [TYPE] [DID]

ARGUMENTS
  TYPE  (rss|twitter|webhose|sitemap) The type of crawl you want to use
  DID   DID of the identity that you want to crawl

OPTIONS
  -h, --help   show CLI help
  -l, --local  Save all the posts in the current directory instead of the crawl dir
  -p, --proxy  Use a proxy for each request
  -s, --stdin  Use STDIN input as a list of newline separated DIDs. They are assumed to all be the same type.

DESCRIPTION
  Don't specify any arguments in order to use the defaults.
  If you want to crawl multiple configs use stdin or set them as the defaults.
  New posts from all feeds are retrieved and stored in their feed directories
  or locally if specified.

See code: src/commands/crawl/pull.ts

psqr crawl:remove [TYPE] [DID]

Remove Crawl configs.

USAGE
  $ psqr crawl:remove [TYPE] [DID]

ARGUMENTS
  TYPE  (rss|twitter|webhose|sitemap) The type of crawl you want to use
  DID   DID of the crawl config that you want to remove

OPTIONS
  -h, --help   show CLI help
  -s, --stdin  Use STDIN input as a list of newline separated DIDs.

See code: src/commands/crawl/remove.ts

psqr crawl:test [TYPE] [DID]

Run a test Crawl to verify the information gathered is accurate.

USAGE
  $ psqr crawl:test [TYPE] [DID]

ARGUMENTS
  TYPE  (rss|twitter|webhose|sitemap) The type of crawl you want to use
  DID   DID of the identity that you want to crawl

OPTIONS
  -c, --complete  Include complete post json instead of just meta info.
  -d, --dataOnly  Only output source data used to form posts.
  -h, --help      show CLI help
  -l, --list      Output as a jsonl file instead of a human readable json array.
  -p, --proxy     Use a proxy for each request
  -s, --stdin     Use STDIN input as a list of newline separated DIDs. They are assumed to all be the same type.
  -u, --urlOnly   Only output list of canonicalUrls.

DESCRIPTION
  Output normally includes post.info.publicSquare.package only as json array.
  Output is saved as a local file(s) with the name crawl-test-{ level }-{ path valid did}-{ timestamp }.json(l)
  depending on options selected.

See code: src/commands/crawl/test.ts

psqr env [FILE]

View or set psqr environment vars. If a valid env FILE is specified it will replace the current env and be saved.

USAGE
  $ psqr env [FILE]

ARGUMENTS
  FILE  path to file containing env vars for the default cli environment

OPTIONS
  -g, --get=get   Get specific saved env vars. Format is comma separated key
  -h, --help      show CLI help
  -l, --list      List current env vars and their values
  -p, --possible  List all possible env vars
  -s, --set=set   Set and save specific env vars. Format is comma separated key=value

See code: src/commands/env.ts

psqr help [COMMAND]

display help for psqr

USAGE
  $ psqr help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

psqr identity [KID]

List saved identities.

USAGE
  $ psqr identity [KID]

ARGUMENTS
  KID  KID URL string, expected format: did:(psqr|web):{hostname}(/|:){path}#{keyId}

OPTIONS
  -a, --all      Include all possible keys
  -d, --default  List the Default Identity
  -h, --help     show CLI help
  -v, --verbose  Output only the raw Identity object

DESCRIPTION
  This command lists the identities that are currently saved and available.

See code: src/commands/identity.ts

psqr identity:add [DID]

Add a preexisting identity to the cli config.

USAGE
  $ psqr identity:add [DID]

ARGUMENTS
  DID  DID URL string, expected format: did:(psqr|web):{hostname}(/|:){path}

OPTIONS
  -a, --absolute   Key directory path is an absolute path
  -h, --help       show CLI help
  -k, --key=key    Name of key to create and add to the DID doc.

  -p, --path=path  Instead of generating a new key, use the keys from this directory. Expected files are private.jwk and
                   public.jwk

  -s, --stdin      Use STDIN input as KeyPair. Expected JSON string format: { kid, private, public }

DESCRIPTION
  This assumes the DID is located at the url specified in the DID string.
  Create new keypair and add it to the DID doc with --key.
  If you have some pre-existing keys that you want to add you can either specify the path to them with --path,
  or pass the entire KeyPair as a JSON string with --stdin.
  Any changes to the DID doc (ie added keys) are local and most be propagated with identity:propagate.

See code: src/commands/identity/add.ts

psqr identity:create [KID]

Create a new identity from a provided KID and add it to the psqr config.

USAGE
  $ psqr identity:create [KID]

ARGUMENTS
  KID  KID string, expected format: did:psqr:{hostname}/{path}#{keyId}. If key is omitted a default publish key will be
       created.

OPTIONS
  -b, --bio=bio                  publicIdentity bio
  -d, --description=description  publicIdentity description
  -h, --help                     show CLI help
  -i, --image=image              publicIdentity image url
  -k, --keys=keys                List of comma separated key names to create. Overrides keyId from end of KID
  -l, --local                    Store the identity locally instead of in the psqr config
  -n, --name=name                publicIdentity name, REQUIRED if no STDIN input
  -s, --stdin                    Use STDIN input as full JSON publicIdentity string
  -t, --tagline=tagline          publicIdentity tagline
  -u, --url=url                  publicIdentity url

DESCRIPTION
  This only supports creating did:psqr identities.

See code: src/commands/identity/create.ts

psqr identity:default [KID]

Set the default identity using the KID

USAGE
  $ psqr identity:default [KID]

ARGUMENTS
  KID  KID URL string, expected format: did:(psqr|web):{hostname}(/|:){path}#{keyId}

OPTIONS
  -h, --help  show CLI help

See code: src/commands/identity/default.ts

psqr identity:delete [DID]

Remove an Identity from a Public Square Network that hosts Identities.

USAGE
  $ psqr identity:delete [DID]

ARGUMENTS
  DID  DID URL string, expected format: did:(psqr|web):{hostname}(/|:){path}

OPTIONS
  -h, --help  show CLI help

See code: src/commands/identity/delete.ts

psqr identity:export [DID]

Export the did doc of an identity.

USAGE
  $ psqr identity:export [DID]

ARGUMENTS
  DID  DID of the identity that you want to export, skip for default

OPTIONS
  -h, --help       show CLI help
  -k, --keys=keys  Comma separated list of key names to export. THIS WILL EXPORT PRIVATE KEYS.
  -p, --pretty     Pretty-print the exported identity doc

DESCRIPTION
  If you wish to export your stored private keys you need to specify each key by name.

See code: src/commands/identity/export.ts

psqr identity:new [KID]

Create a new default identity

USAGE
  $ psqr identity:new [KID]

ARGUMENTS
  KID  KID PSQR string, expected format: did:psqr:{hostname}/{path}#{keyId}

OPTIONS
  -b, --bio=bio                  publicIdentity bio
  -d, --description=description  publicIdentity description
  -h, --help                     show CLI help
  -i, --image=image              publicIdentity image url
  -n, --name=name                publicIdentity name, REQUIRED if no STDIN input
  -s, --stdin                    Use STDIN input as full JSON publicIdentity string
  -t, --tagline=tagline          publicIdentity tagline
  -u, --url=url                  publicIdentity url

DESCRIPTION
  This command creates a new identity from a provided KID URL,
  adds it to the psqr config, and sets it as the default.
  This only supports creating did:psqr identities.

See code: src/commands/identity/new.ts

psqr identity:propagate [DID]

Propagate an Identity to a Public Square Network that hosts Identities.

USAGE
  $ psqr identity:propagate [DID]

ARGUMENTS
  DID  DID URL string, expected format: did:(psqr|web):{hostname}(/|:){path}

OPTIONS
  -h, --help  show CLI help

DESCRIPTION
  It will use any available admin key associated with the identity or it will throw an error if none are available.

See code: src/commands/identity/propagate.ts

psqr identity:resolve [DID]

For Self Hosting the Identity, find the local file and the URL that must serve it.

USAGE
  $ psqr identity:resolve [DID]

ARGUMENTS
  DID  DID URL string, expected format: did:(psqr|web):{hostname}(/|:){path}

OPTIONS
  -h, --help  show CLI help

See code: src/commands/identity/resolve.ts

psqr identity:update [DID]

Update a local Identity with specified info or from the hosted DID doc.

USAGE
  $ psqr identity:update [DID]

ARGUMENTS
  DID  DID PSQR string of the identity to update, expected format: did:psqr:{hostname}/{path}

OPTIONS
  -b, --bio=bio                  publicIdentity bio
  -d, --description=description  publicIdentity description
  -f, --fetch                    Fetch the hosted DID doc from the url specified by the DID and update the local DID doc
  -h, --help                     show CLI help
  -i, --image=image              publicIdentity image url
  -n, --name=name                publicIdentity name, REQUIRED if no STDIN input
  -s, --stdin                    Use STDIN input as full JSON publicIdentity string
  -t, --tagline=tagline          publicIdentity tagline
  -u, --url=url                  publicIdentity url

DESCRIPTION
  This will update the updated timestamp and will only apply locally.
  Use identity:propagate to propagate the changes to the hosted DID doc.
  This does not affect keys or permissions granted.
  Use the fetch flag to update the local doc.

See code: src/commands/identity/update.ts

psqr identity:validate [KID] [PATH]

Validate an identity (DID doc and key pair)

USAGE
  $ psqr identity:validate [KID] [PATH]

ARGUMENTS
  KID   KID PSQR string, expected format: did:(psqr|web):{hostname}(/|:){path}#{keyId}

  PATH  Path to directory containing keys in the form of a JWK, expected algorithm: ES384. Expected files are
        private.jwk and public.jwk

OPTIONS
  -a, --absolute  Key PATH is an absolute path
  -h, --help      show CLI help
  -r, --raw       Key PATH specified is raw (not a filepath), you need to escape "
  -s, --stdin     Use STDIN input as key instead of key PATH

DESCRIPTION
  Use the import flag to import the key into the local identity as well.
  If no key path is specified and no stdin input is provided then this will fallback to checking in the local directory
  of the identity.

See code: src/commands/identity/validate.ts

psqr key:add [KID]

Add a preexisting Key to an identity stored in the cli config.

USAGE
  $ psqr key:add [KID]

ARGUMENTS
  KID  KID URL string, expected format: did:(psqr|web):{hostname}(/|:){path}#{keyId}

OPTIONS
  -a, --absolute   Key directory path is an absolute path
  -h, --help       show CLI help
  -p, --path=path  Use the keys from this directory. Expected files are private.jwk and public.jwk
  -s, --stdin      Use STDIN input as KeyPair. Expected JSON string format: { kid, private, public }

DESCRIPTION
  Specify the path to the directory containing them with --path,
  or pass the entire KeyPair as a JSON string with --stdin.

See code: src/commands/key/add.ts

psqr key:jws [DATA]

Generate a JWS for an arbitrary string with specified key.

USAGE
  $ psqr key:jws [DATA]

ARGUMENTS
  DATA  Relative path to file with string data

OPTIONS
  -h, --help     show CLI help
  -k, --kid=kid  KID string
  -r, --raw      DATA specified is raw (not a filepath), you need to escape "
  -s, --stdin    Use STDIN input as DATA

See code: src/commands/key/jws.ts

psqr key:new [DID] [NAMES]

Create new Keys and add them to a preexisting identity.

USAGE
  $ psqr key:new [DID] [NAMES]

ARGUMENTS
  DID    DID URL string, expected format: did:(psqr|web):{hostname}(/|:){path}
  NAMES  Comma (,) separated list of names of keys to create

OPTIONS
  -h, --help  show CLI help

See code: src/commands/key/new.ts

psqr network

List Network config

USAGE
  $ psqr network

OPTIONS
  -a, --all              List all current Network configs
  -d, --domains=domains  Colon (:) separated list of domains of specific Network(s) to list
  -h, --help             show CLI help
  -r, --raw              Output only the raw Network config

DESCRIPTION
  Lists the config of the Network(s) as specified by flags.
  Lists the defaults if not otherwise specified.

See code: src/commands/network.ts

psqr network:create [DOMAIN] [NAME]

Create a new Network config

USAGE
  $ psqr network:create [DOMAIN] [NAME]

ARGUMENTS
  DOMAIN  Root domain of the network
  NAME    Friendly name to reference this Network

OPTIONS
  -a, --api=api                          Url to use instead of api default ([domain]/api)
  -b, --beacon=beacon                    Url to use instead of beacon default (beacon.[domain])

  -d, --identityDomains=identityDomains  Comma separated list of identityDomains to use instead of the default
                                         (did:psqr:[domain])

  -f, --feed=feed                        Url to use instead of feed default (feed.[domain])

  -h, --help                             show CLI help

  -i, --link=link                        Url to use instead of link default (link.[domain])

  -l, --list=list                        Url to use instead of list default (list.[domain])

  -s, --search=search                    Url to use instead of search default (search.[domain])

See code: src/commands/network/create.ts

psqr network:default [DOMAINS]

Set the default Network(s)

USAGE
  $ psqr network:default [DOMAINS]

ARGUMENTS
  DOMAINS  Colon (:) separated list of Network(s) to set as default

OPTIONS
  -h, --help       show CLI help
  -o, --overwrite  Overwrite the current defaults with specified Network(s)

DESCRIPTION
  Default behavior is to add specified Network(s) to defaults.

See code: src/commands/network/default.ts

psqr network:remove [DOMAINS]

Remove Network configs

USAGE
  $ psqr network:remove [DOMAINS]

ARGUMENTS
  DOMAINS  Colon (:) separated list of Network(s) to remove

OPTIONS
  -h, --help  show CLI help

See code: src/commands/network/remove.ts

psqr post [BODY]

Create post, sign it with specified key, and publish to Broadcaster

USAGE
  $ psqr post [BODY]

ARGUMENTS
  BODY  Relative path to body data file or JSON body data

OPTIONS
  -b, --broadcasters=broadcasters                  Colon (:) separated list of domains of Broadcaster(s) to put to
  -c, --canonicalUrl=canonicalUrl                  Post canonical url
  -e, --description=description                    Post description
  -g, --geo=geo                                    Post geo
  -h, --help                                       show CLI help
  -i, --image=image                                Post image
  -k, --kid=kid                                    KID string
  -l, --lang=lang                                  Post language, can be set in env
  -o, --politicalSubdivision=politicalSubdivision  Post political subdivision
  -p, --publishDate=publishDate                    Post publish date
  -r, --raw                                        DATA specified is raw (not a filepath), you need to escape "
  -s, --stdin                                      Use STDIN input as DATA
  -t, --title=title                                Post title

See code: src/commands/post.ts

psqr post:create [BODY]

Create Post JSON with input data

USAGE
  $ psqr post:create [BODY]

ARGUMENTS
  BODY  Relative path to body data file or JSON body data

OPTIONS
  -c, --canonicalUrl=canonicalUrl                  Post canonical url
  -e, --description=description                    Post description
  -g, --geo=geo                                    Post geo
  -h, --help                                       show CLI help
  -i, --image=image                                Post image
  -k, --kid=kid                                    KID string, can be set in env
  -l, --lang=lang                                  Post language, can be set in env
  -o, --politicalSubdivision=politicalSubdivision  Post political subdivision
  -p, --publishDate=publishDate                    Post publish date
  -r, --raw                                        DATA specified is raw (not a filepath), you need to escape "
  -s, --stdin                                      Use STDIN input as DATA
  -t, --title=title                                Post title

See code: src/commands/post/create.ts

psqr post:put [HASH] [DATA]

Publish content to the specified Broadcaster

USAGE
  $ psqr post:put [HASH] [DATA]

ARGUMENTS
  HASH  infoHash of the post to be published
  DATA  Relative path to signed post content as a JWS or JSON post data, expected format: {config: JWS}

OPTIONS
  -b, --broadcasters=broadcasters  Colon (:) separated list of domains of Broadcaster(s) to put to instead of the
                                   defaults

  -h, --help                       show CLI help

  -r, --raw                        DATA specified is raw (not a filepath), you need to escape "

  -s, --stdin                      Use STDIN input as DATA

See code: src/commands/post/put.ts

psqr post:sign [DATA]

Parse post JSON and sign it with specified key

USAGE
  $ psqr post:sign [DATA]

ARGUMENTS
  DATA  Relative path to post file or JSON post data

OPTIONS
  -h, --help     show CLI help
  -k, --kid=kid  KID string
  -r, --raw      DATA specified is raw (not a filepath), you need to escape "
  -s, --stdin    Use STDIN input as DATA

See code: src/commands/post/sign.ts

psqr search [QUERY]

Search ElasticSearch for a specific string

USAGE
  $ psqr search [QUERY]

ARGUMENTS
  QUERY  String that you want to search

OPTIONS
  -b, --body               Return only the source body from the response object
  -h, --help               show CLI help
  -i, --indexers=indexers  Colon (:) separated list of domains of Indexer(s) to search
  -m, --nometa             Remove metainfo from the response object
  -p, --page=page          ElasticSearch page to query, defaults to 1
  -r, --raw                Output only the raw responses

See code: src/commands/search.ts

psqr setup

This utility will prompt you for the all of the necessary info to get your environment up and running.

USAGE
  $ psqr setup

OPTIONS
  -h, --help  show CLI help

DESCRIPTION
  It will set up your identity, keys, necessary networking, and any content crawling configuration you may need.

See code: src/commands/setup.ts