Skip to content

Adding vars clone for remote repo's - #9

Merged
brickpop merged 1 commit into
mainfrom
f/vars-clone
Jun 21, 2026
Merged

Adding vars clone for remote repo's#9
brickpop merged 1 commit into
mainfrom
f/vars-clone

Conversation

@brickpop

Copy link
Copy Markdown
Collaborator

Added

  • vars clone <remote> clones an existing store from a git remote into your local store directory (e.g. to set up from a store you already pushed), instead of creating a fresh, divergent one. It replaces an empty local store but refuses to overwrite one that holds secrets, locks the store directory to 0700, and reports whether the SSH key the store is encrypted to is available (that key may differ from the one that authenticated the clone). git clone sets origin, so vars sync works immediately.

Changed

  • Writing to a store self-heals its static scaffolding: a missing README.md, .gitignore, or .gitattributes is recreated on the next write (a deleted .gitignore re-arms the default-deny allowlist before secrets are committed). Existing files are never overwritten. The scaffold now has a single source of truth in the vault package, shared by store creation and writes.
  • vars ls <arg> accepts only a scope.
  • Concurrent mutations are serialized by an advisory file lock (flock on a gitignored .vars.lock), so two simultaneous writes no longer race the git index, and a rename can't clobber a concurrently created key. The lock auto-releases if the process dies; it's a no-op on platforms without flock (vars targets Unix).
  • Key names are restricted to [A-Za-z0-9_-] segments separated by /. This rejects accents and other non-ASCII (which collide across machines under Unicode normalization), control characters, and path-traversal, keeping keys portable and predictable.

Fixed

  • vars set treated an existing key whose value can't be decrypted (corrupt or foreign file, or the wrong key loaded) as a brand-new key: --skip would overwrite it and a plain set replaced it silently. It now surfaces the read failure instead, matching vars import.

@brickpop
brickpop merged commit 1370d3b into main Jun 21, 2026
1 check passed
@brickpop
brickpop deleted the f/vars-clone branch June 21, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant