![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
cosmic-cli
Advanced tools
The official command line tool for Cosmic. Use it to log in to your Cosmic JS account, manage your Buckets and manage data, files and users withing your Buckets.
This is the official command line tool for Cosmic. Use it to log in to your Cosmic account, manage Buckets, data, files and users within your Buckets, all from the comfort of your command line interface.
Install the CLI globally:
npm i -g cosmic-cli
To check that it installed properly, run cosmic
on your command line and you should see a list of commands.
Let's walk through the commands you need to get started. For an introduction to the Cosmic CLI run the begin
command.
cosmic begin
Use your credentials (from https://www.cosmicjs.com) to login on the command line. You will only have to do this once. If you used GitHub to sign up, you can also login via authentication token which you can find at https://www.cosmicjs.com/account/authentication
$ cosmic login
? Email: starman@gmail.com
? Password: [hidden]
Authenticated
All Cosmic CLI commands are of the format:
cosmic [command] [options]
Now that you are logged in, you can connect to any of your Buckets on your account. To connect to the Bucket with slug 'simple-react-blog':
$ cosmic use-bucket simple-react-blog
Now using bucket simple-react-blog
To test that we connected to the Bucket properly:
$ cosmic get-objects --query '{"type":"authors"}' --limit 1
Success
{ objects:
[ { _id: '59df6dd5fd8d731b2100118d',
bucket: '59df6dcbfd8d731b21001188',
slug: 'jane-doe',
title: 'Jane Doe',
content: '<p>Something about Jane...</p>',
metafields: [Array],
type: 'authors',
created: '2017-10-12T13:27:49.663Z',
created_at: '2017-10-12T13:27:49.663Z',
status: 'published',
metadata: [Object] } ],
limit: 1 }
Now you are ready to use any of the commands to have full control over your Bucket!
Run cosmic -h
for a list of all commands. The list is also included at the bottom of this README.
Run cosmic [command] -h
for details on options for a specific command.
Below are a few examples of commands. Only a handful of the possible options are shown for the commands.
Creating an Object Type and then an Object
Creating a "Planets" Object Type and specifying default Metafields all Objects in this Object Type should have. For this example all planets will now include the Metafield titled "Radius". See the REST API docs for all Metafield options.
$ cosmic add-object-type --slug planets --title Planets --metafields '[{"title": "Radius","type":"text", "key": "radius"}]'
Making an edit to the Object Type. This example adds another Metafield to the "Planets" Object Type.
$ cosmic edit-object-type -s planets --metafields '[{"title": "Radius","type":"text", "key": "radius"},{"title": "Distance from Sun","type":"text", "key": "distance_from_sun"}]'
Creating an Object in the "Planets" Object Type:
$ cosmic add-object --type planets --title Venus --metafields '[{"title": "Radius","type":"text", "key": "radius", "value": "3,760 miles"},{"title": "Distance from Sun","type":"text", "key": "distance_from_sun", "value": "67.24 million miles"}]'
🏞 Uploading Files to a Bucket
We upload any file from our computer to Cosmic with the name provided to -t, and into a specified folder (optional).
Using shorthand params -f for --file and -t for --title
$ cosmic add-media -f ./my-cat.png -t my-cat.png --folder cat-images
Some commands allow for two types of input: argument based and json string based. This is best illustrated with an example:
To add a new barebones Object with only a title that is of Object Type planets
, there are two ways we could go about it, with equivalent results:
$ cosmic add-object --type planets --title Venus
or
$ cosmic add-object --json '{"type":"planets","title":"Venus"}'
The json string option is convenient in some use cases, and is included on the following commands:
For a list of the options for a command, use cosmic [command] -h
Guide to Getting Started
init starter app
See list of starter appsoutputs the email of the current user
outputs the slug of the current Bucket
shows Buckets available to user
read_key and write_key options required
FAQs
The official command line tool for Cosmic. Use it to log in to your Cosmic JS account, manage your Buckets and manage data, files and users withing your Buckets.
The npm package cosmic-cli receives a total of 0 weekly downloads. As such, cosmic-cli popularity was classified as not popular.
We found that cosmic-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.