Codehooks CLI tool
Command line interface (CLI) for codehooks.io. (NPM)
Version: 1.0.11
The CLI lets you manage projects and spaces/instances (serverless functions + datastore + settings) from the command line.
Popular commands
- Show project information, API keys etc.:
coho info
- Create a new Space:
coho add myspace
- Invite a developer to the project:
coho invite [email protected] myproject
- Deployment you app to the serverless cloud:
coho deploy
- See what's going on with real time logs:
coho logs -f
- Query a Space / datastore:
coho query --collection products --query type=soft
Install
$ npm i codehooks -g
Usage
$ codehooks --help
Help output:
codehooks <command>
Commands:
codehooks admin Open the codehooks.io admin account UI at account.codehooks.io
codehooks docs Open the codehooks.io documentation
codehooks login [provider] Authenticate CLI - sign up and/or sign in
codehooks logout Log out of the CLI
codehooks account Show info about account, projects and invitations
codehooks invite [email] [projectname] Invite user to project
codehooks join [projectname] Join project
codehooks leave [projectname] Leave project
codehooks create [projectname] [teamid] [description] Create and initialize a new codehooks project [aliases: init]
codehooks add [space] [projectname] [restricted] Add new space to project
codehooks use [name] Set active space
codehooks info [projectname] [space] Show info about project and spaces
codehooks verify [dir] Compile code (defaults to current dir) [aliases: compile, ver, comp]
codehooks deploy Deploys current codehook folder [aliases: de, dep]
codehooks undeploy Undeploy current codehook folder [aliases: unde, undep]
codehooks log [space] [tail] [follow] [context] Show system logs for a space. [aliases: logs]
codehooks count [collection] [space] Count objects in a collection in current space [aliases: co]
codehooks query [collection] [query] [space] Run query on collection in current space [aliases: q]
codehooks createindex [collection] [index] [space] Add field(s) to a query index [aliases: idx]
codehooks removeindex [collection] [index] [space] Remove field(s) from a query index
codehooks get [key] [keyspace] [space] [json] Retrieve key-value pair(s) from a space
codehooks set [key] [val] Set key-value pair in a space
codehooks del [key] [keyspace] [space] [json] Delete key-value pair in a space
codehooks collection [project] [output] Show collections for space [aliases: coll, col, ls]
codehooks import [filepath] [collection] [project] [space] [dryrun] Import JSON or CSV data from file [aliases: imp]
codehooks export [collection] [project] [space] Export JSON or CSV data
codehooks add-token [readonly] Add token to space
codehooks remove-token [token] Remove token from space
codehooks set-env [key] [value] [encrypted] Set environment variable for space
codehooks remove-env [key] Remove environment variable from space
codehooks jwks [url] Set/replace JWKS endpoint for OAuth2 authentication. Set to "" (empty string) to remove.
codehooks whitelist [ip] Add host to whitelist (use to restrict space access)
codehooks whitelist-remove [ip] Remove host from whitelist
codehooks completion Generate command completion script. Just add this to your .bashrc, .bash_profile, .zshrc (or similar) on *nix machines
codehooks remove-project [projectname] Remove the project
codehooks remove-space [space] [projectname] Remove space and data
codehooks admintokens Show active admintokens for account or team
codehooks add-admintoken Add admin token to account or team (for use with CI)
codehooks remove-admintoken Remove admin token from account or team
codehooks localserver [port] Run a local development server. Provides a local (JSON) database for test purposes [aliases: serve, run, demo]
Options:
-d, --debug show debug (verbose) information
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
No project active in this folder! Use 'coho create' or 'codehooks create' to create a new project.
created by Codehooks AS - [email protected]
*****DEVELOPMENT*****
Available commands
- admin
- docs
- login
- logout
- account
- invite
- join
- leave
- create
- add
- use
- info
- verify
- deploy
- undeploy
- log
- count
- query
- createindex
- removeindex
- get
- set
- del
- collection
- import
- export
- add-token
- remove-token
- set-env
- remove-env
- jwks
- whitelist
- whitelist-remove
- completion
- remove-project
- remove-space
- admintokens
- add-admintoken
- remove-admintoken
- localserver
admin
$ codehooks admin --help
Help output:
codehooks admin
Open the codehooks.io admin account UI at account.codehooks.io
Options:
-d, --debug show debug (verbose) information
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
docs
$ codehooks docs --help
Help output:
codehooks docs
Open the codehooks.io documentation
Options:
-d, --debug show debug (verbose) information
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
login
$ codehooks login --help
Help output:
codehooks login [provider]
Authenticate CLI - sign up and/or sign in
Options:
-d, --debug show debug (verbose) information
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
logout
$ codehooks logout --help
Help output:
codehooks logout
Log out of the CLI
Options:
-d, --debug show debug (verbose) information
--dir [default: "."]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
account
$ codehooks account --help
Help output:
codehooks account
Show info about account, projects and invitations
Options:
-d, --debug show debug (verbose) information
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
invite
$ codehooks invite --help
Help output:
codehooks invite [email] [projectname]
Invite user to project
Options:
-d, --debug show debug (verbose) information
--projectname Project name [required]
-t, --email [string] [required]
--role [string] [default: "ADMIN"]
--remove remove invitation [boolean]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
join
$ codehooks join --help
Help output:
codehooks join [projectname]
Join project
Options:
-d, --debug show debug (verbose) information
--projectname Project name [required]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
leave
$ codehooks leave --help
Help output:
codehooks leave [projectname]
Leave project
Options:
-d, --debug show debug (verbose) information
--projectname Project name [required]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
create
$ codehooks create --help
Help output:
codehooks create [projectname] [teamid] [description]
Create and initialize a new codehooks project
Options:
-d, --debug show debug (verbose) information
--description A few words about this project
-n, --projectname Project name
-t, --teamid Add project to team with this id
-g, --ga-deploy Add Github Action for automatic deploy [boolean]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
add
$ codehooks add --help
Help output:
codehooks add [space] [projectname] [restricted]
Add new space to project
Options:
-d, --debug show debug (verbose) information
--projectname [required]
-n, --space space name [required]
--restricted only team admins or owner can use if restricted [boolean]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
use
$ codehooks use --help
Help output:
codehooks use [name]
Set active space
Options:
-d, --debug show debug (verbose) information
--projectname [required]
-n, --name
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
info
$ codehooks info --help
Help output:
codehooks info [projectname] [space]
Show info about project and spaces
Options:
-d, --debug show debug (verbose) information
--projectname Active project [required]
--json Output info as JSON (not table) [boolean]
--space Only show info for this space [string]
--examples Include cURL examples [boolean]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
verify
$ codehooks verify --help
Help output:
codehooks verify [dir]
Compile code (defaults to current dir)
Options:
-d, --debug show debug (verbose) information
--dir [default: "."]
--space Select which space to access
-p, --projectname Select which project name to use
--admintoken Use admin token authentication (use for CI)
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
deploy
$ codehooks deploy --help
Help output:
codehooks deploy
Deploys current codehook folder
Options:
-d, --debug show debug (verbose) information
--dir [default: "."]
-s, --space Select which space to access
-p, --projectname Select which project name to use
--history Show deployment history
--rollback Undo last deployment, set previous as active
--json Output JSON format
--admintoken Use admin token authentication (use for CI)
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
undeploy
$ codehooks undeploy --help
Help output:
codehooks undeploy
Undeploy current codehook folder
Options:
-d, --debug show debug (verbose) information
--dir [default: "."]
-s, --space Select which space to access
-p, --projectname Select which project name to use
--json Output JSON format
--admintoken Use admin token authentication (use for CI)
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
log
$ codehooks log --help
Help output:
codehooks log [space] [tail] [follow] [context]
Show system logs for a space.
Options:
-d, --debug show debug (verbose) information
-p, --project Select which project name to use
-s, --space Select which space to log
-t, --tail Chop log to n lines [default: 100]
-f, --follow Keep log stream open
-c, --context Filter log on: jobhooks, queuehooks, routehooks, datahooks, auth
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
Examples:
codehooks log
codehooks log -f
codehooks coho log --tail 10
coho log --project 'pets-ff00' --space prod
count
$ codehooks count --help
Help output:
codehooks count [collection] [space]
Count objects in a collection in current space
Options:
-d, --debug show debug (verbose) information
-p, --project Select which project to query
-s, --space Select which space to query
-c, --collection Collection name [required]
--table Output info as table (not JSON) [boolean]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
query
$ codehooks query --help
Help output:
codehooks query [collection] [query] [space]
Run query on collection in current space
Options:
-d, --debug show debug (verbose) information
-p, --project Select which project to query
-s, --space Select which space to query
-q, --query Limit selection with a query expression [default: ""]
-n, --count Count query results
-c, --collection Collection name [required]
--delete Delete all items from query result
--update Patch all items from query result with JSON string '{...}' [string]
--replace Replace all items from query result with JSON string '{...}' [string]
--useindex Use an indexed field to scan data in query [string]
--start Start value for index scan [string]
--end End value for index scan [string]
--limit Limit query result [number]
--fields Comma separated list of fields to include [string]
--offset Skip items before returning data in query result [number]
--enqueue Add query result to queue topic [string]
--pretty Output data with formatting and colors
--reverse Scan index in reverse order
--table Output data as formatted table (not JSON) [boolean]
--csv Output data in CSV format [boolean]
--admintoken Use admin token authentication (use for CI)
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
Examples:
codehooks query --collection pets --query 'name=Polly&type=Parrot'
codehooks query --collection pets --query 'name=/^po/'
codehooks query pets 'name=Polly' --useindex name --fields 'name,type'
codehooks q pets 'name=Polly&type=Parrot' --update '{"name": "Zilla"}'
codehooks q pets 'type=Fish' --delete
codehooks q pets 'type=Snake' --enqueue 'mytopic'
createindex
$ codehooks createindex --help
Help output:
codehooks createindex [collection] [index] [space]
Add field(s) to a query index
Options:
-d, --debug show debug (verbose) information
-p, --project Select which project to use
-s, --space Select which space to use
-c, --collection Collection with indexes [required]
-i, --index Field to index [required]
--admintoken Use admin token authentication (use for CI)
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
Examples:
codehooks createindex --collection pets --index name
codehooks idx pets name
codehooks idx pets -i name -i type -i 'price-in-dollar'
removeindex
$ codehooks removeindex --help
Help output:
codehooks removeindex [collection] [index] [space]
Remove field(s) from a query index
Options:
-d, --debug show debug (verbose) information
-p, --project Select which project to use
-s, --space Select which space to use
-c, --collection Collection with indexes [required]
-i, --index Field to remove index for [required]
--admintoken Use admin token authentication (use for CI)
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
Examples:
codehooks removeindex pets name
codehooks removeindex --collection pets --index 'name' --index 'type'
get
$ codehooks get --help
Help output:
codehooks get [key] [keyspace] [space] [json]
Retrieve key-value pair(s) from a space
Options:
-d, --debug show debug (verbose) information
-p, --project Select which project to use
-s, --space Select which space to query
-k, --key Key to match, or key* to fetch list [default: "*"]
--keyspace Keyspace to scan
--text Output info as text line [boolean]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
Examples:
codehooks get 'my-value-one'
codehooks get 'my*'
codehooks get '*' --keyspace spacex
set
$ codehooks set --help
Help output:
codehooks set [key] [val]
Set key-value pair in a space
Options:
-d, --debug show debug (verbose) information
-p, --project Select which project to use [string]
-s, --space Select which space to use [string]
--key Key to set [string] [required]
--val Value to set [string] [required]
--keyspace Keyspace to use [string]
--ttl Time to live in millis for value [number]
--json Output info as JSON (not table) [boolean]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
Examples:
codehooks set 'my-value-one' 'foo'
codehooks set 'my-value-two' 'bar'
codehooks set 'session-4f51-9bed' 'OK' --keyspace 'spacex' --ttl 60000
del
$ codehooks del --help
Help output:
codehooks del [key] [keyspace] [space] [json]
Delete key-value pair in a space
Options:
-d, --debug show debug (verbose) information
-p, --project Select which project to use
-s, --space Select which space to use
--key Key to delete [required]
--keyspace Keyspace to use
--json Output info as JSON (not table) [boolean]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
Examples:
codehooks del 'my-value-one'
codehooks del 'my-value-two' --keyspace 'spacex'
collection
$ codehooks collection --help
Help output:
codehooks collection [project] [output]
Show collections for space
Options:
-d, --debug show debug (verbose) information
-p, --project Select which project to query
-s, --space Select which space to query
--json JSON output format
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
import
$ codehooks import --help
Help output:
codehooks import [filepath] [collection] [project] [space] [dryrun]
Import JSON or CSV data from file
Options:
-d, --debug show debug (verbose) information
-p, --project Project name [string] [required]
-s, --space A space in your project [string]
-c, --collection A collection in a Space [string] [required]
-f, --filepath File to import [string] [required]
--separator Field separator character, default is ',', also normal with '\t' or ';' [string] [default: ","]
--dryrun Test only, will not import any data [boolean] [default: false]
--rowcount Add a row count field to each imported record [boolean] [default: false]
--admintoken Use admin token authentication (use for CI)
--local Import data to local development server on port parameter [number]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
Examples:
# shorthand
codehooks import ./myfile.csv mycollection
# explicit parameters
codehooks import --filepath ./myfile.csv --collection mycollection
# parameter shortcuts
codehooks import -f ./myfile.csv -c mycollection --local 3000
# Import data to local dev database
codehooks import -f ./myfile.csv -c mycollection --local 3000
export
$ codehooks export --help
Help output:
codehooks export [collection] [project] [space]
Export JSON or CSV data
Options:
-d, --debug show debug (verbose) information
-p, --project Project name [string] [required]
-s, --space a space name in your project [string]
--collection A collection in the space [string] [required]
-f, --filepath Filename to save export data [string]
--csv Export to CSV [boolean]
--admintoken Use admin token authentication (use for CI)
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
add-token
$ codehooks add-token --help
Help output:
codehooks add-token [readonly]
Add token to space
Options:
-d, --debug show debug (verbose) information
--projectname Project name [required]
--space A space in your project [required]
--readonly [boolean] [default: false]
--description [string] [default: ""]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
remove-token
$ codehooks remove-token --help
Help output:
codehooks remove-token [token]
Remove token from space
Options:
-d, --debug show debug (verbose) information
--projectname Project name [required]
--space A space in your project [required]
-t, --token [string] [required]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
set-env
$ codehooks set-env --help
Help output:
codehooks set-env [key] [value] [encrypted]
Set environment variable for space
Options:
-d, --debug show debug (verbose) information
--projectname Project name [required]
--space A space in your project [required]
--encrypted [boolean] [default: false]
--key [string] [required]
--value [string] [required]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
remove-env
$ codehooks remove-env --help
Help output:
codehooks remove-env [key]
Remove environment variable from space
Options:
-d, --debug show debug (verbose) information
--projectname Project name [required]
--space A space in your project [required]
-k, --key [string] [required]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
jwks
$ codehooks jwks --help
Help output:
codehooks jwks [url]
Set/replace JWKS endpoint for OAuth2 authentication. Set to "" (empty string) to remove.
Options:
-d, --debug show debug (verbose) information
--projectname Project name [required]
--space A space in your project [required]
--url URL of JWKS endpoint (must be https) [string] [required]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
whitelist
$ codehooks whitelist --help
Help output:
codehooks whitelist [ip]
Add host to whitelist (use to restrict space access)
Options:
-d, --debug show debug (verbose) information
--projectname Project name [required]
--space A space in your project [required]
--ip IP address which should be allowed access to space [string] [required]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
whitelist-remove
$ codehooks whitelist-remove --help
Help output:
codehooks whitelist-remove [ip]
Remove host from whitelist
Options:
-d, --debug show debug (verbose) information
--projectname Project name [required]
--space A space in your project [required]
--ip The IP address to remove from the whitelist. [required]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
completion
$ codehooks completion --help
Help output:
codehooks completion
Generate command completion script. Just add this to your .bashrc, .bash_profile, .zshrc (or similar) on *nix machines
Options:
-d, --debug show debug (verbose) information
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
remove-project
$ codehooks remove-project --help
Help output:
codehooks remove-project [projectname]
Remove the project
Options:
-d, --debug show debug (verbose) information
-p, --projectname Project name [string] [required]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
remove-space
$ codehooks remove-space --help
Help output:
codehooks remove-space [space] [projectname]
Remove space and data
Options:
-d, --debug show debug (verbose) information
--projectname Project name
--space A space in your project [required]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
admintokens
$ codehooks admintokens --help
Help output:
codehooks admintokens
Show active admintokens for account or team
Options:
-d, --debug show debug (verbose) information
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
add-admintoken
$ codehooks add-admintoken --help
Help output:
codehooks add-admintoken
Add admin token to account or team (for use with CI)
Options:
-d, --debug show debug (verbose) information
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
remove-admintoken
$ codehooks remove-admintoken --help
Help output:
codehooks remove-admintoken
Remove admin token from account or team
Options:
-d, --debug show debug (verbose) information
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
localserver
$ codehooks localserver --help
Help output:
codehooks localserver [port]
Run a local development server. Provides a local (JSON) database for test purposes.
Options:
-d, --debug show debug (verbose) information
-p, --port Listen on network port [number] [default: 3000]
-a, --auth Enable API key/JWKS for authentication [boolean] [default: false]
--apikey API key for client authentication, use when --auth is enabled [string] [default: "1234"]
--jwks JWKS endpoint, use when --auth is enabled [string]
--https Start server with https protocol enabled, using a self signed certificate [boolean]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
Examples:
codehooks localserver
codehooks localserver --port 3000
codehooks localserver -p 3000 --auth --apikey 'secret-token'
codehooks localserver -p 8443 --https
codehooks localserver -p 3000 --auth --jwks 'https://<insert tenant name>.auth0.com/.well-known/jwks.json'
nodemon -w . -x 'codehooks localserver -p 3000'
License
MIT.