Skip to content

Commit 09ff3a6

Browse files
committed
Add weather and githooks plugins v1.0.0
1 parent 4202f15 commit 09ff3a6

56 files changed

Lines changed: 3280 additions & 3 deletions

Some content is hidden

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

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ If a user installs a plugin binary for the wrong platform, the host will refuse
1717

1818
## Available Plugins
1919

20-
- **echo**: Simple echo plugin for testing the plugin system
20+
- **echo** (v2.0.1): Simple echo plugin for testing the plugin system
21+
- **weather** (v1.0.0): Get weather information and forecasts using wttr.in
22+
- **githooks** (v1.0.0): Git repository management with status, log, branch, and diff commands
2123

2224
## Installing Plugins
2325

build-all.ps1

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
param(
2+
[string]$Version = "1.0.0"
3+
)
4+
5+
$ErrorActionPreference = "Stop"
6+
7+
$Plugins = @("weather", "githooks")
8+
$Platforms = @(
9+
@{Os = "windows"; Arch = "amd64"},
10+
@{Os = "linux"; Arch = "amd64"},
11+
@{Os = "darwin"; Arch = "amd64"},
12+
@{Os = "darwin"; Arch = "arm64"}
13+
)
14+
15+
Write-Host "Building all plugins for all platforms (v$Version)" -ForegroundColor Cyan
16+
Write-Host ""
17+
18+
foreach ($plugin in $Plugins) {
19+
Write-Host "=== Building $plugin ===" -ForegroundColor Yellow
20+
Push-Location "plugins/$plugin"
21+
22+
try {
23+
foreach ($platform in $Platforms) {
24+
$os = $platform.Os
25+
$arch = $platform.Arch
26+
Write-Host " - $os/$arch" -ForegroundColor Gray
27+
& ./build.ps1 -Version $Version -Os $os -Arch $arch
28+
}
29+
}
30+
finally {
31+
Pop-Location
32+
}
33+
34+
Write-Host ""
35+
}
36+
37+
Write-Host "✅ All builds complete!" -ForegroundColor Green
38+
Write-Host ""
39+
Write-Host "Next steps:" -ForegroundColor Cyan
40+
Write-Host "1. Create GitHub release: gh release create v$Version"
41+
Write-Host "2. Upload all ZIP files from plugins/*/dist/"
42+
Write-Host "3. Update registry.json with checksums"
43+
Write-Host "4. Push changes"
44+

build-all.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
VERSION="${1:-1.0.0}"
5+
PLUGINS=("weather" "githooks")
6+
PLATFORMS=("windows/amd64" "linux/amd64" "darwin/amd64" "darwin/arm64")
7+
8+
echo "Building all plugins for all platforms (v$VERSION)"
9+
echo ""
10+
11+
for plugin in "${PLUGINS[@]}"; do
12+
echo "=== Building $plugin ==="
13+
cd "plugins/$plugin"
14+
15+
for platform in "${PLATFORMS[@]}"; do
16+
OS="${platform%/*}"
17+
ARCH="${platform#*/}"
18+
echo " - $OS/$ARCH"
19+
VERSION=$VERSION GOOS=$OS GOARCH=$ARCH bash build.sh
20+
done
21+
22+
cd ../..
23+
echo ""
24+
done
25+
26+
echo "✅ All builds complete!"
27+
echo ""
28+
echo "Next steps:"
29+
echo "1. Create GitHub release: gh release create v$VERSION"
30+
echo "2. Upload all ZIP files from plugins/*/dist/"
31+
echo "3. Update registry.json with checksums"
32+
echo "4. Push changes"
33+

collect-checksums.ps1

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
param(
2+
[string]$Version = "1.0.0"
3+
)
4+
5+
$ErrorActionPreference = "Stop"
6+
7+
$Plugins = @("weather", "githooks")
8+
9+
Write-Host "Collecting checksums for version $Version" -ForegroundColor Cyan
10+
Write-Host ""
11+
12+
foreach ($plugin in $Plugins) {
13+
Write-Host "=== $plugin ===" -ForegroundColor Yellow
14+
$checksumFiles = Get-ChildItem -Path "plugins/$plugin/dist" -Filter "*-v$Version-*.zip.sha256" -ErrorAction SilentlyContinue
15+
16+
foreach ($file in $checksumFiles) {
17+
$zipName = $file.BaseName
18+
$content = Get-Content $file.FullName
19+
$hash = $content.Split(' ')[0]
20+
21+
Write-Host $zipName -ForegroundColor Gray
22+
Write-Host " sha256:$hash" -ForegroundColor Green
23+
Write-Host ""
24+
}
25+
}
26+
27+
Write-Host "Copy these checksums into registry.json" -ForegroundColor Cyan
28+

collect-checksums.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
VERSION="${1:-1.0.0}"
5+
PLUGINS=("weather" "githooks")
6+
7+
echo "Collecting checksums for version $VERSION"
8+
echo ""
9+
10+
for plugin in "${PLUGINS[@]}"; do
11+
echo "=== $plugin ==="
12+
for checksum_file in plugins/$plugin/dist/*-v${VERSION}-*.zip.sha256; do
13+
if [[ -f "$checksum_file" ]]; then
14+
basename "$checksum_file" .sha256
15+
cat "$checksum_file" | awk '{print " sha256:" $1}'
16+
echo ""
17+
fi
18+
done
19+
done
20+
21+
echo "Copy these checksums into registry.json"
22+

plugins/githooks/README.md

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
# Git Hooks Plugin
2+
3+
A marchat plugin that provides git repository management and status updates directly in your chat.
4+
5+
## Description
6+
7+
The Git Hooks Plugin allows users to interact with git repositories without leaving marchat. It provides commands for viewing git status, commit history, branches, and diffs, making it easy to monitor repository changes during conversations.
8+
9+
## Features
10+
11+
- **Git Status**: View the current status of your git repository
12+
- **Commit History**: Browse recent commits with author and time information
13+
- **Branch Management**: View current branch and available branches
14+
- **Diff Viewer**: See uncommitted changes at a glance
15+
- **Repository Watching**: Monitor repositories for changes (admin only)
16+
17+
## Commands
18+
19+
### User Commands
20+
- `:git-status [path]` — Show git status of current or specified directory
21+
- `:git-log [n] [path]` — Show recent git commits (default: 5)
22+
- `:git-branch [path]` — Show current branch and available branches
23+
- `:git-diff [path]` — Show git diff of uncommitted changes
24+
25+
### Admin Commands
26+
- `:git-watch <path>` — Watch a repository for changes (admin only)
27+
28+
## Installation
29+
30+
### From Plugin Store
31+
```bash
32+
:store
33+
# Navigate to githooks plugin and press Enter to install
34+
```
35+
36+
### Direct Installation
37+
```bash
38+
:plugin install githooks
39+
```
40+
41+
## Build and Package
42+
43+
Builds produce a single archive targeted to your OS/architecture.
44+
45+
### PowerShell (Windows)
46+
```powershell
47+
# From this directory
48+
./build.ps1 -Version 1.0.0 -Os windows -Arch amd64
49+
# Output: dist/githooks-plugin-v1.0.0-windows-amd64.zip and .sha256
50+
```
51+
52+
### Bash (Linux/macOS)
53+
```bash
54+
# From this directory
55+
VERSION=1.0.0 bash build.sh # uses GOOS/GOARCH from env
56+
# or override
57+
VERSION=1.0.0 GOOS=linux GOARCH=amd64 bash build.sh
58+
VERSION=1.0.0 GOOS=darwin GOARCH=amd64 bash build.sh
59+
VERSION=1.0.0 GOOS=darwin GOARCH=arm64 bash build.sh
60+
# Output: dist/githooks-plugin-v1.0.0-{os}-{arch}.zip and .sha256
61+
```
62+
63+
### Archive Contents
64+
- `githooks` or `githooks.exe` — the plugin binary
65+
- `plugin.json` — plugin manifest with metadata and commands
66+
- `README.md` — this documentation
67+
68+
### Naming Convention
69+
- `githooks-plugin-v<version>-<goos>-<goarch>.zip`
70+
- Examples: `githooks-plugin-v1.0.0-windows-amd64.zip`, `githooks-plugin-v1.0.0-darwin-arm64.zip`
71+
72+
## Usage Examples
73+
74+
### Check Git Status
75+
```bash
76+
:git-status
77+
# Output: Shows status of current directory
78+
79+
:git-status /path/to/repo
80+
# Output: Shows status of specified repository
81+
```
82+
83+
### View Recent Commits
84+
```bash
85+
:git-log
86+
# Output: Shows last 5 commits
87+
88+
:git-log 10
89+
# Output: Shows last 10 commits
90+
91+
:git-log 10 /path/to/repo
92+
# Output: Shows last 10 commits for specified repo
93+
```
94+
95+
### View Branches
96+
```bash
97+
:git-branch
98+
# Output: Shows current branch and all branches
99+
100+
:git-branch /path/to/repo
101+
# Output: Shows branches for specified repository
102+
```
103+
104+
### View Uncommitted Changes
105+
```bash
106+
:git-diff
107+
# Output: Shows diff statistics for uncommitted changes
108+
109+
:git-diff /path/to/repo
110+
# Output: Shows diff for specified repository
111+
```
112+
113+
### Watch Repository (Admin Only)
114+
```bash
115+
:git-watch /path/to/repo
116+
# Output: Now watching repository: /path/to/repo
117+
```
118+
119+
## Plugin Management
120+
121+
### List Installed Plugins
122+
```bash
123+
:plugin list
124+
```
125+
126+
### Enable/Disable Plugin
127+
```bash
128+
:plugin enable githooks
129+
:plugin disable githooks
130+
```
131+
132+
### Uninstall Plugin (Admin Only)
133+
```bash
134+
:plugin uninstall githooks
135+
```
136+
137+
## Technical Details
138+
139+
### Plugin Structure
140+
```
141+
githooks/
142+
├── githooks (.exe) # Binary executable
143+
├── plugin.json # Plugin manifest
144+
└── README.md # This documentation
145+
```
146+
147+
### Requirements
148+
- Git must be installed and available in PATH
149+
- Plugin will verify git availability during initialization
150+
- Repository paths must contain a valid `.git` directory
151+
152+
### Git Commands Used
153+
- `git status --short --branch` - Repository status
154+
- `git log --pretty=format` - Commit history
155+
- `git branch --show-current` - Current branch
156+
- `git branch -a` - All branches
157+
- `git diff --stat` - Change statistics
158+
159+
## Version History
160+
161+
- **v1.0.0** - Initial release with git status, log, branch, diff, and watch commands
162+
163+
## License
164+
165+
MIT License - see [LICENSE](../../LICENSE) for details.
166+
167+
## Contributing
168+
169+
This plugin is part of the marchat-plugins project. For plugin development guidelines, see the main repository's [CONTRIBUTING.md](../../CONTRIBUTING.md).
170+
171+
## Support
172+
173+
For issues or questions about this plugin:
174+
- Create an issue in the [marchat-plugins repository](https://github.com/Cod-e-Codes/marchat-plugins/issues)
175+
- Check the [plugin documentation](https://github.com/Cod-e-Codes/marchat/blob/main/PLUGIN_ECOSYSTEM.md)
176+
177+
## Security Notes
178+
179+
- Admin-only commands (git-watch) require proper authorization
180+
- Plugin validates repository paths and git directory existence
181+
- All git commands run with user's current permissions
182+
- No git write operations are performed (read-only)
183+
184+
---
185+
186+
**Note**: This plugin executes git commands on your system. Ensure you trust the repositories you're querying and have proper access permissions.
187+

0 commit comments

Comments
 (0)