Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,25 @@ mycoder --githubMode "Work with GitHub issues and PRs"

## Configuration

MyCoder is configured using a `mycoder.config.js` file in your project root, similar to ESLint and other modern JavaScript tools. This file exports a configuration object with your preferred settings.
MyCoder is configured using a configuration file in your project. MyCoder supports multiple configuration file locations and formats, similar to ESLint and other modern JavaScript tools.

### Configuration File Locations

MyCoder will look for configuration in the following locations (in order of precedence):

1. `mycoder.config.js` in your project root
2. `.mycoder.config.js` in your project root
3. `.config/mycoder.js` in your project root
4. `.mycoder.rc` in your project root
5. `.mycoder.rc` in your home directory
6. `mycoder` field in `package.json`
7. `~/.config/mycoder/config.js` (XDG standard user configuration)

Multiple file extensions are supported: `.js`, `.ts`, `.mjs`, `.cjs`, `.json`, `.jsonc`, `.json5`, `.yaml`, `.yml`, and `.toml`.

### Creating a Configuration File

Create a `mycoder.config.js` file in your project root:
Create a configuration file in your preferred location:

```js
// mycoder.config.js
Expand Down
16 changes: 14 additions & 2 deletions packages/docs/docs/usage/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,21 @@ export default {
};
```

## Configuration File Location
## Configuration File Locations

The `mycoder.config.js` file should be placed in the root directory of your project. MyCoder will automatically detect and use this file when run from within the project directory or any of its subdirectories.
MyCoder uses the [c12](https://github.com/unjs/c12) library to load configuration files, which supports multiple file locations and formats. Configuration files are searched in the following order:

1. `mycoder.config.js` (or other supported extensions) in the project root directory
2. `.mycoder.config.js` (or other supported extensions) in the project root directory
3. `.config/mycoder.js` (or other supported extensions) in the project root directory
4. `.mycoder.rc` in the project root directory
5. `.mycoder.rc` in the user's home directory (global configuration)
6. Configuration from the `mycoder` field in `package.json`
7. `~/.config/mycoder/config.js` (XDG standard user configuration)

Supported file extensions include `.js`, `.ts`, `.mjs`, `.cjs`, `.json`, `.jsonc`, `.json5`, `.yaml`, `.yml`, and `.toml`.

MyCoder will automatically detect and use these configuration files when run from within the project directory or any of its subdirectories.

## Overriding Configuration

Expand Down
Loading