agy-git-graph 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +76 -2
- package/assets/logo.svg +17 -0
- package/bin/cli.mjs +158 -0
- package/package.json +49 -4
- package/plugin.json +18 -0
- package/sidecars/git_graph/index.html +856 -0
- package/sidecars/git_graph/lib/git.mjs +410 -0
- package/sidecars/git_graph/lib/graph.mjs +83 -0
- package/sidecars/git_graph/lib/handlers.mjs +50 -0
- package/sidecars/git_graph/lib/workspaces.mjs +167 -0
- package/sidecars/git_graph/server.mjs +131 -0
- package/sidecars/git_graph/sidecar.json +21 -0
- package/skills/agy-git-graph/SKILL.md +10 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 s17765152890-gif
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,77 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Git Graph (提交图) for Antigravity
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/agy-git-graph)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
在 **Google Antigravity 2.0** 右侧侧边栏(Aux Pane)常驻一个轻量级 Git 面板:集合工作区更改管理、快捷提交、Diff 预览与多分支 SVG 可视化提交图(Commit Graph),零外部 npm 依赖。
|
|
7
|
+
|
|
8
|
+
A lightweight, zero-dependency Git sidecar plugin for **Google Antigravity 2.0**, providing working-tree change management, quick commits, colored diffs, branch filtering, and a multi-branch SVG commit graph inside the right side pane.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 功能特性 / Features
|
|
13
|
+
|
|
14
|
+
- **仓库自动发现**:自动从 Antigravity 会话列表与历史摘要快照中发现最近使用的 Git 仓库,也支持点击 `+` 手动添加任意本地仓库路径。
|
|
15
|
+
- **工作区更改 & 提交**:
|
|
16
|
+
- 展示 `已暂存更改 (Staged)` 与 `更改 (Unstaged)` 列表,区分 `M` / `A` / `D` / `R` / `C` / `?` / `U` 状态;
|
|
17
|
+
- 支持单文件或全部暂存(`+`)、取消暂存(`−`)、放弃更改(`↺` 两步确认)以及 `Ctrl+Enter` 快捷提交;
|
|
18
|
+
- 点击文件行即可在抽屉面板查看彩色 Diff(含中文文件名、重命名与未跟踪文件预览)。
|
|
19
|
+
- **多分支 SVG 提交图(Commit Graph)**:
|
|
20
|
+
- 左侧渲染多通道 SVG 彩色分支线与贝塞尔分叉/合并曲线,高亮 `HEAD` 与合并节点;
|
|
21
|
+
- 展示 `HEAD`、本地分支、远端分支与 Tag 徽章;
|
|
22
|
+
- 支持按 **所有分支 / 当前分支 / 指定分支** 筛选、提交信息搜索以及分页加载更多;
|
|
23
|
+
- 点击任意提交可查看完整 Hash、作者时间、正文及逐文件增删统计与 Diff。
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 快速安装 / Quick Install
|
|
28
|
+
|
|
29
|
+
环境要求 / Requirements:**Node.js >= 22.5.0**(推荐 Node 26)与系统 `PATH` 中的 **Git**。
|
|
30
|
+
|
|
31
|
+
### 方式一:通过 npm 一键安装(推荐)
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx agy-git-graph@latest install
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
安装完成后,**重启 Antigravity 2.0**(或在 Customizations 页面重新开关一次插件),然后在对话中输入「打开 Git Graph」或点击插件卡片上的 `[Git Graph](sidecar://agy-git-graph/git_graph/)` 即可在右侧边栏打开。
|
|
38
|
+
|
|
39
|
+
### 方式二:通过 GitHub 手动安装
|
|
40
|
+
|
|
41
|
+
将本仓库克隆到 Antigravity 插件目录:
|
|
42
|
+
|
|
43
|
+
- **Windows (PowerShell)**:
|
|
44
|
+
```powershell
|
|
45
|
+
git clone https://github.com/s17765152890-gif/agy-git-graph.git "$env:USERPROFILE\.gemini\config\plugins\agy-git-graph"
|
|
46
|
+
```
|
|
47
|
+
- **macOS / Linux**:
|
|
48
|
+
```bash
|
|
49
|
+
git clone https://github.com/s17765152890-gif/agy-git-graph.git ~/.gemini/config/plugins/agy-git-graph
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
然后重启 Antigravity 2.0 即可生效。
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## CLI 命令 / CLI Usage
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx agy-git-graph install [--dir <pluginsDir>] # 安装插件到 Antigravity 插件目录
|
|
60
|
+
npx agy-git-graph status [--dir <pluginsDir>] # 查看安装状态
|
|
61
|
+
npx agy-git-graph uninstall [--dir <pluginsDir>] # 卸载插件
|
|
62
|
+
npx agy-git-graph standalone [--port <port>] # 独立启动本地预览服务
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## 独立调试与测试 / Standalone & Tests
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# 运行全部单元测试与端到端集成测试
|
|
69
|
+
npm test
|
|
70
|
+
|
|
71
|
+
# 独立启动本地预览服务(浏览器打开 READY 后的地址)
|
|
72
|
+
npm run standalone
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## 开源协议 / License
|
|
76
|
+
|
|
77
|
+
[MIT](LICENSE) © 2026 [s17765152890-gif](https://github.com/s17765152890-gif)
|
package/assets/logo.svg
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128">
|
|
2
|
+
<g fill="none" stroke="#1e293b" stroke-width="14" stroke-linecap="round">
|
|
3
|
+
<path d="M34 25v78"/>
|
|
4
|
+
<path d="M34 89c0-28 60-19 60-59"/>
|
|
5
|
+
</g>
|
|
6
|
+
<g fill="none" stroke-width="6">
|
|
7
|
+
<path d="M34 25v78" stroke="#818cf8"/>
|
|
8
|
+
<path d="M34 89c0-28 60-19 60-59" stroke="#34d399"/>
|
|
9
|
+
</g>
|
|
10
|
+
<g fill="#1e293b" stroke="#a5b4fc" stroke-width="4">
|
|
11
|
+
<circle cx="34" cy="25" r="10"/>
|
|
12
|
+
<circle cx="34" cy="63" r="8"/>
|
|
13
|
+
<circle cx="34" cy="103" r="10"/>
|
|
14
|
+
<circle cx="94" cy="30" r="10" stroke="#6ee7b7"/>
|
|
15
|
+
<circle cx="84" cy="54" r="7" stroke="#6ee7b7"/>
|
|
16
|
+
</g>
|
|
17
|
+
</svg>
|
package/bin/cli.mjs
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { cpSync, existsSync, mkdirSync, readFileSync, realpathSync, rmSync } from 'node:fs';
|
|
4
|
+
import { homedir } from 'node:os';
|
|
5
|
+
import { dirname, join, resolve } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
|
|
8
|
+
const PLUGIN_NAME = 'agy-git-graph';
|
|
9
|
+
const PKG_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
10
|
+
const PKG_JSON = JSON.parse(readFileSync(join(PKG_ROOT, 'package.json'), 'utf8'));
|
|
11
|
+
|
|
12
|
+
function pathKey(p) {
|
|
13
|
+
let resolved = resolve(p);
|
|
14
|
+
try {
|
|
15
|
+
resolved = realpathSync(resolved);
|
|
16
|
+
} catch {
|
|
17
|
+
// Keep resolved path when target does not exist yet.
|
|
18
|
+
}
|
|
19
|
+
return process.platform === 'win32' ? resolved.toLowerCase() : resolved;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function getFlagValue(args, flag) {
|
|
23
|
+
for (let i = 0; i < args.length; i++) {
|
|
24
|
+
if (args[i] === flag && args[i + 1]) return args[i + 1];
|
|
25
|
+
if (args[i].startsWith(flag + '=')) return args[i].slice(flag.length + 1);
|
|
26
|
+
}
|
|
27
|
+
return '';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function resolvePluginsDir(args) {
|
|
31
|
+
const custom = getFlagValue(args, '--dir');
|
|
32
|
+
return custom ? resolve(custom) : join(homedir(), '.gemini', 'config', 'plugins');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function printHelp() {
|
|
36
|
+
console.log(`agy-git-graph v${PKG_JSON.version}
|
|
37
|
+
|
|
38
|
+
Usage:
|
|
39
|
+
agy-git-graph [install] [--dir <pluginsDir>] Install plugin into Antigravity plugins directory
|
|
40
|
+
agy-git-graph uninstall [--dir <pluginsDir>] Remove installed plugin from Antigravity plugins directory
|
|
41
|
+
agy-git-graph status [--dir <pluginsDir>] Show installation status
|
|
42
|
+
agy-git-graph standalone [--port <port>] Run standalone preview HTTP server
|
|
43
|
+
agy-git-graph --version Print version
|
|
44
|
+
agy-git-graph --help Show this help
|
|
45
|
+
`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function copyRuntimeFiles(targetDir) {
|
|
49
|
+
const items = [
|
|
50
|
+
['plugin.json', false],
|
|
51
|
+
['README.md', false],
|
|
52
|
+
['LICENSE', false],
|
|
53
|
+
['assets', true],
|
|
54
|
+
['skills', true],
|
|
55
|
+
['sidecars/git_graph/sidecar.json', false],
|
|
56
|
+
['sidecars/git_graph/server.mjs', false],
|
|
57
|
+
['sidecars/git_graph/index.html', false],
|
|
58
|
+
['sidecars/git_graph/lib', true],
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
rmSync(targetDir, { recursive: true, force: true });
|
|
62
|
+
mkdirSync(targetDir, { recursive: true });
|
|
63
|
+
|
|
64
|
+
for (const [rel, isDir] of items) {
|
|
65
|
+
const src = join(PKG_ROOT, rel);
|
|
66
|
+
const dest = join(targetDir, rel);
|
|
67
|
+
if (!existsSync(src)) continue;
|
|
68
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
69
|
+
cpSync(src, dest, { recursive: isDir });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function cmdInstall(args) {
|
|
74
|
+
const pluginsDir = resolvePluginsDir(args);
|
|
75
|
+
const targetDir = join(pluginsDir, PLUGIN_NAME);
|
|
76
|
+
|
|
77
|
+
if (pathKey(targetDir) === pathKey(PKG_ROOT)) {
|
|
78
|
+
console.log(`agy-git-graph v${PKG_JSON.version} is already running from ${targetDir}.`);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
copyRuntimeFiles(targetDir);
|
|
83
|
+
console.log(`Installed agy-git-graph v${PKG_JSON.version} to:`);
|
|
84
|
+
console.log(` ${targetDir}`);
|
|
85
|
+
console.log('');
|
|
86
|
+
console.log('Next steps:');
|
|
87
|
+
console.log(' 1. Restart or reload Antigravity 2.0 to load the new sidecar panel.');
|
|
88
|
+
console.log(' 2. Ask Antigravity "打开 Git Graph" or enable it in Customizations.');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function cmdUninstall(args) {
|
|
92
|
+
const pluginsDir = resolvePluginsDir(args);
|
|
93
|
+
const targetDir = join(pluginsDir, PLUGIN_NAME);
|
|
94
|
+
|
|
95
|
+
if (!existsSync(targetDir)) {
|
|
96
|
+
console.log(`agy-git-graph is not installed at ${targetDir}.`);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (pathKey(targetDir) === pathKey(PKG_ROOT)) {
|
|
100
|
+
console.error(`Refusing to remove active package directory: ${targetDir}`);
|
|
101
|
+
process.exitCode = 1;
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
rmSync(targetDir, { recursive: true, force: true });
|
|
106
|
+
console.log(`Removed agy-git-graph from ${targetDir}.`);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function cmdStatus(args) {
|
|
110
|
+
const pluginsDir = resolvePluginsDir(args);
|
|
111
|
+
const targetDir = join(pluginsDir, PLUGIN_NAME);
|
|
112
|
+
const manifestPath = join(targetDir, 'plugin.json');
|
|
113
|
+
|
|
114
|
+
if (!existsSync(manifestPath)) {
|
|
115
|
+
console.log(`Not installed (${targetDir})`);
|
|
116
|
+
process.exitCode = 1;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
try {
|
|
121
|
+
const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
|
|
122
|
+
console.log(`Installed: ${manifest.name || PLUGIN_NAME} v${manifest.version || 'unknown'}`);
|
|
123
|
+
console.log(`Path: ${targetDir}`);
|
|
124
|
+
} catch (err) {
|
|
125
|
+
console.error(`Installed directory exists at ${targetDir}, but failed to read plugin.json: ${err.message}`);
|
|
126
|
+
process.exitCode = 1;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function cmdStandalone(args) {
|
|
131
|
+
const port = getFlagValue(args, '--port');
|
|
132
|
+
const serverPath = join(PKG_ROOT, 'sidecars', 'git_graph', 'server.mjs');
|
|
133
|
+
const childArgs = [serverPath, '--standalone'];
|
|
134
|
+
if (port) childArgs.push('--port', port);
|
|
135
|
+
const child = spawn(process.execPath, childArgs, { stdio: 'inherit', windowsHide: false });
|
|
136
|
+
child.on('exit', (code, signal) => {
|
|
137
|
+
if (signal) process.exit(1);
|
|
138
|
+
process.exit(code ?? 0);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const args = process.argv.slice(2);
|
|
143
|
+
if (args.includes('--help') || args.includes('-h') || args[0] === 'help') {
|
|
144
|
+
printHelp();
|
|
145
|
+
} else if (args.includes('--version') || args.includes('-v')) {
|
|
146
|
+
console.log(PKG_JSON.version);
|
|
147
|
+
} else {
|
|
148
|
+
const cmd = !args[0] || args[0].startsWith('-') ? 'install' : args[0];
|
|
149
|
+
if (cmd === 'install') cmdInstall(args);
|
|
150
|
+
else if (cmd === 'uninstall') cmdUninstall(args);
|
|
151
|
+
else if (cmd === 'status') cmdStatus(args);
|
|
152
|
+
else if (cmd === 'standalone') cmdStandalone(args);
|
|
153
|
+
else {
|
|
154
|
+
console.error(`Unknown command: ${cmd}`);
|
|
155
|
+
printHelp();
|
|
156
|
+
process.exitCode = 1;
|
|
157
|
+
}
|
|
158
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agy-git-graph",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "DSH-style Git changes, commit box, diff viewer, and multi-branch SVG commit graph side panel plugin for Google Antigravity 2.0.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "s17765152890-gif",
|
|
9
|
+
"url": "https://github.com/s17765152890-gif"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/s17765152890-gif/agy-git-graph#readme",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/s17765152890-gif/agy-git-graph.git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/s17765152890-gif/agy-git-graph/issues"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"antigravity",
|
|
21
|
+
"antigravity-plugin",
|
|
22
|
+
"agy",
|
|
23
|
+
"sidecar",
|
|
24
|
+
"git",
|
|
25
|
+
"git-graph",
|
|
26
|
+
"commit-graph",
|
|
27
|
+
"diff"
|
|
28
|
+
],
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=22.5.0"
|
|
31
|
+
},
|
|
32
|
+
"bin": {
|
|
33
|
+
"agy-git-graph": "bin/cli.mjs"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"bin/",
|
|
37
|
+
"assets/",
|
|
38
|
+
"skills/",
|
|
39
|
+
"sidecars/git_graph/sidecar.json",
|
|
40
|
+
"sidecars/git_graph/server.mjs",
|
|
41
|
+
"sidecars/git_graph/index.html",
|
|
42
|
+
"sidecars/git_graph/lib/",
|
|
43
|
+
"plugin.json",
|
|
44
|
+
"README.md",
|
|
45
|
+
"LICENSE"
|
|
46
|
+
],
|
|
47
|
+
"scripts": {
|
|
48
|
+
"test": "node --test sidecars/git_graph/test/git-graph.test.mjs",
|
|
49
|
+
"standalone": "node sidecars/git_graph/server.mjs --standalone --port 0"
|
|
50
|
+
}
|
|
51
|
+
}
|
package/plugin.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agy-git-graph",
|
|
3
|
+
"displayName": "Git Graph (提交图)",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "在 Antigravity 右侧侧边栏查看 Git 工作区更改、提交代码、按分支筛选并浏览多分支可视化提交图(Commit Graph)与单次提交 Diff。",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "s17765152890-gif",
|
|
8
|
+
"url": "https://github.com/s17765152890-gif"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/s17765152890-gif/agy-git-graph",
|
|
11
|
+
"repository": "https://github.com/s17765152890-gif/agy-git-graph",
|
|
12
|
+
"logo": "assets/logo.svg",
|
|
13
|
+
"suggestedPrompts": [
|
|
14
|
+
"打开 Git Graph 提交图侧边栏",
|
|
15
|
+
"查看当前仓库的 Git 分支提交线和未提交更改",
|
|
16
|
+
"在 Git Graph 面板检查最近提交的 Diff"
|
|
17
|
+
]
|
|
18
|
+
}
|