Skip to content

Commit c8a19ec

Browse files
committed
release(v0.0.5): add uninstall command and refactor core systems
This release includes the following changes: - refactor(ci): consolidate and rename github actions workflows - feat(cli): add uninstall command and centralize path management - refactor(core): improve core logic, scripts, and refactor vault initialization - test: update tests and add coverage for new/refactored features - chore(dev): update editor settings - docs: update TODO items - chore: remove debug_install.sh script - docs: add project-specific cursor rules
1 parent f2366b6 commit c8a19ec

43 files changed

Lines changed: 2912 additions & 2483 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cursor/rules/with-project.mdc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: true
5+
---
6+
# Rules for This Project
7+
8+
- This is a Deno 2 project
9+
- Source files in `src/` and tests in `test/`
10+
- Running development, Testing, Linting, Type-checking and other tasks are provided in Deno tasks in the file `deno.json`. Always use them instead of direct calls to the Deno CLI such as `deno test -A ...`
11+
- Git commit messages are semantic commit
12+
- Github actions automate building, testing, and releasing for: Github Release, Chocolatey, and Homebrew tap. Their Github Workflows are in `.github`
13+
- Avoid repetitve code, refactor to hoist and share functions and variables that are used in multiple places
14+
- User facing errors for code in `src/` MUST use the terminal.error message in the file `src/utils/terminal.ts`
15+
- Prompts, spinners, and other interactive CLI elements MUST be provided by the file `src/utils/terminal.ts`
16+
- Avoid hardcoding values such as paths in multiple places, instead use the file [constants.ts](mdc:src/constants.ts)
17+
- Follow the Javascript style guide and standards in `.cursor/rules/with-javascript.mdc`
18+
- Never leave obvious or redudant inline code comments
19+
- Rarely use inline code comments
20+
- Always use `deno task test` to run tests
21+
- Always run tests after a large change to code files in `src/` or `test/`
22+
- This project can be tests and run on ALL platforms so you MUST ensure all code, such as paths, work on Windows Linux and MacOS
Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: Update Chocolatey Package
1+
name: Chocolatey Release
22

33
on:
44
workflow_run:
5-
workflows: ["Release"]
5+
workflows: ["Github Release"]
66
types:
77
- completed
88

@@ -35,6 +35,12 @@ jobs:
3535
with:
3636
fetch-depth: 0
3737

38+
- name: Install Git LFS
39+
shell: bash
40+
run: |
41+
# Install Git LFS on Windows
42+
git lfs install
43+
3844
- name: Get release details
3945
id: release
4046
shell: bash
@@ -62,6 +68,11 @@ jobs:
6268
VERSION="${TAG#v}"
6369
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
6470
71+
# Download release notes
72+
echo "Downloading release notes..."
73+
gh release view $TAG --json body -q '.body' > RELEASE_NOTES.txt
74+
echo "Release notes downloaded successfully."
75+
6576
- name: Download release artifacts
6677
shell: powershell
6778
env:
@@ -85,13 +96,20 @@ jobs:
8596
exit 1
8697
}
8798
99+
# Download the release notes file
100+
Write-Host "Copying release notes to package..."
101+
Copy-Item -Path "${{ github.workspace }}/RELEASE_NOTES.txt" -Destination "choco-pkg/tools/RELEASE_NOTES.txt"
102+
88103
Write-Host "Release artifacts downloaded successfully."
89104
90105
- name: Generate Chocolatey package files
91106
shell: powershell
92107
run: |
93108
$version = "${{ steps.release.outputs.VERSION }}"
94109
110+
# Copy LICENSE to the tools directory
111+
Copy-Item -Path "${{ github.workspace }}/LICENSE" -Destination "choco-pkg/tools/LICENSE"
112+
95113
# Create nuspec file
96114
@"
97115
<?xml version="1.0" encoding="utf-8"?>
@@ -102,10 +120,16 @@ jobs:
102120
<title>Git Vault (gv)</title>
103121
<authors>zackiles</authors>
104122
<projectUrl>https://github.com/zackiles/git-vault</projectUrl>
123+
<projectSourceUrl>https://github.com/zackiles/git-vault</projectSourceUrl>
124+
<docsUrl>https://github.com/zackiles/git-vault/blob/main/README.md</docsUrl>
125+
<iconUrl>https://github.com/zackiles/git-vault/blob/main/logo.ico</iconUrl>
126+
<bugTrackerUrl>https://github.com/zackiles/git-vault/issues</bugTrackerUrl>
105127
<licenseUrl>https://github.com/zackiles/git-vault/blob/main/LICENSE</licenseUrl>
106-
<requireLicenseAcceptance>false</requireLicenseAcceptance>
107-
<description>Drop-dead simple solution for sharing sensitive things in git repositories</description>
108-
<tags>git security secrets vault encryption</tags>
128+
<licenseFile>tools/LICENSE</licenseFile>
129+
<releaseNotes>tools/RELEASE_NOTES.txt</releaseNotes>
130+
<requireLicenseAcceptance>true</requireLicenseAcceptance>
131+
<description>Commit your secrets safely and effortlessly with Git using GPG. 1Password supported. Transparently encrypts files or folder on commit, decrypts on checkout. Handles Git LFS automatically for large files.</description>
132+
<summary>Easiest way to encrypt/decrypt files or folders in your git repository.</summary>
109133
</metadata>
110134
<files>
111135
<file src="tools\**" target="tools" />
@@ -136,9 +160,6 @@ jobs:
136160
137161
# Create primary command as gv.exe
138162
Copy-Item -Path `$exeFile -Destination (Join-Path `$toolsDir "gv.exe") -Force
139-
140-
# Also create git-vault.exe as an alias
141-
Copy-Item -Path `$exeFile -Destination (Join-Path `$toolsDir "git-vault.exe") -Force
142163
"@ | Out-File -Encoding utf8 -FilePath .\choco-pkg\tools\chocolateyInstall.ps1
143164
144165
# Create verification file
@@ -150,9 +171,24 @@ jobs:
150171
This package is published by the git-vault project itself. The binaries are
151172
identical to those in the released zip files from the official GitHub releases.
152173
153-
URL: https://github.com/zackiles/git-vault/releases/tag/v$version
174+
Package Source: https://github.com/zackiles/git-vault
175+
Release URL: https://github.com/zackiles/git-vault/releases/tag/v$version
176+
177+
To verify the binary:
178+
179+
1. Download the official release from the URL above
180+
2. Generate a checksum using:
181+
- PowerShell: Get-FileHash -Algorithm SHA256 gv.exe
182+
- Command Prompt: certutil -hashfile gv.exe SHA256
183+
184+
3. Compare the checksum with:
154185
"@ | Out-File -Encoding utf8 -FilePath .\choco-pkg\tools\VERIFICATION.txt
155186
187+
# Calculate and append checksum
188+
$exePath = Get-ChildItem -Path ".\choco-pkg\tools" -Filter "*.exe" | Select-Object -First 1 -ExpandProperty FullName
189+
$hash = Get-FileHash -Path $exePath -Algorithm SHA256
190+
Add-Content -Path .\choco-pkg\tools\VERIFICATION.txt -Value "SHA256: $($hash.Hash)"
191+
156192
- name: Install Chocolatey
157193
shell: powershell
158194
run: |
Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release
1+
name: Github Release
22

33
on:
44
push:
@@ -29,11 +29,13 @@ jobs:
2929
sudo apt-get update
3030
sudo apt-get install -y gnupg zip unzip
3131
32-
- name: Run unit tests
32+
- name: Install Git LFS
3333
run: |
34-
# Run tests but exclude integration tests that require 1Password or other external services
35-
# Use RUN_INTEGRATION_TESTS=true to run basic integration tests but NOT 1Password tests
36-
deno test -A --reporter=dot test/**/*.test.ts
34+
sudo apt-get install -y git-lfs
35+
git lfs install
36+
37+
- name: Run tests
38+
run: deno task test
3739

3840
build-and-release:
3941
needs: test
@@ -56,6 +58,11 @@ jobs:
5658
sudo apt-get update
5759
sudo apt-get install -y zip unzip tar
5860
61+
- name: Install Git LFS
62+
run: |
63+
sudo apt-get install -y git-lfs
64+
git lfs install
65+
5966
- name: Get tag name
6067
id: get_tag
6168
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
@@ -65,8 +72,8 @@ jobs:
6572
run: |
6673
COMMIT_MSG=$(git log -1 --pretty=format:%B ${{ github.sha }})
6774
# Properly handle multiline commit messages for GitHub Actions
68-
echo "$COMMIT_MSG" > release_notes.txt
69-
echo "NOTES_FILE=release_notes.txt" >> $GITHUB_OUTPUT
75+
echo "$COMMIT_MSG" > RELEASE_NOTES.txt
76+
echo "NOTES_FILE=RELEASE_NOTES.txt" >> $GITHUB_OUTPUT
7077
7178
- name: Build binaries
7279
run: deno task build --bin-path=./bin
Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Update Homebrew Tap
1+
name: Homebrew Tap Release
22

33
on:
44
workflow_run:
@@ -79,23 +79,23 @@ jobs:
7979
echo "Downloading gv-linux-arm.tar.gz..."
8080
gh release download "$TAG" -p "gv-linux-arm.tar.gz" -D dist/ || { echo "Failed to download gv-linux-arm.tar.gz"; exit 1; }
8181
82-
echo "All files downloaded successfully. Renaming files..."
82+
echo "All files downloaded successfully."
8383
84-
# Rename to match Homebrew conventions
85-
mv dist/gv-macos.tar.gz dist/git-vault-macos.tar.gz
86-
mv dist/gv-macos-arm.tar.gz dist/git-vault-macos-arm64.tar.gz
87-
mv dist/gv-linux.tar.gz dist/git-vault-linux.tar.gz
88-
mv dist/gv-linux-arm.tar.gz dist/git-vault-linux-arm64.tar.gz
84+
# No need to rename files anymore
85+
cp dist/gv-macos.tar.gz dist/gv-macos-x86_64.tar.gz
86+
cp dist/gv-macos-arm.tar.gz dist/gv-macos-arm64.tar.gz
87+
cp dist/gv-linux.tar.gz dist/gv-linux-x86_64.tar.gz
88+
cp dist/gv-linux-arm.tar.gz dist/gv-linux-arm64.tar.gz
8989
9090
echo "All files renamed successfully."
9191
9292
- name: Compute SHA256 hashes
9393
id: shasums
9494
run: |
95-
MAC_INTEL_SHA=$(shasum -a 256 dist/git-vault-macos.tar.gz | awk '{print $1}')
96-
MAC_ARM_SHA=$(shasum -a 256 dist/git-vault-macos-arm64.tar.gz | awk '{print $1}')
97-
LINUX_SHA=$(shasum -a 256 dist/git-vault-linux.tar.gz | awk '{print $1}')
98-
LINUX_ARM_SHA=$(shasum -a 256 dist/git-vault-linux-arm64.tar.gz | awk '{print $1}')
95+
MAC_INTEL_SHA=$(shasum -a 256 dist/gv-macos-x86_64.tar.gz | awk '{print $1}')
96+
MAC_ARM_SHA=$(shasum -a 256 dist/gv-macos-arm64.tar.gz | awk '{print $1}')
97+
LINUX_SHA=$(shasum -a 256 dist/gv-linux-x86_64.tar.gz | awk '{print $1}')
98+
LINUX_ARM_SHA=$(shasum -a 256 dist/gv-linux-arm64.tar.gz | awk '{print $1}')
9999
echo "MAC_INTEL_SHA=$MAC_INTEL_SHA" >> $GITHUB_OUTPUT
100100
echo "MAC_ARM_SHA=$MAC_ARM_SHA" >> $GITHUB_OUTPUT
101101
echo "LINUX_SHA=$LINUX_SHA" >> $GITHUB_OUTPUT
@@ -106,7 +106,7 @@ jobs:
106106
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107107
run: |
108108
TAG=${{ steps.release.outputs.TAG }}
109-
gh release upload $TAG dist/git-vault-macos.tar.gz dist/git-vault-macos-arm64.tar.gz dist/git-vault-linux.tar.gz dist/git-vault-linux-arm64.tar.gz --clobber
109+
gh release upload $TAG dist/gv-macos-x86_64.tar.gz dist/gv-macos-arm64.tar.gz dist/gv-linux-x86_64.tar.gz dist/gv-linux-arm64.tar.gz --clobber
110110
111111
- name: Checkout homebrew-git-vault tap repo
112112
uses: actions/checkout@v4
@@ -129,20 +129,20 @@ jobs:
129129
130130
on_macos do
131131
if Hardware::CPU.arm?
132-
url "https://github.com/zackiles/git-vault/releases/download/${TAG}/git-vault-macos-arm64.tar.gz"
132+
url "https://github.com/zackiles/git-vault/releases/download/${TAG}/gv-macos-arm64.tar.gz"
133133
sha256 "${MAC_ARM_SHA}"
134134
else
135-
url "https://github.com/zackiles/git-vault/releases/download/${TAG}/git-vault-macos.tar.gz"
135+
url "https://github.com/zackiles/git-vault/releases/download/${TAG}/gv-macos-x86_64.tar.gz"
136136
sha256 "${MAC_INTEL_SHA}"
137137
end
138138
end
139139
140140
on_linux do
141141
if Hardware::CPU.arm?
142-
url "https://github.com/zackiles/git-vault/releases/download/${TAG}/git-vault-linux-arm64.tar.gz"
142+
url "https://github.com/zackiles/git-vault/releases/download/${TAG}/gv-linux-arm64.tar.gz"
143143
sha256 "${LINUX_ARM_SHA}"
144144
else
145-
url "https://github.com/zackiles/git-vault/releases/download/${TAG}/git-vault-linux.tar.gz"
145+
url "https://github.com/zackiles/git-vault/releases/download/${TAG}/gv-linux-x86_64.tar.gz"
146146
sha256 "${LINUX_SHA}"
147147
end
148148
end
@@ -162,13 +162,10 @@ jobs:
162162
bin.install "gv-x86_64-unknown-linux-gnu" => "gv"
163163
end
164164
end
165-
166-
# Create git-vault symlink for backward compatibility
167-
bin.install_symlink "gv" => "git-vault"
168165
end
169166
170167
test do
171-
assert_match version.to_s, shell_output("#{bin}/git-vault --version")
168+
assert_match version.to_s, shell_output("#{bin}/gv --version")
172169
end
173170
end
174171
EOFORMULA
Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PR Validation
1+
name: Validate Pull Request
22

33
on:
44
pull_request:
@@ -63,24 +63,16 @@ jobs:
6363
sudo apt-get update
6464
sudo apt-get install -y gnupg zip unzip
6565
66+
- name: Install Git LFS
67+
run: |
68+
sudo apt-get install -y git-lfs
69+
git lfs install
70+
6671
- name: Lint and type check
6772
run: deno task check
6873

69-
- name: Run unit tests
70-
env:
71-
NON_INTERACTIVE: true
72-
run: |
73-
# Use direct test command to avoid interactive prompts
74-
# For better test coverage without interactive prompts
75-
DENO_ENV=test deno test -A --reporter=dot test/**/*.test.ts
76-
77-
- name: Run select integration tests
78-
env:
79-
NON_INTERACTIVE: true
80-
RUN_INTEGRATION_TESTS: true
81-
run: |
82-
# Run non-interactive integration tests that don't require 1Password
83-
DENO_ENV=test deno test -A --reporter=dot --filter "installation" test/install-local.test.ts
74+
- name: Run tests
75+
run: deno task test
8476

8577
- name: Build dry run
8678
run: deno task build --bin-path=./bin-test

.vscode/settings.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,14 @@
5555
"choco",
5656
"dryrun",
5757
"apikey",
58-
"shasums"
59-
58+
"shasums",
59+
"unmatch",
60+
"linuxbrew",
61+
"programdata",
62+
"peasy",
63+
"certutil",
64+
"hashfile",
65+
"doesnt",
66+
"LOCALAPPDATA'"
6067
],
6168
}

README.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ curl -fsSL https://raw.githubusercontent.com/zackiles/git-vault/main/install.sh
4646
**Homebrew (macOS/Linux):**
4747

4848
```bash
49-
brew tap zackiles/git-vault
49+
brew tap zackiles/homebrew-git-vault
5050
brew install gv
5151
```
5252

@@ -63,21 +63,31 @@ The process creates `.vault/` for configuration/storage, an empty `.vault/config
6363
> [!NOTE]
6464
> GPG must be installed; this is verified during initialization.
6565
66-
## Usage
66+
## Uninstallation
6767

68-
**First secret? Initialize your vault:**
68+
Assuming you no longer have repositories that gv manages secrets for and you'd like to remove it globally from your system can do so by running:
6969

7070
```bash
71-
gv init
71+
gv uninstall
7272
```
7373

74-
**Now add a file or folder to the vault:**
74+
This will determine how it was installed and use the appropriate uninstaller if you used a package manager like Brew or Chocolatey (or it falls back to manually removing itself).
75+
76+
> [!NOTE]
77+
> To remove git-vault from a specific project without uninstalling the CLI:
78+
>
79+
> - Run `gv remove-all`
80+
> - Remove gv-related entries from `.gitignore`
81+
82+
## Usage
83+
84+
**Add a file or folder to the vault:**
7585

7686
```bash
7787
gv <path/to/your/secret>
7888
```
7989

80-
Encrypts, stores it in `.vault/storage/`, updates `.gitignore`, manages password (local file or 1Password). Easy peasy
90+
The command encrypts and stores your file in `.vault/storage/`, updates `.gitignore`, and manages the password (local file or 1Password). Easy peasy!
8191

8292
**Remove from vault:**
8393

@@ -95,11 +105,8 @@ gv list
95105

96106
Displays managed files/directories, status, and archive sizes.
97107

98-
> [!TIP]
99-
> You can also use `git-vault` as an alias for `gv` for backward compatibility.
100-
101108
> [!IMPORTANT]
102-
> Your .gitignore will be automatically updated and you're safe to commit everything including `.vault/storage/` and `.vault/config.json`)
109+
> Your .gitignore will be automatically updated to ignore the password files and you're safe to commit everything else including `.vault/storage/` and `.vault/config.json`)
103110
104111
## Git LFS Integration
105112

0 commit comments

Comments
 (0)