@productbrain/mcp 0.0.1-beta.9197 → 0.0.1-beta.9201
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.
|
@@ -3329,6 +3329,35 @@ ${recovery}`,
|
|
|
3329
3329
|
}
|
|
3330
3330
|
}
|
|
3331
3331
|
|
|
3332
|
+
// src/lib/platformGlossary.ts
|
|
3333
|
+
var PLATFORM_GLOSSARY_TERMS = [
|
|
3334
|
+
{ name: "Team", definition: "A group of people and agents working toward one purpose; its roles own its decisions, rules and work." },
|
|
3335
|
+
{ name: "Team Lead", definition: "The role accountable for a team's purpose; it decides anything that belongs to a role nobody holds." },
|
|
3336
|
+
{ name: "Role", definition: "A named set of responsibilities a person holds; whoever sits in it decides and accepts the entries it owns." },
|
|
3337
|
+
{ name: "Tension", definition: "A gap someone notices between how things are and how they should be; linking one to an entry is how you say you disagree with it." }
|
|
3338
|
+
];
|
|
3339
|
+
function matchPlatformGlossaryTerms(query) {
|
|
3340
|
+
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
3341
|
+
if (query.trim().length < 2 || words.length === 0) return [];
|
|
3342
|
+
return PLATFORM_GLOSSARY_TERMS.filter((term) => {
|
|
3343
|
+
const name = term.name.toLowerCase();
|
|
3344
|
+
return words.every((word) => name.includes(word));
|
|
3345
|
+
});
|
|
3346
|
+
}
|
|
3347
|
+
|
|
3348
|
+
// src/tools/platformGlossarySearch.ts
|
|
3349
|
+
function platformGlossarySearch(query, collection, status2) {
|
|
3350
|
+
const statusFiltered = Array.isArray(status2) ? status2.length > 0 : !!status2;
|
|
3351
|
+
const terms = !statusFiltered && (!collection || collection === "glossary") ? matchPlatformGlossaryTerms(query) : [];
|
|
3352
|
+
return {
|
|
3353
|
+
count: terms.length,
|
|
3354
|
+
lines: terms.map((t) => `- **${t.name}** (platform term) [glossary]
|
|
3355
|
+
${t.definition}`),
|
|
3356
|
+
structured: terms.map((t) => ({ entryId: null, name: t.name, collection: "glossary", definition: t.definition })),
|
|
3357
|
+
summaryLabel: terms.length ? `${terms.length} platform glossary` : ""
|
|
3358
|
+
};
|
|
3359
|
+
}
|
|
3360
|
+
|
|
3332
3361
|
// src/tools/entriesContract.ts
|
|
3333
3362
|
import { z as z10 } from "zod/v3";
|
|
3334
3363
|
var ENTRIES_ACTIONS = [
|
|
@@ -3910,7 +3939,9 @@ async function handleSearch(server, query, collection, status2) {
|
|
|
3910
3939
|
kernelQuery("chain.searchEntries", { query, collectionSlug: collection, status: status2 }),
|
|
3911
3940
|
kernelQuery("chain.listCollections")
|
|
3912
3941
|
]);
|
|
3913
|
-
|
|
3942
|
+
const platform = platformGlossarySearch(query, collection, status2);
|
|
3943
|
+
const matches = results.length + platform.count;
|
|
3944
|
+
if (matches === 0) {
|
|
3914
3945
|
const recorded = recordGap({ query, tool: "entries", action: "search", gapType: "search_zero", collectionScope: collection });
|
|
3915
3946
|
if (recorded) {
|
|
3916
3947
|
getWorkspaceId().then((wsId) => trackKnowledgeGap(wsId, { query, tool: "entries", action: "search", gap_type: "search_zero", collection_scope: collection })).catch(() => {
|
|
@@ -3937,6 +3968,7 @@ async function handleSearch(server, query, collection, status2) {
|
|
|
3937
3968
|
const slug = collMap.get(e.collectionId) ?? "unknown";
|
|
3938
3969
|
countsBySlug.set(slug, (countsBySlug.get(slug) ?? 0) + 1);
|
|
3939
3970
|
}
|
|
3971
|
+
if (platform.count) countsBySlug.set("platform glossary", platform.count);
|
|
3940
3972
|
const collSummary = [...countsBySlug.entries()].sort((a, b) => b[1] - a[1]).map(([slug, count]) => `${count} ${slug}`).join(", ");
|
|
3941
3973
|
const formatted = results.map((e) => {
|
|
3942
3974
|
const id = e.entryId ? `**${e.entryId}:** ` : "";
|
|
@@ -3950,7 +3982,7 @@ async function handleSearch(server, query, collection, status2) {
|
|
|
3950
3982
|
}).join("\n");
|
|
3951
3983
|
const header = `## Search Result
|
|
3952
3984
|
|
|
3953
|
-
# Search Results for "${query}"${scope} (${
|
|
3985
|
+
# Search Results for "${query}"${scope} (${matches} match${matches === 1 ? "" : "es"})
|
|
3954
3986
|
|
|
3955
3987
|
**By collection:** ${collSummary}`;
|
|
3956
3988
|
const footer = `_Tip: Use \`collection\` param to scope search. Use entries action=get with an entry ID for full details._`;
|
|
@@ -3972,10 +4004,11 @@ async function handleSearch(server, query, collection, status2) {
|
|
|
3972
4004
|
return {
|
|
3973
4005
|
content: [{ type: "text", text: `${header}
|
|
3974
4006
|
|
|
3975
|
-
${formatted}
|
|
4007
|
+
${[...platform.lines, formatted].filter(Boolean).join("\n")}
|
|
3976
4008
|
|
|
3977
4009
|
${footer}` }],
|
|
3978
|
-
structuredContent: success(`Found ${total} entries matching '${query}'.`, {
|
|
4010
|
+
structuredContent: success(`Found ${total} entries${platform.count ? ` and ${platform.count} platform glossary terms` : ""} matching '${query}'.`, {
|
|
4011
|
+
platformTerms: platform.structured,
|
|
3979
4012
|
results: structuredResults,
|
|
3980
4013
|
entries: entriesForView,
|
|
3981
4014
|
total,
|
|
@@ -5112,8 +5145,7 @@ async function handleBuild(server, entryId, maxHops) {
|
|
|
5112
5145
|
if (glossaryTerms.length > 0) {
|
|
5113
5146
|
lines.push("## Glossary Terms");
|
|
5114
5147
|
for (const t of glossaryTerms.slice(0, 15)) {
|
|
5115
|
-
|
|
5116
|
-
lines.push(`- **${id}:** ${t.name}`);
|
|
5148
|
+
lines.push(t.platform ? `- **${t.name}** (platform term)` : `- **${t.entryId ?? t.name}:** ${t.name}`);
|
|
5117
5149
|
if (t.definition) lines.push(` ${t.definition.slice(0, 120)}${t.definition.length > 120 ? "..." : ""}`);
|
|
5118
5150
|
}
|
|
5119
5151
|
if (glossaryTerms.length > 15) lines.push(` _...and ${glossaryTerms.length - 15} more_`);
|
|
@@ -13051,18 +13083,21 @@ async function buildTerminologyResourceText() {
|
|
|
13051
13083
|
kernelQuery("chain.listEntries", { collectionSlug: "standards" })
|
|
13052
13084
|
]);
|
|
13053
13085
|
const lines = ["# Product Brain \u2014 Terminology"];
|
|
13086
|
+
const platformTerms = PLATFORM_GLOSSARY_TERMS.map((t) => `- **${t.name}** (platform term): ${t.definition}`).join("\n");
|
|
13054
13087
|
if (glossaryResult.status === "fulfilled") {
|
|
13055
13088
|
const glossary = glossaryResult.value ?? [];
|
|
13056
|
-
|
|
13057
|
-
|
|
13058
|
-
lines.push(`## Glossary (${glossary.length} terms)
|
|
13089
|
+
const teamTerms = glossary.length > 0 ? glossary.map((t) => `- **${t.name}** (${t.entryId ?? "\u2014"}) [${t.status}]: ${readEntryBody(t.data, "canonical") ?? readEntryBody(t.data, "description") ?? ""}`).join("\n") : "This team has no terms of its own yet. Use `capture` with collection `glossary` to add one.";
|
|
13090
|
+
lines.push(`## Glossary (${PLATFORM_GLOSSARY_TERMS.length} platform terms, ${glossary.length} of this team's)
|
|
13059
13091
|
|
|
13060
|
-
${
|
|
13061
|
-
|
|
13062
|
-
|
|
13063
|
-
}
|
|
13092
|
+
${platformTerms}
|
|
13093
|
+
|
|
13094
|
+
${teamTerms}`);
|
|
13064
13095
|
} else {
|
|
13065
|
-
lines.push(
|
|
13096
|
+
lines.push(`## Glossary
|
|
13097
|
+
|
|
13098
|
+
${platformTerms}
|
|
13099
|
+
|
|
13100
|
+
Could not load this team's terms \u2014 use \`entries action=list collection=glossary\` to browse manually.`);
|
|
13066
13101
|
}
|
|
13067
13102
|
if (standardsResult.status === "fulfilled") {
|
|
13068
13103
|
const standards = standardsResult.value ?? [];
|
|
@@ -13708,4 +13743,4 @@ export {
|
|
|
13708
13743
|
createProductBrainServer,
|
|
13709
13744
|
initFeatureFlags
|
|
13710
13745
|
};
|
|
13711
|
-
//# sourceMappingURL=chunk-
|
|
13746
|
+
//# sourceMappingURL=chunk-GYOYJTDC.js.map
|