MCPcopy Index your code
hub / github.com/callstack/agent-device / buildSnapshotNotices

Function buildSnapshotNotices

src/utils/output.ts:619–641  ·  view source on GitHub ↗
(
  data: Record<string, unknown>,
  nodes: SnapshotNode[],
  options: SnapshotTextOptions,
  helperPresentation: AndroidHelperPresentationInput = { nodes, filteredCount: 0 },
)

Source from the content-addressed store, hash-verified

617}
618
619function buildSnapshotNotices(
620 data: Record<string, unknown>,
621 nodes: SnapshotNode[],
622 options: SnapshotTextOptions,
623 helperPresentation: AndroidHelperPresentationInput = { nodes, filteredCount: 0 },
624): string[] {
625 const notices = readSnapshotWarnings(data);
626 // The structured snapshot quality verdict already carries a sharper version of this hint.
627 if (shouldRenderLegacySparseSnapshotHint(data)) {
628 const sparseSnapshotHint = formatSparseSnapshotHint(nodes, options);
629 if (sparseSnapshotHint) notices.push(sparseSnapshotHint);
630 }
631 if (!options.raw && helperPresentation.filteredCount > 0) {
632 notices.push(
633 `Collapsed ${helperPresentation.filteredCount} Android helper node${helperPresentation.filteredCount === 1 ? '' : 's'} from the agent-facing text snapshot; use --raw or --json for the full hierarchy.`,
634 );
635 }
636 const repeatedNavNodes = helperPresentation.filteredCount > 0 ? helperPresentation.nodes : nodes;
637 if (!options.raw && detectPossibleRepeatedNavSubtree(repeatedNavNodes)) {
638 notices.push('Warning: possible repeated nav subtree detected.');
639 }
640 return notices;
641}
642
643function shouldRenderLegacySparseSnapshotHint(data: Record<string, unknown>): boolean {
644 return !data.snapshotQuality && !isWebSnapshotData(data);

Callers 1

formatSnapshotTextFunction · 0.85

Calls 5

readSnapshotWarningsFunction · 0.85
formatSparseSnapshotHintFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected