-
Notifications
You must be signed in to change notification settings - Fork 232
feat(config): experimental worktrunk.config.* git-config project-config source #3609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
90e52a4
97b8f1f
f2dc703
f8747c6
cd88480
f022b69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2495,6 +2495,31 @@ url = "echo http://localhost:{{ branch | hash_port }}" | |||||
| Aliases defined here are shared with teammates. For personal aliases, use the [user config](@/config.md#aliases) `[aliases]` section instead. | ||||||
| <!-- PROJECT_CONFIG_END --> | ||||||
|
|
||||||
| ## Private project config in git config [experimental] | ||||||
|
|
||||||
| Project config normally lives in `.config/wt.toml`, committed and shared. Some settings are better kept private: a hook that runs a personal script, a machine-specific dev-server URL. Git config can hold these. | ||||||
|
|
||||||
| Any key under the `worktrunk.config.` prefix in git config becomes project config. Strip the prefix; what remains is the exact TOML key path from the sections above: | ||||||
|
|
||||||
| ```console | ||||||
| $ git config worktrunk.config.post-start 'pnpm install' | ||||||
| $ git config worktrunk.config.list.url 'http://localhost:3000' | ||||||
| ``` | ||||||
|
|
||||||
| `.git/config` is local to the repository and never committed, so these keys stay on one machine — and every linked worktree sees them, because the local scope lives in the shared git dir. `--global` puts a key in every repository. Git's normal precedence applies: local overrides global, and conditional includes work. | ||||||
|
|
||||||
| Selection is all-or-nothing. When any `worktrunk.config.*` key exists, those keys are the complete project config and `.config/wt.toml` is ignored — a warning names the superseded file. There is no key-level merging between the two sources. To return to the file, remove the keys. | ||||||
|
|
||||||
| Values are strings, one per key. Settings that need other TOML types (such as the `step.copy-ignored.exclude` array) cannot be expressed here. Hooks and aliases defined this way go through the same approval prompt as file-based project config. | ||||||
|
|
||||||
| Use the canonical key spellings from the sections above. Deprecated spellings may still deserialize, but git-sourced configuration does not run file migration or emit deprecation guidance — `wt config update` has nothing to rewrite here. Per-worktree git config (`extensions.worktreeConfig`) is not supported: keys are read from the shared git dir, so a `config.worktree` value is never consumed. Setting `WORKTRUNK_PROJECT_CONFIG_PATH` — even to an empty value — disables this source entirely; the override names the project config source outright. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two corrections here.
Second, git lowercases the final key component, so a user-chosen name is silently renamed:
Suggested change
|
||||||
|
|
||||||
| To list the matching git keys with their scope and origin file (inside a linked worktree this can also show worktree-scoped keys, which worktrunk does not read): | ||||||
|
|
||||||
| ```console | ||||||
| $ git config --show-scope --show-origin --get-regexp '^worktrunk\.config\.' | ||||||
| ``` | ||||||
|
|
||||||
| # Shell Integration | ||||||
|
|
||||||
| Worktrunk needs shell integration to change directories when switching worktrees. Install with: | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The two facts are stated separately but never multiplied:
--globalreaches every repository, and selection is all-or-nothing. Together they mean one global key set for convenience in one repo silently disables the committed project config — and every project hook — in all of them. The load-time warning catches it, but only after the fact.The mirrors under
docs/content/andskills/worktrunk/reference/regenerate from this.