feat: secrets which prints the manifest version (EGB-700)

Completes EGB-700 — the store-format line (format: vN) shipped in v0.6.0.0;
this adds the manifest schema version to the `which` manifest header
(version N, validated == MANIFEST_VERSION by _check_manifest_file). Now a
single `secrets which` surfaces both the store format and the manifest
version for the dual-format debugging window. 1 bats test. Suite 237/237.
This commit is contained in:
Brian Majewski 2026-06-08 06:02:11 -07:00
parent eaa08e8561
commit 94ee6ec9a2
2 changed files with 12 additions and 1 deletions

View file

@ -1918,7 +1918,10 @@ cmd_which() {
local json_manifest="$PWD/$SECRETS_JSON_NAME" local json_manifest="$PWD/$SECRETS_JSON_NAME"
if [ -e "$json_manifest" ]; then if [ -e "$json_manifest" ]; then
_check_manifest_file "$json_manifest" _check_manifest_file "$json_manifest"
echo "manifest ($SECRETS_JSON_NAME at $json_manifest):" # EGB-700: surface the manifest schema version (validated == MANIFEST_VERSION
# by _check_manifest_file above) alongside the store format printed earlier.
local mver; mver=$(jq -r '.version // "?"' "$json_manifest")
echo "manifest ($SECRETS_JSON_NAME at $json_manifest, version $mver):"
local entry local entry
while IFS= read -r entry; do while IFS= read -r entry; do
[ -n "$entry" ] || continue [ -n "$entry" ] || continue

View file

@ -97,6 +97,14 @@ load test_helper
[[ "$output" == *".env"* ]] || false [[ "$output" == *".env"* ]] || false
} }
@test "which prints the manifest version (EGB-700)" {
create_project_dir manifestver
"$SECRETS_BIN" add .env >/dev/null
run "$SECRETS_BIN" which
[ "$status" -eq 0 ]
[[ "$output" == *"version 2"* ]] || false
}
@test "malformed .secrets.json dies with a directed error naming the file" { @test "malformed .secrets.json dies with a directed error naming the file" {
create_project_dir addproj create_project_dir addproj
echo '{ not json' > .secrets.json echo '{ not json' > .secrets.json