Skip to content

feat: support local file path in extends (both commit-helper and commithelper-go) #82

Description

@kyungmi

Summary

@naverpay/commit-helper (Node.js) and @naverpay/commithelper-go (Go) extends only supports HTTP/HTTPS URLs. Neither implements local file path support.

Resolved in #83 (Go) and #84 (Node.js).

@naverpay/commit-helper (Node.js) supports an extends field that fetches and merges a remote config. @naverpay/commithelper-go did not implement this feature.

Resolved in #83.

Motivation

Teams with multiple repositories want to share a common .commithelperrc.json baseline (branch-prefix rules, protect lists, Jira passthrough) and override only project-specific rules locally.

Implemented Behavior

extends accepts either an HTTP/HTTPS URL or a local file path:

Remote URL:

{
    "extends": "https://raw.githubusercontent.com/my-org/.github/main/.commithelperrc.json",
    "rules": {
        "my-feature": "my-org/my-repo"
    }
}

Local file path (recommended for private registries — install shared config as a dev dependency):

{
    "extends": "./node_modules/@my-org/commithelperrc/.commithelperrc.json",
    "rules": {
        "my-feature": "my-org/my-repo"
    }
}

Merge Strategy

Field Strategy
rules base is default; local key wins on conflict
protect union (base ∪ local), deduped
passthrough union (base ∪ local), deduped
template local wins; falls back to base if unset
extends in base ignored — no recursive loading

Load failure (file not found, HTTP error, invalid JSON) is a fatal error (exit 1).

Reference

Node.js implementation: packages/commit-helper/bin/cli.tsreadExternalConfig() function

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions