Require config files to be explicitly created (#1040)

The behaviour of creating the config file if it's missing while
convenient causes confusion and problems when the tools are run
in the wrong folder.  They end up creating a shadow installation
and misdirect the user with nonsensical error messages, instead
pointing to the real problem which is that the tool can't find
the configuration needed to actually run.

Require a config file to be present at startup and refuse to run if this
file is missing.  To support the odd use-case of creating the config
when missing a --create-config flag is added. To conveniently generate
a config file to edit out from the "config create" command is added.
This commit is contained in:
Hornwitser authored and GitHub committed 2026-09-15 22:16:54 +02:00
1 parent 5df5af7ca8
commit 2c52c265cf
15 files changed
+249 -75

No files matched your search

+6 -3
View File
@@ -460,9 +460,12 @@ export class Config<
return this.fromJSON(fields, location, filepath);
}
/** Saves this config to file if there are unsaved changes */
async save() {
if (!this.dirty) {
/**
* Saves this config to file if there are unsaved changes
* @param force - Set to true to save the file even if no changes have been made.
*/
async save(force = false) {
if (!force && !this.dirty) {
return;
}
if (!this.filepath) {