Skip to content

Config files can extend a shared config (URL or npm package) #87

Closed

Description

@Shinrai

Problem

An organisation that wants the same header settings in every repository has to copy the whole options file into each one, and the copies drift. CLDMV's standard will be published as @cldmv/configs (repository CLDMV/configs) and should be the single source.

Proposal

A config file (--config <path> / configFile) may contain extends: a string or an array of strings, each one of:

  • an https URL, fetched on every run. There is no local cache: a cached copy can go stale, and the point is that every repo uses the current shared config. A failed fetch or a non-2xx response fails the run with a clear error.
  • an npm package path, e.g. @cldmv/configs/fix-headers.json, resolved from the config file's own location the way Node resolves packages (createRequire). Package exports must be honoured.
  • a relative or absolute file path, resolved from the config file's folder.

Merge rules: extended configs are applied in order, then the file's own settings on top, so the repository's file overrides what it extends. Plain objects merge key by key, while arrays and scalars replace. extends chains (a shared config extending another) work, a cycle is an error, and relative extends inside a fetched URL resolve against that URL. The CLI and the programmatic configFile option behave the same. Direct options passed on the CLI or in the API call still win over everything from files.

Tests

  • A URL served by a local test HTTP server: success, 404, invalid JSON, and a chained relative reference.
  • An npm package in a temp node_modules, with and without an exports map.
  • Relative and absolute paths, and array order.
  • Override precedence: file over extends, and CLI/API over file.
  • A cycle error, and no caching: a second run sees the server's changed content.

Activity

  1. added
    priority: high
    type: feature request
    area: core
    area: cli
    status: in progress
    status: implemented
    and removed
    status: in progress
    on Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: cliarea: corepriority: highstatus: implementedtype: feature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions