Skip to content

Add RC format support to updateConfig#293

Draft
Copilot wants to merge 6 commits intomainfrom
copilot/add-rc-format-support
Draft

Add RC format support to updateConfig#293
Copilot wants to merge 6 commits intomainfrom
copilot/add-rc-format-support

Conversation

Copy link

Copilot AI commented Jan 23, 2026

Users need to update RC config files programmatically, but updateConfig only supports JS/TS/JSON formats.

Changes

  • New utility: updateConfigRC exposes rc9's update functionality
    • Updates RC files in specified/current directory
  • Auto-flattening: Nested objects automatically flatten to RC's dotted key format
  • Directory creation: Ensures target directory exists before writing

Usage

import { updateConfigRC } from "c12/update";

// Update project RC config
await updateConfigRC({
  name: ".myapprc",
  dir: process.cwd(),
  onUpdate: (config) => {
    config.database = { host: "localhost", port: 5432 };
  },
});

RC files use simple key-value format with automatic nesting:

database.host="localhost"
database.port=5432
Original prompt

This section details on the original issue you should resolve

<issue_title>Add rc format support to updateConfig</issue_title>
<issue_description>### Describe the feature

I'd like to standardize our config files to use the rc format, but the current bottleneck is that updateConfig doesn't support rc files.
I think it wouldn't be too difficult to add stable support for rc format to updateConfig using rc9. What do you think about adding this feature? If it sounds reasonable, I'd be happy to contribute this myself.

Additional information

  • Would you be willing to help implement this feature?</issue_description>

<agent_instructions>read current updateConfig and https://github.com/unjs/rc9 docs.

  • Add new utility to c12/update
  • Add JSDocs
  • Update readme
  • Add unit tests</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@pi0 Hi. You can use [rc9](https://github.com/unjs/rc9) to do this. We can also expose `updateConfigRC` utility from c12 that uses same.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 23, 2026 09:43
…cumentation

Co-authored-by: pi0 <5158436+pi0@users.noreply.github.com>
Co-authored-by: pi0 <5158436+pi0@users.noreply.github.com>
Co-authored-by: pi0 <5158436+pi0@users.noreply.github.com>
src/update.ts Outdated
* });
* ```
*/
export async function updateConfigUserRC(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot we don't need userRC utils

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed updateConfigUserRC and related code (function, interface, tests, and documentation) in 61015c4.

Co-authored-by: pi0 <5158436+pi0@users.noreply.github.com>
Copilot AI changed the title [WIP] Add rc format support to updateConfig Add RC format support to updateConfig Jan 23, 2026
Copilot AI requested a review from pi0 January 23, 2026 09:50
Co-authored-by: pi0 <5158436+pi0@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add rc format support to updateConfig

2 participants