Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
196 commits
Select commit Hold shift + click to select a range
cdd0d08
refactor: extract PastewatchCore library and add CLI target
Feb 22, 2026
26ef407
feat: add file path, hostname, and credential detection
Feb 22, 2026
4f7e598
feat: add CLI scan mode with structured exit codes
Feb 22, 2026
153ba0a
docs: add SKILL.md, CLI docs, and agent integration
Feb 22, 2026
73a9f31
fix: pin swift-argument-parser to 1.3-1.4 for Xcode 15.2 compat
Feb 22, 2026
daf43e7
fix: resolve swiftlint violations
Feb 22, 2026
57bef58
feat: add line number tracking to DetectedMatch
Feb 22, 2026
e7db775
feat: add SARIF 2.1.0 output format
Feb 22, 2026
30d4673
feat: add directory scanning
Feb 22, 2026
e476012
docs: restructure SKILL.md for ancc validator compliance
Feb 22, 2026
c9e606f
feat: add format-aware scanning for env, JSON, YAML, properties
Feb 22, 2026
8260564
feat: add allowlist and custom detection rules
Feb 22, 2026
facbf43
feat: add --dir flag for directory scanning CLI
Feb 22, 2026
79216fd
docs: update for v0.3.0
Feb 22, 2026
416b6e6
fix: resolve swiftlint violations in v0.3.0 code
Feb 22, 2026
17ff7f0
docs: restructure SKILL.md for ancc compliance
Feb 23, 2026
d2c3f95
docs: add ANCC compliance badge
Feb 23, 2026
3bc801c
feat: add config init and project-level config resolution
Feb 23, 2026
37b7e1c
feat: add MCP server for AI agent integration
Feb 23, 2026
3954625
feat: add baseline diff mode
Feb 23, 2026
c3e9c09
feat: add pre-commit hook installer
Feb 23, 2026
4b89376
docs: update for v0.4.0
Feb 23, 2026
b69317b
docs: expand MCP server documentation for agent discovery
Feb 23, 2026
bd5a374
feat: add severity levels to detection types
Feb 23, 2026
142f744
feat: add pre-commit framework integration
Feb 23, 2026
54ac739
feat: add --stdin-filename for format-aware stdin parsing
Feb 23, 2026
e2b90fb
feat: add inline allowlist comments
Feb 23, 2026
2210bd9
feat: add Linux binary support
Feb 23, 2026
bb1875b
docs: update for v0.5.0
Feb 23, 2026
38d2071
fix: replace Darwin.exit with throw ExitCode for Linux compatibility
Feb 23, 2026
10c2091
feat: add --fail-on-severity threshold flag
Feb 23, 2026
093213b
feat: add Slack, Discord, Azure, GCP credential detection
Feb 23, 2026
bb75d63
feat: add custom severity to custom rules
Feb 23, 2026
ccbabe6
feat: add .pastewatchignore path exclusion
Feb 23, 2026
d316ce0
feat: add --output flag for file report writing
Feb 23, 2026
56916a9
feat: add markdown output format
Feb 23, 2026
ce24d9d
feat: add explain subcommand for detection type details
Feb 23, 2026
402db1a
feat: add config check subcommand
Feb 23, 2026
b66674d
docs: update for v0.6.0
Feb 23, 2026
08b42a3
fix: replace NSPredicate with pure Swift glob matching for Linux
Feb 23, 2026
3592932
fix: resolve SwiftLint violations in IgnoreFile and ConfigValidator
Feb 23, 2026
6a98774
docs: remove project family section from README
Feb 23, 2026
146ab58
docs: add project-level CLAUDE.md
Feb 23, 2026
94433ab
docs: consolidate design-baseline into hard-constraints
Feb 23, 2026
5c69ede
feat: add redacted read/write MCP tools for AI agents
Feb 24, 2026
d84009c
docs: add agent safety guide with MCP setup instructions
Feb 24, 2026
48742fe
fix: resolve SwiftLint force_try violation in RedactionStore
Feb 24, 2026
71418b7
feat: add 12 detection types for LLM keys, registry tokens, and platf…
Feb 25, 2026
9d8f3b6
feat: add audit log to MCP server
Feb 25, 2026
bdae706
docs: add missing detection types to README, add audit log references
Feb 25, 2026
f72c52e
chore: bump version to 0.7.0
Feb 25, 2026
cf97c29
chore: gitignore session files
Feb 25, 2026
db84cf8
docs: add coverage boundaries — what pastewatch protects and what it …
Feb 26, 2026
92fb966
fix: don't respond to JSON-RPC notifications in MCP server
Feb 26, 2026
ba9d387
docs: add per-agent MCP setup guide
Feb 26, 2026
231d9f8
chore: bump version to 0.7.1
Feb 26, 2026
9693993
fix: flush MCP audit log after each write
Feb 26, 2026
fd5a057
chore: bump version to 0.7.2
Feb 26, 2026
9203b14
docs: clarify Intel Mac build-from-source requirement
Feb 26, 2026
db84efa
docs: update project description to reflect CLI and MCP capabilities
Feb 26, 2026
ab684f3
feat: add severity threshold and built-in allowlist to MCP read
Feb 26, 2026
6d87a40
chore: bump version to 0.8.0
Feb 26, 2026
69ffb3a
fix: reduce false positives for IPs, emails, file paths, and UUIDs
Feb 26, 2026
38f2a34
chore: bump version to 0.8.1
Feb 26, 2026
be4dcdd
refactor: extract per-type validators to fix cyclomatic complexity
Feb 26, 2026
a61468e
feat: add guard subcommand for Bash command secret scanning
Feb 26, 2026
affc0c4
chore: bump version to 0.9.0
Feb 26, 2026
30a76dc
ci: add Homebrew tap update to release workflow
Feb 26, 2026
d202f87
feat: add PW_GUARD=0 native bypass to guard and scan --check
Feb 26, 2026
a1101ff
docs: document guard subcommand and PW_GUARD escape hatch
Feb 26, 2026
911e315
chore: bump version to 0.9.1
Feb 26, 2026
02d5eb9
feat: add configurable safeHosts and sensitiveHosts to config
Feb 26, 2026
958aa44
chore: bump version to 0.9.2
Feb 26, 2026
ecee35f
feat: add host suffix matching and regex allowlist patterns
Feb 27, 2026
dd7923c
chore: bump version to 0.9.3
Feb 27, 2026
0326bca
fix: resolve SwiftLint for_where violations in ConfigValidator
Feb 27, 2026
666c790
fix: resolve SwiftLint force_try violations in tests
Feb 27, 2026
ea497dc
feat: add --bail flag for fast pre-dispatch directory scanning
Feb 27, 2026
c55d1c5
chore: bump version to 0.9.4
Feb 27, 2026
bd7e6b2
refactor: extract scanFileContent to reduce cyclomatic complexity
Feb 27, 2026
aecd4e7
feat: add fix subcommand for secret remediation
Feb 27, 2026
ba1342c
chore: bump version to 0.10.0
Feb 27, 2026
7d8693f
fix: replace switch with dictionary lookup for SwiftLint compliance
Feb 27, 2026
672b73d
feat: add native git diff scanning with --git-diff flag
Feb 27, 2026
117aad5
chore: bump version to 0.11.0
Feb 27, 2026
7310c67
feat: add entropy-based secret detection (opt-in)
Feb 27, 2026
3d1d2e6
feat: add guard-read and guard-write subcommands
Feb 27, 2026
09e3a58
chore: bump version to 0.12.0
Feb 27, 2026
b6357ed
feat: add inventory subcommand for secret posture reports
Feb 27, 2026
a900d82
chore: bump version to 0.13.0
Feb 27, 2026
602c389
feat: add VS Code extension for real-time secret detection
Feb 27, 2026
6b48ad1
chore: bump version to 0.14.0
Feb 27, 2026
4c9396c
fix: resolve SwiftLint violations in inventory, diff parser, and entropy
Feb 27, 2026
28e453c
docs: add consolidated agent integration reference
Feb 28, 2026
175d65a
ci: add workflow_dispatch and release triggers to vscode extension
Feb 28, 2026
b15338e
chore: add VS Code extension icon
Feb 28, 2026
f1f7756
fix: make MCP redaction placeholders consistent across files
Mar 1, 2026
1a71fe5
chore: bump version to 0.14.1
Mar 1, 2026
eaff7fb
ci: auto-tag version bump commits on main
Mar 1, 2026
67c33b4
docs: add SKILL.md and improve config documentation
Mar 1, 2026
ba83f55
feat: 2-segment hostname detection and IP prefix matching
Mar 1, 2026
aba79e8
fix: MCP server now reads project and user config files
Mar 1, 2026
e49f4be
docs: add sensitiveIPPrefixes and 2-segment host examples
Mar 1, 2026
cdd7f78
chore: bump version to 0.15.0
Mar 1, 2026
bcefc9f
feat: add doctor diagnostics subcommand
Mar 1, 2026
a29cb30
chore: bump version to 0.16.0
Mar 1, 2026
af0f3e4
fix: resolve SwiftLint large_tuple violations in doctor command
Mar 1, 2026
d90a638
docs: add MCP severity threshold examples to agent-safety and SKILL
Mar 1, 2026
c83d641
feat: add mcpMinSeverity config field for MCP redaction threshold
Mar 1, 2026
380d0d6
feat: add --min-severity flag to MCP server for per-agent thresholds
Mar 1, 2026
be015d6
chore: bump version to 0.17.0
Mar 2, 2026
fb9a432
docs: add ready-to-use agent integration examples
Mar 2, 2026
51fc22d
feat: show per-process min-severity and config mcpMinSeverity in doctor
Mar 2, 2026
40e9017
chore: bump version to 0.17.1
Mar 2, 2026
74296e3
feat: guard detects infrastructure tools (ansible, terraform, docker,…
Mar 2, 2026
45e0f47
chore: bump version to 0.17.2
Mar 2, 2026
50460d9
feat: guard detects scripting interpreters, pipe chains, and file tra…
Mar 2, 2026
b3d7181
chore: bump version to 0.17.3
Mar 2, 2026
7eaa048
feat: guard detects database CLIs, redirect operators, and subshells
Mar 2, 2026
945c869
chore: bump version to 0.17.4
Mar 2, 2026
feae382
fix: resolve SwiftLint for_where violation in CommandParser
Mar 2, 2026
edd8aea
feat: add git history scanning with scan --git-log
Mar 2, 2026
0c99dbf
chore: bump version to 0.18.0
Mar 2, 2026
623b2cf
fix: use conditional CryptoKit import for Linux compatibility
Mar 2, 2026
91dcaef
fix: resolve SwiftLint large_tuple violation in GitHistoryScanner
Mar 2, 2026
9920fbe
feat: add agent auto-setup subcommand (WO-54)
Mar 2, 2026
8d4d587
feat: add agent session report from MCP audit log (WO-57)
Mar 3, 2026
84592c3
feat: add canary secrets for agent leak detection (WO-60)
Mar 3, 2026
171025c
fix: resolve SwiftLint large_tuple violation in SessionReport
Mar 3, 2026
72becba
docs: update README and status with all features through WO-60
Mar 3, 2026
52492e1
docs: add Why Pastewatch section to README
Mar 3, 2026
186443e
feat: add encrypted vault for secret externalization (WO-61)
Mar 3, 2026
8f3a06d
ci: fix auto-tag gating and release checkout
Mar 5, 2026
e099253
chore: bump version to 0.19.0
Mar 5, 2026
ddbbdbe
ci: fix release notes extraction from CHANGELOG
Mar 5, 2026
090ad8e
fix: version subcommand reads from CommandConfiguration
Mar 5, 2026
8e8dab8
chore: bump version to 0.19.1
Mar 5, 2026
da3879e
feat: add multi-repo posture scanning (WO-62)
Mar 7, 2026
0c3b04c
chore: bump version to 0.19.2
Mar 7, 2026
ba68eba
fix: replace force_try with throwing test in PostureScannerTests
Mar 7, 2026
a658f35
chore: update docs
Mar 8, 2026
d0ef908
chore: update docs
Mar 8, 2026
ac68ac6
feat: add Perplexity API key detection (WO-67)
Mar 9, 2026
a640f5c
chore: bump version to 0.19.3
Mar 9, 2026
57fae9c
feat: add XML value parser and ClickHouse config detection (WO-68)
Mar 11, 2026
d63fa7f
chore: bump version to 0.19.4
Mar 11, 2026
a54580d
feat: add configurable MCP placeholder prefix (WO-69)
Mar 11, 2026
2386d9a
chore: bump version to 0.19.5
Mar 11, 2026
3850e4a
docs: add placeholderPrefix to config reference
Mar 11, 2026
ac3bf06
fix: init generates complete config with placeholderPrefix field
Mar 11, 2026
beb43ed
chore: bump version to 0.19.6
Mar 11, 2026
5dc4a3a
refactor: change MCP placeholder format from __PW{TYPE_N}__ to __PW_T…
Mar 13, 2026
7cf45f0
chore: bump version to 0.19.7
Mar 13, 2026
694b993
feat: add JDBC URL built-in detection type (WO-71)
Mar 13, 2026
d9b75d5
feat: add init --profile banking for enterprise onboarding (WO-72)
Mar 13, 2026
3598ec3
chore: bump version to 0.19.8
Mar 13, 2026
ae76d95
docs: add drop-in agent integration snippet for project CLAUDE.md
Mar 13, 2026
8aa394d
feat: setup auto-injects pastewatch snippet into CLAUDE.md (WO-74)
Mar 13, 2026
e08371e
feat: setup runs doctor health check after configuration (WO-75)
Mar 13, 2026
f12ba85
feat: setup runs canary detection smoke test after doctor (WO-78)
Mar 13, 2026
102b35a
docs: add manual install instructions for non-Homebrew environments (…
Mar 13, 2026
5b4c7a9
feat: add admin-enforced config layer at /etc/pastewatch (WO-77)
Mar 13, 2026
92ff8a7
chore: bump version to 0.20.0
Mar 13, 2026
6ba4aef
docs: add shell alias for pre-session health check
Mar 14, 2026
2c7cc13
fix: reduce false positives in credential and AWS key detection (WO-79)
Mar 15, 2026
6ce075d
feat: gitignore-aware scanning with warn-only mode (WO-80)
Mar 15, 2026
aee7c1a
chore: bump version to 0.21.0
Mar 15, 2026
2ee764a
feat: add watch subcommand for continuous file monitoring (WO-59)
Mar 15, 2026
42f7184
feat: add dashboard subcommand for aggregate session reporting (WO-65)
Mar 15, 2026
13bc009
chore: bump version to 0.22.0
Mar 16, 2026
0151a7b
fix: Linux compatibility for watch command
Mar 16, 2026
86eb9aa
fix: SwiftLint large_tuple violation in DashboardBuilder
Mar 16, 2026
15c6ddb
docs: add watch and dashboard sections to README
Mar 16, 2026
dc3de62
feat: add API proxy for scanning outbound requests (WO-81)
Mar 16, 2026
a8385d7
feat: proxy supports --forward-proxy for corporate environments
Mar 16, 2026
55dd858
chore: bump version to 0.23.0
Mar 16, 2026
40db52d
fix: Linux compatibility for proxy server
Mar 16, 2026
438aeac
docs: add API proxy and corporate proxy chaining documentation
Mar 16, 2026
27f905a
docs: add ANCC convention breadcrumb to SKILL.md
Mar 21, 2026
ccab4fd
fix: resolve SwiftLint for_where and large_tuple violations in ProxyS…
Mar 23, 2026
ac6da26
feat: add detection rules for workledger and oracul API keys
Mar 23, 2026
5e22150
chore: bump version to 0.23.1
Mar 23, 2026
3d5c181
feat: add path-based protection for ~/.openclaw directory
Mar 25, 2026
6541199
chore: bump version to 0.23.2
Mar 25, 2026
31dbf5f
fix: auto-enable new detection types in existing configs
Mar 26, 2026
620f4a4
chore: bump version to 0.23.3
Mar 26, 2026
7babea2
feat: inject alert into API response when proxy redacts secrets
Mar 26, 2026
7bc16dd
chore: bump version to 0.24.0
Mar 26, 2026
86c90d9
feat: add arm64 Linux binary to release workflow
Mar 26, 2026
b9087c2
fix: use QEMU emulation for arm64 Linux build instead of arm runner
Mar 26, 2026
2507048
fix: workledger key regex now matches 32+ chars instead of exactly 44
Mar 26, 2026
28ea1c6
chore: bump version to 0.24.1
Mar 26, 2026
4f95aff
docs: update project description to reflect full feature set
Mar 26, 2026
a3d772e
ci: remove QEMU arm64 build from release workflow
Mar 26, 2026
9491eda
ci: add CodeQL code scanning and Dependabot config
Mar 26, 2026
614349b
chore(deps): bump github.com/apple/swift-argument-parser
dependabot[bot] Mar 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2

updates:
- package-ecosystem: "swift"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 5

- package-ecosystem: "npm"
directory: "/vscode-pastewatch"
schedule:
interval: "weekly"
open-pull-requests-limit: 5

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 5
54 changes: 53 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@ jobs:
- name: Run Tests
run: swift test

build-linux:
name: Build and Test (Linux)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- uses: swift-actions/setup-swift@v2
with:
swift-version: "5.9"

- name: Build CLI
run: swift build --product PastewatchCLI

- name: Run Tests
run: swift test

lint:
name: Lint
runs-on: macos-14
Expand All @@ -32,4 +48,40 @@ jobs:
run: brew install swiftlint

- name: Run SwiftLint
run: swiftlint lint --strict || true
run: swiftlint lint --strict

auto-tag:
name: Auto-tag version bumps
runs-on: ubuntu-22.04
needs: [build, build-linux, lint]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Check for version bump commit
id: check
run: |
MSG=$(git log -1 --format='%s')
if echo "$MSG" | grep -qE '^chore: bump version to [0-9]+\.[0-9]+\.[0-9]+$'; then
VERSION=$(echo "$MSG" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "should_tag=true" >> "$GITHUB_OUTPUT"
else
echo "should_tag=false" >> "$GITHUB_OUTPUT"
fi

- name: Create and push tag
if: steps.check.outputs.should_tag == 'true'
env:
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
TAG="v${{ steps.check.outputs.version }}"
git tag "$TAG"
if [ -n "$GH_TOKEN" ]; then
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
fi
git push origin "$TAG"
52 changes: 52 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CodeQL

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 6 * * 1'

permissions:
security-events: write
contents: read

jobs:
analyze-swift:
name: Analyze Swift
runs-on: macos-14
steps:
- uses: actions/checkout@v4

- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_15.2.app

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: swift

- name: Build
run: swift build -c release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:swift"

analyze-javascript:
name: Analyze JavaScript (VS Code Extension)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: javascript-typescript

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:javascript-typescript"
188 changes: 174 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,107 @@ on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g., v0.2.0)'
required: true

permissions:
contents: write

jobs:
resolve:
name: Resolve Tag
runs-on: ubuntu-22.04
outputs:
tag: ${{ steps.tag.outputs.tag }}
ref: ${{ steps.tag.outputs.ref }}
steps:
- name: Resolve tag and ref
id: tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "tag=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
echo "ref=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
echo "ref=${{ github.ref }}" >> "$GITHUB_OUTPUT"
fi

test:
name: Test
runs-on: macos-14
needs: resolve
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.resolve.outputs.ref }}

- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_15.2.app

- name: Run Tests
run: swift test

build-linux:
name: Build Linux Release
runs-on: ubuntu-22.04
needs: [resolve, test]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.resolve.outputs.ref }}

- uses: swift-actions/setup-swift@v2
with:
swift-version: "5.9"

- name: Build CLI
run: |
swift build -c release --product PastewatchCLI
mkdir -p release
cp .build/release/PastewatchCLI release/pastewatch-cli-linux-amd64

- name: Generate SHA256
run: |
cd release
sha256sum pastewatch-cli-linux-amd64 > pastewatch-cli-linux-amd64.sha256

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: linux-release
path: release/

build:
name: Build Release
runs-on: macos-14
needs: [resolve, test, build-linux]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.resolve.outputs.ref }}

- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_15.2.app

- name: Build Release Binary
- name: Build Release Binaries
run: |
swift build -c release
mkdir -p release
cp .build/release/pastewatch release/
cp .build/release/Pastewatch release/pastewatch
cp .build/release/PastewatchCLI release/pastewatch-cli

- name: Create App Bundle
run: |
VERSION="${{ needs.resolve.outputs.tag }}"
VERSION="${VERSION#v}"
mkdir -p "release/Pastewatch.app/Contents/MacOS"
mkdir -p "release/Pastewatch.app/Contents/Resources"
cp .build/release/pastewatch "release/Pastewatch.app/Contents/MacOS/Pastewatch"
cp .build/release/Pastewatch "release/Pastewatch.app/Contents/MacOS/Pastewatch"
cp Sources/Pastewatch/Resources/AppIcon.icns "release/Pastewatch.app/Contents/Resources/AppIcon.icns"
cat > "release/Pastewatch.app/Contents/Info.plist" << 'EOF'
cat > "release/Pastewatch.app/Contents/Info.plist" << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
Expand All @@ -50,7 +124,7 @@ jobs:
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${GITHUB_REF_NAME#v}</string>
<string>${VERSION}</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
Expand All @@ -67,30 +141,116 @@ jobs:

- name: Create DMG
run: |
hdiutil create -volname "Pastewatch" -srcfolder release/Pastewatch.app -ov -format UDZO release/Pastewatch-${{ github.ref_name }}.dmg
TAG="${{ needs.resolve.outputs.tag }}"
hdiutil create -volname "Pastewatch" -srcfolder release/Pastewatch.app -ov -format UDZO "release/Pastewatch-${TAG}.dmg"

- name: Create ZIP
run: |
TAG="${{ needs.resolve.outputs.tag }}"
cd release
zip -r Pastewatch-${{ github.ref_name }}.zip Pastewatch.app
zip -r "Pastewatch-${TAG}.zip" Pastewatch.app

- name: Generate SHA256 checksums
run: |
TAG="${{ needs.resolve.outputs.tag }}"
cd release
shasum -a 256 Pastewatch-${{ github.ref_name }}.dmg > Pastewatch-${{ github.ref_name }}.dmg.sha256
shasum -a 256 Pastewatch-${{ github.ref_name }}.zip > Pastewatch-${{ github.ref_name }}.zip.sha256
shasum -a 256 "Pastewatch-${TAG}.dmg" > "Pastewatch-${TAG}.dmg.sha256"
shasum -a 256 "Pastewatch-${TAG}.zip" > "Pastewatch-${TAG}.zip.sha256"
shasum -a 256 pastewatch > pastewatch.sha256
shasum -a 256 pastewatch-cli > pastewatch-cli.sha256

- name: Download Linux amd64 artifacts
uses: actions/download-artifact@v4
with:
name: linux-release
path: release/

- name: Extract release notes from CHANGELOG
id: notes
run: |
TAG="${{ needs.resolve.outputs.tag }}"
VERSION="${TAG#v}"
# Extract the [VERSION] section from CHANGELOG.md
# Matches "## [0.19.0]" and captures until the next "## [" header
NOTES=$(awk -v ver="## [${VERSION}]" '
BEGIN { found=0 }
index($0, ver) == 1 { found=1; next }
found && /^## \[/ { exit }
found { print }
' CHANGELOG.md | sed '/^$/N;/^\n$/d')

if [ -z "$NOTES" ]; then
NOTES="Release ${TAG}"
fi

# Write to file to avoid quoting issues
echo "$NOTES" > /tmp/release-notes.md

- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.resolve.outputs.tag }}
body_path: /tmp/release-notes.md
files: |
release/Pastewatch-${{ github.ref_name }}.dmg
release/Pastewatch-${{ github.ref_name }}.dmg.sha256
release/Pastewatch-${{ github.ref_name }}.zip
release/Pastewatch-${{ github.ref_name }}.zip.sha256
release/Pastewatch-${{ needs.resolve.outputs.tag }}.dmg
release/Pastewatch-${{ needs.resolve.outputs.tag }}.dmg.sha256
release/Pastewatch-${{ needs.resolve.outputs.tag }}.zip
release/Pastewatch-${{ needs.resolve.outputs.tag }}.zip.sha256
release/pastewatch
release/pastewatch.sha256
generate_release_notes: true
release/pastewatch-cli
release/pastewatch-cli.sha256
release/pastewatch-cli-linux-amd64
release/pastewatch-cli-linux-amd64.sha256
generate_release_notes: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update Homebrew formula
env:
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
TAG="${{ needs.resolve.outputs.tag }}"
VERSION_NUM="${TAG#v}"
SHA256=$(shasum -a 256 release/pastewatch-cli | awk '{print $1}')

cat > /tmp/pastewatch.rb << FORMULA
# typed: false
# frozen_string_literal: true

class Pastewatch < Formula
desc "Sensitive data scanner — deterministic detection and obfuscation for text content"
homepage "https://github.com/ppiankov/pastewatch"
version "${VERSION_NUM}"
license "MIT"

depends_on :macos
depends_on arch: :arm64

url "https://github.com/ppiankov/pastewatch/releases/download/${TAG}/pastewatch-cli"
sha256 "${SHA256}"

def install
bin.install "pastewatch-cli"
end

test do
assert_match "pastewatch-cli", shell_output("#{bin}/pastewatch-cli version")
end
end
FORMULA

# Remove leading whitespace from heredoc
sed -i '' 's/^ //' /tmp/pastewatch.rb

if [ -n "$GH_TOKEN" ]; then
EXISTING_SHA=$(gh api repos/ppiankov/homebrew-tap/contents/Formula/pastewatch.rb --jq .sha 2>/dev/null || echo '')
gh api repos/ppiankov/homebrew-tap/contents/Formula/pastewatch.rb \
--method PUT \
--field message="Update pastewatch to ${TAG}" \
--field content="$(base64 -i /tmp/pastewatch.rb)" \
--field sha="${EXISTING_SHA}" \
|| echo "Homebrew tap update failed — check HOMEBREW_TAP_TOKEN secret"
else
echo "HOMEBREW_TAP_TOKEN not set — skipping Homebrew update"
fi
Loading
Loading