@productbrain/mcp 0.0.1-beta.1419 → 0.0.1-beta.1428
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.
|
@@ -4754,7 +4754,8 @@ _This helps future sessions start with better constraints and context._`
|
|
|
4754
4754
|
const scoreLabel = typeof entry.score === "number" ? ` ${entry.score}` : "";
|
|
4755
4755
|
const flagsLabel = entry.scoreFlags?.length ? ` [${entry.scoreFlags.join(", ")}]` : "";
|
|
4756
4756
|
const originLabel = entry.origin ? ` (origin: ${entry.origin})` : "";
|
|
4757
|
-
|
|
4757
|
+
const tierLabel = entry.tier === 1 ? " `[direct]`" : entry.tier === 2 ? " `[domain]`" : entry.tier === 3 ? " `[org]`" : "";
|
|
4758
|
+
lines2.push(`- ${id}${entry.name}${tierLabel}${scoreLabel}${flagsLabel}${originLabel}`);
|
|
4758
4759
|
if (entry.preview) lines2.push(` _${entry.preview}_`);
|
|
4759
4760
|
}
|
|
4760
4761
|
};
|
|
@@ -10116,14 +10117,10 @@ function extractKeywords(text) {
|
|
|
10116
10117
|
}
|
|
10117
10118
|
return [...new Set(tokens.filter((w) => w.length > 2))];
|
|
10118
10119
|
}
|
|
10119
|
-
function scoreEntry(entry, keywords) {
|
|
10120
|
-
const text = `${entry.name} ${entry.description ?? ""}`.toLowerCase();
|
|
10121
|
-
return keywords.filter((kw) => text.includes(kw)).length;
|
|
10122
|
-
}
|
|
10123
10120
|
function formatGovernanceEntry(entry) {
|
|
10124
10121
|
const id = entry.entryId ?? entry.name;
|
|
10125
10122
|
const desc = entry.description ? ` \u2014 ${entry.description.slice(0, 120)}${entry.description.length > 120 ? "..." : ""}` : "";
|
|
10126
|
-
const tierLabel = entry.tier === 1 ? " `[direct]`" : entry.tier === 2 ? " `[domain]`" : "";
|
|
10123
|
+
const tierLabel = entry.tier === 1 ? " `[direct]`" : entry.tier === 2 ? " `[domain]`" : entry.tier === 3 ? " `[org]`" : "";
|
|
10127
10124
|
const mark = provenanceMark(entry.provenance);
|
|
10128
10125
|
const anchorSuffix = entry.anchoredBy ? ` (${entry.anchoredBy})` : "";
|
|
10129
10126
|
return `- ${mark}**[${id}]** ${entry.name}${anchorSuffix}${tierLabel}${desc}`;
|
|
@@ -10151,20 +10148,15 @@ function buildOperatingProtocol(governanceOrStandards, task) {
|
|
|
10151
10148
|
{ header: "**Active standards:**", entries: standards }
|
|
10152
10149
|
];
|
|
10153
10150
|
if (task) {
|
|
10154
|
-
const hasTiers = types.some((t) => t.entries.some((e) => e.tier !== void 0));
|
|
10155
|
-
const keywords = hasTiers ? [] : extractKeywords(task);
|
|
10156
10151
|
let shownCount = 0;
|
|
10157
10152
|
let totalGovernance = 0;
|
|
10153
|
+
let anyTierRanking = false;
|
|
10158
10154
|
for (const type of types) {
|
|
10159
10155
|
if (type.entries.length === 0) continue;
|
|
10160
10156
|
totalGovernance += type.entries.length;
|
|
10161
|
-
|
|
10162
|
-
if (
|
|
10163
|
-
|
|
10164
|
-
} else {
|
|
10165
|
-
const scored = type.entries.map((e) => ({ entry: e, score: scoreEntry(e, keywords) })).filter((s) => s.score > 0).sort((a, b) => b.score - a.score);
|
|
10166
|
-
sorted = scored.length > 0 ? scored.map((s) => s.entry) : type.entries.slice(0, MAX_ENTRIES_NO_TASK);
|
|
10167
|
-
}
|
|
10157
|
+
const bucketHasTiers = type.entries.some((e) => e.tier !== void 0);
|
|
10158
|
+
if (bucketHasTiers) anyTierRanking = true;
|
|
10159
|
+
const sorted = bucketHasTiers ? [...type.entries].sort((a, b) => (a.tier ?? 99) - (b.tier ?? 99)) : [...type.entries];
|
|
10168
10160
|
const capped = sorted.slice(0, MAX_ENTRIES_WITH_TASK);
|
|
10169
10161
|
if (capped.length > 0) {
|
|
10170
10162
|
shownCount += capped.length;
|
|
@@ -10175,7 +10167,7 @@ function buildOperatingProtocol(governanceOrStandards, task) {
|
|
|
10175
10167
|
lines.push("");
|
|
10176
10168
|
}
|
|
10177
10169
|
}
|
|
10178
|
-
const filterNote =
|
|
10170
|
+
const filterNote = anyTierRanking ? "ranked by relevance" : "in listing order";
|
|
10179
10171
|
lines.push(
|
|
10180
10172
|
`_${shownCount} of ${totalGovernance} governance entries shown, ${filterNote}._`
|
|
10181
10173
|
);
|
|
@@ -14484,4 +14476,4 @@ export {
|
|
|
14484
14476
|
createProductBrainServer,
|
|
14485
14477
|
initFeatureFlags
|
|
14486
14478
|
};
|
|
14487
|
-
//# sourceMappingURL=chunk-
|
|
14479
|
+
//# sourceMappingURL=chunk-LIOYSWBH.js.map
|