agy-git-graph 1.0.0 → 1.1.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/README.md +5 -2
- package/bin/cli.mjs +2 -0
- package/mcp/ext-apps-bridge.js +112 -0
- package/mcp/server.mjs +289 -0
- package/mcp_config.json +8 -0
- package/package.json +3 -1
- package/plugin.json +1 -1
- package/sidecars/git_graph/index.html +175 -34
- package/sidecars/git_graph/lib/render.mjs +41 -0
- package/sidecars/git_graph/server.mjs +2 -27
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
|
|
5
|
+
const FONT_SETTINGS = join(
|
|
6
|
+
homedir(),
|
|
7
|
+
'.gemini',
|
|
8
|
+
'antigravity',
|
|
9
|
+
'sidecar_data',
|
|
10
|
+
'agy-powertools',
|
|
11
|
+
'inspector',
|
|
12
|
+
'settings.json',
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export function powertoolsFontCss() {
|
|
16
|
+
try {
|
|
17
|
+
const settings = JSON.parse(readFileSync(FONT_SETTINGS, 'utf8'));
|
|
18
|
+
const font = typeof settings.fontFamily === 'string' ? settings.fontFamily.replace(/["\\]/g, '').trim() : '';
|
|
19
|
+
const weight = Number(settings.fontWeight);
|
|
20
|
+
const rules = [];
|
|
21
|
+
if (font && font.length <= 128 && !/[;{}<>\u0000-\u001f\u007f-\u009f\u2028\u2029]/.test(font)) {
|
|
22
|
+
rules.push('--ui-font: "' + font + '", var(--ui-font-default);');
|
|
23
|
+
}
|
|
24
|
+
if (Number.isInteger(weight) && weight >= 1 && weight <= 1000) {
|
|
25
|
+
rules.push('--ui-font-weight: ' + weight + ';');
|
|
26
|
+
}
|
|
27
|
+
return rules.length ? ':root { ' + rules.join(' ') + ' }' : '';
|
|
28
|
+
} catch {
|
|
29
|
+
return '';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function renderIndexHtml({ mcpBridgeScript = '' } = {}) {
|
|
34
|
+
let html = readFileSync(new URL('../index.html', import.meta.url), 'utf8')
|
|
35
|
+
.replace('/*__POWERTOOLS_FONT_CSS__*/', () => powertoolsFontCss());
|
|
36
|
+
if (mcpBridgeScript) {
|
|
37
|
+
const safeScript = mcpBridgeScript.replace(/<\/script/gi, '<\\/script');
|
|
38
|
+
html = html.replace('<!--__MCP_APP_BRIDGE__-->', () => `<script>\n${safeScript}\n</script>`);
|
|
39
|
+
}
|
|
40
|
+
return html;
|
|
41
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { createServer } from 'node:http';
|
|
3
|
-
import { homedir } from 'node:os';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
3
|
import { InputError } from './lib/git.mjs';
|
|
6
4
|
import { createHandlers } from './lib/handlers.mjs';
|
|
5
|
+
import { renderIndexHtml } from './lib/render.mjs';
|
|
7
6
|
|
|
8
7
|
for (const stream of [process.stdout, process.stderr]) {
|
|
9
8
|
stream.on('error', (error) => {
|
|
@@ -11,32 +10,8 @@ for (const stream of [process.stdout, process.stderr]) {
|
|
|
11
10
|
});
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
const FONT_SETTINGS = join(homedir(), '.gemini', 'antigravity', 'sidecar_data',
|
|
15
|
-
'agy-powertools', 'inspector', 'settings.json');
|
|
16
13
|
const BODY_LIMIT = 1024 * 1024;
|
|
17
|
-
|
|
18
|
-
function powertoolsFontCss() {
|
|
19
|
-
try {
|
|
20
|
-
const settings = JSON.parse(readFileSync(FONT_SETTINGS, 'utf8'));
|
|
21
|
-
const font = typeof settings.fontFamily === 'string' ? settings.fontFamily.replace(/["\\]/g, '').trim() : '';
|
|
22
|
-
const weight = Number(settings.fontWeight);
|
|
23
|
-
const rules = [];
|
|
24
|
-
if (font && font.length <= 128 && !/[;{}<>\u0000-\u001f\u007f-\u009f\u2028\u2029]/.test(font)) {
|
|
25
|
-
rules.push('--ui-font: "' + font + '", var(--ui-font-default);');
|
|
26
|
-
}
|
|
27
|
-
if (Number.isInteger(weight) && weight >= 1 && weight <= 1000) {
|
|
28
|
-
rules.push('--ui-font-weight: ' + weight + ';');
|
|
29
|
-
}
|
|
30
|
-
return rules.length ? ':root { ' + rules.join(' ') + ' }' : '';
|
|
31
|
-
} catch {
|
|
32
|
-
return '';
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function renderHtml() {
|
|
37
|
-
return readFileSync(new URL('./index.html', import.meta.url), 'utf8')
|
|
38
|
-
.replace('/*__POWERTOOLS_FONT_CSS__*/', () => powertoolsFontCss());
|
|
39
|
-
}
|
|
14
|
+
const renderHtml = () => renderIndexHtml();
|
|
40
15
|
|
|
41
16
|
function sendJson(response, code, data) {
|
|
42
17
|
response.writeHead(code, { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-store' });
|