feat(commithelper-go): add extends support for remote config inheritance#83
Merged
Conversation
- Add Extends field to Config struct - Add fetchExtendsConfig: fetches and parses a remote .commithelperrc.json via HTTP/HTTPS (10s timeout, non-http URLs rejected) - Add mergeConfigs: base (remote) + local merge strategy - rules: base is default, local overrides on key conflict - protect: union of base + local (deduped) - passthrough: union of base + local (deduped) - template: local wins, falls back to base - Update loadConfig to apply extends after local parse - Add extends property to schema.json - Add tests: TestMergeConfigs_*, TestFetchExtendsConfig, TestProcessMessage_WithExtends (using net/http/httptest) Closes #82
Contributor
✅ Changeset detectedLatest commit: 79f0831
If no version change is needed, please add The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
|
Added support for remote config inheritance in commithelper-go.
Contributor
Author
|
/canary-publish |
Contributor
Published Canary Packages |
dbc93b8 to
79f0831
Compare
Contributor
Author
|
/canary-publish |
Contributor
Published Canary Packages |
This was referenced Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
extendssupport to@naverpay/commithelper-go, closing the feature gap with the Node.js version (@naverpay/commit-helper).Closes #82
Motivation
Teams with multiple repositories want to maintain a single shared
.commithelperrc.json(branch-prefix rules, protect lists, Jira passthrough) in a central place and override only project-specific rules locally.Before:
After (remote URL):
{ "extends": "https://raw.githubusercontent.com/my-org/.github/main/.commithelperrc.json", "rules": { "my-feature": "my-org/my-repo" } }After (local file path — for private registries):
{ "extends": "./node_modules/@my-org/commithelperrc/.commithelperrc.json", "rules": { "my-feature": "my-org/my-repo" } }Install a shared config package as a dev dependency and reference it via local path. Works offline, versioned through
package.json, no auth required — useful when your config is hosted on a private registry.Changes
main.goConfigstruct: addExtends *stringjson:"extends,omitempty"``loadExtendsConfig(extends string) (Config, error): dispatches to HTTP fetch or local file readfetchExtendsConfig(url string) (Config, error): fetches a remote config via HTTP/HTTPShttp.ClientreadLocalConfig(filePath string) (Config, error): reads a local file pathmergeConfigs(base, local Config) Config: merge strategyloadConfig(): apply extends after local parse; nested extends are not followedschema.jsonextendsproperty (URL or local file path, no pattern restriction)main_test.goTestMergeConfigs_Rules/Protect/Passthrough/TemplateTestFetchExtendsConfig— valid fetch, 404, invalid JSON, nested extends not followedTestReadLocalConfig— valid file, missing file, invalid JSONTestLoadExtendsConfig— http dispatches to fetch, local path dispatches to readTestProcessMessage_WithExtends— end-to-end with merged configMerge strategy
rulesprotectpassthroughtemplateextendsextendsis ignored (no recursive loading)