localvault 1.12.3 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6798f21f6875910fa68c5300a929b4c18e757a9c03251cd71d46bb46e6cd85b7
4
- data.tar.gz: a40a445f7d92baad0645bc9ab2f2a900bda43d09a657e07735c565bb5f705f01
3
+ metadata.gz: aa374ffc862a0591ab2936ea836ea4f04e96d3d86acd3591fb1b57ed91ea1253
4
+ data.tar.gz: f8ac6c6bd7e329d395801741f1c9e61f121339d5f05d013623faa6e2f7d255e0
5
5
  SHA512:
6
- metadata.gz: 45cf703a841eedc73c9b77ac19a92059075dd914c4c1075ff79beca784b61fce4396ffbf51b206315f55c6179c44270d3238a6174c479bc1a2e9e1e9bf4e34d7
7
- data.tar.gz: 661933cfaa2a6f1a69a5459f0e87580912178e1faeeff0becf7823e4fbb007fa63fad8cfa2f7a05d363146309e20ef1ad4b316143d94a541ba1efb78ae3aa340
6
+ metadata.gz: 3cfb2aaccbfb4c0fc8882d6115dc3ca7ab8802f060601f3083ec9d1c36f76b1688ea2649eea70edaaf18d463f87e35605311a7a5492094f1e22d70326771b1ae
7
+ data.tar.gz: 874a4be548a5f7498d9fa520be60485f762df2f4ebe2e4612816b16617bf072cb1c735f73375ace33638c73d309d0a86c294095ea1c777ccfc57a3b9666b1eca
@@ -123,7 +123,7 @@ module LocalVault
123
123
  ["KEYS (X25519 identity for vault sharing)", %w[keys identity]],
124
124
  ["AI / MCP", %w[install-mcp mcp guard]],
125
125
  ["LEGACY SHARING (pre-v1.2 direct share, still works)", %w[keygen share receive revoke]],
126
- ["OTHER", %w[logout version doctor help]]
126
+ ["OTHER", %w[logout version doctor upgrade help]]
127
127
  ].freeze
128
128
 
129
129
  # One row per plain command; registered subcommands (sync, team, keys,
@@ -1649,6 +1649,60 @@ module LocalVault
1649
1649
  end
1650
1650
  end
1651
1651
 
1652
+ desc "upgrade", "Upgrade localvault using whichever method installed it"
1653
+ long_desc <<~DESC
1654
+ Detect how this copy of localvault was installed and run the matching
1655
+ upgrade — Homebrew, RubyGems, or the install script.
1656
+
1657
+ \x05 localvault upgrade # detect and upgrade
1658
+ \x05 localvault upgrade --check # show what would run, change nothing
1659
+
1660
+ If more than one localvault is on PATH, an old copy can shadow the new one
1661
+ and the upgrade looks like it did nothing. This refuses to guess in that
1662
+ case and points you at `localvault doctor`.
1663
+ DESC
1664
+ method_option :check, type: :boolean, default: false, desc: "Print the upgrade command without running it"
1665
+ def upgrade
1666
+ paths = localvault_paths
1667
+ if paths.length > 1
1668
+ $stderr.puts "Error: multiple localvault executables are on PATH:"
1669
+ paths.each_with_index { |path, index| $stderr.puts " #{index + 1}. #{path}" }
1670
+ $stderr.puts "\nUpgrading now would leave a stale copy shadowing the new one."
1671
+ $stderr.puts "Run `localvault doctor`, remove the copies you don't want, then retry."
1672
+ return CommandStatus.error
1673
+ end
1674
+
1675
+ method, command = upgrade_method_for(paths.first)
1676
+ if method == :unknown
1677
+ $stderr.puts "Error: cannot tell how localvault was installed#{" (#{paths.first})" if paths.first}."
1678
+ $stderr.puts "Upgrade with whichever you used:"
1679
+ $stderr.puts " brew upgrade inventlist/tap/localvault"
1680
+ $stderr.puts " gem update localvault"
1681
+ $stderr.puts " curl -sSL https://inventlist.com/tools/localvault/install.sh | sh"
1682
+ return CommandStatus.error
1683
+ end
1684
+
1685
+ $stdout.puts "Installed via #{method} (#{paths.first})"
1686
+ $stdout.puts "Current version: #{VERSION}"
1687
+ $stdout.puts "Command: #{command}"
1688
+
1689
+ if options[:check]
1690
+ $stdout.puts "\n--check: nothing was run."
1691
+ return CommandStatus.ok
1692
+ end
1693
+
1694
+ $stdout.puts
1695
+ unless system(command)
1696
+ $stderr.puts "\nError: upgrade command failed. Run it yourself to see the full output:"
1697
+ $stderr.puts " #{command}"
1698
+ return CommandStatus.error
1699
+ end
1700
+
1701
+ $stdout.puts
1702
+ $stdout.puts "Done. Verify with: localvault version"
1703
+ CommandStatus.ok
1704
+ end
1705
+
1652
1706
  def self.exit_on_failure?
1653
1707
  false
1654
1708
  end
@@ -2169,6 +2223,38 @@ module LocalVault
2169
2223
  path.start_with?("/opt/homebrew/bin/", "/usr/local/bin/")
2170
2224
  end
2171
2225
 
2226
+ # Which installer put this executable here, and how to upgrade it.
2227
+ #
2228
+ # The path alone can't decide: Homebrew and install.sh both land in
2229
+ # /usr/local/bin. Both write a wrapper naming their gem prefix, so read
2230
+ # that instead — a Cellar path means brew, ~/.localvault/runtime means the
2231
+ # install script.
2232
+ UPGRADE_COMMANDS = {
2233
+ brew: "brew upgrade inventlist/tap/localvault",
2234
+ gem: "gem update localvault",
2235
+ script: "curl -sSL https://inventlist.com/tools/localvault/install.sh | sh"
2236
+ }.freeze
2237
+
2238
+ def upgrade_method_for(path)
2239
+ method = detect_install_method(path)
2240
+ [method, UPGRADE_COMMANDS[method]]
2241
+ end
2242
+
2243
+ def detect_install_method(path)
2244
+ return :unknown if path.nil?
2245
+ return :brew if File.symlink?(path) && File.readlink(path).include?("/Cellar/")
2246
+
2247
+ wrapper = File.read(path, 2048)
2248
+ return :brew if wrapper.include?("/Cellar/")
2249
+ return :script if wrapper.include?("/.localvault/runtime")
2250
+ return :gem if path.include?("/shims/") || path.include?("/gems/")
2251
+
2252
+ :unknown
2253
+ rescue SystemCallError, ArgumentError
2254
+ # Binary or unreadable: fall back to the one thing the path does tell us.
2255
+ path.include?("/shims/") || path.include?("/gems/") ? :gem : :unknown
2256
+ end
2257
+
2172
2258
  def cursor_settings_path
2173
2259
  File.expand_path("~/.cursor/mcp.json")
2174
2260
  end
@@ -1,3 +1,3 @@
1
1
  module LocalVault
2
- VERSION = "1.12.3"
2
+ VERSION = "1.13.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localvault
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.3
4
+ version: 1.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nauman Tariq