@vailent/pulse-mcp 1.1.0 → 1.2.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/dist/server.js +85 -5
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -40533,6 +40533,74 @@ async function handlePodMembers(params) {
|
|
|
40533
40533
|
}
|
|
40534
40534
|
}
|
|
40535
40535
|
|
|
40536
|
+
// lib/current-user.ts
|
|
40537
|
+
import { execSync } from "child_process";
|
|
40538
|
+
var cached2;
|
|
40539
|
+
async function getCurrentUser() {
|
|
40540
|
+
if (cached2 !== void 0) return cached2;
|
|
40541
|
+
try {
|
|
40542
|
+
cached2 = await resolveUser();
|
|
40543
|
+
if (cached2) {
|
|
40544
|
+
console.error(`\u2713 Pulse: identified as ${cached2.fullName} (${cached2.email})`);
|
|
40545
|
+
}
|
|
40546
|
+
return cached2;
|
|
40547
|
+
} catch {
|
|
40548
|
+
cached2 = null;
|
|
40549
|
+
return null;
|
|
40550
|
+
}
|
|
40551
|
+
}
|
|
40552
|
+
async function resolveUser() {
|
|
40553
|
+
const supabase = getAdminClient();
|
|
40554
|
+
const envEmail = process.env.PULSE_USER_EMAIL;
|
|
40555
|
+
if (envEmail?.endsWith("@vailent.com")) {
|
|
40556
|
+
const user = await lookupByEmail(supabase, envEmail);
|
|
40557
|
+
if (user) return user;
|
|
40558
|
+
}
|
|
40559
|
+
const localEmail = getGitEmail("local");
|
|
40560
|
+
if (localEmail?.endsWith("@vailent.com")) {
|
|
40561
|
+
const user = await lookupByEmail(supabase, localEmail);
|
|
40562
|
+
if (user) return user;
|
|
40563
|
+
}
|
|
40564
|
+
const globalEmail = getGitEmail("global");
|
|
40565
|
+
if (globalEmail?.endsWith("@vailent.com")) {
|
|
40566
|
+
const user = await lookupByEmail(supabase, globalEmail);
|
|
40567
|
+
if (user) return user;
|
|
40568
|
+
}
|
|
40569
|
+
const anyEmail = localEmail || globalEmail;
|
|
40570
|
+
if (anyEmail) {
|
|
40571
|
+
console.error(
|
|
40572
|
+
`\u26A0 Pulse: Could not identify you.
|
|
40573
|
+
Your git email (${anyEmail}) is not a @vailent.com address.
|
|
40574
|
+
Fix: git config --global user.email yourname@vailent.com
|
|
40575
|
+
Then restart Claude Code.`
|
|
40576
|
+
);
|
|
40577
|
+
} else {
|
|
40578
|
+
console.error(
|
|
40579
|
+
`\u26A0 Pulse: Could not identify you.
|
|
40580
|
+
Git email not configured.
|
|
40581
|
+
Fix: git config --global user.email yourname@vailent.com
|
|
40582
|
+
Then restart Claude Code.`
|
|
40583
|
+
);
|
|
40584
|
+
}
|
|
40585
|
+
return null;
|
|
40586
|
+
}
|
|
40587
|
+
function getGitEmail(scope) {
|
|
40588
|
+
try {
|
|
40589
|
+
const flag = scope === "local" ? "--local" : "--global";
|
|
40590
|
+
return execSync(`git config ${flag} user.email`, {
|
|
40591
|
+
encoding: "utf-8",
|
|
40592
|
+
timeout: 3e3
|
|
40593
|
+
}).trim() || null;
|
|
40594
|
+
} catch {
|
|
40595
|
+
return null;
|
|
40596
|
+
}
|
|
40597
|
+
}
|
|
40598
|
+
async function lookupByEmail(supabase, email3) {
|
|
40599
|
+
const { data } = await supabase.from("users").select("id, email, full_name, job_title").eq("email", email3).limit(1).single();
|
|
40600
|
+
if (!data) return null;
|
|
40601
|
+
return { id: data.id, email: data.email, fullName: data.full_name, jobTitle: data.job_title || "member" };
|
|
40602
|
+
}
|
|
40603
|
+
|
|
40536
40604
|
// tools/features.ts
|
|
40537
40605
|
async function handleFeatures(params) {
|
|
40538
40606
|
const supabase = getAdminClient();
|
|
@@ -40540,7 +40608,16 @@ async function handleFeatures(params) {
|
|
|
40540
40608
|
switch (action) {
|
|
40541
40609
|
case "list": {
|
|
40542
40610
|
let query = supabase.from("features").select("*").order("week_start", { ascending: false });
|
|
40543
|
-
if (params.podId)
|
|
40611
|
+
if (params.podId) {
|
|
40612
|
+
query = query.eq("pod_id", params.podId);
|
|
40613
|
+
} else {
|
|
40614
|
+
const currentUser = await getCurrentUser();
|
|
40615
|
+
if (currentUser) {
|
|
40616
|
+
const { data: memberships } = await supabase.from("pod_members").select("pod_id").eq("user_id", currentUser.id);
|
|
40617
|
+
const myPodIds = (memberships || []).map((m) => m.pod_id);
|
|
40618
|
+
if (myPodIds.length > 0) query = query.in("pod_id", myPodIds);
|
|
40619
|
+
}
|
|
40620
|
+
}
|
|
40544
40621
|
if (params.projectName) query = query.eq("project_name", params.projectName);
|
|
40545
40622
|
if (params.weekStart) query = query.eq("week_start", params.weekStart);
|
|
40546
40623
|
if (params.status) query = query.eq("status", params.status);
|
|
@@ -42067,9 +42144,9 @@ var multipartFormRequestOptions = async (opts, fetch2, stripFilenames = true) =>
|
|
|
42067
42144
|
var supportsFormDataMap = /* @__PURE__ */ new WeakMap();
|
|
42068
42145
|
function supportsFormData(fetchObject) {
|
|
42069
42146
|
const fetch2 = typeof fetchObject === "function" ? fetchObject : fetchObject.fetch;
|
|
42070
|
-
const
|
|
42071
|
-
if (
|
|
42072
|
-
return
|
|
42147
|
+
const cached3 = supportsFormDataMap.get(fetch2);
|
|
42148
|
+
if (cached3)
|
|
42149
|
+
return cached3;
|
|
42073
42150
|
const promise2 = (async () => {
|
|
42074
42151
|
try {
|
|
42075
42152
|
const FetchResponse = "Response" in fetch2 ? fetch2.Response : (await fetch2("data:,")).constructor;
|
|
@@ -47392,7 +47469,8 @@ function formatWeekStart(date4) {
|
|
|
47392
47469
|
}
|
|
47393
47470
|
async function handleBriefing(params) {
|
|
47394
47471
|
const supabase = getAdminClient();
|
|
47395
|
-
const
|
|
47472
|
+
const currentUser = await getCurrentUser();
|
|
47473
|
+
const jobTitle = params.jobTitle || currentUser?.jobTitle || "engineer";
|
|
47396
47474
|
const podIds = params.podIds;
|
|
47397
47475
|
const now = /* @__PURE__ */ new Date();
|
|
47398
47476
|
const thisWeekStart = getWeekStart(now);
|
|
@@ -47679,6 +47757,8 @@ server.tool(
|
|
|
47679
47757
|
async function main() {
|
|
47680
47758
|
const transport = new StdioServerTransport();
|
|
47681
47759
|
await server.connect(transport);
|
|
47760
|
+
getCurrentUser().catch(() => {
|
|
47761
|
+
});
|
|
47682
47762
|
console.error("Pulse MCP server running");
|
|
47683
47763
|
}
|
|
47684
47764
|
main().catch((e) => {
|