@productbrain/mcp 0.0.1-beta.7984 → 0.0.1-beta.7996

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.
@@ -39,7 +39,7 @@ import {
39
39
  trackQualityVerdict,
40
40
  trackSessionCaptureRate,
41
41
  trackZeroCaptureAuditFired
42
- } from "./chunk-SLQ5XKT5.js";
42
+ } from "./chunk-N6HO6ETW.js";
43
43
 
44
44
  // src/server.ts
45
45
  import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -1024,19 +1024,11 @@ async function captureVersionOrPreview(preview, params) {
1024
1024
  return preview ? buildVersionPreviewResult(params.groundingEntry, params.name) : runVersionCapture(params);
1025
1025
  }
1026
1026
 
1027
- // src/lib/formatFieldGuidance.ts
1028
- function formatFieldGuidance(fields) {
1029
- const guidedFields = fields.filter((f) => f.writingGuidance);
1030
- if (guidedFields.length === 0) return "";
1031
- const lines = ["## Writing Guidance"];
1032
- for (const field of guidedFields) {
1033
- const displayName2 = field.label || field.key;
1034
- lines.push(`- ${displayName2}: ${field.writingGuidance}`);
1035
- if (field.writingExamples && field.writingExamples.length > 0) {
1036
- lines.push(` Examples: ${field.writingExamples.join(" | ")}`);
1037
- }
1038
- }
1039
- return lines.join("\n");
1027
+ // src/lib/bodyTemplate.ts
1028
+ function readBodyTemplateGuidance(bodyTemplate) {
1029
+ if (!bodyTemplate || bodyTemplate.length === 0) return void 0;
1030
+ return bodyTemplate.map((entry) => `## ${entry.heading}
1031
+ ${entry.guidance}`).join("\n\n");
1040
1032
  }
1041
1033
 
1042
1034
  // src/lib/inferSourceDate.ts
@@ -2535,14 +2527,13 @@ Use \`entries action=get\` to inspect the existing entry, or \`entries action=up
2535
2527
  lines.push(`_Grounding: ${parts.join(", ")}. Review and link if relevant._`);
2536
2528
  }
2537
2529
  }
2538
- const fieldGuidanceSection = formatFieldGuidance(col.fields ?? []);
2539
- if (fieldGuidanceSection) {
2530
+ const bodyGuidance = readBodyTemplateGuidance(col.bodyTemplate);
2531
+ if (bodyGuidance) {
2540
2532
  lines.push("");
2541
- lines.push(fieldGuidanceSection);
2542
- const guidedFieldCount = (col.fields ?? []).filter((f) => f.writingGuidance).length;
2533
+ lines.push(bodyGuidance);
2543
2534
  trackFieldGuidanceApplied(wsCtx.workspaceId, {
2544
2535
  collection: resolvedCollection,
2545
- guided_field_count: guidedFieldCount
2536
+ guided_heading_count: col.bodyTemplate?.length ?? 0
2546
2537
  });
2547
2538
  }
2548
2539
  if (formativeHints.length > 0) {
@@ -2665,10 +2656,9 @@ Use \`entries action=get\` to inspect the existing entry, or \`entries action=up
2665
2656
  allFields: (col.fields ?? []).map((f) => ({
2666
2657
  key: f.key,
2667
2658
  required: f.required === true,
2668
- type: f.type,
2669
- ...f.helpText ? { helpText: f.helpText } : {}
2659
+ type: f.type
2670
2660
  })),
2671
- ...col.captureExpectation ? { captureExpectation: col.captureExpectation } : {}
2661
+ ...bodyGuidance ? { guidance: bodyGuidance } : {}
2672
2662
  };
2673
2663
  const totalMs = Date.now() - timingStart;
2674
2664
  const timing = {
@@ -6360,7 +6350,7 @@ var fieldSchema = z17.object({
6360
6350
  colorMap: z17.record(z17.string().max(50)).optional().describe("V2 value-to-semantic-color mapping, e.g. { critical: 'danger', low: 'success' }"),
6361
6351
  accentSource: z17.boolean().optional().describe("When true, this field's colorMap value drives the card-level accent styling"),
6362
6352
  iconMap: z17.record(z17.string(), z17.string().max(50)).optional().describe("Maps field values to icons (emoji/symbol), prepended to badge text"),
6363
- helpText: z17.string().max(2e3).optional().describe("Help text shown in editors and describe output"),
6353
+ helpText: z17.string().max(2e3).optional().describe("Help text shown in admin field editors"),
6364
6354
  optionDescriptions: z17.record(z17.string().max(500)).optional().describe("Per-option guidance for select fields"),
6365
6355
  semanticRole: z17.enum(["problem", "appetite", "elements", "architecture", "done_when", "risks", "exclusions"]).optional().describe("Semantic role for schema-driven consumers \u2014 enables field-key-independent validation and rendering"),
6366
6356
  maxLength: z17.number().optional().describe("Maximum character length for field values. Three-tier resolution: explicit > displayHint > type fallback."),
@@ -6537,17 +6527,14 @@ async function handleDescribe(slug) {
6537
6527
  col.stratum ? `**Stratum:** ${col.stratum}` : null
6538
6528
  ].filter(Boolean).join(" \xB7 ");
6539
6529
  if (meta) sections.push(meta);
6540
- if (col.usageGuidance) {
6541
- sections.push(`
6530
+ if (col.usageGuidance) sections.push(`
6542
6531
  ## When to Use
6543
6532
 
6544
6533
  ${col.usageGuidance}`);
6545
- } else if (col.purpose) {
6546
- sections.push(`
6534
+ else if (col.purpose) sections.push(`
6547
6535
  ## Purpose
6548
6536
 
6549
6537
  ${col.purpose}`);
6550
- }
6551
6538
  if (col.validWorkflowStatuses && col.validWorkflowStatuses.length > 0) {
6552
6539
  sections.push(
6553
6540
  `
@@ -6563,12 +6550,14 @@ ${col.validWorkflowStatuses.map((s) => `- ${s}`).join("\n")}`
6563
6550
 
6564
6551
  ${col.statusList.map((s) => `- \`${s.label}\` \u2192 ${s.category}${s.archiveDefault ? " (archiveDefault)" : ""}`).join("\n")}`);
6565
6552
  }
6553
+ const bodyGuidance = readBodyTemplateGuidance(col.bodyTemplate);
6554
+ if (bodyGuidance) sections.push(`
6555
+ ${bodyGuidance}`);
6566
6556
  if (col.fields.length > 0) {
6567
6557
  const fieldDocs = col.fields.map((f) => {
6568
6558
  const parts = [];
6569
6559
  const typeInfo = `${f.type}${f.required ? ", required" : ""}`;
6570
6560
  parts.push(`### \`${f.key}\` \u2014 ${f.label ?? f.key} (${typeInfo})`);
6571
- if (f.helpText) parts.push(f.helpText);
6572
6561
  if (f.options && f.options.length > 0) {
6573
6562
  const optLines = f.options.map((opt) => {
6574
6563
  const desc = f.optionDescriptions?.[opt];
@@ -6619,10 +6608,11 @@ ${refList}`);
6619
6608
  key: f.key,
6620
6609
  type: f.type,
6621
6610
  required: f.required,
6622
- helpText: f.helpText ?? null,
6623
6611
  options: f.options ?? null,
6624
6612
  optionDescriptions: f.optionDescriptions ?? null
6625
6613
  })),
6614
+ bodyTemplate: col.bodyTemplate ?? null,
6615
+ // TASK-375: replaces the deleted per-field helpText above
6626
6616
  examples: col.examples ?? [],
6627
6617
  crossReferences: col.crossReferences ?? []
6628
6618
  }
@@ -13871,8 +13861,9 @@ function formatOutcomeShow(result2) {
13871
13861
  const o = result2.outcome;
13872
13862
  const unit = o.unit ? ` ${sanitizeSingleLineField(o.unit)}` : "";
13873
13863
  const lines = [
13864
+ // N2 (TASK-367): the metric line is retired — the entry's own name (above) already states
13865
+ // what is measured — mirrors packages/cli/src/commands/outcome.ts text-for-text.
13874
13866
  `${sanitizeSingleLineField(result2.entryId)} \u2014 ${sanitizeSingleLineField(result2.name)}`,
13875
- ` metric ${o.metric ? sanitizeSingleLineField(o.metric) : "not set"}`,
13876
13867
  ` current ${o.current ? `${o.current.value}${unit}` : "no readings yet"} (${o.readingCount} reading(s))`,
13877
13868
  ` progress ${pct(o.progressPct)} direction ${o.direction}`,
13878
13869
  ` pace ${pct(o.pacePct)} ${o.pacePct === void 0 ? "(no cycle end set)" : o.pacePct >= 0 ? "(ahead of pace)" : "(behind pace)"}`,
@@ -14528,7 +14519,7 @@ ${entry.labels.map((l) => `- ${l.name ?? l.slug}`).join("\n")}`);
14528
14519
  collectionSlug,
14529
14520
  requiredFields: contract.requiredFields,
14530
14521
  allFields: contract.allFields,
14531
- captureExpectation: contract.captureExpectation
14522
+ guidance: contract.guidance
14532
14523
  };
14533
14524
  return {
14534
14525
  contents: [{
@@ -14868,4 +14859,4 @@ export {
14868
14859
  createProductBrainServer,
14869
14860
  initFeatureFlags
14870
14861
  };
14871
- //# sourceMappingURL=chunk-3NICJHNZ.js.map
14862
+ //# sourceMappingURL=chunk-3VQ5VSBH.js.map