Introducing Sage CLI: A Magic Tool for Robo.js
Tags: discord, programming, javascript, node
Published: 2023-12-12 15:00:00

> **[Robo.js](https://github.com/Wave-Play/robo.js)** is a framework for creating **[Discord.js](https://discord.js.org)** bots with ease and best practices by default.

---

We're always searching for ways to improve the developer experience. Today, we're excited to unveil `@roboplay/sage`: a shiny new tool to ease your Robo journey.

Wondering how to use it? There's no need to install it directly—just wield the mighty `npx` command, and you're good to go!

```bash
npx @roboplay/sage <command>
```

### The Import Command
Have you ever eyed a plugin and thought, "I wish I could tweak this a bit"? With the import command, you can!

This magical command allows you to import a Robo plugin's source code directly into your project. It's like the regular `robo add`, but instead of adding a node module, you get the entire codebase!

```bash
npx @roboplay/sage import @roboplay/plugin-better-stack
```

For instance, if the plugin is called `@roboplay/plugin-better-stack` on NPM, after using the import command, its contents will be available in `/src/modules/roboplay_plugin-better-stack`

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uet8wcsn3aa034mc31e0.png)

Dependencies? Sage has you covered, automatically adding any the plugin needs.

> **⚠️ Note:** Some plugins might be shy and not import correctly, especially if they aren't playing nice with best practices.

### The Export Command

Ah, the magic of sharing! Created an impressive module within your Robo project and want to bless the world with its brilliance? Say no more!

```bash
npx @roboplay/sage export roles
```

![Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lmutwsy73a040tdtt55u.png)

The spell above crafts a brand-new plugin from the `/src/modules/roles` in your project. While Sage is a wizard at fetching necessary dependencies, always keep an eye out to ensure nothing's amiss.

> **🧙‍♂️ Hint:** If you're exporting the module from `/Projects/my-robo/src/modules/roles`, you'll find the new plugin created at `/Projects/robo-plugin-roles`.

Once it's done, you'll be prompted: "Want to add <plugin> to your Robo?". This will delete the original module. *Always test the new plugin before confirming!*

### The Upgrade Command

Stay updated without the hassle. This command scans your Robo project or plugin, identifies outdated elements, and offers to bring them up-to-date with the latest Robo.js changes.

```bash
npx @roboplay/sage upgrade
```

![Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/otp15nie3rbkz24u291c.png)

> **By the way:** Remember when Robo.js transitioned its configuration system? This can make that shift truly automatic!

No more manual migrations or tedious updates – this command handles it all!

### The Doctor Command

The Doctor is in! This command checks your project's health and offers to fix any issues it finds. It can also help plugins tell you if they're set up correctly.

```bash
npx @roboplay/sage doctor
```

![Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5jqqef8kpw21xgyrz78v.png)

For more information on fixing bugs, check out the Debugging docs.

### The Why Command
Curious about the origins of a command or event in your project? Just ask "Why":

```bash
npx @roboplay/sage why /ping
```

![Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7qdqoqplx8brsxzu77jy.png)

### Safety First!

Before you dive into the magic, always safeguard your code. We recommend stashing a copy of your project, preferably with Git, to ensure you can always roll back time if needed.

### In Conclusion...
Our goal? To make your Robo.js adventure smoother, smarter, and utterly magical. With Sage CLI, we're a step closer to that dream.

Reducing the framework's package size, especially for production, is the cherry on top.

> **✨ Beginner with Robo.js?** Embark on your [grand adventure here](https://docs.roboplay.dev/docs/getting-started?ref=dev.to).