gitrepoforge: apply desired state for YAMLtecture - #151
Conversation
📝 WalkthroughWalkthroughThe ChangesVersion capture commands
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #151 +/- ##
=======================================
Coverage 77.24% 77.24%
=======================================
Files 14 14
Lines 1002 1002
=======================================
Hits 774 774
Misses 153 153
Partials 75 75 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.repver:
- Around line 26-32: Fix the malformed YAML command definitions by indenting
params, targets, git, and all nested entries beneath the name key. Apply this to
.repver lines 26-32 and lines 44-50 for both commands, keeping each command’s
fields at the same nested indentation level under its - name item.
- Line 28: Update the commit_message template to remove the literal v before
{{version}}, so values that already include the leading v are not committed with
a duplicated prefix. Keep the existing version pattern unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| params: | ||
| - name: "version" | ||
| pattern: "^v(?P<major>0|[1-9]\\d*)\\.(?P<minor>0|[1-9]\\d*)\\.(?P<patch>0|[1-9]\\d*)$" | ||
| targets: | ||
| - path: "docs/_config.yml" | ||
| pattern: "^remote_theme: just-the-docs/just-the-docs@(?P<version>.*)$" | ||
| git: |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== .repver relevant lines =="
wc -l .repver
sed -n '1,75p' .repver | nl -ba
echo "== yaml package/version references =="
rg -n "gomod|yaml|v3|viper|repver|justthedocsversion|mermaidversion" -S .
echo "== YAML struct parse/indent invariant via static indentation check =="
python3 - <<'PY'
from pathlib import Path
import re
p = Path('.repver')
text = p.read_text()
for name_label, range in [('justthedocsversion', (26,32)), ('mermaidversion', (44,50))]:
lines = text.splitlines()[range[0]-1:range[1]]
print(f"== {name_label} lines {range[0]}-{range[1]} ==")
for i,l in enumerate(lines, start=range[0]):
if not l.strip():
print(f"{i}: <empty>")
continue
leading = len(l)-len(l.lstrip(' '))
print(f"{i}: {leading}:{l!r}")
PY
echo "== parse with github.com/goccy/go-yaml if available =="
tmp="$(mktemp -d)"
cat > "$tmp/repver.go" <<'GO'
package main
import (
"fmt"
"io/ioutil"
"os"
"github.com/goccy/go-yaml"
)
func main() {
b, err := ioutil.ReadFile(".repver")
if err != nil {
fmt.Println(err); os.Exit(2)
}
var v interface{}
if err := yaml.Unmarshal(b, &v); err != nil {
fmt.Println("yaml_unmarshal_error:", err)
os.Exit(1)
}
fmt.Printf("yaml_unmarshal_ok: %T\n", v)
}
GO
cd "$tmp"
go mod init tmpparse 2>/dev/null || true
go get github.com/goccy/go-yaml@v1.17.0 >/dev/null 2>&1 || true
if [ -x "$(go env GOPATH 2>/dev/null)/bin/repver" 2>/dev/null ]; then
go run "$tmp/repver.go"
else
echo "github.com/goccy/go-yaml tool not available"
fiRepository: UnitVectorY-Labs/YAMLtecture
Length of output: 246
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== .repver total and contents =="
wc -l .repver
cat -n .repver
echo "== relevant .repver indentation =="
python3 - <<'PY'
from pathlib import Path
p = Path(".repver")
lines = p.read_text().splitlines()
for start, end in [(26,32), (44,50)]:
print(f"== range {start}-{end} ==")
for i in range(start, min(end, len(lines))+1):
if 0 < i <= len(lines):
L = lines[i-1]
leading = len(L) - len(L.lstrip(' '))
print(f"{i}: {leading}: {L!r}")
PY
echo "== repo references to repver/yaml/config format =="
rg -n "repver|\\.repver|justthedocsversion|mermaidversion|yaml\\.v3|yaml\\." -S . || trueRepository: UnitVectorY-Labs/YAMLtecture
Length of output: 4232
🌐 Web query:
gopkg.in yaml.v3 strict mapping indentation invalid YAML unmarshal block mapping error
💡 Result:
In gopkg.in/yaml.v3, the legacy UnmarshalStrict function from v2 has been removed [1][2]. To achieve strict unmarshaling—where decoding fails if the YAML contains keys that do not correspond to fields in the target Go struct—you must use the Decoder API with the KnownFields method [1][3][4]. To implement strict field checking, initialize a new Decoder with your input and call the KnownFields(true) method before invoking Decode [4]: decoder:= yaml.NewDecoder(reader) decoder.KnownFields(true) var target MyStruct err:= decoder.Decode(&target) Regarding "invalid YAML" and "indentation" errors, note that go-yaml/v3 introduced changes to how it handles indentation and formatting compared to v2 [5]. Specifically, the Encoder defaults to a different indentation style (often 4 spaces), which has been a reported source of friction [5]. If you encounter "mapping" or "indentation" errors during unmarshaling, they often stem from malformed YAML structures or inconsistencies in how the library's parser interprets nested blocks [6]. You can control the indentation of generated YAML by using the Encoder.SetIndent method, which allows you to customize the number of spaces used for indentation [7][8][4]. If you are migrating from v2 and replacing UnmarshalStrict, be aware that Decoder.Decode handles empty buffers differently than the legacy Unmarshal function (which returned nil for empty input) [2]. When using the decoder, you may need to explicitly check for io.EOF to maintain exact parity with previous behavior if your application processes empty inputs [2].
Citations:
- 1: Support for Unmarshalling strict in yaml v3 go-yaml/yaml#602
- 2: v3: Feature Request: Decoder/Encoder Options go-yaml/yaml#639
- 3: https://github.com/NVIDIA/nodewright/blob/main/operator/vendor/gopkg.in/yaml.v3/yaml.go
- 4: https://tessl.io/registry/tessl/golang-gopkg-in--yaml-v3/3.0.1/files/docs/streaming-operations.md
- 5: Update yaml.v2 to yaml.v3 lxc/incus#1960
- 6: v3 Marshal generates invalid YAML go-yaml/yaml#457
- 7: https://github.com/go-yaml/yaml/blob/v3.0.1/yaml.go
- 8: https://chromium.googlesource.com/external/github.com/go-yaml/yaml/+/refs/heads/v3/yaml.go
Indent the justthedocsversion and mermaidversion command bodies under name.
YAML lists/items share one indentation level under the parent key. In both commands, align the nested list entries and keys at the same indentation as - name; name at this indentation is parsed as an extra list item, so the command map is malformed and the YAML loader refuses it.
.repver#L26-L32: reindentparams,targets,git, and their nested entries undername..repver#L44-L50: apply the same indentation fix undername.
📍 Affects 1 file
.repver#L26-L32(this comment).repver#L44-L50
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.repver around lines 26 - 32, Fix the malformed YAML command definitions by
indenting params, targets, git, and all nested entries beneath the name key.
Apply this to .repver lines 26-32 and lines 44-50 for both commands, keeping
each command’s fields at the same nested indentation level under its - name
item.
| git: | ||
| params: | ||
| - name: "version" | ||
| pattern: "^v(?P<major>0|[1-9]\\d*)\\.(?P<minor>0|[1-9]\\d*)\\.(?P<patch>0|[1-9]\\d*)$" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== candidate files =="
git ls-files | rg '(^|/)(repver|\.repver|\.repver\.example|Makefile|go\.mod|go\.sum)$|main\.go$' || true
echo
echo "== .repver context =="
if [ -f .repver ]; then
nl -ba .repver | sed -n '1,80p'
else
echo ".repver not found"
fi
echo
echo "== search for param-version/template/version handling =="
rg -n "param-version|{{version}}|version|commit message|commit msg|Commit|Message|tag|pattern" -S . --glob '!vendor/**' --glob '!node_modules/**' || trueRepository: UnitVectorY-Labs/YAMLtecture
Length of output: 282
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== .repver context =="
awk '{printf "%6d\t%s\n", NR, $0}' .repver | sed -n '1,70p'
echo
echo "== repver/main.go refs =="
python3 - <<'PY'
import re, pathlib
for p in pathlib.Path('.').rglob('*'):
if p.is_file() and p.name in {'main.go', 'go.mod'} or p == pathlib.Path('.repver'):
print(f"-- {p}")
PY
rg -n "param-version|ParamVersion|{{version}}|version|commit|message|Tag|Pattern|Replace|Raw" -S main.go .repver go.mod go.sum || true
echo
echo "== main.go relevant sections =="
awk '{printf "%6d\t%s\n", NR, $0}' main.go | sed -n '1,240p'Repository: UnitVectorY-Labs/YAMLtecture
Length of output: 11522
🌐 Web query:
github.com/UnitVectorY-Labs/repver main.go param-version {{version}} commit_message v
💡 Result:
The repver tool is a command-line utility written in Go, developed by UnitVectorY-Labs, designed to automate the batch replacement of strings—such as version numbers—across multiple files within a Git repository [1][2][3]. Regarding your query about parameters and commit messages: 1. Parameter Passing: The --param-{name}={value} flag is used to pass values to the command defined in your.repver configuration file [1][4]. For example, if you have a parameter named "version" defined in your config, you would pass its value using --param-version={value} [2][5]. 2. Placeholder Syntax: The Git configuration settings within your.repver file, such as commit_message and branch_name, support placeholders in the format {{name}} to dynamically include the values passed via the command line [6][7]. For instance, if you define a commit_message as "Update version to {{version}}" in your configuration, and run the command with --param-version=1.2.3, the resulting commit message will be "Update version to 1.2.3" [6][7]. In summary, you do not pass the commit message directly as a flag to the repver binary; instead, you define the template for the commit message in your.repver configuration file using the {{parameter_name}} syntax, and repver populates it based on the parameter values you provide at runtime [4][8][6].
Citations:
- 1: https://github.com/UnitVectorY-Labs/repver
- 2: https://guide.unitvectorylabs.com/uvyutilities/repver/
- 3: https://repver.unitvectorylabs.com/
- 4: https://repver.unitvectorylabs.com/command
- 5: https://repver.unitvectorylabs.com/examples
- 6: https://github.com/UnitVectorY-Labs/repver/blob/main/docs/CONFIGURATION.md
- 7: https://github.com/UnitVectorY-Labs/repver/blob/main/docs/EXAMPLES.md
- 8: https://repver.unitvectorylabs.com/configuration
🌐 Web query:
UnitVectorY-Labs repver commit_message v{{version}} param-version pattern
💡 Result:
In the context of the UnitVectorY-Labs repver tool, the components you referenced are part of the repository configuration system used to automate version updates and Git operations [1][2]. repver (short for replace version) is a command-line tool that automates the batch replacement of strings, such as version numbers, across multiple files in a Git repository [2][3]. It relies on a.repver file in the root of the repository to define its behavior [1][2]. The components function as follows: commit_message: This is a configuration attribute within the git section of the.repver file [4]. It defines the commit message to be used when repver automatically commits changes [4][5]. It supports placeholders, such as {{version}}, which are dynamically replaced with the version value provided during execution [4][1]. v{{version}} and param-version: When running the repver command, you use the --param-{name}={value} argument to pass values to the configuration [1][2]. For example, if you define a parameter named version in your.repver file, you invoke it via --param-version=1.23.4 [2]. The {{version}} syntax is then used within the configuration (e.g., in commit_message or branch_name) to inject that provided value [4][1][5]. The v prefix is a common convention used in these strings, such as in commit_message: "Update Go version to v{{version}}" [6][7]. pattern: This refers to the regular expression defined within the params or targets sections of the.repver file [4][2]. In the params section, it defines the regex required to validate the input parameter (e.g., ^(?P0|[1-9]\d*).(?P0|[1-9]\d*).(?P0|[1-9]\d*)$) [4][1]. In the targets section, it defines the regex used to match lines in the files you wish to update [1][2]. Capture groups within these patterns are named, and those names are used as parameters or transformed to update file content [1][2].
Citations:
- 1: https://github.com/UnitVectorY-Labs/repver
- 2: https://guide.unitvectorylabs.com/uvyutilities/repver/
- 3: https://github.com/UnitVectorY-Labs/repver/blob/main/docs/README.md
- 4: https://github.com/UnitVectorY-Labs/repver/blob/main/docs/CONFIGURATION.md
- 5: https://github.com/UnitVectorY-Labs/repver/blob/main/docs/EXAMPLES.md
- 6: https://github.com/UnitVectorY-Labs/remventory/blob/main/.repver
- 7: https://github.com/UnitVectorY-Labs/mcp-rest-forge/blob/v0.1.0/.repver
🌐 Web query:
UnitVectorY-Labs repver main.go commit message template
💡 Result:
There is no fixed or hardcoded "commit message template" within the main.go file of the UnitVectorY-Labs/repver repository [1]. Instead, repver uses a flexible, user-defined configuration system where the commit message is specified by the user within a.repver YAML configuration file [2][3]. In your.repver file, you define the commit message using the commit_message attribute under the git section [2]. This field supports placeholders based on your defined parameters, which are extracted from matched patterns in your files [2][1]. For example, if you have a parameter named version defined in your command, you can use the {{version}} placeholder in your commit message template [2][4]: git: create_branch: true branch_name: "repver/update-v{{version}}" commit: true commit_message: "Update version to {{version}}" push: true remote: "origin" pull_request: "GITHUB_CLI" The main.go file is responsible for parsing this configuration and executing the associated Git operations, but it does not impose a specific template or format for the commit messages themselves [5][2].
Citations:
- 1: https://github.com/UnitVectorY-Labs/repver
- 2: https://github.com/UnitVectorY-Labs/repver/blob/main/docs/CONFIGURATION.md
- 3: https://guide.unitvectorylabs.com/uvyutilities/repver/
- 4: https://github.com/UnitVectorY-Labs/repver/blob/main/docs/EXAMPLES.md
- 5: Add --exists mode for command discovery repver#26
🌐 Web query:
site:github.com/UnitVectorY-Labs/repver replace parameter template raw --param-
💡 Result:
The syntax --param- is used in the repver tool, which is a utility for managing version replacements across files in a Git repository [1][2]. When executing a command using repver, you use the --param-= flag to pass parameters that correspond to named regex capture groups defined in your.repver configuration file [3][1]. Key details include: - Parameters: The in --param- must match a name defined in your command's params section or a named capture group in your regex patterns [3][4]. - Functionality: These parameters allow you to dynamically replace values in files [4][5]. If a transform attribute is defined in your configuration, the tool can use these parameters (or their extracted components, such as major/minor/patch versions) to generate formatted replacement strings [4][5]. - Execution: A typical command execution looks like this [6][1]: repver --command=<command_name> --param-version=1.2.3 If you do not specify a transform in your configuration, the raw parameter value passed via the command line is used directly for replacement [4].
Citations:
- 1: https://github.com/UnitVectorY-Labs/repver
- 2: https://github.com/UnitVectorY-Labs/repver/blob/main/README.md
- 3: https://github.com/UnitVectorY-Labs/repver/blob/main/docs/COMMAND.md
- 4: https://github.com/UnitVectorY-Labs/repver/blob/main/docs/CONFIGURATION.md
- 5: Add params and transform for flexible version replacement repver#37
- 6: https://github.com/UnitVectorY-Labs/repver/blob/main/docs/EXAMPLES.md
🌐 Web query:
site:github.com/UnitVectorY-Labs/repver replace parameter raw commit message {{
💡 Result:
The placeholder syntax {{parameter_name}} used for commit messages is a feature of the repver tool, which is used to automate batch file replacements and associated Git operations (such as committing and pushing) [1][2]. In repver, you define your Git operations within a .repver configuration file [2][3]. When configuring the commit_message attribute under the git section, you can include {{parameter_name}} placeholders [1]. These placeholders are dynamically replaced with the values provided via command-line arguments (e.g., --param-{parameter_name}={value}) when the repver command is executed [2][4]. For example, if your .repver file contains: git: commit: true commit_message: "Update version to {{version}}" And you run the command: repver --command=mycommand --param-version=1.2.0 The tool will replace {{version}} with 1.2.0, resulting in a commit message of "Update version to 1.2.0" [1][5].
Citations:
- 1: https://github.com/UnitVectorY-Labs/repver/blob/main/docs/CONFIGURATION.md
- 2: https://github.com/UnitVectorY-Labs/repver
- 3: https://github.com/UnitVectorY-Labs/repver/blob/main/docs/COMMAND.md
- 4: https://github.com/UnitVectorY-Labs/repver/blob/main/README.md
- 5: https://github.com/UnitVectorY-Labs/repver/blob/main/docs/EXAMPLES.md
🌐 Web query:
site:github.com/UnitVectorY-Labs/repver "raw parameter value" "commit_message"
💡 Result:
In the context of the repver tool, the raw parameter value refers to the user-provided input value for a defined parameter that has not been modified or transformed [1]. When defining a command in the.repver configuration file, you can specify parameters that extract values from input (e.g., via regex capture groups) [2][3]. These parameters can optionally include a transform attribute to modify the raw value before it is used [1][4]. If no transform attribute is specified for a parameter, the raw parameter value is used directly in operations, such as constructing a commit_message [1]. For example, if you define a commit_message like "Update version to {{version}}" and provide the parameter --param-version=1.2.3, "1.2.3" is the raw parameter value. If a transform were applied (e.g., to extract only the major and minor versions), the transformed value would be used instead [1][3].
Citations:
- 1: https://github.com/UnitVectorY-Labs/repver/blob/main/docs/CONFIGURATION.md
- 2: https://github.com/UnitVectorY-Labs/repver/blob/main/docs/COMMAND.md
- 3: https://github.com/UnitVectorY-Labs/repver
- 4: https://github.com/UnitVectorY-Labs/repver/blob/main/docs/EXAMPLES.md
Remove the duplicated v prefix from the commit message.
{{version}} is replaced with the parameter value, and this command requires version to include the leading v. With commit_message: "Update just-the-docs version to v{{version}}", a passed value such as v0.13.0 produces vv0.13.0. Remove the literal v on line 36.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.repver at line 28, Update the commit_message template to remove the literal
v before {{version}}, so values that already include the leading v are not
committed with a duplicated prefix. Keep the existing version pattern unchanged.
Summary by CodeRabbit
v-prefixed versions where applicable.