Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/glean/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "glean-vnext",
"version": "0.2.35",
"version": "0.2.36",
"description": "Glean plugin for discovering skills and running tools.",
"author": {
"name": "Glean"
Expand Down
2 changes: 1 addition & 1 deletion plugins/glean/.codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "glean-vnext",
"version": "0.2.35",
"version": "0.2.36",
"description": "Glean Codex plugin for discovering skills and running tools.",
"author": {
"name": "Glean"
Expand Down
2 changes: 1 addition & 1 deletion plugins/glean/.cursor-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "glean-vnext",
"displayName": "Glean vNext",
"version": "0.2.35",
"version": "0.2.36",
"description": "Search and act across your company's apps — Jira, Slack, Salesforce, Google Workspace, and more — without leaving Cursor.",
"author": {
"name": "Glean"
Expand Down
6 changes: 6 additions & 0 deletions plugins/glean/dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,32 @@

import { build } from "esbuild";
import { builtinModules } from "node:module";
import { readFileSync } from "node:fs";

const nodeBuiltins = [
...builtinModules,
...builtinModules.map((m) => `node:${m}`),
];

// Stamp the plugin version into the bundle as a compile-time constant so the
// running server can log which version it is. The per-host manifests are the
// single source of truth (kept aligned by check-version-bump.sh), so reading
// the Claude manifest is representative. Under `tsx` dev (no bundle), the
// constant is absent and src/index.ts falls back to "dev".
const pluginVersion = JSON.parse(
readFileSync(
new URL("../plugins/glean/.claude-plugin/plugin.json", import.meta.url),
"utf8",
),
).version;

await build({
entryPoints: ["src/index.ts"],
outfile: "plugins/glean/dist/index.js",
bundle: true,
define: {
__GLEAN_PLUGIN_VERSION__: JSON.stringify(pluginVersion),
},
platform: "node",
format: "esm",
target: "node20",
Expand Down
15 changes: 15 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ import {
import { resolveSessionId } from "./session-id.js";
import { resolveServerUrlFromEmail } from "./config-search.js";

// Injected at build time by scripts/build.mjs from the plugin manifest version.
// Absent under `tsx` dev runs — the typeof guard falls back to "dev" there.
declare const __GLEAN_PLUGIN_VERSION__: string | undefined;
const PLUGIN_VERSION =
typeof __GLEAN_PLUGIN_VERSION__ !== "undefined"
? __GLEAN_PLUGIN_VERSION__
: "dev";

function readEnv(...keys: string[]): string | undefined {
for (const key of keys) {
const v = process.env[key];
Expand Down Expand Up @@ -812,6 +820,13 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {

async function main() {
// Run once per session at MCP server startup.
// First line per process: stamps the plugin version (+ node/pid) so any
// session's log is traceable to the exact build that served it.
logLine("server.start", {
version: PLUGIN_VERSION,
node: process.version,
pid: process.pid,
});
const ONE_WEEK_MS = 7 * 24 * 60 * 60 * 1000;
try {
await evictStaleSkills(resolveSkillsBaseDir(), ONE_WEEK_MS, logLine);
Expand Down
Loading