Compare commits
151 Commits
a539bedbbd
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 34731c4e26 | |||
| 22ea72bccc | |||
| 56397d11e2 | |||
| 2e082a4bca | |||
| 09349a9477 | |||
| a967587181 | |||
| f047d61731 | |||
| f087e13267 | |||
| ce73d0273a | |||
| 6bf77cebab | |||
| d6dc207f2c | |||
| 8769d32855 | |||
| a0cb179d6e | |||
| 9412fb7036 | |||
| 1887ee7a41 | |||
| ade0f2dcbd | |||
| 89a3b47948 | |||
| 82914e969d | |||
| b73af714a5 | |||
| 39fdfb5cac | |||
| ca8527ac85 | |||
| 23e08b4162 | |||
| 498fb0112b | |||
| 975561f83e | |||
| a972396412 | |||
| 1db2a401b8 | |||
| 72fa7026bf | |||
| 0fc4ea8da0 | |||
| 1d630c488f | |||
| 4e772d7b44 | |||
| daeb1655ab | |||
| 06a9d5d0d4 | |||
| 0b8fcbadbc | |||
| 7aa122f749 | |||
| 82281239e2 | |||
| 0dcc24f173 | |||
| 0e12ac604e | |||
| 82d9c45bda | |||
|
|
2ae1255629 | ||
|
|
37f12638b8 | ||
|
|
5474bfe44a | ||
|
|
672bb86307 | ||
|
|
7d2a746eaa | ||
|
|
5246f56aa8 | ||
|
|
07aa6ede4c | ||
|
|
45bfc8c23c | ||
|
|
a4ba98f2ac | ||
|
|
27890eb55e | ||
|
|
f87aded9c7 | ||
|
|
3824543efb | ||
|
|
54b8b4c5cd | ||
|
|
849ff08d61 | ||
|
|
3d72ac6d35 | ||
|
|
50f842fffb | ||
|
|
d615bd0df0 | ||
|
|
d4162c37d6 | ||
|
|
2eb45ac67f | ||
|
|
ddf534e72b | ||
|
|
bade8c3c09 | ||
|
|
09c6ef5041 | ||
|
|
f52eb353ab | ||
|
|
27ad9225e9 | ||
|
|
b10e8e2126 | ||
|
|
789a8c0129 | ||
|
|
a30328d219 | ||
|
|
81185ffc9a | ||
|
|
0224a1cb8c | ||
|
|
4c7823ea7a | ||
|
|
5b367ca08a | ||
|
|
b19d5632fd | ||
|
|
a504bc3b25 | ||
|
|
2f159affb4 | ||
|
|
2c969a971c | ||
|
|
8500cb2bd7 | ||
|
|
1b271e12a4 | ||
|
|
bed4c79c5b | ||
|
|
ccd52e2655 | ||
|
|
4a91b4ddce | ||
|
|
dd42885945 | ||
|
|
400222a7f0 | ||
|
|
8f044501bd | ||
|
|
a72d8d3e1c | ||
|
|
38a5c9d94e | ||
|
|
a2ef40b674 | ||
|
|
035b0131ad | ||
|
|
9cf980a3c3 | ||
|
|
938e7e151c | ||
|
|
8a1c659b0e | ||
|
|
5db41a2e4d | ||
|
|
719f624c9b | ||
|
|
b52a0b8504 | ||
|
|
da29c63e32 | ||
|
|
52f045ca64 | ||
|
|
9ed3ae0d40 | ||
|
|
f5dc2683cd | ||
|
|
f211e80fa1 | ||
|
|
0a82fc7499 | ||
|
|
f7b3b4bd04 | ||
|
|
ad8b063c08 | ||
|
|
3ce410fc4d | ||
|
|
05e2ed2060 | ||
|
|
4536810ecb | ||
|
|
9e708b731c | ||
|
|
cb83f14453 | ||
|
|
7a4622ad4a | ||
|
|
6a0c2787fa | ||
|
|
58e79310cc | ||
|
|
4b330d0a7f | ||
|
|
3b5fc1c8c1 | ||
|
|
c508800f83 | ||
|
|
f38af64e40 | ||
|
|
9bf17a7eac | ||
|
|
f2037299e2 | ||
|
|
64afe101f3 | ||
|
|
afa4aa722e | ||
|
|
b819b2978a | ||
|
|
633769e664 | ||
|
|
793d2824c3 | ||
|
|
ded66cd8c1 | ||
|
|
a593be06dd | ||
|
|
3109f02cb7 | ||
|
|
c6fcf26734 | ||
|
|
c10fafb4fa | ||
|
|
511eef1e55 | ||
|
|
419eb2c525 | ||
| ab8ee2c361 | |||
| e5ad9d0edb | |||
| f125f1618d | |||
| 8c744bda82 | |||
| 4ff83d63e7 | |||
| 5647c1ea66 | |||
| 6706ad75f8 | |||
| db115e6fb3 | |||
| 3a2cdeccde | |||
| cbd8cc228e | |||
| 8f6d8f2e51 | |||
| c8b3c10f8f | |||
| d87d05a006 | |||
| 5e144c0244 | |||
| d2aa10e0a7 | |||
| 5d59715ebd | |||
| 760c655d5c | |||
| 6565a6838b | |||
| 66346d56b3 | |||
| e16d45c64f | |||
| 5070765c24 | |||
| 5218d2a940 | |||
| 05c6eb8202 | |||
| 1b79d97142 | |||
| 5dc07a42bf | |||
| 855d353237 |
10
.gitignore
vendored
@@ -1,5 +1,9 @@
|
|||||||
node_modules
|
node_modules
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
dist/
|
||||||
|
dist-tauri
|
||||||
|
src-tauri/target
|
||||||
|
src-tauri/gen
|
||||||
dist.DS_Store
|
dist.DS_Store
|
||||||
.git
|
.git
|
||||||
.gitignore
|
.gitignore
|
||||||
@@ -7,6 +11,7 @@ dist.DS_Store
|
|||||||
*.iml
|
*.iml
|
||||||
yarn.lock
|
yarn.lock
|
||||||
*.lock
|
*.lock
|
||||||
|
!src-tauri/Cargo.lock
|
||||||
Makefile
|
Makefile
|
||||||
*.exe
|
*.exe
|
||||||
tsconfig.tsbuildinfo
|
tsconfig.tsbuildinfo
|
||||||
@@ -14,3 +19,8 @@ tsconfig.tsbuildinfo
|
|||||||
*.pdb
|
*.pdb
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
*.dylib
|
*.dylib
|
||||||
|
*.o
|
||||||
|
build
|
||||||
|
out
|
||||||
|
*.tmp
|
||||||
|
*.app
|
||||||
|
|||||||
179
README.md
@@ -1,79 +1,138 @@
|
|||||||
# auto-git-gui
|
# Auto-Git
|
||||||
|
|
||||||
**Author:** Unknown
|
**Author:** Victor Giers
|
||||||
|
|
||||||
> ⚠️ **This README.md has been automatically generated using AI and might contain hallucinations or inaccuracies. Please proceed with caution!**
|
> ⚠️ **This README.md has been automatically generated using AI and might contain hallucinations or inaccuracies. Please proceed with caution!**
|
||||||
|
|
||||||
# Repo Monitor
|
Auto-Git is a unique and interactive desktop application designed to help you manage your Git repositories with ease. It features a playful cat mascot that guides you through various Git operations, making the process more engaging and user-friendly.
|
||||||
|
|
||||||
## Description
|
---
|
||||||
|
|
||||||
Repo Monitor is a desktop application designed to help developers keep track of their Git repositories. It provides features such as monitoring repository activity, taking snapshots of commits, and managing multiple repositories efficiently.
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- **Repository Monitoring**: Automatically monitors selected Git repositories for changes.
|
- **Interactive Cat Mascot**: A cute cat character that provides feedback and assistance during Git operations.
|
||||||
- **Snapshot Commits**: Save the state of a commit to a file for later reference.
|
- **Intelligent Committing**: Set thresholds for automatic committing based on file changes or time intervals.
|
||||||
- **Checkout Commits**: Switch between different commits in your repository.
|
- **README Generation**: Automatically generate `README.md` files for your repositories using AI models.
|
||||||
- **Commit Diff Viewer**: View differences between commits directly within the application.
|
- **Folder Management**: Easily add, remove, and select Git folders to monitor.
|
||||||
- **Multiple Repositories**: Manage and switch between multiple Git repositories easily.
|
- **Commit History**: View commit history with detailed diffs and options to revert or checkout commits.
|
||||||
- **Tray Integration**: Access quick actions via system tray menu.
|
- **Push to Gitea**: Push your commits directly to a Gitea server with ease.
|
||||||
- **Cat Assistant**: An interactive cat assistant that provides feedback based on commit activity.
|
- **Customizable Settings**: Adjust various settings such as sky mode, autostart, and commit thresholds.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
Before installing Auto-Git, ensure that both **Git** and **Ollama** are installed and available in your system’s PATH:
|
||||||
|
|
||||||
|
1. **Git**
|
||||||
|
- Download and install from [https://git-scm.com/downloads](https://git-scm.com/downloads)
|
||||||
|
- Verify with:
|
||||||
|
```bash
|
||||||
|
git --version
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Ollama**
|
||||||
|
- Download and install from [https://ollama.com](https://ollama.com)
|
||||||
|
- Verify with:
|
||||||
|
```bash
|
||||||
|
ollama --version
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. Download the latest release from the [Releases](https://github.com/yourusername/repo-monitor/releases) page.
|
Download the latest release for your platform:
|
||||||
2. Extract the downloaded archive.
|
|
||||||
3. Run the application executable (`RepoMonitor.exe` for Windows, `RepoMonitor.app` for macOS, or `RepoMonitor` for Linux).
|
- **macOS (arm64)**
|
||||||
|
[Auto-Git 1.0.0 (macOS arm64).dmg](https://victorgiers.com/auto-git/Auto-Git-1.0.0-macOS-arm64.dmg)
|
||||||
|
|
||||||
|
- **Windows (x64)**
|
||||||
|
[Auto-Git 1.0.0 (Setup Windows x64).exe](https://victorgiers.com/auto-git/Auto-Git-1.0.0-Setup-Windows-x64.exe)
|
||||||
|
|
||||||
|
- **Windows (ARM64)**
|
||||||
|
[Auto-Git 1.0.0 (Setup Windows ARM64).exe](https://victorgiers.com/auto-git/Auto-Git-1.0.0-Setup-Windows-ARM64.exe)
|
||||||
|
|
||||||
|
*(Linux builds coming soon.)*
|
||||||
|
|
||||||
|
1. Download the appropriate installer for your system.
|
||||||
|
2. Run the installer and follow the on-screen instructions.
|
||||||
|
3. Launch **Auto-Git** from your applications menu (macOS) or Start menu (Windows).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
1. **Add a Repository**: Click the "Add Folder" button to add a Git repository to be monitored.
|
1. **Add a Folder**
|
||||||
2. **Select a Repository**: Click on a repository in the sidebar to view its commits.
|
- Click on **“Add Folder”** to select and add a Git repository to Auto-Git.
|
||||||
3. **View Commits**: Navigate through commits using pagination and view commit details, including diffs.
|
2. **Monitor Folders**
|
||||||
4. **Take Snapshots**: Use the snapshot button to save the state of a specific commit.
|
- Select a folder in the sidebar to monitor its changes and view commit history.
|
||||||
5. **Checkout Commits**: Switch to a different commit by clicking the checkout button.
|
3. **Commit Changes**
|
||||||
|
- Auto-Git will automatically commit changes when thresholds are reached, or you can manually commit with a custom message.
|
||||||
|
4. **Generate README**
|
||||||
|
- Use the built-in AI integration to generate or update a `README.md` for any monitored repository.
|
||||||
|
5. **Push to Gitea**
|
||||||
|
- Configure your Gitea API key in **Settings**, then push commits directly from Auto-Git.
|
||||||
|
|
||||||
## Contributing
|
### Git safety behavior
|
||||||
|
|
||||||
Contributions are welcome! Please read the [CONTRIBUTING.md](CONTRIBUTING.md) file for guidelines on how to contribute to the project.
|
- Starting monitoring establishes a baseline; changes that already existed are left untouched.
|
||||||
|
- Monitoring commits only paths reported by filesystem events. It never stages the whole repository.
|
||||||
|
- Build output and dependency folders such as `node_modules`, `dist-tauri`, and `src-tauri/target` are always excluded.
|
||||||
|
- Auto-Git refuses to commit when the index already contains staged work or when Git is rebasing, merging, resolving conflicts, or using a detached HEAD.
|
||||||
|
- Threshold- and timer-based commit-message rewrites rebuild commit objects directly without checkout, rebase, hooks, signing, or staging. Every rewritten and descendant commit is checked for identical tree, topology, metadata, and the expected message before the guarded branch compare-and-swap. They do not retain a duplicate history ref. The Reword button preference affects only that button, not scheduled rewrites.
|
||||||
|
- Commit history follows local branches, so **Jump Here** can navigate backward and forward while `HEAD` is detached. Jumping to a commit that is the unique tip of a local branch reattaches that branch.
|
||||||
|
- Starting monitoring reconciles Git changes already present in the working tree, including changes made while monitoring was paused, and commits only those reported paths through the normal guarded monitoring pipeline.
|
||||||
|
- Adding any folder immediately enables monitoring in the UI. Existing Git repositories start their watcher at once; non-repositories stay armed and attach the watcher automatically when **Init Repo** completes, without another Play click.
|
||||||
|
- Automatic commit-message rewriting performs all Git safety checks before contacting Ollama, bounds diffs to the configured model context, requests an exact JSON schema, and stops after the first failed automatic attempt instead of retrying on each scheduler tick.
|
||||||
|
- **Rewrite all** is shown whenever the current HEAD history contains paw-marked commits and rewrites all of them in one manually initiated model request and one transactional history update.
|
||||||
|
- Every automatic candidate batch receives a persisted one-shot identifier before its model request. The same batch can never be sent automatically again, including after a failure or app restart.
|
||||||
|
- Reword, paw retry, and Rewrite all run their Git preflight synchronously. Dirty, staged, and untracked working changes are preserved because message rewriting never touches the worktree or index. Conflicts, detached HEAD, and in-progress Git operations return an immediate UI error and start no model request.
|
||||||
|
- Automatic stashing, forced checkout, rebase abort, and hard-reset recovery are not used by monitoring or commit-message rewriting.
|
||||||
|
- Commit squashing is temporarily disabled until it uses an equivalently isolated transactional mechanism.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Settings
|
||||||
|
|
||||||
|
- **Sky Mode**:
|
||||||
|
Toggle between light and dynamic themes that adjust color to the current sky color in your area.
|
||||||
|
- **Autostart**:
|
||||||
|
Enable or disable Auto-Git to start automatically on system boot.
|
||||||
|
- **Close to Tray**:
|
||||||
|
Minimize Auto-Git to the system tray instead of closing it completely.
|
||||||
|
- **Intelligent Commit Thresholds**:
|
||||||
|
Set file change or time-based thresholds for automatic commits.
|
||||||
|
- **AI Model Selection**:
|
||||||
|
- Default for commit message inference: `qwen2.5-coder:7b`
|
||||||
|
- Default for README generation: `qwen2.5-coder:32b`
|
||||||
|
- **Gitea API Key**:
|
||||||
|
Enter your Gitea API token to push repositories online with one click.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Build from Source
|
||||||
|
|
||||||
|
If you want to build Auto-Git yourself, follow these steps:
|
||||||
|
|
||||||
|
1. Clone or download the repository to your local machine.
|
||||||
|
2. Install Node.js, npm, Rust, and the Tauri prerequisites for your operating system.
|
||||||
|
3. Open a terminal, navigate into the project folder, and run:
|
||||||
|
```bash
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
4. Run the app in development mode:
|
||||||
|
```bash
|
||||||
|
npm start
|
||||||
|
```
|
||||||
|
5. Build the Tauri distributables:
|
||||||
|
```bash
|
||||||
|
npm run dist
|
||||||
|
```
|
||||||
|
6. The output installers/packages will be located under `src-tauri/target/release/bundle/`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.
|
||||||
|
|
||||||
## Contact
|
|
||||||
|
|
||||||
For any questions or support, please contact us at [support@repomonitor.com](mailto:support@repomonitor.com).
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Repo Monitor**
|
|
||||||
*Effortlessly manage your Git repositories.*
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2023 Your Name
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
|
|||||||
34
animeCat.js
@@ -13,7 +13,7 @@ window.AnimeCat = class AnimeCat {
|
|||||||
joy: 'joy.png',
|
joy: 'joy.png',
|
||||||
mischievous: 'mischievous.png'
|
mischievous: 'mischievous.png'
|
||||||
}, options.images);
|
}, options.images);
|
||||||
|
|
||||||
this.blinkMin = options.blinkMin ?? 5000;
|
this.blinkMin = options.blinkMin ?? 5000;
|
||||||
this.blinkMax = options.blinkMax ?? 15000;
|
this.blinkMax = options.blinkMax ?? 15000;
|
||||||
this.blinkDuration = options.blinkDuration ?? 175;
|
this.blinkDuration = options.blinkDuration ?? 175;
|
||||||
@@ -24,6 +24,7 @@ window.AnimeCat = class AnimeCat {
|
|||||||
this._blinkTimeout = null;
|
this._blinkTimeout = null;
|
||||||
this._talkIntervalId = null;
|
this._talkIntervalId = null;
|
||||||
this._speechTimeout = null;
|
this._speechTimeout = null;
|
||||||
|
this._bubbleHideTimeout = null;
|
||||||
this._mouthOpen = false;
|
this._mouthOpen = false;
|
||||||
this._pettingActive = false;
|
this._pettingActive = false;
|
||||||
|
|
||||||
@@ -34,6 +35,9 @@ window.AnimeCat = class AnimeCat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_createElements() {
|
_createElements() {
|
||||||
|
// Der Slot selbst soll nichts blockieren – nur die Katze bleibt klickbar
|
||||||
|
this.container.style.pointerEvents = 'none';
|
||||||
|
|
||||||
// Outer Wrapper für Flex-Layout
|
// Outer Wrapper für Flex-Layout
|
||||||
this.wrapper = document.createElement('div');
|
this.wrapper = document.createElement('div');
|
||||||
Object.assign(this.wrapper.style, {
|
Object.assign(this.wrapper.style, {
|
||||||
@@ -43,7 +47,8 @@ window.AnimeCat = class AnimeCat {
|
|||||||
alignItems: 'flex-end',
|
alignItems: 'flex-end',
|
||||||
minHeight: '80px',
|
minHeight: '80px',
|
||||||
minWidth: '180px',
|
minWidth: '180px',
|
||||||
zIndex: 1
|
zIndex: 1,
|
||||||
|
pointerEvents: 'none'
|
||||||
});
|
});
|
||||||
|
|
||||||
// Innerer Container für Glow + Katze (Stack!)
|
// Innerer Container für Glow + Katze (Stack!)
|
||||||
@@ -54,7 +59,8 @@ window.AnimeCat = class AnimeCat {
|
|||||||
height: '70px',
|
height: '70px',
|
||||||
minWidth: '90px',
|
minWidth: '90px',
|
||||||
minHeight: '70px',
|
minHeight: '70px',
|
||||||
zIndex: 2
|
zIndex: 2,
|
||||||
|
pointerEvents: 'auto'
|
||||||
});
|
});
|
||||||
|
|
||||||
// Glow (hinter der Katze)
|
// Glow (hinter der Katze)
|
||||||
@@ -111,6 +117,8 @@ window.AnimeCat = class AnimeCat {
|
|||||||
opacity: '0',
|
opacity: '0',
|
||||||
transition: 'opacity 0.3s',
|
transition: 'opacity 0.3s',
|
||||||
maxWidth: '240px',
|
maxWidth: '240px',
|
||||||
|
maxHeight: 'min(320px, calc(100vh - 120px))',
|
||||||
|
overflowY: 'auto',
|
||||||
wordBreak: 'break-word',
|
wordBreak: 'break-word',
|
||||||
fontFamily: 'sans-serif',
|
fontFamily: 'sans-serif',
|
||||||
fontSize: '15px',
|
fontSize: '15px',
|
||||||
@@ -119,8 +127,9 @@ window.AnimeCat = class AnimeCat {
|
|||||||
minHeight: '30px',
|
minHeight: '30px',
|
||||||
zIndex: 10,
|
zIndex: 10,
|
||||||
overflowWrap: 'anywhere',
|
overflowWrap: 'anywhere',
|
||||||
display: 'flex',
|
display: 'none',
|
||||||
alignItems: 'center'
|
alignItems: 'center',
|
||||||
|
boxSizing: 'border-box'
|
||||||
});
|
});
|
||||||
|
|
||||||
// Bubble Tail
|
// Bubble Tail
|
||||||
@@ -528,12 +537,17 @@ _runJoyAnimation(onFinish) {
|
|||||||
beginSpeech() {
|
beginSpeech() {
|
||||||
clearTimeout(this._speechTimeout);
|
clearTimeout(this._speechTimeout);
|
||||||
clearInterval(this._talkIntervalId);
|
clearInterval(this._talkIntervalId);
|
||||||
|
clearTimeout(this._bubbleHideTimeout);
|
||||||
|
|
||||||
this._isSpeaking = true;
|
this._isSpeaking = true;
|
||||||
this._mouthOpen = false;
|
this._mouthOpen = false;
|
||||||
this.img.src = this.images.default;
|
this.img.src = this.images.default;
|
||||||
this.bubble.style.opacity = '1';
|
this.bubble.style.display = 'flex';
|
||||||
|
this.bubble.style.opacity = '0';
|
||||||
this.bubble.style.visibility = 'visible';
|
this.bubble.style.visibility = 'visible';
|
||||||
|
// Reflow erzwingen, damit das Fade-In nach display:none sauber läuft
|
||||||
|
void this.bubble.offsetWidth;
|
||||||
|
this.bubble.style.opacity = '1';
|
||||||
Array.from(this.bubble.childNodes).forEach(node => {
|
Array.from(this.bubble.childNodes).forEach(node => {
|
||||||
if (node !== this.bubblePointer) node.remove();
|
if (node !== this.bubblePointer) node.remove();
|
||||||
});
|
});
|
||||||
@@ -561,6 +575,11 @@ _runJoyAnimation(onFinish) {
|
|||||||
this._speechTimeout = setTimeout(() => {
|
this._speechTimeout = setTimeout(() => {
|
||||||
this.bubble.style.opacity = '0';
|
this.bubble.style.opacity = '0';
|
||||||
this._isSpeaking = false;
|
this._isSpeaking = false;
|
||||||
|
this._bubbleHideTimeout = setTimeout(() => {
|
||||||
|
if (this._isSpeaking) return;
|
||||||
|
this.bubble.style.display = 'none';
|
||||||
|
this.bubble.style.visibility = 'hidden';
|
||||||
|
}, 320);
|
||||||
}, 6000);
|
}, 6000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,7 +587,8 @@ _runJoyAnimation(onFinish) {
|
|||||||
clearTimeout(this._blinkTimeout);
|
clearTimeout(this._blinkTimeout);
|
||||||
clearInterval(this._talkIntervalId);
|
clearInterval(this._talkIntervalId);
|
||||||
clearTimeout(this._speechTimeout);
|
clearTimeout(this._speechTimeout);
|
||||||
|
clearTimeout(this._bubbleHideTimeout);
|
||||||
this.wrapper.remove();
|
this.wrapper.remove();
|
||||||
this.heartEmitter.remove();
|
this.heartEmitter.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 162 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 273 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 154 KiB |
@@ -1,13 +0,0 @@
|
|||||||
// editor-reword.js
|
|
||||||
const fs = require('fs');
|
|
||||||
const map = JSON.parse(process.env.REBASE_COMMIT_MAP);
|
|
||||||
const msgFile = process.argv[2];
|
|
||||||
const origMsg = fs.readFileSync(msgFile, 'utf-8');
|
|
||||||
|
|
||||||
// Hash suchen
|
|
||||||
const hashMatch = origMsg.match(/commit\\s+([a-f0-9]{7,40})/i);
|
|
||||||
const hash = hashMatch ? hashMatch[1] : null;
|
|
||||||
if (hash && map[hash]) {
|
|
||||||
fs.writeFileSync(msgFile, map[hash] + '\n');
|
|
||||||
}
|
|
||||||
process.exit(0);
|
|
||||||
110
index.html
@@ -4,6 +4,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<title>auto-git</title>
|
<title>auto-git</title>
|
||||||
<script src="https://cdn.tailwindcss.com"></script>
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
|
<script src="tauriBridge.js"></script>
|
||||||
<style>
|
<style>
|
||||||
:root {
|
:root {
|
||||||
/* Default-Modus: Weißes Panel mit Rosa-Akzenten */
|
/* Default-Modus: Weißes Panel mit Rosa-Akzenten */
|
||||||
@@ -12,13 +13,20 @@
|
|||||||
--accent: #9f1239; /* Rosa */
|
--accent: #9f1239; /* Rosa */
|
||||||
--border: #ffe4e6;
|
--border: #ffe4e6;
|
||||||
}
|
}
|
||||||
body.sky-mode {
|
body.theme-sky {
|
||||||
/* Sky-Mode: Himmelshintergrund und passende Akzente */
|
/* Sky-Mode: Himmelshintergrund und passende Akzente */
|
||||||
--bg-main: rgb(173,216,230); /* sanftes Baby-Blau */
|
--bg-main: rgb(173,216,230); /* sanftes Baby-Blau */
|
||||||
--bg-sidebar: rgb(200,220,240); /* etwas dunkleres Blau */
|
--bg-sidebar: rgb(200,220,240); /* etwas dunkleres Blau */
|
||||||
--accent: rgb(20,60,100); /* dunkles Marine-Blau als Akzent */
|
--accent: rgb(20,60,100); /* dunkles Marine-Blau als Akzent */
|
||||||
--border: rgb(180,200,220);
|
--border: rgb(180,200,220);
|
||||||
}
|
}
|
||||||
|
body.theme-grey {
|
||||||
|
/* Grey theme: ruhige, neutrale Akzente */
|
||||||
|
--bg-main: #f5f5f5;
|
||||||
|
--bg-sidebar: #eceff1;
|
||||||
|
--accent: #374151;
|
||||||
|
--border: #d1d5db;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||||
@@ -155,7 +163,10 @@
|
|||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
.content-area ul#contentList li {
|
||||||
|
word-break: break-all;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
#folderHierarchyDropdown.open {
|
#folderHierarchyDropdown.open {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
@@ -236,16 +247,23 @@
|
|||||||
<!-- Content-Area -->
|
<!-- Content-Area -->
|
||||||
<div class="flex-1 p-4 overflow-y-auto content-area">
|
<div class="flex-1 p-4 overflow-y-auto content-area">
|
||||||
<!-- Title -->
|
<!-- Title -->
|
||||||
<div id="folderTitleDrop"
|
<div class="flex items-center pb-2">
|
||||||
class="relative flex items-baseline space-x-1 cursor-pointer select-none group pb-2">
|
<div id="folderTitleDrop"
|
||||||
<svg id="folderTitleArrow"
|
class="relative flex flex-1 min-w-0 items-baseline space-x-1 cursor-pointer select-none group">
|
||||||
class="h-4 w-6 flex-none transition-transform"
|
<svg id="folderTitleArrow"
|
||||||
viewBox="0 0 24 24">
|
class="h-4 w-6 flex-none transition-transform"
|
||||||
<path stroke="currentColor" stroke-width="2" fill="none"
|
viewBox="0 0 24 24">
|
||||||
stroke-linecap="round" stroke-linejoin="round"
|
<path stroke="currentColor" stroke-width="2" fill="none"
|
||||||
d="M9 5l7 7-7 7"/>
|
stroke-linecap="round" stroke-linejoin="round"
|
||||||
</svg>
|
d="M9 5l7 7-7 7"/>
|
||||||
<span id="currentTitle" class="font-semibold text-xl truncate"></span>
|
</svg>
|
||||||
|
<span id="currentTitle" class="font-semibold text-xl truncate"></span>
|
||||||
|
</div>
|
||||||
|
<button id="rewritePendingBtn"
|
||||||
|
class="hidden ml-3 px-3 py-1.5 text-sm border rounded font-semibold whitespace-nowrap"
|
||||||
|
style="background: var(--accent); color: #fff; border-color: var(--border)">
|
||||||
|
Rewrite all (0)
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<pre id="folderHierarchyDropdown"
|
<pre id="folderHierarchyDropdown"
|
||||||
class="hidden text-sm font-mono select-text leading-snug mb-2 mt-1 max-h-80 overflow-auto"
|
class="hidden text-sm font-mono select-text leading-snug mb-2 mt-1 max-h-80 overflow-auto"
|
||||||
@@ -275,6 +293,11 @@
|
|||||||
style="background: var(--accent); color: #fff; border-color: var(--border)">
|
style="background: var(--accent); color: #fff; border-color: var(--border)">
|
||||||
Commit
|
Commit
|
||||||
</button>-->
|
</button>-->
|
||||||
|
<button id="initRepoBtn"
|
||||||
|
class="ml-auto px-4 py-2 border rounded font-semibold hidden"
|
||||||
|
style="background: var(--accent); color: #fff; border-color: var(--border)">
|
||||||
|
Init Repo
|
||||||
|
</button>
|
||||||
<button id="readmeBtn"
|
<button id="readmeBtn"
|
||||||
class="ml-4 px-4 py-2 border rounded font-semibold"
|
class="ml-4 px-4 py-2 border rounded font-semibold"
|
||||||
style="background: var(--accent); color: #fff; border-color: var(--border)">
|
style="background: var(--accent); color: #fff; border-color: var(--border)">
|
||||||
@@ -283,10 +306,69 @@
|
|||||||
<button id="pushBtn"
|
<button id="pushBtn"
|
||||||
class="ml-2 px-4 py-2 border rounded font-semibold"
|
class="ml-2 px-4 py-2 border rounded font-semibold"
|
||||||
style="background: var(--accent); color: #fff; border-color: var(--border)">
|
style="background: var(--accent); color: #fff; border-color: var(--border)">
|
||||||
Push to Gitea
|
Push
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="rewordModeModal"
|
||||||
|
class="hidden fixed inset-0 z-50 items-center justify-center bg-black/40 px-4"
|
||||||
|
role="dialog" aria-modal="true" aria-labelledby="rewordModeTitle">
|
||||||
|
<div class="w-full max-w-md rounded-lg border bg-white p-5 shadow-xl"
|
||||||
|
style="border-color: var(--border)">
|
||||||
|
<h3 id="rewordModeTitle" class="text-lg font-semibold text-gray-900">
|
||||||
|
Reword commit message
|
||||||
|
</h3>
|
||||||
|
<p class="mt-2 text-sm text-gray-600">
|
||||||
|
Choose Automatic to ask the configured LLM, or Manual to type the message yourself.
|
||||||
|
</p>
|
||||||
|
<label class="mt-4 flex items-center gap-2 text-sm text-gray-700 select-none">
|
||||||
|
<input id="rememberRewordMode" type="checkbox" class="h-4 w-4" />
|
||||||
|
Remember my choice
|
||||||
|
</label>
|
||||||
|
<div class="mt-5 flex justify-end gap-2">
|
||||||
|
<button id="cancelRewordModeBtn" class="px-3 py-2 text-sm border rounded hover:bg-gray-100">
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
<button id="manualRewordModeBtn" class="px-3 py-2 text-sm border rounded hover:bg-gray-100">
|
||||||
|
Manual
|
||||||
|
</button>
|
||||||
|
<button id="autoRewordModeBtn" class="px-3 py-2 text-sm border rounded font-semibold"
|
||||||
|
style="background: var(--accent); color: #fff; border-color: var(--border)">
|
||||||
|
Automatic
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="manualRewordModal"
|
||||||
|
class="hidden fixed inset-0 z-50 items-center justify-center bg-black/40 px-4"
|
||||||
|
role="dialog" aria-modal="true" aria-labelledby="manualRewordTitle">
|
||||||
|
<form id="manualRewordForm"
|
||||||
|
class="w-full max-w-lg rounded-lg border bg-white p-5 shadow-xl"
|
||||||
|
style="border-color: var(--border)">
|
||||||
|
<h3 id="manualRewordTitle" class="text-lg font-semibold text-gray-900">
|
||||||
|
Enter commit message
|
||||||
|
</h3>
|
||||||
|
<p class="mt-2 text-sm text-gray-600">
|
||||||
|
Type the new single-line message for this commit.
|
||||||
|
</p>
|
||||||
|
<input id="manualRewordInput" type="text" required autocomplete="off"
|
||||||
|
class="mt-4 w-full rounded border border-gray-300 px-3 py-2 text-sm text-gray-900 focus:outline-none focus:ring-2"
|
||||||
|
style="--tw-ring-color: var(--accent)" />
|
||||||
|
<div class="mt-5 flex justify-end gap-2">
|
||||||
|
<button id="cancelManualRewordBtn" type="button"
|
||||||
|
class="px-3 py-2 text-sm border rounded hover:bg-gray-100">
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
<button id="applyManualRewordBtn" type="submit"
|
||||||
|
class="px-3 py-2 text-sm border rounded font-semibold"
|
||||||
|
style="background: var(--accent); color: #fff; border-color: var(--border)">
|
||||||
|
Apply
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script src="renderer.js"></script>
|
<script src="renderer.js"></script>
|
||||||
<script src="animeCat.js"></script>
|
<script src="animeCat.js"></script>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
@@ -313,4 +395,4 @@
|
|||||||
</script>
|
</script>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
47
package.json
@@ -1,47 +1,18 @@
|
|||||||
{
|
{
|
||||||
"productName": "Auto-Git",
|
"productName": "Auto-Git",
|
||||||
"name": "Auto-Git",
|
"name": "Auto-Git",
|
||||||
"description": "Auto-Git: Git-Surveillance with automatic LLM-Commit-Message and README.md compilation",
|
"version": "1.0.11",
|
||||||
"version": "1.0.0",
|
"description": "Auto-Git: Git-Überwachung mit automatischer LLM-Commit-Message und README-Erstellung",
|
||||||
"author": "Victor Giers",
|
"author": "Victor Giers",
|
||||||
"main": "main.js",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron .",
|
"prepare:tauri-frontend": "node scripts/prepare-tauri-frontend.mjs",
|
||||||
"dist": "electron-builder"
|
"start": "npm run prepare:tauri-frontend && tauri dev",
|
||||||
},
|
"tauri:dev": "npm run prepare:tauri-frontend && tauri dev",
|
||||||
"build": {
|
"dist": "npm run prepare:tauri-frontend && tauri build"
|
||||||
"appId": "com.victorgiers.auto-git",
|
|
||||||
"productName": "Auto-Git",
|
|
||||||
"files": [
|
|
||||||
"**/*"
|
|
||||||
],
|
|
||||||
"directories": {
|
|
||||||
"buildResources": "assets/icon"
|
|
||||||
},
|
|
||||||
"mac": {
|
|
||||||
"icon": "mac/icon.icns"
|
|
||||||
},
|
|
||||||
"win": {
|
|
||||||
"icon": "win/icon.ico"
|
|
||||||
},
|
|
||||||
"linux": {
|
|
||||||
"icon": "linux/icon.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"chokidar": "^4.0.3",
|
|
||||||
"electron-store": "^8.2.0",
|
|
||||||
"ignore": "^7.0.4",
|
|
||||||
"micromatch": "^4.0.8",
|
|
||||||
"node-fetch": "^3.3.2",
|
|
||||||
"simple-git": "^3.20.0",
|
|
||||||
"suncalc": "^1.9.0"
|
|
||||||
},
|
},
|
||||||
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"autoprefixer": "^10.4.21",
|
"@tauri-apps/api": "^2.11.0",
|
||||||
"electron": "^25.0.0",
|
"@tauri-apps/cli": "^2.11.0"
|
||||||
"electron-builder": "^26.0.12",
|
|
||||||
"postcss": "^8.5.3",
|
|
||||||
"tailwindcss": "^4.1.7"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
74
preload.js
@@ -1,74 +0,0 @@
|
|||||||
const { contextBridge, ipcRenderer } = require('electron');
|
|
||||||
|
|
||||||
contextBridge.exposeInMainWorld('settingsAPI', {
|
|
||||||
getSkyMode: () => ipcRenderer.invoke('get-skymode'),
|
|
||||||
setSkyMode: val => ipcRenderer.invoke('set-skymode', val),
|
|
||||||
getSkipPrompt: () => ipcRenderer.invoke('get-skip-git-prompt'),
|
|
||||||
setSkipPrompt: val => ipcRenderer.invoke('set-skip-git-prompt', val),
|
|
||||||
getIntelligentCommitThreshold: () => ipcRenderer.invoke('get-intelligent-commit-threshold'),
|
|
||||||
setIntelligentCommitThreshold: value => ipcRenderer.invoke('set-intelligent-commit-threshold', value),
|
|
||||||
getMinutesCommitThreshold: () => ipcRenderer.invoke('get-minutes-commit-threshold'),
|
|
||||||
setMinutesCommitThreshold: value => ipcRenderer.invoke('set-minutes-commit-threshold', value),
|
|
||||||
getCommitModel: () => ipcRenderer.invoke('get-commit-model'),
|
|
||||||
setCommitModel: (model) => ipcRenderer.invoke('set-commit-model', model),
|
|
||||||
getReadmeModel: () => ipcRenderer.invoke('get-readme-model'),
|
|
||||||
setReadmeModel: (model) => ipcRenderer.invoke('set-readme-model', model),
|
|
||||||
close: () => ipcRenderer.send('close-settings'),
|
|
||||||
getAutostart: () => ipcRenderer.invoke('get-autostart'),
|
|
||||||
setAutostart: val => ipcRenderer.invoke('set-autostart', val),
|
|
||||||
getCloseToTray: () => ipcRenderer.invoke('get-close-to-tray'),
|
|
||||||
setCloseToTray: val => ipcRenderer.invoke('set-close-to-tray', val),
|
|
||||||
});
|
|
||||||
|
|
||||||
contextBridge.exposeInMainWorld('electronAPI', {
|
|
||||||
getFolders: () => ipcRenderer.invoke('get-folders'),
|
|
||||||
addFolder: () => ipcRenderer.invoke('add-folder'),
|
|
||||||
removeFolder: folderObj=> ipcRenderer.invoke('remove-folder', folderObj),
|
|
||||||
getSelected: () => ipcRenderer.invoke('get-selected'),
|
|
||||||
setSelected: folderObj=> ipcRenderer.invoke('set-selected', folderObj),
|
|
||||||
getCommits: (folderObj, page, pageSize) => ipcRenderer.invoke('get-commits', folderObj, page, pageSize),
|
|
||||||
getAllCommitHashes: (folderObj) => ipcRenderer.invoke('get-all-commit-hashes', folderObj),
|
|
||||||
diffCommit: (folderObj, hash) => ipcRenderer.invoke('diff-commit', folderObj, hash),
|
|
||||||
revertCommit: (folderObj, hash) => ipcRenderer.invoke('revert-commit', folderObj, hash),
|
|
||||||
snapshotCommit: (folderObj, hash) => ipcRenderer.invoke('snapshot-commit', folderObj, hash),
|
|
||||||
checkoutCommit: (folderObj, hash) => ipcRenderer.invoke('checkout-commit', folderObj, hash),
|
|
||||||
getCommitCount: folderObj=> ipcRenderer.invoke('get-commit-count', folderObj),
|
|
||||||
hasDiffs: folderObj=> ipcRenderer.invoke('has-diffs', folderObj),
|
|
||||||
removeGitFolder:folderObj=> ipcRenderer.invoke('remove-git-folder', folderObj),
|
|
||||||
commitCurrentFolder: (folderObj, message) => ipcRenderer.invoke('commit-current-folder', folderObj, message),
|
|
||||||
showFolderContextMenu: folderPath => ipcRenderer.send('show-folder-context-menu', folderPath),
|
|
||||||
setMonitoring: (folderObj, monitoring) => ipcRenderer.invoke('set-monitoring', folderObj.path, monitoring),
|
|
||||||
getFolderTree: (folderPath) => ipcRenderer.invoke('get-folder-tree', folderPath),
|
|
||||||
showTreeContextMenu: (info) => ipcRenderer.send('show-tree-context-menu', info),
|
|
||||||
getSelectedSync: () => ipcRenderer.sendSync('get-selected-sync'),
|
|
||||||
getIntelligentCommitThreshold: () => ipcRenderer.invoke('get-intelligent-commit-threshold'),
|
|
||||||
setIntelligentCommitThreshold: value => ipcRenderer.invoke('set-minutes-commit-threshold', value),
|
|
||||||
getMinutesCommitThreshold: () => ipcRenderer.invoke('get-minutes-commit-threshold'),
|
|
||||||
setMinutesCommitThreshold: value => ipcRenderer.invoke('set-intelligent-commit-threshold', value),
|
|
||||||
ollamaList: () => ipcRenderer.invoke('ollama-list'),
|
|
||||||
ollamaPull: (model) => ipcRenderer.invoke('ollama-pull', model),
|
|
||||||
onTrayToggleMonitoring: (callback) => ipcRenderer.on('tray-toggle-monitoring', callback),
|
|
||||||
onTrayRemoveFolder: (callback) => ipcRenderer.on('tray-remove-folder', callback),
|
|
||||||
onTrayAddFolder: (callback) => ipcRenderer.on('tray-add-folder', callback),
|
|
||||||
onFoldersLocationUpdated: (callback) => ipcRenderer.on('folders-location-updated', (e, folderObj) => callback(folderObj)),
|
|
||||||
isGitRepo: (path) => ipcRenderer.invoke('is-git-repo', path),
|
|
||||||
relocateFolder: (oldPath, newPath) => ipcRenderer.invoke('relocate-folder', oldPath, newPath),
|
|
||||||
pickFolder: () => ipcRenderer.invoke('pick-folder'),
|
|
||||||
repoHasCommit: (repoPath, commitHash) => ipcRenderer.invoke('repo-has-commit', repoPath, commitHash),
|
|
||||||
addFolderByPath: (folderPath) => ipcRenderer.invoke('add-folder-by-path', folderPath),
|
|
||||||
onCatBegin: (cb) => ipcRenderer.on('cat-begin', cb),
|
|
||||||
onCatChunk: (cb) => ipcRenderer.on('cat-chunk', cb),
|
|
||||||
onCatEnd: (cb) => ipcRenderer.on('cat-end', cb),
|
|
||||||
getDailyCommitStats: () => ipcRenderer.invoke('get-daily-commit-stats'),
|
|
||||||
hasReadme: (folderPath) => ipcRenderer.invoke('has-readme', folderPath),
|
|
||||||
generateReadme: (folderPath) => ipcRenderer.invoke('generate-readme', folderPath),
|
|
||||||
pushToGitea: (folderPath) => ipcRenderer.invoke('push-to-gitea', folderPath),
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcRenderer.on('repo-updated', (_e, folder) => {
|
|
||||||
window.dispatchEvent(new CustomEvent('repo-updated', { detail: folder }));
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcRenderer.on('skymode-changed', (_e, val) => {
|
|
||||||
window.dispatchEvent(new CustomEvent('skymode-changed', { detail: val }));
|
|
||||||
});
|
|
||||||
335
renderer.js
@@ -7,7 +7,18 @@ window.addEventListener('DOMContentLoaded', async () => {
|
|||||||
const titleArrow = document.getElementById('folderTitleArrow');
|
const titleArrow = document.getElementById('folderTitleArrow');
|
||||||
const contentList = document.getElementById('contentList');
|
const contentList = document.getElementById('contentList');
|
||||||
const readmeBtn = document.getElementById('readmeBtn');
|
const readmeBtn = document.getElementById('readmeBtn');
|
||||||
|
const initRepoBtn = document.getElementById('initRepoBtn');
|
||||||
const pushBtn = document.getElementById('pushBtn');
|
const pushBtn = document.getElementById('pushBtn');
|
||||||
|
const rewritePendingBtn = document.getElementById('rewritePendingBtn');
|
||||||
|
const rewordModeModal = document.getElementById('rewordModeModal');
|
||||||
|
const rememberRewordMode = document.getElementById('rememberRewordMode');
|
||||||
|
const cancelRewordModeBtn = document.getElementById('cancelRewordModeBtn');
|
||||||
|
const manualRewordModeBtn = document.getElementById('manualRewordModeBtn');
|
||||||
|
const autoRewordModeBtn = document.getElementById('autoRewordModeBtn');
|
||||||
|
const manualRewordModal = document.getElementById('manualRewordModal');
|
||||||
|
const manualRewordForm = document.getElementById('manualRewordForm');
|
||||||
|
const manualRewordInput = document.getElementById('manualRewordInput');
|
||||||
|
const cancelManualRewordBtn = document.getElementById('cancelManualRewordBtn');
|
||||||
const panel = document.querySelector('.flex-1.p-4.overflow-y-auto');
|
const panel = document.querySelector('.flex-1.p-4.overflow-y-auto');
|
||||||
const PAGE_SIZE = 50;
|
const PAGE_SIZE = 50;
|
||||||
|
|
||||||
@@ -15,9 +26,63 @@ window.addEventListener('DOMContentLoaded', async () => {
|
|||||||
paginationEl.className = 'pagination flex justify-center items-center my-2 space-x-2';
|
paginationEl.className = 'pagination flex justify-center items-center my-2 space-x-2';
|
||||||
contentList.parentElement.insertBefore(paginationEl, contentList);
|
contentList.parentElement.insertBefore(paginationEl, contentList);
|
||||||
|
|
||||||
|
|
||||||
let lastFolderPath = null;
|
let lastFolderPath = null;
|
||||||
let lastPage = null;
|
let lastPage = null;
|
||||||
|
|
||||||
|
function chooseRewordMode() {
|
||||||
|
rememberRewordMode.checked = false;
|
||||||
|
rewordModeModal.classList.remove('hidden');
|
||||||
|
rewordModeModal.classList.add('flex');
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const finish = mode => {
|
||||||
|
rewordModeModal.classList.add('hidden');
|
||||||
|
rewordModeModal.classList.remove('flex');
|
||||||
|
resolve(mode ? { mode, remember: rememberRewordMode.checked } : null);
|
||||||
|
};
|
||||||
|
cancelRewordModeBtn.onclick = () => finish(null);
|
||||||
|
manualRewordModeBtn.onclick = () => finish('manual');
|
||||||
|
autoRewordModeBtn.onclick = () => finish('auto');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function promptForCommitMessage(currentMessage) {
|
||||||
|
manualRewordInput.value = currentMessage || '';
|
||||||
|
manualRewordInput.setCustomValidity('');
|
||||||
|
manualRewordModal.classList.remove('hidden');
|
||||||
|
manualRewordModal.classList.add('flex');
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
manualRewordInput.focus();
|
||||||
|
manualRewordInput.select();
|
||||||
|
});
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const finish = message => {
|
||||||
|
manualRewordModal.classList.add('hidden');
|
||||||
|
manualRewordModal.classList.remove('flex');
|
||||||
|
resolve(message);
|
||||||
|
};
|
||||||
|
cancelManualRewordBtn.onclick = () => finish(null);
|
||||||
|
manualRewordInput.oninput = () => manualRewordInput.setCustomValidity('');
|
||||||
|
manualRewordInput.onkeydown = event => {
|
||||||
|
if (event.key === 'Escape') {
|
||||||
|
event.preventDefault();
|
||||||
|
finish(null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
manualRewordForm.onsubmit = event => {
|
||||||
|
event.preventDefault();
|
||||||
|
const message = manualRewordInput.value.trim();
|
||||||
|
if (!message) {
|
||||||
|
manualRewordInput.setCustomValidity('The commit message cannot be empty.');
|
||||||
|
manualRewordInput.reportValidity();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
manualRewordInput.setCustomValidity('');
|
||||||
|
finish(message);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const slot = document.getElementById('catSlot');
|
const slot = document.getElementById('catSlot');
|
||||||
window.cat = new window.AnimeCat(slot, {
|
window.cat = new window.AnimeCat(slot, {
|
||||||
images: {
|
images: {
|
||||||
@@ -68,7 +133,50 @@ window.addEventListener('DOMContentLoaded', async () => {
|
|||||||
alert('❌ Unexpected error:\n' + (err.message || err));
|
alert('❌ Unexpected error:\n' + (err.message || err));
|
||||||
} finally {
|
} finally {
|
||||||
pushBtn.disabled = false;
|
pushBtn.disabled = false;
|
||||||
pushBtn.textContent = 'Push to Gitea';
|
pushBtn.textContent = 'Push';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
initRepoBtn.addEventListener('click', async () => {
|
||||||
|
const selected = await window.electronAPI.getSelected();
|
||||||
|
if (!selected || !selected.path) {
|
||||||
|
return alert('No folder selected!');
|
||||||
|
}
|
||||||
|
initRepoBtn.disabled = true;
|
||||||
|
initRepoBtn.textContent = 'Initializing…';
|
||||||
|
try {
|
||||||
|
const result = await window.electronAPI.initRepo(selected.path);
|
||||||
|
if (!result?.success) {
|
||||||
|
throw new Error(result?.error || 'Init failed');
|
||||||
|
}
|
||||||
|
await renderSidebar();
|
||||||
|
const refreshed = await window.electronAPI.getSelected();
|
||||||
|
if (refreshed) {
|
||||||
|
await renderContent(refreshed);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
alert('Init failed:\n' + (err.message || err));
|
||||||
|
} finally {
|
||||||
|
initRepoBtn.disabled = false;
|
||||||
|
initRepoBtn.textContent = 'Init Repo';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
rewritePendingBtn.addEventListener('click', async () => {
|
||||||
|
const selected = await window.electronAPI.getSelected();
|
||||||
|
if (!selected?.path) return;
|
||||||
|
rewritePendingBtn.disabled = true;
|
||||||
|
rewritePendingBtn.textContent = 'Starting rewrite…';
|
||||||
|
try {
|
||||||
|
const result = await window.electronAPI.rewritePendingCommits(selected.path);
|
||||||
|
if (!result?.success) {
|
||||||
|
alert('Rewrite could not start:\n' + (result?.error || 'Unknown error'));
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
alert('Rewrite could not start:\n' + (err.message || err));
|
||||||
|
} finally {
|
||||||
|
const refreshed = await getFolderObjByPath(selected.path);
|
||||||
|
if (refreshed) await renderContent(refreshed, lastPage);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -91,10 +199,23 @@ window.addEventListener('DOMContentLoaded', async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
window.addEventListener('tauri-folder-drop', async e => {
|
||||||
|
const paths = Array.isArray(e.detail) ? e.detail : [];
|
||||||
|
for (const folderPath of paths) {
|
||||||
|
await window.electronAPI.addFolderByPath(folderPath);
|
||||||
|
}
|
||||||
|
if (paths.length) {
|
||||||
|
await renderSidebar();
|
||||||
|
const sel = await window.electronAPI.getSelected();
|
||||||
|
if (sel) await renderContent(sel);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Sky-Mode Setup
|
// Theme Setup (Sky = dynamic, Default/Grey = static)
|
||||||
const DAY_COLOR = [173, 216, 230];
|
const DAY_COLOR = [173, 216, 230];
|
||||||
const NIGHT_COLOR = [0, 0, 50];
|
const NIGHT_COLOR = [0, 0, 50];
|
||||||
|
const VALID_THEMES = ['default', 'sky', 'grey'];
|
||||||
|
let currentTheme = 'default';
|
||||||
function lerpColor(c1, c2, t) {
|
function lerpColor(c1, c2, t) {
|
||||||
return c1.map((v, i) => Math.round(v + t * (c2[i] - v)));
|
return c1.map((v, i) => Math.round(v + t * (c2[i] - v)));
|
||||||
}
|
}
|
||||||
@@ -113,28 +234,36 @@ window.addEventListener('DOMContentLoaded', async () => {
|
|||||||
panel.style.backgroundColor = `rgb(${r}, ${g}, ${b})`;
|
panel.style.backgroundColor = `rgb(${r}, ${g}, ${b})`;
|
||||||
}
|
}
|
||||||
let skyIntervalId, titleIntervalId;
|
let skyIntervalId, titleIntervalId;
|
||||||
function applySkyMode(enabled) {
|
function applyTheme(theme) {
|
||||||
document.body.classList.toggle('sky-mode', enabled);
|
const normalized = VALID_THEMES.includes(theme) ? theme : 'default';
|
||||||
|
currentTheme = normalized;
|
||||||
|
|
||||||
|
document.body.classList.remove('theme-sky', 'theme-grey');
|
||||||
|
if (normalized === 'sky') document.body.classList.add('theme-sky');
|
||||||
|
if (normalized === 'grey') document.body.classList.add('theme-grey');
|
||||||
|
|
||||||
clearInterval(skyIntervalId);
|
clearInterval(skyIntervalId);
|
||||||
clearInterval(titleIntervalId);
|
clearInterval(titleIntervalId);
|
||||||
if (enabled) {
|
if (normalized === 'sky') {
|
||||||
updateBackground();
|
updateBackground();
|
||||||
skyIntervalId = setInterval(updateBackground, 60_000);
|
skyIntervalId = setInterval(updateBackground, 60_000);
|
||||||
function updateAllTextColors() { setTextColor('sky'); }
|
const updateAllTextColors = () => setTextColor('sky');
|
||||||
updateAllTextColors();
|
updateAllTextColors();
|
||||||
titleIntervalId = setInterval(updateAllTextColors, 60_000);
|
titleIntervalId = setInterval(updateAllTextColors, 60_000);
|
||||||
} else {
|
} else {
|
||||||
panel.style.backgroundColor = '';
|
panel.style.backgroundColor = '';
|
||||||
setTextColor('default');
|
setTextColor(normalized);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const initialSky = await window.settingsAPI.getSkyMode();
|
const initialTheme = await window.settingsAPI.getTheme();
|
||||||
applySkyMode(initialSky);
|
applyTheme(initialTheme);
|
||||||
window.addEventListener('skymode-changed', e => applySkyMode(e.detail));
|
window.addEventListener('theme-changed', e => applyTheme(e.detail));
|
||||||
|
|
||||||
function setTextColor(mode) {
|
function setTextColor(mode) {
|
||||||
let textColor = '#111';
|
let textColor = '#111';
|
||||||
if (mode === 'sky') {
|
if (mode === 'grey') {
|
||||||
|
textColor = '#1f2937';
|
||||||
|
} else if (mode === 'sky') {
|
||||||
const hour = new Date().getHours();
|
const hour = new Date().getHours();
|
||||||
textColor = (hour >= 18 || hour < 6) ? '#fff' : '#111';
|
textColor = (hour >= 18 || hour < 6) ? '#fff' : '#111';
|
||||||
}
|
}
|
||||||
@@ -256,8 +385,14 @@ window.addEventListener('DOMContentLoaded', async () => {
|
|||||||
const pauseBtn = li.querySelector('.pause-play-btn');
|
const pauseBtn = li.querySelector('.pause-play-btn');
|
||||||
pauseBtn.addEventListener('click', async e => {
|
pauseBtn.addEventListener('click', async e => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
await window.electronAPI.setMonitoring(folderObj, !isMonitoring);
|
pauseBtn.disabled = true;
|
||||||
await renderSidebar();
|
try {
|
||||||
|
await window.electronAPI.setMonitoring(folderObj, !isMonitoring);
|
||||||
|
} catch (err) {
|
||||||
|
alert(`Monitoring could not be changed:\n${err?.message || err}`);
|
||||||
|
} finally {
|
||||||
|
await renderSidebar();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Remove-Button
|
// Remove-Button
|
||||||
@@ -415,7 +550,7 @@ window.addEventListener('DOMContentLoaded', async () => {
|
|||||||
|
|
||||||
const tree = await window.electronAPI.getFolderTree(selected.path);
|
const tree = await window.electronAPI.getFolderTree(selected.path);
|
||||||
folderHierarchyDropdown.innerHTML = renderFolderTreeAscii(tree, '.', '');
|
folderHierarchyDropdown.innerHTML = renderFolderTreeAscii(tree, '.', '');
|
||||||
setTextColor(document.body.classList.contains('sky-mode') ? 'sky' : 'default');
|
setTextColor(currentTheme);
|
||||||
});
|
});
|
||||||
|
|
||||||
folderHierarchyDropdown.addEventListener('contextmenu', function(e) {
|
folderHierarchyDropdown.addEventListener('contextmenu', function(e) {
|
||||||
@@ -463,10 +598,33 @@ window.addEventListener('DOMContentLoaded', async () => {
|
|||||||
|
|
||||||
async function renderContent(folderObj, page) {
|
async function renderContent(folderObj, page) {
|
||||||
closeDropdown();
|
closeDropdown();
|
||||||
|
window.currentSelectedFolderObj = folderObj;
|
||||||
const folder = folderObj.path;
|
const folder = folderObj.path;
|
||||||
await updateInteractionBar(folderObj);
|
await updateInteractionBar(folderObj);
|
||||||
titleEl.textContent = folder;
|
titleEl.textContent = folder;
|
||||||
setTextColor(document.body.classList.contains('sky-mode') ? 'sky' : 'default');
|
setTextColor(currentTheme);
|
||||||
|
|
||||||
|
const isGit = await window.electronAPI.isGitRepo(folder);
|
||||||
|
initRepoBtn.classList.toggle('hidden', isGit);
|
||||||
|
initRepoBtn.disabled = isGit;
|
||||||
|
readmeBtn.disabled = !isGit;
|
||||||
|
pushBtn.disabled = !isGit;
|
||||||
|
pushBtn.classList.toggle('hidden', !isGit);
|
||||||
|
if (!isGit) {
|
||||||
|
rewritePendingBtn.classList.add('hidden');
|
||||||
|
contentList.innerHTML = '<div class="p-6 text-gray-500">Not a Git repository. Click "Init Repo" to initialize.</div>';
|
||||||
|
paginationEl.innerHTML = '';
|
||||||
|
lastFolderPath = folder;
|
||||||
|
lastPage = null;
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
initRepoBtn.classList.add('hidden');
|
||||||
|
}
|
||||||
|
|
||||||
|
const commitCount = await window.electronAPI.getCommitCount(folderObj);
|
||||||
|
const hasCommits = commitCount > 0;
|
||||||
|
pushBtn.classList.toggle('hidden', !hasCommits);
|
||||||
|
pushBtn.disabled = !hasCommits;
|
||||||
|
|
||||||
// Jetzt erst den Readme-Button-Text aktualisieren:
|
// Jetzt erst den Readme-Button-Text aktualisieren:
|
||||||
const hasReadme = await window.electronAPI.hasReadme(folder);
|
const hasReadme = await window.electronAPI.hasReadme(folder);
|
||||||
@@ -480,19 +638,24 @@ window.addEventListener('DOMContentLoaded', async () => {
|
|||||||
lastFolderPath = folder;
|
lastFolderPath = folder;
|
||||||
lastPage = usePage;
|
lastPage = usePage;
|
||||||
|
|
||||||
const { head, commits, total, page: currentPage, pageSize, pages } =
|
const { head, commits, total, page: currentPage, pageSize, pages, pendingRewriteCount } =
|
||||||
await window.electronAPI.getCommits(folderObj, usePage, PAGE_SIZE);
|
await window.electronAPI.getCommits(folderObj, usePage, PAGE_SIZE);
|
||||||
|
|
||||||
|
const pendingCount = pendingRewriteCount || 0;
|
||||||
|
rewritePendingBtn.classList.toggle('hidden', pendingCount === 0 && !folderObj.rewriteInProgress);
|
||||||
|
rewritePendingBtn.disabled = !!folderObj.rewriteInProgress || pendingCount === 0;
|
||||||
|
rewritePendingBtn.textContent = folderObj.rewriteInProgress
|
||||||
|
? 'Rewriting…'
|
||||||
|
: `Rewrite all (${pendingCount})`;
|
||||||
|
|
||||||
if (!commits || !commits.length) {
|
if (!commits || !commits.length) {
|
||||||
|
rewritePendingBtn.classList.add('hidden');
|
||||||
contentList.innerHTML = '<div class="p-6 text-gray-500">No commits found.</div>';
|
contentList.innerHTML = '<div class="p-6 text-gray-500">No commits found.</div>';
|
||||||
paginationEl.innerHTML = '';
|
paginationEl.innerHTML = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
contentList.innerHTML = commits.map(c => {
|
contentList.innerHTML = commits.map(c => {
|
||||||
const isQueued = folderObj.llmCandidates && folderObj.llmCandidates.some(fullHash =>
|
|
||||||
fullHash.startsWith(c.hash)
|
|
||||||
);
|
|
||||||
return `
|
return `
|
||||||
<li style="position:relative;" class="w-full p-3 mb-2 bg-white border border-gray-200 rounded shadow-sm
|
<li style="position:relative;" class="w-full p-3 mb-2 bg-white border border-gray-200 rounded shadow-sm
|
||||||
${c.hash === head ? 'current-commit' : ''}">
|
${c.hash === head ? 'current-commit' : ''}">
|
||||||
@@ -501,7 +664,7 @@ window.addEventListener('DOMContentLoaded', async () => {
|
|||||||
<span>${new Date(c.date).toLocaleString()}</span>
|
<span>${new Date(c.date).toLocaleString()}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-gray-800 mb-2">${c.message}</div>
|
<div class="text-gray-800 mb-2">${c.message}</div>
|
||||||
<div class="flex space-x-2 mb-2">
|
<div class="flex flex-wrap gap-2 mb-2">
|
||||||
<button class="diff-btn flex items-center px-2 py-1 text-xs border rounded hover:bg-gray-100" data-hash="${c.hash}">
|
<button class="diff-btn flex items-center px-2 py-1 text-xs border rounded hover:bg-gray-100" data-hash="${c.hash}">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1 rotate" viewBox="0 0 24 24"
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1 rotate" viewBox="0 0 24 24"
|
||||||
stroke="currentColor" fill="none">
|
stroke="currentColor" fill="none">
|
||||||
@@ -527,6 +690,17 @@ window.addEventListener('DOMContentLoaded', async () => {
|
|||||||
</svg>
|
</svg>
|
||||||
Jump Here
|
Jump Here
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
class="reword-btn flex items-center px-2 py-1 text-xs border rounded ${!c.canReword || folderObj.rewriteInProgress ? 'disabled' : 'hover:bg-gray-100'}"
|
||||||
|
data-hash="${c.hash}"
|
||||||
|
title="${c.canReword ? 'Generate and apply a new LLM commit message' : 'This commit is not in the current HEAD history'}"
|
||||||
|
${!c.canReword || folderObj.rewriteInProgress ? 'disabled' : ''}>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||||
|
d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
|
||||||
|
</svg>
|
||||||
|
Reword
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="diff-container relative">
|
<div class="diff-container relative">
|
||||||
<button class="copy-diff-btn absolute top-1 right-1 p-1 border rounded hover:bg-gray-100 flex items-center justify-center">
|
<button class="copy-diff-btn absolute top-1 right-1 p-1 border rounded hover:bg-gray-100 flex items-center justify-center">
|
||||||
@@ -540,12 +714,13 @@ window.addEventListener('DOMContentLoaded', async () => {
|
|||||||
<pre class="m-0"></pre>
|
<pre class="m-0"></pre>
|
||||||
</div>
|
</div>
|
||||||
${
|
${
|
||||||
isQueued
|
c.needsRewrite
|
||||||
? `<img src="assets/cat/paw.png"
|
? `<img src="assets/cat/paw.png"
|
||||||
alt="In Rewrite Queue"
|
alt="Needs LLM rewrite"
|
||||||
title="In Rewrite Queue"
|
title="Needs LLM rewrite — click to retry this commit"
|
||||||
class="paw-queued"
|
class="paw-queued"
|
||||||
style="pointer-events: none; z-index:10;">`
|
data-hash="${c.hash}"
|
||||||
|
style="pointer-events: auto; cursor: pointer; z-index:10;">`
|
||||||
: ''
|
: ''
|
||||||
}
|
}
|
||||||
</li>`;
|
</li>`;
|
||||||
@@ -640,6 +815,87 @@ window.addEventListener('DOMContentLoaded', async () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function startSingleRewrite(hash, control) {
|
||||||
|
control.disabled = true;
|
||||||
|
try {
|
||||||
|
const result = await window.electronAPI.rewriteCommit(folderObj.path, hash);
|
||||||
|
if (!result?.success) {
|
||||||
|
alert('Rewrite could not start:\n' + (result?.error || 'Unknown error'));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Commit rewrite error:', e);
|
||||||
|
alert('Rewrite could not start:\n' + (e.message || e));
|
||||||
|
} finally {
|
||||||
|
const refreshed = await getFolderObjByPath(folderObj.path);
|
||||||
|
if (refreshed) await renderContent(refreshed, currentPage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function startTypedRewrite(hash, currentMessage, control) {
|
||||||
|
const message = await promptForCommitMessage(currentMessage);
|
||||||
|
if (message === null) return;
|
||||||
|
control.disabled = true;
|
||||||
|
try {
|
||||||
|
const result = await window.electronAPI.rewriteCommitWithMessage(
|
||||||
|
folderObj.path,
|
||||||
|
hash,
|
||||||
|
message
|
||||||
|
);
|
||||||
|
if (!result?.success) {
|
||||||
|
alert('Rewrite could not start:\n' + (result?.error || 'Unknown error'));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Typed commit rewrite error:', e);
|
||||||
|
alert('Rewrite could not start:\n' + (e.message || e));
|
||||||
|
} finally {
|
||||||
|
const refreshed = await getFolderObjByPath(folderObj.path);
|
||||||
|
if (refreshed) await renderContent(refreshed, currentPage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleRewordButton(commit, control) {
|
||||||
|
let mode = 'ask';
|
||||||
|
try {
|
||||||
|
mode = await window.settingsAPI.getRewordMode();
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Could not load Reword choice:', e);
|
||||||
|
}
|
||||||
|
if (!['ask', 'auto', 'manual'].includes(mode)) mode = 'ask';
|
||||||
|
if (mode === 'ask') {
|
||||||
|
const choice = await chooseRewordMode();
|
||||||
|
if (!choice) return;
|
||||||
|
mode = choice.mode;
|
||||||
|
if (choice.remember) {
|
||||||
|
try {
|
||||||
|
await window.settingsAPI.setRewordMode(mode);
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Could not remember Reword choice:', e);
|
||||||
|
alert('Your choice could not be saved, but this rewrite will continue.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mode === 'manual') {
|
||||||
|
await startTypedRewrite(commit.hash, commit.message, control);
|
||||||
|
} else {
|
||||||
|
await startSingleRewrite(commit.hash, control);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reword is available for every commit in the current HEAD history.
|
||||||
|
contentList.querySelectorAll('.reword-btn').forEach(btn => {
|
||||||
|
btn.addEventListener('click', async () => {
|
||||||
|
const commit = commits.find(item => item.hash === btn.dataset.hash);
|
||||||
|
if (commit) await handleRewordButton(commit, btn);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// A paw is both the durable "needs rewrite" marker and its individual retry action.
|
||||||
|
contentList.querySelectorAll('.paw-queued').forEach(img => {
|
||||||
|
img.addEventListener('click', async () => {
|
||||||
|
await startSingleRewrite(img.dataset.hash, img);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Copy-Diff-Button
|
// Copy-Diff-Button
|
||||||
contentList.querySelectorAll('.diff-container').forEach(container => {
|
contentList.querySelectorAll('.diff-container').forEach(container => {
|
||||||
const btn = container.querySelector('.copy-diff-btn');
|
const btn = container.querySelector('.copy-diff-btn');
|
||||||
@@ -697,6 +953,35 @@ window.addEventListener('DOMContentLoaded', async () => {
|
|||||||
await renderContent(obj);
|
await renderContent(obj);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.addEventListener('rewrite-progress', async e => {
|
||||||
|
const progress = e.detail || {};
|
||||||
|
const selected = await window.electronAPI.getSelected();
|
||||||
|
if (!selected || selected.path !== progress.folderPath) return;
|
||||||
|
|
||||||
|
if (progress.status === 'running') {
|
||||||
|
rewritePendingBtn.classList.remove('hidden');
|
||||||
|
rewritePendingBtn.disabled = true;
|
||||||
|
rewritePendingBtn.textContent = `Rewriting ${progress.current}/${progress.total}…`;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const refreshed = await getFolderObjByPath(progress.folderPath);
|
||||||
|
if (refreshed) await renderContent(refreshed, lastPage);
|
||||||
|
if (progress.status === 'failed' || progress.status === 'partial') {
|
||||||
|
const heading = progress.status === 'partial'
|
||||||
|
? 'Some commit messages could not be rewritten. Their paws remain.'
|
||||||
|
: 'The commit message could not be rewritten. Its paw remains.';
|
||||||
|
const details = progress.error ? `\n\n${String(progress.error).slice(0, 1200)}` : '';
|
||||||
|
alert(heading + details);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener('monitoring-error', e => {
|
||||||
|
const detail = e.detail || {};
|
||||||
|
const message = detail.message || detail.code || 'Unknown monitoring error';
|
||||||
|
alert(`Auto-Git paused a repository operation:\n${message}`);
|
||||||
|
});
|
||||||
|
|
||||||
titleEl.addEventListener('contextmenu', e => {
|
titleEl.addEventListener('contextmenu', e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (titleEl.textContent !== 'No folder selected') {
|
if (titleEl.textContent !== 'No folder selected') {
|
||||||
@@ -781,4 +1066,4 @@ window.addEventListener('DOMContentLoaded', async () => {
|
|||||||
window.updateCatGlow = function(commitCount) {
|
window.updateCatGlow = function(commitCount) {
|
||||||
if (window.cat) window.cat.animateCatGlow(commitCount);
|
if (window.cat) window.cat.animateCatGlow(commitCount);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
14
scripts/prepare-tauri-frontend.mjs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { cp, mkdir, rm } from 'node:fs/promises';
|
||||||
|
import path from 'node:path';
|
||||||
|
|
||||||
|
const root = process.cwd();
|
||||||
|
const out = path.join(root, 'dist-tauri');
|
||||||
|
|
||||||
|
await rm(out, { recursive: true, force: true });
|
||||||
|
await mkdir(out, { recursive: true });
|
||||||
|
|
||||||
|
for (const file of ['index.html', 'settings.html', 'renderer.js', 'animeCat.js', 'tauriBridge.js']) {
|
||||||
|
await cp(path.join(root, file), path.join(out, file));
|
||||||
|
}
|
||||||
|
|
||||||
|
await cp(path.join(root, 'assets'), path.join(out, 'assets'), { recursive: true });
|
||||||
148
settings.html
@@ -14,7 +14,7 @@
|
|||||||
--accent: #9f1239; /* Rosa */
|
--accent: #9f1239; /* Rosa */
|
||||||
--border: #fff;
|
--border: #fff;
|
||||||
}
|
}
|
||||||
body.sky-mode {
|
body.theme-sky {
|
||||||
/* Sky-Mode: Himmelshintergrund und passende Akzente */
|
/* Sky-Mode: Himmelshintergrund und passende Akzente */
|
||||||
--bg-main: rgb(173,216,230); /* sanftes Baby-Blau */
|
--bg-main: rgb(173,216,230); /* sanftes Baby-Blau */
|
||||||
--bg-sidebar: rgb(200,220,240); /* etwas dunkleres Blau */
|
--bg-sidebar: rgb(200,220,240); /* etwas dunkleres Blau */
|
||||||
@@ -23,6 +23,13 @@
|
|||||||
|
|
||||||
background: var(--border);
|
background: var(--border);
|
||||||
}
|
}
|
||||||
|
body.theme-grey {
|
||||||
|
--bg-main: #f5f5f5;
|
||||||
|
--bg-sidebar: #eceff1;
|
||||||
|
--accent: #374151;
|
||||||
|
--border: #d1d5db;
|
||||||
|
background: var(--bg-main);
|
||||||
|
}
|
||||||
|
|
||||||
html, body {
|
html, body {
|
||||||
width: 100%; height: 100%;
|
width: 100%; height: 100%;
|
||||||
@@ -154,21 +161,27 @@
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<script src="tauriBridge.js"></script>
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener('DOMContentLoaded', async () => {
|
window.addEventListener('DOMContentLoaded', async () => {
|
||||||
const isSky = await window.settingsAPI.getSkyMode();
|
const applyThemeClass = (theme) => {
|
||||||
document.body.classList.toggle('sky-mode', isSky);
|
document.body.classList.remove('theme-sky', 'theme-grey');
|
||||||
|
if (theme === 'sky') document.body.classList.add('theme-sky');
|
||||||
|
if (theme === 'grey') document.body.classList.add('theme-grey');
|
||||||
|
};
|
||||||
|
const VALID_THEMES = ['sky', 'default', 'grey'];
|
||||||
|
|
||||||
// Elemente holen
|
// Elemente holen
|
||||||
const themeSelect = document.getElementById('themeSelect');
|
const themeSelect = document.getElementById('themeSelect');
|
||||||
const cbSky = document.getElementById('skymode');
|
const cbSkip = document.getElementById('skipPrompt');
|
||||||
const cbSkip = document.getElementById('skipPrompt');
|
const thresholdInput = document.getElementById('intelligentCommitThresholdInput');
|
||||||
const thresholdInput = document.getElementById('intelligentCommitThresholdInput');
|
const minutesInput = document.getElementById('intelligentCommitMinutesInput');
|
||||||
const minutesInput = document.getElementById('intelligentCommitMinutesInput');
|
const rewordModeSelect = document.getElementById('rewordModeSelect');
|
||||||
const ok = document.getElementById('okBtn');
|
const ok = document.getElementById('okBtn');
|
||||||
const cancel = document.getElementById('cancelBtn');
|
const cancel = document.getElementById('cancelBtn');
|
||||||
const cbAutostart = document.getElementById('autostart');
|
const cbAutostart = document.getElementById('autostart');
|
||||||
const cbCloseToTray= document.getElementById('closeToTray');
|
const cbCloseToTray = document.getElementById('closeToTray');
|
||||||
|
const giteaTokenInput = document.getElementById('giteaTokenInput');
|
||||||
|
|
||||||
const [initialAutostart, initialCloseToTray] = await Promise.all([
|
const [initialAutostart, initialCloseToTray] = await Promise.all([
|
||||||
window.settingsAPI.getAutostart(),
|
window.settingsAPI.getAutostart(),
|
||||||
@@ -178,55 +191,82 @@
|
|||||||
cbCloseToTray.checked = initialCloseToTray;
|
cbCloseToTray.checked = initialCloseToTray;
|
||||||
|
|
||||||
// Initialwerte parallel laden
|
// Initialwerte parallel laden
|
||||||
const [initialSky, initialSkip, initialThreshold, initialMinutes] = await Promise.all([
|
const [initialTheme, initialSkip, initialThreshold, initialMinutes, initialRewordMode] = await Promise.all([
|
||||||
window.settingsAPI.getSkyMode(),
|
window.settingsAPI.getTheme(),
|
||||||
window.settingsAPI.getSkipPrompt(),
|
window.settingsAPI.getSkipPrompt(),
|
||||||
window.electronAPI.getIntelligentCommitThreshold(),
|
window.electronAPI.getIntelligentCommitThreshold(),
|
||||||
window.electronAPI.getMinutesCommitThreshold()
|
window.electronAPI.getMinutesCommitThreshold(),
|
||||||
|
window.settingsAPI.getRewordMode()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const fallbackTheme = VALID_THEMES.includes(initialTheme) ? initialTheme : 'sky';
|
||||||
|
themeSelect.value = fallbackTheme;
|
||||||
|
applyThemeClass(fallbackTheme);
|
||||||
// Inputs setzen
|
// Inputs setzen
|
||||||
cbSky.checked = initialSky;
|
|
||||||
cbSkip.checked = initialSkip;
|
cbSkip.checked = initialSkip;
|
||||||
thresholdInput.value = initialThreshold;
|
thresholdInput.value = initialThreshold;
|
||||||
minutesInput.value = initialMinutes;
|
minutesInput.value = initialMinutes;
|
||||||
|
rewordModeSelect.value = ['ask', 'auto', 'manual'].includes(initialRewordMode)
|
||||||
|
? initialRewordMode
|
||||||
|
: 'ask';
|
||||||
|
|
||||||
// **Vorschau**: Sky-Mode sofort übernehmen
|
// **Vorschau**: Theme sofort übernehmen
|
||||||
cbSky.addEventListener('change', async () => {
|
themeSelect.addEventListener('change', async () => {
|
||||||
await window.settingsAPI.setSkyMode(cbSky.checked);
|
const val = themeSelect.value || 'default';
|
||||||
document.body.classList.toggle('sky-mode', cbSky.checked);
|
await window.settingsAPI.setTheme(val);
|
||||||
|
applyThemeClass(val);
|
||||||
});
|
});
|
||||||
// OK: alles final speichern
|
|
||||||
|
|
||||||
|
const initialToken = await window.settingsAPI.getGiteaToken();
|
||||||
|
giteaTokenInput.value = initialToken || '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// OK: alles final speichern – eine fehlschlagende Einstellung darf die
|
||||||
|
// anderen nicht blockieren und das Fenster muss sich immer schließen.
|
||||||
ok.addEventListener('click', async () => {
|
ok.addEventListener('click', async () => {
|
||||||
await window.settingsAPI.setSkipPrompt(cbSkip.checked);
|
const errors = [];
|
||||||
await window.settingsAPI.setAutostart(cbAutostart.checked);
|
const safe = async (name, promise) => {
|
||||||
await window.settingsAPI.setCloseToTray(cbCloseToTray.checked);
|
try { await promise; } catch (e) { errors.push(`${name}: ${e}`); }
|
||||||
// SkyMode haben wir ja schon beim Change gesetzt
|
};
|
||||||
|
|
||||||
|
await safe('Skip-Prompt', window.settingsAPI.setSkipPrompt(cbSkip.checked));
|
||||||
|
await safe('Autostart', window.settingsAPI.setAutostart(cbAutostart.checked));
|
||||||
|
await safe('Close-to-Tray', window.settingsAPI.setCloseToTray(cbCloseToTray.checked));
|
||||||
|
await safe('Theme', window.settingsAPI.setTheme(themeSelect.value || fallbackTheme));
|
||||||
|
await safe('Reword-Mode', window.settingsAPI.setRewordMode(rewordModeSelect.value || 'ask'));
|
||||||
|
|
||||||
// Threshold speichern (immer Wert aus Feld nehmen!)
|
// Threshold speichern (immer Wert aus Feld nehmen!)
|
||||||
let threshold = parseInt(thresholdInput.value, 10);
|
let threshold = parseInt(thresholdInput.value, 10);
|
||||||
if (isNaN(threshold)) threshold = 10;
|
if (isNaN(threshold)) threshold = 10;
|
||||||
if (threshold < 1) threshold = 1;
|
if (threshold < 1) threshold = 1;
|
||||||
if (threshold > 1000) threshold = 1000;
|
if (threshold > 1000) threshold = 1000;
|
||||||
await window.settingsAPI.setIntelligentCommitThreshold(threshold);
|
await safe('Commit-Threshold', window.settingsAPI.setIntelligentCommitThreshold(threshold));
|
||||||
|
|
||||||
let minutes = parseInt(minutesInput.value, 10);
|
let minutes = parseInt(minutesInput.value, 10);
|
||||||
if (isNaN(minutes)) minutes = 10;
|
if (isNaN(minutes)) minutes = 10;
|
||||||
if (minutes < 1) minutes = 1;
|
if (minutes < 1) minutes = 1;
|
||||||
if (minutes > 1000) minutes = 60;
|
if (minutes > 1000) minutes = 60;
|
||||||
await window.settingsAPI.setMinutesCommitThreshold(minutes);
|
await safe('Minutes-Threshold', window.settingsAPI.setMinutesCommitThreshold(minutes));
|
||||||
|
|
||||||
// Dropdowns speichern
|
// Dropdowns speichern
|
||||||
const commitSel = document.getElementById('commitModelSelect');
|
const commitSel = document.getElementById('commitModelSelect');
|
||||||
const readmeSel = document.getElementById('readmeModelSelect');
|
const readmeSel = document.getElementById('readmeModelSelect');
|
||||||
if (commitSel) await window.settingsAPI.setCommitModel(commitSel.value);
|
if (commitSel) await safe('Commit-Model', window.settingsAPI.setCommitModel(commitSel.value));
|
||||||
if (readmeSel) await window.settingsAPI.setReadmeModel(readmeSel.value);
|
if (readmeSel) await safe('Readme-Model', window.settingsAPI.setReadmeModel(readmeSel.value));
|
||||||
|
|
||||||
|
await safe('Gitea-Token', window.settingsAPI.setGiteaToken(giteaTokenInput.value.trim()));
|
||||||
|
|
||||||
|
if (errors.length) {
|
||||||
|
alert('Nicht alle Einstellungen konnten gespeichert werden:\n\n' + errors.join('\n'));
|
||||||
|
}
|
||||||
window.settingsAPI.close();
|
window.settingsAPI.close();
|
||||||
});
|
});
|
||||||
// Cancel / Close: SkyMode zurücksetzen, dann schließen
|
// Cancel / Close: Theme zurücksetzen, dann schließen
|
||||||
const rollback = async () => {
|
const rollback = async () => {
|
||||||
await window.settingsAPI.setSkyMode(initialSky);
|
await window.settingsAPI.setTheme(fallbackTheme);
|
||||||
|
applyThemeClass(fallbackTheme);
|
||||||
window.settingsAPI.close();
|
window.settingsAPI.close();
|
||||||
};
|
};
|
||||||
cancel.addEventListener('click', rollback);
|
cancel.addEventListener('click', rollback);
|
||||||
@@ -238,7 +278,7 @@
|
|||||||
if (res.status === 'no-cli') {
|
if (res.status === 'no-cli') {
|
||||||
container.innerHTML = `
|
container.innerHTML = `
|
||||||
<div style="color:red;font-weight:bold;margin:1em 0;">
|
<div style="color:red;font-weight:bold;margin:1em 0;">
|
||||||
!! You need to install Ollama to use intelligent message & README generation !!
|
Ollama is not reachable. Start Ollama or install it to use the cool stuff !!
|
||||||
</div>`;
|
</div>`;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -249,11 +289,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Liste der Modell-Namen extrahieren
|
// Liste der Modell-Namen extrahieren
|
||||||
const names = res.models.map(m => m.name || m.model).filter(Boolean);
|
const names = [...new Set(res.models.map(m => m.name || m.model).filter(Boolean))];
|
||||||
const qwen = names.filter(n => /^qwen2\.5-coder(:[\w\-.]+)?$/.test(n));
|
const qwen = names.filter(n => /^qwen2\.5-coder(:[\w\-.]+)?$/.test(n));
|
||||||
|
|
||||||
if (!qwen.length) {
|
if (!names.length) {
|
||||||
// keine qwen2.5-coder → Pull-Buttons
|
// keine lokalen Modelle → Pull-Buttons für die bisherigen Defaults
|
||||||
container.innerHTML = `
|
container.innerHTML = `
|
||||||
<button id="pullCommitModelBtn" style="margin-bottom:8px;">
|
<button id="pullCommitModelBtn" style="margin-bottom:8px;">
|
||||||
ollama pull qwen2.5-coder:7b
|
ollama pull qwen2.5-coder:7b
|
||||||
@@ -277,8 +317,8 @@
|
|||||||
arr.map(m => `<option ${m===sel?'selected':''}>${m}</option>`).join('');
|
arr.map(m => `<option ${m===sel?'selected':''}>${m}</option>`).join('');
|
||||||
|
|
||||||
// Default-Auswahl aus Settings (oder erstes gefundenes)
|
// Default-Auswahl aus Settings (oder erstes gefundenes)
|
||||||
const commitDefault = qwen.find(m=>m.includes('7b'))||qwen[0];
|
const commitDefault = qwen.find(m=>m.includes('7b')) || names[0];
|
||||||
const readmeDefault= qwen.find(m=>m.includes('32b'))||qwen[0];
|
const readmeDefault= qwen.find(m=>m.includes('32b')) || names[0];
|
||||||
const currentCommit = await window.settingsAPI.getCommitModel?.() || commitDefault;
|
const currentCommit = await window.settingsAPI.getCommitModel?.() || commitDefault;
|
||||||
const currentReadme= await window.settingsAPI.getReadmeModel?.() || readmeDefault;
|
const currentReadme= await window.settingsAPI.getReadmeModel?.() || readmeDefault;
|
||||||
|
|
||||||
@@ -286,12 +326,12 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<label>Model for commit message generation:
|
<label>Model for commit message generation:
|
||||||
<select id="commitModelSelect">
|
<select id="commitModelSelect">
|
||||||
${makeOpts(qwen, currentCommit)}
|
${makeOpts(names, currentCommit)}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label>Model for README generation:
|
<label>Model for README generation:
|
||||||
<select id="readmeModelSelect">
|
<select id="readmeModelSelect">
|
||||||
${makeOpts(qwen, currentReadme)}
|
${makeOpts(names, currentReadme)}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
</div>`;
|
</div>`;
|
||||||
@@ -309,17 +349,20 @@
|
|||||||
<input type="checkbox" id="closeToTray" checked />
|
<input type="checkbox" id="closeToTray" checked />
|
||||||
Close to Tray
|
Close to Tray
|
||||||
</label>
|
</label>
|
||||||
<label class="option">
|
|
||||||
<input type="checkbox" id="skymode" />
|
|
||||||
Sky Theme
|
|
||||||
</label>
|
|
||||||
<label class="option" style="align-items:center;">
|
<label class="option" style="align-items:center;">
|
||||||
Theme:
|
Theme:
|
||||||
<select id="themeSelect" style="margin-left:1em;">
|
<select id="themeSelect" style="margin-left:1em;">
|
||||||
<option value="default">Cits Favorite</option>
|
<option value="sky">SkyMode</option>
|
||||||
<option value="sky">Sky</option>
|
<option value="default">Default</option>
|
||||||
<option value="epic">Epic</option>
|
<option value="grey">Grey</option>
|
||||||
<option value="yinyang" disabled>Yin/Yang (coming soon)</option>
|
</select>
|
||||||
|
</label>
|
||||||
|
<label class="option" style="align-items:center;">
|
||||||
|
Reword button:
|
||||||
|
<select id="rewordModeSelect" style="margin-left:1em;">
|
||||||
|
<option value="ask">Ask every time</option>
|
||||||
|
<option value="auto">Automatic (LLM)</option>
|
||||||
|
<option value="manual">Manual input</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label class="option">
|
<label class="option">
|
||||||
@@ -337,6 +380,15 @@
|
|||||||
<!-- Hier kommt das Model-Selector-HTML rein -->
|
<!-- Hier kommt das Model-Selector-HTML rein -->
|
||||||
<div id="ollama-model-selectors"></div>
|
<div id="ollama-model-selectors"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<label class="block mb-2 font-semibold">Gitea API Token:</label>
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
id="giteaTokenInput"
|
||||||
|
placeholder="Enter your Gitea token…"
|
||||||
|
class="border rounded px-2 py-1 w-20 mx-1" class="flex-none"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Weitere Optionen in Zukunft hier hinzufügen -->
|
<!-- Weitere Optionen in Zukunft hier hinzufügen -->
|
||||||
</div>
|
</div>
|
||||||
@@ -354,4 +406,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
6026
src-tauri/Cargo.lock
generated
Normal file
32
src-tauri/Cargo.toml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
[package]
|
||||||
|
name = "auto-git"
|
||||||
|
version = "1.0.11"
|
||||||
|
description = "Auto-Git: Git monitoring with automatic LLM commit messages and README generation"
|
||||||
|
authors = ["Victor Giers"]
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
tauri-build = { version = "2.6.0", features = [] }
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
arboard = "3.6.1"
|
||||||
|
base64 = "0.22.1"
|
||||||
|
dirs = "6.0.0"
|
||||||
|
globset = "0.4.18"
|
||||||
|
ignore = "0.4.25"
|
||||||
|
notify = "8.2.0"
|
||||||
|
open = "5.3.3"
|
||||||
|
rfd = "0.15.4"
|
||||||
|
serde = { version = "1.0.228", features = ["derive"] }
|
||||||
|
serde_json = "1.0.145"
|
||||||
|
tempfile = "3.23.0"
|
||||||
|
tauri = { version = "2.11.0", features = ["tray-icon", "image-png", "image-ico"] }
|
||||||
|
thiserror = "2.0.17"
|
||||||
|
reqwest = { version = "0.12.24", default-features = false, features = ["blocking", "json", "rustls-tls"] }
|
||||||
|
wait-timeout = "0.2.1"
|
||||||
|
|
||||||
|
[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
|
auto-launch = "0.5.0"
|
||||||
|
|
||||||
|
[target.'cfg(not(target_os = "macos"))'.dependencies]
|
||||||
|
auto-launch = "0.5.0"
|
||||||
3
src-tauri/build.rs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
tauri_build::build()
|
||||||
|
}
|
||||||
13
src-tauri/capabilities/default.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../gen/schemas/desktop-schema.json",
|
||||||
|
"identifier": "default",
|
||||||
|
"description": "Default desktop capability for Auto-Git",
|
||||||
|
"windows": ["main", "settings"],
|
||||||
|
"permissions": [
|
||||||
|
"core:default",
|
||||||
|
"core:event:default",
|
||||||
|
"core:window:default",
|
||||||
|
"core:menu:default",
|
||||||
|
"core:tray:default"
|
||||||
|
]
|
||||||
|
}
|
||||||
5962
src-tauri/src/main.rs
Normal file
40
src-tauri/tauri.conf.json
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
|
"productName": "Auto-Git",
|
||||||
|
"version": "1.0.11",
|
||||||
|
"identifier": "com.victorgiers.auto-git",
|
||||||
|
"build": {
|
||||||
|
"frontendDist": "../dist-tauri"
|
||||||
|
},
|
||||||
|
"app": {
|
||||||
|
"withGlobalTauri": true,
|
||||||
|
"windows": [
|
||||||
|
{
|
||||||
|
"label": "main",
|
||||||
|
"title": "Auto-Git",
|
||||||
|
"width": 900,
|
||||||
|
"height": 600,
|
||||||
|
"minWidth": 800,
|
||||||
|
"minHeight": 500,
|
||||||
|
"titleBarStyle": "Transparent",
|
||||||
|
"hiddenTitle": true,
|
||||||
|
"backgroundColor": "#fff1f2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"security": {
|
||||||
|
"csp": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bundle": {
|
||||||
|
"active": true,
|
||||||
|
"targets": "all",
|
||||||
|
"icon": [
|
||||||
|
"../assets/icon/linux/icon.png",
|
||||||
|
"../assets/icon/mac/icon.icns",
|
||||||
|
"../assets/icon/win/icon.ico"
|
||||||
|
],
|
||||||
|
"resources": [
|
||||||
|
"../assets/**/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
141
tauriBridge.js
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
(function () {
|
||||||
|
const tauri = window.__TAURI__;
|
||||||
|
if (!tauri || window.electronAPI || window.settingsAPI) return;
|
||||||
|
|
||||||
|
const invoke = (command, args = {}) => tauri.core.invoke(command, args);
|
||||||
|
const listen = (event, handler) => tauri.event.listen(event, handler);
|
||||||
|
|
||||||
|
let selectedCache = null;
|
||||||
|
const eventUnsubscribers = [];
|
||||||
|
|
||||||
|
function onTauriEvent(eventName, callback, legacyEventArg = true) {
|
||||||
|
const promise = listen(eventName, event => {
|
||||||
|
if (legacyEventArg) callback({}, event.payload);
|
||||||
|
else callback(event.payload);
|
||||||
|
});
|
||||||
|
eventUnsubscribers.push(promise);
|
||||||
|
return promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function refreshSelectedCache() {
|
||||||
|
selectedCache = await invoke('get_selected');
|
||||||
|
return selectedCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
listen('repo-updated', event => {
|
||||||
|
window.dispatchEvent(new CustomEvent('repo-updated', { detail: event.payload }));
|
||||||
|
});
|
||||||
|
|
||||||
|
listen('rewrite-progress', event => {
|
||||||
|
window.dispatchEvent(new CustomEvent('rewrite-progress', { detail: event.payload }));
|
||||||
|
});
|
||||||
|
|
||||||
|
listen('monitoring-error', event => {
|
||||||
|
window.dispatchEvent(new CustomEvent('monitoring-error', { detail: event.payload }));
|
||||||
|
});
|
||||||
|
|
||||||
|
listen('theme-changed', event => {
|
||||||
|
const theme = event.payload;
|
||||||
|
window.dispatchEvent(new CustomEvent('theme-changed', { detail: theme }));
|
||||||
|
window.dispatchEvent(new CustomEvent('skymode-changed', { detail: theme === 'sky' }));
|
||||||
|
});
|
||||||
|
|
||||||
|
listen('skymode-changed', event => {
|
||||||
|
const val = !!event.payload;
|
||||||
|
window.dispatchEvent(new CustomEvent('theme-changed', { detail: val ? 'sky' : 'default' }));
|
||||||
|
window.dispatchEvent(new CustomEvent('skymode-changed', { detail: val }));
|
||||||
|
});
|
||||||
|
|
||||||
|
listen('tauri://drag-drop', event => {
|
||||||
|
const paths = event.payload?.paths || [];
|
||||||
|
if (paths.length) {
|
||||||
|
window.dispatchEvent(new CustomEvent('tauri-folder-drop', { detail: paths }));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
window.settingsAPI = {
|
||||||
|
getTheme: () => invoke('get_theme'),
|
||||||
|
setTheme: val => invoke('set_theme', { val }),
|
||||||
|
getSkyMode: () => invoke('get_theme').then(theme => theme === 'sky'),
|
||||||
|
setSkyMode: val => invoke('set_theme', { val: val ? 'sky' : 'default' }),
|
||||||
|
getSkipPrompt: () => invoke('get_skip_git_prompt'),
|
||||||
|
setSkipPrompt: val => invoke('set_skip_git_prompt', { val }),
|
||||||
|
getIntelligentCommitThreshold: () => invoke('get_intelligent_commit_threshold'),
|
||||||
|
setIntelligentCommitThreshold: value => invoke('set_intelligent_commit_threshold', { value }),
|
||||||
|
getMinutesCommitThreshold: () => invoke('get_minutes_commit_threshold'),
|
||||||
|
setMinutesCommitThreshold: value => invoke('set_minutes_commit_threshold', { value }),
|
||||||
|
getCommitModel: () => invoke('get_commit_model'),
|
||||||
|
setCommitModel: model => invoke('set_commit_model', { val: model }),
|
||||||
|
getReadmeModel: () => invoke('get_readme_model'),
|
||||||
|
setReadmeModel: model => invoke('set_readme_model', { val: model }),
|
||||||
|
getRewordMode: () => invoke('get_reword_mode'),
|
||||||
|
setRewordMode: val => invoke('set_reword_mode', { val }),
|
||||||
|
close: () => invoke('close_settings'),
|
||||||
|
getAutostart: () => invoke('get_autostart'),
|
||||||
|
setAutostart: val => invoke('set_autostart', { enabled: val }),
|
||||||
|
getCloseToTray: () => invoke('get_close_to_tray'),
|
||||||
|
setCloseToTray: val => invoke('set_close_to_tray', { val }),
|
||||||
|
getGiteaToken: () => invoke('get_gitea_token'),
|
||||||
|
setGiteaToken: token => invoke('set_gitea_token', { token })
|
||||||
|
};
|
||||||
|
|
||||||
|
window.electronAPI = {
|
||||||
|
getFolders: () => invoke('get_folders'),
|
||||||
|
addFolder: () => invoke('add_folder'),
|
||||||
|
removeFolder: folderObj => invoke('remove_folder', { folderObj }),
|
||||||
|
getSelected: refreshSelectedCache,
|
||||||
|
setSelected: async folderObj => {
|
||||||
|
selectedCache = await invoke('set_selected', { folderObjOrPath: folderObj });
|
||||||
|
return selectedCache;
|
||||||
|
},
|
||||||
|
getCommits: (folderObj, page, pageSize) => invoke('get_commits', { folderObj, page, pageSize }),
|
||||||
|
getAllCommitHashes: folderObj => invoke('get_all_commit_hashes', { folderObj }),
|
||||||
|
diffCommit: (folderObj, hash) => invoke('diff_commit', { folderObj, hash }),
|
||||||
|
revertCommit: (folderObj, hash) => invoke('revert_commit', { folderObj, hash }),
|
||||||
|
snapshotCommit: (folderObj, hash) => invoke('snapshot_commit', { folderObj, hash }),
|
||||||
|
checkoutCommit: (folderObj, hash) => invoke('checkout_commit', { folderObj, hash }),
|
||||||
|
getCommitCount: folderObj => invoke('get_commit_count', { folderObj }),
|
||||||
|
hasDiffs: folderObj => invoke('has_diffs', { folderObj }),
|
||||||
|
removeGitFolder: folderObj => invoke('remove_git_folder', { folderObj }),
|
||||||
|
commitCurrentFolder: (folderObj, message) => invoke('commit_current_folder', { folderObj, message }),
|
||||||
|
showFolderContextMenu: folderPath => invoke('show_folder_context_menu', { folderPath }),
|
||||||
|
setMonitoring: (folderObj, monitoring) => invoke('set_monitoring', { folderPath: folderObj.path, monitoring }),
|
||||||
|
getFolderTree: folderPath => invoke('get_folder_tree', { folderPath }),
|
||||||
|
showTreeContextMenu: info => invoke('show_tree_context_menu', { info }),
|
||||||
|
getSelectedSync: () => selectedCache || window.currentSelectedFolderObj || null,
|
||||||
|
getIntelligentCommitThreshold: () => invoke('get_intelligent_commit_threshold'),
|
||||||
|
setIntelligentCommitThreshold: value => invoke('set_intelligent_commit_threshold', { value }),
|
||||||
|
getMinutesCommitThreshold: () => invoke('get_minutes_commit_threshold'),
|
||||||
|
setMinutesCommitThreshold: value => invoke('set_minutes_commit_threshold', { value }),
|
||||||
|
ollamaList: () => invoke('ollama_list'),
|
||||||
|
ollamaPull: model => invoke('ollama_pull', { model }),
|
||||||
|
onTrayToggleMonitoring: callback => onTauriEvent('tray-toggle-monitoring', callback),
|
||||||
|
onTrayRemoveFolder: callback => onTauriEvent('tray-remove-folder', callback),
|
||||||
|
onTrayAddFolder: callback => onTauriEvent('tray-add-folder', callback),
|
||||||
|
onFoldersLocationUpdated: callback => onTauriEvent('folders-location-updated', callback, false),
|
||||||
|
isGitRepo: path => invoke('is_git_repo', { folderPath: path }),
|
||||||
|
relocateFolder: (oldPath, newPath) => invoke('relocate_folder', { oldPath, newPath }),
|
||||||
|
pickFolder: () => invoke('pick_folder'),
|
||||||
|
repoHasCommit: (repoPath, commitHash) => invoke('repo_has_commit', { repoPath, commitHash }),
|
||||||
|
addFolderByPath: folderPath => invoke('add_folder_by_path', { folderPath }),
|
||||||
|
onCatBegin: callback => onTauriEvent('cat-begin', callback),
|
||||||
|
onCatChunk: callback => onTauriEvent('cat-chunk', callback),
|
||||||
|
onCatEnd: callback => onTauriEvent('cat-end', callback),
|
||||||
|
getDailyCommitStats: () => invoke('get_daily_commit_stats'),
|
||||||
|
hasReadme: folderPath => invoke('has_readme', { folderPath }),
|
||||||
|
generateReadme: folderPath => invoke('generate_readme', { folderPath }),
|
||||||
|
squashCommits: folderPath => invoke('squash_commits', { folderPath }),
|
||||||
|
pushToGitea: folderPath => invoke('push_to_gitea', { folderPath }),
|
||||||
|
initRepo: folderPath => invoke('init_repo', { folderPath }),
|
||||||
|
triggerRewriteNow: folderPath => invoke('trigger_rewrite_now', { folderPath }),
|
||||||
|
rewriteCommit: (folderPath, hash) => invoke('rewrite_commit', { folderPath, hash }),
|
||||||
|
rewriteCommitWithMessage: (folderPath, hash, message) => invoke('rewrite_commit_with_message', { folderPath, hash, message }),
|
||||||
|
rewritePendingCommits: folderPath => invoke('rewrite_pending_commits', { folderPath })
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('beforeunload', () => {
|
||||||
|
for (const pending of eventUnsubscribers) {
|
||||||
|
pending.then(unlisten => unlisten()).catch(() => {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||