# Welcome

Saffron is a tool for building robust, configurable command-line interfaces for Node applications. It is an integration between [Yargs](https://github.com/yargs/yargs) and [Cosmiconfig](https://github.com/davidtheclark/cosmiconfig), two best-in-class tools for creating CLIs and working with configuration files, respectively.

{% hint style="info" %}
General familiarity with Yargs and Cosmiconfig is recommended (but not required) before using Saffron.
{% endhint %}

## Rationale

[Yargs](https://github.com/yargs/yargs) is undeniably one of the best command-line argument parsers in the Node ecosystem. However, its API has grown tremendously over the years to support the myriad idiosyncratic use-cases of its users while maintaining backward compatibility, leading to bloat. And while it *does* have limited support for loading configuration files, it only supports files in the JSON format.

Saffron focuses on the most flexible, robust Yargs API: the [command module API](https://github.com/yargs/yargs/blob/master/docs/api.md#commandmodule), which supports every Yargs use-case while only involving a single method from the Yargs API: `.command()`.

[Cosmiconfig](https://github.com/davidtheclark/cosmiconfig) is an extremely powerful and configurable utility for adding support for configuration files to an application in several different formats, allowing the end-users of your application to choose between JSON, YAML, and JavaScript-based configuration files with a single tool.

Saffron aims to integrate these two tools, solving for many common cases and applying sensible defaults where possible, making it easy to create robust, self-documenting CLIs that deliver excellent user experiences in as few lines of code as possible.

If you've used tools like Vite, Webpack, ESLint, or TypeScript, then you are already familiar with the CLI + configuration file application architecture that Saffron is designed for. With Saffron, the aim is to deliver parsed command-line arguments and configuration data to your app with as little effort as possible so you can focus on building an amazing application. ✨


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://darkobits.gitbook.io/saffron/welcome.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
