Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ repos:
rev: v0.9.3
hooks:
- id: taplo-format
exclude: /modify_.*\.toml$

- repo: https://github.com/google/yamlfmt
rev: v0.21.0
Expand Down
13 changes: 13 additions & 0 deletions chezmoi/.chezmoitemplates/memsearch_config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[embedding]
provider = "onnx"

[reranker]
model = "Alibaba-NLP/gte-reranker-modernbert-base"

[plugins.claude-code.user_profile]
enabled = true
output_file = "~/.memsearch/USER.md"

[plugins.opencode.user_profile]
enabled = true
output_file = "~/.memsearch/USER.md"
8 changes: 8 additions & 0 deletions chezmoi/private_dot_memsearch/modify_config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{- /* chezmoi:modify-template */ -}}
{{- $current := dict -}}
{{- if .chezmoi.stdin | trim -}}
{{- $current = fromToml .chezmoi.stdin -}}
{{- end -}}
{{- $template := includeTemplate "memsearch_config.toml" . | fromToml -}}
{{- $merged := mergeOverwrite $current $template -}}

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.

high

Using mergeOverwrite $current $template causes the template values ($template) to overwrite the existing local configuration ($current), which is the opposite of the intended behavior of preserving local overrides. In Sprig, mergeOverwrite gives precedence from right to left (the rightmost argument overwrites the leftmost). To preserve local overrides, you should use merge $current $template instead. In Sprig, merge gives precedence to the destination dictionary (the first argument), meaning any existing keys in $current will be preserved, and only missing keys from $template will be added.

{{- $merged := merge $current $template -}}

{{ $merged | toToml }}
Loading