1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
import { Hono } from "hono";
import { readFileSync, existsSync, statSync, readdirSync } from "fs";
import { join } from "path";
const install = new Hono();
const FALLBACK_SCRIPT = `#!/usr/bin/env bash
echo "Gluecron install script unavailable on this host." >&2
echo "Fetch it directly from https://gluecron.com/install" >&2
exit 1
`;
function loadScript(): string {
const candidates = [
join(process.cwd(), "scripts", "install.sh"),
join(import.meta.dir, "..", "..", "scripts", "install.sh"),
];
for (const p of candidates) {
try {
const buf = readFileSync(p, "utf8");
if (buf && buf.length > 0) return buf;
} catch {
}
}
return FALLBACK_SCRIPT;
}
export const INSTALL_SCRIPT_SRC = loadScript();
install.get("/install", (c) => {
c.header("content-type", "text/x-shellscript; charset=utf-8");
c.header("cache-control", "public, max-age=300");
c.header("content-disposition", 'inline; filename="install.sh"');
return c.body(INSTALL_SCRIPT_SRC);
});
const MARKETPLACE_URL =
"https://marketplace.visualstudio.com/items?itemName=gluecron.gluecron-vscode";
function findVsix(): { name: string; size: number } | null {
const candidates = [
join(process.cwd(), "public"),
join(import.meta.dir, "..", "..", "public"),
];
for (const dir of candidates) {
try {
if (!existsSync(dir)) continue;
const files = readdirSync(dir).filter((f) => f.endsWith(".vsix"));
if (files.length === 0) continue;
files.sort();
const pick = files[files.length - 1];
const st = statSync(join(dir, pick));
return { name: pick, size: st.size };
} catch {
}
}
return null;
}
function formatBytes(n: number): string {
if (n < 1024) return `${n} B`;
if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KiB`;
return `${(n / (1024 * 1024)).toFixed(1)} MiB`;
}
function vscodeLandingHtml(vsix: { name: string; size: number } | null): string {
const vsixBlock = vsix
? `
<p>
<a class="cta" href="/${encodeURIComponent(vsix.name)}" download>
Download ${vsix.name} (${formatBytes(vsix.size)})
</a>
</p>
<pre><code>code --install-extension ${vsix.name}</code></pre>`
: `
<p class="muted">
No <code>.vsix</code> uploaded yet — build one yourself:
</p>
<pre><code>git clone https://gluecron.com/ccantynz/Gluecron.com
cd Gluecron.com/editor-extensions/vscode
npm install
npm run compile
npx vsce package
code --install-extension gluecron-vscode-0.1.0.vsix</code></pre>`;
return `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Gluecron for VS Code</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
:root { color-scheme: dark light; }
body { font: 15px/1.55 system-ui, sans-serif; max-width: 640px; margin: 5rem auto; padding: 0 1rem; }
h1 { margin-top: 0; font-size: 1.6rem; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 4px; background: #2c2c2c; color: #fff; font-size: 13px; text-decoration: none; }
.cta { display: inline-block; padding: 8px 14px; border-radius: 6px; background: #1f6feb; color: #fff; text-decoration: none; font-weight: 600; }
pre { background: #0e1116; color: #e6edf3; padding: 12px; border-radius: 6px; overflow-x: auto; }
code { font: 13px ui-monospace, monospace; }
.muted { opacity: 0.75; }
ul { padding-left: 1.2rem; }
</style>
</head>
<body>
<h1>Gluecron for VS Code</h1>
<p>
Chat with this repo, ship PRs, run specs, voice-to-PR, and let Claude write
your commit messages — without leaving the editor.
</p>
<p>
<a class="badge" href="${MARKETPLACE_URL}" rel="nofollow">
Marketplace listing (coming soon)
</a>
</p>
<h2>Install</h2>
${vsixBlock}
<h2>What you get</h2>
<ul>
<li>Sidebar <strong>repo chat</strong> grounded in the current repository</li>
<li>One-click <strong>AI commit messages</strong> in the SCM title bar</li>
<li><strong>Open in Gluecron</strong> deep-links for the active file / line</li>
<li>Embedded <strong>pull requests</strong>, <strong>issues</strong>, and <strong>AI standups</strong></li>
<li><strong>Ship spec</strong> + <strong>voice-to-PR</strong> shortcuts</li>
</ul>
<p class="muted">Source: <a href="/ccantynz/Gluecron.com/tree/main/editor-extensions/vscode">editor-extensions/vscode</a></p>
</body>
</html>`;
}
install.get("/install/vscode", (c) => {
const vsix = findVsix();
c.header("content-type", "text/html; charset=utf-8");
c.header("cache-control", "public, max-age=300");
return c.body(vscodeLandingHtml(vsix));
});
export default install;
|