Skip to content

feat(config/modes): lay groundwork for multiple configuration structures - #142

Merged
JuanGalilea merged 4 commits into
masterfrom
feat/config-modes
Sep 22, 2026
Merged

JuanGalilea merged 4 commits into
masterfrom
feat/config-modes

Conversation

@JuanGalilea

Copy link
Copy Markdown
Contributor

Added groundwork for multiple config structures, named current one as legacy.

Adding a new one should be simple since all post-processing is done in shared code.

To add a new one you need to:

  1. add name to enum
  2. zod schema
  3. create function that resolves into flat structure
  4. profit

I still need to do some test trimming.

NOTE: load-config.test.ts is renamed actor-config.test.ts with a few additions/deletions.
Made sure both were green before getting rid of actor-config

@ruocco-l ruocco-l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

Comment thread bin/utils/config/structures/legacy.ts Outdated
.array(
z.object({
folder: z.string(),
actorFullName: z.string().regex(/^[a-z0-9_.-]+\/[a-z0-9_.-]+$/),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i had it but the code looked deranged.
I'll add them back then

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added them @ruocco-l.
It's kinda sus tho, would be great for them to expose an actorFullName regex (with ~ or /)

@metalwarrior665 metalwarrior665 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this might be a bit of overkill as the different formats will likely be very similar extensions of each other. But it is not that much code and we can refactor later.

[CONFIG_FILE_STRATEGY.LEGACY]: LEGACY_PARSER,
} as const;

const ModeSelectionSchema = z.enum(CONFIG_FILE_STRATEGY).default(CONFIG_FILE_STRATEGY.LEGACY);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How does it pick if the file satisfies multiple parsers?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

they are an enum, so it can only match one. You explicitly state the resolution method and if not, legacy is the default (which is the current method we use). That way this is backwards compatible and users can pick different methods according to what they think is more comfortable.

@JuanGalilea
JuanGalilea merged commit 7e18638 into master Sep 22, 2026
9 checks passed
@JuanGalilea
JuanGalilea deleted the feat/config-modes branch September 22, 2026 07:20
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.

4 participants